Import FMUs - MATLAB & Simulink (original) (raw)

Main Content

Use the FMU block to import Functional Mockup Units (FMUs) into Simulink®.

The FMU block automatically selects the FMU mode based on the existing FMU you want to import:

This block supports FMI versions 1.0, 2.0 and 3.0. For FMI version 2.0 and 3.0, if your FMU contains both Co-Simulation and Model Exchange elements, the block detects this state and prompts you to select the operation mode for the block.

You can use your FMU block as you do other Simulink blocks. The FMU block supports normal, rapid accelerator, and accelerator modes. Rapid accelerator mode is unsupported for FMU blocks with FMU logging.

This topic assumes that you provide a .fmu file.

FMU XML File Directives

The default parameter values derive from the corresponding parameterstart value defined in the FMU ModelDescription.xml file. A block parameter value overwrites the initial value of the corresponding parameter defined in the FMU binary implementation.

Simulink interprets these FMU tags accordingly.

FMU Tag Simulink
ScalarVariable has attributes set as follows: causality="none" orcausality="internal"variability="parameter"start value is defined Interprets ScalarVariable element as block parameter
Real Interprets block parameter as edit field
Integer Interprets block parameter as edit field
Boolean Interprets block parameter as check box
Enumeration Interprets block parameter as drop-down list
String Interprets as UTF-8 encoded string

The FMU block supports the following encoding formats for the model description XML file:

Additional Support and Limitations

Capability FMI Version 3.0 Support FMI Version 2.0 Support FMI Version 1.0 Support
Save model operating point to base workspace (FMU flags that it supports this feature by setting canGetAndSetFMUstate andcanSerializeFMUstate fields in its model description XML totrue) (FMU flags that it supports this feature by setting canGetAndSetFMUstate andcanSerializeFMUstate fields in its model description XML totrue)
Fast restart (FMU flags that it supports this feature by setting canGetAndSetFMUstate andcanSerializeFMUstate fields in its model description XML totrue.) (FMU flags that it supports this feature by setting canGetAndSetFMUstate andcanSerializeFMUstate fields in its model description XML totrue.)
Simulation Stepper (FMU flags that it supports this feature by setting canGetAndSetFMUstate andcanSerializeFMUstate fields in its model description XML totrue.) (FMU flags that it supports this feature by setting canGetAndSetFMUstate andcanSerializeFMUstate fields in its model description XML totrue.)
Solver Jacobian (FMU flags that it supports this feature by setting providesDirectionalDerivatives field in its model description XML to true.) (FMU flags that it supports this feature by setting providesDirectionalDerivatives field in its model description XML to true.)
Linearize models (FMU flags that it supports this feature by setting providesDirectionalDerivatives field in its model description XML to true.) (FMU flags that it supports this feature by setting providesDirectionalDerivatives field in its model description XML to true.)
Declare parameter as tunable and tune it during simulation (FMU flags that it supports this feature by setting canGetAndSetFMUstate andcanSerializeFMUstate fields in its model description XML totrue.) (FMU flags that it supports this feature by setting canGetAndSetFMUstate andcanSerializeFMUstate fields in its model description XML totrue.)
For Each subsystem blocks (Supported only whencanBeInstantiatedOnlyOncePerProcess attribute is set to false in modelDescription.xml file) (Supported only whencanBeInstantiatedOnlyOncePerProcess attribute is set to false in modelDescription.xml file)
Parameters of type string (Array of string type parameters are not supported)
Rapid accelerator mode
Software-in-the-loop (SIL) and processor-in-the-loop (PIL) modes
Code generation
Nested FMU export
Protected model export
Model coverage
Simulink Design Verifier™
Model reference in accelerator mode
Event Mode
Scheduled Execution Mode
Enumerated data type for inputs, outputs and parameters

Simulink supports stepping back and forth, tuning parameters in between, and saving states for the FMU Import block as long as the FMU itself supports these features. FMU flags that it supports these features by setting canGetAndSetFMUstate andcanSerializeFMUstate fields in its model description XML totrue.

FMU Import Examples

See Also

FMU

Topics

External Websites