Post · 7 min read· pp. 520–526

Store

The Store component connects to a single bus and provides inter-temporal storage of the carrier of the Bus it attaches to. Its nominal quantity is the energy capacity e_nom in MWh. The dispatch p is positive when the store supplies the bus. Where losses or direction-specific costs require it, a charging variable p_store complements it, so that p + p_store is the discharge. The outputs p_dispatch and p_store report both directions.

By default, charging and discharging power are not limited. A finite max_hours limits them to e_nom / max_hours (scaled by p_max_pu and p_min_pu), i.e. it couples the power capacity to the energy capacity as for a battery with a fixed energy-to-power ratio. Losses on the way into and out of the store are given by efficiency_store and efficiency_dispatch, standing losses by standing_loss. An exogenous inflow (e.g. river inflow to a hydro reservoir) may be spilled at spill_cost.

For independent charging and discharging power capacities, connect separate Link components to an auxiliary Bus to which the Store attaches. This decoupled approach also enables asymmetric power ratings for charging and discharging.

Hydrogen storage system with a Store and two Link components

mermaid
graph LR
    ElectricityBus["Electricity Bus"]:::bus
    HydrogenBus["Hydrogen Bus"]:::bus
    SteelTank["Steel Tank Store"]:::store

    ElectricityBus -->|Electrolyser Link| HydrogenBus
    HydrogenBus -->|Hydrogen Turbine Link| ElectricityBus
    HydrogenBus --> SteelTank

    classDef bus fill:#f9f,stroke:#333,stroke-width:2,shape:circle;
    classDef store fill:#bbf,stroke:#333,stroke-width:2,shape:rect;

Marginal costs

The marginal_cost attribute applies to the net dispatch p: discharging incurs a cost and charging is credited. It represents the value of the stored carrier, e.g. for trading it at a fixed price or for assigning a water value. The marginal_cost_dispatch and marginal_cost_store attributes apply to discharging and charging separately, e.g. for variable operating costs of a battery inverter or for wear costs per MWh moved.

Relation to storage units

Store covers all functionality of StorageUnit components and, with infinite max_hours, leaves the power unconstrained. n.c.storage_units.convert_to_stores() converts storage units into equivalent stores. In custom constraints, the net dispatch of a store is the variable n.model["Store-p"] and the charging power n.model["Store-p_store"].

