主要内容

Import, Test, and Simulate FMUs in Simulink

Simulink provides a wide range of features that enhance the usability and integration of FMUs within its environment. Through support for FMI standards and integration with native Simulink capabilities, you can incorporate FMUs into model development workflows for simulation, verification, and deployment. This enables FMUs to function as integral components within Simulink based systems, supporting a range of development and testing activities.

FMUs for Large-Scale Modeling and Simulation

Simulink enables you to create your system compositions by providing options to integrate heterogeneous components of your system. Import components of your system that are FMUs into large-scale system-level models in Simulink or as part of your architecture composition in System Composer:

Testing and Debugging FMUs in Simulink

After importing your FMU into Simulink, you can use various tools to test and debug your imported FMU:

  • Use FMU with Simulink Test to observe internal variables, which allows you to access and verify internal FMU variables during simulation. Test and validate your FMU using wireless visibility into the internal states and signals of the imported FMU. For more information, see Observe Internal Variables of an FMU (Simulink Test).

    FMU with internal signal observed by Observer block

  • Support for the FMUState feature allows you to save, restore, and manipulate FMU states during simulation. This setting enables testing, parametric analysis, and iterative development, with a high degree of flexibility and control over simulation workflows. You can use model operating points to stop and restart simulation at desired points and step back during simulation. For more information, see Capture Simulation State, Fast Restart, and Step Through Model Containing FMU.

  • You can debug your FMU that contains source code using an external debugger with Simulink. Use this option to set breakpoints, step through FMU source code during simulation, and identify issues at the implementation level. For more information, see Debug FMU with Source Code Using External Debugger.

  • You can execute your FMU in a separate process from the Simulink process. This option improves simulation performance and isolation, allows you to isolate FMU execution from the main Simulink process, and facilitates fault tolerance during simulation. You can enable this feature using the DebugExecutionForFMUViaOutOfProcess model configuration parameter. For more information, see FMU Import blocks.

FMU Simulation Features in Simulink

You can enhance the simulation performance and capabilities of the imported FMU in Simulink using these simulation features.

  • You can generate an FMU for use in real time testing, making it possible to deploy models to hardware-in-the-loop (HIL) or other real-time platforms. When you use this option, the generated FMUs are suitable for applications with strict timing and reliability requirements encountered in embedded systems development. For more information, see Apply Functional Mock-up Units by Using Simulink Real-Time.

  • You can compile new FMU binaries from the FMU source code directly within Simulink for cases where modifications or platform-specific builds are required. This option enables you to customize and adapt FMUs for different simulation or deployment targets. For more information, see fmudialog.compileFMUSources.

  • Simulink supports multicore simulation of co-simulation components. You can run multiple FMUs or co-simulation units in parallel, making efficient use of multicore processors and reducing overall simulation time for large models. For more information, see Run Co-Simulation Components on Multiple Cores.

  • Simulink automatically performs numeric compensation for co-simulation to address numerical discrepancies and stability challenges that can arise during co-simulation. When integrating FMUs from diverse sources or with differing numerical properties, numerical compensation helps to create accurate and reliable results. For more information, see Numerical Compensation.

  • You can perform cross-platform simulation of your FMU that contains Linux binary on Windows using the cross-platform simulation feature enabled by Windows Subsystem for Linux. For more information, see Simulate FMU with Linux Binary on Windows.

See Also

| (Simulink Test) |