Tools for Hybrid Systems Reachability Goran Frehse Universite - - PowerPoint PPT Presentation

tools for hybrid systems reachability
SMART_READER_LITE
LIVE PREVIEW

Tools for Hybrid Systems Reachability Goran Frehse Universite - - PowerPoint PPT Presentation

Tools for Hybrid Systems Reachability Goran Frehse Universite Grenoble 1, Verimag - with work from Thao Dang, Antoine Girard and Colas Le Guernic - QMC10, Copenhague, March 5, 2010 1 Outline I. Hybrid Automata and Reachability II. Linear


slide-1
SLIDE 1

1

Tools for Hybrid Systems Reachability

Goran Frehse Universite Grenoble 1, Verimag

  • with work from Thao Dang, Antoine Girard and Colas Le Guernic -

QMC’10, Copenhague, March 5, 2010

slide-2
SLIDE 2

2

Outline

I. Hybrid Automata and Reachability

  • II. Linear Hybrid Automata
  • III. Piecewise Affine Hybrid Systems
  • IV. Support Functions
slide-3
SLIDE 3

3 Incorrect / Unknown Revise Design

Formal Verification

Model of System Formal Specification Correct Verification (algorithmic)

slide-4
SLIDE 4

4

Formal Verification

Key Problems

– computable (decidable) only for simple dynamics – computationally expensive – representation of / computation with continuous sets

slide-5
SLIDE 5

5

Formal Verification

Fighting complexity with overapproximations

– simplify dynamics – set representations – set computations

Overapproximations should be

– conservative – easy to derive and compute with – accurate (not too many false positives)

slide-6
SLIDE 6

6 Incorrect / Unknown Revise Design

Formal Verification

Model of System Formal Specification Correct Verification (algorithmic)

slide-7
SLIDE 7

7

Formal Verification

Model of Physics Model of Software Model of System

continuous dynamics discrete dynamics

slide-8
SLIDE 8

8

Modeling Hybrid Systems

Example: Bouncing Ball

– ball with mass m and position x in free fall – bounces when it hits the ground at x=0 – initially at position x and at rest x Fg

slide-9
SLIDE 9

9

Condition for Free Fall

– ball above ground:

First Principles (physical laws)

Part I – Free Fall

  • gravitational force :

  • Newton's law of motion :

x Fg

slide-10
SLIDE 10

10

Obtaining 1st Order ODE System

Part I – Free Fall

  • ordinary differential equation
  • transform to 1st order by introducing variables

for higher derivatives

  • here:

:

x Fg

slide-11
SLIDE 11

11

Part II – Bouncing

Conditions for “Bouncing” Action for “Bouncing”

  • ball at ground position:
  • downward motion:
  • velocity changes direction
  • loss of velocity (deformation, friction)
  • −, ≤ ≤
slide-12
SLIDE 12

12

Combining Part I and II

Free Fall Bouncing

  • while ≥ ,
  • if and

continuous dynamics discrete dynamics

slide-13
SLIDE 13

13

Hybrid Automaton Model

freefall

flow location invariant discrete transition guard label reset initial conditions

slide-14
SLIDE 14

14

Hybrid Automata - Semantics

Run

– sequence of discrete transitions and time elapse

Execution

– run that starts in the initial states

x(t) x(t) x(t)

slide-15
SLIDE 15

15

Execution of Bouncing Ball

time t position x x(t) x(t) x(t) x(t) x(t) δ δ δ δ δ x … time t velocity v v(t) v(t) v(t) v(t) v(t) δ δ δ δ δ v …

slide-16
SLIDE 16

16

Execution of Bouncing Ball

State-Space View (infinite time range)

position x velocity v discrete transition x x(t) x(t) x(t)

slide-17
SLIDE 17

17 Incorrect / Unknown Revise Design

Formal Verification

Model of System Formal Specification Correct Verification (Reachability)

slide-18
SLIDE 18

18

Compute successor states

R0

Computing Reachable States

  • discrete transitions :
  • time elapse :

R1=Postc(R0) R2=Postd(R1) R3=Postc(R2)

slide-19
SLIDE 19

19

Computing Reachable States

Fixpoint computation Problems

– in general termination not guaranteed – time-elapse very hard to compute with sets

  • Initialization:
  • Recurrence: ∪ ∪
  • Termination: ⇒ .
slide-20
SLIDE 20

20

Chapter Summary

Why should we care?

