I ntegrated Model-Driven Development Environments for - - PowerPoint PPT Presentation

i ntegrated model driven development environments for
SMART_READER_LITE
LIVE PREVIEW

I ntegrated Model-Driven Development Environments for - - PowerPoint PPT Presentation

I ntegrated Model-Driven Development Environments for Equation-Based Object-Oriented Languages Adrian Pop Programming Environment Laboratory Department of Computer and Information S cience Linkping University 2008-06-05 Outline


slide-1
SLIDE 1

I ntegrated Model-Driven Development Environments for Equation-Based Object-Oriented Languages

Adrian Pop

Programming Environment Laboratory Department of Computer and Information S cience Linköping University

2008-06-05

slide-2
SLIDE 2

2

Outline

  • Introduction
  • Equation-Based Obj ect-Oriented Languages
  • The MetaModelica Language
  • Idea, Language constructs, Compiler Prot otype, OpenModelica Bootst rapping
  • Debugging of Equation-Based Obj ect-Oriented Languages
  • Debugging of EOO Meta-Programs (Late vs. Early instrumentation)
  • Runtime debugging
  • Integrated Environments for Equation-Based Obj ect-Oriented Languages
  • ModelicaML – A UML/ S

ysML profile for Modelica

  • Conclusions and Future Work
  • Thesis Contributions
slide-3
SLIDE 3

3

Thesis Motivation

Current state-of-the art EOO languages are supported by tools that have fixed features and are hard to extend The existing tools do not satisfy different user requirements

Management of models: creation, query, manipulation, composition. Query of model equations for: optimization purposes, parallelization,

model checking, simulation with different solvers, etc.

Model configuration for simulation purposes Simulation features: running a simulation and displaying a result,

running more simulations in parallel, possibility to handle simulation failures and continue the simulation on a different path, possibility to generate only specific data within a simulation, possibility to manipulate simulation data for export to another tool.

Model transformation and refactoring: export to a different tool,

improve the current model or library but retain the semantics, model composition and invasive model composition.

slide-4
SLIDE 4

4

Research Questions

Can we deliver a new language that allows people to build their own

solution to their problems without having to go via tool vendors?

What is expected from such a language? What properties should the language have based on the requirements

for it? This includes language primitives, type system, semantics, etc.

Can such a language combined with a general tool be better than a

special-purpose tool?

What are the steps to design and develop such a language? What methods and tools should support debugging of the new

language?

How can we construct advanced interactive development

environments that support such a language?

slide-5
SLIDE 5

5

Outline

  • Introduction

Equation-Based Obj ect-Oriented Languages

  • The MetaModelica Language
  • Idea, Language constructs, Compiler Prot otype, OpenModelica Bootst rapping
  • Debugging of Equation-Based Obj ect-Oriented Languages
  • Debugging of EOO Meta-Programs (Late vs. Early instrumentation)
  • Runtime debugging
  • Integrated Environments for Equation-Based Obj ect-Oriented Languages
  • ModelicaML – A UML/ S

ysML profile for Modelica

  • Conclusions and Future Work
  • Thesis Contributions
slide-6
SLIDE 6

6

Examples of Complex Systems

Robotics Automotive Aircrafts S

atellites

Biomechanics Power plants Hardware-in-the-

loop, real-time simulation

slide-7
SLIDE 7

7

Stored Knowledge

Model knowledge is stored in books and human minds which computers cannot access

“The change of motion is proportional to the motive force impressed “

– Newton

slide-8
SLIDE 8

8

The Form – Equations

Equations were used in the third millennium B.C. Equality sign was introduced by Robert Recorde in 1557 Newton still wrote text (Principia, vol. 1, 1686)

“The change of motion is proportional to the motive force impressed ”

CSSL (1967) introduced a special form of “equation”: variable = expression v = INTEG(F)/m Programming languages usually do not allow equations!

slide-9
SLIDE 9

9

Modelica

Declarative language

Equations and mathematical functions allow acausal modeling,

high level specification, increased correctness

Multi-domain modeling

Combine electrical, mechanical, thermodynamic, hydraulic,

biological, control, event, real-time, etc...

Everything is a class

S

trongly typed obj ect-oriented language with a general class concept, Java & Matlab like syntax

