Skip to content

st_storage

Classes:

AdditionalConstraintOperator

Possible constraint operators.

Attributes:

  • LESS

    less than (<).

  • GREATER

    greater than (>).

  • EQUAL

    equal to (=).

AdditionalConstraintVariable

Variables considered for the constraint.

Attributes:

  • WITHDRAWAL

    The constraint considers a set of withdrawal values.

  • INJECTION

    The constraint considers a set of injection values.

  • NETTING

    The constraint consider a set of hybrid variables equivalent to the variation of the level when there are no inflows.

Occurrence dataclass

Occurrence(hours: list[int])

Occurence of the additional constraint.

Attributes:

  • hours (list[int]) –

    List of the index of the hours in the week where a constraint is applied.

STStorage

STStorage(
    storage_service: BaseShortTermStorageService,
    area_id: str,
    name: str,
    properties: Optional[STStorageProperties] = None,
    constraints: Optional[dict[str, STStorageAdditionalConstraint]] = None,
)

Short-term storage object of modelling.

This object allows to represent the management of any short-term storage with the following main characteristics :

  • Storages managed on cycles that are sub-multiples of the Antares optimization window (week or day). By cycle we mean that at the end of the cycle the stock must return to the level at the start of the cycle
  • Rule curves that frame the admissible levels hour by hour - the authorized range is a subset of the 0-100 range hourly.
  • PMAX chronicles for storage and destocking.
  • Natural inflows (case of open cycle Pump-Storage Plants).

Methods:

Attributes:

Source code in src/antares/craft/model/st_storage.py
def __init__(
    self,
    storage_service: BaseShortTermStorageService,
    area_id: str,
    name: str,
    properties: Optional[STStorageProperties] = None,
    constraints: Optional[dict[str, STStorageAdditionalConstraint]] = None,
):
    self._area_id: str = area_id
    self._storage_service: BaseShortTermStorageService = storage_service
    self._name: str = name
    self._id: str = transform_name_to_id(name)
    self._properties: STStorageProperties = properties or STStorageProperties()
    self._constraints = constraints or {}

area_id property

area_id: str

Area to which the short-term storage belongs to.

id property

id: str

ID of the short-term storage.

name property

name: str

Name of the short-term storage.

properties property

properties: STStorageProperties

Properties of the short-term storage.

create_constraints

create_constraints(constraints: list[STStorageAdditionalConstraint]) -> None

Create a new additional constraints.

Parameters:

Source code in src/antares/craft/model/st_storage.py
def create_constraints(self, constraints: list[STStorageAdditionalConstraint]) -> None:
    """Create a new additional constraints.

    Args:
        constraints: The list of new additional constraints.
    """
    new_constraints = self._storage_service.create_constraints(self._area_id, self._id, constraints)
    for constraint in new_constraints:
        self._constraints[constraint.id] = constraint

delete_constraints

delete_constraints(constraint_ids: list[str]) -> None

Delete additional constraints.

Parameters:

  • constraint_ids

    (list[str]) –

    The list of the constraint IDs to delete.

Source code in src/antares/craft/model/st_storage.py
def delete_constraints(self, constraint_ids: list[str]) -> None:
    """Delete additional constraints.

    Args:
        constraint_ids: The list of the constraint IDs to delete.
    """
    self._storage_service.delete_constraints(self._area_id, self._id, constraint_ids)
    for ids in constraint_ids:
        del self._constraints[ids]

get_constraint_term

get_constraint_term(constraint_id: str) -> DataFrame

Get constraint term.

Parameters:

  • constraint_id

    (str) –

    The constraint ID.

Returns:

  • DataFrame

    The constraint term dataframe.

Source code in src/antares/craft/model/st_storage.py
def get_constraint_term(self, constraint_id: str) -> pd.DataFrame:
    """Get constraint term.

    Args:
        constraint_id: The constraint ID.

    Returns:
        The constraint term dataframe.
    """
    return self._storage_service.get_constraint_term(self._area_id, self._id, constraint_id)

