Hybrid Control Problem Hybrid Modelcse.lab.imtlucca.it/~bemporad/talks/pisa01/hybrid-part4.pdf ·...

10
26 Acknowledgments Francesco Borrelli Mike Fodor Davor Hrovat Mitch McConnell Hybrid Control Example: Cruise Control System Hybrid Control Problem Renault Clio 1.9 DTI RXE GOAL: command gear ratio, gas pedal, and brakes to track a desired speed and minimize consumption Hybrid Model ω = k s R g ( i ) x ç mx ¨= F e à F b à ìx ç F e = k s R g ( i ) M • Vehicle dynamics • Transmission kinematics discretized with sampling time T s =0 . 5 s = engine torque = engine speed = gear ω M i = vehicle speed x ç = brake force F b = traction force F e

Transcript of Hybrid Control Problem Hybrid Modelcse.lab.imtlucca.it/~bemporad/talks/pisa01/hybrid-part4.pdf ·...

Page 1: Hybrid Control Problem Hybrid Modelcse.lab.imtlucca.it/~bemporad/talks/pisa01/hybrid-part4.pdf · 2001. 12. 10. · Renault Clio 1.9 DTI RXE GOAL: command gear ratio, gas pedal, and

26

Acknowledgments

• Francesco Borrelli • Mike Fodor

• Davor Hrovat• Mitch McConnell

Hybrid Control Example:Cruise Control System

Hybrid Control Problem

Renault Clio 1.9 DTI RXE

GOAL:

command gear ratio, gas pedal, and brakes to track a desired speed and minimize consumption

Hybrid Model

ω = ks

Rg(i)xç

mx = Fe à Fb à ìxç

Fe = ks

Rg(i)M

• Vehicle dynamics

• Transmission kinematics

discretized with sampling time Ts = 0.5 s

= engine torque

= engine speed

= gear

ω

M

i

= vehicle speedxç

= brake forceFb

= traction forceFe

Page 2: Hybrid Control Problem Hybrid Modelcse.lab.imtlucca.it/~bemporad/talks/pisa01/hybrid-part4.pdf · 2001. 12. 10. · Renault Clio 1.9 DTI RXE GOAL: command gear ratio, gas pedal, and

27

Hybrid Model

1000 2000 3000 400060

80

100

120

140

160

180

C+e (ω)• Max engine torque

Piecewise-linearization:(PWL Toolbox, Julián, 1999)

http://www.renault.fr

Càe (ω) = ë1 + ì1ω• Min engine torque

requires: 4 binary aux variables4 continuous aux variables

à Càe (ω) ô M ô C+

e (ω)• Engine torque

Hybrid Model

ω = ks

Rg(i)xç

Fe = ks

Rg(i)M

• Gear selection (traction force):

Fe = FeR + Fe1 + Fe2 + Fe3 + Fe4 + Fe5

depends on gear #i

define auxiliary continuous variables:

similarly, also requires 6 auxiliary continuous variables

• Gear selection (engine/vehicle speed):

• Gear selection:gi ∈ {0, 1}

for each gear #i,

define a binary input

IF gi = 1 THEN Fei = ks

Rg(i)M ELSE 0

Hybrid Model• MLD model

x(t + 1) = Ax(t) + B1u(t)y(t) = Cx(t) + D1u(t)

+ B2î(t) + B3z(t)+ D2î(t) + D3z(t)

E2î(t) + E3z(t) ô E4x(t) + E1u(t) + E5

• 2 continuous states:• 2 continuous inputs:• 6 binary inputs:• 1 continuous output:

• 4 auxiliary binary vars:

• 16 auxiliary continuous vars:

(engine torque, brake force)

(vehicle speed)

(gears)

v

M, Fb

gR, g1, g2, g3, g4, g5

(vehicle position and speed)x, v

(6 traction force, 6 engine speed, 4 PWL max engine torque)

(PWL max engine torque breakpoints)

• 96 mixed-integer inequalities

Hysdel Model

http://control.ethz.ch/~hybrid/hysdel

Page 3: Hybrid Control Problem Hybrid Modelcse.lab.imtlucca.it/~bemporad/talks/pisa01/hybrid-part4.pdf · 2001. 12. 10. · Renault Clio 1.9 DTI RXE GOAL: command gear ratio, gas pedal, and

