Lec16 - Optimal Control
Lec16 - Optimal Control
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
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)
.
.
.
|
= 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