Controllability and observability
لم يُترجم بعد؛ يُعرض باللغة الإنجليزية
عن هذا الدرس
Before you design a controller from a state-space model, ask two questions: can the input steer every state, and can the output reveal every state? Follow the cart from "State-space models" through both rank tests, steer it to a target with two computed pushes, then watch two identical tanks fail both tests: one pump cannot hold them apart, and one total-level sensor cannot tell them apart.
Two questions about a model
A state-space model ẋ = Ax + Bu, y = Cx raises two questions. Can the input u steer every state wherever we like? That is controllability. Can the output y reveal every state? That is observability. Start with the cart.
the cart from "State-space models"
2 kg, spring 50 N/m, damper 4 N·s/m
x = [x₁, x₂] = [position, velocity]
u = force (N) y = position (m)
A = [[ 0, 1], B = [0, 0.5]ᵀ
[-25, -2]] C = [1, 0]
controllable u can drive x anywhere
observable y lets us work out xاقرأ الدرس خطوة بخطوة
Two questions about a model
A state-space model ẋ = Ax + Bu, y = Cx raises two questions. Can the input u steer every state wherever we like? That is controllability. Can the output y reveal every state? That is observability. Start with the cart.
the cart from "State-space models" 2 kg, spring 50 N/m, damper 4 N·s/m x = [x₁, x₂] = [position, velocity] u = force (N) y = position (m) A = [[ 0, 1], B = [0, 0.5]ᵀ [-25, -2]] C = [1, 0] controllable u can drive x anywhere observable y lets us work out xThe push reaches velocity
B = [0, 0.5] says the force acts only on the velocity x₂, at 0.5 m/s² per newton. There is no wire from u to the position x₁: that entry of B is zero. Is the position out of reach?
ẋ₁ = 0·x₁ + 1·x₂ + 0·u ← u not here ẋ₂ = −25·x₁ − 2·x₂ + 0.5·u ← u enters here B = [0, 0.5]ᵀ A zero entry is a missing wire: the force cannot change the position directly.Velocity carries it on
No. Row one of A says ẋ₁ = x₂: velocity flows into position, so the push reaches x₁ one integration later. Multiplying shows it: AB = [0.5, −1]. Its first entry is no longer zero.
B = [0, 0.5] u changes x₂ now AB = A·B = [ 0·0 + 1·0.5, −25·0 − 2·0.5] = [0.5, −1] ...and x₁ next Each extra power of A follows the wires one more step: B, AB, A²B, ...The controllability matrix
Put the two directions side by side: [B AB] = [[0, 0.5], [0.5, −1]]. Its determinant is −0.25, not zero, so the columns point different ways and span the plane. Rank 2 equals the number of states: controllable.
A = [[0, 1], [-25, -2]] B = [0, 0.5] AB = [A[0][0]*B[0] + A[0][1]*B[1], A[1][0]*B[0] + A[1][1]*B[1]] det = B[0]*AB[1] - AB[0]*B[1] # columns B and AB print(AB, det) # [0.5, -1.0] -0.25 # n states: controllable iff rank [B AB ... A^(n-1)B] = nSteer it anywhere
Controllable means we can solve for an input. Goal: from rest to 0.1 m, stopped, in 1 s. Two unknowns, two equations: push 2.17 N for half a second, then 4.20 N. It lands exactly, and 5 N holds it.
A = [[0, 1], [-25, -2]]; B = [0, 0.5] def run(x, u, T, dt=1e-4): for _ in range(round(T / dt)): d = [A[i][0]*x[0] + A[i][1]*x[1] + B[i]*u for i in range(2)] x = [x[i] + d[i]*dt for i in range(2)] return x g1 = run(run([0, 0], 1, 0.5), 0, 0.5) # 1 N early g2 = run([0, 0], 1, 0.5) # 1 N late det = g1[0]*g2[1] - g1[1]*g2[0] # not 0: solvable u1, u2 = 0.1*g2[1] / det, -g1[1]*0.1 / det x = run(run([0, 0], u1, 0.5), u2, 0.5) print(round(u1, 2), round(u2, 2), round(x[0], 3), abs(round(x[1], 3))) # 2.17 4.2 0.1 0.0Two identical tanks
Now a system that fails. Two identical tanks each head for the pump setting u with a 1-minute time constant: ẋ₁ = −x₁ + u, ẋ₂ = −x₂ + u. One pump feeds both, so B = [1, 1]. Every state has a wire.
ẋ₁ = −x₁ + u tank 1 (level, m) ẋ₂ = −x₂ + u tank 2 (level, m) t in minutes A = [[-1, 0], B = [1, 1]ᵀ [ 0, -1]] No wire between the tanks: A₁₂ = A₂₁ = 0. The pump reaches both directly.The gap ignores the pump
Start tank 1 at 1 m and tank 2 empty, then run the pump. Subtract the equations: the gap x₁ − x₂ obeys d(gap)/dt = −gap. It fades as e^(−t) whatever u does. No input can hold the levels apart.
def gap_after_2min(u_of_t, dt=1e-3): x1, x2 = 1.0, 0.0 for n in range(2000): u = u_of_t(n * dt) x1 += (-x1 + u) * dt x2 += (-x2 + u) * dt return round(x1 - x2, 3) print(gap_after_2min(lambda t: 0), gap_after_2min(lambda t: 1), gap_after_2min(lambda t: 5 * t)) # 0.135 0.135 0.135The test catches it
AB = [−1, −1] lies along the same line as B = [1, 1]. So [B AB] = [[1, −1], [1, −1]] has determinant 0 and rank 1. The pump moves only the average level. A wire to every state is not enough.
A = [[-1, 0], [0, -1]] B = [1, 1] AB = [A[0][0]*B[0] + A[0][1]*B[1], A[1][0]*B[0] + A[1][1]*B[1]] det = B[0]*AB[1] - AB[0]*B[1] print(AB, det) # [-1, -1] 0 # reachable: only multiples of [1, 1] (the average) # out of reach: the gap direction [1, -1]Observability: what y reveals
Now the mirror question. The cart's sensor reads position only: C = [1, 0]. Velocity is how fast that reading changes: CA = [0, 1]. Stacked, [C; CA] is the identity: determinant 1, rank 2. The cart is observable.
A = [[0, 1], [-25, -2]] C = [1, 0] CA = [C[0]*A[0][0] + C[1]*A[1][0], C[0]*A[0][1] + C[1]*A[1][1]] det = C[0]*CA[1] - C[1]*CA[0] # rows C and CA print(CA, det) # [0, 1] 1 # y = x₁, dy/dt = CA·x = x₂: two readings, two statesTwo starts, one output
Read the tanks with one sensor for the total level, C = [1, 1], pump off. Start A at [1, 0] and start B at [0, 1] give the same output, e^(−t), for ever. [C; CA] = [[1, 1], [−1, −1]]: rank 1, unobservable.
def y_after(x1, x2, T=1.0, dt=1e-3): # pump off for n in range(round(T / dt)): x1 += -x1 * dt x2 += -x2 * dt return round(x1 + x2, 4) # y = Cx print(y_after(1, 0), y_after(0, 1), y_after(0.3, 0.7)) # 0.3677 0.3677 0.3677Test before you design
State feedback can move every pole only if the system is controllable; an observer can place its error poles only if it is observable. The tanks hide a mode: their transfer function is just 2/(s + 1). Check the ranks first.
C(sI − A)⁻¹B for the tanks = [1, 1]·diag(1/(s+1), 1/(s+1))·[1, 1]ᵀ = 2/(s + 1) first order, 2 states the gap mode cannot be reached or seen # python-control (optional) import control as ct, numpy as np A = [[0, 1], [-25, -2]]; B = [[0], [0.5]]; C = [[1, 0]] np.linalg.matrix_rank(ct.ctrb(A, B)) # 2 np.linalg.matrix_rank(ct.obsv(A, C)) # 2
أسئلة سريعة: 5
اختر إجابة واحدة لكل سؤال. يمكنك تغيير اختياراتك قبل التحقق منها.
01For the cart, B = [0, 0.5] has a zero in the position row. Why is the cart still controllable?
Controllability asks whether B and its images AB, A²B, … together span every direction. Here B and AB are independent: det [B AB] = −0.25 ≠ 0.
02Two identical tanks: ẋ₁ = −x₁ + u, ẋ₂ = −x₂ + u. What does the rank test say?
det [[1, −1], [1, −1]] = 0. The pump moves only the average level; the gap x₁ − x₂ obeys d(gap)/dt = −gap whatever u does.
03With C = [1, 1] on the tanks and the pump off, starts [1, 0] and [0, 1] both give y = e^(−t). What does that show?
Observable means the output (with the known input) fixes the state. [C; CA] = [[1, 1], [−1, −1]] has rank 1, and the unseen direction is the gap [1, −1].
04The cart measures position only, C = [1, 0]. What is CA, and is the cart observable?
CA = [1, 0]·[[0, 1], [−25, −2]] = [0, 1]: the rate of change of the reading is the velocity. Two independent rows, so both states can be worked out.
05The tanks have two states but their transfer function C(sI − A)⁻¹B is 2/(s + 1). Why only first order?
A transfer function only describes the part of the system that is both controllable and observable. That is why the state-space tests come before state-feedback and observer design.
المسرد
- Controllable
- An input can drive the state from any starting point to any target in finite time. For n states: rank [B AB … Aⁿ⁻¹B] = n.
- Observable
- The output (and the known input) over a finite time is enough to work out the starting state. For n states: rank [C; CA; …; CAⁿ⁻¹] = n.
- Controllability matrix
- The matrix whose columns are B, AB, …, Aⁿ⁻¹B: the directions the input can push the state, directly and through A. python-control: ct.ctrb(A, B).
- Observability matrix
- The matrix whose rows are C, CA, …, CAⁿ⁻¹: what the output and its rates of change show about the state. python-control: ct.obsv(A, C).
- Rank
- The number of independent rows (or columns) of a matrix. A 2×2 matrix has rank 2 exactly when its determinant is not zero.
- Hidden mode
- A part of the motion that the input cannot reach or the output cannot see. It does not appear in the transfer function.
- Stabilisable / detectable
- Every uncontrollable mode (stabilisable) or every unobservable mode (detectable) is stable on its own, so feedback can still work even though it cannot move that pole.
الملاحظات والمصادر
- The cart is the 2 kg, 50 N/m, 4 N·s/m cart of the earlier lessons; the tanks are an illustrative pair with a 1-minute time constant. Every curve and number in the figure is computed from these state equations.
- For n states the tests use n blocks: controllable if and only if [B AB … Aⁿ⁻¹B] has rank n, observable if and only if [C; CA; …; CAⁿ⁻¹] has rank n. With two states that is one 2×2 determinant each.
- The tanks' hidden mode, the gap, still dies away by itself (its pole is at −1). A system whose unreachable and unseen modes are stable is called stabilisable and detectable; feedback can still work on it, it just cannot move that pole.
- The Python on each step is plain Python 3. It steps the equations forward with small time steps, so its last digits differ slightly from the exact values the figure plots.
- K. Ogata, Modern Control Engineering, 5th ed., Pearson (ch. 9, §9-6 Controllability, §9-7 Observability)
- N. S. Nise, Control Systems Engineering, 8th ed., Wiley (ch. 12, Design via state space)
- G. F. Franklin, J. D. Powell, A. Emami-Naeini, Feedback Control of Dynamic Systems, 8th ed., Pearson (ch. 7, State-space design)
- MIT OpenCourseWare 16.06 Principles of Automatic Control (S. Hall)
- MIT OpenCourseWare 6.302 Feedback Systems (Roberge, Dawson, Lundberg)
- python-control: control.ctrb (controllability matrix)
- python-control: control.obsv (observability matrix)
اختبار يتاح بعد الخطوة الأخيرة.