modelling and analysis of real time systems kim guldstrand larsen

34
Modelling and Analysis of Real Time Systems Kim Guldstrand Larsen using UPPAAL2k UPPAAL2k

Upload: devon

Post on 18-Jan-2016

38 views

Category:

Documents


3 download

DESCRIPTION

Modelling and Analysis of Real Time Systems Kim Guldstrand Larsen. using UPPAAL2k. Hybrid & Real Time Systems. Computer Science. Control Theory. sensors. Task. Task. Task. Task. actuators. Controller Program Discrete. Plant Continuous. Eg.:. Pump Control Air Bags Robots - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

Modelling and Analysis of Real Time Systems

Kim Guldstrand Larsen

using UPPAAL2kUPPAAL2k

Page 2: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

2UCb Kim G. Larsen

Hybrid & Real Time Systems

PlantContinuous

Controller ProgramDiscrete

Control Theory Computer Science

Eg.:Pump ControlAir BagsRobotsCruise ControlABSCD PlayersProduction Lines

Real Time SystemA system where correctness not only depends on the logical order of events but also on their timing

Real Time SystemA system where correctness not only depends on the logical order of events but also on their timing

sensors

actuators

TaskTask

TaskTask

Page 3: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

3UCb Kim G. Larsen

Validation & VerificationConstruction of UPPAAL models

PlantContinuous

Controller ProgramDiscrete

sensors

actuators

TaskTask

TaskTask

a

cb

1 2

43

a

cb

1 2

43

1 2

43

1 2

43

a

cb

UPPAAL Model

Modelofenvironment(user-supplied)

Model oftasks(automatic)

Page 4: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

4UCb Kim G. Larsen

The impatient CS

Machine

Person

Observer

cof

coin

pub

Ready

Wait

coin!

cof?

pub!

Page 5: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

5UCb Kim G. Larsen

The impatient CS

Machine

Person

Observer

cof

coin

pub

Ready

Wait

coin!

T:=8

cof?

pub!

Error

to(T)

Page 6: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

6UCb Kim G. Larsen

CSMA/CD protocol

m! m? m! m?

Page 7: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

7UCb Kim G. Larsen

CSMA/CD protocol

EVENTS

Page 8: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

Timed Automata

Page 9: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

9UCb Kim G. Larsen

Intelligent Light Control

Off Light Brightpress? press?

press?

press?

WANT: if press is issued twice quickly then the light will get brighter; otherwise the light is turned off.

Page 10: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

10UCb Kim G. Larsen

Intelligent Light Control

Off Light Brightpress? press?

press?

press?

Solution: Add real-valued clock x

X:=0X<=3

X>3

Page 11: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

11UCb Kim G. Larsen

Timed Automata

n

m

a

Alur & Dill 1990

Clocks: x, y

x<=5 & y>3

x := 0

Guard Boolean combination of integer boundson clocks and clock-differences.

ResetAction perfomed on clocks

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

Actionused

for synchronization

Page 12: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

12UCb Kim G. Larsen

n

m

a

Clocks: x, y

x<=5 & y>3

x := 0

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

LocationInvariants

g1g2 g3

g4

Timed Automata Invariants

Invariants ensure

progress!!

Invariants ensure

progress!!

Page 13: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

13UCb Kim G. Larsen

Timed Automata: Exampleguard

reset-set

location

a

action

Page 14: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

14UCb Kim G. Larsen

Timed Automata: Example

aa a

guard

reset-set

location

a

action

Page 15: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

15UCb Kim G. Larsen

Timed Automata: Example

3x a

Invariant

Page 16: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

16UCb Kim G. Larsen

Timed Automata: Example

3x a a a a

Invariant

Page 17: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

17UCb Kim G. Larsen

Page 18: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

18UCb Kim G. Larsen

Page 19: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

19UCb Kim G. Larsen

Page 20: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

20UCb Kim G. Larsen

Page 21: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

21UCb Kim G. Larsen

Parallel Composition (a’la CCS)

l1

l2

a!

x>=2

x := 0

m1

m2

a?

y<=4

………….Two-way synchronizationon complementary actions.

Closed Systems!

Two-way synchronizationon 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

Page 22: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

22UCb Kim G. Larsen

The UPPAAL Model= Networks of Timed Automata + Integer Variables +….

l1

l2

a!

x>=2i==3

x := 0i:=i+4

m1

m2

a?

y<=4

………….Two-way synchronizationon complementary actions.

Closed Systems!

Two-way synchronizationon complementary actions.