get_constraints

Get the associated constraints.

Returns:

Source code in src/antares/craft/model/st_storage.py
def get_constraints(self) -> MappingProxyType[str, STStorageAdditionalConstraint]:
    """Get the associated constraints.

    Returns:
        A mapping of the additional constraint ID and the object `STStorageAdditionalConstraint`.
    """
    return MappingProxyType(self._constraints)

get_cost_injection

get_cost_injection() -> DataFrame

Get the injection cost time series.

Returns:

  • DataFrame

    The injection cost dataframe.

Source code in src/antares/craft/model/st_storage.py
def get_cost_injection(self) -> pd.DataFrame:
    """Get the injection cost time series.

    Returns:
        The injection cost dataframe.
    """
    return self._storage_service.get_storage_matrix(self, STStorageMatrixName.COST_INJECTION)

get_cost_level

get_cost_level() -> DataFrame

Get the level cost time series.

Returns:

  • DataFrame

    The level cost dataframe.

Source code in src/antares/craft/model/st_storage.py
def get_cost_level(self) -> pd.DataFrame:
    """Get the level cost time series.

    Returns:
        The level cost dataframe.
    """
    return self._storage_service.get_storage_matrix(self, STStorageMatrixName.COST_LEVEL)

get_cost_variation_injection

get_cost_variation_injection() -> DataFrame

Get the variation injection cost time series.

Returns:

  • DataFrame

    The variation injection cost dataframe.

Source code in src/antares/craft/model/st_storage.py
def get_cost_variation_injection(self) -> pd.DataFrame:
    """Get the variation injection cost time series.

    Returns:
        The variation injection cost dataframe.
    """
    return self._storage_service.get_storage_matrix(self, STStorageMatrixName.COST_VARIATION_INJECTION)

get_cost_variation_withdrawal

get_cost_variation_withdrawal() -> DataFrame

Get the variation withdrawal cost time series.

Returns:

  • DataFrame

    The variation withdrawal cost dataframe.

Source code in src/antares/craft/model/st_storage.py
def get_cost_variation_withdrawal(self) -> pd.DataFrame:
    """Get the variation withdrawal cost time series.

    Returns:
        The variation withdrawal cost dataframe.
    """
    return self._storage_service.get_storage_matrix(self, STStorageMatrixName.COST_VARIATION_WITHDRAWAL)

get_cost_withdrawal

get_cost_withdrawal() -> DataFrame

Get the withdrawal cost time series.

Returns:

  • DataFrame

    The withdrawal cost dataframe.

Source code in src/antares/craft/model/st_storage.py
def get_cost_withdrawal(self) -> pd.DataFrame:
    """Get the withdrawal cost time series.

    Returns:
        The withdrawal cost dataframe.
    """
    return self._storage_service.get_storage_matrix(self, STStorageMatrixName.COST_WITHDRAWAL)

get_lower_rule_curve

get_lower_rule_curve() -> DataFrame

Get the lower rule curve time series.

Returns:

  • DataFrame

    The lower rule curve dataframe.

Source code in src/antares/craft/model/st_storage.py
def get_lower_rule_curve(self) -> pd.DataFrame:
    """Get the lower rule curve time series.

    Returns:
        The lower rule curve dataframe.
    """
    return self._storage_service.get_storage_matrix(self, STStorageMatrixName.LOWER_CURVE_RULE)

get_pmax_injection

get_pmax_injection() -> DataFrame

Get the maximum injection power time series.

Returns:

  • DataFrame

    The maximum injection power dataframe.

Source code in src/antares/craft/model/st_storage.py
def get_pmax_injection(self) -> pd.DataFrame:
    """Get the maximum injection power time series.

    Returns:
        The maximum injection power dataframe.
    """
    return self._storage_service.get_storage_matrix(self, STStorageMatrixName.PMAX_INJECTION)

get_pmax_withdrawal

get_pmax_withdrawal() -> DataFrame

Get the maximum withdrawal power time series.

