ece7850: hybrid systems:theory and applications lecture

43
ECE7850: Hybrid Systems:Theory and Applications Lecture Note 9: Model Predictive Control of Linear and Hybrid Systems: Basic Formulation and Algorithms Wei Zhang Assistant Professor Department of Electrical and Computer Engineering Ohio State University, Columbu, Ohio, USA Spring 2017 Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 1 / 43

Upload: others

Post on 29-Apr-2022

18 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ECE7850: Hybrid Systems:Theory and Applications Lecture

ECE7850: Hybrid Systems:Theory and Applications

Lecture Note 9: Model Predictive Control ofLinear and Hybrid Systems: Basic Formulation

and Algorithms

Wei Zhang

Assistant ProfessorDepartment of Electrical and Computer Engineering

Ohio State University, Columbu, Ohio, USA

Spring 2017

Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 1 / 43

Page 2: ECE7850: Hybrid Systems:Theory and Applications Lecture

Outline

• Formulation of General MPC Problems

• Linear MPC Problems

• Linear MPC Example: Cessna Citation Aircraft

• Discrete-Time Hybrid System Models

• MPC of Hybrid Systems

This lecture was developed based on [BBM17; Bem; BJM] with the help of Hao LiLecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 2 / 43

Page 3: ECE7850: Hybrid Systems:Theory and Applications Lecture

MPC Formulation: System Model