Visual component programming

Hierarchical system architecture capabilities

Efficient, nonproprietary

Efficiency comparable to C; advanced equation compilation, e.g.

300 000 equations

slide-10
SLIDE 10

10

What is acausal modeling/ design? Why does it increase reuse?

The acausality makes Modelica library classes

more reusable than traditional classes

containing assignment statements where the input-output causality is fixed.

Example: a resistor equat ion:

R*i = v;

can be used in three ways:

i := v/R; v := R*i; R := v/i;

Modelica Acausal Modeling

slide-11
SLIDE 11

11

Modelica - Reusable Class Libraries

Info

R= C= L= G AC= DC= Vs Is S D T

  • +

Op V i E : 1

Info

shaft3DS=

S

shaft3D= shaftS=

S

shaft= gear1= gear2= planetary= diff= sun= planet= ring= bearing fixTooth S moveS move torque c= d= fric= fricTab clutch= converter r w a t fixedBase

S

state

Info

inertial bar= body= bodyBar= cylBody= bodyShape= revS=

S

prismS=

S

screw S=

S

cylS=

S

univS

S

planarS= S sphereS S freeS S rev= prism= screw = cyl= univ planar= sphere free C barC= barC2= x y C sphereC c= d= cSer= force torque lineForce= lineTorque= sensor s sd lineSensor Library advanced Library drive Library translation

slide-12
SLIDE 12

12

inertial x y axis1 axis2 axis3 axis4 axis5 axis6

r3Drive1 1 r3Motor r3Control qdRef 1 S qRef 1 S k2 i k1 i qddRef

cut joint

l

qd

tn

Jmotor=J gear=i spring=c fric=Rv0

S

rel joint=0

S

Vs

  • +

diff

  • +

pow er emf La=(250/(2*D*w m)) Ra=250 Rd2=100 C=0.004*D/w m

  • +

OpI Rd1=100 Ri=10 Rp1=200 Rp2=50 Rd4=100 hall2 Rd3=100 g1 g2 g3 hall1 g4 g5 r w

qd q

rate2 b(s) a(s) rate3 340.8 S rate1 b(s) a(s) tacho1 PT1 Kd 0.03 w Sum

  • sum

+1 +1 pSum

  • Kv

0.3 tacho2 b(s) a(s)

q

qd

iRef qRef qdRef Srel = n*n' + (identity(3) - n*n')*cos(q) - skew(n)*sin(q); wrela = n*qd; zrela = n*qdd; Sb = Sa*Srel'; r0b = r0a; vb = Srel*va; wb = Srel*(wa + wrela); ab = Srel*aa; zb = Srel*(za + zrela + cross(wa, wrela)); fa = Srel'*fb; ta = Srel'*tb;

Hierarchical Composition Diagram

slide-13
SLIDE 13

13

Multi-Domain Modelica Model - DCMotor

A DC motor can be thought of as an electrical circuit

which also contains an electromechanical component.

model DCMotor Resistor R(R=100); Inductor L(L=100); VsourceDC DC(f=10); Ground G; ElectroMechanicalElement EM(k=10,J=10, b=2); Inertia load; equation connect(DC.p,R.n); connect(R.p,L.n); connect(L.p, EM.n); connect(EM.p, DC.n); connect(DC.n,G.p); connect(EM.flange,load.flange); end DCMotor

load EM DC G R L

slide-14
SLIDE 14

14

Outline

  • Introduction
  • Equation-Based Obj ect-Oriented Languages

MetaModelica

  • Idea, Language constructs, Compiler Prot otype, OpenModelica Bootst rapping
  • Debugging of Equation-Based Obj ect-Oriented Languages
  • Debugging of EOO Meta-Programs (Late vs. Early instrumentation)
  • Runtime debugging
  • Integrated Environments for Equation-Based Obj ect-Oriented Languages
  • ModelicaML – A UML/ S

ysML profile for Modelica

  • Conclusions and Future Work
  • Thesis Contributions
slide-15
SLIDE 15

15

MetaModelica

Research Question

Can we deliver a new language that allows

users to build their own solutions to their problems?

Our idea - extend Modelica with support for

Meta-Modeling – represent models as data Meta-Programming – transform or query models

The new language - MetaModelica

