Find the edge
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.
Switch off the integral and derivative parts (Ti = ∞, Td = 0), so the controller is just a gain. With Kp = 10 the output overshoots by 49% and settles within 2% after 12.7 s.
Raise Kp slowly. The swings grow and take longer to die away: at Kp = 20 the overshoot is 76% and settling takes 29 s. On the s-plane the complex pair of poles slides towards the imaginary axis.
At Kp = 30 the output swings for ever with a constant size, between 0.06 and 1.94. The pair sits on the imaginary axis at ±2.24j. This gain is the ultimate gain, Ku = 30. Any higher and the swings grow.
Apply the rule
Time one full swing: peaks at 1.57 s and 4.37 s, so the ultimate period Pu = 2.81 s. It matches 2π/√5 = 2.81 s from the poles. Ku and Pu are the only two numbers the recipe needs.
The Ziegler-Nichols table turns Ku and Pu into settings. For a full PID: Kp = 0.6 Ku = 18, Ti = 0.5 Pu = 1.405 s and Td = 0.125 Pu = 0.351 s. Simpler P and PI rows exist too.
Dial in Kp = 18, Ti = 1.40 s and Td = 0.35 s. The integral adds a pole, and the controller brings two zeros. Because Ti = 4·Td they land together at s = −1.42. The poles move back into the left half-plane.
Check and refine
Now the step, integrated from the tuned loop. The output peaks at 1.67 s with 62% overshoot and stays within 2% after 10.0 s. Stable and fast, but that first swing is large.
This is what the rule aims for. The first overshoot is 0.618, the next 0.147: each swing about a quarter of the one before (0.24). Ziegler and Nichols chose that for fast process plants. Most loops want calmer.
Keep Kp = 18 but lengthen Ti to 3.077 s and Td to 0.769 s. The double zero moves to −0.65 and the overshoot falls to 19%, settling in 5.1 s. Z-N got us close in one experiment; judgment finishes the job.
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.