– Reachability Analysis is a set-based computation that can answer many interesting questions about a system (safety, bounded liveness,…)

What’s the problem?

– The hardest part is computing time elapse. – Explicit solutions only for very simple dynamics.

What’s the solution?

– First study simple dynamics. – Then apply these techniques to complex dynamics.

slide-21
SLIDE 21

21

Outline

I. Hybrid Automata and Reachability

  • II. Linear Hybrid Automata
  • III. Piecewise Affine Hybrid Systems
  • IV. Support Functions
slide-22
SLIDE 22

22

In this Chapter…

A very simple class of hybrid systems Exact computation of discrete transitions and time elapse

– Note: Reachability (and pretty much everything else) is nonetheless undecidable.

A case study

slide-23
SLIDE 23

23

Linear Hybrid Automata

Continuous Dynamics

  • piecewise constant: ˙

x = 1

  • intervals: ˙

x ∈ [1, 2]

  • conservation laws: ˙

x + ˙ x = 0

  • general form: conjunctions of linear constraints

a ˙ x ⊲ ⊳ b, a ∈ n, b ∈ , ⊲ ⊳ ∈ {<, ≤}. = convex polyhedron over derivatives

slide-24
SLIDE 24

24

Linear Hybrid Automata

Discrete Dynamics

  • affine transform: x := ax + b
  • with intervals: x := x ± 0.5
  • general form: conjunctions of linear constraints (new value x′)

a x + a′ x′ ⊲ ⊳ b, a, a′ ∈ n, b ∈ , ⊲ ⊳ ∈ {<, ≤} = convex polyhedron over x x x x and x x x x’

slide-25
SLIDE 25

25

Linear Hybrid Automata

Invariants, Initial States

  • general form: conjunctions of linear constraints

a x ⊲ ⊳ b, a ∈ n, b ∈ , ⊲ ⊳∈ {<, ≤}, = convex polyhedron over x x x x

slide-26
SLIDE 26

26

Reachability with LHA

Compute discrete successor states Postd(S)

– all x’ for which exists x ∈ S s.t.

  • x ∈ G
  • x’ ∈ R(x) Inv

Operations:

– existential quantification – intersection – standard operations on convex polyhedra, but of exponential complexity

slide-27
SLIDE 27

27

Reachability with LHA

Compute time elapse states Postc(S) Theorem [Alur et al.]

– Time elapse along arbitrary trajectory iff time elapse along straight line (convex invariant). – time elapse along straight line can be computed as projection along cone [Halbwachs et al.]

Inv

slide-28
SLIDE 28

28

Reachability with LHA [Halbwachs, Henzinger, 93-97]

invariant initial states 9 derivatives successors projection cone

  • 1. get projection

cone

  • 1. get projection

cone

  • 2. time elapse by

projection

  • 2. time elapse by

projection

  • 3. compute

successors of transitions

  • 3. compute

successors of transitions

slide-29
SLIDE 29

29

Multi-Product Batch Plant

8

5

slide-30
SLIDE 30

30

Multi-Product Batch Plant

Cascade mixing process

– 3 educts via 3 reactors ⇒ 2 products

Verification Goals

– Invariants

  • overflow
  • product tanks never empty

– Filling sequence

Design of verified controller

L IS 1 1 M LIS 22 QIS 22 L IS 32 LIS 31 M LIS 23 Q IS 23 M LIS 21 QIS 21 L IS 1 3 L IS 12

slide-31
SLIDE 31

31

Verification with PHAVer

  • Controller + Plant

– 266 locations, 823 transitions (~150 reachable) – 8 continuous variables

  • Reachability over infinite time

– 120s—1243s, 260—600MB – computation cost increases with nondeterminism (intervals for throughputs, initial states)

Controller Controlled Plant

slide-32
SLIDE 32

32

Verification with PHAVer

slide-33
SLIDE 33

33

Outline

I. Hybrid Automata and Reachability

  • II. Linear Hybrid Automata
  • III. Piecewise Affine Hybrid Systems
  • IV. Support Functions
slide-34
SLIDE 34

34

In this Chapter…

Another class of (not quite so) simple dynamics

– but things are getting serious (no explicit solution for sets)

Exact computation of time elapse only at discrete points in time

– used to overapproximate continuous time

Efficient data structures

slide-35
SLIDE 35

35

Piecewise Affine Hybrid Systems

Affine dynamics

– Flow: – For time elapse it’s enough to look at a single location. ˙ x = Ax + b (deterministic) ˙ x ∈ Ax + B, with B a set (nondeterministic)

