You are on page 1of 59

Model Predictive Control for Linear and

Hybrid Systems.
Hybrid Systems

Francesco Borrelli

Department of Mechanical Engineering,


University of California at Berkeley,
USA
fborrelli@berkeley.edu

April 25, 2011


Introduction

Up to this point: Discrete-time linear systems with linear constraints


A step further: Systems consisting of
1 continuous dynamics : described by one or more difference (or
differential) equations, states belong to a continuum
2 discrete events : state variables assume discrete values from a countable
set, e.g.
◮ binary digits {0, 1},
◮ N, Z, Q, . . .
◮ finite set of symbols

Hybrid systems. Dynamical systems whose state evolution depends on an


interaction between continuous dynamics and discrete events .

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 2 / 59


Introduction
discrete
binary binary
inputs dynamics outputs
and logic

events mode
switches

real-valued continuous real-valued


outputs dynamics inputs

Figure: Hybrid systems. Logic-based discrete dynamics and continuous dynamics


interact through events and mode switches

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 3 / 59


Hybrid Systems: Examples (I)
Mechanical system with backlash

δ ε

111111111111
000000000000
000000000000
111111111111
000000000000
111111111111
00
11 00
11
000000000000
111111111111
00
11 00
11
00
11
00
11 00 11
11 00
00
11 00
11
00
11 00
11
00
11 00
11 00
11
00
11
00
11 00
11 00
11 00
11
00 ∆x
11
00
11 11 00
11
00 11
00 00
11
00
11 00
11
11 00
11
00 11 00
11
00
11
00
11
00
11 00
11 00
00
11 00
11
x1 00
11 00 11
11 00 00
11
00
11 00
11
11 00
11
00 11 00
11
00
11
00
11
00
11 00
11 00
00
11 00
11
00
11 00 11
11 00 00
11
x2 00
11
00
11 00
11
00
11
000000000000
111111111111
000000000000
111111111111
000000000000
111111111111

Continuous dynamics : states x1 , x2 , ẋ1 , ẋ2 .


Discrete events :
a) “contact mode” ⇒ mechanical parts are in contact and the force is
transmitted. Condition:
W
[(∆x = δ) ∧ (ẋ1 > ẋ2 )] [(∆x = ε) ∧ (ẋ2 > ẋ1 )]
b) “backlash mode” ⇒ mechanical parts are not in contact
Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 4 / 59
Hybrid Systems: Examples (II)
DC2DC Converter

rℓ iℓ S=0
vℓ i0
S=1 rc
vs ic r0 v0
vc

Continuous dynamics : states vℓ , iℓ , vc , ic , v0 , i0


Discrete events : S = 0, S = 1

MODE 1 (S = 1 ) MODE 2 (S = 0 )

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 5 / 59


Hybrid Systems: Examples (III)
Temperature Control System

Evolution of the temperature in a room:

Ṫ = f (T, x, u)

Continuous states : temperature T , other states x


Discrete input : heating u ∈ {ON, OFF}
Control system with hysteresis:

u = ON
u T ≥ Thigh

Ṫ = f (T , x, ON) Ṫ = f (T , x, OFF)

u = OF F T < Thigh T > Tlow


Tlow T
Thigh

T ≤ Tlow

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 6 / 59


Piecewise Affine (PWA) Systems
PWA are defined by:

affine dynamics and output in each region:


  h
x(t + 1) = Ai x(t) + Bi u(t) + fi x(t)
i
if u(t) ∈ Xi(t)
y(t) = Ci x(t) + Di u(t) + gi

polyhedral partition of the (x, u)-space:


s
{Xi }i=1 := {[ ux ] | Hi x + Ji u ≤ Ki }

with: x ∈ Rn , u ∈ Rm .
Remark: physical constraints on x(t) and u(t) are defined by polyhedra Xi .

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 7 / 59


Piecewise Affine (PWA) Systems

Examples:
linearization of a non-linear system at different operating point ⇒ useful
as an approximation tool

closed-loop MPC system for linear constrained systems

When the mode i is an exogenous variable, the partition disappears and


we refer to the system as a Switched Affine System (SAS)

Definition
Let P be a PWA system and let X = ∪si=1 Xi ⊆ Rn+m be the polyhedral
partition associated with it. System P is called well-posed if for all pairs
(x(t), u(t)) ∈ X there exists only one index i(t) satisfying the membership
condition.

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 8 / 59


Modeling Discontinuities

Discontinuous systems can be approximated by disconnecting the domain.


Example:

1

2 x(t) if x(t) ≤ 0
x(t + 1) =
0 if x(t) > 0

can be approximated by

1

2 x(t) if x(t) ≤ 0
x(t + 1) =
0 if x(t) ≥ ǫ

