FMIPhysicalModel

class persalys.FMIPhysicalModel(*args)

Physical model defined by a FMI scheme.

Parameters
namestr

Model name

inputssequence of Input

Input variables (optional)

outputssequence of Output

Output variables (optional)

fmuFilestr

FMU file name

fmuTypestr, default=’auto’

FMU type, either one of auto, ME or CS

Notes

When only the file name is provided, only variables marked with Input FMI causality are set as model input variables, and only variables marked with Output FMI causality are set as model output variables.

The implementation is based on OTFMI.

Methods

addInput(input)

Add an input variable.

addOutput(output)

Add an output variable.

clearInputs()

Remove all the input variables.

clearOutputs()

Remove all the output variables.

exportStandalonePythonScript(fileName)

Export the model into a Python script.

getClassName()

Accessor to the object's name.

getCode()

Code accessor.

getCopula()

Copula accessor.

getDistribution()

Distribution accessor.

getEvalTime()

Evaluation time accessor.

getFMUFileName()

FMU file name accessor.

getFMUInfo()

FMU infos accessor.

getFunction()

Accessor to the underlying function.

getInputByName(*args)

Input variable accessor.

getInputDimension()

Number of input variables accessor.

getInputNames()

Input variable names accessor.

getInputRandomVector()

Input random vector accessor.

getInputs()

Input variables accessor.

getMeshModel()

Mesh model accessor.

getName()

Accessor to the object's name.

getOutputByName(*args)

Output variable accessor.

getOutputDimension()

Number of output variables accessor.

getOutputNames()

Output variable names accessor.

getOutputRandomVector(outputNames)

Output random vector accessor.

getOutputs()

Output variables accessor.

getPointToFieldFunction(*args)

Accessor to the underlying function.

getProcessNumber()

Number of concurrent processes.

getPythonScript()

Python script accessor.

getRestrictedFunction(*args)

Accessor to the function restricted to its stochastic inputs.

getRestrictedPointToFieldFunction(outputNames)

Accessor to the field function restricted to its stochastic inputs.

getSelectedOutputsNames()

Accessor to the selected outputs names.

getStochasticInputNames()

Accessor to the names of the stochastic input variables.

hasInputNamed(inputName)

Check if an input has the given name.

hasMesh()

Whether the model has a mesh.

hasName()

Test if the object is named.

hasOutputNamed(outputName)

Check if an output has the given name.

hasStochasticInputs()

Whether it contains stochastic variables.

isParallel()

Whether the evaluations of the model are parallelized.

isValid()

Whether it is valid.

removeInput(inputName)

Remove an input variable.

removeOutput(outputName)

Remove an output variable.

selectOutput(outputName, selected)

Select output.

setCode(code)

Code accessor.

setCopula(inputNames, copula)

Copula accessor.

setDistribution(inputName, distribution)

Input distribution accessor.

setDistributionParametersType(inputName, ...)

Input distribution parameter type accessor.

setEvalTime(evalTime)

Evaluation time accessor.

setFMUFileName(fileName)

FMU file name accessor.

setFiniteDifferenceStep(inputName, step)

Finite difference step accessor.

setInputDescription(inputName, description)

Input description accessor.

setInputName(inputName, newName)

Input variable name accessor.

setInputStochastic(inputName, stoch)

Whether the input variable is stochastic.

setInputValue(inputName, value)

Input variable value accessor.

setInputs(inputs)

Input variables accessor.

setMeshModel(meshModel)

Mesh model accessor.

setName(name)

Accessor to the object's name.

setOutputDescription(outputName, description)

Output description accessor.

setOutputName(outputName, newName)

Output variable name accessor.

setOutputValue(outputName, value)

Output variable name accessor.

setOutputs(outputs)

Output variables accessor.

setParallel(flag)

Whether the evaluations of the model are parallelized.

setProcessNumber(processNumber)

Number of concurrent processes.

getFMUType

reassignVariables

setFMUType

__init__(*args)
addInput(input)

Add an input variable.

Parameters
inputInput

New variable

addOutput(output)

Add an output variable.

Parameters
outputOutput

New variable

clearInputs()

Remove all the input variables.

clearOutputs()

Remove all the output variables.

exportStandalonePythonScript(fileName)

Export the model into a Python script.

In the case of metamodels the script only depends on OpenTURNS and is meant to be used out of Persalys.

Parameters
fileNamestr

Path of the exported script

getClassName()

Accessor to the object’s name.

Returns
class_namestr

The object class name (object.__class__.__name__).

getCode()

Code accessor.

Returns
codestr

Code text

getCopula()

Copula accessor.

Parameters
copulaopenturns.Copula

The copula

getDistribution()

Distribution accessor.

Parameters
Distributionopenturns.JointDistribution

The composed distribution (marginals and dependence)

getEvalTime()

Evaluation time accessor.

Returns
evalTimefloat

Evaluation time

getFMUFileName()

FMU file name accessor.

Returns
fileNamestr

FMU file name containing the FMI scheme

getFMUInfo()

FMU infos accessor.

Returns
fmuInfoFMUInfo

FMU infos

getFunction()

Accessor to the underlying function.

Parameters
outputNamessequence of str

Names of the outputs to be evaluated (optional)

Returns
functionopenturns.Function

Function evaluating the outputs

getInputByName(*args)

Input variable accessor.

Parameters
namestr

Variable name

Returns
inputInput

Input variable

getInputDimension()

Number of input variables accessor.

Returns
dimensionint

Number of input variables

getInputNames()

Input variable names accessor.

Returns
namesopenturns.Description

Input variable names

getInputRandomVector()

Input random vector accessor.

Returns
namesopenturns.RandomVector

Input random vector

getInputs()

