cronian.DERs.storage

Model of a storage asset that can buffer an arbitrary energy carrier.

Functions

add_storage_asset_to_model(model, prosumer, ...)

Add a storage asset to the optimization model of the given prosumer.

add_simple_model_of_storage_asset(...)

Add a simple model of the storage asset to the optimization model.

add_complex_model_of_storage_asset(...)

Add a complex model of the storage asset to the optimization model.

add_storage_asset_minimum_state_of_charge_constraint(...)

Add minimum state-of-charge constraint for the storage asset.

add_storage_asset_availability_constraints(...)

Add availability constraints for the storage asset.

Module Contents

cronian.DERs.storage.add_storage_asset_to_model(model: pyomo.environ.AbstractModel, prosumer: dict, asset_name: str, timeseries_data: pandas.DataFrame, number_of_timesteps, storage_model: str)

Add a storage asset to the optimization model of the given prosumer.

Example of storage assets: battery, heat storage, hydrogen storage, etc.

Parameters:
  • model – Pyomo model to which the prosumer’s storage will be added.

  • prosumer – Dictionary containing prosumer details.

  • asset_name – Name of the storage asset, e.g., battery.

  • timeseries_data – Timeseries data containing the availability factors for VRE generators and EVs doing V2G, demand profiles for prosumers, …

  • number_of_timesteps – Number of timesteps to run the optimization for.

  • storage_model – Type of storage model to use: simple or complex.

Returns:

Pyomo AbstractModel with the storage asset added to it.

Raises:

ValueError – If an invalid storage model is specified.

cronian.DERs.storage.add_simple_model_of_storage_asset(model: pyomo.environ.AbstractModel, prosumer: dict, asset_name: str, timeseries_data: pandas.DataFrame, number_of_timesteps) pyomo.environ.AbstractModel

Add a simple model of the storage asset to the optimization model.

NOTE: The simple_storage model does not strictly/explicitly restrict the simultaneous charge and discharge of the storage. Hence, under negative electricity prices and excess wind generation, storage may charge and discharge at the same time.

Parameters:
  • model – Pyomo model to which the prosumer’s storage will be added.

  • prosumer – Dictionary containing prosumer details.

  • asset_name – Name of the storage asset, e.g., battery.

  • timeseries_data – Timeseries data containing the availability factors for VRE generators and EVs doing V2G, demand profiles for prosumers, …

  • number_of_timesteps – Number of timesteps to run the optimization for.

Returns:

Pyomo AbstractModel with the storage asset added to it.

Raises:

KeyError – If a required asset parameter is missing

Requires model attributes:

  • time

Creates model attributes:

  • <prosumer_id>_<asset_id>_init_energy (Param): Initial energy of the storage asset

  • <prosumer_id>_<asset_id>_energy_capacity (Param): Maximum energy capacity of the storage asset

  • <prosumer_id>_<asset_id>_charge_capacity (Param): Maximum rate of charge of the storage asset

  • <prosumer_id>_<asset_id>_discharge_capacity (Param): Maximum rate of discharge of the storage asset

  • <prosumer_id>_<asset_id>_charge_efficiency (Param): Efficiency when charging

  • <prosumer_id>_<asset_id>_discharge_efficiency (Param): Efficiency when discharging

  • <prosumer_id>_<asset_id>_charge (Var[time]): Decision variable for amount of charge

  • <prosumer_id>_<asset_id>_discharge (Var[time]): Decision variable for amount of discharge

  • <prosumer_id>_<asset_id>_energy (Var[time]): Decision variable for amount of energy in the storage asset

  • <prosumer_id>_<asset_id>_charge_constraint (Constraint[time]): Constrain charge rate below capacity

  • <prosumer_id>_<asset_id>_discharge_constraint (Constraint[time]): Constrain discharge rate below capacity

  • <prosumer_id>_<asset_id>_energy_level_consistency_constraint (Constraint[time]): Constrain energy level to change with (dis)charge

  • <prosumer_id>_<asset_id>_energy_capacity_constraint (Constraint[time]): Constrain energy level below capacity

cronian.DERs.storage.add_complex_model_of_storage_asset(model: pyomo.environ.AbstractModel, prosumer: dict, asset_name: str, timeseries_data: pandas.DataFrame, number_of_timesteps) pyomo.environ.AbstractModel

