PIDController
Simple overview
- Proportional. Role: it produces a correction directly scaled to the present error — the larger the deviation, the stronger the response. Raison d'être: it is the workhorse that does the bulk of the correcting, driving the system toward the setpoint in rough proportion to how far off it is. Vice: it cannot eliminate steady-state error (since zero error means zero output), and if its gain is set too high it produces oscillation.
- Integral. Role: it accumulates past error over time and adds a correction proportional to that running sum. Raison d'être: it exists to eliminate the steady-state offset that proportional action alone must tolerate, supplying sustained effort even when the instantaneous error is small. Vice: windup — its accumulated sum causes overshoot and sluggish, oscillatory settling, since the memory of past error persists after the error itself is gone.
- Derivative. Role: it responds to the rate of change of the error, opposing rapid movement toward or away from the setpoint. Raison d'être: it acts as a damper and a crude predictor, braking the system as it approaches the target so as to curb the overshoot the other two terms invite. Vice: it amplifies measurement noise (differentiation magnifies high-frequency jitter), which is why it is often filtered, attenuated, or omitted entirely in practice.
The central three tuning parameters for a PID system are the gains themselves — one per term:
- Kp (proportional gain) sets how aggressively the controller responds to present error. Raise it for faster response; raise it too far and you get oscillation.
- Ki (integral gain) sets how quickly accumulated error translates into corrective effort. Higher values kill steady-state error faster but worsen overshoot and windup.
- Kd (derivative gain) sets the strength of the damping action. More of it curbs overshoot, but amplifies noise sensitivity.
A note on convention: you will also encounter the standard form, where instead of Ki and Kd one specifies Ti (integral time) and Td (derivative time), with Ki = Kp/Ti and Kd = Kp·Td. These express the same thing in units of time — Ti is roughly "how long the integral takes to repeat the proportional action" — and many industrial controllers are parameterized this way. The gains are not independent in effect: adjusting one alters the influence of the others, which is what makes tuning an art.
Beyond the three gains, practical controllers expose several auxiliary parameters:
- Derivative filter coefficient — a low-pass filter time constant applied to the derivative term to tame its noise amplification.
- Anti-windup limits — bounds on the integral accumulator (or a back-calculation gain) so it cannot grow without limit while the actuator is saturated.
- Output limits — the floor and ceiling of the control signal, matched to what the actuator can physically deliver.
- Setpoint weighting — factors that make the P and D terms act on a weighted version of the setpoint, so that a sudden setpoint change does not produce a violent kick (the derivative term in particular is often computed on the measurement alone).
- Sample time — for digital implementations, the loop interval, which must be fast relative to the process dynamics.
As for choosing the gains, the classical starting point is the Ziegler–Nichols method: raise Kp alone until the system oscillates steadily, note that critical gain and oscillation period, and derive the three gains from tabulated formulæ. It yields a serviceable, somewhat aggressive tuning that one then refines by hand — typically in the order P, then I, then D.