Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti...

47
Course on Model Predictive Control Part II – Linear MPC design Gabriele Pannocchia Department of Chemical Engineering, University of Pisa, Italy Email: [email protected] Facoltà di Ingegneria, Pisa. July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 1 / 47

Transcript of Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti...

Page 1: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Course on Model Predictive ControlPart II – Linear MPC design

Gabriele Pannocchia

Department of Chemical Engineering, University of Pisa, ItalyEmail: [email protected]

Facoltà di Ingegneria, Pisa.July 16th, 2012, Aula Pacinotti

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 1 / 47

Page 2: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Outline

1 Estimator module design for offset-free tracking

2 Steady-state optimization module design

3 Dynamic optimization module design

4 Closed-loop implementation and receding horizon principle

5 Quick overview of numerical optimization

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 2 / 47

Page 3: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Estimator module

MPC

ProcessDynamic

Steady-state

u(k)

Optimization

Estimatord(k)

Optimization

Tuning parameters

Tuning parameters

x(k), d(k)

xs(k), us(k)

z−1

x−(k +1)d−(k +1)

y(k)

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 3 / 47

Page 4: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Estimator preliminaries

Basic model, inputs and outputs

Basic model:

x+ = Ax +Bu +w

y =C x + v

Inputs k: measured output y(k) and predicted state x−(k)Outputs k: updated state estimate x(k)

State estimator for basic modelChoose any L such that (A− ALC ) is strictly HurwitzFiltering: x(k) = x−(k)+L(y(k)−C x−(k))

Key observation

The estimator is the only feedback module in an MPC. Any discrepancybetween true plant and model should be corrected there

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 4 / 47

Page 5: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Augmented system: definition

Issue and solution approach

An MPC based on the previous estimator does notcompensate for plant/model mismatch and persistentdisturbances

As in [Davison and Smith, 1971, Kwakernaak and Sivan, 1972,Smith and Davison, 1972, Francis and Wonham, 1976], oneshould model and estimate the disturbance to be rejected

For offset-free control, an integrating disturbance is added

Augmented system [Muske and Badgwell, 2002, Pannocchia andRawlings, 2003], with d ∈Rnd

[xd

]+=

[A Bd

0 I

][xd

]+

[B0

]u +

[w

wd

]y = [

C Cd][

xd

]+ v

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 5 / 47

Page 6: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Augmented system: observability

Observability of the augmented system

Assume that (A,C ) is observable

Question: is

([A Bd

0 I

],[C Cd

])observable?

Answer: yes, if and only if (from the Hautus test)

rank

[A− I Bd

C Cd

]= n +nd

Observation: the previous can be satisfied if and only if

nd ≤ p

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 6 / 47

Page 7: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Augmented system: controllability

Controllability of the augmented system

Assume that (A,B) is controllable

Question: is

([A Bd

0 I

],

[B0

])controllable?

Answer: No

Observation: the disturbance is not going to be controlled.Its effect is taken into account in Steady-State Optimizationand Dynamic Optimization modules

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 7 / 47

Page 8: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Augmented estimator

General design

Set nd = p (see [Pannocchia and Rawlings, 2003, Maeder et al.,2009] for issues on choosing nd < p)

Choose (Bd ,Cd ) such that the augmented system is observable

Choose L =[

Lx

Ld

]such that

([A Bd

0 I

]−

[A Bd

0 I

][Lx

Ld

][C Cd

])is strictly Hurwitz

Augmented estimator:[x(k)d(k)

]=

[x−(k)d−(k)

]+

[Lx

Ld

](y(k)− [

C Cd][

x−(k)d−(k)

])

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 8 / 47

Page 9: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

The typical industrial design

Typical industrial design for stable systems (A strictly Hurwitz)

Bd = 0, Cd = I , Lx = 0, Ld = I

Output disturbance model

Any error y(k)−C x−(k) is assumed to be caused by a step(constant) disturbance acting on the output. In fact, thefiltered disturbance estimate is:

