Optimal control and estimation

Similar documents
Outline. Linear regulation and state estimation (LQR and LQE) Linear differential equations. Discrete time linear difference equations

Integral action in state feedback control

MATH4406 (Control Theory) Unit 6: The Linear Quadratic Regulator (LQR) and Model Predictive Control (MPC) Prepared by Yoni Nazarathy, Artem

4F3 - Predictive Control

Extensions and applications of LQ

Automatic Control 2. Model reduction. Prof. Alberto Bemporad. University of Trento. Academic year

Outline. 1 Linear Quadratic Problem. 2 Constraints. 3 Dynamic Programming Solution. 4 The Infinite Horizon LQ Problem.

Linear Systems. Manfred Morari Melanie Zeilinger. Institut für Automatik, ETH Zürich Institute for Dynamic Systems and Control, ETH Zürich

Lecture 9: Discrete-Time Linear Quadratic Regulator Finite-Horizon Case

6.4 Kalman Filter Equations

Linear-Quadratic Optimal Control: Full-State Feedback

State Estimation of Linear and Nonlinear Dynamic Systems

CBE507 LECTURE IV Multivariable and Optimal Control. Professor Dae Ryook Yang

Here represents the impulse (or delta) function. is an diagonal matrix of intensities, and is an diagonal matrix of intensities.

ECE7850 Lecture 7. Discrete Time Optimal Control and Dynamic Programming

Automatic Control 2. Nonlinear systems. Prof. Alberto Bemporad. University of Trento. Academic year

Automatic Control II Computer exercise 3. LQG Design

4F3 - Predictive Control

Control Systems Lab - SC4070 Control techniques

Lecture 10 Linear Quadratic Stochastic Control with Partial State Observation

EL2520 Control Theory and Practice

Lecture 2: Discrete-time Linear Quadratic Optimal Control

State estimation and the Kalman filter

RECURSIVE ESTIMATION AND KALMAN FILTERING

Linear-Quadratic-Gaussian (LQG) Controllers and Kalman Filters

Optimal Control. McGill COMP 765 Oct 3 rd, 2017

Lecture 5 Linear Quadratic Stochastic Control

Model Predictive Control Short Course Regulation

Contents. 1 State-Space Linear Systems 5. 2 Linearization Causality, Time Invariance, and Linearity 31

OPTIMAL CONTROL AND ESTIMATION

Control Design. Lecture 9: State Feedback and Observers. Two Classes of Control Problems. State Feedback: Problem Formulation

Outline. 1 Full information estimation. 2 Moving horizon estimation - zero prior weighting. 3 Moving horizon estimation - nonzero prior weighting

Theory in Model Predictive Control :" Constraint Satisfaction and Stability!

Moving Horizon Estimation (MHE)

Systems and Control Theory Lecture Notes. Laura Giarré

ESC794: Special Topics: Model Predictive Control

State Observers and the Kalman filter

Homework Solution # 3

Discrete-time linear systems

MATH4406 (Control Theory) Unit 1: Introduction to Control Prepared by Yoni Nazarathy, August 11, 2014

6.241 Dynamic Systems and Control

4 Derivations of the Discrete-Time Kalman Filter

Steady State Kalman Filter

A Study of the Duality between Kalman Filters and LQR Problems

Estimation and Control across Analog Erasure Channels

Lecture 5: Control Over Lossy Networks

Networked Sensing, Estimation and Control Systems

State Estimation using Moving Horizon Estimation and Particle Filtering

CONSTRAINED MODEL PREDICTIVE CONTROL ON CONVEX POLYHEDRON STOCHASTIC LINEAR PARAMETER VARYING SYSTEMS. Received October 2012; revised February 2013

Lecture 20: Linear Dynamics and LQG

State Regulator. Advanced Control. design of controllers using pole placement and LQ design rules

Control Over Packet-Dropping Channels

Lecture 7 LQG Design. Linear Quadratic Gaussian regulator Control-estimation duality SRL for optimal estimator Example of LQG design for MIMO plant

