TExcelTAD
Home › Control Systems & Automation › Controllability and Observability

Controllability and Observability

The two-zone plate of State-Space Models gets a cheaper design: one power stage drives both heaters in parallel, and one sensor sits in the middle between them. The loop works, the average temperature is perfect, yet one zone ends up 3 K3\ \text{K} warmer than the other after someone puts a cold part on it, and the controller never corrects it. Nothing is broken. The difference between the zones is a mode that this actuator cannot push and this sensor cannot see. Controllability asks whether the inputs can steer every state; observability asks whether the outputs reveal every state. Both are yes/no questions with a simple matrix test, and both must be answered before pole placement or an observer can work.

Intuition: a bridge with a capacitor across it

A Wheatstone bridge has a capacitor C1C_1 between its two midpoints. Its voltage is a state. When the bridge is balanced (R4=R3R_4 = R_3, here 1 kΩ1\ \text{k}\Omega), the source raises both midpoints by exactly the same amount, so the capacitor voltage never moves, whatever the source does: that state is uncontrollable from the source. Unbalance the bridge with the slider and the two midpoints separate with a time constant: the state becomes controllable.

01230246810t (ms)VV(a)V(b)at t = 10.00 msV(in)5.00 VV(a)2.50 VV(b)3.33 VI(V1)-4.17 mAI(R1)2.50 mAI(R2)2.50 mAI(R3)1.67 mAI(R4)1.67 mAI(C1)-135 nA

At R4=2 kΩR_4 = 2\ \text{k}\Omega both midpoints start at 2.857 V2.857\ \text{V} (the capacitor holds 0 V0\ \text{V}) and separate towards 2.5 V2.5\ \text{V} and 3.333 V3.333\ \text{V} with τ=C1(R1∥R2+R3∥R4)=1 μF×1167 Ω=1.17 ms\tau = C_1(R_1 \parallel R_2 + R_3 \parallel R_4) = 1\ \mu\text{F} \times 1167\ \Omega = 1.17\ \text{ms}; at t=1 mst = 1\ \text{ms} the lab shows 2.652 V2.652\ \text{V} and 3.131 V3.131\ \text{V}. Slide R4R_4 to 1 kΩ1\ \text{k}\Omega and both traces stay at 2.5 V2.5\ \text{V}: the capacitor's state is decoupled from the input.

The definitions and the rank tests