Closed Systems!

(l1, m1,………, x=2, y=3.5, i=3,…..) (l2,m2,……..,x=0, y=3.5, i=7,…..)

(l1,m1,………,x=2.2, y=3.7, I=3,…..)

0.2

tau

Example transitions

If a URGENT CHANNEL

Page 23: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

UPPAALUPPAAL

Modelling and Verification of Real Time systems

UPPAAL2k > 800 users > 35 countries

UPPAAL2k > 800 users > 35 countries

www.uppaal.com

Page 24: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

24UCb Kim G. Larsen

Collaborators@UPPsala

Wang Yi Johan Bengtsson Paul Pettersson Fredrik Larsson Alexandre David Tobias Amnell Oliver Möller

@AALborg Kim G Larsen Arne Skou Paul Pettersson Carsten Weise Kåre J Kristoffersen Gerd Behrman Thomas Hune Oliver Möller Nicky Oliver Bodentien Lasse Poulsen

@Elsewhere David Griffioen, Ansgar Fehnker, Frits Vandraager, Klaus Havelund, Theo

Ruys, Pedro D’Argenio, J-P Katoen, J. Tretmans,Judi Romijn, Ed Brinksma, Franck Cassez, Magnus Lindahl, Francois Laroussinie, Patricia Bouyer, Augusto Burgueno, H. Bowmann, D. Latella, M. Massink, G. Faconti, Kristina Lundqvist, Lars Asplund, Justin Pearson...

Page 25: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

25UCb Kim G. Larsen

LEGO Mindstorms/RCX

Sensors: temperature, light, rotation, pressure.

Actuators: motors, lamps,

Virtual machine: 10 tasks, 4 timers,

16 integers.Several Programming Languages:

NotQuiteC, Mindstorm, Robotics, legOS, etc.

3 input ports

3 output ports

1 infra-red port

Page 26: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

26UCb Kim G. Larsen

First UPPAAL modelSorting of Lego Boxes

Conveyer Belt

Exercise: Design Controller so that only black boxes are being pushed out

BoxesPiston

Black

red9 18 81 90

99

BlckRd

remove

eject

Controller

Ken Tindell

MAIN PUSH

Page 27: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

27UCb Kim G. Larsen

NQC programs

task PUSH{ while(true){ wait(Timer(1)>DELAY && active==1); active=0; Rev(OUT_C,1); Sleep(8); Fwd(OUT_C,1); Sleep(12); Off(OUT_C); }}

task PUSH{ while(true){ wait(Timer(1)>DELAY && active==1); active=0; Rev(OUT_C,1); Sleep(8); Fwd(OUT_C,1); Sleep(12); Off(OUT_C); }}

int active;int DELAY;int LIGHT_LEVEL;

int active;int DELAY;int LIGHT_LEVEL;

task MAIN{ DELAY=75; LIGHT_LEVEL=35; active=0; Sensor(IN_1, IN_LIGHT); Fwd(OUT_A,1); Display(1);

start PUSH; while(true){ wait(IN_1<=LIGHT_LEVEL); ClearTimer(1); active=1; PlaySound(1); wait(IN_1>LIGHT_LEVEL); }}

task MAIN{ DELAY=75; LIGHT_LEVEL=35; active=0; Sensor(IN_1, IN_LIGHT); Fwd(OUT_A,1); Display(1);

start PUSH; while(true){ wait(IN_1<=LIGHT_LEVEL); ClearTimer(1); active=1; PlaySound(1); wait(IN_1>LIGHT_LEVEL); }}

Page 28: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

UPPAAL Demo

Page 29: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

29UCb Kim G. Larsen

From RCX to UPPAAL

Model includes Round-Robin Scheduler.

Compilation of RCX tasks into TA models.

Presented at ECRTS 2000

Task MAIN

Page 30: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

30UCb Kim G. Larsen

The Production CellCourse at DTU, Copenhagen

Production Cell

Page 31: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

31UCb Kim G. Larsen

Challenge

Machine

Person

Observer

cof

coin

pub

Waity<=3

Ready

Waity<=2

Go

coin!y:=0

y=3

cof?y:=0

y=2

pub!

Design Machine and Observer

Page 32: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

32UCb Kim G. Larsen

Train Crossing

River

Crossing

Gate

StopableArea

[10,20][7,15]

Queue

[3,5]

Page 33: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

33UCb Kim G. Larsen

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)

Page 34: Modelling and Analysis of  Real Time Systems Kim Guldstrand Larsen

34UCb Kim G. Larsen

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)