Exporting a Model to FMU Format

Export to FMU lets you export a model to a FMU format.


Before you begin:

Activate a model from the Package Browser.

  1. Click Export to FMU .
  2. To select the name and location for the FMU, do the following:
    1. Click after the Output file name field.
    2. Browse to the location where the exported FMU is to be located.
    3. Optional: Enter a name for the new FMU file. By default, the name of the Modelica model is proposed.

      Important: The FMU file name must only contain letters, digits, and underscores. It must not begin with a digit.

    4. Click Save.
  3. Optional: Select the FMI type to use:
    • Model exchange to export the model as model exchange.
    • Co-simulation using Cvode to export the model as Co-simulation with the Cvode solver.
    • Model exchange, and Co-simulation using Cvode to export both as model exchange, and Co-simulation using the Cvode solver.
    • Co-simulation using Dymola solvers to export the model as Co-simulation with the current Dymola solver and tolerance.
      Note: This option is only available for FMI 1.0.
  4. Select the complaint version, Export as FMI 1.0 or Export as FMI 2.0.
  5. Optional: Select options:

    Note: Only one of the two first options can be selected.

    1. Include source code to include the source code in the exported FMU.
    2. Export with string parameters

      Note: String variables are not supported.

    3. Copy resources to FMU to copy the external resources that are using the functions Modelica.Utilites.Files.loadResources or ModelicaServices.ExternalReferences.loadResource to the FMU.
  6. To select what variables to expose in the exported FMU, do any of the following:
    • To expose all variables in the imported FMU, select All variables, then skip the next step.
      Important: "All variables" means all variables filtered, that is, the model description filters are also taken into account. See Step 10.
    • To specify in detail what variables to expose, click Custom. See next step for selection.
  7. To specify what variables to expose when you have selected Custom in the previous step, click Select variables to display a dialog for selection.

    In the dialog, by default, all variables filtered are selected to be exposed.

    1. In the left part of the dialog, select the variables to hide.

      You can:

      • Search for variables by typing in the first field.
      • Expand and collapse nodes in the tree individually, or all by clicking Expand All or Collapse All.
      • Multiselect variables individually, or all by clicking Select All or Select None.

    2. Click Hide to hide the selected variables.

      Tip: To instead work with what variables to expose, in the left part of the dialog, click Select All, and then click Hide. You can now work with what variables to expose in the same way as working with what variables to hide.

    3. When you have finalized the selection, click OK to validate the selection and close the dialog box.
  8. Optional: You can store the results in a .mat file.
    1. Activate Store result in mat file.

      Note: This option and Include source code (see above) are mutually exclusive, you can only activate one of them at the same time.

    2. If the store option is activated, you can specify the result generation interval when storing simulation results by changing the Interval.
  9. Select binaries:
    1. 64-bit binaries if you want to create 64-bit binaries.
    2. 32-bit binaries if you want to create 32-bit binaries.
    3. Linux 64-bit binaries if you want to, on Windows, create Linux 64-bit binaries.

      Note: The option to create Linux binaries can only be activated if:
      • "Windows Subsystems for Linux" is installed on your computer.
      • You have activated the option Enable WSL using: <path to wsl.exe>, with the correct path specified, from Me > Preferences > App Preferences > 3D Modeling > Systems Modeling and Execution > Dymola Behavior Modeling , the Compiler tab.

  10. Optional: Select model description filters to control the filtering of the model description (modelDescription.xml).
    1. Exclude Protected variables to filter away protected Modelica variables.
    2. Exclude Auxiliary variables to do the following:

      The option works differently in FMI 2.0 and FMI 1.0:

      • For FMI version 2.0, to filer away all variables of causality local, except states and derivatives of states.
      • For FMI version 1.0, to filter away all variables of causality internal, except the ones with variability parameters.

    3. Only Black-box to do the following:

      The option works differently in FMI 2.0 and FMI 1.0:

      • For FMI version 2.0, to filter away all variables, except the following:
        • Variables of causality inputs and outputs.
        • Variables required for the model structure. The names are however hidden (concealed).
      • For FMI version 1.0, to filter away all variables of causality inputs and outputs.

      Note: If you select Only Black-box, the options Exclude Protected variables and Exclude Auxiliary variables are not selectable anymore; they are not relevant in this case.

  11. Optional: You can select to include a model image in the FMU export:
    • None - no image is included. This is the default selection.
    • Icon - the icon of the model is included.
    • Diagram - the image of the diagram layer is included.