Skip to content

Storage

StorageABC

Bases: ControllableMixin, PublishesStateMixin, ABC


              flowchart TD
              nrgise.components.StorageABC[StorageABC]
              nrgise.components.capabilities.controllable_mixin.ControllableMixin[ControllableMixin]
              nrgise.components.capabilities.publishes_state_mixin.PublishesStateMixin[PublishesStateMixin]
              nrgise.components.component_abc.ComponentABC[ComponentABC]

                              nrgise.components.capabilities.controllable_mixin.ControllableMixin --> nrgise.components.StorageABC
                                nrgise.components.component_abc.ComponentABC --> nrgise.components.capabilities.controllable_mixin.ControllableMixin
                

                nrgise.components.capabilities.publishes_state_mixin.PublishesStateMixin --> nrgise.components.StorageABC
                                nrgise.components.component_abc.ComponentABC --> nrgise.components.capabilities.publishes_state_mixin.PublishesStateMixin
                



              click nrgise.components.StorageABC href "" "nrgise.components.StorageABC"
              click nrgise.components.capabilities.controllable_mixin.ControllableMixin href "" "nrgise.components.capabilities.controllable_mixin.ControllableMixin"
              click nrgise.components.capabilities.publishes_state_mixin.PublishesStateMixin href "" "nrgise.components.capabilities.publishes_state_mixin.PublishesStateMixin"
              click nrgise.components.component_abc.ComponentABC href "" "nrgise.components.component_abc.ComponentABC"
            

Base class for storage components.

nrgise.components.StorageABC.capacity abstractmethod property writable

capacity: float

in kWh

nrgise.components.StorageABC.set_power_contribution abstractmethod

set_power_contribution(power: float) -> float

Sets the power (kW) of the storage during the upcoming simulated time step. Positive values cause a discharge of the storage, whereas negative values cause a charge.

Parameters:

Name Type Description Default
power float

The amount of power (kW) to charge or discharge. Positive = discharge; Negative = charge.

required

Returns: Actual power charged or discharged by the storage.


Battery

Battery(
    label: str,
    nom_power: float,
    capacity: float,
    time_delta_seconds: int,
    initial_soc: float = 0,
    efficiency_charge: float = 1,
    efficiency_discharge: float = 1,
)

Bases: StorageABC


              flowchart TD
              nrgise.components.Battery[Battery]
              nrgise.components.storage.storage_abc.StorageABC[StorageABC]
              nrgise.components.capabilities.controllable_mixin.ControllableMixin[ControllableMixin]
              nrgise.components.capabilities.publishes_state_mixin.PublishesStateMixin[PublishesStateMixin]
              nrgise.components.component_abc.ComponentABC[ComponentABC]

                              nrgise.components.storage.storage_abc.StorageABC --> nrgise.components.Battery
                                nrgise.components.capabilities.controllable_mixin.ControllableMixin --> nrgise.components.storage.storage_abc.StorageABC
                                nrgise.components.component_abc.ComponentABC --> nrgise.components.capabilities.controllable_mixin.ControllableMixin
                

                nrgise.components.capabilities.publishes_state_mixin.PublishesStateMixin --> nrgise.components.storage.storage_abc.StorageABC
                                nrgise.components.component_abc.ComponentABC --> nrgise.components.capabilities.publishes_state_mixin.PublishesStateMixin
                




              click nrgise.components.Battery href "" "nrgise.components.Battery"
              click nrgise.components.storage.storage_abc.StorageABC href "" "nrgise.components.storage.storage_abc.StorageABC"
              click nrgise.components.capabilities.controllable_mixin.ControllableMixin href "" "nrgise.components.capabilities.controllable_mixin.ControllableMixin"
              click nrgise.components.capabilities.publishes_state_mixin.PublishesStateMixin href "" "nrgise.components.capabilities.publishes_state_mixin.PublishesStateMixin"
              click nrgise.components.component_abc.ComponentABC href "" "nrgise.components.component_abc.ComponentABC"
            