Add a complex model of the storage asset to the optimization model.

NOTE: The complex_storage model strictly/explicitly restricts the simultaneous charge and discharge of the storage using binary variables.

Parameters:
  • model – Pyomo model to which the prosumer’s storage will be added.

  • prosumer – Dictionary containing prosumer details.

  • asset_name – Name of the storage asset, e.g., battery.

  • timeseries_data – Timeseries data containing the availability factors for VRE generators and EVs doing V2G, demand profiles for prosumers, …

  • number_of_timesteps – Number of timesteps to run the optimization for.

Returns:

Pyomo AbstractModel with the storage asset added to it.

Requires model attributes:

  • time

  • <prosumer_id>_<asset_id>_charge_capacity

  • <prosumer_id>_<asset_id>_discharge_capacity

  • <prosumer_id>_<asset_id>_charge

  • <prosumer_id>_<asset_id>_discharge

  • <prosumer_id>_<asset_id>_charge_constraint

  • <prosumer_id>_<asset_id>_discharge_constraint

Creates model attributes:

  • <prosumer_id>_<asset_id>_charge_status (Var[time]): Binary variable to indicate charging

  • <prosumer_id>_<asset_id>_discharge_status (Var[time]): Binary variable to indicate discharging

  • <prosumer_id>_<asset_id>_charge_constraint (Constraint[time]): Constrain charge rate below capacity, when charging

  • <prosumer_id>_<asset_id>_discharge_constraint (Constraint[time]): Constrain discharge rate below capacity, when discharging

  • <prosumer_id>_<asset_id>_charge_discharge_status_constraint (Constraint[time]): Constrain status to disallow simultaneous charging and discharging

cronian.DERs.storage.add_storage_asset_minimum_state_of_charge_constraint(model: pyomo.environ.AbstractModel, prosumer: dict, asset_name: str, timeseries_data: pandas.DataFrame, number_of_timesteps) pyomo.environ.AbstractModel

Add minimum state-of-charge constraint for the storage asset.

Parameters:
  • model – Pyomo model to which the prosumer’s storage will be added.

  • prosumer – Dictionary containing prosumer details.

  • asset_name – Name of the storage asset, e.g., battery.

  • timeseries_data – Timeseries data containing the availability factors for VRE generators and EVs doing V2G, demand profiles for prosumers, …

  • number_of_timesteps – Number of timesteps to run the optimization for.

Returns:

Pyomo AbstractModel with the storage asset’s min SOC constraints added.

Requires model attributes:

  • time

  • <prosumer_id>_<asset_id>_energy

  • <prosumer_id>_<asset_id>_energy_capacity

Creates model attributes:

  • <prosumer_id>_<asset_id>_minimum_SOC (Param[time]): Define minimum state of charge per time

  • <prosumer_id>_<asset_id>_minimum_SOC_constraint (Constraint[time]): Constrain asset’s energy level to be at least the minimum state of charge

cronian.DERs.storage.add_storage_asset_availability_constraints(model: pyomo.environ.AbstractModel, prosumer: dict, asset_name: str, timeseries_data: pandas.DataFrame, number_of_timesteps) pyomo.environ.AbstractModel

Add availability constraints for the storage asset.

Parameters:
  • model – Pyomo model to which the prosumer’s storage will be added.

  • prosumer – Dictionary containing prosumer details.

  • asset_name – Name of the storage asset, e.g., battery.

  • timeseries_data – Timeseries data containing the availability factors for VRE generators and EVs doing V2G, demand profiles for prosumers, …

  • number_of_timesteps – Number of timesteps to run the optimization for.

Returns:

Pyomo AbstractModel with the storage’s availability constraints added.

Requires model attributes:

  • time

  • <prosumer_id>_<asset_id>_charge

  • <prosumer_id>_<asset_id>_charge_capacity

  • <prosumer_id>_<asset_id>_discharge

  • <prosumer_id>_<asset_id>_discharge_capacity

Creates model attributes:

  • <prosumer_id>_<asset_id>_availability (Param[time]): Define availability ratio of asset

  • <prosumer_id>_<asset_id>_availability_charge_constraint (Constraint[time]): Constrain charging below availability ratio

  • <prosumer_id>_<asset_id>_availability_discharge_constraint (Constraint[time]): Constrain discharging below availability ratio