• Ingen resultater fundet

Real Time Model Checking

N/A
N/A
Info
Hent
Protected

Academic year: 2022

Del "Real Time Model Checking"

Copied!
72
0
0

Indlæser.... (se fuldtekst nu)

Hele teksten

(1)

Real Time Model Checking

Kim G Larsen

using UPPAAL

(2)

Informationsteknologi

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

@Elsewhere

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...

(3)

Informationsteknologi

UCb

Real Time Systems

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

(4)

Informationsteknologi

UCb

Real Time 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

of

environment (user-supplied / non-determinism)

Plant

Continuous

Controller Program

Discrete

Model of tasks

(automatic?)

(5)

Informationsteknologi

UCb

Real Time 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

of

environment (user-supplied)

Synthesis of

tasks/scheduler (automatic)

(6)

Informationsteknologi

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!

(7)

Informationsteknologi

UCb

UPPAAL Tool

Modeling

Simulation

Verification

(8)

Timed Automata

Alur & Dill 1989

(9)

Informationsteknologi

UCb

Dumb Light Control

WANT: if press is issued twice quickly

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

Off press? Light press? Bright

press?

press?

(10)

Informationsteknologi

UCb

Dumb Light Control

Off press? Light press? Bright

press?

press?

Solution: Add real-valued clock x

X:=0

X<=3

X>3

(11)

Informationsteknologi

UCb

Timed Automata review

n

m a

Clocks: x, y

x<=5 & y>3

x := 0

Guard

Boolean combination of integer bounds on 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

DelayTrans

(12)

Informationsteknologi

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

Timed Automata review

Invariants

Invariants ensure progress!!

Invariants

ensure

progress!!

(13)

Informationsteknologi

UCb

Example

Reachable?

a b

c

(14)

Informationsteknologi

UCb

Example

Reachable?

x y

(L0,x=0,y=0)

a b

c

(15)

Informationsteknologi

UCb

Example

Reachable?

x y

(L0,x=0,y=0) Æ

ε(1.4)

(L0,x=1.4,y=1.4)

a b

c

ε(1.4)

(16)

Informationsteknologi

UCb

Example

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

(17)

Informationsteknologi

UCb

Example

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 ε(1.6 a

)

(18)

Informationsteknologi

UCb

(19)

Informationsteknologi

UCb

(20)

Informationsteknologi

UCb

(21)

Informationsteknologi

UCb

(22)

Informationsteknologi

UCb

Timed Automata: Example

a a a

guard

reset-set location

a

action

(23)

Informationsteknologi

UCb

Timed Automata: Example

≤3

x a a a a

Invariant

(24)

Informationsteknologi

UCb

Light Control Interface

Control Program

User

Interface

Light

endhold!

endhold!

touch!

touch!

starthold!

starthold!

press?

press?

release?

release?

L++/L--/L:=0L++/L--/L:=0

(25)

Informationsteknologi

UCb

Light Control Interface

Control Program

User

endhold!

endhold!

touch!

touch!

starthold!

starthold!

press?

press?

release?

release?

L++/L--/L:=0L++/L--/L:=0

(26)

Informationsteknologi

UCb

Networks of Timed Automata

(a’la CCS)

l1

l2 a!

x>=2

x := 0

m1

m2 a?

y<=4

………….

Two-way synchronization on complementary actions.

Closed Systems!

Two-way synchronization on 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

(27)

Informationsteknologi

UCb

Network Semantics

A X

) s s

, ,

S S

( T

T

1

⎪⎪

X 2

=

1

×

2

10

⎪⎪

X 20

⎪⎪

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

(28)

Informationsteknologi

UCb

Network Semantics

(URGENT synchronization)

A X

) s s

, ,

S S

( T

T

1

⎪⎪

X 2

=

1

×

2

10

⎪⎪

X 20

⎪⎪

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:

¬ ( s1e(d’) u? → → ∧ s2e(d’) u!→ → )

(29)

Informationsteknologi

UCb

Control Program

Light Control Network

endhold!

endhold!

touch!

touch!

starthold!

starthold!

press?

press?

release?

release?

(30)

Overview of the

UPPAAL Toolkit

(31)

Informationsteknologi

UCb

UPPAAL’s architecture

Linux, Windows, Solaris, MacOS

(32)

Informationsteknologi

UCb

GUI

Editor

Simulator

Verifier

(33)

Informationsteknologi

UCb

Train Crossing

River Crossing

Gate Stopable

Area

[10,20]

[7,15]

Queue

[3,5]

(34)

Informationsteknologi

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.

(35)

Timed Automata

in UPPAAL

(36)

Informationsteknologi

UCb

Declarations

Constants

Bounded integers Channels

Clocks Arrays

Templates Processes Systems Constants

Bounded integers Channels

Clocks Arrays

Templates Processes Systems

(37)

Informationsteknologi

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 two clocks: x and y.

(38)

Informationsteknologi

UCb

Declarations in UPPAAL (cont.)

„ Data variables

Syntax:

int n1, … ; Integer with “default” domain.

int[l,u] n1, … ; Integer with domain “l” to “u”.

int n1[m], … ; Integer array w. elements n1[0] to n1[m-1].

Example:

int a, b;

int[0,1] a, b[5][6];

(39)

Informationsteknologi

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;

(40)

Informationsteknologi

UCb

Declarations U PPAAL (cont.)

„ Constants

Syntax:

const int c1 = n1;

Example:

const int[0,1] YES = 1;

const bool NO = false;

(41)

Informationsteknologi

UCb

Timed Automata in UPPAAL

invariants

Guards

Synchronizations Resets

Discrete Variables

(42)

Informationsteknologi

UCb

Timed Automata 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

{ , , , , }

op { , , , , ,! }

=

= ⊗ ⊗ +

=

⊗∈ < <= == >= >

∈ < <= == >= > =

d

i : Expr

Expr :: i|i[Expr]|

n| Expr|

Expr Expr|

Expr Expr|

Expr *Expr|

Expr/Expr|

(g ?Expr : Expr)

=

=

− +

(43)

Informationsteknologi

UCb

Expressions

used in

guards, invariants, assignments, synchronizations properties,

used in

guards, invariants, assignments, synchronizations properties,

(44)

Informationsteknologi

UCb

Expressions

(45)

Informationsteknologi

UCb

Operators

(46)

Informationsteknologi

UCb

Guards, Invariants, Assignments

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 only compared to integer expressions

„ Guards over clocks are essentially conjunctions (I.e. disjunctions are only allowed over integer

conditions)

Assignments

„ 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

Invariants

„ It forms conjunctions of conditions of the form x<e or x<=e where x is a clock reference and e evaluates to an integer

(47)

Informationsteknologi

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 other 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 one 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.

(48)

Informationsteknologi

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;

(49)

Informationsteknologi

UCb

Templates

„ 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);

