Formal Methods for Automation and Safety in Railway and Automotive Systems (FORMS/FORMAT) Braunschweig, Germany. December 2-3, 2004 Modelling and Analysis of Traffic Networks Based on Graph Transformation Juan de Lara E.T.S. de Inform´ atica, Universidad Auton´ oma de Madrid, Madrid, Spain Hans Vangheluwe School of Computer Science, McGill University, Montr´ eal, Canada Pieter J. Mosterman Simulation and Real-Time Technologies, The MathWorks, Inc., Natick, MA, USA FORMS/FORMAT 2004, 2-3 December, Braunschweig Modelling and Analysis of Traffic Networks Based on Graph Transformation 1/41
� � � Overview 1. Domain Specific (Visual) Modelling – DS(V)M What/Why of DS(V)M (and DS(V)Ls) ? 2. Building DS(V)M Tools Effectively (a) Specifying textual/visual syntax of DS(V)Ls: meta-modelling (b) Specifying DS(V)L semantics : transformations (c) Modelling (and executing) transformations : graph rewriting 3. Traffic , a domain specific modelling formalism Modelling a Traffic -Specific Modelling Tool (un-timed and timed versions) Various Transformations 4. Conclusions and Future Work FORMS/FORMAT 2004, 2-3 December, Braunschweig Modelling and Analysis of Traffic Networks Based on Graph Transformation 2/41
Goal: to Model/Analyse/Simulate Traffic Networks FORMS/FORMAT 2004, 2-3 December, Braunschweig Modelling and Analysis of Traffic Networks Based on Graph Transformation 3/41
Approach: Domain Specific (Visual) Modelling FORMS/FORMAT 2004, 2-3 December, Braunschweig Modelling and Analysis of Traffic Networks Based on Graph Transformation 4/41
� ✁ � � � ✁ Why DS(V)M ? match the user’s mental model of the problem domain maximally constrain user (to the problem at hand) easier to learn avoid errors separate domain-expert’s work from analysis/transformation expert’s work re-use transformation knowledge ( e.g., in variations of a domain specific formalism) FORMS/FORMAT 2004, 2-3 December, Braunschweig Modelling and Analysis of Traffic Networks Based on Graph Transformation 5/41
� � Building DS(V)M Tools Effectively . . . development cost of DS(V)M Tools may be prohibitive ! we want to effectively (rapidly, correctly, re-usably, . . . ) specify and generate/execute : – Domain Specific (Visual) Languages (DS(V)Ls) – (reactive) behaviour of DS(V)M environments/tools – model transformations (for analysis, optimization, simulation . . . ) model everything FORMS/FORMAT 2004, 2-3 December, Braunschweig Modelling and Analysis of Traffic Networks Based on Graph Transformation 6/41
How to Build DS(V)M Tools Effectively ? 1. Specify textual/visual syntax of DS(V)Ls: meta-modelling 2. Specify DS(V)L semantics : transformation 3. Model (and analyze and execute) transformations : graph rewriting FORMS/FORMAT 2004, 2-3 December, Braunschweig Modelling and Analysis of Traffic Networks Based on Graph Transformation 7/41
A Tool for Multi-formalism and Meta-Modelling atom3.cs.mcgill.ca FORMS/FORMAT 2004, 2-3 December, Braunschweig Modelling and Analysis of Traffic Networks Based on Graph Transformation 8/41
� ✂ � Specifying textual/visual syntax of DS(V)Ls abstract syntax: – syntax grammar (text grammar, AToM 3 Graph Grammar) or – meta-model ( type graph) concrete syntax: – textual (lexical specification) or – visual (AToM 3 “icons” + connections) FORMS/FORMAT 2004, 2-3 December, Braunschweig Modelling and Analysis of Traffic Networks Based on Graph Transformation 9/41
Meta-modelling (OMG-style) FORMS/FORMAT 2004, 2-3 December, Braunschweig Modelling and Analysis of Traffic Networks Based on Graph Transformation 10/41
Meta-modelling: model-instance morphism level M2: model a model of the Petri Net formalism, an INSTANCE of the Entity Relationship formalism tran2pl PNTransition PNPlace name type=String init.value= name type=String init.value= tokens type=Integer init.value=0 pl2tran mapping mapping mapping mapping mapping mapping 0 level M1: data place1 a Petri Net, an INSTANCE of the Petri Net formalism transition 0 place2 FORMS/FORMAT 2004, 2-3 December, Braunschweig Modelling and Analysis of Traffic Networks Based on Graph Transformation 11/41
Meta-modelling: model-instance morphism ctd. mapping mapping level M3: meta−model a model of the Entity Relationship formalism, an INSTANCE of the Core formalism (Core == Entity Relationship) ERentity name type=String init.value= attributes type=List init.value= ERrelationship mapping mapping mapping mapping level M2: model tran2pl a model of the Petri Net formalism, an INSTANCE of the Entity Relationship formalism PNTransition PNPlace name type=String init.value= name type=String init.value= tokens type=Integer init.value=0 pl2tran mapping mapping mapping mapping level M1: data 0 a Petri Net, place1 an INSTANCE of the Petri Net formalism transition 0 place2 FORMS/FORMAT 2004, 2-3 December, Braunschweig Modelling and Analysis of Traffic Networks Based on Graph Transformation 12/41
How to break the meta-* chain ? ERrelationship ERentity name type=String init.val attributes type=List init bootstrap ER (Core == Entity Relationship) implementation note: interpret or compile meta-models ? FORMS/FORMAT 2004, 2-3 December, Braunschweig Modelling and Analysis of Traffic Networks Based on Graph Transformation 13/41
Un-timed and timed Traffic Formalism meta-model (a model in the UML Class Diagram Formalism) Capacity + name: String + capacity: Integer 1..* CapacityOf + updated: Bool 0..* Section2Sink Source 0..1 Source2Section RoadSection Sink 0..* 0..1 0..* + name: String + name: String + name: String ControlledSection 0..1 + num_vehicles: Integer + num_vehicles: Integer + num_vehicles: Integer 0..* Direction + infinite_supply: Bool + state: {normal, added 0..* , removed} FlowTo 0..* 0..1 0..* 0..* TimedSource TrafficLight TimedRoadSection TimedFlowTo + inter_arrival_time: Float + State: {green, red} 0..* + length: Float 0..1 + velocity_limit: Float 0..1 Synchronized TimedTrafficLight + timing_red: Float + timing_green: Float FORMS/FORMAT 2004, 2-3 December, Braunschweig Modelling and Analysis of Traffic Networks Based on Graph Transformation 14/41
Traffic Concrete Syntax (the Capacity Entity) FORMS/FORMAT 2004, 2-3 December, Braunschweig Modelling and Analysis of Traffic Networks Based on Graph Transformation 15/41
The generated Traffic visual modelling environment FORMS/FORMAT 2004, 2-3 December, Braunschweig Modelling and Analysis of Traffic Networks Based on Graph Transformation 16/41
Caveat: Statechart model of the GUI’s Reactive Behaviour FORMS/FORMAT 2004, 2-3 December, Braunschweig Modelling and Analysis of Traffic Networks Based on Graph Transformation 17/41
The GUI’s reactive behaviour in action current work: what is the optimal formalism to specify GUI reactive behaviour ? FORMS/FORMAT 2004, 2-3 December, Braunschweig Modelling and Analysis of Traffic Networks Based on Graph Transformation 18/41
� � � � Modelling Traffic’s Semantics choices: timed, un-timed, . . . (level of abstraction) denotational : map onto known formalism (TTPN, PN) . . . good for analysis purposes operational : procedure to execute/simulate model . . . may act as a reference implementation note: need to prove consistency between denotational and operational semantics if both are given ! FORMS/FORMAT 2004, 2-3 December, Braunschweig Modelling and Analysis of Traffic Networks Based on Graph Transformation 19/41
Traffic, the Big Picture simulate Traffic (timed) n e g l e c t t i m e simulate s c i t o n t a n m o e g s n e i p b p Traffic (un-timed) i r a c m s e y d b simulate describe semantics analyze by mapping onto simulate Timed Transition Petri Nets Place-Transition Petri Nets compute all possible behaviours analyze: reachability, coverability, ... Coverability Graph FORMS/FORMAT 2004, 2-3 December, Braunschweig Modelling and Analysis of Traffic Networks Based on Graph Transformation 20/41
� � � ✁ Traffic’s (un-timed) semantics in terms of Petri Nets need a meta-model of Traffic (shown before) need a meta-model of Petri Nets (shown before) need a model of the mapping: Traffic Petri Nets FORMS/FORMAT 2004, 2-3 December, Braunschweig Modelling and Analysis of Traffic Networks Based on Graph Transformation 21/41
Graph Grammars to Specify Model Transformations Ehrig, H., G. Engels, H.-J. Kreowski, and G. Rozenberg. 1999. Handbook of graph grammars and computing by graph transformation. World Scientific. Tools: AGG, PROGRES, GME, AToM 3 , Fujaba, . . . FORMS/FORMAT 2004, 2-3 December, Braunschweig Modelling and Analysis of Traffic Networks Based on Graph Transformation 22/41
A very simple un-timed Traffic model 1 2 segment2 segment1 4 capacity FORMS/FORMAT 2004, 2-3 December, Braunschweig Modelling and Analysis of Traffic Networks Based on Graph Transformation 23/41
Traffic to Petri Net Graph Grammar rules CONDITION: 1 node = LHS.nodeWithLabel(1) 1 <COPIED> <ANY> return not node.vehiclesPNPlaceGenerated <COPIED> <ANY> 3 rule1: RoadSection2PNPlace 2 <SPECIFIED> ACTION: LHS.nodeWithLabel(1)).name node = RHS.nodeWithLabel(1) <SPECIFIED> LHS.nodeWithLabel(1)).num_vehicles LHS RHS node.vehiclesPNPlaceGenerated = True FORMS/FORMAT 2004, 2-3 December, Braunschweig Modelling and Analysis of Traffic Networks Based on Graph Transformation 24/41
Recommend
More recommend