EE55: Linear Systems Final Exam SIST, ShanghaiTech Final Exam Solutions Course: Linear Systems Teacher: Prof. Boris Houska Duration: 85min YOUR NAME: (type in English letters) I Introduction This exam consist of three sections, named, Modeling Linear Control Systems, Kalman Filter, and Linear Quadratic Regulator. Keep in mind that all questions admit short and elegant solutions. This is an open-book exam. Overview: (max 6 points in total) Section II: Section III: Section IV: max 2 points max 2 points max 2 points 1
EE55: Linear Systems Final Exam SIST, ShanghaiTech II Modeling Linear Control Systems Consider the mass-spring-damper system in Figure 1. Figure 1: A mass-spring-damper system. 1. Let x(t) be the position of the trolley with mass m and v(t) its velocity at time t. The force of the spring is given by F s = Dx(t). The force of the damper is F d = cv(t). Now, assume that our control input is the force F (t) with which we can pull (or push) the mass point m in x-direction. Show that the dynamics of this mass-spring-damper system can be modelled by a linear control system of the form ẏ(t) = Ay(t) + Bu(t). What are the matrices A and B in this example? How do you define the states y(t) and control input function u(t)? (5 points) Newton s law of motion can be written in the form ẋ(t) = v(t) m v(t) = cv(t) Dx(t) + F (t). Thus, if we introduce the state vector y(t) = [x(t), v(t)] T and control input u(t) = F (t), the linear control system can be written in the form ( ) ( ) 1 ẏ(t) = Ay(t) + Bu(t) with A = and B = 1. m D m c m 2
EE55: Linear Systems Final Exam SIST, ShanghaiTech 2. Work out an explicit expression for the solution G(t, τ) of the differential equation G(t, τ) = AG(t, τ) with G(τ, τ) = I t for all t, τ R. You may assume D > as well as m > and c. (5 points) The solution for the differential equation can be written in the form G(t, τ) = e A(t τ). In order to work out the exponential function explicitly, we work out the eigenvalues λ 1,2 = c c 2m ± 2 4m 2 D m of the matrix A. Since we have D > and m >, we must have λ 1 λ 2, which implies that the (normed) eigenvectors v 1 = 1 ( 1 1 + λ 2 λ 1 1 ) and v 2 = 1 ( 1 1 + λ 2 λ 2 2 are linearly independent, i.e., the matrix T = [v 1, v 2 ] is invertible. In summary, we have ( ) e λ 1 (t τ) G(t, τ) = T e λ T 2(t τ) 1. ) 3
EE55: Linear Systems Final Exam SIST, ShanghaiTech 3. Assume that we have D >, m >, and c >. The set { t t } S(t) = G(t, τ)bu(τ) dτ u(τ) 2 2 dτ 1 is called the controllability ellipsoid of the linear control system. It can be interpreted as the set of reachable points in the states space, which can be obtained with control inputs whose L 2 -norm is bounded by 1. Find an explicit expression for the limit set S = lim t S(t). Make a 2-dimensional sketch of the set S and discuss how the geometry of the set S depends on the parameters m, D, and c and give physical interpretations of your results. What happens for very small damping parameters c? (1 points) The controllability ellipsoid can be written in the form { } S(t) = P (t)v v T v 1, where P (t) denotes the solution of the Lyapunov differential equation P (t) = AP (t) + P (t)a T + BB T. As the system is open-loop stable (since c > ), the state of the Lyapunov differential equation must converge to a limit state P, which satisfies the steady-state condition ( ) ( ) ( ) = A P + P A T + BB T 1 = D m P c + P D m m 1 c + 1. m m 2 This is a linear equation system for P, which can be solved explicitly: P = 1 ( 1 D ). 2cm 1 Thus, the limit set S = { P v v T v 1 } is an ellipsoid whose axis are aligned with the position 1 and velocity coordinate and have the lengths 2cm and 1 2cmD, respectively. For c the controllability ellipsoid becomes arbitrarily large, lim c S = R 2. 4
EE55: Linear Systems Final Exam SIST, ShanghaiTech III Kalman Filter Consider the linear control system from the previous section for u = and c =, i.e., under the assumption that we neither apply an external force nor have damping such that ( ) 1 ẏ(t) = Ay(t) with A = D m. (1) We use a camera in order to measure the position x(t) = Cy(t) of the mass point at time t. Notice that the matrix C = ( 1, ) returns the first component of the state vector y. The error of the position measurement is assumed to be a Gaussian white-noise signal satisfying { E {η(t) Cy(t)} = and E (η(t) Cy(t)) (η(t) Cy(t)) T} = V for given the variance matrix V = 1. Here, η(t) denotes the position measurement from the camera. We assume that the model is exact and that there is no process noise. 1. A continuous-time Kalman filter is based on the solving the Riccati differential equation P (t) = AP (t) + P (t)a T P (t)c T V 1 CP (t) with P () = P. Here, P = E{x()x() T } = I denotes the variance matrix of the initial state x(), which is assumed to be given and equal to the unit matrix. The inverse matrix F (t) = P (t) 1 is called the information matrix that is associated with the Kalman filter. Prove that F satisfies a Lyapunov differential equation. Solve this Lyapunov differential equation as explicitly as possible and use this result to find a solution of the above Riccati differential equation for P. Interpret your result. (1 points) The function F satisfies the Lyapunov differential equation F (t) = t P (t) 1 = F (t) P (t)f (t) = F (t)a A T F (t) + C T V 1 C (2) with F () = I. The solution for the matrix F has the form F (t) = Φ(t, )Φ(t, ) T + t Φ(t, τ)c T V 1 CΦ(t, τ) T dτ with Φ(t, τ) = e AT (t τ) = G(τ, t) T. Recall that an explicit expression for fundamental solution G has already been worked out in the previous section. The solution of the Riccati differential equation can then be recovered as P (t) = F (t) 1. (We gave full points for this or similar solutions, even if the above integral for F was not worked out explicitly.) 5
EE55: Linear Systems Final Exam SIST, ShanghaiTech 2. Assume that we want to run the above Kalman on an embedded hardware system with limited memory capacities. Also assume that there is additional (Gaussian) process noise present and that variance matrix of the initial value is a steady-state of the Riccati differential equation for the Kalman filter. Explain how you would implement the filter in this case. Which variables do we need to store on the hardware in order to run the filter? Which variables can be computed offline (beforehand), e.g., on a desktop computer? Which operations do we have to perform online (and in real-time) on the embedded hardware system whenever new measurements arrive? You may assume that the measurements come in at a high sampling rate (much faster than the time-scale of the system dynamics). The computation time of basic operations on a modern processor (for static memory) is given below (1ns = 1 9 seconds). Operation z[i] = x[i] z[i] += x[i] z[i] = x[i] + y[i] z[i] += x[i] + y[i] z[i] = x[i] * y[i] z[i] += x[i] * y[i] CPU Time 1.3ns 1.3ns 1.38ns 1.49ns 1.5ns 1.86ns Estimate of the performance of your Kalman filter implementation in terms of how long it takes to update the state estimate whenever a new measurement arrives. (1 points) As the Kalman filter is assumed to be at steady-state, we can solve the algebraic Riccati equation = AP + P A T P C T V 1 CP + W for the variance-covariance matrix P offline. Here W denotes the variance of the additional noise. The associated Kalman gain, given by K = P CV 1 can be computed offline, too. The differential equation for the state estimate is then = Aŷ(t) + K(η(t) Cŷ(t)). tŷ(t) For small time steps < δ 1, this equation can also be approximated as χ k+1 = Aχ k + Bη k with A = e (A KC)δ, and B = δ e (A KC)(δ τ) K dτ. The matrices A and B can be computed offline, too. The pseudo code list below suggests that the Kalman filter update takes for our example less than 15ns on modern processors. Here A and B are assumed to be pre-computed. (We have of course also accepted direct methods as a solution approach, which discretize first and work with the discrete-time Kalman filter.) 6
EE55: Linear Systems Final Exam SIST, ShanghaiTech Input: measurement eta, output: state estimate chi (static memory). Operation s[] = chi[]; s[1] = chi[1]; chi[] += A[]*s[]; chi[] += A[1] *s[1]; chi[] += B[] *eta; chi[1] += A[2] *s[]; chi[1] += A[3] *s[1]; chi[1] += B[1] *eta; TOTAL CPU Time +1.3ns +1.3ns < 15ns Pseudo code for the Kalman state update using C-syntax. 7
EE55: Linear Systems Final Exam SIST, ShanghaiTech IV Linear Quadratic Regulator We still consider the mass-spring damper system from the previous sections. The kinetic energy of the trolley at the time T is given by E kin = 1 2 m [v(t )]2. Moreover, the potential energy of the spring is given by E pot = 1 2 D [x(t )]2. Our goal is to minimize the sum of the kinetic and potential energy at the end time T and an additional control penalty term of the form Here, ɛ is a scalar weighting factor. T ɛ (u(t)) 2 dt. 1. Formulate the above problem as a linear-quadratic optimal control problem (LQR problem) in standard form assuming that the initial value y for the states of system at time are given. (1 points) The sum of the kinetic and potential energy is a quadratic form, E kin + E pot = y(t ) T P end y(t ) with P end = 1 ( ) D. 2 m The control penalty term has the form T T ɛ (u(t)) 2 dt = u(t) T Ru(t) dt with R = ɛ. We also set Q = R 2 2 as states only enter via the Mayer term. The standard LQR problem is then given by min x,u T { } y(t) T Qy(t) + u(t) T Ru(t) dt + y(t ) T P end y(t ) s.t. { ẏ(t) = Ay(t) + Bu(t) y() = y. 8
EE55: Linear Systems Final Exam SIST, ShanghaiTech 2. Discuss how the optimal solutions for the control input and the states of the above linearquadratic optimal problem depend on the control penalty weight ɛ >. What happens for ɛ +? What happens for ɛ? You may assume that the parameters D >, m >, as well as c > are given and positive. (1 points) We denote with (yɛ, u ɛ) the optimal solution of the LQR optimal control problem in dependence on ɛ. (a) For ɛ + the control penalty vanishes leading to extreme control reactions. As the system is controllable, we have lim ɛ y ɛ (T ) =. (b) For ɛ we find lim ɛ u ɛ(t) = for (almost) all t [, T ], as the control penalty becomes infinitely large. Thus, the states correspond to the open-loop response and we have E kin + E pot > at time T (assuming y ). 9