Real Tim e Kim G Larsen Model Checking using UPPAAL - - PDF document

real tim e
SMART_READER_LITE
LIVE PREVIEW

Real Tim e Kim G Larsen Model Checking using UPPAAL - - PDF document

Real Tim e Kim G Larsen Model Checking using UPPAAL Collaborators @ AALborg @UPPsala Kim G Larsen Wang Yi Informationsteknologi Gerd Behrman Paul Pettersson Arne Skou John Hkansson Brian Nielsen


slide-1
SLIDE 1

Real Tim e Model Checking

Kim G Larsen

using UPPAAL

slide-2
SLIDE 2

Informationsteknologi

UC UCb

Collaborators

@UPPsala

Wang Yi

Paul Pettersson

John Håkansson

Anders Hessel

Pavel Krcal

Leonid Mokrushin

Shi Xiaochun

@AALborg

Kim G Larsen

Gerd Behrman

Arne Skou

Brian Nielsen

Alexandre David

Jacob Illum Rasmussen

Marius Mikucionis

@Elsew here

Emmanuel Fleury, Didier Lime, Johan Bengtsson, Fredrik Larsson, Kåre J Kristoffersen, Tobias Amnell, Thomas Hune, Oliver Möller, Elena Fersman, Carsten Weise, David Griffioen, Ansgar Fehnker, Frits Vandraager, Theo Ruys, Pedro D’Argenio, J-P Katoen, Jan Tretmans, Judi Romijn, Ed Brinksma, Martijn Hendriks, Klaus Havelund, Franck Cassez, Magnus Lindahl, Francois Laroussinie, Patricia Bouyer, Augusto Burgueno, H. Bowmann, D. Latella, M. Massink, G. Faconti, Kristina Lundqvist, Lars Asplund, Justin Pearson...

slide-3
SLIDE 3

Informationsteknologi

UC UCb

Real Tim e System s

Plant

Continuous

Controller Program

Discrete

Eg.: Realtime Protocols

Pump Control Air Bags Robots Cruise Control ABS CD Players Production Lines

Real Time System

A system where correctness not only depends on the logical order of events but also on their timing!!

Real Time System

A system where correctness not only depends on the logical order of events but also on their timing!!

sensors actuators

slide-4
SLIDE 4

Informationsteknologi

UC UCb

Real Tim e Model Checking

sensors actuators

a c b 1 2 4 3 a c b 1 2 4 3 1 2 4 3 1 2 4 3 a c b

UPPAAL Model

Model

  • f

environment (user-supplied / non-determinism)

Plant

Continuous

Controller Program

Discrete

Model

  • f

tasks (automatic?)

slide-5
SLIDE 5

Informationsteknologi

UC UCb

Real Tim e Control Synthesis

Plant

Continuous

Controller Program

Discrete

sensors actuators

a c b 1 2 4 3 a c b 1 2 4 3 1 2 4 3 1 2 4 3 a c b

Partial UPPAAL Model

Model

  • f

environment (user-supplied)

Synthesis

  • f

tasks/scheduler (automatic)

slide-6
SLIDE 6

Informationsteknologi

UC UCb

Model-Checking

A – Model: Network of Timed Automata F – Requirement: TCTL formula, e.g.:

− Invariant: something bad will never happen − Liveness: something good will eventually happen − Bounded Liveness: something good will happen before

some upper time-bound T.

A ² F

UPPAAL

No!

Diagnostic Information Model: A Requirement Specification: F

Yes!

slide-7
SLIDE 7

Informationsteknologi

UC UCb

UPPAAL Tool

Modeling Simulation Verification

slide-8
SLIDE 8

Tim ed Autom ata

Alur & Dill 1 9 8 9

slide-9
SLIDE 9

Informationsteknologi

UC UCb

Dum b Light Control

WANT: if press is issued twice quickly

then the light will get brighter; otherwise the light is turned off.

Off Light Bright

press? press? press? press?

slide-10
SLIDE 10

Informationsteknologi

UC UCb

Dum b Light Control

Off Light Bright

press? press? press? press?

Solution: Add real-valued clock x

X:= 0 X< = 3 X> 3

slide-11
SLIDE 11

Informationsteknologi

UC UCb

Tim ed Autom ata

review

n m a

