Skip to content

EnergySystem

EnergySystem(time_index: DatetimeIndex)

The EnergySystem represents the main container for the local energy system to be modeled. All components (e.g. storage, grid, pv_system) of the system to be modelled have to be added to the EnergySystem. The concept of the EnergySystem implemented here is based on the basic ideas of an EnergySystem in oemof (see https://oemof-solph.readthedocs.io/en/latest/usage.html#set-up-an-energy-system).

Parameters:

Name Type Description Default
time_index DatetimeIndex

Pandas DatetimeIndex which defines the datetime range looped over when running a simulation.

required

nrgise.EnergySystem.add_components

add_components(*args: ComponentABC) -> None

Adds one or more Component to the EnergySystem.

Parameters:

Name Type Description Default
args ComponentABC

One or more components to add to the EnergySystem.

()
Example
es.add_components(grid, load, aging_battery, pv_system)

nrgise.EnergySystem.get_component_by_label

get_component_by_label(
    label: str,
) -> Optional[ComponentABC]

Returns a component which matches the label.

Parameters:

Name Type Description Default
label str

The label to search for.

required

Returns: The Component found or None

nrgise.EnergySystem.get_components_by_instance

get_components_by_instance(instance: Type[T]) -> list[T]

Searches self.components for all objects of type instance and returns them as a list.

Parameters:

Name Type Description Default
instance Type[T]

instance to search for e.g. Battery

required

Returns: List of objects of type of the instance

nrgise.EnergySystem.get_grid_builder

get_grid_builder() -> GridBuilderABC

Returns the GridBuilder of the EnergySystem. Could be GridBuilder, Grid, Generator, ...

Returns:

Type Description
GridBuilderABC

The grid builder.

nrgise.EnergySystem.reset

reset() -> State

Resets the EnergySystem by:

  • Setting controllable components which receive actions from a controller
  • Calling reset() on all components of this EnergySystem which implement a reset() method.
  • Setting the time to 0

Returns:

Type Description
State

The initial State of the EnergySystem

nrgise.EnergySystem.simulate_one_time_step

simulate_one_time_step(
    action: dict[str, float],
) -> tuple[dict[str, float], Optional[State], bool]

This method is used by the Simulation and can be considered the core method which performs the simulation of the energy system. It executes:

  1. The action is dispatched to the corresponding controllable components. The actual power contribution is returned (note that this can differ from the requested action due to physical constraints of the controllable components).
  2. The time step is incremented. This time step update is propagated to all components which implement TimeStepAwareMixin (e.g. if they contain a data profile which must be stepped through)
  3. By performing the previous steps, the power system is now in a new State. This is queried. In addition, information is requested if the simulation has reached its end.

Returns:

Type Description
dict[str, float]

The power contribution actually deliverd by the controllable in this simulation step.

Optional[State]

State for next simulation step (or None if the simulation is done)

bool

Is the simulation done or not? Defined by if the time step exceeds the last time index of the EnergySystem.

nrgise.EnergySystem.stretch_time

stretch_time(target_end_date: Timestamp) -> None

Extend the time index and components implementing DataProfileMixin to a target_end_date.

Existing data profiles are repeated until the target date. This is useful for simulations over a longer period than the available input data, for example when investigating aging effects.

Parameters:

Name Type Description Default
target_end_date Timestamp

Timestamp through which the profiles are repeated.

required