补充三相总有功功率、三相总无功功率、三相总视在功率

This commit is contained in:
caozehui
2026-07-06 16:28:24 +08:00
parent 4d52e9c820
commit cf2dcf8ff4
4 changed files with 93 additions and 7 deletions

View File

@@ -37,10 +37,13 @@ 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", "功率因数"),
TOTW("TotW", "三相总有功功率"),
TOTVA("TotVA", "三相总视在功率"),
TOTVAR("TotVAr", "三相总无功功率"),
// P_FUND("P_FUND", "基波有功功率"),
// P_HVAR("P_HVAR", "基波无功功率"),
// P_HVA("P_HVA", "基波视在功率"),

View File

@@ -724,6 +724,88 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
}
}
break;
case TOTW:
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(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:

View File

@@ -83,9 +83,9 @@ public class DictTreeServiceImpl extends ServiceImpl<DictTreeMapper, DictTree> 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);

View File

@@ -23,6 +23,7 @@ public enum DicDataEnum {
HSI("HSI","间谐波电流"),
VOLTAGE("VOLTAGE","暂态"),
F("F","闪变"),
P("P","功率")