Modelica
Encyclopedia
Modelica is an object-oriented, declarative
Declarative programming
In computer science, declarative programming is a programming paradigm that expresses the logic of a computation without describing its control flow. Many languages applying this style attempt to minimize or eliminate side effects by describing what the program should accomplish, rather than...

, multi-domain modeling language
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...

 for component-oriented
Component-based software engineering
Component-based software engineering is a branch of software engineering that emphasizes the separation of concerns in respect of the wide-ranging functionality available throughout a given software system...

 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 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++
C++
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...

 or Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

, it differs in two important respects. First, Modelica is a modeling language rather than a conventional 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 algorithm
Algorithm
In mathematics and computer science, an algorithm is an effective method expressed as a finite list of well-defined instructions for calculating a function. Algorithms are used for calculation, data processing, and automated reasoning...

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
Causal system
A causal system is a system where the output depends on past/current inputs but not future inputs i.e...

. 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
Doctor of Philosophy
Doctor of Philosophy, abbreviated as Ph.D., PhD, D.Phil., or DPhil , in English-speaking countries, is a postgraduate academic degree awarded by universities...

 thesis
of Hilding Elmqvist and on the experience with
the modeling languages Allan,
Dymola
Dymola
Dymola is a commercial modeling and simulation environment based on theopen Modelica modeling language. It is developed bythe Swedish company Dassault Systèmes AB, Lund...

, 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
).
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:
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
Unicode
Unicode is a computing industry standard for the consistent encoding, representation and handling of text expressed in most of the world's writing systems...

 support, access control to protect IP
Intellectual property
Intellectual property is a term referring to a number of distinct types of creations of the mind for which a set of exclusive rights are recognized—and the corresponding fields of law...

, improved support of object libraries)

Implementations

Commercial front-ends for Modelica include AMESim
AMESim
LMS Imagine.Lab AMESim is a simulation software for the modelling and analysis of one-dimensional systems. The software package offers a 1D simulation suite to model and analyze multi-domain, intelligent systems and to predict their multi-disciplinary performance...

 from the French company Imagine SA (now part of LMS International
LMS International
LMS International is an engineering services and software company, headquartered in Leuven, Belgium. The company employs about 890 people in 31 offices across the world....

), Dymola
Dymola
Dymola is a commercial modeling and simulation environment based on theopen Modelica modeling language. It is developed bythe Swedish company Dassault Systèmes AB, Lund...

 from the Swedish company Dynasim AB (now part of Dassault Systemes
Dassault Systemes
Dassault Systèmes S.A. is a leading company specializing in 3D and PLM software.Dassault Systèmes develops and markets PLM application software and services that support industrial processes and provide a 3D vision of the entire lifecycle of products from conception to maintenance to recycling...

), MathModelica from the Swedish company MathCore Engineering AB (now part of Wolfram Research), SimulationX
SimulationX
SimulationX is a multi-domain CAE simulation software for physical system simulation, developed and sold commercially by ITI GmbH, based in Dresden, Germany...

 from the German company ITI GmbH, MapleSim
MapleSim
MapleSim is a 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...

 from the Canadian company Maplesoft
Waterloo Maple
Waterloo Maple Inc. is a Canadian software company, headquartered in Waterloo, Ontario. It operates under the trading name Maplesoft and is best known as the manufacturer of the Maple computer algebra system and MapleSim physical modeling and simulation software.-Corporate history:Waterloo Maple Inc...

, and
CATIA Systems
from Dassault Systemes
Dassault Systemes
Dassault Systèmes S.A. is a leading company specializing in 3D and PLM software.Dassault Systèmes develops and markets PLM application software and services that support industrial processes and provide a 3D vision of the entire lifecycle of products from conception to maintenance to recycling...

 (CATIA
CATIA
CATIA is a multi-platform CAD/CAM/CAE commercial software suite developed by the French company Dassault Systemes...

 is one of the major CAD systems).

JModelica.org 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 simulation optimization of Modelica models, while offering a flexible platform serving as a virtual lab for algorithm development and research.

OpenModelica 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
Scicos is a graphical dynamical system modeler and simulator. User can create block diagrams to model and simulate the dynamics of hybrid dynamical systems and compile such models into executable code...

 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
():


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 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 (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

,
General Motors, Toyota, BMW and Daimler.
Modelica is also been increasingly used for the simulation of thermo-fluid and energy systems.

See also

  • AMESim
    AMESim
    LMS Imagine.Lab AMESim is a simulation software for the modelling and analysis of one-dimensional systems. The software package offers a 1D simulation suite to model and analyze multi-domain, intelligent systems and to predict their multi-disciplinary performance...

  • AMPL
    AMPL
    AMPL, an acronym for "A Mathematical Programming Language", is an algebraic modeling language for describing and solving high-complexity problems for large-scale mathematical computation AMPL, an acronym for "A Mathematical Programming Language", is an algebraic modeling language for describing and...

  • APMonitor
    APMonitor
    APMonitor, or "Advanced Process Monitor", is a modeling language for differential and algebraic equations. It is used for describing and solving representations of physical systems in the form of implicit DAE models. APMonitor is suited for large-scale problems and allows solutions of dynamic...

  • ASCEND
    ASCEND
    ASCEND is a free, open source, mathematical modelling system developed at Carnegie Mellon University since the late 1978. ASCEND is an acronym which stands for Advanced System for Computations in ENgineering Design. Its main uses have been in the field of chemical process modelling although its...

  • Dymola
    Dymola
    Dymola is a commercial modeling and simulation environment based on theopen Modelica modeling language. It is developed bythe Swedish company Dassault Systèmes AB, Lund...

  • Domain-Specific Modeling
    Domain-Specific Modeling
    Domain-specific modeling is a software engineering methodology for designing and developing systems, such as computer software. It involves systematic use of a domain-specific language to represent the various facets of a system...

     DSM
  • EcosimPro: Continuous and Discrete Modelling and Simulation Software
  • EMSO
    EMSO simulator
    EMSO simulator is an equation-oriented process simulator with a graph­i­cal interface for modeling com­plex dynamic or steady-state processes. It is CAPE-OPEN compliant. EMSO stands for Environment for Mod­el­ing, Sim­u­la­tion, and Opti­miza­tion...

  • GAMS
    General Algebraic Modeling System
    The General Algebraic Modeling System is a high-level modeling system for mathematical optimization. GAMS is designed for modeling and solving linear, nonlinear, and mixed-integer optimization problems. The system is tailored for complex, large-scale modeling applications and allows the user to...

  • JModelica.org
    JModelica.org
    JModelica.org is a free and open source platform based on the Modelica modeling language for modeling, simulation, optimization and analysis of complex dynamic systems. The platform is maintained and developed by Modelon AB in collaboration with academic and industrial institutions, notably Lund...

  • MapleSim
    MapleSim
    MapleSim is a 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...

  • MathModelica
  • MATLAB
    MATLAB
    MATLAB is a numerical computing environment and fourth-generation programming language. Developed by MathWorks, MATLAB allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages,...

  • SimulationX
    SimulationX
    SimulationX is a multi-domain CAE simulation software for physical system simulation, developed and sold commercially by ITI GmbH, based in Dresden, Germany...


External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK