FMU

Use the FMU tool to add a Functional Mock-up Unit and connect it to a multi-body model.

Add an FMU Entity

  1. Select the system to which the FMU entity is to be added.
  2. Add the FMU entity to the system by any of the following methods:
    • Right-click on the FMU icon on the Control toolbar.
    • Right-click on the system in the Project Browser and select Add > Control Entity > FMU from the context menu.
    • Right-click on any existing FMU folder in the Project Browser and select Add FMU… from the context menu.
    The Add FMU dialog is displayed.
  3. Specify a label and a variable name.
    Note: By default, variables names of entities in MotionView follow a certain convention. For example, all FMU entities have a variable name starting with “fmu_”. This is the recommended convention to follow when building models in MotionView since it has many advantages in identifying the entity during model editing and model manipulation
  4. Use the Filename browser to locate the FMU file (.fmu) and select it.
  5. Click OK to close the window or Apply to continue creating entities.
Once an FMU entity has been added to the model, it is selected and its panel will automatically be displayed in the panel area.

View and Edit FMU

An FMU represents a dynamic system which is characterized by arrays of inputs (U), dynamic states (X), and outputs (Y). In addition, an FMU can contain Parameters that can be changed to vary the initial state of the model that the FMU represents.


Figure 1. FMU panel - Properties tab
The FMU panel Properties tab displays the following information:
Property Type Description
Filename File FMU file name with path.
FMU Type String Type of FMU.
  • Model Exchange

    Or

  • Co-simulation

If an FMU contains both types, this option is available for selection.

Number of states Integer Number of states within the FMU.
Number of inputs Integer Number of input channels the FMU is seeking.
Number of outputs Integer Number of output channels from the FMU.
Number of parameters Integer Number of parameters in the FMU.
Check FMU   Runs the FMU compliance checker to provide more information and verify the validity of the FMU. See Comments.
Reload FMU   The FMU is reloaded.

Click on Edit FMU... to view and edit Input, Output, Parameters and Settings.

The FMU dialog appears.


Figure 2. FMU dialog

This dialog has the following tabs:

Input

The input tab lists all the input channels in the input array with their name and description.

Provide a solver expression under the Value column to each of the channels as input to the FMU. The value of this solver expression is computed by MotionSolve during simulation and communicated to the FMU at every time-step of the simulation.

Output

This tab lists all the output channels in the output array from the FMU with their names and descriptions.

Parameters

The parameters tab lists the parameters and initial conditions along with their default values in the FMU. Parameters are variables that are exposed by the FMU and can take a different value at the beginning of the simulation. Parameters can be of the type Real, Integer, Boolean or String.

Settings

The settings tab provides additional options:
Property Type Description
Error tolerance factor Real Applicable for FMU of type Model Exchange only. A scale factor that is multiplied to the displacement integration error tolerance define the integration error tolerance for the continuous states of the FMU.

Value > 0, Default: 1.0

Communication Interval Real Time interval that MotionSolve uses to communicate with the FMU.

Value > 0, Default: Maximum integration step size

Static Hold Boolean Applicable for FMU of type Model Exchange only.

Flag to hold the value of the FMU’s dynamic states constant during a static or quasi-static simulation.

Default: False
Use Address Boolean Turn this option ON if the FMU is run on a different machine. Default: OFF (FMU is executed on the same machine as MotionSolve).
IP Address String If Use Address is ON, provide the IP address of the machine where the FMU is executed.

Connect an FMU to the Model

Inputs and Outputs connect the FMU to the Model. FMU Inputs are Model measures (defined as Model state- and time-based expressions). FMU Outputs are typically referred to by force or motion generating entities contained in the Model.
  1. Provide solver expressions for each of the channels under the Value column of the Input tab.
  2. Define the FMU Outputs. These are referenced by Force or Motion entities in the Model.
    The expression for the Forces/Motions in the Model use the ARYVAL function to reference the FMU outputs. The FMU outputs are available as attributes to the y_array data member of the FMU entity. For instance, {fmu_1.y_array.output_3}, will contain the third output of the FMU.


    Figure 3. Force expression referring to an output of an FMU

    In the above model of a quadcopter, the vehicle position and velocities captured by the solver expressions DX(), DY() etc. are provided as inputs to the FMU. The output from the FMU is tapped using the output attributes of the y_array data member of the FMU that was resolved to the solver expression ARYVAL. In the demonstrated case, the motion on one of the blades uses the second and the third output. The expression {fmu_controller.y_array.output_2} returns the second output from the FMU’s (fmu_controller) output array (y_array).

Comments

An FMU (.fmu) is a zipped package that could contain the binaries and resources needed to solve the model that it represents along with a model description (.xml) file.

An FMU could be of the type Model Exchange (ME) or Co-simulation (CS) or both. An ME FMU contains the necessary states and variables that could be solved by the calling solver. A CS FMU can contain its own solver or calls another solver. In this case, two solvers co-simulate (one calling solver and other solving the FMU) to solve the entire model. An FMU may contain both modes ME and CS. In this case, the Type attribute in the FMU panel will be editable and you can select the mode in which the FMU is solved.

Check FMU will run the FMU through the FMU compliance checker as provided by the FMI standard. Along with the information about the contents of the FMU, the checker verifies the validity of the information and try to execute the FMU. Warnings or Errors are posted in the resulting dialog.
Note: MotionView runs the Check FMU on the model containing an FMU during a Check Model|Export Solver Deck|Run simulation and may flag an error or warning.


Figure 4. FMU Compliance Check Log from Check FMU

See the following for additional information:

MV-7012: Functional Mockup Unit (FMU) in MotionView and MotionSolve

Control: FMU > XML Format

ARYVAL (MotionSolve Function)

*FMU() (MotionView > MDL Statement)

http://www.fmi-standard.org/