pypsa-meets-earth / pypsa-earth

PyPSA-Earth: A flexible Python-based open optimisation model to study energy system futures around the world.
https://pypsa-earth.readthedocs.io/en/latest/
207 stars 167 forks source link

add lines as s_nom_min not s_nom #956

Open pz-max opened 5 months ago

pz-max commented 5 months ago

Checklist

Describe the Bug

Lines are currently added as s_nom. If lines are oversized in a network and can reduce for the optimal case s_nom_opt. 1) deconstructing lines makes no sense (yet) and 2) this can lead to negative objective values.

https://github.com/pypsa-meets-earth/pypsa-earth/blob/e0117356d3600da4366d499b9dfbf9ebbbc61bff/scripts/base_network.py#L353-L359

We should probably add lines as s_nom_min

pz-max commented 5 months ago

@GbotemiB discovered the bug and @davide-f found out about the potential reason

davide-f commented 5 months ago

As a revision, in the mentioned code, it is ok to define it as s_nom, but it is better to specify s_nom_min in prepare_network. Actually, we have a section of code that should be doing that but it seems not to be working for some reason.

The code is in the set_transmission_limit function here: https://github.com/pypsa-meets-earth/pypsa-earth/blob/e4edb177fb5f1216f9d4ead8cf2e319a1c8a48ec/scripts/prepare_network.py#L188