Clocks: x, y

x< = 5 & y> 3 x := 0

Guard

Boolean combination of integer bounds

  • n clocks

Reset

Action performed on clocks

Alur & Dill 1990

Transitions

( n , x= 2.4 , y= 3.1415 ) ( n , x= 3.5 , y= 4.2415 )

e(1.1)

( n , x= 2.4 , y= 3.1415 ) ( m , x= 0 , y= 3.1415 )

a

State

( location , x= v , y= u )

where v,u are in R

Action

used for synchronization

Discrete Trans Delay Trans

slide-12
SLIDE 12

Informationsteknologi

UC UCb

n m a x< = 5 & y> 3 x := 0

Clocks: x, y Transitions

( n , x= 2.4 , y= 3.1415 ) ( n , x= 3.5 , y= 4.2415 )

e(1.1)

( n , x= 2.4 , y= 3.1415 )

e(3.2)

x< = 5 y< = 10

Location Invariants

g1 g2 g3 g4

Tim ed Autom ata review

I nvariants

I nvariants ensure progress!! I nvariants ensure progress!!

slide-13
SLIDE 13

Informationsteknologi

UC UCb

Exam ple

Reachable?

a b c

slide-14
SLIDE 14

Informationsteknologi

UC UCb

Exam ple

Reachable? x y

(L0,x= 0,y= 0)

a b c

slide-15
SLIDE 15

Informationsteknologi

UC UCb

Exam ple

Reachable? x y

(L0,x= 0,y= 0)

ε(1.4)

(L0,x= 1.4,y= 1.4)

a b c

ε(1.4)

slide-16
SLIDE 16

Informationsteknologi

UC UCb

Exam ple

Reachable? x y

(L0,x= 0,y= 0)

ε(1.4)

(L0,x= 1.4,y= 1.4)

a

(L0,x= 1.4,y= 0)

a b c

ε(1.4)

a

slide-17
SLIDE 17

Informationsteknologi

UC UCb

Exam ple

Reachable? x y

(L0,x= 0,y= 0)

ε(1.4)

(L0,x= 1.4,y= 1.4)

a

(L0,x= 1.4,y= 0)

ε(1.6)

(L0,x= 3.0,y= 1.6)

a

(L0,x= 3.0,y= 0)

a b c

ε(1.4)

a a

ε(1.6)

slide-18
SLIDE 18

Informationsteknologi

UC UCb

slide-19
SLIDE 19

Informationsteknologi

UC UCb

slide-20
SLIDE 20

Informationsteknologi

UC UCb

slide-21
SLIDE 21

Informationsteknologi

UC UCb

slide-22
SLIDE 22

Informationsteknologi

UC UCb

Tim ed Autom ata: Exam ple

a a a

guard reset-set location

a

action

slide-23
SLIDE 23

Informationsteknologi

UC UCb

Tim ed Autom ata: Exam ple

3 ≤ x

a a a a

Invariant

slide-24
SLIDE 24

Informationsteknologi

UC UCb

Light Control I nterface

Control Program User I nterface Light endhold! endhold! touch! touch! starthold! starthold! press? press? release? release? L+ + / L--/ L:= 0 L+ + / L--/ L:= 0

slide-25
SLIDE 25

Informationsteknologi

UC UCb

Light Control I nterface

Control Program User endhold! endhold! touch! touch! starthold! starthold! press? press? release? release? L+ + / L--/ L:= 0 L+ + / L--/ L:= 0

slide-26
SLIDE 26

Informationsteknologi

UC UCb

Netw orks of Tim ed Autom ata

( a’la CCS)

l1 l2

a!

x> = 2 x := 0

m1 m2

a?

y< = 4

………….

Two-way synchronization

  • n complementary actions.

Closed Systems!

Two-way synchronization

  • n complementary actions.

Closed Systems!

(l1, m1,………, x= 2, y= 3.5,…..) (l2,m2,……..,x= 0, y= 3.5, …..) (l1,m1,………,x= 2.2, y= 3.7, …..) 0.2 tau Example transitions If a URGENT CHANNEL

slide-27
SLIDE 27

Informationsteknologi

UC UCb

Netw ork Sem antics

