PyPSA icon indicating copy to clipboard operation
PyPSA copied to clipboard

Store marginal cost does not seem symmetric

Open Cellophil opened this issue 2 months ago • 1 comments

Version Checks (indicate both or one)

  • [x] I have confirmed this bug exists on the lastest release of PyPSA.

  • [x] I have confirmed this bug exists on the current master branch of PyPSA.

Issue Description

Hi,

Store component doc says: marginal_cost (float or Series or SeriesLike[float or Series]) – Marginal cost applied to both charging and discharging of 1 MWh.

However, the objective suggests only dispatch is part of the objective function. Both makes sense, but the doc specifically suggests marginal cost "double counting".

import pypsa
n = pypsa.Network()
n.set_snapshots([0,1,2])

n.add('Bus', 'bus')
n.add('Store', 'storage', e_nom=1000, bus='bus', marginal_cost=10)

n.optimize.create_model()

n.model.objective

Output: LinearExpression: +10 Store-p[0, storage] + 10 Store-p[1, storage] + 10 Store-p[2, storage]

Possibly the doc needs clarification, or possibly I misunderstood something.

Best regards, Andreas

Reproducible Example

import pypsa
n = pypsa.Network()
n.set_snapshots([0,1,2])

n.add('Bus', 'bus')
n.add('Store', 'storage', e_nom=1000, bus='bus', marginal_cost=10)

n.optimize.create_model()

n.model.objective

Expected Behavior

Either the doc should specify application of marginal cost to dispatch, or the objective should include Store-e variable.

Installed Versions

Replace this line.

Cellophil avatar Oct 15 '25 09:10 Cellophil

Ok store-p is inherently symmetric - so unless we have non-cyclic storages that are somehow filled at t=0 and can be consumed, marginal cost would not work. Efficiencies also don't work, but the field exists. Maybe those columns should be removed, it may confuse people. There is a usage for a really primitive, fast storage variable without cost and efficiency every now and then. Please correct me if I got it wrong.

Cellophil avatar Oct 16 '25 13:10 Cellophil