from timed automata to stochastic hybrid games

71
From Timed Automata to Stochastic Hybrid Games Model Checking, Performance Evaluation and Synthesis Kim G. Larsen Aalborg University, DENMARK

Upload: others

Post on 21-Oct-2021

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: From Timed Automata to Stochastic Hybrid Games

From Timed Automata to Stochastic Hybrid Games

Model Checking, Performance Evaluation and Synthesis

Kim G. Larsen

Aalborg University, DENMARK

TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAAAAAA

Page 2: From Timed Automata to Stochastic Hybrid Games

Aalborg

Aalborg University leading Danish ICT University in terms of

public investments (33%)

Aalborg

Aarhus

Copenhagen

Jomfru Ane Gade

SSFT2015 / Kim G Larsen

Page 3: From Timed Automata to Stochastic Hybrid Games

CISS - Center For Embedded Software Systems

Regional ICT Center (2003- )

3 research groups

Computer Science

Control Theory

HW/SW- codesign

20 Employed

25 Associated

20 PhD Students

50 Industrial projects

10 Elite-students

65 MDKK

ARTIST Design

ARTEMIS

SSFT2015 / Kim G Larsen

Page 4: From Timed Automata to Stochastic Hybrid Games

ES are Pervasive

Characteristica:

Dedicated function Complex environment SW/HW/Mechanics Autonomous Ressource constrained : Energy : Bandwidth : Memory : … Timing constraints

SSFT2015 / Kim G Larsen

Page 5: From Timed Automata to Stochastic Hybrid Games

ES are often Safety Critical

300 horse power

100 processors

How to achieve ES that are: • correct • predicable • dependable • fault tolerant • ressource minial • cheap

.. Model-Based Development

SSFT2015 / Kim G Larsen

Page 6: From Timed Automata to Stochastic Hybrid Games

Model Checking

TOOL

System Description

Requirement

Yes Prototypes

Executable Code Test sequences

No! Debugging Information

A( req ) A} grant)

A( req ) A}t<30s grant)

A( req ) A}t<30s , p>0.90 grant)

A( req ) A}t<30s,c<5$ grant)

Time Cost Probability

SSFT2015 / Kim G Larsen

Page 7: From Timed Automata to Stochastic Hybrid Games

TOOL

System Description

Requirement

Yes Control Strategy

No! Debugging Information

A( req ) A} grant)

A( req ) A}t<30s grant)

A( req ) A}t<30s,c<5$ grant)

Synthesis

Time Cost Probability ?

A( req ) A}t<30s , p>0.90 grant)

SSFT2015 / Kim G Larsen

Page 8: From Timed Automata to Stochastic Hybrid Games

Origin of UPPAAL

SSFT2015 / Kim G Larsen

TAU CCS & Modal Transition Systems

Refinements

Modal Mu-Calculus

Explicit State Representation

Prolog

EPSILON TCCS

Timed Refinements

Timed Mu-Calculus

Regions

Prolog

1989

1993 UPPAAL

Timed Automata

TCTL

Zones

C++ & Java

1995

2007

UP4ALL

2013

CAV Award

Page 9: From Timed Automata to Stochastic Hybrid Games

Contributors

@UPPsala Wang Yi

Paul Pettersson

John Håkansson

Anders Hessel

Pavel Krcal

Leonid Mokrushin

Shi Xiaochun

@AALborg Kim G Larsen Alexandre David Marius Mikucionis Gerd Behrman Arne Skou Brian Nielsen Jacob I. Rasmussen Thomas Chatain

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

SSFT2015 / Kim G Larsen

Page 10: From Timed Automata to Stochastic Hybrid Games

UPPAAL Model Checker

Editor

Simulator

SSFT2015 / Kim G Larsen

Verifier Performance

Analyses

Discrete Control

Concurrency

Continuous Aspects

Stochasticity

Timing Constraints

Resources

Page 11: From Timed Automata to Stochastic Hybrid Games

Overview

