ENع
→Linearisation
الدرس 12 · Modelling systems

Linearising a nonlinear system

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

15 دقيقة10 خطوات5 أسئلةIntermediate
عن هذا الدرس

Transfer functions only work for linear systems, but real ones bend. Follow a water tank that drains through a hole, where the outflow grows with √h. Pick the level it normally runs at, swap the curve for its tangent there, and write the equation in small changes. Out comes G(s) = 20/(20s + 1). Then test it against the real tank: within 5 % for a small pump step, 33 % off for a big one.

ستتعلّم

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

شكل 12 · تفاعلي
01 / 10

A tank that drains

A pump fills a tank, and water drains out of a hole in the floor. The deeper the water, the harder it pushes, so it drains faster. We want a transfer function from pump flow q to level h.

pump flow     q   (m³/s)   the input
water level   h   (m)      the output
tank floor    A = 1 m²

water out of the hole: q_out = c·√h
(Torricelli's law; c = 0.1 sums up the
hole's size)
جارٍ تحميل الرسم…
أو ← →
اقرأ الدرس خطوة بخطوة
  1. A tank that drains

    A pump fills a tank, and water drains out of a hole in the floor. The deeper the water, the harder it pushes, so it drains faster. We want a transfer function from pump flow q to level h.

    pump flow     q   (m³/s)   the input
    water level   h   (m)      the output
    tank floor    A = 1 m²
    
    water out of the hole: q_out = c·√h
    (Torricelli's law; c = 0.1 sums up the
    hole's size)
  2. The equation and its blocks

    Water in minus water out changes the level: A·dh/dt = q − c·√h. In the block diagram, the sum takes in minus out, the store block turns that into level, and the outflow block feeds c·√h back.

    A·dh/dt = q − c·√h
    
    sum      q − q_out          net flow
    store    1/(A·s)            net flow → level
    outflow  c·√h               level → flow out
    
    The outflow block is the only one that
    is not a plain multiply or integrate.
  3. The bend that breaks it

    Outflow grows with the square root of depth: four times deeper drains only twice as fast. The curve bends, so the equation is nonlinear, and the Laplace transform cannot turn √h into anything times H(s).

    h (m)    q_out = 0.1·√h (m³/s)
    1        0.100
    2        0.141
    4        0.200     4× deeper, only 2× the flow
    
    Linear means: double the cause, double
    the effect. √h fails that test, so no
    transfer function yet.
  4. Pick an operating point

    First choose where the tank normally runs. With the pump at 0.1 m³/s, the level settles where outflow equals inflow: 0.1·√h = 0.1, so h₀ = 1.00 m. Nothing changes there. That resting point is the operating point.

    operating point (an equilibrium)
      q₀ = 0.1 m³/s
      c·√h₀ = q₀   →   h₀ = (q₀ / c)² = 1.00 m
      dh/dt = 0 there: in = out
    
    Every later number is a small change
    away from this point.
  5. Swap the curve for its tangent

    Close to h₀ the curve is almost straight, so replace it by its tangent line. Its slope is c/(2√h₀) = 0.05. A small rise δh in level then adds δh/R to the outflow, with R = 2h₀/q₀ = 20 s/m².

    # slope of the outflow curve at h0, numerically
    import math
    c, h0, d = 0.1, 1.0, 1e-6
    f = lambda h: c * math.sqrt(h)
    slope = (f(h0 + d) - f(h0 - d)) / (2 * d)
    print(round(slope, 4))        # 0.05
  6. Write it in small changes

    Now track only changes from the operating point: δh = h − h₀ and δq = q − q₀. The constants q₀ and c·√h₀ cancel, and what is left is linear: A·dδh/dt = δq − δh/R.

    h = h₀ + δh,   q = q₀ + δq
    c·√h ≈ q₀ + δh/R            (the tangent)
    
    A·dδh/dt = q₀ + δq − q₀ − δh/R
             = δq − δh/R        linear!
    
    A = 1 m²,  R = 20 s/m²
  7. One block: G(s)

    Laplace-transform it from rest: (A·s + 1/R)·δH(s) = δQ(s). The loop reduces to one block, G(s) = R/(A·R·s + 1) = 20/(20s + 1): a first-order system with time constant A·R = 20 s.

    (A·s + 1/R)·δH = δQ
    G(s) = δH/δQ = R / (A·R·s + 1)
         = 20 / (20·s + 1)
    
    gain        R = 20 m per m³/s
    time const  A·R = 20 s
    
    import control
    G = control.tf([20], [20, 1])
  8. Test 1: a small step

    Test it. Raise the pump 10 %, to 0.11 m³/s. The real tank settles at 1.21 m; the linear model says 1.20 m. Close: near the operating point the tangent is a good copy of the curve.

    # real tank vs linear model, pump 0.11
    import math
    A, c, R, q = 1.0, 0.1, 20.0, 0.11
    h, dh, dt = 1.0, 0.0, 0.01
    for n in range(12000):            # 120 s
        h += dt * (q - c * math.sqrt(h)) / A
        dh += dt * ((q - 0.1) - dh / R) / A
    print(f"{h:.2f} {1 + dh:.2f}")    # 1.21 1.20
  9. Test 2: a big step

    Now double the pump, to 0.2 m³/s. The real tank climbs to 4.00 m but the model says 3.00 m, and the tank is slower too: 34 s, not 20 s, to cover 63 % of its rise. Far from h₀ the tangent misleads.

    # the same check with the pump doubled
    import math
    A, c, R, q = 1.0, 0.1, 20.0, 0.2
    h, dh, dt = 1.0, 0.0, 0.01
    for n in range(30000):            # 300 s
        h += dt * (q - c * math.sqrt(h)) / A
        dh += dt * ((q - 0.1) - dh / R) / A
    print(f"{h:.2f} {1 + dh:.2f}")    # 4.00 3.00
  10. The recipe and its limit

    The recipe: find the operating point, take the slope of every curved term there, and write the equation in small changes. You get a transfer function that is good near that point only. Move far away, and linearise again there.

    1  operating point: set d/dt = 0, solve
    2  slope of each nonlinear term there
    3  write in deviations: δh, δq
    4  Laplace → G(s)
    
    error at the final level
      small step (+10 %)   5 % of the rise
      big step (×2)        33 % of the rise

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