|
@@ -1,15 +1,10 @@
|
|
|
package com.ruoyi.web.controller;
|
|
|
|
|
|
-import cn.hutool.core.collection.CollUtil;
|
|
|
-import cn.hutool.core.collection.ListUtil;
|
|
|
-import cn.hutool.core.date.DateField;
|
|
|
-import cn.hutool.core.date.DateRange;
|
|
|
-import cn.hutool.core.date.DateTime;
|
|
|
-import cn.hutool.core.date.DateUtil;
|
|
|
+import cn.hutool.core.collection.*;
|
|
|
+import cn.hutool.core.date.*;
|
|
|
import cn.hutool.core.text.StrBuilder;
|
|
|
import cn.hutool.core.thread.ThreadUtil;
|
|
|
-import cn.hutool.core.util.NumberUtil;
|
|
|
-import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.core.util.*;
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.ruoyi.quartz.handler.IJobHandler;
|
|
@@ -33,7 +28,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
-import java.util.stream.Stream;
|
|
|
|
|
|
@Service
|
|
|
public class JavaFunctionJobHandler extends IJobHandler {
|
|
@@ -275,7 +269,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
}
|
|
|
|
|
|
public URI goldenUri() {
|
|
|
- return URI.create("http://172.16.12.103:8017/ts");
|
|
|
+ return URI.create("http://172.16.12.103:8011/ts");
|
|
|
}
|
|
|
|
|
|
public Map<String, String> getEntityMap(String uniformCode, String institutionType) {
|
|
@@ -1549,55 +1543,6 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
return turbineZt;
|
|
|
}
|
|
|
|
|
|
- public void calcStationXdTest(Date date, String stId) {
|
|
|
- DateTime end = DateUtil.beginOfDay(date);
|
|
|
- DateTime start = DateUtil.offsetDay(end, -1);
|
|
|
- //AGC
|
|
|
- List<PointInfo> entityAgc = getEntity("AGC002", "booster");
|
|
|
- entityAgc = filterPointInfo(entityAgc, stId, PointInfo::getStationId);
|
|
|
- getSnapDataByEntity(entityAgc, start, end, 15);
|
|
|
- PointInfo agcInfo = entityAgc.get(0);
|
|
|
- //出线
|
|
|
- List<PointInfo> entityCx = getEntity("AGC001", "booster");
|
|
|
- entityCx = filterPointInfo(entityCx, stId, PointInfo::getStationId);
|
|
|
- getSnapDataByEntity(entityCx, start, end, 15);
|
|
|
- PointInfo cxInfo = entityCx.get(0);
|
|
|
- //状态
|
|
|
- List<PointInfo> turbineZt = calcTurbineDizt(start, end, 15);
|
|
|
- turbineZt = filterPointInfo(turbineZt, stId, PointInfo::getStationId);
|
|
|
- List<PointInfo> turbineAizt = calcTurbineAizt(start, end, 15);
|
|
|
- turbineAizt = filterPointInfo(turbineAizt, stId, PointInfo::getStationId);
|
|
|
- turbineZt.addAll(turbineAizt);
|
|
|
- Map<String, PointInfo> ztMap = turbineZt.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
|
|
|
- //风速
|
|
|
- List<PointInfo> entityFs = getEntity("AI066", "turbine");
|
|
|
- entityFs = filterPointInfo(entityFs, stId, PointInfo::getStationId);
|
|
|
- Map<String, PointInfo> fsMap = entityFs.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
|
|
|
- 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> firstZsgl = new ArrayList<>();
|
|
|
- for (int i = 0; i < agcInfo.getPointDatas().size(); i++) {
|
|
|
- int finalI = i;
|
|
|
- long ts = start.getTime() + finalI * 15000L;
|
|
|
- double v3 = pdsZsglMap.values().stream().mapToDouble(pds -> pds.get(finalI).getValue()).sum();
|
|
|
- firstZsgl.add(new PointData(ts, v3));
|
|
|
- }
|
|
|
- List<PointData> czxd = calcStationXd2(agcInfo, cxInfo.getPointDatas(), firstZsgl);
|
|
|
- for (PointData pd : czxd) {
|
|
|
- System.out.println(DateUtil.formatDateTime(new Date(pd.getTs())) + "," + pd.getValue());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
public List<PointData> calcTurbineSimpleZt(Date start, Date end, Integer interval, String tbId) {
|
|
|
List<PointInfo> turbineZt = calcTurbineDizt(start, end, interval, tbId);
|
|
|
List<PointInfo> turbineAizt = calcTurbineAizt(start, end, interval, tbId);
|
|
@@ -2184,6 +2129,10 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public Map<String, PointInfo> getSectionDataByEntity(List<PointInfo> entitys, URI uri, Date start, Date end, Function<PointInfo, String> function) {
|
|
|
+ getSectionDataByEntity(entitys, uri, start, end);
|
|
|
+ return entitys.stream().collect(Collectors.toMap(function, Function.identity()));
|
|
|
+ }
|
|
|
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());
|
|
@@ -4392,32 +4341,31 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
Map<String, PointInfo> rawMapGl = getSnapDataByEntity(entityGl, goldenUri(), start, date, 15, PointInfo::getTurbineId);
|
|
|
//状态
|
|
|
List<PointInfo> entityZt = getEntity("MXZT", "turbine");
|
|
|
- Map<String, PointInfo> rawMapZt = getSnapDataByEntity(entityZt, taosUri(), start, date, 15, PointInfo::getTurbineId);
|
|
|
+ Map<String, PointInfo> rawMapZt = getRawDataByEntity(entityZt, taosUri(), start, date, PointInfo::getTurbineId);
|
|
|
+ //发电量
|
|
|
+ List<PointInfo> entityFdl = getEntity("AI121", "turbine");
|
|
|
+ getSectionDataByEntity(entityFdl,goldenUri(),start,date);
|
|
|
|
|
|
List<TurbineInfoMin> mins = getTurbineinfoByMin(date, entityFs);
|
|
|
for (TurbineInfoMin min : mins) {
|
|
|
String tbId = min.getTurbineId();
|
|
|
List<PointData> fsDatas = rawMapFs.get(tbId).getPointDatas();
|
|
|
List<PointData> ztDatas = rawMapZt.get(tbId).getPointDatas();
|
|
|
- ztDatas = doublePointDatasFull(2, ztDatas, start.getTime(), date.getTime(), 1);
|
|
|
+ ztDatas = doublePointDatasFull(2, ztDatas, start.getTime()-1000, date.getTime(), 1);
|
|
|
Map<Long, Double> ztMap = ztDatas.stream().collect(Collectors.toMap(PointData::getTs, PointData::getValue));
|
|
|
- double pjfs = fsDatas.stream().mapToDouble(PointData::getValue).average().orElse(0);
|
|
|
+ double pjfs = fsDatas.stream().mapToDouble(PointData::getValue).average().orElse(0.0);
|
|
|
fsDatas = fsDatas.stream().peek(pd -> pd.setDoubleValue(pd.getValue() >= 23 ? 23.0 : pd.getValue() < 0 ? 0 :
|
|
|
NumberUtil.round(pd.getValue(), 2).doubleValue())).collect(Collectors.toList());
|
|
|
- double llgl = fsDatas.stream().mapToDouble(pd -> CalcCache.fitcoef.get(tbId).get(pd.getValue())).sum();
|
|
|
- llgl = llgl / 60;
|
|
|
- List<PointData> kyFsDatas = fsDatas.stream().filter(pd -> ztMap.get(pd.getTs()) != 4 || ztMap.get(pd.getTs()) != 6).collect(Collectors.toList());
|
|
|
- double kygl = kyFsDatas.stream().mapToDouble(pd -> CalcCache.fitcoef.get(tbId).get(pd.getValue())).sum();
|
|
|
- kygl = kygl / 60;
|
|
|
- List<PointData> xdFsDatas = fsDatas.stream().filter(pd -> ztMap.get(pd.getTs()) == 8).collect(Collectors.toList());
|
|
|
- double xdfdl = xdFsDatas.stream().mapToDouble(pd -> CalcCache.fitcoef.get(tbId).get(pd.getValue())).sum();
|
|
|
- xdfdl = xdfdl / 240;
|
|
|
- double sjgl = rawMapGl.get(tbId).getPointDatas().stream().mapToDouble(PointData::getValue).sum();
|
|
|
- sjgl = sjgl / 60;
|
|
|
+ double llgl = fsDatas.stream().mapToDouble(pd -> CalcCache.fitcoef.get(tbId).get(pd.getValue())).average().orElse(0.0);
|
|
|
+ List<PointData> kyFsDatas = fsDatas.stream().filter(pd -> {
|
|
|
+ if(ztMap.get(pd.getTs())==null) System.out.println(pd.getTs());
|
|
|
+ return ztMap.get(pd.getTs()) != 4 || ztMap.get(pd.getTs()) != 6;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ double kygl = kyFsDatas.stream().mapToDouble(pd -> CalcCache.fitcoef.get(tbId).get(pd.getValue())).average().orElse(0.0);
|
|
|
+ double sjgl = rawMapGl.get(tbId).getPointDatas().stream().mapToDouble(PointData::getValue).average().orElse(0.0);
|
|
|
|
|
|
if (kygl < sjgl) kygl = sjgl;
|
|
|
if (llgl < sjgl) llgl = sjgl * 1.0005;
|
|
|
- min.setXdfdl(xdfdl);
|
|
|
min.setPjfs(pjfs);
|
|
|
min.setPjgl(sjgl);
|
|
|
min.setLlgl(llgl);
|
|
@@ -4507,11 +4455,11 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
String stId = day.getStationId();
|
|
|
TurbineInfoMin min = minMap.get(stId);
|
|
|
PointInfo agcInfo = statMapAgc.get(stId);
|
|
|
- PointInfo cxInfo = statMapCx.get(stId);
|
|
|
- day.setLlgl(min.getLlgl());
|
|
|
- day.setKygl(min.getKygl());
|
|
|
+ PointInfo cxInfo = statMapCx.get(stId); double pjgl = cxInfo.getPointDatas().get(0).getValue() * cxInfo.getCoef();
|
|
|
+ day.setKygl(Math.max(min.getKygl(),pjgl));
|
|
|
+ day.setLlgl(Math.max(min.getKygl(),min.getLlgl()));
|
|
|
day.setAgc(agcInfo.getPointDatas().get(0).getValue() * agcInfo.getCoef());
|
|
|
- day.setPjgl(cxInfo.getPointDatas().get(0).getValue() * cxInfo.getCoef());
|
|
|
+ day.setPjgl(pjgl);
|
|
|
day.setPjfs(min.getPjfs());
|
|
|
}
|
|
|
stationInfoMinService.saveOrUpdateBatch(byDate);
|
|
@@ -4616,7 +4564,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
m = 2;
|
|
|
System.out.println("ai状态未配对:" + data.getValue());
|
|
|
}
|
|
|
- data.setDoubleValue(Double.valueOf(m));
|
|
|
+ data.setDoubleValue(m);
|
|
|
info.setPointDatas(Collections.singletonList(data));
|
|
|
}
|
|
|
return entityAiZt;
|
|
@@ -5769,7 +5717,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void calcCdqKhfs(Date date) {
|
|
|
+ public void calcCdqKhfs(Date date) {
|
|
|
DateTime begin = DateUtil.offsetDay(DateUtil.beginOfDay(date), -1);
|
|
|
DateTime end = DateUtil.offsetDay(DateUtil.endOfDay(date), -1);
|
|
|
DateTime beginDq = DateUtil.offsetDay(begin, -2);
|
|
@@ -5783,18 +5731,27 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
long b = beginDq.getTime();
|
|
|
long e = end.getTime();
|
|
|
long b0 = b;
|
|
|
- long e0 = e + 15 * 60 * 1000;
|
|
|
+ long e0 = b + 15 * 60 * 1000;
|
|
|
while (e0 < e) {
|
|
|
for (PointData pd : pi.getPointDatas()) {
|
|
|
long ts = pd.getTs();
|
|
|
if (ts >= b0 && ts < e0) {
|
|
|
- ztMap.getOrDefault(DateUtil.date(b0), new ArrayList<>()).add(pd.getValue());
|
|
|
- } else {
|
|
|
- ztMap.getOrDefault(DateUtil.date(e0), new ArrayList<>()).add(pd.getValue());
|
|
|
+ List<Double> doubles = ztMap.computeIfAbsent(DateUtil.date(b0), k -> new ArrayList<>());
|
|
|
+ doubles.add(pd.getValue());
|
|
|
+ } else if(ts>=e0&&ts<e0 + 15 * 60 * 1000){
|
|
|
+ List<Double> doubles = ztMap.computeIfAbsent(DateUtil.date(e0), k -> new ArrayList<>());
|
|
|
+ doubles.add(pd.getValue());
|
|
|
+ b0 = e0;
|
|
|
+ e0 += 15 * 60 * 1000;
|
|
|
+ }else {
|
|
|
b0 = e0;
|
|
|
e0 += 15 * 60 * 1000;
|
|
|
}
|
|
|
}
|
|
|
+ if(pi.getPointDatas().size()==0){
|
|
|
+ b0 = e0;
|
|
|
+ e0 += 15 * 60 * 1000;
|
|
|
+ }
|
|
|
}
|
|
|
czztMapMap.put(stId, ztMap);
|
|
|
});
|
|
@@ -5826,31 +5783,31 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
//超短期
|
|
|
// 标准准确率
|
|
|
final List<Double> WIND_STANDARD = Arrays.asList(0.80, 0.75, 0.70, 0.65);
|
|
|
- List<PredictExamin2> peList = new ArrayList<>();
|
|
|
+ List<PredictExamin2> peList = new ArrayList<>(); DateTime hpBegin = DateUtil.offsetMinute(begin, -15);
|
|
|
for (int i = 0; i < 6; i++) {
|
|
|
- DateTime hour = DateUtil.offsetHour(begin, 4 * i);
|
|
|
+ DateTime hour = DateUtil.offsetHour(hpBegin, 4 * i);
|
|
|
DateTime hour2 = DateUtil.offsetHour(hour, 4);
|
|
|
QueryWrapper<HistoryPredict> wrapper = new QueryWrapper<>();
|
|
|
wrapper.eq("device_type", "station").eq("predict_type", "CDQ").eq("data_time", hour)
|
|
|
- .ge("predict_time", hour).lt("predict_time", hour2).orderByAsc("data_time");
|
|
|
+ .between("predict_time", hour,hour2).orderByAsc("data_time");
|
|
|
List<HistoryPredict> predicts = historyPredictService.list(wrapper);
|
|
|
Map<String, List<HistoryPredict>> cdqMap = predicts.stream().collect(Collectors.groupingBy(HistoryPredict::getSiteId));
|
|
|
int finalI = i;
|
|
|
cdqMap.forEach((stId, hps) -> {
|
|
|
List<StationInfoMin> minGl = minMap.get(stId);
|
|
|
PredictExamin2 examin2 = new PredictExamin2();
|
|
|
- Double capacity = glpisMap.get(stId) * 1000;
|
|
|
+ Double capacity = glpisMap.get(stId) * 1000; Date pdtHour = hps.get(0).getPredictTime();
|
|
|
examin2.setModelId("1");
|
|
|
examin2.setPredictType("CDQ");
|
|
|
examin2.setDeviceType("station");
|
|
|
- examin2.setTime(hour);
|
|
|
+ examin2.setTime(pdtHour);
|
|
|
examin2.setSiteId(stId);
|
|
|
List<Double> ycgls = hps.stream().map(HistoryPredict::getPredictPower).collect(Collectors.toList());
|
|
|
List<StationInfoMin> sub = ListUtil.sub(minGl, 16 * finalI, 16 * (finalI + 1));
|
|
|
List<Double> sjgls = sub.stream().map(StationInfoMin::getPjgl).collect(Collectors.toList());
|
|
|
List<List<Double>> ycglss = ListUtil.split(ycgls, 4);
|
|
|
List<List<Double>> sjglss = ListUtil.split(sjgls, 4);
|
|
|
- calculateForecastScore(examin2, ycglss, sjglss, WIND_STANDARD, capacity, hour.getHours());
|
|
|
+ calculateForecastScore(examin2, ycglss, sjglss, WIND_STANDARD, capacity, pdtHour.getHours());
|
|
|
peList.add(examin2);
|
|
|
});
|
|
|
|
|
@@ -5891,8 +5848,8 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
Map<Boolean, List<Double>> forecastPowers = hps.stream().collect(Collectors.groupingBy(m ->
|
|
|
"qt".equals(getIsImportance(m.getTime().getHours())),
|
|
|
Collectors.mapping(RealtimePredict::getPredictPower, Collectors.toList())));
|
|
|
- examin2.setAccuracyRate1(calcHarmonicMeanAccuracy(actualPowers.get(true), forecastPowers.get(true), capacity));
|
|
|
- examin2.setAccuracyRate4(calcHarmonicMeanAccuracy(actualPowers.get(false), forecastPowers.get(false), capacity));
|
|
|
+ examin2.setAccuracyRate1(calcHarmonicMeanAccuracy(actualPowers.get(false), forecastPowers.get(false), capacity));
|
|
|
+ examin2.setAccuracyRate4(calcHarmonicMeanAccuracy(actualPowers.get(true), forecastPowers.get(true), capacity));
|
|
|
peList.add(examin2);
|
|
|
});
|
|
|
//可用电量
|
|
@@ -5908,7 +5865,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
calcKydlFilter(examin2, minsKy, capacity, dtlMap);
|
|
|
peList.add(examin2);
|
|
|
});
|
|
|
- predictExamin2Service.saveBatch(peList);
|
|
|
+ predictExamin2Service.saveOrUpdateBatch(peList);
|
|
|
}
|
|
|
|
|
|
public double calcQAll(List<StationInfoMin> actualPower, List<RealtimePredict> forecastPower, double capacity, Map<DateTime, List<Double>> dtlMap) {
|
|
@@ -5944,7 +5901,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
//免考核
|
|
|
if (Pi_n <= 0.03 * capacity && Pi_r <= 0.03 * capacity) continue;
|
|
|
//预测偏差
|
|
|
- double Ei = Pi_r - Pi_n / Pi_r * 100;
|
|
|
+ double Ei = (Pi_r - Pi_n) / Pi_r;
|
|
|
//免考核
|
|
|
if (Math.abs(Ei) < 0.25) continue;
|
|
|
|
|
@@ -5989,13 +5946,13 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
return K;
|
|
|
}
|
|
|
|
|
|
- private static double calculateWeightedSum(double[] integralDifferences, double weight) {
|
|
|
- double sum = 0;
|
|
|
- for (double diff : integralDifferences) {
|
|
|
- sum += diff;
|
|
|
- }
|
|
|
- return sum * weight;
|
|
|
- }
|
|
|
+// private double calculateWeightedSum(double[] integralDifferences, double weight) {
|
|
|
+// double sum = 0;
|
|
|
+// for (double diff : integralDifferences) {
|
|
|
+// sum += diff;
|
|
|
+// }
|
|
|
+// return sum * weight;
|
|
|
+// }
|
|
|
|
|
|
/**
|
|
|
* 计算超短期预测考核总分
|
|
@@ -6020,24 +5977,24 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
// 是否重点时段
|
|
|
String importance = getIsImportance(hour + i);
|
|
|
if ("qt".equals(importance)) {
|
|
|
- totalScore += capacity * 0.0003 * v;
|
|
|
+ totalScore += capacity * 0.0003 * v * 100;
|
|
|
} else {
|
|
|
- totalScore += capacity * 0.0015 * v;
|
|
|
+ totalScore += capacity * 0.0015 * v * 100;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//MW转万kWh
|
|
|
- examin.setExaminScore(totalScore / 10);
|
|
|
+ examin.setExaminScore(totalScore / 10000);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 计算是否是重点时间段
|
|
|
*/
|
|
|
public String getIsImportance(int hour) {
|
|
|
- if (hour > 11 && hour < 14) {
|
|
|
+ if (hour >= 10 && hour < 16) {
|
|
|
//大发
|
|
|
return "df";
|
|
|
- } else if (hour > 17 && hour < 21) {
|
|
|
+ } else if ((hour >= 6 && hour < 9) || (hour >= 17 && hour < 22)) {
|
|
|
//高峰
|
|
|
return "gf";
|
|
|
}
|
|
@@ -6056,24 +6013,25 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
double Pi_r = actualPower.get(i);
|
|
|
double Pi_n = forecastPower.get(i);
|
|
|
double abs = Math.abs(Pi_r - Pi_n);
|
|
|
- if (abs <= 0.03 * capacity) continue; // 免考核条件
|
|
|
+ if (Pi_n <= 0.03 * capacity && Pi_r <= 0.03 * capacity) continue; // 免考核条件
|
|
|
sumrn += abs;
|
|
|
sum += Math.abs(Pi_r / (Pi_r + Pi_n) - 0.5) * abs;
|
|
|
}
|
|
|
- return 1 - 2 * sum / sumrn;
|
|
|
+ return sumrn==0?0.99:(1 - 2 * sum / sumrn);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 可用电量计算过滤
|
|
|
*/
|
|
|
public void calcKydlFilter(PredictExamin2 examin2, List<StationInfoMin> mins, double capacity, Map<DateTime, List<Double>> dtlMap) {
|
|
|
- double actualPower = 0, availablePower = 0;
|
|
|
+ double actualPower = 0, availablePower = 0,pjgl=0;
|
|
|
for (StationInfoMin min : mins) {
|
|
|
List<Double> doubles = dtlMap.get(min.getRecordDate());
|
|
|
//限电
|
|
|
if (calcXdRate(doubles) > 0.6) continue;
|
|
|
- actualPower += min.getKygl() / 4;
|
|
|
+ actualPower += min.getRfdl();
|
|
|
availablePower += min.getKygl() / 4;
|
|
|
+ pjgl += min.getPjgl() / 4;
|
|
|
}
|
|
|
double accuracy = calcKydlAccuracy(actualPower, availablePower, capacity);
|
|
|
double penalty = calcKydlPenalty(accuracy, capacity);
|
|
@@ -6082,11 +6040,12 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
double sum1 = mins.stream().mapToDouble(StationInfoMin::getKygl).sum();
|
|
|
examin2.setAccuracyRate2(sum);
|
|
|
examin2.setAccuracyRate3(sum1 / 4);
|
|
|
+ examin2.setAccuracyRate4(calcKydlAccuracy(actualPower, pjgl, capacity));
|
|
|
examin2.setExaminScore(penalty);
|
|
|
}
|
|
|
|
|
|
public double calcXdRate(List<Double> doubles) {
|
|
|
- // 计算1.0的数量
|
|
|
+ if(CollUtil.isEmpty(doubles)) return 0; // 计算1.0的数量
|
|
|
long countOfOnes = doubles.stream().filter(number -> number == 1.0).count();
|
|
|
// 计算1.0在列表中的占比
|
|
|
return (double) countOfOnes / doubles.size();
|
|
@@ -6095,26 +6054,69 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
/**
|
|
|
* 计算可用电量准确率
|
|
|
*/
|
|
|
- public static double calcKydlAccuracy(double actualPower, double availablePower, double capacity) {
|
|
|
+ public double calcKydlAccuracy(double actualPower, double availablePower, double capacity) {
|
|
|
if (actualPower == 0) return 0.97;
|
|
|
double v = capacity * 24 * 0.03;
|
|
|
if (actualPower < v && availablePower < v) return 0.97;
|
|
|
- return 1 - (actualPower - availablePower) / actualPower;
|
|
|
+ return 1 - Math.abs(actualPower - availablePower) / actualPower;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 计算考核扣分
|
|
|
*/
|
|
|
- public static double calcKydlPenalty(double accuracy, double capacity) {
|
|
|
+ public double calcKydlPenalty(double accuracy, double capacity) {
|
|
|
if (accuracy >= 0.97) return 0.0;
|
|
|
- double v = capacity * 0.02 * (0.97 - accuracy);
|
|
|
+ double v = capacity * 0.02 * (0.97 - accuracy) * 100;
|
|
|
//万kWh
|
|
|
- return v / 10;
|
|
|
+ return v / 10000;
|
|
|
}
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ public void calcStationXdTest(Date date,String stId){
|
|
|
+ DateTime end = DateUtil.beginOfDay(date);
|
|
|
+ DateTime start = DateUtil.offsetDay(end,-1);
|
|
|
+ //AGC
|
|
|
+ List<PointInfo> entityAgc = getEntity("AGC002", "booster");
|
|
|
+ entityAgc = filterPointInfo(entityAgc, stId, PointInfo::getStationId);
|
|
|
+ getSnapDataByEntity(entityAgc, start, end, 15);
|
|
|
+ PointInfo agcInfo = entityAgc.get(0);
|
|
|
+ //出线
|
|
|
+ List<PointInfo> entityCx = getEntity("AGC001", "booster");
|
|
|
+ entityCx = filterPointInfo(entityCx, stId, PointInfo::getStationId);
|
|
|
+ getSnapDataByEntity(entityCx, start, end, 15);
|
|
|
+ PointInfo cxInfo = entityCx.get(0);
|
|
|
+ //状态
|
|
|
+ List<PointInfo> turbineZt = calcTurbineDizt(start, end, 15);
|
|
|
+ turbineZt = filterPointInfo(turbineZt, stId, PointInfo::getStationId);
|
|
|
+ List<PointInfo> turbineAizt = calcTurbineAizt(start, end, 15);
|
|
|
+ turbineAizt = filterPointInfo(turbineAizt, stId, PointInfo::getStationId);
|
|
|
+ turbineZt.addAll(turbineAizt);
|
|
|
+ Map<String, PointInfo> ztMap = turbineZt.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
|
|
|
+ //风速
|
|
|
+ List<PointInfo> entityFs = getEntity("AI066", "turbine");
|
|
|
+ entityFs = filterPointInfo(entityFs, stId, PointInfo::getStationId);
|
|
|
+ getSnapDataByEntity(entityFs, start, end, 15);
|
|
|
+ Map<String, PointInfo> fsMap = entityFs.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
|
|
|
+ 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> firstZsgl = new ArrayList<>();
|
|
|
+ for (int i = 0; i < agcInfo.getPointDatas().size(); i++) {
|
|
|
+ int finalI = i;
|
|
|
+ long ts = start.getTime() + finalI * 15000L;
|
|
|
+ double v3 = pdsZsglMap.values().stream().mapToDouble(pds -> pds.get(finalI).getValue()).sum();
|
|
|
+ firstZsgl.add(new PointData(ts, v3));
|
|
|
+ }
|
|
|
+ List<PointData> czxd = calcStationXd2(agcInfo, cxInfo.getPointDatas(), firstZsgl);
|
|
|
+ for (PointData pd : czxd) {
|
|
|
+ System.out.println(DateUtil.formatDateTime(new Date(pd.getTs())) + "," + pd.getValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|