One term is not enough
The plant: a 1 kg cart on a spring (20 N/m) with a damper (10 N·s/m), pushed by a force u. So G(s) = 1/(s² + 10s + 20). We ask it to move 1 m; holding it there takes 20 N against the spring.
With proportional control alone, u = 300·e. The cart swings to 1.31 m and settles at 0.94 m, short of 1 m: P pushes only while an error remains, so some error must stay to hold the spring (see "Proportional control and its offset").
The three terms
PID joins the three terms from "Adding integral and derivative action": u = Kp·e + Ki·∫e dt + Kd·de/dt (our D uses y, step 7). P sees the error now, I the error so far, D how fast it changes. Gains: 300, 200, 20.
In Laplace form C(s) = Kp + Ki/s + Kd·s = (20s² + 300s + 200)/s. That is a pole at s = 0, the integrator, plus two zeros, here at −0.70 and −14.30. Three gains place two zeros and the overall gain.
P pushes in proportion to the error right now. At t = 0 the error is the full 1 m, so P pushes 300 N, the biggest kick of the run. As the cart closes in, the error shrinks and P fades towards zero.
I adds up the error over time, so it keeps growing while any error is left. It ends at 19.8 N, heading for exactly the 20 N the spring needs. With I holding that force, P no longer needs an error.
D reacts to how fast the cart moves: −20 × its speed. Racing towards the target, D pushes back, down to −142 N at 0.060 s, so the cart barely overshoots. It uses dy/dt, not de/dt, so the step command makes no spike.
All together
The three terms add into one force, u = P + I + D, and that single force pushes the cart. Early on P dominates, D brakes the rush, and at the end I alone holds the 20 N.
The result: the PID cart peaks at only 1.005 m (0.5% overshoot), stays within 2% of 1 m after 0.24 s and ends on target. P alone swung to 1.31 m and stopped at 0.94 m.
Closed-loop poles solve s³ + (10 + Kd)s² + (20 + Kp)s + Ki = 0, here s³ + 30s² + 320s + 200: −0.67 and −14.67 ± 9.24j. Each gain sets one coefficient, so the three gains can place all three poles.
Industry often writes Kp(1 + 1/(Ti·s) + Td·s): here Ti = 1.50 s, Td = 0.0667 s. Real controllers also filter D against sensor noise and stop I growing when the motor is at its limit. "Ziegler-Nichols tuning" picks gains by rule.
The working
# step 1/11 · cart
# about: Command r, Cart, Position y
plant m·y'' + b·y' + k·y = u
m = 1 kg, b = 10 N·s/m, k = 20 N/m
G(s) = Y/U = 1 / (s² + 10s + 20)
command r = 1 m (a unit step at t = 0)
to hold y = 1 m at rest the spring pulls back
with k·y = 20 N, so the controller must keep
pushing with u = 20 N for ever.
The cart (1 kg, 20 N/m, 10 N·s/m) and the gains are round illustrative numbers, not a measured machine. Every curve is integrated from the closed loop (RK4, 0.1 ms steps) and every number in the text is measured on those curves. The Python is plain Python 3 with a simple Euler loop at 0.1 ms; it prints the same numbers as the RK4 model to the digits shown. With python-control, ct.step_response(ct.tf([300, 200], [1, 30, 320, 200])) gives the same PID curve.