FMUs are ideal for performing large-scale simulation studies on computing clusters. Since computing clusters usually run on Linux, the FMUs must also be compiled for Linux. We show you how to generate cross-compiled Linux FMUs with Dymola.
The Functional Mock-Up Interface (FMI) is a standardized interface that enables the exchange of models between different simulation tools. Functional Mock-Up Units (FMUs) are compiled models that conform to the FMI standard. For example, a model created in Dymola can be exported as an FMU and used in Simulink to test controllers.
FMUs are usually in the form of compiled code¹. FMUs are therefore, similar to the well-known executables (.exe), executable programs that are bound to a specific operating system. An FMU compiled on Windows can only be executed on Windows and not on Linux. Linux would not "understand" the Windows FMU. To create a Linux FMU with Dymola, the FMU previously had to be created on Linux. This meant that a Linux distribution and a Linux version of Dymola were required.
Since version 2022, Dymola supports what is known as cross-compilation. Cross-compilation makes it possible to compile FMUs on Windows that can run on both Windows and Linux. This increases the user-friendliness considerably.
Even though Dymola natively supports cross-compilation since version 2022, additional programs must be installed before first use:
If you get an error message instead of the pictured message, WSL may not have write permissions. To grant WSL write permissions, the wsl.conf file must be edited:
For more information, please refer to the Dymola user manual.
To create a Linux FMU, the option Cross compile for Linux must be selected in the Export FMU window (Simulatation\Translate\FMU):
If you open the FMU afterwards (FMUs are packaged as .zip files), you will see three folders in the binaries directory:
This shows that the FMU has been compiled for 32-bit and 64-bit Windows (win32 and win64) as well as 64-bit Linux (linux64). The FMU can thus be executed on Windows as well as on 64-bit Linux.
¹ Exception: So-called source code FMUs. Source code FMUs are not compiled, but are available in the form of C code. Source code FMUs are thus not bound to an operating system.