diff --git a/cse-cc-import-runner-app/src/main/java/com/farao_community/farao/cse/import_runner/app/dichotomy/DichotomyResultHelper.java b/cse-cc-import-runner-app/src/main/java/com/farao_community/farao/cse/import_runner/app/dichotomy/DichotomyResultHelper.java index 515a7170..0accbe83 100644 --- a/cse-cc-import-runner-app/src/main/java/com/farao_community/farao/cse/import_runner/app/dichotomy/DichotomyResultHelper.java +++ b/cse-cc-import-runner-app/src/main/java/com/farao_community/farao/cse/import_runner/app/dichotomy/DichotomyResultHelper.java @@ -30,10 +30,10 @@ public DichotomyResultHelper(FileImporter fileImporter) { this.fileImporter = fileImporter; } - public String getLimitingElement(DichotomyResult dichotomyResult) { + public String getLimitingElement(DichotomyResult dichotomyResult, Network network) { DichotomyStepResult highestValidStepResult = dichotomyResult.getHighestValidStep(); Crac crac = fileImporter.importCracFromJson(highestValidStepResult.getValidationData() - .getRaoResponse().getCracFileUrl()); + .getRaoResponse().getCracFileUrl(), network); RaoResult raoResult = fileImporter.importRaoResult(highestValidStepResult.getValidationData() .getRaoResponse().getRaoResultFileUrl(), crac); FlowCnec worstCnec = CnecUtil.getWorstCnec(crac, raoResult); diff --git a/cse-cc-import-runner-app/src/main/java/com/farao_community/farao/cse/import_runner/app/dichotomy/MultipleDichotomyRunner.java b/cse-cc-import-runner-app/src/main/java/com/farao_community/farao/cse/import_runner/app/dichotomy/MultipleDichotomyRunner.java index 44a01313..a02d0ab7 100644 --- a/cse-cc-import-runner-app/src/main/java/com/farao_community/farao/cse/import_runner/app/dichotomy/MultipleDichotomyRunner.java +++ b/cse-cc-import-runner-app/src/main/java/com/farao_community/farao/cse/import_runner/app/dichotomy/MultipleDichotomyRunner.java @@ -77,7 +77,7 @@ public MultipleDichotomyResult runMultipleDichotomy(CseReq String limitingCause = TtcResult.limitingCauseToString(initialDichotomyResult.getLimitingCause()); if (initialDichotomyResult.hasValidStep()) { - limitingElement = dichotomyResultHelper.getLimitingElement(multipleDichotomyResult.getBestDichotomyResult()); + limitingElement = dichotomyResultHelper.getLimitingElement(multipleDichotomyResult.getBestDichotomyResult(), network); ttcString = String.valueOf(round(dichotomyResultHelper.computeHighestSecureItalianImport(initialDichotomyResult))); printablePrasIds = toString(getActivatedRangeActionInPreventive(crac, initialDichotomyResult)); printableForcedPrasIds = toString(getForcedPrasIds(initialDichotomyResult)); @@ -126,7 +126,7 @@ public MultipleDichotomyResult runMultipleDichotomy(CseReq flattenPrasIds(forcedPrasIds)); if (nextDichotomyResult.hasValidStep()) { - String newLimitingElement = dichotomyResultHelper.getLimitingElement(nextDichotomyResult); + String newLimitingElement = dichotomyResultHelper.getLimitingElement(nextDichotomyResult, network); double previousLowestUnsecureItalianImport = dichotomyResultHelper.computeLowestUnsecureItalianImport(multipleDichotomyResult.getBestDichotomyResult()); double newLowestUnsecureItalianImport = dichotomyResultHelper.computeLowestUnsecureItalianImport(nextDichotomyResult); @@ -181,7 +181,7 @@ public MultipleDichotomyResult runMultipleDichotomy(CseReq String finalLimitingCause = TtcResult.limitingCauseToString(multipleDichotomyResult.getBestDichotomyResult().getLimitingCause()); if (multipleDichotomyResult.getBestDichotomyResult().hasValidStep()) { - finalLimitingElement = dichotomyResultHelper.getLimitingElement(multipleDichotomyResult.getBestDichotomyResult()); + finalLimitingElement = dichotomyResultHelper.getLimitingElement(multipleDichotomyResult.getBestDichotomyResult(), network); finalTtcString = String.valueOf(round(dichotomyResultHelper.computeHighestSecureItalianImport(multipleDichotomyResult.getBestDichotomyResult()))); finalPrintablePrasIds = toString(getActivatedRangeActionInPreventive(crac, multipleDichotomyResult.getBestDichotomyResult())); finalPrintableForcedPrasIds = toString(getForcedPrasIds(multipleDichotomyResult.getBestDichotomyResult())); diff --git a/cse-cc-import-runner-app/src/main/java/com/farao_community/farao/cse/import_runner/app/dichotomy/RaoRunnerValidator.java b/cse-cc-import-runner-app/src/main/java/com/farao_community/farao/cse/import_runner/app/dichotomy/RaoRunnerValidator.java index c2ac6ef3..05261e6c 100644 --- a/cse-cc-import-runner-app/src/main/java/com/farao_community/farao/cse/import_runner/app/dichotomy/RaoRunnerValidator.java +++ b/cse-cc-import-runner-app/src/main/java/com/farao_community/farao/cse/import_runner/app/dichotomy/RaoRunnerValidator.java @@ -84,7 +84,7 @@ public DichotomyStepResult validateNetwork(Network network String networkPresignedUrl = fileExporter.saveNetworkInArtifact(network, baseDirPathForCurrentStep + scaledNetworkName, "", processTargetDateTime, processType, isImportEcProcess); try { - Crac crac = fileImporter.importCracFromJson(cracUrl); + Crac crac = fileImporter.importCracFromJson(cracUrl, network); List appliedRemedialActionInPreviousStep = lastDichotomyStepResult != null && lastDichotomyStepResult.getRaoResult() != null ? lastDichotomyStepResult.getRaoResult().getActivatedNetworkActionsDuringState(crac.getPreventiveState()) .stream().map(NetworkAction::getId).toList() : Collections.emptyList(); RaoRequest raoRequest = buildRaoRequest(networkPresignedUrl, baseDirPathForCurrentStep, appliedRemedialActionInPreviousStep); diff --git a/cse-cc-import-runner-app/src/main/java/com/farao_community/farao/cse/import_runner/app/services/FileImporter.java b/cse-cc-import-runner-app/src/main/java/com/farao_community/farao/cse/import_runner/app/services/FileImporter.java index cbfb74c5..81e40b95 100644 --- a/cse-cc-import-runner-app/src/main/java/com/farao_community/farao/cse/import_runner/app/services/FileImporter.java +++ b/cse-cc-import-runner-app/src/main/java/com/farao_community/farao/cse/import_runner/app/services/FileImporter.java @@ -69,9 +69,9 @@ public CseCrac importCseCrac(String cracUrl) { return cseCracImporter.importNativeCrac(cracInputStream); } - public Crac importCracFromJson(String cracUrl) { + public Crac importCracFromJson(String cracUrl, Network network) { InputStream cracResultStream = openUrlStream(cracUrl); - return CracImporters.importCrac(FileUtil.getFilenameFromUrl(cracUrl), cracResultStream); + return CracImporters.importCrac(FileUtil.getFilenameFromUrl(cracUrl), cracResultStream, network); } public ZonalData importGlsk(String glskUrl, Network network) { diff --git a/cse-cc-import-runner-app/src/test/java/com/farao_community/farao/cse/import_runner/app/dichotomy/DichotomyResultHelperTest.java b/cse-cc-import-runner-app/src/test/java/com/farao_community/farao/cse/import_runner/app/dichotomy/DichotomyResultHelperTest.java index 51d7e057..7d8551b3 100644 --- a/cse-cc-import-runner-app/src/test/java/com/farao_community/farao/cse/import_runner/app/dichotomy/DichotomyResultHelperTest.java +++ b/cse-cc-import-runner-app/src/test/java/com/farao_community/farao/cse/import_runner/app/dichotomy/DichotomyResultHelperTest.java @@ -10,6 +10,9 @@ import com.farao_community.farao.dichotomy.api.results.DichotomyResult; import com.farao_community.farao.dichotomy.api.results.DichotomyStepResult; import com.farao_community.farao.rao_runner.api.resource.RaoResponse; +import com.powsybl.iidm.network.Identifiable; +import com.powsybl.iidm.network.Line; +import com.powsybl.iidm.network.Network; import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; @@ -35,6 +38,11 @@ void testLimitingElement() throws IOException { DichotomyStepResult highestValidStep = Mockito.mock(DichotomyStepResult.class); DichotomyRaoResponse dichotomyRaoResponse = Mockito.mock(DichotomyRaoResponse.class); RaoResponse raoResponse = Mockito.mock(RaoResponse.class); + Network network = Mockito.mock(Network.class); + Identifiable line = Mockito.mock(Line.class); + + Mockito.when(line.getId()).thenReturn("anId"); + Mockito.when(network.getIdentifiable(Mockito.anyString())).thenReturn(line); Mockito.when(dichotomyResult.getHighestValidStep()).thenReturn(highestValidStep); Mockito.when(highestValidStep.getValidationData()).thenReturn(dichotomyRaoResponse); @@ -42,7 +50,7 @@ void testLimitingElement() throws IOException { Mockito.when(raoResponse.getRaoResultFileUrl()).thenReturn("file://" + Objects.requireNonNull(getClass().getResource("rao-result-v1.1.json")).getPath()); Mockito.when(raoResponse.getCracFileUrl()).thenReturn("file://" + Objects.requireNonNull(getClass().getResource("crac-for-rao-result-v1.1.json")).getPath()); - String limitingElement = dichotomyResultHelper.getLimitingElement(dichotomyResult); + String limitingElement = dichotomyResultHelper.getLimitingElement(dichotomyResult, network); assertEquals("cnec1prevId", limitingElement); } diff --git a/cse-cc-import-runner-app/src/test/java/com/farao_community/farao/cse/import_runner/app/dichotomy/MultipleDichotomyRunnerTest.java b/cse-cc-import-runner-app/src/test/java/com/farao_community/farao/cse/import_runner/app/dichotomy/MultipleDichotomyRunnerTest.java index fe76a7c0..d4dcf739 100644 --- a/cse-cc-import-runner-app/src/test/java/com/farao_community/farao/cse/import_runner/app/dichotomy/MultipleDichotomyRunnerTest.java +++ b/cse-cc-import-runner-app/src/test/java/com/farao_community/farao/cse/import_runner/app/dichotomy/MultipleDichotomyRunnerTest.java @@ -139,9 +139,10 @@ private void mockCrac() { private DichotomyResult mockDichotomyResult(String limitingElement, double lowestUnsecureItalianImport) throws IOException { DichotomyStepResult highestValidStep = Mockito.mock(DichotomyStepResult.class); DichotomyResult dichotomyResult = Mockito.mock(DichotomyResult.class); + Mockito.when(dichotomyResult.getHighestValidStep()).thenReturn(highestValidStep); Mockito.when(dichotomyResult.hasValidStep()).thenReturn(true); - Mockito.when(dichotomyResultHelper.getLimitingElement(dichotomyResult)).thenReturn(limitingElement); + Mockito.when(dichotomyResultHelper.getLimitingElement(dichotomyResult, network)).thenReturn(limitingElement); Mockito.when(dichotomyResultHelper.computeLowestUnsecureItalianImport(dichotomyResult)).thenReturn(lowestUnsecureItalianImport); return dichotomyResult; } diff --git a/cse-cc-import-runner-app/src/test/java/com/farao_community/farao/cse/import_runner/app/services/ForcedPraHandlerTest.java b/cse-cc-import-runner-app/src/test/java/com/farao_community/farao/cse/import_runner/app/services/ForcedPraHandlerTest.java index fc0e346a..136b4c77 100644 --- a/cse-cc-import-runner-app/src/test/java/com/farao_community/farao/cse/import_runner/app/services/ForcedPraHandlerTest.java +++ b/cse-cc-import-runner-app/src/test/java/com/farao_community/farao/cse/import_runner/app/services/ForcedPraHandlerTest.java @@ -45,8 +45,8 @@ public Logger getLoggerTest() { @Test void checkCracAndForcedPrasAreConsistent() { - Crac crac = CracImporters.importCrac("crac-for-forced-pras.json", Objects.requireNonNull(getClass().getResourceAsStream("crac-for-forced-pras.json"))); Network network = Network.read("network-for-forced-pras.xiidm", getClass().getResourceAsStream("network-for-forced-pras.xiidm")); + Crac crac = CracImporters.importCrac("crac-for-forced-pras.json", Objects.requireNonNull(getClass().getResourceAsStream("crac-for-forced-pras.json")), network); Set manualForcedPrasIds = Set.of("Open line NL1-NL2", "Open line BE2-FR3", "PRA_PST_BE"); diff --git a/cse-lib/data/src/main/java/com/farao_community/farao/cse/data/cnec/CracResultsHelper.java b/cse-lib/data/src/main/java/com/farao_community/farao/cse/data/cnec/CracResultsHelper.java index 860d923f..2a0c9a2b 100644 --- a/cse-lib/data/src/main/java/com/farao_community/farao/cse/data/cnec/CracResultsHelper.java +++ b/cse-lib/data/src/main/java/com/farao_community/farao/cse/data/cnec/CracResultsHelper.java @@ -6,6 +6,7 @@ */ package com.farao_community.farao.cse.data.cnec; +import com.powsybl.contingency.ContingencyElement; import com.powsybl.openrao.commons.Unit; import com.farao_community.farao.cse.data.CseDataException; @@ -13,7 +14,7 @@ import com.powsybl.openrao.data.cracapi.Identifiable; import com.powsybl.openrao.data.cracapi.Instant; import com.powsybl.openrao.data.cracapi.NetworkElement; -import com.powsybl.openrao.data.cracapi.Contingency; +import com.powsybl.contingency.Contingency; import com.powsybl.openrao.data.cracapi.cnec.FlowCnec; import com.powsybl.openrao.data.cracapi.cnec.Side; import com.powsybl.openrao.data.cracapi.rangeaction.InjectionRangeAction; @@ -38,7 +39,6 @@ import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.Set; import java.util.stream.Collectors; /** @@ -250,12 +250,28 @@ public FlowCnecResult getFlowCnecResultInAmpere(FlowCnec flowCnec, Instant optim return new FlowCnecResult(flow, iMax); } + public String getAreaFrom(ContingencyElement contingencyElement) { + String nodeFrom = getNodeFrom(contingencyElement); + String nodeTo = getNodeTo(contingencyElement); + String countryFrom = UcteCountryCode.fromUcteCode(nodeFrom.charAt(0)).toString(); + String countryTo = UcteCountryCode.fromUcteCode(nodeTo.charAt(0)).toString(); + return getCountryOfNode(contingencyElement.getId(), countryFrom, countryTo); + } + + public String getAreaTo(ContingencyElement contingencyElement) { + String nodeFrom = getNodeFrom(contingencyElement); + String nodeTo = getNodeTo(contingencyElement); + String countryFrom = UcteCountryCode.fromUcteCode(nodeFrom.charAt(0)).toString(); + String countryTo = UcteCountryCode.fromUcteCode(nodeTo.charAt(0)).toString(); + return getCountryOfNode(contingencyElement.getId(), countryTo, countryFrom); + } + public String getAreaFrom(NetworkElement networkElement) { String nodeFrom = getNodeFrom(networkElement); String nodeTo = getNodeTo(networkElement); String countryFrom = UcteCountryCode.fromUcteCode(nodeFrom.charAt(0)).toString(); String countryTo = UcteCountryCode.fromUcteCode(nodeTo.charAt(0)).toString(); - return getCountryOfNode(networkElement, countryFrom, countryTo); + return getCountryOfNode(networkElement.getId(), countryFrom, countryTo); } public String getAreaTo(NetworkElement networkElement) { @@ -263,27 +279,27 @@ public String getAreaTo(NetworkElement networkElement) { String nodeTo = getNodeTo(networkElement); String countryFrom = UcteCountryCode.fromUcteCode(nodeFrom.charAt(0)).toString(); String countryTo = UcteCountryCode.fromUcteCode(nodeTo.charAt(0)).toString(); - return getCountryOfNode(networkElement, countryTo, countryFrom); + return getCountryOfNode(networkElement.getId(), countryTo, countryFrom); } private String getAreaFrom(NetworkElement networkElement, NativeBranch nativeBranch) { String countryFrom = UcteCountryCode.fromUcteCode(nativeBranch.getFrom().charAt(0)).toString(); String countryTo = UcteCountryCode.fromUcteCode(nativeBranch.getTo().charAt(0)).toString(); - return getCountryOfNode(networkElement, countryFrom, countryTo); + return getCountryOfNode(networkElement.getId(), countryFrom, countryTo); } private String getAreaTo(NetworkElement networkElement, NativeBranch nativeBranch) { String countryFrom = UcteCountryCode.fromUcteCode(nativeBranch.getFrom().charAt(0)).toString(); String countryTo = UcteCountryCode.fromUcteCode(nativeBranch.getTo().charAt(0)).toString(); - return getCountryOfNode(networkElement, countryTo, countryFrom); + return getCountryOfNode(networkElement.getId(), countryTo, countryFrom); } - private String getCountryOfNode(NetworkElement networkElement, String nodeCountry, String destinationNodeCountry) { + private String getCountryOfNode(String elementId, String nodeCountry, String destinationNodeCountry) { if (!nodeCountry.equals(UcteCountryCode.XX.toString())) { return nodeCountry; } else { - String area1 = getCountrySide1(networkElement); - String area2 = getCountrySide2(networkElement); + String area1 = getCountrySide1(elementId); + String area2 = getCountrySide2(elementId); if (StringUtils.equals(area1, destinationNodeCountry)) { return area2; } else { @@ -292,31 +308,31 @@ private String getCountryOfNode(NetworkElement networkElement, String nodeCountr } } - private String getCountrySide1(NetworkElement networkElement) { - Optional substationOpt = network.getBranch(networkElement.getId()).getTerminal1().getVoltageLevel().getSubstation(); + private String getCountrySide1(String elementId) { + Optional substationOpt = network.getBranch(elementId).getTerminal1().getVoltageLevel().getSubstation(); if (substationOpt.isPresent()) { Optional country = substationOpt.get().getCountry(); if (country.isPresent()) { return country.get().toString(); } else { - throw new CseDataException("NetworkElement " + networkElement.getId() + " has no country on side 1"); + throw new CseDataException("NetworkElement " + elementId + " has no country on side 1"); } } else { - throw new CseDataException("NetworkElement " + networkElement.getId() + " has no country on side 1"); + throw new CseDataException("NetworkElement " + elementId + " has no country on side 1"); } } - private String getCountrySide2(NetworkElement networkElement) { - Optional substationOpt = network.getBranch(networkElement.getId()).getTerminal2().getVoltageLevel().getSubstation(); + private String getCountrySide2(String elementId) { + Optional substationOpt = network.getBranch(elementId).getTerminal2().getVoltageLevel().getSubstation(); if (substationOpt.isPresent()) { Optional country = substationOpt.get().getCountry(); if (country.isPresent()) { return country.get().toString(); } else { - throw new CseDataException("NetworkElement " + networkElement.getId() + " has no country on side 2"); + throw new CseDataException("NetworkElement " + elementId + " has no country on side 2"); } } else { - throw new CseDataException("NetworkElement " + networkElement.getId() + " has no country on side 2"); + throw new CseDataException("NetworkElement " + elementId + " has no country on side 2"); } } @@ -328,25 +344,33 @@ public String getNodeTo(NetworkElement networkElement) { return networkElement.getId().substring(9, 17); } - public String getOrderCode(NetworkElement networkElement) { - return networkElement.getId().substring(18, 19); + public String getNodeFrom(ContingencyElement contingencyElement) { + return contingencyElement.getId().substring(0, 8); + } + + public String getNodeTo(ContingencyElement contingencyElement) { + return contingencyElement.getId().substring(9, 17); + } + + public String getOrderCode(ContingencyElement contingencyElement) { + return contingencyElement.getId().substring(18, 19); } public static String getOutageName(FlowCnec flowCnec) { Optional contingencyOpt = flowCnec.getState().getContingency(); if (contingencyOpt.isPresent()) { - return contingencyOpt.get().getName(); + return contingencyOpt.get().getName().orElse(contingencyOpt.get().getId()); } else { return PREVENTIVE_OUTAGE_NAME; } } - public static Set getOutageElements(FlowCnec flowCnec) { + public static List getOutageElements(FlowCnec flowCnec) { Optional contingencyOpt = flowCnec.getState().getContingency(); if (contingencyOpt.isPresent()) { - return contingencyOpt.get().getNetworkElements(); + return contingencyOpt.get().getElements(); } else { - return Collections.emptySet(); + return Collections.emptyList(); } } diff --git a/cse-lib/data/src/main/java/com/farao_community/farao/cse/data/ttc_rao/TtcRao.java b/cse-lib/data/src/main/java/com/farao_community/farao/cse/data/ttc_rao/TtcRao.java index 54191843..ce644f7b 100644 --- a/cse-lib/data/src/main/java/com/farao_community/farao/cse/data/ttc_rao/TtcRao.java +++ b/cse-lib/data/src/main/java/com/farao_community/farao/cse/data/ttc_rao/TtcRao.java @@ -23,7 +23,7 @@ import com.farao_community.farao.cse.data.xsd.ttc_rao.PreventiveResult; import com.farao_community.farao.cse.data.xsd.ttc_rao.Status; import com.farao_community.farao.cse.data.xsd.ttc_rao.StringValue; -import com.powsybl.openrao.data.cracapi.Contingency; +import com.powsybl.contingency.Contingency; import com.powsybl.openrao.data.craccreation.creator.api.ElementaryCreationContext; import com.powsybl.openrao.data.craccreation.creator.api.stdcreationcontext.RemedialActionCreationContext; import com.powsybl.openrao.data.craccreation.creator.cse.remedialaction.CseHvdcCreationContext; @@ -96,11 +96,11 @@ private static List getOutageResults(CracResultsHelper cracResults outage.setName(cseOutageCreationContext.getNativeId()); outageResult.setOutage(outage); Contingency contingency = cracResultsHelper.getCrac().getContingency(cseOutageCreationContext.getCreatedContingencyId()); - contingency.getNetworkElements().forEach(contingencyNetworkElement -> { + contingency.getElements().forEach(contingencyElement -> { Branch branch = new Branch(); - branch.setCode(getStringValue(cracResultsHelper.getOrderCode(contingencyNetworkElement))); - branch.setFromNode(getStringValue(cracResultsHelper.getNodeFrom(contingencyNetworkElement))); - branch.setToNode(getStringValue(cracResultsHelper.getNodeTo(contingencyNetworkElement))); + branch.setCode(getStringValue(cracResultsHelper.getOrderCode(contingencyElement))); + branch.setFromNode(getStringValue(cracResultsHelper.getNodeFrom(contingencyElement))); + branch.setToNode(getStringValue(cracResultsHelper.getNodeTo(contingencyElement))); outage.getBranch().add(branch); }); diff --git a/cse-lib/data/src/main/java/com/farao_community/farao/cse/data/ttc_res/TtcResult.java b/cse-lib/data/src/main/java/com/farao_community/farao/cse/data/ttc_res/TtcResult.java index 2775a47c..bef26ac2 100644 --- a/cse-lib/data/src/main/java/com/farao_community/farao/cse/data/ttc_res/TtcResult.java +++ b/cse-lib/data/src/main/java/com/farao_community/farao/cse/data/ttc_res/TtcResult.java @@ -9,9 +9,9 @@ import com.farao_community.farao.cse.data.CseDataException; import com.farao_community.farao.cse.data.cnec.*; import com.farao_community.farao.cse.data.xsd.ttc_res.*; +import com.powsybl.contingency.ContingencyElement; import com.powsybl.openrao.data.cracapi.Crac; -import com.powsybl.openrao.data.cracapi.Contingency; -import com.powsybl.openrao.data.cracapi.NetworkElement; +import com.powsybl.contingency.Contingency; import com.powsybl.openrao.data.cracapi.InstantKind; import com.powsybl.openrao.data.cracapi.cnec.FlowCnec; import com.powsybl.openrao.data.craccreation.creator.api.ElementaryCreationContext; @@ -320,8 +320,8 @@ private static void fillLimitingElement(CracResultsHelper cracResultsHelper, Tim } else { outageName.setV(CracResultsHelper.getOutageName(worstCnec)); outage.setName(outageName); - CracResultsHelper.getOutageElements(worstCnec).forEach(networkElement -> - fillOutageElements(cracResultsHelper, outage, networkElement) + CracResultsHelper.getOutageElements(worstCnec).forEach(contingencyElement -> + fillOutageElements(cracResultsHelper, outage, contingencyElement) ); if (worstCnec.getState().getInstant() == crac.getLastInstant()) { @@ -366,14 +366,14 @@ private static void fillLimitingElement(CracResultsHelper cracResultsHelper, Tim ttcResults.setLimitingElement(limitingElement); } - private static void fillOutageElements(CracResultsHelper cracResultsHelper, Outage outage, NetworkElement networkElement) { + private static void fillOutageElements(CracResultsHelper cracResultsHelper, Outage outage, ContingencyElement contingencyElement) { Element outageElement = new Element(); Code outageElementCode = new Code(); - outageElementCode.setV(networkElement.getId()); + outageElementCode.setV(contingencyElement.getId()); Areafrom outageAreaFrom = new Areafrom(); - outageAreaFrom.setV(cracResultsHelper.getAreaFrom(networkElement)); + outageAreaFrom.setV(cracResultsHelper.getAreaFrom(contingencyElement)); Areato outageAreaTo = new Areato(); - outageAreaTo.setV(cracResultsHelper.getAreaTo(networkElement)); + outageAreaTo.setV(cracResultsHelper.getAreaTo(contingencyElement)); outageElement.setCode(outageElementCode); outageElement.setAreafrom(outageAreaFrom); outageElement.setAreato(outageAreaTo); @@ -396,8 +396,8 @@ private static void fillNotPreventiveCnecs(CracResultsHelper cracResultsHelper, outage.setName(outageName); MonitoredElement monitoredElement = new MonitoredElement(); Contingency contingency = cracResultsHelper.getCrac().getContingency(cseOutageCreationContext.getCreatedContingencyId()); - contingency.getNetworkElements().forEach(contingencyNetworkElement -> - fillOutageElements(cracResultsHelper, outage, contingencyNetworkElement) + contingency.getElements().forEach(contingencyElement -> + fillOutageElements(cracResultsHelper, outage, contingencyElement) ); addCurativeRemedialActions(contingency.getId(), cracResultsHelper, criticalBranch); diff --git a/pom.xml b/pom.xml index 69b5652d..5165ca8b 100644 --- a/pom.xml +++ b/pom.xml @@ -50,9 +50,9 @@ 3.0.0 - 1.28.1 - 4.16.1 - 1.22.1 + 1.29.0 + 4.17.0 + 1.23.0 1.26.1 1.1.2