Composition of XML Dialects - PowerPoint PPT Presentation

About This Presentation
Title:

Composition of XML Dialects

Description:

ModelicaXML Compost. a start in providing better tools for Modelica language. Future Work. refine the Modelica Compost extension. more composition operators ... – PowerPoint PPT presentation

Number of Views:33
Avg rating:3.0/5.0
Slides: 21
Provided by: adrianpopi
Category:

less

Transcript and Presenter's Notes

Title: Composition of XML Dialects


1
Composition of XML Dialects
  • A ModelicaXML case study

Adrian Pop, Ilie Savga, Uwe Aßmann, Peter
Fritzson Programming Environments
Laboratory Linköping University
2
Outline
  • Introduction
  • Modelica
  • ModelicaXML
  • Compost
  • ModelicaXML extension of Compost
  • Modelica Component Model
  • Composition programs
  • Conclusions and Future Work

3
Introduction
  • Why the need for Modelica composition and
    transformation?
  • Interoperability between existing modeling
    languages or CAD tools and Modelica
  • Automatic generation of different version of
    models from product specifications. Choosing best
    design based on automatic simulation.
  • Automatic configuration of models using external
    sources (XML, databases, files)
  • Protection of intellectual property through
    obfuscation
  • Fine grain support for library developers

4
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
  • Strongly typed object-oriented language with a
    general class concept, Java Matlab like syntax
  • Visual component programming
  • Hierarchical system architecture capabilities
  • Efficient, non-proprietary
  • Efficiency comparable to C advanced equation
    compilation, e.g. 300 000 equations

5
Modelica Visual Programming
Decomposition and Abstraction of an Automatic
Gearbox
6
ModelicaXML
modelicaxml
  • class Test "comment"
  • Real x
  • Real xdot
  • equation
  • xdot der(x)
  • end Test

definition
component
equation
component
ltmodelicaxmlgt ltdefinition ident "Test"
comment"comment"gt ltcomponent
ident"x" type"Real"
visibility"public" /gt ltcomponent
ident"xdot" type"Real"
visibility"public" /gt ltequationgt...lt/equati
ongt lt/definitiongt lt/modelicaxmlgt
7
Compost Overview
8
ModelicaXML extension of Compost
9
Modelica Component Model Box hierarchy
10
Example Box Hierarchy
ltdefinition ident"Engine" restriction"class"gt
ltcomponent visibility"public
variability"parameter"
type"Integer" ident"cylinders"gt
ltmodification_equalsgt ltinteger_literal
value"4"/gt lt/modification_equalsgt
lt/componentgt ltcomponent visibility"public"
type"Cylinder" ident"c"gt
ltarray_subscriptsgt ltcomponent_reference
ident"cylinders"/gt lt/array_subscriptsgt
lt/componentgt lt/definitiongt
class Engine parameter Integer
cylinders 4 Cylinder ccylinders end
Engine
ModelicaClass
ModelicaComponent
ModelicaComponent
11
Modelica Component Model Hook hierarchy
12
Example Hooks
ltcomponent visibility"public
variability"parameter"
type"Integer" ident"cylinders"gt
ltmodification_equalsgt ltinteger_literal
value"4"/gt lt/modification_equalsgt
lt/componentgt
ModelicaParameterHook name value
parameter Integer cylinders 4
ltdefinition identNewEngine" restriction"class"gt
ltextends typeEnginegt .... lt/definitiongt
class NewEngine extends Engine .... end
NewEngine
ltdefinition identEngine restriction"class"gt
ltextractgt ltcomponentgt..lt/componentgt ...
lt/extractgt lt/definitiongt
13
Composition Programs Mixin
ModelicaCompositionSystem cs new
ModelicaCompositionSystem() ModelicaClass
resultBox cs.createModelicaClass(Class1.m
o.xml) ModelicaClass firstMixin
cs.createModelicaClass(Class2.mo.xml) ModelicaC
lass secondBox cs.createModelicaClass(Res
ult.mo.xml) resultBox.mixin(firstMixin)
resultBox.mixin(secondMixin)
resultBox.print()
14
Composition Program Input
class CelestialBody Celestial Body'' Real
mass String name constant Real g
6.672e-11 parameter Real radius end
CelestialBody
15
Composition Program
ModelicaCompositionSystem cs new
ModelicaCompositionSystem() ModelicaClass
bodyBox cs.createModelicaClass(Body.mo.xm
l'') ModelicaClass celestialBodyBox
cs.createModelicaClass(Celestial.mo.xml'') Mode
licaElement extractedPart
celestialBody.findHook(extract'').getValue()
celestialBody.findHook(extract'').bind(null)
bodyBox.append(extractedPart)
bodyBox.print() celestialBody.findHook(super
class'').bind(Body'') celestialBody.print()

16
Composition Programs Result
class Body Generic Body'' Real mass
String name end Body class CelestialBody
Celestial Body'' extends Body constant
Real g 6.672e-11 parameter Real radius end
CelestialBody
17
Conclusions and Future Work
  • ModelicaXMLCompost
  • a start in providing better tools for Modelica
    language
  • Future Work
  • refine the ModelicaCompost extension
  • more composition operators
  • validation of composition using OpenModelica
    compiler
  • automatic generation of Modelica component model
    from the Modelica ontology

18
End
  • Thank you!
  • Questions?

19
ModelicaXML and Compost
  • ModelicaXML
  • http//www.ida.liu.se/adrpo/modelica/xml
  • Compost
  • http//www.the-compost-system.org/

20
Software Composition Workshop 2004, Barcelona
Components
Transformation and Composition
Sagrada Familia
Write a Comment
User Comments (0)
About PowerShow.com