The offset
Our plant is G(s) = 1/((s+1)(s+2)) and the goal steps to 1. Proportional control, u = 10·e, overshoots by 22.1% and then settles at 0.833. An error of 0.167 stays for ever.
At rest this plant needs u = 2·y to hold y. With P alone u = 10·e, so balance needs e = 1/6 ≈ 0.167. A bigger Kp shrinks the gap but never closes it: Kp = 40 gives 0.048 and 47% overshoot.
Integral action
The integral term keeps a running total of the error: I = Ki·∫e dt, the area under e(t). While e is positive the total grows; when e is negative it shrinks. It stops changing only when e is exactly zero.
PI control: u = 10·e + 5·∫e dt. The total keeps growing while any gap remains, so y climbs past 0.833 to 1. The price: a peak of 1.19 (19.5% overshoot), settling within 2% after 2.76 s.
By 10 s the error is 0.001, so P is almost zero. The integral carries almost all of u: I = 1.99 of u ≈ 2, what the plant needs for y = 1. The 1/s pole makes the loop type 1: no step error.
Derivative action
The derivative term reacts to how fast the output moves: D = −Kd·dy/dt. Rising fast means a strong brake before the goal is reached. It reads the output, not the error, so a step in the goal gives no sudden kick.
PD control: u = 10·e − 2·dy/dt. Overshoot falls from 22.1% to 3.8%, and settling from 2.42 s to 1.71 s. But at rest dy/dt = 0, so D adds nothing and the 0.167 gap remains.
The closed loop obeys y'' + (3 + Kd)·y' + 12·y = 10·r. Kd adds straight to the y' term, like extra friction. The damping ratio rises from 0.43 to 0.72, while the natural frequency stays 3.46 rad/s.
Choosing
Side by side: I removes the offset, D tames the overshoot. P acts on the error now, I on the error stored up from the past, D on where the output is heading. All three together make the PID controller.
Integral action lags, so it adds overshoot, and it winds up when the actuator saturates. Derivative action amplifies noise: a ripple at 100 rad/s gets 100 times the gain of one at 1 rad/s, so real controllers filter D.
What is happening
# step 1/10 · offset
# about: Goal, Compare, P term, Sum, Plant, P
# P only
Kp, Ki, Kd, dt = 10, 0, 0, 0.0001
y = v = I = 0.0 # output, its speed, integral
for n in range(100000): # 10 s
e = 1.0 - y # goal r = 1
u = Kp * e + I - Kd * v # P + I + D
a = u - 3 * v - 2 * y # plant: y'' + 3y' + 2y = u
y, v = y + v * dt, v + a * dt
I += Ki * e * dt
print(f"{y:.3f}") # 0.833
The plant 1/((s+1)(s+2)) is a textbook example in normalised units, not a measured machine. Every curve and number is simulated from it with the same Python loop shown on the steps (Euler steps of 0.1 ms); the final values and overshoots agree with the closed-form results. The Python on the run steps is plain Python 3 with no libraries. python-control can check the same loops: control.feedback(C * G) with C = control.tf([10, 5], [1, 0]) for PI.