Skip to content

fix: Introduce parameter for enabling voltage rejection#607

Merged
spetznick-elia merged 5 commits into
mainfrom
fix/voltage-angle-rejection-optional
Jul 2, 2026
Merged

fix: Introduce parameter for enabling voltage rejection#607
spetznick-elia merged 5 commits into
mainfrom
fix/voltage-angle-rejection-optional

Conversation

@spetznick-elia

@spetznick-elia spetznick-elia commented Jun 30, 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)?

PR introduces a flag to toggle voltage-related rejection reasons for ac validation and switches it off by default. This breaks previous behavior.

Also fixes a default parameter for critical_voltage_jump_percent: float = 5.0 and max_allowed_va_diff: float = 20.0 in compute_loadflow_and_metrics and compute_metrics_single_timestep. We also add these parameters to compute_remaining_loadflows, which called compute_metrics_single_timestep without parameters leading to always using the default.

Does this PR introduce a breaking change?

  • Yes, default parameters changed and the feature is off by default.
  • No

Signed-off-by: Sascha Petznick <229719644+spetznick-elia@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 30, 2026 13:23

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.

Pull request overview

This PR adds a configuration toggle to enable/disable voltage-based rejection criteria during AC validation in the topology optimizer, and updates scoring code to correctly forward configured voltage thresholds instead of relying on hard-coded defaults.

Changes:

  • Introduces enable_critical_voltage_rejection in AC GA parameters and wires it through optimizer/scoring.
  • Updates AC acceptance/scoring logic to conditionally apply voltage-magnitude and voltage-angle rejection checks.
  • Extends/updates tests to cover the new toggle and verify threshold forwarding paths.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/topology_optimizer_pkg/tests/interfaces/messages/test_ac_ga_params.py Verifies default and explicit behavior for the new enable_critical_voltage_rejection parameter.
packages/topology_optimizer_pkg/tests/ac/test_ac_scoring_functions.py Adds tests for toggle behavior in acceptance and for forwarding voltage thresholds through scoring paths.
packages/topology_optimizer_pkg/src/toop_engine_topology_optimizer/interfaces/messages/ac_params.py Adds enable_critical_voltage_rejection to the AC GA parameter message model.
packages/topology_optimizer_pkg/src/toop_engine_topology_optimizer/ac/scoring_functions.py Implements the toggle in evaluate_acceptance and forwards configured voltage thresholds through scoring functions.
packages/topology_optimizer_pkg/src/toop_engine_topology_optimizer/ac/optimizer.py Forwards the new toggle from GA config into scoring parameters.

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>
@sonarqube-mccs

sonarqube-mccs Bot commented Jul 1, 2026

Copy link
Copy Markdown

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.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

@spetznick-elia spetznick-elia merged commit 7ef47d1 into main Jul 2, 2026
18 checks passed
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.

4 participants