2. Installation and Configuration

This chapter describes how to install, configure, and uninstall SimulatorToFMU on Windows and Linux operating systems. SimulatorToFMU is currently not supported on Mac OS.

2.1. Software requirements

To export a Simulator as an FMU, SimulatorToFMU needs:

  1. Python and following dependencies:
    • jinja2
    • lxml
  2. Modelica parser
  3. C-Compiler

SimulatorToFMU has been tested with:

  • Python 2.7.12 (Linux) and 2.7.13 (Windows)
  • Three Modelica parsers
    • Dymola 2017 FD01 on Windows and Linux
    • JModelica 2.0 on Windows, and JModelica trunk version 9899 on Linux
    • OpenModelica 1.11.0 on Windows
  • C-Compiler: Microsoft Visual Studio 10 Professional

Note

SimulatorToFMU can use OpenModelica and Dymola to export a Simulator as an FMU. However OpenModelica 1.11.0 (on Windows) and Dymola 2017 FD01 (on Linux) do not copy all required libraries dependencies to the FMU. As a workaround, SimulatorToFMU checks if there are missing libraries dependencies and copies the dependencies to the FMU.

2.2. Installation

To install SimulatorToFMU, proceed as follows:

  1. Add following folders to your system path:
  • Python installation folder (e.g. C:\Python27)
  • Python scripts folder (e.g. C:\Python27\Scripts),
  • Dymola executable folder (e.g. C:\Program Files(x86)\Dymola2017 FD01\bin)
  • JModelica installation folder (e.g. C:\JModelica.org-2.0)
  • OpenModelica executable folder (e.g. C:\OpenModelica1.11.0-32bit\bin)

You can add folders to your system path by performing following steps on Windows 8 or 10:

  • In Search, search for and then select: System (Control Panel)
  • Click the Advanced system settings link.
  • Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click Edit.
  • In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable (e.g. C:\Python27, C:\Python27\Scripts). Click OK. Close all remaining windows by clicking OK.
  • Reopen Command prompt window for your changes to be active.

To check if the variables have been correctly added to the system path on Windows, type python, dymola, pylab, or omc into a command prompt to see if the right version of Python, Dymola, JModelica, or OpenModelica starts up.

Note

To avoid adding Dymola, JModelica, or OpenModelica to the system path, provide the path to the executables to SimulatorToFMU.py. See Command-line use for the lists of arguments of SimulatorToFMU.

  1. Install SimulatorToFMU by running
> pip install --user SimulatorToFMU

Note

Use the --user command line option to install SimulatorToFMU so it can be installed in your Python 2.7 user installation directory and can write files to your disk. The Python 2.7 user installation directory is typically C:\Users\YourUserName\AppData\Roaming\Python\Python27\site-packages on Windows, and /home/YourUserName/.local/lib/python2.7/site-packages on Linux where YourUserName is your system login user name.

The installation directory should contain the following subdirectories:

  • bin/ (Scripts for running unit tests)
  • doc/ (Documentation sources)
  • fmus/ (FMUs folder)
  • parser/ (Python scripts, Modelica templates and XML validator files)

2.3. UnitTests

To test your installation run from the installation bin folder

> python runUnitTest.py

2.4. Uninstallation

To uninstall SimulatorToFMU, run

> pip uninstall SimulatorToFMU