• General discrete-time nonlinear systems:{x(t+ 1) = f(x(t), u(t))

y(t) = h(x(t))t ∈ Z+ (1)

• State and Control constraints:

x(t) ∈ X u(t) ∈ U (2)

- In general, X ⊂ Rn ×Q and U ⊂ Rm × Σ have both continuous and discretecomponents.

• For simplicity, we assume full state information is available (e.g. y(t) = x(t)or h(·) is bijection). Output tracking will be discussed later in this class.

Formulation of General MPC Problems Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 3 / 43

Page 4: ECE7850: Hybrid Systems:Theory and Applications Lecture

MPC Formulation: Online Optimization Problem

• At time t: solve the following N -horizon optimal control problem:

PN (x(t)) : VN (x(t)) =

minU0 JN (x(t), U0) , Jf (xN ) +∑N−1

k=0 l(xk, uk)

subj. to: xk+1 = f(xk, uk), k = 0, . . . , N − 1

xk ∈ X , uk ∈ U , k = 0, . . . , N − 1

xN ∈ Xf , x0 = x(t)

(3)

• U0 = (u0, u1, . . . , uN−1): overall control vector

• Xf ⊆ X : terminal state constraint set

• Assume nonnegative cost functions: Jf : X → R+ and l : X × U → R+

• Given x(t) at time t, optimal control sequence u∗0, . . . , u∗N−1 can be found

via numerical optimization

Formulation of General MPC Problems Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 4 / 43

Page 5: ECE7850: Hybrid Systems:Theory and Applications Lecture

MPC Formulation: Receding Horizon Implementation

• At time t, solves an N -horizon optimal control problem (3)

• Apply the first step of the optimal control sequence

• At time t+ 1, horizon is shifted and the optimal control problem is solvedagain using newly obtained state information

Formulation of General MPC Problems Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 5 / 43

Page 6: ECE7850: Hybrid Systems:Theory and Applications Lecture

Remarks

• Problem (3) can also be solved using dynamic programming, leading tooptimal control laws{

Vj = T [Vj−1], with V0 = Jf , (value iteration)

µ∗j (z) = argminu∈U(z){l(z, u) + Vj−1(f(z, u))}, j = 1, . . . , N

• At any time t, if the state is x(t), then MPC controller will applyut = µ∗N

(x(t))

• Finding optimal control sequence {u∗k} is much easier than finding theoptimal control laws µ∗j (·)

• Why we care about {µ∗j (·)}?- For some cases, µ∗j (z) may have appealing analytical structures that can simplify

the “online” computation for {u∗k} (e.g.: explicit MPC)

- Enable various analysis for feasibility, performance, and stability of MPC

Formulation of General MPC Problems Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 6 / 43

Page 7: ECE7850: Hybrid Systems:Theory and Applications Lecture

Main Topics of MPC

• Computational Issues:

- Standard MPC forms and their online optimization algorithms (this lecture)

- Explicit MPC: solve the optimal MPC control law offline to simply onlinecomputation (will be discussed later this semester)

• Theoretical Issues (will be discussed later this semester)

- Recursive feasibility

- Closed-loop stability

• Other topics (will not be covered in this class)

- Distributed MPC

- Stochastic MPC

- Embedded MPC

-...

Formulation of General MPC Problems Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 7 / 43

Page 8: ECE7850: Hybrid Systems:Theory and Applications Lecture

Outline

• Formulation of General MPC Problems

• Linear MPC Problems

• Linear MPC Example: Cessna Citation Aircraft

• Discrete-Time Hybrid System Models

• MPC of Hybrid Systems

Linear MPC Problems Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 8 / 43

Page 9: ECE7850: Hybrid Systems:Theory and Applications Lecture

MPC of Linear Systems

• Linear MPC problem: linear dynamical system + polyhedral state/controlconstraints + convex cost functions

• At time t: solve the following N -horizon optimal control problem:

PN (x(t)) : VN (x(t)) =

minU0

JN (x(t), U0) , Jf (xN ) +∑N−1

k=0 l(xk, uk)

subj. to: xk+1 = Axk +Buk, k = 0, . . . , N − 1

Axxk ≤ bx, Auuk ≤ bu, k = 0, . . . , N − 1

AfxN ≤ bf , x0 = x(t)

(4)

• Cost functions JN (x(t), U0): 2-norm, 1-norm, ∞-norm:

- 2-norm: xTNQfxN +∑N−1

k=0

(xTkQxk + uT

kRuk

)

- 1/∞-norm: ‖QfxN‖p +∑N−1

k=0 (‖Qxk‖p + ‖Ruk‖p), p = 1,∞, Q,Qf , R are fullcolumn rank matrices

- Recall: ‖x‖1 =∑i

|xi| and ‖x‖∞ = maxi |xi|

Linear MPC Problems Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 9 / 43

Page 10: ECE7850: Hybrid Systems:Theory and Applications Lecture

Batch Formulation of Linear MPC I

• Vector form of prediction model over N horizon:x(t)x1......xN

︸ ︷︷ ︸

X

=

IA......AN

︸ ︷︷ ︸Sx

x(t) +

0 · · · · · · 0B 0 · · · 0

AB. . .

. . ....

.... . .

. . ....

AN−1B · · · · · · B

︸ ︷︷ ︸

Su

u0......

uN−1

︸ ︷︷ ︸

U0

(5)

• Define X = Sxx(t) + SuU0

• 2-norm cost function becomes: JN (x(t), U0) = XT QX + U0T RU0,

- Q , diag{Q, . . . , Q,Qf}, Q � 0

- R , diag{R, . . . , R}, R � 0

Linear MPC Problems Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 10 / 43

Page 11: ECE7850: Hybrid Systems:Theory and Applications Lecture

Batch Formulation of Linear MPC II• Substituting the expression of X:

JN (x(t), U0) = (Sxx(t) + SuU0)T Q(Sxx(t) + SuU0) + U0T RU0

= U0T ((Su)T QSu + R)︸ ︷︷ ︸

H

U0 + 2xT (t)(Sx)T QSu︸ ︷︷ ︸F

U0 + xT (t)((Sx)T QSx)︸ ︷︷ ︸Y

x(t)

= U0THU0 + 2xT (t)FU0 + xT (t)Y x(t)

=[UT0 , x(t)T

] [H FT

F Y

] [U0

x(t)

]

• Polyhedral constraints can be reduced to:

G0U0 ≤ w0 + E0x(t)

where G0, w0, E0, x(t) are known matrices/vectors at time t.

Linear MPC Problems Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 11 / 43

Page 12: ECE7850: Hybrid Systems:Theory and Applications Lecture

Batch Formulation of Linear MPC III• PN (x(t)) boils down to a quadratic programming (QP) problem:

VN (x(t)) =

minU0 JN (x(t), U0) =[UT

0 , x(t)T][H FT

F Y

][U0

x(t)

]

subj. to G0U0 ≤ w0 + E0x(t)

(6)

- Whenever H � 0, the above QP with affine constraints is a special convexoptimization problem, which can be solved very efficiently

- Optimization variable is U0; all parameters are known and constant;

- x(t) is the measured state at each time t, which is also known before solving theQP.

- MATLAB quadratic programming function: quadprog

Linear MPC Problems Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 12 / 43

Page 13: ECE7850: Hybrid Systems:Theory and Applications Lecture

Outline

• Formulation of General MPC Problems

• Linear MPC Problems

• Linear MPC Example: Cessna Citation Aircraft

• Discrete-Time Hybrid System Models

• MPC of Hybrid Systems

Linear MPC Example Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 13 / 43

Page 14: ECE7850: Hybrid Systems:Theory and Applications Lecture

Linear MPC Example: Cessna Citation Aircraft

Example 1 (Cessna Citation Aircraft).

Linearized continuous-time model: (at altitude of 5000m and a speed of 128.2 m/sec)

x =

−1.2822 0 0.98 0

0 0 1 0−5.4293 0 −1.8366 0−128.2 128.2 0

x+

−0.3

0−17

0

uy =

[0 1 0 00 0 0 1

]x

• Input: elevator angle

• States: x1: angle of attack, x2: pitch angle,x3: pitch rate, x4: altitude

• Outputs: pitch angle and altitude

• Constraints: elevator angle ±0.262rad(±15◦), elevator rate ±0.349 rad/s (±20◦/s),pitch angle ±0.650 rad (±37◦)

• Open-loop response is unstable (open-loop poles: 0, 0, 1.5594± 2.29i)

Linear MPC Example Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 14 / 43

Page 15: ECE7850: Hybrid Systems:Theory and Applications Lecture

Linear MPC Example: LQR vs. MPC with Quadratic Cost

• Quadratic cost

• Linear system dynamics

• Linear constraints on inputs and states

LQR

V ∗(x(t)) = minu

∞∑

k=0

(xTt Qxt + uTkRuk)

s.t. xk+1 = Axk +Buk

x0 = x(t)

MPC

V ∗N (x(t)) = minu

N−1∑

k=0

(xTt Qxt + uTkRuk)

s.t. xk+1 = Axk +Buk

xk ∈ X , uk ∈ Ux0 = x(t)

• Assume: Q = QT � 0, R = RT � 0

Linear MPC Example Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 15 / 43

Page 16: ECE7850: Hybrid Systems:Theory and Applications Lecture

Linear MPC Example: LQR with SaturationLinear quadratic regulator with saturated inputs.

At time t = 0 the plane is flying with a deviation of10m of the desired altitude, i.e. x0 = [0; 0; 0; 10]

0 1 2 3 4 5 6 7 8 9 10

Time(seconds)

-300

-200

-100

0

100

200

300

Alti

tude

x4 (

m)

-2

-1

0

1

2

Pitc

h an

gle

x2 (

rad)

0 1 2 3 4 5 6 7 8 9 10

Time(seconds)

-0.5

0

0.5

Ele

vato

r an

gle

u (r

ad)

Problem parameters:Sampling time 0.25sec,Q = I , R = 10

Closed-loop system is unsta-ble

Applying LQR control andsaturating the controller canlead to instability!

Linear MPC Example Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 16 / 43

Page 17: ECE7850: Hybrid Systems:Theory and Applications Lecture

Linear MPC Example: MPC with Input Bound ConstraintsMPC controller with input constraints |ui| ≤ 0.262

0 1 2 3 4 5 6 7 8 9 10

Time(seconds)

-150

-100

-50

0

50

100

150

Alti

tude

x4 (

m)

-1.5

-1

-0.5

0

0.5

1

1.5

Pitc

h an

gle

x2 (

rad)

0 1 2 3 4 5 6 7 8 9 10

Time(seconds)

-0.5

0

0.5

Ele

vato

r an

gle

u (r

ad)

Problem parameters:Sampling time 0.25sec,Q = I , R = 10, N = 10

The MPC controller uses theknowledge that the elevatorwill saturate, but it does notconsider the rate constraints.

⇒System does not convergeto desired steady-state but toa limit cycle

Linear MPC Example Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 17 / 43

Page 18: ECE7850: Hybrid Systems:Theory and Applications Lecture

Linear MPC Example: MPC with all Input ConstraintsMPC controller with input constraints |ui| ≤ 0.262and rate constraints |ui| ≤ 0.349, approximated by|uk − uk−1| ≤ 0.349Ts

0 1 2 3 4 5 6 7 8 9 10

Time(seconds)

-20

-10

0

10

20

Alti

tude

x4 (

m)

-0.3

-0.2

-0.1

0

0.1

0.2

Pitc

h an

gle

x2 (

rad)

0 1 2 3 4 5 6 7 8 9 10

Time(seconds)

-0.2

-0.1

0

0.1

0.2

Ele

vato

r an

gle

u (r

ad)

Problem parameters:Sampling time 0.25sec,Q = I , R = 10, N = 10

The MPC controller con-siders all constraints on theactuator

Closed-loop system is stable

Efficient use of the controlauthority

Linear MPC Example Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 18 / 43

Page 19: ECE7850: Hybrid Systems:Theory and Applications Lecture

Linear MPC Example: Inclusion of State ConstraintsMPC controller with input constraints |ui| ≤ 0.262and rate constraints |ui| ≤ 0.349, approximated by|uk − uk−1| ≤ 0.349Ts

0 1 2 3 4 5 6 7 8 9 10

Time(seconds)

-150

-100

-50

0

50

100

150

Alti

tude

x4 (

m)

-1

-0.5

0

0.5

1

Pitc

h an

gle

x2 (

rad)

0 1 2 3 4 5 6 7 8 9 10

Time(seconds)

-0.5

0

0.5

Ele

vato

r an

gle

u (r

ad)

Pitch angle 0.9, i.e. -52°

Problem parameters:Sampling time 0.25sec,Q = I , R = 10, N = 10

Increase step :At time t = 0 the plane is fly-ing with a deviation of 100mof the desired altitude, i.e.x0 = [0; 0; 0; 100]

• Pitch angle too largeduring transient

Linear MPC Example Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 19 / 43

Page 20: ECE7850: Hybrid Systems:Theory and Applications Lecture

Linear MPC Example: Inclusion of State ConstraintsMPC controller with input constraints |ui| ≤ 0.262and rate constraints |ui| ≤ 0.349, approximated by|uk − uk−1| ≤ 0.349Ts

0 1 2 3 4 5 6 7 8 9 10

Time(seconds)

-150

-100

-50

0

50

100

150

Alti

tude

x4 (

m)

-1

-0.5

0

0.5

1

Pitc

h an

gle

x2 (

rad)

0 1 2 3 4 5 6 7 8 9 10

Time(seconds)

-0.5

0

0.5

Ele

vato

r an

gle

u (r

ad)

Constraint on pitch angle active

Problem parameters:Sampling time 0.25sec,Q = I , R = 10, N = 10

Add state constraints for pas-

senger comfort:

|x2| ≤ 0.650

Linear MPC Example Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 20 / 43

Page 21: ECE7850: Hybrid Systems:Theory and Applications Lecture

Outline

• Formulation of General MPC Problems

• Linear MPC Problems

• Linear MPC Example: Cessna Citation Aircraft

• Discrete-Time Hybrid System Models

• MPC of Hybrid Systems

DT Hybrid System Models Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 21 / 43

Page 22: ECE7850: Hybrid Systems:Theory and Applications Lecture

Discrete-Time Hybrid System Models

• Conceptual ideas of MPC can be applied to all kinds of nonlinear systems.However, to make Problem (3) numerically tractable, model structure mustbe selected very carefully

• We will discuss three classes of discrete-time hybrid system models

- (Discrete-Time) Piecewise Affine Systems (PWA)

- Discrete Hybrid Automaton (DHA)

- (Linear) Mixed Logical Dynamical (MLD) Systems

• The three models are (“almost”) equivalent, but each of them has differentadvantages.

- PWA and DHA are more convenient than MDL in modeling real worldapplications

- PWA is suitable for analysis and explcit MPC

- MLD is more convenient to use for online optimization

DT Hybrid System Models Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 22 / 43

Page 23: ECE7850: Hybrid Systems:Theory and Applications Lecture

Discrete-Time Piecewise Affine Systems (PWA)

Piecewise affine (PWA) systems

x(t+ 1) = Ai(t)x(t) +Bi(t)u(t) + f i(t)

y(t) = Ci(t)x(t) +Di(t)u(t) + gi(t)

Hi(t)x(t) + J i(t)u(t) ≤ Ki(t)

• state: x(t) ∈ Rn

• control: u(t) ∈ Rm

• output: y(t) ∈ Rp

• mode: i(t) ∈ L , {1, . . .M}

17.2 Piecewise Affine Systems 359

C7

C4

C2

C1

C3

C6

C5

x-space

Figure 17.2 Piecewise affine (PWA) systems. Mode switches are triggeredby linear threshold events.

where x(t) ∈ Rn is the state vector at time t ∈ T and T = {0, 1, . . .} is the set ofnonnegative integers, u(t) ∈ Rm is the input vector, y(t) ∈ Rp is the output vector,i(t) ∈ I = {1, . . . , s} is the current mode of the system, the matrices Ai(t), Bi(t),f i(t), Ci(t), Di(t), gi(t), Hi(t), J i(t), Ki(t) are constant and have suitable dimensions,and the inequalities in (17.1c) should be interpreted component-wise. Each linearinequality in (17.1c) defines a half-space in Rn and a corresponding hyperplane,that will be also referred to as guardline. Each vector inequality (17.1c) defines apolyhedron Ci = {[ xu ] ∈ Rn+m : Hix+ J iu ≤ Ki} in the state+input space Rn+m

that will be referred to as cell, and the union of such polyhedral cells as partition.We assume that Ci are full-dimensional sets of Rn+m, for all i = 1, . . . , s.

A PWA system is called well-posed if it satisfies the following property [37]:

Definition 17.1 Let P be a PWA system of the form (17.1) and let C = ∪si=1Ci ⊆Rn+m be the polyhedral partition associated with it. System P is called well-posedif for all pairs (x(t), u(t)) ∈ C there exists only one index i(t) satisfying (17.1).

Definition 17.1 implies that x(t+1), y(t) are single-valued functions of x(t) and u(t),and therefore that state and output trajectories are uniquely determined by theinitial state and input trajectory. A relaxation of definition 17.1 is to let polyhedralcells Ci share one or more hyperplanes. In this case the index i(t) is not uniquelydefined, and therefore the PWA system is not well-posed. However, if the mappings(x(t), u(t))→ x(t+ 1) and (x(t), u(t))→ y(t) are continuous across the guardlinesthat are facets of two or more cells (and, therefore, they are continuous on theirdomain of definition), such mappings are still single valued.

DT Hybrid System Models Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 23 / 43

Page 24: ECE7850: Hybrid Systems:Theory and Applications Lecture

Discrete Hybrid Automaton (DHA) I17.3 Discrete Hybrid Automata 365

E

1

s

y

vd

Fd

u v

S

Mx

u

d

i

...

!e(k)

!e(k)

!e(k)

u!(k)

u!(k)

x!(k)i(k)

xc(k)

uc(k)

uc(k)

Mode Selector (MS)

Finite State Machine(FSM)

EventGenerator (EG)

(SAS)

SwitchedAffineSystem

yc(k)

y!(k)

Figure 17.6 A discrete hybrid automaton (DHA) is the connection of a finitestate machine (FSM) and a switched affine system (SAS), through a modeselector (MS) and an event generator (EG). The output signals are omittedfor clarity

linear thresholds (the guardlines), (iii) exogenous discrete inputs [275]. We willdetail each of the four blocks in the next sections.

17.3.1 Switched Affine System (SAS)

A switched affine system is a collection of affine systems:

xc(t+ 1) = Ai(t)xc(t) +Bi(t)uc(t) + f i(t), (17.11a)

yc(t) = Ci(t)xc(t) +Di(t)uc(t) + gi(t), (17.11b)

where t ∈ T is the time indicator, xc ∈ Rnc is the continuous state vector, uc ∈ Rmc

is the exogenous continuous input vector, yc ∈ Rpc is the continuous output vector,{Ai, Bi, f i, Ci, Di, gi}i∈I is a collection of matrices of suitable dimensions, and themode i(t) ∈ I = {1, . . . , s} is an input signal that determines the affine state updatedynamics at time t. An SAS of the form (17.11) preserves the value of the statewhen a mode switch occurs, but it is possible to implement reset maps on an SASas shown in [275].

17.3.2 Event Generator (EG)

An event generator is an object that generates a binary vector δe(t) ∈ {0, 1}ne

of event conditions according to the satisfaction of a linear (or affine) threshold

• Discrete hybrid automaton (DHA): connection of a finite state machine(FSM) and a switched affine system (SAS), through a mode selector (MS)and an event generator (EG).

• Goal: Simplify model development for real engineering systems that involvecontinuous dynamics coupled with discrete logic rules.

DT Hybrid System Models Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 24 / 43

Page 25: ECE7850: Hybrid Systems:Theory and Applications Lecture

Discrete Hybrid Automaton (DHA) II• Switched Affine System (SAS):{

xc(t+ 1) = Ai(t)xc(t) +Bi(t)uc(t) + f i(t)

yc(t) = Ci(t)xc(t) +Di(t)uc(t) + gi(t)(7)

- xc ∈ Rnc : Continuous state

- uc ∈ Rmc : Continuous input

- yc ∈ Rpc : Continuous output

- i(t) ∈ L , {1, . . . s}: mode index at time t;

- Depending on the way of determining the mode index i(t), this SAS model mayinclude the PWA model as special cases. The mode i(t) can depends on partitioninformation. It is also possible to have multiple dynamic modes within certainpartitions

DT Hybrid System Models Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 25 / 43

Page 26: ECE7850: Hybrid Systems:Theory and Applications Lecture

Discrete Hybrid Automaton (DHA) III• Event Generator (EG):

Event generated by function of state and control input:

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

hi(xc, uc) =

{1 if Hixc + J iuc +Ki ≤ 0

0 if Hixc + J iuc +Ki > 0(9)

- δe(t) ∈ {0, 1}ne : event indicator variable; assume there are ne events

- Event is generated according to linear threshold conditions over continuousstates, continuous inputs, and time.

.

DT Hybrid System Models Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 26 / 43

Page 27: ECE7850: Hybrid Systems:Theory and Applications Lecture

Discrete Hybrid Automaton (DHA) IV• Finite State Machine (FSM): binary state of the finite state machine

evolves according to a Boolean state update function:{xl(t+ 1) = fl(xl(t), ul(t), δe(t))

yl(t) = gl(xl(t), ul(t), δe(t))(10)

- xl ∈ {0, 1}nl is the binary state

- ul ∈ {0, 1}ml is the exogenous binary input

- δe(t) is the endogenous binary input coming from the EG

DT Hybrid System Models Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 27 / 43

Page 28: ECE7850: Hybrid Systems:Theory and Applications Lecture

Discrete Hybrid Automaton (DHA) V• Mode Selector (MS)

i(t) = fM (xl(t), ul(t), δe(t)) (11)

where i(t) ∈ {0, 1}ns , nM = dlog2 se.

- The active mode i(k) is selected by a Boolean function of the current binarystates, binary inputs, and event variables

- Mode selector can be viewed as the output function of the discrete dynamics

DT Hybrid System Models Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 28 / 43

Page 29: ECE7850: Hybrid Systems:Theory and Applications Lecture

Discrete Hybrid Automaton (DHA) VI• DHA Trajectories:

For a given initial condition

[xc(0)xl(0)

]∈ Rnc × {0, 1}nl , and inputs[

uc(t)ul(t)

]∈ Rmc × {0, 1}ml , the state x(t) of the system evolves according

to:

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

i(t) = fM (xl(t), ul(t), δe(t))

yc(t) = Ci(t)xc(t) +Di(t)uc(t) + gi(t)

yl(t) = gl(xl(t), ul(t), δe(t))

xc(t+ 1) = Ai(t)xc(t) +Bi(t)uc(t) + f i(t)

xl(t+ 1) = fl(xl(t), ul(t), δe(t))

(12)

DT Hybrid System Models Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 29 / 43

Page 30: ECE7850: Hybrid Systems:Theory and Applications Lecture

From DHA to Mixed Logical Dynamical Systems

• DHA is convenient to use for modeling complex engineering systems.However, it is hard to directly use such model for MPC

• Goal: Transform DHA model in form compatible with optimization software

• Key ideas:

- Translation of logic rules into linear integer inequalities

- Translation of continuous/discrete dynamics into linear mixed-integer dynamicrelations

• Final outcome: Mixed Logical Dynamical Systems

- continuous and binary variables

- linear equalities and inequalities

DT Hybrid System Models Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 30 / 43

Page 31: ECE7850: Hybrid Systems:Theory and Applications Lecture

From Logic Statement into Inequalities I

• From Boolean statement to inequalities:

- Given Boolean variables X1, . . . , Xn and a Boolean statement:

f(X1, . . . , Xn) = TRUE

- Define a set of binary variables: {δi = 1} ↔ Xi = TRUE

- Find constant matrix/vector A and b such that

f(X1, . . . , Xn) = TRUE ⇔ Aδ ≤ b

• Step 1: Convert to Conjunctive Normal Form (CNF)

m∧j=1

∨i∈Pj

Xi

∨j∈Nj

¬Xi

= TRUE

Nj , Pj ⊆ {1, . . . n}

DT Hybrid System Models Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 31 / 43

Page 32: ECE7850: Hybrid Systems:Theory and Applications Lecture

From Logic Statement into Inequalities II• Step 2: Transform into inequalities:

Relation Boolean Linear InequalitiesAND δ1 ∧ δ2 δ1 ≥ 1, δ2 ≥ 1 and δ1 + δ2 ≥ 2OR δ1 ∨ δ2 δ1 + δ2 ≥ 1

NOT ¬δ1 (1− δ1) ≥ 1 and δ1 = 0XOR δ1

⊕δ2 δ1 + δ2 = 1

IMPLY δ1 → δ2 δ1 − δ2 ≤ 0IFF δ1 ↔ δ2 δ1 − δ2 = 0

- In general, the polytope P = {δ : Aδ ≤ b} defined by the linear inequalities is theconvex hull of the rows of the truth table associated with the Boolean formulaf(X1, . . . , XN )

DT Hybrid System Models Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 32 / 43

Page 33: ECE7850: Hybrid Systems:Theory and Applications Lecture

From Logic Statement into Inequalities III• For mixed continuous/Boolean conditions: Use Big-M technique

• IF-AND-ONLY-IF condition: [δ = 1]↔ [aTxc − b ≤ 0], xc ∈ X andδ ∈ {0, 1}

- Assume X is bounded and let M and m be constants such that

M > aTxc − b > m, ∀xc ∈ X

- The IF-AND-ONLY-IF condition is equivalent to

{aTxc − b ≤M(1− δ)aTxc − b > mδ

DT Hybrid System Models Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 33 / 43

Page 34: ECE7850: Hybrid Systems:Theory and Applications Lecture

From Logic Statement into Inequalities IV• IF-THEN-ELSE condition: e.g.:

z =

{aT1 xc + f1 if δ = 1

aT2 xc + f2 otherwise

- Assume X is bounded and let M1,M2,m1,m2 be constants such that

M1 > aT1 xc + f1 > m1 and M2 > aT2 xc + f2 > m2, ∀xc ∈ X

- The IF-THEN-ELSE condition is equivalent to in

(m1 −M2)(1− δ) + z ≤ aT1 xc + f1

(m2 −M1)(1− δ)− z ≤ −aT1 xc − f1(m2 −M1)δ + z ≤ aT2 xc + f2

(m1 −M2)δ − z ≤ −aT2 xc − f2

DT Hybrid System Models Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 34 / 43

Page 35: ECE7850: Hybrid Systems:Theory and Applications Lecture

Summary: From DHA to MDL Model I

Proposition 1.

Any logic formula involving Boolean variables and linear combinations ofcontinuous variables can be translated into a set of (mixed-)integer linear(in)equalities

• FSM and Mode selector: any logic statement f(X) = TRUE can be writtenm∧

j=1

(∨i∈Pj

Xi ∨j∈Nj¬Xi

)Nj , Pj ⊆ {1, . . . n}

i∈P1δi +

∑i∈N1

(1− δi) ≥ 1

...∑i∈Pm

δi +∑

i∈Nm(1− δi) ≥ 1

• Event generator: [δie(t) = 1]↔ [Hixc(t) ≤W i] ⇒{Hixc(t)−W i ≤M(1− δie)

Hixc(t)−W i > miδie

• Switched affine system:

{if [δ = 1] then z = aT1 x+ bT1 u+ f1

else z = aT2 x+ bT2 u+ f2⇒

(m2 −M1)δ + z ≤ aT2 x+ bT2 u+ f2

(m1 −M2)δ − z ≤ −aT2 x− bT2 u− f2(m1 −M2)(1− δ) + z ≤ aT1 x+ bT1 u+ f1

(m2 −M1)(1− δ)− z ≤ −aT1 x− bT1 u− f1

DT Hybrid System Models Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 35 / 43

Page 36: ECE7850: Hybrid Systems:Theory and Applications Lecture

Summary: From DHA to MDL Model II• All DHA blocks can be translated into (mixed)integer linear equalities and

inequalities

• This leads to the so-called Mixed Logical Dynamical (MLD) Systemx(t+ 1) = Ax(t) +B1u(t) +B2δ(t) +B3z(t) +B5

y(t) = Cx(t) +D1u(t) +D2δ(t) +D3z(t) +D5

E2δ(t) + E3z(t) ≤ E1u(t) + E4x(t) + E5

(13)

x ∈ Rnc × {0, 1}nl , u ∈ Rmc × {0, 1}ml , y ∈ Rpc × {0, 1}pl , δ ∈ {0, 1}rl , z ∈ Rrc

Theorem 1.

MLD and PWA are equivalent in the sense that given a MLD (resp. PWA), one canalways find a corresponding PWA (resp. MLD) model which produces the same outputunder the same initial state and control inputs.

DT Hybrid System Models Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 36 / 43

Page 37: ECE7850: Hybrid Systems:Theory and Applications Lecture

HYbrid System DEscription Language (HYSDEL)

• HYSDEL Modeling Language: A modeling language describing DHA models

376 17 Models of Hybrid Systems

SYSTEM sample {INTERFACE {STATE {

REAL xr [-10, 10]; }INPUT {

REAL ur [-2, 2]; }}IMPLEMENTATION {AUX {

REAL z1, z2, z3;BOOL de, df, d1, d2, d3; }

AD {de = xr >= 0;df = xr + ur - 1 >= 0; }

LOGIC {d1 = ~de & ~df;d2 = de;d3 = ~de & df; }

DA {z1 = {IF d1 THEN xr + ur - 1 };z2 = {IF d2 THEN 2 * xr };z3 = {IF (~de & df) THEN 2 }; }

CONTINUOUS {xr = z1 + z2 + z3; }

}}

Table 17.2 Sample HYSDEL list of system (17.32)

the technique presented in Section 17.4, and PWA form using either the approachof [116] or the approach of [28]. HYSDEL can generate also a simulator that runs asa function in MATLABTM. Both the HYSDEL compiler and the Hybrid Toolboxcan import and convert HYSDEL models.

In this section we illustrate the functionality of HYSDEL through a set ofexamples. For more examples and the detailed syntax we refer the interestedreader to [146].

Example 17.6 Consider the DHA system:

SAS: x′c(t) =

xc(t) + uc(t)− 1, if i(t) = 1,2xc(t), if i(t) = 2,2, if i(t) = 3,

(17.32a)

EG:

{δe(t) = [xc(t) ≥ 0],δf (t) = [xc(t) + uc(t)− 1 ≥ 0],

(17.32b)

MS: i(t) =

1, if[

δe(t)δf (t)

]= [ 00 ] ,

2, if δe(t) = 1,

3, if[

δe(t)δf (t)

]= [ 01 ] .

(17.32c)

The corresponding HYSDEL list is reported in Table 17.2.

The HYSDEL list is composed of two parts. The first one, called INTERFACE,contains the declaration of all variables and parameters, so that it is possible tomake the proper type checks. The second part, IMPLEMENTATION, is composedof specialized sections where the relations among the variables are described. Thesesections are described next.

374 17 Models of Hybrid Systems

SYSTEM sample {INTERFACE {STATE {

REAL xr [-10, 10]; }INPUT {

REAL ur [-2, 2]; }}IMPLEMENTATION {AUX {

REAL z1, z2, z3;BOOL de, df, d1, d2, d3; }

AD {de = xr >= 0;df = xr + ur - 1 >= 0; }

LOGIC {d1 = ~de & ~df;d2 = de;d3 = ~de & df; }

DA {z1 = {IF d1 THEN xr + ur - 1 };z2 = {IF d2 THEN 2 * xr };z3 = {IF (~de & df) THEN 2 }; }

CONTINUOUS {xr = z1 + z2 + z3; }

}}

Table 17.2 Sample HYSDEL list of system (17.32)

the technique presented in Section 17.4, and PWA form using either the approachof [118] or the approach of [29]. HYSDEL can generate also a simulator that runs asa function in MATLABTM. Both the HYSDEL compiler and the Hybrid Toolboxcan import and convert HYSDEL models.

In this section we illustrate the functionality of HYSDEL through a set ofexamples. For more examples and the detailed syntax we refer the interestedreader to [148].

Example 17.6 Consider the DHA system:

SAS: x′c(t) =

xc(t) + uc(t)− 1, if i(t) = 1,2xc(t), if i(t) = 2,2, if i(t) = 3,

(17.32a)

EG:

{δe(t) = [xc(t) ≥ 0],δf (t) = [xc(t) + uc(t)− 1 ≥ 0],

(17.32b)

MS: i(t) =

1, if[

δe(t)δf (t)

]= [ 00 ] ,

2, if δe(t) = 1,

3, if[

δe(t)δf (t)

]= [ 01 ] .

(17.32c)

The corresponding HYSDEL list is reported in Table 17.2.

The HYSDEL list is composed of two parts. The first one, called INTERFACE,contains the declaration of all variables and parameters, so that it is possible tomake the proper type checks. The second part, IMPLEMENTATION, is composedof specialized sections where the relations among the variables are described. Thesesections are described next.

• Freely available http://control.ee.ethz.ch/~cohysys/hysdel/

• The tool can automatically generate equivalent MDL model in MATLAB

DT Hybrid System Models Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 37 / 43

Page 38: ECE7850: Hybrid Systems:Theory and Applications Lecture

Outline

• Formulation of General MPC Problems

• Linear MPC Problems

• Linear MPC Example: Cessna Citation Aircraft

• Discrete-Time Hybrid System Models

• MPC of Hybrid Systems

MPC of Hybrid Systems Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 38 / 43

Page 39: ECE7850: Hybrid Systems:Theory and Applications Lecture

MPC of Hybrid Systems: 2-Norm Case

• At each time t, obtain state x(t) and solve the following optimizationproblem:{

minU0J(x(t), U0) = xTNQfxN +

∑N−1k=0

(xTkQxk + uTkRuk

)subj. to. MLD (13)

(14)

• The above optimization problem can be reduced tominξ

ξTHξ + 2x(t)TFξ + x(t)TY x(t)

subj. to Gξ ≤W + Sx(t)(15)

where ξ = {u0, . . . , uN−1, δ0, . . . , δN−1, z0, . . . , zN−1}.

• This is Mixed Integer Quadratic Programming (MIQP) problem.

MPC of Hybrid Systems Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 39 / 43

Page 40: ECE7850: Hybrid Systems:Theory and Applications Lecture

MPC of Hybrid Systems: ∞-Norm Case I

• At each time t, obtain state x(t) and solve the following optimizationproblem: {

minU0J(x(t), U0) =

∑N−1k=0 (‖Qxk‖∞ + ‖Ruk‖∞)

subj. to. MLD (13)(16)

• Introduce slack variables:

{εxk ≥ ‖Qxk‖∞εuk ≥ ‖Ruk‖∞

εxk ≥ [Qxk]i, i = 1, . . . , n k = 1, . . . , N − 1

εxk ≥ −[Qxk]i i = 1, . . . , n k = 1, . . . , N − 1

εuk ≥ [Ruk]i i = 1, . . . ,m k = 1, . . . , N − 1

εuk ≥ −[Ruk]i i = 1, . . . ,m k = 1, . . . , N − 1

MPC of Hybrid Systems Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 40 / 43

Page 41: ECE7850: Hybrid Systems:Theory and Applications Lecture

MPC of Hybrid Systems: ∞-Norm Case II• The problem reduces to an optimization problem of the following form:min

ξ

N−1∑k

εxk + εuk

subj. to Gξ ≤W + Sx(t)

(17)

whereξ = {εx1 , . . . , εxN−1, εu0 , . . . , εuN−1, u0, . . . , uN−1, δ0, . . . , δN−1, z0, . . . , zN−1}.

• This is Mixed Integer Quadratic Programming (MILP) problem.

MPC of Hybrid Systems Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 41 / 43

Page 42: ECE7850: Hybrid Systems:Theory and Applications Lecture

Conclusion

• Introduced general model predictive control formulation:

- At each time t, update current state x(t) and solve an optimal control problemover a finite look ahead horizon with x(t) as the initial state

- Apply the first step of the obtained optimal control sequence to the system

- t← t+ 1 and repeat the above steps

• For linear systems: using 2-norm, 1-norm, or ∞-norm cost functions all leadto tractable solutions for the online optimization problem

• Introduced three classes of hybrid system models: Piecewise Affine Systems(PWA), Discrete Hybrid Automaton (DHA), Mixed Logical Dynamical(MLD) model. All of them are equivalent

• Hybrid MPC is based on MLD; PWA and DHA can be tranformed into MLDmodels.

• Both linear and hybrid MPC can be solved using the Multi-parametrictoolbox (MPT) [Her+13]

• Further reading: [BBM17; Bem; BJM]

• Next Lecture: Explicit MPC

MPC of Hybrid Systems Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 42 / 43

Page 43: ECE7850: Hybrid Systems:Theory and Applications Lecture

References

[Her+13] M. Herceg et al. “Multi-Parametric Toolbox 3.0”. In: Proc. of the European ControlConference. http://control.ee.ethz.ch/~mpt. Zurich, Switzerland, 2013.

[BBM17] Francesco Borrelli, Alberto Bemporad, and Manfred Morari. Predictive Control forLinear and Hybrid Systems. Cambridge University Press, 2017.

[Bem] Alberto Bemporad. “MPC Lecture Notes (IMT School for Advanced StudiesLucca)”. http://cse.lab.imtlucca.it/~bemporad/mpc_course.html.

[BJM] Francesco Borrelli, Colin Jones, and Manfred Morari. “MPC Lecture Notes (UCBerkeley)”. http://www.mpc.berkeley.edu/mpc-course-material.

MPC of Hybrid Systems Lecture 9 (ECE7850 Sp17) Wei Zhang(OSU) 43 / 43