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/
233 stars 190 forks source link

Extend isolated node options to isolated networks #931

Closed davide-f closed 2 weeks ago

davide-f commented 11 months ago

Describe the feature you'd like to see

In the simplification phase of our workflow, we have two options that enable dropping or merging isolated nodes among them, to save clusters in the network. That allows flexibility to reduce the number of overall buses, which is likely to lead to issues during the clustering phase. The options are the following: https://github.com/pypsa-meets-earth/pypsa-earth/blob/46d792bb763f118b874a069f0b8ae655462d03a3/config.default.yaml#L66C5-L67

This is the function taking care of the dropping option, whereas the one of the merging option is this one.

However, that applies to isolated nodes only; if we have an isolated system that connects 2 nodes that is not considered by the approach.

It would be nice to extend the functionality to "isolated networks", so to identify the buses corresponding to sub_networks whose total demand is below a given threshold and drop the nodes corresponding to those subnetworks.

To tackle that, you need:

  1. calculate the total demand by sub_network, using the function groupby on n.loads_t.p_set.sum().groupby(n.buses.sub_network) [bugfixing is likely to be required]
  2. that will be a pandas series with index the subnetworks and values the total demand
  3. the subnetworks below threshold shall be identified
  4. and the list of the corresponding buses will replace the i_islands variable

@carlosfv92 FYI :) Let me know whre stuff it is not clear, and what you think about it

@ekatef FYI as well as you dealed with the functions and currently dealing with something similar #903

ekatef commented 11 months ago

@davide-f thanks a lot for adding the issue and providing a detailed description!

Absolutely agree that the load value may be a good indicator to select "main" networks, meaning the networks to each will be merged all the others isolated sub-networks. Other possible candidates are a generation value or total length/extension of networks. Probably, we can also allow manual selection of sub-networks to be merged. What do you think?

@carlosfv92 what is your experience of dealing with sub-networks? Which strategies would be convenient for your use-cases?

Have added a small notebook which may be helpful to investigate topology of sub-networks.

ekatef commented 6 months ago

Hello @davide-f! It has been a really great idea you present in the issue :) My feeling is that we could have fixed it with #903. Can we probably close this issue?

ekatef commented 2 weeks ago

Closed as seems to be completed. Feel free to reopen if needed!