FMIUsing an Imported FMU

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

For the imported FMU to be compatible with SystemModeler, which uses Modelica as its primary modeling language, a Modelica model is created around the FMU. That model is referred to as the wrapper model, and this chapter is dedicated to describing its properties.

FMI IN SYSTEMMODELER
FMI | FMU Export and Import | FMI-Variable Naming

The Icon View

After importing an FMU, the Icon View of the wrapper model will automatically open. FMUs with a built-in icon will keep their icon in SystemModeler, with the addition of a small puzzle shape in the upper-right corner. This is added to make it easier to differentiate between imported FMUs and other models created in SystemModeler. Imported FMUs that do not contain an icon will be given the puzzle shape as an icon.

Icon of an imported FMU of a tank system.

2.gif

The automatically generated icon for an FMU that is not shipped with its own icon.

The Diagram View

The Diagram View of the wrapper model contains graphical representations of inputs, outputs and filters connected to inputs/outputs. Additionally, it displays some textual information about the FMU:

Documentation

Documentation that is shipped with the FMU is accessible from SystemModeler after the import. An FMU that does not contain any documentation will show the default documentation page for a Modelica class. For more information on how to view documentation of classes, see this chapter.

The Class Browser

The Class Browser on the left-hand side of Model Center will have an expandable item for the wrapper model. Expand the item to find subpackages that facilitate working with the wrapper model. These include definitions of enumeration types (the Types_ subpackage), connectors and partial models (the Interfaces_ subpackage) and discrete delay blocks (the DiscreteDelays_ subpackage). The discrete delays are useful as wrapper filters on discrete inputs and outputs. For continuous inputs and outputs, it is recommended to use one of the lowpass filters in Modelica.Blocks.Continuousby default, Modelica.Blocks.Continuous.FirstOrder is used. For more information on the Class Browser, see this page.

4.gif

The Class Browser showing the selection of discrete delay blocks for an imported FMU.

The Component Browser

The Component Browser on the right-hand side of Model Center lists all variables and parameters in the wrapper model. This includes a number of internal variables that are created by SystemModeler during FMU Import. All variable and parameter names ending in a simple underscore, for example debugLogging_ and x_, are generated by the import and should not be mistaken for FMU variables. For more information on the Component Browser, see this page.

5.gif

The Component Browser for an imported FMU of a tank system.

General View

The General view for the wrapper model can be found at the bottom of Model Center. This view displays all inputs, outputs and parameters present in the top-level model. The General view may have several sections, depending on FMU content:

FMU View

The FMU tab contains only one section, namely Parameters. This view shows the parameters for the FMU as a whole, such as configurations for debug logging.

7.gif

The FMU view.

Input and Output Filters

As mentioned in the chapter on FMU Import, adding filters to either inputs or outputs allows an FMU to be safely connected to other components in a loop. If On inputs (or On outputs) was chosen for the Add FMU interface filters option during the import, the inputs or outputs will be connected to filters in the imported FMU.

The inputs of the imported Tank FMU are connected to filters.

As can be seen in the preceding screenshot, the filters are in turn connected to terminal blocks. These terminals make it possible for you to easily exchange the default filters with your own customized filters or the ones provided in the DiscreteDelays_ subpackage. Simply right-click the filter, choose Change Type and enter the new class in the Other field. Another alternative is to delete the default filter from the diagram layer and drag and drop the new filter onto the Diagram View. Then reconnect the filter to the input (or output) and the corresponding terminal block using the Connection Line Tool.

The inputs and outputs of the wrapper model are given the original input and output names as they were specified in the model description file, while the actual variables of the FMU are found at the corresponding terminal block, named using the _fmu_ suffix. As an example, in the imported Tank FMU shown, the wrapper interface variables are named as specified in the model description file, like qIn and qOut, whereas the actual FMU variables are named qIn_fmu_.u and qOut_fmu_.y, respectively. The naming of the filter blocks is insignificant.

9.gif

Naming of input variables, filters and terminals.

Wrapper View

If On inputs or On outputs was chosen for the Add FMU interface filters option in the FMU Import dialog, a Wrapper tab will be available at the bottom of the Model Center main window. The Wrapper view contains parameters for Input and output filters, namely filterT_the default time constant for all added filtersand delayKind_only applicable to discrete delays with the selectable kind of delay.

The filterT_ parameter can be edited directly in the Wrapper view, and that edit then applies to the default of all input or output filters. Of course, each filter can override the default time constant if different delays are preferred.

The delayKind_ parameter is the default kind of the discrete delays with the selectable kind of delay, like DiscreteDelays_.Integer_SelectDelay. It offers three different choices:

Co-simulation View

In FMI for Co-simulation, the FMU contains its own simulator that runs independently from the Modelica model in SystemModeler; the parameters in the wrapper model for controlling that simulator are found in the Co-simulation view.

Data (input/output) is exchanged between the FMU and the Modelica model at discrete communication points. The wrapper model has two operating modes for determining the communication points, and the operating mode is controlled by useTriggerInput_. If useTriggerInput_ is true, an external trigger signal connected to stepTrigger_ is used for triggering communication points. If useTriggerInput_ is false, communication is performed periodically with the step size given by step_.

If the FMU uses a variable step-size solver and error estimation, it is possible to provide a tolerance for the error estimation by setting tolerance_ to something greater than zero.

11.gif

The Co-Simulation view.

FMI IN SYSTEMMODELER
FMI | FMU Export and Import | 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