where ǫ > 0 is an arbitrarily small number, for instance the machine precision.

We prefer to assume that in the definition of the PWA dynamics


the polyhedral cells Xi(t) are closed sets.

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 9 / 59


Example
    
cos α(t) − sin α(t) 0
x(t + 1) = 0.8 x(t) + u(t)


sin α(t) cos α(t) 1


  
y(t) =  0 π1 x(t)
if [ 1 0 ] x(t) ≥ 0



 α(t) = 3
− π3 if [ 1 0 ] x(t) < 0

can be described in PWA form as


   √   
√1 − 3 0
0.4 x(t) + u(t)

 

3 1 1

 


 
 
if 1 0 x(t) ≥ 0

 


 


x(t + 1) =

  √   
 
 1
√ 3 0

 
 0.4 x(t) + u(t)
− 3 1   1

 


 

if 1 0 x(t) ≤ −ǫ

 

  
y(t) = 0 1 x(t)

for all x1 ∈ (−∞, −ǫ] ∪ [0, +∞), x2 ∈ R, u ∈ R, and ǫ > 0.


Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 10 / 59
Binary States, Inputs, and Outputs

Remark
In the previous example, the PWA system has only continuous states and
inputs.

We will formulate PWA systems including binary state and inputs by treating
0-1 binary variables as

numbers, over which arithmetic operations are defined,

Boolean variables, over which Boolean functions are defined.


In Particular, we will use the notation x = [ xxcℓ ], where n , nc + nℓ . Similarly,
y ∈ Rpc × {0, 1}pℓ , p , pc + pℓ , u ∈ Rmc × {0, 1}mℓ , m , mc + mℓ .

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 11 / 59


Boolean Algebra. Basic Definitions and Notation

Boolean variable. A variable δ is a Boolean variable if δ ∈ {0, 1}, where


“δ = 0” means “false”, “δ = 1” means “true”.

A Boolean expression is obtained by combining Boolean variables


through the logic operators ¬ (not), ∨ (or), ∧ (and), ← (implied by), →
(implies), and ↔ (iff).

A Boolean function f : {0, 1}n−1 7→ {0, 1} is used to define a Boolean


variable δn as a logic function of other variables δ1 , . . . , δn−1 :

δn = f (δ1 , δ2 , . . . , δn−1 ).

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 12 / 59


Boolean Algebra. Basic Definitions and Notation

Boolean formula. Given n Boolean variables δ1 , . . . , δn , a Boolean


formula F defines a relation

F (δ1 , . . . , δn )

that must hold true.

Conjunctive Normal Form (CNF). Every Boolean formula


F (δ1 , δ2 , . . . , δn ) can be rewritten in the CNF
 
^m _ _
(CNF)  δi ∼ δi 
j=1 i∈Pj i∈Nj

Nj , Pj ⊆ {1, . . . , n}, ∀j = 1, . . . , m.

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 13 / 59


Example
Consider the system

xc (t + 1) = 2xc (t) + uc (t) − 3uℓ (t)


xℓ (t + 1) = xℓ (t) ∧ uℓ (t)

can be represented in the PWA form


 
2xc (t) + uc (t)

 if xℓ ≤ 12 , uℓ ≤ 1
2
0






  
2xc (t) + uc (t) − 3


if xℓ ≤ 12 , uℓ ≥ 1



    0 2
xc (t + 1)

=
xℓ (t + 1)  
2xc (t) + uc (t)

1 1
if xℓ ≥ + ǫ, uℓ ≤


0 2 2






  
2xc (t) + uc (t) − 3


1 1
xℓ ≥ + ǫ, uℓ ≥

 if 2 2 + ǫ.
1

1 1
by associating xℓ = 0 with xℓ ≤ 2 and xℓ = 1 with xℓ ≥ 2 + ǫ for any
0 < ǫ ≤ 21 .
Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 14 / 59
Example
Consider the spring-mass system

k(x1 ) b(u2 ) k(x1 ) b(u2 )


u1 u1
M M

x1 x1
(a) Low b (u2 = 1) (b) High b (u2 = 0)

With the following spring nonlinear characteristic


40

35

30

25

k(x1 )20

15

10

-5

-10
-10 -8 -6 -4 -2 0 2 4 6 8 10

x1
Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 15 / 59
Example

The system dynamics can be described in continuous-time as:

M ẋ2 = u1 − k(x1 ) − b(u2 )x2

The spring coefficient is



k1 x1 + d1 if x1 ≤ xm
k(x1 ) =
k2 x1 + d2 if x1 > xm ,

and the viscous friction coefficient is



b1 if u2 = 1
b(u2 ) =
b2 if u2 = 0.

Assume the system description is valid for −5 ≤ x1 , x2 ≤ 5, and for


