Skip to content

Fix: config link type carriers#2191

Open
nicolezechneraggm wants to merge 6 commits into
PyPSA:masterfrom
AGGM-AG:feat/fix-config-link-type-carriers
Open

Fix: config link type carriers#2191
nicolezechneraggm wants to merge 6 commits into
PyPSA:masterfrom
AGGM-AG:feat/fix-config-link-type-carriers

Conversation

@nicolezechneraggm

@nicolezechneraggm nicolezechneraggm commented Jun 9, 2026

Copy link
Copy Markdown

Changes proposed in this Pull Request

Bugfix: As introduced for H2 pipeline retrofitted in #2174, the link type carriers gas pipeline new and CO2 pipeline must be called to correctly address losses.

If the bidirectional links with (p_min_pu=-1) are not added here, they are not split in lossy_bidirectional_links in prepare_sector_network. They are then allowed negative flows, leading to negative marginal costs in the exporting bus and generating artificial revenue there.

Additionally, the if-gate in the lossy_bidirectional_links function triggers only if carrier_i.empty:
https://github.com/AGGM-AG/pypsa-eur/blob/f750d664f1d5f2afa4c57a3f8b4132ecdd59873f/scripts/prepare_sector_network.py#L5852-L5856

if (  
    not any((v != 1.0) or (v >= 0) for v in efficiencies.values())  
    or carrier_i.empty  
):  
    return

The first part of the condition (v != 1.0) or (v >= 0) is always True. This may be an oversight that allows the split of bidirectional links regardless of efficiency values, as long as they are given in the config.

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.

@nicolezechneraggm nicolezechneraggm changed the title Feat/fix config link type carriers Fix: config link type carriers Jun 9, 2026
@nicolezechneraggm nicolezechneraggm marked this pull request as ready for review June 9, 2026 10:11
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.

1 participant