P 0.00r = 1e +1.0v 0.0I 0.00u 0.00y 0.000y 0.000
goal 1012345600.51time (s)yOUTPUT y(t), GOAL r = 1no limitwindupclampedactuator max 1.5plant needs 1012345601234time (s)IINTEGRAL I(t) VS THE LIMITwindupclamped
Lit wire with moving dashes: a signal is flowing along itBlocks: goal, compare (e = r − y), the P and I terms, the sum (asked v), the actuator limit (given u) and the plantBars: a term's value, or on the limit block the asked value (outline) and the given value (solid); red marks are the ±1.5 limitThe red wire from the limit to the I block is anti-windup; the pill on the front wire is the measured output yOne plant, 1/(s+1), one PI controller and one actuator that can give at most 1.5. The sum disc is what the controller asks for (v); the limit block is what the actuator gives (u). The dashed outline on the limit block is the request, the solid bar the delivery, and the red marks the limit. The plots below are simulated from the model as the steps play: with no anti-windup the integral climbs far past the limit and the output overshoots; clamping holds the integral while the actuator is stuck. Åström and Murray, Feedback Systems (2nd ed.), §11.4: when the actuator saturates "the feedback loop is broken and the system runs in open loop", the integral builds up, and "the consequence is that there are large transients". Their cruise-control example (Example 11.5) shows the same effect on a steep hill.

On paper

  1. Plant G(s) = 1/(s+1), PI controller 4·e + 8·∫e dt, goal steps to 1. With no limits it overshoots 7.2% and settles within 2% in 1.73 s. But at t = 0 it asks for u = 4.

Saturation and windup

Anti-windup

In practice

What is happening

# step 1/9 · paper
# about: Goal, Compare, P term, I term, Asked v, Plant, No limit

# PI, goal r = 1, no actuator limit
Kp, Ki, umax, dt = 4, 8, 1.5, 0.001
y = I = peak = 0.0
for n in range(6000):           # 6 s
    e = 1.0 - y                 # error
    v = Kp * e + I              # what the controller asks for
    u = v                       # what the actuator gives
    I += Ki * e * dt            # integral always adds
    y += (u - y) * dt           # plant: y' = -y + u
    peak = max(peak, y)
print(f"{peak:.3f}")             # 1.072

The plant 1/(s+1), the gains Kp = 4, Ki = 8 and the limit ±1.5 are a textbook-style example in normalised units, not a measured machine. Every curve and number is simulated with the same Python loop shown on the steps (Euler steps of 1 ms). The no-limit run matches the closed-form step response of (4s + 8)/(s² + 5s + 8), and the windup integral matches 8·(1 − ln3/2) ≈ 3.61. Clamping as defined in the MathWorks PID Controller block documentation: integration stops while the controller output exceeds the limits and the integrator input has the same sign as the saturation block input; it resumes when either condition no longer holds. The code here tests the same thing with e·v < 0. The Python is plain Python 3 with no libraries. python-control can simulate the linear part (control.step_response on control.feedback(C * G)), but a saturation needs a nonlinear simulation such as the loop shown.