OpenTURNSFMUFunction

class OpenTURNSFMUFunction(*args)

Override NumericalMathFunction from Python.

Parameters:

path_fmu : String, path to the FMU file.

inputs_fmu : Sequence of strings

Names of the variable from the fmu to be used as input variables.

outputs_fmu : Sequence of strings

Names of the variable from the fmu to be used as output variables.

inputs : Sequence of strings

Optional names to use as variables descriptions.

outputs : Sequence of strings

Optional names to use as variables descriptions.

n_cpus : Integer

Number of cores to use for multiprocessing.

initialization_script : String (optional)

Path to the initialization script.

kind : String, 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_trajectory : Boolean

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

Methods

__call__(X, **kwargs)
getFMUInputDescription() Get the list of input variable names.
getFMUOutputDescription() Get the list of output variable names.
getInputDescription()
getInputDimension()
getOutputDescription()
getOutputDimension()
initialize([initialization_script]) Initialize the FMU, using initialization script if available.
load_fmu(path_fmu[, kind]) Load an FMU.
setInputDescription(descIn)
setOutputDescription(descOut)
simulate([value_input, reset]) Simulate the fmu.
simulate_sample(list_value_input[, n_cpus]) Simulate the FMU multiple times.
getFMUInputDescription()

Get the list of input variable names.

getFMUOutputDescription()

Get the list of output variable names.

initialize(initialization_script=None)

Initialize the FMU, using initialization script if available.

Parameters:

initialization_script : String (optional), path to the initialization

script.

load_fmu(path_fmu, kind=None, **kwargs)

Load an FMU.

Parameters:

path_fmu : String, path to the FMU file.

kind : String, 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.

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

Simulate the fmu.

Parameters:

value_input : Vector of input values.

reset : Boolean, toggle reseting the FMU prior to simulation. True by

default.

simulate_sample(list_value_input, n_cpus=None, **kwargs)

Simulate the FMU multiple times.

Parameters:

list_value_input : Sequence of vectors of input values.

n_cpus : Integer

Number of cores to use for multiprocessing. Use the value of the ‘n_cpus” attribute as default, or 1 (no multiprocessing) if not set.

Additional keyword arguments are passed on to the ‘simulate’ method of

the underlying PyFMI model object.