28

Hybrid Controller• Max-speed controller

maxutJ(ut, x(t)),v(t + 1|t)

subj. to MLD modelx(t|t) = x(t)

ú

MILP optimization problem

( is irrelevant)x(t)

v(t)

x(t)0

50

100

150

200

250

Linear constraintsContinuous variablesBinary variablesParametersTime to solve mp-MILP

(Sun Ultra 10)Number of regions

9618101

45 s11

Hybrid Controller• Max-speed controller

0 50 1000

50

100

150

200Velocity (km/h)

0 50 1000

1000

2000

3000

4000

5000

6000Engine speed (rpm)

Time (s)0 50 100

0

50

100

150

200Engine Torque (Nm)

Time (s)

0 50 1001

2

3

4

5Gear

0 50 1000

10

20

30

40

50

60Power (kW)

Time (s)

0 50 100-1

-0.5

0

0.5

1

Fraction of Max Torque (Nm)

0 50 100-1

-0.5

0

0.5

1Road Slope (deg)

Time (s)

0 50 100-1

-0.5

0

0.5

1Brakes (Nm)

Hybrid Controller• Tracking controller

minutJ(ut, x(t)),|v(t + 1 |t) à vd(t)| + ú |ω|

subj. to MLD modelx(t|t) = x(t)

ú

v(t)

vd(t)

0 40 80 120 160 2000

50

100

150

200

250

MILP optimization problemLinear constraintsContinuous variablesBinary variablesParametersTime to solve mp-MILP

(Sun Ultra 10)Number of regions

9819102

27 m49

Hybrid Controller• Tracking controller

0 100 2000

20

40

60

80

100

120Velocity (km/h), Desired velocity (km/h)

0 100 2000

1000

2000

3000

4000

5000

6000Engine speed (rpm)

Time (s)0 100 200

-200

-100

0

100

200Engine Torque (Nm)

Time (s)

0 100 2001

2

3

4

5Gear

0 100 200-100

-50

0

50

100Power (kW)

Time (s)

0 100 200-1

-0.5

0

0.5

1

Fraction of Max Torque (Nm)

0 100 200-6

-4

-2

0

2

4

6Road Slope (deg)

Time (s)

0 100 2000

2000

4000

6000

8000

10000Brakes (Nm)

minutJ(ut, x(t)),|v(t + 1|t)à vd(t)| + ú|ω|

ú = 0 .001

Page 4: Hybrid Control Problem Hybrid Modelcse.lab.imtlucca.it/~bemporad/talks/pisa01/hybrid-part4.pdf · 2001. 12. 10. · Renault Clio 1.9 DTI RXE GOAL: command gear ratio, gas pedal, and

29

Hybrid Controller• Smoother tracking controller

minutJ(ut, x(t)),|v(t + 1 |t) à vd(t)| + ú |ω|

subj. to|v(t + 1 |t) à v(t)| < Tsamax

MLD modelx(t|t) = x(t)

v(t)

vd(t)

0 40 80 120 160 2000

50

100

150

200

250

MILP optimization problemLinear constraintsContinuous variablesBinary variablesParametersTime to solve mp-MILP

(Sun Ultra 10)Number of regions

10019102

28 m54

Hybrid Controller• Smoother tracking controller

0 100 2000

20

40

60

80

100

120Velocity (km/h), Desired velocity (km/h)

0 100 2000

1000

2000

3000

4000

5000

6000Engine speed (rpm)

Time (s)0 100 200

-200

-100

0

100

200Engine Torque (Nm)

Time (s)

0 100 2001

2

3

4

5Gear

0 100 200-100

-50

0

50

100Power (kW)

Time (s)

0 100 200-1

-0.5

0

0.5

1

Fraction of Max Torque (Nm)

0 100 200-6

-4

-2

0

2

4

6Road Slope (deg)

Time (s)

0 100 2000

2000

4000

6000

8000

10000Brakes (Nm)

Reachability Analysis(Verification)

Verification

• GIVEN: an embedded system (continuous dynamicalsystem + logic controller)

• CERTIFY that such combination behaves as desired• for ALL initial conditions within a given set• for ALL disturbances within a given class

• or PROVIDE a counterexample.

Simulation: provides a partial answer (not all possibilities can be tested!)

