2 ms·
PID is a fairly simple concept. It's a way to control a process to reach a certain target value. So for example it might be used in an oven to drive the heating
by Doxin 9y ago
PID is a fairly simple concept. It's a way to control a process to reach a certain target value. So for example it might be used in an oven to drive the heating elements to keep a specific temperature.
The way this works is by summing three different properties of error in varying quantities, where error is the difference between your actual value and the target value. So in the oven scenario the actual temperature might be 60c, with the target being 220c. Then the error is 220-60=160.
The different properties are:
- Proportional: This is simply the error multiplied by a preset constant.
- Integral: This is all the previous errors summed together and multiplied by a preset constant.
- Derivative: This is the speed of change in error multiplied by a preset constant.
By tuning the P, I, and D constant you can change how your controller reacts to error.
P simply tries to drive the system towards less error, more P equals a faster system, but might lead to overshooting the target and oscillating back and forth.
I tries to correct for constant error. In the over example that might be heat leaking away. Too much I can lead to "windup": Any amount of error causing a long-lasting over-correction, causing overshoot again.
D tries to dampen the system. Increasing it leads to a slower response and less oscillation.
The way you generally tune these is by starting with all the constants set to 0. You then increase P until it starts oscillating. Then you increase D until it stops oscillating.
For most systems leaving I set at 0 is good enough, but in case your system never reaches the target value you can start increasing it until it starts overshooting. Note that any amount of I will eventually force the system to the target value. It's only a question of how long it takes.
I hope that helps.