test: integration test dc solver fitness versus validation fitness#507
Merged
Conversation
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: Sascha Petznick <229719644+spetznick-elia@users.noreply.github.com>
Signed-off-by: Sascha Petznick <229719644+spetznick-elia@users.noreply.github.com>
Signed-off-by: Sascha Petznick <229719644+spetznick-elia@users.noreply.github.com>
Signed-off-by: Sascha Petznick <229719644+spetznick-elia@users.noreply.github.com>
Signed-off-by: Sascha Petznick <229719644+spetznick-elia@users.noreply.github.com>
Signed-off-by: Sascha Petznick <229719644+spetznick-elia@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: Leonard Hilfrich <Leonard.Hilfrich@50Hertz.com>
Signed-off-by: Leonard Hilfrich <Leonard.Hilfrich@50Hertz.com>
Signed-off-by: Leonard Hilfrich <Leonard.Hilfrich@50Hertz.com>
…near_only' into feat/integration-test-pst Signed-off-by: Sascha Petznick <229719644+spetznick-elia@users.noreply.github.com>
Signed-off-by: Sascha Petznick <229719644+spetznick-elia@users.noreply.github.com>
Signed-off-by: Benjamin Petrick <170433522+BenjPetr@users.noreply.github.com>
Signed-off-by: Sascha Petznick <229719644+spetznick-elia@users.noreply.github.com>
…near_only' into feat/integration-test-pst Signed-off-by: Sascha Petznick <229719644+spetznick-elia@users.noreply.github.com>
Signed-off-by: Benjamin Petrick <170433522+BenjPetr@users.noreply.github.com>
Signed-off-by: Sascha Petznick <229719644+spetznick-elia@users.noreply.github.com>
Signed-off-by: Sascha Petznick <229719644+spetznick-elia@users.noreply.github.com>
Signed-off-by: Sascha Petznick <229719644+spetznick-elia@users.noreply.github.com>
Signed-off-by: Sascha Petznick <229719644+spetznick-elia@users.noreply.github.com>
Signed-off-by: Sascha Petznick <229719644+spetznick-elia@users.noreply.github.com>
…oOp into fix/exlude-basecase-from-n-1
6 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds PST-focused integration coverage that cross-checks DC-solver fitness/overload metrics against Powsybl-based validation, and introduces a new “parallel PST” example grid plus supporting preprocessing helpers and fixture refactors across packages.
Changes:
- Added new AC/DC integration tests comparing
overload_energy_n_1between DC-solver aggregation and Powsybl validation across multiple PST scenarios. - Introduced a new
parallel_pst_example()Powsybl grid and new centralized “preprocessed data-folder” helper functions indc_solver_pkg. - Updated/centralized fixtures and added targeted preprocessing tests (e.g., operational-limit side voltage handling).
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/topology_optimizer_pkg/tests/test_ac_dc_integration.py | Adds integration tests that compare DC-solver metric aggregation vs Powsybl validation across PST tap scenarios. |
| packages/topology_optimizer_pkg/tests/conftest.py | Refactors grid-prep fixtures to rely on centralized preprocessing helpers. |
| packages/grid_helpers_pkg/src/toop_engine_grid_helpers/powsybl/example_grids.py | Adds the new parallel_pst_example() grid definition used for PST integration coverage. |
| packages/dc_solver_pkg/tests/test_example_grids.py | Extends example-grid tests, including coverage for complex-grid creation. |
| packages/dc_solver_pkg/tests/preprocessing/test_powsybl_helpers.py | Adds a regression test ensuring operational-limit “side” drives voltage used in get_p_max. |
| packages/dc_solver_pkg/tests/preprocessing/test_powsybl_backend.py | Updates fixture usage for complex-grid preprocessing/loadflow matching tests. |
| packages/dc_solver_pkg/tests/conftest.py | Refactors complex-grid fixtures to reuse centralized preprocessing helpers and persist network_data.pkl. |
| packages/dc_solver_pkg/src/toop_engine_dc_solver/preprocess/powsybl/powsybl_helpers.py | Updates get_p_max to use operational-limit side-specific voltage when converting current limits to MW. |
| packages/dc_solver_pkg/src/toop_engine_dc_solver/jax/nodal_inj_optim.py | Updates a comment in PST tap application code path (and introduces a TODO about sign). |
| packages/dc_solver_pkg/src/toop_engine_dc_solver/example_grids.py | Adds centralized helper(s) to generate preprocessed data folders for complex/parallel PST grids. |
Signed-off-by: Sascha Petznick <229719644+spetznick-elia@users.noreply.github.com>
…oOp into copilot/start-implementation
Signed-off-by: Sascha Petznick <229719644+spetznick-elia@users.noreply.github.com>
Signed-off-by: Sascha Petznick <229719644+spetznick-elia@users.noreply.github.com>
Signed-off-by: Sascha Petznick <229719644+spetznick-elia@users.noreply.github.com>
|
LeonHilf
approved these changes
May 28, 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.




