ENع
→Design goals
الدرس 05 · What control is

Design goals: stable, fast, accurate

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

12 دقيقة11 خطوة5 أسئلةBeginner
عن هذا الدرس

Every feedback loop is judged by three questions: does it settle (stable), how quickly does it get there (fast), and how close to the goal does it end (accurate)? Follow one room heater whose thermometer reading is 8 minutes old, and turn up the gain of a simple proportional rule: it gets faster and more accurate, until it starts to swing for ever.

ستتعلّم

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

شكل 5 · تفاعلي
01 / 11

Three questions for every loop

Any feedback loop is judged by three questions. Stable: does it settle down? Fast: how quickly does it get there? Accurate: how close to the goal does it end up? Our loop keeps a room at 20 °C.

stable     does the output settle, or swing
           for ever?
fast       how quickly does it get close?
accurate   how far from the goal does it
           end up?

The example: a room, a heater (0 to 3 kW),
a thermometer and a proportional rule.
Goal 20 °C, outside 10 °C.
جارٍ تحميل الرسم…
أو ← →
اقرأ الدرس خطوة بخطوة
  1. Three questions for every loop

    Any feedback loop is judged by three questions. Stable: does it settle down? Fast: how quickly does it get there? Accurate: how close to the goal does it end up? Our loop keeps a room at 20 °C.

    stable     does the output settle, or swing
               for ever?
    fast       how quickly does it get close?
    accurate   how far from the goal does it
               end up?
    
    The example: a room, a heater (0 to 3 kW),
    a thermometer and a proportional rule.
    Goal 20 °C, outside 10 °C.
  2. Every reading is old

    The thermometer hangs far from the heater, so warm air takes 8 minutes to reach it. Every reading the controller gets is 8 minutes old. A delay like this is called dead time, and almost every real loop has some.

    sensor     thermometer across the room
    delay      8 min (dead time)
    
    reading at time t = room temperature
                        at time t − 8 min
    
    The controller always acts on old news.
  3. A gentle rule: K = 0.1

    The rule is proportional: power = K × error, kept between 0 and 3 kW. K, the gain, says how hard to push per °C of error. With a gentle K = 0.1, the room warms smoothly and levels off.

    # K = 0.1: the reading is 8 min (80 updates) old
    import math
    TAU, R, K, goal = 40, 7.5, 0.1, 20.0
    temp, log, dt = 10.0, [], 0.1
    for n in range(1801):           # 0 to 180 min
        log.append(temp)
        reading = log[max(0, n - 80)]
        power = min(max(K * (goal - reading), 0), 3)
        target = 10.0 + R * power
        temp = target + (temp - target) * math.exp(-dt / TAU)
    print(round(temp, 1))            # 14.3
  4. Stable: it settles

    Stable means that after a push, the output settles to one steady value instead of swinging or running away. This loop is stable: by about 74 minutes it has settled for good.

    stable     yes
    settles at 14.3 °C
    settling time  74 min
      (from then on it stays within 2% of the
       way from 10 °C to 14.3 °C)
    
    Stability comes first: an unstable loop
    is useless however fast it is.
  5. Accurate: the gap at the end

    It settles at 14.3 °C, not 20. The gap left once everything has settled is the steady-state error: 5.7 °C here. A proportional rule needs an error to make any heat, so a gentle K leaves a big gap.

    steady-state error = goal − final
                       = 20 − 14.3
                       = 5.7 °C
    
    To hold the room warm, the heater needs
    power, and K × error is the only power
    this rule makes. Small K → big error.
  6. Fast: the rise time

    Speed is measured by the rise time: how long the output takes to go from 10% to 90% of the way to its final value. Here it takes 41 minutes. Stable, but slow and inaccurate.

    rise time   10% → 90% of the way
                from 10 °C to 14.3 °C
              = 41 min
    
    K = 0.1   stable yes   rise 41 min
              error 5.7 °C
  7. More gain: K = 0.4

    Four times the gain pushes harder on the same error. The rise time drops to 13 minutes and the room ends at 17.5 °C, only 2.5 °C short. More gain: faster and more accurate.

    # K = 0.4: the reading is 8 min (80 updates) old
    import math
    TAU, R, K, goal = 40, 7.5, 0.4, 20.0
    temp, log, dt = 10.0, [], 0.1
    for n in range(1801):           # 0 to 180 min
        log.append(temp)
        reading = log[max(0, n - 80)]
        power = min(max(K * (goal - reading), 0), 3)
        target = 10.0 + R * power
        temp = target + (temp - target) * math.exp(-dt / TAU)
    print(round(temp, 1))            # 17.5
    
    K = 0.4   rise 13 min (was 41)
              error 2.5 °C (was 5.7)
  8. The first warning: overshoot

    But the room now overshoots: it climbs to 18.2 °C, past where it ends up, then falls back. The old readings still said too cold, so the heater kept pushing. Overshoot warns that the loop is getting closer to instability.

    peak        18.2 °C
    final       17.5 °C
    overshoot   9% of the rise
    
    The heater reacts to what the room was
    8 minutes ago, so it stops too late.
    Still stable: it settles in 36 min.
  9. Too much gain: K = 1.5

    At K = 1.5 the room never settles. It swings between 17.9 and 21.0 °C for ever, while the heater keeps hitting off and full power. This loop is unstable: it fails the first goal.

    # K = 1.5: the reading is 8 min (80 updates) old
    import math
    TAU, R, K, goal = 40, 7.5, 1.5, 20.0
    temp, log, dt = 10.0, [], 0.1
    for n in range(1801):           # 0 to 180 min
        log.append(temp)
        reading = log[max(0, n - 80)]
        power = min(max(K * (goal - reading), 0), 3)
        target = 10.0 + R * power
        temp = target + (temp - target) * math.exp(-dt / TAU)
    print(round(min(log[900:]), 1), round(max(log[900:]), 1))  # 17.9 21.0
    
    Without the 0 to 3 kW limit the swings
    would grow without end.
  10. Why: pushing hard on old news

    By the time a reading says too cold, the room is already warm, and a strong rule still blasts heat. Then it overshoots the other way. Above K = 1.13, each late correction is bigger than the error it chases.

    gain limit for this room   K = 1.13 kW/°C
      (where the 8 min delay plus the room's
       slow warming make a correction arrive
       half a swing late; at that gain one
       swing takes 30 min)
    
    K = 1.5 > 1.13  → unstable
    K = 0.4 < 1.13  → stable
  11. The trade-off

    More gain bought speed and accuracy but cost stability. With a proportional rule you cannot have all three. Choosing the balance is control design. Later lessons in this course add parts that get all three.

    K     stable   rise      error
    0.1   yes      41 min    5.7 °C
    0.4   yes      13 min    2.5 °C
    1.5   no       never settles
    
    limit K = 1.13: more gain → faster,
    more accurate, less stable.

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