Jump to content

Modelica: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
m →‎External links: Principles of Object-Oriented Modeling and Simulation with Modelica 2.1
Missing references added, external links for Modelica tools added
Line 16: Line 16:
| latest_preview_date =
| latest_preview_date =
| typing =
| typing =
| implementations = CATIA Systems, [[Dymola]], JModelica.org, [[MapleSim]], [[MathModelica]], OpenModelica, [[Scicos]], [[SimulationX]], [[Xcos]]
| implementations = CATIA Systems, [[Dymola]], JModelica.org, [[MapleSim]], [[MathModelica]], OpenModelica, [[Scicos]], [[SimulationX]], Vertex, [[Xcos]]
| influenced_by =
| influenced_by =
| influenced =
| influenced =
Line 46: Line 46:
| title=A Structured Model Language for Large Continuous Systems.}}</ref>
| title=A Structured Model Language for Large Continuous Systems.}}</ref>
of Hilding Elmqvist and on the experience with
of Hilding Elmqvist and on the experience with
the modeling languages Allan<ref>Jeandel A., Boudaud F.: [https://www.modelica.org/publications/papers/p303.pdf ''Physical System Modelling Languages: from ALLAN to Modelica''], Building Simulation'97, IBPSA Conference, Prague, September 8-10, 1997.</ref>,
the modeling languages Allan{{Citation needed|date=April 2010}}, [[Dymola]], NMF{{Citation needed|date=April 2010}}, ObjectMath{{Citation needed|date=April 2010}}, Omola{{Citation needed|date=April 2010}}, SIDOPS+{{Citation needed|date=April 2010}},
and Smile{{Citation needed|date=April 2010}}. Hilding Elmqvist is the key architect of Modelica, but
[[Dymola]], NMF{{Citation needed|date=April 2010}}
ObjectMath{{Citation needed|date=April 2010}},
Omola<ref>S.E. Mattsson, M. Andersson and K.J..Aström: Object-oriented modeling and simulation. In: Linkens, ed., CAD for Control Systems (Marcel Dekker, 1993) pp. 31-69.</ref>,
SIDOPS+{{Citation needed|date=April 2010}}, and
Smile<ref>Ernst T., Jähnichen S., Klose M.:
[https://www.modelica.org/publications/papers/imacs97.pdf ''Object-Oriented Physical Systems Modeling, Modelica, and the Smile/M Simulation Environment'']. 15th IMACS World Congress on Scientific Computation, Modelling and Applied Mathematics, Berlin, August 24-29, 1997.</ref>.
Hilding Elmqvist is the key architect of Modelica, but
many other people have contributed as well (see appendix E in
many other people have contributed as well (see appendix E in
<ref name="3.2spec"/>).
<ref name="3.2spec"/>).
Line 237: Line 243:
*[http://www.springer.com/east/home/generic/search/results?SGWID=5-40109-22-33373560-0 Introduction to Physical Modeling with Modelica], book by Michael Tiller
*[http://www.springer.com/east/home/generic/search/results?SGWID=5-40109-22-33373560-0 Introduction to Physical Modeling with Modelica], book by Michael Tiller
* {{cite book
* {{cite book
| url = http://www.ida.liu.se/labs/pelab/modelica/OpenModelica/Documents/ModelicaBookExcerpts.pdf
| title = Principles of Object-Oriented Modeling and Simulation with Modelica 2.1
| title = Principles of Object-Oriented Modeling and Simulation with Modelica 2.1
| last = Fritzson
| last = Fritzson
Line 246: Line 253:
| isbn = 978-0-471-47163-9
| isbn = 978-0-471-47163-9
}}
}}
* Commercial Modelica tools: [http://www.3ds.com/products/catia/portfolio/dymola Dymola], [http://www.lmsintl.com/imagine-amesim-1-d-multi-domain-system-simulation LMS Imagine.Lab AMESim], [http://www.maplesoft.com/products/maplesim/index.aspx MapleSim], [http://www.mathcore.com/products/mathmodelica/ MathModelica], [http://www.modelon.com/products/modelica-physical-modeling-toolbox-for-matlab/ Modelica Physical Modeling Toolbox for Matlab], [http://www.simulationx.com/ SimulationX], [http://www.deltatheta.com/products/vertex/ Vertex]
* Open source Modelica tools: [http://www.openmodelica.org/ OpenModelica] (GPL or OSMC-PL), [http://www.jmodelica.org/ JModelica.org] (GPL)


[[Category:Simulation programming languages]]
[[Category:Simulation programming languages]]

Revision as of 10:40, 2 June 2011

Modelica
Paradigmdeclarative language
First appeared1997
Stable release
3.2 / March 24, 2010[1]
OSCross-platform
LicenseModelica License Version 2
Websitewww.modelica.org
Major implementations
CATIA Systems, Dymola, JModelica.org, MapleSim, MathModelica, OpenModelica, Scicos, SimulationX, Vertex, Xcos

Modelica is an object-oriented, declarative, multi-domain modeling language for component-oriented modeling of complex systems, e.g., systems containing mechanical, electrical, electronic, hydraulic, thermal, control, electric power or process-oriented subcomponents. The free Modelica language[1] is developed by the non-profit Modelica Association.[2] The Modelica Association also develops the free Modelica Standard Library[3] that contains about 1280 generic model components and 910 functions in various domains, as of version 3.2.

Characteristics

While Modelica resembles object-oriented programming languages, such as C++ or Java, it differs in two important respects. First, Modelica is a modeling language rather than a true programming language. Modelica classes are not compiled in the usual sense, but are translated into objects which are then exercised by a simulation engine. The simulation engine is not specified by the language, although certain required capabilities are outlined.

Second, although classes may contain algorithmic components similar to statements or blocks in programming languages, their primary content is a set of equations. In contrast to a typical assignment statement, such as

x := 2 + y;,

where the left-hand side of the statement is assigned a value calculated from the expression on the right-hand side, an equation may have expressions on both its right- and left-hand sides, for example,

x + y = 3 * z;.

Equations do not describe assignment but equality. In Modelica terms, equations have no pre-defined causality. The simulation engine may (and usually must) manipulate the equations symbolically to determine their order of execution and which components in the equation are inputs and which are outputs.

History

The Modelica design effort was initiated in September 1996 by Hilding Elmqvist. The goal was to develop an object-oriented language for modeling of technical systems in order to reuse and exchange dynamic system models in a standardized format. Modelica 1.0 is based on the PhD thesis[4] of Hilding Elmqvist and on the experience with the modeling languages Allan[5], Dymola, NMF[citation needed] ObjectMath[citation needed], Omola[6], SIDOPS+[citation needed], and Smile[7]. Hilding Elmqvist is the key architect of Modelica, but many other people have contributed as well (see appendix E in [1]). In September 1997, version 1.0 of the Modelica specification was released which was the basis for a prototype implementation within the commercial Dymola software system. In year 2000, the non-profit Modelica Association was formed to manage the continually evolving Modelica language and the development of the free Modelica Standard Library. In the same year, the usage of Modelica in industrial applications started.

This table presents the timeline of the Modelica specification history[8]:

Release Release Date Highlights
1.0 1997, September First version to model continuous dynamic systems.
1.1 1998, December Language elements to model discrete systems (pre, when)
1.2 1999, June Interface to C and Fortran, inner/outer for global variables, refined semantics of event handling
1.3 1999, December Improved semantics for inner/outer connections, protected elements, array expressions.
1.4 2000, December Removed declare-before-use rule, refined package concept, refined when-clause
2.0 2002, July Initialization of models, standardization of graphical appearance, functions with mixed positional and named arguments, record constructor, enumerations
2.1 2004, March Overdetermined connector to model 3-dim. mechanical systems, enhanced redeclaration of submodels, array and array indices of enumerations
2.2 2005, February Expandable connector to model signal buses, conditional component declarations, arrays with dynamic size changes in functions
3.0 2007, September Clean-up version: specification newly written, type system and graphical appearance refined, language flaws fixed, balanced model concept to detect model errors in a much better way
3.1 2009, May Stream connector to handle bi-directional flow of fluid, operator overloading, mapping model parts to execution environments (for use in embedded systems)
3.2 2010, March Improved initialization with homotopy method, functions as formal inputs to functions, Unicode support, access control to protect IP, improved support of object libraries)

Implementations

Commercial front-ends for Modelica include Dymola from the Swedish company Dynasim AB (now part of Dassault Systemes), MathModelica from the Swedish company MathCore Engineering AB, SimulationX from the German company ITI GmbH, MapleSim from the Canadian company Maplesoft,[9] and CATIA Systems [10][11] from Dassault Systemes (CATIA is one of the major CAD systems).

JModelica.org[12] is an extensible Modelica-based open source platform for optimization, simulation and analysis of complex dynamic systems. The main objective of the project is to create an industrially viable open source platform for optimization of Modelica models, while offering a flexible platform serving as a virtual lab for algorithm development and research.

OpenModelica[13] is an open-source Modelica-based modeling and simulation environment intended for industrial and academic usage. Its long-term development is supported by a non-profit organization – the Open Source Modelica Consortium (OSMC). The goal with the OpenModelica effort is to create a comprehensive Open Source Modelica modeling,[14] compilation and simulation environment based on free software distributed in binary and source code form for research,[15] teaching,[16] and industrial usage.

The free simulation environment Scicos uses a subset of Modelica for component modeling. Support for a larger part of the Modelica language is currently under development.

Examples

The following code fragment shows a very simple example of a first order system ():

model FirstOrder
  parameter Real c=1 "Time constant";
  Real x "An unknown";
equation
  der(x) = -c*x "A first order differential equation";
end FirstOrder;

Interesting things to note about this example are the 'parameter' qualifier, which indicates that a given variable is time-invariant and the 'der' operator, which represents (symbolically) the time derivative of a variable. Also worth noting are the documentation strings that can be associated with declarations and equations.

The main application area of Modelica is the modeling of physical systems. The most basic structuring concepts are shown at hand of simple examples from the electrical domain:

Built-in and user derived types

Modelica has the 4 built-in types Real, Integer, Boolean, String. Typically, user-defined types are derived, to associate physical quantity, unit, nominal values and other attributes:

type Voltage = Real(quantity="ElectricalPotential", unit="V");
type Current = Real(quantity="ElectricalCurrent", unit="A");
  ...

Connectors describing physical interaction

The interaction of a component to other components is defined by physical ports, called connectors, e.g., an electrical pin is defined as:

connector Pin "Electrical pin"
   Voltage      v "Potential at the pin";
   flow Current i "Current flowing into the component";
end Pin;

When drawing connection lines between ports, the meaning is that corresponding connector variables without the "flow" prefix are identical (here: "v") and that corresponding connector variables with the "flow" prefix (here: "i") are defined by a zero-sum equation (the sum of all corresponding "flow" variables is zero). The motivation is to automatically fulfill the relevant balance equations at the infinitesimal small connection point.

Basic model components

A basic model component is defined by a model and contains equations that describe the relationship between the connector variables in a declarative form (i.e., without specifying the calculation order):

model Capacitor
   parameter Capacitance C;
   Voltage u "Voltage drop between pin_p and pin_n";
   Pin pin_p, pin_n;
equation
            0 = pin_p.i + pin_n.i;
            u = pin_p.v - pin_n.v;
   C * der(u) = pin_p.i;
end Capacitor;

The goal is that a connected set of model components leads to a set of differential, algebraic and discrete equations where the number of unknowns and the number of equations is identical. In Modelica this is achieved by requiring so called balanced models. This means that when "using" a model (making a model instance), all missing equations must be provided. From this requirement and the possibilities to provide missing equations for a model instance, e.g., by connecting connectors, Modelica requires in its simplest form that:

Number of model equations = Number of unknowns - number of flow variables - number of inputs

The Capacitor model above is balanced, since

number of equations =   5 (number of unknowns:
                           pin_p.v, pin_p.i, pin_n.v, pin_n.i, u)
                      - 2 (number of flow variables: pin_p.i, pin_n.i)
                    =   3.

Hierarchical models

A hierarchical model is built-up from basic models, by instantiating basic models, providing suitable values for the model parameters, and by connecting model connectors. A typical example is the following electrical circuit:

model Circuit
   Capacitor C1(C=1e-4) "A Capacitor instance from the model above";
   Capacitor C2(C=1e-5) "A Capacitor instance from the model above";
     ...
equation
   connect(C1.pin_p, C2.pin_n);
   ...
end Circuit;

Via the language element annotation(...) definitions can be added to a model that do not have an influence on a simulation. Annotations are used to define graphical layout, documentation and version information. A basic set of graphical annotations is standardized in order that the graphical appearance and layout of models in different Modelica tools is the same.

Applications

Modelica is designed to be domain neutral and, as a result, is used in a wide variety of applications, such as fluid systems (e.g. steam power generation, hydraulics, etc), automotive applications (especially powertrain) and mechanical systems (e.g. multi-body systems, mechatronics, etc).

In the automotive sector, many of the major automotive OEMs are using Modelica. These include Ford [17] [18] ,[19] General Motors,[20] Toyota,[21] BMW [22] and Daimler.[23] Modelica is also been increasingly used for the simulation of thermo-fluid and energy systems.[24]

See also

Notes

  1. ^ a b c "Modelica Language Specification, Version 3.2" (PDF). Modelica Association. 2010-03-24. Cite error: The named reference "3.2spec" was defined multiple times with different content (see the help page).
  2. ^ Homepage of the Modelica Association
  3. ^ The Modelica Standard Library is available for download here
  4. ^ "A Structured Model Language for Large Continuous Systems".
  5. ^ Jeandel A., Boudaud F.: Physical System Modelling Languages: from ALLAN to Modelica, Building Simulation'97, IBPSA Conference, Prague, September 8-10, 1997.
  6. ^ S.E. Mattsson, M. Andersson and K.J..Aström: Object-oriented modeling and simulation. In: Linkens, ed., CAD for Control Systems (Marcel Dekker, 1993) pp. 31-69.
  7. ^ Ernst T., Jähnichen S., Klose M.: Object-Oriented Physical Systems Modeling, Modelica, and the Smile/M Simulation Environment. 15th IMACS World Congress on Scientific Computation, Modelling and Applied Mathematics, Berlin, August 24-29, 1997.
  8. ^ "Documents". Modelica Association. Retrieved 2009-10-11.
  9. ^ "Supports Modelica standard". Maplesoft. Retrieved 2009-10-11.
  10. ^ "Modelica in CATIA (module: CATIA Systems Dynamic Behavior)". Dassault Systemes.
  11. ^ Announcement of DS' acquisition of Dynasim
  12. ^ JModelica project
  13. ^ OpenModelica project
  14. ^ Adrian Pop, David Akhvlediani, Peter Fritzson Integrated UML and Modelica System Modeling with ModelicaML in Eclipse, In Proceedings of the 11th IASTED International Conference on Software Engineering and Applications (SEA 2007), Cambridge, MA, USA
  15. ^ Håkan Lundvall and Peter Fritzson Automatic Parallelization of Object Oriented Models Executed with Inline Solvers, In Proceedings of EuroPvm/Parsim, Springer Verlag LNCS, Volume 4757, 2007. See also http://pvmmpi07.lri.fr/parsim07.html. Paris, France.
  16. ^ Anders Fernström, Ingemar Axelsson, Peter Fritzson, Anders Sandholm, Adrian Pop OMNotebook - Interactive WYSIWYG Book Software for Teaching Programming, In Proc. of the Workshop on Developing Computer Science Education - How Can It Be Done?, 2006. Linköping University, Dept. Computer & Inf. Science, Linköping, Sweden
  17. ^ Michael Tiller, Paul Bowles, Mike Dempsey Development of a Vehicle Modeling Architecture in Modelica, 3rd International Modelica Conference
  18. ^ Erik Surewaard, Eckhard Karden, Michael Tiller Advanced Electric Storage System Modeling in Modelica, 3rd International Modelica Conference
  19. ^ Charles Newman, John Batteh, Michael Tiller Spark-Ignited Engine Cycle Simulation in Modelica, 2nd International Modelica Conference
  20. ^ E. D. Tate, Michael Sasena, Jesse Gohl, Michael Tiller Model Embedded Control: A Method to Rapidly Synthesize Controllers in a Modeling Environment, 6th International Modelica Conference
  21. ^ S. Soejima, T. Matsuba Application of mixed mode integration and implicit inline integration at Toyota, 2nd International Modelica Conference
  22. ^ Henrik Wigermo, Johannes von Grundherr, Thomas Christ Implementation of a Modelica Online Optimization for an Operating Strategy of a Hybrid Powertrain, 6th International Modelica Conference
  23. ^ Brückmann, Strenkert, Keller, Wiesner, Junghanns Model-based Development of a Dual-Clutch Transmission using Rapid Prototyping and SiL, International VDI Congress Transmissions in Vehicles 2009, Friedrichshafen, Germany
  24. ^ Michael Wetter, Christoph Haugstetter Modelica versus TRNSYS - A Comparison Between An Equation-Based and a Procedural Modeling Language for Building Energy Simulation, 2nd SimBuild Conference, Cambridge, MA, USA, August 2006.

External links