Timed Automata & UPPAAL Symbolic Verification &

UPPAAL Engine, Options

Priced Timed Automata and Timed Games

Stochastic Timed Automata

Statistical Model Checking Optimal Synthesis

(Lecture + Exercise)4

TRON

CLASSIC

TIGA

CORA

SMC

SSFT2015 / Kim G Larsen

ECDAR

STRATEGO

Page 12: From Timed Automata to Stochastic Hybrid Games

www.cs.aau.dk/~kgl/SSFT205

SSFT2015 / Kim G Larsen

www.uppaal.org

Page 13: From Timed Automata to Stochastic Hybrid Games

Timed Automata

Page 14: From Timed Automata to Stochastic Hybrid Games

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

sensors

actuators

SSFT2015 / Kim G Larsen

Page 15: From Timed Automata to Stochastic Hybrid Games

A Dumb Light Controller

SSFT2015 / Kim G Larsen

Page 16: From Timed Automata to Stochastic Hybrid Games

Timed Automata

ADD a clock x

Synchronizing

action

Clock Guard

Conjunctions of

x~n

x: real-valued

clock

Reset

[Alur & Dill’89]

SSFT2015 / Kim G Larsen

Page 17: From Timed Automata to Stochastic Hybrid Games

A Timed Automata (Semantics)

States:

( location , x=v) where v2R

Transitions:

( Off , x=0 )

delay 4.32 ( Off , x=4.32 )

press? ( Light , x=0 )

delay 2.51 ( Light , x=2.51 )

press? ( Bright , x=2.51 )

SSFT2015 / Kim G Larsen

Page 18: From Timed Automata to Stochastic Hybrid Games

Intelligent Light Controller

Invariant

(Henzinger)

SSFT2015 / Kim G Larsen

Page 19: From Timed Automata to Stochastic Hybrid Games

Intelligent Light Controller

Transitions:

( Off , x=0 )

delay 4.32 ( Off , x=4.32 )

press? ( Light , x=0 )

delay 4.51 ( Light , x=4.51 )

press? ( Light , x=0 )

delay 100 ( Light , x=100)

( Off , x=0)

Note:

( Light , x=0 ) delay 103

X

Invariants ensures progress

SSFT2015 / Kim G Larsen

Page 20: From Timed Automata to Stochastic Hybrid Games

Intellingent Light Controller

SSFT2015 / Kim G Larsen

1 2 3

Page 21: From Timed Automata to Stochastic Hybrid Games

UPPAAL Demo

SSFT2015 / Kim G Larsen

Page 22: From Timed Automata to Stochastic Hybrid Games

Clock Valuations

SSFT2015 / Kim G Larsen

Page 23: From Timed Automata to Stochastic Hybrid Games

Clock Valuation – Operations

SSFT2015 / Kim G Larsen

Page 24: From Timed Automata to Stochastic Hybrid Games

Clock Valuation – Evaluation

SSFT2015 / Kim G Larsen

Page 25: From Timed Automata to Stochastic Hybrid Games

Timed Automata – Syntax

SSFT2015 / Kim G Larsen

Page 26: From Timed Automata to Stochastic Hybrid Games

Timed Automata – Semantics

SSFT2015 / Kim G Larsen

Page 27: From Timed Automata to Stochastic Hybrid Games

Timed Automata: Example

guard

reset

synchronization

SSFT2015 / Kim G Larsen

Page 28: From Timed Automata to Stochastic Hybrid Games

Timed Automata: Example

guard

invariant

SSFT2015 / Kim G Larsen

Page 29: From Timed Automata to Stochastic Hybrid Games

Example

a b

c

Is L1 reachable ?

SSFT2015 / Kim G Larsen

Page 30: From Timed Automata to Stochastic Hybrid Games

Example

x

y

a b

c

SSFT2015 / Kim G Larsen

Page 31: From Timed Automata to Stochastic Hybrid Games

Example

x

y

a b

c

SSFT2015 / Kim G Larsen

