estim8.models#

This module implements the model classes for the Estim8 package.

class estim8.models.Estim8Model(default_parameters={}, r_tol=0.0001)#

Bases: ABC

Methods

retrieve_variables()

Retrieve model parameters and observables.

simulate(t0, t_end, stepsize[, parameters, ...])

Simulate the model.

abstractmethod retrieve_variables()#

Retrieve model parameters and observables.

abstractmethod simulate(t0: float, t_end: float, stepsize: float, parameters: Dict[str, float] = {}, observe: List[str] | None = None, replicate_ID: str | None = None) Simulation#

Simulate the model.

Parameters:
t0float

Start time of the simulation.

t_endfloat

End time of the simulation.

stepsizefloat

Time step size for the simulation.

parametersdict

Parameters for the simulation.

observelist

List of observables to record during the simulation.

replicate_IDstr, optional

Replicate ID for the simulation, by default SINGLE_ID.

Returns:
Simulation

The simulation results.

class estim8.models.FmuModel(path: str, fmi_type: Literal['ModelExchange', 'CoSimulation'] = 'ModelExchange', default_parameters: dict = {}, r_tol=0.0001, memory_threshold_mb: float | None = None)#

Bases: Estim8Model

Attributes:
fmi_type

Get the FMI type.

Methods

cleanup()

Clean up temporary files and directories.

freeInstance()

Free the FMU instance.

instantiate_fmu()

Instantiate the FMU from the copied file.

retrieve_variables()

Retrieve model parameters and observables.

simulate(t0, t_end, stepsize[, parameters, ...])

Simulate the FMU model.

cleanup()#

Clean up temporary files and directories.

property fmi_type#

Get the FMI type.

Returns:
str

The FMI type.

freeInstance()#

Free the FMU instance.

instantiate_fmu()#

Instantiate the FMU from the copied file.

retrieve_variables()#

Retrieve model parameters and observables.

simulate(t0: float, t_end: float, stepsize: float, parameters: dict[str, float] = {}, observe: list[str] | None = None, replicate_ID: str | None = None, r_tol: float | None = None, solver: Literal['CVode', 'Euler'] = 'CVode') Simulation#

Simulate the FMU model.

Parameters:
t0float

Start time of the simulation.

t_endfloat

End time of the simulation.

stepsizefloat

Time step size for the simulation.

parametersdict, optional

Parameters for the simulation, by default {}.

observelist, optional

List of observables to record during the simulation, by default None.

r_tolfloat, optional

Relative tolerance for the simulation, by default None.

solverLiteral[“CVode”, “Euler”], optional

Solver to use for the simulation, by default “CVode”.

replicate_IDstr, optional

Replicate ID for the simulation, by default SINGLE_ID.

Returns:
Simulation

The simulation results.