FMU

This block (co)simulates an FMU block.

    FMU

Library

Activate/CoSimulation

Description

The FMU block enables the importing and simulation of an FMU as an intrinsic Activate block. The FMU can be of type Model-Exchange (ME) or Co-Simulation (CS). Both version 1.0 and 2.0 are supported. Inputs and outputs can be of Real, Integer, Boolean or String data types. Only scalar input and output are supported. The FMU block can also signal an external event to the FMU.

Parameters

FMU_0

NameLabelDescriptionData TypeValid Values

FMUfilename

FMU file name

The full path of the FMU to be imported.

String

NX

Number of continuous states

Number of continuous-time states of the FMU. Click the 'Reload' button to automatically populate this field.

Scalar

NZ

Number of zero-crossing surfaces

Number of zero-crossing surfaces of the FMU. Click the 'Reload' button to automatically populate this field.

Scalar

nevin

Number of input events

Number

nevout

Number of output events

Number

nclocks

Number of clock variables

Number

clocks

Clocks

Structure

clocks/name

Name

Name of the clock variable

Cell of strings

clocks/description

Description

Description of the clock variable.

Cell of strings

clocks/causality

Causality

Type of clock causality.

Cell of strings

clocks/intervalVariability

intervalVariability

Type of clock.

Cell of strings

clocks/intervalDecimal

intervalDecimal

Interval (period of clock for periodic clocks)

clocks/shiftDecimal

shiftDecimal

Shift of offset of the clock for perodic variable.

clocks/resolution

resolution

Resolution of the clock.

clocks/intervalCounter

intervalCounter

interval counter of the clock

clocks/shiftCounter

shiftCounter

shift counter of the clock.

clocks/reference

Reference

Cell of scalars

nin

Number of inputs

Number of input ports of the FMU. Click the 'Reload' button to automatically populate this field.

Number

inports

Input ports

Structure

inports/name

Name

Name of the input port. The name is extracted from the FMU file and is not editable.

Cell of strings

inports/description

Description

Description of the input port. The description is extracted from the FMU file and is not editable.

Cell of strings

inports/it

Datatype

Input datatype of the input port. The datatype is extracted from the FMU file and is not editable.

Cell of strings

inports/dodependency

Direct dependency vector for the input

Input-output dependency of the input port. The dependency is extracted from the FMU file and is not editable. Select the check box to indicate that the input directly affects the output port values.

Cell of vectors

nout

Number of outputs

Number of output ports of the FMU. Click the 'Reload' button to automatically populate this field.

Number

outports

Output ports

Structure

outports/name

Name

Name of the output port. The name is extracted from the FMU file and is not editable.

Cell of strings

outports/description

Description

Description of the output port. The description is extracted from the FMU file and is not editable.

Cell of strings

outports/ot

Datatype

Output datatype of the output port. The datatype is extracted from the FMU file and is not editable.

Cell of strings

nparam

Number of parameters

Number of editable parameters of the FMU. Click the 'Reload' button to automatically populate this field.

Number

params

Parameters

Structure

params/name

Name

Name of the parameter. The name is extracted from the FMU file and is not editable.

Cell of strings

params/description

Description

Description of the parameter. The description is extracted from the FMU file and is not editable.

Cell of strings

params/tp

Datatype

Parameter datatype of the output port. The datatype is extracted from the FMU file and is not editable.

Cell of strings

params/unit

Unit

Cell of strings

params/value

Value

The value of the parameter. The default value is automatically extracted from the FMU and displayed.

params/defvalue

Default value

params/reference

Reference

Cell of scalars

nlocals

Number of internal variables

Number

local_names

Additional outputs

This field adds additional output ports to inspect internal FMU variables.

local_types

data types

local_refrs

references

FMU_1

NameLabelDescriptionData TypeValid Values

run_as_me

Run as Model Exchange if both FMU types are provided

If the FMU provides both the Model Exchange and Co-Simulation API's, you can select the check box to apply the Model Exchange API, otherwise the Co-Simulation API is applied.

Scalar

0
1

tolerancecontrolled

Error tolerance is provided to FMU

Scalar

0
1

stoptimedefined

Final time is provided to FMU

Scalar

0
1

deleteafteruse

Delete the unpacked FMU before exiting

The import block unzips the FMU on each run. Select the check box to delete the unzipped folder after the simulation runs.

Scalar

0
1

inevent

Show FMU input event ports

Select the check box to enable the input event ports of the FMU import block. The FMU import block has two input event ports: External and End. The External event can be activated by any event and puts the FMU (of type ME) into the event iteration mode. The End event puts the block into terminate mode.

Scalar

0
1

outevent