Page 32: From Timed Automata to Stochastic Hybrid Games

Example

x

y

a

a b

c

SSFT2015 / Kim G Larsen

Page 33: From Timed Automata to Stochastic Hybrid Games

Example

x

y

a a

a b

c

SSFT2015 / Kim G Larsen

Page 34: From Timed Automata to Stochastic Hybrid Games

Networks Light Controller & User

Off Light Bright press? press?

press?

x:=0

x·3

x>3

x·100

x=100 x:=0

x·100

x=100 x:=0

x:=0

press? x:=0

Rest Busy

y¸10 y:=0

y·10

press!

press! y:=0

Transition

( Off, Rest, x=0, y=0 )

delay 20 ( Off, Rest, x=20, y=20 )

press?! ( Light, Busy, x=0, y=0 )

delay 2 ( Light, Busy, x=2, y=2)

press?! ( Bright, Rest, x=0, y=0)

Synchronization

x:=0

SSFT2015 / Kim G Larsen

Page 35: From Timed Automata to Stochastic Hybrid Games

Network Semantics

A X)s s ,,SS(T T 20

102121

X X

X X 2121

111

s ´ss s

´ss

X X ´s ss s

´ss

2121

222

X X ´s ´ss s

´ss ´ss aa

2121

222111

X X ´s ´ss s

´ss ´ss)d(e

)d(e)d(e

2121

222111

! ?

where

SSFT2015 / Kim G Larsen

Page 36: From Timed Automata to Stochastic Hybrid Games

Network Semantics (URGENT synchronization)

A X)s s ,,SS(T T 20

102121

X X

X X 2121

111

s ´ss s

´ss

X X ´s ss s

´ss

2121

222

X X ´s ´ss s

´ss ´ss aa

2121

222111

X X ´s ´ss s

´ss ´ss)d(e

)d(e)d(e

2121

222111

! ?

where

d’ < d, u UAct:

( s1 s2 ) e(d’) u! e(d’) u?

SSFT2015 / Kim G Larsen

Page 37: From Timed Automata to Stochastic Hybrid Games

UPPAAL First Introduction

Page 38: From Timed Automata to Stochastic Hybrid Games

Light Control Interface

Control Program

User

Interface

Light

endhold!

touch!

starthold! press?

release?

press? d release? touch! 0.5·d· 1 press? 1 startH! press? d release? endH! d >1

press? 0.2 release? … press? 0.7 release? … press? 1.0 2.4 release? …

Ø thouch! startH! endH! SSFT2015 / Kim G Larsen

Page 39: From Timed Automata to Stochastic Hybrid Games

Light Control Interface

Control Program

User

endhold!

touch!

starthold! press?

release?

SSFT2015 / Kim G Larsen

Page 40: From Timed Automata to Stochastic Hybrid Games

Control Program

Light Control Network

endhold!

touch!

starthold! press?

release?

SSFT2015 / Kim G Larsen

Page 41: From Timed Automata to Stochastic Hybrid Games

Full Light Controller

Dim

Dim

SSFT2015 / Kim G Larsen

Page 42: From Timed Automata to Stochastic Hybrid Games

Full Light Controller

Dim

Dim

SSFT2015 / Kim G Larsen

Page 43: From Timed Automata to Stochastic Hybrid Games

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

SSFT2015 / Kim G Larsen

Page 44: From Timed Automata to Stochastic Hybrid Games

A Real Timed System

Controller Program

LEGO MINDSTORM

The Plant Conveyor Belt

& Bricks

What is suppose to happen?

SSFT2015 / Kim G Larsen

Page 45: From Timed Automata to Stochastic Hybrid Games

First UPPAAL model Sorting of Lego Boxes

Conveyer Belt

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

Boxes

Piston

Black

red 9 18 81 90

99

Blck Rd

remove

eject

Controller

Ken Tindell

MAIN PUSH

SSFT2015 / Kim G Larsen

Page 46: From Timed Automata to Stochastic Hybrid Games

NQC programs

SSFT2015 / Kim G Larsen

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;

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 47: From Timed Automata to Stochastic Hybrid Games

A Black Brick

SSFT2015 / Kim G Larsen

Page 48: From Timed Automata to Stochastic Hybrid Games

Control Tasks & Piston

GLOBAL DECLARATIONS:

const int ctime = 75;

int[0,1] active;

clock x, time;

chan eject, ok;

urgent chan blck, red, remove, go;

SSFT2015 / Kim G Larsen

Page 49: From Timed Automata to Stochastic Hybrid Games

From RCX to UPPAAL

Model includes Round-Robin Scheduler.

Compilation of RCX tasks into TA models.

Presented at ECRTS 2000

Task MAIN

SSFT2015 / Kim G Larsen

Page 50: From Timed Automata to Stochastic Hybrid Games

The Production Cell Course at DTU, Copenhagen

Production Cell

SSFT2015 / Kim G Larsen

Page 51: From Timed Automata to Stochastic Hybrid Games

UPPAAL

Modeling & Specification

Page 52: From Timed Automata to Stochastic Hybrid Games

Train Crossing

Time

River

Bridge

tracks

Safe Approaching Crossing Safe

0 3 – 5

20

SSFT2015 / Kim G Larsen

Page 53: From Timed Automata to Stochastic Hybrid Games

Train Crossing

Time

River

Bridge

tracks

Safe Approaching Crossing Safe

Safe Approaching Crossing Safe

Stop the train while it still stoppable!

10 0 3 – 5

20

SSFT2015 / Kim G Larsen

Page 54: From Timed Automata to Stochastic Hybrid Games

Train Crossing

Time

River

Bridge

tracks

Safe Approaching Crossing Safe

Safe Approaching Crossing Safe

10 0 3 – 5

20

Stopped

Crossing Safe

Restarted Stopped

Crossing Safe

7 – 15

Crossing

Restarted

SSFT2015 / Kim G Larsen

Page 55: From Timed Automata to Stochastic Hybrid Games

Train Crossing

Safe Approaching Crossing Safe

Stopped Restarted

Add timing+ synchronization

SSFT2015 / Kim G Larsen

Page 57: From Timed Automata to Stochastic Hybrid Games

UPPAAL Help

SSFT2015 / Kim G Larsen

Page 58: From Timed Automata to Stochastic Hybrid Games

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

SSFT2015 / Kim G Larsen

Page 59: From Timed Automata to Stochastic Hybrid Games

Editor

SSFT2015 / Kim G Larsen

GUI

• Unlimited undo and redo

• Syntax and bracket highlighting

• Rectangular selection

• Customization of colors

• Tooltip

• Hiding of information

• Improved help menu with search component

Language

• User defined functions (C-like)

• New types (records, type declarations, meta variables, scalars)

• Partial instantiation of templates

• Select clauses on edges

• Forall and exist quantifiers

Page 60: From Timed Automata to Stochastic Hybrid Games

Concrete Simulator

SSFT2015 / Kim G Larsen

Graphical Simulator

• visualization

and recording

• inexpensive fault detection

• inspection of error traces

• Message Sequence Charts

• Gannt Charts

Page 61: From Timed Automata to Stochastic Hybrid Games

Symbolic Simulator

SSFT2015 / Kim G Larsen

Graphical Simulator

• visualization

and recording

• inexpensive fault detection

• inspection of error traces

• Message Sequence Charts

• Gannt Charts

Page 62: From Timed Automata to Stochastic Hybrid Games

Verifier

SSFT2015 / Kim G Larsen

Verifier

• Exhaustive & automatic

checking of requirements

• .. including validating, safety, liveness,

bounded liveness and

response properties

•.. generation of debugging information

for visualisation in simulator.

•.. performance properties,

e.g probabilistic and expectation.

• .. plot composer

Page 63: From Timed Automata to Stochastic Hybrid Games

Bang & Olufsen (1997)

Bug known to exist for 10 years

Ill-described: 2.800 loc + 3 flowchart + 1 B&O eng.

3 months for modeling.

UPPAAL detects error with 1.998 transition steps (shortest)

Error trace was confirmed in B&O laboratory.

Error corrected and verified in UPPAAL.

Follow-up project.

Arne Skou, Klaus Havelund

1st RTSS’97 talk, Klaus Havelund

SSFT2015 / Kim G Larsen

Page 64: From Timed Automata to Stochastic Hybrid Games

MECEL AB (1998) Gear Controller Lindahl, Pettersson, Yi 1998

Network

Canbus

GearBox Engine

Interface

Clutch GearControl

Flowgraph

Paul Pettersson

SSFT2015 / Kim G Larsen

Page 65: From Timed Automata to Stochastic Hybrid Games

MECEL AB (1998) Gear Controller Lindahl, Pettersson, Yi 1998

Network

Canbus

GearBox Engine

Interface

Clutch GearControl

Flowgraph

Paul Pettersson

SSFT2015 / Kim G Larsen

Page 66: From Timed Automata to Stochastic Hybrid Games

MECEL AB (1998) Gear Controller Lindahl, Pettersson, Yi 1998

Network

Canbus

GearBox Engine

Interface

Clutch GearControl

Paul Pettersson

SSFT2015 / Kim G Larsen

Page 67: From Timed Automata to Stochastic Hybrid Games

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]

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]