slide-36
SLIDE 36

36

Linear Dynamics

Let’s begin with “autonomous” part of the dynamics: Known solutions:

– analytic solution in continuous time – explicit solution at discrete points in time (up to arbitrary accuracy)

Approach for Reachability:

– Compute reachable states over finite time: Reach[0,T](XIni) – Use time-discretization, but with care! ˙ x = Ax, x ∈ n

slide-37
SLIDE 37

37

Time-Discretization for an Initial Point

Analytic solution: Explicit solution in discretized time (recursive):

x = xIni xk = eAδxk x(t) = eAtxIni

2δ 3δ δ x0 x1 x2 x3 t x(t)

multiplication with const. matrix eAδ = linear transform x(δ(k + 1)) = eAδx(δk)

  • with t = δk :
slide-38
SLIDE 38

38

Time-Discretization for an Initial Set

Explicit solution in discretized time Acceptable solution for purely continuous systems

– x(t) is in ǫ(δ)-neighborhood of some Xk

Unacceptable for hybrid systems

– discrete transitions might “fire” between sampling times – if transitions are “missed,” x(t) not in ǫ(δ)-neighborhood

2δ 3δ δ X0 X1 X2 X3 t

X = XIni Xk = eAδXk

Reach[0,3δ](XIni)

slide-39
SLIDE 39

39

Bouncing Ball

– In other examples this error might not be as obvious… X90 = ∅

slide-40
SLIDE 40

40

Goal:

– Compute sequence Ωk over bounded time [0,Nδ] such that:

Approach:

– Refine Ωk by recurrence: – Condition for Ω:

Reachability by Time-Discretization

Reach,Nδ(XIni) ⊆ ∪ ∪ . . . ∪ N

2δ 3δ δ t Reach[0,3δ](XIni) Ω0 Ω1 Ω2

k = eAδk Reach,δ(XIni) ⊆

slide-41
SLIDE 41

41

Time-Discretization with Convex Hull

Overapproximating Reach[0,δ]:

  • ,δIni
slide-42
SLIDE 42

42

Time-Discretization with Convex Hull

Bouncing Ball:

Ω0 X0 X1 X0 X1 Ω0

slide-43
SLIDE 43

43

Nondeterministic Affine Dynamics

Let’s include the effect of inputs:

– variables x,…,xn, inputs u,…,up

Input u models nondeterminism

– used later for overapproximating nonlinear dynamics ˙ x = Ax + Bu, x ∈ n, u ∈ U ⊆ p ˙ x ∈ Ax + BU

slide-44
SLIDE 44

44

Nondeterministic Affine Dynamics

Analytic Solution

2δ 3δ δ t Reach[0,3δ](XIni) influence of inputs

x(t) = eAδx(0) + τ

  • eAδ−τBu(τ)dτ

autonomous dynamics influence of inputs

slide-45
SLIDE 45

45

Nondeterministic Affine Dynamics

How far can the input “push” the system in δ δ δ δ time? Minkowski Sum:

A ⊕ B = {a + b | a ∈ A, b ∈ B}

  • V = box with radius eAδ−

||A||

supu∈U||Bu||

  • =

Bloat(Conv(XIni, eAδXIni)) ⊕ V k = eAδk ⊕ V

slide-46
SLIDE 46

46

Nondeterministic Affine Dynamics

2δ 3δ δ t Ω0 Ω1

  • =

eAδ ⊕ V eAδ

slide-47
SLIDE 47

47

Wrapping Effect

Fight complexity by overapproximation Overapproximated Sequence

– accumulation of approximations → Wrapping Effect – exponential increase in approximation error! ˆ k = (eAδ ˆ k ⊕ V )

slide-48
SLIDE 48

48

Wrapping Effect

Error Propagation in Conventional Algorithm:

slide-49
SLIDE 49

49

Wrapping Effect-Free Algorithm

Computing the sum of Sequences instead of a sequence of sums [Girard, LeGuernic, Maler, 2006]

slide-50
SLIDE 50

50

Outline

I. Hybrid Automata and Reachability

  • II. Linear Hybrid Automata
  • III. Piecewise Affine Hybrid Systems
  • IV. Support Functions
slide-51
SLIDE 51

51

Support Functions

  • max. signed distance of P to
  • rigin projected in direction d
slide-52
SLIDE 52

52

Support Functions

If we know the value of ρPd, we know P is in the halfspace

