TExcelTAD
Home › Control Systems & Automation › Actuator Saturation, Integrator Windup and Anti-Windup

Actuator Saturation, Integrator Windup and Anti-Windup

Ask the heater block of the intro to rise by 25 K25\ \text{K} with a well-tuned PI controller and something alarming happens: the temperature overshoots by more than 12 K12\ \text{K}, to over 60 ∘C60\,^\circ\text{C}, and takes almost nine minutes to come back. The same controller handles a 1 K1\ \text{K} step perfectly. The difference is the actuator: the heater cannot deliver more than 14.4 W14.4\ \text{W}, so for a large step it sits at full power for minutes while the integrator keeps adding up error it cannot act on. When the temperature finally arrives, the integrator holds a huge value that must be "unwound" by an equally long period of negative error: overshoot. This is integrator windup, the most common practical failure of PI and PID loops, and the fix is a few lines of code.

Why it happens

Every actuator saturates: a valve is fully open, a PWM duty cycle reaches 100 %, a motor driver hits its current limit, a heater its maximum power. While uu is pinned at umaxu_\text{max}, the loop is open: the plant receives a constant input whatever the controller says. A proportional or derivative term does no harm (it stops changing when the error stops changing). The integral term, however, keeps integrating:

I(t)=Ki∫0te(τ) dτgrows as long as e>0, even though u=umaxI(t) = K_i\int_0^t e(\tau)\,d\tau \quad \text{grows as long as } e > 0, \text{ even though } u = u_\text{max}

The controller's internal output v=Kpe+Iv = K_p e + I climbs far above umaxu_\text{max}. When the error changes sign, vv must fall all the way back below umaxu_\text{max} before uu moves at all: the heater stays at full power after the target is passed. Windup is worse for long saturation (large steps, slow plants, weak actuators) and for small TiT_i.

Two fixes

e Ki + + 1/s integrator Kp + + v saturation umin..umax u + - u - v 1/Tt

Clamping (conditional integration). Stop integrating when the controller is saturated and the error would push it further into saturation:

