unit stepr − yP · Kp 01 / s(s+1)(s+5)output y1Ku, Pu = 30, 2.81 # measured2Kp = 0.6 * Ku # 183Ti = 0.5 * Pu # 1.405 s4Td = 0.125 * Pu # 0.351 sKu 30 · Pu 2.81 sKp 18 · Ti 1.40 · Td 0.35
−6−5−4−3−2−10−3−2−10123σ, real partjω, imaginary partS-PLANE: POLES AND ZEROS±j√5 at K = 300369121500.511.52time (s)output ySTEP RESPONSE y(t)Z-NnowPu = 2.81 s
Lit wire with moving dashes: a signal is flowing along itBlocks: command, compare, PID controller (dial = Kp), plant G(s), output; the code card holds the tuning rulePlots: the s-plane (crosses = plant poles, dots = closed-loop poles, rings = controller zeros) and the step response nowPills: Ku and Pu carried to the rule, then the three gains carried into the controllerZiegler-Nichols tuning on a unity-feedback servo. With integral and derivative action off, the proportional gain is raised until the output swings with constant amplitude: the ultimate gain Ku and its period Pu. The rule card turns them into Kp = 0.6 Ku, Ti = 0.5 Pu and Td = 0.125 Pu. The s-plane shows the closed-loop poles and the controller's zeros; the step response is integrated from the closed loop at the current settings. Quarter-amplitude decay is the design target of the original rules; here the second overshoot is 0.24 of the first. The refined settings trade a slower integral for far less overshoot (61.8% down to about 19%).

Find the edge

  1. A PID controller has three knobs: the gain Kp, the integral time Ti and the derivative time Td. Tuning means choosing them. Ziegler and Nichols, in 1942, gave a recipe that needs one experiment on the loop, not a model.

Apply the rule

Check and refine

The working

# step 1/10 · loop
# about: Command: unit step, Compare (error), PID controller, Plant G(s), Output y

controller   u = Kp·(e + (1/Ti)∫e dt + Td·de/dt)
             (see the lesson "The PID controller")
plant        G(s) = 1 / (s(s + 1)(s + 5))
feedback     unity: e = command - y

Kp  how hard to push on the error now
Ti  how fast to add up past error
Td  how strongly to react to its trend

The question: which three numbers?

The plant 1/(s(s+1)(s+5)) is a textbook servo model with round numbers, not a measured machine. Every curve is integrated from the closed loop (RK4, 0.01 s steps for the plot, 0.001 s for the numbers); the poles are the exact roots of the characteristic polynomial; settling uses a 2% band. The Python uses only the standard library. With python-control installed, ct.step_info(ct.feedback(C * G)) reports the same overshoot and 2% settling time for these settings.