Computer Aided Multi-paradigm Modelling - McGill University

Post on 20-Apr-2022

5 views 0 download

Transcript of Computer Aided Multi-paradigm Modelling - McGill University

SCSC 2003Montreal, Canada

22 July, 2003

Computer Aided Multi-paradigm Modelling

of Hybrid Systems with AToM3

Juan de Lara and Manuel Alfonseca

E.T.S. de InformaticaUniversidad Autonoma de Madrid, Madrid, Spain

Hans Vangheluwe

Modelling, Simulation and Design Lab (MSDL)School of Computer Science, McGill University, Montreal, Canada

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 1/30

Presentation Overview� Multi-paradigm Modelling and Simulation

� An example Hybrid model

� Meta-modelling

� AToM3: A Tool for Multi-formalism Meta-Modelling

� The future . . .

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 2/30

Multi-paradigm modelling and simulation

1. Different levels of abstraction

2. Mixing different formalisms (coupling, transformation)

3. Modelling classes of models (formalisms) by meta-modelling

4. Modelling transformations explicitly

(in the Graph Grammar formalism)

TOMACS 12(4) 2002: Special Issue on CAMPaM.

Mosterman and Vangheluwe.

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 3/30

A Hybrid Example: T � l controlled liquid

is_full

is_emptyheat

off

cool

is_coldis_hot

fill emptyclosed

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 4/30

A Simulation Applet

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 5/30

OOCSMP to Java applets with C-OOL

Simulation 79(1) 2003: Visual Interactive Simulation for Distance

Eductation. de Lara and Alfonseca.

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 6/30

The Controller (Statechart)

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 7/30

Meta-modelling

meta-model a model in formalism MF

meta-modelprocessor model

userinput

a model of a class of models (the formalism F)semantics within formalism MFdescribes: structure and constraints

a model in formalism F

-create-delete-verify (local, global)

MF

F

(ER)

(FSA)

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 8/30

Statecharts Meta-model

Name type=String init.val

Blob

Name type=String init.val

Orthogonal

Actions type=String init.

Initial

Hyperedge

composed_of

has_inside

has_Initialiconnection

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 9/30

Statecharts Meta-model in AToM3

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 10/30

Edit Entity

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 11/30

Edit Entity Appearance

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 12/30

The Controller (Statechart)

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 13/30

The Continuous Plant Model (ALG + ODE)

Inputs (discontinuous � hybrid model):

� Emptying, filling flow rate φ

� Rate of adding/removing heat W

Parameters:

� Cross-section surface of vessel A

� Specific heat of liquid c

� Density of liquid ρ

State variables:

� Temperature T

� Level of liquid l

Outputs (sensors):

� is low � is high � is cold � is hot

������������� �����������

dTdt

1l W

cρA

� φT �

dldt

φ

is low l � llow �

is high l � lhigh �

is cold T � Tcold �

is hot T � Thot �

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 14/30

A Causal Block Diagram Model

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 15/30

CBD Meta-model (ER)

Type type=Enum init.valueValue type=Float init.valName type=String init.valInitialCondition type=PorVariable type=Port init.v

Block

Name type=String init.valValue type=Float init.val

Constant

Type type=Enum init.valueLocation type=Enum init.v

Output

Type type=Enum init.value

Control_Variable

Connected_to_Block

Connected_Ct

Connected_Out

Connected_Ctrl

Connected_out_ctrl

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 16/30

x� � � � Kx � x � 0 � � 0 � x� � 0 � � 1

x0

0.0

y0

1.0

ICx

ICy

− I OUT

K

1.0

0.0

PLOT

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 17/30

Generated LATEX

\[

\left\{

\begin{array}{ll}

\dot{x} = y, & x(t_0) = x0\\

\dot{y} = -(x) \cdot K, & y(t_0) = y0\\

\\

x0 = 0.0\\

K = 1.0\\

y0 = 1.0\\

\end{array}

\right.

\]

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 18/30

Rendered

������������� �����������

x y � x t0 � x0

y � x ��� K � y t0 � y0

x0 0� 0

K 1� 0

y0 1� 0

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 19/30

Generated Matlab/Simulink

function xdot = harmonic(t, x)

xdot = zeros(2, 1);

xdot(1) = x(2);

xdot(2) = -(x(1)) *1.0;

x0 = [0.0; 1.0];

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 20/30

The OOCSMP top-model

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 21/30

OOCSMP meta-model (ER)

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 22/30

The Complete Model

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 23/30

Meta-meta-. . .

meta-metamodel

meta-modelprocessor

meta-modeluserinput

a model of a class of models (the formalism MF)semantics within formalism MMFdescribes: structure and constraints

a model in formalism MF

-create-delete-verify (local, global)

meta-modelprocessor model

userinput

a model of a class of models (the formalism F)semantics within formalism MFdescribes: structure and constraints

a model in formalism F

-create-delete-verify (local, global)

MMF

MF

F

(ER)

(ER)

(FSA)

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 24/30

ER Meta-model (ER)

name type=String init.valattributes type=List init

ERentity

ERrelationship

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 25/30

Model Transformation Specification

meta-model a model in formalism ER

meta-modelprocessor

model

userinput

a model of a class of models (the formalism NFA)semantics within formalism ER

a model in formalism NFA

-create-delete-verify (local, global)

MF

F

(ER)

(NFA)

meta-model a model in formalism MF

meta-modelprocessor

model

userinput

a model of a class of models (the formalism F)semantics within formalism MFdescribes: structure and constraints

a model in formalism FSA

-create-delete-verify (local, global)

MF

F

(ER)

(FSA)(multi-formalism)

model transformer=

meta-modelprocessor

transformationmeta-model

MF (GGR)

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 26/30

The Full Picture

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 27/30

Related Work� The OMG’s Model Driven Architecture (MDA)

� Graph Grammars: PROGRES, AGG, . . .

� Ptolemy (Berkely, Ed Lee): co-simulation

� Vanderbilt (ISIS): Multigraph Architecture, GME

� Honeywell: DOME

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 28/30

The Future . . .� Domain-specific modelling and simulation environments

� Experiment with variations (flavours) of formalisms (syntax and

semantics)

� Formalism Transformation (FTG)

� Graph Grammars models for all Transformations

� Simulator Meta-specification (reference implementation)

� Model exchange (DTD from meta-model, XML from model)

� Concrete vehicle: ATOM3 http://atom3.cs.mcgill.ca

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 29/30

Acknowledgements� The Modelling, Simulation and Design Lab (MSDL)

http://msdl.cs.mcgill.ca

� Jean-Sebastien Bolduc (CBD transformations)

� NSERC http://www.nserc.ca

SCSC 2003, 22 July, Montreal Computer Aided Multi-paradigm Modelling of Hybrid Systems with AToM3 30/30