I˙={0if (v>umax and e>0) or (v<umin and e<0)Ki eotherwise\dot I = \begin{cases} 0 & \text{if } (v > u_\text{max} \text{ and } e > 0) \text{ or } (v < u_\text{min} \text{ and } e < 0) \\ K_i\,e & \text{otherwise} \end{cases}

Simple, no extra parameter, used in most microcontroller PID libraries.

Back-calculation (tracking). Feed the saturation error u−vu - v back into the integrator with a tracking time constant TtT_t (figure):

I˙=Ki e+1Tt (u−v)\dot I = K_i\,e + \frac{1}{T_t}\,(u - v)

While saturated, the integrator is pulled towards the value that makes v=uv = u, with time constant TtT_t. A common choice is Tt=TiTdT_t = \sqrt{T_i T_d} for a PID and a fraction of TiT_i for a PI; smaller TtT_t unwinds faster but makes the loop sensitive to noise near the limit. Back-calculation also handles the case where the actuator's real position is measured (a valve that sticks): use the measured uu.

Other details of a complete design: the actuator rate limit can wind up the integrator too; in a cascade the inner loop's saturation must be reported to the outer controller (Cascade Control); and bumpless transfer is the same tracking idea applied to manual mode (Practical PID). Nonlinearities treats saturation as a nonlinear element in general.

Worked example: a 25 K step of the heater

Given: G(s)=4 e−10s300s+1G(s) = \frac{4\,e^{-10 s}}{300 s + 1} (K/W), SIMC PI from Model-Based Tuning: Kp=3.75 W/KK_p = 3.75\ \text{W/K}, Ti=80 sT_i = 80\ \text{s}; heater limits 0≤u≤14.4 W0 \le u \le 14.4\ \text{W}; setpoint step 25 K25\ \text{K}.

Find: overshoot and settling time (to ±0.5 K\pm 0.5\ \text{K}, 2 % of the step) without anti-windup, with clamping, and with back-calculation (Tt=40 sT_t = 40\ \text{s}).

Solve: the step asks for Kp×25=94 WK_p \times 25 = 94\ \text{W} at once, so the heater saturates. Even at full power the block needs about 300ln⁡57.657.6−25=171 s300 \ln\frac{57.6}{57.6 - 25} = 171\ \text{s} to rise 25 K25\ \text{K} (the final value at 14.4 W14.4\ \text{W} would be 57.6 K57.6\ \text{K}). During that time the error is large, and without protection the integral grows to many times the 6.25 W6.25\ \text{W} that is finally needed. The simulation gives the numbers:

python · try it yourself
import numpy as np

K, T, theta = 4.0, 300.0, 10.0
Kp, Ti = 3.75, 80.0
Ki = Kp / Ti
umin, umax = 0.0, 14.4
dt, tend, step = 0.1, 1500.0, 25.0
nd = int(theta / dt)

def run(mode, Tt=40.0):
    x, I = 0.0, 0.0
    delay = np.zeros(nd)                            # sensor delay line
    ys, us, Is = [], [], []
    for k in range(int(tend / dt)):
        y_meas = delay[k % nd]
        e = step - y_meas
        v = Kp * e + I
        u = min(max(v, umin), umax)
        if mode == "none":
            I += Ki * e * dt
        elif mode == "clamping":
            if not ((v > umax and e > 0) or (v < umin and e < 0)):
                I += Ki * e * dt
        elif mode == "back-calculation":
            I += (Ki * e + (u - v) / Tt) * dt
        x += dt * (K * u - x) / T                    # heater block, Euler step
        delay[k % nd] = x
        ys.append(x); us.append(u); Is.append(I)
    return np.array(ys), np.array(us), np.array(Is)

t = np.arange(int(tend / dt)) * dt
for mode in ("none", "clamping", "back-calculation"):
    y, u, I = run(mode)
    ts = t[np.nonzero(abs(y - step) > 0.5)[0][-1]]
    print(f"{mode:16s}: peak rise {y.max():5.2f} K (overshoot {max(0.0, 100 * (y.max() - step) / step):4.1f} %), "
          f"settled at {ts:5.0f} s, saturated for {dt * np.sum(u >= umax):4.0f} s, max integral {I.max():5.1f} W")
none            : peak rise 37.97 K (overshoot 51.9 %), settled at   523 s, saturated for  320 s, max integral 102.3 W
clamping        : peak rise 25.00 K (overshoot  0.0 %), settled at   214 s, saturated for  147 s, max integral   6.2 W
back-calculation: peak rise 25.00 K (overshoot  0.0 %), settled at   243 s, saturated for  139 s, max integral   6.2 W

Without anti-windup the block overshoots by almost 13 K and the heater stays at full power for over five minutes; with either fix the loop arrives without overshoot in less than half the time. In the unprotected case the integral term reached several times the heater's whole range: that stored "debt" is the overshoot.

Lab: the linear loop never winds up

The PID lab's actuator has no limits, so it cannot show windup: its PI loop (Kp=3K_p = 3, Ki=2K_i = 2, Kd=0K_d = 0) overshoots 12.99 %12.99\,\% for any step size. A real loop with the same gains would show that overshoot for small steps only, and much more for large ones. Keep this in mind whenever you read step-response specifications: they are small-signal numbers.

r = 1+C(s): Kp 3, Ki 2, Kd 0P(s) = 1/((1s+1)(0.5s+1))y-T(s) = (3.000 s + 2.000) / (0.500 s^3 + 1.500 s^2 + 4.000 s + 2.000)closed-loop poles: -0.61, -1.19+j2.26, -1.19-j2.260.00.51.001 s2 s3 s4 s5 sty(t)t_s 3.47 s+13.0 %y(t)setpoint10-90 % rise

Guided lab: windup on the heater block

Hand calculation. For your block, estimate the full-power rise time to the setpoint (τln⁡RthPmaxRthPmax−ΔT\tau\ln\frac{R_\text{th}P_\text{max}}{R_\text{th}P_\text{max} - \Delta T}) and the integral accumulated in that time; predict that large steps overshoot without anti-windup.

Simulation. Change the program to your model and gains; try steps of 55, 1515 and 25 K25\ \text{K} and plot y and u.

What you would measure. The 10 Ω10\ \Omega heater on a current-limited 12 V12\ \text{V} supply via PWM, PI in a microcontroller. A small step (3 K3\ \text{K}) behaves the same with or without anti-windup. A large step (limited to 15 K15\ \text{K} above room temperature, so the windup overshoot stays below 60 ∘C60\,^\circ\text{C}) without anti-windup overshoots by several kelvin; with clamping the overshoot drops below about 0.5 K0.5\ \text{K} (the sensor's resolution and the model error set the floor). Log uu to see the saturation interval; it should match the hand estimate within about 20 %.

Hazards and safe setup. This experiment overshoots on purpose: cap the setpoint as above, add a software cut-off at 70 ∘C70\,^\circ\text{C} and a thermal fuse, use a heat-resistant base, never leave it unattended; current limit about 1.5 A1.5\ \text{A}.

Pitfalls

  • Limiting only the output and not the integrator: the output looks right, the integrator still winds up.
  • Clamping on v>umaxv > u_\text{max} alone (without checking the sign of ee): the integrator then stays frozen at its wound-up value whenever the error reverses, until the proportional term alone pulls vv back inside the limits.
  • Forgetting that the "actuator" limit may be hidden downstream (a driver's current limit, a PLC output scaling to 0–100 %): the controller must know the real limits.
  • Choosing TtT_t much smaller than the sample time in a digital implementation: the tracking becomes unstable.

Practice

  1. A PI with Ki=0.05 W/(K⋅s)K_i = 0.05\ \text{W/(K} \cdot \text{s)} sits saturated for 200 s200\ \text{s} with an average error of 10 K10\ \text{K}. How much does the integral term grow without anti-windup?
  2. Why does a P-only controller not wind up?
  3. With back-calculation and Tt=40 sT_t = 40\ \text{s}, how fast does the integrator approach its tracking value while saturated?
Answer
  1. 0.05×10×200=100 W0.05 \times 10 \times 200 = 100\ \text{W}, about seven times the heater's 14.4 W14.4\ \text{W}.
  2. It has no state: its output depends only on the present error, so it stops pushing the moment the error falls.
  3. Exponentially with time constant Tt=40 sT_t = 40\ \text{s} (ignoring the KieK_i e term).

Test yourself

Integrator windup happens when

  1. the derivative term is unfiltered
  2. the actuator saturates while the integrator keeps integrating the error
  3. the sensor is noisy
  4. the gain is too low

Clamping (conditional integration) stops the integrator when

  1. the error is zero
  2. the output is saturated and the error would drive it further into saturation
  3. the setpoint changes
  4. the derivative is large

In back-calculation, the integrator input gets the extra term

  1. Kde˙K_d \dot e
  2. (u−v)/Tt(u - v)/T_t
  3. −Kpe-K_p e
  4. v/Tiv/T_i

Why can the PID lab's step responses not show windup?

  1. its integrator is clamped
  2. its actuator has no limits
  3. it has no integral term
  4. it uses back-calculation