ENع
→Pole placement
الدرس 47 · State space and digital control

State feedback and pole placement

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

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

Measure every state, multiply each one by a gain and feed it back, and you rewrite the system's A matrix, and with it the poles. Follow one 2 kg cart that rings with 53% overshoot: choose new poles at −4 ± j4, solve two gains by matching coefficients (K = [14 12]), add a reference gain so it lands on target, and watch the poles slide and the ringing disappear.

ستتعلّم

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

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

The cart as matrices

Our plant is the cart from State-space models: 2 kg on a spring and damper, pushed by a force u. Its state x is position x₁ and velocity x₂, and it obeys ẋ = Ax + Bu.

x = [x1, x2]   position (m), velocity (m/s)

x' = A x + B u
A = [[  0,  1],
     [-25, -2]]
B = [0, 0.5]

2 kg · spring 50 N/m · damper 4 N·s/m
جارٍ تحميل الرسم…
أو ← →
اقرأ الدرس خطوة بخطوة
  1. The cart as matrices

    Our plant is the cart from State-space models: 2 kg on a spring and damper, pushed by a force u. Its state x is position x₁ and velocity x₂, and it obeys ẋ = Ax + Bu.

    x = [x1, x2]   position (m), velocity (m/s)
    
    x' = A x + B u
    A = [[  0,  1],
         [-25, -2]]
    B = [0, 0.5]
    
    2 kg · spring 50 N/m · damper 4 N·s/m
  2. It rings

    Push it with a steady 10 N and it overshoots by 53% and rings for 3.9 s. The reason is in A: its eigenvalues, the poles, sit at −1 ± j4.90, close to the imaginary axis.

    det(sI - A) = s^2 + 2s + 25
    poles       -1 ± j4.90   (damping ratio 0.2)
    
    step, u = 10 N
    peak        0.305 m  (+53 %)
    within 2 %  after 3.9 s
  3. Measure the whole state

    State feedback needs every state variable, not just the output. Sensors read the position x₁ and the velocity x₂, and each one travels back along its own wire to a gain.

    frozen at t = 0.4 s of the open-loop push
    x1 = 0.225 m
    x2 = 0.63 m/s
    
    Full-state feedback: every state is
    measured (or estimated) at every instant.
  4. The feedback law

    Multiply each state by a gain and subtract the sum from the input: u = −k₁x₁ − k₂x₂, or u = −Kx. The row K = [k₁ k₂] holds the only two numbers we get to choose.

    u = -K x = -(k1*x1 + k2*x2)
    K = [k1, k2]   one gain per state
    
    k1  how hard to pull back per metre
    k2  how hard to brake per m/s
  5. Feedback rewrites A

    Put u = −Kx into ẋ = Ax + Bu and you get ẋ = (A − BK)x. The loop acts like a new plant with matrix A − BK, so its poles are the eigenvalues of A − BK, not of A.

    x' = A x + B(-K x) = (A - B K) x
    
    A - B K = [[        0,          1],
               [-25 - 0.5 k1, -2 - 0.5 k2]]
    
    new poles = eigenvalues of A - B K
  6. One gain, one coefficient

    Here det(sI − (A − BK)) = s² + (2 + 0.5k₂)s + (25 + 0.5k₁). The velocity gain sets the damping term and the position gain sets the stiffness term: two gains, two coefficients.

    det(sI - (A - BK))
      = s^2 + (2 + 0.5 k2) s + (25 + 0.5 k1)
               damping          stiffness
    
    k2 = 0, k1 = 0  ->  s^2 + 2s + 25 (the cart alone)
  7. Choose where poles go

    We want little ringing and a quick finish, so we pick poles at −4 ± j4: damping ratio 0.71, about 4.3% overshoot. Those two poles mean the polynomial (s + 4)² + 16 = s² + 8s + 32.

    wanted poles   -4 ± j4
    damping ratio  0.71   natural frequency 5.66 rad/s
    (s + 4 - 4j)(s + 4 + 4j) = s^2 + 8s + 32
    
    further left  = faster decay
    less height   = less ringing
  8. Match and solve

    Match coefficients: 2 + 0.5k₂ = 8 gives k₂ = 12, and 25 + 0.5k₁ = 32 gives k₁ = 14. As the gains grow from zero, the poles slide from −1 ± j4.90 to −4 ± j4.

    # pole placement by matching coefficients
    A = [[0, 1], [-25, -2]]
    b = 0.5                  # B = [0, b]
    a1, a0 = 8, 32           # want s^2 + 8s + 32
    k2 = (a1 + A[1][1]) / b  # 2 + 0.5*k2 = 8
    k1 = (a0 + A[1][0]) / b  # 25 + 0.5*k1 = 32
    print(k1, k2)            # 14.0 12.0
  9. Why it works here

    Matching works because the cart is controllable: [B AB] = [0 0.5; 0.5 −1] has determinant −0.25, not zero. Then K can put the poles anywhere, as long as complex poles come in conjugate pairs.

    controllability matrix
    [B  AB] = [[0.0,  0.5],
               [0.5, -1.0]]
    det = -0.25  (not zero: full rank)
    
    full rank  -> any pole set is reachable
    rank short -> some poles cannot move
  10. Aim at a target

    u = −Kx only pulls the cart to zero. To aim at r = 0.2 m, add a reference gain: u = N̄r − Kx. N̄ = 64 makes the cart settle at r; with N̄ = 1 it would stop at 3.1 mm.

    x1 / r at steady state = 0.5 * Nbar / 32
    Nbar = 32 / 0.5 = 64  ->  x1 -> r exactly
    Nbar = 1             ->  x1 -> 3.1 mm
    
    u = 64 r - 14 x1 - 12 x2
  11. The placed loop

    Ask for 0.2 m. The cart rises, overshoots by 4.3% to 0.209 m, and stays within 2% after 1.1 s. Open loop overshot 53% and took 3.9 s. Same cart, new poles.

    # simulate u = 64*r - 14*x1 - 12*x2
    x1 = x2 = peak = 0.0
    r, dt = 0.2, 1e-4
    for n in range(40000):    # 4 s
        u = 64 * r - 14 * x1 - 12 * x2
        x1, x2 = x1 + dt * x2, x2 + dt * (-25 * x1 - 2 * x2 + 0.5 * u)
        peak = max(peak, x1)
    print(round(peak, 3))    # 0.209
  12. The price is force

    The loop starts with 12.8 N, eases to 5.5 N to brake the cart, then settles at 10 N, the force the spring needs. Poles further left need bigger gains and more force than the motor may have.

    u(0)        12.8 N   (64 * 0.2)
    smallest    5.5 N   at 0.24 s (braking)
    steady      10 N   (50 N/m * 0.2 m)
    
    faster poles -> bigger K -> bigger u

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