scenario
EnScenario
¶
Bases: BaseModel
Represents an energy scenario with detailed specifications and attributes.
The EnScenario class models a scenario in an energy system setting, incorporating various attributes such as name, start date, time steps, interval, and associated energy system models. This facilitates structured handling of scenario data within an energy modeling system.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
Name of the energy scenario. Must be between 1 and 100 characters. |
start_date |
date
|
The starting date for the scenario. Defaults to the current date. |
time_steps |
int | None
|
The number of time steps in the scenario. Can be None for no specific limit or defaults to 8760. |
interval |
float
|
The interval between each time step in hours. Defaults to 1.0. |
project_id |
int
|
Identifier for the project to which the scenario belongs. |
energysystem_model |
EnEnergysystem
|
The associated energy system model for the scenario. |
Source code in backend/app/scenario/model.py
EnScenarioDB
¶
Bases: SQLModel
Represents the database model for energy scenario information.
This class defines a database model for storing information about energy scenarios. It uses SQLModel with table mapping enabled to represent the corresponding table in the database. The class includes various fields that describe properties of the energy scenario, such as its name, associated project and user IDs, start date, time steps, and other relevant details.
Attributes:
Name | Type | Description |
---|---|---|
id |
int
|
Primary key of the scenario record. |
name |
str
|
Name of the energy scenario must be between 1 and 100 characters in length. |
start_date |
date
|
Start date of the energy scenario. This is a required field. |
time_steps |
int | None
|
Number of time steps in the energy scenario. Defaults to 8760 if not provided and is nullable. |
interval |
float
|
Time interval associated with the energy scenario. Defaults to 1. |
project_id |
int
|
Foreign key referencing the associated project for the scenario. |
user_id |
int
|
Foreign key referencing the user associated with the scenario. |
energysystem_model |
EnEnergysystem
|
JSONB column storing the energy system model associated with the scenario. Defaults to an empty dictionary. |
Source code in backend/app/scenario/model.py
EnScenarioUpdate
¶
Bases: EnScenario
Represents an updated energy scenario with validated parameters.
This class extends the functionality of the EnScenario
class to allow for
scenario updates with specific attributes constrained by validation requirements.
It is primarily used for defining and updating the parameters of an energy simulation
scenario, ensuring proper formats and validations such as field lengths and data type
constraints.
Attributes:
Name | Type | Description |
---|---|---|
name |
str | None
|
Optional name of the scenario, which must be a string with a minimum length of 1 character and a maximum length of 100 characters. |
interval |
float | None
|
Optional interval defining the time step size, where the value is a float. |
start_date |
date | None
|
Optional start date for the scenario, represented as a date object. |
time_steps |
int | None
|
Optional total number of time steps in the simulation. |
energysystem_model |
EnEnergysystem | None
|
Optional reference to an energy system model associated with the scenario. |
project_id |
None
|
Reserved attribute for the project ID, currently none. |
user_id |
None
|
Reserved attribute for the user ID, currently none. |