Time Varying Optimal Control with Packet Losses.

Linear-quadratic-Gaussian control of linear system with Rayleigh flat fading channel

Control System Design

Numerical Methods for Model Predictive Control. Jing Yang

LQR, Kalman Filter, and LQG. Postgraduate Course, M.Sc. Electrical Engineering Department College of Engineering University of Salahaddin

Observers for Bilinear State-Space Models by Interaction Matrices

Linear System Theory. Wonhee Kim Lecture 1. March 7, 2018

Enhancing Transient Response of Asymptotic Regulation with Disturbance Onset

CDS 110b: Lecture 2-1 Linear Quadratic Regulators

L06. LINEAR KALMAN FILTERS. NA568 Mobile Robotics: Methods & Algorithms

Structured State Space Realizations for SLS Distributed Controllers

SUCCESSIVE POLE SHIFTING USING SAMPLED-DATA LQ REGULATORS. Sigeru Omatu

FIR Filters for Stationary State Space Signal Models

Optimal Polynomial Control for Discrete-Time Systems

SYSTEMTEORI - KALMAN FILTER VS LQ CONTROL

Linear State Feedback Controller Design

Robotics. Control Theory. Marc Toussaint U Stuttgart

Suppose that we have a specific single stage dynamic system governed by the following equation:

Analysis of Discrete-Time Systems

CS 532: 3D Computer Vision 6 th Set of Notes

EE C128 / ME C134 Feedback Control Systems

Module 03 Linear Systems Theory: Necessary Background

Autonomous Mobile Robot Design

6 OUTPUT FEEDBACK DESIGN

Course on Model Predictive Control Part II Linear MPC design

EEE582 Homework Problems

Robust Control 5 Nominal Controller Design Continued

Module 9: State Feedback Control Design Lecture Note 1

EE226a - Summary of Lecture 13 and 14 Kalman Filter: Convergence

Comparison of four state observer design algorithms for MIMO system

Lecture 9. Introduction to Kalman Filtering. Linear Quadratic Gaussian Control (LQG) G. Hovland 2004

Infinite Horizon LQ. Given continuous-time state equation. Find the control function u(t) to minimize

A Tour of Reinforcement Learning The View from Continuous Control. Benjamin Recht University of California, Berkeley

Lyapunov Stability Analysis: Open Loop

Model Predictive Control

DESIGN AND IMPLEMENTATION OF SENSORLESS SPEED CONTROL FOR INDUCTION MOTOR DRIVE USING AN OPTIMIZED EXTENDED KALMAN FILTER

CALIFORNIA INSTITUTE OF TECHNOLOGY Control and Dynamical Systems. CDS 110b

Linear System Theory

Analysis of Discrete-Time Systems

Control engineering sample exam paper - Model answers

CALIFORNIA INSTITUTE OF TECHNOLOGY Control and Dynamical Systems. CDS 110b

MATH4406 (Control Theory) Unit 1: Introduction Prepared by Yoni Nazarathy, July 21, 2012

Robotics: Science & Systems [Topic 6: Control] Prof. Sethu Vijayakumar Course webpage:

Control Systems. Design of State Feedback Control.

Exam in Automatic Control II Reglerteknik II 5hp (1RT495)

Development of a Low-Cost Integrated

Final Exam Solutions

Transcription:

Automatic Control 2 Optimal control and estimation Prof. Alberto Bemporad University of Trento Academic year 2010-2011 Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 1 / 32

(LQR) State-feedback control via pole placement requires one to assign the closed-loop poles Any way to place closed-loop poles automatically and optimally? The main control objectives are 1 Make the state x(k) small (to converge to the origin) 2 Use small input signals u(k) (to minimize actuators effort) These are conflicting goals! LQR is a technique to place automatically and optimally the closed-loop poles Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 2 / 32