This PR adds PST-focused integration coverage that cross-checks DC-solver fitness metrics against Powsybl-based validation, and introduces a new “parallel PST” example grid plus supporting fixture updates across packages.
Changes:
Checklist
Please check if the PR fulfills these requirements:
Does this PR already have an issue describing the problem?
Tracked by existing issue context in this PR flow.
What is the new behavior (if this is a feature change)?
Does this PR introduce a breaking change?
Original prompt
Start implementation
The user has attached the following file paths as relevant context:
- .github/copilot-instructions.md
[Chronological Review: The conversation began with the user reporting a failure in the test case `test_dc_optimizer_fitness_ac_validation_fitness_parallel_pst` due to discrepancies in the computation of N-1 overload energy between validation and the DC solver. The user requested to investigate the differences despite equal computations of N-1 loadflows. The user then indicated to start the implementation phase.][Intent Mapping:
[Technical Inventory:
parallel_pst_data_folder,load_grid,pypowsybl.network.load,pypowsybl.loadflow.run_dc, andnet.save.[Code Archaeology:
test_ac_dc_integration.py.test_dc_optimizer_fitness_ac_validation_fitness_parallel_pst, which sets up a test environment using a fixture and runs a DC load flow analysis.fixture_name = "three_node_pst_example_data_folder"indicates the use of a specific data folder for testing.][Progress Assessment:
[Context Validation: All necessary context for continuing the investigation into the test failure and the implementation of solutions is captured.]
[Recent Commands Analysis:
1. Conversation Overview: - Primary Objectives: User aims to resolve a test failure in `test_dc_optimizer_fitness_ac_validation_fitness_parallel_pst` due to discrepancies in N-1 overload energy computations. User requested to investigate the differences and indicated readiness to start implementation. - Session Context: The conversation transitioned from identifying a test failure to preparing for implementation. - User Intent Evolution: Initially focused on troubleshooting the test failure, the user shifted to readiness for implementation.- Technical Foundation:
- pytest: Used for testing framework.
- pypowsybl: Library for network loading and DC load flow computations.
- fsspec: Used for file system operations.
- Codebase Status:
- File Name:
- Purpose: Contains tests for DC optimizer fitness validation.
- Current State: User is investigating a failure in the test case.
- Key Code Segments:
- Dependencies: Relies on pypowsybl for network operations and fsspec for file handling.
- Problem Resolution:
- Issues Encountered: Discrepancy in N-1 overload energy computations between validation and DC solver.
- Solutions Implemented: None yet, as the user is in the investigation phase.
- Debugging Context: Ongoing analysis of metric computation differences.
- Lessons Learned: Understanding of how different metrics can yield discrepancies despite similar loadflow computations.
- Progress Tracking:
- Completed Tasks: Identification of the test failure.
- Partially Complete Work: Investigation into metric discrepancies is ongoing.
- Validated Outcomes: None confirmed yet as the investigation is still in progress.
- Active Work State:
- Current Focus: Investigating the differences in metric computations related to the test failure.
- Recent Context: User indicated readiness to start implementation after identifying the issue.
- Working Code: The test function
- Immediate Context: User is looking to understand why the metrics differ despite equal computations.
- Recent Operations:
- Last Agent Commands: User requested to sta...
test_ac_dc_integration.pydef test_dc_optimizer_fitness_ac_validation_fitness_parallel_pst(tmp_path_factory: pytest.TempPathFactory) -> None:sets up the test environment.fixture_name = "three_node_pst_example_data_folder"indicates the data folder used for testing.test_dc_optimizer_fitness_ac_validation_fitness_parallel_pstis the focus of the investigation.Created from VS Code.