Returns:

  • DataFrame

    The maximum withdrawal power dataframe.

Source code in src/antares/craft/model/st_storage.py
def get_pmax_withdrawal(self) -> pd.DataFrame:
    """Get the maximum withdrawal power time series.

    Returns:
        The maximum withdrawal power dataframe.
    """
    return self._storage_service.get_storage_matrix(self, STStorageMatrixName.PMAX_WITHDRAWAL)

get_storage_inflows

get_storage_inflows() -> DataFrame

Get the natural inflow time series.

Returns:

  • DataFrame

    The natural inflow dataframe.

Source code in src/antares/craft/model/st_storage.py
def get_storage_inflows(self) -> pd.DataFrame:
    """Get the natural inflow time series.

    Returns:
        The natural inflow dataframe.
    """
    return self._storage_service.get_storage_matrix(self, STStorageMatrixName.INFLOWS)

get_upper_rule_curve

get_upper_rule_curve() -> DataFrame

Get the upper rule curve time series.

Returns:

  • DataFrame

    The upper rule curve dataframe.

Source code in src/antares/craft/model/st_storage.py
def get_upper_rule_curve(self) -> pd.DataFrame:
    """Get the upper rule curve time series.

    Returns:
        The upper rule curve dataframe.
    """
    return self._storage_service.get_storage_matrix(self, STStorageMatrixName.UPPER_RULE_CURVE)

set_constraint_term

set_constraint_term(constraint_id: str, matrix: DataFrame) -> None

Set constraint term.

Parameters:

  • constraint_id

    (str) –

    The constraint ID.

  • matrix

    (DataFrame) –

    The new constraint dataframe.

Source code in src/antares/craft/model/st_storage.py
def set_constraint_term(self, constraint_id: str, matrix: pd.DataFrame) -> None:
    """Set constraint term.

    Args:
        constraint_id: The constraint ID.
        matrix: The new constraint dataframe.
    """
    self._storage_service.set_constraint_term(self._area_id, self._id, constraint_id, matrix)

set_cost_injection

set_cost_injection(cost_injection_matrix: DataFrame) -> None

Set cost injection time series.

Parameters:

  • cost_injection_matrix

    (DataFrame) –

    The new cost injection dataframe.

Source code in src/antares/craft/model/st_storage.py
def set_cost_injection(self, cost_injection_matrix: pd.DataFrame) -> None:
    """Set cost injection time series.

    Args:
        cost_injection_matrix: The new cost injection dataframe.
    """
    self._storage_service.set_storage_matrix(self, STStorageMatrixName.COST_INJECTION, cost_injection_matrix)

set_cost_level

set_cost_level(cost_level_matrix: DataFrame) -> None

Set cost level time series.

Parameters:

  • cost_level_matrix

    (DataFrame) –

    The new cost level dataframe.

Source code in src/antares/craft/model/st_storage.py
def set_cost_level(self, cost_level_matrix: pd.DataFrame) -> None:
    """Set cost level time series.

    Args:
        cost_level_matrix: The new cost level dataframe.
    """
    self._storage_service.set_storage_matrix(self, STStorageMatrixName.COST_LEVEL, cost_level_matrix)

set_cost_variation_injection

set_cost_variation_injection(cost_variation_injection_matrix: DataFrame) -> None

Set cost of variation injection time series.

Parameters:

  • cost_variation_injection_matrix

    (DataFrame) –

    The new cost of variation injection dataframe.

Source code in src/antares/craft/model/st_storage.py
def set_cost_variation_injection(self, cost_variation_injection_matrix: pd.DataFrame) -> None:
    """Set cost of variation injection time series.

    Args:
        cost_variation_injection_matrix: The new cost of variation injection dataframe.
    """
    self._storage_service.set_storage_matrix(
        self, STStorageMatrixName.COST_VARIATION_INJECTION, cost_variation_injection_matrix
    )

set_cost_variation_withdrawal

set_cost_variation_withdrawal(cost_variation_withdrawal_matrix: DataFrame) -> None

