Skip to content

Commit 6a7048c

Browse files
authored
do not read imax for cim if no %imax threshold defined (#1456)
Signed-off-by: Thomas Bouquet <thomas.bouquet@rte-france.com>
1 parent ea80e63 commit 6a7048c

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

data/crac/crac-io/crac-io-cim/src/main/java/com/powsybl/openrao/data/crac/io/cim/craccreator/MonitoredSeriesCreator.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,20 @@ private MeasurementCreationContext createCnecFromMeasurement(Analog measurement,
248248
try {
249249
cnecId = addThreshold(flowCnecAdder, unit, branchHelper, cnecNativeId, direction, threshold);
250250
setNominalVoltage(flowCnecAdder, branchHelper);
251-
IidmCnecElementHelper cnecElementHelper = new IidmCnecElementHelper(branchHelper.getBranch().getId(), network);
252-
flowCnecAdder.withIMax(cnecElementHelper.getCurrentLimit(TwoSides.ONE), TwoSides.ONE);
253-
flowCnecAdder.withIMax(cnecElementHelper.getCurrentLimit(TwoSides.TWO), TwoSides.TWO);
251+
if (Unit.PERCENT_IMAX.equals(unit)) {
252+
IidmCnecElementHelper cnecElementHelper = new IidmCnecElementHelper(branchHelper.getBranch().getId(), network);
253+
Double currentLimit1 = cnecElementHelper.getCurrentLimit(TwoSides.ONE);
254+
Double currentLimit2 = cnecElementHelper.getCurrentLimit(TwoSides.TWO);
255+
if (currentLimit1 != null && currentLimit2 != null) {
256+
flowCnecAdder.withIMax(currentLimit1, TwoSides.ONE);
257+
flowCnecAdder.withIMax(currentLimit2, TwoSides.TWO);
258+
} else if (currentLimit1 == null) {
259+
flowCnecAdder.withIMax(currentLimit2);
260+
} else {
261+
flowCnecAdder.withIMax(currentLimit1);
262+
}
263+
}
264+
254265
} catch (OpenRaoException e) {
255266
if (instant.isPreventive()) {
256267
measurementCreationContext.addCnecCreationContext(null, instant, CnecCreationContext.notImported(ImportStatus.OTHER, e.getMessage()));

0 commit comments

Comments
 (0)