ENع
→Saturation and windup
الدرس 54 · Control in the real world

Actuator limits and integrator windup

لم يُترجم بعد؛ يُعرض باللغة الإنجليزية

16 دقيقة9 خطوات5 أسئلةAdvanced
عن هذا الدرس

Every real actuator has a limit: a motor's top speed, a valve fully open, a heater's maximum power. Linear design ignores it. Take one PI loop (the integral term from "Adding integral and derivative action") on the plant 1/(s+1) and give the actuator a ceiling of 1.5. A step that asks for more saturates the actuator, the integral keeps adding anyway, and the output overshoots 28.5% instead of the designed 7.2%. Then fix it with anti-windup. Every curve is simulated from the model, and the same Python loop runs on each step.

ستتعلّم

حدّد ما تشعر بأنك أتقنته. هذا التقييم الذاتي لا يؤثر في درجة الدرس.

شكل 54 · تفاعلي
01 / 09

The design on paper

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.

# 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
جارٍ تحميل الرسم…
أو ← →
اقرأ الدرس خطوة بخطوة
  1. The design on paper

    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.

    # 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
  2. Every actuator has a limit

    A motor has a top speed; a valve opens only so far; a heater has a maximum power. Our actuator gives at most 1.5. Ask for 4 and it gives 1.5: the extra is simply lost. This clipping is called saturation.

    asked v       given u = sat(v)
      0.8           0.8
      1.5           1.5
      4.0           1.5    (saturated)
     −4.0          −1.5    (saturated)
    
    u = min(max(v, −1.5), 1.5)
    
    Saturation is not linear: doubling v
    does not double u once v passes 1.5.
  3. The step asks too much

    At t = 0 the controller asks for 4 and gets 1.5. While stuck at the limit the loop is open: y = 1.5(1 − e^−t), slower than designed. It reaches the goal only at t = ln 3 ≈ 1.10 s.

    saturated: u = 1.5 whatever y does
      y' = −y + 1.5
      y(t) = 1.5·(1 − e^−t)
    
    y = 1  when  e^−t = 1/3
           t = ln 3 = 1.099 s
    
    The feedback is still measured,
    but it cannot change u: the loop
    runs open while saturated.
  4. The integral winds up

    All that time the error stays positive, so the integral keeps adding. When y first reaches 1, I holds 3.61. The plant needs only 1 to stay at 1, and the actuator gives at most 1.5. This build-up is integrator windup.

    I(ln 3) = 8 · ∫₀^ln3 (1 − 1.5(1 − e^−t)) dt
            = 8 · (1.5·2/3 − ln3/2)
            = 3.61
    
    at rest y = 1 needs u = 1 (DC gain 1)
    so I should end at 1.
    The extra 2.61 must be paid back
    by negative error: overshoot.
  5. Paying the debt back

    With I = 3.61 the request stays above 1.5, so the actuator keeps pushing at full power past the goal until t = 1.91 s. Only negative error drains I. y overshoots to 1.285 (28.5%) and settles in 3.27 s.

    # PI, goal r = 1, actuator limit, no anti-windup
    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 = min(max(v, -umax), umax)  # 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.285
    
    # overshoot 28.5%  (no limit: 7.2%)
    # settles in 3.27 s  (no limit: 1.73 s)
  6. Fix: stop adding at the limit

    Anti-windup by clamping, also called conditional integration: while the actuator is saturated and the error pushes the same way, the integral holds still. It adds again as soon as the request is back inside the limit.

    every dt:
        v = Kp*e + I
        u = min(max(v, -umax), umax)
        if u == v or e * v < 0:
            I += Ki * e * dt
    
    u == v     not saturated: integrate
    e * v < 0  error pulls v back inside
               the limit: integrate
    otherwise  hold I
    
    The extra wire from the limit to I
    carries one bit: "I am saturated".
  7. The fix in action

    Same gains, same limit. I holds at 0 until y passes 0.625, where 4·e drops to 1.5. It then peaks at only 1.02. Overshoot falls from 28.5% to 0.3%, settling from 3.27 s to 1.44 s.

    # PI, goal r = 1, actuator limit + clamping
    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 = min(max(v, -umax), umax)  # what the actuator gives
        if u == v or e * v < 0:     # not stuck, or easing off
            I += Ki * e * dt
        y += (u - y) * dt           # plant: y' = -y + u
        peak = max(peak, y)
    print(f"{peak:.3f}")             # 1.003
    
    # integration starts at t = 0.54 s (y = 0.625)
    # I peaks at 1.02  (windup: 3.61)
  8. Three runs side by side

    No limit: 7.2% overshoot, 1.73 s. Limit with windup: 28.5%, 3.27 s. Limit with clamping: 0.3%, 1.44 s. Another common fix, back-calculation, feeds the gap u − v back into the integrator and gives 0.3% here.

                   overshoot   settle (2%)   I max
    no limit        7.2%       1.73 s      1.51
    windup         28.5%       3.27 s      3.61
    clamping        0.3%       1.44 s      1.02
    back-calc       0.3%       1.42 s      1.02
    
    back-calculation (Åström & Murray §11.4):
        I += (Ki*e + Kaw*(u - v)) * dt
        Kaw = 8: u − v = 0 unless saturated
  9. Why linear tools miss it

    Root locus, Bode plots and closed-loop poles all assume a linear loop: double the input, double the output. Saturation breaks that. Goal steps up to 0.375 never touch the limit and match the design; bigger steps wind up.

    linear analysis  T(s) = (4s + 8) / (s² + 5s + 8)
                     ζ = 0.88, ωn = 2.83 rad/s
                     overshoot 7.2% for ANY step size
    
    real loop        u(0) = Kp·r = 4·r
                     saturates if 4·r > 1.5
                     i.e. r > 0.375
    
    So check the actuator signal in a
    simulation with the real limits.

اختبار يتاح بعد الخطوة الأخيرة.