Skip to content

Patch SB 2040 reference grid using CBA reference grid insights#527

Merged
tgilon merged 25 commits intomasterfrom
fix/improve-2040-grid
Mar 10, 2026
Merged

Patch SB 2040 reference grid using CBA reference grid insights#527
tgilon merged 25 commits intomasterfrom
fix/improve-2040-grid

Conversation

@tgilon
Copy link
Copy Markdown
Member

@tgilon tgilon commented Feb 26, 2026

Closes #476.

Changes proposed in this Pull Request

This PR addresses the observation that the Market outputs report flows in 2040 that exceed the 2035 electrical reference grid capacities, as built from the SB data. The current approach is to build this grid using the 2030 reference grid (introduced in PR #18) and the investment candidates (introduced in PR #340, and fixed in PR #496). However, further investigation suggests that patching the 2035 reference grid with the correction we identified in PR #406 reduces the observed inconsistencies.

The graph below compares the electrical reference grid in 2030 and 2040 against the market outputs data using the latest intermediate results and the results from this PR. The cross-border capacities (p_nom) from these networks are compared to the max flows observed in the market outputs data, considering each direction separately.

rfc_grid_2030 rfc_grid_2040

As can be seen, applying these fixes resolves all the issues reported in Issue #476, as well as correcting additional capacities that were too high. Note that cross-border capacities that exceed the max flow are not an issue, of course.

This PR also addresses a bug introduced in PR #496. Currently, the SB and CBA streams do not read the Investment candidates in the same way (CBA code and SB code). The two functions are now refactored to be coherent.

This PR also adds a fix from the Appendix B.2 of the Implementation Guidelines to improve the GB-FR border value by adding +1875 MW to FR00->GB00 and GB00->FR00.

Follow-up PRs must address the offshore capacities (issue #513) and the H2 grid (issue #481).

Tasks

  • Fix CI

Workflow

This PR introduces a config tyndp_investment_candidates:patch_sb_with_cba that decides whether to patch the network in the SB or in the CBA. If True, the 2035 network will be patched in prepare_sector_network when the candidates are added to the 2030 reference grid. If False, the network will be patched in prepare_reference.

Open issues

  • Validate that this approach makes sense and is aligned with the TYNDP 2024 methodology.
  • This implementation only works with sector coupled models.

Notes

patch_sb_with_cba == True
rfc_grid_2040_sb_cba_true

patch_sb_with_cba == False
rfc_grid_2040_sb_cba_false

Checklist

  • I tested my contribution locally and it works as intended.
  • Code and workflow changes are sufficiently documented.
  • Changed dependencies are added to pixi.toml (using pixi add <dependency-name>).
  • Changes in configuration options are added in config/config.default.yaml.
  • Changes in configuration options are documented in doc/configtables/*.csv.
  • Changes in configuration options are added in config/test/*.yaml.
  • Open-TYNDP SPDX license header added to all touched files.
  • For new data sources or versions, these instructions have been followed.
  • New rules are documented in the appropriate doc/*.rst files.
  • A release note doc/release_notes.rst is added.
  • Major features are documented with up-to-date information in README and doc/index.rst.
  • Module docstrings added to new Python scripts.

@tgilon tgilon added this to the Release v0.6 milestone Feb 26, 2026
@tgilon tgilon self-assigned this Feb 26, 2026
@tgilon tgilon added SB Scenario Building CBA Cost Benefit Analysis labels Feb 26, 2026
@tgilon
Copy link
Copy Markdown
Member Author

tgilon commented Feb 27, 2026

@daniel-rdt This PR is ready for review!

@measrainsey I'm adding you as a reviewer to get your feedback on the CBA section that I'm refactoring. Daniel will do the detailed review

@tgilon tgilon marked this pull request as ready for review February 27, 2026 13:27
Comment thread doc/release_notes.rst Outdated
Copy link
Copy Markdown
Member

@daniel-rdt daniel-rdt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tgilon, this refactoring is working well and should largely address our observed mismatches. I do have a main comment regarding negative corrections that might require some changes.
Other than that, just small notes and suggestions

Comment thread config/scenarios.tyndp.yaml
Comment thread config/test/config.tyndp.yaml Outdated
Comment thread scripts/cba/fix_reference_sb_to_cba.py
Comment thread scripts/prepare_sector_network.py Outdated
Comment thread scripts/prepare_sector_network.py Outdated
Comment thread rules/build_sector.smk
Comment thread scripts/cba/fix_reference_sb_to_cba.py
Comment thread scripts/prepare_sector_network.py
Comment thread scripts/prepare_sector_network.py Outdated
Comment thread scripts/cba/fix_reference_sb_to_cba.py
Copy link
Copy Markdown
Member

@measrainsey measrainsey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tgilon for this work and for consolidating the different reference grid modifications so that they can be consistently used across the SB and CBA workflows!

I did some tests (branched out of this branch, with the latest master changes merged) to check the CBA networks when tyndp_investment_candidates.patch_sb_with_cba: true and when tyndp_investment_candidates.patch_sb_with_cba: false. Looks like the final CBA reference grids are the same in terms of capacities, so I take this to mean that the workflow is working properly:

  • If tyndp_investment_candidates.patch_sb_with_cba: true, corrections are applied in SB (and CBA skips them).
  • If tyndp_investment_candidates.patch_sb_with_cba: false, corrections are applied in CBA.

I also did a quick glance to see if there would be any major conflicts or issues with the other open CBA PR #522, but I think it's fine. Perhaps some code conflicts but no functional/feature conflicts from what I can see.

@tgilon tgilon requested a review from daniel-rdt March 6, 2026 15:15
@tgilon
Copy link
Copy Markdown
Member Author

tgilon commented Mar 10, 2026

@daniel-rdt @measrainsey Thank you both for the reviews!

@tgilon tgilon merged commit a6cb798 into master Mar 10, 2026
5 checks passed
@tgilon tgilon deleted the fix/improve-2040-grid branch March 10, 2026 08:24
cdgaete added a commit that referenced this pull request Mar 11, 2026
Two bugs were introduced during the merge of master into fix/382-cba-add-new-links
(commit 76f9c29):

- scripts/cba/prepare_reference.py: `update_or_add_link` retained the `attrs`
  parameter in its signature but `**attrs` was replaced with `capital_cost=0.0`
  in `n.add()`, silently discarding the length, underwater_fraction, and
  capital_cost populated by `get_link_attrs`. Restore `**attrs`.

- rules/cba.smk: `prepare_reference` input referenced
  `rules.fix_reference_sb_to_cba.output.corrections_csv` which was renamed
  to `corrections` in master (#527). Update to match the current output key.
cdgaete added a commit that referenced this pull request Mar 19, 2026
* feat(cba): populate length, underwater_fraction, and capital_cost for new CBA links (#382)
Extract route length, CAPEX, and underwater fraction from ENTSO-E Trans.Investments sheet and use them when creating DC links that don't exist in the base network.
capital_cost is computed from the project-reported total CAPEX, annualized via HVDC inverter pair lifetime and discount rate.

* fix(cba): use per-km cost formula for new link capital_cost

Compute capital_cost using the same formula as add_electricity.py (length-based with overhead/submarine/inverter costs) instead of project-reported total CAPEX. This ensures new PINT links are
assessed on the same cost basis as all other DC links in the network.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* docs: add #522 to doc/release_notes

* Update scripts/cba/prepare_reference.py

Co-authored-by: meas <[email protected]>

* Update scripts/cba/prepare_project.py

Co-authored-by: meas <[email protected]>

* fix(cba): fix merge conflict resolution in prepare_reference and cba.smk

Two bugs were introduced during the merge of master into fix/382-cba-add-new-links
(commit 76f9c29):

- scripts/cba/prepare_reference.py: `update_or_add_link` retained the `attrs`
  parameter in its signature but `**attrs` was replaced with `capital_cost=0.0`
  in `n.add()`, silently discarding the length, underwater_fraction, and
  capital_cost populated by `get_link_attrs`. Restore `**attrs`.

- rules/cba.smk: `prepare_reference` input referenced
  `rules.fix_reference_sb_to_cba.output.corrections_csv` which was renamed
  to `corrections` in master (#527). Update to match the current output key.

---------

Co-authored-by: cdgaete <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Measrainsey Meng <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CBA Cost Benefit Analysis SB Scenario Building

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Correct installed capacities of electricity grid based on Market Output maximal flows

3 participants