A simple model of an energy storage. The model can be classified as energy reservoir model according to https://ieeexplore.ieee.org/document/8922750

Parameters:

Name Type Description Default
label str

An unique identifier for the component.

required
nom_power float

Maximum of power which can be handled by the storage in kW.

required
capacity float

The overall capacity of the storage in kWh.

required
time_delta_seconds int

The duration of one time step in seconds.

required
initial_soc float

State of charge, in [0,1]

0
efficiency_charge float

Defines the efficiency of the storage when charging. When set to 0.95, 5% of the energy is considered lost when charging.

1
efficiency_discharge float

Defines the efficiency of the storage when discharging.

1

nrgise.components.Battery.get_state

get_state() -> dict[str, float]

Returns the state of charge.

nrgise.components.Battery.reset

reset() -> None

Resets the storage into its initial state.

nrgise.components.Battery.set_power_contribution

set_power_contribution(power: float) -> float

Tries to apply requested power contribution (kW).

  1. Power limits are enforced.
  2. The state of charge is updated according to the applied power and the storage's capacity and efficiency.
  3. Power which was actually applied is returned.

AgingLinearCapacityWrapper

AgingLinearCapacityWrapper(
    storage: StorageABC,
    lifetime_in_years: float,
    max_cycles: int,
    eol: float,
    replace_storage_when_eol_reached: bool = False,
)

Bases: StorageWrapperABC


              flowchart TD
              nrgise.components.AgingLinearCapacityWrapper[AgingLinearCapacityWrapper]
              nrgise.components.storage.storage_wrapper_abc.StorageWrapperABC[StorageWrapperABC]
              nrgise.components.storage.storage_abc.StorageABC[StorageABC]
              nrgise.components.capabilities.controllable_mixin.ControllableMixin[ControllableMixin]
              nrgise.components.capabilities.publishes_state_mixin.PublishesStateMixin[PublishesStateMixin]
              nrgise.components.component_abc.ComponentABC[ComponentABC]

                              nrgise.components.storage.storage_wrapper_abc.StorageWrapperABC --> nrgise.components.AgingLinearCapacityWrapper
                                nrgise.components.storage.storage_abc.StorageABC --> nrgise.components.storage.storage_wrapper_abc.StorageWrapperABC
                                nrgise.components.capabilities.controllable_mixin.ControllableMixin --> nrgise.components.storage.storage_abc.StorageABC
                                nrgise.components.component_abc.ComponentABC --> nrgise.components.capabilities.controllable_mixin.ControllableMixin
                

                nrgise.components.capabilities.publishes_state_mixin.PublishesStateMixin --> nrgise.components.storage.storage_abc.StorageABC
                                nrgise.components.component_abc.ComponentABC --> nrgise.components.capabilities.publishes_state_mixin.PublishesStateMixin
                





              click nrgise.components.AgingLinearCapacityWrapper href "" "nrgise.components.AgingLinearCapacityWrapper"
              click nrgise.components.storage.storage_wrapper_abc.StorageWrapperABC href "" "nrgise.components.storage.storage_wrapper_abc.StorageWrapperABC"
              click nrgise.components.storage.storage_abc.StorageABC href "" "nrgise.components.storage.storage_abc.StorageABC"
              click nrgise.components.capabilities.controllable_mixin.ControllableMixin href "" "nrgise.components.capabilities.controllable_mixin.ControllableMixin"
              click nrgise.components.capabilities.publishes_state_mixin.PublishesStateMixin href "" "nrgise.components.capabilities.publishes_state_mixin.PublishesStateMixin"
              click nrgise.components.component_abc.ComponentABC href "" "nrgise.components.component_abc.ComponentABC"
            