slide-53
SLIDE 53

53 d1

Support Functions

If we know ρPd, ρPd,… we know P is inside the intersection of the halfspaces

P d2 d3

slide-54
SLIDE 54

54 d1

Support Functions

If we know ρPd, ρPd,… we know P is inside the intersection of the halfspaces = outer polyhedral approx.

P d2 d3

slide-55
SLIDE 55

55

Computing with Support Functions

Many set operations are simple operations on support functions

– Affine Transform: – Minkowski sum: – Convex hull:

Problems:

– Containment: use outer/inner polyhedral approx. – Intersection:

  • approx. intersection with halfspace cheap,

with polyhedron = multivariable optim. problem

slide-56
SLIDE 56

56

Comparison of Set Representations

Operators Polyhedra Zonotopes Support Functions Constraints Vertices Affine transform

  • ++

++ ++ Minkowski sum

  • ++

++ Intersection ++

  • +/-

Containment +

  • ?

+/(-) Convex hull

  • +
  • ++
slide-57
SLIDE 57

57

Computing with Support Functions

If explicit set representation needed (display, simplification,…), sample the support function for given directions and use the outer polyhedral approximation.

– arbitrarily close if enough directions are used

Computing the support function of a polyhedron

– solve linear program (very cheap)

slide-58
SLIDE 58

58

Filtered Switched Oscillator

Switched oscillator

– 2 state variables – similar to many circuits (Buck converters,…)

plus mth order filter

– damps output signal

Piecewise affine dynamics

– 4 discrete states – total 2+m continuous state variables

slide-59
SLIDE 59

59

Filtered Switched Oscillator

2nd order oscillator + 8th order filter

– 10 state variables

2*n box constraints (axis directions) 2*n2 octagonal constraints (± xi ± xj)

slide-60
SLIDE 60

60

Filtered Switched Oscillator

Tool Performance (on virtual machine)

1 10 100 1000 4 1 1 6 2 2 2 8 3 4 4 Box Octagonal

time in s (VM)

  • Nb. of variables

slower due to 8 discrete jumps instead of 6 until convergence

slide-61
SLIDE 61

61

Bibliography

  • Hybrid Systems Theory

– Rajeev Alur, Costas Courcoubetis, Nicolas Halbwachs, Thomas A. Henzinger, Pei-Hsin Ho, Xavier Nicollin, Alfredo Olivero, Joseph Sifakis, and Sergio Yovine. The algorithmic analysis of hybrid systems. Theoretical Computer Science 138:3-34, 1995 – Thomas A. Henzinger. The theory of hybrid automata. Proceedings of the 11th Annual Symposium on Logic in Computer Science (LICS), IEEE Computer Society Press, 1996, pp. 278-292

  • Linear Hybrid Automata

– Thomas A. Henzinger, Pei-Hsin Ho, and Howard Wong-Toi, HyTech: The next

  • generation. RTSS’95

– Goran Frehse. PHAVer: Algorithmic Verification of Hybrid Systems past HyTech. HSCC’05 – Goran Frehse. Tools for the verification of linear hybrid automata models. In J. Lunze and F. Lamnabhi-Lagarrigue, editors, Handbook of Hybrid Systems Control. Cambridge University Press, 2009.

slide-62
SLIDE 62

62

Bibliography

Affine Dynamics

– E. Asarin, O. Bournez, T. Dang, and O. Maler. Approximate Reachability Analysis of Piecewise-Linear Dynamical Systems. HSCC’00 – A. Girard, C. Le Guernic, and O. Maler. Efficient computation of reachable sets

  • f linear time-invariant systems with inputs. HSCC’06

Support Functions

– C. Le Guernic, A.Girard. Reachability analysis of hybrid systems using support

  • functions. CAV’09

– G. Frehse, R. Ray. Design Principles for an Extendable Verification Tool for Hybrid Systems. ADHS’09

slide-63
SLIDE 63

63

Verification Tools for Hybrid Systems

HyTech: LHA

– http://embedded.eecs.berkeley.edu/research/hytech/

PHAVer: LHA + affine dynamics

– http://www-verimag.imag.fr/~frehse/

d/dt: affine dynamics + controller synthesis

– http://www-verimag.imag.fr/~tdang/Tool-ddt/ddt.html

Matisse Toolbox: zonotopes

– http://www.seas.upenn.edu/~agirard/Software/MATISSE/

HSOLVER: nonlinear systems

– http://hsolver.sourceforge.net/

and more…