FMI / FMU (Pro)
Overview
The FMI interface connects FMUs (Functional Mock-up Units) to your realvirtual simulation. FMI (Functional Mock-up Interface) is the open industry standard for exchanging simulation models, supported by more than 150 tools such as Modelica, Dymola, Simulink, Amesim and OpenModelica (see fmi-standard.org).
With the FMU Interface you can bring validated physics and controls models — hydraulic cylinders, electrical drives, thermal models, controllers — directly into your virtual commissioning scene. The FMU calculates its dynamics in perfect sync with the Unity physics timestep, and all FMU variables appear as ordinary realvirtual PLC signals that you connect to Drives, Behaviors and other components like signals from any other interface.
The interface supports FMI 2.0 Co-Simulation FMUs with a Windows 64-bit binary.
Quick Start
Copy your
.fmufile intoAssets/StreamingAssets/FMU/(create the folder if it does not exist). StreamingAssets is required so the FMU is available as a real file in built applications.Add the component realvirtual > Interfaces > FMU (FMI 2.0) to an empty GameObject.
Enter the file name (e.g.
BouncingBall.fmu) into Fmu File.Click ⬇️ Import Signals. All FMU inputs, outputs and tunable parameters are created as signal GameObjects under the interface — in Edit Mode, so you can wire them to your components before pressing Play.
Connect the signals to your scene (Drives, Behaviors, custom scripts) and press Play. The interface loads the FMU, shows 🟢 Connected, and steps the model in sync with the physics.
Key Properties
Fmu File (string) The .fmu package to load. Relative names are resolved against Assets/StreamingAssets/FMU/; absolute paths are used as-is.
Step Mode (enum) How the co-simulation is advanced. Physics Synced (default) performs exactly one macro step per FixedUpdate with the Unity physics timestep — FMU time stays identical to the simulation time, and pause or Time.timeScale changes are honored automatically. Free Running steps the FMU on a background cycle independent of physics, e.g. for faster-than-realtime co-simulation.
Step Size (float, seconds) In Physics Synced mode this is the internal sub-step resolution: the physics timestep is divided into equal sub-steps of approximately this size (values equal to or larger than the physics timestep result in exactly one step per FixedUpdate). In Free Running mode it is the fixed macro step per communication cycle. The step size is never derived from frame time — co-simulation stays deterministic.
Tolerance (float) Solver tolerance passed to the FMU at initialization.
Allow Viewer To Fmu (bool) If enabled, values written to the PLC input signals (from Unity, the WebViewer or MCP) are sent into the FMU before each step. If disabled, input signals are ignored.
Import Signals (button) Creates or updates the FMU's signals in Edit Mode by reading the FMU's own modelDescription.xml — no manual signal mapping needed. Re-importing is safe: existing signals keep their user-set values.
Signals
Signals are named <ModelName>.<VariableName> (e.g. BouncingBall.h) and follow the standard realvirtual convention:
Output / calculated parameter
PLCOutputFloat / Int / Bool / Text
FMU → scene
Input / tunable parameter
PLCInputFloat / Int / Bool / Text
Scene → FMU
Fixed parameter, local, time
(no signal)
internal
Input signals are initialized with the FMU's declared start values, so the model behaves exactly as designed until you change an input. Fixed (non-tunable) parameters cannot be changed after FMU initialization — this is defined by the FMI standard — and therefore get no signal.
Each FMU Interface hosts exactly one FMU. To use several FMUs in one scene, add one interface per FMU.
Common Use Cases
Detailed component physics – Simulate a pneumatic cylinder, hydraulic axis or electrical drive with a validated FMU model instead of approximating it in Unity.
Controls-in-the-loop – Run a controller model exported from Simulink or Modelica against your virtual machine.
Plant models for virtual commissioning – Couple domain-specific simulation models (thermal, fluid, mechanical) developed by simulation specialists into the commissioning scene.
Live model tuning – Tunable FMU parameters are ordinary input signals; adjust them at runtime from the Inspector, the WebViewer or MCP.
Error Behavior
The interface degrades cleanly: if the native core or the FMU file is missing, the interface simply stays Disconnected and logs a warning — the scene never crashes. FMU step rejections (fmi2Discard) and errors are reported in the Console with the FMU's own log messages.
See Also
Simulink Interface — direct MathWorks Simulink co-simulation
Custom Interfaces — building your own interface
Last updated