FMUCreator has two functions:
- Install and uninstall OpenModelica 1.9.1 on an RT-LAB enabled Linux target
- Export FMU out of a GenUnit for both Windows and Linux platforms using OM 1.9.1, OM 1.16.2 or Dymola.
|Export FMU for ...||Running a model with existing FMU on ...|
|Windows Target||Linux Target||Windows Target||Linux Target|
|OM 1.9.1||Needs manual installation||Needs manual installation via FMUCreator (RedHat only)||Needs manual installation||Needs manual installation via FMUCreator (RedHat only)|
|OM 1.16.2||Needs manual installation||Is pre-installed on OPALRT Linux v3.5 and later||Does not need installation||Only OPALRT Linux v3.5 and later|
|Needs manual installation||Does not need installation||Does not need installation||Does not need installation|
*DYMOLA Version 2019, released 2018-04-11. Other versions have not been tested and verified.
OpenModelica 1.9.1 Installation
To install OpenModelica 1.9.1 on a Linux target:
- Make sure the RT-LAB’s MetaController is running on the local host and the desired target is up and connected to the local host.
- Execute FMUCreator.bat that exists in ‘C:\OPAL-RT\RT-LAB\ vX.X\FMUCreator’, figure is shown below in 'Exporting FMU'. The Available Targets by name/ip section shows a list of available targets as defined in the RT-LAB GUI. For this example, the target name is ‘192.168.4.51'. If the desired target is not listed, the user can still add it by defining its ip address in “Target ip” section and clicking on the “Add Target ip” button (Section 4 in the figure showing FMUCreator interface). You should then provide the same username/password as the one on the target in order to establish a successful connection.
- Double click on the target name on which OpenModelica needs to be installed and choose Install OpenModelica.
Upon successful installation, the following messages should be displayed, both in the FMUCreator command window and the FMUCreator Interface:
“Installation in progress... Log at ‘C:\OPAL-RT\RT-LAB\vX.X\FMUCreator\openmodelica_install.log’.Installation complete.”
Note: The successful installation of OpenModelica on the Linux target also could be checked directly on the target using the following commands:
FMUs can be created from GenUnits using the FMUCreator interface shown in the figure below.
Follow the steps shown in the above figure to create an FMU:
- In the Resources section, click on Select Source and select the Modelica file that contains the GenUnit-type components to be exported as FMU.
- The Select Package button can be used to open all the GenUnits inside the selected folder that contains the file 'package.mo'.
- If the GenUnit file has dependencies to other Modelica libraries, they must be also loaded by clicking on Add Dependency and adding them to the corresponding section in FMUCreator as shown in the above figure.
- The Modelica Standard Library is automatically loaded in FMUCreator and does not need to be added as dependency.
- GenUnit as well as dependency files’ address should not include any special character.
- If the GenUnit folder includes a 'package.mo' file, opening that file using Select Source button will load all the GenUnits inside that 'package.mo' in the FMUCreator automatically.
- In the Models / Classes section, check the check-box for the genunits you want to compile.
- In the Compilation Settings section, the following options can be set:
|Compile on selected target also|
If this option is not checked, the FMU will be only generated for the windows target.
However, if checked, the FMU will be also compiled for the corresponding Linux target selected in step-4 alongside its compilation for windows.
|Keep source||If checked, the FMU also includes the generated c-code of the model.|
|Debug||If checked, verbose compilation information is shown in the output window during FMU generation.|
- If in Step 3 Compile on selected target also is checked, then a proper target must be chosen in the Available Targets by name/ip section.
A list of already added targets in the RT-LAB is automatically loaded in this section. If the desired target is not listed, the user can still add it by defining its ip address in “Target ip” section and clicking on the “Add Target ip” button.
Also make sure username/password pair matches to the one on the target.
- In Modelica compiler section, Select the Modelica development tool by which the FMUs will be generated.
Three options are available:
- OpenModelica 1.9.1
- OpenModelica 1.16.2
To use desired version of OpenModelica, install them on the default paths and verify that the values for the Windows user environment variables, OPENMODELICAHOME and OPENMODELICALIBRARY, are set correctly as discussed in the Migration Notes for v2021.3. Otherwise, the corresponding option for OpenModelica is disabled.
Note: If EPHASOR_DYMOLA_FMU license is not enabled in RT-LAB, the Dymola option is disabled. This means the FMU cannot be exported using Dymola; however, an already built Dymola FMU can still be used for the simulation.
- In Select Build Directory section, choose the folder to which the generated FMUs will be copied.
Note: Build directory address should not include any special characters.
- Finally click Compile FMU. The compilation process begins and the generated fmus are placed in the folder defined in step-6.
- Depending on the compilation platform chosen, FMUs are created with two different file extensions:
- [GenUnit Name].win32.fmu: FMUs which are compiled for Windows platform.
- [GenUnit Name].linux32.fmu: FMUs which are compiled for the 32-bit Linux platform.
- [GenUnit Name].linux64.fmu: FMUs which are compiled for the 64-bit Linux platform.
Note: Dymola FMUs compiled for windows (with .win32.fmu extension) include both win32 and win64 binaries.
To make this sure, go to FMI Export tab under Simulation Setup in Dymola and select both 32 and 64 bit binaries as shown in figure below.