340 likes | 514 Views
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
E N D
Modelling and Analysis of Real Time SystemsKim 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 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
a a a 1 1 1 1 2 2 2 2 b b b c c c 3 3 3 3 4 4 4 4 Validation & VerificationConstruction of UPPAAL models Controller Program Discrete Plant Continuous sensors Task Task Task Model of tasks (automatic) Task actuators Model of environment (user-supplied) UPPAAL Model
The impatient CS Person Machine Observer coin! cof pub! pub coin Ready cof? Wait
The impatient CS Person Machine Observer coin! cof T:=8 pub! pub coin Ready to(T) cof? Wait Error
CSMA/CD protocol m! m? m! m?
CSMA/CD protocol EVENTS
Intelligent Light Control press? Off Light Bright press? press? press? WANT: if press is issued twice quickly then the light will get brighter; otherwise the light is turned off.
Intelligent Light Control press? X<=3 Off Light Bright X:=0 press? press? press? X>3 Solution: Add real-valued clock x
Timed Automata Alur & Dill 1990 Clocks:x, y Guard Boolean combination of integer bounds on clocks and clock-differences. n Reset Action perfomed on clocks Action used for synchronization x<=5 & y>3 State (location , x=v , y=u ) where v,u are in R a Transitions x := 0 a (n , x=2.4 , y=3.1415 ) (m , x=0 , y=3.1415 ) m e(1.1) (n , x=2.4 , y=3.1415 ) (n , x=3.5 , y=4.2415 )
Timed Automata Invariants n Clocks:x, y x<=5 Transitions x<=5 & y>3 e(3.2) Location Invariants (n , x=2.4 , y=3.1415 ) a e(1.1) (n , x=2.4 , y=3.1415 ) (n , x=3.5 , y=4.2415 ) x := 0 m Invariants ensure progress!! y<=10 g4 g1 g3 g2
Timed Automata: Example guard location a action reset-set
Timed Automata: Example guard location a a a a action reset-set
Timed Automata: Example a Invariant
Timed Automata: Example a a a a Invariant
Parallel Composition (a’la CCS) m1 l1 Two-way synchronization on complementary actions. Closed Systems! x>=2 y<=4 …………. a! a? x := 0 l2 m2 Example transitions (l1, m1,………, x=2, y=3.5,…..) (l2,m2,……..,x=0, y=3.5, …..) (l1,m1,………,x=2.2, y=3.7, …..) tau 0.2 If aURGENT CHANNEL
The UPPAAL Model= Networks of Timed Automata + Integer Variables +…. m1 l1 Two-way synchronization on complementary actions. Closed Systems! x>=2 i==3 y<=4 …………. a! a? x := 0 i:=i+4 l2 m2 Example transitions (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,…..) tau 0.2 If aURGENT CHANNEL
www.uppaal.com UPPAAL Modelling and Verification ofReal Timesystems UPPAAL2k > 800 users > 35 countries
@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 Collaborators @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...
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 output ports 1 infra-red port 3 input ports
First UPPAAL modelSorting of Lego Boxes Ken Tindell Piston Boxes eject remove 99 Conveyer Belt red 81 18 90 9 Blck Rd Controller MAIN PUSH Black Exercise: Design Controller so that only black boxes are being pushed out
NQC programs 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 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); } }
From RCX to UPPAAL Task MAIN • Model includes Round-Robin Scheduler. • Compilation of RCX tasks into TA models. • Presented at ECRTS 2000
The Production CellCourse at DTU, Copenhagen Production Cell
Challenge Person Machine Observer coin! y:=0 pub! cof Wait y<=3 pub Go y=3 coin Ready cof? y:=0 y=2 Wait y<=2 DesignMachine andObserver
Train Crossing Stopable Area [10,20] [7,15] [3,5] Crossing River Queue Gate
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)
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)