diff --git a/data/crac-creation/crac-creator-csa-profiles/src/main/java/com/powsybl/openrao/data/craccreation/creator/csaprofile/craccreator/cnec/AbstractCnecCreator.java b/data/crac-creation/crac-creator-csa-profiles/src/main/java/com/powsybl/openrao/data/craccreation/creator/csaprofile/craccreator/cnec/AbstractCnecCreator.java index b54b61e35b..1bf8b2769a 100644 --- a/data/crac-creation/crac-creator-csa-profiles/src/main/java/com/powsybl/openrao/data/craccreation/creator/csaprofile/craccreator/cnec/AbstractCnecCreator.java +++ b/data/crac-creation/crac-creator-csa-profiles/src/main/java/com/powsybl/openrao/data/craccreation/creator/csaprofile/craccreator/cnec/AbstractCnecCreator.java @@ -9,6 +9,7 @@ import com.powsybl.contingency.Contingency; import com.powsybl.openrao.data.cracapi.Crac; import com.powsybl.openrao.data.cracapi.cnec.CnecAdder; +import com.powsybl.openrao.data.cracapi.cnec.FlowCnecAdder; import com.powsybl.iidm.network.TwoSides; import com.powsybl.openrao.data.craccreation.creator.csaprofile.craccreator.CsaProfileCracCreationContext; import com.powsybl.openrao.data.craccreation.creator.csaprofile.craccreator.CsaProfileCracUtils; @@ -97,9 +98,12 @@ private void initCnecAdder(CnecAdder cnecAdder, Contingency contingency, Stri .withId(cnecName) .withName(cnecName) .withInstant(instantId) - .withOperator(CsaProfileCracUtils.getTsoNameFromUrl(nativeAssessedElement.operator())) - .withOptimized(aeSecuredForRegion) - .withMonitored(aeScannedForRegion); + .withOperator(CsaProfileCracUtils.getTsoNameFromUrl(nativeAssessedElement.operator())); + if (cnecAdder instanceof FlowCnecAdder) { + // The following 2 lines mustn't be called for angle & voltage CNECs + cnecAdder.withOptimized(aeSecuredForRegion) + .withMonitored(aeScannedForRegion); + } } protected void markCnecAsImportedAndHandleRejectedContingencies(String cnecName) { diff --git a/data/crac-creation/crac-creator-csa-profiles/src/main/java/com/powsybl/openrao/data/craccreation/creator/csaprofile/craccreator/cnec/AngleCnecCreator.java b/data/crac-creation/crac-creator-csa-profiles/src/main/java/com/powsybl/openrao/data/craccreation/creator/csaprofile/craccreator/cnec/AngleCnecCreator.java index a0cf4107b9..9d4fb7c562 100644 --- a/data/crac-creation/crac-creator-csa-profiles/src/main/java/com/powsybl/openrao/data/craccreation/creator/csaprofile/craccreator/cnec/AngleCnecCreator.java +++ b/data/crac-creation/crac-creator-csa-profiles/src/main/java/com/powsybl/openrao/data/craccreation/creator/csaprofile/craccreator/cnec/AngleCnecCreator.java @@ -54,7 +54,7 @@ private void addAngleCnec(String instantId, Contingency contingency) { } private AngleCnecAdder initAngleCnec() { - return crac.newAngleCnec().withReliabilityMargin(0); + return crac.newAngleCnec().withReliabilityMargin(0).withOptimized(false).withMonitored(true); } private void addAngleLimit(AngleCnecAdder angleCnecAdder) {