slide-16
SLIDE 16

16

Meta-Modeling and Meta-Programming

Model1 Model2 ModelN ... Meta-Model1 Meta-Model2 Meta- Meta Model

Modelica models Modelica language specification MetaModelica and Natural Semantics Specification formalisms Meta-programming: transformation

Physical system

World The Modeling Space

slide-17
SLIDE 17

17

MetaModelica - Context

S

yntax - there are many efficient parser generator tools

lex (flex), yacc (bison), ANTLR, Coco, etc.

S

emant ics:

t here are no st andard efficient and easy t o use

compiler-compiler t ools

slide-18
SLIDE 18

18

MetaModelica - Motivation

Can we adapt the Modelica equation-based

style to define semantics of programming languages?

Answer: Yes!

MetaModelica Language

executable language specification based on

a model (abstract syntax tree) semantic functions over the model

elaboration and typechecking translation, transformation, querying etc.

slide-19
SLIDE 19

19

MetaModelica - I dea We started from

The Relational Meta-Language (RML)

A system for building executable natural semantics

specifications

Used to specify Java, Pascal-subset, C-subset, Mini-ML, etc.

The OpenModelica compiler for Modelica specified in

RML

Idea: int egrat e t he RML met a-modeling and

met a-programming facilit ies wit hin t he Modelica

  • language. The not ion of equat ion is used as t he

unifying feat ure

slide-20
SLIDE 20

20

MetaModelica extensions to Modelica (I )

Modelica

classes, models, records, functions, packages behavior is defined by equations or/ and functions equations

differential equations algebraic equations difference equations conditional equations

MetaModelica extensions

local equations pattern equations match expressions high-level data structures: lists, tuples, option and

uniontypes

slide-21
SLIDE 21

21

MetaModelica extensions to Modelica (I I )

pattern equations

unbound variables get their value by unification

Env.BOOLVAL(x,y) = eval_something(env, e);

match expressions

pattern matching case rules

pattern = match expression opt ional-local-declarat ions case pat t ern-expression opt -local-declarat ions

  • pt ional-local-equat ions then value-expression;

case ... ... else opt ional-local-declarat ions

  • pt ional-local-equat ions then value-expression;

end match;

slide-22
SLIDE 22

22

MetaModelica – Example (I )

package ExpressionEvaluator // abstract syntax declarations ... // semantic functions ... end ExpressionEvaluator;

slide-23
SLIDE 23

23

package ExpressionEvaluator // abstract syntax declarations // semantic functions ... end ExpressionEvaluator;

MetaModelica – Example (I I )

uniontype Exp record RCONST Real x1; end RCONST; record PLUS Exp x1; Exp x2; end PLUS; record SUB Exp x1; Exp x2; end SUB; record MUL Exp x1; Exp x2; end MUL; record DIV Exp x1; Exp x2; end DIV; record NEG Exp x1; end NEG; end Exp; Expression: 12+5*13 Representation:

PLUS( RCONST(12), MUL( RCONST(5), RCONST(13) ) ) PLUS MUL RCONST RCONST RCONST 12 5 13

slide-24
SLIDE 24

24

MetaModelica – Example (I I I )

package ExpressionEvaluator // abstract syntax declarations ... // semantic functions

function eval input Exp in_exp;

  • utput Real out_real;

algorithm

  • ut_real := match in_exp

local Real v1,v2,v3; Exp e1,e2; case RCONST(v1) then v1; case ADD(e1,e2) equation v1 = eval(e1); v2 = eval(e2); v3 = v1 + v2; then v3; case SUB(e1,e2) equation v1 = eval(e1); v2 = eval(e2); v3 = v1 - v2; then v3; case MUL(e1,e2) equation v1 = eval(e1); v2 = eval(e2); v3 = v1 * v2; then v3; case DIV(e1,e2) equation v1 = eval(e1); v2 = eval(e2); v3 = v1 / v2; then v3; case NEG(e1) equation v1 = eval(e1); v2 = -v1; then v2; end match; end eval;

end ExpressionEvaluator;

slide-25
SLIDE 25

25

MetaModelica Compiler Prototype

Based on the RML compiler with a new

front-end

Can handle large specifications S

upports debugging, mutable arrays

S

upports only a subset of MetaModelica

