Modelica
   HOME

TheInfoList



OR:

Modelica is an
object-oriented Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of pro ...
, declarative, multi-domain
modeling language A modeling language is any artificial language that can be used to express information or knowledge or systems in a structure that is defined by a consistent set of rules. The rules are used for interpretation of the meaning of components in the st ...
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 is developed by the non-profit Modelica Association. The Modelica Association also develops the free Modelica Standard Library that contains about 1400 generic model components and 1200 functions in various domains, as of version 4.0.0.


Characteristics

While Modelica resembles
object-oriented Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of pro ...
programming languages A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
, such as
C++ C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
or
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
, it differs in two important respects. First, Modelica is a
modeling language A modeling language is any artificial language that can be used to express information or knowledge or systems in a structure that is defined by a consistent set of rules. The rules are used for interpretation of the meaning of components in the st ...
rather than a conventional ''programming'' language. Modelica classes are not compiled in the usual sense, but they 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
algorithm In mathematics and computer science, an algorithm () is a finite sequence of rigorous instructions, typically used to solve a class of specific Computational problem, problems or to perform a computation. Algorithms are used as specificat ...
ic 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 Causality (also referred to as causation, or cause and effect) is influence by which one event, process, state, or object (''a'' ''cause'') contributes to the production of another event, process, state, or object (an ''effect'') where the cau ...
''. 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 of Hilding Elmqvist and on the experience with the modeling languages Allan,
Dymola Dymola is a commercial modeling and simulation environment based on the open Modelica modeling language. Large and complex systems are composed of component models; mathematical equations describe the dynamic behavior of the system. Developed by ...
, NMF ObjectMath, Omola, SIDOPS+, and Smile. Hilding Elmqvist is the key architect of Modelica, but many other people have contributed as well (see appendix E in the Modelica specification). 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:


Implementations

Commercial front-ends for Modelica include
AMESim Simcenter Amesim is a commercial simulation software for the modeling and analysis of multi-domain systems. It is part of systems engineering domain and falls into the mechatronic engineering field. The software package is a suite of tools used to ...
from the French company Imagine SA (now part of
Siemens Digital Industries Software Siemens Digital Industries Software (formerly UGS and then Siemens PLM Software) is an American computer software company specializing in 3D & 2D Product Lifecycle Management (PLM) software. The company is a business unit of Siemens, operates un ...
),
Dymola Dymola is a commercial modeling and simulation environment based on the open Modelica modeling language. Large and complex systems are composed of component models; mathematical equations describe the dynamic behavior of the system. Developed by ...
from the Swedish company Dynasim AB (now part of
Dassault Systemes Dassault Group (; also GIM Dassault or Groupe Industriel Marcel Dassault SAS) is a French group of companies established in 1929 with the creation of Société des Avions Marcel Bloch (now Dassault Aviation) by Marcel Dassault, and led by son Se ...
),
Wolfram SystemModeler Wolfram System Modeler, developed by Wolfram MathCore, is a platform for engineering as well as life-science modeling and simulation based on the Modelica language. It provides an interactive graphical modeling and simulation environment and a cu ...
(formerly ''MathModelica'') from the Swedish company Wolfram MathCore AB (now part of
Wolfram Research Wolfram Research, Inc. ( ) is an American multinational company that creates computational technology. Wolfram's flagship product is the technical computing program Wolfram Mathematica, first released on June 23, 1988. Other products include ...
),
SimulationX SimulationX is a CAE software application running on Microsoft Windows for the physical simulation of technical systems. It is developed and sold by ESI Group. History In the mid 1980s, VEB Mikromat in Dresden (Germany) developed a progra ...
from the German company ESI ITI GmbH,
MapleSim MapleSim is a Modelica-based, multi-domain modeling and simulation tool developed by Maplesoft. MapleSim generates model equations, runs simulations, and performs analyses using the symbolic and numeric mathematical engine of Maple. Models are cr ...
from the Canadian company
Maplesoft Waterloo Maple Inc. is a Canadian software company, headquartered in Waterloo, Ontario. It operates under the trade name Maplesoft. It is best known as the manufacturer of the Maple computer algebra system, and MapleSim physical modeling and s ...
,
JModelica.org JModelica.org is a commercial software platform based on the Modelica modeling language for modeling, simulating, optimizing and analyzing complex dynamic systems. The platform is maintained and developed by Modelon AB in collaboration with academi ...
(open source, discontinued) and Modelon Impact, from the Swedish company Modelon AB, and CATIA Systems from
Dassault Systemes Dassault Group (; also GIM Dassault or Groupe Industriel Marcel Dassault SAS) is a French group of companies established in 1929 with the creation of Société des Avions Marcel Bloch (now Dassault Aviation) by Marcel Dassault, and led by son Se ...
(
CATIA CATIA (, an acronym of computer-aided three-dimensional interactive application) is a multi-platform software suite for computer-aided design (CAD), computer-aided manufacturing (CAM), computer-aided engineering (CAE), 3D modeling and Product ...
is one of the major
CAD Computer-aided design (CAD) is the use of computers (or ) to aid in the creation, modification, analysis, or optimization of a design. This software is used to increase the productivity of the designer, improve the quality of design, improve co ...
systems).
Openmodelica OpenModelica is a free and open source environment based on the Modelica modeling language for modeling, simulating, optimizing and analyzing complex dynamic systems. This software is actively developed by Open Source Modelica Consortium, a non- ...
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, compilation and simulation environment based on free software distributed in binary and source code form for research, teaching, and industrial usage. The free simulation environment
Scicos Scicos is a graphical dynamical system modeler and simulator. The software’s purpose is to create block diagrams to model and simulate the dynamics of hybrid dynamical systems (both continuous and discrete time) and compile these models into e ...
uses a subset of Modelica for component modeling. Support for a larger part of the Modelica language is currently under development. Nevertheless, there is still some incompatibility and diverging interpretation between all the different tools concerning the Modelica language.