A system x˙=Ax+Bu\dot{x} = Ax + Bu is controllable if for any initial state and any target state there is an input that moves the system from one to the other in finite time. It is observable if the initial state can be worked out from the input and the output over a finite interval. For an nn-state LTI system both reduce to the rank of a matrix (Kalman's tests):

C=[BABA2B⋯An−1B],O=[CCA⋮CAn−1]\mathcal{C} = \begin{bmatrix} B & AB & A^2B & \cdots & A^{n-1}B \end{bmatrix}, \qquad \mathcal{O} = \begin{bmatrix} C \\ CA \\ \vdots \\ CA^{n-1} \end{bmatrix}

controllable   ⟺  rank⁡C=n\iff \operatorname{rank}\mathcal{C} = n, observable   ⟺  rank⁡O=n\iff \operatorname{rank}\mathcal{O} = n. The columns of C\mathcal{C} are the directions the input can push the state, directly (BB) and after the dynamics have acted once, twice, … (ABAB, A2BA^2B); the rows of O\mathcal{O} are what the output and its derivatives reveal. In python-control: ct.ctrb(A, B) and ct.obsv(A, C).

The tests are dual: (A,C)(A, C) is observable exactly when (AT,CT)(A^T, C^T) is controllable. Every controller-design method therefore gives an observer-design method for free, which Observers uses.

A mode-by-mode view (the Popov–Belevitch–Hautus test): an eigenvalue λ\lambda of AA is uncontrollable if rank⁡[ λI−A  B ]<n\operatorname{rank}[\,\lambda I - A \ \ B\,] < n, unobservable if rank⁡[λI−AC]<n\operatorname{rank}\begin{bmatrix} \lambda I - A \\ C \end{bmatrix} < n. It tells you which mode is the problem. An unstable or badly damped mode that is uncontrollable cannot be fixed by any feedback; such a plant is not stabilisable, and the hardware has to change.

Pole-zero cancellation hides modes

A transfer function shows only the part of the system that is both controllable and observable (Kalman's decomposition). If a zero of one block cancels a pole of another, the cancelled mode disappears from G(s)G(s) but not from the hardware. Cancelling a stable, fast pole is harmless; cancelling an unstable one ("put a zero at s=+2s = +2 to remove the unstable pole") leaves an internal signal that grows without bound while the transfer function looks fine. ct.minreal removes cancelled modes from a model; when it shrinks a physical model, ask which mode went missing and why.

Worked example: the plate with one actuator and one sensor

Given: the plate model with Ch=75 J/KC_h = 75\ \text{J/K}, R=8 K/WR = 8\ \text{K/W}, R12=4 K/WR_{12} = 4\ \text{K/W}, so A=175[−0.3750.250.25−0.375] s−1A = \frac{1}{75}\begin{bmatrix} -0.375 & 0.25 \\ 0.25 & -0.375 \end{bmatrix}\ \text{s}^{-1}. Both heaters wired in parallel: B=175[ 1, 1 ]TB = \frac{1}{75}[\,1,\ 1\,]^T. Sensor in the middle reading the average: C=[ 0.5, 0.5 ]C = [\,0.5,\ 0.5\,].

Find: the ranks of C\mathcal{C} and O\mathcal{O}, and which mode is lost.

Solve:

  • AB=1752(−0.375+0.25)[ 1, 1 ]T=−0.125752[ 1, 1 ]TAB = \frac{1}{75^2}(-0.375 + 0.25)[\,1,\ 1\,]^T = -\frac{0.125}{75^2}[\,1,\ 1\,]^T: parallel to BB. So C=[ B  AB ]\mathcal{C} = [\,B\ \ AB\,] has rank 1, not 2.
  • Similarly CA=−0.12575[ 0.5, 0.5 ]CA = -\frac{0.125}{75}[\,0.5,\ 0.5\,] is parallel to CC: rank 1.
  • The eigenvectors of AA are [ 1, 1 ]T[\,1,\ 1\,]^T (zones together, λ=−0.125/75=−1/600 s−1\lambda = -0.125/75 = -1/600\ \text{s}^{-1}) and [ 1, −1 ]T[\,1,\ -1\,]^T (zones apart, λ=−0.625/75=−1/120 s−1\lambda = -0.625/75 = -1/120\ \text{s}^{-1}). The input only excites the first, and the sensor only sees the first. The difference mode is both uncontrollable and unobservable: it decays on its own with a 120 s120\ \text{s} time constant, but nothing in the loop can speed it up or detect it.

Check: the code computes the ranks, then repairs the design two ways: separate heater drives, or a sensor on zone 1 only.

python · try it yourself
import numpy as np
import control as ct

Ch, g, g12 = 75.0, 1 / 8, 1 / 4
A = np.array([[-(g + g12), g12], [g12, -(g + g12)]]) / Ch

def ranks(B, C):
    return np.linalg.matrix_rank(ct.ctrb(A, B)), np.linalg.matrix_rank(ct.obsv(A, C))

cases = {
    "heaters in parallel, average sensor": (np.array([[1], [1]]) / Ch, np.array([[0.5, 0.5]])),
    "two separate heaters, average sensor": (np.eye(2) / Ch, np.array([[0.5, 0.5]])),
    "heaters in parallel, sensor on zone 1": (np.array([[1], [1]]) / Ch, np.array([[1.0, 0.0]])),
    "one heater on zone 1, sensor on zone 1": (np.array([[1], [0]]) / Ch, np.array([[1.0, 0.0]])),
}
for name, (B, C) in cases.items():
    rc, ro = ranks(B, C)
    print(f"{name:40s}: rank ctrb {rc}, rank obsv {ro}")

# The transfer function of the first case shows one pole only
G = ct.ss2tf(ct.ss(A, cases["heaters in parallel, average sensor"][0], [[0.5, 0.5]], 0))
Gm = ct.minreal(G, verbose=False)
print("poles of G before minreal (1/s):", np.round(np.sort(ct.poles(G).real), 5))
print("poles after minreal (1/s):      ", np.round(ct.poles(Gm).real, 5))
heaters in parallel, average sensor     : rank ctrb 1, rank obsv 1
two separate heaters, average sensor    : rank ctrb 2, rank obsv 1
heaters in parallel, sensor on zone 1   : rank ctrb 1, rank obsv 2
one heater on zone 1, sensor on zone 1  : rank ctrb 2, rank obsv 2
poles of G before minreal (1/s): [-0.00833 -0.00167]
poles after minreal (1/s):       [-0.00167]

The minimal model keeps only the slow common mode at −1/600=−0.00167 s−1-1/600 = -0.00167\ \text{s}^{-1}; the difference mode at −1/120-1/120 is gone from the transfer function but not from the plate. A heater on one zone plus a sensor on that zone is enough: through the coupling resistance it reaches and sees both modes, because AA mixes them.

Nearly uncontrollable is a practical problem

The rank test is a yes/no answer; real hardware is often almost uncontrollable. If the two heater gains differ by 2 %, the rank is 2, but steering the difference mode then needs enormous, opposite heater powers. The condition number of C\mathcal{C} (or the smallest singular value of the controllability Gramian, ct.gram) measures how hard a direction is to reach:

python · try it yourself
import numpy as np
import control as ct

Ch, g, g12 = 75.0, 1 / 8, 1 / 4
A = np.array([[-(g + g12), g12], [g12, -(g + g12)]]) / Ch
for mismatch in (0.0, 0.02, 0.2, 1.0):
    B = np.array([[1.0], [1.0 - mismatch]]) / Ch
    s = np.linalg.svd(ct.ctrb(A, B), compute_uv=False)
    rank = np.linalg.matrix_rank(ct.ctrb(A, B))
    ratio = s[0] / s[1] if s[1] > 1e-15 else float("inf")
    print(f"heater 2 gain {1 - mismatch:4.2f}: rank {rank}, singular-value ratio {ratio:10.3g}")
heater 2 gain 1.00: rank 1, singular-value ratio        inf
heater 2 gain 0.98: rank 2, singular-value ratio   1.49e+04
heater 2 gain 0.80: rank 2, singular-value ratio   1.37e+03
heater 2 gain 0.00: rank 2, singular-value ratio        300

The ratio falls from very large to moderate as the second heater weakens: of the arrangements where the second heater gets between 0 and 100 % of the drive, a single heater on zone 1 (gain 0) reaches both modes most easily, which is not obvious without the test. (The ratio also depends on how the states are scaled, so compare arrangements of one plant, not different plants.)

Guided lab: the bridge on the bench

Hand calculation. For R1=R2=R3=1 kΩR_1 = R_2 = R_3 = 1\ \text{k}\Omega, R4=2 kΩR_4 = 2\ \text{k}\Omega, C1=1 μFC_1 = 1\ \mu\text{F} and a 5 V5\ \text{V} step: final va=2.5 Vv_a = 2.5\ \text{V}, vb=3.333 Vv_b = 3.333\ \text{V}, τ=1.17 ms\tau = 1.17\ \text{ms}. Balanced (R4=1 kΩR_4 = 1\ \text{k}\Omega): va−vb=0v_a - v_b = 0 for all time.

Simulation. The netlist lab above; set R4R_4 to 1.1 kΩ1.1\ \text{k}\Omega and see how small the controllable part becomes: final vb−va=5(1100/2100)−2.5=0.119 Vv_b - v_a = 5(1100/2100) - 2.5 = 0.119\ \text{V}.

What you would measure. Build it on a breadboard with 1 % resistors and a film capacitor, drive it from a 5 V5\ \text{V} square wave at 50 Hz50\ \text{Hz} (function generator, 50 Ω50\ \Omega output) and look at va−vbv_a - v_b with the scope's math channel. Balanced, you see only a few millivolts (resistor tolerance: 1 % parts leave up to about ±50 mV\pm 50\ \text{mV}); unbalanced, a clean exponential with τ≈1.2 ms±10 %\tau \approx 1.2\ \text{ms} \pm 10\,\% (capacitor tolerance).

Hazards and safe setup. 5 V5\ \text{V} only; nothing hazardous. Ground both scope probes to the generator ground, and use the math channel rather than floating one probe.

Pitfalls

  • Calling a plant controllable because its transfer function has the right order: cancellations hide modes.
  • Trusting matrix_rank on badly scaled matrices: scale states to similar units first, and look at singular values, not only the rank.
  • Cancelling an unstable plant pole with a controller zero: the transfer function looks stable, the internal signals are not.
  • Forgetting that adding a sensor (observability) or an actuator (controllability) is often cheaper than a clever controller.

Practice

  1. Is A=[0100]A = \begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix}, B=[ 0, 1 ]TB = [\,0,\ 1\,]^T (a double integrator, force to position) controllable? Is it observable with C=[ 0, 1 ]C = [\,0,\ 1\,] (velocity sensor only)?
  2. The motor of State-Space Models with only a current sensor, C=[ 1, 0 ]C = [\,1,\ 0\,]: observable?
Answer
  1. C=[ B  AB ]=[0110]\mathcal{C} = [\,B\ \ AB\,] = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}: rank 2, controllable. O=[0100]\mathcal{O} = \begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix}: rank 1, not observable: a velocity sensor cannot tell where the mass started.
  2. O=[10−2000−20]\mathcal{O} = \begin{bmatrix} 1 & 0 \\ -2000 & -20 \end{bmatrix}: rank 2, observable. The back-EMF term −k/La=−20-k/L_a = -20 carries the speed into the current.

Test yourself

An nn-state system is controllable when

  1. BB has nn nonzero entries
  2. [B AB ⋯ An−1B][B\ AB\ \cdots\ A^{n-1}B] has rank nn
  3. all eigenvalues of AA are negative
  4. CC is square

Two identical zones heated by one shared drive and measured by one average sensor: which mode is lost?

  1. the common (both rising together) mode
  2. the difference (zones apart) mode
  3. neither
  4. both

Observability of (A,C)(A, C) is equivalent to

  1. controllability of (AT,CT)(A^T, C^T)
  2. stability of AA
  3. controllability of (A,B)(A, B)
  4. D≠0D \ne 0

Why is cancelling an unstable plant pole with a controller zero unacceptable?

  1. it lowers the DC gain
  2. the unstable mode is still in the hardware, now uncontrollable or unobservable, and internal signals grow
  3. python-control cannot simulate it
  4. it creates a zero in the right half-plane