diff --git a/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java b/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java index 90b999df..c70a200b 100644 --- a/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java +++ b/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java @@ -1863,28 +1863,16 @@ public class SocketDevResponseService { if (channelListDTO.getHarmFlag()) { List harmList = channelListDTO.getHarmList(); double sum = harmList.stream().map(harmModel -> harmModel.getFAmp() * harmModel.getFAmp() / 10000).mapToDouble(x -> x).sum(); - if (channelType.contains("U")) { - if (maxVoltage.compareTo(BigDecimal.valueOf(Math.sqrt(1 + sum) * fAmp)) < 0) { - return 1; - } - } else { - if (maxCurrent.compareTo(BigDecimal.valueOf(Math.sqrt(1 + sum) * fAmp)) < 0) { - return 2; - } + if (maxVoltage.compareTo(BigDecimal.valueOf(Math.sqrt(1 + sum) * fAmp)) < 0) { + return channelType.contains("U") ? 1 : 2; } } // 间谐波判断 if (channelListDTO.getInHarmFlag()) { List inharmList = channelListDTO.getInharmList(); double sum = inharmList.stream().map(harmModel -> harmModel.getFAmp() * harmModel.getFAmp() / 10000).mapToDouble(x -> x).sum(); - if (channelType.contains("U")) { - if (maxVoltage.compareTo(BigDecimal.valueOf(Math.sqrt(1 + sum) * fAmp)) < 0) { - return 1; - } - } else { - if (maxCurrent.compareTo(BigDecimal.valueOf(Math.sqrt(1 + sum) * fAmp)) < 0) { - return 2; - } + if (maxVoltage.compareTo(BigDecimal.valueOf(Math.sqrt(1 + sum) * fAmp)) < 0) { + return channelType.contains("U") ? 1 : 2; } } }