Set cost of variation withdrawal time series.

Parameters:

  • cost_variation_withdrawal_matrix

    (DataFrame) –

    The new cost of variation withdrawal dataframe.

Source code in src/antares/craft/model/st_storage.py
def set_cost_variation_withdrawal(self, cost_variation_withdrawal_matrix: pd.DataFrame) -> None:
    """Set cost of variation withdrawal time series.

    Args:
        cost_variation_withdrawal_matrix: The new cost of variation withdrawal dataframe.
    """
    self._storage_service.set_storage_matrix(
        self, STStorageMatrixName.COST_VARIATION_WITHDRAWAL, cost_variation_withdrawal_matrix
    )

set_cost_withdrawal

set_cost_withdrawal(cost_withdrawal_matrix: DataFrame) -> None

Set cost withdrawal time series.

Parameters:

  • cost_withdrawal_matrix

    (DataFrame) –

    The new cost withdrawal dataframe.

Source code in src/antares/craft/model/st_storage.py
def set_cost_withdrawal(self, cost_withdrawal_matrix: pd.DataFrame) -> None:
    """Set cost withdrawal time series.

    Args:
        cost_withdrawal_matrix: The new cost withdrawal dataframe.
    """
    self._storage_service.set_storage_matrix(self, STStorageMatrixName.COST_WITHDRAWAL, cost_withdrawal_matrix)

set_lower_rule_curve

set_lower_rule_curve(lower_rule_curve_matrix: DataFrame) -> None

Set the lower rule curve time series.

Parameters:

  • lower_rule_curve_matrix

    (DataFrame) –

    The new lower rule curve dataframe.

Source code in src/antares/craft/model/st_storage.py
def set_lower_rule_curve(self, lower_rule_curve_matrix: pd.DataFrame) -> None:
    """Set the lower rule curve time series.

    Args:
        lower_rule_curve_matrix: The new lower rule curve dataframe.
    """
    self._storage_service.set_storage_matrix(self, STStorageMatrixName.LOWER_CURVE_RULE, lower_rule_curve_matrix)

set_pmax_injection

set_pmax_injection(p_max_injection_matrix: DataFrame) -> None

Set the maximum injection power time series.

Parameters:

  • p_max_injection_matrix

    (DataFrame) –

    The new maximum injection power dataframe.

Source code in src/antares/craft/model/st_storage.py
def set_pmax_injection(self, p_max_injection_matrix: pd.DataFrame) -> None:
    """Set the maximum injection power time series.

    Args:
        p_max_injection_matrix: The new maximum injection power dataframe.
    """
    self._storage_service.set_storage_matrix(self, STStorageMatrixName.PMAX_INJECTION, p_max_injection_matrix)

set_pmax_withdrawal

set_pmax_withdrawal(p_max_withdrawal_matrix: DataFrame) -> None

Set the maximum withdrawal power time series.

Parameters:

  • p_max_withdrawal_matrix

    (DataFrame) –

    The new maximum injection power dataframe.

Source code in src/antares/craft/model/st_storage.py
def set_pmax_withdrawal(self, p_max_withdrawal_matrix: pd.DataFrame) -> None:
    """Set the maximum withdrawal power time series.

    Args:
        p_max_withdrawal_matrix: The new maximum injection power dataframe.
    """
    self._storage_service.set_storage_matrix(self, STStorageMatrixName.PMAX_WITHDRAWAL, p_max_withdrawal_matrix)

set_storage_inflows

set_storage_inflows(inflows_matrix: DataFrame) -> None

Set storage inflows time series.

Parameters:

  • inflows_matrix

    (DataFrame) –

    The new storage inflows dataframe.

Source code in src/antares/craft/model/st_storage.py
def set_storage_inflows(self, inflows_matrix: pd.DataFrame) -> None:
    """Set storage inflows time series.

    Args:
        inflows_matrix: The new storage inflows dataframe.
    """
    self._storage_service.set_storage_matrix(self, STStorageMatrixName.INFLOWS, inflows_matrix)

