PID control

Level UniversityDifficulty ★★★★★Application⌖ Open in the map

What is it?

The most used controller in the world: correct proportionally to the error (P), to its accumulated integral (I, removes steady offset) and to its derivative (D, anticipates and damps). Calculus in one line, running in thermostats, drones, cruise control and hard-disk heads.

Formulas

u(t)=Kp e(t)+Ki∫0te(s) ds+Kd dedtu(t) = K_p\,e(t) + K_i\int_0^t e(s)\,\dd s + K_d\,\frac{\dd e}{\dd t}
uk=Kpek+Kih∑j≤kej+Kd ek−ek−1hu_k = K_p e_k + K_i h\sum_{j\le k} e_j + K_d\,\frac{e_k - e_{k-1}}{h}
discrete version on a microcontroller (Riemann sum + finite difference)

The mathematics behind it

  • Derivative★★★★★frequent

    The D term reacts to the derivative of the error, anticipating where the system is going.

  • Tuning a controller is choosing the damping ratio ζ\zeta of the closed loop: fast without overshoot.

  • Laplace transform★★★★★frequent

    Derivative and integral actions become ss and 1/s1/s: PID design is pole placement in ss.

Where is it used?

Computing topics reachable from here, through the chain of ideas that leads to them:

What depends on it

Exercises

1Applied

A drone hovers 2 m below its target height. Explain what each of P, I and D contributes, and what goes wrong with only P.

Solution

P pushes up in proportion to the 2 m error; D brakes as the error shrinks quickly, preventing overshoot; I accumulates any persistent error. With only P, gravity needs a non-zero thrust, which requires a non-zero error: the drone settles below the target (steady-state error) and may oscillate if KpK_p is large.

This page has the essentials. A fuller treatment (intuition, formal definition, worked example) is on the way.

↑ ↓ to navigate · ↵ · Esc