Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit

- Dump the enclosing scope path instead of the instance tree path for
  extended names in replaceable classes in getModelInstance.


Failed to load latest commit information.
Latest commit message
Commit time

OpenModelica License: OSMC-PL

OpenModelica is an open-source Modelica-based modeling and simulation environment intended for industrial and academic usage.

OpenModelica User's Guide

The User's Guide is automatically generated from the documentation repository.

OpenModelica environment

The OpenModelica Compiler is the core of the OpenModelica project. OMEdit is the graphical user interface on top of the compiler. OMSimulator is a capable FMI and SSP-based Co-Simulation environment, available as a standalone version or integrated in OMEdit. In addition there are interactive environments OMNotebook, OMPlot and OMShell interaction with the OMCompiler as well as various other tools: OMOptim, OMParser, OMSens, OMSense_Qt.

Working with the repository

OpenModelica.git is a superproject. Clone the project using one of:

# Faster pulling by using read-only mirror (low latency in Europe; very important when updating all submodules)
# Replace the pull URL with if you want to pull directly from github
# The default choice is to push to your fork on (SSH). Replace MY_FORK with OpenModelica to push directly to the OpenModelica repositories (if you have access)
git clone --recursive
cd OpenModelica
git remote set-url --push origin$MY_FORK/OpenModelica.git
git submodule foreach --recursive 'git remote set-url --push origin `git config --get remote.origin.url | sed s,^.*/,'$MY_FORK'/,`'

If you are a developer and want to update your local git repository to the latest developments or latest heads, use:

# After cloning
cd OpenModelica
git checkout master
git pull
# To checkout the latest master on each submodule run
# >ou will need to merge each submodule, but your changes will remain
git submodule foreach --recursive "git checkout master && git pull"

# Running master on all submodules might lead to build errors
# so use this to make sure you force all submodules to the commits
# from the OpenModelica glue project which are properly tested
git submodule update --force --init --recursive

In order to push to the repository, you will push to your own fork of OpenModelica.git, etc. You will need to create a fork of each repository that you want to push to (by clicking the Fork button in the GitHub web interface).

If you do not checkout the repositories for some GUI clients (such as OMOptim.git), these directories will be ignored by autoconf and skipped during compilation.

To checkout a specific version of OpenModelica, say tag v1.16.2 do:

git clone --recursive
cd OpenModelica
git checkout v1.16.2
git submodule update --force --init --recursive

If you have issues building you can try to clean and reset the repository using:

git clean -fdx
git submodule foreach --recursive git clean -fdx
git reset --hard
git submodule foreach --recursive git reset --hard
git submodule update --init --recursive

To check your working copy status and the hashes of the submodules, use:

git status
git submodule status --recursive

To checkout a minimal version of OpenModelica

> git clone OpenModelica-minimal
> cd OpenModelica-minimal
> git submodule update --init --recursive libraries

Build OpenModelica

How to run

Here is a short example session. This example uses OMShell-terminal, but OMShell, mos-scripts, or OMNotebook work the same way.

$ cd trunk/build/bin
$ ./OMShell-terminal
OMShell Copyright 1997-2015, Open Source Modelica Consortium (OSMC)
Distributed under OMSC-PL and GPL, see

