lec16_ Optimal Control

Embed Size (px)

Citation preview

  • 8/12/2019 lec16_ Optimal Control

    1/13

    MIT OpenCourseWarehttp://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.

    http://ocw.mit.edu/http://ocw.mit.edu/termshttp://ocw.mit.edu/termshttp://ocw.mit.edu/
  • 8/12/2019 lec16_ Optimal Control

    2/13

    16.323Lecture16ModelPredictiveControl

    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,IEEPublishing,2001. Maciejowski, J.,PredictiveControlwithConstraints,PearsonEducationPOD,

    2002. Rossiter, J. A., Model-Based Predictive Control: A Practical Approach, CRC

    Press,2003.

  • 8/12/2019 lec16_ Optimal Control

    3/13

  • 8/12/2019 lec16_ Optimal Control

    4/13

    Spr2008 16.323 162 Note that the control algorithm is based on numerically solving an

    optimizationproblemateachstepTypicallyaconstrainedoptimization

    MainadvantageofMPC:Explicitlyaccountsforsystemconstraints.Doesntjust design a controller to keep the system away from

    them.Caneasilyhandlenonlinearandtime-varyingplantdynamics,since

    thecontrollerisexplicitlyafunctionofthemodelthatcanbemodifiedinreal-time(andplantime)

    Manycommercialapplicationsthatdatebacktotheearly1970s,seehttp://www.che.utexas.edu/

    ~qin/cpcv/cpcv14.html

    Muchofthisworkwasinprocesscontrol- verynonlineardynamics,butnotparticularlyfast.

    Ascomputerspeedhas increased,therehasbeenrenewed interest inapplying thisapproach toapplicationswith faster time-scale: trajectorydesignforaerospacesystems.

    June18,2008

    Ref

    PlantP

    Trajectory

    Generation

    Noise

    uRef

    Output

    PlantP

    Trajectory

    Generation

    Noiseuud

    xd du

    Output

    Feedback

    Compensation

    Implementation architectures for MPC (from Mark Milam)

    Figure by MIT OpenCourseWare.

    http://www.che.utexas.edu/~qin/cpcv/cpcv14.htmlhttp://www.che.utexas.edu/~qin/cpcv/cpcv14.htmlhttp://www.che.utexas.edu/~qin/cpcv/cpcv14.htmlhttp://www.che.utexas.edu/~qin/cpcv/cpcv14.html
  • 8/12/2019 lec16_ Optimal Control

    5/13

    BasicFormulation

    Spr2008 16.323 163 Givenasetofplantdynamics(assumelinearfornow)

    x(k+ 1) = Ax(k) +Bu(k)z(k) = Cx(k)

    andacostfunctionN

    J = {z(k+j|k)Rzz +u(k+j|k)Ruu}+F(x(k+N|k))j=0

    z(k+j|k)Rxx isjust a short hand for a weighted norm of thestate,andtobeconsistentwithearlierwork,wouldtake

    z(k+j|k)Rzz =z(k+j|k)TRzzz(k+j|k)F(x(k+N|k))isaterminalcostfunction

    NotethatifN ,andtherearenoadditionalconstraintsonzoru,thenthisisjustthediscreteLQRproblemsolvedonpage314.NotethattheoriginalLQR resultcouldhavebeenwrittenasjust

    an inputcontrolsequence(feedforward),butwechoosetowriteitasalinearstatefeedback.

    In the nominal case, there is no difference between these two implementationapproaches(feedforwardandfeedback)

    Butwithmodelingerrorsanddisturbances,thestatefeedbackformismuchlesssensitive.

    Thisisthemainreasonforusingfeedback.

    Issue: Whenlimitsonxanduareadded,wecannolongerfindthegeneralsolutioninanalyticform mustsolveitnumerically.

    June18,2008

  • 8/12/2019 lec16_ Optimal Control

    6/13

    Spr2008 16.323 164 However,solvingforaverylonginputsequence:

    Doesnotmakesenseifoneexpectsthatthemodeliswrongand/orthere are disturbances, because it is unlikely that the end of theplanwillbeimplemented(anewonewillbemadebythen)

    Longerplanshavemoredegreesof freedomandtakemuch longertocompute.

    TypicallydesignusingasmallNshortplanthatdoesnotnecessarilyachieveallofthegoals.ClassicalhardquestionishowlargeshouldN be?Ifplandoesntreachthegoal,thenmustdevelopanestimateofthe

    remainingcost-to-go

    Typicalproblemstatement: forfiniteN (F = 0)N

    minJ = k)Rzz +u(k+j k)Ruu}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)| um

    June18,2008

  • 8/12/2019 lec16_ Optimal Control

    7/13

    Spr2008 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)= CA2x(k|k) +CABu(k|k) +CBu(k+ 1|k)...

    z(k+N|k) = CANx(k|k) +CAN1Bu(k|k) + +CBu(k+ (N1)|k)

    Combinetheseequationsintothefollowing:

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

    =

    x(k k)|||k)k) CACA2z(k+ 2.. ... .

    CANz(k+N|k) 0 0 0 0CB 0 0 0

    CAB CB 0 0u(k|k)

    u(k+ 1

    ...|k)+ ...

    CAN1B CAN2B CAN3B CB u(k+N1|k)

    June18,2008

  • 8/12/2019 lec16_ Optimal Control

    8/13

    Spr2008 16.323 166Nowdefine

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

    | U(k) ...|

    z(k+N|k) u(k+N1|k)then,withx(k|k) =x(k)

    Z(k) =Gx(k) +HU(k)Notethat

    Nz(k+j|k)TRzzz(k+j|k) =Z(k)TW1Z(k)

    j=0withanobviousdefinitionoftheweightingmatrixW1Thus

    Z(k)TW1Z(k) +U(k)TW2U(k)= (Gx(k) +HU(k))TW1(Gx(k) +HU(k))+U(k)TW2U(k)

    1= x(k)TH1x(k) +H2TU(k) + U(k)TH3U(k)2

    whereH1 =GTW1G, H2 =2(x(k)TGTW1H), H3 =2(HTW1H+W2)

    ThentheMPCproblemcanbewrittenas:minJ = H2TU(k) +1U(k)TH3U(k)U(k) 2

    INs.t. U(k)umIN

    June18,2008

  • 8/12/2019 lec16_ Optimal Control

    9/13

    ToolboxesSpr2008 16.323 167 Key point: the MPC problem is now in the form of a standard

    quadraticprogramforwhichstandardandefficientcodesexist.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

  • 8/12/2019 lec16_ Optimal Control

    10/13

    MPCObservations

    Spr2008 16.323 168 Currentformassumesthatfullstateisavailable- canhookupwithan

    estimator

    CurrentformassumesthatwecansenseandapplycorrespondingcontrolimmediatelyWith most control systems, that is usually a reasonably safe as

    sumptionGiventhatwemust re-run theoptimization, probablyneedtoac

    count for thiscomputationaldelay - different formof thediscretemodel- seeF&P(chapter2)

    Iftheconstraintsarenotactive,thenthesolutiontotheQPisthatU(K) =H1H23

    whichcanbewrittenas:u(k|k) = 1 0 . . . 0 (HTW1H+W2)1HTW1Gx(k)

    = Kx(k)whichisjustastatefeedbackcontroller.Canapplythisgaintothesystemandchecktheeigenvalues.

    June18,2008

  • 8/12/2019 lec16_ Optimal Control

    11/13

    Spr2008 16.323 169 WhatcanwesayaboutthestabilityofMPCwhentheconstraintsare

    active? 33Dependsalotontheterminalcostandtheterminalconstraints.34

    Classic result:35 Consider a MPC algorithm for a linear system withconstraints. Assumethatthereareterminalconstraints: x(k+N|k) = 0forpredictedstatex u(k+N|k) = 0forcomputedfuturecontroluTheniftheoptimizationproblemisfeasibleattimek,x= 0isstable.Proof: CanusetheperformanceindexJ asaLyapunovfunction.AssumethereexistsafeasiblesolutionattimekandcostJkCanusethatsolutiontodevelopafeasiblecandidateattimek+ 1,

    bysimply

    adding

    u(k

    +

    N

    + 1)

    =

    0and

    x(k

    +

    N

    + 1)

    =

    0.

    Keypoint: canestimatethecandidatecontrollerperformance

    Jk+1 = Jk{z(k|k)Rzz +u(k|k)Ruu} Jk{z(k|k)Rzz}

    Thiscandidate issuboptimal fortheMPCalgorithm,henceJ decreasesevenfasterJk+1 Jk+1

    WhichsaysthatJ decreases ifthestatecost isnon-zero(observabilityassumptions) butJ islowerboundedbyzero.

    Mayneetal. [2000] provides excellent review of other strategies forprovingstabilitydifferentterminalcostandconstraintsets

    33

    Tutorial: modelpredictivecontroltechnology,Rawlings,J.B.AmericanControlConference,1999. pp. 662-67634Mayne,D.Q.,J.B.Rawlings,C.V.RaoandP.O.M.Scokaert,ConstrainedModelPredictiveControl: StabilityandOptimality,

    Automatica,36,789-814(2000).35A.Bemporad,L.Chisci,E.Mosca: OnthestabilizingpropertyofSIORHC,Automatica,vol. 30,n. 12,pp. 2013-2015,1994.

    June18,2008

  • 8/12/2019 lec16_ Optimal Control

    12/13

    Example: HelicopterSpr2008 16.323 1610 ConsiderasystemsimilartotheQuansarhelicopter36

    Thereare2controlinputsvoltagetoeachfanVf,Vb Asimpledynamicsmodelisthat:

    e = K1(Vf +Vb)Tg/Jer = K2sin(p)p = K3(Vf Vb)

    andtherearephysicallimitsontheelevationandpitch:0.5e 0.6 1p 1

    ModelcanbelinearizedandthendiscretizedTs = 0.2sec.

    0 5 10 15 20 250

    2

    4

    6

    8

    10

    12

    N

    State

    Control

    Time

    Figure16.3:ResponseSummary36ISSN02805316ISRNLUTFD2/TFRT- -7613- -SEMPCtools1.0 ReferenceManualJohanAkessonDepartmentofAutomatic

    ControlLundInstituteofTechnologyJanuary2006

    June18,2008

    p

    e

    r

    Figure by MIT OpenCourseWare.

  • 8/12/2019 lec16_ Optimal Control

    13/13

    Spr2008

    0 10 20 300.1

    0

    0.1

    0.2

    0.3

    0.4

    Elevation[rad]

    0 10 20 30

    1

    0.5

    0

    0.5

    1

    t [s]

    Pitch[rad]

    0 10 20 301

    0

    1

    2

    3

    4

    Rotation[rad]

    0 10 20 302

    1

    0

    1

    2

    3

    4

    Vf,

    Vb[

    V]

    t [s]

    16.323 1611

    Figure16.4:ResponsewithN

    = 3

    0 10 20 300.1

    0

    0.1

    0.2

    0.3

    0.4

    Elevation[rad]

    0 10 20 30

    1

    0.5

    0

    0.5

    1

    t [s]

    Pitch[rad]

    0 10 20 301

    0

    1

    2

    3

    4

    Rotation[rad]

    0 10 20 302

    1

    0

    1

    2

    3

    4

    Vf,

    Vb[

    V]

    t [s]

    Figure16.5:ResponsewithN =10

    0 10 20 300.1

    0

    0.1

    0.2

    0.3

    0.4

    Elevation

    [rad]

    0 10 20 30

    1

    0.5

    0

    0.5

    1

    t [s]

    Pitch[rad]

    0 10 20 301

    0

    1

    2

    3

    4

    Rotation

    [rad]

    0 10 20 302

    1

    0

    1

    2

    3

    4

    Vf,

    Vb[

    V]

    t [s]

    Figure16.6:ResponsewithN =25June 18 2008