From efb379d6a45d0e9b16e964acb19d267b992ecd62 Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Mon, 6 Jul 2026 20:05:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E4=B8=89=E7=9B=B8=E5=8A=9F?= =?UTF-8?q?=E7=8E=87=E5=9B=A0=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pojo/enums/DetectionCodeEnum.java | 1 + .../service/impl/PqScriptDtlsServiceImpl.java | 32 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/detection/src/main/java/com/njcn/gather/detection/pojo/enums/DetectionCodeEnum.java b/detection/src/main/java/com/njcn/gather/detection/pojo/enums/DetectionCodeEnum.java index a4d725b5..c20e457b 100644 --- a/detection/src/main/java/com/njcn/gather/detection/pojo/enums/DetectionCodeEnum.java +++ b/detection/src/main/java/com/njcn/gather/detection/pojo/enums/DetectionCodeEnum.java @@ -44,6 +44,7 @@ public enum DetectionCodeEnum { TOTW("TotW", "三相总有功功率"), TOTVA("TotVA", "三相总视在功率"), TOTVAR("TotVAr", "三相总无功功率"), + TOTPF("TotPF","三相功率因数"), // P_FUND("P_FUND", "基波有功功率"), // P_HVAR("P_HVAR", "基波无功功率"), // P_HVA("P_HVA", "基波视在功率"), diff --git a/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptDtlsServiceImpl.java b/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptDtlsServiceImpl.java index 80906004..b3174abd 100644 --- a/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptDtlsServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptDtlsServiceImpl.java @@ -806,6 +806,38 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl x.getChannelType().contains("U")).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(channelU)) { + Double valueTotW = 0.0; + Double valueTotVA = 0.0; + for (PqScriptDtlsParam.ChannelListDTO listDTO : channelU) { + //获取电流通道 + channelI = channelList.stream() +// .filter(PqScriptDtlsParam.ChannelListDTO::getHarmFlag) + .filter(x -> x.getChannelType().contains("I" + listDTO.getChannelType().substring(1, 2))) + .collect(Collectors.toList()); + if (CollUtil.isNotEmpty(channelI)) { + //cos(电压角度-电流角度) + double v = listDTO.getFPhase() - channelI.get(0).getFPhase(); + if (v == 90 || v == -90 || v == 270 || v == -270) { + valueTotW += 0.0; + } else { + valueTotW += channelI.get(0).getFAmp() * listDTO.getFAmp() * Math.cos(v * Math.PI / 180); + } + valueTotVA += channelI.get(0).getFAmp() * listDTO.getFAmp(); + } + } + checkData = new PqScriptDtlsParam.CheckData(); + checkData.setErrorFlag(channelListDTO.getErrorFlag()); + checkData.setEnable(channelListDTO.getEnable()); + checkData.setValue(valueTotW / valueTotVA); + checkData.setPhase("T"); + checkData.setPid(channelListDTO.getPid()); + checkData.setValueType(channelListDTO.getValueType()); + info.add(checkData); + } + break; case UNKNOWN_ERROR: break; default: