i ntegrated model driven development environments for
play

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


  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

  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 2

  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. 3

  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? 4

  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 5

  6. Examples of Complex Systems � Robotics � Automotive � Aircrafts � S atellites � Biomechanics � Power plants � Hardware-in-the- loop, real-time simulation 6

  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 7

  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! 8

  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 9

  10. Modelica Acausal Modeling � 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; 10

  11. Modelica - Reusable Class Libraries R= C= L= body= bodyBar= bar= Info Info G shaftS= inertial shaft3DS= shaft3D= Info S S cylBody= bodyShape= cylS= AC= DC= Vs Is S S S S S shaft= prismS= gear2= revS= screw S= sphereS univS planarS= freeS gear1= - planetary= S planet= S + V i S ring= S diff= prism= rev= D T Op sun= sphere cyl= univ planar= free : 1 bearing fixTooth S screw = E moveS move y sphereC barC= c= d= cSer= c= d= x torque C C barC2= fric= sensor force lineForce= lineSensor r fricTab clutch= s sd torque lineTorque= converter advanced drive translation w a t fixedBase Library Library Library S state 11

  12. Hierarchical Composition Diagram k2 i axis6 cut joint qddRef tn qdRef qRef k1 r3Control r3Drive1 r3Motor 1 1 i 1 S S qd axis5 l qdRef Kd S rel 0.03 Jmotor=J joint=0 spring=c S axis4 iRef qRef pSum Kv sum w Sum rate2 rate3 gear=i fric=Rv0 340.8 +1 b(s) 0.3 - - +1 a(s) S axis3 rate1 tacho2 tacho1 b(s) b(s) PT1 a(s) a(s) g5 axis2 q qd Rp2=50 Ra=250 C=0.004*D/w m Rp1=200 Rd1=100 axis1 La=(250/(2*D*w m)) Rd2=100 Ri=10 - - - Srel = n*n' + (identity(3) - n*n')*cos(q) - skew(n)*sin(q); + + diff + pow er wrela = n*qd; OpI zrela = n*qdd; Vs Rd4=100 Sb = Sa*Srel'; emf Rd3=100 y r0b = r0a; g3 x vb = Srel*va; inertial g1 wb = Srel*(wa + wrela); ab = Srel*aa; hall2 zb = Srel*(za + zrela + cross(wa, wrela)); hall1 w r fa = Srel'*fb; ta = Srel'*tb; g4 q qd 12 g2

  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 R L connect(DC.p,R.n); EM connect(R.p,L.n); DC connect(L.p, EM.n); connect(EM.p, DC.n); load connect(DC.n,G.p); connect(EM.flange,load.flange); G end DCMotor 13

  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 14

  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 15

  16. Meta-Modeling and Meta-Programming MetaModelica and Natural Semantics Specification Meta- Meta Model The Modeling Space formalisms Modelica language Meta-Model1 Meta-Model2 specification Modelica Model1 Model2 ModelN ... models World Meta-programming: Physical system transformation 16

  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 17

  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. 18

  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 19

  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 20

Recommend


More recommend