Modelica — A unified object-oriented language for system modeling and simulation

  • Peter Fritzson
  • Vadim Engelson
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1445)

Abstract

A new language called Modelica for hierarchical physical modeling is developed through an international effort. Modelica 1.0 [http:// www.Dynasim.se/Modelica] was announced in September 1997. It is an object-oriented language for modeling of physical systems for the purpose of efficient simulation. The language unifies and generalizes previous object-oriented modeling languages. Compared with the widespread simulation languages available today this language offers three important advances: 1) non-causal modeling based on differential and algebraic equations; 2) multidomain modeling capability, i.e. it is possible to combine electrical, mechanical, thermodynamic, hydraulic etc. model components within the same application model; 3) a general type system that unifies object-orientation, multiple inheritance, and templates within a single class construct.

A class in Modelica may contain variables (i.e. instances of other classes), equations and local class definitions. A function (method) can be regarded as a special case of local class without equations, but including an algorithm section.

The equation-based non-causal modeling makes Modelica classes more reusable than classes in ordinary object-oriented languages. The reason is that the class adapts itself to the data flow context where it is instantiated and connected. The multi-domain capability is partly based on a notion of connectors, i.e. certain class members that can act as interfaces (ports) when connecting instantiated objects. Connectors themselves are classes just like any other entity in Modelica. Simulation models can be developed using a graphical editor for connection diagrams. Connections are established just by drawing lines between objects picked from a class library.

The Modelica semantics is defined via translation of classes, instances and connections into a flat set of constants, variables and equations. Equations are sorted and converted to assignment statements when possible. Strongly connected sets of equations are solved by calling a symbolic and/or numeric solver. The generated C/C++ code is quite efficient.

In this paper we present the Modelica language with emphasis on its class construct and type system. A few short examples are given for illustration and compared with similar constructs in C++ and Java when this is relevant.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [1]
    Abadi M., and L. Cardelli: A Theory of Objects. Springer Verlag, ISBN 0-387-94775-2, 1996.Google Scholar
  2. [2]
    Andersson M.: Object-Oriented Modeling and Simulation of Hybrid Systems. PhD thesis ISRN LUTFD2/TFRT—1043—SE, Department of Automatic Control, Lund Institute of Technology, Lund, Sweden, December 1994.Google Scholar
  3. [3]
    Barton P.I., and C.C. Pantelides: Modeling of combined discrete/continuous processes. AIChE J., 40, pp. 966–979, 1994.CrossRefGoogle Scholar
  4. [4]
    Elmqvist H., D. Brück, and M. Otter: Dymola — User's Manual. Dynasim AB, Research Park Ideon, Lund, Sweden, 1996.Google Scholar
  5. [5]
    Ernst T., S. Jähnichen, and M. Klose: The Architecture of the Smile/M Simulation Environment. Proc. 15th IMACS World Congress on Scientific Computation, Modelling and Applied Mathematics, Vol. 6, Berlin, Germany, pp. 653–658, 1997Google Scholar
  6. [6]
    Jeandel A., F. Boudaud., and E. Larivière: ALLAN Simulation release 3.1 description M.DéGIMA.GSA1887. GAZ DE FRANCE, DR, Saint Denis La plaine, FRANCE, 1997.Google Scholar
  7. [7]
    Peter Wegner. Concepts and paradigms of object-oriented programming. OOPS Messenger, 1 (1):9–87, August 1990.Google Scholar
  8. [8]
    Dynasim Home page, http://www.Dynasim.seGoogle Scholar
  9. [9]
    Mathematica Home page, http://www.wolfram.comGoogle Scholar
  10. [10]
    Fritzson, P. Static and String Typing for Extended Mathematica, Innovation in Mathematics, Proceedings of the Second International Mathematica Symposium, Rovaniemi, Finland, 29 June–4 July, V. Keränen, P. Mitic, A. Hietamäki (Ed.), pp 153–160.Google Scholar
  11. [11]
    Peter Fritzson, Lars Viklund, Dag Fritzson, Johan Herber. High-Level Mathematical Modelling and Programming, IEEE Software, 12(4):77–87, July 1995.CrossRefGoogle Scholar
  12. [12]
    Sahlin P., A. Bring, and E.F. Sowell: The Neutral Model Format for building Simulation, Version 3.02. Technical Report, Department of Building Sciences, The Royal Institute of Technology, Stockholm, Sweden, June 1996.Google Scholar
  13. [13]
    ObjectMath Home Page, http://www.ida.liu.se/labs/pelab/omathGoogle Scholar
  14. [14]
    Hindmarsh, A.C., ODEPACK, A Systematized Collection of ODE Solvers, Scientific Computing, R. S. Stepleman et al. (eds.), North-Holland, Amsterdam, 1983 (Vol. 1 of IMACS Transactions on Scientific Computation), pp. 55–64, also http://www.netlib.org/odepack/index.htmlGoogle Scholar
  15. [15]
    Otter M., C. Schlegel, and H. Elmqvist, Modeling and Real-time Simulation of an Automatic Gearbox using Modelica. In Proceedings of ESS'97 — European Simulation Symposium, Passau, Oct. 19–23, 1997.Google Scholar
  16. [16]
    Tummescheit H., T. Ernst and M. Klose, Modelica and Smile — A Case Study Applying Object-Oriented Concepts to Multi-facet Modeling. In Proceedings of ESS'97 — European Simulation Symposium, Passau, Oct. 19–23, 1997.Google Scholar
  17. [17]
    Broenink J.F., Bond-Graph Modeling in Modelica. In Proceedings of ESS'97 — European Simulation Symposium, Passau, Oct. 19–23, 1997.Google Scholar
  18. [18]
    SIMULINK 2 — Dynamic System Simulation. http://www.mathworks.com/products/simulink/Google Scholar
  19. [19]
    ACSL software. http://www.mga.comGoogle Scholar
  20. [20]
    Jan Van der Spiegel. SPICE — A Brief Overview. http://howard.engr.siu.edu/ elec/faculty/etienne/spice.overview.html, http://www.seas.upenn.edu/~jan/spice/spice.overview.htmlGoogle Scholar
  21. [21]
    ADAMS — virtual prototyping virtually anything that moves. http://www.adams.comGoogle Scholar
  22. [22]
    V. Engelson, P. Fritzson, D. Fritzson. Generating Efficient 3D graphics animation code with OpenGL from object oriented models in Mathematica, In Innovation in Mathematics. Proceedings of the Second International Mathematica Symposium, Rovaniemi, Finland, 29 June–4 July 1997, V.Keränen, P. Mitic, A. Hietamäki (Ed.), pp. 129–136Google Scholar
  23. [23]
    Modelica Home Page http://www.Dynasim.se/ModelicaGoogle Scholar
  24. [24]
    V. Engelson, P. Fritzson, D. Fritzson. Automatic Generation of User Interfaces From Data Structure Specifications and Object-Oriented Application Models. In Proceedings of European Conference on Object-Oriented Programming (ECOOP96), Linz, Austria, 8–12 July 1996, vol. 1098 of Lecture Notes in Computer Science, Pierre Cointe (Ed.), pp. 114–141. Springer-Verlag, 1996Google Scholar
  25. [25]
    V. Engelson, P. Fritzson, D. Fritzson. Using the Mathematica environment for generating efficient 3D graphics. In Proceedings of COMPUGRAPHICS/EDUGRAPHICS, Vilamoura, Portugal, 15–18 December 1997 (to appear).Google Scholar
  26. [26]
    D. Fritzson, P. Nordling. Solving Ordinary Differential Equations on Parallel Computers Applied to Dynamic Rolling Bearing Simulation. In Parallel Programming and Applications, P. Fritzson, L. Finmo, eds., IOS Press, 1995Google Scholar
  27. [27]
    SIMPACK Home page http://www.cis.ufl.edu/mpack/~fishwick/simpack.htmlGoogle Scholar
  28. [28]
    M. Löfgren, J. Lindskov Knudsen, B. Magnusson, O. Lehrmann Madsen Object-Oriented Environments — The Mjølner Approach ISBN 0-13-009291-6, Prentice Hall, 1994. See also Beta Home Page, http://www.daimi.aau.dk/~beta/Google Scholar
  29. [29]
    H. Elmqvist, S. E. Mattsson: “Modelica — The Next Generation Modeling Language — An International Design Effort”. In Proceedings of First World Congress of System Simulation, Singapore, September 1–3 1997.Google Scholar

Copyright information

© Springer-Verlag 1998

Authors and Affiliations

  • Peter Fritzson
    • 1
  • Vadim Engelson
    • 1
  1. 1.PELAB, Dept. of Computer and Information ScienceLinköping UniversityLinköpingSweden

Personalised recommendations