Reachability Analysis: provides the answer.

Page 5: Hybrid Control Problem Hybrid Modelcse.lab.imtlucca.it/~bemporad/talks/pisa01/hybrid-part4.pdf · 2001. 12. 10. · Renault Clio 1.9 DTI RXE GOAL: command gear ratio, gas pedal, and

30

Ariane 5 - 19964

5

For 1 1:10 a[i]=0;end

while (x) read file

For 1 1:10 a[i]=0;end

while (x) read file

For 1 1:10 a[i]=0;end…

4

For 1 1:10 a[i]=0;end

while (x) read file

For 1 1:10 a[i]=0;end

while (x) read file

For 1 1:10 a[i]=0;end…

4

+

+

Physical beaviour Computer code

Need for verification

•Success

•Failure

• If yes, from which subset of ? • Disturbance/input sequences driving to .

• Target sets (disjoint)

• A hybrid system X(0)

Σ

Reachability Analysis/Verification

• Given:

Z 1 , Z 2 , . . ., ZL

t ô Tmax

• Problem: • Is reachable from in t steps ?Z i X(0)X(0)

Z i

XZ i(0)

XZ i(0)

• A set of initial conditions

• Time horizon

Z 1

Z 2

ZL

XZ 1(0)

XZ 2(0)

XZL(0)

X(0)

(Bemporad, Torrisi, Morari, 2000)

Applications• Safety ( = unsafe sets)

• Stability ( = invariant set around the origin)

• Scheduling ( = optimal strategy,

= reference set)

• Liveness ( =set to be reached within a finite time)

• Robust Simulation

Z 1, Z 2, . . ., ZL

Z 1

u (0), . . ., u (Tmax)

Z 1

Z 1

XZ 1(0 )

XZ 2(0 )

XZL(0 )

Z 1

Z 2

ZL

X(0)

(Bemporad, Giovanardi, Torrisi, CDC 2000)

Simple Verification Algorithm

• Only practical for small problems ! because number of free integer variables grows with T

• Efficient Solution: Exploit the special structure of the problem.

î(0), î(1), . . ., î(T)

• Simple solution: Solve the mixed-integer linear feasibility test

x(0) ∈ X(0)x(T) ∈ Zi

u(t) ∈ U, 0 ô t ô Tx(t + 1) = Ax(t) +B1u(t) +B2î(t) +B3z(t)E2î(t) + E3z(t) ô E1u(t) + E4x(t) + E5

∀T õ 0

x(0), {u(t), î(t), z(t)}Tt=0

with respect to

(Bemporad, Torrisi, Morari, HSCC 2000)

Page 6: Hybrid Control Problem Hybrid Modelcse.lab.imtlucca.it/~bemporad/talks/pisa01/hybrid-part4.pdf · 2001. 12. 10. · Renault Clio 1.9 DTI RXE GOAL: command gear ratio, gas pedal, and

31

Reach-Set EvolutionX0

t = 1

t = 2

t = 3

t = 4

t = 5

t = 6t = 4

x1

x2x2x2Cj Ci

• Compute the reach set (linear dynamics) (polyhedral sets)

• Switching detection using Mixed Integer Programming

• Describe new intersections as unions of hyperboxes

• Stopping criteria for a single exploration

X(t)

X(t)T Cj

Reachability analysis algorithm:

• , discrete-time modelTmax <∞Decidable !

• NP-hard !because of integer variables

(Bemporad, Torrisi, Morari, 2000)

Verification Example:Cruise Control System

Cruise Control System

Renault Clio 1.9 DTI RXE

GOAL:

Verify if a given switching controller satisfies certain specifications

(Torrisi, Bemporad, 2001)

Cruise Control System

1 2 43 5

w ≥ wu w ≥ wu w ≥ wu w ≥ wu

Gear selector:

e(t + 1) = e(t) + Ts(vr(t) − v(t))

ut(t) =

½kt(vr(t) − v(t)) + ite(t) if v(t) < vr(t) + 10 otherwise

ub(t) =

½kb(vr(t) − v(t)) if v(t) ≥ vr(t) + 10 otherwise

Speed controller:

+ saturation

Page 7: Hybrid Control Problem Hybrid Modelcse.lab.imtlucca.it/~bemporad/talks/pisa01/hybrid-part4.pdf · 2001. 12. 10. · Renault Clio 1.9 DTI RXE GOAL: command gear ratio, gas pedal, and

