|
|
@@ -11,6 +11,7 @@ import cn.hutool.core.util.RandomUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.service.IService;
|
|
|
import com.ruoyi.quartz.handler.IJobHandler;
|
|
|
import com.ruoyi.ucp.entity.*;
|
|
|
import com.ruoyi.ucp.feign.AdapterApi;
|
|
|
@@ -55,7 +56,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
private static final Logger logger = LoggerFactory.getLogger(JavaFunctionJobHandler.class);
|
|
|
|
|
|
@Resource
|
|
|
- private AdapterApi adapter;
|
|
|
+ public AdapterApi adapter;
|
|
|
@Resource
|
|
|
private StringRedisTemplate stringRedisTemplate;
|
|
|
@Resource
|
|
|
@@ -2227,116 +2228,6 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
//turbineInfoMinService.saveOrUpdateBatch(dayMap.values());
|
|
|
}
|
|
|
|
|
|
- public void calcStation5s(DateTime begin, DateTime end) {
|
|
|
- if (end.equals(DateUtil.beginOfDay(end))) {
|
|
|
- return;
|
|
|
- } else {
|
|
|
- begin = DateUtil.beginOfDay(begin);
|
|
|
- }
|
|
|
- //AGC
|
|
|
- List<PointInfo> entityAgc = getEntity("AGC002", "booster");
|
|
|
- getSnapDataByEntity(entityAgc, begin, end, 15);
|
|
|
- //出线
|
|
|
- List<PointInfo> entityCx = getEntity("AGC020", "booster");
|
|
|
- getSnapDataByEntity(entityCx, begin, end, 15);
|
|
|
- //可用功率
|
|
|
- List<PointData> kyglpds = adapter.getHistorySnap(goldenUri(), "区域集控.惠安风场.升压站.中车风机设备信息.可用发电功率", begin.getTime(), end.getTime(), 15);
|
|
|
- List<PointData> kyglpds2 = adapter.getHistorySnap(goldenUri(), "区域集控.惠安风场.升压站.联合动力能管信息.可用发电功率", begin.getTime(), end.getTime(), 15);
|
|
|
- CollUtil.forEach(kyglpds, (pd, i) -> pd.setDoubleValue(pd.getValue() + kyglpds2.get(i).getValue()));
|
|
|
-
|
|
|
- PointInfo cxPi = entityCx.get(0);
|
|
|
- List<PointData> cxPds = cxPi.getPointDatas();
|
|
|
- List<PointData> czxd = calcStationXd2(entityAgc.get(0), cxPds, kyglpds, 0.01);
|
|
|
- List<Double> xdl = new ArrayList<>();
|
|
|
-
|
|
|
- for (int i = 0; i < cxPds.size(); i++) {
|
|
|
- double v = kyglpds.get(i).getValue() * 1000 - cxPds.get(i).getValue() * cxPi.getCoef();
|
|
|
- if (v < 0) v = 0;
|
|
|
- if (czxd.get(i).isBooleanValue()) {
|
|
|
- xdl.add(v);
|
|
|
- } else {
|
|
|
- xdl.add(0d);
|
|
|
- }
|
|
|
- }
|
|
|
- double sumxdl = xdl.stream().mapToDouble(Double::doubleValue).sum() / 2400;
|
|
|
- PointData data = new PointData(end.getTime(), NumberUtil.round(sumxdl, 4).doubleValue());
|
|
|
- data.setTagName("区域集控.惠安风场.统计计算.总日限电量");
|
|
|
- adapter.writeHistoryBatch(mqttUri(), Collections.singletonList(data));
|
|
|
- }
|
|
|
-
|
|
|
- public void haxdRecalc(Date date) {
|
|
|
- DateTime end = DateUtil.beginOfDay(date);
|
|
|
- DateTime begin = DateUtil.offsetDay(end, -1);
|
|
|
- //AGC
|
|
|
- List<PointInfo> entityAgc = getEntity("AGC002", "booster");
|
|
|
- getSnapDataByEntity(entityAgc, begin, end, 15);
|
|
|
- //出线
|
|
|
- List<PointInfo> entityCx = getEntity("AGC020", "booster");
|
|
|
- getSnapDataByEntity(entityCx, begin, end, 15);
|
|
|
- //可用功率
|
|
|
- //List<PointData> kyglpds1 = adapter.getHistorySnap(goldenUri(), "区域集控.惠安风场.AGCAVC.实时可调上限", begin.getTime(), end.getTime(), 15);
|
|
|
- List<PointData> cdxdlPd = adapter.getHistoryRaw(goldenUri(), "区域集控.惠安风场.统计计算.日限电量", end.getTime() - 2 * 60 * 60 * 1000, end.getTime());
|
|
|
- double cdxdl = cdxdlPd.stream().mapToDouble(PointData::getValue).max().orElse(0d) * 1000;
|
|
|
- List<PointData> kyglpds1 = adapter.getHistorySnap(goldenUri(), "区域集控.惠安风场.升压站.中车风机设备信息.可用发电功率", begin.getTime(), end.getTime(), 15);
|
|
|
- List<PointData> kyglpds2 = adapter.getHistorySnap(goldenUri(), "区域集控.惠安风场.升压站.联合动力能管信息.可用发电功率", begin.getTime(), end.getTime(), 15);
|
|
|
- for (int i = 0; i < kyglpds1.size(); i++) {
|
|
|
- PointData pd = kyglpds1.get(i);
|
|
|
- pd.setDoubleValue(pd.getValue() + kyglpds2.get(i).getValue());
|
|
|
- }
|
|
|
- PointInfo cxPi = entityCx.get(0);
|
|
|
- List<PointData> cxPds = cxPi.getPointDatas();
|
|
|
- List<PointData> czxd = calcStationXd2(entityAgc.get(0), cxPds, kyglpds1, 0.01);
|
|
|
- List<Double> xdl = new ArrayList<>();
|
|
|
- //总损失电量
|
|
|
- List<Double> zssdl = new ArrayList<>();
|
|
|
- for (int i = 0; i < cxPds.size(); i++) {
|
|
|
- double v = kyglpds1.get(i).getValue() * 1000 - cxPds.get(i).getValue() * cxPi.getCoef();
|
|
|
- if (v < 0) v = 0;
|
|
|
- if (czxd.get(i).isBooleanValue()) {
|
|
|
- xdl.add(v);
|
|
|
- } else {
|
|
|
- xdl.add(0d);
|
|
|
- zssdl.add(v);
|
|
|
- }
|
|
|
- }
|
|
|
- double sum = xdl.stream().mapToDouble(Double::doubleValue).sum() / 2400;
|
|
|
- //double xdv = sum / cdxdl;
|
|
|
- //if (xdv > 0.98 && xdv < 1.02) {
|
|
|
- //} else {
|
|
|
- // if (xdv > 0.57) {
|
|
|
- // sum = cdxdl * 0.9 + sum * 0.1;
|
|
|
- // } else {
|
|
|
- // sum = sum * 1.44;
|
|
|
- // }
|
|
|
- //}
|
|
|
- double sumZssdl = zssdl.stream().mapToDouble(Double::doubleValue).sum() / 2400;
|
|
|
- //List<Long> tss = entityCx.get(0).getPointDatas().stream().map(v -> v.getTs()).collect(Collectors.toList());
|
|
|
- //List<PowerLosses> losses = calcLossPeriods(xdl, tss);
|
|
|
- //CsvWriter writer = CsvUtil.getWriter("D:/loss.csv", CharsetUtil.CHARSET_UTF_8);
|
|
|
- //writer.writeBeans(losses);
|
|
|
- //writer.flush();
|
|
|
- List<TurbineInfoDay> byDate = getTurbineinfoByDate(begin);
|
|
|
- double xdsum = byDate.stream().mapToDouble(TurbineInfoDay::getXdss).sum();
|
|
|
- //xd + fjh + jh + xn
|
|
|
- double zsssum = byDate.stream().mapToDouble(tid -> tid.getFjhjxss() + tid.getJhjxss() + tid.getXnss()).sum();
|
|
|
- double xs = xdsum == 0d ? 0d : sum / xdsum;
|
|
|
- double zssXs = zsssum == 0d ? 0d : sumZssdl / zsssum;
|
|
|
- byDate.forEach(tid -> {
|
|
|
- tid.setXdss((tid.getXdss() - tid.getDjss()) * xs);
|
|
|
- tid.setLlfdl(tid.getRfdl() + tid.getXdss() + tid.getFjhjxss() + tid.getJhjxss() + tid.getXnss());
|
|
|
- //
|
|
|
- tid.setJhjxss(tid.getJhjxss() * zssXs);
|
|
|
- tid.setFjhjxss(tid.getFjhjxss() * zssXs);
|
|
|
- tid.setXnss(tid.getXnss() * zssXs);
|
|
|
- tid.setDjss(tid.getDjss() * zssXs);
|
|
|
- tid.setGzss(tid.getGzss() * zssXs);
|
|
|
- });
|
|
|
- //turbineInfoDayService.saveOrUpdateBatch(byDate);
|
|
|
- PointData data = new PointData(end.getTime(), NumberUtil.round(sum, 4).doubleValue());
|
|
|
- data.setTagName("区域集控.惠安风场.光耀计算.日限电量");
|
|
|
- adapter.writeHistoryBatch(mqttUri(), Collections.singletonList(data));
|
|
|
- }
|
|
|
-
|
|
|
public void getXdQx(List<Double> xdl, PointInfo piZt, List<PointData> fsList, List<PointData> glList) {
|
|
|
String tbId = piZt.getTurbineId();
|
|
|
|
|
|
@@ -4687,12 +4578,13 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
|
|
|
List<PointInfo> turbineZt = calcRealtimeTurbineDizt();
|
|
|
List<PointInfo> turbineAizt = calcRealtimeTurbineAizt();
|
|
|
+
|
|
|
turbineZt.addAll(turbineAizt);
|
|
|
- turbineZt = turbineZt.stream().peek(t -> {
|
|
|
- if (t.getPointDatas().get(0).getTs() + 35 * 60 * 1000 <= date.getTime()) {
|
|
|
- t.getPointDatas().get(0).setDoubleValue(12.0);
|
|
|
- }
|
|
|
- }).collect(Collectors.toList());
|
|
|
+ //turbineZt = turbineZt.stream().peek(t -> {
|
|
|
+ // if (t.getPointDatas().get(0).getTs() + 35 * 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())));
|
|
|
//AGC
|
|
|
List<PointInfo> entityAgc = getEntity("AGC002", "booster");
|
|
|
@@ -4816,9 +4708,9 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
}).collect(Collectors.toList());
|
|
|
if (isOnMin) {
|
|
|
List<PointData> czztDatas = xdPdMap.values().stream().peek(pd -> pd.setTs(date.getTime())).collect(Collectors.toList());
|
|
|
- adapter.writeHistoryBatch(taosUri(), czztDatas);
|
|
|
- adapter.writeHistoryBatch(taosUri(), dataList);
|
|
|
- adapter.writeHistoryBatch(taosUri(), qfztDataList);
|
|
|
+ //adapter.writeHistoryBatch(taosUri(), czztDatas);
|
|
|
+ //adapter.writeHistoryBatch(taosUri(), dataList);
|
|
|
+ //adapter.writeHistoryBatch(taosUri(), qfztDataList);
|
|
|
} else {
|
|
|
List<PointData> collect = dataList.stream().filter(d -> {
|
|
|
if (Objects.equals(CalcCache.statusCache.get(d.getTagName()), d.getValue())) {
|
|
|
@@ -4836,8 +4728,8 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
return true;
|
|
|
}
|
|
|
}).collect(Collectors.toList());
|
|
|
- adapter.writeHistoryBatch(taosUri(), collect);
|
|
|
- adapter.writeHistoryBatch(taosUri(), qfztDatas);
|
|
|
+ //adapter.writeHistoryBatch(taosUri(), collect);
|
|
|
+ //adapter.writeHistoryBatch(taosUri(), qfztDatas);
|
|
|
}
|
|
|
}
|
|
|
//此处加公式
|
|
|
@@ -5318,6 +5210,28 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
}
|
|
|
|
|
|
//依赖calcTurbineStateMin
|
|
|
+ public void calcTurbineFxTest(Date date) {
|
|
|
+ //date当天零点
|
|
|
+ DateTime time = DateUtil.beginOfDay(date);
|
|
|
+ //date昨天零点
|
|
|
+ DateTime time0 = DateUtil.offsetDay(time, -1);
|
|
|
+
|
|
|
+ List<TurbineInfoDay> byDate = getTurbineinfoByDate(time0);
|
|
|
+ //风向DI1392
|
|
|
+ List<PointInfo> entityFx = getEntity("AI067", "turbine");
|
|
|
+ Map<String, PointInfo> rawDataFx = getRawDataByEntity(entityFx, goldenUri(), time0, time, PointInfo::getTurbineId);
|
|
|
+
|
|
|
+ for (TurbineInfoDay day : byDate) {
|
|
|
+ String tbId = day.getTurbineId();
|
|
|
+ List<PointData> pdsFx = Optional.ofNullable(rawDataFx.get(tbId))
|
|
|
+ .map(PointInfo::getPointDatas).orElse(Collections.emptyList());
|
|
|
+ double fx = pdsFx.stream().mapToDouble(PointData::getValue).average().orElse(0d);
|
|
|
+ day.setFx(fx);
|
|
|
+ }
|
|
|
+ turbineInfoDayService.saveOrUpdateBatch(byDate);
|
|
|
+ }
|
|
|
+
|
|
|
+ //依赖calcTurbineStateMin
|
|
|
public void calcTurbineJfplFxYxfssBll(Date date) {
|
|
|
//date当天零点
|
|
|
DateTime time = DateUtil.beginOfDay(date);
|
|
|
@@ -5327,18 +5241,22 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
List<PointInfo> entityFs = getEntity("AI066", "turbine");
|
|
|
Map<String, PointInfo> rawDataFs = getRawDataByEntity(entityFs, goldenUri(), time0, time, PointInfo::getTurbineId);
|
|
|
List<TurbineInfoDay> byDate = getTurbineinfoByDate(time0);
|
|
|
- //风向
|
|
|
- List<PointInfo> entityFx = getEntity("DI1392", "turbine");
|
|
|
+ //风向DI1392
|
|
|
+ List<PointInfo> entityFx = getEntity("AI067", "turbine");
|
|
|
Map<String, PointInfo> rawDataFx = getRawDataByEntity(entityFx, goldenUri(), time0, time, PointInfo::getTurbineId);
|
|
|
|
|
|
for (TurbineInfoDay day : byDate) {
|
|
|
String tbId = day.getTurbineId();
|
|
|
+ //风速
|
|
|
List<PointData> pds = Optional.ofNullable(rawDataFs.get(tbId))
|
|
|
.map(PointInfo::getPointDatas).orElse(Collections.emptyList());
|
|
|
long jfsc = calcDuration(pds, pd -> pd.getValue() < 3d);
|
|
|
day.setJfpl(jfsc / (1000 * 60 * 60 * 24d));
|
|
|
- double yxfss = (24 * 60 - day.getJxMin() - day.getGzMin()) / 60;
|
|
|
- day.setYxfss(yxfss);
|
|
|
+
|
|
|
+ Long yf = calcMatchDuration(pds, pd -> pd.getValue() > 3d && pd.getValue() < 18d);
|
|
|
+ day.setYxfss(yf / (1000 * 60 * 60.0d));
|
|
|
+ //double yxfss = (24 * 60 - day.getJxMin() - day.getGzMin()) / 60;
|
|
|
+ //day.setYxfss(yxfss);
|
|
|
List<PointData> pdsFx = Optional.ofNullable(rawDataFx.get(tbId))
|
|
|
.map(PointInfo::getPointDatas).orElse(Collections.emptyList());
|
|
|
double fx = pdsFx.stream().mapToDouble(PointData::getValue).average().orElse(0d);
|
|
|
@@ -5403,6 +5321,9 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
}
|
|
|
|
|
|
public void calcTurbine5s(DateTime begin, DateTime end, double ssxs) {
|
|
|
+ IService<PowerLosses> powerLossesService = serviceGroup.getService(PowerLosses.class);
|
|
|
+ IService<TurbineInfoDay> turbineInfoDayService = serviceGroup.getService(TurbineInfoDay.class);
|
|
|
+ IService<ProEconBrownoutsEvent2> event2Service = serviceGroup.getService(ProEconBrownoutsEvent2.class);
|
|
|
List<PointInfo> isFubing = getIsFubing(begin, end);
|
|
|
Map<String, List<PointData>> isFubingMap = isFubing.stream().collect(Collectors.toMap(PointInfo::getTurbineId, PointInfo::getPointDatas));
|
|
|
//风速
|
|
|
@@ -5420,16 +5341,23 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
Map<String, Map<String, PointInfo>> ztMapMapInfos = ztMapMap.stream().collect(
|
|
|
Collectors.groupingBy(PointInfo::getStationId, Collectors.toMap(PointInfo::getTurbineId, Function.identity())));
|
|
|
|
|
|
- List<PointData> glpdss = entityFs.get(0).getPointDatas();
|
|
|
- List<Double> zeroList = IntStream.range(0, glpdss.size()).mapToObj(i -> 0.0).collect(Collectors.toList());
|
|
|
+ List<Long> tss = entityFs.get(0).getPointDatas().stream().map(PointData::getTs).collect(Collectors.toList());
|
|
|
+ List<List<Double>> xdlsList = new ArrayList<>();
|
|
|
+ List<ProEconBrownoutsEvent2> eventList = new ArrayList<>();
|
|
|
Map<String, TurbineInfoDay> dayMap = getTurbineinfoMap(begin, entityFs);
|
|
|
ztMapMapInfos.forEach((stId, ztMapInfo) -> ztMapInfo.forEach((wtId, ztInfo) -> {
|
|
|
//0 待机,1 手动停机,2 正常发电,3 发电降出力,4 故障,5 故障受累,6 检修,7 检修受累,8 限电降出力,
|
|
|
// 9 限电停机,10 电网受累,11 环境受累,12 通讯中断,13 设备离线
|
|
|
TurbineInfoDay infoDay = dayMap.get(wtId);
|
|
|
+ List<PointData> fsDatas = fsMapMap.get(stId).get(wtId);
|
|
|
+ List<PointData> glDatas = glMapMap.get(stId).get(wtId);
|
|
|
+ List<Double> zeros = IntStream.range(0, fsDatas.size()).mapToObj(i -> 0.0).collect(Collectors.toList());
|
|
|
//限电曲线
|
|
|
- getXdQx(zeroList, ztInfo, fsMapMap.get(stId).get(wtId), glMapMap.get(stId).get(wtId));
|
|
|
- Map<String, Double> loss = getTurbinePowerLoss2(isFubingMap.get(wtId), ztInfo, fsMapMap.get(stId).get(wtId), glMapMap.get(stId).get(wtId));
|
|
|
+ getXdQx(zeros, ztInfo, fsDatas, glDatas);
|
|
|
+ xdlsList.add(zeros);
|
|
|
+ List<PowerLosses> losses = calcLossPeriods(zeros, tss);
|
|
|
+ eventList.addAll(loss2events(losses, stId, wtId));
|
|
|
+ Map<String, Double> loss = getTurbinePowerLoss2(isFubingMap.get(wtId), ztInfo, fsDatas, glDatas);
|
|
|
infoDay.setJhjxss(loss.get("jxss") * ssxs);
|
|
|
infoDay.setFjhjxss(loss.get("gzss") * ssxs + loss.get("fdjcl") * ssxs + loss.get("sdtj") * ssxs);
|
|
|
infoDay.setXdss(loss.get("xdjcl") * ssxs + loss.get("xdtj") * ssxs);
|
|
|
@@ -5439,14 +5367,40 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
infoDay.setXnss(loss.get("xnss") * ssxs + loss.get("djss") * ssxs);
|
|
|
infoDay.setLlfdl(infoDay.getRfdl() + infoDay.getJhjxss() + infoDay.getFjhjxss() + infoDay.getXdss() + infoDay.getSlss() + infoDay.getXnss());
|
|
|
}));
|
|
|
- List<Double> collect = zeroList.stream().map(v -> v / 240).collect(Collectors.toList());
|
|
|
- List<Long> tss = glpdss.stream().map(PointData::getTs).collect(Collectors.toList());
|
|
|
+ List<Double> collect = sumLists(xdlsList).stream().map(v -> v / 240).collect(Collectors.toList());
|
|
|
List<PowerLosses> losses = calcLossPeriods(collect, tss);
|
|
|
QueryWrapper<PowerLosses> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("record_date", new Date(begin.getTime()));
|
|
|
powerLossesService.remove(queryWrapper);
|
|
|
powerLossesService.saveBatch(losses);
|
|
|
turbineInfoDayService.saveOrUpdateBatch(dayMap.values());
|
|
|
+ eventList.forEach(event -> event.setLossPower(event.getLossPower()/240));
|
|
|
+ event2Service.saveOrUpdateBatch(eventList);
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<ProEconBrownoutsEvent2> loss2events(List<PowerLosses> losses, String stId, String wtId) {
|
|
|
+ List<ProEconBrownoutsEvent2> events = new ArrayList<>();
|
|
|
+ for (PowerLosses loss : losses) {
|
|
|
+ ProEconBrownoutsEvent2 event = new ProEconBrownoutsEvent2();
|
|
|
+ event.setWindpowerstationId(stId);
|
|
|
+ event.setWindturbineId(wtId);
|
|
|
+ event.setStopTime(loss.getEndTime());
|
|
|
+ event.setStartTime(loss.getStartTime());
|
|
|
+ event.setStopHours((loss.getEndTime().getTime()-loss.getStartTime().getTime())/1000d/3600d);
|
|
|
+ event.setLossPower(loss.getXdss());
|
|
|
+ event.setStopTypeId("限电停机");
|
|
|
+ events.add(event);
|
|
|
+ }
|
|
|
+ return events;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public List<Double> sumLists(List<List<Double>> lists) {
|
|
|
+ if (lists == null || lists.isEmpty()) return new ArrayList<>();
|
|
|
+ int size = lists.get(0).size();
|
|
|
+ // 对每个位置 i,计算所有列表的第 i 个元素之和
|
|
|
+ return IntStream.range(0, size).mapToObj(i ->
|
|
|
+ lists.stream().mapToDouble(list -> list.get(i)).sum()).collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
public List<PointData> calcKygl(DateTime begin, DateTime end) {
|
|
|
@@ -5686,8 +5640,11 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
List<PointData> pds = Optional.ofNullable(rawDataFs.get(tbId)).map(PointInfo::getPointDatas).orElse(Collections.emptyList());
|
|
|
long jfsc = calcDuration(pds, pd -> pd.getValue() < 3d);
|
|
|
day.setJfpl(jfsc / (1000 * 60 * 60 * 24d));
|
|
|
- double yxfss = (24 * 60 - day.getJxMin() - day.getGzMin()) / 60;
|
|
|
- day.setYxfss(yxfss);
|
|
|
+
|
|
|
+ Long yf = calcMatchDuration(pds, pd -> pd.getValue() > 3d && pd.getValue() < 18d);
|
|
|
+ day.setYxfss(yf / (1000 * 60 * 60.0d));
|
|
|
+ //double yxfss = (24 * 60 - day.getJxMin() - day.getGzMin()) / 60;
|
|
|
+ //day.setYxfss(yxfss);
|
|
|
List<PointData> pdsFx = Optional.ofNullable(rawDataFx.get(tbId)).map(PointInfo::getPointDatas).orElse(Collections.emptyList());
|
|
|
double fx = pdsFx.stream().mapToDouble(PointData::getValue).average().orElse(0d);
|
|
|
day.setFx(fx);
|
|
|
@@ -6701,11 +6658,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
|
|
|
public void calcStationRealtimeLLgl() {
|
|
|
//实际功率时间戳
|
|
|
- Dict sjglsjc = CalcCache.dictMap.get("sjglsjc");
|
|
|
- if (sjglsjc == null) {
|
|
|
- sjglsjc = Dict.create();
|
|
|
- CalcCache.dictMap.put("sjglsjc", sjglsjc);
|
|
|
- }
|
|
|
+ Dict sjglsjc = CalcCache.dictMap.computeIfAbsent("sjglsjc", k -> Dict.create());
|
|
|
Map<String, String> llglMap = getEntityMap("SSZLLGL", "station");
|
|
|
Map<String, String> zbzglMap = getEntityMap("SSZBZGL", "station");
|
|
|
Map<String, String> bzglMap = getEntityMap("SSBZGL", "turbine");
|
|
|
@@ -7054,7 +7007,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
// System.out.println(tsc / 1000);
|
|
|
//}
|
|
|
//如果是故障
|
|
|
- if (prevState == 4) {
|
|
|
+ if (prevState == 4 || prevState == 1) {
|
|
|
//只有10分钟才算时间次数
|
|
|
if (tsc > 10 * 60 * 1000) {
|
|
|
frequency.put(prevState, frequency.getOrDefault(prevState, 0L) + 1);
|
|
|
@@ -9121,7 +9074,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
List<ProEconEquipmentInfoJs> yesterJs = proEconEquipmentInfoJsService.list(yesterWrapper);
|
|
|
Map<String, ProEconEquipmentInfoJs> yesterMap = yesterJs.stream().collect(Collectors.toMap(ProEconEquipmentInfoJs::getMeterName, Function.identity(), (k1, k2) -> k1));
|
|
|
|
|
|
- Map<String, PointData> yxts = adapter.getHistorySection(goldenUri(), "区域集控.惠安风场.统计计算.安全运行天数", thisDay.getTime());
|
|
|
+ Map<String, PointData> yxts = adapter.getHistorySection(goldenUri(), "区域集控.惠安风场.统计计算.安全运行天数", thisDay.getTime() - 1);
|
|
|
double ts = yxts.values().iterator().next().getValue();
|
|
|
//年平均风速计算方式:比如今天10号,(8号年风速×截止到8号安全运行天数+9号日风速)÷截止到9号安全运行天数
|
|
|
double v1 = (yesterMap.get("区域集控.惠安风场.一期年累平均风速").getStopCode() * ts + thisMap.get("区域集控.惠安风场.一期本期平均风速").getStopCode()) / (ts + 1);
|
|
|
@@ -9391,11 +9344,31 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
//List<PointInfo> entityFs = getEntity("AI066", "turbine");
|
|
|
//entityFs = filterPointInfo(entityFs, "NX_FGS_HA_F_WT_0021_EQ", PointInfo::getTurbineId);
|
|
|
//getSnapDataByEntity(entityFs, begin, end, 15);
|
|
|
+ //getRawDataByEntity(entityFs, goldenUri(), begin, end);
|
|
|
+ //for (PointInfo info : entityFs) {
|
|
|
+ // //List<PointData> dataList = info.getPointDatas().stream().filter(a -> a.getValue() == 0 || a.getValue() == -1).collect(Collectors.toList());
|
|
|
+ // List<PointData> dataList = info.getPointDatas().stream().filter(a -> a.getValue() <3||a.getValue() >18).collect(Collectors.toList());
|
|
|
+ // if(dataList.isEmpty()){
|
|
|
+ // System.out.println();
|
|
|
+ // }else {
|
|
|
+ // System.out.println();
|
|
|
+ // }
|
|
|
+ //}
|
|
|
List<PointInfo> entityAiZt = getEntity("AI422", "state");
|
|
|
- entityAiZt = filterPointInfo(entityAiZt, "NX_FGS_HA_F_WT_0012_EQ", PointInfo::getTurbineId);
|
|
|
- getRawDataByEntity(entityAiZt, goldenUri(), begin, end);
|
|
|
- entityAiZt.get(0).getPointDatas().stream().filter(a -> a.getValue() == 5 || a.getValue() == 6 || a.getValue() == 9).collect(Collectors.toList());
|
|
|
- calcStateDurationFrequency(entityAiZt.get(0).getPointDatas());
|
|
|
+ //List<PointInfo> entityAiZt = getEntity("MXZT", "turbine");
|
|
|
+ //entityAiZt = filterPointInfo(entityAiZt, "NX_FGS_HA_F_WT_0012_EQ", PointInfo::getTurbineId);
|
|
|
+ //getRawDataByEntity(entityAiZt, goldenUri(), begin, end);
|
|
|
+ //entityAiZt.get(0).getPointDatas().stream().filter(a -> a.getValue() == 5 || a.getValue() == 6 || a.getValue() == 9).collect(Collectors.toList());
|
|
|
+ for (PointInfo info : entityAiZt) {
|
|
|
+ //List<PointData> dataList = info.getPointDatas().stream().filter(a -> a.getValue() == 0 || a.getValue() == -1).collect(Collectors.toList());
|
|
|
+ List<PointData> dataList = info.getPointDatas().stream().filter(a -> a.getValue() == 5 || a.getValue() == 6 || a.getValue() == 9).collect(Collectors.toList());
|
|
|
+ if (dataList.isEmpty()) {
|
|
|
+ System.out.println();
|
|
|
+ } else {
|
|
|
+ System.out.println();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //calcStateDurationFrequency(entityAiZt.get(0).getPointDatas());
|
|
|
System.out.println();
|
|
|
|
|
|
}
|
|
|
@@ -9601,4 +9574,460 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
}
|
|
|
stationInfoDayService.saveOrUpdateBatch(byDate);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ public void haxdRecalc(Date date) {
|
|
|
+ DateTime end = DateUtil.beginOfDay(date);
|
|
|
+ DateTime begin = DateUtil.offsetDay(end, -1);
|
|
|
+ //AGC
|
|
|
+ List<PointInfo> entityAgc = getEntity("AGC002", "booster");
|
|
|
+ getSnapDataByEntity(entityAgc, begin, end, 15);
|
|
|
+ //出线
|
|
|
+ List<PointInfo> entityCx = getEntity("AGC020", "booster");
|
|
|
+ getSnapDataByEntity(entityCx, begin, end, 15);
|
|
|
+ //可用功率
|
|
|
+ //List<PointData> kyglpds1 = adapter.getHistorySnap(goldenUri(), "区域集控.惠安风场.AGCAVC.实时可调上限", begin.getTime(), end.getTime(), 15);
|
|
|
+ List<PointData> cdxdlPd = adapter.getHistoryRaw(goldenUri(), "区域集控.惠安风场.统计计算.日限电量", end.getTime() - 2 * 60 * 60 * 1000, end.getTime());
|
|
|
+ double cdxdl = cdxdlPd.stream().mapToDouble(PointData::getValue).max().orElse(0d) * 1000;
|
|
|
+ List<PointData> kyglpds1 = adapter.getHistorySnap(goldenUri(), "区域集控.惠安风场.升压站.中车风机设备信息.可用发电功率", begin.getTime(), end.getTime(), 15);
|
|
|
+ List<PointData> kyglpds2 = adapter.getHistorySnap(goldenUri(), "区域集控.惠安风场.升压站.联合动力能管信息.可用发电功率", begin.getTime(), end.getTime(), 15);
|
|
|
+ for (int i = 0; i < kyglpds1.size(); i++) {
|
|
|
+ PointData pd = kyglpds1.get(i);
|
|
|
+ pd.setDoubleValue(pd.getValue() + kyglpds2.get(i).getValue());
|
|
|
+ }
|
|
|
+ PointInfo cxPi = entityCx.get(0);
|
|
|
+ List<PointData> cxPds = cxPi.getPointDatas();
|
|
|
+ List<PointData> czxd = calcStationXd2(entityAgc.get(0), cxPds, kyglpds1, 0.01);
|
|
|
+ List<Double> xdl = new ArrayList<>();
|
|
|
+ //总损失电量
|
|
|
+ List<Double> zssdl = new ArrayList<>();
|
|
|
+ for (int i = 0; i < cxPds.size(); i++) {
|
|
|
+ double v = kyglpds1.get(i).getValue() * 1000 - cxPds.get(i).getValue() * cxPi.getCoef();
|
|
|
+ if (v < 0) v = 0;
|
|
|
+ if (czxd.get(i).isBooleanValue()) {
|
|
|
+ xdl.add(v);
|
|
|
+ } else {
|
|
|
+ xdl.add(0d);
|
|
|
+ zssdl.add(v);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ double sum = xdl.stream().mapToDouble(Double::doubleValue).sum() / 2400;
|
|
|
+ //double xdv = sum / cdxdl;
|
|
|
+ //if (xdv > 0.98 && xdv < 1.02) {
|
|
|
+ //} else {
|
|
|
+ // if (xdv > 0.57) {
|
|
|
+ // sum = cdxdl * 0.9 + sum * 0.1;
|
|
|
+ // } else {
|
|
|
+ // sum = sum * 1.44;
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ double sumZssdl = zssdl.stream().mapToDouble(Double::doubleValue).sum() / 2400;
|
|
|
+ //List<Long> tss = entityCx.get(0).getPointDatas().stream().map(v -> v.getTs()).collect(Collectors.toList());
|
|
|
+ //List<PowerLosses> losses = calcLossPeriods(xdl, tss);
|
|
|
+ //CsvWriter writer = CsvUtil.getWriter("D:/loss.csv", CharsetUtil.CHARSET_UTF_8);
|
|
|
+ //writer.writeBeans(losses);
|
|
|
+ //writer.flush();
|
|
|
+ List<TurbineInfoDay> byDate = getTurbineinfoByDate(begin);
|
|
|
+ double xdsum = byDate.stream().mapToDouble(TurbineInfoDay::getXdss).sum();
|
|
|
+ //xd + fjh + jh + xn
|
|
|
+ double zsssum = byDate.stream().mapToDouble(tid -> tid.getFjhjxss() + tid.getJhjxss() + tid.getXnss()).sum();
|
|
|
+ double xs = xdsum == 0d ? 0d : sum / xdsum;
|
|
|
+ double zssXs = zsssum == 0d ? 0d : sumZssdl / zsssum;
|
|
|
+ byDate.forEach(tid -> {
|
|
|
+ tid.setXdss((tid.getXdss() - tid.getDjss()) * xs);
|
|
|
+ tid.setLlfdl(tid.getRfdl() + tid.getXdss() + tid.getFjhjxss() + tid.getJhjxss() + tid.getXnss());
|
|
|
+ //
|
|
|
+ tid.setJhjxss(tid.getJhjxss() * zssXs);
|
|
|
+ tid.setFjhjxss(tid.getFjhjxss() * zssXs);
|
|
|
+ tid.setXnss(tid.getXnss() * zssXs);
|
|
|
+ tid.setDjss(tid.getDjss() * zssXs);
|
|
|
+ tid.setGzss(tid.getGzss() * zssXs);
|
|
|
+ });
|
|
|
+ //turbineInfoDayService.saveOrUpdateBatch(byDate);
|
|
|
+ }
|
|
|
+
|
|
|
+ public double getValueByTagName(List<PointData> dataList, String tagName) {
|
|
|
+ return dataList.stream()
|
|
|
+ .filter(data -> tagName.equals(data.getTagName()))
|
|
|
+ .findFirst()
|
|
|
+ .map(PointData::getDoubleValue)
|
|
|
+ .orElse(0.0);
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<PointData> getDataForZbs(DateTime date, String zbName, double value, double xs) {
|
|
|
+ List<PointData> pds = new ArrayList<>();
|
|
|
+ value = NumberUtil.round(value * xs, 4).doubleValue();
|
|
|
+ pds.add(new PointData(date.getTime(), zbName, value));
|
|
|
+ String s = CalcCache.oneMap.get(zbName);
|
|
|
+ String[] split = s.split(";");
|
|
|
+ for (String infos : split) {
|
|
|
+ String[] info = infos.split(",");
|
|
|
+ Dict dict = CalcCache.dictMap.get(info[1]);
|
|
|
+ Double va = dict.getDouble(info[2]);
|
|
|
+ double v = NumberUtil.round(va * xs, 4).doubleValue();
|
|
|
+ pds.add(new PointData(date.getTime(), info[0], v + value));
|
|
|
+ }
|
|
|
+ return pds;
|
|
|
+ }
|
|
|
+
|
|
|
+ public double out2Zero(double value, double min, double max) {
|
|
|
+ if (value < min || value > max) value = 0;
|
|
|
+ return value;
|
|
|
+ }
|
|
|
+
|
|
|
+ public double averagePd(List<PointData> pds) {
|
|
|
+ return pds.stream().mapToDouble(PointData::getValue).average().orElse(0d);
|
|
|
+ }
|
|
|
+
|
|
|
+ public double sumPd(List<PointData> pds) {
|
|
|
+ return pds.stream().mapToDouble(PointData::getValue).sum();
|
|
|
+ }
|
|
|
+
|
|
|
+ public PointData getDataForZb(DateTime date, String zbName, double value, double xs) {
|
|
|
+ double v = NumberUtil.round(value * xs, 4).doubleValue();
|
|
|
+ PointData data = new PointData(date.getTime(), zbName, v);
|
|
|
+ CalcCache.pointDataMap.put(zbName, data);
|
|
|
+ return data;
|
|
|
+ }
|
|
|
+
|
|
|
+ public PointData getDataForZb(DateTime date, String zbName, double value) {
|
|
|
+ return getDataForZb(date, zbName, value, 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<PointData> getDataForZbs2(DateTime date, String zbName, double value) {
|
|
|
+ return getDataForZbs2(date, zbName, value, 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<PointData> getDataForZbs2(DateTime date, String zbName, double value, double xs) {
|
|
|
+ List<PointData> pds = new ArrayList<>();
|
|
|
+ pds.add(getDataForZb(date, zbName, value, xs));
|
|
|
+ String yn = CalcCache.oneMap.get(zbName + "--月年");
|
|
|
+ String[] split = yn.split(",");
|
|
|
+ for (String infos : split) {
|
|
|
+ pds.add(getDataForZb2(date, infos, value, xs));
|
|
|
+ }
|
|
|
+ return pds;
|
|
|
+ }
|
|
|
+
|
|
|
+ public PointData getDataForZb2(DateTime date, String zbName, double rvalue, double xs) {
|
|
|
+ String ryn_jsname = CalcCache.oneMap.get(zbName);
|
|
|
+ String[] split = ryn_jsname.split(",");
|
|
|
+ Double value;
|
|
|
+ if (split.length > 2) {
|
|
|
+ if (zbName.contains("平均风速")) {
|
|
|
+ Double ts = CalcCache.dictMap.get("安全天数").getDouble("昨天");
|
|
|
+ value = ((Optional.of(CalcCache.dictMap.get(split[0])).orElse(Dict.create()).getDouble(split[1]) +
|
|
|
+ Optional.of(CalcCache.dictMap.get(split[0])).orElse(Dict.create()).getDouble(split[2])) / 2 *
|
|
|
+ ts + rvalue) / (ts + 1);
|
|
|
+ } else {
|
|
|
+ value = Optional.of(CalcCache.dictMap.get(split[0])).orElse(Dict.create()).getDouble(split[1]) +
|
|
|
+ Optional.of(CalcCache.dictMap.get(split[0])).orElse(Dict.create()).getDouble(split[2]) + rvalue;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ value = Optional.of(CalcCache.dictMap.get(split[0])).orElse(Dict.create()).getDouble(split[1]) + rvalue;
|
|
|
+ }
|
|
|
+ return getDataForZb(date, zbName, value, xs);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void createBimap() {
|
|
|
+ //CalcCache.biMap.put("区域集控.惠安风场.全场本期限电量", "区域集控.惠安风场.光耀计算.日限电量");
|
|
|
+ //CalcCache.biMap.put("区域集控.惠安风场.全场月限电量", "区域集控.惠安风场.光耀计算.月限电量");
|
|
|
+ //CalcCache.biMap.put("区域集控.惠安风场.全场年限电量", "区域集控.惠安风场.光耀计算.年限电量");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.日限电量--月年", "区域集控.惠安风场.光耀计算.月限电量,区域集控.惠安风场.光耀计算.年限电量");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.日限损失电量--月年", "区域集控.惠安风场.光耀计算.月限电损失电量,区域集控.惠安风场.光耀计算.年限电损失电量");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.日故障损失电量--月年", "区域集控.惠安风场.光耀计算.月限故障失电量,区域集控.惠安风场.光耀计算.年限故障失电量");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.日计划检修损失电量--月年", "区域集控.惠安风场.光耀计算.月计划检修损失电量,区域集控.惠安风场.光耀计算.年计划检修损失电量");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.日受累损失电量--月年", "区域集控.惠安风场.光耀计算.月受累损失电量,区域集控.惠安风场.光耀计算.年受累损失电量");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.日性能损失电量--月年", "区域集控.惠安风场.光耀计算.月性能损失电量,区域集控.惠安风场.光耀计算.年性能损失电量");
|
|
|
+
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.日平均风速--月年", "区域集控.惠安风场.光耀计算.月平均风速,区域集控.惠安风场.光耀计算.年平均风速");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.日发电量--月年", "区域集控.惠安风场.光耀计算.月发电量,区域集控.惠安风场.光耀计算.年发电量");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.日上网电量--月年", "区域集控.惠安风场.光耀计算.月上网电量,区域集控.惠安风场.光耀计算.年上网电量");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.日购网电量--月年", "区域集控.惠安风场.光耀计算.月购网电量,区域集控.惠安风场.光耀计算.年购网电量");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.日场用电量--月年", "区域集控.惠安风场.光耀计算.月场用电量,区域集控.惠安风场.光耀计算.年场用电量");
|
|
|
+ //CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.日综合场用电量--月年", "区域集控.惠安风场.光耀计算.月综合场用电量,区域集控.惠安风场.光耀计算.年综合场用电量");
|
|
|
+ //CalcCache.oneMap.put("区域集控.惠安风场.全场月限电量", "一月合计指标");
|
|
|
+ //CalcCache.oneMap.put("区域集控.惠安风场.全场年限电量", "一年合计指标");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.日限电量", "当日指标,区域集控.惠安风场.全场本期限电量");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.月限电量", "一月合计指标,区域集控.惠安风场.全场本期限电量");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.年限电量", "一年合计指标,区域集控.惠安风场.全场本期限电量");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.日限电损失电量", "当日指标,区域集控.惠安风场.全场本期限电量");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.月限电损失电量", "一月合计指标,区域集控.惠安风场.全场本期限电量");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.年限电损失电量", "一年合计指标,区域集控.惠安风场.全场本期限电量");
|
|
|
+
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.日故障损失电量", "当日指标,区域集控.惠安风场.全场本期故障损失电量");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.日计划检修损失电量", "当日指标,区域集控.惠安风场.全场本期定检维护电量");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.日受累损失电量", "当日指标,区域集控.惠安风场.全场本期受累损失电量");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.日性能损失电量", "当日指标,区域集控.惠安风场.日性能损失电量");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.月故障损失电量", "一月合计指标,区域集控.惠安风场.全场本期故障损失电量");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.月计划检修损失电量", "一月合计指标,区域集控.惠安风场.全场本期定检维护电量");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.月受累损失电量", "一月合计指标,区域集控.惠安风场.全场本期受累损失电量");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.月性能损失电量", "当日指标,区域集控.惠安风场.月性能损失电量");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.年故障损失电量", "一年合计指标,区域集控.惠安风场.全场本期故障损失电量");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.年计划检修损失电量", "一年合计指标,区域集控.惠安风场.全场本期定检维护电量");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.年受累损失电量", "一年合计指标,区域集控.惠安风场.全场本期受累损失电量");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.年性能损失电量", "当日指标,区域集控.惠安风场.年性能损失电量");
|
|
|
+
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.日发电量", "当日指标,区域集控.惠安风场.一期本期实际发电量,区域集控.惠安风场.二期本期实际发电量");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.月发电量", "一月合计指标,区域集控.惠安风场.一期本期实际发电量,区域集控.惠安风场.二期本期实际发电量");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.年发电量", "一年合计指标,区域集控.惠安风场.一期本期实际发电量,区域集控.惠安风场.二期本期实际发电量");
|
|
|
+
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.日平均风速", "当日指标,区域集控.惠安风场.一期本期平均风速,区域集控.惠安风场.二期本期平均风速");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.月平均风速", "当日指标,区域集控.惠安风场.一期月累平均风速,区域集控.惠安风场.二期月累平均风速");
|
|
|
+ CalcCache.oneMap.put("区域集控.惠安风场.光耀计算.年平均风速", "当日指标,区域集控.惠安风场.一期年累平均风速,区域集控.惠安风场.二期年累平均风速");
|
|
|
+
|
|
|
+ //CalcCache.pushMap.computeIfAbsent("当日指标", k -> new HashMap<>()).put("区域集控.惠安风场.全场本期限电量", "区域集控.惠安风场.光耀计算.日限电量");
|
|
|
+ //CalcCache.pushMap.computeIfAbsent("一月合计指标", k -> new HashMap<>()).put("区域集控.惠安风场.全场本期限电量", "区域集控.惠安风场.光耀计算.月限电量");
|
|
|
+ //CalcCache.pushMap.computeIfAbsent("一年合计指标", k -> new HashMap<>()).put("区域集控.惠安风场.全场本期限电量", "区域集控.惠安风场.光耀计算.年限电量");
|
|
|
+ }
|
|
|
+
|
|
|
+ public double tsAdd(String tagName1, String tagName2) {
|
|
|
+ tagName1 = "区域集控.惠安风场.光耀计算." + tagName1;
|
|
|
+ tagName2 = "区域集控.惠安风场.光耀计算." + tagName2;
|
|
|
+ return CalcCache.pointDataMap.get(tagName1).getValue() + CalcCache.pointDataMap.get(tagName2).getValue();
|
|
|
+ }
|
|
|
+
|
|
|
+ public double tsAdd(String... tagNames) {
|
|
|
+ double r = 0;
|
|
|
+ for (String tagName : tagNames) {
|
|
|
+ tagName = "区域集控.惠安风场.光耀计算." + tagName;
|
|
|
+ r += CalcCache.pointDataMap.get(tagName).getValue();
|
|
|
+ }
|
|
|
+ return r;
|
|
|
+ }
|
|
|
+
|
|
|
+ public double tsAdd(double value1, String tagName2) {
|
|
|
+ tagName2 = "区域集控.惠安风场.光耀计算." + tagName2;
|
|
|
+ return value1 + CalcCache.pointDataMap.get(tagName2).getValue();
|
|
|
+ }
|
|
|
+
|
|
|
+ public double tsMul(String tagName1, String tagName2) {
|
|
|
+ tagName1 = "区域集控.惠安风场.光耀计算." + tagName1;
|
|
|
+ tagName2 = "区域集控.惠安风场.光耀计算." + tagName2;
|
|
|
+ return CalcCache.pointDataMap.get(tagName1).getValue() * CalcCache.pointDataMap.get(tagName2).getValue();
|
|
|
+ }
|
|
|
+
|
|
|
+ public double tsDiv(String tagName1, String tagName2) {
|
|
|
+ tagName1 = "区域集控.惠安风场.光耀计算." + tagName1;
|
|
|
+ tagName2 = "区域集控.惠安风场.光耀计算." + tagName2;
|
|
|
+ return CalcCache.pointDataMap.get(tagName1).getValue() / CalcCache.pointDataMap.get(tagName2).getValue();
|
|
|
+ }
|
|
|
+
|
|
|
+ public double tsDiv(String tagName1, double value2) {
|
|
|
+ tagName1 = "区域集控.惠安风场.光耀计算." + tagName1;
|
|
|
+ return CalcCache.pointDataMap.get(tagName1).getValue() / value2;
|
|
|
+ }
|
|
|
+
|
|
|
+ public double tsDiv(double value1, String tagName2) {
|
|
|
+ tagName2 = "区域集控.惠安风场.光耀计算." + tagName2;
|
|
|
+ return value1 / CalcCache.pointDataMap.get(tagName2).getValue();
|
|
|
+ }
|
|
|
+
|
|
|
+ public double tsSub(String tagName1, String tagName2) {
|
|
|
+ tagName1 = "区域集控.惠安风场.光耀计算." + tagName1;
|
|
|
+ tagName2 = "区域集控.惠安风场.光耀计算." + tagName2;
|
|
|
+ return CalcCache.pointDataMap.get(tagName1).getValue() - CalcCache.pointDataMap.get(tagName2).getValue();
|
|
|
+ }
|
|
|
+
|
|
|
+ public double tsSub(double value1, String tagName2) {
|
|
|
+ tagName2 = "区域集控.惠安风场.光耀计算." + tagName2;
|
|
|
+ return value1 - CalcCache.pointDataMap.get(tagName2).getValue();
|
|
|
+ }
|
|
|
+
|
|
|
+ public void calcNYData(DateTime date) {
|
|
|
+ IService<ProEconEquipmentInfoJs> jsService = serviceGroup.getService(ProEconEquipmentInfoJs.class);
|
|
|
+ Dict aqts = CalcCache.dictMap.computeIfAbsent("安全天数", k -> Dict.create());
|
|
|
+ Dict zbDR = CalcCache.dictMap.computeIfAbsent("当日指标", k -> Dict.create());
|
|
|
+ Dict zbYYHJ = CalcCache.dictMap.computeIfAbsent("一月合计指标", k -> Dict.create());
|
|
|
+ Dict zbYNHJ = CalcCache.dictMap.computeIfAbsent("一年合计指标", k -> Dict.create());
|
|
|
+ //当天指标
|
|
|
+ QueryWrapper<ProEconEquipmentInfoJs> wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.eq("record_date", date).ne("meter_id", "AI0001");
|
|
|
+ List<ProEconEquipmentInfoJs> jss = jsService.list(wrapper);
|
|
|
+ jss.forEach(js -> zbDR.put(js.getMeterName(), js.getStopCode()));
|
|
|
+ //Map<String, ProEconEquipmentInfoJs> jsMap = jss.stream().collect(Collectors.toMap(ProEconEquipmentInfoJs::getMeterName, Function.identity(), (k1, k2) -> k1));
|
|
|
+ //一月指标
|
|
|
+ QueryWrapper<ProEconEquipmentInfoJs> wrapperYY = new QueryWrapper<>();
|
|
|
+ wrapperYY.between("record_date", DateUtil.beginOfMonth(date), date).ne("meter_id", "AI0001");
|
|
|
+ List<ProEconEquipmentInfoJs> jssYY = jsService.list(wrapperYY);
|
|
|
+ Map<String, List<ProEconEquipmentInfoJs>> jsYYMap = jssYY.stream().collect(Collectors.groupingBy(ProEconEquipmentInfoJs::getMeterName));
|
|
|
+ jsYYMap.forEach((key, ijs) -> zbYYHJ.put(key, ijs.stream().mapToDouble(ProEconEquipmentInfoJs::getStopCode).sum()));
|
|
|
+ //一年指标
|
|
|
+ QueryWrapper<ProEconEquipmentInfoJs> wrapperYN = new QueryWrapper<>();
|
|
|
+ wrapperYN.between("record_date", DateUtil.beginOfYear(date), date).ne("meter_id", "AI0001");
|
|
|
+ List<ProEconEquipmentInfoJs> jssYN = jsService.list(wrapperYN);
|
|
|
+ Map<String, List<ProEconEquipmentInfoJs>> jsYNMap = jssYN.stream().collect(Collectors.groupingBy(ProEconEquipmentInfoJs::getMeterName));
|
|
|
+ jsYNMap.forEach((key, ijs) -> zbYNHJ.put(key, ijs.stream().mapToDouble(ProEconEquipmentInfoJs::getStopCode).sum()));
|
|
|
+
|
|
|
+ Map<String, PointData> yxts = adapter.getHistorySection(goldenUri(), "区域集控.惠安风场.统计计算.安全运行天数", date.getTime() - 1);
|
|
|
+ double ts = yxts.values().iterator().next().getValue();
|
|
|
+ aqts.put("昨天", ts);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void zeroPush2(DateTime time) {
|
|
|
+ List<PointData> pds = new ArrayList<>();
|
|
|
+ //pds.add(getDataForZb2(time, "区域集控.惠安风场.光耀计算.日限电量", 1));
|
|
|
+ //pds.add(getDataForZb2(time, "区域集控.惠安风场.光耀计算.月限电量", 1));
|
|
|
+ //pds.add(getDataForZb2(time, "区域集控.惠安风场.光耀计算.年限电量", 1));
|
|
|
+ System.out.println();
|
|
|
+ adapter.writeHistoryBatch(mqttUri(), pds);
|
|
|
+ }
|
|
|
+
|
|
|
+ public PointData getDataForZb(DateTime date, String tagName, String zbName, double xs) {
|
|
|
+ Dict dict = CalcCache.dictMap.get(zbName);
|
|
|
+ Double value = dict.getDouble(tagName);
|
|
|
+ double v = NumberUtil.round(value * xs, 4).doubleValue();
|
|
|
+ return new PointData(date.getTime(), CalcCache.pushMap.get(zbName).get(tagName), v);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void zeroPush(DateTime time) {
|
|
|
+ List<PointData> pds = new ArrayList<>();
|
|
|
+ pds.add(getDataForZb(time, "区域集控.惠安风场.全场本期限电量", "当日指标", 1));
|
|
|
+ pds.add(getDataForZb(time, "区域集控.惠安风场.全场本期限电量", "一月合计指标", 1));
|
|
|
+ pds.add(getDataForZb(time, "区域集控.惠安风场.全场本期限电量", "一年合计指标", 1));
|
|
|
+ System.out.println();
|
|
|
+ //adapter.writeHistoryBatch(mqttUri(), pds);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void getDatas(DateTime begin, DateTime end) {
|
|
|
+ //AGC
|
|
|
+ List<PointInfo> entityAgc = getEntity("AGC002", "booster");
|
|
|
+ getSnapDataByEntity(entityAgc, begin, end, 15);
|
|
|
+ CalcCache.pointInfosMap.put("推送-booster-AGC-snap15s", entityAgc);
|
|
|
+ //出线
|
|
|
+ List<PointInfo> entityCx = getEntity("AGC020", "booster");
|
|
|
+ getSnapDataByEntity(entityCx, begin, end, 15);
|
|
|
+ CalcCache.pointInfosMap.put("推送-booster-出线-snap15s", entityCx);
|
|
|
+ //可用功率
|
|
|
+ List<PointData> kyglpds = adapter.getHistorySnap(goldenUri(), "区域集控.惠安风场.升压站.中车风机设备信息.可用发电功率", begin.getTime(), end.getTime(), 15);
|
|
|
+ List<PointData> kyglpds2 = adapter.getHistorySnap(goldenUri(), "区域集控.惠安风场.升压站.联合动力能管信息.可用发电功率", begin.getTime(), end.getTime(), 15);
|
|
|
+ CollUtil.forEach(kyglpds, (pd, i) -> pd.setDoubleValue(pd.getValue() + kyglpds2.get(i).getValue()));
|
|
|
+ CalcCache.pointDatasMap.put("推送-booster-可用功率-snap15s", kyglpds);
|
|
|
+ //风速
|
|
|
+ List<PointInfo> entityFs = getEntity("AI066", "turbine");
|
|
|
+ getSnapDataByEntity(entityFs, begin, end, 15);
|
|
|
+ CalcCache.pointInfosMap.put("推送-turbine-风速-snap15s", entityFs);
|
|
|
+ //功率
|
|
|
+ List<PointInfo> entityGl = getEntity("AI114", "turbine");
|
|
|
+ getSnapDataByEntity(entityGl, begin, end, 15);
|
|
|
+ CalcCache.pointInfosMap.put("推送-turbine-功率-snap15s", entityGl);
|
|
|
+ //状态
|
|
|
+ List<PointInfo> ztMapMap = calcTurbineZt(begin, end);
|
|
|
+ CalcCache.pointInfosMap.put("推送-turbine-状态-snap15s", ztMapMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<PointInfo> calcTurbineZt(Date start, Date end) {
|
|
|
+ List<PointInfo> turbineZt = calcTurbineDizt(start, end, 15);
|
|
|
+ List<PointInfo> turbineAizt = calcTurbineAizt(start, end, 15);
|
|
|
+ turbineZt.addAll(turbineAizt);
|
|
|
+ Map<String, Map<String, PointInfo>> ztMapMap = pointInfos2MapMap2(turbineZt);
|
|
|
+
|
|
|
+ //AGC
|
|
|
+ List<PointInfo> entityAgc = CalcCache.pointInfosMap.get("推送-booster-AGC-snap15s");
|
|
|
+ //出线
|
|
|
+ List<PointInfo> entityCx = CalcCache.pointInfosMap.get("推送-booster-出线-snap15s");
|
|
|
+ //叶轮转速给定
|
|
|
+ List<PointInfo> entityYlzsgd = getEntity("AI110", "turbine");
|
|
|
+ getSnapDataByEntity(entityYlzsgd, start, end, 15);
|
|
|
+
|
|
|
+ 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 = pointInfos2MapMap(entityYlzsgd);
|
|
|
+ //风速
|
|
|
+ List<PointInfo> fsInfos = CalcCache.pointInfosMap.get("推送-turbine-风速-snap15s");
|
|
|
+ Map<String, Map<String, PointInfo>> fsMapMap = pointInfos2MapMap2(fsInfos);
|
|
|
+ //功率
|
|
|
+ List<PointInfo> glInfos = CalcCache.pointInfosMap.get("推送-turbine-功率-snap15s");
|
|
|
+ Map<String, Map<String, List<PointData>>> glMapMap = pointInfos2MapMap(glInfos);
|
|
|
+ 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;
|
|
|
+ for (int i = 0; i < agcInfo.getPointDatas().size(); i++) {
|
|
|
+ int finalI = i;
|
|
|
+ long ts = start.getTime() + i * 15000L;
|
|
|
+ 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, 0.4);
|
|
|
+ String ybj = "NX_FGS_HA_F_WT_0001_EQ,NX_FGS_HA_F_WT_0002_EQ,NX_FGS_HA_F_WT_0003_EQ,NX_FGS_HA_F_WT_0004_EQ,NX_FGS_HA_F_WT_0005_EQ,NX_FGS_HA_F_WT_0006_EQ,NX_FGS_HA_F_WT_0007_EQ,NX_FGS_HA_F_WT_0008_EQ,NX_FGS_HA_F_WT_0009_EQ,NX_FGS_HA_F_WT_0010_EQ,NX_FGS_HA_F_WT_0011_EQ,NX_FGS_HA_F_WT_0012_EQ,NX_FGS_HA_F_WT_0013_EQ,NX_FGS_HA_F_WT_0014_EQ,NX_FGS_HA_F_WT_0015_EQ,NX_FGS_HA_F_WT_0016_EQ,NX_FGS_HA_F_WT_0017_EQ,NX_FGS_HA_F_WT_0018_EQ,NX_FGS_HA_F_WT_0019_EQ,NX_FGS_HA_F_WT_0020_EQ,NX_FGS_HA_F_WT_0021_EQ,NX_FGS_HA_F_WT_0022_EQ,NX_FGS_HA_F_WT_0023_EQ,NX_FGS_HA_F_WT_0024_EQ,NX_FGS_HA_F_WT_0025_EQ";
|
|
|
+ ztMap.forEach((wtId, ztInfo) -> {
|
|
|
+ if (ybj.contains(wtId)) return;
|
|
|
+ List<PointData> fss = fsMap.get(wtId).getPointDatas();
|
|
|
+ List<PointData> gls = glMapMap.get(stId).get(wtId);
|
|
|
+ //叶轮转速给定
|
|
|
+ List<PointData> ylzsgds = Optional.ofNullable(collectYlzsgd.get(stId)).map(m -> m.get(wtId)).orElse(null);
|
|
|
+ calcTurbineXd(ztInfo, gls, fss, ylzsgds, czxd);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ return turbineZt;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Map<String, Map<String, List<PointData>>> pointInfos2MapMap(List<PointInfo> infos) {
|
|
|
+ return infos.stream().collect(Collectors.groupingBy(PointInfo::getStationId, Collectors.toMap(PointInfo::getTurbineId, PointInfo::getPointDatas)));
|
|
|
+ }
|
|
|
+
|
|
|
+ public Map<String, Map<String, PointInfo>> pointInfos2MapMap2(List<PointInfo> infos) {
|
|
|
+ return infos.stream().collect(Collectors.groupingBy(PointInfo::getStationId, Collectors.toMap(PointInfo::getTurbineId, Function.identity())));
|
|
|
+ }
|
|
|
+
|
|
|
+ public void calcStation5s(DateTime begin, DateTime end) {
|
|
|
+ if (end.equals(DateUtil.beginOfDay(end))) return;
|
|
|
+ //AGC
|
|
|
+ List<PointInfo> entityAgc = CalcCache.pointInfosMap.get("推送-booster-AGC-snap15s");
|
|
|
+ //出线
|
|
|
+ List<PointInfo> entityCx = CalcCache.pointInfosMap.get("推送-booster-出线-snap15s");
|
|
|
+ //可用功率
|
|
|
+ List<PointData> kyglpds = CalcCache.pointDatasMap.get("推送-booster-可用功率-snap15s");
|
|
|
+ PointInfo cxPi = entityCx.get(0);
|
|
|
+ List<PointData> cxPds = cxPi.getPointDatas();
|
|
|
+ List<PointData> czxd = calcStationXd2(entityAgc.get(0), cxPds, kyglpds, 0.01);
|
|
|
+ List<Double> xdl = new ArrayList<>();
|
|
|
+
|
|
|
+ for (int i = 0; i < cxPds.size(); i++) {
|
|
|
+ double v = kyglpds.get(i).getValue() * 1000 - cxPds.get(i).getValue() * cxPi.getCoef();
|
|
|
+ if (v < 0) v = 0;
|
|
|
+ if (czxd.get(i).isBooleanValue()) {
|
|
|
+ xdl.add(v);
|
|
|
+ } else {
|
|
|
+ xdl.add(0d);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ double sumxdl = xdl.stream().mapToDouble(Double::doubleValue).sum() / 2400000;
|
|
|
+ //adapter.writeHistoryBatch(mqttUri(), getDataForZbs2(end, "区域集控.惠安风场.光耀计算.日限电量", sumxdl, 1));
|
|
|
+
|
|
|
+ getDataForZb(end, "区域集控.惠安风场.光耀计算.日限电率", sumxdl/tsAdd(sumxdl, "日发电量")*100);
|
|
|
+ getDataForZb(end, "区域集控.惠安风场.光耀计算.月限电率", tsDiv("月限电量",tsAdd("月限电量", "月发电量"))*100);
|
|
|
+ getDataForZb(end, "区域集控.惠安风场.光耀计算.年限电率", tsDiv("年限电量",tsAdd("年限电量", "年发电量"))*100);
|
|
|
+ getDataForZb(end, "区域集控.惠安风场.光耀计算.日限电率", CalcCache.pointDataMap.get("区域集控.惠安风场.光耀计算.日限电率").getValue());
|
|
|
+ getDataForZb(end, "区域集控.惠安风场.光耀计算.月限电率", CalcCache.pointDataMap.get("区域集控.惠安风场.光耀计算.月限电率").getValue());
|
|
|
+ getDataForZb(end, "区域集控.惠安风场.光耀计算.年限电率", CalcCache.pointDataMap.get("区域集控.惠安风场.光耀计算.年限电率").getValue());
|
|
|
+ }
|
|
|
}
|