slide-26
SLIDE 26

26

OpenModelica Bootstrapping

To support the full MetaModelica language

Integrate the meta-modeling and meta-

programming facilities in the OpenModelica compiler

New features in OpenModelica targeting

the MetaModelica Language

Pattern matching High-level data structures (list, option, union

types, tuples)

Exception handling

slide-27
SLIDE 27

27

Outline

  • Introduction
  • Equation-Based Obj ect-Oriented Languages
  • MetaModelica
  • Idea, Language constructs, Compiler Prot otype, OpenModelica Bootst rapping

Debugging of Equation-Based Obj ect-Oriented Languages

  • Debugging of EOO Meta-Programs (Late vs. Early instrumentation)
  • Runtime debugging
  • Integrated Environments for Equation-Based Obj ect-Oriented Languages
  • ModelicaML – A UML/ S

ysML profile for Modelica

  • Conclusions and Future Work
  • Thesis Contributions
slide-28
SLIDE 28

28

Debugging EOO Languages

S

tatic aspect

Overconst rained syst em: the number of variables is smaller than the

number of equations

Underconst rained syst em: the number of variables is larger than the

number of equations

S

  • lved partially by Modelica 3.0 that requires models to be balanced

Dynamic (run-time) aspect

Handles errors due to:

model configurat ion: when parameters values for the model

simulation are incorrect.

model specificat ion: when the equations that specify the model

behavior are incorrect.

algorit hmic code: when the functions (either native or external)

called from equations return incorrect results.

slide-29
SLIDE 29

29

Portable Debugging of EOO Meta-Programs

Why we need debugging

To debug large meta-programs The OpenModelica Compiler S

pecification

4,65 MB of MetaModelica sources, ~140 000 LOC 52 Packages, 5422 Functions

Debugging strategy: Code Instrumentation

Early instrumentation

Debugging instrumentation at the AS

T level

S

low compilat ion and execut ion t ime

Late instrumentation

Debugging instrumentation at the C code level Accept able compilat ion and execut ion t ime

slide-30
SLIDE 30

30

Early I nstrumentation – AST level

function bubbleSort input Real [:] unordElem;

  • utput Real [size(unordElem, 1)] ordElem;

protected Real tempVal; Boolean isOver = false; algorithm

  • rdElem := unordElem;

while not isOver loop isOver := true; for i in 1:size(ordElem, 1)-1 loop if ordElem[i] > ordElem[i+1] then tempVal := ordElem[i];

  • rdElem[i] := ordElem[i+1];
  • rdElem[i+1] := tempVal;

isOver := false; end if; end for; end while; end bubbleSort; function bubbleSort input Real [:] unordElem;

  • utput Real [size(unordElem, 1)] ordElem;

protected Real tempVal; Boolean isOver = false; algorithm Debug.register_in("unordElem",unordElem); Debug.step(...);

  • rdElem := unordElem;

Debug.register_out("ordElem", ordElem); Debug.register_in("isOver", isOver); Debug.step(...); while not isOver loop isOver := true; Debug.register_out("isOver", isOver); Debug.register_in("ordElem",ordElem); Debug.step(...); for i in 1:size(ordElem, 1)-1 loop Debug.register_out("i", i); Debug.register_in("i", i); Debug.register_in("ordElem[i]",

  • rdElem[i]);

Debug.register_in("ordElem[i+1]",

  • rdElem[i+1]);

Debug.step(...); ... end bubbleSort;

slide-31
SLIDE 31

31

Late I nstrumentation – C level

function bubbleSort input Real [:] unordElem;

  • utput Real [size(unordElem, 1)] ordElem;

protected Real tempVal; Boolean isOver = false; algorithm

  • rdElem := unordElem;

while not isOver loop isOver := true; for i in 1:size(ordElem, 1)-1 loop if ordElem[i] > ordElem[i+1] then tempVal := ordElem[i];

  • rdElem[i] := ordElem[i+1];
  • rdElem[i+1] := tempVal;

isOver := false; end if; end for; end while; end bubbleSort; bubbleSort_rettype _bubbleSort(real_array unordElem) { size_t tmp2; bubbleSort_rettype tmp1; real_array ordElem; /* [:] */ modelica_boolean isOver; ... Debug.register_in("unordElem",unordElem); Debug.step(...); copy_real_array_data(&unordElem, &ordElem); Debug.register_out("ordElem", ordElem); Debug.register_in("isOver", isOver); Debug.step(...); while ... }

