Controller Synthesis for Linear Hybrid Systems SynCoP and PV April - - PowerPoint PPT Presentation

controller synthesis for linear hybrid systems
SMART_READER_LITE
LIVE PREVIEW

Controller Synthesis for Linear Hybrid Systems SynCoP and PV April - - PowerPoint PPT Presentation

Controller Synthesis for Linear Hybrid Systems SynCoP and PV April 14th, 2018 Marco Faella Universit di Napoli Federico II, Italy Summary Hybrid systems Controller synthesis safety control reachability control Tool


slide-1
SLIDE 1

Controller Synthesis for Linear Hybrid Systems

Marco Faella Università di Napoli “Federico II”, Italy SynCoP and PV April 14th, 2018

slide-2
SLIDE 2

2

Summary

  • Hybrid systems
  • Controller synthesis

– safety control – reachability control

  • Tool demo
slide-3
SLIDE 3

3

Models of Hybrid Systems

  • In control engineering:

– Switched systems – Piecewise affine systems

  • In computer science:

– Hybrid Automata – generalize Timed Automata by allowing more general dynamics

slide-4
SLIDE 4

4

Hybrid Automata

q0 q1

(x , ˙ x)∈F

x∈Inv (x , x')∈Jmp

Flow constraint Invariant Jump relation

Jump/Transition

x state vars ẋ first derivatives x’ state vars after jump

Location

slide-5
SLIDE 5

5

A Hybrid Automaton

q0 q1

˙ x=Ax+b

x1⩽x2 x1>1∧x 2:=x1

Flow constraint Invariant Jump relation

x state vars ẋ first derivatives x’ state vars after jump

slide-6
SLIDE 6

6

Runs

  • Semantics based on runs
  • Sequences of alternating timed steps and discrete steps
  • Timed step:

a continuous-time trajectory in ℝn, which satisfies the invariant and the flow constraint of the current location

location remains fixed

  • Discrete step (i.e., jump):

an instantaneous change of location

variables change according to jump relation

slide-7
SLIDE 7

10

What Kind of Flow Constraints?

  • 1. Affine Hybrid Automaton: linear diff. eq.

– –

A and B are constant matrices and d ∈ D are disturbances

  • 2. Linear (sic!) Hybrid Automaton (LHA): polyhedral diff. inclusions

– –

where F is a convex polyhedron

i.e., a set of linear constraints on the derivatives

special case of affine, with A=0 (no dependency on the current state)

  • 3. Rectangular Hybrid Automaton: rectangular diff. incl.

as above, but F is a hyper-rectangle (Cartesian product of intervals)

˙ x∈F ˙ x=A x+B d

slide-8
SLIDE 8

11

Verification Problems

  • We seek to solve the following:

– Forward reachability problem (FRP): given an effective set of initial states,

compute the set of states that are reachable from them

– Backward reachability problem (BRP): given an effective set of error

states, compute the set of states that can reach them

  • BRP and FRP are inter-reducible provided the model supports

inversion of time (LHAs do)

  • In this talk, effective = polyhedral
slide-9
SLIDE 9

12

Decidability

  • Decidability requires:

– very simple dynamics (initialized rectangular), or – very simple transitions (o-minimal)

  • LHAs are undecidable
slide-10
SLIDE 10

13

Algorithms

Two approaches:

– Finite bisimulation quotient (a.k.a. indirect approach)

  • decidable models

– On-the-fly exploration of the state-space (direct approach)

  • decidable or undecidable models
slide-11
SLIDE 11

14

The Direct Approach

  • On-the-fly exploration of the state space
  • Two sub-approaches:

– Surrender exactness

 approximate algorithms

– Surrender termination

 exact semi-algorithms

slide-12
SLIDE 12

15

Exact Semi-Algorithms

  • An algorithm that may or may not terminate
  • When it terminates, it provides the exact answer
  • It may be stopped after a deadline
  • It provides the exact answer up to a fixed number of

discrete steps

– bounded horizon reachability

slide-13
SLIDE 13

16

An Exact Semi-Algorithm for BRP on LHAs

  • Given a polyhedral set of states E, simulate discrete steps and

timed steps backwards (symbolic execution)

  • For discrete steps:

PreJmp(E) = states that can reach E via a discrete step

  • For timed steps:

PreTime(E) = states that can reach E via a timed step

slide-14
SLIDE 14

17

An exact semi-algorithm for BRP on LHAs

  • The solution to BRP is:

Z* = μZ . E ∪ PreJmp(Z) ∪ PreTime(Z)

  • Fact: When Z is polyhedral, PreJmp and PreTime can be

effectively computed and their result is polyhedral

  • However, the above sequence may not converge in a finite

number of steps

easy to compute hard to compute error states

slide-15
SLIDE 15

22

Computing PreTime: The Reach-While-Avoiding Operator

Fix a location q and the corresponding flow constraint Flow(q)

  • Definition. Given two polyhedra U and V,

RWA(U, V) is the set of points from which there is a trajectory that:

– reaches U – while avoiding V at all times.

  • a.k.a.: flow_avoid in [Wong-Toi,97], Reach in [Tomlin et al.,00]
  • in temporal logic (CTL): ∃ V Until U
slide-16
SLIDE 16

23

PreTime and RWA

PreTime is a special case of RWA, i.e.: PreTime(U) = RWA(U, Inv(q))

where U is a polyhedron in ℝn

Let's analyze the basic properties of RWA...

slide-17
SLIDE 17

24

Assume w.l.o.g. that U and V are disjoint. [distributivity 1st arg] RWA(U1 ∪ U2, V) = RWA(U1, V) ∪ RWA(U2, V) [non-distrib. 2nd arg] RWA(U, V1 ∪ V2) ≠ RWA(U, V1) ∩ RWA(U, V2)

Properties of RWA

slide-18
SLIDE 18

26

V2

Non-distributivity

U V1

RWA(U, V1) RWA(U, V1)

F

Dynamics:

˙ x ˙ y

slide-19
SLIDE 19

27

V1

Non-distributivity

U V2

RWA(U, V2) RWA(U, V2)

F

Dynamics:

˙ x ˙ y

slide-20
SLIDE 20

28

Non-distributivity

U V2 V1

F

Dynamics:

˙ x ˙ y

RWA(U, V1) RWA(U, V1)

∩ ∩

RWA(U, V2) RWA(U, V2)

slide-21
SLIDE 21

29

Non-distributivity

U V2 V1 RWA(U, V1 RWA(U, V1∪ ∪V2) V2) may avoid V1 may avoid V2 can't avoid V1 ∪ V2

F

Dynamics:

˙ x ˙ y

slide-22
SLIDE 22

32

Computing RWA(U,V)

U V2 V1

F

Dynamics:

˙ x ˙ y

V = V1 ∪ V2 V ∩ U↙

“pre-flow of U” Points that can reach U Standard operator

slide-23
SLIDE 23

33

Computing RWA(U,V)

U V2 V1

1 3 4 5 6 F

Dynamics:

˙ x ˙ y

A partition of V ∩ U↙ into 6 convex polyhedra

2

V = V1 ∪ V2

slide-24
SLIDE 24

34

Computing RWA(U,V)

U V2 V1

F

Dynamics:

˙ x ˙ y

All points of P2 go directly into U They are added to the result

1 2 3 4 5 6

slide-25
SLIDE 25

35

Computing RWA(U,V)

U V2 V1

F

Dynamics:

˙ x ˙ y

Some points

  • f P1 go

directly into U They are added to the result

1 2 3 4 5 6

slide-26
SLIDE 26

36

Computing RWA(U,V)

U V2 V1

F

Dynamics:

˙ x ˙ y

The other points of P1 go directly into P2

They are added to the result

1 2 3 4 5 6

slide-27
SLIDE 27

37

Computing RWA(U,V)

U V2 V1

F

Dynamics:

˙ x ˙ y

All points of P5 go directly into P2 They are added to the result

3 4 5 6 1 2

slide-28
SLIDE 28

38

Computing RWA(U,V)

U V2

F

Dynamics:

˙ x ˙ y

Some points

  • f P4 go

directly into P2 They are added to the result V1

3 4 5 6 1 2

slide-29
SLIDE 29

39

Computing RWA(U,V)

U V2 V1

F

Dynamics:

˙ x ˙ y

3 4 5 6 1 2

slide-30
SLIDE 30

40

Computing RWA(U,V)

U V2 V1

F

Dynamics:

˙ x ˙ y

3 4 5 6 1 2

slide-31
SLIDE 31

41

Computing RWA(U,V)

U V2 V1

F

Dynamics:

˙ x ˙ y

3 4 5 6 1 2

slide-32
SLIDE 32

42

Computing RWA(U,V)

U V2 V1 RWA(U,V) RWA(U,V)

F

Dynamics:

˙ x ˙ y

3 4 5 6 1 2

slide-33
SLIDE 33

43

Algorithm for RWA(U, V)

where and [[A]] is the representation of A as a finite set of convex polyhedra

  • Interesting implementation issues
  • Details in [Benerecetti et al., TCS 2013]
slide-34
SLIDE 34

44

Controller Synthesis

slide-35
SLIDE 35

45

Hybrid Games

A hybrid automaton whose transitions are divided between controllable and uncontrollable i.e., the controller can only take certain transitions

it does not directly influence the continuous behavior

a.k.a. switching controller

Control goals:

safety

reachability

slide-36
SLIDE 36

46

Example: Two Open-air Tanks

in

x y

  • ut

transfer evaporation rain

  • We control 3 discrete valves (on/off): in, transfer, and out
  • Rain is an uncontrollable discrete event (on/off)
  • Evaporation rate varies within given bounds
  • Control goal: keep the level in both tanks within bounds (safety)
  • At least one time unit between any two transitions (prevents Zenoness)
slide-37
SLIDE 37

47

Flow constraint:

everywhere:

HG Fragment for Two Open-air Tanks

1

(in=off, tran=off, out=off, rain=off)

3 2

(off, off, on, off) (on, off, off, off) (off, on, off, off) t>1 t:=0 t>1 t:=0 t>1 t:=0

−2⩽ ˙ x⩽−1 ˙ y= ˙ x ˙ t=1 1⩽ ˙ x⩽2 ˙ y= ˙ x−3

4

(off, off, off, on) t>1 t:=0

controllable uncontrollable

slide-38
SLIDE 38

48

The Safety Control Problem

  • A (control) strategy is a function from states to moves of the

controller

– possible moves: take an enabled controllable transition or do nothing – a form of closed-loop control

  • A strategy is winning if it constrains the system within the safe

set

  • Problem: Given a HG and a safe set, compute the set of states

from which the controller has a winning strategy (winning states)

slide-39
SLIDE 39

49

The General Algorithm for Safety Games

  • Inspired by finite-state games
  • Based on the “controllable predecessors” operator
  • Definition. Given a set of states Z, CPre(Z) contains the states

from which the controller can ensure that the system remains in Z until the next discrete transition (included).

CPre:2

S→2 S

slide-40
SLIDE 40

50

The General Algorithm for Safety Games

Given the set of safe states R, the set of winning states is:

νZ . R∩CPre(Z)

slide-41
SLIDE 41

53

Computing CPre(Z) on LHGs

controllable trans. leading into Z (good) uncontrollable trans. leading outside Z (bad)

F

Dynamics:

˙ x ˙ y

Z

slide-42
SLIDE 42

54

controllable trans. leading into Z (good) uncontrollable trans. leading outside Z (bad)

F

Dynamics:

˙ x ˙ y

These points exit from Z while avoiding good transitions They are removed from the result

Computing CPre(Z) on LHGs

slide-43
SLIDE 43

55

controllable trans. leading into Z (good) uncontrollable trans. leading outside Z (bad)

F

Dynamics:

˙ x ˙ y

These points also exit from Z while avoiding good transitions They are removed from the result

Computing CPre(Z) on LHGs

slide-44
SLIDE 44

56

controllable trans. leading into Z (good) uncontrollable trans. leading outside Z (bad)

F

Dynamics:

˙ x ˙ y

Computing CPre(Z) on LHGs

slide-45
SLIDE 45

57

controllable trans. leading into Z (good) uncontrollable trans. leading outside Z (bad)

F

Dynamics:

˙ x ˙ y

These points reach a bad trans. while avoiding good transitions They are removed from the result

Computing CPre(Z) on LHGs

slide-46
SLIDE 46

58

controllable trans. leading into Z (good) uncontrollable trans. leading outside Z (bad)

F

Dynamics:

˙ x ˙ y

CPre(Z) CPre(Z)

Computing CPre(Z) on LHGs

slide-47
SLIDE 47

59

controllable trans. leading into Z (good) uncontrollable trans. leading outside Z (bad)

F

Dynamics:

˙ x ˙ y

CPre(Z) CPre(Z)

Looks familiar?

Computing CPre(Z) on LHGs

slide-48
SLIDE 48

60

Computing CPre(Z) on LHGs

We can compute CPre using RWA! CPre(Z) = Z \ RWA(Z ∪ Bad, Good) where: Bad = PreJmpu(Z) predecessors under uncontrollable trans. Good = PreJmpc(Z) predecessors under controllable trans.

Warning: there are special effects when a trajectory exits from Z and from the invariant at the same time.

slide-49
SLIDE 49

61

Proof Sketch in Temporal Logic

RWA(U,V) = ∃ V Until U CPre(Z) = Z ∩ ∀ (Z ∩ Bad) WUntil Good Recall the classical equivalence: ∀ A WUntil B ≡  ∃ B Until A Hence, CPre(Z) = Z \ RWA(Z ∪ Bad, Good)

weak until

slide-50
SLIDE 50

62

The Reachability Control Problem

slide-51
SLIDE 51

63

The Reachability Control Problem

  • Control goal: bring system into a desired set of target states

reachability game

  • Problem. Given a HG and a target set, compute the set of

states from which the controller has a winning strategy (winning states)

slide-52
SLIDE 52

64

(non-) Duality

  • In most types of finite-state games, a reachability game can be

reduced to its dual safety game

  • I.e.,

– to solve the game with goal “F R”... – ...exchange the players... – ...and solve the game with goal “G R”

  • This does not work for LHGs
  • LHGs are asymmetric: continuous flow (timed steps) is always

adversarial

  • We need a direct algorithm for reachability games
slide-53
SLIDE 53

65

The General Algorithm for Reachability Games

Based on a variant to the controllable predecessors operator

  • Definition. Given a set of states Z, CPreReach(Z) contains the

states from which the controller can ensure that the system reaches Z within the next discrete transition (included).

CPreReach:2

S→2 S

slide-54
SLIDE 54

66

The General Algorithm for Reachability Games

Given the target set R, the set of winning states is:

μ Z .R∪CPreReach(Z)

slide-55
SLIDE 55

68

Computing CPreReach

All trajectories should reach Z ∪ Good while avoiding Bad. CPreReach(Z) = ∀ Bad Until (Z ∪ Good) where as before: Bad = PreJmpu(Z) Good = PreJmpc(Z)

slide-56
SLIDE 56

69

Another Type of RWA!

Fix a location q and the corresponding flow constraint Flow(q).

  • Definition. Given two (possibly non-convex) polyhedra U and V,

must-RWA(U,V) is the set of points from which all trajectories reach U while avoiding V. in temporal logic (CTL): ∀ V Until U CPreReach(Z) = must-RWA(Z ∪ Good, Bad)

slide-57
SLIDE 57

70

Computing must-RWA

Unfortunately, forall-until (must-RWA) cannot be reduced to exists- until (RWA). However, we can use exists-until to do the heavy lifting. Idea:

  • First, compute an over-approximation of must-RWA
  • Then, use RWA to refine it (remove unwanted points)
slide-58
SLIDE 58

71

Boundedness

Given a location q and a (possibly non-convex) polyhedron G:

  • A point p in G is q-bounded if all trajectories starting from p eventually

exit from G

  • G is q-bounded if all of its points are

G y x

➢ y is q-bounded ➢ x is not q-bounded ➢ G is not q-bounded

slide-59
SLIDE 59

72

Computing must-RWA: the Idea in Detail

Assume w.l.o.g. that U and V are disjoint. Clearly, U ⊆ must-RWA(U,V). Let Over be a set such that:

1) must-RWA(U,V) ⊆ Over (it is an over-approximation) 2) Over ∩ V =  (it does not contain trivially “losing” points) 3) Over \ U is q-bounded (the “unsafe” part of Over is q-bounded)

