0% found this document useful (0 votes)
117 views13 pages

Lec16 - Optimal Control

Model predictive control (MPC) is a control technique that uses an explicit process model to predict the future response of a plant. At each time step, MPC solves an optimization problem to determine a sequence of future control inputs that minimize a cost function while satisfying system constraints. Only the first input in the sequence is applied, then the optimization is repeated at the next time step using updated system measurements. MPC can handle system constraints and nonlinear/time-varying dynamics by re-solving the optimization problem in real-time. It has been successfully applied in various industrial process control applications.

Uploaded by

javadmousavi440
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
117 views13 pages

Lec16 - Optimal Control

Model predictive control (MPC) is a control technique that uses an explicit process model to predict the future response of a plant. At each time step, MPC solves an optimization problem to determine a sequence of future control inputs that minimize a cost function while satisfying system constraints. Only the first input in the sequence is applied, then the optimization is repeated at the next time step using updated system measurements. MPC can handle system constraints and nonlinear/time-varying dynamics by re-solving the optimization problem in real-time. It has been successfully applied in various industrial process control applications.

Uploaded by

javadmousavi440
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

MIT OpenCourseWare

http://ocw.mit.edu
16.323 Principles of Optimal Control
Spring 2008
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
16.323 Lecture 16
Model Predictive Control
Allgower,F.,andA.Zheng,NonlinearModelPredictiveControl,Springer-Verlag,
2000.
Camacho,E.,andC.Bordons,ModelPredictiveControl,Springer-Verlag,1999.
Kouvaritakis, B., and M. Cannon, Non-Linear Predictive Control: Theory &
Practice, IEE Publishing, 2001.
Maciejowski, J., Predictive Control with Constraints, Pearson Education POD,
2002.
Rossiter, J. A., Model-Based Predictive Control: A Practical Approach, CRC
Press, 2003.
Spr 2008 16.323 161
MPC
PlanninginLecture8waseectivelyopen-loop
Designedthecontrolinputsequenceu(t)usinganassumedmodel
andsetofconstraints.
Issueisthatwithmodelingerrorand/ordisturbances,theseinputs
willnotnecessarilygeneratethedesiredsystemresponse.
Needaclosed-loopstrategytocompensatefortheseerrors.
ApproachcalledModel Predictive Control
Alsoknownasreceding horizon control
Basicstrategy:
At time k, use knowledge of the system model to design an input
sequence
u(k|k),u(k+ 1|k), u(k+ 2|k), u(k+ 3|k), . . . ,u(k+N|k)
overanitehorizonN fromthecurrentstatex(k)
Implementafractionofthatinputsequence,usuallyjustrststep.
Repeatfortimek+ 1atstatex(k+1)
June 18, 2008
Reference
"Optimal" future outputs
"Optimal" future inputs
Future outputs, no control
Future inputs, no control
Old outputs
Old inputs
Past Present Future Time
MPC: basic idea (from Bo Wahlberg)
Figure by MIT OpenCourseWare.
Spr 2008 16.323 162
Note that the control algorithm is based on numerically solving an
optimizationproblemateachstep
Typicallyaconstrainedoptimization
MainadvantageofMPC:
Explicitlyaccountsforsystemconstraints.
Doesnt just design a controller to keep the system away from
them.
Caneasilyhandlenonlinearandtime-varyingplantdynamics,since
thecontrollerisexplicitlyafunctionofthemodelthatcanbemod-
iedinreal-time(andplantime)
Manycommercialapplicationsthatdatebacktotheearly1970s,see
http://www.che.utexas.edu/
~
qin/cpcv/cpcv14.html
Muchofthisworkwasinprocesscontrol- verynonlineardynamics,
butnotparticularlyfast.
As computer speed has increased, there has been renewed interest in
applying this approach to applications with faster time-scale: trajec-
torydesignforaerospacesystems.
June 18, 2008
Ref
Plant
P
Trajectory
Generation
Noise
u
Ref
Output
Plant
P
Trajectory
Generation
Noise
u u
d
x
d
du
Output
Feedback
Compensation
Implementation architectures for MPC (from Mark Milam)
Figure by MIT OpenCourseWare.
Basic Formulation

Spr 2008 16.323 163


Givenasetofplantdynamics(assumelinearfornow)
x(k+ 1) = Ax(k) +Bu(k)
z(k) = Cx(k)
andacostfunction
N
J = {z(k+j|k)
R
zz
+u(k+j|k)
R
uu
}+F(x(k+N|k))
j=0
z(k+j|k)
R
xx
is just a short hand for a weighted norm of the
state,andtobeconsistentwithearlierwork,wouldtake
z(k+j|k)
R
zz
=z(k+j|k)
T
R
zz
z(k+j|k)
F(x(k+N|k))isaterminalcostfunction
NotethatifN ,andtherearenoadditionalconstraintsonzor
u,thenthisisjustthediscreteLQRproblemsolvedonpage314.
Note that the original LQR result could have been written as just
an input control sequence (feedforward), but we choose to write
itasalinearstatefeedback.
In the nominal case, there is no dierence between these two im-
plementationapproaches(feedforwardandfeedback)
Butwithmodelingerrorsanddisturbances,thestatefeedbackform
ismuchlesssensitive.
Thisisthemainreasonforusingfeedback.
Issue: Whenlimitsonxanduareadded,wecannolongerndthe
generalsolutioninanalyticform mustsolveitnumerically.
June 18, 2008