A wrapper for a StorageABC which implements a linear aging model. This Aging Model performs cyclic and calendric aging linearly. For both the calendric and the cyclic aging, the capacity decrease is calculated. However, only one of the two factors is used to age the capacity: the one that caused the larger loss in the state of health (which is due to the fact that both parameters max_cycles and lifetime_in_years are intertwined anyway).

Note: The cycling counting is done by the actual capacity and not by the initial capacity here! Keep in mind that reducing the capacity also reduces the absolute electricity in the storage.

Parameters:

Name Type Description Default
eol float

Defines the fraction of capacity which is available when the storage reaches its maximum lifetime or maximum cycles

required
replace_storage_when_eol_reached bool

Replaces the storage by calling the reset() method when maximum lifetime or cycles are reached. This might be used in longer simulation periods where storage replacements are considered.

False
storage StorageABC

The StorageABC which should be wrapped to perform linear aging

required
lifetime_in_years float

The maximum lifetime of the storage in years. After this time, the storage is considered to be at its end of life (EOL).

required
max_cycles int

The maximum number of equivalent cycles the storage can perform before it is considered to be at its end of life (EOL).

required
Example
battery = StorageSystemEnergyReservoir(...)

aging_battery = AgingLinearCapacityWrapper(
    storage=battery,
    lifetime_in_years=10,
    max_cycles=7000,
    eol=0.7,
    replace_storage_when_eol_reached=True,
)

es.add_components(..., aging_battery)

StorageWrapperABC

StorageWrapperABC(storage: StorageABC)

Bases: StorageABC, ABC


              flowchart TD
              nrgise.components.StorageWrapperABC[StorageWrapperABC]
              nrgise.components.storage.storage_abc.StorageABC[StorageABC]
              nrgise.components.capabilities.controllable_mixin.ControllableMixin[ControllableMixin]
              nrgise.components.capabilities.publishes_state_mixin.PublishesStateMixin[PublishesStateMixin]
              nrgise.components.component_abc.ComponentABC[ComponentABC]

                              nrgise.components.storage.storage_abc.StorageABC --> nrgise.components.StorageWrapperABC
                                nrgise.components.capabilities.controllable_mixin.ControllableMixin --> nrgise.components.storage.storage_abc.StorageABC
                                nrgise.components.component_abc.ComponentABC --> nrgise.components.capabilities.controllable_mixin.ControllableMixin
                

                nrgise.components.capabilities.publishes_state_mixin.PublishesStateMixin --> nrgise.components.storage.storage_abc.StorageABC
                                nrgise.components.component_abc.ComponentABC --> nrgise.components.capabilities.publishes_state_mixin.PublishesStateMixin
                




              click nrgise.components.StorageWrapperABC href "" "nrgise.components.StorageWrapperABC"
              click nrgise.components.storage.storage_abc.StorageABC href "" "nrgise.components.storage.storage_abc.StorageABC"
              click nrgise.components.capabilities.controllable_mixin.ControllableMixin href "" "nrgise.components.capabilities.controllable_mixin.ControllableMixin"
              click nrgise.components.capabilities.publishes_state_mixin.PublishesStateMixin href "" "nrgise.components.capabilities.publishes_state_mixin.PublishesStateMixin"
              click nrgise.components.component_abc.ComponentABC href "" "nrgise.components.component_abc.ComponentABC"
            

Used to implement wrappers which extend the functionality of a StorageABC. It is an implementation of the decorator pattern. The pattern was used for a similar usage in gymnasium: https://gymnasium.farama.org/_modules/gymnasium/core/#Wrapper


helper

nrgise.components.storage.helper.calc_equivalent_cycle

calc_equivalent_cycle(
    power: float,
    time_delta_seconds: int,
    energy_capacity: float,
) -> float

This way of calculating the full equivalent cycles was defined in 10.1016/j.est.2022.105634 (We adapted it to work with energy capacity not charge capacity)

Returns:

Type Description
float

Number of full equivalent cycles that the battery performed during this timestep