Skip to content

Co-Simulating FMUs in MontiArc

The Functional Mockup Interface, maintained by the Modelica Association, is a free standard that allows the exchange and co-simulation of models from different simulation-tools. You can export your models as FMUs and use them as components inside your MontiArc projects. To expand MontiArcs simulation capabilities, the FMU2ArcTool provides the possibility of using your Functional Mockup Units in your MontiArc systems.

Using the Tool

After applying the fmu2arc-plugin, the tool expects your .fmu files inside the src/main/fmu2arc/*package_name* directory. It is important that they are inside a package. The Tool then generates Java files for all .fmu files inside the src/main/fmu2arc/ directory, mimicking those generated by native MontiArc components. To use these "FMU-Components", you can import them like you would with normal MontiArc models. In this example, the File ExampleFMU.fmu is located in package fmu.

ExampleComp.arc
package example;

import fmu.ExampleFMU

  component ExampleComp {
    port sync in double a;
    port sync out double b;

    ExampleFMU explFmu;

    a -> explFmu.a;
    explFmu.b -> b;
  }
Every input- and output variable of the FMU is realized as a synchronous port, tunable parameters are realized as event ports and fixed parameters are handled like MontiArc component parameters.

Time inside the FMU is equivalent to the rest of the simulation, every tick the FMU-Component receives, it does a timestep of size simulatedTickLength.

Important Information

The tool only supports Co-Simulation for FMI 2.0. Make sure the FMU you are trying to use was created on your platform or has the correct binaries for it. You can validate your FMUs and see which binaries they have using the FMI-Standard Website.