slide-32
SLIDE 32

32

Debugging - Performance Evaluation (I )

The test case

Meta-Program: The OpenModelica Compiler

4,65 MB of MetaModelica sources, ~140 000 lines of code 52 Packages, 5422 Functions

Compilation times (seconds)

Generated C Code Compilation time

No debugging 37 (MB) 269.86 (s) 130+ (MB) 103 (MB) Early instrumentation 850.35 (s) Late instrumentation 610.61 (s)

slide-33
SLIDE 33

33

Debugging - Performance Evaluation (I I )

The test case

RRLargeModel2.mo - model wit h 1659 equat ions/ variables Execution time for the OpenModelica Compiler while

checking RRLargeModel2.mo

No debugging 223.01 (s) Early instrumentation 5395.47 (s) Late instrumentation 864.36 (s)

slide-34
SLIDE 34

34

Eclipse Debugging Environment Type

information for all variables

Browsing of

complex data structures

slide-35
SLIDE 35

35

SML.NET Debugger No type

information for variables

slide-36
SLIDE 36

36

Why do we need Equation-based debugging?

Easy to build large systems

Drag and Drop composition Hierarchical Modeling

Model behavior depends on

data from various sources (xml, databases, files, etc)

Models could be external

(Hardware in the loop, co- simulation, etc)

You build your model by connecting components together You simulate (hopefully there are no compilation errors) The result you get back is wrong!

Why is the result wrong? Where is the error? How can I pin-point the error?

slide-37
SLIDE 37

37

Modelica Specific General

Translation process

EOO EOO System Simulation System Simulation Result Modelica OpenModelica OpenModelica Simulation Runtime Simulation Result Compilation & Simulation Debugging & Tracing

slide-38
SLIDE 38

38

Modelica Specific

Existing Debugging Strategies Do Not Suffice

Modelica OpenModelica OpenModelica Simulation Runtime Simulation Files

Error Discovered

How do we fix it? Where is the actual code that caused this error?

Debugging & Tracing Compilation & Simulation

Where is the actual code that caused this error? How do we go back? How can we automate the round trip?

model Apollo … equation … gravity = …; … end Apollo;

Error

? ?

slide-39
SLIDE 39

39

Debugging method

Interactive Dependency Graph

These equations contributed to the result

Code viewer

Show which model or function the equation node belongs to

class Resistor extends TwoPin; parameter Real equation R * I = v; end Resistor class Resistor extends TwoPin; parameter Real equation R * I = v; end Resistor class Resistor extends TwoPin; parameter Real equation R * I = v; end Resistor class Resistor extends TwoPin; parameter Real equation R * I = v; end Resistor

Follow if error is in an equation Simulation Results

These are the intermediate simulation results that contributed to the result

Follow if error is in a function Algorithmic Code Debugging

Normal execution point debugging of functions

Build graph Error Discovered

What now? Where is the equation or code that generated this error?

Interactive Dependency Graph

These equations contributed to the result

Code viewer

Show which model or function the equation node belongs to

class Resistor extends TwoPin; parameter Real equation R * I = v; end Resistor class Resistor extends TwoPin; parameter Real equation R * I = v; end Resistor class Resistor extends TwoPin; parameter Real equation R * I = v; end Resistor class Resistor extends TwoPin; parameter Real equation R * I = v; end Resistor

Follow if error is in an equation Simulation Results

These are the intermediate simulation results that contributed to the result

Follow if error is in a function Algorithmic Code Debugging

Normal execution point debugging of functions

Build graph Error Discovered

What now? Where is the equation or code that generated this error?

Mark the error Build an interactive

graph containing the evaluation

Walk the graph

interactively to find the error

slide-40
SLIDE 40

40

Modelica Specific

Debugging Strategy: Compiling With Debugging I n Mind

Modelica OpenModelica OpenModelica Simulation Runtime Simulation Files

Error Discovered

How do we fix it? Where is the actual code that caused this error?

model Apollo … equation … gravity = …; … end Apollo;

Error

