Main Content

FMU

Include Functional Mockup Unit (FMU) in model

  • Library:
  • Simulink Extras / FMU Import

  • FMU block

Description

The FMU block imports existing functional mockup units (FMUs) into Simulink®. The block automatically selects an FMU mode based on the existing FMU you want to import:

  • Co-Simulation — Integrate FMUs that implement a Functional Mock-up Interface (FMI) Co-Simulation interface. These FMUs may contain local solvers that are used for tool coupling.

  • Model Exchange — Integrate FMUs that implement an FMI Model Exchange interface. These FMUs do not contain local solvers. Instead, they inherit solvers from Simulink.

This block supports FMI versions 1.0 and 2.0. For FMI version 2.0, if your FMU contains both Co-Simulation and Model Exchange elements, the block detects them and prompts you to select the mode you want the block to operate in.

To use this block, you must first have an existing FMU, exported from another tool, or authored in C language.

Ports

Output Arguments

expand all

Placeholder port that produces no output as is. Input and output ports are configured when an actual FMU is imported into the block. Both input and output ports support numerical and string data types.

Parameters

expand all

Specify the name of an FMU, with or without the file extension. This entry is case sensitive. The FMU must exist on the MATLAB® path.

To specify an FMU name, enter the name in the FMU name text box.

When you click OK, the block creates an /slprj/_fmu/unique_ID folder with the unpacked files and the file hierarchy intact.

Dependencies

When you specify an FMU name, the block dialog updates to contain four tabs:

  • Parameters

  • Simulation

  • Input Bus

  • Output Bus

Programmatic Use

Block Parameter: FMUName
Type: character vector
Values: name of an FMU, with or without file extension
Default: ' '

Parameters

This tab lists parameters defined in the FMU.

  • To display only the parameters you are interested in, type a search string in the filter field. This string can match the parameter name or text in the description.

  • In the parameter table, you can change the value of the parameter in the Value field.

Simulation

Select this check box to enable the specification of a tolerance value to the FMU.​ Otherwise, clear this check box.

Dependencies

This parameter is applicable only if your FMU version or mode supports tolerance values.

Programmatic Use

Block Parameter: FMUIsToleranceUsed
Type: character vector
Values: on | off
Default: 'off'

FMU relative tolerance value (%), specified as a scalar.​

Dependencies

This parameter is applicable only if your FMU version or mode supports tolerance values.

Programmatic Use

Block Parameter: FMUToleranceValue
Type: character vector
Values: 1E-3 | scalar
Default: '1E-3'

Communication step size during simulation, specified as a scalar.​ Specify the time interval between simulation time instants for the block. To inherit the sample time from the driving block or the model solver, set this parameter to -1. For more information, see Specify Sample Time.

The block supports different types of sample time,​ including continuous,​ discrete,​ and Inherited. However,​ common co-simulation FMUs support only periodic discrete sample times without offset (such as positive scalar).

Dependencies

This parameter is applicable only in Co-Simulation mode.

Programmatic Use

Block Parameter: FMUSampleTime
Type: character vector
Values: scalar
Default: '-1'

To enable the display of FMU debug logging, select this check box. Otherwise, clear this check box.

Programmatic Use

Block Parameter: FMUDebugLogging
Type: 1xN cell array of character vectors
Values: on | off
Default: 'off'

Filter debug logs by type, specified by selecting these check boxes:

  • OK

  • Warning

  • Discard

  • Error

  • Fatal

  • Pending

Programmatic Use

Block Parameter: FMUDebugLoggingFilter
Type: character vector
Values: OK | Warning | Discard | Error | Fatal | Pending
Default: 'OK' | 'Warning' | 'Discard' | 'Error' | 'Fatal' | 'Pending'

Direct debug logs, specified as:

  • File — Stream to slprj/_fmu/_logs_modelname/modelname_FMUblockname.txt​.

  • Display — Stream to the MATLAB Command Window.

Dependencies

Setting this parameter to File enables the Open FMU Log File... link.

Programmatic Use

Block Parameter: FMUDebugLoggingRedirect
Type: character vector
Values: File | Display
Default: 'File'

Input Bus

This tab lists bus objects specified in the FMU modelDescription.xml or created in the workspace with the fmudialog.createBusType function.

Specify the bus object for a structured input port. By default, the bus object uses the structured variable name defined in modelDescription.xml. To create a new bus object in the workspace, use fmudialog.createBusType.

Output Bus

This tab lists bus objects specified in the FMU modelDescription.xml or created in the workspace with the fmudialog.createBusType function.

Specify the bus object for a structured output port. By default, the bus object uses the structured variable name defined in modelDescription.xml. To create a new bus object in the workspace, use fmudialog.createBusType.

Introduced in R2017b