Export Model as FMU with Linux Binary on Windows
This topic shows how to generate a standalone cosimulation Functional Mockup Unit (FMU), compatible with FMI 2.0 and 3.0 standards, containing a Linux® binary from the Windows® platform.
Configure System for Cross-Platform Compilation
To generate a Linux binary on Windows for the FMU, you must install:
MATLAB® R2024a Update 1 or later. To update your MATLAB installation to the latest version, see Update an Existing Installation.
Windows Subsystem for Linux (WSL) Version 2.0.9.0 or later. To install WSL, see Install Linux on Windows with WSL.
FMU Builder for Simulink® support package version 24.1.1 or later. To install the latest version of the support package, see FMU Builder for Simulink. You can also download the latest version of the support package or update your existing installation to the latest version using the Add-On Explorer. For more information, see Get and Manage Add-Ons.
Generate FMU with Linux Binary
After configuring your system, open the Simulink model that you want to export as an FMU and set the solver type as fixed-step.
For example, open the f14
model
and set it solver to fixed-step.
set_param(gcs,'SolverType','Fixed-step');
Use this command to export your model with Linux binary.
exportToFMU('f14','FMUType','CS','FMIVersion','2.0', ... 'GenerateLinuxBinaryWithWSL','on')
Alternatively, you can export your model by selecting the Linux (x86-64) Requires Windows Subsystem for Linux (WSL2) option in the FMU export window.
Once you generate the FMU with Linux binary, you can simulate it on Windows. For more information, see Simulate FMU with Linux Binary on Windows.
Limitations
The following limitations apply to this workflow:
Models with a variable-step solver are not supported.
Model exchange FMU generation is not supported.
Models containing blocks from the Vehicle Network Toolbox™ are not supported.