d(k) = d−(k)+ (y(k)−C x−(k)− d−(k)) = y(k)−C x−(k)

It is a deadbeat Kalman filter

Q = 0, Qd = I , R → 0

It is simple and does the job [Rawlings et al., 1994]

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 9 / 47

Page 10: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Comments on the industrial design

Rotation factor for integrating systems

k k +1 k +2 k +3k −1 k +4

(current time)

yk

(uncorrected)

(rotated)

translated)(rotated and

xk|k−1

Limitations of the output disturbance model

The overall performance is often sluggish [Lundström et al., 1995, Muske andBadgwell, 2002, Pannocchia and Rawlings, 2003, Pannocchia, 2003]

A suitable estimator design can improve the closed-loop performance[Pannocchia, 2003, Pannocchia and Bemporad, 2007, Rajamani et al., 2009]

Often, a deadbeat input disturbance model works better

Bd = B , Cd = 0, Q = 0, Qd = I , R → 0

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 10 / 47

Page 11: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Steady-state optimization module

MPC

ProcessDynamic

Steady-state

u(k)

Optimization

Estimatord(k)

Optimization

Tuning parameters

Tuning parameters

x(k), d(k)

xs(k), us(k)

z−1

x−(k +1)d−(k +1)

y(k)

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 11 / 47

Page 12: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Steady-state optimization module: introduction

A trivial case

Square system (m = p) without constraints and withsetpoints on all CVs

Solve the linear system

xs = Axs +Bus +Bd d

rs =C xs +Cd d

Obtain [xs

us

]=

[I − A −B

C 0

]−1 [Bd d

rsp −Cd d

]

ObservationThe steady-state target (xs , us ) may change at each decision time because of thedisturbance estimate d

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 12 / 47

Page 13: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Objectives of the steady-state optimization module

Boundary conditions

In most cases the number of CVs is different from thenumber of MVs: p 6= m

CVs and MVs have constraints to meet

ymin ≤ y(k) ≤ ymax, umin ≤ u(k) ≤ umax

Only a small subset of CVs have fixed setpoints: H y(k) → rsp

Objectives

Given the current disturbance estimate, d

Compute the equilibrium (xs ,us , ys ):xs = Axs +Bus +Bd d , ys =C xs +Cd d such that:

Ï constraints on MVs and CVs are satisfied:ymin ≤ ys ≤ ymax, umin ≤ us ≤ umax

Ï the subset of CVs tracks the setpoint: H ys = rs

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 13 / 47

Page 14: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Examples of steady-state optimization feasible regions

Stable system with 2 MVs and 2 CVs (with bounds)

ys =C (I − A)−1Bus + (C (I − A)−1Bd +Cd )d =Gus +Gd d

u(2)s

u(1)s u(1)

maxu(1)min

u(2)min

u(2)max

y (1)max

y (2)max

y (1)min

y (2)min

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 14 / 47

Page 15: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Examples of steady-state optimization feasible regions

Stable system with 2 MVs and 2 CVs (one setpoint)

ys =C (I − A)−1Bus + (C (I − A)−1Bd +Cd )d =Gus +Gd d

y (2)min = y (2)

max

u(1)s u(1)

maxu(1)min

u(2)min

u(2)max

y (1)max

y (1)min

u(2)s

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 15 / 47

Page 16: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Examples of steady-state optimization feasible regions

Stable system with 2 MVs and 2 CVs (two setpoints)

ys =C (I − A)−1Bus + (C (I − A)−1Bd +Cd )d =Gus +Gd d

y (1)min = y (1)

max

u(1)s u(1)

maxu(1)min

u(2)min

u(2)max

u(2)s

y (2)min = y (2)

max

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 16 / 47

Page 17: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Examples of steady-state optimization feasible regions

Stable system with 2 MVs and 3 CVs (two setpoints)

ys =C (I − A)−1Bus + (C (I − A)−1Bd +Cd )d =Gus +Gd d

y (3)max

u(1)s u(1)

maxu(1)min

u(2)min

u(2)max

u(2)s

y (2)min = y (2)

max

y (1)min = y (1)

max

y (3)min

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 17 / 47

Page 18: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Hard and soft constraints

Hard constraints

In the two optimization modules, constraints on MVs areregarded as hard, i.e., cannot be violated

This choice comes from the possibility of satisfying themexactly

Soft constraints

In the two optimization modules, constraints on CVs areregarded as soft, i.e., can be violated when necessary

The amount of violation is penalized in the objective function

This choice comes from the impossibility of satisfying themexactly

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 18 / 47

Page 19: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Steady-state optimization module: linear formulation

General formulation (LP)

minus ,xs ,εs ,εs

q ′εs +q ′εs + r ′us s.t.

xs = Axs +Bus +Bd d

umin ≤ us ≤ umax

ymin −εs ≤C xs +Cd d ≤ ymax +εs

εs ≥ 0

εs ≥ 0

ExtensionsSetpoints on some CVs can be specified with either an equality constraint orby setting identical value for minimum and maximum value

Often CVs are grouped by ranks

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 19 / 47

Page 20: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

LP steady-state optimization module: tuning

Cost functionr ∈Rm is the MV cost vector: a positive (negative) entry in r implies that thecorresponding MV should be minimized (maximized)

q ∈Rp and q ∈Rp are the weights of upper and lower bound CV violations.Sometimes they are defined in terms of equal concern error:q i = 1

SSECEUi

, qi= 1

SSECELi

, i = 1, . . . , p

ConstraintsBounds umax, umin, ymax, ymin can be modified by the operators (withinranges defined by the MPC designer)

Sometimes in order to avoid large target changes from time k −1 to time k arate constraint is added

−∆umax ≤ us (k)−us (k −1) ≤∆umax

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 20 / 47

Page 21: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

LP steady-state optimization module: numerical solution

Standard LP form

minz

c ′z s.t.

E z ≤ e, F z = f

with

z =[ xs

usεsεs

], E =

0 I 0 00 −I 0 0C 0 −I 0−C 0 0 −I

0 0 −I 00 0 0 −I

, e =

umax−umin

ymax−Cd d

−(ymin−Cd d)00

, F = [ I−A −B 0 0 ] , f = Bd d

Solution algorithms [Nocedal and Wright, 2006]

Solution methods based on simplex or interior point algorithms

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 21 / 47

Page 22: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Steady-state optimization module: quadratic formulation

QP formulation

The LP formulation is quite intuitive but its outcome may betoo “jumpy”

Sometimes a QP formulation may be preferred

minus ,xs ,εs ,εs

‖εs‖2Q s

+‖εs‖2Q

s+‖us −usp‖2

Rss.t.

xs = Axs +Bus +Bd d

umin ≤ us ≤ umax

ymin −εs ≤C xs +Cd d ≤ ymax +εs

where usp is the desired MV setpoint and ‖x‖2Q = x ′Qx

Tuning is slightly more complicated, but the outcome isusually “smoother”

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 22 / 47

Page 23: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Dynamic optimization module

MPC

ProcessDynamic

Steady-state

u(k)

Optimization

Estimatord(k)

Optimization

Tuning parameters

Tuning parameters

x(k), d(k)

xs(k), us(k)

z−1

x−(k +1)d−(k +1)

y(k)

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 23 / 47

Page 24: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Dynamic optimization module: introduction

Agenda

Make a finite-horizon prediction of future CVs evolutionbased on a sequence of MVs

Find the optimal MVs sequence, minimizing a cost functionthat comprises:

Ï deviation of CVs (and MVs) from their targetsÏ rate of change of MVs

respecting constraints on:Ï MVs (always)Ï CVs (possibly)

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 24 / 47

Page 25: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Dynamic optimization module: graphical interpretation

Prediction horizon

y

u

FuturePast

Control horizon

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 25 / 47

Page 26: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Dynamic optimization module: formulation

Cost function: Q, either R or S, Q, Q, P positive definite matrices

VN (x,u,εεε,εεε) =N−1∑j=0

[‖y( j )− ys‖2

Q +‖u( j )−us‖2R +‖u( j )−u( j −1)‖2

S+

‖ε( j )‖2Q+‖ε( j )‖2

Q

]+‖x(N )−xs‖2

P s.t.

x+ = Ax +Bu +Bd d x(0) = x

y =C x +Cd d ys =C xs +Cd d

Control problem

minu,εεε,εεε

VN (x,u,εεε,εεε) s.t.

umin ≤ u( j ) ≤ umax

−∆umax ≤ u( j )−u( j −1) ≤∆umax

ymin −ε( j ) ≤ y( j ) ≤ ymax +ε( j )

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 26 / 47

Page 27: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Dynamic optimization module: formulation

Main tuning parameters

Q: diagonal matrix of weights for CVs deviation from target:

qi i =(

1

DEC E Mi

)2

R: diagonal matrix of weights for MVs deviation from targetS: diagonal matrix of weights for MVs rate of change, often calledmove suppression factorsQ, Q: diagonal matrices of weights for CVs violation ofconstraints

q i i =(

1

DEC EUi

)2

, qi i=

(1

DEC E Li

)2

umax, umin, ymax, ymin, ∆umax: constraint vectorsN : prediction horizon

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 27 / 47

Page 28: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Dynamic optimization module: rewriting

Deviation variables

Use the target (xs ,us ):x( j ) = x( j )−xs , u( j ) = u( j )−us ,

Recall that:xs = Axs +Bus +Bd d , ys =C xs +Cd d

Cost function becomes:

VN (x, u,εεε,εεε) =N−1∑j=0

[‖x( j )‖2

C ′QC +‖u( j )‖2R +‖u( j )− u( j −1)‖2

S+

‖ε( j )‖2Q+‖ε( j )‖2

Q

]+‖x(N )‖2

P s.t.

x+ = Ax +Bu x(0) = x −xs

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 28 / 47

Page 29: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Dynamic optimization module: constrained LQR

Compact problem formulation

minu,εεε,εεε

VN (x, u,εεε,εεε) s.t.

umin −us ≤ u( j ) ≤ umax −us

−∆umax ≤ u( j )− u( j −1) ≤∆umax

ymin − ys −ε( j ) ≤C x( j ) ≤ ymax − ys +ε( j )

Constrained LQR formulationWith suitable definitions (shown next), we obtain a constrained LQR formulation:

minua

VN (xa ,ua) =N−1∑j=0

[‖xa( j )‖2

Qa+‖ua( j )‖2

Ra+2xa( j )Maua( j )

]+‖xa(N )‖2

Pa

s.t. x+a = Aa xa +Baua , Daua +Ea xa ≤ ea

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 29 / 47

Page 30: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Dynamic optimization module: constrained LQR (cont.’d)

Augmented state and input

xa( j ) =[

x( j )u( j−1)

], ua( j ) =

[ u( j )ε( j )ε( j )

]

The state is augmented to write terms u( j )−u( j −1) (in theobjective function and/or in the constraints)

The input is augmented to write the soft output constraints

Matrices and vectors

Aa = [A 00 0

]Ba = [

B 0 0I 0 0

]Qa =

[C ′QC 0

0 S

]Ra =

[R+S 0 00 Q 00 0 Q

]Ma = [

0 0 0−S 0 0

]

Da = I 0 0

−I 0 0I 0 0−I 0 00 −I 00 0 −I

Ea = 0 0

0 00 −I0 IC 0−C 0

ea =

umax−usus−umin∆umax∆umax

ymax−ysys−ymin

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 30 / 47

Page 31: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Dynamic optimization module: QP solution

From constrained LQR to a QP problem

xa =

xa (0)xa (1)xa (2)

...xa ()

Aa =

I

Aa

A2a

...AN

a

Ba =

0 ··· ··· 0

Ba

. . ....

Aa Ba Ba

. . ....

. . . 0AN−1

a Ba ··· Aa Ba Ba

=⇒ xa = Aa xa(0)+Ba ua

Qa =

Qa

Qa

. . .Qa

Pa

Ra =Ra

Ra

. . .Ra

Ma =

Ma

Ma

. . .Ma

0 ··· 0

Da =Da

Da

. . .Da

Ea =

Ea 0

Ea

.... . .

Ea 0

ea = ea

ea

...ea

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 31 / 47

Page 32: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Dynamic optimization module: QP solution (cont.’d)

QP problem

minua

1

2u′

a Ha ua +u′a qa s.t.

Fa ua ≤ ea −Ga xa(0)

where

Ha = B′a Qa Ba +Ra +B′

a Ma +M′a Ba qa = (B′

a Qa +M′a)Aa xa(0)

Fa = Da +Ea Ba Ga = Ea Aa

ObservationsBoth the linear penalty and constraint RHS vary linearly with the currentaugmented state xa(0), while all other terms are fixed

QP solvers are based on Active-Set Methods or Interior Point Methods

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 32 / 47

Page 33: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Feedback controllers synthesis from open-loopcontrollers: the receding horizon principle

A quote from [Lee and Markus, 1967]

One technique for obtaining a feedback controller synthesis fromknowledge of open-loop controllers is to measure the current controlprocess state and then compute very rapidly for the open-loop controlfunction.The first portion of this function is then used during a short time interval,after which a new measurement of the process state is made and a newopen-loop control function is computed for this new measurement.The procedure is then repeated.

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 33 / 47

Page 34: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Optimal control sequence and closed-loopimplementation

The optimal control sequence

The optimal control sequence u0a is in the form

u0a =

u0(0), u0(1), . . . , u0(N −1)︸ ︷︷ ︸u0

,ε(0),ε(1), . . . ,ε(N −1)︸ ︷︷ ︸εεε

,ε(0),ε(1), . . . ,ε(N −1)︸ ︷︷ ︸εεε

The variables εεε and εεε are present only when soft output constraints are used

Closed-loop implementation

Only the first element of the optimal control sequence isinjected into the plant: u(k) = u0(0)+us (k)The successor state is predicted using the estimator model

x−(k +1) = Ax(k)+Bu(k)+Bd d(k)

d−(k +1) = d(k)

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 34 / 47

Page 35: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Linear MPC: summary

Overall algorithm

1 Given predicted state and disturbance (x−(k), d−(k)) and outputmeasurement y(k), compute filtered estimate:x(k) = x−(k)+Lx

(y(k)−C x−(k)−Cd d−(k)

),

d(k) = d−(k)+Ld(y(k)−C x−(k)−Cd d−(k)

)2 Solve Steady-State Optimization problem and compute targets

(xs (k),us (k))

3 Define deviation variables: x(0) = x(k)−us (k),

u(−1) = u(k −1)−us (k), and initial regulator state xa(0) =[

x(0)u(−1)

].

Solve Dynamic Optimization problem to obtain u0

4 Inject control action u(k) = u0(0)+us (k). Predict successor statex−(k +1) = Ax(k)+Bu(k)+Bd d(k) and disturbanced−(k +1) = d(k). Set k ← k +1 and go to 1

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 35 / 47

Page 36: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

General formulation of an optimization problem

The three ingredients

x ∈Rn , vector of variables

f :Rn →R, objective function

c :Rn →Rm , vector function of constraints that the variablesmust satisfy. m is the number of restrictions applied

The optimization problem

minx∈Rn

f (x) subject to

{ci (x) = 0 ∀i ∈ E

ci (x) ≥ 0 ∀i ∈I

E , I : sets of indices of equality and inequality constraints, respectively

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 36 / 47

Page 37: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Constrained optimization: example 1

Solve

min x1 +x2 s. t. x21 +x2

2 −2 = 0

Standard notation, feasibility region and solution

In standard notation: f (x) = x1 +x2, I =;, E = {1},c1(x) = x2

1 +x22 −2

Feasibility region: circle of radiusp

2, only the border

Solution: x∗ = [−1,−1]T

f (x)

x1

x2

Observation

∇ f (x∗) =[

11

], ∇c1(x∗) =

[−2−2

]=⇒∇ f (x∗) =−1

2∇c1(x∗)

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 37 / 47

Page 38: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Constrained optimization: example 2

Solve

min x1 +x2 s. t. 2−x21 −x2

2 ≥ 0

Standard notation, feasibility region and solution

In standard notation: f (x) = x1 +x2, I = {1}, E =;,c1(x) = 2− (x2

1 +x22)

Feasibility region: circle of radiusp

2, including theinterior

Solution: x∗ = [−1,−1]T

x1

x2

f (x)

Observation

∇ f (x∗) =[

11

], ∇c1(x∗) =

[22

]=⇒∇ f (x∗) = 1

2∇c1(x∗)

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 38 / 47

Page 39: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Constrained optimality conditions (KKT)

Lagrangian function

L (x,λ) = f (x)− ∑i∈E∪I

λi ci (x)

Karush-Kuhn-Tucker optimality conditions

If x∗ is a local solution to the standard problem, there exists avector λ∗ ∈Rm such that the following conditions hold:

∇xL (x∗,λ∗) = 0

ci (x∗) = 0 for all i ∈ E

ci (x∗) ≥ 0 for all i ∈I

λ∗i ≥ 0 for all i ∈I

λ∗i ci (x∗) = 0 for all i ∈ E ∪I

The components of λ∗ are called Lagrange multipliersNotice that a multiplier is zero when the correspondingconstraint is inactive

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 39 / 47

Page 40: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Linear programs (LP) problems

LP in standard form

minx

cT x subject to Ax = b, x ≥ 0

where: c ∈Rn , x ∈Rn , A ∈Rm×n , b ∈Rm and rank(A) = m

Optimality conditions

Lagrangian function: L (x,π, s) = cT x −πT (Ax −b)− sT x

If x∗ is solution of the linear program, then:

ATπ∗+ s∗ = c

Ax∗ = b

x∗ ≥ 0

s∗ ≥ 0

x∗i s∗i = 0, i = 1,2, . . .n

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 40 / 47

Page 41: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

LP: the simplex method

The “base points”

A point x ∈Rn is a base point if

Ax = b and x ≥ 0

At most m components of x are nonzero

The columns of A corresponding to the nonzero elements arelinearly independent

Fundamental aspects of the simplex method

Base points are vertices of the feasibility region

The solution is a base point

The simplex method iterates from a base point xk to another one xk+1, andstops when all components of sk are nonnegative

When a component of sk is negative, a new base point xk+1 in which thecorresponding element of xk is nonzero is selected

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 41 / 47

Page 42: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Quadratic Programming (QP)

Standard form

minx

1

2xT Gx +xT d

subject to:

aTi x = bi , i ∈ E

aTi x ≥ bi , i ∈I

where G ∈Rn×n is symmetric (positive definite), d ∈Rn , b ∈Rn , andai ∈Rn , for all i ∈ E ∪I

The active set

A (x∗) = {i ∈ E ∪I : aT

i x∗ = bi}

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 42 / 47

Page 43: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Quadratic Programming (QP) problems (2/2)

Lagrangian function

L (x,λ) = 1

2xT Gx +xT − ∑

i∈E∪I

λi (aTi x −bi )

Optimality conditions (KKT)

Gx∗+d − ∑i∈A (x∗)

λ∗i ai = 0

aTi x∗ = bi , for all i ∈A (x∗)

aTi x∗ > bi , for all i ∈I \A (x∗)

λ∗i ≥ 0, for all i ∈I ∩A (x∗)

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 43 / 47

Page 44: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Active set methods for convex QP problems

Fundamental steps

1 Given a feasible xk , we evaluate its active set and build thematrix A whose row are {aT

i }, i ∈A (xk )

2 Solve the KKT linear system[G AT

A 0

][−pk

λk

]=

[d +Gxk

Axk −b

]3 If ‖pk‖ ≤ ρ, check if λ∗

i ≥ 0 for all i ∈A (xk ). If so, stop.

4 If a multiplier λ∗i < 0 for some i ∈A (xk ), remove the i−th

constraint from the active set.

5 If ‖pk‖ > ρ, define xk+1 = xk +αk pk , where αk is the largestscalar in (0,1] such that no inequality constraint is violated.When a blocking constraint is found, it is included in the newactive set A (xk+1)

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 44 / 47

Page 45: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

Nonlinear programming (NLP) problems via SQPalgorithms

Nonlinear programming (NLP) problems

minx

f (x) s.t.

ci (x) = 0 i ∈ E

ci (x) ≥ 0 i ∈I

“Sequential Quadratic Programming” (SQP) approach

minpk

1

2pT

k Wk pk +∇ f (xk )T pk s.t.

∇ci (xk )T pk + ci (xk ) = 0 i ∈ E

∇ci (xk )T pk + ci (xk ) ≥ 0 i ∈I

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 45 / 47

Page 46: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

References I

E. J. Davison and H. W. Smith. Pole assignment in linear time-invariant multivariable systems withconstant disturbances. Automatica, 7:489–498, 1971.

B. A. Francis and W. M. Wonham. The internal model principle of control theory. Automatica, 12:457–465, 1976.

H. Kwakernaak and R. Sivan. Linear Optimal Control Systems. John Wiley & Sons, 1972.

E. B. Lee and L. Markus. Foundations of Optimal Control Theory. John Wiley & Sons, New York, 1967.

P. Lundström, J. H. Lee, M. Morari, and S. Skogestad. Limitations of dynamic matrix control. Comp.Chem. Eng., 19:409–421, 1995.

U. Maeder, F. Borrelli, and M. Morari. Linear offset-free model predictive control. Automatica, 45(10):2214–2222, 2009.

K. R. Muske and T. A. Badgwell. Disturbance modeling for offset-free linear model predictive control. J.Proc. Contr., 12:617–632, 2002.

J. Nocedal and S. J. Wright. Numerical Optimization. Springer, second edition, 2006.

G. Pannocchia. Robust disturbance modeling for model predictive control with application tomultivariable ill-conditioned processes. J. Proc. Cont., 13:693–701, 2003.

G. Pannocchia and A. Bemporad. Combined design of disturbance model and observer for offset-freemodel predictive control. IEEE Trans. Auto. Contr., 52(6):1048–1053, 2007.

G. Pannocchia and J. B. Rawlings. Disturbance models for offset-free model predictive control. AIChE J.,49:426–437, 2003.

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 46 / 47

Page 47: Course on Model Predictive Control Part II – Linear MPC design · July 16th, 2012, Aula Pacinotti G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory

References II

M. R. Rajamani, J. B. Rawlings, and S. J. Qin. Achieving state estimation equivalence for misassigneddisturbances in offset-free model predictive control. AIChE J., 55(2):396–407, 2009.

J. B. Rawlings, E. S. Meadows, and K. R. Muske. Nonlinear model predictive control: a tutorial andsurvey. In ADCHEM Conference, pages 203–214, Kyoto, Japan, 1994.

H. W. Smith and E. J. Davison. Design of industrial regulators. Integral feedback and feedforwardcontrol. Proc. IEE, 119(8):1210–1216, 1972.

G. Pannocchia Course on Model Predictive Control. Part II – Linear MPC theory 47 / 47