Skip to content

Conversation

@SylvestreSakti
Copy link
Member

@SylvestreSakti SylvestreSakti commented Jan 21, 2026

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • A PR or issue has been opened in all impacted repositories (if any)

Does this PR already have an issue describing the problem?
No

What kind of change does this PR introduce?

#1240 introduced a new formalism for bus targetQ updating. This new formalism was not correctly applied for secondary voltage control, triggering an exception when restoring a bus state that has been modified with secondary voltage control outer loop.
com.powsybl.commons.PowsyblException: Generation targetQ cannot be frozen if generatorVoltageControl is enabled

This fix led to a refactoring to avoid such errors

What is the current behavior?
The exception is thrown

What is the new behavior (if this is a feature change)?
When activating voltage control, targetQ is correctly invalidated by the secondary voltage control outer loop, there is no exception.

Moreover, to avoid this kind of mistake, the methods invalidateGenerationTargetQ() and setGenerationVoltageControlEnabled(bool) are now private. Outside the class AbstractLfBus, we can use :

  • setGeneratorVoltageControlEnabledAndRecomputeTargetQ(bool) : activates or deactivates generationVoltageControl and invalidates targetQ (if targetQ was frozen, it turns unfrozen)
  • freezeGenerationTargetQAndDisableGeneratorVoltageControl(double) : deactivates generatorVoltageControl and freezes targetQ (used to switch a bus from PV to PQ)

Two test cases are introduced :
1 - The exception throwing case due to Secondary Voltage Control Outer loop
2 - An uncovered corner case : Security Analysis with a contingency on a generator that switched PV -> PQ in the base case

Does this PR introduce a breaking change or deprecate an API?

  • Yes
  • No

Signed-off-by: PRABAKARAN Sylvestre <sylvestre.prabakaran@rte-france.com>
Signed-off-by: PRABAKARAN Sylvestre <sylvestre.prabakaran@rte-france.com>
Signed-off-by: PRABAKARAN Sylvestre <sylvestre.prabakaran@rte-france.com>
…ageControlEnabled in higher level methods setVoltageControlEnabled and freezeGenerationTargetQ

Signed-off-by: PRABAKARAN Sylvestre <sylvestre.prabakaran@rte-france.com>
geofjamg
geofjamg previously approved these changes Feb 2, 2026
Signed-off-by: PRABAKARAN Sylvestre <sylvestre.prabakaran@rte-france.com>
Signed-off-by: PRABAKARAN Sylvestre <sylvestre.prabakaran@rte-france.com>
Signed-off-by: PRABAKARAN Sylvestre <sylvestre.prabakaran@rte-france.com>
@SylvestreSakti SylvestreSakti changed the title Fix targetQ freezing for Secondary Voltage Control outer loop Fix generationTargetQ freezing and invalidating for LfBus Feb 3, 2026
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 3, 2026

Copy link
Collaborator

@vidaldid-rte vidaldid-rte left a comment

Choose a reason for hiding this comment

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

This seems to fix the current bug and make the API more robust. I did not see any other difference introduced with previous behaviour.

The API (although names may be modified) reflects well the three states of the bus regarding Q computation, the transitions, and the need to invalidate the cache that si common to frozen state (Q determined by the diagram), and unregulating state where Q is controlled by the generator's reactive target).

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants