Conversation
Signed-off-by: Leonard Hilfrich <Leonard.Hilfrich@50Hertz.com>
There was a problem hiding this comment.
🟡 Changes recommended
The current Powsybl batching logic duplicates basecase results across batches and the GA parameter rename breaks existing callers/tests without a compatibility shim.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR introduces an optional contingency batching parameter to the AC contingency-analysis flow, exposing it through the AC optimizer GA parameters and wiring it into the Powsybl contingency analysis implementation.
Changes:
- Add
contingency_batch_sizetoACGAParametersand pass it into AC runner construction. - Implement sequential batching for Powsybl contingency analysis and thread
batch_sizethroughget_ac_loadflow_results(). - Add/adjust tests to cover the new batching behavior and the new GA parameter.
File summaries
| File | Description |
|---|---|
| packages/topology_optimizer_pkg/tests/interfaces/messages/test_ac_ga_params.py | Updates message parameter tests to include the new batch size field. |
| packages/topology_optimizer_pkg/src/toop_engine_topology_optimizer/interfaces/messages/ac_params.py | Adds contingency_batch_size to AC GA parameters. |
| packages/topology_optimizer_pkg/src/toop_engine_topology_optimizer/ac/optimizer.py | Threads the batch size parameter into runner creation for full AC analysis. |
| packages/contingency_analysis_pkg/tests/powsybl/test_contingency_analysis_powsybl.py | Adds a regression test asserting batched vs unbatched Powsybl results match. |
| packages/contingency_analysis_pkg/src/toop_engine_contingency_analysis/pypowsybl/contingency_analysis_powsybl.py | Implements sequential batching for outage contingencies in the Polars Powsybl path. |
| packages/contingency_analysis_pkg/src/toop_engine_contingency_analysis/ac_loadflow_service/ac_loadflow_service.py | Updates docs and forwards batch_size to the Powsybl implementation. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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>
Signed-off-by: Leonard Hilfrich <Leonard.Hilfrich@50Hertz.com>
…tages Signed-off-by: Leonard Hilfrich <Leonard.Hilfrich@50Hertz.com>
|




Checklist
Please check if the PR fulfills these requirements:
Does this PR already have an issue describing the problem?
Fixes #
What is the new behavior (if this is a feature change)?
Does this PR introduce a breaking change?