WOLFRAM SYSTEMMODELER TUTORIAL

FMU Export and Import

Introduction | Class Browser | Class Window | Graphical Views | Modelica Text View | Component Browser | Variable Views | Reliability View | Messages View | Kernel Command View | Documentation Center | Functional Mock-up Interface | Keyboard Shortcuts | Kernel Commands

SystemModeler supports import and export of

  • FMI 1.0 for Model Exchange.
  • FMI 2.0 for Model Exchange.

This chapter describes the FMU export and import workflow.

FMI IN SYSTEMMODELER
FMI | Using an Imported FMU | FMI-Variable Naming

FMU Export

To export a class as an FMU, choose File Export FMU. This will open up the FMU Export dialog box.

1.gif

Exporting an FMU.

The FMU Export dialog box contains a set of export options for the FMU:

  • FMI Version. Which version of the FMI standard to use.
  • Class icon. Specifies whether or not to include a class icon in the FMU.
  • Class documentation. Specifies whether or not to include the class documentation in the FMU.

Classes can also be exported using the Class Browser. Right-click the name of the class and choose Export FMU from the popup menu.

FMU Import

To import an FMU, choose File Import FMU and select the FMU file. This will open up the Import FMU dialog with information about the selected FMU. It is also possible to trigger the import dialog by dragging and dropping the FMU anywhere on the main window in Model Center.

During the import, a wrapper model is created for the FMU. The wrapper model will mirror the variables and parameters in the FMU. The Options section of the FMU Import dialog allows control of which variables will be present in the created model, and how variable and parameter names in the FMU are translated to Modelica identifiers.

Content of the FMU Import dialog box:

2.gif

Importing an FMU.

  • FMU:
  • Model. The name of the model as used in the modeling environment that generated the FMU.
  • Description. A short string describing the model.
  • FMI Version. The FMI version that was used to generate the FMU.
  • Generated by. The name of the tool that generated the FMU.
  • Copyright. Information about the intellectual property copyright for the FMU (only for version 2.0)
  • Output:
  • Name. The top-level class name the FMU wrapper model will be given in SystemModeler.
  • Create in. The directory in which the FMU wrapper model will be created.
  • Options:
  • Include derivatives. If unchecked, all derivative variables as determined by the structured naming convention will be excluded. If Flat is chosen from the Variable naming convention drop-down menu, this alternative becomes disabled, as it is not possible to specify derivative variables using a flat naming convention.
  • Advanced:
  • Allow use of quoted Modelica identifiers for imported variables. Allow variable names generated by the FMU import to be Modelica quoted identifiers. Note that all quoted identifiers will be reserved for generated names, so quoted identifiers in the FMU will become mangled if this option is checked.
  • Variable naming convention. Interpret variable names according to the FMI standard's Structured or Flat naming convention. More information on variable naming conventions can be found in the specification for FMI www.fmi-standard.org.
  • Variables that need name mangling. Treatment of variables subjected to name mangling. Note that if Treat as error is chosen, the import will not succeed if variable name mangling is needed during the import. That a variable has been subjected to name mangling means that its original name as specified in the model description file could not be maintained in SystemModeler, for example, if the name contains characters that are not allowed in a valid Modelica identifier.
  • Add FMU interface filters. Adding filters to inputs or outputs allows the FMU to be safely connected to other components or FMUs in a loop. Regardless of filters on the outputs, the outputs will have uninitialized values during initialization, while absence of filters on the inputs will allow the FMU to initialize with correct values on its inputs. Use filters on outputs to allow the FMU to initialize with correct values on its inputs; otherwise, use filters on inputs.

For more information on the combination of Variable naming convention and Allow use of quoted Modelica identifiers for imported variables, as well as examples of name mangling related to Variables that need name mangling, see chapter FMIVariable Naming.

Clicking OK will import the FMU with the given options. The progress of the import can be followed from the Messages window at the bottom of Model Center, where all major steps in the import process are logged.

FMI IN SYSTEMMODELER
FMI | Using an Imported FMU | FMI-Variable Naming

Introduction | Class Browser | Class Window | Graphical Views | Modelica Text View | Component Browser | Variable Views | Reliability View | Messages View | Kernel Command View | Documentation Center | Functional Mock-up Interface | Keyboard Shortcuts | Kernel Commands