Finite-time optimal control Let the model of the open-loop process be the dynamical system x(k + 1) = Ax(k) + Bu(k) linear system with initial condition x(0) We look for the optimal sequence of inputs U = {u(0), u(1),..., u(n 1)} driving the state x(k) towards the origin and that minimizes the performance index N 1 J(x(0), U) = x (N)Q N x(n) + x (k)qx(k) + u (k)ru(k) k=0 quadratic cost where Q = Q 0, R = R 0, Q N = Q N 01 1 For a matrix Q n n, Q 0 means that Q is a positive definite matrix, i.e., x Qx > 0 for all x 0, x n. Q N 0 means positive semidefinite, x Qx 0, x n Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 3 / 32

Finite-time optimal control Example: Q diagonal Q = Diag(q 1,..., q n ), single input, Q N = 0 N 1 n J(x(0), U) = q i x 2 i (k) + Ru 2 (k) k=0 i=1 Consider again the general performance index of the posed linear quadratic (LQ) problem N 1 J(x(0), U) = x (N)Q N x(n) + x (k)qx(k) + u (k)ru(k) N is called the time horizon over which we optimize performance The first term x Qx penalizes the deviation of x from the desired target x = 0 The second term u Ru penalizes actuator authority The third term x (N)Q N x(n) penalizes how much the final state x(n) deviates from the target x = 0 Q, R, Q N are the tuning parameters of the optimal control design (cf. the parameters of the PID controller K p, T i, T d ), and are directly related to physical/economic quantities Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 4 / 32 k=0

Minimum-energy controllability Consider again the problem of controllability of the state to zero with minimum energy input u(0) u(1) min U. u(n 1) s.t. x(n) = 0 The minimum-energy control problem can be seen as a particular case of the LQ optimal control problem by setting R = I, Q = 0, Q N = I Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 5 / 32

Solution to LQ optimal control problem By substituting x(k) = A k x(0) + k 1 i=0 Ai Bu(k 1 i) in N 1 J(x(0), U) = x (k)qx(k) + u (k)ru(k) + x (N)Q N x(n) k=0 we obtain J(x(0), U) = 1 2 U HU + x(0) FU + 1 2 x(0) Yx(0) where H = H 0 is a positive definite matrix The optimizer U is obtained by zeroing the gradient 0 = U J(x(0), U) = HU + F x(0) u (0) u (1) U =. u (N 1) = H 1 F x(0) Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 6 / 32

