|
@@ -14,7 +14,6 @@ import com.ruoyi.ucp.service.*;
|
|
|
import com.ruoyi.ucp.util.CalcCache;
|
|
|
import org.apache.commons.math3.fitting.PolynomialCurveFitter;
|
|
|
import org.apache.commons.math3.fitting.WeightedObservedPoints;
|
|
|
-import org.junit.Test;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -144,15 +143,15 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
|
|
|
public Map<String, Double> getTurbinePowerLoss(double rfdl, PointInfo piZt, List<PointData> fsList, List<PointData> glList) {
|
|
|
String tbId = piZt.getTurbineId();
|
|
|
-
|
|
|
+
|
|
|
double sum1 = glList.stream().mapToDouble(PointData::getValue).sum();
|
|
|
double xs = rfdl / (sum1 / 240);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
List<PointData> collectZt = piZt.getPointDatas();
|
|
|
double jxss = 0, sdtj = 0, gzss = 0, djss = 0, xnss = 0, fdjcl = 0, xdjcl = 0, xdtj = 0;
|
|
@@ -344,7 +343,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
pi.setUniformCode("Z-ZXYG-JX");
|
|
|
pi.setLineId("all");
|
|
|
List<PointInfo> entity = pointService.getByEntity(pi);
|
|
|
-
|
|
|
+
|
|
|
String keys = pointInfos2Keys(entity);
|
|
|
Map<String, PointData> latest2 = adapter.getHistorySection(goldenUri(), keys, time2.getTime());
|
|
|
Map<String, PointData> latest1 = adapter.getHistorySection(goldenUri(), keys, time1.getTime());
|
|
@@ -388,7 +387,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
.groupBy("station_id");
|
|
|
List<LineInfoDay> list = lineInfoDayService.list(wrapper);
|
|
|
List<StationInfoDay> byDate = getStationinfoByDate(time0.toJdkDate());
|
|
|
-
|
|
|
+
|
|
|
|
|
|
Map<String, StationInfoDay> collect = new HashMap<>();
|
|
|
if (!byDate.isEmpty()) {
|
|
@@ -705,18 +704,18 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
cxInfo.setPointDatas(cxc);
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
List<PointData> firstZsgl = new ArrayList<>();
|
|
|
double v1, v2, v3;
|
|
|
for (int i = 0; i < 5760; i++) {
|
|
|
int finalI = i;
|
|
|
long ts = start.getTime() + i * 15000;
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
v3 = pdsZsglMap.values().stream().mapToDouble(pds -> pds.get(finalI).getValue()).sum();
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
firstZsgl.add(new PointData(ts, v3));
|
|
|
}
|
|
|
|
|
@@ -736,7 +735,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
Map<String, EquipmentModel> map = equipmentModelService.map();
|
|
|
Double capacity = map.get(ztInfo.getSpare()).getPowerProduction();
|
|
|
List<PointData> zts = ztInfo.getPointDatas();
|
|
|
- for (int i = 0; i < 5760; i++) {
|
|
|
+ for (int i = 0; i < fss.size(); i++) {
|
|
|
double ssgl = gls.get(i).getValue();
|
|
|
double ssfs = fss.get(i).getValue();
|
|
|
double ylzsgd = ylzsgds.get(i).getValue();
|
|
@@ -764,7 +763,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
List<PointData> czxd = zsglSnap.stream().map(s -> new PointData(s.getTs(), 0.0)).collect(Collectors.toList());
|
|
|
|
|
|
boolean iszqxd = false;
|
|
|
- for (int i = 0; i < 5760; i++) {
|
|
|
+ for (int i = 0; i < zsglSnap.size(); i++) {
|
|
|
boolean isxd = false;
|
|
|
double zsgl = zsglSnap.get(i).getValue();
|
|
|
double zsgl5 = zsgl5s.get(i).getValue();
|
|
@@ -881,7 +880,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
} else if (map.get("MX006").getPointDatas().get(i).getValue() == 1.0) {
|
|
|
data0.setDoubleValue(6.0);
|
|
|
} else {
|
|
|
-
|
|
|
+
|
|
|
data0.setDoubleValue(2.0);
|
|
|
}
|
|
|
}
|
|
@@ -995,7 +994,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
Map<String, Map<Integer, Integer>> collectAi = list.stream().collect(Collectors.groupingBy(
|
|
|
StateAi::getModel, Collectors.toMap(StateAi::getOriginalState, StateAi::getMappingState)));
|
|
|
|
|
|
-
|
|
|
+
|
|
|
for (PointInfo ef : entityFs) {
|
|
|
String wtId = ef.getTurbineId();
|
|
|
PointInfo glInfo = glMap.get(wtId);
|
|
@@ -1011,13 +1010,13 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
if (turbineZt != null) {
|
|
|
double capacity = map.get(turbineZt.getSpare()).getPowerProduction();
|
|
|
fit = dataProcessAndFit(ef, glInfo, turbineZt, CalcCache.bzgl.get(turbineZt.getSpare()), capacity);
|
|
|
-
|
|
|
+
|
|
|
turbineZt.setPointDatas(null);
|
|
|
}
|
|
|
if (turbineAizt != null) {
|
|
|
double capacity = map.get(turbineAizt.getSpare()).getPowerProduction();
|
|
|
fit = dataProcessAndFit(ef, glInfo, turbineAizt, CalcCache.bzgl.get(turbineAizt.getSpare()), capacity);
|
|
|
-
|
|
|
+
|
|
|
turbineAizt.setPointDatas(null);
|
|
|
}
|
|
|
ef.setPointDatas(null);
|
|
@@ -1025,7 +1024,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
stringRedisTemplate.opsForValue().set("edfs:" + end.getMonth() + ":" + wtId, JSON.toJSONString(fit));
|
|
|
}
|
|
|
System.out.println("苹果天涯");
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1195,7 +1194,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
queryWrapper.eq("uniform_code", "AI066");
|
|
|
|
|
|
List<PointInfo> pointInfos = getEntity("AI066", "turbine");
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
ConcurrentHashMap<String, ConcurrentHashMap<String, Double>> mapIn = new ConcurrentHashMap<>();
|
|
@@ -1242,15 +1241,15 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
|
|
|
if (value1 == 0 && value2 == 2) {
|
|
|
ts1 = pointData2.getTs();
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
|
|
|
long ts11 = ts1 - 300000;
|
|
|
|
|
|
List<PointData> pointDatas1 = adapter.getHistorySnap(goldenUri(), windSpeedKey, ts11, ts1, 10);
|
|
|
|
|
|
double avgCutInWindSpeed = pointDatas1.stream().mapToDouble(PointData::getValue).average().orElse(0);
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -1262,12 +1261,12 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
if (value1 == 2 && value2 != 2) {
|
|
|
ts2 = pointData2.getTs();
|
|
|
String stringDate = DateUtil.date(ts2).toString("yyyy-MM-dd HH:mm:ss");
|
|
|
-
|
|
|
+
|
|
|
|
|
|
long ts22 = ts2 - 300000;
|
|
|
List<PointData> pointDatas2 = adapter.getHistorySnap(goldenUri(), windSpeedKey, ts22, ts2, 10);
|
|
|
double avgCutOutWindSpeed = pointDatas2.stream().mapToDouble(PointData::getValue).average().orElse(0);
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -1341,21 +1340,21 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
System.out.println(turbineInfoDay);
|
|
|
|
|
|
interest.add(turbineInfoDay);
|
|
|
-
|
|
|
+
|
|
|
} else {
|
|
|
one.setXfqrfs(avgCutInWindSpeed);
|
|
|
System.out.println(one);
|
|
|
-
|
|
|
+
|
|
|
update.add(one);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
turbineInfoDayService.saveOrUpdateBatch(interest);
|
|
|
turbineInfoDayService.saveOrUpdateBatch(update);
|
|
|
}
|
|
@@ -1409,7 +1408,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
Map<String, Map<Integer, Integer>> collectAi = list.stream().collect(Collectors.groupingBy(
|
|
|
StateAi::getModel, Collectors.toMap(StateAi::getOriginalState, StateAi::getMappingState)));
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
List<TurbineInfoDay> interest = new ArrayList<>();
|
|
@@ -1437,21 +1436,21 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
System.out.println("数据处理拟合");
|
|
|
capacity = map.get(turbineZt.getSpare()).getPowerProduction();
|
|
|
fit = dataProcessAndFit(ef, glInfo, turbineZt, CalcCache.bzgl.get(turbineZt.getSpare()), capacity);
|
|
|
-
|
|
|
+
|
|
|
turbineZt.setPointDatas(null);
|
|
|
}
|
|
|
if (turbineAizt != null) {
|
|
|
System.out.println("数据处理拟合");
|
|
|
capacity = map.get(turbineAizt.getSpare()).getPowerProduction();
|
|
|
fit = dataProcessAndFit(ef, glInfo, turbineAizt, CalcCache.bzgl.get(turbineAizt.getSpare()), capacity);
|
|
|
-
|
|
|
+
|
|
|
turbineAizt.setPointDatas(null);
|
|
|
}
|
|
|
ef.setPointDatas(null);
|
|
|
glInfo.setPointDatas(null);
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
System.out.println("拟合曲线的大小" + fit.size() + ":" + wtId);
|
|
|
|
|
@@ -1491,12 +1490,12 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
turbineInfoDay.setRecordDate(start);
|
|
|
turbineInfoDay.setEdfs(agValue);
|
|
|
System.out.println(turbineInfoDay);
|
|
|
-
|
|
|
+
|
|
|
interest.add(turbineInfoDay);
|
|
|
} else {
|
|
|
one.setEdfs(agValue);
|
|
|
System.out.println(one);
|
|
|
-
|
|
|
+
|
|
|
update.add(one);
|
|
|
}
|
|
|
|
|
@@ -1509,16 +1508,16 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
turbineInfoDayService.saveOrUpdateBatch(interest);
|
|
|
turbineInfoDayService.saveOrUpdateBatch(update);
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1567,20 +1566,20 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
turbineInfoDay.setHjwd(avgCutInWindSpeed);
|
|
|
System.out.println(turbineInfoDay);
|
|
|
interest.add(turbineInfoDay);
|
|
|
-
|
|
|
+
|
|
|
} else {
|
|
|
one.setHjwd(avgCutInWindSpeed);
|
|
|
System.out.println(one);
|
|
|
update.add(one);
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
turbineInfoDayService.saveOrUpdateBatch(interest);
|
|
|
turbineInfoDayService.saveOrUpdateBatch(update);
|
|
|
|
|
@@ -1613,9 +1612,9 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
List<StationInfoDay> yearDays = stationInfoDayService.list(wrapper);
|
|
|
Map<String, StationInfoDay> yearMap = yearDays.stream().collect(Collectors.toMap(StationInfoDay::getStationId, Function.identity()));
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
QueryWrapper<ProEconReportIndicatorPool> wrapperrp = new QueryWrapper<>();
|
|
|
wrapperrp.eq("record_date", time0)
|
|
@@ -1769,8 +1768,8 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
List<TurbineInfoDay> yearDays = turbineInfoDayService.list(wrapper);
|
|
|
Map<String, TurbineInfoDay> yearMap = yearDays.stream().collect(Collectors.toMap(TurbineInfoDay::getProjectId, Function.identity()));
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
|
|
|
QueryWrapper<ProEconReportIndicatorPool> wrapperrp = new QueryWrapper<>();
|
|
|
wrapperrp.eq("record_date", time0)
|
|
@@ -1869,7 +1868,6 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
double nzhcydl = 0;
|
|
|
|
|
|
|
|
|
-
|
|
|
for (ProEconReportIndicatorPool pool : list) {
|
|
|
rfdl += pool.getRfdldb();
|
|
|
swdl += pool.getRswdldb();
|
|
@@ -1905,10 +1903,232 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
reportIndicatorPoolService.saveOrUpdate(GSZB);
|
|
|
|
|
|
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public void calcRealtimeTurbineZt() {
|
|
|
+ DateTime date = DateUtil.date();
|
|
|
+
|
|
|
+ List<PointInfo> turbineZt = calcRealtimeTurbineDizt();
|
|
|
+ List<PointInfo> turbineAizt = calcRealtimeTurbineAizt();
|
|
|
+ turbineZt.addAll(turbineAizt);
|
|
|
+ turbineZt = turbineZt.stream().peek(t -> {
|
|
|
+ if (t.getPointDatas().get(0).getTs() + 9 * 60 * 1000 <= date.getTime()) {
|
|
|
+ t.getPointDatas().get(0).setDoubleValue(12.0);
|
|
|
+ }
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ Map<String, Map<String, PointInfo>> ztMapMap = turbineZt.stream().collect(Collectors.groupingBy(PointInfo::getStationId,
|
|
|
+ Collectors.toMap(PointInfo::getTurbineId, Function.identity())));
|
|
|
+
|
|
|
+ List<PointInfo> entityAgc = getEntity("AGC002", "booster");
|
|
|
+ getSnapDataByEntity(entityAgc, DateUtil.offsetMinute(date, -5), date, 15);
|
|
|
+
|
|
|
+ List<PointInfo> entityCx = getEntity("AGC001", "booster");
|
|
|
+ getSnapDataByEntity(entityCx, DateUtil.offsetMinute(date, -5), date, 15);
|
|
|
+
|
|
|
+ List<PointInfo> entityYlzsgd = getEntity("AI110", "turbine");
|
|
|
+ getLatestByEntity(entityYlzsgd);
|
|
|
+
|
|
|
+ List<PointInfo> entityFs = getEntity("AI066", "turbine");
|
|
|
+ getSnapDataByEntity(entityFs, DateUtil.offsetMinute(date, -5), date, 15);
|
|
|
+
|
|
|
+ List<PointInfo> entityGl = getEntity("AI114", "turbine");
|
|
|
+
|
|
|
+ getLatestByEntity(entityGl);
|
|
|
+
|
|
|
+ Map<String, PointInfo> collectAgc = entityAgc.stream().collect(Collectors.toMap(PointInfo::getStationId, Function.identity()));
|
|
|
+ Map<String, PointInfo> collectCx = entityCx.stream().collect(Collectors.toMap(PointInfo::getStationId, Function.identity()));
|
|
|
+ Map<String, Map<String, List<PointData>>> collectYlzsgd = entityYlzsgd.stream().collect(Collectors.groupingBy(PointInfo::getStationId,
|
|
|
+ Collectors.toMap(PointInfo::getTurbineId, PointInfo::getPointDatas)));
|
|
|
+ Map<String, Map<String, PointInfo>> fsMapMap = entityFs.stream().collect(Collectors.groupingBy(PointInfo::getStationId,
|
|
|
+ Collectors.toMap(PointInfo::getTurbineId, Function.identity())));
|
|
|
+ Map<String, Map<String, List<PointData>>> glMapMap = entityGl.stream().collect(Collectors.groupingBy(PointInfo::getStationId,
|
|
|
+ Collectors.toMap(PointInfo::getTurbineId, PointInfo::getPointDatas)));
|
|
|
+
|
|
|
+ ztMapMap.forEach((stId, ztMap) -> {
|
|
|
+ PointInfo agcInfo = collectAgc.get(stId);
|
|
|
+ PointInfo cxInfo = collectCx.get(stId);
|
|
|
+ Map<String, PointInfo> fsMap = fsMapMap.get(stId);
|
|
|
+
|
|
|
+ Map<String, List<PointData>> pdsZsglMap = new HashMap<>();
|
|
|
+ ztMap.forEach((wtId, zt) -> {
|
|
|
+ List<PointData> peek = fsMap.get(wtId).getPointDatas().stream().peek(pd -> pd.setDoubleValue(NumberUtil.round(pd.getValue() > 25 ? 25.0
|
|
|
+ : pd.getValue(), 2).doubleValue())).collect(Collectors.toList());
|
|
|
+ fsMap.get(wtId).setPointDatas(peek);
|
|
|
+ List<PointData> zsglSnap = fsMap.get(wtId).getPointDatas().stream().map(pd -> {
|
|
|
+ Double v = CalcCache.fitcoef.get(wtId).get(pd.getValue());
|
|
|
+ return new PointData(pd.getTs(), v == null ? 0 : v);
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ pdsZsglMap.put(wtId, zsglSnap);
|
|
|
+ });
|
|
|
+ List<PointData> agcc = agcInfo.getPointDatas().stream().peek(agc -> {
|
|
|
+ agc.setDoubleValue(agc.getValue() * agcInfo.getCoef());
|
|
|
+ agc.setLongValue(0L);
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ agcInfo.setPointDatas(agcc);
|
|
|
+ List<PointData> cxc = cxInfo.getPointDatas().stream().peek(cx -> {
|
|
|
+ cx.setDoubleValue(cx.getValue() * cxInfo.getCoef());
|
|
|
+ cx.setLongValue(0L);
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ cxInfo.setPointDatas(cxc);
|
|
|
+
|
|
|
+
|
|
|
+ List<PointData> firstZsgl = new ArrayList<>();
|
|
|
+ double v3 = pdsZsglMap.values().stream().mapToDouble(pds -> pds.get(0).getValue()).sum();
|
|
|
+ firstZsgl.add(new PointData(date.getTime(), v3));
|
|
|
|
|
|
+ List<PointData> czxd = calcStationXd2(agcInfo, cxInfo.getPointDatas(), firstZsgl);
|
|
|
+ ztMap.forEach((wtId, ztInfo) -> {
|
|
|
+ List<PointData> fss = fsMap.get(wtId).getPointDatas();
|
|
|
+ List<PointData> gls = glMapMap.get(stId).get(wtId);
|
|
|
+
|
|
|
+ List<PointData> ylzsgds = collectYlzsgd.get(stId).get(wtId);
|
|
|
+ calcRealtimeTurbineXd(ztInfo, gls.get(0), fss.get(fss.size() - 1), ylzsgds.get(0), czxd.get(czxd.size() - 1));
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ Map<String, String> entityMxzt = getEntityMap("MXZT", "turbine");
|
|
|
+ List<PointData> dataList = turbineZt.stream().map(zt -> {
|
|
|
+ PointData data = zt.getPointDatas().get(0);
|
|
|
+ data.setTagName(entityMxzt.get(zt.getTurbineId()));
|
|
|
+ return data;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ adapter.writeHistoryBatch(taosUri(), dataList);
|
|
|
+ ThreadUtil.sleep(1000);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public List<PointInfo> getLatest(String uniformCode, String institutionType) {
|
|
|
+ List<PointInfo> entity = getEntity(uniformCode, institutionType);
|
|
|
+ String collect = entity.stream().map(PointInfo::getPointKey).collect(Collectors.joining(","));
|
|
|
+ Map<String, PointData> latest = adapter.getLatest(goldenUri(), collect);
|
|
|
+ entity.forEach(e -> {
|
|
|
+ e.setPointDatas(Collections.singletonList(latest.get(e.getPointKey())));
|
|
|
+ });
|
|
|
+ return entity;
|
|
|
}
|
|
|
|
|
|
+ public void getLatestByEntity(List<PointInfo> entity) {
|
|
|
+ String collect = entity.stream().map(PointInfo::getPointKey).collect(Collectors.joining(","));
|
|
|
+ Map<String, PointData> latest = adapter.getLatest(goldenUri(), collect);
|
|
|
+ entity.forEach(e -> {
|
|
|
+ e.setPointDatas(Collections.singletonList(latest.get(e.getPointKey())));
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<PointInfo> calcRealtimeTurbineDizt() {
|
|
|
+ List<PointInfo> entity = new ArrayList<>();
|
|
|
+ List<PointInfo> result = new ArrayList<>();
|
|
|
+ List<PointInfo> entity0 = getEntity("MX000", "state");
|
|
|
+ List<PointInfo> entity1 = getEntity("MX001", "state");
|
|
|
+ List<PointInfo> entity2 = getEntity("MX002", "state");
|
|
|
+ List<PointInfo> entity4 = getEntity("MX004", "state");
|
|
|
+ List<PointInfo> entity6 = getEntity("MX006", "state");
|
|
|
+ entity.addAll(entity0);
|
|
|
+ entity.addAll(entity1);
|
|
|
+ entity.addAll(entity2);
|
|
|
+ entity.addAll(entity4);
|
|
|
+ entity.addAll(entity6);
|
|
|
+ List<String> keys = entity.stream().map(PointInfo::getPointKey).collect(Collectors.toList());
|
|
|
+ Map<String, PointData> latest = adapter.getLatest(goldenUri(), String.join(",", keys));
|
|
|
|
|
|
+ Map<String, Map<String, PointInfo>> wtUcPis = entity.stream().collect(Collectors.groupingBy
|
|
|
+ (PointInfo::getTurbineId, Collectors.toMap(PointInfo::getUniformCode, Function.identity())));
|
|
|
+ wtUcPis.forEach((wtId, map) -> {
|
|
|
+ PointInfo info2 = map.get("MX002");
|
|
|
+ PointData data2 = latest.get(info2.getPointKey());
|
|
|
+ if (data2.getValue() == 1.0) {
|
|
|
+ data2.setDoubleValue(2.0);
|
|
|
+ data2.setBooleanValue(false);
|
|
|
+ info2.setPointDatas(Collections.singletonList(data2));
|
|
|
+ result.add(info2);
|
|
|
+ } else {
|
|
|
+ PointInfo info0 = map.get("MX000");
|
|
|
+ PointData data0 = latest.get(info0.getPointKey());
|
|
|
+ if (data0.getValue() == 1.0) {
|
|
|
+ data0.setDoubleValue(0.0);
|
|
|
+ data0.setBooleanValue(false);
|
|
|
+ info0.setPointDatas(Collections.singletonList(data0));
|
|
|
+ result.add(info0);
|
|
|
+ } else {
|
|
|
+ PointInfo info6 = map.get("MX006");
|
|
|
+ PointData data6 = latest.get(info6.getPointKey());
|
|
|
+ if (data6.getValue() == 1.0) {
|
|
|
+ data6.setDoubleValue(6.0);
|
|
|
+ data6.setBooleanValue(false);
|
|
|
+ info6.setPointDatas(Collections.singletonList(data6));
|
|
|
+ result.add(info6);
|
|
|
+ } else {
|
|
|
+ PointInfo info4 = map.get("MX004");
|
|
|
+ PointData data4 = latest.get(info4.getPointKey());
|
|
|
+ if (data4.getValue() == 1.0) {
|
|
|
+ data4.setDoubleValue(4.0);
|
|
|
+ data4.setBooleanValue(false);
|
|
|
+ info4.setPointDatas(Collections.singletonList(data4));
|
|
|
+ result.add(info4);
|
|
|
+ } else {
|
|
|
+ PointInfo info1 = map.get("MX001");
|
|
|
+ PointData data1 = latest.get(info1.getPointKey());
|
|
|
+ if (data1.getValue() == 1.0) {
|
|
|
+ data1.setDoubleValue(1.0);
|
|
|
+ data1.setBooleanValue(false);
|
|
|
+ info1.setPointDatas(Collections.singletonList(data1));
|
|
|
+ result.add(info1);
|
|
|
+ } else {
|
|
|
+ data1.setDoubleValue(2.0);
|
|
|
+ System.out.println("wtId: " + wtId + ",状态值无批配: " + data1.getValue());
|
|
|
+ info1.setPointDatas(Collections.singletonList(data1));
|
|
|
+ result.add(info1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<PointInfo> calcRealtimeTurbineAizt() {
|
|
|
+ List<PointInfo> entityAiZt = getEntity("AI422", "state");
|
|
|
+ List<StateAi> list = stateAiService.list();
|
|
|
+
|
|
|
+ Map<String, Map<Integer, Integer>> collectAi = list.stream().collect(Collectors.groupingBy(
|
|
|
+ StateAi::getModel, Collectors.toMap(StateAi::getOriginalState, StateAi::getMappingState)));
|
|
|
+ String collect = entityAiZt.stream().map(PointInfo::getPointKey).collect(Collectors.joining(","));
|
|
|
+ Map<String, PointData> latest = adapter.getLatest(goldenUri(), collect);
|
|
|
+
|
|
|
+ for (PointInfo info : entityAiZt) {
|
|
|
+ PointData data = latest.get(info.getPointKey());
|
|
|
+ Integer m = collectAi.get(info.getSpare()).get((int) data.getValue());
|
|
|
+ if (m == null) m = 2;
|
|
|
+ data.setDoubleValue(m);
|
|
|
+ info.setPointDatas(Collections.singletonList(data));
|
|
|
+ }
|
|
|
+ return entityAiZt;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void getAgoAvg(List<PointInfo> entity, Date start, Date end) {
|
|
|
+ for (PointInfo info : entity) {
|
|
|
+ DoubleStatData snap = adapter.getHistoryStat(goldenUri(), info.getPointKey(), start.getTime(), end.getTime());
|
|
|
+ ThreadUtil.sleep(20);
|
|
|
+ info.setPointDatas(Collections.singletonList(snap.getAvg()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void calcRealtimeTurbineXd(PointInfo ztInfo, PointData gl, PointData fs, PointData ylzsgd, PointData czxd) {
|
|
|
+ Map<String, EquipmentModel> map = equipmentModelService.map();
|
|
|
+ Double capacity = map.get(ztInfo.getSpare()).getPowerProduction();
|
|
|
+ PointData zt = ztInfo.getPointDatas().get(0);
|
|
|
+
|
|
|
+ if (czxd.isBooleanValue() && gl.getValue() < capacity * 0.9) {
|
|
|
+ if (fs.getValue() >= 12) {
|
|
|
+ zt.setDoubleValue(8.0);
|
|
|
+ }
|
|
|
+ if (ylzsgd.getValue() != 0 && ylzsgd.getValue() < 17.3) {
|
|
|
+ zt.setDoubleValue(8.0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|