Input variables accessor.

Returns
inputssequence of Input

Input variables

getMeshModel()

Mesh model accessor.

Returns
meshMeshModel

Mesh model

getName()

Accessor to the object’s name.

Returns
namestr

The name of the object.

getOutputByName(*args)

Output variable accessor.

Parameters
namestr

Variable name

Returns
inputOutput

Output variable

getOutputDimension()

Number of output variables accessor.

Returns
dimensionint

Number of output variables

getOutputNames()

Output variable names accessor.

Returns
namesopenturns.Description

Output variable names

getOutputRandomVector(outputNames)

Output random vector accessor.

Returns
namesopenturns.RandomVector

Output random vector

getOutputs()

Output variables accessor.

Returns
outputssequence of Output

Output variables

getPointToFieldFunction(*args)

Accessor to the underlying function.

Parameters
outputNamessequence of str

Names of the outputs to be evaluated (optional)

Returns
functionopenturns.PointToFieldFunction

Function evaluating the outputs along the mesh nodes

getProcessNumber()

Number of concurrent processes.

Returns
process_numberint

Maximum number of processes

getPythonScript()

Python script accessor.

Returns
scriptstr

Python script to replay the model

getRestrictedFunction(*args)

Accessor to the function restricted to its stochastic inputs.

Parameters
outputNamessequence of str

Output variables (optional)

Returns
restrictedopenturns.Function

Stochastic function

getRestrictedPointToFieldFunction(outputNames)

Accessor to the field function restricted to its stochastic inputs.

Parameters
outputNamessequence of str

Output variables (optional)

Returns
restrictedopenturns.PointToFieldFunction

Stochastic field function (for model with mesh)

getSelectedOutputsNames()

Accessor to the selected outputs names.

Returns
namesopenturns.Description

Selected outputs names

getStochasticInputNames()

Accessor to the names of the stochastic input variables.

Returns
namesopenturns.Description

Names of the stochastic input variables

hasInputNamed(inputName)

Check if an input has the given name.

Parameters
namestr

Variable name

Returns
hasbool

Whether an input has the given name

hasMesh()

Whether the model has a mesh.

Returns
hasMeshbool

Whether the model has a mesh

hasName()

Test if the object is named.

Returns
hasNamebool

True if the name is not empty.

hasOutputNamed(outputName)

Check if an output has the given name.

Parameters
namestr

Variable name

Returns
hasbool

Whether an output has the given name

hasStochasticInputs()

Whether it contains stochastic variables.

Returns
hasbool

Whether it contains stochastic variables

isParallel()

Whether the evaluations of the model are parallelized.

Returns
isParallelbool

Whether the evaluations of the model are parallelized (available only for the Python model)

isValid()

Whether it is valid.

Returns
isValidbool

Whether it is valid

removeInput(inputName)

Remove an input variable.

Parameters
namestr

Variable name

removeOutput(outputName)

Remove an output variable.

Parameters
namestr

Variable name

selectOutput(outputName, selected)

Select output.

Parameters
namestr

Output name

isSelectedbool

Whether it is selected

setCode(code)

Code accessor.

Parameters
codestr

Code text

setCopula(inputNames, copula)

Copula accessor.

Parameters
copulaopenturns.Copula

The copula

setDistribution(inputName, distribution)

Input distribution accessor.

Parameters
namestr

Variable name

distributionopenturns.Distribution

Variable distribution

setDistributionParametersType(inputName, distributionParametersType)

Input distribution parameter type accessor.

Parameters
namestr

Variable name

parametersTypeint

Distribution parameter type accessor

setEvalTime(evalTime)

Evaluation time accessor.

Parameters
evalTimefloat

Evaluation time

setFMUFileName(fileName)

FMU file name accessor.

Parameters
fileNamestr

FMU file name containing the FMI scheme

setFiniteDifferenceStep(inputName, step)

Finite difference step accessor.

Parameters
namestr

Variable name

stepfloat

Finite difference step used to define the gradient of the model’s function

setInputDescription(inputName, description)

Input description accessor.

Parameters
namestr

Variable name

descriptionstr

Description text

setInputName(inputName, newName)

Input variable name accessor.

Parameters
namestr

Variable name

newNamestr

New name

setInputStochastic(inputName, stoch)

Whether the input variable is stochastic.

Parameters
namestr

Variable name

isStochasticbool

Whether the input variable is stochastic

setInputValue(inputName, value)

Input variable value accessor.

Parameters
namestr

Variable name

valuefloat

New value

setInputs(inputs)

Input variables accessor.

Parameters
inputssequence of Input

Input variables

setMeshModel(meshModel)

Mesh model accessor.

Parameters
meshMeshModel

Mesh model

setName(name)

Accessor to the object’s name.

Parameters
namestr

The name of the object.

setOutputDescription(outputName, description)

Output description accessor.

Parameters
namestr

Variable name

descriptionstr

Description text

setOutputName(outputName, newName)

Output variable name accessor.

Parameters
namestr

Variable name

newNamestr

New name

setOutputValue(outputName, value)

Output variable name accessor.

Parameters
namestr

Variable name

valuefloat

New value

setOutputs(outputs)

Output variables accessor.

Parameters
outputssequence of Output

Output variables

setParallel(flag)

Whether the evaluations of the model are parallelized.

Parameters
isParallelbool

Whether the evaluations of the model are parallelized

Notes

This is only implemented for the Python model. Also, on Windows platforms, ProcessPoolExecutor startup time being much higher, you may want to evaluate enough points in batch rather than many small blocks. Refer to the setBlockSize method of the various algorithms.

setProcessNumber(processNumber)

Number of concurrent processes.

Parameters
process_numberint

Maximum number of processes