Theorem: must-RWA(U,V) = Over \ RWA(Over, U)

slide-60
SLIDE 60

73

range of possible directions U V Over

Computing must-RWA Using RWA

slide-61
SLIDE 61

74

U V Over

RWA(Over, U)

Computing must-RWA Using RWA

range of possible directions

slide-62
SLIDE 62

75

U V Over

RWA(Over, U) RWA(Over, U)

Computing must-RWA Using RWA

range of possible directions

slide-63
SLIDE 63

76

U V Over

RWA(Over, U) RWA(Over, U)

must-RWA(U,V)

Computing must-RWA Using RWA

range of possible directions

slide-64
SLIDE 64

77

Why the Over-approximation Must Be Bounded

U V Over (unbounded) range of possible directions

slide-65
SLIDE 65

78

U V

RWA(Over, U)

Why the Over-approximation Must Be Bounded

Over (unbounded) range of possible directions

slide-66
SLIDE 66

79

U V

RWA(Over, U)

Why the Over-approximation Must Be Bounded

??

Over (unbounded) No more points are removed! range of possible directions

slide-67
SLIDE 67

80

Computing the Over-approximation

  • “not V” is an obvious over-approximation

however, its unsafe part “Over \ U” is not necessarily q-bounded

  • How do we make it q-bounded while preserving all good points?