[LQ problem matrix computation] Q {}} x(1) Q 0 0... 0 { J(x(0), U) = x(2) 0 Q 0... 0 x (0)Qx(0) +............ x(n 1) 0... 0 Q 0 x(n) 0 0... 0 Q N R 0... 0 u (0) u (1)... u (N 1) 0 R... 0........ 0... 0 R } {{ } R x(1) x(2). x(n) = S {}}{ B 0... 0 A AB B... 0 u(0) A 2 u(1)........... + x(0). A N 1 B A N 2 u(n 1) B... B A N }{{} N J(x(0), U) = x (0)Qx(0) + ( SU + Nx(0)) Q( SU + Nx(0)) + U RU = 1 2 U 2( R + S Q S) U + x (0) 2 N Q S U + 1 }{{}}{{} 2 x (0) 2(Q + N Q N) x(0) }{{} H F Y x(1) x(2). x(n 1) x(n) u(0) u(1). u(n 1) + Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 7 / 32

Solution to LQ optimal control problem The solution U = u (0) u (1). u (N 1) = H 1 F x(0) is an open-loop one: u(k) = f k (x(0)), k = 0, 1,..., N 1 Moreover the dimensions of the H and F matrices is proportional to the time horizon N We use optimality principles next to find a better solution (computationally more efficient, and more elegant) Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 8 / 32

Bellman s principle of optimality Bellman s principle Given the optimal sequence U = [u (0),..., u (N 1)] (and the corresponding optimal trajectory x (k)), the subsequence [u (k 1 ),..., u (N 1)] is optimal for the problem on the horizon [k 1, N], starting from the optimal state x (k 1 ) Richard Bellman (1920-1984) optimal state x (k) y 11, 2010 0 0 k 1 optimal input u (k) k 1 N N time time Given the state x (k 1 ), the optimal input trajectory u on the remaining interval [k 1, N] only depends on x (k 1 ) Then each optimal move u (k) of the optimal trajectory on [0, N] only depends on x (k) The optimal control policy can be always expressed in state feedback form u (k) = u (x (k))! Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 9 / 32

Bellman s principle of optimality The principle also applies to nonlinear systems and/or non-quadratic cost functions: the optimal control law can be always written in state-feedback form u (k) = f k (x (k)), k = 0,..., N 1 optimal state trajectories x Compared to the open-loop solution {u (0),..., u (N 1)} = f(x(0)) the feedback form u (k) = f k (x (k)) has the big advantage of being more robust with respect to perturbations: at each time k we apply the best move on the remaining period [k, N] Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 10 / 32

Dynamic programming At a generic instant k 1 and state x(k 1 ) = z consider the optimal cost-to-go N 1 V k1 (z) = min x (k)qx(k) + u (k)ru(k) + x (N)Q N x(n) u(k 1 ),...,u(n 1) k=k 1 V 0 (z) is the optimal cost in the remaining interval [k 1, N] starting at x(k 1 ) = z Principle of dynamic programming V 0 (z) = min U {u(0),...,u(n 1)} k1 1 = min u(0),...,u(k 1 1) J(z, U) x (k)qx(k) + u (k)ru(k) + V k1 (x(k 1 )) k=0 Starting at x(0), the minimum cost over [0, N] equals the minimum cost spent until step k 1 plus the optimal cost-to-go from k 1 to N starting at x(k 1 ) Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 11 / 32

Riccati iterations By applying the dynamic programming principle, we can compute the optimal inputs u (k) recursively as a function of x (k) (Riccati iterations): 1 Initialization: P(N) = Q N 2 For k = N,..., 1, compute recursively the following matrix P(k 1) = Q A P(k)B(R+B P(k)B) 1 B P(k)A+A P(k)A 3 Define The optimal input is K(k) = (R + B P(k + 1)B) 1 B P(k + 1)A u (k) = K(k)x (k) Jacopo Francesco Riccati (1676-1754) The optimal input policy u (k) is a (linear time-varying) state feedback! Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 12 / 32

Dynamical processes operate on a very long time horizon (in principle, for ever). Let s send the optimal control horizon N V (x(0)) = min x (k)qx(k) + u (k)ru(k) Result u(0),u(1),... k=0 Let (A, B) be a stabilizable pair, R 0, Q 0. There exists a unique solution P of the algebraic Riccati equation (ARE) P = A P A + Q A P B(B P B + R) 1 B P A such that the optimal cost is V (x(0)) = x (0)P x(0) and the optimal control law is the constant linear state feedback u(k) = K LQR x(k) with K LQR = (R + B P B) 1 B P A MATLAB P = dare(a,b,q,r) MATLAB [-K,P ] = dlqr(a,b,q,r) Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 13 / 32

Go back to Riccati iterations: starting from P( ) = P and going backwards we get P(j) = P, j 0 Accordingly, we get K(j) = (R + B P B) 1 B P A K LQR, j = 0, 1,... The LQR control law is linear and time-invariant MATLAB» [-K,P,E] = lqr(sysd,q,r) E= closed-loop poles = eigenvalues of (A + BK LQR ) Closed-loop stability is ensured if (A, B) is stabilizable, R 0, Q 0, and (A, Q 1 1 2 ) is detectable, where Q 2 is the Cholesky factor 2 of Q LQR is an automatic and optimal way of placing poles! A similar result holds for continuous-time linear systems ( MATLAB: lqr) 2 Given a matrix Q = Q 0, its Cholesky factor is an upper-triangular matrix C such that C C = Q ( MATLAB: chol) Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 14 / 32

LQR with output weighting We often want to regulate only y(k) = Cx(k) to zero, so define V (x(0)) = min y (k)q y y(k) + u (k)ru(k) u(0),u(1),... k=0 The problem is again an LQR problem with equivalent state weight Q = C Q y C Corollary MATLAB» [-K,P,E] = dlqry(sysd,qy,r) Let (A, B) stabilizable, (A, C) detectable, R > 0, Q y > 0. Under the LQR control law u(k) = K LQR x(k) the closed-loop system is asymptotically stable lim x(t) = 0, lim t u(t) = 0 t Intuitively: the minimum cost x (0)P x(0) is finite y(k) 0 and u(k) 0. y(k) 0 implies that the observable part of the state 0. As u(k) 0, the unobservable states remain undriven and goes to zero spontaneously (=detectability condition) Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 15 / 32

LQR example Two-dimensional single input single output (SISO) dynamical system (double integrator) x(k + 1) = 1 1 0 x(k) + u(k) 0 1 1 y(k) = 1 0 x(k) LQR (infinite horizon) controller defined on the performance index V (x(0)) = min u(0),u(1),... k=0 1 ρ y2 (k) + u 2 (k), ρ > 0 Weights: Q y = 1 ρ (or Q = 1 0 1 ρ [ 1 0 ] = 1 ρ 0 ), R = 1 0 0 Note that only the ratio Q y /R = 1 ρ matters, as scaling the cost function does not change the optimal control law Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 16 / 32

LQR Example 1 0.5 output y(k) ρ = 0.1 (red line) K = [ 0.8166 1.7499] 0 0.5 0 2 4 6 8 10 12 14 16 18 20 ρ = 10 (blue line) 1 input u(k) K = [ 0.2114 0.7645] 0.5 0 0.5 1 0 2 4 6 8 10 12 14 16 18 20 Initial state: x(0) = 1 0 ρ = 1000 (green line) K = [ 0.0279 0.2505] V (x(0)) = min u(0),u(1),... k=0 1 ρ y2 (k) + u 2 (k) Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 17 / 32

Kalman filtering Kalman filtering Introduction Problem: assign observer poles in an optimal way, that is to minimize the state estimation error x = x ˆx Information comes in two ways: from sensors measurements (a posteriori) and from the model of the system (a priori) We need to mix the two information sources optimally, given a probabilistic description of their reliability (sensor precision, model accuracy) The Kalman filter solves this problem, and is now the most used state observer in most engineering fields (and beyond) Rudolf E. Kalman (born 1930) R.E. Kalman receiving the Medal of Science from the President of the USA on October 7, 2009 Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 18 / 32

Kalman filtering Modeling assumptions The process is modeled as the stochastic linear system x(k + 1) = Ax(k) + Bu(k) + ξ(k) y(k) = Cx(k) + ζ(k) x(0) = x 0 ξ(k) n = process noise. We assume E[ξ(k)] = 0 (zero mean), E[ξ(k)ξ (j)] = 0 k j (white noise), and E[ξ(k)ξ (k)] = Q 0 (covariance matrix) ζ(k) p = measurement noise, E[ζ(k)] = 0, E[ζ(k)ζ (j)] = 0 k j, E[ζ(k)ζ (k)] = R 0 x 0 n is a random vector, E[x 0 ] = x 0, E[(x 0 x 0 )(x 0 x 0 ) ] = Var[x 0 ] = P 0, P 0 0 Vectors ξ(k), ζ(k), x 0 are uncorrelated: E[ξ(k)ζ (j)] = 0, E[ξ(k)x 0 ] = 0, E[ζ(k)x 0 ] = 0, k, j Probability distributions: we often assume normal (=Gaussian) distributions ξ(k) (0, Q), ζ(k) (0, R), x 0 ( x 0, P 0 ) Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 19 / 32

Kalman filtering Kalman predictor Introduce some quantities: ˆx(k + 1 k) state prediction x(k + 1 k) = x(k + 1) ˆx(k + 1 k) prediction error P(k + 1 k) = E x(k + 1 k) x(k + 1 k) prediction error covariance!"#$%&'$()*+,'-.. u(k) A,B x(k) /+0-)./$/- C y(k) A,[B L(k)] x(k) ˆ./$/-) -./&%$/- C y(k) ˆ - + 1$(%$#)*+-!&'/,+ The observer dynamics is ˆx(k + 1 k) = Aˆx(k k 1) + Bu(k) + L(k)(y(k) Cˆx(k k 1)) starting from an initial estimate ˆx(0 1) = ˆx 0. The Kalman predictor minimizes the covariance matrix P(k + 1 k) of the prediction error x(k + 1 k) Tuesday, May 11, 2010 Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 20 / 32

Kalman filtering Kalman predictor Theorem The observer gain L(k) minimizing the trace of P(k k 1) is L(k) = AP(k k 1)C CP(k k 1)C + R 1 where P(k k 1) solves the iterative equations P(k + 1 k) = AP(k k 1)A + Q AP(k k 1)C CP(k k 1)C + R 1 CP(k k 1)A with initial condition P(0 1) = P 0 The Kalman predictor is a time-varying observer, as the gain L(k) depends on the time index k In many cases we are interested in a time-invariant observer gain L, to avoid computing P(k + 1 k) on line Note the similarities with Riccati iterations in LQR Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 21 / 32

Kalman filtering Stationary Kalman predictor Theorem Let (A, C) observable, and (A, B q ) stabilizable, where Q = B q B q (B q=cholesky factor of Q). Then the stationary optimal predictor is with ˆx(k + 1 k) = Aˆx(k k 1) + Bu(k) + L(y(k) Cˆx(k k 1)) = (A LC)ˆx(k k 1) + Bu(k) + Ly(k) L = AP C CP C + R 1 where P is the only positive-definite solution of the algebraic Riccati equation P = AP A + Q AP C CP C + R 1 CP A the observer is asymptotically stable, i.e. all the eigenvalues of (A LC) are inside the unit circle Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 22 / 32

Kalman filtering Example of Kalman predictor: time-varying gain Noisy measurements y(k) of an exponentially decaying signal x(k) x(k + 1) = ax(k) + ξ(k) E[ξ(k)] = 0 E[ξ 2 (k)] = Q y(k) = x(k) + ζ(k) E[ζ(k)] = 0 E[ζ 2 (k)] = R a < 1 E[x(0)] = 0 E[x 2 (0)] = P 0 The equations of the Kalman predictor are ˆx(k + 1 k) = aˆx(k k 1) + L(k) (y(k) ˆx(k k 1)), ˆx(0 1) = 0 L(k) = ap(k k 1) P(k k 1) + R P(k + 1 k) = a 2 P(k k 1) + Q a2 P 2 (k k 1) P(k k 1) + R, P(0 1) = P 0 Let a = 0.98, Q = 10 5, R = 5 10 3, P 0 = 1, ˆx(0) = 0.4, x(0) = 1 Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 23 / 32

Kalman filtering Example of Kalman predictor: time-varying gain 1.5 state x(k), output y(k) x y 1 0.5 0 0 10 20 30 40 50 60 70 80 90 100 k 1.5 1 state prediction (time varying gain) x x est +/ 2(sqrt P) band 0.5 0 0 10 20 30 40 50 60 70 80 90 100 k Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 24 / 32

Kalman filtering Example of Kalman predictor: stationary gain Let s compute the stationary Kalman predictor (the pair (a, 1) is observable, the pair (a, B q ), with B q = 10 5 is stabilizable) Solve the algebraic Riccati equation for a = 0.98, Q = 10 5, R = 5 10 3, P 0 = 1. We get two solutions: P = 3.366 10 4, P = 1.486 10 4 the positive solution is the correct one Compute L = ap = 2.83 10 2 P + R The stationary Kalman predictor is ˆx(k + 1 k) = 0.98 ˆx(k) + 2.83 10 2 (y(k) Cˆx(k k 1)) Check asymptotic stability: x(k + 1 k) = (a L) x(k k 1) = 0.952 x(k k 1) lim x(k k 1) = 0 k + Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 25 / 32

Kalman filtering Kalman predictor: example 1.5 state prediction (stationary gain) x x est 1 0.5 0 0 10 20 30 40 50 60 70 80 90 100 k 1 0.8 Kalman gain: time varying vs. stationary L(k) L 0.6 0.4 0.2 0 0 10 20 30 40 50 60 70 80 90 100 k Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 26 / 32

Kalman filtering Kalman filter The Kalman filter provides an optimal estimate of x(k) given the measurements up to time k The Kalman filter proceeds in two steps: 1 measurement update based on the most recent y(k) M(k) = P(k k 1)C [CP(k k 1)C + R] 1 P(0 1) = P 0 ˆx(k k) = ˆx(k k 1) + M(k) (y(k) Cˆx(k k 1)) ˆx(0 1) = ˆx 0 P(k k) = (I M(k)C)P(k k 1) 2 time update based on the model of the system ˆx(k + 1 k) = Aˆx(k k) + Bu(k) P(k + 1 k) = AP(k k)a + Q Same as Kalman predictor, as L(k) = AM(k) Stationary version: M = P C (CP C + R) 1 MATLAB»[KEST,L,P,M,Z]=kalman(sys,Q,R) Z = E[(x(k) x(k k))(x(k) x(k k)) ] Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 27 / 32

Kalman filtering Tuning Kalman filters It is usually hard to quantify exactly the correct values of Q and R for a given process The diagonal terms of R are related to how noisy are output sensors Q is harder to relate to physical noise, it mainly relates to how rough is the (A, B) model After all, Q and R are the tuning knobs of the observer (similar to LQR) The larger is R with respect to Q the slower is the observer to converge (L, M will be small) On the contrary, the smaller is R than Q, the more precise are considered the measurments, and the faster observer will be to converge Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 28 / 32

Kalman filtering LQG control Linear Quadratic Gaussian (LQG) control combines an LQR control law and a stationary Kalman predictor/filter Consider the stochastic dynamical system x(k + 1) = Ax(k) + Bu(k) + ξ(k), w (0, Q KF ) y(k) = Cx(k) + ζ(k), v (0, R KF ) with initial condition x(0) = x 0, x 0 ( x 0, P 0 ), P, Q KF 0, R KF 0, and ζ and ξ are independent and white noise terms. The objective is to minimize the cost function T 1 J(x(0), U) = lim T T E x (k)q LQ x(k) + u (k)r LQ u(k) k=0 when the state x is not measurable Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 29 / 32

Kalman filtering LQG control If we assume that all the assumptions for LQR control and Kalman predictor/filter hold, i.e. the pair (A, B) is reachable and the pair (A, C q ) with C q such that Q LQ = C q C q is observable (here Q is the weight matrix of the LQ controller) the pair (A, B q ), with B q s.t. Q KF = B q B q, is stabilizable, and the pair (A, C) is observable (here Q is the covariance matrix of the Kalman predictor/filter) Then, apply the following procedure: 1 Determine the optimal stationary Kalman predictor/filter, neglecting the fact that the control variable u is generated through a closed-loop control scheme, and find the optimal gain L KF 2 Determine the optimal LQR strategy assuming the state accessible, and find the optimal gain K LQR Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 30 / 32

Kalman filtering LQG control!"#$%&'$()*+,'-.. u(k) A,B x(k) C y(k) v(k) + + K LQR x(k) ˆ 3$(%$# 4(2-+ /01)',#2+,((-+ Analogously to the case of output feedback control using a Luenberger observer, it is possible to show that the extended state [x x ] has eigenvalues equal to the eigenvalues of (A + BK LQR ) plus those of (A L KF C) (2n in total) Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 31 / 32

Kalman filtering English-Italian Vocabulary positive (semi)definite matrix dynamic programming matrice (semi)definita positiva programmazione dinamica Translation is obvious otherwise. Prof. Alberto Bemporad (University of Trento) Automatic Control 2 Academic year 2010-2011 32 / 32