brics@aalborg uppaal systemer
TRANSCRIPT
UUUUCCCCbbbb
Verifikation af realtids Verifikation af realtids systemersystemeri i UPPAALUPPAAL
Kim G. LarsenBRICS@Aalborg
2MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
Research ProfileDistributed Systems & Semantics Unit
Semantic Modelsconcurrency, mobility, objects real-time, hybrid systems
Validation & Verificationalgorithms & tools
Constructionreal-time & network systems
3MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
BRICS Machine Basic Research in Computer Science
30+40+40 Millkr
100
100
Aalborg Aarhus
ToolsOther revelvant projects
UPPAAL, VHS, VVS, WOODDES
4MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
Tools and BRICS
Logicā¢ Temporal Logicā¢ Modal Logicā¢ MSOL ā¢ā¢
Algorithmicā¢ (Timed) Automata Theoryā¢ Graph Theoryā¢ BDDsā¢ Polyhedra Manipulationā¢ā¢
Semanticsā¢ Concurrency Theoryā¢ Abstract Interpretationā¢ Compositionalityā¢ Models for real-time
& hybrid systemsā¢ā¢
HOL TLP
Applications
PVS ALFSPIN
visualSTATE UPPAAL
5MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
A REAL real time system
Klaus Havelund, NASA
6MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
Embedded Systems
SyncMaster 17GLsi
Telephone
Tamagotchi
Mobile Phone
Digital Watch
7MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
Introducing, Detecting and Repairing Errors Liggesmeyer 98
8MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
Introducing, Detecting and Repairing Errors Liggesmeyer 98
9MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
Suggested Solution?
Model based validation, verfication and testing of
software and hardware
10MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
Verification & Validation
Design Model Specification
Analysis
Implementation
Testing
11MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
Verification & Validation
Design Model SpecificationVerification & Refusal
AnalysisValidation
Implementation
Testing
UML
SDL
12MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
Verification & Validation
Design Model SpecificationVerification & Refusal
AnalysisValidation
Implementation
Testing
UML
SDL
ModelExtraction
AutomaticCode generation
13MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
Verification & Validation
Design Model SpecificationVerification & Refusal
AnalysisValidation
Implementation
Testing
UML
AutomaticCode generation
AutomaticTest generation
SDL
ModelExtraction
14MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
How?
Unified Model = State Machine!
a
b
x
ya?
b?
x!
y!b?
Control states
Inputports
Outputports
15MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
TamagotchiA C
Health=0 or Age=2.000
B
Passive Feeding Light
Clean
PlayDisciplineMedicine
Care
Tick
Health:=Health-1; Age:=Age+1
AA
A
A
AA
A
A
Meal
Snack
B
B
ALIVE
DEAD
Health:=Health-1
16MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
SYNCmaster
17MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
Digital Watch
18MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
visualSTATE
ļæ½ Hierarchical state systems
ļæ½ Flat state systemsļæ½ Multiple and inter-
related state machines
ļæ½ Supports UML notation
ļæ½ Device driver access
VVSw Baan Visualstate, DTU (CIT project)
19MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
The SDL EditorThe SDL EditorThe SDL Editor
Process levelProcess level
20MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
SPIN, G
erald Holzm
ann AT&
T
21MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
UPP A
AL
22MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
āState Explosionā problem
a
cb
1 2
43
1,a 4,a
3,a 4,a
1,b 2,b
3,b 4,b
1,c 2,c
3,c 4,c
All combinations = exponential in no. of components
M1 M2
M1 x M2
Provably theoretical
intractable
23MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
Train Simulator1421 machines11102 transitions2981 inputs2667 outputs3204 local statesDeclare state sp.: 10^476
BUGS ?
VVSvisualSTATE
Our techniuqes has reduced verification
time with several orders of magnitude
(ex 14 days to 6 sec)
24MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
Tool Support (model checking)
System Description A
Requirement F Yes, PrototypesExecutable CodeTest sequences
No!Debugging Information
Tools: Telelogic, Verilog, UPPAAL, SPIN, MV, Statemate, visualSTATE, FormalCheck, VeriSoft, Java Pathfinder,ā¦
TOOLTOOL
UUUUCCCCbbbb
UPPAALUPPAAL
Modelling and Verification ofReal Time systems
UPPAAL2k> 800 users> 35 countries
UPPAAL2k> 800 users> 35 countries
www.uppaal.com
26MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
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...
27MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
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
28MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
Construction 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?)
29MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
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
30MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
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!!
31MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
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
32MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
Timed Automata in UPPAAL
ļæ½Timed (Safety) Automata+ urgent actions + urgent locations+ committed locations+ data-variables (with bounded domains)+ arrays of data-variables + constants + guards and assignments over data-variables and
arraysā¦+ templates with local clocks, data-variables, and
constants.
33MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
Declarations in UPPAAL
clock x1, ā¦, xn;
int i1, ā¦, im;
chan a1, ā¦, ao;
const c1 n1, ā¦, cp np;
Examples:clock x, y;
int i, J0; int[0,1] k[5];
const delay 5, true 1, false 0;
Array k of five booleans.
34MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
Timed Automata in UPPAAL
n
m
a
x<=5 & y>3
x := 0
x<=5
y<=10
g1g2 g3
g4
invinvnxnxinv ,||:: ā¤<=
clock natural number and
}!,,,,,{},,,,{
::|::
,||::
=>>==<=<ā>>==<=<ā
=+=
=
op
ExpropExprgnyxnxg
ggggg
d
c
dc
ļæ½
ļæ½ļæ½
nx =:
clock guards
data guards
clock assignments
clock assignments
):?(|/|*||
|||][|::
:
ExprExprgExprExprExprExprExprExprExprExpr
ExprnExpriiExpr
Expri
d
ā+
ā=
=
location invariants
35MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
Urgent Channels
urgent chan hurry;
Informal Semantics:ā¢ There will be no delay if transition with urgent action can be taken.
Restrictions:ā¢ No clock guard allowed on transitions with urgent actions.ā¢ Invariants and data-variable guards are allowed.
36MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
Urgent Locations
Click āUrgentā in State Editor.
Informal Semantics:ā¢ No delay in urgent location.
Note: the use of urgent locations reduces the number of clocks in a model, and thus the complexity of the analysis.
37MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
Committed Locations
Click āCommittedā in State Editor.
Informal Semantics:ā¢ No delay in committed location.ā¢ Next transition must involve automata in committed location.
Note: the use of committed locations reduces the number of clocks in a model, and allows for more space and time efficient analysis.
38MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
UPPAAL Specification Language
A[] p (AG p)E<> p (EF p)
p::= a.l | gd | gc | p and p |
p or p | not p | p imply p |
( p )
clock guardsdata guardsprocess location
UUUUCCCCbbbb
BRICK SORTING
40MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
First UPPAAL modelSorting of Lego BoxesSorting of Lego BoxesSorting of Lego BoxesSorting 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
41MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
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);
}}
42MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
From RCX to UPPAAL
ļæ½Model includes Round-Robin Scheduler.
ļæ½Compilation of RCX tasks into TA models.
ļæ½Presented at ECRTS2000
Task MAIN
43MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
The Production CellCourse at DTU, Copenhagen
Production Cell
UUUUCCCCbbbb
TRAIN CROSSING
45MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
Train Crossing
River
Crossing
Gate
StopableArea
[10,20]
[7,15]
Queue
[3,5]
46MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
Train Crossing
River
Crossing
Gate
StopableArea
[10,20]
[7,15]
Queue
[3,5]appr,stop
leave
go
emptynonemptyhd, add,rem
elel
Communication via channels andshared variable.
UUUUCCCCbbbb
Communication ProtocolsCSMA/CDBRPā¦ā¦
48MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
CSMA/CD protocol ā MAC layer
send - service provided by Mac which reacts by transmitting a message,
rec - (receive) service provided by Mac, indicates that a message is ready to be received,
b - (begin) Mac begins message transmission to M, e - (end) Mac terminates message transmission to M, br - (begin receive) M begins message delivery to Mac, er - (end receive) M terminates message delivery to Mac, b - (collision) Mac is notified that a
collision has occurred on M.
EVENTS
UUUUCCCCbbbb
Philips Bounded Retransmission Protocol
[DāArgenio et.al. 97]
50MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
Protocol Overviewļæ½Protocol developed by Philips.ļæ½Transfer data between Audio/Video components
via infra-red communication.ļæ½Data files sent in smaller chunks.ļæ½Problem: Unreliable communication medium.ļæ½Sender retransmit if receiver respond too late.ļæ½Receiver abort if sender sends too late.
51MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
Overview of BRP
Sender Receiver
S R
K
L
Input: file = p1, ā¦, pn
lossy
lossy
Output: p1, ā¦, pn
BRP
pi
ack
52MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
How It Works
ļæ½Sender input: file = p1, ā¦, pn.
ļæ½S sends (p1,FST,0), (p2,INC,1), ā¦, (pn-1,INC,1), (pn,OK,0).
ļæ½R sends: ack, ā¦, ack.ļæ½S retransmits pi if timeout.ļæ½Receiver recives: p1, ā¦, pn.ļæ½Sender and Receiver receives NOK or OK.
whole file OK
more parts will followfirst part of file
53MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
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)
54MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
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)
55MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
BRP Model OverviewSender Receiver
S R
K
L
Input: file = p1, ā¦, pn
ack
(pi,INDication,abit)
lossy
lossy
ok, nok, dk IND, ok, nok
Output: p1, ā¦, pn
BRP
56MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
The Lossy Media
value-passing
lossy = may dropmessages
one-place capacity
delay
57MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
Bounded Retransmission
ļæ½S sends a chunk pi and waits for ack from R.ļæ½If timeout the chunk is retransmitted.ļæ½If too many timeout the transmission fails
(NOK is sent to Sender). ļæ½If whole file successfully sent OK is sent to
Sender.ļæ½Receiver is similar.
58MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
Process S
59MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
Process R
60MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
The Sender and Receiver
61MIIāā2001 Kim G. LarsenUCUCUCUCb b b b
āIf you want to know moreā
ļæ½Test & Verification ļæ½ http://www.cs.auc.dk/~ejersbo/tov/Plan.html
ļæ½BRICS@Aalborgļæ½ http://www.cs.auc.dk/research/FS/
ļæ½UPPAALļæ½ http://www.uppaal.com
ļæ½WOODDES, ATT (VHS):ļæ½ http://www.docs.uu.se/docs/rtmv/wooddes/ļæ½ http://www-verimag.imag.fr/VHS/main.html
ļæ½Strategic Directions in Computing Research Formal Methods Working Group, ACM June 1996ļæ½ http://www.cs.cmu.edu/afs/cs/usr/wing/www/mit/mit.html