Compilation & Simulation Debugging & Tracing

slide-41
SLIDE 41

41

Translation Phases with Debugging

Save element position Normal Translation Process Debugging Translation Process Additional Steps Save element origin (model and position) Save equation elements origin (model and position)

Executable C Code Optimized sorted equations Sorted equations Flat Model Modelica model Modelica Source Code Translator Analyzer Optimizer Code Generator C Compiler Simulation

Save the optimizer transformations changes Save all the available

  • rigin information

Executable with all the available origin information Simulation with run-time debugging functionality

Include

debugging support within the translation process

slide-42
SLIDE 42

42

Outline

  • Introduction
  • Equation-Based Obj ect-Oriented Languages
  • MetaModelica
  • Idea, Language constructs, Compiler Prototype
  • OpenModelica Bootstrapping
  • High Level Data S

tructures, Patt ern Matching, Exception Handling

  • Debugging of Equation-Based Obj ect-Oriented Languages
  • Debugging of EOO Meta-Programs (Late vs. Early instrumentation)
  • Runtime debugging

Integrated Environments for Equation-Based Obj ect-Oriented Languages

  • ModelicaML – A UML/ S

ysML profile for Modelica

  • Conclusions and Future Work
  • Thesis Contributions
slide-43
SLIDE 43

43

OpenModelica

Advanced Interactive Modelica compiler (OMC)

S

upports most of the Modelica Language

Basic environments for creating models

OMS

hell – an interactive command handler

OMNotebook – a literate programming notebook MDT – an advanced textual environment in Eclipse

slide-44
SLIDE 44

44

OpenModelica Context

Parse Client: Eclipse Plugin Corba Client: OMShell Interactive Session Handler Server: Main Program Including Compiler, Interpreter, etc. Interactive SCode Inst Ceval plot system etc.

Untyped API Typed Checked Command API

Client: Graphic Model Editor

slide-45
SLIDE 45

45

Modelica Development Tooling (MDT) S

upports textual editing of Modelica/ MetaModelica code

Was created to ease the development of the

OpenModelica development (~140 000 lines of code) and to support advanced Modelica library development

It has most of the functionality expected from a

Development Environment

code browsing, assistance, indentation, highlighting error detection and debugging automated build of Modelica/ MetaModelica proj ects

slide-46
SLIDE 46

46

Modelica Perspective

The MDT Eclipse Environment (I )

Modelica Editor Modelica Browser Modelica Code Assistant MetaModelica Debugging

slide-47
SLIDE 47

47

The MDT Eclipse Environment (I I )

.mo file

OMC Compiler Small Modelica Parser

Eclipse Modelica model

AST Information

Modelica Browser Modelica Code Assistant Modelica Editor MetaModelica Builder MetaModelica Build console MMC Compiler MetaModelica Debugging

slide-48
SLIDE 48

48

The MDT Eclipse Environment (I I I )

.mo file

MMC Compiler

Eclipse

MetaModelica Debugging Modelica Editor Executable + Debugging runtime

slide-49
SLIDE 49

49

Creating Modelica projects (I )

Creation of Modelica proj ects using wizards

slide-50
SLIDE 50

50

Creating Modelica projects (I I )

Modelica proj ect

slide-51
SLIDE 51

51

Creating Modelica packages

Creation of Modelica packages using wizards

slide-52
SLIDE 52

52

Creating Modelica classes

Creation of Modelica classes, models, etc, using wizards

slide-53
SLIDE 53

53

Code browsing

Code Browsing for

easy navigation within Modelica files. Automatic update on file save.

slide-54
SLIDE 54

54

Error detection (I )

Parse error detection on file save

slide-55
SLIDE 55

55

Error detection (I I )

S emantic error detection on compilation

slide-56
SLIDE 56

56

Code assistance (I )

Code Assistance on imports

slide-57
SLIDE 57

57

Code assistance (I I )

Code Assistance on assignments

slide-58
SLIDE 58

58

Code assistance (I I I )

Code Assistance on function calls

slide-59
SLIDE 59

59

Code indentation

Code Indentation

slide-60
SLIDE 60

60

Code Outline and Hovering I nfo

Code Outline for

easy navigation within Modelica files

Identifier Info on Hovering

slide-61
SLIDE 61

