UcteConverterHelper { public static double calculatePhaseDu(TwoWindingsTransformer twoWindingsTransformer) { double rhoMin = Double.MAX_VALUE; double rhoMax = -Double.MAX_VALUE; RatioTapChanger tapChanger = twoWindingsTransformer.getRatioTapChanger(); for (int i = tapChanger.getLowTapPosition(); i <= tapChanger.getHighTapPosition(); ++i) { rhoMin = Double.min(rhoMin, tapChanger.getStep(i).getRho()); rhoMax = Double.max(rhoMax, tapChanger.getStep(i).getRho()); } double res = 100 * (1 / rhoMin - 1 / rhoMax) / (tapChanger.getStepCount() - 1); return BigDecimal.valueOf(res).setScale(4, RoundingMode.HALF_UP).doubleValue(); } private  UcteConverterHelper(); static double calculatePhaseDu(TwoWindingsTransformer twoWindingsTransformer); static double calculateSymmAngleDu(TwoWindingsTransformer twoWindingsTransformer); static double calculateAsymmAngleDu(TwoWindingsTransformer twoWindingsTransformer); static double calculateAsymmAngleTheta(TwoWindingsTransformer twoWindingsTransformer);  }
@Test public void calculatePhaseDuTest() { assertEquals(2.0000, calculatePhaseDu(reference.getTwoWindingsTransformer("0BBBBB5 0AAAAA2 1")), 0.00001); assertNotEquals(2.0001, calculatePhaseDu(reference.getTwoWindingsTransformer("0BBBBB5 0AAAAA2 1")), 0.00001); }