Apply Functional Mock-up Units by Using Simulink Real-Time
After you create a model that contains an FMU block, you can build and download the model to a target computer by using Simulink® Real-Time™. These limitations apply:
Simulink Real-Time supports FMU blocks for Co-Simulation mode. Simulink Real-Time does not support FMU blocks for Model Exchange mode.
Simulink Real-Time does not support FMU blocks within a referenced model. FMU blocks must be at the top level of the model.
Simulink Real-Time generates a mask dialog box that contains both numeric-valued and string-valued parameters. Simulink Real-Time generates code for only numeric- valued parameters.
To convert a Simulink model that contains FMU blocks to a Simulink Real-Time model, set the model configuration parameters to values compatible with real-time execution:
In the Code Generation pane, set System target file to
slrealtime.tlc
.In the Solver pane:
Set Type to
Fixed-step
.Set Fixed-step size to a step size compatible with the real-time requirements of your model.
Generate a shared object SO file by using the QNX® Neutrino® tools for the FMU. For more information, see
slrealtime.fmu.compileFMUSources
.
You can then build and download the model to a target computer and run the real-time application. This process loads the required FMU binary files on the target computer. For more information about creating the FMU files, see Compile Source Code for Functional Mock-up Units.
To open an example model that contains FMU blocks running in Simulink Real-Time, in the MATLAB® Command Window, type:
open_system(fullfile(matlabroot, 'toolbox', 'slrealtime', ... 'examples', 'slrt_ex_vanderpol'))