Main Content

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™.

FMU Limitations for 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 speedgoat.tlc or other Simulink Real-Time STF.

  • In the Solver pane, set Type to Fixed-step.

  • In the Solver pane, 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.

Create Target Object and Connect

Create a Target object for the default target computer and connect to the target computer. In the Command Window, type:

tg = slrealtime;
connect(tg);

Open the Model

To open an example model that contains FMU blocks running in Simulink Real-Time, in the Command Window, type:

model = 'slrt_ex_vanderpol';
open_system(model);
modelSTF = getSTFName(tg);
set_param(model,"SystemTargetFile",modelSTF);

Close the Model

bdclose('slrt_ex_vanderpol');

See Also

Related Topics

External Websites