−10 ≤ u2 ≤ 10.

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 16 / 59


Example
The system has four modes, depending on the binary input and the region of
linearity.
  0.90 0.02  0.10
 −0.01 

 −0.02 −0.00 x(t) + [ 0.02 ] u1 (t) + −0.02
if x1 (t) ≤ 1, u2 (t) ≤ 0.5









 
0.90 0.02
  −0.07 
 −0.06 −0.00 x(t) + [ 0.10

0.02 ] u1 (t) + −0.15






 if x1 (t) ≥ 1 + ǫ, u2 (t) ≤ 0.5
x(t + 1) =
  0.90 0.38   −0.10 
x(t) + [ 0.10 ] u1 (t) + −0.38



 −0.38 0.52 0.38
if x1 (t) ≤ 1, u2 (t) ≥ 0.5










  0.90 0.35  0.10
 −0.75 
−1.04 0.35 x(t) + [ 0.35 ] u1 (t) + −2.60




if x(t) ≥ 1 + ǫ, u2 (t) ≥ 0.5

for x1 (t) ∈ [−5, 1] ∪ [1 + ǫ, 5], x2 (t) ∈ [−5, 5], u(t) ∈ [−10, 10], and for any
arbitrary small ǫ > 0.

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 17 / 59


Example

Consider the following SISO system:

x1 (t + 1) = ax1 (t) + bu(t).

A logic state x2 ∈ [0, 1] stores the information whether the state of system has
ever gone below a certain lower bound xlb or not:
_
x2 (t + 1) = x2 (t) [x1 (t) ≤ xlb ],

Assume that the input coefficient is a function of the logic state:



b1 if x2 = 0
b=
b2 if x2 = 1.

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 18 / 59


Example
The system can be described by the PWA model:
      
a 0 b2 0
x(t) + u(t) +


0 0 0 1



 
if 1 0 x(t) ≤ xlb







   
a 0 b1


x(t) + u(t)


0 1 0 


   
x(t + 1) = 1 0 xlb + ǫ
if x(t) ≥
0 −1 −0.5







    
a 0 b2


x(t) + u(t)


0 1 0



 
xlb + ǫ


if x(t) ≥


0.5

for u(t) ∈ R, x1 (t) ∈ (−∞, xlb ] ∪ [xlb + ǫ, +∞), x2 ∈ {0, 1}, and for any ǫ > 0.

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 19 / 59


Discrete Hybrid Automata (DHA)
xc (k)
δe (k) EVENT GENERATOR
(EG)
uc (k)
δe (k)

replacements FINITE STATE MACHINE


(FSM)
ub (k)

...
SYS 1

SYS s
uc (k)

SWITCHED AFFINE
xb (k) SYSTEM (SAS)

MODE SELECTOR
ub (k) (MS)

δe (k)

Interconnection between:
switched affine system (SAS) ⇒ continuous dynamics
finite state machine (FSM) ⇒ discrete events
Interconnection based on:
Event Generator (EG)
◮ logic signals from the constraints on continuous states and time
◮ triggers mode switching of the FSM
Mode Selector (MS) ⇒ selection of an affine subsystem

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 20 / 59


DHA. Switched Affine System

State update equation:

xc (t + 1) = Ai(t) xc (t) + Bi(t) uc (t) + fi(t) ,


yc (t) = Ci(t) xc (t) + Di(t) uc (t) + gi(t) ,
if i(k) = j

xc ∈ Xc ⊆ Rnc , uc ∈ Uc ⊆ Rmc
i(t) ⇒ dynamic mode of SAS
i(t), j ∈ I = {1, 2, . . . , s}

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 21 / 59


DHA. Mode Selector

The mode i(t) of the SAS is generated by a Mode Selector function that
depends on
1 the FSM state
2 Discrete events generated by the continuous variables of the SAS
3 Exogenous discrete inputs
4 Time events

Boolean function fM : {0, 1}nb × {0, 1}mb × {0, 1}ne → I:


i(t) = fM (xb (t), ub (t), δe (t))

i(k) ∈ I ⊂ N ⇒ active mode


selection of a dynamic mode of the SAS

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 22 / 59


DHA. Event Generator

Defined by function fEG : Xc × Uc × N0 → D:

δe (t) = fEG (xc (t), uc (t), t)

Generates a binary vector δe (t) ∈ {0, 1}ne of event conditions according to the
satisfaction of a linear (or affine) condition.

time events: {δei = 1} ⇔ {t > t∗ }


threshold events: {δei = 1} ⇔ {aT xc (t) + bT uc (t) ≤ c}

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 23 / 59


DHA. Finite State Machine

Discrete time dynamic process:

xb (k + 1) = fF SM (xb (k), ub (k), δe (k))

