PyPSA / pypsa-eur

PyPSA-Eur: A Sector-Coupled Open Optimisation Model of the European Energy System
https://pypsa-eur.readthedocs.io/
342 stars 242 forks source link

Add H2 bus based on pop_layout fails for offshore nodes #532

Closed martavp closed 3 months ago

martavp commented 3 years ago

When using a high number of nodes, if any of them has no mainland area/population associated, the H2 and battery buses are not added to that node (because they are defined based on pop_layout)

https://github.com/PyPSA/pypsa-eur-sec/blob/4fd164f73ca77f2e2ec8ea9faeac2ffbfa16be61/scripts/prepare_sector_network.py#L868

This also creates some problems with the bus_map when calculating energy and energy supply in make_summary.py

https://github.com/PyPSA/pypsa-eur-sec/blob/4fd164f73ca77f2e2ec8ea9faeac2ffbfa16be61/scripts/make_summary.py#L305

https://github.com/PyPSA/pypsa-eur-sec/blob/4fd164f73ca77f2e2ec8ea9faeac2ffbfa16be61/scripts/make_summary.py#L350

fneum commented 3 years ago

@martavp what was the rough number of nodes where this error occurs? I'll check this out.

martavp commented 3 years ago

I realized this while running a highly resolved Denmark (14 nodes), embedded in a 1-node-per-country Europe.
I've copied below the relevant lines in the config file. The nodes creating the issue were those in Zealand which ended up being offshore nodes.

scenario: sectors: [E] simpl: [''] ll: ['copt'] clusters: [49] opts: [Co2L0-H]

countries: ['AL', 'AT', 'BA', 'BE', 'BG', 'CH', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'HR', 'HU', 'IE', 'IT', 'LT', 'LU', 'LV', 'ME', 'MK', 'NL', 'NO', 'PL', 'PT', 'RO', 'RS', 'SE', 'SI', 'SK']

focus_weights: 'AL': 0.02 'AT': 0.02 'BA': 0.02 'BE': 0.02 'BG': 0.02 'CH': 0.02 'CZ': 0.02 'DE': 0.02 'DK': 0.29999 'EE': 0.02
'ES': 0.04 'FI': 0.02 'FR': 0.02 'GB': 0.02 'GR': 0.02 'HR': 0.02 'HU': 0.02 'IE': 0.04 'IT': 0.04 'LT': 0.02 'LU': 0.02 'LV': 0.02 'ME': 0.02 'MK': 0.02 'NL': 0.02 'NO': 0.02 'PL': 0.02 'PT': 0.02 'RO': 0.02 'RS': 0.02 'SE': 0.02 'SI': 0.02 'SK': 0.02

fneum commented 3 months ago

Assuming this issue doesn't occur anymore, since it has been a long time ago.