Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support of switch contingency in sensitivity analysis and refactoring #580

Merged
merged 30 commits into from
Sep 14, 2022

Conversation

annetill
Copy link
Member

@annetill annetill commented Jul 7, 2022

Please check if the PR fulfills these requirements (please use '[x]' to check the checkboxes, or submit the PR and then click the checkboxes)

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

Does this PR already have an issue describing the problem ? If so, link to this issue using '#XXX' and skip the rest

No.

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

In case of a switch contingency, and without any BUS_VOLTAGE sensitivity function, the sensitivity analysis will be based on bus/breaker view. In the other cases, it remains on the bus view. The contingency propagation is not supported in the PR because it leads to other issues such as shared controls in a zero impedance network: it is not handle because zero impedance branches are managed with a min impedance.

Coding this, I have made a refactoring to unify the treatments between security analysis and sensitivity analysis. Without any switch to open in a security analysis, the computation is based on the bus/view and not longer in the bus/breaker view.

What is the current behavior? (You can also link to an open issue here)

What is the new behavior (if this is a feature change)?

Does this PR introduce a breaking change or deprecate an API? If yes, check the following:

  • The Breaking Change or Deprecated label has been added
  • The migration guide has been updated in the github wiki (What changes might users need to make in their application due to this PR?)

Other information:

(if any of the questions/checkboxes don't apply, please delete them entirely)

annetill added 4 commits July 7, 2022 12:37
Signed-off-by: Anne Tilloy <[email protected]>
Signed-off-by: Anne Tilloy <[email protected]>
@annetill annetill changed the base branch from main to sensi-use-breakers July 7, 2022 15:36
annetill added 2 commits July 8, 2022 13:04
Signed-off-by: Anne Tilloy <[email protected]>
Signed-off-by: Anne Tilloy <[email protected]>
@annetill annetill requested a review from flo-dup July 8, 2022 13:13
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jul 8, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

91.0% 91.0% Coverage
0.0% 0.0% Duplication

@annetill annetill changed the title Support of contingency propagation in sensitivity analysis [WIP] Support of contingency propagation in sensitivity analysis Jul 8, 2022
@annetill
Copy link
Member Author

annetill commented Jul 8, 2022

I cannot go further because in case of a factor that involves a BUS_VOLTAGE, the API automatically changes the bus id (from the bus/breaker view) into a bus id (from the bus/view). It means that it will not work for voltage sensitivities in case of a contingency propagation that leads to a switch opening or a switch contingency.

@annetill annetill changed the base branch from sensi-use-breakers to main August 16, 2022 10:51
@annetill annetill changed the title [WIP] Support of contingency propagation in sensitivity analysis Support of switch contingency in sensitivity analysis and refactoring Aug 16, 2022
@annetill annetill requested a review from geofjamg August 16, 2022 16:06
@@ -54,7 +54,8 @@ protected void addResults(StateMonitor monitor, Consumer<LfBranch> branchConsume
network.getBuses().stream()
.filter(lfBus -> monitor.getVoltageLevelIds().contains(lfBus.getVoltageLevelId()))
.filter(lfBus -> !lfBus.isDisabled())
.forEach(lfBus -> busResults.add(lfBus.createBusResult()));
.filter(lfBus -> !lfBus.isFictitious())
Copy link
Member Author

Choose a reason for hiding this comment

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

@geofjamg just tell me if we have to avoid fictitious buses here.

Signed-off-by: Geoffroy Jamgotchian <[email protected]>

@Override
public List<BusResult> createBusResults() {
return bus.getVoltageLevel().getBusBreakerView().getBusesFromBusViewBusId(bus.getId())
Copy link
Member

Choose a reason for hiding this comment

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

Does it still work when if bus is a bus/breaker one?

Copy link
Member Author

Choose a reason for hiding this comment

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

No :-) I am on it.

Copy link
Member

@geofjamg geofjamg left a comment

Choose a reason for hiding this comment

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

Let's merge it as it is. The issue with missing bus results is not linked to this PR.

Signed-off-by: Geoffroy Jamgotchian <[email protected]>
@@ -174,6 +175,14 @@ public void analyse(Network network, List<PropagatedContingency> contingencies,
Objects.requireNonNull(resultWriter);
Objects.requireNonNull(reporter);

boolean breakers = !allSwitchesToOpen.isEmpty();
if (breakers && hasBusTargetVoltage(factorReader)) {
Copy link
Member

Choose a reason for hiding this comment

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

@annetill Maybe to check the performance impact because we fully read factors 2 times with this. AC sensitivity analysis is quite slow so probably no impact, but to check with a larger number of factor.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe could have been done inside the actual factor read method without doing it 2 times?

Copy link
Member

Choose a reason for hiding this comment

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

I can see that it was already the case to check for transformer voltage control. So new we read all factors and resolve to network 3 times.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

90.2% 90.2% Coverage
0.0% 0.0% Duplication

@geofjamg geofjamg merged commit 1c594d6 into main Sep 14, 2022
@geofjamg geofjamg deleted the contingency-propagation-sensi branch September 14, 2022 11:08
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.

2 participants