Adapting the UPPAAL Model of a Distributed Lift System, 2007

Analyzing a χ model of a turntable system using Spin, CADP and Uppaal, 2006

Designing, Modelling and Verifying a Container Terminal System Using UPPAAL, 2008

Model-based system analysis using Chi and Uppaal: An industrial case study, 2008

Climate Controller for Pig Stables, 2008

Optimal and Robust Controller for Hydralic Pump, 2009

SSFT2015 / Kim G Larsen

Page 68: From Timed Automata to Stochastic Hybrid Games

Case Studies: Protocols

Philips Audio Protocol [HS’95, CAV’95, RTSS’95, CAV’96] Bounded Retransmission Protocol [TACAS’97] Bang & Olufsen Audio/Video Protocol [RTSS’97] TDMA Protocol [PRFTS’97] Lip-Synchronization Protocol [FMICS’97] 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]

Analysis of a protocol for dynamic configuration of IPv4 link local addresses using Uppaal, 2006

Formalizing SHIM6, a Proposed Internet Standard in UPPAAL, 2007

Verifying the distributed real-time network protocol RTnet using Uppaal, 2007

Analysis of the Zeroconf protocol using UPPAAL, 2009

Analysis of a Clock Synchronization Protocol for Wireless Sensor Networks, 2009

Model Checking the FlexRay Physical Layer Protocol, 2010

SSFT2015 / Kim G Larsen

Page 69: From Timed Automata to Stochastic Hybrid Games

Using UPPAAL as Back-end

Vooduu: verification of object-oriented designs using Uppaal, 2004

Moby/RT: A Tool for Specification and Verification of Real-Time Systems, 2000

Formalising the ARTS MPSOC Model in UPPAAL, 2007

Timed automata translator for Uppaal to PVS Component-Based Design and Analysis of Embedded

Systems with UPPAAL PORT, 2008 Verification of COMDES-II Systems Using UPPAAL with

Model Transformation, 2008 METAMOC: Modular WCET Analysis Using UPPAAL,

2010.

SSFT2015 / Kim G Larsen

Page 70: From Timed Automata to Stochastic Hybrid Games

www.uppaal.org

SSFT2015 / Kim G Larsen

Page 71: From Timed Automata to Stochastic Hybrid Games

LAB-Exercises http://people.cs.aau.dk/~kgl/SSFT2015/

Exercise 1 (Brick Sorter)

Excercise 19 (Train Crossing)

Exercise 2 (Coffee Machine)

Exercise 28 (Jobshop Scheduling)