cosapp.tools.fmu.exporter¶
Export a System as FMU.
Functions
|
Export a system as CoSimulation FMU respecting FMI 2.0. |
Classes
CoSApp FMU builder |
|
|
Available time integrator for FMU export. |
|
Variable attributes |
|
- class cosapp.tools.fmu.exporter.FmuBuilder[source]¶
Bases:
object
CoSApp FMU builder
- static generate_fmu_facade(system: System, inputs: Iterable[str] = None, parameters: Iterable[str] = None, outputs: Iterable[str] = None, locals: Iterable[str] = None, time_integrator: TimeIntegrator | str = TimeIntegrator.RK4, nonlinear_solver: AbstractSolver | None = None, dest: Path | str = '.', python_env: Path | str | None = None, version: str | None = None, author: str | None = None, description: str | None = None, copyright: str | None = '', license: str | None = '', fmu_name_suffix: str = '') Path [source]¶
Export a system as CoSimulation FMU respecting FMI 2.0.
Inputs, parameters, outputs and locals are by default taken from inputs, inwards, outputs and outwards variables of the CoSApp system, respectively. If you wish to set an empty list, set the corresponding argument with a empty dictionary.
You can add a mathematical problem to the system by passing the proper nonlinear_solver. If it contains a RunSingleCase, its equations will be passed to the FMU.
- Parameters:
system (-) – System to be exported
inputs (-) – List of input variables with initial values; default None
parameters (-) – List of parameter variables with initial values; default None
outputs (-) – List of output variables with initial values; default None
locals (-) – List of local variables with initial values; default None
time_integrator (-) – Time integrator algorithm; default Runge-Kutta 4th order
nonlinear_solver (-) – Non linear Driver to use for solving the system at a given instant
dest (-) – Destination folder; default current directory
python_env (-) – File listing the python dependency; default None
version (-) – FMU version; default None
author (-) – FMU author; default None
description (-) – System description; default None
license (-) – FMU license; default “”
copyright (-) – FMU copyright; default “”
fmu_name_suffix (-) – FMU name; default “”
- Returns:
Folder path containing FMU facade files
- Return type:
pathlib.Path
- static to_fmu(system: System, inputs: Iterable[str] = None, parameters: Iterable[str] = None, outputs: Iterable[str] = None, locals: Iterable[str] = None, time_integrator: TimeIntegrator | str = TimeIntegrator.RK4, nonlinear_solver: AbstractSolver | None = None, dest: Path | str = '.', python_env: Path | str | None = None, project_files: Iterable[str | Path] = {}, version: str | None = None, author: str | None = None, description: str | None = None, copyright: str | None = '', license: str | None = '', fmu_name_suffix: str = '') Path [source]¶
Export a system as CoSimulation FMU respecting FMI 2.0.
Inputs, parameters, outputs and locals are by default taken from inputs, inwards, outputs and outwards variables of the CoSApp system, respectively. If you wish to set an empty list, set the corresponding argument with a empty dictionary.
You can add a mathematical problem to the system by passing the proper nonlinear_solver. If it contains a RunSingleCase, its equations will be passed to the FMU.
- Parameters:
system (System) – System to be exported
inputs (Iterable[str], optional) – List of input variables with initial values; default None
parameters (Iterable[str], optional) – List of parameter variables with initial values; default None
outputs (Iterable[str], optional) – List of output variables with initial values; default None
locals (Iterable[str], optional) – List of local variables with initial values; default None
time_integrator (TimeIntegrator, optional) – Time integrator algorithm; default Runge-Kutta 4th order
nonlinear_solver (AbstractSolver, optional) – Non linear Driver to use for solving the system at a given instant
dest (str or Path, optional) – Destination folder; default current directory
python_env (str or Path, optional) – File listing the python dependency; default None
project_files (Iterable of str or Path, optional) – List of additional files to be included in the FMU; default no additional files
version (str, optional) – FMU version; default None
author (str, optional) – FMU author; default None
description (str, optional) – System description; default None
license (str, optional) – FMU license; default “”
copyright (str, optional) – FMU copyright; default “”
fmu_name_suffix (str, optional) – FMU name suffix; default “”
- Returns:
FMU file path object
- Return type:
pathlib.Path
- class cosapp.tools.fmu.exporter.TimeIntegrator(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enum
Available time integrator for FMU export.
- EulerExplicit = 'Euler explicit'¶
- RK2 = 'Runge-Kutta 2'¶
- RK3 = 'Runge-Kutta 3'¶
- RK4 = 'Runge-Kutta 4'¶
- property driver: str¶
- property options: Dict[str, str]¶
- class cosapp.tools.fmu.exporter.Variable(name: str, pytype: str, fmutype: str, causality: Fmi2Causality, variability: Fmi2Variability | None = None)[source]¶
Bases:
NamedTuple
Variable attributes
- causality: Fmi2Causality¶
Alias for field number 3
- fmutype: str¶
Alias for field number 2
- name: str¶
Alias for field number 0
- pytype: str¶
Alias for field number 1
- variability: Fmi2Variability | None¶
Alias for field number 4
- class cosapp.tools.fmu.exporter.VariableType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enum
- Boolean = 'bool'¶
- Integer = 'int'¶
- Real = 'float'¶
- String = 'bytes'¶
- cosapp.tools.fmu.exporter.to_fmu(system: System, inputs: Iterable[str] = None, parameters: Iterable[str] = None, outputs: Iterable[str] = None, locals: Iterable[str] = None, time_integrator: TimeIntegrator | str = TimeIntegrator.RK4, nonlinear_solver: AbstractSolver | None = None, dest: Path | str = '.', python_env: Path | str | None = None, project_files: Iterable[str | Path] = {}, version: str | None = None, author: str | None = None, description: str | None = None, copyright: str | None = '', license: str | None = '', fmu_name_suffix: str = '') Path ¶
Export a system as CoSimulation FMU respecting FMI 2.0.
Inputs, parameters, outputs and locals are by default taken from inputs, inwards, outputs and outwards variables of the CoSApp system, respectively. If you wish to set an empty list, set the corresponding argument with a empty dictionary.
You can add a mathematical problem to the system by passing the proper nonlinear_solver. If it contains a RunSingleCase, its equations will be passed to the FMU.
- Parameters:
system (System) – System to be exported
inputs (Iterable[str], optional) – List of input variables with initial values; default None
parameters (Iterable[str], optional) – List of parameter variables with initial values; default None
outputs (Iterable[str], optional) – List of output variables with initial values; default None
locals (Iterable[str], optional) – List of local variables with initial values; default None
time_integrator (TimeIntegrator, optional) – Time integrator algorithm; default Runge-Kutta 4th order
nonlinear_solver (AbstractSolver, optional) – Non linear Driver to use for solving the system at a given instant
dest (str or Path, optional) – Destination folder; default current directory
python_env (str or Path, optional) – File listing the python dependency; default None
project_files (Iterable of str or Path, optional) – List of additional files to be included in the FMU; default no additional files
version (str, optional) – FMU version; default None
author (str, optional) – FMU author; default None
description (str, optional) – System description; default None
license (str, optional) – FMU license; default “”
copyright (str, optional) – FMU copyright; default “”
fmu_name_suffix (str, optional) – FMU name suffix; default “”
- Returns:
FMU file path object
- Return type:
pathlib.Path