OpenTURNSFMUFunction

class OpenTURNSFMUFunction(*args)

Define a Function from a FMU file.

Parameters:
path_fmustr, path to the FMU file.
inputs_fmuSequence of str, default=None

Names of the variable from the fmu to be used as input variables. By default assigns variables with FMI causality INPUT.

outputs_fmuSequence of str, default=None

Names of the variable from the fmu to be used as output variables. By default assigns variables with FMI causality OUTPUT.

inputsSequence of str

Optional names to use as variables descriptions.

outputsSequence of str

Optional names to use as variables descriptions.

n_cpusint

Number of cores to use for multiprocessing.

initialization_scriptstr (optional)

Path to the initialization script.

final_timefloat

The output variables value is collected at t=final_time and returned by FMUFunction.

kindstr, one of “ME” (model exchange) or “CS” (co-simulation)

Select a kind of FMU if both are available. Note: Contrary to pyfmi, the default here is “CS” (co-simulation). The rationale behind this choice is is that co-simulation may be used to impose a solver not available in pyfmi.

expect_trajectorybool

If True, the call inputs are assumed to be time dependent trajectories. Default is False

Methods

__call__(X, **kwargs)

Call self as a function.

getFMUInputDescription()

Get the list of input variable names.

getFMUOutputDescription()

Get the list of output variable names.

getInputDescription()

Input description accessor.

getInputDimension()

Input dimension accessor.

getOutputDescription()

Output description accessor.

getOutputDimension()

Output dimension accessor.

initialize([initialization_script])

Initialize the FMU, using initialization script if available.

load_fmu(path_fmu[, kind])

Load an FMU.

setInputDescription(descIn)

Input description accessor.

setOutputDescription(descOut)

Output description accessor.

simulate([value_input, reset])

Simulate the fmu.

simulate_sample(list_value_input, **kwargs)

Simulate the FMU multiple times.

getFMUInputDescription()

Get the list of input variable names.

getFMUOutputDescription()

Get the list of output variable names.

getInputDescription()

Input description accessor.

getInputDimension()

Input dimension accessor.

getOutputDescription()

Output description accessor.

getOutputDimension()

Output dimension accessor.

initialize(initialization_script=None)

Initialize the FMU, using initialization script if available.

Parameters:
initialization_scriptString (optional), path to the initialization
script.
load_fmu(path_fmu, kind=None, **kwargs)

Load an FMU.

Parameters:
path_fmuString, path to the FMU file.
kindString, one of “ME” (model exchange) or “CS” (co-simulation)

Select a kind of FMU if both are available. Note: Contrary to pyfmi, the default here is “CS” (co-simulation). The rationale behind this choice is is that co-simulation may be used to impose a solver not available in pyfmi.

Additional keyword arguments are passed on to pyfmi’s ‘load_fmu’
function.
setInputDescription(descIn)

Input description accessor.

setOutputDescription(descOut)

Output description accessor.

simulate(value_input=None, reset=True, **kwargs)

Simulate the fmu.

Parameters:
value_inputVector of input values.
resetBoolean, toggle resetting the FMU prior to simulation. True by
default.
timeSequence of floats, time vector (optional).
timestepFloat, time step in seconds (optional).
Additional keyword arguments are passed on to the ‘simulate’ method of
the underlying PyFMI model object.
simulate_sample(list_value_input, **kwargs)

Simulate the FMU multiple times.

Parameters:
list_value_inputSequence of vectors of input values.
Additional keyword arguments are passed on to the ‘simulate’ method of
the underlying PyFMI model object.