Skip to content

feat: add batchsize parameter to ca - #711

Open
LeonHilf wants to merge 7 commits into
mainfrom
feat/batch_size_ac_outages
Open

LeonHilf wants to merge 7 commits into
mainfrom
feat/batch_size_ac_outages

Conversation

@LeonHilf

@LeonHilf LeonHilf commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

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)?

Does this PR introduce a breaking change?

  • Yes
  • No

Signed-off-by: Leonard Hilfrich <Leonard.Hilfrich@50Hertz.com>
Copilot AI lite review requested due to automatic review settings September 2, 2026 10:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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_size to ACGAParameters and pass it into AC runner construction.
  • Implement sequential batching for Powsybl contingency analysis and thread batch_size through get_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>
Signed-off-by: Leonard Hilfrich <Leonard.Hilfrich@50Hertz.com>
…tages

Signed-off-by: Leonard Hilfrich <Leonard.Hilfrich@50Hertz.com>
@sonarqube-mccs

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants