You are on page 1of 13

C21 Model Predictive Control

2-1

Lecture 2
Prediction and optimization Input and state predictions Unconstrained optimal control law Extending the cost horizon to infinity Connections with unconstrained LQ-optimal control Incorporating constraints Quadratic programming

C21 Model Predictive Control

2-2

Prediction equations
Linear plant model

Predictions for horizon length

(terminal state

not affected by

Quadratic cost

Terminal weight

may be different from


allows to be accounted for in cost

C21 Model Predictive Control

2-3

Prediction equations
Prediction model (time-invariant, no uncertainty):

State predictions

i.e. th row of :

where

C21 Model Predictive Control

2-4

Prediction equations
Re-write in terms of , :

where terms terms terms

LTI system

can be computed offline

C21 Model Predictive Control

2-5

Prediction equations: example


Linear plant model:

Convolution matrix for

Cost matrices:

C21 Model Predictive Control

2-6

Prediction equations: LTV model


Formulation for linear time-varying plant model: State predictions

where

must be computed online

C21 Model Predictive Control

2-7

Unconstrained optimization
Optimize Differentiate w.r.t. : :

is invertible if:

or

& C = full-rank
(true if

controllable)

Receding horizon implementation:

Linear state feedback law

Closed-loop properties: performance? stability?

C21 Model Predictive Control

2-8

Unconstrained optimization: example


Linear plant, For : as before,

Closed-loop responses with unconstrained MPC for varying Predictions and closed-loop response are different Performance gets worse as is reduced

C21 Model Predictive Control

2-9

Unconstrained optimization: example

Horizon

C21 Model Predictive Control

2 - 10

Unconstrained optimization: example

Horizon

C21 Model Predictive Control

2 - 11

Unconstrained optimization: example

Horizon

C21 Model Predictive Control

2 - 12

Unconstrained optimization: example


Unstable for System is non-minimum phase impulse response changes sign short horizon closed-loop instability

Solution: use infinite cost horizon but retain finite number of d.o.f. in predictions

C21 Model Predictive Control

2 - 13

Infinite horizon cost


Cost evaluated over infinite horizon finite input predicted input sequence:

use dual mode predictions: mode 1 mode 2

free (explicit predictions)

feedback law (implicit)

C21 Model Predictive Control

2 - 14

Infinite horizon cost


Split cost:
J (k ) = & ! x T (k + i | k )Qx(k + i | k ) + uT (k + i | k )Ru(k + i | k ) # " $
i=0 N %1

+ J ' (x(k + N | k ))

infinite horizon part of cost:


J ! (x0 ) = & " x T (i)Qx(i) + uT (i)Ru(i) $ # %
i=0 !

! x(0) = x0 " # x(i + 1) = ( A + BK )x(i), i = 1,2,

J ! (x) = x T Px,

P " ( A + BK )T P( A + BK ) = Q + K T RK

Lyapunov equation Proof:


x T (i) " P ! ( A + BK )T P( A + BK ) $ x(i) = x T (i) "Q + K T RK $ x(i) # % # % J ! (x(i)) " J ! (x(i + 1)) = x T (i)Qx(i) + uT (i)Ru(i)

J ! (x(0)) = & " x T (i)Qx(i) + uT (i)Ru(i) $, since lim J ! (x(n)) = 0 # %


i=0

n'!

C21 Model Predictive Control

2 - 15

Infinite horizon cost


Choose terminal weight:
(Lyapunov equation solution)

infinite horizon cost Choose LQ-optimal feedback gain

optimal performance in mode 2

(for given

unconstrained MPC = LQ-optimal control NB. principle of optimality if optimal and optimal optimal

C21 Model Predictive Control

2 - 16

Infinite horizon cost: example


Linear plant, LQ-optimal for Lyapunov equation solution: as before, :

Cost matrices for

C21 Model Predictive Control

2 - 17

Example: unconstrained MPC

identical predicted and closed-loop responses = unconstrained LQ

C21 Model Predictive Control

2 - 18

Constraints
MPC more useful for constraint handling!! Apply input constraints to mode 1 predictions:

vector of ones (single input case) or

Apply state constraints to mode 1 predictions:

C21 Model Predictive Control

2 - 19

Constraints
Constraints on mode 1 predictions:

LTI prediction model online optimization:

can be computed offline

quadratic program (QP) Quadratic objective Linear constraints

Strictly convex problem (single minimum point) if is positive definite

C21 Model Predictive Control

2 - 20

QP solvers: active set method


At QP solution split constraints: active constraints inactive constraints th row of If the active constraint set then at the solution is known , inequality constraints must be satisfied:

is determined by solving an equality constraint problem:

Solve QP by searching over possible combinations of active constraints, equality constraint problem solved at each iteration

C21 Model Predictive Control

2 - 21

Active constraints: example

QP problem with 5 inequality constraints only constraint 2 is active at the solution

C21 Model Predictive Control

2 - 22

Active constraints: example

QP problem with only constraint 2

same solution

C21 Model Predictive Control

2 - 23

QP solvers: active set method


Computational load: large upper bound on possible no. iterations operations per iteration

Use cost gradient to choose possible active constraint sets small number of iterations in practice

For MPC: initialize solver using solution of previous optimization no. iterations needed are significantly reduced

C21 Model Predictive Control

2 - 24

QP solvers: interior point method


Solve unconstrained problem at each iteration:

where barrier function: as at constraints

is increased at each iteration until

Computational advantages for large-scale problems, e.g.

No method (yet) for initializing at estimated solution

C21 Model Predictive Control

2 - 25

Interior point method: example

as but problem becomes ill-conditioned as

C21 Model Predictive Control

2 - 26

Summary
Predictions input:

state: Infinite horizon cost

Optimization subject to constraints:

You might also like