You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#### Version 2.3.2
- Removed fixed point calculations as the speed benefit was very minimal.
- Prevent integral windup if output exceeds limits.
- Added the following new functions that return the P, I and D terms of the calculation.
```c++
float GetPeTerm(); // proportional on error component of output
float GetPmTerm(); // proportional on measurement component of output
float GetIterm(); // integral component of output
float GetDterm(); // derivative component of output
```
####
QuickPID is a fast fixed/floating point implementation of the Arduino PID library with built-in [AutoTune](https://github.com/Dlloydev/QuickPID/wiki/AutoTune) class as a dynamic object to reduce memory if not used, thanks to contributions by [gnalbandian (Gonzalo)](https://github.com/gnalbandian). This controller can automatically determine and set parameters `Kp, Ki, Kd`. Additionally the Ultimate Gain `Ku`, Ultimate Period `Tu`, Dead Time `td` and determine how easy the process is to control. There are 10 tuning rules available to choose from. Also available is a POn setting that controls the mix of Proportional on Error to Proportional on Measurement.
4
-
5
-
### About
6
-
7
-
This PID controller provides a shortened *read-compute-write* cycle by taking advantage of fixed point math and using a fast analog read function.
3
+
QuickPID is an updated implementation of the Arduino PID library with a built-in [AutoTune](https://github.com/Dlloydev/QuickPID/wiki/AutoTune) class as a dynamic object to reduce memory if not used, thanks to contributions by [gnalbandian (Gonzalo)](https://github.com/gnalbandian). This controller can automatically determine and set parameters `Kp, Ki, Kd`. Additionally the Ultimate Gain `Ku`, Ultimate Period `Tu`, Dead Time `td` and determine how easy the process is to control. There are 10 tuning rules available to choose from. Also available is a POn setting that controls the mix of Proportional on Error to Proportional on Measurement.
8
4
9
5
### Features
10
6
@@ -18,7 +14,7 @@ This example allows you to experiment with the AutoTunePID class, various tuning
18
14
19
15
### Direct and Reverse Controller Action
20
16
21
-
If a positive error increases the controller's output, the controller is said to be direct acting (i.e. heating process). When a positive error decreases the controller's output, the controller is said to be reverse acting (i.e. cooling process). When the controller is set to `REVERSE` acting, the sign of the `error` and `dInput` (derivative of Input) is internally changed. All operating ranges and limits remain the same. To simulate a `REVERSE` acting process from a process that's `DIRECT` acting, the Input value needs to be "flipped". That is, if your reading from a 10-bit ADC with 0-1023 range, the input value used is (1023 - reading). See the examples `AutoTune_Filter_DIRECT.ino` and `AutoTune_Filter_REVERSE.ino` for details.
17
+
If a positive error increases the controller's output, the controller is said to be direct acting (i.e. heating process). When a positive error decreases the controller's output, the controller is said to be reverse acting (i.e. cooling process). When the controller is set to `REVERSE` acting, the sign of the `error` and `dInput` (derivative of Input) is internally changed. All operating ranges and limits remain the same. To simulate a `REVERSE` acting process from a process that's `DIRECT` acting, the Input value needs to be "flipped". That is, if your reading from a 10-bit ADC with 0-1023 range, the input value used is (1023 - reading). See the examples [AutoTune_Filter_DIRECT.ino](https://github.com/Dlloydev/QuickPID/blob/master/examples/AutoTune_Filter_DIRECT/AutoTune_Filter_DIRECT.ino) and [AutoTune_Filter_REVERSE.ino](https://github.com/Dlloydev/QuickPID/blob/master/examples/AutoTune_Filter_REVERSE/AutoTune_Filter_REVERSE.ino) for details.
- `Input`, `Output`, and `Setpoint` are pointers to the variables holding these values.
33
29
- `Kp`, `Ki`, and `Kd` are the PID proportional, integral, and derivative gains.
34
-
- `POn` is the Proportional on Error weighting value (0.0-1.0). This controls the mix of Proportional on Error (PonE) and Proportional on Measurement (PonM) that's used in the compute algorithm. Note that POn controls the PonE amount, where the remainder (1-PonE) is the PonM amount. Also, the default POn is 1
30
+
- `POn` is the Proportional on Error weighting value with range 0.0-1.0 and default 1.0 (100% Proportional on Error). This controls the mix of Proportional on Error to Proportional on Measurement.
The PID will either be connected to a DIRECT acting process (+Output leads to +Input) or a REVERSE acting process (+Output leads to -Input.) We need to know which one, because otherwise we may increase the output when we should be decreasing. This is called from the constructor.
112
108
113
-
#### Display_Functions
109
+
#### PID Query Functions
114
110
115
111
```c++
116
-
float QuickPID::GetKp();
117
-
float QuickPID::GetKi();
118
-
float QuickPID::GetKd();
119
-
float QuickPID::GetKu();
120
-
float QuickPID::GetTu();
121
-
float QuickPID::GetTd();
122
-
uint8_t QuickPID::GetMode();
123
-
uint8_t QuickPID::GetDirection();
112
+
float GetKp(); // proportional gain
113
+
float GetKi(); // integral gain
114
+
float GetKd(); // derivative gain
115
+
float GetPeTerm(); // proportional on error component of output
116
+
float GetPmTerm(); // proportional on measurement component of output
117
+
float GetIterm(); // integral component of output
118
+
float GetDterm(); // derivative component of output
119
+
mode_t GetMode(); // MANUAL (0) or AUTOMATIC (1)
120
+
direction_t GetDirection(); // DIRECT (0) or REVERSE (1)
124
121
```
125
122
126
-
These functions query the internal state of the PID. They're here for display purposes.
123
+
These functions query the internal state of the PID.
127
124
128
-
#### Utility_Functions
125
+
#### Utility Functions
129
126
130
127
```c++
131
128
intQuickPID::analogReadFast(int ADCpin)
@@ -137,76 +134,20 @@ A faster configuration of `analogRead()`where a preset of 32 is used. If the ar
137
134
138
135
Use this link for reference. Note that if you're using QuickPID, there's no need to install the AnalogWrite library as this feature is already included.
139
136
140
-
#### Change Log
141
-
142
-
#### Version 2.3.1
143
-
144
-
- Resolved `Kp` windup as noted in issue #6. Algorithm reverts to upstream library, but with fixed point math option and newer controller direction method maintained.
145
-
- Updated AutoTune examples and documentation.
146
-
- Default AutoTune `outputStep` value in examples (and documentation) is now 5.
147
-
148
-
#### Version 2.3.0
149
-
150
-
- New AutoTune class added as a dynamic object to reduce memory if not used, thanks to contributions by [gnalbandian (Gonzalo)](https://github.com/gnalbandian).
151
-
- AutoTune now works for a reverse acting controller.
152
-
- AutoTune configuration parameters include outputStep, hysteresis, setpoint, output, direction and printOrPlotter.
153
-
- Defined tuningMethod as an enum.
154
-
- Updated AnalogWrite methods for ESP32/ESP32-S2.
155
-
156
-
#### Version 2.2.8
157
-
158
-
- AutoTune is now independent of the QuickPID library and can be run from a sketch. AutoTune is now non-blocking, no timeouts are required and it uses Input and Output variables directly.
159
-
160
-
#### Version 2.2.7
161
-
162
-
- Fixed REVERSE acting controller mode.
163
-
- now using src folder for source code
164
-
- replaced defines with enumerated types and inline functions
165
-
166
-
#### Version 2.2.6
167
-
168
-
- Changed Input, Output and Setpoint parameters to float.
169
-
- Updated compatibility with the ESP32 AnalogWrite
Copy file name to clipboardExpand all lines: library.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
"keywords": "PID, controller, signal",
4
4
"description": "A fast fixed/floating point PID controller with AutoTune and 10 tuning rules to choose from. This controller can automatically determine and set tuning parameters. Compatible with most Arduino and ESP32 boards.",
0 commit comments