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

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

@@ -97,11 +97,12 @@ public class RActivePowerRangeServiceImpl extends MppServiceImpl<RActivePowerRan
//时间段
commonQueryParam.setStartTime(startTime);
commonQueryParam.setEndTime(endTime);
//临时模拟增加的条件(用于调试主要是数据量太大非常消耗时间)
//临时模拟增加的条件(用于调试主要是数据量太大非常消耗时间) 2024-09-01 00:00:00
// commonQueryParam.setDataType("AVG");
// commonQueryParam.setPhasic("A");
// commonQueryParam.setStartTime("2024-09-01 00:00:00");
// commonQueryParam.setEndTime("2024-09-01 00:00:00");
commonQueryParam.setStartTime("2024-08-10 00:00:00");
commonQueryParam.setEndTime("2024-08-10 00:00:00");
//模拟增加的条件结束
//功率表data_harmpower_p及字段p
commonQueryParam.setTableName(InfluxDBTableConstant.DATA_HARM_POWER_P);
commonQueryParam.setColumnName("p");
@@ -150,8 +151,20 @@ public class RActivePowerRangeServiceImpl extends MppServiceImpl<RActivePowerRan
PowerStatisticsTargetVO powerStatisticsTargetVO = new PowerStatisticsTargetVO();
//设置时间为当前功率的时间
powerStatisticsTargetVO.setTime(statisticalDataDTO.getTime().atZone(ZoneId.systemDefault()).format(formatter));
powerStatisticsTargetVO.setTime("2024-08-10 00:00:00");
//当前功率的p字段 / 风电场额定功率
double temp = statisticalDataDTO.getValue() / Double.parseDouble(newStation.getRatedPower());
//区间过滤下(用于前端查询)
if(finalRActivePowerRangeParam.isSearch() && finalRActivePowerRangeParam.getField() != null){
if(Double.parseDouble(finalRActivePowerRangeParam.getField()) < temp * 10 && temp * 10 <= Double.parseDouble(finalRActivePowerRangeParam.getField())+1){
//指标越限列表区间区分字段(用于前端查询)
powerStatisticsTargetVO.setField(finalRActivePowerRangeParam.getField());
//判断每个指标是否越限(根据type来区分设置到哪个区间对应的是否越限字段)
installLimit(rActivePowerRangePO,statisticalDataDTO,overlimit,Integer.parseInt(finalRActivePowerRangeParam.getField()),powerStatisticsTargetVO);
powerStatisticsTargetVOS.add(powerStatisticsTargetVO);
}
continue;
}
if(temp <= 0.1){
//占有率区间个数+1
rActivePowerRangePO.setMinsNum0(rActivePowerRangePO.getMinsNum0() + 1);
@@ -196,7 +209,6 @@ public class RActivePowerRangeServiceImpl extends MppServiceImpl<RActivePowerRan
powerStatisticsTargetVO.setField("9");
installLimit(rActivePowerRangePO,statisticalDataDTO,overlimit,9,powerStatisticsTargetVO);
}
//重点说明:powerStatisticsTargetVO结构(维度)为:time可能多组相同,取决于功率表data_harmpower_p中的相别及统计方式,标识每个指标是否越限,总之一句话:每条数据当前时间中八个指标是否越限及他们的相别和统计方式是什么
powerStatisticsTargetVOS.add(powerStatisticsTargetVO);
log.info("前监测点为:{},遍历第{}条...,遍历结束,{}",key,index,sdf.format(new Date()));
index++;
@@ -210,11 +222,8 @@ public class RActivePowerRangeServiceImpl extends MppServiceImpl<RActivePowerRan
}
});
log.info("当前遍历的功率根据监测点分组后长度为:{},集合总长为:{},遍历结束,{}",map.size(),dataHarmPowerPS.size(),sdf.format(new Date()));
//区间过滤下(用于前端查询)
if(rActivePowerRangeParam.isSearch()){
if(finalRActivePowerRangeParam.getField() != null){
return powerStatisticsTargetVOS.stream().filter(param->param.getField().equals(finalRActivePowerRangeParam.getField())).collect(Collectors.toList());
}
//重点说明:powerStatisticsTargetVO结构(维度)为:time可能多组相同,取决于功率表data_harmpower_p中的相别及统计方式,标识每个指标是否越限,总之一句话:每条数据当前时间中八个指标是否越限及他们的相别和统计方式是什么
return powerStatisticsTargetVOS;
}
return null;
@@ -411,6 +420,7 @@ public class RActivePowerRangeServiceImpl extends MppServiceImpl<RActivePowerRan
List<CommonQueryParam> commonQueryParams = new ArrayList<>();
//不管哪种时间是固定的
String time = statisticalDataDTO.getTime().atZone(ZoneId.systemDefault()).format(formatter);
time = "2024-08-10 00:00:00";
CommonQueryParam commonQueryParam = new CommonQueryParam();
//无谐波次数指标查询
if(start == null){