PyPSA / PyPSA/pypsa-eur

Network clustering incorrectly preferring lines over links

Open
#2,045 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
615
Forks
459
Avg merge
4d 14h
Merged PRs (30d)
6

Description

Version Checks (indicate both or one)
  • I have confirmed this bug exists on the lastest release of PyPSA-Eur.

  • I have confirmed this bug exists on the current master branch of PyPSA-Eur.

Issue Description

I'm working with an OSM pre-built and have two HVDC link relations that are pulled in as both a line and a link.

Relations:

  1. https://www.openstreetmap.org/relation/16101671
  2. https://www.openstreetmap.org/relation/18462073

In the pre-built they have been assigned to links and lines. This translates to one of each in resources(networks/base_s.nc), e.g.:

In [1]: network.links.filter(regex="18462073", axis=0)
Out[1]: 
                                        bus0               bus1 type  ...   dc  underwater_fraction  project_status
name                                                                  ...                                          
relation/18462073-525-DC  way/1078532568-400  way/166703766-400       ...  1.0             0.590604                

[1 rows x 43 columns]

In [2]: network.lines.filter(regex="18462073", axis=0)
Out[2]: 
                                    bus0               bus1                         type           x          r  ...  r_pu_eff  s_nom_opt  v_nom  i_nom   dc
name                                                                                                             ...                                        
relation/18462073-525  way/160580052-525  way/133323988-525  Al/St 240/40 4-bundle 380.0  124.785648  15.217762  ...       0.0        0.0    380   2.58  0.0

[1 rows x 35 columns]

Once clustered, the link disappears and only the line is represented. This is an erroneous choice: this is a HVDC link.

There seem to be a few places where a bug could be introduced:

  1. In building the OSM network from raw data (creating an entry in both lines.csv and links.csv)
  2. In clustering the OSM network (choosing a line in preference to a link following the same route)

You won't find these specific relations in the v0.6 prebuilt. The osm prebuilt I'm using is a slight update to include some new infrastructure we needed to capture, based on running the pypsa-eur osm pre-built prep script a few months ago.

Reproducible Example
N/A
Expected Behavior

HVDC links should be links in the final clustered network

Installed Versions
Replace this line.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the OSM prebuilt prep script and compare how the affected relations are written to lines.csv and links.csv, then inspect the clustering step using resources(networks/base_s.nc). Reproduce the duplicate relation entries with the linked Zenodo prebuilt or equivalent input. Done means the clustered network retains these HVDC relations as links rather than replacing them with lines.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.