补充三相功率因数
This commit is contained in:
@@ -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", "基波视在功率"),
|
||||
|
||||
@@ -806,6 +806,38 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
||||
info.add(checkData);
|
||||
}
|
||||
break;
|
||||
case TOTPF:
|
||||
channelU = channelList.stream().filter(x -> 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:
|
||||
|
||||
Reference in New Issue
Block a user