32.4. Functional Mockup Unit Instance

If you have an FMU file, it can be initialized as described in Initialize FMU Instance. When the FMU file is initialized, a user function is created in the Outline tree view under Simulation > Expressions, Functions and Variables > User Functions with the Functional Mockup Unit Instance option selected. The input variables, input parameters, and output variables that are available in the function are those that were selected during initialization.

To complete the function definition:

  • Right-click the applicable function under Simulation > Expressions, Functions and Variables > User Functions and select Edit.

    The function details view appears.

  • Ensure that FMU File Name is set to the name of the FMU file.

  • Specify Coordinate Frame as appropriate for correct interpretation of the function inputs and outputs.

  • Under Argument Values (FMU Input Variables), select each variable listed, one-at-a-time, and specify a value (typically via a CEL expression) under Expression Value.

  • Under Argument Constants (FMU Parameter Variables), select each parameter listed, one-at-a-time, and specify a value (not via a CEL expression) under Value.

  • Under Result Values (FMU Output Variables), select each variable listed, one-at-a-time, and review the units.

    Note that, in the details view:

    • The lists show the CFX names.

    • The Value Name fields show the names that are used in communication with the FMU binary.

  • Click OK.

Function usage syntax:

<function name>.<variable or parameter name>()

For example, if you have a function named WaterTank Control, and the FMU output variable is valve (a Boolean value that is returned as 0 (zero) for off, or 1 (one) for on), then you could implement a conditional connection control (see Conditional Connection Control) of a domain interface (that acts as a valve), using the Option Specified Open State with Logical Expression:

WaterTank Control.valve() > 0

For modeling details, see Coupling CFX to an External Solver: Functional Mock-up Interface (FMI) Co-simulation in the CFX-Solver Modeling Guide.