(50)

Informationsteknologi

UCb

Extensions

Select statement

„ 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];

(51)

Informationsteknologi

UCb

Urgency & Commitment

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!

Committed Locations

„ No delay.

„ Next transition MUST

involve edge in one of the processes in committed location

„ May reduce considerably state space

(52)

TCTL:

Timed Computational Tree

Logic

(53)

Informationsteknologi

UCb

TCTL = CTL + Time

φ α

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

(54)

Informationsteknologi

UCb

Derived Operators

Along any path φ holds continuously until within 7 time units ψ becomes valid.

=

=

The property φ becomes valid within 5 time units.

(55)

Informationsteknologi

UCb

Paths

Example:

push

click push

9 y

. . . ) 9 ,

0 ,

( )

9 ),

3 (

9 ,

(

) 3 ,

3 ,

( )

, 0 ,

(

) ,

( )

0 ,

(

) 5 . 3 ,

( )

0 ,

(

) 3 ( 9 3

5 . 3

=

=

⎯→

= +

=

⎯ →

⎯ +

=

=

⎯→

=

=

⎯→

=

=

⎯→

=

=

⎯→

=

=

⎯→

=

=

+

y x

off y

x on

y x

on y

x on

y x

on y

x on

y x

off y

x off

click

push push

π

π π

π

π π

(56)

Informationsteknologi

UCb

Elapsed time in path

. . . ) 9 ,

0 ,

( )

9 ),

3 (

9 ,

(

) 3 ,

3 ,

( )

, 0 ,

(

) ,

( )

0 ,

(

) 5 . 3 ,

( )

0 ,

(

) 3 ( 9 3

5 . 3

=

=

⎯→

= +

=

⎯ →

⎯ +

=

=

⎯→

=

=

⎯→

=

=

⎯→

=

=

⎯→

=

=

⎯→

=

=

+

y x

off y

x on

y x

on y

x on

y x

on y

x on

y x

off y

x off

click

push push

π

π π

π

π π

Example:

σ=

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

(57)

Informationsteknologi

UCb

TCTL Semantics

s - location

w - formula clock valuation P

M

(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’))

(58)

Informationsteknologi

UCb

Timeliness 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)

(59)

UPPAAL

Specification Language

(60)

Informationsteknologi

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).

(61)

Informationsteknologi

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

(62)

Informationsteknologi

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

(63)

Informationsteknologi

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

(64)

Informationsteknologi

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

(65)

Informationsteknologi

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.

(66)

Informationsteknologi

UCb

Gear Controller

with MECEL AB Lindahl, Pettersson, Yi 1998

Volvo Saab

Network Canbus

GearBox Engine

Interface Clutch

GearControl

Flowgraph

(67)

Informationsteknologi

UCb

Gear Controller

with MECEL AB Requirements

Volvo Saab

GearBox Engine

Interface Clutch GearControl

(68)

Informationsteknologi

UCb

UPPAAL 3.4

Gate Template

IntQueue

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

(69)

Informationsteknologi

UCb

UPPAAL 3.6 (3.5) with C-Code

Gate Template

Gate Declaration

(70)

Informationsteknologi

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]

(71)

Informationsteknologi

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]

(72)

Informationsteknologi

UCb

www.uppaal.com

Referencer

RELATEREDE DOKUMENTER

Further I would like to define the dysfunctions of the archaeological contexts as post depositional by character, either caused by natural erosion or by later.. land use damages.

Headway time (short headways) ≈ travel time  Waiting time factor 2 Note: Multipliers do not apply to business travel VTT in the same way.. Effect of

putbox occurs periodically (exactly) every 25 time units (note: other putbox’s may occur

Second, we consider continuous-time Markov chains (CTMCs), frequently used in performance analysis, which model continuous real time and probabilistic choice: one can specify the

an alternative path of no greater weight THUS Remove all redundant edges.. An edge is REDUNDANT if there exists an alternative path of no

This method uses a fast ray tracer to emit photons and a pixel shader 1 is used to filter a screen-sized texture containing the rendered photons.. Some advantages of this method

Cancer prehabilitation, a process on the continuum of care that occurs between the time of cancer diagnosis and the beginning of acute treatment, includes

These include lighting and lumen hours, children´s study time after nightfall, energy expenditures and usage time of the most frequent appliances used by households in