FunctionExporter
- class FunctionExporter(*args)
Fonction export.
- Parameters:
- function
openturns.Function
oropenturns.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.
- function
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, optional
- 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, optional
Verbose output (default=False).
- binarybool, optional
Whether to generate binaries or source (default=True)
- modestr, optional, either ‘pyprocess’, ‘cpython’ or ‘cxx’
pyprocess (default): the function is run via a Python process by file I/O; slow but should work almost everywhere. The Python environment is required to run the resulting FMU (eg run OMEdit from the conda env).
cpython: the function is run via the Python C API; quite fast (no file I/O) but requires Python development headers and 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).