Wintersim 2002 San Diego, CA 9 December 2002 Meta-model are Models Too Hans Vangheluwe School of Computer Science, McGill University, Montr´ eal, Canada Juan de Lara E.T.S. de Inform´ atica, Universidad Auton´ oma de Madrid, Madrid, Spain Wintersim 2002, 9 December, San Diego hv@cs.mcgill.ca Meta-model are Model Too 1/34
� ✁ ✁ � Meta-modelling and XML modelling and simulation meta-modelling meta-modelling and XML Experiences with A Tool for Multi-formalism, Meta-Modelling AToM 3 : http://atom3.cs.mcgill.ca Wintersim 2002, 9 December, San Diego hv@cs.mcgill.ca Meta-model are Model Too 2/34
� � � � Modelling and Simulation Wishlist Meaningful exchange and re-use of models Syntax and Semantics ! Domain/problem-specific (visual) modelling & simulation environments Syntax and Semantics ! Model transformation – simulation (state changes) – code-generation (syntax changes) – simplification (level of abstraction changes) – formalism transformation (formalism changes) Meaningful multi-formalism modelling Wintersim 2002, 9 December, San Diego hv@cs.mcgill.ca Meta-model are Model Too 3/34
Petri Net model of Producer Consumer 1 1 P.Calculating Wait4Prod Rem.from buffer Produce 0 Buffer 0 0 C.Calculating Wait4Cons 1 Buffer−p Consume Put in Buffer reachability analysis + simplification + simulation + code generation Wintersim 2002, 9 December, San Diego hv@cs.mcgill.ca Meta-model are Model Too 4/34
Statechart model of Producer Consumer Producer Buff Consumer Producing Wait4Prod Produce Empty buffer−− [in Buff.Empty] [in Buff.Full] Consume buffer++ / buffer++ / buffer−− Wait4Cons Full Computing simulation + code generation + transformation to equivalent Petri Net Wintersim 2002, 9 December, San Diego hv@cs.mcgill.ca Meta-model are Model Too 5/34
Timed Automata model of a Traffic Light pi pcr show(R) R pi show(O) pcr PCR CO 10 after off 60 after pi after 10 show(O) show(G) O after 50 G off off pi off off show(OFF) OFF smulation + code generation Wintersim 2002, 9 December, San Diego hv@cs.mcgill.ca Meta-model are Model Too 6/34
Generated Application Wintersim 2002, 9 December, San Diego hv@cs.mcgill.ca Meta-model are Model Too 7/34
GPSS model of Manufacturing system 5 INSPQ 12 9 INSPECTR INSPECTR 3 1 1 INSPECTR Name: TRANSIT Low.Limit: 5 INSPQ Int.Size: 5 TRANSIT Num.Intervals: 10 .1 1 1 Wintersim 2002, 9 December, San Diego hv@cs.mcgill.ca Meta-model are Model Too 8/34
Generated GPSS code * Manufacturing shop model 4 * G. Gordon Figure 11-9/9-8 SIMULATE L0 GENERATE 5 ; Create parts L7 QUEUE INSPQ ; Queue for an inspector L5 ENTER INSPECTR,1 ; A single inspector becomes busy L8 DEPART INSPQ ; Leave the inspector queue L9 MARK ; Start counting transit time L1 ADVANCE 12,9 ; Inspect L6 LEAVE INSPECTR,1 ; Make the inspector idle again L10 TABULATE TRANSIT ; Tabulate parts’ transit time L2 TRANSFER .1,ACC,REJ ; Randomly determine defective parts ACC TERMINATE 1 ; Accepted parts REJ TERMINATE 1 ; Rejected parts TRANSIT TABLE M1,5,5,10 INSPECTR STORAGE 3 START 1000 END Wintersim 2002, 9 December, San Diego hv@cs.mcgill.ca Meta-model are Model Too 9/34
Forrester System Dynamics model of Predator-Prey uptake_predator loss_prey Grazing_efficiency prey_surplus_BR predator_surplus_DR Predator Prey 2−species predator−prey system transformation to Ordinary Differential Equations + analysis Wintersim 2002, 9 December, San Diego hv@cs.mcgill.ca Meta-model are Model Too 10/34
Causal Block Diagram model of Harmonic Oscillator 0.0 x0 K 0.0 1.0 x IC − OUT I y0 1.0 PLOT y IC analysis + simplification + simulation Wintersim 2002, 9 December, San Diego hv@cs.mcgill.ca Meta-model are Model Too 11/34
Event Scheduling DAE model of a Train Departure_Event Initialize_Model passengers = passengers − IF x = x_0 v = v_0 1 Train_at_rest passengers = 0 IF AFTER 1 0 START EVENT DepartureStart IF AFTER passengers > 0 AFTER print "Train arrived at t 0 5 Train_is_full Passenger_arrive IF print "Train is leaving i IF passengers = passengers 1 passengers >= 10 AFTER 0 Test_zerospeed IF passengers < 10 AFTER 5 monitoring fct.: v AFTER +− random.uniform ( 1 , 10 ) Train_starts print "Train is leaving a BrakingODE x v v − k * ( v + 3 ) AcceleratingODE x v testmax v k * ( v − v_init + 5 ) Start_Braking monitoring fct.: v_max − v +− Stop_Accelerating Start_Accelerating test_arrival testmin monitoring fct.: stopping_x − x +− monitoring fct.: v − v_min +− FrictionODE x v v − k * ( v − 20 ) code generation Wintersim 2002, 9 December, San Diego hv@cs.mcgill.ca Meta-model are Model Too 12/34
� � � � What is Meta-modelling ? A meta-model is a model of a modelling formalism A meta-model is itself a model . Its syntax and semantics are governed by the formalism it is described in. That formalism can be modelled in a meta-meta-model. As a meta-model is a model, we can reason about it, manipulate it, . . . In particular, properties of (all models in) a formalism can be formally proven. Formalism-specific modelling and simulation tools can automatically be generated from a meta-model ( e.g., in AToM 3 A Tool for Multi-formalism Meta-Modelling). Wintersim 2002, 9 December, San Diego hv@cs.mcgill.ca Meta-model are Model Too 13/34
� ✂ � Formalisms can be tailored to specific needs by modifying the meta-model (possibly through inheritance if specializing). Building domain/application specific, possibly graphical modelling and simulation environments becomes affordable. Semantics of new formalisms through extension or transformation. Wintersim 2002, 9 December, San Diego hv@cs.mcgill.ca Meta-model are Model Too 14/34
FSA model of Even Binary Number recognizer 1 1 Init End_1 0 1 0 End_0 0 Wintersim 2002, 9 December, San Diego hv@cs.mcgill.ca Meta-model are Model Too 15/34
ER model of the FSA formalism syntax (meta-model) FSATransition FSAState current Name type=String init.val isInitial type=Boolean in isFinal type=Boolean init points_to Wintersim 2002, 9 December, San Diego hv@cs.mcgill.ca Meta-model are Model Too 16/34
ER formalism + constraints (OCL/Python) # check for unique input labels (FSA) for transition1 in state.out_connections: for transition2 in state.out_connections: if transition1 != transition2: if transition1.in == transition2.in: return("Non-determinism: input "+transition1.in) Wintersim 2002, 9 December, San Diego hv@cs.mcgill.ca Meta-model are Model Too 17/34
ER model of the ER formalism (meta-meta-model) ERrelationship ERentity name type=String init.val attributes type=List init Wintersim 2002, 9 December, San Diego hv@cs.mcgill.ca Meta-model are Model Too 18/34
Meta-meta-. . . MMF (ER) meta-meta a model of a class of models (the formalism MF) model semantics within formalism MMF describes: structure and constraints MF (ER) user meta-model meta-model a model in formalism MF input processor -create a model of a class of models (the formalism F) -delete semantics within formalism MF -verify (local, global) describes: structure and constraints F (FSA) user meta-model a model in formalism F model input processor -create -delete -verify (local, global) Wintersim 2002, 9 December, San Diego hv@cs.mcgill.ca Meta-model are Model Too 19/34
Causal Block Diagram Semantics ? 0.0 x0 K 0.0 1.0 x IC − OUT I y0 1.0 PLOT y IC Wintersim 2002, 9 December, San Diego hv@cs.mcgill.ca Meta-model are Model Too 20/34
✠ ✡ ✠ ✞ ✟ ✟ ✞ ✞ ✞ ✄ ✝ ☎ ☎ ✆ ☎ ☎ ✞ Causal Block Diagram Denotational Semantics dx y x 0 0 dt dy Kx y 0 1 dt K 1 Wintersim 2002, 9 December, San Diego hv@cs.mcgill.ca Meta-model are Model Too 21/34
FSA model Operational Semantics ? 1 1 Init End_1 0 1 0 End_0 0 Wintersim 2002, 9 December, San Diego hv@cs.mcgill.ca Meta-model are Model Too 22/34
Simulation steps Wintersim 2002, 9 December, San Diego hv@cs.mcgill.ca Meta-model are Model Too 23/34
1 1 1 1 Init End_1 Init End_1 input 0 0 0 Rule 1 Rule 2 1 1 0 0 End_0 End_0 Current State Current State 0 0 1 1 1 1 Init End_1 Init End_1 input 1 0 0 input 0 Rule 2 Rule 2 1 1 0 0 End_0 End_0 Current State Current State 0 0 end of input Final Action "Accept Input" Wintersim 2002, 9 December, San Diego hv@cs.mcgill.ca Meta-model are Model Too 24/34
Graph Grammar model of FSA OpSem Rule 1 (priority 3) Locate Initial Current State 1 1 ::= <ANY> <COPIED> 3 2 Current State Rule 2 (priority 1) State Transition 1 1 Current State Current State condition: 2 2 matched(4).input == input[0] 4 3 <COPIED> / <COPIED> 3 5 ::= 5 4 <COPIED> <ANY> / <ANY> <ANY> <ANY> <COPIED> action: remove(input[0]) Rule 3 (priority 2) Local State Transition 1 1 Current State Current State condition: matched(4).input == input[0] 2 2 ::= 4 4 <COPIED> <COPIED> <ANY> / <ANY> / 3 3 action: <COPIED> <ANY> remove(input[0]) Wintersim 2002, 9 December, San Diego hv@cs.mcgill.ca Meta-model are Model Too 25/34
Recommend
More recommend