Examples

The following code fragment shows a very simple example of a first order system (\dot x = - c \cdot x, x(0)=10 ): model FirstOrder parameter Real c=1 "Time constant"; Real x (start=10) "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 four 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 infinitesimally 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. The full rules for defining balanced models are rather complex, and can be read from in section 4.7. However, for most cases, a simple rule can be issued, that counts variables and equations the same way as most simulation tools do:
A model is balanced when the number of its equations
equals the number of its variables.
given that variables and equations must be counted according to the following rule:
->Number of model equations                            = 
  Number of equations defined in the model             + 
  number of flow variables in the outside connectors
 
->Number of model variables = Number of variables defined in the model
  (including the variables in the physical connectors) 
''Note that standard input connectors (such as RealInput or IntegerInput) do not contribute to the count of variables since no new variables are defined inside them.'' The reason for this rule can be understood thinking of the capacitor defined above. Its pins contain a flow variable, i.e. a current, each. When we check it, it is connected to nothing. This corresponds to set an equation pin.i=0 for each pin. That's why we must add an equation for each flow variable. Obviously the example can be extended to other cases, in which other kinds of flow variables are involved (e.g. forces, torques, etc.). When our capacitor is connected to another (balanced) model through one of its pins, a connection equation will be generated that will substitute the two i=0 equations of the pins being connected. Since the connection equation corresponds to two scalar equations, the connection operation will leave the balanced larger model (constituted by our Capacitor and the model it is connected to). The Capacitor model above is balanced, since
number of equations =   3+2=5   (flow variables: pin_p.i, pin_n.i, u)
number of variables =       5   (u, pin_p.u, pin_p.i, pin_n.u, pi_n.i)
Verification using OpenModelica of this model gives, in fact
Class Capacitor has 5 equation(s) and 5 variable(s).
3 of these are trivial equation(s).
Another example, containing both input connectors and physical connectors is the following component from Modelica Standard Library: model SignalVoltage "Generic voltage source using the input signal as source voltage" Interfaces.PositivePin p; Interfaces.NegativePin n; Modelica.Blocks.Interfaces.RealInput v(unit="V") "Voltage between pin p and n (= p.v - n.v) as input signal"; SI.Current i "Current flowing from pin p to pin n"; equation v = p.v - n.v; 0 = p.i + n.i; i = p.i; end SignalVoltage; The component SignalVoltage is balanced since
number of equations =   3+2=5  (flow variables: pin_p.i, pin_n.i, u)
number of variables =       5  (i, pin_p.u, pin_p.i, pin_n.u, pi_n.i)
Again, checking with OpenModelica gives
Class Modelica.Electrical.Analog.Sources.SignalVoltage has 5 equation(s) and 5 variable(s).
4 of these are trivial equation(s).


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 to ensure 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 (for example, steam power generation, hydraulics, etc.), automotive applications (especially powertrain) and mechanical systems (for example, multi-body systems, mechatronics, etc.). In the automotive sector, many of the major automotive OEMs are using Modelica. These include Ford, General Motors, Toyota, BMW, and Daimler. Modelica is also being increasingly used for the simulation of thermo-fluid and energy systems. The characteristics of Modelica (acausal, object-oriented, domain neutral) make it well suited to system-level simulation, a domain where Modelica is now well established.