fF SM : Xb × Ub × D → Xb is deterministic logic function .


δe ∈ D ⊆ {0, 1}ne (Boolean event from EG),
xb ∈ Xb ⊆ {0, 1}nb (Boolean state),
ub ∈ Ub ⊆ {0, 1}mb (Boolean input),

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 24 / 59


Finite State Machine. Example
∼ δ1

Red

∼ δ3 δ1 ∧ ∼ uℓ2
δ1 ∧ uℓ2
δ2
Green Blue
δ3 ∧ uℓ1

∼ uℓ1 ∧ δ3 ∼ δ2

uℓ = [uℓ1 uℓ2 ]T is the input vector, and δ = [δ1 . . . δ3 ]T is a vector


of signals coming from the event generator.

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 25 / 59


Finite State Machine. Example
The Boolean state update function (also called state transition function) is:

 Red if ((xℓ (t) = Green)∧ ∼ δ3 )∨

((xℓ (t) = Red)∧ ∼ δ1 ),




Green if ((xℓ (t) = Red) ∧ δ1 ∧ uℓ2 )∨




((xℓ (t) = Blue) ∧ δ2 )∨

xℓ (t + 1) =

 ((xℓ (t) = Green)∧ ∼ uℓ1 ∧ δ3 ),
Blue if ((xℓ (t) = Red) ∧ δ1 ∧ ∼ uℓ2 )∨




((xℓ (t) = Green) ∧ (δ3 ∧ uℓ1 ))∨




((xℓ (t) = Blue)∧ ∼ δ2 )).

Code the four states as Red = [ 00 ], Green = [ 01 ], and Blue = [ 10 ]:

xℓ1 (t + 1) = (∼ xℓ1 ∧ ∼ xℓ2 ∧ δ1 ∧ ∼ uℓ2 ) ∨


(xℓ1 ∧ ∼ δ2 ) ∨ (xℓ2 ∧ δ3 ∧ uℓ1 ),
xℓ2 (t + 1) = (∼ xℓ1 ∧ ∼ xℓ2 ∧ δ1 ∧ uℓ2 ) ∨
(xℓ1 ∧ δ2 ) ∨ (xℓ2 ∧ δ3 ∧ ∼ uℓ1 ),

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 26 / 59


Summary
xc (k)
δe (k) EVENT GENERATOR
(EG)

δe (k) uc (k)

FINITE STATE MACHINE


(FSM)
ub (k)

...
SYS 1

SYS s
uc (k)
SWITCHED AFFINE
xb (k) SYSTEM (SAS)

MODE SELECTOR
ub (k) (MS)

δe (k)

δe (t) = h(xc (t), uc (t), t)


i(t) = µ(xℓ (t), uℓ (t), δe (t))
yc (t) = Ci(t) xc (t) + Di(t) uc (t) + gi(t)
yℓ (t) = gℓ (xℓ (t), uℓ (t), δe (t))
xc (t + 1) = Ai(t) xc (t) + Bi(t) uc (t) + fi(t)
xℓ (t + 1) = fℓ (xℓ (t), uℓ (t), δe (t))

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 27 / 59


Summary

Needed: a mathematical model

descriptive: captures the behavior of the hybrid system


simple (enough) for analysis and the prediction of the states

PWA:
mode enumeration explodes

DHA:
good framework for the description of a hybrid systems
not convenient for the MPC formulation

Basic problem: How to describe the interaction between continuous


dynamics and propositional logic rules?

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 28 / 59


Mixed Logical Dynamical Systems

Idea: associate to each Boolean variable pi a binary integer variable δi :


pi ⇔ {δi = 1}, ¬pi ⇔ {δi = 0}

and embed them into a set of constraints as linear integer inequalities .

Two main steps:


1 Translation of Logic Rules into Linear Integer Inequalities
2 Translation DHA components into Linear Mixed-Integer Relations

Final result: a compact model with linear equalities and inequalities involving
real and binary variables

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 29 / 59


Boolean formulas as Linear Integer Inequalities

Aim
Given a Boolean formula F (p1 , p2 , . . . , pn ) define a polyhedral set P such that
a set of binary values {δ1 , δ2 , . . . , δn } satisfies the Boolean formula F in P . I.e.,

F (p1 , p2 , . . . , pn ) “TRUE” ⇔ Aδ ≤ B, δ ∈ {0, 1}n

where: {δi = 1} ⇔ pi = “TRUE”.

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 30 / 59


Analytic Approach
1 Transform F (p1 , p2 , . . . , pn ) into a Conjuctive Normal Form (CNF) :
" #
^ _
F (p1 , p2 , . . . , pn ) = pi
j i

2 Translation of a CNF into algebraic inequalities:

relation Boolean linear constraints


