Skip to content

Commit 5f774cc

Browse files
committed
Update
Update ReadMe
1 parent a082053 commit 5f774cc

3 files changed

Lines changed: 10 additions & 105 deletions

File tree

README.md

Lines changed: 7 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# QuickPID [![arduino-library-badge](https://www.ardu-badge.com/badge/QuickPID.svg?)](https://www.ardu-badge.com/QuickPID) [![PlatformIO Registry](https://badges.registry.platformio.org/packages/dlloydev/library/QuickPID.svg)](https://registry.platformio.org/packages/libraries/dlloydev/QuickPID)
22

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.
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) [![arduino-library-badge](https://camo.githubusercontent.com/2f6685943640fc03f25d1851ccbb5dbcd5963d9e3c26341c9f2b1c0f564c9016/68747470733a2f2f7777772e617264752d62616467652e636f6d2f62616467652f7354756e652e7376673f)](https://www.ardu-badge.com/sTune) [![PlatformIO Registry](https://camo.githubusercontent.com/269bbd52c6be846bab52a8afe727604d3bce8e7f068e317e36042fe3c9330203/68747470733a2f2f6261646765732e72656769737472792e706c6174666f726d696f2e6f72672f7061636b616765732f646c6c6f796465762f6c6962726172792f7354756e652e737667)](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)
410

511
### Features
612

@@ -15,14 +21,6 @@ Development began with a fork of the Arduino PID Library. Modifications and new
1521
- [x] Derivative on error `dOnError` and measurement `dOnMeas` options
1622
- [x] New PID Query Functions `GetPterm`, `GetIterm`, `GetDterm`, `GetPmode`, `GetDmode` and `GetAwMode`
1723
- [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).
2624

2725
### Functions
2826

@@ -105,96 +103,3 @@ void SetDerivativeMode(dMode dMode); // Set the dTerm, based error or
105103
void SetAntiWindupMode(iAwMode iAwMode); // Set iTerm anti-windup to iAwCondition, iAwClamp or iAwOff
106104
```
107105
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)
116-
117-
#### SetOutputLimits
118-
119-
```c++
120-
void QuickPID::SetOutputLimits(float Min, float Max);
121-
```
122-
123-
The PID controller is designed to vary its output within a given range. By default this range is 0-255, the Arduino PWM range.
124-
125-
#### SetTunings
126-
127-
```c++
128-
void QuickPID::SetTunings(float Kp, float Ki, float Kd, pMode pMode = pMode::pOnError,
129-
dMode dMode = dMode::dOnMeas, iAwMode iAwMode = iAwMode::iAwCondition)
130-
```
131-
132-
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-
void QuickPID::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)
139-
140-
#### SetControllerDirection
141-
142-
```c++
143-
void QuickPID::SetControllerDirection(Action Action);
144-
```
145-
146-
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.
147-
148-
#### SetSampleTime
149-
150-
```c++
151-
void QuickPID::SetSampleTimeUs(uint32_t NewSampleTimeUs);
152-
```
153-
154-
Sets the period, in microseconds, at which the calculation is performed. The default is 100000µs (100ms).
155-
156-
#### SetProportionalMode
157-
158-
```c++
159-
void QuickPID::SetProportionalMode(pMode pMode);
160-
```
161-
162-
Sets the computation method for the proportional term, to compute based either on error (default), on measurement, or the average of both.
163-
164-
#### SetDerivativeMode
165-
166-
```c++
167-
void QuickPID::SetDerivativeMode(dMode dMode);
168-
```
169-
170-
Sets the computation method for the derivative term, to compute based either on error or on measurement (default).
171-
172-
#### SetAntiWindupMode
173-
174-
```c++
175-
void QuickPID::SetAntiWindupMode(iAwMode iAwMode);
176-
```
177-
178-
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)
183-
184-
### Original README (Arduino PID)
185-
186-
```
187-
***************************************************************
188-
* Arduino PID Library - Version 1.2.1
189-
* by Brett Beauregard <br3ttb@gmail.com> brettbeauregard.com
190-
*
191-
* This Library is licensed under the MIT License
192-
***************************************************************
193-
```
194-
195-
- For a detailed explanation of the original code, please visit:
196-
http://brettbeauregard.com/blog/2011/04/improving-the-beginners-pid-introduction/
197-
198-
- For function documentation see: http://playground.arduino.cc/Code/PIDLibrary
199-
200-
------

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "QuickPID",
33
"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.",
55
"keywords": "PID, controller, signal, autotune, tuner, stune",
66
"repository":
77
{

library.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name=QuickPID
22
version=3.0.5
33
author=David Lloyd
44
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.
77
category=Signal Input/Output
88
url=https://github.com/Dlloydev/QuickPID
99
architectures=*

0 commit comments

Comments
 (0)