Functional Mock-Up Interface Support

The Functional Mock-Up Interface (FMI) is an emerging standard for creating interfaces between different tools.

The FMI standard defines two main interfacing solutions: Model Exchange and Co-Simulation. The export from one tool to another is made through FMU files. Activate can simulate FMU blocks from the FMI-1.0 and FMI-2.0 standards, and supports both the Model-Exchange and Co-Simulation block types.

FMU Import

The FMU Import block lets you import and simulate FMU blocks.

The block is located in the palette Advanced > CoSimulation.

The FMU block automatically detects the FMI version, 1.0 or 2.0, and FMI type, Model Exchange or Co-Simulation, and applies a simulation method accordingly. Double-clicking the FMU Import block displays the block dialog:

The block dialog lets you select and load an FMU block. Once selected, you can enter values in the fields such as the number of inputs, outputs and states, or click Reload to read the FMU block and populate the fields automatically. In the Parameters table, the FMU variables that have an editable start value are displayed. Changes to the values are incorporated before a simulation starts.

Once the dialog is populated, the FMU block can be added to a model diagram. The following example shows an FMU block in a diagram facilitating co-simulation with a hydraulics software product.

FMU Export

The FMU Export feature enables Activate super blocks to be exported as FMU modules.

The FMU Export feature includes:
  • Export as FMI-2.0.
  • Export FMU as Model Exchange or Co-Simulation or both.
  • Internal information of the super block is hidden for IP protection.
  • Internal block parameters are displayed in the FMU.
  • Several fixed-step and variable-step solvers can be exported into the FMI for co-simulation.
  • Exported FMU can be imported into Activate or any other FMI compatible tool.
The current version of the FMI Export does not support:
  • Signal import blocks such as ReadfromMat and SignalIn.
  • Signal export blocks such as WritetoMat and SignalOut.
  • Signal Viewer blocks such as Scope and Display.
  • Co-simulation blocks such as MotionSolve and Spice.
  • Memory block is not supported.
  1. To export to the FMU, select the area of a diagram that you want to export and convert it into a super block.
    For example, in the following model you can select the super block controller_to_export.

    The controller-to-export super block contains a linear system and matrix gain block with one scalar input and two vector outputs:

  2. After creating the super block, on the ribbon, select Tools > FMU 2.0.
  3. Select an export method: Model Exchange, Co-Simulation, or Co-Simulation and Model Exhange.

    The name and identifier of the exported FMU keeps the name of the super block. Therefore any unsupported characters in the name of the super block are converted into ASCII characters. For example if the name of your super blocks is SuperB !\%lock, the name is converted into sb_SuperB32339237lock.

    If you selected the Co-Simulation export method, the Activate simulator as well as the Simulation Parameters are exported with the model.

    Note:

    The FMI export feature requires a C/C++ compiler.

    On Windows platforms, a MicroSoft Visual Studio C/C++ compiler is required. Ensure that you have the correct compiler installed on your system to compile the generated C code, otherwise the binary will not be available for the FMU and the FMI export will fail.

    On Linux platforms, Activate uses the GCC compiler available on your system.

    Note:

    Activate automatically detects the C compiler on your system. The OML command vssGetCompilerName() displays the C compiler that is recognized by Activate.

  4. After selecting the export method, Activate exports the super block and prompts you to specify a location to save the FMU. The default location is the folder where the model file is saved.

FMU Export with Documentation

Issue the OML command to export FMU information in an .html file.

When exporting an FMU, you can generate and include an .html file with a description of the super block in the FMU. The description that is exported is the model report of the super block diagram.

By default, the .html page is not generated. To enable this feature, in the OML Command Window, enter: setenv('Activate_FMU_export_DOC','true')

FMU Export on Linux Platforms

FMU exporting on Linux requires ld version 2.27 or greater.

To export an FMU in Activate on Linux platforms, the compilation and linking of the C code requires ld version 2.27 or greater. You can ensure that you are working with a compatible version of ld by installing or updating Binutils with the command: yum install binutils.

FMU Editor

The FMU Editor lets you interact within the hierarchy of an FMU, hide or expose variables and attributes to customize information for a particular audience, and save and export a customized FMU.

  1. On the ribbon, select Tools > FMU Editor
  2. In the FMU Editor, select File > Open and navigate to your FMU.


    The FMU Editor includes FMU Variables and FMU Attributes tabs.
  3. Select the FMU Variables tab to customize variables with multiple options:
    • Navigate inside the FMU with the tree view.
    • Select the variables that you want to display.
    • Deselect the variables that you want to hide.
    • Modify the descriptions of the variables.
    • Use the FMU editor tools to work with the variables: select/deselect all, reverse order, find and search.




  4. Select the FMU Attributes tab to customize the FMU with these options:
    • Modify the FMU attribute descriptions.
    • Modify editable attribute fields. Grayed out fields cannot be modified.


  5. Click the Save FMU As button and name and save your customized version of the FMU.
    A customized version of the FMU is ready for sharing. The source FMU remains unchanged.