fix: non controllable psts diverging loadflows#619
Open
LeonHilf wants to merge 6 commits into
Open
Conversation
Signed-off-by: Leonard Hilfrich <Leonard.Hilfrich@50Hertz.com>
Signed-off-by: Leonard Hilfrich <Leonard.Hilfrich@50Hertz.com>
Signed-off-by: Leonard Hilfrich <Leonard.Hilfrich@50Hertz.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the preprocessing + backend masking around PST controllability to prevent running optimization/loadflows on PSTs that should not be controlled, and refreshes the example/test grids to include additional PST scenarios (including isolated islands).
Changes:
- Replace the previous PST-related mask outputs (
trafo_pst_linear,trafo_has_pst_tap,pst_group_labels) with a singletrafo_controllablemask and propagate it through backends. - Move/refresh parallel-PST grouping logic into the DC-solver Powsybl preprocessing helpers (used to populate
pst_groupon the trafo dataframe). - Expand the complex Powsybl example grid with additional substations/voltage-levels/PSTs and adjust affected tests/fixtures.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/topology_optimizer_pkg/tests/test_ac_dc_integration.py | Updates complex-grid fixture setup to match new PST configuration/flags. |
| packages/topology_optimizer_pkg/tests/conftest.py | Updates fixture grid initialization to pass the updated linear_pst flag shape. |
| packages/interfaces_pkg/src/toop_engine_interfaces/folder_structure.py | Adds trafo_controllable mask filename and removes deprecated PST mask filenames. |
| packages/importer_pkg/tests/pypowsybl_import/test_powsybl_masks.py | Updates mask expectations and removes tests for removed PST grouping outputs. |
| packages/importer_pkg/tests/network_graph/test_powsybl_station_to_graph.py | Updates expected relevant voltage-level IDs due to expanded complex grid topology. |
| packages/importer_pkg/src/toop_engine_importer/pypowsybl_import/powsybl_masks.py | Replaces PST mask outputs with trafo_controllable in the importer’s mask dataclass + update logic. |
| packages/grid_helpers_pkg/src/toop_engine_grid_helpers/powsybl/example_grids.py | Extends complex example grid (DE/FR stations, internal PSTs, extra lines/loads) and adjusts linear_pst default handling. |
| packages/dc_solver_pkg/tests/preprocessing/test_powsybl_helpers.py | Adds unit tests for PST grouping helpers moved into DC-solver preprocessing. |
| packages/dc_solver_pkg/tests/conftest.py | Updates complex-grid preprocessing fixtures to the new linear_pst vector length. |
| packages/dc_solver_pkg/src/toop_engine_dc_solver/preprocess/powsybl/powsybl_helpers.py | Adds PST parallel-group labeling based on step-table equivalence and exposes helper functions. |
| packages/dc_solver_pkg/src/toop_engine_dc_solver/preprocess/powsybl/powsybl_backend.py | Switches controllable-PST selection to use the new controllability mask (but currently has a column mismatch bug). |
| packages/dc_solver_pkg/src/toop_engine_dc_solver/preprocess/pandapower/pandapower_backend.py | Updates Pandapower backend to load trafo_controllable instead of the removed mask name. |
| packages/dc_solver_pkg/src/toop_engine_dc_solver/example_grids.py | Updates saved mask files to trafo_controllable and adjusts complex-grid preprocessing parameters. |
Signed-off-by: Leonard Hilfrich <Leonard.Hilfrich@50Hertz.com>
Collaborator
|
works for me, documentation needs to be adjusted |
Signed-off-by: Leonard Hilfrich <Leonard.Hilfrich@50Hertz.com>
…n the dc-solver Signed-off-by: Benjamin Petrick <170433522+BenjPetr@users.noreply.github.com>
|
| if not allclose(n_0, n_0_solver): | ||
| error = np.abs(n_0 - n_0_solver) | ||
| messages.append(f"N-0 does not match, mean error: {error.mean()}, max error: {error.max()}") | ||
| raise AssertionError(f"N-0 does not match, mean error: {error.mean()}, max error: {error.max()}") |
Collaborator
There was a problem hiding this comment.
Why do we raise in all cases now? Should we introduce the logger to this file and log the error?
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 psts being excluded from the preprocessing if they are outside the control area leading to a loadflow mismatch since they are not considered in the PSDF.
Updated the complex grid to have the DE region connected with another PST and a load. New unconnected region FR. This way we have more diversity in branches being outside and inside the zones
What is the new behavior (if this is a feature change)?
Does this PR introduce a breaking change?