SSCS ss2019 Exam Solution
SSCS ss2019 Exam Solution
Prof. Dr. Moritz Diehl, Dr. Dang Doan, Benjamin Stickan, Katrin Baumgärtner, IMTEK, Universität Freiburg
21.08.19, 09:30 - 12:00 — Georges-Koehler-Allee 101, Seminar 01-009/013
Page 1 2 3 4 5 6 7
Points on page (max) 0 12 14 8 10 10 6
Points obtained
Intermediate sum
Please fill in your name above. For each question, give a short formula or text answer just below the question in the space provided, and, if
necessary, write on the backpage of the same sheet where the question appears, and add a comment “see backpage”. Do not add extra pages (for
fast correction, all pages will be separated for parallelization). The exam is a closed book exam, i.e. no books or other material are allowed besides
2 sheets (total 4 pages) of notes and a non-programmable calculator. Some legal comments are found in a footnote.1
Note: Data given in the questions are enough to figure the answers. Engineers often face situations with ‘vague’ data, it’s indeed additional freedom
for them to choose reasonable parameters.
1 WITHDRAWING FROM AN EXAMINATION: In case of illness, you must supply proof of your illness by submitting a medical report to the Examinations
Office. Please note that the medical examination must be done at the latest on the same day of the missed exam. In case of illness while writing the exam please
contact the supervisory staff, inform them about your illness and immidiatelly see your doctor. The medical certificate must be submitted latest 3 days after the medical
examination. More informations: http://www.tf.uni-freiburg.de/studies/exams/withdrawing exam.html
CHEATING/DISTRUBING IN EXAMINATIONS: A student who disrupts the orderly proceedings of an examination will be excluded from the remainder of the
exam by the respective examiners or invigilators. In such a case, the written exam of the student in question will be graded as ’nicht bestanden’ (5.0, fail) on the
grounds of cheating. In severe cases, the Board of Examiners will exclude the student from further examinations.
10 points on page: 0
(a) Write the state-space representation of this system, taking V (t) as the control input, θ̇(t) as the output.
2
θ̇
Take x = , u = V, y = θ̇, the state-space system:
i
−10 1 0
ẋ = x+ u
−0.02 −2 1
y= 1 0 x
(b) Calculate the controllability matrix of this system. Is the system fully controllable? Why?
2
0 1
C = [B, AB] =
1 −2
det(C ) 6= 0
C 1 0
O= =
CA −10 1
det(O) 6= 0
Using the controller u = −Kx with K = [k1 , k2 ], the closed-loop characteristic polynomial is:
λ + 10 −1
pcl (λ) = det(λI − A + BK) = det
k1 + 0.02 λ + 2 + k2
= λ2 + (k2 + 12) λ + 10k2 + 20 + k1 + 0.02 (4)
| {z } | {z }
=10 =26
(e) We want the output y of the controlled system to track a reference r, using a prefilter Kf such that u = −Kx + Kf r. Write the
formula for computing Kf based on K computed from step (1d).
2
−1
Kf = − C(A − BK)−1 B (6)
11 points on page: 12
2. LQR
Given a state-space continuous system:
ẋ = Ax + Bu
y = Cx
with the following parameters:
−10 0 0
A= , B= , C= 1 0 .
0 −1 2
(a) Determine from the state-space system: which state is controllable, which state is observable.
2
x1 is uncontrollable and observable. x2 is controllable and unobservable. (Students would get full score if they just write x2 is
controllable, x1 is observable. However the info on uncontrollable / unobservable state would be helpful to deal with later questions.)
(b) Calculate the eigenvalues of the closed-loop system using a state-feedback controller u = −K̄x with K̄ = 0 2 .
2
−10 0
Acl = A − BK =
0 −5
So the eigenvalues are: λ1 = −10, λ2 = −5.
(c) Explain why the output signal of the closed-loop system always exhibits a stable behaviour, regardless of the state-feedback gain K
that is used in the controller u = −Kx.
2
AT P + PA − PBR−1 BT P + Q = 0 (9)
We solve (9) to obtain a P 0, with Q < 0 and R 0.
(e) (*) Lily the Queen of Regulation claims that K̄ = 0 2 is an optimal controller in some sense. Your task is to trace back her
claim, by finding which weighting matrices Q, R used in the LQR formulation, such that K̄ is the solution.
6
First, we just choose R = 1 (we only need R > 0, another number is just a scaling factor, as we look at (8)). Using:
K = R−1 BT P, (10)
we calculate P to obtain:
p11 0
P=
0 1
with p11 free, we can let it be 1.
Then using (9), we substitute values of A, B, P, K to calculate Q, and obtain:
20 0
Q=
0 6
Note that a different R comes with a different Q, they are also correct as long as the ARE is satisfied.
12 points on page: 14
(f) Later the Queen found that her ‘optimal’ state-feedback controller with K̄ = 0 2 is indeed impossible to be implemented in
practice. Point out and explain the trouble she would face when implementing this controller.
4
With K̄ = 0 2 , we need to use the information of x2 . But x2 is unobservable, hence there is no way to provide value of x2 to
the controller.
3. Ball on beam
Consider a ball on a controlled beam under some approximation, having the following differential equation:
J
0= + m r̈(t) + mg sin α(t) (11)
R2
d
and the relation α(t) = L
θ(t), in which J, R, m, g, d, L are positive constants.
r
(a) Let θ be the control input, r be the output. Write the nonlinear state-space system, using the state vector x = .
ṙ
2
mg d
r̈(t) = − J
sin θ(t)
R 2 +m L
y = x1
Equilibrium is where ẋ = 0:
ẋ1 = 0 ⇔ x2 = 0
d dkπ
ẋ2 = 0 ⇔ u = kπ, k ∈ Z ⇔ u = ,k ∈ Z
L L
The equilibrium can happen with any x1 ∈ R (physical meaning: when the beam is horizontal and the ball’s velocity is zero, then it
doesn’t move, regardless of its position).
13 points on page: 8
0
(c) Linearize the original system around the equilibrium xe = , ue = 0. You can simplify the exposition by denoting H =
0
mgd .
L J2 +m
R
2
∂f 0 1
A= =
∂x (xe ,ue )
0 0
0
∂f 0
B= = − mgd
cos d
u
=
∂u (xe ,ue ) J +m L L −H
R2 (xe ,ue )
C= 1 0
D=0
(d) Suppose we want to control the system around (xe , ue ), using the linearized model in the following form:
ẋ(t) = Ax(t) + Bu(t) + w(t) (12)
y(t) = Cx(t) + v(t) (13)
where w and v are independent zero-mean, Gaussian white noises, with covariances:
E(wwT ) = Qw , E(vvT ) = Rv . (14)
We want to design a Kalman filter for estimating states of this system.
Write the formula that would be used to obtain the state estimation, and how to find the gain of the filter.
2
Let x̂(t) denote the estimated state, it is a dynamical process with differential equation:
x̂˙ = Ax̂ + Bu + L(y − Cx̂), x̂(0) = E(x(0))
with the gain
L = PCT R−1
v , where P = E (x − x̂)(x − x̂)
T
A diagram that expresses a control block using LQR and an observer block using Kalman filter: 1 point.
With detailed blocks showing the linear system: + 0.5 point.
With input of w and v: + 0.5 point.
(f) Provided that the closed-loop system is stable using K and L from the LQG design in step (3e). Explain why we don’t need to redesign
K for every time we use a different state estimator (i.e. L changes), as long as the new observer guarantees that the estimated state
converges asymptotically to the real state.
4
For LTI systems, there is the separation principle when we use a linear state feedback controller and a Luenberger observer, as the
closed-loop dynamics (denoting e(t) , x(t) − x̂(t))
ẋ(t) (A − BK) BK x(t) I 0 w
= + (16)
ė(t) 0 (A − LC) e(t) I −L v
| {z }
A
shows that eigenvalues of new closed-loop system’s A compose of eigenvalues of A − BK and A − LC.
With a stable closed-loop system, we already have A − BK stable. Hence, as long as a new observer is stable (≡ the estimated state
converges asymptotically to the real state), the closed-loop system is also stable, thus we don’t need to redesign K.
14 points on page: 10
(g) Uno the King of Filtering has an idea to first discretize the nonlinear continuous dynamics to obtain a discrete-time system in the form:
xk+1 = f (xk , uk ) + wk (17)
yk = h(xk ) + vk , (18)
and then linearize it around (xe , ue ) to have the discrete-time linear system:
xk+1 = Axk + Buk + wk (19)
yk = Cxk + vk , (20)
then he uses discrete LQR to design the state-feedback controller, and a discrete nonlinear observer for state estimation.
Propose to Uno one type of nonlinear observer that he can use, describe the steps in the iteration of such observer, with general formula.
Any nonlinear observer would be accepted, e.g. those covered in the lectures: Extended Kalman Filter, Unscented Kalman Filter,
Moving Horizon Estimation.
4. MPC for discrete-time system
Consider a discrete linear time-invariant system:
xk+1 = Axk + Buk
yk = Cxk
1 0.1 0
with A = , B= C= 1 0 .
,
0 1 1
x̄10
Given an arbitrary initial state x̄0 = in the region: x̄10 ∈ [−2; 2], x̄20 ∈ [−1; 1]. We want to use state-feedback Model Predictive
x̄20
Control (MPC) to regulate the system, i.e. we aim to drive the states to zero. During control, we want following conditions to be satisfied:
−3 ≤ y ≤ 3 (21)
−1 ≤ u ≤ 1 (22)
(a) Formulate the optimization problem to be solved at each sampling time, using quadratic cost MPC with horizon N and zero terminal
state constraint.
2
(b) (*) Suppose we choose a short horizon: N = 2. Prove that there is some value of x0 in [−2; 2] × [−1; 1] such that the MPC problem
formulated at step (4a) cannot be solved (it is infeasible).
4
Notice that the control input has little affect on state x1 , the main idea is to give an example such that with any u satisfying the
constraint (27), the first state cannot be driven to zero (as required by constraint (28)).
We can use the dynamical equation to eliminate state variable x1 :
1
x0 + 0.1x20
1
x0 + 0.1x20 + 0.1(x20 + u0 )
x1 = 2 , x2 = 2 (30)
x0 + u0 x0 + u0 + u1
−2
We test for a value x0 = , from (30) we have: x12 = −2 + 0.1u0 . The zero terminal state constraint (28) with N = 2 requires
0
x12 = 0. However due to (27), with u0 ≤ 1 ⇒ x12 ≤ −2 + 0.1 = −1.9, hence (28) could not be satisfied with any permissible u0 .
15 points on page: 10
(c) (*) We want to formulate a less restrictive MPC problem, where we replace the zero terminal state constraint by:
• a terminal cost term xTN PxN , where P is the solution of the discrete algebraic Riccati equation:
−1
P = Q + AT PA − AT PB R + BT PB BT PA (31)
in which Q and R are respectively the weighting matrices for state and control input in the stage cost; and
• a terminal constaint xN ∈ Xf , where Xf is an invariant set for the closed-loop system using the state-feedback controller
u = −Kx, with −1
K = R + BT PB BT PA, (32)
‘invariant’ means if we have a state x̄ ∈ Xf , then we will have (A − BK)x̄ ∈ Xf .
Prove that such MPC closed-loop system is stable, using Lyapunov stability theory.
6
For each time step t, let us denote the optimal solution of the MPC optimization problem as (u∗t , x∗t ) with u∗t = [ut|t , ut+1|t , . . . , ut+N −1|t ]T
and x∗t = [xt , xt+1|t , . . . , xt+N |t ]T . We also denote Vt∗ as the optimal cost function for the problem at time step t, i.e.
N
X −1
Vt∗ = xTt+k|t Qxt+k|t + uTt+k|t Rut+k|t
k=1
∗
To prove that the MPC closed-loop system is stable, we aim to show that Vt+1 ≤ Vt∗ for any t, and use Vt∗ as the Lyapunov
function. To obtain the desired inequality, we construct a feasible value for problem at time step t + 1:
ũt+1 = [ut+1|t , . . . , ut+N −1|t , ut+N ]T
x̃t+1 = [xt+1|t , . . . , xt+N |t , xt+N +1 ]T
where ut+N = −Kxt+N |t , xt+N +1 = Axt+N |t + But+N = (A − BK)xt+N |t . This means we reuse the computed result (u∗t , x∗t )
in step t, shift the sequence of u∗t one step to the right (omit ut|t ) and append the last control input using linear controller u = −Kx,
the state vector x̃t+1 is constructed just by using the discrete linear dynamics.
We denote Ṽt+1 for the cost function associated with (ũt+1 , x̃t+1 ). Next, we use Ṽt+1 as a bridge to prove the following inequalities:
∗
Vt+1 ≤ Ṽt+1 ≤ Vt∗ (33)
• The first inequality of (33) can be verified by proving that (ũt+1 , x̃t+1 ) is a feasible solution of the optimization problem at
∗
time step t + 1, while Vt+1 is the optimal solution for the same problem, hence it should be lower or equal to Ṽt+1 ). About the
feasibility of (ũt+1 , x̃t+1 ): in this setting there is no uncertainty, hence the initial condition at time step t + 1 is xt+1 = xt+1|t ,
the dynamical constraints at time step t + 1 should be satisfied because they are enforced from time step t (most of values of
(u∗t , x∗t ) are reused in (ũt+1 , x̃t+1 )); moreover, by using the linear controller u = −Kx, and the terminal constraint xN ∈ Xf
in which Xf is an invariant set, the new terminal state constraint xt+N ∈ Xf is also satisfied. Hence (ũt+1 , x̃t+1 ) is a feasible
∗
solution of the MPC problem at time step t + 1, therefore Vt+1 ≤ Ṽt+1 .
We will show that α = 0. Note that we have the formula for K from (32) and can substitute it to α:
α = Q + AT PA − AT PBK − KT BT PA + KT BT PBK + KT RK − P
= Q + AT PA − AT PBK − KT BT PA + KT (BT PB + R) K
|{z} −P
−1
(R+BT PB) BT PA
= Q + AT PA − AT PB K
|{z} −KT BT PA + KT BT PA − P
(R+BT PB)−1 BT PA
−1
= Q + AT PA − AT PB R + BT PB BT PA − P
16 points on page: 6