Clear Filters
Clear Filters

Export Standalone-FMU with non standard capability flags

6 views (last 30 days)
Hello, I would like to export a standalone FMU from a Simulink model.
For that FMU I would like to change the standard capability flags for canGetAndSetFMUstate and canSerializeFMUstate.
I can't find any checkbox in the model. Neither is there any information in the documentation. There is only a small hint that it is possible to import models with those settings.
Can anyone help me how I can change those flags?

Answers (1)

Anshuman on 23 Jan 2024
Specific capability flags such as 'canGetAndSetFMUstate' and 'canSerializeFMUstate', are not directly accessible through a graphical user interface or a checkbox in Simulink. However there is an alternative way to achieve this. Firstly, you will need to export the FMU from Simulink.
  • Open the model to export.
  • Under Solver > Type, select "Fixed-step" for a Co-Simulation FMU or "Variable-step" for a Model Exchange FMU.
  • From the Simulation tab, click the drop-down button for "Save".
  • In the "Export Model To" section, click "Standalone FMU".
  • Click "Create" to export to FMU.
After exporting the FMU, you can modify the capability flags by editing the "modelDescription.xml" file within the FMU.
  1. Rename the FMU file extension from .fmu to .zip.
  2. Open the "modelDescription.xml" file in a text editor and locate the <CoSimulation ...> element.
  3. There you will find the above-mentioned flags and you can modify them as per your usecase.
  4. After saving the changes, rename the file extension back to ".fmu".
Note that, modifying the FMU in this way is not recommended and may lead to some unexpected results in the workflow.


Find more on Create Standalone FMU 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!