AND δ1 ∧ δ2 δ1 = 1, δ2 = 1 or δ1 + δ2 ≥ 2
OR δ1 ∨ X2 δ1 + δ2 ≥ 1
NOT ∼ δ1 δ1 = 0
XOR δ1 ⊕ δ2 δ1 + δ2 = 1
IMPLY δ1 → δ2 δ1 − δ2 ≤ 0
IFF δ1 ↔ δ2 δ1 − δ2 = 0
ASSIGNMENT δ1 + (1 − δ3 ) ≥ 1
δ3 = δ1 ∧ δ2 δ3 ↔ δ1 ∧ δ2 δ2 + (1 − δ3 ) ≥ 1
(1 − δ1 ) + (1 − δ2 ) + δ3 ≥ 1

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 31 / 59


Analytic Approach. Example
Given
F (p1 , p2 , p3 , p4 ) , [(p1 ∧ p2 ) ⇒ (p3 ∧ p4 )]
find the equivalent set of linear integer inequalities.

1 remove implication:

F (p1 , p2 , p3 , p4 ) = ¬(p1 ∧ p2 ) ∨ (p3 ∧ p4 )

2 using DeMorgan’s theorem, obtain CNF:

F (p1 , p2 , p3 , p4 ) = (¬p1 ∨ ¬p2 ∨ p3 ) ∧ (¬p1 ∨ ¬p2 ∨ p4 )

3 introduce [δi = 1] ⇔ pi = “TRUE” and write the inequalities:



 δ1 + δ2 − δ3 ≤ 1
F (p1 , p2 , p3 , p4 ) = “TRUE” ⇔ δ1 + δ2 − δ4 ≤ 1
δ1,2,3,4 ∈ {0, 1}

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 32 / 59


Geometric Approach
Key idea
The polytope P = {δ ∈ {0, 1}n | Aδ ≤ B} is the convex hull of the rows of the
truth table defining a logic proposition Ω(pi ).

Example. Given Ω(p1 , p2 ) , [p1 ⇒ p2 ]. Build the truth table:

δ1 δ2 δ3
0 0 1
0 1 1

δ3
1 0 0
1 1 1
0
0
1
δ2
δ1 0 1


         δ2 − δ3 ≤ 0
 0 0 1 1 


δ3 ≤ 1

hull 0 , 1 , 0 , 1 =
δ 1 − δ 2 + δ3 ≤ 1
1 1 0 1
   
−δ − δ3 ≤April−1

Francesco Borrelli (UC Berkeley) Hybrid Systems
1 25, 2011 33 / 59
Linear Inequality As Logic Condition
Event Generator
Defined by function fEG : Xc × Uc × N0 → D:

δe (t) = fEG (xc (t), uc (t), t)

Consider the Boolean expression consisting of a Boolean variable p and


continuous variable x ∈ Rn :
p ⇔ aT x ≤ b
where a ∈ Rn , b ∈ R, x ∈ X ⊂ Rn :

X = {x | aT x − b ∈ [m, M ]}

Translated to linear inequalitites:


aT x − b ≤ M (1 − δ)
T
a x−b > mδ

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 34 / 59


Switched Affine Dynamics
Rewrite the state update functions of the SAS as

A1 xc (t) + B1 uc (t) + f1 , if (i(t) = 1),
z1 (t) =
0, otherwise,
..
.

As xc (t) + Bs uc (t) + fs , if (i(t) = s),
zs (t) =
0, otherwise,
Xs
xc (t + 1) = zi (t),
i=1

In general, use the “IF-THEN-ELSE” relations

IF δ THEN z = a′1 x + b′1 u + f1 ELSE z = a′2 x + b′2 u + f2 ,

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 35 / 59


“IF-THEN-ELSE” Relations

IF p THEN (m2 − M1 )δ + zt ≤ aT2 xt + b2


(m1 − M2 )δ − zt ≤ −aT2 xt − b2
zt = aT1 xt + b1
⇐⇒ (m1 − M2 )(1 − δ) + zt ≤ aT1 xt + b1
ELSE
(m2 − M1 )(1 − δ) − zt ≤ −aT1 xt − b1
zt = aT2 xt + b2

where x ∈ X , with
sup aTi x − bi ≤ Mi ,
x∈X

inf aTi x − bi ≥ mi .
x∈X

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 36 / 59