Show FMU output event ports

Select the check box to enable the output event ports of the FMU import block. The FMU import block has two output event ports:Discrete and End. The Discrete event is triggered when a time event is programmed inside the FMU block. The End event is triggered when the FMU requests a termination.

Scalar

0
1

resources

FMU resource location

Location of the resource folder for the FMU. If a location is not specified, the default location is fmu://resources.

String

tempdir

Directory for unpacking the FMU

Specify a folder to unzip the FMU. If a folder is not specified, the FMU is unzipped into a temporary folder.

String

ipc

Run in safe mode

Protects Activate from crashes in the FMU. Simulations run slower in this mode.

Number

0
1

nEnvVar

Number of environment variables

Number of environment variables to pass to FMU.

Number

EnvVars

Environment Variables

Structure

EnvVars/varname

Name

Name of the environment variable to pass to FMU.

Cell of strings

EnvVars/varvalue

Value

Value of the environment variable to pass to FMU.

Cell of strings

FMU_2

NameLabelDescriptionData TypeValid Values

enable_fmulogging

Enable FMU logging

Select the check box to enable the logger.

Number

0
1

simloglevel

FMU interface logging level

Select a logging level for the interface to the FMU block. The levels Info, Warning, and Error are registered.

String

'Nothing'
'Fatal'
'Error'
'Warning'
'Info'
'Verbose'

add_Activate_messages

Add Activate messages

Select the check box to include messages from Activate in the log file.

Scalar

0
1

fmulogging_cats

FMU logging categories (for FMI-2.0 and later)

The FMU can filter log messages. You can enter the required log categories. Log categories should be protected by double quotes and separated by a comma.

String

log_file_name

Log file name (*.log)

The log file name to be created. If this field is left empty, the logger is disabled.

String

csv

Separator character used in .csv file

The separator character in the output .csv file.

String

out_enum_as_int_flag

Print Enums and Booleans as integers in .csv file

Select the check box to activate the Enum values as integers, otherwise the text values are stored.

Scalar

0
1

log_only_outputs

Store only input/output variables

Select the check box to store only input and output variables in the .csv and HDF files to reduce output file volume.

Scalar

0
1

result_file

Result storage file name (*.csv/*.mtsf)

The full path of the output result file. The output file can be either a .csv or HDF file (with extension *.mtsf).

String

FMU_3

NameLabelDescriptionData TypeValid Values

stepevent

Solver mesh-point events (step events)

If activated, when a step event occurs, the value of each variable is stored at that time instant.

Scalar

0
1

stateevent

Zero-crossing events (state events)

If activated, when a state event (zero-crossing event) occurs, the value of each variable is stored at that time instant.

Scalar

0
1

timeevent

Time events

If activated, when a time event occurs, the value of each variable is stored at that time instant.

Scalar

0
1

OutputOn

Every output update

If activated, when the block outputs are updated, the value of each variable is stored at that time instant.

Scalar

0
1

meshpoints

Meshpoints

If activated, the value of each variable is stored at the solver mesh points.

Scalar

0
1

superdensetimes

Super dense time instants

If activated, the value of each variable is stored at the super dense time instants of the discrete events.

Scalar

0
1

FMU_4

NameLabelDescriptionData TypeValid Values

fixedComStepsize

Preferred fixed communication stepsize

FMUs of type Co-Simulation are simulated by performing input and output updating at intervals called communication points. The communication points can be defined by the Activate solvers or constant time. In the latter case, the constant communication interval size is provided here. This option is valid for FMI 2.0.

Scalar

provideDerivative

FMU input interpolation

If activated, the first derivative of inputs is computed using the numerical differentiation method and is given to the FMU/CS.

Scalar

0
1

exploitOutDerivative

FMU output extrapolation order

Number

visible

Secondary simulator should be visible

If activated, the FMU/CS is co-simulated interactively.

Scalar

0
1

EnableRollback

Enable rollback

Apply GetFmuState and SetFmuState APIs to solve algebraic loops if the FMU supports these APIs.

Scalar

0
1

EnableDirectDer

Exploit directional derivative

If activated and the FMU provides directional derivative for Cosimulation, directional derivative will be used to compute the Jacobian of the model.

Scalar

0
1

Ports

NameTypeDescriptionIO TypeNumber

Port 1

explicit

output

nout+nlocals

Port 2

explicit

input

nin

Port 3

activation

input

2*inevent+nevin

Port 4

activation

output

2*outevent+nevout

Advanced Properties

NameValueDescription

always active

yes

direct-feedthrough

Depends on block parameters

zero-crossing

Depends on block parameters

mode

no

continuous-time state

Depends on block parameters

discrete-time state

no