Using an Imported FMU
The Icon View | FMU View |
The Diagram View | Input and Output Filters |
Documentation | Wrapper View |
The Component Browser | Co-Simulation View |
General View |
For the imported FMU to be compatible with System Modeler, 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 page is dedicated to describing its properties.
For an introduction to FMI, see the Functional Mock-up Interface page.
The Icon View
After importing an FMU in Model Center, the Icon View of the wrapper model will automatically open. FMUs with a built-in icon will keep their icon in System Modeler, 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 System Modeler. 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.
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 System Modeler 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 the Documentation Center User Guide.
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 System Modeler 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 the Component Browser chapter of Model Center User Guide.
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:
- Fixed start values (FMI 1.0 only). Parameters that are used to set exact initial values for top-level variables.
- Non-fixed start values (FMI 1.0 only). Parameters that are used to set initial guess values for top-level variables.
- Exact initial conditions (FMI 2.0 only). Parameters that are used to set exact initial values for variables.
- Approximate initial conditions (FMI 2.0 only). Parameters that are used to set initial guess values for variables.
The parameters that are used to set initial values for variables, with names in the form of <nameOfVariable>_start_, are generated during FMU import. As an example, the parameter that is used to set the start value of variable m1Out in the imported FMU MyModel (see preceding image) is given the name m1Out_start_, and it can be found under the Fixed start values section, since it is an exact initial value.
FMU View
The FMU tab shows the parameters for the FMU as a whole, such as configurations for debug logging.
Input and Output Filters
As mentioned in the page 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.
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 filters—and 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:
- Fixed. Use a fixed delay (the value of filterT_) that does not vary during a simulation. Note that the default value of filterT_ is determined with continuous filters in mind; a much smaller value is probably a better choice if there are only discrete variables.
Co-Simulation View
In FMI for Co-simulation, the FMU contains its own simulator that runs independently from the Modelica model in System Modeler; 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.