fix: bb outages - #625
Merged
Merged
Conversation
Signed-off-by: Benjamin Petrick <170433522+BenjPetr@users.noreply.github.com>
Signed-off-by: Benjamin Petrick <170433522+BenjPetr@users.noreply.github.com>
…ge and keep order Signed-off-by: Benjamin Petrick <170433522+BenjPetr@users.noreply.github.com>
Signed-off-by: Benjamin Petrick <170433522+BenjPetr@users.noreply.github.com>
Signed-off-by: Benjamin Petrick <170433522+BenjPetr@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes incorrect busbar outage handling across preprocessing and the JAX outage execution path, addressing case ordering/deduplication and ensuring physically disconnected stub subtrees yield zero monitored flow instead of residual flow. It also adds regression grids and tests to prevent reintroducing these issues.
Changes:
- Extend busbar-outage preprocessing to preserve branch order during deduplication and to track “zero-flow” branches for bridge-fed stub subtrees.
- Propagate the new busbar-outage metadata through
NetworkData→convert_to_jax→ HDF5 persistence → JAX outage execution, including filtering padded/always-articulation busbar slots. - Add a dedicated node-breaker regression grid plus end-to-end tests validating DC solver results against reference loadflows for busbar contingencies.
Reviewed changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/interfaces_pkg/src/toop_engine_interfaces/loadflow_result_helpers_polars.py | Fix empty-return arrays to be well-formed and filled with NaN instead of relying on invalid np.full usage. |
| packages/importer_pkg/src/toop_engine_importer/network_graph/powsybl_station_to_graph.py | Adjust connected-component in-service mask evaluation for branches/injections. |
| packages/grid_helpers_pkg/tests/powsybl/test_powsybl_example_grids.py | Add convergence test for the new always-articulation busbar outage regression grid. |
| packages/grid_helpers_pkg/src/toop_engine_grid_helpers/powsybl/example_grids.py | Introduce create_busbar_outage_always_articulation_grid() regression grid builder. |
| packages/dc_solver_pkg/tests/test_example_grids.py | Add preprocessing-path test coverage for the new regression grid. |
| packages/dc_solver_pkg/tests/preprocessing/test_preprocess_bb_outage.py | Update tests for new return values (zero-flow branches) + add ordering and stub-compensation regression tests. |
| packages/dc_solver_pkg/tests/preprocessing/test_convert_to_jax.py | Assert correct N-1 case counting and persistence of new rel-busbar validity metadata. |
| packages/dc_solver_pkg/tests/postprocessing/test_postprocess_powsybl.py | Add reference-matching tests comparing solver busbar-outage results to Powsybl DC loadflow per contingency. |
| packages/dc_solver_pkg/tests/jax/test_busbar_outage.py | Add unit tests for padded-slot filtering and extend dummy rel-bb outage data with new fields. |
| packages/dc_solver_pkg/tests/conftest.py | Add fixtures to generate/copy the new regression grid preprocessing folder for tests. |
| packages/dc_solver_pkg/src/toop_engine_dc_solver/preprocess/preprocess_bb_outage.py | Refactor busbar-outage extraction: stable deduplication, connected-busbar propagation logic, and “zero-flow branch” tracking. |
| packages/dc_solver_pkg/src/toop_engine_dc_solver/preprocess/network_data.py | Extend OutageData/NetworkData with *_zero_flow_br_indices fields for busbar outages. |
| packages/dc_solver_pkg/src/toop_engine_dc_solver/preprocess/convert_to_jax.py | Convert/pad new outage metadata for JAX, compute valid busbar masks/flat indices, and carry zero-flow branch sets. |
| packages/dc_solver_pkg/src/toop_engine_dc_solver/jax/types.py | Add new RelBBOutageData / NonRelBBOutageData fields and update outage counts to use valid busbar indices. |
| packages/dc_solver_pkg/src/toop_engine_dc_solver/jax/inputs.py | Persist/load new busbar-outage datasets in HDF5 with backward-compatible defaults. |
| packages/dc_solver_pkg/src/toop_engine_dc_solver/jax/busbar_outage.py | Apply zero-flow forcing post-outage, improve retry outage selection, and filter valid busbar slots in rel-bb execution. |
| packages/dc_solver_pkg/src/toop_engine_dc_solver/jax/branch_action_set.py | Merge new rel-bb outage fields when combining action sets. |
| packages/dc_solver_pkg/src/toop_engine_dc_solver/example_grids.py | Provide a preprocessing-folder generator for the new always-articulation regression grid. |
| notebooks/example3_e2e_pipeline.ipynb | Update notebook pipeline configuration and optionally generate demo grids from helpers. |
| .gitignore | Ignore new notebook demo data folder. |
…sbar_outages Signed-off-by: Benjamin Petrick <170433522+BenjPetr@users.noreply.github.com>
Signed-off-by: Benjamin Petrick <170433522+BenjPetr@users.noreply.github.com>
Signed-off-by: Benjamin Petrick <170433522+BenjPetr@users.noreply.github.com>
Signed-off-by: Benjamin Petrick <170433522+BenjPetr@users.noreply.github.com>
## Checklist Please check if the PR fulfills these requirements: - [ ] PR Title follows conventional commit messages - [ ] Tests for the changes have been added (for bug fixes / features) - [ ] Docs have been added / updated (for bug fixes / features) - [ ] All commits in this PR are DCO signed-off (see CONTRIBUTING.md) ## Does this PR already have an issue describing the problem? Fixes # ## What is the new behavior (if this is a feature change)? <!-- Describe the new behavior and the motivation/context for the change. --> ## Does this PR introduce a breaking change? - [ ] Yes - [ ] No --------- Signed-off-by: Leonard Hilfrich <Leonard.Hilfrich@50Hertz.com> Signed-off-by: Benjamin Petrick <170433522+BenjPetr@users.noreply.github.com>
BenjPetr
force-pushed
the
fix/bb_outage_ben
branch
from
July 21, 2026 08:24
5b459c9 to
f46e3d1
Compare
… rebalance power in create_complex_grid_battery_hvdc_svc_3w_trafo() Signed-off-by: Benjamin Petrick <170433522+BenjPetr@users.noreply.github.com>
…_trafos Signed-off-by: Benjamin Petrick <170433522+BenjPetr@users.noreply.github.com>
Signed-off-by: Benjamin Petrick <170433522+BenjPetr@users.noreply.github.com>
Signed-off-by: Benjamin Petrick <170433522+BenjPetr@users.noreply.github.com>
Signed-off-by: Benjamin Petrick <170433522+BenjPetr@users.noreply.github.com>
Signed-off-by: Benjamin Petrick <170433522+BenjPetr@users.noreply.github.com>
Signed-off-by: Benjamin Petrick <170433522+BenjPetr@users.noreply.github.com>
…s_breaker_bus_id() has been replaced by test_get_bus_contingency_expansions_uses_busbar_propagation_map_on_complex_grid() Signed-off-by: Benjamin Petrick <170433522+BenjPetr@users.noreply.github.com>
|
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?
Fixes busbar outages:
What is the new behavior (if this is a feature change)?
Does this PR introduce a breaking change?