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 6ac1bc40..a4d725b5 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 @@ -37,11 +37,14 @@ public enum DetectionCodeEnum { I_UNBAN("I_UNBAN", "三相电流负序不平衡度"), SeqA("SeqA", "电流序分量"), PST("PST", "短时间闪变"), - W("W", "有功功率"), - VARW("VARW", "无功功率"), - VAW("VAW", "视在功率"), + W("W", "总有功功率"), + VARW("VARW", "总无功功率"), + VAW("VAW", "总视在功率"), PF("PF", "功率因数"), -// P_FUND("P_FUND", "基波有功功率"), + TOTW("TotW", "三相总有功功率"), + TOTVA("TotVA", "三相总视在功率"), + TOTVAR("TotVAr", "三相总无功功率"), + // P_FUND("P_FUND", "基波有功功率"), // P_HVAR("P_HVAR", "基波无功功率"), // P_HVA("P_HVA", "基波视在功率"), I1("I1", "基波电流"), 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 e499998f..80906004 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 @@ -724,6 +724,88 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl x.getChannelType().contains("U")).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(channelU)) { + Double value = 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) { + value += 0.0; + } else { + value += channelI.get(0).getFAmp() * listDTO.getFAmp() * Math.cos(v * Math.PI / 180); + } + } + } + checkData = new PqScriptDtlsParam.CheckData(); + checkData.setErrorFlag(channelListDTO.getErrorFlag()); + checkData.setEnable(channelListDTO.getEnable()); + checkData.setValue(value); + checkData.setPhase("T"); + checkData.setPid(channelListDTO.getPid()); + checkData.setValueType(channelListDTO.getValueType()); + info.add(checkData); + } + break; + case TOTVAR: + channelU = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(channelU)) { + Double value = 0.0; + for (PqScriptDtlsParam.ChannelListDTO listDTO : channelU) { + //获取电流通道 + channelI = channelList.stream() + .filter(x -> x.getChannelType().contains("I" + listDTO.getChannelType().substring(1, 2))) + .collect(Collectors.toList()); + if (CollUtil.isNotEmpty(channelI)) { + //电压*电流*sin(电压角度-电流角度) + double v = listDTO.getFPhase() - channelI.get(0).getFPhase(); + if (v == 0 || v == 360 || v == 180 || v == -180) { + value += 0.0; + } else { + value += channelI.get(0).getFAmp() * listDTO.getFAmp() * Math.sin(v * Math.PI / 180); + } + } + } + checkData = new PqScriptDtlsParam.CheckData(); + checkData.setErrorFlag(channelListDTO.getErrorFlag()); + checkData.setEnable(channelListDTO.getEnable()); + checkData.setValue(value); + checkData.setPhase("T"); + checkData.setPid(channelListDTO.getPid()); + checkData.setValueType(channelListDTO.getValueType()); + info.add(checkData); + } + break; + case TOTVA: + channelU = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(channelU)) { + Double value = 0.0; + for (PqScriptDtlsParam.ChannelListDTO listDTO : channelU) { + //获取电流通道 + channelI = channelList.stream() + .filter(x -> x.getChannelType().contains("I" + listDTO.getChannelType().substring(1, 2))) + .collect(Collectors.toList()); + if (CollUtil.isNotEmpty(channelI)) { + value += channelI.get(0).getFAmp() * listDTO.getFAmp(); + } + } + checkData = new PqScriptDtlsParam.CheckData(); + checkData.setErrorFlag(channelListDTO.getErrorFlag()); + checkData.setEnable(channelListDTO.getEnable()); + checkData.setValue(value); + checkData.setPhase("T"); + checkData.setPid(channelListDTO.getPid()); + checkData.setValueType(channelListDTO.getValueType()); + info.add(checkData); + } + break; case UNKNOWN_ERROR: break; default: diff --git a/system/src/main/java/com/njcn/gather/system/dictionary/service/impl/DictTreeServiceImpl.java b/system/src/main/java/com/njcn/gather/system/dictionary/service/impl/DictTreeServiceImpl.java index b821df45..82013a4a 100644 --- a/system/src/main/java/com/njcn/gather/system/dictionary/service/impl/DictTreeServiceImpl.java +++ b/system/src/main/java/com/njcn/gather/system/dictionary/service/impl/DictTreeServiceImpl.java @@ -83,9 +83,9 @@ public class DictTreeServiceImpl extends ServiceImpl i public boolean updateDictTree(DictTreeParam.UpdateParam param) { param.setName(param.getName().trim()); DictTree dictTree = this.getById(param.getId()); - if ("975f63baeb6f653c54fca226a9ae36ca".equals(param.getId()) || dictTree.getPids().contains("975f63baeb6f653c54fca226a9ae36ca")) { - throw new BusinessException(SystemResponseEnum.CAN_NOT_UPDATE_USED_DICT); - } +// if ("975f63baeb6f653c54fca226a9ae36ca".equals(param.getId()) || dictTree.getPids().contains("975f63baeb6f653c54fca226a9ae36ca")) { +// throw new BusinessException(SystemResponseEnum.CAN_NOT_UPDATE_USED_DICT); +// } checkRepeat(param, true); DictTree copyDictTree = new DictTree(); BeanUtils.copyProperties(param, copyDictTree); diff --git a/system/src/main/java/com/njcn/gather/system/pojo/enums/DicDataEnum.java b/system/src/main/java/com/njcn/gather/system/pojo/enums/DicDataEnum.java index deeb9880..8802d2c8 100644 --- a/system/src/main/java/com/njcn/gather/system/pojo/enums/DicDataEnum.java +++ b/system/src/main/java/com/njcn/gather/system/pojo/enums/DicDataEnum.java @@ -23,6 +23,7 @@ public enum DicDataEnum { HSI("HSI","间谐波电流"), VOLTAGE("VOLTAGE","暂态"), F("F","闪变"), + P("P","功率")