Patch SB 2040 reference grid using CBA reference grid insights#527
Patch SB 2040 reference grid using CBA reference grid insights#527
Conversation
|
@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 |
daniel-rdt
left a comment
There was a problem hiding this comment.
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
Co-authored-by: Daniel Rüdt <[email protected]>
Conflicts: scripts/lib/validation/config/__init__.py
measrainsey
left a comment
There was a problem hiding this comment.
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.
Conflicts: doc/release_notes.rst
|
@daniel-rdt @measrainsey Thank you both for the reviews! |
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.
* 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]>
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.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
Workflow
This PR introduces a config
tyndp_investment_candidates:patch_sb_with_cbathat decides whether to patch the network in the SB or in the CBA. If True, the 2035 network will be patched inprepare_sector_networkwhen the candidates are added to the 2030 reference grid. If False, the network will be patched inprepare_reference.Open issues
Notes
patch_sb_with_cba == Truepatch_sb_with_cba == FalseChecklist
pixi.toml(usingpixi add <dependency-name>).config/config.default.yaml.doc/configtables/*.csv.config/test/*.yaml.doc/*.rstfiles.doc/release_notes.rstis added.READMEanddoc/index.rst.