Repository navigation
fix: name input N-1 elements and single outages as the DC solver does - #891
Merged
Merged
Conversation
UCTE lines and transformers are now named '<id>: <elementName>' and UCTE tie lines by their id, matching the branch names of the DC solver preprocessing. Contingencies that the DC solver outages as a single element take that element's grid name instead of the input name, so names such as 'D4EICH2_D4GURT2_EICRTGUR:line' no longer reach the saved N-1 definition. Signed-off-by: Sascha Petznick <229719644+spetznick-elia@users.noreply.github.com>
Move the per-source-format naming of lines, transformers and tie lines from the DC solver preprocessing into get_branch_names in grid_helpers, together with get_cgmes_ids. The DC solver and, for UCTE, CGMES and hybrid grids, the input N-1 validation of the importer both use it. Pure UCTE lines are now named '<id>: <elementName>' in the DC solver as well, like its transformers and hybrid grids; before, the separator was missing. get_cgmes_ids no longer raises an AttributeError when a merged grid has several CGMES sub-networks. Signed-off-by: Sascha Petznick <229719644+spetznick-elia@users.noreply.github.com>
…dation" This reverts commit f84b97a. Signed-off-by: Sascha Petznick <229719644+spetznick-elia@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Contingency renaming can assign incorrect single-outage names because it counts branches excluded by the DC backend and ignores unconverted three-winding transformers.
2 open issues
What changed in this PR
This follow-up to #889 aligns importer N-1 element and single-outage contingency names more closely with DC solver preprocessing.
Changes:
- Formats UCTE branch names using IDs and grid names, with tie lines named by ID.
- Renames detected single-outage contingencies and logs name corrections.
- Updates regression tests and importer documentation.
| File | Description |
|---|---|
packages/importer_pkg/tests/pypowsybl_import/test_nminus1_definition_input.py |
Tests grid-derived names, correction logs, and multi-outage name preservation. |
packages/importer_pkg/src/toop_engine_importer/pypowsybl_import/contingency_from_file/nminus1_definition_input.py |
Adds DC-style element naming and single-outage contingency renaming. |
docs/importer/pypowsybl/index.md |
Documents the updated naming behavior. |
Review effort: Balanced
A contingency with a three-winding transformer is never a DC single outage, because the transformer becomes three DC branches, so it keeps its input name. Branches that are not connected at both sides do not count as DC branches, as in the DC solver's projection of contingencies. Signed-off-by: Sascha Petznick <229719644+spetznick-elia@users.noreply.github.com>
LeonHilf
approved these changes
Nov 6, 2026
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.





Checklist
Please check if the PR fulfills these requirements:
Does this PR already have an issue describing the problem?
No linked issue. Follow-up to #889.
What is the new behavior and why?
The N-1 definition that the DC solver preprocessing builds and the input N-1 definition that the importer validates named the same UCTE elements differently:
<id>: <elementName>, and a single-outage contingency of it the same way.elementNamefor the element and kept the contingency name of the input file. That name follows a business naming scheme, with underscores between shortened node names and a type suffix such as:lineor:trf.The importer now uses the DC solver's naming:
<id>: <elementName>, and UCTE tie lines by their id. Other UCTE elements keep theirelementName, and CGMES elements their Powsyblname.nminus1_contingency_name_corrected.Known difference: for pure UCTE grids, the DC solver's
get_linesjoins id andelementNamewithout the": "separator (<id><elementName>), unlike its transformers and its UCTE/CGMES-merged ("hybrid") grids. The importer always uses": ", which matches the DC solver's transformers and hybrid grids.Does this PR introduce a breaking change?