Professional Documents
Culture Documents
Lecture 3
Discretization, controllability, state feedback
2. Discretization
3. Controllability
Controllability tests
Controllability indices
Controllability in practice
4. State feedback
Pole placement
2. Discretization
3. Controllability
Controllability tests
Controllability indices
Controllability in practice
4. State feedback
Pole placement
Nonlinear system
A magnet (mass m) is hovering below a stationary magnet, with the stationary magnet imposing
an attractive force on the hovering magnet.
z1 : the vertical speed of the hovering magnet (positive downwards)
z2 : its distance from the stationary magnet (positive downwards).
The vertical magnetic force on the hovering magnet equals −(ku /z22 )f , where f is the input signal
and ku is a constant. Neglecting air resistance, the vertical dynamics of the hovering magnet are
described by the following nonlinear equations:
ku f
ż1 =g −
mz22
ż2 =z1
Linearized system
gmx 2
We define a reference distance xr and a reference input u0 = k r such that the magnet is in
u
equilibrium when z1 = 0 and z2 = xr . Using the state variables: x1 = z1 and x2 = z2 − xr , we get
the following linearized system:
A B
z" }| #{ z" }| #{
2g ku
−
ẋ1 0 xr
x1 mxr2
= + u
ẋ2 1 0 x2 0
Eigenvalues
We find the system’s eigenvalues by solving |λI − A| = 0:
q
2g
λ1 : xr
q
λ2 : − 2g x r
As one of the eigenvalues has a positive real value, the system’s response will tend to ”blow up”.
Intuitively: if the magnet drops slightly below the equilibrium point, the magnetic force gets weaker,
leading the magnet to drop further. If the magnet rises above the equilibrium, the force grows
stronger, leading the magnet to rise further.
Eigenvectors
" q # " q #
2g 2g
−
v1 = xr , v2 = xr
1 1
For this system: the eigenvectors are combinations of speed (x1 ) and position (x2 ) that excite a
proportional response.
q
v1 : above or below equilibrium, moving away at a speed 2g xr
times the distance.
q
v2 : above or below equilibrium, moving toward it at a speed 2g x
times the distance.
r
2. Discretization
3. Controllability
Controllability tests
Controllability indices
Controllability in practice
4. State feedback
Pole placement
ẋ = Ax + Bu
y = Cx + Du
Discretization
Discretization is a necessary step for computer simulation. A recursive model is sought:
Many methods are available for obtaining a discretized model. We examine the two most common
methods: Exact and Euler discretization.
Approach
Realize Discretize Recursion
TF −−−−→ CLTI −
−−−−−
→ DLTI −−−−−−→ Solution
1
Some systems are discrete by nature, such as financial systems or discrete filters. Most plants will however be continuous as
they are based on a physical model.
TTK4115 (MOA) Lecture 3 10 / 64
LTI solution
The exact solution of the LTI system forms the theoretical basis of exact discretization.
ẋ = Ax + Bu
y = Cx + Du
Z t
x(t) = eAt x0 + eA(t−τ ) Bu(τ )dτ
0
Sampling
Time is discretized into intervals of duration T : t = kT . Sample index is denoted k.
The state solution from one sample to the next is:
Z (k +1)T
x((k + 1)T ) = eAT x(kT ) + eA[(k +1)T −τ ] Bu(τ )dτ
kT
Substitution rule
Z y (b) Z b dy
F (x)dx = F (y(x)) dx
y(a) a dx
τ0 = kT → α0 = T , τ1 = (k + 1)T → α1 = 0
Bd
Ad z }| ! {
z}|{ Z T
x[k + 1] = eAT x[k] + eAα dα B u[k]
0
Euler discretization
Euler’s method proceeds via the definition of the derivative2 :
x[k + 1] − x[k]
ẋ[k] ≈
T
Thus:
ẋ[k] = Ax[k] + Bu[k] ⇒ x[k + 1] = Ix[k] + T Ax + T Bu
Stability
Euler’s method may be unstable although the underlying plant is stable. This problem gets worse
with larger timesteps. A mathematical criterion for first order systems may be stated as:
|1 + T λ| ≤ 1
2
x[k] = x(kT )
TTK4115 (MOA) Lecture 3 14 / 64
Euler’s Method vs Discretization
3 x[k+1] = Ad x[k]
x[k+1] = x[k] + T A x[k]
2
1
x[m]
−1
−2
−3
5 10 15 20 25
t[s]
2. Discretization
3. Controllability
Controllability tests
Controllability indices
Controllability in practice
4. State feedback
Pole placement
or the pair (A, B) is said to be controllable if for any initial state x[0] = x0 and any final state x1 ,
there exists an input sequence of finite length that transfers x0 to x1 . Otherwise it is said to be
uncontrollable.
Example
Consider the single input discrete system:
4 steps forward
Starting point is x[0]:
Key idea
A2 B A3 B
Iff B AB has full rank, we can choose x[4] as we like with our inputs.
Controllability matrix
Iff the controllability matrix has full rank: rank(C) = n
C , B AB . . . A(n−1) B
the state can be placed anywhere with the right sequence of inputs.
Therefore, the system is controllable.
The controllability matrix can be used to test controllability for both discrete time and continuous
systems.
2. Discretization
3. Controllability
Controllability tests
Controllability indices
Controllability in practice
4. State feedback
Pole placement
Result
Z t1 T
h i
x1 = eAt1 x0 − eA(t1 −τ ) B BT eA (t1 −τ ) W−1
c (t1 ) e
At1
x0 − x1 dτ
0
Wc (t1 )
z }| {
Z t1
T AT (t1 −τ )
h i
=e At1
x0 − e A(t1 −τ )
BB e dτ W−1
c (t1 ) e
At1
x0 − x1
0
h i
= eAt1 x0 − eAt1 x0 − x1 = x1
This shows that the system is controllable if Wc (t) is invertible for any t > 0.
0 0
Z tz }| {z }| {
T
T
v Wc (t)v = vT eA(t−τ ) B BT eA (t−τ ) v dτ = 0
0
Premultiplying by vT :
0
Z t1 z }| {
0=v v+T
vT eA(t1 −τ ) B u(τ )dτ = ||v||2 + 0
0
vT C = vT [B AB ... An−1 B] = 0
vT eAt B = 0
Which shows:
If C doesn’t have full rank, Wc (t) cannot be invertible.
vT [B AB ... An−1 B] = vT C = 0
Which shows:
If Wc (t) is not invertible, C cannot have full row rank.
Controllability Gramian
Z t T
Wc (t) = eA(t−τ ) BBT eA (t−τ )
dτ
0
Controllability Matrix
np
z }| {
C= B AB ··· An−1 B }n
Iff the controllability matrix has full rank: rank(C) = n, the system is controllable.
Example
θ m
u
M
Example
θ m
u
M
Linearized EOM
0 0 1 0
ẋ x 0
θ̇ 0 0 0 1 θ 0
u
ẍ =
+
− gm 1
0 M
0 0 ẋ
M
g(m+M) 1
θ̈ 0 lM
0 0 θ̇ − lM
Controllability Gramian
Z t T
Wc (t) = eA(t−τ ) BBT eA (t−τ )
dτ
0
t
0.5 1.0 1.5 2.0 2.5 3.0
-2
-4
x,Θ
1.0
0.8
0.6
0.4
0.2
t
0.5 1.0 1.5 2.0 2.5 3.0
Popov-Belevitch-Hautus test
The PBH test gives an elegant test based on this insight.
An LTI system is controllable iff:
Basic idea
If the Controllability matrix has full rank, there is no non-zero vector v such that:
BT
T
B A T
CTv =
v = 0
...
T
B (A )T (n−1)
Let q be an eigenvector of AT : AT q = λq
BT
BT
λBT
BT AT
CTq =
q = .. q
...
T T (n−1)
.
B (A )
λn−1 BT
If such an eigenvector q exists, the system is not controllable, and we have shown that the PBH
test is equivalent to that criterion.
2. Discretization
3. Controllability
Controllability tests
Controllability indices
Controllability in practice
4. State feedback
Pole placement
Controllability matrix
Controllability index
The controllability indices of bi : µi , are the number of linearly independent columns associated
with bi . If C has rank n, these indices sum to:
µ1 + µ2 + · · · + µp = n
Example
2 0 1 0 1
A= 1 1 0 , B= 0 0
2 2 1 1 0
Has this controllability matrix:
0 1 1 2 3 6
A2 b1 A2 b2
C= b1 b2 Ab1 Ab2 = 0 0 0 1 1 3
1 0 1 2 3 8
From the left, the green columns are the first linearly independent ones.
1 is associated with b1 (column 1), so µ1 = 1.
2 are associated with b2 (columns 2 and 4), so µ2 = 2.
µ1 + µ2 = 1 + 2 = 3 = n, so the system is controllable.
The controllability index of the system is 2.
Physical significance
The physical significance of the controllability index is not very clear for continous time systems.
For a controllable discrete time system with n states,
If the system has controllability index µ, there exists an input sequence of length µ that can
transfer the system to any other state.
µ may be lower than n, so for these systems we can in fact reach the desired state in fewer
than n steps.
Multi-input controllability
Using controllability indices, we can show that it is sufficient to check the rank of:
C = B AB . . . An−p B
to check controllability (where n is the number of states and p is the number of inputs, assuming B
has full column rank).
Property 1
Controllability is not affected by an equivalence transformation.
Property 2
Controllability is not affected by reordering the columns of B.
2. Discretization
3. Controllability
Controllability tests
Controllability indices
Controllability in practice
4. State feedback
Pole placement
Caveats
Even if the controllability matrix has full rank, this does not mean that the system is easy to control
in practice.
The controller may require too large inputs.
The closed loop response may be higly sensitive to modeling errors in ẋ = Ax + Bu.
The closed loop eigenvalues may have been chosen unrealistically fast.
Fast response requires powerful actuators and an accurate model.
The system may be ”almost uncontrollable” in practice.
Dynamic positioning
Vs
u2 θ
ω
u1
r V
State equation
d
−m 0 0
V̇ V 1/m − sin(θ)/m
u1
V̇s = 0 − dms 0 Vs + 0 cos(θ)/m
u2
ω̇ 0 0 − dJω ω 0 cos(θ)r /J
Dynamic positioning
Vs
u2 θ
ω
u1
r V
Controllability matrix
1 sin(θ) d sin(θ) d2 d 2 sin(θ)
− − md2 m2 m3
− m3
m m
cos(θ)ds2
C= 0 cos(θ) cos(θ)d
− m2 s
m
0 0 m3
2
r cos(θ) r cos(θ)dω r cos(θ)dω
0 J
0 − J2
0 J3
Condition number of C
Condition number of C
100
80
60
cond(C)
40
20
0
0 50 100 150 200 250 300 350
θ[deg]
2. Discretization
3. Controllability
Controllability tests
Controllability indices
Controllability in practice
4. State feedback
Pole placement
2. Discretization
3. Controllability
Controllability tests
Controllability indices
Controllability in practice
4. State feedback
Pole placement
State feedback
Our approach to control:
In the Control systems course you’ve learned about output feedback in monovariable (SISO)
systems.
The output feedback typically uses a reference r for the output y.
Here, we design state feedback controllers - using the full state vector x to calculate u.
If we cannot measure all states, we estimate them (using observer / Kalman filter).
We design controllers that drive x to 0. Why?
I 0 is the equilibrium point of the system ẋ = Ax + Bu.
I We can often define our states and input variables to place the ”point of interest” in 0
I If we need the system to follow a reference 6= 0, we add a feedforward to achieve that (next week).
Ā b̄
z }| { z }| {
x̄˙ = P−1 AP x̄ + P−1 b u
y = cP x̄
|{z}
c̄
s3 n1 + s2 n2 + sn3 + n4
g(s) = c̄(sI − Ā)−1 b̄ =
s4 + s3 α1 + s2 α2 + sα3 + α4
Ā b̄
z }| { z }| {
x̄˙ = P−1 AP x̄ + P−1 b u
y = cP x̄
|{z}
c̄
Transformation
1 α1 α2 α3
0 1 α1 α2
A2 b 3
P= b Ab A b
| {z } 0 0 1 α1
C 0 0 0 1
| {z }
C̄ −1
Reason
Factorize closed loop controllability matrix to obtain:
rank(Ck ) = rank(C)
Pole placement
Transform the plant to the controllable canonical form. Choose the state feedback:
u = k̄x̄, k̄ = η1 − α1 η2 − α2 η3 − α3 η4 − α4
s3 n1 + s2 n2 + sn3 + n4
⇒ gk (s) =
s4 + s3 η1 + s2 η2 + sη3 + η4
u
M
Linearized EOM
0 0 1 0
ẋ x 0
θ̇ 0 0 0 1 θ 0
u
u̇ =
+
− gm 1
0 M
0 0 ẋ
M
g(m+M) 1
q̇ 0 lM
0 0 θ̇ − lM
u
M
Controllability matrix
1 5
0 0
2 2
0 − 21 0 − 15
2
C= 1 5
Full rank
2
0 2
0
− 12 0 − 15
2
0
Characteristic polynomial
√ √
|sI − A| = s4 − 15s2 = s2 − 15 + s 15 + s
α2 = −15, α1,3,4 = 0
Transform
1 5
0 0
1 α1 α2 α3 2 2 1 0 −15 0
0 1 α1 = 0
α2 − 21 0 − 15
2 0
1 0 −15
P=C
0 0 1 α1 12 0 5
2
0 0 0 1 0
0 0 0 1 − 12 0 − 15 0 0 0 0 1
2
α2 = −15, α1,3,4 = 0
Transformed system
√
−2 15 −15 0 0
1 0 0 0
Ā − b̄k̄ =
0 1 0 0
0 0 1 0
Procedure
1 Calculate the system’s transfer function and controllability matrix.
2 Find transform to controllable canonical form, x = Px̄.
3 Choose gain matrix k̄ such that u = −k̄x̄ leads to the desired poles. Always possible.
4 Transform k̄ back to the original coordinates, k = k̄P−1
Pole placement
K̄ = (η1 − α1 )Ip (η2 − α2 )Ip (η3 − α3 )Ip (η4 − α4 )Ip
Comments
In matlab, use: ”K = place(A,B,eig)”.
Remember to always assign complex eigenvalues in pairs.
MIMO pole placement alters the common denominator of Gsp (s).
It may be difficult to tune the individual outputs.
Only eigenvalues are considered, not input amplitudes.