Skip to content

Fix DC junctions in simplify_network#2147

Merged
fneum merged 13 commits into
masterfrom
fix-simplify-network
Jun 8, 2026
Merged

Fix DC junctions in simplify_network#2147
fneum merged 13 commits into
masterfrom
fix-simplify-network

Conversation

@bobbyxng

@bobbyxng bobbyxng commented Apr 13, 2026

Copy link
Copy Markdown
Collaborator

@brynpickering @euronion
Same bug present in PyPSA-Eur upstream.

Changes proposed in this Pull Request

  • Fixes overly aggressive DC link simplification in simplify_network (literal edge case example for new UK/Shetland HVDC and multi-terminal setup).
  • Updates supernodes so only true chain nodes (degree 2, also applied to DC) are collapsed. Preserves DC junction buses/multi-terminals (degree 3+) to avoid dropping branches in topologies like Shetland to onshore branching links.
  • Resolves merge conflicts with upstream documentation migration by keeping the release-note entry in doc/release_notes.md.

Original base network topology

Before fix
remove_stubs: true

remove_stubs: false

After fix
remove_stubs: true

remove_stubs: false

Checklist

Required:

  • Changes are tested locally and behave as expected.
  • Code and workflow changes are documented.
  • A release note entry is added to doc/release_notes.md.

If applicable:

  • Changes in configuration options are reflected in scripts/lib/validation.
  • For new data sources or versions, these instructions have been followed.
  • New rules are documented in the appropriate doc/*.md files.

@bobbyxng

Copy link
Copy Markdown
Collaborator Author

Clustered example 50 nodes with fix
image

@bobbyxng

Copy link
Copy Markdown
Collaborator Author

I had to add a new key, named it allow_ac_dc_mix for now to make this decision transparent/user configurable. Specifically, now that more DC buses "survive", it can happen that AC and DC buses in the same region (depending on clustering mode) are to be clustered. The question is, do you keep them separate (maintaining individual bus carriers) or allow DC buses to be clustered with AC buses (in this case all bus carriers become AC).

  • "Visually" this looks the same, however, the underlying subnetworks and topology, number of lines and links change.
  • For example, using config/test/config.clusters.yaml (administrative clustering)
    • allow_ac_dc_mix: false → 54 buses, 10 subnetworks (AC and DC kept separate)
    • allow_ac_dc_mix: true → 52 buses, 8 subnetworks (mixed clusters coerced to AC)

Open question, what to set as default. I believe the closest to replicate old behaviour is to allow mixing of AC and DC, but the technically more correct way would be to set allow_ac_dc_mix: false, as you also could have congestion between the AC and DC buses. Any thoughts? @fneum @brynpickering, maybe @martacki (given your clustering expertise :))

Comment thread scripts/cluster_network.py Outdated
Comment thread scripts/cluster_network.py Outdated
Comment thread scripts/cluster_network.py Outdated
@fneum

fneum commented May 4, 2026

Copy link
Copy Markdown
Member

I would suggest allow_ac_dc_mix: false as default, since mixing could be heavy simplification of network topology. Don't mind the extra buses.

Not sure the name is expressive enough though. Just looking at the name, one could assume separate synchronous zones (like Balearic Islands, DK etc.) can be clustered / simplified.

Comment thread scripts/cluster_network.py
@bobbyxng

Copy link
Copy Markdown
Collaborator Author

Thanks both @brynpickering and @fneum, I think I addressed all your comments. Regarding the config term, how about allow_ac_dc_mixing_in_bus_clusters? This should be more explicit.
Also, I removed an old hotfix in cluster_network, maybe @FabianHofmann can confirm that it is indeed okay to remove the hotfix.

@fneum

fneum commented Jun 8, 2026

Copy link
Copy Markdown
Member

@copilot resolve the merge conflicts in this pull request

Copilot AI commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved the merge conflicts by merging origin/master into this branch and fixing the release-notes conflict in commit 9d9df66d.

Copilot finished work on behalf of fneum June 8, 2026 14:41
Copilot AI requested a review from fneum June 8, 2026 14:41
@fneum fneum enabled auto-merge (squash) June 8, 2026 14:43
@fneum fneum disabled auto-merge June 8, 2026 18:50
@fneum fneum merged commit 8208868 into master Jun 8, 2026
9 of 10 checks passed
@fneum fneum deleted the fix-simplify-network branch June 8, 2026 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants