st 1 HYCON PhD School on Hybrid Systems www.unisi.it www.ist-hycon.org Model Predictive Control of Hybrid Systems Alberto Bemporad University of Siena, Italy bemporad@dii.unisi.it scimanyd suounitnoc enibmoc smetsys dirbyH lacipyt (snoitauqe ecnereffid ro laitnereffid) scimanyd etercsid dna stnalp lacisyhp fo fo lacipyt (snoitidnoc lacigol dna atamotua) fo senilpicsid gninibmoc yB .cigol lortnoc ,yroeht lortnoc dna smetsys dna ecneics retupmoc dilos a edivorp smetsys dirbyh no hcraeser ,sisylana eht rof sloot lanoitatupmoc dna yroeht fo ngised lortnoc dna ,noitacifirev ,noitalumis egral a ni desu era dna ,''smetsys deddebme`` ria ,smetsys evitomotua) snoitacilppa fo yteirav ssecorp ,smetsys lacigoloib ,tnemeganam ciffart .(srehto ynam dna ,seirtsudni HYSCOM IEEE CSS Technical Committee on Hybrid Systems Siena, July 19-22, 2005 - Rectorate of the University of Siena 9 Outline Model Predictive Control of Hybrid Systems • Model Predictive Control (MPC) concepts Alberto Bemporad • Hybrid models for MPC Dept. Information Engineering - University of Siena, Italy • MPC of hybrid systems http://www.dii.unisi.it/~bemporad http://www.dii.unisi.it/~bemporad • Explicit MPC (multiparametric programming) • Optimization-based reachability analysis • Examples University University of Siena (founded in 1240) EIHS – European Institute of Hybrid Systems 1st HYCON PhD School on Hybrid Systems (Siena, 20/7/05) 2 Model Predictive Control Optimizer Model Predictive Control Plant Reference Input r(t) u(t) Output y(t) Measurements • MPC concepts • MODEL: a model of the plant is needed to predict the future behavior of the plant • PREDICTIVE: optimization is based on the predicted future evolution of the plant • CONTROL: control complex constrained multivariable plants • Linear MPC • Matlab tools for linear MPC 3 Receding Horizon Philosophy • At time t : – minimize Receding Horizon - Example y(t+k) r(t) Solve an optimal control problem over a finite future horizon N : 4 Predicted outputs Manipulated Inputs t t+1 • MPC is like playing chess ! u(t+k) t+N – subject to constraints t+1 t+2 t+N+1 • Only apply the first optimal move • Get new measurements, and repeat the optimization at time t+1 Advantage of on-line optimization: FEEDBACK! 5 6 Constrained Optimal Control Constrained Optimal Control • Optimization problem: • Linear Model: By substituting , we get (quadratic) • Constraints: (linear) • Constrained optimal control problem (quadratic performance index): Convex QUADRATIC PROGRAM (QP) 7 8 Model Predictive Control Toolbox MPC of Linear Systems past future • MPC Toolbox 2.0 (Bemporad, Ricker, Morari, 1998-2004): Predicted outputs y(t+k|t) – – – – Manipulated Inputs u(t+k) t t+1 At time t: t+N Object-oriented implementation (MPC object) MPC Simulink Library MPC Graphical User Interface RTW extension (code generation) • Get/estimate the current state x(t) • Solve the QP problem and let U={u*(0),...,u*(N-1)} be the solution (=finite-horizon constrained open-loop optimal control) • Apply only optimal inputs and discard the remaining Only linear models are handled • Go to time t+1 9 Example: AFTI-16 http://www.mathworks.com 10 Example: AFTI-16 • Linearized model: see demo afti16.m (MPC-Tbx) 11 12 Convergence Convergence Proof Lyapunov function (Keerthi and Gilbert, 1988)(Bemporad et al., 1994) Proof: Use value function as Lyapunov function 13 Global optimum is not needed to prove convergence ! Convergence Proof 14 Convergence Proof 15 16 Outline MPC and LQR • Consider the MPC control law: 9 Model Predictive Control (MPC) concepts Jacopo Francesco Riccati (1676 - 1754) • Hybrid models for MPC • MPC of hybrid systems • Explicit MPC (multiparametric programming) • Optimization-based reachability analysis • In a polyhedral region around the origin the MPC control law is equivalent to the constrained LQR controller with (Chmielewski, Manousiouthakis, 1996) weights Q,R. • Examples (Scokaert and Rawlings, 1998) MPC ≡ constrained LQR • The larger the horizon, the larger the region where MPC=LQR 17 18 Hybrid Systems Hybrid Models for MPC B • Discrete Hybrid Automata (DHA) Control Theory Finite state machines Continuous dynamical systems Hybrid systems A • Mixed Logical Dynamical (MLD) Systems Computer Science B C • Piecewise Affine (PWA) Systems u(t) B system y(t) C C A 19 “Intrinsically Hybrid” Systems 20 Cruise Control Problem continuous inputs GOAL: command gear ratio, gas pedal, and brakes to track a desired speed and minimize consumptions discrete input Discrete input (1,N,2,3,4) + Continuous inputs (brakes, gas, clutch) Continuous + dynamical states CHALLENGES: (velocities, torques, • continuous and discrete inputs • dynamics depends on gear • nonlinear torque/speed maps air-flows, fuel level) 21 Key Requirements for Hybrid Models • Descriptive enough to capture the behavior of the system 22 Piecewise Affine Systems state+input space – continuous dynamics (physical laws) – logic components (switches, automata, software code) – interconnection between logic and dynamics • Simple enough for solving analysis and synthesis problems (Sontag 1981) ? linear systems nonlinear systems linear hybrid systems “Make everything as simple as possible, but not simpler.” — Albert Einstein • Can approximate nonlinear/discontinuous dynamics arbitrarily well 24 Switched Affine System Discrete Hybrid Automaton (Torrisi, Bemporad, 2004) Event Generator Switched Affine System 1 Finite State Machine 2 time or event counter Mode Selector s The affine dynamics depend on the current mode i(k): mode 25 26 Mode Selector Event Generator Event variables are generated by linear threshold conditions over continuous states, continuous inputs, and time: The active mode i(k) is selected by a Boolean function of the current binary states, binary inputs, and event variables: Example: 0 0 Example: [δ=1] ↔ [xc(k)≥0] 1 27 Finite State Machine 1 the system has 3 modes 28 Logic and Inequalities Glover 1975, Williams 1977 The binary state of the finite state machine evolves according to a Boolean state update function: Switched Affine System Finite State Machine Mode Selector 1 Event Generator 2 Example: s 29 30 Logic → Inequalities: Symbolic Approach Switched Affine Systems Switched Affine System 1 The state-update equation can be rewritten as a combination of affine terms and if-then-else conditions: 0. Given a Boolean statement 2 1. Convert to Conjunctive Normal Form (CNF): s 2. Transform into inequalities: polyhedron where . If-then-else conditions are converted to inequalities. Output equations yc(t)=Cixc(t)+Diuc(t)+gi admit a similar transformation. Any logic proposition can be translated into linear integer ineq. 31 Logic → Inequalities: Symbolic Approach 32 Logic → Inequalities: Geometric Approach Example: logic “AND” F (X1, X2, X3) = [X3 ↔ X1 ∧ X2] Example: F (X1, X2, X3) = [X3 ↔ X1 ∧ X2] 1. Convert to Conjunctive Normal Form (CNF): (see e.g.: http://www.oursland.net/aima/propositionApplet.html T: or just search [CNF + applet] on Google ...) (X3 ∨ ¬X1 ∨ ¬X2) ∧ (X1 ∨ ¬X3) ∧ (X2 ∨ ¬X3) X1 0 0 1 1 X2 0 1 0 1 X3 0 0 0 1 Key idea: White points cannot be in the hull of black points δ3 (1,1,1) δ2 (0,1,0) δ1 (0,0,0) (1,0,0) 2. Transform into inequalities: ⎧ ⎪ ⎨ δ3 + (1 − δ 1) + (1 − δ 2) ≥ 1 δ1 + (1 − δ3) ≥ 1 ⎪ ⎩ δ2 + (1 − δ3) ≥ 1 Convex hull algorithms: cdd, lrs, qhull, chD, Hull, Porto 33 34 Mixed Logical Dynamical Systems A Simple Example Discrete Hybrid Automaton • System: • Associate and transform HYSDEL (Torrisi, Bemporad, 2004) Mixed Logical Dynamical (MLD) Systems (Bemporad, Morari 1999) • Then Continuous and binary variables • Rewrite as a linear equation • Computationally oriented (mixed-integer programming) • Suitable for controller synthesis, verification, ... 35 36 Hybrid Toolbox for Matlab HYSDEL (Bemporad, 2003-2004) Features: • Hybrid model (MLD and PWA) design and simulation (HYbrid Systems DEscription Language) • Describe hybrid systems: • Control design for linear systems w/ constraints and hybrid systems (on-line optimization via QP/MILP/MIQP) – – – – – • Explicit control (via multiparametric programming) • C-code generation • Simulink Automata Logic Lin. Dynamics Interfaces Constraints (Torrisi, Bemporad, 2004) • Automatically generate MLD models in Matlab Download: http://www.dii.unisi.it/hybrid/toolbox http://www.dii.unisi.it/hybrid/toolbox Reference: http://control.ethz.ch/~hybrid/hysdel 37 Example: Bouncing Ball 38 Bouncing Ball – Time Discretization x x -mg N F= m g x How to model this system in MLD form? 39 Systems Theory for DiscreteDiscrete-Time Linear Hybrid Systems HYSDEL - Bouncing Ball SYSTEM bouncing_ball { INTERFACE { /* Description of variables and constants */ STATE { REAL height [-10,10]; REAL velocity [-100,100]; PARAMETER { REAL g; REAL dissipation; REAL Ts; } } IMPLEMENTATION { AUX { REAL z1; REAL z2; BOOL negative; – – – – – – } negative = height <= 0; } DA { z1 = { z2 = { • Analysis } /* 0=elastic, 1=completely anelastic */ AD { 40 IF negative THEN height-Ts*velocity ELSE height+Ts*velocity-Ts*Ts*g}; IF negative THEN -(1-dissipation)*velocity ELSE velocity-Ts*g}; } Well-posedness Realization & Transformation Reachability (=Verification) Observability Stability Identification • Synthesis – Control – State estimation CONTINUOUS { height = z1; velocity=z2;} }} go to demo /demos/hybrid/bball.m 41 42 Well-posedness Equivalences of Hybrid Models Are state and output trajectories defined ? Uniquely defined ? Persistently defined ? • MLD well-posedness : î(t) = F(x(t), u(t)) x1(k), y1(k) Σ1 {x(t), u(t)} → {x(t + 1)} {x(t), u(t)} → {y(t)} z(t) = G(x(t), u(t)) are single valued u(k) x1(0)=x2(0) x2(k), y2(k) Σ2 Numerical test based on mixed-integer programming available (Bemporad, Morari, Automatica, 1999) 43 44 MLD and PWA Systems Example: Room Temperature Theorem MLD systems and PWA systems are equivalent AC system (Bemporad, Ferrari-Trecate, Morari, IEEE TAC,2000) • Proof is constructive: given an MLD system it returns its equivalent PWA form • Drawback: it needs the enumeration of all possible combinations of binary states, binary inputs, and δ variables ucold uhot Heater • Most of such combinations lead to empty regions • Efficient algorithms are available for converting MLD models into PWA models avoiding such an enumeration: Hybrid Dynamics • #1 turns the heater (air conditioning) on whenever he is cold (hot) • If #2 is cold he turns the heater on, unless #1 is hot Tamb T2 T1 • If #2 is hot he turns the air conditioning on, unless #2 is cold T2 T1 • Otherwise, heater and air conditioning are off • A. Bemporad, “Efficient Algorithms for Converting Mixed Logical Dynamical Systems into an Equivalent Piecewise Affine Form”, IEEE Trans. Autom. Contr., 2004. • Ṫ 1 = −α1 (T1 − T amb) + k 1 (uhot − ucold) (body temperature dynamics of #1) • T. Geyer, F.D. Torrisi and M. Morari, “Efficient Mode Enume- • Ṫ 2 = −α2 (T2 − T amb) + k 2 (uhot − ucold) (body temperature dynamics of #2) ration of Compositional Hybrid Models”, HSCC’03 45 HYSDEL Model go to demo /demos/hybrid/heatcool.m 46 Hybrid MLD Model • MLD model Hybrid Toolbox for Matlab (Bemporad, 2003-2005) (temperatures T1,T2) • 2 continuous states: http://www.dii.unisi.it/hybrid/toolbox • 1 continuous input: (room temperature Tamb) • 2 auxiliary continuous vars: • 6 auxiliary binary vars: (power flows uhot, ucold) (4 thresholds + 2 for OR condition) • 20 mixed-integer inequalities >>S=mld('heatcoolmodel',Ts) get the MLD model in Matlab >>[XX,TT]=sim(S,x0,U); simulate the MLD model Possible combination of integer variables: 26 = 64 47 48 Hybrid PWA Model Simulation in Simulink • PWA model 50 • 2 continuous states: (temperatures T1,T2) Temperature T 2 (deg C) 40 • 1 continuous input: (room temperature Tamb) • 5 polyhedral regions (partition does not depend on input) 30 20 10 0 -10 -10 >>P=pwa(S); 0 10 20 30 Temperature1T(deg C) uhot = 0 ucold = 0 40 50 uhot = 0 uhot = Ū H ucold = ŪC ucold = 0 49 50 Equivalence Results Other Existing Hybrid Models • Linear complementarity (LC) systems x(t + 1) = Ax(t) + B1 u(t) + B2 w(t) y(t) = Cx(t) + D1 u(t) + D2 w(t) v(t) = E1 x(t) + E2 u(t) + E3 w(t) + e4 0 ô v(t)⊥w(t) õ 0 ? (Heemels, 1999) ? Ex: mechanical systems circuits with diodes etc. MMPS PWA ? LC ? ? ? DHA MLD • Extended linear complementarity (ELC) systems ? ELC ? (De Schutter, De Moor, 2000) Generalization of LC systems • Min-max-plus-scaling (MMPS) systems (De Schutter, Van den Boom, 2000) x(t + 1) = Mx(x(t), u(t), d(t)) y(t) = My (x(t), u(t), d(t)) 0 õ Mc(x(t), u(t), d(t)) ? Theorem All the above six classes of discrete-time hybrid models are equivalent (possibly under some additional assumptions, such as boundedness of input and state variables) (Heemels, De Schutter, Bemporad, Automatica, 2001) MMPS function: defined by the grammar (Torrisi, Bemporad, IEEE CST, 2003) (Bemporad and Morari, Automatica, 1999) (Bemporad, Ferrari-T.,Morari, IEEETAC, 2000) M := x i|ë| max(M1 , M2 )| min(M1 , M2 )|M1 + M2 |ìM1 Example: x(t + 1) = 2 max(x(t), 0) + min(à 12u(t), 1) Theoretical properties and analysis/synthesis tools can be transferred from one class to another Used for modeling discrete-event systems (t=event counter) 51 MLD and LC Systems 52 Hybrid System Identification (Heemels, De Schutter, Bemporad, Automatica, 2001) • Sometimes a hybrid model of the process (or of a part of it) cannot be derived manually from available knowledge. • Therefore, a model must be either – Estimated from data (model unknown) – or hybridized before it can be used for control/analysis (model known but nonlinear) Proof: x(t + 1) = Ax(t) + B1 u(t) + B2 î(t) + B3 z(t) y(t) = Cx(t) + D1 u(t) + D2 î(t) + D3 z(t) E 2 î(t) + E 3 z(t) ô E 4 x(t) + E 1 u(t) + E 5 x(t + 1) = Ax(t) + B1 u(t) + B2 w(t) y(t) = Cx(t) + D1 u(t) + D2 w(t) v(t) = E1 x(t) + E2 u(t) + E3 w(t) + e4 0 ô v(t)⊥w(t) õ 0 • If a linear model is enough, no problem: several algorithms are available (e.g.: use Ljung’s ID TBX) • If switching modes are known and data can be generated for each mode, no problem: we identify one linear model per mode (e.g.: use Ljung’s ID TBX) • If modes & dynamics must be identified together, we need For each complementarity pair vi(t), w i(t) introduce a binary variable îi(t) ∈ {0, 1} [îi(t) = 1] → [vi(t) = 0, w i(t) õ 0] [îi(t) = 0] → [vi(t) õ 0, w i(t) = 0] w i(t) vi(t) w i(t) vi(t) ô ô õ õ Mîi(t) M(1 à îi(t)) 0 0 hybrid system identification Set zi(t) = w i(t) and substitute v(t) = E 1 x(t) + E 2 u(t) + E 3 w(t) + e4 53 54 Outline PWA Identification Problem Estimate from data both the parameters of the affine submodels and the partition of the PWA map 9 Model Predictive Control (MPC) concepts 9 Hybrid models for MPC Example Let the data be generated by the PWARX system • MPC of hybrid systems • Explicit MPC (multiparametric programming) • Optimization-based reachability analysis • Examples 55 56 Hybrid Control Problem hybrid process continuous states continuous inputs MPC of Hybrid Systems binary states binary inputs • Problem setup on-line decision maker • Convergence properties • Computational aspects desired behavior • Matlab tools for hybrid MPC constraints 57 Model Predictive Control of Hybrid Systems 58 MPC for Hybrid Systems past future Predicted outputs y(t+k|t) MLD model Manipulated Inputs u(t+k) t t+1 Controller Reference r(t) t+T • At time t solve with respect to Hybrid System Input u(t) Model Predictive (MPC) Control the finite-horizon open-loop, optimal control problem: Output y(t) Measurements • • • MODEL: use an MLD or PWA model of the plant to predict the future behavior of the hybrid system PREDICTIVE: optimization is still based on the predicted future evolution of the hybrid system CONTROL: the goal is to control the hybrid system • Apply only u(t) =uã(t) (discard the remaining optimal inputs) • Repeat the whole optimization at time t+1 59 60 Closed-Loop Convergence Convergence Proof Lyapunov function (Bemporad, Morari 1999) Proof: Easily follows from standard Lyapunov arguments More stability results: see (Lazar, Heemels, Weiland, Bemporad, 2005) 61 Hybrid MPC - Example 62 Hybrid MPC - Example PWA system: Constraint: Note: Global optimum not needed for convergence ! Closed loop: Open loop behavior go to demo /demos/hybrid/bm99sim.m 63 Hybrid MPC – Temperature Control 64 Hybrid MPC – Temperature Control >>refs.x=2; % just weight state #2 >>Q.x=1; >>Q.rho=Inf; % hard constraints >>Q.norm=2; % quadratic costs >>N=2; % optimization horizon >>limits.xmin=[25;-Inf]; >>C=hybcon(S,Q,N,limits,refs); >> C Hybrid controller based on MLD model S <heatcoolmodel.hys> 2 0 0 1 0 state measurement(s) output reference(s) input reference(s) state reference(s) reference(s) on auxiliary continuous z-variables 20 optimization variable(s) (8 continuous, 12 binary) 46 mixed-integer linear inequalities sampling time = 0.5, MILP solver = 'glpk' Type "struct(C)" for more details. >> >>[XX,UU,DD,ZZ,TT]=sim(C,S,r,x0,Tstop); 65 66 MIQP Formulation of MPC (Bemporad, Morari, 1999) Optimal Control of Hybrid Systems: Computational Aspects Mixed Integer Quadratic Program (MIQP) 67 68 (Bemporad, Borrelli, Morari, 2000) • Mixed-Integer Programming is NP-hard Phase transitions have been found in computationally hard problems. • Introduce slack variables: ïxk ïuk • Set õ kQy(t + k|t)k∞ õ kRu(t + k)k∞ ø,[ïx1 , . . ., ïxN , ïu1 , y min |x| ïxk ïxk ïuk ïuk BUT min ï s.t. ï õ x ïõ àx [Qy(t + k|t)]i õ õ à [Qy(t + k|t)]i õ [Ru(t + k))]i õ à [Ru(t + k))]i i = 1, . . ., p, i = 1, . . ., p, i = 1, . . ., m, i = 1, . . ., m, Cost of Computation Mixed-Integer Program Solvers MILP Formulation of MPC 4000 50 var 40 var 20 var 3000 2000 1000 0 2 3 4 5 6 7 8 Ratio of Constraints to Variables (Monasson et al., Nature, 1999) k = 1, . . ., T à 1 k = 1, . . ., T à 1 k = 0, . . ., T à 1 k = 0, . . ., T à 1 • General purpose Branch & Bound/Branch & Cut solvers available for MILP and MIQP (CPLEX, Xpress-MP, BARON, GLPK, ...) More solvers and benchmarks: http://plato.la.asu.edu/bench.html . . ., ïTà1 , U, î, z] min J(ø, x (t)) = Mixed Integer Linear Program (MILP) ø Tà1 X ïxi + ïui • No need to reach global optimum (see proof of the theorem), although performance deteriorates k=0 s.t.Gø ô W + Sx (t) 69 70 Mixed-Integer Programming Solvers Mixed-Integer Programming Solvers Main drawbacks: Main drawbacks: • Loss of the original discrete structure (Boolean formulas) • Loss of the original discrete structure (Boolean formulas) • On-line combinatorial optimization • On-line combinatorial optimization Good for large sampling times (e.g., 1 h) / expensive hardware … Good for large sampling times (e.g., 1 h) / expensive hardware … … but not for fast sampling (e.g. 10 ms) / cheap hardware ! … but not for fast sampling (e.g. 10 ms) / cheap hardware ! 71 72 Exploiting Logic Structures “Hybrid” Solvers Main drawbacks when using Mixed-Integer Programming for Combine MIP and Constraint Satisfaction (CSP) techniques to exploit the discrete structure of the problem implementing hybrid MPC control laws: 1. Why CSP ? Loss of the original Boolean structure y More flexible modeling than MIP (e.g.: constraint logic programming (CLP) and Satisfiability of Boolean formulas (SAT)) y Structure is kept and exploited to direct the search. FALSE TRUE 1 0 x`(k + 1) = x` (k) ∧ u` (k) Why MIP ? y Specialized techniques for highly structured problems (e.g. LP problems); Better for handling continuous vars y A wide range of tight relaxations are available Efficiency of MIP solver usually not good when continuous LP/QP relaxations are not tight Why a combined approach ? Performance increase already shown in other application domains (Harjunkoski, Jain, Grossmann, 2000)74 73 SAT-Based Branch&Bound Computations: MILP vs. LBLB-B&B The basic modeling framework has the following form: (Bockmayr, Kasper,1998) Convex cost function Continuous constraints Mixed constraints Purely logic constraints Computation time and # LP solved for finding an optimal control sequence optimization variables SAT-based B&B Pure B&B SAT-based B&B “ingredients” (Bemporad, Giorgetti, 2003) A relaxed convex problem A SAT feasibility problem (pure logic constraints dropped) (for logic constraints only) Convex solver (e.g.: LP/QP) #nodes=11 SAT solver 75 #nodes=6227 Pentium IV 1.8GHz SAT solver: zCHAFF 2003.07.22 76 Mixed-Integer Programming Solvers SAT vs. MILP Uniform Random 3CNF benchmarks (from http://www.satlib.org) All 3SAT instances are in the phase transition region. Main drawbacks: • Loss of the original discrete structure (Boolean formulas) • On-line combinatorial optimization Good for large sampling times (e.g., 1 h) / expensive hardware … All clauses are passed to CPLEX new MILP solver as logic constraints (we exploit the new feature of release 9.0). PC: P4 2.8GHz + 1GB RAM Solvers: CPLEX 9.0 zCHAFF 2003.12.04 77 … but not for fast sampling (e.g. 10 ms) / cheap hardware ! 78 Outline 9 Model Predictive Control (MPC) concepts 9 Hybrid models for MPC Explicit Model Predictive Control 9 MPC of hybrid systems • Explicit MPC (multiparametric programming) • Multiparametric quadratic programming • Optimization-based reachability analysis • Explicit linear MPC • Examples • Explicit hybrid MPC • Matlab tools for explicit MPC 79 80 OnOn-Line vs. OffOff-Line Optimization MPC: Pros and Cons • PRO: systematic design approach – – – – Multivariable systems State and Input Constraints Stability guarantees Reference preview • On-line optimization: given x(t) solve the problem at each time step t (the control law u=u(x) is implicitly defined by the QP solver) Quadratic Program (QP) • CON: computation complexity ! – Large sampling time/fast hardware – Software reliability • Off-line optimization: solve the QP for all x(t) to find the control law u=u(x) explicitly multi-parametric Quadratic Program (mp-QP) 81 82 Linearity of the Solution Multiparametric Quadratic Programming (Bemporad et al., 2002) x0∈ X solve QP to find identify active constraints at form matrices by collecting active constraints: KKT optimality conditions: From (1) : • Objective: solve the QP for all From (2) : • Assumptions: (always satisfied if QP problem originates from optimal control problem) (can be easily satisfied, e.g. by choosing positive input weights) 83 In some neighborhood of x0, λ and U are explicit affine functions of x ! 84 Neighboring Regions Determining a Critical Region (Tøndel, Johansen, Bemporad, 2003) • Impose primal and dual feasibility: x2 x2 x2 linear inequalities in x ! CR CR CR • Remove redundant constraints: (this requires solving LP’s) x1 critical region CR0 • x0 CR0 x-space x1 x1 The active set of a neighboring region is found by using the active set of the current region + knowledge of the type of hyperplane we are crossing: X ⇒ The corresponding constraint is added to the active set • CR0 is the set of all and only parameters x for which is the optimal combination of active constraints at the optimizer ⇒ The corresponding constraint is withdrawn from the active set 85 86 Mp-QP Properties Complexity Reduction 2.5 2.5 CR1 CR2 CR3 CR4 CR5 CR6 CR7 CR8 CR9 2 1.5 1 1 0.5 0.5 0 0 -0.5 continuous, piecewise affine -0.5 -1 -1 -1.5 -1.5 -2 -2.5 -2.5 CR1 CR2 CR3 CR4 CR5 CR6 CR7 2 1.5 -2 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 -2.5 -2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 convex, continuous, piecewise quadratic, C1 (if no degeneracy) Corollary: The linear MPC controller is a continuous piecewise affine function of the state Regions where the first component of the solution is the same can be joined (when their union is convex). (Bemporad, Fukuda, Torrisi, Computational Geometry, 2001) 87 Double Integrator Example 88 mp-QP solution • System: sampling + ZOH Ts=1 s Nu=2 • Constraints: • Control objective: minimize • Optimization problem: for Nu=2 (cost function is normalized by max svd(H)) go to demo /demos/linear/doubleintexp.m 89 (Hyb-Tbx) 90 Complexity Example: AFTI-16 • Linearized model: Nu=5 Nu=4 Nu=3 Section with x=[0 0 0 0]’, u=[0 0]’ 10 8 CPU time 40 Nu=6 4 2 0 # Regions 6 20 0 5 10 15 r2 20 0 300 -2 200 -4 100 0 -6 0 5 10 # free moves 15 20 Explicit controller: 8 parameters, 51 regions -8 -10 -10 -8 -6 -4 -2 0 2 4 6 8 10 r1 go to demo linear/afti16.m (Hyb-Tbx) (is the number of regions finite for Nu→∞ ?) 91 92 Explicit Hybrid MPC (MLD) Multiparametric MILP min ø={ø c ,ø d} øc ∈ Rn f 0øc + d0ød ø d ∈ {0, 1} m s.t. Gøc + Eød ô W + Fx • mp-MILP can be solved (by alternating MILPs and mp-LPs) (Dua, Pistikopoulos, 1999) • On-line optimization: solve the problem for each given x(t) • Theorem: The multiparametric solution ã ø (x) is piecewise affine Mixed-Integer Linear Program (MILP) • The MPC controller is piecewise affine in x,r • Off-line optimization: solve the MILP for all x(t) in advance (x,r)-space 4 2 M 1 5 63 multi-parametric Mixed Integer Linear Program (mp-MILP) 93 Explicit Hybrid MPC (PWA) 94 Explicit Hybrid MPC (PWA) Method A: (Borrelli, Baotic, Bemporad, Morari, Automatica, 2005) Use a combination of DP (dynamic programming) and mpLP (1-norm, ∞-norm), or mpQP (quadratic forms) Method B: (Bemporad, Hybrid Toolbox, 2003) (Alessio, Bemporad, 2005) (Mayne, ECC 2001) 1 - Use backwards (=DP) reachability analysis for enumerating all feasible mode sequences I={i(0),i(1),…,i(T-1)}; • Solution u(x,r) found via a combination of - Dynamic programming or enumeration of feasible mode sequences, multiparametric linear or quadratic programming, (Borrelli, Baotic, Bemporad, Morari, 2003) and polyhedral computation. (Mayne, ECC 2001) • The MPC controller is piecewise affine in x,r 3 - Case 1/∞-norm: Compare value functions and split regions. Quadratic case: keep overlapping regions (possibly eliminate overlaps that are never optimal) and compare on-line (if needed). (x,r)-space 4 2 2 - For each fixed sequence I, solve the explicit finite-time optimal control problem for the corresponding linear time-varying system (mpQP or mpLP); M 1 5 Note: in the 2-norm case the partition may not be fully polyhedral 63 Note: in the 2-norm case, the fully explicit partition may not be polyhedral 95 96 Hybrid Control - Example PWA system: Hybrid Control Example (Revisited) Closed loop: Constraints: Objective: Open loop behavior: HybTbx: /demos/hybrid/bm99sim.m 97 98 Explicit PWA Controller Hybrid MPC - Example Closed loop: Section with r=0 10 1 2 3 4 5 8 6 4 x2 2 0 -2 -4 -6 -8 -10-10 -8 -6 -4 -2 0 x12 4 6 8 10 ñ MPC law PWA law HybTbx: /demos/hybrid/bm99sim.m (CPU time: 1.51 s, Pentium M 1.4GHz) 99 100 Explicit MPC – Temperature Control Explicit PWA Regulator >>E=expcon(C,range,options); Objective: >> E Prediction Horizon N=1 Prediction Horizon N=2 10 CR1 CR2 CR3 CR4 CR5 CR6 CR7 CR8 8 6 4 x2 2 10 10 8 8 6 6 4 4 2 0 -2 -4 -4 -4 -6 -6 -8 -8 -8 -10 -10 -10 -10 -6 -4 -2 0 2 x1 4 6 8 10 Type "struct(E)" for more details. >> x2 0 -2 -8 The controller is for hybrid systems (tracking) This is a state-feedback controller. 2 x2 0 -2 -10 -10 Explicit controller (based on hybrid controller C) 3 parameter(s) 1 input(s) 12 partition(s) sampling time = 0.5 Prediction Horizon N=3 -6 -8 -6 -4 -2 0 x1 2 4 6 8 10 -8 -6 -4 -2 0 x1 2 4 6 8 10 Section in the (T1,T2)-space for Tref = 30 HybTbx: /demos/hybrid/bm99benchmark.m 101 102 Explicit MPC – Temperature Control Comments on Explicit Solutions • Alternatives: either (1) solve an MIP on-line or (2) evaluate a PWA function • For problems with many variables and/or long horizons: MIP may be preferable • For simple problems (short horizon/few constraints): - time to evaluate the control law is shorter than MIP Generated C-code - control code is simpler (no complex solver must be included in the control software !) utils/expcon.h - more insight in controller’s behavior 103 104 Hybrid Toolbox for Matlab Hybrid Control Design Flow (Bemporad, 2003-2004) Features: physical system hybrid model control objectives & constraints simulation and validation optimal control setup (on-line MIP) • Hybrid model (MLD and PWA) design and simulation • Control design for linear systems w/ constraints and hybrid systems (on-line optimization via QP/MILP/MIQP) • Explicit control (via multiparametric programming) simulation and validation • C-code generation multiparametric solver • Simulink PWA control law too complex ? yes implementation (C code) and experiments no 105 http://www.dii.unisi.it/hybrid/toolbox 106 State Estimation / Fault Detection • Problem: given past output measurements and inputs, estimate the current state/faults • Solution: Use Moving Horizon Estimation for MLD systems (dual of MPC) Augment the MLD model with: n • Input disturbances ø ∈ R • Output disturbances ð ∈ R p State Estimation / Fault Detection At each time t solve min the optimization: T P k yê(t à k|t) à y(t à k)k 2 + . . . MHE optimization = MIQP Convergence can be guaranteed Fault detection: 107 and get estimates x ê (t) k=1 (Bemporad, Mignone, Morari, ACC 1999) (Ferrari-T., Mignone, Morari, 2002) augment MLD with unknown binary distubances þ ∈ {0, 1}p 108 Example: Three Tank System Example: Three Tank System COSY Benchmark problem, ESF COSY Benchmark problem, ESF • þ1 : leak in tank 1 for 20s ô t ô 60s • þ1 : leak in tank 1 for 20s ô t ô 60s • þ2 : valve V1 blocked for t õ 40s • þ2 : valve V1 blocked for t õ 40s • Add logic constraint [h 1 ô h v ] ⇒ þ2 = 0 109 110 Outline 9 Model Predictive Control (MPC) concepts 9 Hybrid models for MPC Optimization-based Reachability Analysis 9 MPC of hybrid systems 9 Explicit MPC (multiparametric programming) (Verification of Safety Properties via Mixed-integer Programming) • Optimization-based reachability analysis • Examples 111 Hybrid Verification Problem Verification Algorithm hybrid process continuous disturbances binary disturbances 112 • QUERY: Is the target set Xf reachable after N steps from some initial state x0 ∈ X0 for some input profile u ∈ U ? continuous states • Computation: Solve the mixed-integer linear program (MILP) binary states verification algorithm counterexample answer always safe ! safety query with respect to u(0),δ(0),z(0),…, u(N-1),δ(N-1),z(N-1),x(0) set of possible initial states • Alternative solutions: • Exploit the special structure of the problem and use polyhedral set of possible disturbances computation. 113 • Use abstractions (LPs) + SAT solvers (Torrisi, 2003) (Giorgetti, Pappas, 2005) 114 Verification Example Verification Example • MLD model: room temperature system • (set of unsafe states) • (set of initial states) • (set of possible inputs) • N=10 (time horizon) >>[flag,x0,U]=reach(S,N,Xf,X0,umin,umax); 115 116 Verification Example Verification Example • MLD model: semiactive suspension system (set of unsafe states) • • (set of initial states) (set of possible inputs) • • N=10 (time horizon) >>[flag,x0,U]=reach(S,N,Xf,X0,umin,umax); 117 118 Integral Switched Affine System (Bemporad, Di Cairano, Julvez, 2005) Event Generator Integral dynamics: Integral Switched Affine System Finite State Machine 1 time 2 s Mode Selector Event-Driven / Continuous-Time Hybrid Automata mode k = event index tk = event instant Change of variables: 119 Same as discrete-time dynamics ! 120 Event Generator Event Generator Asynchronous Finite State Machine Event Generator Events occur at time t if: Integral Switched Affine System (1) or (2) or 1 Finite State Machine time 2 Integral Switched Affine System Finite State Machine 1 time 2 s s (3) mode Mode Selector mode Mode Selector Asynchronous FSM dynamics: x c (t) hj1 x c1 + hj2 x c2 > w j hj hj1 x c1 + hj2 x c2 < w j x c (tk ) 1x c1 + hj 2x c2 = Example: Discrete state transitions, events, and mode switches might occur at any (continuous) time t ! w j for some threshold index j 121 122 Hybrid Automaton with Integral Continuous() Continuous(-time) Dynamics (icHA (icHA) Outline 9 Model Predictive Control (MPC) concepts Event Generator Wrapping up: Integral Switched Affine System event-driven (asynchronous) FSM Finite State Machine + 9 Hybrid models for MPC 1 tim e 2 s integral dynamics = Mode Selector 9 MPC of hybrid systems mod e 9 Explicit MPC (multiparametric programming) same as discrete hybrid automaton 9 Optimization-based reachability analysis • Examples states inputs All numerical control/verification techniques developed for DHA can be immediately applied to icHA ! 123 124 Hybrid Control Problem Hybrid Control Example: Cruise Control System GOAL: command gear ratio, gas pedal, and brakes to track a desired speed and minimize consumption 125 126 Hybrid Model Hybrid Model + à Cà e (ω) ô M ô Ce (ω) • Engine torque • Vehicle dynamics mẍ = F e à F b à ìxç C+ e (ω) • Max engine torque xç = vehicle speed Fe = traction force Fb = brake force 180 160 discretized with sampling time T s = 0.5 s 140 • Transmission kinematics ω= Rg(i) xç ks Fe = Rg(i) M ks ω = engine speed M= engine torque i = Piecewise-linearization: 120 (PWL Toolbox, Julián, 1999) 100 requires: 4 binary aux variables 4 continuous aux variables 60 1000 2000 3000 4000 Cà e (ω) = ë1 + ì 1 ω • Min engine torque gear 80 127 128 Hybrid Model • Gear selection: Hysdel Model for each gear #i, gi ∈ {0, 1} define a binary input • Gear selection (traction force): Fe = Rg(i) M ks depends on gear #i define auxiliary continuous variables: IF gi = 1 THEN F ei = Rg(i) M ks ELSE 0 F e = F eR + F e1 + F e2 + F e3 + F e4 + F e5 • Gear selection (engine/vehicle speed): ω= Rg(i) xç ks similarly, also requires 6 auxiliary continuous variables 129 Hybrid Model • Max-speed controller x(t + 1) = Ax(t) + B1 u(t) + B2 î(t) + B3 z(t) y(t) = Cx(t) + D1 u(t) + D2 î(t) + D3 z(t) E 2 î(t) + E 3 z(t) ô E 4 x(t) + E 1 u(t) + E 5 x, v • 2 continuous inputs: M, F b • 6 binary inputs: gR, g1 , g2 , g3 , g4 , g5 • 1 continuous output: v • 16 auxiliary continuous vars: • 4 auxiliary binary vars: 130 Hybrid Controller • MLD model • 2 continuous states: go to demo /demos/cruise/init.m max J(u t, x(t)),v(t + 1|t) ut ú MLD model subj. to x(t|t) = x(t) Objective: maximize speed (to reproduce max acceleration plots) 250 200 (vehicle position and speed) (engine torque, brake force) MILP optimization problem (gears) Linear constraints Continuous variables Binary variables Parameters Time to solve mpMILP (Sun Ultra 10) Number of regions (vehicle speed) (6 traction force, 6 engine speed, 4 PWL max engine torque) (PWL max engine torque breakpoints) v(t) 96 18 10 1 45 s 11 150 100 50 0 x(t) (x(t) is irrelevant) • 96 mixed-integer inequalities 131 (Parameters: Renault Clio 1.9 DTI RXE) 132 Hybrid Controller Hybrid Controller • Max-speed controller Velocity (km/h) • Tracking controller Gear 200 Fraction of Max Torque (Nm) Brakes (Nm) 5 min J(u t, x(t)),|v(t + 1|t) à vd (t)| + ú|ω| ut ú MLD model subj. to x(t|t) = x(t) 1 1 150 4 100 3 50 2 0 1 0.5 0.5 0 50 100 0 0 -0.5 -0.5 -1 0 Road Slope (deg) 50 100 Engine speed (rpm) 1 200 -1 0 50 100 0 Engine Torque (Nm) 6000 50 MILP optimization problem 100 Linear constraints Continuous variables Binary variables Parameters Time to solve mp-MILP (PC 850Mhz) Number of regions Power (kW) 200 60 5000 50 0.5 150 4000 0 40 3000 100 30 2000 20 -0.5 250 98 19 10 2 vd(t) 150 100 50 00 43 s 49 40 80 120 160 200 v(t) 50 1000 -1 10 0 0 50 Time (s) 100 0 0 50 Time (s) 100 0 0 50 Time (s) 100 0 50 Time (s) 100 go to demo /demos/cruise/init_exp.m 133 Hybrid Controller • Tracking controller Velocity (km/h), Desired velocity (km/h) 120 Hybrid Controller min J(u t, x(t)),|v(t + 1|t) à vd(t)| + ú|ω| • Smoother tracking controller ut Gear Brakes (Nm) Fraction of Max Torque (Nm) 5 10000 min J(u t, x(t)),|v(t + 1|t) à vd(t)| + ú|ω| ut ⎧ ⎨ |v(t + 1|t) à v(t)| < Tsamax subj. to MLD model ⎩ x(t|t) = x(t) 1 100 8000 4 0.5 80 6000 60 3 134 0 4000 40 2 250 -0.5 2000 20 0 1 0 100 200 -1 0 100 200 0 200 0 100 200 0 100 MILP optimization problem 200 ú = 0.001 Engine Torque (Nm) Engine speed (rpm) Road Slope (deg) 6 6000 4 5000 2 4000 0 3000 -2 2000 -4 1000 100 100 50 0 0 -100 -6 0 200 -50 -200 0 100 19 10 2 47 s 54 150 vd(t) 100 50 00 40 80 120 160 200 v(t) 0 100 100 -100 0 200 Time (s) Time (s) Linear constraints Continuous variables Binary variables Parameters Time to solve mp-MILP (PC 850Mhz) Number of regions Power (kW) 200 100 200 0 100 200 Time (s) Time (s) 135 136 Hybrid Controller • Smoother tracking controller Velocity (km/h), Desired velocity (km/h) 120 Gear Brakes (Nm) Fraction of Max Torque (Nm) 5 10000 1 100 8000 4 0.5 80 6000 60 3 0 4000 40 2 -0.5 0 1 0 100 200 -1 0 100 0 200 0 6000 4 5000 2 4000 0 3000 -2 2000 100 200 -6 0 100 200 Power (kW) 200 100 100 50 0 (joint work with F. Borrelli, Borrelli, M. Fodor, D. Hrovat) Hrovat) 0 -100 -4 0 Engine Torque (Nm) Engine speed (rpm) Road Slope (deg) 6 Traction Control System 2000 20 -50 1000 -200 0 100 Time (s) 200 0 100 Time (s) 200 -100 0 100 Time (s) 200 0 100 200 Time (s) 137 138 Tire Force Characteristics Vehicle Traction Control Improve driver’s ability to control a vehicle under adverse external conditions (wet or icy roads) Longitudinal Force al ce Tire Forces t er La r Fo Slip Target Zone Maximum Braking Model nonlinear, uncertain, constraints Maximum Cornering Controller suitable for real-time implementation Maximum Acceleration Steer Angle Tire Slip Longitudinal Force Lateral Force MLD hybrid framework + optimization-based control strategy 139 140 Hybrid Model Simple Traction Model • Mechanical system Nonlinear tire torque τt =f(Δω , μ) Torque ò ó üt 1 üc à beωe à gr Je üt vç v = mvrt ωç e = μ Slip PWA Approximation • Manifold/fueling dynamics (PWL Toolbox, Julian, 1999) Torque üc = biüd(t à üf) • Tire torque τt is a function of slip Δω and road surface μ adhesion coefficient μ Mixed-Logical HYSDEL Slip (Hybrid Systems Description Language) ωe vv Δω = à gr rt Dynamical (MLD) Wheel slip Hybrid Model (discrete time) Δω 141 142 Performance and Constraints MLD Model • Control objective: min PN k=0 subj. to. State x(t) 4 variables Input u(t) 1 variable Aux. Binary vars δ(t) 1 variable Aux. Continuous vars z(t) 3 variables Mixed-integer inequalities 14 |Δω(k|t) à Δωdes| MLD Dynamics • Constraints: • Limits on the engine torque: à 20Nm ô ü d ô 176Nm • Logic Constraint: • Hysteresis The MLD matrices are automatically generated in Matlab format by HYSDEL go to demo /demos/traction/init.m 143 144 Experimental Results Experiment Wheel Speeds, [rad/s] 20 15 10 5 0 Engine Torque Command, [Nm] 200 150 100 50 0 0 3 6 9 12 30 Controller Region 25 • ≈500 regions • 20ms sampling time • Pentium 266Mhz + Labview 20 15 10 5 0 0 3 6 9 12 Time, [s] 145 146 DISC Engine Control Problem Goal: Develop a controller for a Direct-Injection Stratified Charge (DISC) engine. Main features of DISC engines: • • • • Hybrid Control of a DISC Engine (joint work with N. Giorgetti, I. Kolmanovsky and D. Hrovat) Direct injection of fuel (as Diesel engines); Two operating modes (homogeneous/stratified); Reduction of consumptions up to 15%; Highly complex post-treatment system of exhaust gas; • Different control objectives and constraints that depend on the operating mode (Photo: Courtesy Mitsubishi) Strategy: Develop a hybrid model that captures the two operating modes; Design a constrained MPC controller based on the hybrid model 147 148 DISC Engine DISC Engine Two distinct regimes: Regime fuel injection Homogeneous intake combustion stroke Stratified combustion pm States/Controlled outputs: Intake manifold pressure (pm); Air-to-fuel ratio (λ); Engine brake torque (τ); air-tofuel ratio λ=14.64 compression λ stroke λ Wth Inputs (continuous): 14.64 τ ρ Wf Air mass flow rate through throttle (Wth); Mass flow rate of fuel (Wf); Spark timing (δ); • Mode is switched by changing fuel injection timing (late / early) • Better fuel economy during stratified mode Inputs (binary): Periodical cleaning of the aftertreatment system needed (λ=14.00, homogeneous regime) Constraints on: δ ρ = regime of combustion (homogeneous/stratified); Air-to-fuel ratio (due to engine roughness, misfiring, smoke emiss.) normal purge the stratified operation can only be sustained in a restricted part of the engine operating range Spark timing (to avoid excessive engine roughness) Mass flow rate on intake manifold (constraints on throttle) 149 • • Dynamic equations are nonlinear Dynamics and constraints depend on regime ρ 150 DISC Dynamics Hybridization of DISC Model Nonlinear model of the engine developed and validated at Ford Research (Kolmanovsky, Sun, …) DYNAMICS (intake pressure, air-to-fuel ratio, torque): Assumptions: - no EGR (exhaust gas recirculation) rate, - engine speed=2000 rpm. • Definition of two operating points; • Linearization of nonlinear dynamics; • Time discretization of the linear models. ρ-dependent dynamic equations • Intake manifold pressure: CONSTRAINTS on: • Air-to-Fuel Ratio: λmin(ρ)·λ(t)·λmax(ρ); • Mass of air through the throttle: 0 · Wth · K; • Spark timing: 0·δ(t)· δmbt(λ, ρ) • In-cylinder Air-to-Fuel ratio: • Engine torque: with ρ−dependent constraints functions of pm where θa, θb, δmbt are functions of λ, δ and ρ. 9 Good for simulation Hybrid system with 2 modes (switching affine system) 8 Not suitable for controller synthesis 151 MPC for Hybrid Systems Integral Action past future Predicted outputs y(t+k|t) Manipulated Inputs u(t+k) t t+1 152 Model Predictive (MPC) Control Integrators on torque error and air-to-fuel ratio error are added to obtain zero offsets in steady-state: t+T = sampling time • At time t solve with respect to the finite-horizon open-loop, optimal control problem: brake torque and air-to-fuel references Simulation based on nonlinear model confirms zero offsets in steady-state • Apply only (discard the remaining optimal inputs); (despite the model mismatch) • Repeat the whole optimization at time t+1 153 MPC of DISC Engine 154 DISC Engine - HYSDEL List N = control horizon x(t) = current state where: and: 155 SYSTEM hysdisc{ INTERFACE{ STATE{ REAL pm [1, 101.325]; REAL xtau [-1e3, 1e3]; REAL xlam [-1e3, 1e3]; REAL taud [0, 100]; REAL lamd [10, 60]; } OUTPUT { REAL lambda; /* [10, 50]; */ REAL tau; /* [0, 100]; */ } INPUT{ REAL Wth [0,38.5218]; REAL Wf [0, 2]; REAL delta [0, 40]; BOOL rho; } PARAMETER{ REAL Ts, pm1, pm2; REAL l01, l02, l0c; REAL l11,l12,l1c; REAL t01,t02,t03,t04,t05; REAL t11,t12,t13,t14,t15; } } IMPLEMENTATION{ AUX{ REAL lam, taul; REAL lmin,lmax; REAL dmbt; } DA{ lam={ IF rho THEN l11*pm+l12*Wf+l1c ELSE l01*pm+l02*Wf+l0c}; taul={IF rho THEN t11*pm+t12*Wf+t13*delta+t14*lam+t15 ELSE t01*pm+t02*Wf+t03*delta+t04*lam+t05 }; lmin={IF rho THEN 13 ELSE 19}; lmax ={IF rho THEN 21 ELSE 38}; dmbt ={IF rho THEN -28.74+3.1845*lam ELSE 14.0877+0.2810*lam}; } CONTINUOUS{ pm=pm1*pm+pm2*Wth; xtau=xtau+Ts*(taud-taul); xlam=xlam+Ts*(lamd-lam); taud=taud; lamd=lamd; } OUTPUT { lambda=lam; tau=taul; } MUST{ lmin-lam <=0; lam-lmax <=0; delta-dmbt <=0; } }} 156 Simulation Results MPC – Torque Control Mode Solve MIQP problem (mixed-integer quadratic program) to compute u(t) Weights: pm λ (prevents unneeded chattering) qλ sε τ sε (Purge Lean NOx Trap) Time (s) Time (s) Simulation in torque control mode: • Control horizon N=1; homogeneous • Simulation time T=2.5 s; τ ρ qτ 14 Combustion mode Wth rρ Air-to-Fuel Ratio [Nm] Engine Brake Torque Wf • Sampling time Ts=10 ms; • CPU time for simulation ' 8 s; (on an Intel Centrino 1.2 GHz, 640 Mb RAM with Cplex 9.01) δ λ main emphasis on torque ' 32 ms per time step stratified MPC Time (s) 157 Multiparametric (Explicit) Solution Not directly implementable ! 158 Explicit MPC Controller Mixed Integer Quadratic Program Explicit control law: N=1 (control horizon) 75 partitions where: • On-line optimization: given x(t), solve an MIQP at each t. • Off-line optimization: solve the MIQP for all x(t) off line Cross-section by the τref-λref plane - find feasible switching sequences using reachability analysis - solve sequence of multi-parametric quadratic programs (using the Hybrid Toolbox) 4 2 • Sampling time Ts=10 ms; • CPU time for simulation: 0.52 s M 1 5 Time to compute the explicit MPC: 3.4750 s; • Simulation time T=2.5 s; ρ=0 (x,r)-space The MPC controller is piecewise affine in x,r • ρ=1 ' 10 μs per time step 63 159 160 Microcontroller Implementation Explicit MPC Controller (N=2) • C-code automatically generated by the Hybrid Toolbox Explicit control law: 5637 partitions where: • Microcontroller Motorola MPC 555 (custom made for Ford) Engine Brake Torque • 43 Kb memory available N=2 (control horizon) Air-to-Fuel Ratio • Floating point arithmetic ≈ 3ms execution time sampling period = 10ms Implementable ! • Further reduction of number of partitions possible (Alessio, Bemporad, 2005) • C-code can be further optimized Closed-loop N=2 161 Closed-loop N=1 Adequate! 162 Conclusions Key References • Hybrid systems are a modeling framework for automotive control problems where continuous switched dynamics and logic are relevant (and linear models are not enough!) [1] A. Bemporad, “Modeling, control, and reachability analysis of discrete-time hybrid systems,” Lecture Notes - DISC School on Hybrid Systems, Mar. 2003. • MPC control design handle all performance specs and constraints in a natural and direct way. Quite complex systems can be controlled using on-line optimization • Piecewise affine MPC controllers can be synthesized, off-line, and implemented as look-up tables of linear gains [5] W.P.H.M Heemels, B. de Schutter, and A. Bemporad, “Equivalence of hybrid dynamical models,” Automatica, vol. 37, no. 7, pp. 1085-1091, July 2001 M 1 5 [3] A. Bemporad and M. Morari, “Control of systems integrating logic, dynamics, and constraints,” Automatica, vol. 35, no. 3, pp. 407-427, Mar. 1999. [4] A. Bemporad, “Efficient conversion of mixed logical dynamical systems into an equivalent piecewise affine form,” IEEE Trans. Automatic Control, vol. 49, no. 5, pp. 832-838, 2004. (x,r)-space 4 2 [2] F.D. Torrisi and A. Bemporad, “HYSDEL - A tool for generating computational hybrid models,” IEEE Trans. on Control Systems Technology, vol. 12, no. 2, pp. 235-249, Mar. 2004 63 • Matlab tools available to assist the whole design process (models, simulation, MPC design, code generation): MPC Toolbox (linear), Hybrid Toolbox (hybrid, explicit), Multi-Parametric Toolbox (PWA, explicit) 163 Key References [6] A. Bemporad, M. Morari, V. Dua, and E.N. Pistikopoulos, “The explicit linear quadratic regulator for constrained systems,” Automatica, vol. 38, no. 1, pp. 3-20, 2002. more on http://www.dii.unisi.it/~bemporad/publications The End [7] A. Bemporad, F. Borrelli, and M. Morari, “Piecewise linear optimal controllers for hybrid systems,” In Proc. American Control Conference, 2000, pp. 1190-1194. [8] F. Borrelli, M. Baotic, A. Bemporad, and M. Morari, “Dynamic programming for constrained optimal control of discrete-time linear hybrid systems,” Automatica, vol. 41, no. 10, Oct. 2005. [9] A. Bemporad and N. Giorgetti, “Logic-based methods for optimal control of hybrid systems,”IEEE Trans. Autom. Control, 2005, to appear [10] A. Bemporad, D. Mignone, and M. Morari, “Moving horizon estimation for hybrid systems and fault detection,” in Proc. American Control Conf., 1999, Chicago, IL, pp. 2471-2475. [11] A. Bemporad, A. Garulli, S. Paoletti, and A. Vicino, “A bounded-error approach to piecewise affine system identification,” IEEE Trans. Automatic Control, 2005, to appear. [12] A. Bemporad, “Hybrid Toolbox – User’s Guide,’’ Dec. 2003, http://www.dii.unisi.it/hybrid/toolbox. [13] M. Lazar, M. Heemels, S. Weiland, A. Bemporad, “Stability of Hybrid Model Predictive Control,” IEEE Trans. Automatic Control, 2005, submitted. more on http://www.dii.unisi.it/~bemporad/publications MPC controller - SIMO DC-Servomotor Hybrid Toolbox 165 http://www.dii.unisi.it/hybrid/toolbox 164