See also

*
AMESim Simcenter Amesim is a commercial simulation software for the modeling and analysis of multi-domain systems. It is part of systems engineering domain and falls into the mechatronic engineering field. The software package is a suite of tools used to ...
*
AMPL AMPL (A Mathematical Programming Language) is an algebraic modeling language to describe and solve high-complexity problems for large-scale mathematical computing (i.e., large-scale optimization and scheduling-type problems). It was developed ...
*
APMonitor Advanced process monitor (APMonitor) is a modeling language for differential algebraic ( DAE) equations. It is a free web-service or local server for solving representations of physical systems in the form of implicit DAE models. APMonitor is s ...
*
ASCEND ASCEND is an open source, mathematical modelling chemical process modelling system developed at Carnegie Mellon University since late 1978. ASCEND is an acronym which stands for Advanced System for Computations in Engineering Design. Its main us ...
* Domain-Specific Modeling DSM *
Dymola Dymola is a commercial modeling and simulation environment based on the open Modelica modeling language. Large and complex systems are composed of component models; mathematical equations describe the dynamic behavior of the system. Developed by ...
* EcosimPro: Continuous and Discrete Modelling and Simulation Software * EMSO *
GAMS Gams is a municipality in the ''Wahlkreis'' (constituency) of Werdenberg in the canton of St. Gallen in Switzerland. History Gams is first mentioned in 835 as ''Campesias''. In 1210 it was mentioned as ''Chames'', in 1236 as ''Gamps''. Unt ...
*
JModelica.org JModelica.org is a commercial software platform based on the Modelica modeling language for modeling, simulating, optimizing and analyzing complex dynamic systems. The platform is maintained and developed by Modelon AB in collaboration with academi ...
*
OpenModelica OpenModelica is a free and open source environment based on the Modelica modeling language for modeling, simulating, optimizing and analyzing complex dynamic systems. This software is actively developed by Open Source Modelica Consortium, a non- ...
*
MapleSim MapleSim is a Modelica-based, multi-domain modeling and simulation tool developed by Maplesoft. MapleSim generates model equations, runs simulations, and performs analyses using the symbolic and numeric mathematical engine of Maple. Models are cr ...
*
MATLAB MATLAB (an abbreviation of "MATrix LABoratory") is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementation ...
*
SimulationX SimulationX is a CAE software application running on Microsoft Windows for the physical simulation of technical systems. It is developed and sold by ESI Group. History In the mid 1980s, VEB Mikromat in Dresden (Germany) developed a progra ...
*
Simulink Simulink is a MATLAB-based graphical programming environment for modeling, simulating and analyzing multidomain dynamical systems. Its primary interface is a graphical block diagramming tool and a customizable set of block libraries. It offers t ...
*
Wolfram SystemModeler Wolfram System Modeler, developed by Wolfram MathCore, is a platform for engineering as well as life-science modeling and simulation based on the Modelica language. It provides an interactive graphical modeling and simulation environment and a cu ...
* Scilab/Xcos * Kepler (Ptolemy)


Notes


External links


Modelica 3.5 language specificationModelica Association
the homepage of the non-profit Modelica Association (developing Modelica)
Modelica by Example
A free interactive HTML book for learning Modelica, by Michael Tiller
Introduction to Physical Modeling with Modelica
book by Michael Tiller * {{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 , last = Fritzson , first = Peter , date=February 2004 , publisher = Wiley-IEEE Press , isbn = 978-0-471-47163-9
Modelica Overview
Simulation programming languages Declarative programming languages Object-oriented programming