Modelling and Analysis of Real Time Systems Kim Guldstrand Larsen

Post on 18-Jan-2016

36 views 3 download

Tags:

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 of Modelling and Analysis of Real Time Systems Kim Guldstrand Larsen

Modelling and Analysis of Real Time Systems

Kim Guldstrand Larsen

using UPPAAL2kUPPAAL2k

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

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)

4UCb Kim G. Larsen

The impatient CS

Machine

Person

Observer

cof

coin

pub

Ready

Wait

coin!

cof?

pub!

5UCb Kim G. Larsen

The impatient CS

Machine

Person

Observer

cof

coin

pub

Ready

Wait

coin!

T:=8

cof?

pub!

Error

to(T)

6UCb Kim G. Larsen

CSMA/CD protocol

m! m? m! m?

7UCb Kim G. Larsen

CSMA/CD protocol

EVENTS

Timed Automata

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.

10UCb Kim G. Larsen

Intelligent Light Control

Off Light Brightpress? press?

press?

press?

Solution: Add real-valued clock x

X:=0X<=3

X>3

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

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

13UCb Kim G. Larsen

Timed Automata: Exampleguard

reset-set

location

a

action

14UCb Kim G. Larsen

Timed Automata: Example

aa a

guard

reset-set

location

a

action

15UCb Kim G. Larsen

Timed Automata: Example

3x a

Invariant

16UCb Kim G. Larsen

Timed Automata: Example

3x a a a a

Invariant

17UCb Kim G. Larsen

18UCb Kim G. Larsen

19UCb Kim G. Larsen

20UCb Kim G. 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

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

UPPAALUPPAAL

Modelling and Verification of Real Time systems

UPPAAL2k > 800 users > 35 countries

UPPAAL2k > 800 users > 35 countries

www.uppaal.com

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

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

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

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

UPPAAL Demo

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

30UCb Kim G. Larsen

The Production CellCourse at DTU, Copenhagen

Production Cell

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

32UCb Kim G. Larsen

Train Crossing

River

Crossing

Gate

StopableArea

[10,20][7,15]

Queue

[3,5]

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)

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)