Skip to content

OpenModelica/OMSimulator

Repository files navigation

OMSimulator License: OSMC-PL

The OpenModelica FMI & SSP-based co-simulation environment.

Downloads

OMSimulator can be installed as stand-alone application, as C library to be linked into custom applications, and as python package. OMSimulator is also shipped with the OpenModelica installer, which also includes OMEdit as the graphical editor.

Documentation

The latest documentation is available as pdf and html versions. For OMSimulatorLib a Doxygen source code documentation is available as well.

FMI cross-check results

Dependencies

Tools

Required

  • A C++ compiler with C++17 support.
  • cmake

Optional

  • Sphinx for generating documentation.
  • Doxygen for generating documentation.
  • GNU Flex for verifying testsuite results.

Libraries

Compilation

Note Make sure you have fetched and initialized the OMSimulator submodules

You can do this in one of two ways

  1. If you have already cloned OMSimulator, then run

    git submodule update --init --recursive
  2. If you are cloning the repository, then use

    git clone https://github.com/OpenModelica/OMSimulator.git --recurse-submodules

Linux / MacOS

  1. Configure OMSimulator

    cd OMSimulator
    cmake -S . -B build/ -DCMAKE_INSTALL_PREFIX=install/
  2. Build and install OMSimulator

    cd OMSimulator
    cmake --build build/ --target install
    ./install/bin/OMSimulator --version

Windows (OMDev mingw)

  1. Setup OMDev

    • Clone OMDev (OpenModelica Development Environment): git clone https://openmodelica.org/git/OMDev.git
    • Follow the instructions in OMDev/INSTALL.txt
  2. Open a MinGW-64 terminal

  3. Configure OMSimulator

    cd OMSimulator
    cmake -S . -B build/ -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=install/
  4. Build and install OMSimulator

    cd OMSimulator
    cmake --build build/ --target install
    ./install/bin/OMSimulator --version

Windows (Visual Studio)

The following versions of Visual Studio are supported:

  • Visual Studio 15 2017 Win64 and later

It is not strictly required to install the full Visual Studio IDE. The build only requires Visual C++ Build Tools.

  1. Open a Visual Studio command prompt

  2. Configure OMSimulator

    cd OMSimulator
    cmake -S . -B build/ -DCMAKE_INSTALL_PREFIX=install/
  3. Build and install OMSimulator

    cd OMSimulator
    cmake --build build/ --config Release --target install
    ./install/bin/OMSimulator.exe --version

Test your build

The testsuite of OMSimulator is run on Jenkins for every commit and creating test reports. The project is tested for the following OS:

  • linux64 without OMPython
  • mingw-ucrt64
  • msvc64
  • cross-compiled OSX

In addition the OpenModelica project has a number of test cases using OMSimulator for FMU simulation that can be find in this OpenModelica test reports.

To verify your build is compiled and installed correctly see the following instructions.

Linux / MacOS / Windows (OMDev mingw)

  1. Build test dependencies

    cmake --build build/ --target testsuite-depends
  2. Run partest

    cd testsuite/partest/
    ./runtests.pl -j4

    Use -jN to test with N threads.

    To disable Python tests add -asan.

Windows (Visual Studio)

We currently have no bat-Script to build and test with CMD, so you have to use OMDev mingw shell for the tests.

  1. Build test dependencies

    cmake --build build/ --target testsuite-depends
  2. Run partest

    cd testsuite/partest/
    ./runtests.pl -j4 -platform=win

    Use -jN to test with N threads. To disable TLM tests add -notlm, to disable Python tests add -asan.