How can I deploy my Simulink model containing a FMU with Simulink Real-Time (SLRT)?

17 views (last 30 days)
I have two Simulink models - a main model and a nested model. I want to export my nested model as a FMU and then import that FMU into my main model to deploy onto Speedgoat target hardware with Simulink Real-Time (SLRT). How can I accomplish this?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 19 Mar 2023
Edited: MathWorks Support Team on 19 Mar 2023
There are a few limitations you should be aware of before reviewing the workflow to get your FMU ready for use on SLRT.
Code generation for FMUs is only supported for the code generation target "slrealtime.tlc" in Co-Simulation mode. For more information on these limitations in the documentation, please see the page below:
In addition, there are some other limitations for using FMUs with SLRT that apply which are described in the documentation page below:
To deploy your FMU, you will first need to prepare the FMU to be deployed onto the SLRT RTOS using the MATLAB function "slrealtime.fmu.compileFMUSources". For more information on this function, please see the documentation page below:
1) Export the nested model as a FMU with the "Access source code from FMU" button checked in the FMU Export dialog.
2) Use the MATLAB function "slrealtime.fmu.compileFMUSources" with the FMU file that contains source code. The function will output a FMU file and a Simulink Real-Time binary file with a "_slrt" suffix to the output file name.
3) Import the newly generated FMU into your main model to replace your nested model.
Now you will be able to deploy your model containing an imported FMU onto your Simulink Real-Time target.

More Answers (0)


Find more on Hardware-in-the-Loop Simulation with Simulink Real-Time in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by