Skip to content

Commit ea92f8a

Browse files
author
David Forrest
committed
Update to PID_1_bc
1 parent 41bc38c commit ea92f8a

File tree

9 files changed

+36
-20
lines changed

9 files changed

+36
-20
lines changed

PID_v1.cpp renamed to PID_v1_bc.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/**********************************************************************************************
2-
* Arduino PID Library - Version 1.2.1
3-
* by Brett Beauregard <[email protected]> brettbeauregard.com
2+
* Arduino PID Library with back calculation - Version 1.2.2
3+
* by David Forrest <[email protected]>
4+
* Brett Beauregard <[email protected]> brettbeauregard.com
45
*
56
* This Library is licensed under the MIT License
67
**********************************************************************************************/
@@ -11,7 +12,7 @@
1112
#include "WProgram.h"
1213
#endif
1314

14-
#include <PID_v1.h>
15+
#include <PID_v1_bc.h>
1516

1617
/*Constructor (...)*********************************************************
1718
* The parameters specified here are those for for which we can't set up

PID_v1.h renamed to PID_v1_bc.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#ifndef PID_v1_h
2-
#define PID_v1_h
3-
#define LIBRARY_VERSION 1.2.1
1+
#ifndef PID_v1_bc_h
2+
#define PID_v1_bc_h
3+
#define LIBRARY_VERSION 1.2.2
44

55
class PID
66
{

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
***************************************************************
2-
* Arduino PID Library - Version 1.2.1
2+
* Arduino PID Library - Version 1.2.2
3+
* by David Forrest <[email protected]> 2023-02-24
34
* by Brett Beauregard <[email protected]> brettbeauregard.com
45
*
56
* This Library is licensed under the MIT License
@@ -10,4 +11,15 @@
1011

1112
- For function documentation see: http://playground.arduino.cc/Code/PIDLibrary
1213

14+
1315
This fork uses back calculation per [Astrom 1989](http://cse.lab.imtlucca.it/~bemporad/teaching/controllodigitale/pdf/Astrom-ACC89.pdf) to manage integral windup.
16+
17+
The back calculation should prevent integral windup be dynamically limiting the Intergrato to precent the Control Output
18+
from exceeding the limits. Large errors far outside of the proportional range (error > MaxOutput/kP) will produce MaxOutput and
19+
inhibit integral growth.
20+
21+
See
22+
23+
* https://github.com/br3ttb/Arduino-PID-Library/pull/116 -- Pull request to the PID_v1 library
24+
* https://github.com/br3ttb/Arduino-PID-Library/issues/76#issuecomment-1445273655
25+

examples/PID_AdaptiveTunings/PID_AdaptiveTunings.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Parameters when we're farther away.
1010
********************************************************/
1111

12-
#include <PID_v1.h>
12+
#include <PID_v1_bc.h> // https://github.com/drf5n/Arduino-PID-Library
1313

1414
#define PIN_INPUT 0
1515
#define PIN_OUTPUT 3

examples/PID_Basic/PID_Basic.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Reading analog input 0 to control analog PWM output 3
44
********************************************************/
55

6-
#include <PID_v1.h>
6+
#include <PID_v1_bc.h> // https://github.com/drf5n/Arduino-PID-Library
77

88
#define PIN_INPUT 0
99
#define PIN_OUTPUT 3

examples/PID_PonM/PID_PonM.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* in certain processes like sous-vides.
77
********************************************************/
88

9-
#include <PID_v1.h>
9+
#include <PID_v1_bc.h> // https://github.com/drf5n/Arduino-PID-Library
1010

1111
//Define Variables we'll be connecting to
1212
double Setpoint, Input, Output;

examples/PID_RelayOutput/PID_RelayOutput.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* window being "Relay Off Time"
1515
********************************************************/
1616

17-
#include <PID_v1.h>
17+
#include <PID_v1_bc.h> // https://github.com/drf5n/Arduino-PID-Library
1818

1919
#define PIN_INPUT 0
2020
#define RELAY_PIN 6

library.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
{
2-
"name": "PID",
2+
"name": "PID_v1_bc",
33
"keywords": "PID, controller, signal",
44
"description": "A PID controller seeks to keep some input variable close to a desired setpoint by adjusting an output. The way in which it does this can be 'tuned' by adjusting three parameters (P,I,D).",
55
"url": "http://playground.arduino.cc/Code/PIDLibrary",
6-
"include": "PID_v1",
6+
"include": "PID_v1_bc",
77
"authors":
88
[
9+
{
10+
"name": "David Forrest"
11+
},
912
{
1013
"name": "Brett Beauregard"
1114
}
1215
],
1316
"repository":
1417
{
1518
"type": "git",
16-
"url": "https://github.com/br3ttb/Arduino-PID-Library.git"
19+
"url": "git@github.com:drf5n/Arduino-PID-Library.git"
1720
},
1821
"frameworks": "arduino"
1922
}

library.properties

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name=PID
2-
version=1.2.1
3-
author=Brett Beauregard
4-
maintainer=Brett Beauregard
5-
sentence=PID controller
1+
name=PID_v1_bc
2+
version=1.2.2
3+
author=David Forrest
4+
maintainer=David Forrest
5+
sentence=PID controller based on PID_v1 with back-calculation anti-windup
66
paragraph=A PID controller seeks to keep some input variable close to a desired setpoint by adjusting an output. The way in which it does this can be 'tuned' by adjusting three parameters (P,I,D).
77
category=Signal Input/Output
8-
url=http://playground.arduino.cc/Code/PIDLibrary
8+
url=https://github.com/drf5n/Arduino-PID-Library
99
architectures=*

0 commit comments

Comments
 (0)