|
@@ -130,6 +130,19 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
return byDate;
|
|
|
}
|
|
|
|
|
|
+ public List<StationInfoMin> getStationinfoByMin(Date date, String stId) {
|
|
|
+ QueryWrapper<StationInfoMin> wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.eq("record_date", date).eq("station_id", stId);
|
|
|
+ List<StationInfoMin> list = stationInfoMinService.list(wrapper);
|
|
|
+ if (CollUtil.isEmpty(list)) {
|
|
|
+ StationInfoMin day = new StationInfoMin();
|
|
|
+ day.setStationId(stId);
|
|
|
+ day.setRecordDate(date);
|
|
|
+ list.add(day);
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public StationInfoDay getStationinfoByDate(Date date, String stId) {
|
|
|
QueryWrapper<StationInfoDay> wrapper = new QueryWrapper<>();
|
|
@@ -1896,7 +1909,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
}
|
|
|
ef.setPointDatas(null);
|
|
|
glInfo.setPointDatas(null);
|
|
|
- String key = "glqxnh:" + (end.getMonth() + 1) + ":" + wtId;
|
|
|
+ String key = "glqxnh:" + end.getMonth() + ":" + wtId;
|
|
|
stringRedisTemplate.opsForValue().set(key, JSON.toJSONString(fit));
|
|
|
CalcCache.fitcoef.put(key, new ConcurrentHashMap<>(fit));
|
|
|
}
|
|
@@ -2018,6 +2031,15 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public void getSectionDataByEntity(List<PointInfo> entitys, URI uri, Date end) {
|
|
|
+ String collect = entitys.stream().map(PointInfo::getPointKey).collect(Collectors.joining(","));
|
|
|
+ Map<String, PointData> section1 = adapter.getHistorySection(uri, collect, end.getTime());
|
|
|
+ for (PointInfo entity : entitys) {
|
|
|
+ entity.setPointDatas(new ArrayList<>());
|
|
|
+ entity.getPointDatas().add(section1.get(entity.getPointKey()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public void getSnapDataByEntity(List<PointInfo> entity, URI uri, Date start, Date end, int interval) {
|
|
|
for (PointInfo info : entity) {
|
|
|
getSnapDataByEntity(info, uri, start, end, interval);
|
|
@@ -3236,7 +3258,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
public void getRawDataByEntity(List<PointInfo> entity, URI uri, Date start, Date end) {
|
|
|
for (PointInfo info : entity) {
|
|
|
List<PointData> snap = adapter.getHistoryRaw(uri, info.getPointKey(), start.getTime(), end.getTime());
|
|
|
- ThreadUtil.sleep(5);
|
|
|
+// ThreadUtil.sleep(5);
|
|
|
info.setPointDatas(snap);
|
|
|
}
|
|
|
}
|
|
@@ -4061,7 +4083,8 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
//AGC
|
|
|
List<PointInfo> entityAgc = getEntity("AGC002", "booster");
|
|
|
entityAgc = entityAgc.stream().filter(e -> stId.equals(e.getStationId())).collect(Collectors.toList());
|
|
|
- Map<String, PointInfo> statMapAgc = getRawDataByEntity(entityAgc, goldenUri(), begin, end, PointInfo::getStationId);
|
|
|
+ getSectionDataByEntity(entityAgc, goldenUri(), end);
|
|
|
+ Map<String, PointInfo> mapAgc = entityAgc.stream().collect(Collectors.toMap(PointInfo::getStationId, Function.identity()));
|
|
|
//出线
|
|
|
List<PointInfo> entityCx = getEntity("AGC001", "booster");
|
|
|
entityCx = entityCx.stream().filter(e -> stId.equals(e.getStationId())).collect(Collectors.toList());
|
|
@@ -4082,33 +4105,74 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
getSectionDataByEntity(entity, goldenUri(), begin, end);
|
|
|
Map<String, List<PointInfo>> fdlsMap = entity.stream().collect(Collectors.groupingBy(PointInfo::getStationId));
|
|
|
|
|
|
- List<StationInfoMin> byDate = getStationinfoByMin(end, entityAgc);
|
|
|
+ List<StationInfoMin> byDate = getStationinfoByMin(end, stId);
|
|
|
+ byDate = byDate.stream().filter(e -> stId.equals(e.getStationId())).collect(Collectors.toList());
|
|
|
|
|
|
for (StationInfoMin day : byDate) {
|
|
|
String id = day.getStationId();
|
|
|
- PointInfo agcInfo = statMapAgc.get(id);
|
|
|
- PointInfo cxInfo = statMapCx.get(id);
|
|
|
+// if (day.getPjfs() == null || day.getPjfs() == 0) {
|
|
|
List<PointInfo> fsInfos = fssMap.get(id);
|
|
|
double pjfs = fsInfos.stream().mapToDouble(pi -> pi.getPointDatas().stream().mapToDouble(PointData::getValue).average().orElse(0.0)).average().orElse(0);
|
|
|
- List<PointInfo> hjwdInfos = hjwdsMap.get(id);
|
|
|
- double hjwd = hjwdInfos.stream().mapToDouble(pi -> pi.getPointDatas().stream().mapToDouble(PointData::getValue).average().orElse(0.0)).average().orElse(0);
|
|
|
+ day.setPjfs(pjfs);
|
|
|
+// }
|
|
|
+// if (day.getPjgl() == null || day.getPjgl() == 0) {
|
|
|
+ PointInfo cxInfo = statMapCx.get(id);
|
|
|
+ double cxgl = cxInfo.getPointDatas().stream().mapToDouble(PointData::getValue).average().orElse(0.0);
|
|
|
+ cxgl = cxgl * cxInfo.getCoef();
|
|
|
+
|
|
|
+ if (cxgl < 0 && pjfs > 3) cxgl = nihe(pjfs);
|
|
|
+ day.setPjgl(cxgl);
|
|
|
+// }
|
|
|
+// if (day.getAgc() == null || day.getAgc() == 0) {
|
|
|
+ PointInfo agcInfo = mapAgc.get(id);
|
|
|
+ double agc = agcInfo.getPointDatas().get(0).getValue() * agcInfo.getCoef();
|
|
|
+ if (agc < cxgl) agc = cxgl;
|
|
|
+ day.setAgc(agc);
|
|
|
+// }
|
|
|
+// if (day.getRfdl() == null || day.getRfdl() == 0) {
|
|
|
List<PointInfo> fdlInfos = fdlsMap.get(id);
|
|
|
double rfdl = fdlInfos.stream().mapToDouble(pi -> {
|
|
|
double v = (pi.getPointDatas().get(1).getValue() - pi.getPointDatas().get(0).getValue()) * pi.getCoef();
|
|
|
- if (v < 0 || v > 720000) v = 0;
|
|
|
+ if (v < 0) v = 0;
|
|
|
+ if (v > 7500) v = 7500.0;
|
|
|
return v;
|
|
|
}).sum();
|
|
|
- double agc = agcInfo.getPointDatas().stream().mapToDouble(PointData::getValue).average().orElse(0.0);
|
|
|
- double cxgl = cxInfo.getPointDatas().stream().mapToDouble(PointData::getValue).average().orElse(0.0);
|
|
|
- day.setAgc(agc * agcInfo.getCoef());
|
|
|
- day.setPjgl(cxgl * cxInfo.getCoef());
|
|
|
- day.setPjfs(pjfs);
|
|
|
+ if (rfdl < 660 && cxgl > 0) rfdl = cxgl / 4.0;
|
|
|
day.setRfdl(rfdl);
|
|
|
+// }
|
|
|
+// if (day.getHjwd() == null || day.getHjwd() == 0) {
|
|
|
+ List<PointInfo> hjwdInfos = hjwdsMap.get(id);
|
|
|
+ double hjwd = hjwdInfos.stream().mapToDouble(pi -> pi.getPointDatas().stream().mapToDouble(PointData::getValue).average().orElse(0.0)).average().orElse(0);
|
|
|
day.setHjwd(hjwd);
|
|
|
+// }
|
|
|
}
|
|
|
stationInfoMinService.saveOrUpdateBatch(byDate);
|
|
|
}
|
|
|
|
|
|
+ private double nihe(double pjfs) {
|
|
|
+ //LJS
|
|
|
+ return -90.4382 * Math.pow(pjfs, 3) + 1661.275 * Math.pow(pjfs, 2) + 2245.86 * pjfs - 17011.14;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void getPoint() {
|
|
|
+ //AGC
|
|
|
+ List<PointInfo> entityAgc = getEntity("AGC002", "booster");
|
|
|
+ Map<String, PointInfo> mapAgc = entityAgc.stream().collect(Collectors.toMap(PointInfo::getStationId, Function.identity()));
|
|
|
+ //出线
|
|
|
+ List<PointInfo> entityCx = getEntity("AGC001", "booster");
|
|
|
+ //风速
|
|
|
+ List<PointInfo> entityFs = getEntity("AI066", "turbine");
|
|
|
+ Map<String, List<PointInfo>> fssMap = entityFs.stream().collect(Collectors.groupingBy(PointInfo::getStationId));
|
|
|
+ //环境温度
|
|
|
+ List<PointInfo> entityHjwd = getEntity("AI072", "turbine");
|
|
|
+ Map<String, List<PointInfo>> hjwdsMap = entityHjwd.stream().collect(Collectors.groupingBy(PointInfo::getStationId));
|
|
|
+ //日发电量
|
|
|
+ List<PointInfo> entity = getEntity("Z-ZXYG-JX", "meter");
|
|
|
+ entity = entity.stream().filter(e -> !"".equals(e.getProjectId())).collect(Collectors.toList());
|
|
|
+ Map<String, List<PointInfo>> fdlsMap = entity.stream().collect(Collectors.groupingBy(PointInfo::getStationId));
|
|
|
+ System.out.println();
|
|
|
+ }
|
|
|
+
|
|
|
public void calcPredictExamin(Date date) {
|
|
|
DateTime end = DateUtil.beginOfDay(date);
|
|
|
DateTime begin = DateUtil.offsetDay(end, -1);
|
|
@@ -4117,7 +4181,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
entity.addAll(entity1);
|
|
|
Map<String, EquipmentModel> map = equipmentModelService.map();
|
|
|
|
|
|
- Map<String, Double> tbPowerMap = entity.stream().collect(Collectors.toMap(pi -> pi.getTurbineId(), pi -> map.get(pi.getTurbineId()).getPowerProduction()));
|
|
|
+ Map<String, Double> tbPowerMap = entity.stream().collect(Collectors.toMap(pi -> pi.getTurbineId(), pi -> map.get(pi.getSpare()).getPowerProduction()));
|
|
|
List<PointInfo> entityGl = getEntity("AI114", "turbine");
|
|
|
getSnapDataByEntity(entityGl, begin, end, 15 * 60);
|
|
|
Map<String, PointInfo> glpisMap = entityGl.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
|
|
@@ -4136,8 +4200,8 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
DateTime hour2 = DateUtil.offsetHour(hour, 4);
|
|
|
QueryWrapper<HistoryPredict> wrapper = new QueryWrapper<>();
|
|
|
wrapper.lambda().eq(HistoryPredict::getPredictType, "CDQ").eq(HistoryPredict::getDataTime, hour)
|
|
|
- .between(HistoryPredict::getPredictTime, hour, hour2).orderByAsc(HistoryPredict::getDataTime);
|
|
|
- List<HistoryPredict> predicts = historyPredictService.list(predictWrapper);
|
|
|
+ .between(HistoryPredict::getPredictTime, hour, hour2).orderByAsc(HistoryPredict::getPredictTime);
|
|
|
+ List<HistoryPredict> predicts = historyPredictService.list(wrapper);
|
|
|
cdqPredicts.addAll(predicts);
|
|
|
}
|
|
|
Map<String, List<HistoryPredict>> cdqPredictsMap = cdqPredicts.stream().collect(Collectors.groupingBy(HistoryPredict::getTurbineId));
|
|
@@ -4200,7 +4264,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
errorPercentage = 100.0;
|
|
|
}
|
|
|
} else {
|
|
|
- errorPercentage = Math.abs(predictPower.get(i) - actualPower.get(i)) / predictPower.get(i) * 100;
|
|
|
+ errorPercentage = Math.abs(predictPower.get(i) - actualPower.get(i)) / installCapacity * 100;
|
|
|
}
|
|
|
if (errorPercentage > maxErrorPercentage) {
|
|
|
maxErrorPercentage = errorPercentage;
|