How to ensure Linux compatibility when exporting Simscape models into FMUs?

3 次查看(过去 30 天)
I am exporting Simscape models into FMUs to use them on other software platforms using the exportToFMU2CS function. The generated FMUs are, however, not Linux compatible. Is there a way to enable this compatibility?
If I convert the models using the tool-coupling FMU (https://nl.mathworks.com/help/simulink/ug/export-model-as-tool-coupling-fmu.html), the generated FMU is both Windows and Linux compatible, but the FMU requires a license when running on other software platforms. Therefore I use the exportToFMU2CS function as it seems to be license-free for the FMU-user, but the generated FMUs are only Windows compatible.

回答(1 个)

Karan Singh
Karan Singh 2023-9-4
Hi Bart,
The “exportToFMU2CS” function in Simscape is designed to generate “FMUs” that are only compatible with Windows. If you need Linux compatibility for your FMUs, you can try using the “FMI Kit for Co-Simulation” provided by Modelon.
The “FMI Kit for Co-Simulation” allows you to export models as “FMUs” that are compatible with multiple platforms, including Linux. It provides a command-line interface that you can use to export your Simscape models as “FMUs”.
Here are the general steps to export your model using the “FMI Kit for Co-Simulation”:
  • Install the “FMI Kit for Co-Simulation”. You can find the installation instructions on the Modelon website.
  • Open a command prompt or terminal and navigate to the installation directory of the “FMI Kit for Co-Simulation”.
  • Use the “fmuexport” command to export your Simscape model as an “FMU”. The command syntax is as follows:
fmuexport -m <model> -o <output_directory> -f <fmu_version> -p <platform>
  • Replace <model> with the path to your “Simscape model file, <output_directory> with the directory where you want to save the “FMU”, <fmu_version> with the desired “FMI” version (e.g., 2.0), and <platform> with linux64 for Linux compatibility.For example:
fmuexport -m MyModel.slx -o /path/to/output -f 2.0 -p linux64
  • The command will generate the “FMU” in the specified output directory. The “FMU” will be compatible with Linux and can be used on other software platforms.
Attached below are some documentation links that you may find helpful:
Hope this helps!

类别

Help CenterFile Exchange 中查找有关 Create Standalone FMU 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by