diff --git a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/DiscretePstTapFiller.java b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/DiscretePstTapFiller.java index 869b64e97b..d1531cf72c 100644 --- a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/DiscretePstTapFiller.java +++ b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/DiscretePstTapFiller.java @@ -181,10 +181,10 @@ private void refineTapToAngleConversionCoefficientAndUpdateBounds(LinearProblem */ private Pair getMinAndMaxAdmissibleTaps(PstRangeAction pstRangeAction, State state) { double prePerimeterAngle = prePerimeterRangeActionSetpoints.getSetpoint(pstRangeAction); - int minAdmissibleTap = pstRangeAction.convertAngleToTap(pstRangeAction.getMinAdmissibleSetpoint(prePerimeterAngle)); - int maxAdmissibleTap = pstRangeAction.convertAngleToTap(pstRangeAction.getMaxAdmissibleSetpoint(prePerimeterAngle)); - minAdmissibleTap = Math.min(maxAdmissibleTap, minAdmissibleTap); - maxAdmissibleTap = Math.max(maxAdmissibleTap, minAdmissibleTap); + int minTap = pstRangeAction.convertAngleToTap(pstRangeAction.getMinAdmissibleSetpoint(prePerimeterAngle)); + int maxTap = pstRangeAction.convertAngleToTap(pstRangeAction.getMaxAdmissibleSetpoint(prePerimeterAngle)); + int minAdmissibleTap = Math.min(maxTap, minTap); + int maxAdmissibleTap = Math.max(maxTap, minTap); Pair, State> lastAvailableRangeAction = RaoUtil.getLastAvailableRangeActionOnSameNetworkElement(optimizationPerimeter, pstRangeAction, state); if (lastAvailableRangeAction != null) {