Simulationmodel
EnModel
¶
Bases: EnBaseModel
Represents an energy model that solves optimization problems for a given energy system using a specified solver.
This class is designed to manage and execute energy model optimization tasks. It provides configuration options for the underlying solver, including the ability to enable verbose output and specify additional solver arguments. The focus is on integrating with a defined energy system and ensuring that the energy system provided is not empty or undefined.
Attributes:
Name | Type | Description |
---|---|---|
energysystem |
EnEnergysystem
|
The energy system that the model operates upon. This is a required parameter. |
solver |
Solver
|
The solver to use for optimization tasks. Defaults to the Gurobi solver. |
solver_verbose |
bool
|
Specifies whether to enable verbose output from the solver during runtime. Defaults to True. |
solver_kwargs |
dict[str, bool | str | int | float] | None
|
Extra configuration arguments for the solver, such as gap limits or other solver-specific parameters. Defaults to None. |
Source code in backend/app/ensys/components/model.py
es_is_not_none(v)
classmethod
¶
Validates the 'energysystem' field during class instantiation to ensure it is not set to None. This method is called automatically by the Pydantic validator mechanism.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
v
|
Any
|
The value provided for the 'energysystem' field. |
required |
Returns:
Type | Description |
---|---|
Any
|
The validated 'energysystem' value if it is not None. |
Raises:
Type | Description |
---|---|
ValueError
|
If the 'energysystem' value is None. |