有功功率趋势定时任务算法优化

This commit is contained in:
guofeihu
2024-09-12 19:18:17 +08:00
parent 8be5c88737
commit 270eee3c26
2 changed files with 49 additions and 12 deletions

View File

@@ -146,11 +146,38 @@ public class PowerStatisticsServiceImpl implements PowerStatisticsService {
//间谐波电压含有率带有谐波次数需要特殊处理
powerStatisticsTargetVO.setInterHarmonicList(initFrequencyPV(value,Param.interHarmonic,value.get(0).getInterHarmonicLimit()));
powerStatisticsTargetVO.setSequenceCurrentUnbalanceList(initPV(pvs,Param.sequenceCurrentUnbalance,value.get(0).getSequenceCurrentUnbalanceLimit()));
powerStatisticsTargetVO.setVTimesList(formatFrequency(powerStatisticsTargetVO.getVTimesList()));
powerStatisticsTargetVO.setITimestList(formatFrequency(powerStatisticsTargetVO.getITimestList()));
powerStatisticsTargetVO.setInterHarmonicList(formatFrequency(powerStatisticsTargetVO.getInterHarmonicList()));
data.add(powerStatisticsTargetVO);
});
return data.stream().sorted(Comparator.comparing(PowerStatisticsTargetVO::getTime)).collect(Collectors.toList());
}
private List<ThdDataVO> formatFrequency(List<ThdDataVO> thdDataVOS){
List<ThdDataVO> data = new ArrayList<>();
for(ThdDataVO thdDataVO : thdDataVOS){
boolean isOk = false;
if(thdDataVO.getMINPhaseA()!= null && Float.parseFloat(thdDataVO.getMINPhaseA())>thdDataVO.getLimit()) isOk = true;
if(thdDataVO.getMINPhaseB()!= null && Float.parseFloat(thdDataVO.getMINPhaseB())>thdDataVO.getLimit()) isOk = true;
if(thdDataVO.getMINPhaseC()!= null && Float.parseFloat(thdDataVO.getMINPhaseC())>thdDataVO.getLimit()) isOk = true;
if(thdDataVO.getMAXPhaseA()!= null && Float.parseFloat(thdDataVO.getMAXPhaseA())>thdDataVO.getLimit()) isOk = true;
if(thdDataVO.getMAXPhaseB()!= null && Float.parseFloat(thdDataVO.getMAXPhaseB())>thdDataVO.getLimit()) isOk = true;
if(thdDataVO.getMAXPhaseC()!= null && Float.parseFloat(thdDataVO.getMAXPhaseC())>thdDataVO.getLimit()) isOk = true;
if(thdDataVO.getAVGPhaseA()!= null && Float.parseFloat(thdDataVO.getAVGPhaseA())>thdDataVO.getLimit()) isOk = true;
if(thdDataVO.getAVGPhaseB()!= null && Float.parseFloat(thdDataVO.getAVGPhaseB())>thdDataVO.getLimit()) isOk = true;
if(thdDataVO.getAVGPhaseC()!= null && Float.parseFloat(thdDataVO.getAVGPhaseC())>thdDataVO.getLimit()) isOk = true;
if(thdDataVO.getCP95PhaseA()!= null && Float.parseFloat(thdDataVO.getCP95PhaseA())>thdDataVO.getLimit()) isOk = true;
if(thdDataVO.getCP95PhaseB()!= null && Float.parseFloat(thdDataVO.getCP95PhaseB())>thdDataVO.getLimit()) isOk = true;
if(thdDataVO.getCP95PhaseC()!= null && Float.parseFloat(thdDataVO.getCP95PhaseC())>thdDataVO.getLimit()) isOk = true;
if(isOk){
data.add(thdDataVO);
}
}
return data;
}
private List<ThdDataVO> initPV(List<Map<String,String>> pv, String name, Float limit){
List<ThdDataVO> thdDataVOS = new ArrayList<>();
ThdDataVO tdv = new ThdDataVO();
@@ -296,11 +323,11 @@ public class PowerStatisticsServiceImpl implements PowerStatisticsService {
tdv.setCP95PhaseB(frequencyPVList(cp94B,i-k));
tdv.setCP95PhaseC(frequencyPVList(cp94C,i-k));
tdv.setMINPhaseA(frequencyPVList(minA,i-k));
tdv.setMINPhaseA(frequencyPVList(minB,i-k));
tdv.setMINPhaseA(frequencyPVList(minC,i-k));
tdv.setMINPhaseB(frequencyPVList(minB,i-k));
tdv.setMINPhaseC(frequencyPVList(minC,i-k));
tdv.setMAXPhaseA(frequencyPVList(maxA,i-k));
tdv.setMAXPhaseA(frequencyPVList(maxB,i-k));
tdv.setMAXPhaseA(frequencyPVList(maxC,i-k));
tdv.setMAXPhaseB(frequencyPVList(maxB,i-k));
tdv.setMAXPhaseC(frequencyPVList(maxC,i-k));
} catch (Exception e) {
e.printStackTrace();
}