FunctionExporter

class FunctionExporter(*args)

Fonction export.

Parameters:
functionopenturns.Function or openturns.PointToFieldFunction

Function to export. Temporal functions (PointToFieldFunction with mesh dimension=1) can only be exported in fmu format via “pythonfmu” mode.

startsequence of float

Initial input values.

Methods

export_fmu(fmu_path[, fmuType, mode, verbose])

Export the Modelica model as FMU.

export_model(model_path[, gui, verbose, ...])

Export to model file (.mo).

export_fmu(fmu_path, fmuType='me', mode='pyprocess', verbose=False)

Export the Modelica model as FMU.

Requires CMake, a C compiler and omc the OpenModelica compiler. If the model does not already exist, or if the existing model uses OMEdit connectors, the model is (re)created.

Parameters:
fmu_pathstr

Path to the generated .fmu file.

fmuTypestr

model type, either me (model exchange), cs (co-simulation), me_cs (both model exchange and co-simulation)

modestr

either pyprocess or pythonfmu Only pythonfmu mode is allowed for temporal models (PointToFieldFunction) Note that pythonfmu mode yields cosimulation-only, pyfmi/otfmi incompatible fmus

verbosebool

Verbose output (default=False).

export_model(model_path, gui=False, verbose=False, binary=True, mode='pyprocess', move=True)

Export to model file (.mo).

Requires CMake, a C/C++ compiler. Unlike export_fmu, field functions (temporal models) cannot be exported.

Parameters:
model_pathstr

Path to the generated .mo file. The model name is taken from the base name.

guibool
If True, define the input/output connectors.

In this case, given start values ARE NOT TAKEN INTO ACCOUNT.

If False, input and outputs are defined in Modelica code.

In this case only, the model can be exported as FMU using OMC command line.

verbosebool

Verbose output (default=False).

binarybool

Whether to generate binaries or source (default=True)

modestr, either ‘pyprocess’, ‘cpython’ or ‘cxx’
  • pyprocess: the function is run via a Python process by file I/O; slow but should work almost everywhere.

  • cpython: the function is run via the Python C API; quite fast (no file I/O) but requires Python development headers/libs

  • cxx: the function is directly evaluated trough the OpenTURNS C++ API; even faster but requires the OpenTURNS development headers and libraries (not just the Python module that would be installed by pip for example).