MPC for Hybrid systems Eduardo F. Camacho Univ. of Seville E.F. Camacho EECI MPC course , Paris 2 Outline • Hybrid Systems • MPC for Hybrid systems • Some results • Some HYCON examples • Conclusions E.F. Camacho EECI MPC course , Paris 3 Hybrid Systems Models TWO approaches CONTROL ENGINEERING- ORIENTED VIEW COMPUTER SCIENTIST- ORIENTED VIEW TIME - DRIVEN DYNAMICS EVENT - DRIVEN DYNAMICS E.F. Camacho EECI MPC course , Paris 4 Computer science approach - State machine embedding dynamics dx/dt=f(x) dx/dt=g(x) 1- Hybrid Automaton 2- Timed Petri Nets 3- Finite State Machines 4. Etc. E.F. Camacho EECI MPC course , Paris 5 3 2 C B B B C A 1 A 5 C 4 Hybrid Systems X={1,2,3,4,5} U={A,B,C} output 1 dx/dt=f 1 (x) X=1 5 X=5 dx/dt=f 2 (x) 4 X=4 dx/dt=f 3 (x) reference control system C U=C, t=t1 U=A, t=t2 A E.F. Camacho EECI MPC course , Paris 6 Control engineering approach x(k+1) = f(x(k),u(k)) y(k) = g(x(k),u(k)) state x = [x c T , x d T ] T output y = [y c T ,y d T ] T input u = [u c T ,u d T ] T ,
18
Embed
Hybrid Systems MPC for Hybrid systems • MPC for Hybrid ... Eduardo CAMACHO... · • Some HYCON examples • Conclusions E.F. Camacho EECI MPC course , Paris 27 MPC and PWA systems
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
MPC for Hybrid systems
Eduardo F. CamachoUniv. of Seville
E.F. Camacho EECI MPC course , Paris 2
Outline
• Hybrid Systems• MPC for Hybrid systems• Some results• Some HYCON examples• Conclusions
E.F. Camacho EECI MPC course , Paris 3
Hybrid Systems Models
TWO approaches
CONTROL ENGINEERING-ORIENTED VIEW
COMPUTER SCIENTIST-ORIENTED VIEW
TIME - DRIVENDYNAMICS
EVENT - DRIVEN DYNAMICS
E.F. Camacho EECI MPC course , Paris 4
Computer science approach
- State machine embedding dynamics
dx/dt=f(x) dx/dt=g(x)
1- Hybrid Automaton 2- Timed Petri Nets3- Finite State Machines4. Etc.
E.F. Camacho EECI MPC course , Paris 5
3
2CB
BB
CA
1
A5C
4
Hybrid Systems
X={1,2,3,4,5}U={A,B,C}
output
1
dx/dt=f1(x)
X=1
reference control system
5
X=5
dx/dt=f2(x)
reference control system
4
X=4
dx/dt=f3(x)
reference control system
C
U=C, t=t1 U=A, t=t2
A
E.F. Camacho EECI MPC course , Paris 6
Control engineering approach
x(k+1) = f(x(k),u(k))y(k) = g(x(k),u(k))
state x = [xcT, xd
T]T
output y = [ycT,yd
T]T
input u = [ucT,ud
T]T,
E.F. Camacho EECI MPC course , Paris 7
Control engineering approach
discretecontrol command
generator
dynamicalsystem
reference
output
1 - Piecewise Affine (PWA) Systems2 - Mixed Logical Dynamical (MLD) Systems 3 - Linear Complementary (LC) Systems 4 - Extended Linear Complementary (ELC) Systems5 - Max-Min-Plus-Scaling (MMPS) Systems6 - etc
E.F. Camacho EECI MPC course , Paris 8
Equivalence Results
Figure 1: Graphical representation of the links between the classes of hybrid systems. An arrow going from class A to class B means that A is a subset of B. The label next to each arrow corresponds to the result that states this relation. An arrow with a star (*) require conditions to establish the indicate inclusion.
PWA
MLD
LC MMPS
ELC
Prop. 9*
Prop. 6Prop. 5*
Prop. 1Prop. 2*Prop. 4*
Prop. 3
Prop. 7
Prop. 8*
Cor. 2Cor. 1*Cor. 3*Rem. 3
Rem. 4
E.F. Camacho EECI MPC course , Paris 9
Example: A Jacket Cooled Bath Reactor
X (t)T = [C (t) T (t) V (t)]T
Output vector
Manipulated variable
E.F. Camacho EECI MPC course , Paris 10
Example: A Jacket Cooled Bath Reactor (2)
E.F. Camacho EECI MPC course , Paris 11
Mixed Logical Dynamical Systems (MLD)
Notice that if the state is discrete, not necessarily Boolean, butfinite, it can be coded into a set of Boolean variables.
x (t) = [xrT (t) xb
T (t)]xr (t) є n
xb (t) є {0.1}nb
y (t) = [yrT (t) yb
T (t)]
yr (t) є m
u (t) = [urT (t) ub
T (t)]
ur (t) є l
ub (t) є {0,1}lb
(t) є {0,1}lbAuxiliary continuous z (t) є r and discrete variables ∂ (t) є {0,1}rb are usually needed.
E.F. Camacho EECI MPC course , Paris 12
logical expressions can be trasformed into algebraicconstraints.
L1 L2 ~ L1 V L2
L1 L2 L1 = L2.
TFFT
L1 L3TFFT
TTFT
TTFT
FFFT
FTTT
TTFF
FTFT
FFTT
L1 = L2~ L1 V L2L1 L2 L1 Λ L2L1 V L2~ L1L2L1
Logical Expressions and algebraic constraints
E.F. Camacho EECI MPC course , Paris 13
Logical Expressions and algebraicconstraints(2)
Associate an integer variable ∂. ∂= 1 if L= T (true) and ∂= 0 if L= F (False).
• Consider a function f and a logical variable l є {0,1}.• f is bounded in its domain by f ≤ f (x) ≤ f. • The following logical statements and constraints are
equivalent.
(f (x) ≤ 0) Λ (∂= 1) f (x) - ∂ ≤ - 1 + f (1 - ∂) (f (x) ≤ 0) V (∂= 1) f (x) ≤ f¯ ∂
~ (f (x) ≤ 0) f (x) > 0 or f (x) ≥ є
where є is the smallest number in the computer.
(f (x) ≤ 0) (∂ = 1) ~ (f (x) ≤ 0) V (∂ = 1)
E.F. Camacho EECI MPC course , Paris 15
Logical Expressions and algebraicconstraints(4)
If and only if condition ( ) necessary toestablish the equivalence between the logicalpredicate and the set of constraints can
f (x) ≤ f¯∂1= f¯ (1-∂)(∂ = 1) (f (x) ≤ 0)
f(x) ≥ є + ∂ (f – є)
E.F. Camacho EECI MPC course , Paris 16
Logical predicates and real functions.
Consider a term in the form ∂ f (x). Define an auxiliary real variable z ∂ f(x) with z = 0 when ∂ = 0 and z = f (x) when ∂ = 1.
Predicates((∂ = 0)) (z = 0) and (∂ = 1) (z = f (x))) can
be translated into the following linear inequalities:
z ≤ f¯ ∂z ≥ f ∂
z ≤ f (x) – f (1 - ∂)z ≥ f (x) - f¯ (1 - ∂)
E.F. Camacho EECI MPC course , Paris 17
Logical predicates and real functionsproduct of variables (∂1, ∂2).
The control law can be write as u(x(k)) = Fi x(k) + Gi if ∈ x(k) ∈ Pi
- Multiparametric Problems- Computational Expensive (off-line)- Only useful for simple systems
E.F. Camacho EECI MPC course , Paris 37
uc ud
qc3
qc4h3
h4
h1 h2
qo1 qo2
E.F. Camacho EECI MPC course , Paris 38
E.F. Camacho EECI MPC course , Paris 39
Branch and Bound Mixed Integer Programming
Consider the optimization problem P0 with u єand ∂ є{0,1}m;
E.F. Camacho EECI MPC course , Paris 40
Branch and Bound Mixed IntegerProgramming (2)
• Given two subsets U1 U and U2 U • And bounds f1 ≤ min uєU 1 f(u), f2 ≥ min uєU f (u).
• Then if, f2 ≤ f1, the points in U1 may be disregarded
Problem (RP0) relax conditions ∂ є {0, 1}m by 0 ≤ ∂ ≤ 1 with larger feasibility region and the following
characteristics:1. If P0 is feasible, so is RP0; if RP0 is infeasible so is P0.2. The minimum of the relaxed problem is a lower bound of the
minimum of the original problem.(i.e., min RP0 ≤ min P0).
3. If the optimal solution of RP0 is feasible for P0, it is also the optimal solution for P0.
E.F. Camacho EECI MPC course , Paris 41
Branch and Bound Mixed IntegerProgramming (3)
Define the problem Pkj; (k depth in the tree and j a binary combination of the boolean variables for one of the nodes being explored (j є {0, 1}k).)For example, P210 is the problem when the first two boolean decision variables are fixed to 1and 0, respectively (∂1= 1, ∂2= 0) while leaving the remaining boolean variables free ∂k + I є {0, 1} for i= 1 …, m – k.The relaxed problem RPkj is the problem obtained when the constraints ∂k+i є {0, 1} for i= 1, …, m – k are relaxed to 0 ≤ ∂k+i ≤ 1 for i= 1, …, m – k.
E.F. Camacho EECI MPC course , Paris 42
Define u*r= arg min RPkj ; u*= arg min Pkj
F(Pkj), and F(RPkj) the feasible regions of problems Pkjand RPkj.
1. F (Pkj) F (RPkj)2. F (Pkj) ≠ Ø F (RPkj) ≠ Ø3. F (RPkj) = Ø F (Pkj) = Ø4. min RPkj ≤ min Pkj5. If u*
r є F (Pkj) u* = u*r
Branch and Bound Mixed Integer Programming (3)
E.F. Camacho EECI MPC course , Paris 43
Branch and Bound Mixed Integer Programming (4)
A basic branch and bound-based MIP algorithm works as follow:
1) Calculate an upper bound J¯(P0) and a lower bound J (P0)of minu (P0), Ø SOL. Put P0 and its associated lower bound (J (P0)) into OPEN (List of candidate Solutions).
2) If OPEN is empty, the optimum solution is in SOL and its value is J¯, STOP.
3) Otherwise, get a problem Pi, from OPEN. If the associated lower bound of Pi is bigger than J¯, go to step 2 (disregard node as its lower bound is above the upper bound of the solution found so far).
4) Form the relaxed problem RPi. Solve RPi. Let SOL1 be the solution (it may be empty if the problem is unfeasible) and Jibe the minimum value of the objective function.
E.F. Camacho EECI MPC course , Paris 44
Branch and Bound Mixed Integer Programming (5)
5) If SOL1 is empty (problem RPi infeasible), go to step 2.6) If Ji ≥ J¯ go to step 2 (disregard node as its lower
bound is above the upper bound of the solution found so far).
7) If SOL1 is also feasible for Pi set Ji* = Ji, set J¯ = Ji and
the solution of SOL = SOL1; go to step 2.8) Generate problems Pio and Pi1 (children of problem Pi)
and put them in OPEN with associated lower bounds J (Pio) = J (Pio)= Ji, go to step 2.
E.F. Camacho EECI MPC course , Paris 45
Branch and Bound Mixed Integer Programming (5)
Some remarks:
The initial upper and lower bounds can be fixed at very highand low values if no information is available. However, thenumber of visited nodes can be reduced if these bounds are tightly estimated.How is the next node to be expanded selected from the set of candidate solutions.
1. The depth-first search the (expand node with greatest depth). 2. The depth-first search of (expanding node with the smallest
depth), more systematic but requires more nodes in memory.3. More efficient strategies use information about the objective
function.4. The order in which the Boolean variables are selected is to order
these variables according to the influence they will have on theobjective function.
E.F. Camacho EECI MPC course , Paris 46
2 - Use the systems information to prune (1)A - Reach and controllable sets
This is a lower bound of the index and can be used in a Branch & Bound algorithm
Somewhat conservative but there are more tricks
E.F. Camacho EECI MPC course , Paris 54
Prediction horizon vs. Nº QP evaluation
2 4 6 8 10100
105
1010
1015
Prediction Horizon
Log(Number of QP evaluation)
Enumerative QPevaluation = SN-1
Max Number of QP evaluation
Min Number of QP evaluationMean Number of QP evaluation
E.F. Camacho EECI MPC course , Paris 55
Invariant sets for PWA
• Role of invariant sets in MPC
– Used as terminal constraint to guaranty stability
– The domain of attraction of the MPC depends on the size of the invariant set.
E.F. Camacho EECI MPC course , Paris 56
Invariant sets for PWA• Regions
– Given a convex polyhedron
– The one-step set of
E.F. Camacho EECI MPC course , Paris 57
Invariant sets for PWA• Algorithm 1
– Set can be represented as the union of convex sets. The number of required convex sets grows exponentially with k. This approach is not practical for relatively small values of k.
E.F. Camacho EECI MPC course , Paris 58
Outer bound of invariant set• Algorithm 2
– The convex hull operator required to implement the algorithm can be substituted by any outer approximation.
– It can be stopped when there is no significant improvement.
– Each set contains , for all
E.F. Camacho EECI MPC course , Paris 59
Inner approx. of invariant set
• Given set , denotes the
complementary set of in .
• The algorithm obtains an inner approximation
(polyhedron) of a union of convex sets.
• Done by computing inner supporting constraints
that separate the complementary set of the
union of sets from the inner approximation.
E.F. Camacho EECI MPC course , Paris 60
Example
Outer approximation Inner approximation
E.F. Camacho EECI MPC course , Paris 61
Approximated evolution of PWA: Zonotopes
– Allow fast computation of an outer approximation of the union and intersection of zonotopes.
– Permit to compute a guaranteed outer bound of the uncertain evolution.
– They constitute a powerful tool to address the MPC problem (Bravo, et al. Automatica 2006).
– Used in combination with the outer and inner bound of the robust invariant sets can be usedfor robustness or verification problems,
E.F. Camacho EECI MPC course , Paris 62
Zonotopes
• Definitions– Minkowski sum of two set X and Y denoted by
– Unitary interval
– Unitary box , is a vector composed by m unitary intervals.
– Zonotope of order m. Given a vector and a matrix , the set
E.F. Camacho EECI MPC course , Paris 63
Evolution Zonotopes for autonomous PWA sytems
– PWA system– At time , the current state set is represented
by a zonotope– Then, it is mapped by the dynamic function as
which is a zonotope.– In the presence of additive uncertainty, an exact
outer bound of the one step set can also be obtained a zonotope.
E.F. Camacho EECI MPC course , Paris 64
Union of zonotopes
• Consider– Two zonotopes
• Property– A zonotope containing
their union is
Unsafe
Inner
Outer
Init
• Given:– A PWA system.– Outer and inner bound
of the robust invariantset
– An unsafe region– An initial condition
region
Constraint satisfaction
– If the current zonotopeis completely containedin the inner bound set, then the system issafe.
Constraint Satisfaction
• Conservative rule:
– If the current zonotope– is contained in more
than one region, thencompute the
intersection zonotopesand bound the union oftheir images.
Constraint Satisfaction
If more accuracy is required:
– If the current
zonotope is contained
in more than one
region, then compute
the intersection
zonotopes and analizeindependently theirimages.
Constraint Satisfaction
• Intersection
– If the current zonotope
is contained in more
than one region, then compute the
intersection zonotopes andanalize
indepenently their images.
Constraint Satisfaction
• Reducing the search space:
– If the current zonotope
is partially contained in theinner bound set,
then compute the intersectionand
analize only the
external part.
Constraint Satisfaction
E.F. Camacho EECI MPC course , Paris 71
Outline
• Model Predictive Control• Hybrid Systems• MPC for Hybrid systems• Some results• Some HYCON examples• Conclusions
HYCON Network of ExcellenceFP6 – IST- 511368
Fuel cell: PWA model
• Fuel cell: safety objective
– Evaluate the possibility of starvation
Sistema
Ist
λo2
Fuel cell: PWA model
• Fuel cell: problems
– Complex dynamics.• Non-linearities,
• hybrid
– Different time constants
Fuel cell: PWA model
• Fuel cell: identification
– The identification has done employing ramps as input.
SistemastI 2oλ1s
Integrator
0 2 4 6 8 10 12 14 16 18 200
0.01
0.02
0.03
0.04
0.05
0.06
0.07
0.08
0.09
0.1
DeltaIst [V/s]
Tim
e [s
]
0 2 4 6 8 10 12 14 16 18 202.224
2.226
2.228
2.23
2.232
2.234
2.236
2.238
2.24
2.242
Time [s]
Lam
bda o2
0 2 4 6 8 10 12 14 16 18 2020
20.2
20.4
20.6
20.8
21
21.2
21.4
21.6
21.8
22
Time [s]
Ist
Fuel cell: PWA model
• Fuel cell: system characteristic
the output depends only on the ratio between thevariation of the current and the current!
st
st
IIΔr =
A PWA model can be identified considering r as an input
Fuel cell: PWA model
• Obtained model is of the form:
where x is the state, r the ratio input, w the uncertainty, u the control action.
• Suitable for MPC:1. It is possible to obtain the greatest robust (control) invariant set.2. It is possible (using LMIs) to design a controller of the form:
3. It is not difficult to implement a MPC generalizing the results of Kothare et al Automatica 1996.
Fuel cell: PWA model
• Fuel cell: identification
– In blue the non-linear systems with differentconstant current.
– In magenta the linear identified modelwithout integrator.
– In red the linear modelwith integrator.
0 2 4 6 8 10 12 14-0.05
0
0.05
0.1
0.15
0.2
0.25
0.3
0.35
Time [s]
Lam
bda o2
Ist = 10Ist = 20Ist = 30Ist =40IdIdInt
Fuel cell: PWA model
• Fuel cell: identification results
– Example: a random current ratio
Output Error
10 20 30 40 50 60 70 80 90
2
2.05
2.1
2.15
2.2
2.25
2.3
2.35
2.4
2.45
2.5
Time [s]
Lam
bda o2
LambdaIdIdint
10 20 30 40 50 60 70 80 90
-0.06
-0.04
-0.02
0
0.02
0.04
0.06
Time [s]
Erro
r
Error IdError Id Int
Fuel cell: PWA model
E.F. Camacho EECI MPC course , Paris 80
E.F. Camacho EECI MPC course , Paris 81
Solar Plant web
E.F. Camacho EECI MPC course , Paris 82
Solar Plant Benchmark
u1
u2
ud
y1y2
y3
y4
E.F. Camacho EECI MPC course , Paris 83
Absorption machine
E.F. Camacho EECI MPC course , Paris 84
Process variables
• Controlled variables:– temperatures and flows
• Manipulated variables:– pump velocity and valves
• Perturbations:– Solar radiation, ambient temperature, flow
through the evaporator of the absorption machine, evaporator input temperature of the absorption machine
E.F. Camacho EECI MPC course , Paris 85
1.Fulfill cooling demand.2.Minimize use of gas.3.Maximize energy stored at the end of the
day.4.Minimize the number of operating mode
changes.
Control objectives
E.F. Camacho EECI MPC course , Paris 86
Operating modes
1. Recirculation ⇒ l1 = 12. Loading the tanks with hot water ⇒ l2 = 13. Using the solar collectors ⇒ l3 = 14. Using the solar collectors and gas heater ⇒ l4 = 15. Using the gas heater ⇒ l5 = 16. Using the tanks and gas heater ⇒ l6 = 17. Using tanks ⇒ l7 = 18. Loading the tanks and using the gas heater ⇒ l8 = 19. Recirculation and using the gas heater ⇒ l9 = 110.Using the solar collectors and loading tank ⇒ l10 = 111.Using the solar collectors and gas heater, and loading
tanks ⇒ l11 = 1
E.F. Camacho EECI MPC course , Paris 87
m1
E.F. Camacho EECI MPC course , Paris 88
m2
E.F. Camacho EECI MPC course , Paris 89
m3, m4, m5, m6 …
E.F. Camacho EECI MPC course , Paris 90
Model validation
E.F. Camacho EECI MPC course , Paris 91
HYCONHYCONHybrid Control: Taming
Heterogeneity and Complexity of Networked Embedded Systems
Hybrid systems provide the modeling framework for capturing the richness of behaviors characteristic of embedded systems.
The key feature of hybrid systems is their capability of rigorously describing the dynamics of devices where continuous parts – governed by differential or difference equations and discrete parts – described by finite state machines, if-then-else rules, prepositional and temporal logic interact over time.
E.F. Camacho EECI MPC course , Paris 92
The controller is connectedwith the real plant using OPC library of Matlab/Simulink.
The controler is allocatedinside the block called Controllerand is connected with the necessary inputs and outputs.
Control of the Real Plant
E.F. Camacho EECI MPC course , Paris 93
Control of the Real Plant
E.F. Camacho EECI MPC course , Paris 94
University of Sienna (UNISI).
University of Dortmund (UNIDO).
University of Valladolid (UV).
ETH Zurich (ETHZ).
University of Seville (US).
Proposals from HYCON partners. Proposals from non HYCON researchers.
Universidad Tecnológica de Bolívar, Colombia
University of Almería, Spain
Federal University of Santa Catarina, Brazil
Uppsala University, Sweden
University of Los Andes, Venezuela
Simón Bolívar University, Venezuela
Accepted Not accepted
Participants
HYCON activities: Solar plant benchamrk
E.F. Camacho EECI MPC course , Paris 96
•Award panel
•Analyzed issues:
•Results on two days simulation (real environmental data)