To get help on using OMShell and OpenModelica, type "help()" and press enter
Started server using:omc -d=interactive > /tmp/omshell.log 2>&1 &
>>> loadModel(Modelica)
>>> getErrorString()
>> instantiateModel(Modelica.Electrical.Analog.Basic.Resistor)
"class Modelica.Electrical.Analog.Basic.Resistor \"Ideal linear electrical resistor\"
  Real v(quantity = \"ElectricPotential\", unit = \"V\") \"Voltage drop between the two pins (= p.v - n.v)\";
  Real i(quantity = \"ElectricCurrent\", unit = \"A\") \"Current flowing from pin p to pin n\";
  Real p.v(quantity = \"ElectricPotential\", unit = \"V\") \"Potential at the pin\";
  Real p.i(quantity = \"ElectricCurrent\", unit = \"A\") \"Current flowing into the pin\";
  Real n.v(quantity = \"ElectricPotential\", unit = \"V\") \"Potential at the pin\";
  Real n.i(quantity = \"ElectricCurrent\", unit = \"A\") \"Current flowing into the pin\";
  parameter Boolean useHeatPort = false \"=true, if HeatPort is enabled\";
  parameter Real T(quantity = \"ThermodynamicTemperature\", unit = \"K\", displayUnit = \"degC\", min = 0.0, start = 288.15, nominal = 300.0) = T_ref \"Fixed device temperature if useHeatPort = false\";
  Real LossPower(quantity = \"Power\", unit = \"W\") \"Loss power leaving component via HeatPort\";
  Real T_heatPort(quantity = \"ThermodynamicTemperature\", unit = \"K\", displayUnit = \"degC\", min = 0.0, start = 288.15, nominal = 300.0) \"Temperature of HeatPort\";
  parameter Real R(quantity = \"Resistance\", unit = \"Ohm\", start = 1.0) \"Resistance at temperature T_ref\";
  parameter Real T_ref(quantity = \"ThermodynamicTemperature\", unit = \"K\", displayUnit = \"degC\", min = 0.0, start = 288.15, nominal = 300.0) = 300.15 \"Reference temperature\";
  parameter Real alpha(quantity = \"LinearTemperatureCoefficient\", unit = \"1/K\") = 0.0 \"Temperature coefficient of resistance (R_actual = R*(1 + alpha*(T_heatPort - T_ref))\";
  Real R_actual(quantity = \"Resistance\", unit = \"Ohm\") \"Actual resistance = R*(1 + alpha*(T_heatPort - T_ref))\";
  assert(1.0 + alpha * (T_heatPort - T_ref) >= 1e-15, \"Temperature outside scope of model!\");
  R_actual = R * (1.0 + alpha * (T_heatPort - T_ref));
  v = R_actual * i;
  LossPower = v * i;
  v = p.v - n.v;
  0.0 = p.i + n.i;
  i = p.i;
  T_heatPort = T;
  p.i = 0.0;
  n.i = 0.0;
end Modelica.Electrical.Analog.Basic.Resistor;
>> a:=1:5;
>> b:=3:8
>>> a*b

>>> getErrorString()
"[<interactive>:1:1-1:0:writable] Error: Incompatible argument types to operation scalar product in component <NO COMPONENT>, left type: Integer[5], right type: Integer[6]
[<interactive>:1:1-1:0:writable] Error: Incompatible argument types to operation scalar product in component <NO COMPONENT>, left type: Real[5], right type: Real[6]
[<interactive>:1:1-1:0:writable] Error: Cannot resolve type of expression a * b. The operands have types Integer[5], Integer[6] in component <NO COMPONENT>.
>> b:=3:7;
>> a*b
>>> listVariables()
{b, a}

How to contribute to the OpenModelica Compiler

The long-term development of OpenModelica is supported by a non-profit organization - the Open Source Modelica Consortium (OSMC).

See on how to contribute to the development. If you encounter any bugs, feel free to open a ticket about it. For general questions regarding OpenModelica there is a discussions section available.


See OSMC-License.txt.

How to cite

We recommend citing the article The OpenModelica Integrated Environment for Modeling, Simulation, and Model-Based Development regarding OpenModelica.


  title={{The OpenModelica Integrated Environment for Modeling, Simulation, and Model-Based   Development}},
  author={Fritzson, Peter and Pop, Adrian and Abdelhak, Karim and Ashgar, Adeel and Bachmann,   Bernhard and Braun, Willi and Bouskela, Daniel and Braun, Robert and Buffoni, Lena and Casella,   Francesco and Castro, Rodrigo and Franke, Rüdiger and Fritzson, Dag and Gebremedhin, Mahder and   Heuermann, Andreas and Lie, Bernt and Mengist, Alachew and Mikelsons, Lars and Moudgalya, Kannan   and Ochel, Lennart and Palanisamy, Arunkumar and Ruge, Vitalij and Schamai, Wladimir and Sjölund,   Martin and Thiele, Bernhard and Tinnerholm, John and Östlund, Per},
  journal={Modeling, Identification and Control},
  publisher={Norwegian Society of Automatic Control}

Last updated: 2023-02-13


OpenModelica is an open-source Modelica-based modeling and simulation environment intended for industrial and academic usage.






No packages published