set_upper_rule_curve

set_upper_rule_curve(upper_rule_curve_matrix: DataFrame) -> None

Set the upper rule curve time series.

Parameters:

  • upper_rule_curve_matrix

    (DataFrame) –

    The new upper rule curve dataframe.

Source code in src/antares/craft/model/st_storage.py
def set_upper_rule_curve(self, upper_rule_curve_matrix: pd.DataFrame) -> None:
    """Set the upper rule curve time series.

    Args:
        upper_rule_curve_matrix: The new upper rule curve dataframe.
    """
    self._storage_service.set_storage_matrix(self, STStorageMatrixName.UPPER_RULE_CURVE, upper_rule_curve_matrix)

update_constraint

Update an additional constraint.

Parameters:

Returns:

Source code in src/antares/craft/model/st_storage.py
def update_constraint(
    self, constraint_id: str, constraint: STStorageAdditionalConstraintUpdate
) -> STStorageAdditionalConstraint:
    """Update an additional constraint.

    Args:
        constraint_id: The constraint ID.
        constraint: The new constraint update.

    Returns:
        The updated constraint.
    """
    updated_constraints = self._storage_service.update_st_storages_constraints({self: {constraint_id: constraint}})
    updated_constraint = updated_constraints[self.area_id][self.id][constraint_id]
    self._constraints[constraint_id] = updated_constraint
    return updated_constraint

update_properties

Update short-term storage properties.

Parameters:

Returns:

Source code in src/antares/craft/model/st_storage.py
def update_properties(self, properties: STStoragePropertiesUpdate) -> STStorageProperties:
    """Update short-term storage properties.

    Args:
        properties: The properties to update.

    Returns:
        The updated properties.
    """
    new_properties = self._storage_service.update_st_storages_properties({self: properties})
    self._properties = new_properties[self]
    return self._properties

STStorageAdditionalConstraint dataclass

STStorageAdditionalConstraint(
    name: str,
    variable: AdditionalConstraintVariable = NETTING,
    operator: AdditionalConstraintOperator = LESS,
    occurrences: list[Occurrence] = list(),
    enabled: bool = True,
)

Short-term storage additional constraint.

Attributes:

  • id (str) –

    ID of the additional constraint.

  • name (str) –

    Name of the additional constraint.

  • variable (AdditionalConstraintVariable) –

    Variable considered for the constraint (WITHDRAWAL, INJECTION or NETTING).

  • operator (AdditionalConstraintOperator) –

    Mathematical operator defining the constraint (LESS, GREATER or EQUAL).

  • occurrences (list[Occurrence]) –

    List of list of hours where the constraint is applied.

  • enabled (bool) –

    Whether the constraint is considered.

STStorageAdditionalConstraintUpdate dataclass

STStorageAdditionalConstraintUpdate(
    variable: Optional[AdditionalConstraintVariable] = None,
    operator: Optional[AdditionalConstraintOperator] = None,
    occurrences: Optional[list[Occurrence]] = None,
    enabled: Optional[bool] = None,
)

Short-term storage additional constraint update.

See the class STStorageAdditionalConstraint for more details on the parameters.

STStorageGroup

Short-term storage group possibilities.

Attributes:

  • PSP_OPEN

    Open cycle Pump-Storage Plants.

  • PSP_CLOSED

    Closed cycle Pump-Storage Plants.

  • PONDAGE

    Small water storage behind the weir of a run-of-the-river hydroelectric power plant

  • BATTERY

    Battery.

  • OTHER1

    Other 1.

  • OTHER2

    Other 2.

  • OTHER3

    Other 3.

  • OTHER4

    Other 4.

  • OTHER5

    Other 5.

STStorageProperties dataclass

STStorageProperties(
    group: str = value,
    injection_nominal_capacity: float = 0,
    withdrawal_nominal_capacity: float = 0,
    reservoir_capacity: float = 0,
    efficiency: float = 1,
    initial_level: float = 0.5,
    initial_level_optim: bool = False,
    enabled: bool = True,
    efficiency_withdrawal: Optional[float] = None,
    penalize_variation_injection: Optional[bool] = None,
    penalize_variation_withdrawal: Optional[bool] = None,
    allow_overflow: Optional[bool] = None,
)

