pypsa-meets-earth / pypsa-distribution

GNU General Public License v3.0
10 stars 8 forks source link

Possible bug in definition of central bus of the microgrid #26

Open ekatef opened 9 months ago

ekatef commented 9 months ago

Checklist

Describe the Bug

It looks like there may be some mild discrepancy in defining a central bus for each grid.

Currently, such a bus is hardcoded as bus_9:

https://github.com/pypsa-meets-earth/pypsa-distribution/blob/94db427fdca07ffd346e97bd7b9c349705c619ba/scripts/build_shapes.py#L76-L79

This bus_9 is used to fetch both conventional generators and generate time-series of renewable generation. At the same time, bus_9 column is dropped from the demand dataframe:

https://github.com/pypsa-meets-earth/pypsa-distribution/blob/94db427fdca07ffd346e97bd7b9c349705c619ba/scripts/build_demand.py#L226-L227

Which means that load is attached to all the buses, except bus_9:

https://github.com/pypsa-meets-earth/pypsa-distribution/blob/94db427fdca07ffd346e97bd7b9c349705c619ba/scripts/add_electricity.py#L357

So, generation and loads are attached to different buses which leads to not meaningful simulation results.

I can miss something, but currently it looks like some fix may be needed here. Would be happy to contribute, but need verify that my understanding is correct. @davide-f could you please give some hints on that?