Feedback and PID control
Open and closed loops, what the P, I and D terms each do, why loops go unstable, and how to tune one.
35 min
On this page
Open loop and closed loop
Open loop: you set the pump to 1180 rpm and hope the pressure is right. If the pipes are dirtier than expected, you never find out.
Closed loop: you measure the pressure, compare it with what you want, and correct the speed continuously. The controller does what a person would do by hand, faster and without getting tired.
- SP, set-point (consigne): what you want, for example 25 m of head.
- PV, process variable (mesure): what the sensor reads.
- e = SP − PV, the error.
- CV, control variable: what the controller commands, here the pump speed.
- Disturbance: anything that pushes PV away, for example a valve closing downstream.
The three terms
P, proportional: how far off am I now? Push harder the bigger the error. More reacts faster, but on its own it leaves a steady-state offset.
I, integral: how long have I been off? It adds up the error over time and keeps pushing while any error remains, so it removes the offset completely. Too much overshoots and oscillates.
D, derivative: how fast is it changing? It brakes the response when PV approaches the set-point quickly, which damps overshoot. It amplifies sensor noise, so pump and fan loops usually leave it out and use a PI controller.
FoundationStart here if this is new to you
Think of steering a car to stay in the middle of the lane. P: the further you drift, the more you turn the wheel. I: if a steady crosswind keeps pushing you, you slowly hold a little extra turn until you are centred again. D: if you are swinging back towards the centre quickly, you ease off early so you do not overshoot.
Predict first
A P-only controller (Ki = 0) holds a pump's pressure. Demand changes and the pump must settle at a new speed. Where does the pressure end up?
- Overshoot
- 0.0 %
- Settling time
- does not settle
- Error before disturbance
- 0.455
Why loops go unstable
Every real loop has lag and delay: the motor takes time to change speed, the sensor filters its reading, the fieldbus adds a few scans. The controller always acts on slightly old news. With a small gain that is harmless. With a large gain it overcorrects on old information, overshoots, overcorrects the other way, and the oscillation grows. Raise above about 9.5 in the widget and it never settles.
Tuning a loop
- Start with and a small .
- Raise until the response is quick with little overshoot.
- Add slowly until the offset disappears in reasonable time.
- Add only if overshoot is a problem and the signal is clean.
Ziegler-Nichols is the classic systematic method. With P only, raise until the loop oscillates steadily. That gain is and the period is . Then use and for a PI controller. It is known to be aggressive.
The full playground has five real processes, all these effects as switches, and tested presets.
ExplorerGo deeper: derivations and open questions
Frequency view. For a plant and controller , the loop is stable while the phase of stays above −180° where its gain crosses 1. A pure delay adds phase lag with no change in gain, which is why delay, more than anything else, limits how aggressive a loop can be.
Open question. Two first-order lags with a PI controller can never be made unstable by alone. Why? What do you have to add before large can destabilise the loop? (Lab II depends on the answer.)