# FMU Workflow in PLECS

**URL:** <https://forum.plexim.com/t/fmu-workflow-in-plecs/2713>\
**Category:** Support Solutions\
**Tags:** plecs, application-example, plecs-coder, using-plecs, fmu\
**Created:** [November 20, 2025, 6:12pm UTC](https://forum.plexim.com/t/fmu-workflow-in-plecs/2713 "2025-11-20T18:12:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Johannes\_Bruderer](https://dub1.discourse-cdn.com/flex006/user_avatar/forum.plexim.com/johannes_bruderer/32/2276_2.png) [@Johannes\_Bruderer](https://forum.plexim.com/u/Johannes_Bruderer)\
**Post date:** [November 20, 2025, 6:12pm UTC](https://forum.plexim.com/t/fmu-workflow-in-plecs/2713/1 "2025-11-20T18:12:26Z")

</div>

PLECS 5.0 supports versions 2.0 and 3.0 of the **Functional Mock-up Interface (FMI)** standard and enables the use of **Functional Mock-up Units (FMUs)** for both **Model Exchange** and **Co-Simulation**.

This article describes the export and import workflow for _FMI 2.0 Model Exchange FMUs_ in PLECS. For details on additional FMI capabilities of PLECS, refer to the [Functional Mock-up Interface](https://docs.plexim.com/plecs/latest/functional-mockup-interface/#functional-mockup-interface) section of the PLECS documentation.

* * *

**Note:** The FMI features are available in both PLECS Standalone and PLECS Blockset. FMU export requires an additional PLECS Coder license.

* * *

Attached are two examples highlighting the _FMU Version 2.0_ export and import workflow in PLECS. Both examples consist of separate export and import models.

- Example 1: Thyristor Rectifier

[thy\_rect\_fmu\_export.plecs](https://forum.plexim.com/uploads/short-url/69d1h9J9JzS4oj9AWRhUM5EgIer.plecs)

[thy\_rect\_fmu\_import.plecs](https://forum.plexim.com/uploads/short-url/e4HIXv4qmVs4ZezfdW4ICk9Dbv5.plecs)

- Example 2: PMSM with sensorless control

[sensorless\_vector\_control\_pmsm\_fmu\_export.plecs](https://forum.plexim.com/uploads/short-url/jHKZ2q4XWeq4JpOWTCtTp4oj7ii.plecs)

[sensorless\_vector\_control\_pmsm\_fmu\_import.plecs](https://forum.plexim.com/uploads/short-url/qfyD4A4RF163RADcERj9F8Xfio.plecs)

The following is a step-by-step instruction on how to export and import FMU files in PLECS.

## Exporting an FMU file from a PLECS model

In this example, the _Tyristor Rectifier Circuit_ is exported as FMU file. Note that the FMU export feature requires a PLECS Coder license.

 ![image](https://europe1.discourse-cdn.com/flex006/uploads/plecs/original/2X/4/4e1a38aa6e8b0e96e39941d664150099cfafee75.png)

1. The subsystem to be exported is set to _atomic_ with _auto_ sample time.  
(This step is preconfigured in the example model)  
The _auto_ sample time setting ensures that the subsystem is simulated at variable time-steps with a variable-step solver selected.

 ![image](https://europe1.discourse-cdn.com/flex006/uploads/plecs/original/2X/b/b49278c079578034bb07521f3d75741afcee0541.jpeg)

 ![image](https://europe1.discourse-cdn.com/flex006/uploads/plecs/original/2X/6/6860ba55966817319b052ea633bdc7d3513e32a8.jpeg)

1. Simulate the model twice: first with a variable-step solver, then with a fixed-step solver. After each simulation save the trace to compare the results in a PLECS Scope. The comparison highlights the loss of accuracy introduced by discretizing the model at a fixed sample time. **Variable-step simulation** is best practice for almost all offline simulations. With variable-step solvers, the accuracy defined by the solver tolerance settings is guaranteed, as the step size is automatically adapted to meet these tolerances. The quality of the fixed-step results reflects what can be expected from the exported FMU model later.

* * *

**Note:** Fixed-step simulation will fail if the model contains blocks with _variable-step discrete tasks_. This applies to _Example 2 (PMSM with sensorless control)_. In this case, skip the fixed-step simulation and proceed with the next step. See [FMU Validation Workflows](#fmu_validation_workflows)

* * *

 ![export_solver_settings](https://europe1.discourse-cdn.com/flex006/uploads/plecs/original/2X/a/a5ac3e0cb62c2dc46e603914107f782ece7fe592.jpeg)

 ![export_scope](https://europe1.discourse-cdn.com/flex006/uploads/plecs/original/2X/f/f835c2e55a14378b8f027840eb81de4a59d29b7e.jpeg)

1. Right-Click on Subsystem to open the FMU export dialog

 ![export_fmu_menu](https://europe1.discourse-cdn.com/flex006/uploads/plecs/original/2X/2/2a015be6a24dab823e7ff460f7606f37c8fc894d.jpeg)

1. By default, the sample time is set to the fixed-step size configured in the solver settings
2. Select the Target platform(s) and enter a name for the FMU File
3. Export the FMU file

 ![image](https://europe1.discourse-cdn.com/flex006/uploads/plecs/original/2X/9/9ec4db31e8f9df676b96acd838e657a5557437cd.jpeg)

## Importing an FMU File into a PLECS model

1. Open the import PLECS model
2. Import the FMU file into the configurable “Circuit” subsystem

 ![image](https://europe1.discourse-cdn.com/flex006/uploads/plecs/original/2X/d/d758328cc99dac47f53fb487cf5c592293014163.png)

 ![image](https://europe1.discourse-cdn.com/flex006/uploads/plecs/original/2X/9/9680128e1a3b103919062a86a4448abb9391ef84.jpeg)

1. Simulate the model and compare “FMU” configuration to “Original” configuration

 ![image](https://europe1.discourse-cdn.com/flex006/uploads/plecs/original/2X/0/078d9f2091cb574947e89a8b9425aeb8f9bff9a3.jpeg)

Due to the discrete-time execution, the accuracy of the FMU model is reduced compared to the “Original” PLECS plant, which is simulated using a variable-step solver. If more accuracy is required, the discretization step size needs to be reduced when exporting the FMU model.

## FMU Validation Workflows

When discretizing simulation models, for example, for FMU export or C code generation, the accuracy of the simulation results depends on the chosen discretization step size and is generally reduced compared to variable-step simulations. Therefore, discretized models should be validated by comparison with variable-step simulation results.

Two validation workflows are possible. The first is a direct comparison between variable-step and fixed-step simulation results. This approach is suitable when the model used for FMU export can be simulated with a fixed-step solver and is typically the simplest and fastest validation method. With a fixed-step solver it’s important to note that both the FMU subsystem and other components in the model are simulated with a common step size.

If the export model cannot be simulated with a fixed-step solver, for example, because it contains variable-step discrete tasks, a different approach is required. In this case, the exported FMU must be re-imported, and the simulation results of the re-imported FMU are compared against the results of the original PLECS subsystem used for FMU export. Both the original PLECS circuit and the imported FMU model are simulated with a variable-step solver. However, because the re-imported FMU has the fixed-step size encoded in the FMU, the discrete behavior of the FMU block is simulated correctly. Other components in the PLECS schematic outside the FMU block will use the variable-step solver and therefore support variable-step discrete tasks.

* * *

## Downloads

| File | Description |
| --- | --- |
| [thy\_rect\_fmu\_export.plecs](https://forum.plexim.com/uploads/short-url/69d1h9J9JzS4oj9AWRhUM5EgIer.plecs) | Thyristor rectifier example circuit for FMU export. |
| [thy\_rect\_fmu\_import.plecs](https://forum.plexim.com/uploads/short-url/e4HIXv4qmVs4ZezfdW4ICk9Dbv5.plecs) | Thyristor rectifier example circuit for FMU import. |
| [sensorless\_vector\_control\_pmsm\_fmu\_export.plecs](https://forum.plexim.com/uploads/short-url/jHKZ2q4XWeq4JpOWTCtTp4oj7ii.plecs) | PMSM example circuit for FMU import. |
| [sensorless\_vector\_control\_pmsm\_fmu\_import.plecs](https://forum.plexim.com/uploads/short-url/qfyD4A4RF163RADcERj9F8Xfio.plecs) | PMSM example circuit for FMU export. |