A X ) s s , , S S ( T T

⊆ → × =

2 1 2 1 2 1⎪

X

⎪ ⎪

X

⎪ ⎪

X

⎪ ⎪

X

2 1 2 1 1 1 1

s ´ s s s ´ s s

⎯→ ⎯ ⎯→ ⎯

μ μ

⎪ ⎪

X

⎪ ⎪

X

´ s s s s ´ s s

2 1 2 1 2 2 2

⎯→ ⎯ ⎯→ ⎯

μ μ

⎪ ⎪

X

⎪ ⎪

X

´ s ´ s s s ´ s s ´ s s

a a

2 1 2 1 2 2 2 1 1 1

⎯→ ⎯ ⎯→ ⎯ ⎯→ ⎯

τ

⎪ ⎪

X

⎪ ⎪

X

´ s ´ s s s ´ s s ´ s s

) d ( e ) d ( e ) d ( e

2 1 2 1 2 2 2 1 1 1

⎯ ⎯ → ⎯ ⎯ ⎯ → ⎯ ⎯ ⎯ → ⎯

! ?

where

slide-28
SLIDE 28

Informationsteknologi

UC UCb

Netw ork Sem antics

( URGENT synchronization)

A X ) s s , , S S ( T T

⊆ → × =

2 1 2 1 2 1⎪

X

⎪ ⎪

X

⎪ ⎪

X

⎪ ⎪

X

2 1 2 1 1 1 1

s ´ s s s ´ s s

⎯→ ⎯ ⎯→ ⎯

μ μ

⎪ ⎪

X

⎪ ⎪

X

´ s s s s ´ s s

2 1 2 1 2 2 2

⎯→ ⎯ ⎯→ ⎯

μ μ

⎪ ⎪

X

⎪ ⎪

X

´ s ´ s s s ´ s s ´ s s

a a

2 1 2 1 2 2 2 1 1 1

⎯→ ⎯ ⎯→ ⎯ ⎯→ ⎯

τ

⎪ ⎪

X

⎪ ⎪

X

´ s ´ s s s ´ s s ´ s s

) d ( e ) d ( e ) d ( e

2 1 2 1 2 2 2 1 1 1

⎯ ⎯ → ⎯ ⎯ ⎯ → ⎯ ⎯ ⎯ → ⎯

! ?

where

+ Urgent synchronization

∀d’ < d, ∀u∈ UAct: ¬ ( s1 → → ∧ s2 → → )

e(d’) u! e(d’) u?

slide-29
SLIDE 29

Informationsteknologi

UC UCb

Control Program

Light Control Netw ork

endhold! endhold! touch! touch! starthold! starthold! press? press? release? release?

slide-30
SLIDE 30

Overview of the UPPAAL Toolkit

slide-31
SLIDE 31

Informationsteknologi

UC UCb

UPPAAL’s architecture

Linux, W indow s, Solaris, MacOS

slide-32
SLIDE 32

Informationsteknologi

UC UCb

GUI

Editor Sim ulator Verifier

slide-33
SLIDE 33

Informationsteknologi

UC UCb

Train Crossing

River Crossing Gate Stopable Area [10,20] [7,15] Queue [3,5]

slide-34
SLIDE 34

Informationsteknologi

UC UCb

Train Crossing

River Crossing Gate Stopable Area [10,20] [7,15] Queue [3,5]

appr, stop leave go empty nonempty hd, add,rem

el el

Communication via channels and shared variable.

slide-35
SLIDE 35

Tim ed Autom ata in UPPAAL

slide-36
SLIDE 36

Informationsteknologi

UC UCb Declarations

Constants Bounded integers Channels Clocks Arrays Templates Processes Systems Constants Bounded integers Channels Clocks Arrays Templates Processes Systems

slide-37
SLIDE 37

Informationsteknologi

UC UCb

Declarations in UPPAAL

The syntax used for declarations in UPPAAL is similar to

the syntax used in the C programming language.

Clocks:

− Syntax: − clock x1, …, xn ; − Example: − clock x, y;

Declares tw o clocks: x and y.

slide-38
SLIDE 38

Informationsteknologi

UC UCb

Declarations in UPPAAL ( cont.)

Data variables

− Syntax: − int n1, … ;

I nteger w ith “default” dom ain.

− int[l,u] n1, … ;

I nteger w ith dom ain “l” to “u”.

− int n1[m], … ;

I nteger array w . elem ents n1 [ 0 ] to n1 [ m -1 ] .

− Example: − int a, b; − int[0,1] a, b[5][6];

slide-39
SLIDE 39

Informationsteknologi

UC UCb

Declarations in UPPAAL ( cont.)

Actions (or channels):

− Syntax: − chan a, … ;

Ordinary channels.

− urgent chan b, … ;

Urgent actions ( see later)

− Example: − chan a, b; − urgent chan c;

slide-40
SLIDE 40

Informationsteknologi

UC UCb

Declarations UPPAAL ( cont.)

Constants

− Syntax: − const int c1 = n1; − Example: − const int[0,1] YES = 1; − const bool NO = false;

slide-41
SLIDE 41

Informationsteknologi

UC UCb

Tim ed Autom ata in UPPAAL

invariants Guards Synchronizations Resets Discrete Variables

slide-42
SLIDE 42

Informationsteknologi

UC UCb

Tim ed Autom ata in UPPAAL

invariants Guards Synchronizations Resets

Discrete Variables

x := Expr

inv :: x Expr|x Expr|inv,inv = < <=

c d c d

g :: g |g |g,g g :: x Expr|x y Expr g :: Expr op Expr { , , , , }

  • p

{ , , , , ,! } = = ⊗ ⊗ + = ⊗∈ < <= == >= > ∈ < <= == >= > =

d

i: Expr Expr :: i|i[Expr]| n| Expr| Expr Expr| Expr Expr| Expr *Expr| Expr/Expr| (g ?Expr :Expr) = = − + −

slide-43
SLIDE 43

Informationsteknologi

UC UCb

Expressions

used in guards, invariants, assignments, synchronizations properties, used in guards, invariants, assignments, synchronizations properties,

slide-44
SLIDE 44

Informationsteknologi

UC UCb

Expressions

slide-45
SLIDE 45

Informationsteknologi

UC UCb

Operators

slide-46
SLIDE 46

Informationsteknologi

UC UCb

Guards, I nvariants, Assignm ents

Guards:

It is side-effect free, type

correct, and evaluates to boolean

Only clock variables,

integer variables, constants are referenced (or arrays of such)

Clocks and differences are

  • nly compared to integer

expressions

Guards over clocks are

essentially conjunctions (I.e. disjunctions are only allowed over integer conditions) Assignm ents

It has a side effect and is

type correct

Only clock variable,

integer variables and constants are referenced (or arrays of such)

Only integer are assigned

to clocks I nvariants

It forms conjunctions of

conditions of the form x<e

  • r x<=e where x is a clock

reference and e evaluates to an integer

slide-47
SLIDE 47

Informationsteknologi

UC UCb

Synchronization

Binary Synchronization

Declared like:

chan a, b, c[3];

If a is channel then:

a! = Emmision

a? = Reception

Two edges in different

processes can synchronize if one is emitting and the

  • ther is receiving on the

same channel. Broadcast Synchronization

Declared like

broadcast chan a, b, c[2];

If a is a broadcast channel:

a! = Emmision of broadcast

a? = Reception of broadcast

A set of edges in different

processes can synchronize if

  • ne is emitting and the others

are receiving on the same b.c.

  • channle. A process can always

emit. Receivers MUST synchronize if they can. No blocking.

slide-48
SLIDE 48

Informationsteknologi

UC UCb

More on Types

Multi dimensional arrays

− e.g. int b[4][2];

Array initialiser:

− e.g. int b[4] := { 1, 2, 3, 4 };

Arrays of channels, clocks, constants.

− e.g. − chan a[3]; − clock c[3]; − const k[3] { 1, 2, 3 };

Broadcast channels.

− e.g. broadcast chan a;

slide-49
SLIDE 49

Informationsteknologi

UC UCb

Tem plates

Templates may be

parameterised:

int v; const min; const max

int[0,N] e; const id

Templates are instantiated

to form processes:

P:= A(i,1,5);

Q:= A(j,0,4);

Train1:=Train(el, 1);

Train2:=Train(el, 2);

slide-50
SLIDE 50

Informationsteknologi

UC UCb

Extensions

Select statem ent

  • models a non-deterministic

choise

  • x : int[0,42]

Types

  • Record types
  • Type declarations
  • Meta variables:

not stored with state meta int x; Forall / Exists expressions

  • forall (x:int[0,42]) expr

true if expr is true for all values in [ 0,42] of x

  • exists (x:int[0,4]) expr

true if expr is true for some values in [ 0,42] of x Example: forall (x:int[0,4])array[x];

slide-51
SLIDE 51

Informationsteknologi

UC UCb

Urgency & Com m itm ent

Urgent Channels

No delay if the

synchronization edges can be taken !

No clock guard allowed. Guards on data-variables. Declarations:

urgent chan a, b, c[3]; Urgent Locations

No delay – time is freezed! May reduce number of

clocks! Com m itted Locations

No delay. Next transition MUST

involve edge in one of the processes in committed location

May reduce considerably

state space

slide-52
SLIDE 52

TCTL:

Tim ed Com putational Tree Logic

slide-53
SLIDE 53

Informationsteknologi

UC UCb

TCTL = CTL + Tim e

− − ∈ ∈ φ α in z clocks formula D z ns propositio automic AP p , , , , “freeze operator” introduces new formula clock z E[ φ U φ ], A[ φ U φ ] - like in CTL No EX φ constraints over formula clocks and automata clocks

slide-54
SLIDE 54

Informationsteknologi

UC UCb

Derived Operators

Along any path φ holds continuously until within 7 time units ψ becomes valid. = = The property φ becomes valid within 5 time units.

slide-55
SLIDE 55

Informationsteknologi

UC UCb

Paths

Example:

push push click

9 ≤ y

. . . ) 9 , , ( ) 9 ), 3 ( 9 , ( ) 3 , 3 , ( ) , , ( ) , ( ) , ( ) 5 . 3 , ( ) , (

) 3 ( 9 3 5 . 3

= = ⎯ ⎯→ ⎯ = + − = ⎯ ⎯ ⎯ → ⎯ + = = ⎯ → ⎯ = = ⎯ ⎯→ ⎯ = = ⎯ → ⎯ = = ⎯ ⎯→ ⎯ = = ⎯ → ⎯ = =

+ −

y x

  • ff

y x

  • n

y x

  • n

y x

  • n

y x

  • n

y x

  • n

y x

  • ff

y x

  • ff

click push push

π π π π

π π

slide-56
SLIDE 56

Informationsteknologi

UC UCb

Elapsed tim e in path

. . . ) 9 , , ( ) 9 ), 3 ( 9 , ( ) 3 , 3 , ( ) , , ( ) , ( ) , ( ) 5 . 3 , ( ) , (

) 3 ( 9 3 5 . 3

= = ⎯ ⎯→ ⎯ = + − = ⎯ ⎯ ⎯ → ⎯ + = = ⎯ → ⎯ = = ⎯ ⎯→ ⎯ = = ⎯ → ⎯ = = ⎯ ⎯→ ⎯ = = ⎯ → ⎯ = =

+ −

y x

  • ff

y x

  • n

y x

  • n

y x

  • n

y x

  • n

y x

  • n

y x

  • ff

y x

  • ff

click push push

π π π π

π π

Example:

σ= Δ(σ,1)=3.5, Δ(σ,6)=3.5+9=12.5

slide-57
SLIDE 57

Informationsteknologi

UC UCb

TCTL Sem antics

s - location w - formula clock valuation PM(s) - set of paths from s Pos(σ) - positions in σ Δ(σ,i) - elapsed time

(i,d) <<(i’,d’) iff (i<j) or ((i=j) and (d<d’))

slide-58
SLIDE 58

Informationsteknologi

UC UCb

Tim eliness Properties

receive(m) occurs within 5 time units after send(m) receive(m) occurs exactly 11 time units after send(m) putbox occurs periodically (exactly) every 25 time units (note: other putbox’s may occur in between)

slide-59
SLIDE 59

UPPAAL Specification Language

slide-60
SLIDE 60

Informationsteknologi

UC UCb

Logical Specifications

Validation Properties

Possibly: E< > P

Safety Properties

Invariant: A[ ] P

  • Pos. Inv.:

E[ ] P

Liveness Properties

Eventually: A< > P

Leadsto: P Q

Bounded Liveness

Leads to within: P · t Q

The expressions P and Q must be type safe, side effect free, and evaluate to a boolean. Only references to integer variables, constants, clocks, and locations are allowed (and arrays of these).

slide-61
SLIDE 61

Informationsteknologi

UC UCb

Logical Specifications

Validation Properties

Possibly: E< > P

Safety Properties

Invariant: A[ ] P

  • Pos. Inv.:

E[ ] P

Liveness Properties

Eventually: A< > P

Leadsto: P Q

Bounded Liveness

Leads to within: P · t Q

slide-62
SLIDE 62

Informationsteknologi

UC UCb

Logical Specifications

Validation Properties

Possibly: E< > P

Safety Properties

Invariant: A[ ] P

  • Pos. Inv.:

E[ ] P

Liveness Properties

Eventually: A< > P

Leadsto: P Q

Bounded Liveness

Leads to within: P · t Q

slide-63
SLIDE 63

Informationsteknologi

UC UCb

Logical Specifications

Validation Properties

Possibly: E< > P

Safety Properties

Invariant: A[ ] P

  • Pos. Inv.:

E[ ] P

Liveness Properties

Eventually: A< > P

Leadsto: P Q

Bounded Liveness

Leads to within: P · t Q

slide-64
SLIDE 64

Informationsteknologi

UC UCb

Logical Specifications

Validation Properties

Possibly: E< > P

Safety Properties

Invariant: A[ ] P

  • Pos. Inv.:

E[ ] P

Liveness Properties

Eventually: A< > P

Leadsto: P Q

Bounded Liveness

Leads to within: P · t Q

· t · t

slide-65
SLIDE 65

Informationsteknologi

UC UCb

Train Crossing

River Crossing Gate Stopable Area [10,20] [7,15] Queue [3,5]

appr, stop leave go empty nonempty hd, add,rem

el el

Communication via channels and shared variable.

slide-66
SLIDE 66

Informationsteknologi

UC UCb

Gear Controller

w ith MECEL AB

Lindahl, Pettersson, Yi 1998

V

  • l

v

  • S

a a b Network Canbus GearBox Engine Interface Clutch GearControl

Flow graph

slide-67
SLIDE 67

Informationsteknologi

UC UCb

Gear Controller

w ith MECEL AB

Requirem ents

Volvo Saab GearBox Engine Interface Clutch GearControl

slide-68
SLIDE 68

Informationsteknologi

UC UCb

UPPAAL 3 .4

Gate Tem plate I ntQueue

int[0,N] list[N], len, i;

slide-69
SLIDE 69

Informationsteknologi

UC UCb

UPPAAL 3 .6 ( 3 .5 ) w ith C-Code

Gate Tem plate Gate Declaration

slide-70
SLIDE 70

Informationsteknologi

UC UCb

Case-Studies: Controllers

Gearbox Controller [ TACAS’98] Bang & Olufsen Power Controller

[ RTPS’99,FTRTFT’2k]

SIDMAR Steel Production Plant [ RTCSA’99,

DSVV’2k]

Real-Time RCX Control-Programs [ ECRTS’2k] Experimental Batch Plant (2000) RCX Production Cell (2000) Terma, Verification of Memory Management for

Radar (2001)

Scheduling Lacquer Production (2005) Memory Arbiter Synthesis and Verification for a

Radar Memory Interface Card [ NJC’05]

slide-71
SLIDE 71

Informationsteknologi

UC UCb

Case Studies: Protocols

Philips Audio Protocol [ HS’95, CAV’95, RTSS’95,

CAV’96]

Collision-Avoidance Protocol [ SPIN’95] Bounded Retransmission Protocol [ TACAS’97] Bang & Olufsen Audio/ Video Protocol [ RTSS’97] TDMA Protocol [ PRFTS’97] Lip-Synchronization Protocol [ FMICS’97] Multimedia Streams [ DSVIS’98] ATM ABR Protocol [ CAV’99] ABB Fieldbus Protocol [ ECRTS’2k] IEEE 1394 Firewire Root Contention (2000) Distributed Agreement Protocol [ Formats05] Leader Election for Mobile Ad Hoc Networks

[ Charme05]

slide-72
SLIDE 72

Informationsteknologi

UC UCb w w w .uppaal.com