Skip to content

Extend Post contingency result with a list of moved phaseShifters#3907

Open
RiadBRD wants to merge 2 commits into
mainfrom
extend_post_contingency-result
Open

Extend Post contingency result with a list of moved phaseShifters#3907
RiadBRD wants to merge 2 commits into
mainfrom
extend_post_contingency-result

Conversation

@RiadBRD
Copy link
Copy Markdown
Collaborator

@RiadBRD RiadBRD commented May 7, 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)

What kind of change does this PR introduce?
feature

What is the new behavior (if this is a feature change)?
add a list of all phaseShifters that have been moved after a loadflow into the post contingency results

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

  • Yes
  • No

…r that have been moved

Signed-off-by: Riad Benradi <riad.benradi_externe@rte-france.com>
@RiadBRD RiadBRD self-assigned this May 7, 2026
Signed-off-by: Riad Benradi <riad.benradi_externe@rte-france.com>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 7, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
70.6% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

public class PhaseShifterResultsExtension extends AbstractExtension<PostContingencyResult> implements Extension<PostContingencyResult> {

// Conventionnellement, les noms d'extension sont en minuscules et séparés par des tirets
public static final String NAME = "phase-shifter-results";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In Powsybl, it seems that extension name are in camel case : phaseShifterResults

/**
* @author Riad BENRADI {@literal <riad.benradi_externe@ at rte-france.com>}
*/
public class PhaseShifterResultsExtension extends AbstractExtension<PostContingencyResult> implements Extension<PostContingencyResult> {
Copy link
Copy Markdown
Member

@SylvestreSakti SylvestreSakti May 13, 2026

Choose a reason for hiding this comment

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

I am not sure this is necessary to implement the interface Extension here (already done in AbstractExtension)

* @author Mathieu Bague {@literal <mathieu.bague at rte-france.com>}
*/
public class PostContingencyResult extends AbstractContingencyResult {
public class PostContingencyResult extends AbstractContingencyResult implements Extendable<PostContingencyResult> {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A little bit broader than the scope of this PR: but I would suggest to make AbstractContingencyResult implement Extendable (so that PreContingencyResult can be extendable also, in case we need details about the simulation of pre contingency state)

this.movedPhaseShifterIds = Objects.requireNonNull(movedPhaseShifterIds, "Moved phase shifter IDs cannot be null");
}

public List<String> getMovedPhaseShifterIds() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggestion, what about creating a subclass PhaseShifterResult (without an s)

public class MovedPhaseShifterResult {
  private final String transformerId;
  private final int initialTap;
  private final int newTap;
}

And storing a Map<String, MovedPhaseShifterResult> in this extension

(See NetworkResult and its use of BranchResult for a similar use case)

This is a suggestion, but not sure of its relevance

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