补充功率因数
This commit is contained in:
@@ -1967,9 +1967,6 @@ public class SocketDevResponseService {
|
||||
|
||||
if (nonHarmonicList.contains(sourceIssue.getType())) {
|
||||
for (DevData.SqlDataDTO sqlDataDTO : data.getSqlData()) {
|
||||
if (sqlDataDTO.getDesc().equals("PF")) {
|
||||
continue;
|
||||
}
|
||||
DevData.SqlDataDTO.ListDTO listDTO = sqlDataDTO.getList();
|
||||
SimAndDigNonHarmonicResult adNonHarmonicResult = new SimAndDigNonHarmonicResult();
|
||||
adNonHarmonicResult.setTimeId(localDateTime);
|
||||
|
||||
@@ -575,9 +575,6 @@ public class SocketSourceResponseService {
|
||||
DevPhaseSequenceParam phaseSequenceParam = new DevPhaseSequenceParam();
|
||||
// 设置监测点ID列表
|
||||
phaseSequenceParam.setMoniterIdList(monitorIdList);
|
||||
if (socketDataMsg.getRequestId().equals(SourceOperateCodeEnum.FORMAL_REAL.getValue() + CnSocketUtil.STEP_TAG + "P")) {
|
||||
comm.add("real$PF");
|
||||
}
|
||||
// 设置数据类型列表
|
||||
phaseSequenceParam.setDataType(comm);
|
||||
// 设置读取次数
|
||||
|
||||
@@ -40,7 +40,7 @@ public enum DetectionCodeEnum {
|
||||
W("W", "有功功率"),
|
||||
VARW("VARW", "无功功率"),
|
||||
VAW("VAW", "视在功率"),
|
||||
// PF("PF", "功率因数"),
|
||||
PF("PF", "功率因数"),
|
||||
// P_FUND("P_FUND", "基波有功功率"),
|
||||
// P_HVAR("P_HVAR", "基波无功功率"),
|
||||
// P_HVA("P_HVA", "基波视在功率"),
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.njcn.gather.monitor.service.IPqMonitorService;
|
||||
import com.njcn.gather.plan.pojo.enums.DataSourceEnum;
|
||||
import com.njcn.gather.report.pojo.enums.PowerIndexEnum;
|
||||
import com.njcn.gather.result.pojo.enums.ResultUnitEnum;
|
||||
import com.njcn.gather.script.mapper.PqScriptMapper;
|
||||
import com.njcn.gather.script.pojo.po.PqScriptCheckData;
|
||||
import com.njcn.gather.script.pojo.po.SourceIssue;
|
||||
import com.njcn.gather.script.service.IPqScriptCheckDataService;
|
||||
@@ -72,6 +73,7 @@ public class DetectionServiceImpl {
|
||||
private final IPqMonitorService pqMonitorService;
|
||||
private final IPqDevService pqDevService;
|
||||
private final IPqStandardDevGainRecordService pqStandardDevGainRecordService;
|
||||
private final PqScriptMapper pqScriptMapper;
|
||||
|
||||
public static final String TYPE_A = "A";
|
||||
public static final String TYPE_B = "B";
|
||||
@@ -414,14 +416,12 @@ public class DetectionServiceImpl {
|
||||
List<SimAndDigNonHarmonicResult> info = new ArrayList<>();
|
||||
List<String> devValueTypeList = sourceIssue.getDevValueTypeList();
|
||||
for (String s : devValueTypeList) {
|
||||
if ((DetectionCodeEnum.REAL_PREFIX.getCode() + "PF").equals(s)) {
|
||||
continue;
|
||||
}
|
||||
String[] splitArr = s.split("\\$");
|
||||
// 根据数据处理规则取值。key为相别,value为值列表
|
||||
Map<String, List<Double>> map = devListMap(dev, dataRule, s.split("\\$")[1]);
|
||||
Map<String, List<Double>> map = devListMap(dev, dataRule, splitArr[1]);
|
||||
List<ErrDtlsCheckDataVO> dtlsCheckData = null;
|
||||
if (CollUtil.isNotEmpty(errDtlsCheckData)) {
|
||||
dtlsCheckData = errDtlsCheckData.stream().filter(x -> x.getValueTypeCode().equals(s.split("\\$")[1])).collect(Collectors.toList());
|
||||
dtlsCheckData = errDtlsCheckData.stream().filter(x -> x.getValueTypeCode().equals(splitArr[1])).collect(Collectors.toList());
|
||||
}
|
||||
Double fData = 1.0;
|
||||
if (U.equals(type)) {
|
||||
@@ -434,9 +434,14 @@ public class DetectionServiceImpl {
|
||||
fData = sourceIssue.getFFreq();
|
||||
}
|
||||
if (P.equals(type)) {
|
||||
fData = sourceIssue.getFUn() * sourceIssue.getFIn() * 0.01;
|
||||
Double finalFData = fData;
|
||||
dtlsCheckData.stream().forEach(x -> x.setValue(x.getValue() * finalFData));
|
||||
if (!DetectionCodeEnum.PF.getCode().equals(splitArr[1])) {
|
||||
Boolean valueType = pqScriptMapper.selectScriptIsValueType(sourceIssue.getScriptId());
|
||||
if (valueType) {
|
||||
fData = sourceIssue.getFUn() * sourceIssue.getFIn() / 100;
|
||||
}
|
||||
Double finalFData = fData;
|
||||
dtlsCheckData.stream().forEach(x -> x.setValue(x.getValue() * finalFData));
|
||||
}
|
||||
}
|
||||
SimAndDigNonHarmonicResult result = new SimAndDigNonHarmonicResult();
|
||||
String[] split = dev.get(0).getId().split("_");
|
||||
|
||||
@@ -67,7 +67,7 @@ public class NettyDevClientHandler extends SimpleChannelInboundHandler<String> {
|
||||
/**
|
||||
* 实时数据检测超时时间:1分钟(60秒)
|
||||
*/
|
||||
private static final long REALTIME_TIMEOUT = 60L;
|
||||
private static final long REALTIME_TIMEOUT = 60 * 3L;
|
||||
|
||||
/**
|
||||
* 暂停操作超时时间:10分钟(600秒)
|
||||
|
||||
@@ -421,7 +421,11 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
||||
|
||||
@Override
|
||||
public List<PqScriptDtlsParam.CheckData> scriptDtlsCheckDataList(PqScriptDtlsParam sourceIssue) {
|
||||
// Boolean valueType = pqScriptMapper.selectScriptIsValueType(sourceIssue.getScriptId());
|
||||
Boolean valueType = pqScriptMapper.selectScriptIsValueType(sourceIssue.getScriptId());
|
||||
double radio = 1;
|
||||
if (valueType) {
|
||||
radio = 100;
|
||||
}
|
||||
|
||||
List<PqScriptDtlsParam.CheckData> info = new ArrayList<>();
|
||||
//获取所有下拉值情况
|
||||
@@ -637,10 +641,12 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
||||
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
||||
checkData.setEnable(channelListDTO.getEnable());
|
||||
//电压*电流*cos(电压角度-电流角度)
|
||||
checkData.setValue(channelI.get(0).getFAmp() * listDTO.getFAmp() / 100 * Math.cos((listDTO.getFPhase() - channelI.get(0).getFPhase()) * Math.PI / 180));
|
||||
// if (valueType) {
|
||||
// checkData.setValue(checkData.getValue() * 57.74 * 5);
|
||||
// }
|
||||
double v = listDTO.getFPhase() - channelI.get(0).getFPhase();
|
||||
if (v == 90 || v == -90 || v == 270 || v == -270) {
|
||||
checkData.setValue(0.0);
|
||||
} else {
|
||||
checkData.setValue(channelI.get(0).getFAmp() * listDTO.getFAmp() * Math.cos(v * Math.PI / 180));
|
||||
}
|
||||
setCheck(info, checkData, channelListDTO, checkArchive, listDTO);
|
||||
}
|
||||
}
|
||||
@@ -659,8 +665,13 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
||||
checkData = new PqScriptDtlsParam.CheckData();
|
||||
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
||||
checkData.setEnable(channelListDTO.getEnable());
|
||||
//电压*电流*cos(电压角度-电流角度)
|
||||
checkData.setValue(channelI.get(0).getFAmp() * listDTO.getFAmp() / 100 * Math.sin((listDTO.getFPhase() - channelI.get(0).getFPhase()) * Math.PI / 180));
|
||||
//电压*电流*sin(电压角度-电流角度)
|
||||
double v = listDTO.getFPhase() - channelI.get(0).getFPhase();
|
||||
if (v == 0 || v == 360 || v == 180 || v == -180) {
|
||||
checkData.setValue(0.0);
|
||||
} else {
|
||||
checkData.setValue(channelI.get(0).getFAmp() * listDTO.getFAmp() * Math.sin(v * Math.PI / 180));
|
||||
}
|
||||
// if (valueType) {
|
||||
// checkData.setValue(checkData.getValue() * 57.74 * 5);
|
||||
// }
|
||||
@@ -682,11 +693,32 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
||||
checkData = new PqScriptDtlsParam.CheckData();
|
||||
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
||||
checkData.setEnable(channelListDTO.getEnable());
|
||||
//电压*电流*cos(电压角度-电流角度)
|
||||
checkData.setValue(channelI.get(0).getFAmp() * listDTO.getFAmp() / 100);
|
||||
// if (valueType) {
|
||||
// checkData.setValue(checkData.getValue() * 57.74 * 5);
|
||||
// }
|
||||
checkData.setValue(channelI.get(0).getFAmp() * listDTO.getFAmp() / radio);
|
||||
setCheck(info, checkData, channelListDTO, checkArchive, listDTO);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PF:
|
||||
channelU = channelList.stream().filter(x -> x.getChannelType().contains("U")).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(channelU)) {
|
||||
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)) {
|
||||
checkData = new PqScriptDtlsParam.CheckData();
|
||||
checkData.setErrorFlag(channelListDTO.getErrorFlag());
|
||||
checkData.setEnable(channelListDTO.getEnable());
|
||||
//cos(电压角度-电流角度)
|
||||
double v = listDTO.getFPhase() - channelI.get(0).getFPhase();
|
||||
if (v == 90 || v == -90 || v == 270 || v == -270) {
|
||||
checkData.setValue(0.0);
|
||||
} else {
|
||||
checkData.setValue(Math.cos(v * Math.PI / 180));
|
||||
}
|
||||
setCheck(info, checkData, channelListDTO, checkArchive, listDTO);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user