How do we distinguish good points?

  • Idea sketch:
  • Luckily, the good points in Over \ U are already q-

bounded

  • because they can reach U
  • Hence, preserve all the q-bounded points!

more info in [Benerecetti & F., ACM TECS, 2017]

slide-68
SLIDE 68

82

References

  • M. Benerecetti, M.F. Tracking Smooth Trajectories in Linear

Hybrid Systems. Information & Computation, 257, 2017.

  • M. Benerecetti, M.F. Automatic Synthesis of Switching Controllers

for Linear Hybrid Systems: Reachability Control. ACM Trans. on Embedded Computing Systems, 16(4), 2017.

  • M. Benerecetti, M.F., S. Minopoli. Automatic Synthesis of

Switching Controllers for Linear Hybrid Systems: Safety Control. Theoretical Computer Science, 493, 2013. Also: HSCC 2013, HSCC 2012, IEEE CDC 2011, GandALF 2011.

slide-69
SLIDE 69

83

Tool Demo

slide-70
SLIDE 70

84

Features:

controllability region w.r.t. safety goal

controllability region w.r.t. reachability goal

  • ptional smooth semantics (instead of a.e. differentiable)

http://wpage.unina.it/m.faella/nycs

NYCS Naples hYbrid Controller Synthesis

slide-71
SLIDE 71

85

NYCS Schematics

model control goal NYCS poly2tex polyview

controllable region (.poly)

tikz figure (.tex)

slide-72
SLIDE 72

86

The “Maze” Example

Navigate a point vehicle in a maze

  • control goal: reach target T
  • 4 cardinal directions
  • speed = 2
  • 1 time unit between two changes
  • f dir. (non-Zeno)

N S E N W walls modeled via uncontrollable transitions T

width 1

slide-73
SLIDE 73

87

The “Maze” Example

E Abort wall hit S N S W everywhere:

˙ x=2 ˙ y=0 ˙ t=1

Invariant: true

t >1 t:=0

controllable uncontrollable

t >1 t:=0

slide-74
SLIDE 74

88

Demo

nycs maze.xml maze.cfg.xml