Spr 2008 16.323 164


However,solvingforaverylonginputsequence:
Doesnotmakesenseifoneexpectsthatthemodeliswrongand/or
there are disturbances, because it is unlikely that the end of the
planwillbeimplemented(anewonewillbemadebythen)
Longer plans have more degrees of freedom and take much longer
tocompute.
TypicallydesignusingasmallNshortplanthatdoesnotnecessarily
achieveallofthegoals.
ClassicalhardquestionishowlargeshouldN be?
Ifplandoesntreachthegoal,thenmustdevelopanestimateofthe
remainingcost-to-go
Typicalproblemstatement: forniteN (F = 0)
N
minJ = k)
R
zz
+u(k+j k)
R
uu
}
u
{z(k+j| |
j=0
s.t. x(k+j+ 1|k) = Ax(k+j|k) +Bu(k+j|k)
x(k|k) x(k)
z(k+j|k) = Cx(k+j|k)
and |u(k+j|k)| u
m
June 18, 2008
Spr 2008 16.323 165
Considerconvertingthisintoamorestandardoptimizationproblem.
z(k|k) = Cx(k|k)
z(k+ 1|k) = Cx(k+ 1|k) =C(Ax(k|k) +Bu(k|k))
= CAx(k|k) +CBu(k|k)
z(k+ 2|k) = Cx(k+ 2|k)
= C(Ax(k+ 1|k) +Bu(k+ 1|k))
= CA(Ax(k|k) +Bu(k|k))+CBu(k+ 1|k)
= CA
2
x(k|k) +CABu(k|k) +CBu(k+ 1|k)
.
.
.
z(k+N|k) = CA
N
x(k|k) +CA
N1
Bu(k|k) +
+CBu(k+ (N 1)|k)
Combinetheseequationsintothefollowing:

z(k k) C |
z(k+ 1


x(k k) |
|
|
k)
k)
CA
CA
2
z(k+ 2
.
.
.
.
. .
CA
N
z(k+N|k)

0 0 0 0
CB 0 0 0
CAB CB 0 0
u(k|k)
u(k+ 1


.
.
.


|k)
+
.
.
.
CA
N1
B CA
N2
B CA
N3
B CB
u(k+N 1|k)

June 18, 2008


Spr 2008 16.323 166
Nowdene

z(k k) u(k k)
Z(k)

.
.
.
|

U(k)

.
.
.
|

z(k+N|k) u(k+N 1|k)


then,withx(k|k) =x(k)
Z(k) =Gx(k) +HU(k)
Notethat
N
z(k+j|k)
T
R
zz
z(k+j|k) =Z(k)
T
W
1
Z(k)
j=0
withanobviousdenitionoftheweightingmatrixW
1
Thus
Z(k)
T
W
1
Z(k) +U(k)
T
W
2
U(k)
= (Gx(k) +HU(k))
T
W
1
(Gx(k) +HU(k))+U(k)
T
W
2
U(k)
1
= x(k)
T
H
1
x(k) +H
2
T
U(k) + U(k)
T
H
3
U(k)
2
where
H
1
=G
T
W
1
G, H
2
=2(x(k)
T
G
T
W
1
H), H
3
=2(H
T
W
1
H+W
2
)
ThentheMPCproblemcanbewrittenas:
minJ

= H
2
T
U(k) +
1
U(k)
T
H
3
U(k)
U(k) 2
I
N
s.t. U(k)u
m
I
N
June 18, 2008
Toolboxes
Spr 2008 16.323 167
Key point: the MPC problem is now in the form of a standard
quadratic programforwhichstandardandecientcodesexist.
QUADPROG Quadratic programming. %
X=QUADPROG(H,f,A,b) attempts to solve the %
quadratic programming problem:
min 0.5*x*H*x + f*x subject to: A*x <= b
x
X=QUADPROG(H,f,A,b,Aeq,beq) solves the problem %
above while additionally satisfying the equality%
constraints Aeq*x = beq.
SeveralMatlabtoolboxesexistfortestingtheseideas
MPCtoolboxbyMorariandRickerextensiveanalysisanddesign
tools.
MPCtools
32
enablessomeMPCsimulationandisfree
www.control.lth.se/user/johan.akesson/mpctools/
32
Johan Akesson: MPCtools 1.0 - Reference Manual. Technical report ISRN LUTFD2/TFRT7613SE, Department of Auto-
matic Control, Lund Institute of Technology, Sweden, January 2006.
June 18, 2008
MPC Observations

Spr 2008 16.323 168
Currentformassumesthatfullstateisavailable- canhookupwithan
estimator
Currentformassumesthatwecansenseandapplycorrespondingcon-
trolimmediately
With most control systems, that is usually a reasonably safe as-
sumption
Given that we must re-run the optimization, probably need to ac-
count for this computational delay - dierent form of the discrete
model- seeF&P(chapter2)
Iftheconstraintsarenotactive,thenthesolutiontotheQPisthat
U(K) =H
1
H
2
3
whichcanbewrittenas:
u(k|k) = 1 0 . . . 0 (H
T
W
1
H+W
2
)
1
H
T
W
1
Gx(k)
= Kx(k)
whichisjustastatefeedbackcontroller.
Canapplythisgaintothesystemandchecktheeigenvalues.
June 18, 2008
Spr 2008 16.323 169
WhatcanwesayaboutthestabilityofMPCwhentheconstraintsare
active?
33
Dependsalotontheterminalcostandtheterminalconstraints.
34
Classic result:
35
Consider a MPC algorithm for a linear system with
constraints. Assumethatthereareterminalconstraints:
x(k+N|k) = 0forpredictedstatex
u(k+N|k) = 0forcomputedfuturecontrolu
Theniftheoptimizationproblemisfeasibleattimek,x= 0isstable.
Proof: CanusetheperformanceindexJ asaLyapunovfunction.
Assumethereexistsafeasiblesolutionattimek andcostJ
k
Canusethatsolutiontodevelopafeasiblecandidateattimek+1,
bysimplyaddingu(k+N + 1)=0andx(k+N + 1)=0.
Key point: canestimatethecandidatecontrollerperformance
J

k+1
= J
k
{z(k|k)
R
zz
+u(k|k)
R
uu
}
J
k
{z(k|k)
R
zz
}
This candidate is suboptimal for the MPC algorithm, hence J de-
creasesevenfasterJ
k+1
J

k+1
Which says that J decreases if the state cost is non-zero (observ-
abilityassumptions) butJ islowerboundedbyzero.
Mayne et al. [2000] provides excellent review of other strategies for
provingstabilitydierentterminalcostandconstraintsets
33
Tutorial: model predictive control technology, Rawlings, J.B. American Control Conference, 1999. pp. 662-676
34
Mayne,D.Q.,J.B.Rawlings,C.V.RaoandP.O.M.Scokaert,ConstrainedModelPredictiveControl: StabilityandOptimality,
Automatica, 36, 789-814 (2000).
35
A. Bemporad, L. Chisci, E. Mosca: On the stabilizing property of SIORHC, Automatica, vol. 30, n. 12, pp. 2013-2015, 1994.
June 18, 2008
Example: Helicopter
Spr 2008 16.323 1610
ConsiderasystemsimilartotheQuansarhelicopter
36
Thereare2controlinputsvoltagetoeachfanV
f
,V
b
Asimpledynamicsmodelisthat:

e
= K
1
(V
f
+V
b
)T
g
/J
e

r
= K
2
sin(
p
)

p
= K
3
(V
f
V
b
)
andtherearephysicallimitsontheelevationandpitch:
0.5
e
0.6 1
p
1
ModelcanbelinearizedandthendiscretizedT
s
= 0.2sec.
0 5 10 15 20 25
0
2
4
6
8
10
12
N


State
Control
Time
Figure 16.3: Response Summary
36
ISSN 02805316 ISRN LUTFD2/TFRT- -7613- -SE MPCtools 1.0 Reference Manual Johan Akesson Department of Automatic
Control Lund Institute of Technology January 2006
June 18, 2008

r
Figure by MIT OpenCourseWare.
Spr 2008
0 10 20 30
0.1
0
0.1
0.2
0.3
0.4
E
l
e
v
a
t
i
o
n

[
r
a
d
]
0 10 20 30
1
0.5
0
0.5
1
t [s]
P
i
t
c
h

[
r
a
d
]
0 10 20 30
1
0
1
2
3
4
R
o
t
a
t
i
o
n

[
r
a
d
]
0 10 20 30
2
1
0
1
2
3
4
V
f
,

V
b

[
V
]
t [s]
16.323 1611
Figure 16.4: Response with N = 3
0 10 20 30
0.1
0
0.1
0.2
0.3
0.4
E
l
e
v
a
t
i
o
n

[
r
a
d
]
0 10 20 30
1
0.5
0
0.5
1
t [s]
P
i
t
c
h

[
r
a
d
]
0 10 20 30
1
0
1
2
3
4
R
o
t
a
t
i
o
n

[
r
a
d
]
0 10 20 30
2
1
0
1
2
3
4
V
f
,

V
b

[
V
]
t [s]
Figure 16.5: Response with N =10
0 10 20 30
0.1
0
0.1
0.2
0.3
0.4
E
l
e
v
a
t
i
o
n

[
r
a
d
]
0 10 20 30
1
0.5
0
0.5
1
t [s]
P
i
t
c
h

[
r
a
d
]
0 10 20 30
1
0
1
2
3
4
R
o
t
a
t
i
o
n

[
r
a
d
]
0 10 20 30
2
1
0
1
2
3
4
V
f
,

V
b

[
V
]
t [s]
Figure 16.6: Response with N =25
June 18, 2008

You might also like