attributetypeunitdefaultdescriptionstatus
namestringnannanUnique nameInput (required)
busstringnannanName of bus to which store is attached.Input (required)
controlstringnanPQP,Q,V control strategy for PF, must be "PQ", "PV" or "Slack".Input (optional)
typestringnannanPlaceholder for store type. Not yet implemented.Input (optional)
carrierstringnannanCarrier of the store.Input (optional)
e_nomfloatMWh0Nominal energy capacity (i.e. limit on e). Ignored if e_nom_extendable=True.Input (optional)
e_nom_modfloatMWh0Nominal energy capacity of the store module. Introduces integer variables if set.Input (optional)
e_nom_extendablebooleannanFalseSwitch to allow capacity e_nom to be extended in optimisation.Input (optional)
e_nom_minfloatMWh0If e_nom_extendable=True, set the minimum value of e_nom_opt.Input (optional)
e_nom_maxfloatMWhinfIf e_nom_extendable=True, set the maximum value of e_nom_opt.Input (optional)
e_nom_setfloatMWhnanIf e_nom_extendable=True, set the value of e_nom_opt.Input (optional)
e_min_pustatic or seriesper unit0Minimal value of e relative to e_nom for the optimisation.Input (optional)
e_max_pustatic or seriesper unit1Maximal value of e relative to e_nom for the optimisation.Input (optional)
e_initialfloatMWh0Energy before the snapshots in the optimisation.Input (optional)
cycles_maxfloatcyclesinfMaximum number of equivalent full cycles over the snapshots of the optimisation, i.e. discharge at the bus divided by e_nom.Input (optional)
e_initial_per_periodbooleannanFalseSwitch: if True, then at the beginning of each investment period e is set to e_initial.Input (optional)
e_cyclicbooleannanFalseSwitch: if True, then e_initial is ignored and the initial energy is set to the final energy for the group of snapshots in the optimisation.Input (optional)
e_cyclic_per_periodbooleannanFalseSwitch: if True, then the cyclic constraints are applied to each investment period separately.Input (optional)
p_setstatic or seriesMWnanActive power set point (for optimisation and power flow)Input (optional)
e_sum_minfloatMWh-infThe minimum total net energy dispatched (p) over all snapshots of the optimization, with investment periods weighted by their years, also across the windows of a rolling horizon optimization.Input (optional)
e_sum_maxfloatMWhinfThe maximum total net energy dispatched (p) over all snapshots of the optimization, with investment periods weighted by their years, also across the windows of a rolling horizon optimization.Input (optional)
q_setstatic or seriesMVar0Reactive power set point (for power flow only)Input (optional)
e_setstatic or seriesMWhnanFixed energy filling level set point (for optimisation only)Input (optional)
max_hoursfloathoursinfRatio of energy capacity e_nom to power capacity. Limits discharging to p_max_pu * e_nom / max_hours and charging to -p_min_pu * e_nom / max_hours. Infinite by default, i.e. power is unconstrained.Input (optional)
p_min_pustatic or seriesper unit-1Minimum output per unit of power capacity e_nom / max_hours. Negative sign implies storing mode withdrawing power from bus. Only applied if max_hours is finite.Input (optional)
p_max_pustatic or seriesper unit1Maximum output per unit of power capacity e_nom / max_hours. Positive sign implies discharging mode injecting power into bus. Only applied if max_hours is finite.Input (optional)
signfloatnan1Sign denoting orientation of the energy variable (e).Input (optional)
marginal_coststatic or piecewise or seriescurrency/MWh0Marginal cost of net dispatch of 1 MWh (positive p incurs cost; negative p is credited).Input (optional)
marginal_cost_dispatchstatic or seriescurrency/MWh0Marginal cost of discharging 1 MWh (p_dispatch).Input (optional)
marginal_cost_storestatic or seriescurrency/MWh0Marginal cost of charging 1 MWh (p_store).Input (optional)
marginal_cost_quadraticstatic or seriescurrency/MWh0Quadratic marginal cost of net dispatch of 1 MWh.Input (optional)
marginal_cost_storagestatic or seriescurrency/MWh/h0Marginal cost of energy storage of 1 MWh for one hour.Input (optional)
capital_costfloatcurrency/MWh0Fixed period costs of extending e_nom by 1 MWh (e.g. annuitized investment costs). Used directly unless overnight_cost is specified.Input (optional)
overnight_costfloatcurrency/MWhnanOvernight (upfront) investment cost per MWh. If specified, PyPSA calculates annuity using discount_rate and lifetime. Takes precedence over capital_cost.Input (optional)
discount_ratefloatper unitnanDiscount rate for annuity calculation when using overnight_cost. Supports 0% rate (simple depreciation).Input (optional)
fom_costfloatcurrency/MWh0Fixed period operation and maintenance costs per MWh, added to annuitized investment cost.Input (optional)
standing_lossstatic or seriesper unit0Losses per hour to energy level.Input (optional)
efficiency_storestatic or seriesper unit1Efficiency of storage on the way into the storage.Input (optional)
efficiency_dispatchstatic or seriesper unit1Efficiency of storage on the way out of the storage.Input (optional)
inflowstatic or seriesMW0Inflow to the energy level (e.g. due to river inflow in hydro reservoir).Input (optional)
spill_coststatic or seriescurrency/MWh0Cost of spilling 1 MWhInput (optional)
activebooleannanTrueWhether to consider the component in optimisation or notInput (optional)
build_yearintyear0Build yearInput (optional)
lifetimefloatyearsinfLifetimeInput (optional)
pseriesMW0Power at bus (positive if net supply)Output
p_dispatchseriesMW0Active power dispatch at busOutput
p_storeseriesMW0Active power charging at busOutput
spillseriesMW0Spillage for each snapshot (e.g. hydro-dam letting water flow over the spillway without generating electricity).Output
qseriesMVar0Reactive power (positive if net supply)Output
eseriesMWh0Energy level of store as calculated by the optimisation.Output
e_nom_optfloatMWh0Optimised nominal energy capacity outputed by optimisation.Output
mu_upperseriescurrency/MWhnanShadow price of upper e_nom limitOutput
mu_lowerseriescurrency/MWhnanShadow price of lower e_nom limitOutput
mu_energy_balanceseriescurrency/MWhnanShadow price of storage consistency equations (i.e. water values)Output
capital_cost_piecewise_optfloatcurrency/MWh0.Optimised capital cost when using piecewise linearisation.Output
marginal_cost_piecewise_optseriescurrency/MWh0.Optimised marginal cost when using piecewise linearisation.Output

diagram 2026-11-02

diagram 2025-10-09