Hybrid Modelling - An Example
Consider the following system with constraints: |x| ≤ 10, |u| ≤ 10
(
0.8xt + ut if xt ≥ 0
xt+1 =
−0.8xt + ut if xt < 0

1 associate {δt = 1} ⇔ {xt ≥ 0}

−mδt ≤ xt − m
−(M + ǫ)δt ≤ −xt − ǫ,

where: M = −m = 10, ǫ > 0.

2 state update equation:

xt+1 = 1.6δt xt − 0.8xt + ut

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 37 / 59


Hybrid Modelling - An Example

3 introduce disaggregated variable: zt = δt xt

xt+1 = 1.6zt − 0.8xt + ut

4 constraints on z:

zt ≤ M δt
zt ≥ mδt
zt ≤ xt − m(1 − δt )
zt ≥ xt − M (1 − δt )

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 38 / 59


MLD Hybrid Model

A DHA can be converted into the following MLD model

xt+1 = Axt + B1 ut + B2 δt + B3 zt
yt = Cxt + D1 ut + D2 δt + D3 zt
E2 δt + E3 zt ≤ E4 xt + E1 ut + E5

where x ∈ Rnc × {0, 1}nb , u ∈ Rmc × {0, 1}mb y ∈ Rpc × {0, 1}pb , δ ∈ {0, 1}rb
and z ∈ Rrc .

Physical constraints on continuous variables:


  
xc
C= ∈ Rnc +mc | F xc + Guc ≤ H
uc

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 39 / 59


MLD Hybrid Model. Well-Posedness

T
Well-Posedness: for a given xTt uTt


⇒ xt+1 and yt uniquely determined

Complete Well-Posedness:
T
well-posedness + uniquely determined δt and zt ∀ xTt uTt


Well-posedness : sufficient for the computation of the state and output


prediction

Complete well-posedness : transformation into equivalent hybrid models

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 40 / 59


Linear Complementary (LC) Systems

xt+1 = Axt + B1 ut + B2 wt ,
yt = Cxt + D1 ut + D2 wt ,
vt = E1 xt + E2 ut + E3 wt + g4
0 ≤ vt ⊥ wt ≥ 0

where: vt , wt ∈ Rs and “⊥” denotes elementwise complementarity: vi wi = 0.

Examples : mechanical systems, electrical circuit with ideal diodes

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 41 / 59


Max-Min-Plus-Scaling (MMPS) Systems
MMPS expressions defined by the grammar:
f := xi | α | max(fk , fl ) | min(fk , fl ) | fk + fl | βfk

where α, β ∈ R, i = {1, 2, . . . , n} and fk , fl are MMPS expressions.


Example:
f = 7x1 + 0.5x2 + max(min(3x1 − 2x2 , x3))
MMPS system:

xt+1 = Mx (xt , ut , dt ),
yt = My (xt , ut , dt ),
Mc (xt , ut , dt ) ≤ c

where Mx,y,c(·) are MMPS expressions in components of xt , ut and dt .

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 42 / 59


Equivalence of Hybrid Models
“The big picture”:

ELC

MMPS MLD LC

DHA PWA

A B “A” translates into “B”

A B “A” translates into “B” under some conditions

Modelling & Simulation: DHA


Control synthesis: MLD & PWA
Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 43 / 59
HYbrid System DEscription Language

HYSDEL
based on DHA
enables description of discrete-time hybrid systems in a compact way:
◮ automata and propositional logic
◮ continuous dynamics
◮ A/D and D/A conversion
◮ definition of constraints
automatically generates MLD models for MATLAB
freely available from:

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

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 44 / 59


Mixed Integer Linear Programming
Consider the following MILP

inf [zc ,zb ] c′c zc + c′b zb + d


subj. to Gc zc + Gb zb ≤ W
zc ∈ Rsc , zb ∈ {0, 1}sb
where zc ∈ Rsc , zb ∈ {0, 1}sb

MILP are nonconvex , in general.


For a fixed z̄b the MILP becomes a linear program:

inf [zc ,zb ] c′c zc + (c′ bz̄b + d)


subj. to Gc zc ≤ W − Gb z̄b
zc ∈ Rsc

Brute force approach to solution: enumerating the 2sb integer values of


the variable zb and solve the corresponding LPs. By comparing the 2sb
optimal costs one can find the optimizer and the optimal cost of the
MILP.

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 45 / 59


Mixed Integer Linear Programming

Denote by J ∗ the optimal value and by Z ∗ the set of optimizers.

Case 1. The MILP solution is unbounded, i.e., J ∗ = −∞.

Case 2. The MILP solution is bounded, i.e., J ∗ > −∞ and the optimizer
is unique. Z ∗ is a singleton.

Case 3. The MILP solution is bounded and there are infinitely many
optima corresponding to the same integer value.

Case 4. The MILP solution is bounded and there are finitely many
optima corresponding to different integer values.

Case 5. The union of Case 3 and Case 4.

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 46 / 59


Mixed Integer Quadratic Programming
Consider the following MIQP

inf [zc ,zb ] 12 z ′ Hz + q ′ z + r


subj. to Gc zc + Gb zb ≤ W
zc ∈ Rsc , zb ∈ {0, 1}sb
z = [zc , zb ], s = sc + sd
where H  0, zc ∈ Rsc , zb ∈ {0, 1}sb .
MIQP are nonconvex, in general.
For a fixed integer value z̄b of zb , the MIQP becomes a quadratic program:
1 ′ ′
inf [zc ] 2 zc Hc zc + qc z + k
subj. to Gc zc ≤ W − Gb z̄b
zc ∈ Rsc

Brute force approach to the solution: enumerating all the 2sb integer
values of the variable zb and solve the corresponding QPs. By comparing
the 2sb optimal costs one can derive the optimizer and the optimal cost of
the MIQP.

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 47 / 59


Mixed Integer Quadratic Programming

Denote by J ∗ the optimal value and by Z ∗ the set of optimizers of problem

Case 1. The MIQP solution is unbounded, i.e., J ∗ = −∞. This cannot


happen if H ≻ 0.

Case 2. The MIQP solution is bounded, i.e., J ∗ > −∞ and the


optimizer is unique. Z ∗ is a singleton.

Case 3. The MIQP solution is bounded and there are infinitely many
optima corresponding to the same integer value. subset of Rs
and an integer number zb∗ . This cannot happen if H ≻ 0.

Case 4. The MIQP solution is bounded and there are finitely many
optima corresponding to different integer values.

Case 5. The union of Case 3 and Case 4.

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 48 / 59


MPC for Hybrid Systems. General Formulation
Consider the CFTOC problem:

N
X −1
J ∗ (xt|t ) = min ℓN (xt+N |t ) + ℓ(xt+k|t , ut+k|t , δt+k|t , zt+k|t ),
U
k=0


 xt+k+1|t = Axt+k|t + B1 ut+k|t + B2 δt+k|t + B3 zt+k|t



s.t. E2 δt+k|t + E3 zt+k|t ≤ E4 xt+k|t + E1 ut+k|t + E5




xt+N |t ∈ Xf

where x ∈ Rnc × {0, 1}nb , u ∈ Rmc × {0, 1}mb , y ∈ Rpc × {0, 1}pb , δ ∈ {0, 1}rb
and z ∈ Rrc and  T
U = uTt|t uTt+1|t . . . uTt+N −1|t

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 49 / 59


MPC for Hybrid Systems. 2-norm Case
The final and stage costs become

ℓN (x) = kP xk2
ℓ(x, u, δ, z) = kQx xk2 + kQu uk2 + kQδ δk2 + kQz zk2

Use the substitution:


k−1
X
xt+k|t = Ak xt|t +
 j
A (B1 ut+k−j−1|t +
j=0

+B2 δt+k−j−1|t + B3 zt+k−j−1|t )

Introduce the optimization vector:


T
ξ = U T , δt|t , . . . , δt+N −1|t , zt|t , . . . , zt+N −1|t


Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 50 / 59


MPC for Hybrid Systems. 2-norm Case

Written in a more compact form, the problem becomes:

min kH1 ξk2 + ξ T H2 xt|t + kH3 xt|t k2 + cT1 ξ + c2 xt|t ,


ξ

s. t. Gξ ≤ W + Sxt|t

On-line optimization problem:


Mixed-Integer Quadratic Program (MIQP)

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 51 / 59


MPC for Hybrid Systems. 2 Norm Case

Theorem
The solution to the CFTOC problem based on MLD model and with the cost
based on quadratic norm is time-varying PWA feedback law of the form:

u∗t (xt ) = Fti xt + Git if xt ∈ Rik

 Rt
where Rit i=1 are regions partitioning the set of feasible states Xt∗ and the
closure R̄ik of the sets Rik has the following form:

R̄ik , x : x(k)′ L(j)ik x(k) + M (j)ik x(k) ≤ N (j)ik , j = 1, . . . , nik ,




k = 0, . . . , N − 1.

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 52 / 59


MPC for Hybrid Systems. 2 Norm Case
N
Denote by {vi }si=1 the set of all possible switching sequences over the
horizon N

Fix a certain vi and constrain the state to switch according to the


sequence vi .

The problem becomes a CFTOC for a linear time-varying system.


The solution is

ui (x(0)) = F̃ i,j x(0) + g̃ i,j , ∀x(0) ∈ T i,j , j = 1, . . . , N r i


SN r i
where Di = j=1 T i,j

SsN
The set X0 = i=1 Di in general is not convex.

The sets Di can, in general, overlap. I.e., some initial state is feasible
for more switching sequences.

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 53 / 59


MPC for Hybrid Systems. 2 Norm Case
If T i,j ∩ T l,m = ∅ for all l 6= i, l = 1, . . . , sN , m = 1, . . . , N r l , then vi is
the only feasible sequence and

u∗ (x(0)) = F̃ i,j x(0) + g̃ i,j , ∀x ∈ T i,j .


If T i,j intersects one or more polyhedra T l1 ,m1 ,T l2 ,m2 the states therein
are feasible also for the sequences vi , vl1 , vl2 .
Compare the value functions Jv∗i (x(0)), Jv∗l1 (x(0)),Jv∗l2 (x(0)).
 i,j
 F̃ x(0) + g̃ i,j ,
∀x(0) ∈ T (i,j),(l,m) : Jv∗i (x(0)) < Jv∗l (x(0))








 F̃ l,m x(0) + g̃ l,m ,



u (x(0)) = ∀x(0) ∈ T (i,j),(l,m) : Jv∗i (x(0)) > Jv∗l (x(0))


  i,j
F̃ x(0) + g̃ i,j or




F̃ l,m x(0) + g̃ l,m




 (i,j),(l,m) ∗ ∗
∀x(0) ∈ T : Jvi (x(0)) = Jvl (x(0))

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 54 / 59


MPC for Hybrid Systems. 1, ∞-norm Case
The final and stage costs become

ℓN (x) = kP xk1,∞
ℓ(x, u, δ, z) = kQx xk1,∞ + kQu uk1,∞ + kQδ δk1,∞ + kQz zk1,∞
Introduce decision variables to model ∞-norm:
−1n εxt+k|t ≤ ±Qx xt+k|t
−1m εut+k|t ≤ ±Qu ut+k|t
−1rb εδt+k|t ≤ ±Qδ δt+k|t
−1rc εzt+k|t ≤ ±Qz zt+k|t
−1n εxt+N |t ≤ ±P xt+N |t ,
where k = 0, . . . , N − 1, n = nc + nb , m = mc + mb .
Introduce the optimization vector:
h
ξ = U T , εxt|t , . . . , εxt+N |t , εut|t , . . . , εut+N −1|t ,
iT
εδt|t , . . . , εδt+N −1|t , εzt|t , . . . , εzt+N −1|t

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 55 / 59


MPC for Hybrid Systems. 1, ∞-norm Case
Written in a more compact form, the problem becomes:
N
X −1
min εxt+N |t + (εxt+N |t + εδt+N |t + εzt+k|t + εut+k|t )
ξ
k=0

s. t. Gξ ≤ W + Sxt|t

On-line optimization problem:


Mixed-Integer Linear Program (MILP)

Receding Horizon Policy


given xt|t solve MILP/MIQP and obtain the optimizer vector ξ ∗ ⇒
extract u∗t|t and apply it to the plant
stability ⇒ general stability theory for MPC with receding horizon
◮ terminal state constraint xN|t = 0
◮ xN|t inside an invariant set around the origin

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 56 / 59


MPC for Hybrid Systems. 1, ∞-norm Case

Theorem
The solution to the CFTOC problem based on MLD model and with the cost
based on norms {1, ∞} is time-varying PPWA feedback law of the form:

u∗t (xt ) = Fti xt + Git if xt ∈ Rik

 Rt
where Rit i=1 are polyhedral regions partitioning the set of feasible states Xt∗ .

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 57 / 59


MPC for Hybrid Systems - Complexity

the complexity strongly depends on the problem structure and the initial
setup
in general:
Mixed-Integer programming is HARD

efficient general purpose solvers for MILP/MIQP: CPLEX, XPRESS-MP ⇒


based on Branch-And-Bound , Branch-And-Cut methods + a lot of
heuristics
on-line optimization is good for applications allowing large sampling
intervals (tipically minutes ), requires expensive hardware and (even
more) expensive software
for problems requiring fast sampling rate ⇒ explicit solution of the MPC

Francesco Borrelli (UC Berkeley) Hybrid Systems April 25, 2011 58 / 59


MPC for Hybrid Systems - Example
   
cos αt − sin αt 0

 xt+1 = 0.8 xt + u(k)
sin α cos α 1



  t h t
i




 π/3 if 1 0 xt ≥ 0,
αt = h i
 −π/3 if 1 0 xt < 0

    



 xt ∈ −10, 10 × −10, 10 ,

  
ut ∈ −1, 1

N = 12, PN = Qx = I, Qu = 1, ∞ − norm
Controller partition with 252 regions
Value of the control action U over 252 regions
1 10

4
1
2
u∗ (x)

0.5
x2

0
0
−2

−0.5 −4
10

−1 5 −6
10 0
5 −8
0 −5
−5 x1
−10 −10 −10
−10 −8 −6 −4 −2 0 2 4 6 8 10
Francesco Borrelli (UC x 2
Berkeley) Hybrid Systems x April 25, 2011 59 / 59

You might also like