61

Go to definition

Identifier Info on Hovering CTRL+Click on identifer goes to definition

slide-62
SLIDE 62

62

Outline

  • Introduction
  • Equation-Based Obj ect-Oriented Languages
  • MetaModelica
  • Idea, Language constructs, Compiler Prototype
  • OpenModelica Bootstrapping
  • High Level Data S

tructures, Patt ern Matching, Exception Handling

  • Debugging of Equation-Based Obj ect-Oriented Languages
  • Debugging of EOO Meta-Programs (Late vs. Early instrumentation)
  • Runtime debugging
  • Integrated Environments for Equation-Based Obj ect-Oriented Languages

ModelicaML – A UML/ S

ysML profile for Modelica

  • Conclusions and Future Work
  • Thesis Contributions
slide-63
SLIDE 63

63

System Modeling Language (SysML™) Graphical modeling language for S

ystems Engineering constructed as a UML2 Profile

Designed to provide simple but powerful

constructs for modeling a wide range of systems engineering problems

Effective in specifying requirements, structure,

behavior, allocations, and constraints on system properties to support engineering analysis

Intended to support multiple processes and

methods such as structured, obj ect-oriented, etc.

slide-64
SLIDE 64

64

ModelicaML - a UML profile for Modelica

S

upports modeling with all Modelica constructs i.e. restricted classes, equations, generics, discrete variables, etc.

Multiple aspects of a system being designed are supported

system development process phases such as requirements analysis,

design, implementation, verification, validation and integration.

S

upports mathematical modeling with equations (to specify system behavior). Algorithm sections are also supported.

S

imulation diagrams are introduced to configure, model and document simulation parameters and results in a consistent and usable way.

The ModelicaML meta-model is consistent with S

ysML in

  • rder to provide S

ysML-to-ModelicaML conversion and back.

slide-65
SLIDE 65

65

ModelicaML - Purpose Target ed t o Modelica and S

ysML users

Provide a S

ysML/ UML view of Modelica for

Documentation purposes Language understanding

To ext end Modelica wit h addit ional design

capabilit ies (requirement s modeling, inherit ance diagrams, et c)

To support t ranslat ion bet ween Modelica and

S ysML models via XMI

slide-66
SLIDE 66

66

ModelicaML - Overview

slide-67
SLIDE 67

67

ModelicaML – Package Diagram

The Package Diagram groups logically connected user

defined elements into packages.

The primarily purpose of this diagram is to support the

specifics of the Modelica packages.

slide-68
SLIDE 68

68

ModelicaML – Class Diagram

  • ModelicaML provides

extensions to S ysML in order to support the full set of Modelica constructs.

  • ModelicaML defines unique

class definition types ModelicaClass, ModelicaModel, ModelicaBlock, ModelicaConnector, ModelicaFunction and ModelicaRecord that correspond to class,

model, block, connector, function and record restricted Modelica

classes.

  • Modelica specific restricted

classes are included because a modeling tool needs to impose their semantic restrictions (for example a record cannot have equations, etc).

Class Diagram defines Modelica classes and relationships between classes, like generalizations, association and dependencies

slide-69
SLIDE 69

69

ModelicaML - I nternal Class Diagram

Internal Class Diagram shows the internal

structure of a class in terms of parts and connections

slide-70
SLIDE 70

70

ModelicaML – Equation Diagram behavior is specified using Equation Diagrams all Modelica equations have their specific diagram:

initial, when, for, if equations

slide-71
SLIDE 71

71

ModelicaML – Simulation Diagram

Used to model, configure and document simulation

parameters and results

S

imulation diagrams can be integrated with any Modelica modeling and simulation environment (OpenModelica)

slide-72
SLIDE 72

72

Eclipse environment for ModelicaML

slide-73
SLIDE 73

73

Requirements Modeling

Requirements

can be modeled

hierarchically

can be t raced can be linked with

  • ther ModelicaML

models

can be queried

with respect of their attributes and links (coverage)

slide-74
SLIDE 74

74

Requirements Modeling in Eclipse

slide-75
SLIDE 75

75

Outline

  • Introduction
  • Equation-Based Obj ect-Oriented Languages
  • MetaModelica
  • Idea, Language constructs, Compiler Prototype
  • OpenModelica Bootstrapping
  • High Level Data S

