Modelica — A unified object-oriented language for system modeling and simulation
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.
KeywordsAssignment Statement Class Parametrization Reusable Component Connector Class Simple Electrical Circuit
Unable to display preview. Download preview PDF.
- Abadi M., and L. Cardelli: A Theory of Objects. Springer Verlag, ISBN 0-387-94775-2, 1996.Google Scholar
- 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
- Elmqvist H., D. Brück, and M. Otter: Dymola — User's Manual. Dynasim AB, Research Park Ideon, Lund, Sweden, 1996.Google Scholar
- 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
- 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
- Peter Wegner. Concepts and paradigms of object-oriented programming. OOPS Messenger, 1 (1):9–87, August 1990.Google Scholar
- Dynasim Home page, http://www.Dynasim.seGoogle Scholar
- Mathematica Home page, http://www.wolfram.comGoogle Scholar
- 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
- 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
- ObjectMath Home Page, http://www.ida.liu.se/labs/pelab/omathGoogle Scholar
- 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
- 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
- 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
- Broenink J.F., Bond-Graph Modeling in Modelica. In Proceedings of ESS'97 — European Simulation Symposium, Passau, Oct. 19–23, 1997.Google Scholar
- SIMULINK 2 — Dynamic System Simulation. http://www.mathworks.com/products/simulink/Google Scholar
- ACSL software. http://www.mga.comGoogle Scholar
- 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
- ADAMS — virtual prototyping virtually anything that moves. http://www.adams.comGoogle Scholar
- 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
- Modelica Home Page http://www.Dynasim.se/ModelicaGoogle Scholar
- 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
- 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
- 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
- SIMPACK Home page http://www.cis.ufl.edu/mpack/~fishwick/simpack.htmlGoogle Scholar
- 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
- 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