How can I run my Simulink model containing an FMU on Speedgoat hardware with Simulink Real-Time (SLRT)?

38 visualizzazioni (ultimi 30 giorni)

Risposta accettata

MathWorks Support Team
MathWorks Support Team il 23 Feb 2024
Modificato: MathWorks Support Team il 23 Feb 2024

Using FMUs with SLRT: Support and Limitations

There are a few limitations you should be aware of before reviewing the workflow to get your FMU ready for use on SLRT.
SLRT only supports FMUs in Co-Simulation mode. In addition to this, take note of the support depending on the FMU's FMI version and used MATLAB release:
  • FMI version 1.0: SLRT Code generation support was added in R2018a.
  • FMI version 2.0: SLRT Code generation support was added in R2022a.
  • FMI version 3.0: No code generation support is available as of R2023b.
For more information on general FMU limitations in Simulink, as well as SLRT-specific limitations, please see the pages below:
  .

Using FMUs with SLRT: Build Considerations

To get your FMU ready for use on SLRT, the FMU source code must be compiled using a compiler that is compliant with the Real-Time Operating System (RTOS) used by SLRT.
In R2020b and later, SLRT uses the QNX® Neutrino® RTOS. This means that you must compile the FMU source code by using the QNX Neutrino compiler "qcc" or "q++". Starting in R2022a, you can use the function slrealtime.fmu.compileFMUSources to compile the FMU sources into a QNX-compatible shared library file (.so). For more information on this function, and a full example, please see the documentation page below:
In R2020a and earlier, SLRT uses the Windows-based On-Time RTOS. Please see the page below for FMU build considerations in these older releases::
Important note: FMU dependencies on dynamically linked external libraries (.so, .dll) are also an important consideration. The external libraries must be compatible with the SLRT RTOS, and they may not depend on other runtime libraries that are unavailable on an SLRT target computer.
 

How to Export an FMU from Simulink for use with Speedgoat hardware

Assume you have two Simulink models - a main model and a nested model. If you want to export the nested model as an FMU and then import that FMU into the main model to deploy onto Speedgoat target hardware with SLRT, follow the steps below:
1) Export the nested model as an FMU with the "Access source code from FMU" button checked in the FMU Export dialog. Please note that the FMU has been exported targeting GRT by default and it does not have a SLRT binary compiled. It is important that the source code is present with the FMU.
2) Use "slrealtime.fmu.compileFMUSources" with the FMU file that contains the source code. The function will output an 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.

Più risposte (0)

Categorie

Scopri di più su Create Standalone FMU in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by