tructures, Patt ern Matching, Exception Handling

  • Debugging of Equation-Based Obj ect-Oriented Languages
  • Debugging of EOO Meta-Programs (Late vs. Early instrumentation)
  • Runtime debugging
  • Integrated Environments for Equation-Based Obj ect-Oriented Languages
  • ModelicaML – A UML/ S

ysML profile for Modelica

Conclusions and Future Work

  • Thesis Contributions
slide-76
SLIDE 76

76

Conclusions

EOO languages can be successfully

generalized to also support software modeling, thus addressing the whole product modeling process.

Integrated environments that support such

a generalized EOO language can be created and effectively used on real-sized applications.

slide-77
SLIDE 77

77

Future Work

Conclude the OpenModelica bootstrapping Further develop the EOO debugging

framework

Modularity and scalability of MetaModelica

language

slide-78
SLIDE 78

78

Outline

  • Introduction
  • Equation-Based Obj ect-Oriented Languages
  • MetaModelica
  • Idea, Language constructs, Compiler Prototype
  • OpenModelica Bootstrapping
  • High Level Data S

tructures, Patt ern Matching, Exception Handling

  • Debugging of Equation-Based Obj ect-Oriented Languages
  • Debugging of EOO Meta-Programs (Late vs. Early instrumentation)
  • Runtime debugging
  • Integrated Environments for Equation-Based Obj ect-Oriented Languages
  • ModelicaML – A UML/ S

ysML profile for Modelica

  • Conclusions and Future Work

Thesis Contributions

slide-79
SLIDE 79

79

Thesis Contributions

The design, implementation, and evaluation of

  • a new, general, executable mathematical modeling and semantics

meta-modeling language called MetaModelica. The MetaModelica language extends the existing Modelica language with support for meta- modeling, meta-programming, and exception handling

  • advanced portable debugging methods and frameworks for runtime

debugging of MetaModelica and semantic specifications

  • several integrated model-driven environments supporting creation,

development, refactoring, debugging, management, composition, serialization, and graphical representation of models in EOO languages. Additionally, an integrated model-driven product design and development environment based on EOO languages is also contributed

Alternative representation of Modelica EOO models based on XML and

UML/ S ysML are investigated and evaluated

Transformation and invasive composit ion of EOO models has also been

investigated

slide-80
SLIDE 80

80

End

Thank you! Questions?

http://www.OpenModelica.org

slide-81
SLIDE 81

81

Thesis Structure

Modelica ModelicaXML MetaModelica/RML System MetaModelica/RML Specification of Modelica Modelica Parser C Compiler C Code

Open Modelica Compiler

Meta-Modeling Meta-Programming C Compiler C Code Modelica Simulation XML Tools Modelica Database Debugging runtime Product Design Tools Simulation Tools Product Concept Virtual Product COMPOST Composition Program

Part III

Chapter 12 Chapter 13

Part IV

Part I Motivation, Introduction, Background and Related Work Chapter 1. Introduction Chapter 2. Background and Related Work Part II Extending EOO Languages for Safe Symbolic Processing Chapter 3. Extending Equation-based Object-oriented Languages Chapter 4. Efficient Implementation of Meta-Programming EOO Languages Part III Debugging of Equation-based Object Oriented Languages Chapter 5. Portable Debugging EOO Meta-programs Chapter 6. Run-time Debugging of EOO Languages Chapter 7. Debugging Natural Semantics Specifications Part IV Advanced Integrated Environments Chapter 8. Modelica Development Tooling (MDT) Chapter 9. Parsing-Unparsing and Refactoring Chapter 10. UML and Modelica System Modeling with ModelicaML Chapter 11. Integrated Framework for Model-driven Product Design and Development Part V Meta-programming and Composition of EOO Languages Chapter 12. ModelicaXML: A ModelicaXML Representation with Applications Chapter 13. Composition of XML dialects: A ModelicaXML case study Part VI Conclusions and Future Work Chapter 14. Conclusions and Future Work

Thesis Structure

Part V Part II

Modelica Development Tooling

Chapter 11

ModelicaML SysML

Chapter 10 Chapter 9 Chapter 8

Part IV

Simulation runtime