Modelica Language

Modelica is an open source, object-oriented and equation-based language, used to model complex physical systems involving, for instance, mechanics, electronics, hydraulics and controls.

Why is this language born?

  • To model the complex and dynamical behavior of multi domain systems.
  • Models are described by differential, algebraic and/or discrete equations.
  • There can be no modeling through partial differential equation: that means no FEM and no CFD. Only results from these methods may only be used by Dymola.

 

Vehicle Detailed Model
Vehicle Detailed Model

Modelica-based Simulation Environment

Dymola is a Modelica based simulation environment, fully compatible with all its libraries. This means that Dymola is capable of solving and simulate any model developed with Modelica.

Relazione fra Dymola e Modelica
Modelica-based Simulation Framework

Modelica Language Features

  • Mathematical notation for matrixes and arrays can be composed by numbers, and by models as well;
  • Sub-models are replaceable and modifiable: for instance, it’s easy to quickly change between different versions of a transmission in a vehicle model.
  • Constructs are available to define discontinuous systems and variables, like switch or frictions.
  • Mathematical functions with a variable number of input/output. The procedural part of Modelica is used as a scripting language.
  • Functions written in C, Fortran and Java can be called inside Modelica.
  • Powerful concept of Library (compilers have enough data to automatically search inside models, manage the version, update models…)

Object-Oriented Language

Modelica is an object–oriented language in which:

  • Every icon represents a physical component (electrical resistance, pump, …)
  • A connection line represents the real physical coupling (cable, fluid or heat flux, …)
  • A component can be composed by subsystems connected (in a hierarchical way) and/or described by equations
  • Through symbolic manipulation algorithms, high level Modelica description gets translated in a set of algebraic differential equations.

 

modellazione ad oggetti basata su Modelica in Dymola
Modelica-based Dymola Model
  • For each domain, causal and acausal (bidirectional) connectors are defined:
Descrizione delle varie tipologie di connettori Modelica
Modelica Connector Types
  • Every connector type is compatible only with itself, since it is defined from physical quantities which belong to a certain physical domain.
  • For each domain, physical balance laws are defined for every generic component.
Modellazione da zero di un componente in Modelica
Base Component Definition
  • Models are composed from a source code Modelica representation, and from the relative graphical block scheme illustration.
  • Each block represents a class instance, define outside the model.
  • External class instances can be modified or renamed while declaring them.
  • Connections among blocks are equations, as well.
Esempio di modellazione ad oggetti in Modelica
Object-Oriented and Block Modeling
Modello di un sistema complesso multidominio, modellando utilizzando le classi e Modelica
Multi-domain Model of a Complex System using Modelica Classes

Hardware in the Loop

In each model, Modelica source code can easily be divided into logic units and then partitioned by defining different tasks and subtasks. Once these logic units have been defined, the development tool based on Modelica (Dymola) will be able to automatically split equations, generating the code for each physical target, thanks to the syntactic Modelica structure.

Hardware in the loop con Modelica
Hardware in the Loop with Modelica