Skip to content

Commit

Permalink
Add coupler information in the log
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Dupuy <[email protected]>
  • Loading branch information
flo-dup committed May 5, 2021
1 parent 52a9085 commit f46f5d6
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,13 @@ public static List<PropagatedContingency> createListForSensitivityAnalysis(Netwo
for (int index = 0; index < contingencies.size(); index++) {
Contingency contingency = contingencies.get(index);
PropagatedContingency propagatedContingency = PropagatedContingency.create(network, contingency, index);
if (!propagatedContingency.containsCouplerToOpen()) {
Optional<Switch> coupler = propagatedContingency.switchesToOpen.stream().filter(PropagatedContingency::isCoupler).findFirst();
if (coupler.isEmpty()) {
propagatedContingencies.add(propagatedContingency);
} else {
// Sensitivity analysis works in bus view, it cannot deal (yet) with contingencies whose propagation encounters a coupler
LOGGER.error("Contingency '{}' removed from list, as a coupler switch has been encountered while propagating the contingency", contingency.getId());
LOGGER.warn("Propagated contingency '{}' not processed: coupler '{}' has been encountered while propagating the contingency",
contingency.getId(), coupler.get().getId());
}
}
return propagatedContingencies;
Expand Down Expand Up @@ -125,10 +127,6 @@ private static PropagatedContingency create(Network network, Contingency conting
return new PropagatedContingency(contingency, index, branchIdsToOpen, hvdcIdsToOpen, switchesToOpen, terminalsToDisconnect);
}

private boolean containsCouplerToOpen() {
return switchesToOpen.stream().anyMatch(PropagatedContingency::isCoupler);
}

private static boolean isCoupler(Switch s) {
VoltageLevel.NodeBreakerView nbv = s.getVoltageLevel().getNodeBreakerView();
Connectable<?> c1 = nbv.getTerminal1(s.getId()).getConnectable();
Expand Down

0 comments on commit f46f5d6

Please sign in to comment.