Short-term storage properties.

Attributes:

  • group (str) –

    Group of short term storage (PSP_OPEN, PSP_CLOSED, PONDAGE, BATTERY or OTHER).

  • injection_nominal_capacity (float) –

    The maximal flow in MW that can be injected into the storage.

  • withdrawal_nominal_capacity (float) –

    The maximal flow in MW that can be withdraw from the storage.

  • reservoir_capacity (float) –

    The maximal capacity in MWh of the storage.

  • efficiency (float) –

    The injection energy efficiency which is the ratio between the stored energy and the energy taken from the system.

  • initial_level (float) –

    To be considered only if initial_level_optim = False, in this case corresponds to the ratio of the storage level between empty 0 and full 1.

  • initial_level_optim (bool) –

    Whether to allow reoptimization of the initial storage level each week. In this case the level is discontinuous between weeks. Otherwise, the initial level is imposed by the user and is identical each week.

  • enabled (bool) –

    Whether the storage is included in the model.

  • efficiency_withdrawal (Optional[float]) –

    The withdrawal energy efficiency which is the ratio between the stored energy and the energy returned to the system.

  • penalize_variation_injection (Optional[bool]) –

    Whether to create new variables to penalize the variation in the injection flowrate.

  • penalize_variation_withdrawal (Optional[bool]) –

    Whether to create new variables to penalize the variation in the withdrawal flowrate.

  • allow_overflow (Optional[bool]) –

    Whether to allow overflow of the storage.

STStoragePropertiesUpdate dataclass

STStoragePropertiesUpdate(
    group: Optional[str] = None,
    injection_nominal_capacity: Optional[float] = None,
    withdrawal_nominal_capacity: Optional[float] = None,
    reservoir_capacity: Optional[float] = None,
    efficiency: Optional[float] = None,
    initial_level: Optional[float] = None,
    initial_level_optim: Optional[bool] = None,
    enabled: Optional[bool] = None,
    efficiency_withdrawal: Optional[float] = None,
    penalize_variation_injection: Optional[bool] = None,
    penalize_variation_withdrawal: Optional[bool] = None,
    allow_overflow: Optional[bool] = None,
)

Short-term storage properties update.

Attributes:

  • group (Optional[str]) –

    Group of short term storage (PSP_OPEN, PSP_CLOSED, PONDAGE, BATTERY or OTHER).

  • injection_nominal_capacity (Optional[float]) –

    The maximal flow in MW that can be injected into the storage.

  • withdrawal_nominal_capacity (Optional[float]) –

    The maximal flow in MW that can be withdraw from the storage.

  • reservoir_capacity (Optional[float]) –

    The maximal capacity in MWh of the storage.

  • efficiency (Optional[float]) –

    The injection energy efficiency which is the ratio between the stored energy and the energy taken from the system.

  • initial_level (Optional[float]) –

    To be considered only if initial_level_optim = False, in this case corresponds to the ratio of the storage level between empty 0 and full 1.

  • initial_level_optim (Optional[bool]) –

    Whether to allow reoptimization of the initial storage level each week. In this case the level is discontinuous between weeks. Otherwise, the initial level is imposed by the user and is identical each week.

  • enabled (Optional[bool]) –

    Whether the storage is included in the model.

  • efficiency_withdrawal (Optional[float]) –

    The withdrawal energy efficiency which is the ratio between the stored energy and the energy returned to the system.

  • penalize_variation_injection (Optional[bool]) –

    Whether to create new variables to penalize the variation in the injection flowrate.

  • penalize_variation_withdrawal (Optional[bool]) –

    Whether to create new variables to penalize the variation in the withdrawal flowrate.

  • allow_overflow (Optional[bool]) –

    Whether to allow overflow of the storage.