32

SYSTEM car {INTERFACE {

STATE { REAL speed, err, vr; BOOL gear1, gear2, gear3, gear4, gear5; }PARAMETER {…}}

IMPLEMENTATION {AUX {

REAL Fe1, Fe2, Fe3, Fe4, Fe5, w1, w2, w3, w4, w5, DCe1, DCe2, DCe3, DCe4,zut, zub, ierr, torque, F_brake;BOOL dPWL1, dPWL2, dPWL3, dPWL4, sd, su, verr, sat_torque, sat_F_brake, no_sat;}

LOGIC { no_sat = ~(sat_torque | sat_F_brake) & verr; }AD {dPWL1 = wPWL1 - (w1 + w2 + w3 + w4 + w5) <= 0; dPWL2 = wPWL2 - (w1 + w2 + w3 + w4 + w5) <= 0;

dPWL3 = wPWL3 - (w1 + w2 + w3 + w4 + w5) <= 0; dPWL4 = wPWL4 - (w1 + w2 + w3 + w4 + w5) <= 0;

sd = (w1 + w2 + w3 + w4 + w5) - wl <= 0; su = wu - (w1 + w2 + w3 + w4 + w5) <= 0; verr = speed - vr - 2 <= 0; sat_torque = - zut + (DCe1 + DCe2 + DCe3 + DCe4) + 1 <= 0; sat_F_brake = - zub + max_brake_force <= 0; }

DA {Fe1 = {IF gear1 THEN torque / speed_factor * Rgear1}; Fe2 = {IF gear2 THEN torque / speed_factor * Rgear2};Fe3 = {IF gear3 THEN torque / speed_factor * Rgear3}; Fe4 = {IF gear4 THEN torque / speed_factor * Rgear4};Fe5 = {IF gear5 THEN torque / speed_factor * Rgear5};

w1 = {IF gear1 THEN speed / speed_factor * Rgear1}; w2 = {IF gear2 THEN speed / speed_factor * Rgear2};w3 = {IF gear3 THEN speed / speed_factor * Rgear3}; w4 = {IF gear4 THEN speed / speed_factor * Rgear4};w5 = {IF gear5 THEN speed / speed_factor * Rgear5};

DCe1 = {IF dPWL1 THEN (aPWL2) + (bPWL2) * (w1 + w2 + w3 + w4 + w5) ELSE (aPWL1) + (bPWL1) * (w1 + w2 + w3 + w4 + w5)};DCe2 = {IF dPWL2 THEN (aPWL3 - aPWL2) + (bPWL3 - bPWL2) * (w1 + w2 + w3 + w4 + w5)}; DCe3 = {IF dPWL3 THEN (aPWL4 - aPWL3) + (bPWL4 - bPWL3) * (w1 + w2 + w3 + w4 + w5)};DCe4 = {IF dPWL4 THEN (aPWL5 - aPWL4) + (bPWL5 - bPWL4) * (w1 + w2 + w3 + w4 + w5)};

zut = {IF verr THEN kt * (vr - speed) + it * err}; zub = {IF ~verr THEN - kb * (vr - speed) - ib * err}; torque ={IF sat_torque THEN (DCe1 + DCe2 + DCe3 + DCe4) + 1 ELSE zut}; F_brake = {IF sat_F_brake THEN max_brake_force ELSE zub};ierr = {IF no_sat THEN err + Ts * (vr - speed)};}

CONTINUOUS {speed = speed + Ts / mass * (Fe1 + Fe2 + Fe3 + Fe4 + Fe5 - F_brake - beta_friction * speed); err = ierr; vr = vr;}

AUTOMATA {gear1 = (gear2 & sd) | (gear1 & ~su); gear2 = (gear1 & su) | (gear3 & sd) | (gear2 & ~sd & ~su);gear3 = (gear2 & su) | (gear4 & sd) | (gear3 & ~sd & ~su); gear4 = (gear3 & su) | (gear5 & sd) | (gear4 & ~sd & ~su);gear5 = (gear4 & su) | (gear5 & ~sd );}

MUST {-w1 <= -wemin; w1 <= wemax; -w2 <= -wemin; w2 <= wemax; -w3 <= -wemin; w3 <= wemax; -w4 <= -wemin; w4 <= wemax; -w5 <= -wemin; w5 <= wemax; -F_brake <= 0; F_brake <= max_brake_force; torque - (DCe1 + DCe2 + DCe3 + DCe4) - 1 <= 0; -((REAL gear1) + (REAL gear2) + (REAL gear3) + (REAL gear4) + (REAL gear5)) <= -0.9999;(REAL gear1) + (REAL gear2) + (REAL gear3) + (REAL gear4) + (REAL gear5) <= 1.0001;dPWL4 -> dPWL3; dPWL4 -> dPWL2; dPWL4 -> dPWL1; dPWL3 -> dPWL2; dPWL3 -> dPWL1; dPWL2 -> dPWL1;}}

Hysdel Model (HYbrid Systems DEscription Language)

http://control.ethz.ch/~hybrid/hysdel (Torrisi, Bemporad, Mignone, 2000)

Hybrid Model• MLD model

x(t + 1) = Ax(t) + B1u(t)y(t) = Cx(t) + D1u(t)

+ B2î(t) + B3z(t)+ D2î(t) + D3z(t)

E2î(t) + E3z(t) ô E4x(t) + E1u(t) + E5

• 3 continuous states:

• 5 binary states:

• 15 auxiliary binary vars:

• 19 auxiliary continuous vars:

(gears)g1, g2, g3, g4, g5

(vehicle speed, reference and tracking error)v, vr, e

(5 traction force, 5 engine speed, 5 reset/saturation, 4 PWL max engine torque)

(4 PWL max torque breakpoints, 4 saturations 5 logic updates, 2 gear switching conditions)

• 173 mixed-integer inequalities

Verification

0 2 4 6 8 10 12 14 160

20

40

60

80

100

120

Time (s)

Spee

d (K

m/h

)

Liveness

Safety

Verify that the cruise control reaches the desired speed

reference ( ) and

without driving above the limit ( ),Z 1 = {v : v > vr + rtoll}

Z 2 = {v, t : v < vr − 2rtoll, t > 10/Ts}

rtoll = 5 km/h

• For the verification algorithm finds the first counterexample after ~7m

• For all the controller satisfies both liveness & safety properties

• CPU time: ~2.5h on Matlab5.3, PC650MHz.

Verification Results

vr ∈

0 2 4 6 8 10 12 14 160

20

40

60

80

100

120

Time (s)

Spee

d (K

m/h

)

Liveness

Safety[30, 120] km/h

vr ∈ [30, 70] km/h

Page 8: Hybrid Control Problem Hybrid Modelcse.lab.imtlucca.it/~bemporad/talks/pisa01/hybrid-part4.pdf · 2001. 12. 10. · Renault Clio 1.9 DTI RXE GOAL: command gear ratio, gas pedal, and

33

Conclusions• Hybrid systems as a framework for new applications, where

both logic and continuous dynamics are relevant• Mixed Logical Dynamical (MLD) systems as discrete-time, computation-oriented models for hybrid systems

x (t + 1) = Ax (t) + B1u (t)y(t) = Cx(t) + D 1u (t)

+ B 2î(t) + B 3z(t)+ D 2î(t) + D 3z(t)

E 2î(t) + E 3z(t) ô E 4x (t) + E 1u (t) + E 5

HYSDEL

Conclusions• Hybrid systems as a framework for new applications, where

both logic and continuous dynamics are relevant• Mixed Logical Dynamical (MLD) systems as discrete-time, computation-oriented models for hybrid systems

y(t)u(t)

Plant

OutputInput

Measurements

• Piecewise Linear Optimal Controllers can be synthesizedvia off-line multiparametric programming for fast-sampling applications

• Supervisory MPC controllers and State Estimation/Fault Detection schemes can be synthesized via on-line mixed-integer programming (MILP/MIQP)

Conclusions• Hybrid systems as a framework for new applications, where

both logic and continuous dynamics are relevant• Mixed Logical Dynamical (MLD) systems as discrete-time, computation-oriented models for hybrid systems

• Piecewise Linear Optimal Controllers can be synthesizedvia off-line multiparametric programming for fast-sampling applications

• Supervisory MPC controllers and State Estimation/Fault Detection schemes can be synthesized via on-line mixed-integer programming (MILP/MIQP)

• Safety Analysis properties can be formally verified

References[1] A. Bemporad and M. Morari.Control of systems integrating logic, dynamics, and

constraints. Automatica, 35(3):407 –427, March 1999.[2] A. Bemporad, G.Ferrari-Trecate, and M.Morari. Observability and controllability

of piecewise affine and hybrid systems. IEEE Transactions Automatic Control,vol. 45, n.10, pp. 1864-1876, October 2000.

[3] A. Bemporad, F.D. Torrisi, M. Morari. Optimization-based verification andstability characterization of piecewise affine and hybrid systems. In Hybrid

Systems:Computation and Control, Lecture Notes in Computer Science 1790, pages 45–58. Springer Verlag, 1999.

[4] A. Bemporad, F. Borrelli, M. Morari. Piecewise linear optimal controllers for hybrid systems. American Control Conference, Chicago, pp. 1190-1194, 2000.

[5] A. Bemporad, D. Mignone, and M. Morari. Moving horizon estimation for hybrid systems an fault detection. In Proc. American Contr. Conf., 1999.

[6] M. Heemels, B. De Schutter, A. Bemporad. Equivalence of hybrid dynamical models. Automatica, vol. 37, n.7, pp. 1085-1091, 2001

[7] A Bemporad, M. Morari, V. Dua, E.N. Pistikopoulos. The explicit linear quadratic regulator for constrained systems. Automatica, to appear.

[8] A. Bemporad, M. Morari. Optimization-based hybrid control tools. In Proc. American Contr. Conf., 2001 (survey paper).

Download: http://www.dii.unisi.it/~bemporad

Page 9: Hybrid Control Problem Hybrid Modelcse.lab.imtlucca.it/~bemporad/talks/pisa01/hybrid-part4.pdf · 2001. 12. 10. · Renault Clio 1.9 DTI RXE GOAL: command gear ratio, gas pedal, and

34

Stability Analysis

Stability of PWA systems

• Not possible to deduce stability from stability of subsystems

• In general stability is either undecidable or NP-complete(Branicky, 1995)

(Blondel & Tsitsiklis, 1999)

Problem: check if the origin of a PWA system is asymptotically stableand determine a region of attraction.

Difficulties:

Look for sufficient conditions for stability

xk+1 =

à 0.04 à 0.46à 0.14 0.34

ò óxk

0.94 0.320.79 à 0.05

ò óxk

à 0.86 0.810.49 0.62

ð ñxk

à 0.02 0.640.76 0.27

ð ñxk

xk ∈ C1

xk ∈ C2

xk ∈ C3

xk ∈ C4

if

if

if

if

Quadratic Lyapunov Functions

Theorem. If there exists such that

the origin of the PWA system is exponentially stable.

V(x) = x0Px x ∈ Ci P = P0 > 0

PV(x) = x0Px A0

jPAj à P < 0

• Solvable as a Linear Matrix Inequalities problem via Semidefinite Programming (interior-point methods)

(1)

• Sometimes too conservative

(Boyd,Vandenberghe, 1996)

Piecewise Quadratic Lyapunov Functions

Theorem. If there exists such that

the origin of the PWA system is exponentially stable.

V(x) = x0Pix x ∈ Ci Pi = P0i > 0 i = 1, . . ., s

Pi

A0jPiAj à Pj < 0 ∀(i, j) ∈ S

S : set of one-step switches between different regions

(1)(Mignone, Ferrari-Trecate, Morari, 2000)

(easily computed via reachability analysis)

• The LMIs for analysis can be adapted to synthesize a stabilizing piecewise linear state-feedback u(k) = Kix(k)

• Explicit computation of a discontinuos Lyapunov function andcharacterization of the region of attraction.

(Johannson, Rantzer, 1998)

• Solvable as a Linear Matrix Inequalities problem via Semidefinite Programming (interior-point methods) (Boyd,Vandenberghe, 1996)

Page 10: Hybrid Control Problem Hybrid Modelcse.lab.imtlucca.it/~bemporad/talks/pisa01/hybrid-part4.pdf · 2001. 12. 10. · Renault Clio 1.9 DTI RXE GOAL: command gear ratio, gas pedal, and

35

Piecewise Quadratic LyapunovFunction

The End