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

Missing lines after network simplification #338

Open hazemakhalek opened 2 years ago

hazemakhalek commented 2 years ago

Checklist

Describe the Bug

Some lines are missing in the final representation of a tested country (Morocco) when comparing to clean osm data (possible when using gadm clustering)

Example

Notice the empty regions in the second plot

MA_gadm2 MA_gadm2_pypsa

hazemakhalek commented 2 years ago

The issue is caused by function remove_stubs() in simplify_network.py

hazemakhalek commented 2 years ago

The problem is already known I guess, but becomes much more apparent when you have a one-to-one comparison of the gadm clustered network with the OSM data. The problem arises because in the OSM data the lines and substations are not always connected and thus big parts of the network is disconnected and are considered as stubs to be removed.

davide-f commented 2 years ago

This is the option I talked you about to increase the distance of the merged nodes. This may be relevant, for example, for the isolated node on the bottom left that is not expected to be isolated, I guess. I'd start by checking whether the tolerance is too small or whether there might be a bug somewhere.

https://github.com/pypsa-meets-africa/pypsa-africa/blob/75c60823bed5b7932e21ba13e804dfb56053edf8/config.default.yaml#L65

davide-f commented 1 year ago

For this issue I think there is no easy solution. My feeling is that we could add an option in the config to disable remove_stubs. The major concern in my opinion is the isolated bus in the south; missing lines in other regions may be justified by the expected behavior of that function