diff --git a/src/main/java/com/powsybl/openloadflow/util/PropagatedContingency.java b/src/main/java/com/powsybl/openloadflow/util/PropagatedContingency.java index c3e969e634..f3c2774813 100644 --- a/src/main/java/com/powsybl/openloadflow/util/PropagatedContingency.java +++ b/src/main/java/com/powsybl/openloadflow/util/PropagatedContingency.java @@ -73,11 +73,13 @@ public static List 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 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; @@ -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();