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
QuickPID is an updated implementation of the Arduino PID library with additional features for PID control. By default, this implementation closely follows the method of processing the p,i,d terms as in the PID_v1 library except for using a more advanced anti-windup mode. Integral anti-windup can be based on conditionally using PI terms to provide some integral correction, prevent deep saturation and reduce overshoot. Anti-windup can also be based on clamping only, or it can be turned completely off. Also, the proportional term can be based on error, measurement, or both. The derivative term can be based on error or measurement. PID controller modes include `timer`, which allows external timer or ISR timing control.
3
+
QuickPID is an updated implementation of the Arduino PID library with additional features for PID control. By default, this implementation closely follows the method of processing the p,i,d terms as in the PID_v1 library except for using a more advanced anti-windup mode. Integral anti-windup can be based on conditionally using PI terms to provide some integral correction, prevent deep saturation and reduce overshoot. Anti-windup can also be based on clamping only, or it can be turned completely off. Also, the proportional term can be based on error, measurement, or both. The derivative term can be based on error or measurement. PID controller modes include timer, which allows external timer or ISR timing control.
4
+
5
+
### Need Autotune?
6
+
7
+
###### Get [sTune](https://github.com/Dlloydev/sTune)[](https://www.ardu-badge.com/sTune)[](https://registry.platformio.org/packages/libraries/dlloydev/sTune)
8
+
9
+
A very fast autotuner that's capable of on-the-fly tunings. Example: [Autotune_QuickPID.ino](https://github.com/Dlloydev/QuickPID/blob/master/examples/Autotune_QuickPID/Autotune_QuickPID.ino)
4
10
5
11
### Features
6
12
@@ -15,14 +21,6 @@ Development began with a fork of the Arduino PID Library. Modifications and new
15
21
-[x] Derivative on error `dOnError` and measurement `dOnMeas` options
16
22
-[x] New PID Query Functions `GetPterm`, `GetIterm`, `GetDterm`, `GetPmode`, `GetDmode` and `GetAwMode`
17
23
-[x] New integral anti-windup options `iAwCondition`, `iAwClamp` and `iAwOff`
18
-
-[x] New `reverse` mode only changes sign of `error` and `dInput`
19
-
-[x] Uses `float` instead of `double`
20
-
21
-
#### Direct and Reverse Controller Action
22
-
23
-
Direct controller action leads the output to increase when the input is larger than the setpoint (i.e. heating process). Reverse controller leads the output to decrease when the input is larger than the setpoint (i.e. cooling process).
24
-
25
-
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).
26
24
27
25
### Functions
28
26
@@ -105,96 +103,3 @@ void SetDerivativeMode(dMode dMode); // Set the dTerm, based error or
105
103
void SetAntiWindupMode(iAwMode iAwMode); // Set iTerm anti-windup to iAwCondition, iAwClamp or iAwOff
106
104
```
107
105
108
-
#### SetMode
109
-
110
-
```c++
111
-
void QuickPID::SetMode(Control Mode);
112
-
```
113
-
114
-
Allows the controller Mode to be set to `manual` (0) (default) or `automatic` (1) or `timer` (2). when the transition from manual to automatic or timer occurs, the controller is automatically initialized. `timer` mode is used when the PID compute is called by an external timer function or ISR. In this mode, the timer function and `SetSampleTimeUs` use the same time period value. The PID compute and timer will always remain in sync because the sample time variable and calculations remain constant.
115
-
See examples: [PID_AVR_Basic_Interrupt_TIMER.ino](https://github.com/Dlloydev/QuickPID/blob/master/examples/PID_AVR_Basic_Interrupt_TIMER/PID_AVR_Basic_Interrupt_TIMER.ino) and [PID_AVR_Basic_Software_TIMER.ino](https://github.com/Dlloydev/QuickPID/blob/master/examples/PID_AVR_Basic_Software_TIMER/PID_AVR_Basic_Software_TIMER.ino)
This function allows the controller's dynamic performance to be adjusted. It's called automatically from the constructor, but tunings can also be adjusted on the fly during normal operation. The parameters are as described in the constructor.
133
-
134
-
```c++
135
-
voidQuickPID::SetTunings(float Kp, float Ki, float Kd);
136
-
```
137
-
138
-
Set Tunings using the last remembered `pMode`, `dMode` and `iAwMode` settings. See example [PID_AdaptiveTunings.ino](https://github.com/Dlloydev/QuickPID/blob/master/examples/PID_AdaptiveTunings/PID_AdaptiveTunings.ino)
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.
Sets the integral anti-windup mode to one of iAwClamp, which clamps the output after adding integral and proportional (on measurement) terms, or iAwCondition (default), which provides some integral correction, prevents deep saturation and reduces overshoot. Option iAwOff disables anti-windup altogether.
179
-
180
-
#### AnalogWrite (PWM and DAC) for ESP32
181
-
182
-
If you're using QuickPID with an ESP32 and need analogWrite compatibility, there's no need to install a library as this feature is already included. AnalogWrite [documentation](https://github.com/Dlloydev/ESP32-ESP32S2-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
@@ -1,7 +1,7 @@
1
1
{
2
2
"name": "QuickPID",
3
3
"version": "3.0.5",
4
-
"description": "A fast PID controller with Integral anti-windup, timer mode and multiple options for Proportional, Derivative and anti-windup modes of operation. Also includes analogWrite compatibility for ESP32 and ESP32-S2.",
4
+
"description": "A fast PID controller with timer mode and multiple options for Proportional, Derivative and Integral anti-windup modes of operation. Includes analogWrite compatibility for ESP32 and ESP32-S2.",
Copy file name to clipboardExpand all lines: library.properties
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -2,8 +2,8 @@ name=QuickPID
2
2
version=3.0.5
3
3
author=David Lloyd
4
4
maintainer=David Lloyd <dlloydev@testcor.ca>
5
-
sentence=A fast PID controller with Integral anti-windup, timer mode and multiple options for Proportional, Derivative and anti-windup modes of operation.
6
-
paragraph=Also includes analogWrite compatibility for ESP32 and ESP32-S2.
5
+
sentence=A fast PID controller with timer mode and multiple options for Proportional, Derivative and Integral anti-windup modes of operation.
6
+
paragraph=Includes analogWrite compatibility for ESP32 and ESP32-S2.
0 commit comments