|
@@ -0,0 +1,559 @@
|
|
|
+package com.gyee.impala.schdule;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.gyee.impala.common.spring.DecisionConvert;
|
|
|
+import com.gyee.impala.mapper.decision.*;
|
|
|
+import com.gyee.impala.mapper.master.WindspeedforecastshorttermMapper;
|
|
|
+import com.gyee.impala.mapper.master.WindspeedforecastspshorttermMapper;
|
|
|
+import com.gyee.impala.model.decision.*;
|
|
|
+import com.gyee.impala.model.master.Windspeedforecastshortterm;
|
|
|
+import com.gyee.impala.model.master.Windspeedforecastspshortterm;
|
|
|
+import com.gyee.impala.service.master.IWindspeedforecastshorttermService;
|
|
|
+import com.gyee.impala.service.master.IWindspeedforecastspshorttermService;
|
|
|
+import lombok.SneakyThrows;
|
|
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 预测风速训练样本库
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class TaskWindspeedForecast {
|
|
|
+ @Resource
|
|
|
+ private NoscaleCwDaPfPeriodDataMapper noscaleCwDaPfPeriodDataMapper;
|
|
|
+ @Resource
|
|
|
+ private NoscalePrDaPfPeriodDataMapper noscalePrDaPfPeriodDataMapper;
|
|
|
+ @Resource
|
|
|
+ private NoscaleWfDaPfPeriodDataMapper noscaleWfDaPfPeriodDataMapper;
|
|
|
+ @Resource
|
|
|
+ private NoscaleWtgDaPfPeriodDataMapper noscaleWtgDaPfPeriodDataMapper;
|
|
|
+ @Resource
|
|
|
+ private ProjectUspTsPeriodDataMapper projectUspTsPeriodDataMapper;
|
|
|
+ @Resource
|
|
|
+ private WfProjectStatPeriodDataMapper wfProjectStatPeriodDataMapper;
|
|
|
+ @Resource
|
|
|
+ private WfStatPeriodDataMapper wfStatPeriodDataMapper;
|
|
|
+ @Resource
|
|
|
+ private WfUspTsPeriodDataMapper wfUspTsPeriodDataMapper;
|
|
|
+ @Resource
|
|
|
+ private WfYcHistoryData1Mapper wfYcHistoryData1Mapper;
|
|
|
+ @Resource
|
|
|
+ private WfNwpDataMapper wfNwpDataMapper;
|
|
|
+ @Resource
|
|
|
+ private MvMapper mvMapper;
|
|
|
+ @Resource
|
|
|
+ private DecisionConvert decisionConvert;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IWindspeedforecastshorttermService windspeedforecastshorttermService;
|
|
|
+ @Resource
|
|
|
+ private IWindspeedforecastspshorttermService windspeedforecastspshorttermService;
|
|
|
+
|
|
|
+ //线路预测功率-短期
|
|
|
+ private List<NoscaleCwDaPfPeriodData> noscaleCwDaPfPeriodDatas;
|
|
|
+ //期次预测功率-短期
|
|
|
+ private List<NoscalePrDaPfPeriodData> noscalePrDaPfPeriodDatas;
|
|
|
+ //场站预测功率-短期
|
|
|
+ private List<NoscaleWfDaPfPeriodData> noscaleWfDaPfPeriodDatas;
|
|
|
+ //风机预测功率-短期
|
|
|
+ private List<NoscaleWtgDaPfPeriodData> noscaleWtgDaPfPeriodDatas;
|
|
|
+ //期次预测功率-超短期
|
|
|
+ private List<ProjectUspTsPeriodData> projectUspTsPeriodDatas;
|
|
|
+ //实际风速-期次
|
|
|
+ private List<WfProjectStatPeriodData> wfProjectStatPeriodDatas;
|
|
|
+ //场站实际功率、风速
|
|
|
+ private List<WfStatPeriodData> wfStatPeriodDatas;
|
|
|
+ //场站预测功率-超短期
|
|
|
+ private List<WfUspTsPeriodData> wfUspTsPeriodDatas;
|
|
|
+ //实际功率-期次、线路、风机
|
|
|
+ private List<WfYcHistoryData1> wfYcHistoryData1s;
|
|
|
+ //预测风速
|
|
|
+ private List<WfNwpData> wfNwpDatas;
|
|
|
+
|
|
|
+ private List<Mv> mvs;
|
|
|
+
|
|
|
+ public List<Mv> getMvMap() {
|
|
|
+ QueryWrapper<Mv> wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.lt("WINDPLANT_NO", 6);
|
|
|
+ if (mvs == null) {
|
|
|
+ mvs = mvMapper.selectList(wrapper);
|
|
|
+ }
|
|
|
+ return mvs;
|
|
|
+ }
|
|
|
+
|
|
|
+ @SneakyThrows
|
|
|
+ @Scheduled(cron = "0 35 2 * * ?")
|
|
|
+ //短期
|
|
|
+ public void shortTerm() {
|
|
|
+ Calendar today = Calendar.getInstance();
|
|
|
+ getWfStatPeriodDatas(today);
|
|
|
+ getWfNwpDatas(today);
|
|
|
+ getNoscaleWfDaPfPeriodDatas(today);
|
|
|
+ //获取场站短期风速功率预测
|
|
|
+ List<Windspeedforecastshortterm> windspeedforecastshorttermList1 = getStationWindspeedandpowerForecast();
|
|
|
+ getWfYcHistoryData1s(today);
|
|
|
+ getWfProjectStatPeriodDatas(today);
|
|
|
+ getNoscalePrDaPfPeriodDatas(today);
|
|
|
+ //获取期次短期风速功率预测
|
|
|
+ List<Windspeedforecastshortterm> windspeedforecastshorttermList2 = getProjectWindspeedandpowerForecast();
|
|
|
+ getNoscaleCwDaPfPeriodDatas(today);
|
|
|
+ //获取集电线路短期风速功率预测
|
|
|
+ List<Windspeedforecastshortterm> windspeedforecastshorttermList3 = getLineWindspeedandpowerForecast();
|
|
|
+ getMvMap();
|
|
|
+ getNoscaleWtgDaPfPeriodDatas(today);
|
|
|
+ //获取风机短期风速功率预测
|
|
|
+ List<Windspeedforecastshortterm> windspeedforecastshorttermList4 = getWindturbineWindspeedandpowerForecast();
|
|
|
+ windspeedforecastshorttermList1.addAll(windspeedforecastshorttermList2);
|
|
|
+ windspeedforecastshorttermList1.addAll(windspeedforecastshorttermList3);
|
|
|
+ windspeedforecastshorttermList1.addAll(windspeedforecastshorttermList4);
|
|
|
+ windspeedforecastshorttermService.insertBatch(windspeedforecastshorttermList1);
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<Windspeedforecastshortterm> getStationWindspeedandpowerForecast() {
|
|
|
+ List<Windspeedforecastshortterm> wsfcsts = new ArrayList<>();
|
|
|
+ if(noscaleWfDaPfPeriodDatas.size()==0) return wsfcsts;
|
|
|
+ for (NoscaleWfDaPfPeriodData noscaleWfDaPfPeriodData : noscaleWfDaPfPeriodDatas) {
|
|
|
+ Windspeedforecastshortterm wsfcst = new Windspeedforecastshortterm();
|
|
|
+ wsfcst.setForecasttype("station");
|
|
|
+ wsfcst.setStationid(decisionConvert.getStationIdMap().get(noscaleWfDaPfPeriodData.getWindplantNo()));
|
|
|
+ wsfcst.setStationname(decisionConvert.getStationNameMap().get(noscaleWfDaPfPeriodData.getWindplantNo()));
|
|
|
+ wsfcst.setCalctime(noscaleWfDaPfPeriodData.getDataTime());
|
|
|
+ wsfcst.setForecastpower(noscaleWfDaPfPeriodData.getValue());
|
|
|
+ wsfcst.setAlgorithmmodel(decisionConvert.getModelNameMap().get(noscaleWfDaPfPeriodData.getModelNo()));
|
|
|
+ wsfcst.setWyfcid(noscaleWfDaPfPeriodData.getWindplantNo());
|
|
|
+ wsfcsts.add(wsfcst);
|
|
|
+ }
|
|
|
+ wsfcsts = wsfcsts.stream().map(wct -> {
|
|
|
+ wfStatPeriodDatas.stream().filter(wspd -> wct.getWyfcid()==wspd.getWindplantNo() &&
|
|
|
+ wct.getCalctime().compareTo(wspd.getDataTime()) == 0).forEach(wspd -> {
|
|
|
+ wct.setActualpower(wspd.getp0());
|
|
|
+ wct.setActualwindspeed(wspd.getAvgWindSpeed());
|
|
|
+ });
|
|
|
+ wfNwpDatas.stream().filter(wnd -> wct.getWyfcid()==wnd.getWindplantNo().shortValue() &&
|
|
|
+ wct.getCalctime().compareTo(wnd.getDataTime()) == 0).forEach(wnd -> {
|
|
|
+ wct.setForecastwindspeed(wnd.getWindSpeed());
|
|
|
+ });
|
|
|
+ return wct;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
+ return wsfcsts;
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<Windspeedforecastshortterm> getWindturbineWindspeedandpowerForecast() {
|
|
|
+ List<Windspeedforecastshortterm> wsfcsts = new ArrayList<>();
|
|
|
+ if(noscaleWtgDaPfPeriodDatas.size()==0) return wsfcsts;
|
|
|
+ List<Mv> mvs1 = mvs.stream().filter(mv -> mv.getMeasurementtypeNo() == 1).collect(Collectors.toList());
|
|
|
+ for (Mv mv : mvs1) {
|
|
|
+ Calendar day = Calendar.getInstance();
|
|
|
+ day.add(Calendar.DATE, -1);
|
|
|
+ day.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ day.set(Calendar.MINUTE, 0);
|
|
|
+ day.set(Calendar.SECOND, 0);
|
|
|
+ day.set(Calendar.MILLISECOND, 0);
|
|
|
+ for (Short j = 0; j < 96; j++) {
|
|
|
+ Windspeedforecastshortterm wsfcst = new Windspeedforecastshortterm();
|
|
|
+ wsfcst.setCalctime(day.getTime());
|
|
|
+ wsfcst.setForecasttype("windturbine");
|
|
|
+ Short wpNo = mv.getWindplantNo();
|
|
|
+ wsfcst.setWyfcid(wpNo);
|
|
|
+ wsfcst.setStationid(decisionConvert.getStationIdMap().get(wpNo));
|
|
|
+ wsfcst.setStationname(decisionConvert.getStationNameMap().get(wpNo));
|
|
|
+ Short wturNo = mv.getWturNo();
|
|
|
+ wsfcst.setWyfjid(wturNo);
|
|
|
+ wsfcst.setWindturbineid(decisionConvert.getWindturbineIdMap().get(wturNo));
|
|
|
+ wsfcst.setWindturbinename(decisionConvert.getWindturbineNameMap().get(wturNo));
|
|
|
+ wsfcst.setWyanalogno(mv.getMvNo());
|
|
|
+ wsfcsts.add(wsfcst);
|
|
|
+ day.add(Calendar.MINUTE, 15);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ wsfcsts = wsfcsts.stream().map(wct -> {
|
|
|
+ wfYcHistoryData1s.stream().filter(wyhd1 -> wct.getWyanalogno() == wyhd1.getAnalogNo() &&
|
|
|
+ wct.getCalctime().compareTo(wyhd1.getDataTime()) == 0).forEach(wyhd1 -> {
|
|
|
+ wct.setActualpower(wyhd1.getYcVal());
|
|
|
+ });
|
|
|
+ noscaleWtgDaPfPeriodDatas.stream().filter(nwdppd -> wct.getWyfjid() == nwdppd.getWtgNo() &&
|
|
|
+ wct.getCalctime().compareTo(nwdppd.getDataTime()) == 0).forEach(nwdppd -> {
|
|
|
+ wct.setWymodelno(nwdppd.getModelNo());
|
|
|
+ wct.setAlgorithmmodel(decisionConvert.getModelNameMap().get(nwdppd.getModelNo()));
|
|
|
+ wct.setForecastpower(nwdppd.getValue());
|
|
|
+ });
|
|
|
+ return wct;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ List<Mv> mvs9 = mvs.stream().filter(mv -> mv.getMeasurementtypeNo() == 9).collect(Collectors.toList());
|
|
|
+ wsfcsts = wsfcsts.stream().map(wct -> {
|
|
|
+ mvs9.stream().filter(mv9 -> wct.getWyfjid() == mv9.getWturNo()).forEach(mv9 -> {
|
|
|
+ wct.setWyanalogno(mv9.getMvNo());
|
|
|
+ });
|
|
|
+ return wct;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ wsfcsts = wsfcsts.stream().map(wct -> {
|
|
|
+ wfYcHistoryData1s.stream().filter(wyhd1 -> wct.getWyanalogno() == wyhd1.getAnalogNo() &&
|
|
|
+ wct.getCalctime().compareTo(wyhd1.getDataTime()) == 0).forEach(wyhd1 -> {
|
|
|
+ wct.setActualwindspeed(wyhd1.getYcVal());
|
|
|
+ });
|
|
|
+ return wct;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ return wsfcsts;
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<Windspeedforecastshortterm> getLineWindspeedandpowerForecast() {
|
|
|
+ List<Windspeedforecastshortterm> wsfcsts = new ArrayList<>();
|
|
|
+ if(noscaleCwDaPfPeriodDatas.size()==0) return wsfcsts;
|
|
|
+ for (Collectorwireproject collectorwireproject : decisionConvert.getCollectorwireprojects()) {
|
|
|
+ Calendar day = Calendar.getInstance();
|
|
|
+ day.add(Calendar.DATE, -1);
|
|
|
+ day.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ day.set(Calendar.MINUTE, 0);
|
|
|
+ day.set(Calendar.SECOND, 0);
|
|
|
+ day.set(Calendar.MILLISECOND, 0);
|
|
|
+ for (Short j = 0; j < 96; j++) {
|
|
|
+ Windspeedforecastshortterm wsfcst = new Windspeedforecastshortterm();
|
|
|
+ wsfcst.setCalctime(day.getTime());
|
|
|
+ wsfcst.setForecasttype("line");
|
|
|
+ Short wpNo = collectorwireproject.getWpNo();
|
|
|
+ wsfcst.setWyfcid(wpNo);
|
|
|
+ wsfcst.setStationid(decisionConvert.getStationIdMap().get(wpNo));
|
|
|
+ wsfcst.setStationname(decisionConvert.getStationNameMap().get(wpNo));
|
|
|
+ Short projectNo = collectorwireproject.getProjectNo();
|
|
|
+ wsfcst.setWyqcid(projectNo);
|
|
|
+ wsfcst.setProjectid(decisionConvert.getProjectIdMap().get(projectNo));
|
|
|
+ wsfcst.setProjectname(collectorwireproject.getWireName());
|
|
|
+ Short collectorwireNo = collectorwireproject.getCollectorwireNo();
|
|
|
+ wsfcst.setWyxlid(collectorwireNo);
|
|
|
+ wsfcst.setLineid(decisionConvert.getLineIdMap().get(projectNo));
|
|
|
+ wsfcst.setLinename(decisionConvert.getLineNameMap().get(projectNo));
|
|
|
+ wsfcst.setWyanalogno(collectorwireproject.getAnalogNo());
|
|
|
+ wsfcsts.add(wsfcst);
|
|
|
+ day.add(Calendar.MINUTE, 15);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ wsfcsts = wsfcsts.stream().map(wct -> {
|
|
|
+ wfYcHistoryData1s.stream().filter(wyhd1 -> wct.getWyanalogno() == wyhd1.getAnalogNo() &&
|
|
|
+ wct.getCalctime().compareTo(wyhd1.getDataTime()) == 0).forEach(wyhd1 -> {
|
|
|
+ wct.setActualpower(wyhd1.getYcVal());
|
|
|
+ });
|
|
|
+ wfProjectStatPeriodDatas.stream().filter(wpspd -> wct.getWyfcid() == wpspd.getWindplantNo() &&
|
|
|
+ wct.getWyqcid() == wpspd.getProjectNo() && wct.getCalctime().compareTo(wpspd.getDataTime()) == 0).forEach(wpspd -> {
|
|
|
+ wct.setActualwindspeed(wpspd.getAvgWindSpeed());
|
|
|
+ });
|
|
|
+ noscaleCwDaPfPeriodDatas.stream().filter(ncdppd -> wct.getWyxlid() == ncdppd.getWfPrCwireNo() &&
|
|
|
+ wct.getCalctime().compareTo(ncdppd.getDataTime()) == 0).forEach(ncdppd -> {
|
|
|
+ wct.setWymodelno(ncdppd.getModelNo());
|
|
|
+ wct.setAlgorithmmodel(decisionConvert.getModelNameMap().get(ncdppd.getModelNo()));
|
|
|
+ wct.setForecastpower(ncdppd.getValue());
|
|
|
+ });
|
|
|
+ return wct;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ return wsfcsts;
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<Windspeedforecastshortterm> getProjectWindspeedandpowerForecast() {
|
|
|
+ List<Windspeedforecastshortterm> wsfcsts = new ArrayList<>();
|
|
|
+ if(noscalePrDaPfPeriodDatas.size()==0) return wsfcsts;
|
|
|
+
|
|
|
+ for (Windplantproject windplantproject : decisionConvert.getWindplantprojects()) {
|
|
|
+ Calendar day = Calendar.getInstance();
|
|
|
+ day.add(Calendar.DATE, -1);
|
|
|
+ day.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ day.set(Calendar.MINUTE, 0);
|
|
|
+ day.set(Calendar.SECOND, 0);
|
|
|
+ day.set(Calendar.MILLISECOND, 0);
|
|
|
+
|
|
|
+ for (Short j = 0; j < 96; j++) {
|
|
|
+ Windspeedforecastshortterm wsfcst = new Windspeedforecastshortterm();
|
|
|
+ wsfcst.setCalctime(day.getTime());
|
|
|
+ wsfcst.setForecasttype("project");
|
|
|
+ Short wpNo = windplantproject.getWpNo();
|
|
|
+ wsfcst.setWyfcid(wpNo);
|
|
|
+ wsfcst.setStationid(decisionConvert.getStationIdMap().get(wpNo));
|
|
|
+ wsfcst.setStationname(decisionConvert.getStationNameMap().get(wpNo));
|
|
|
+ Short projectNo = windplantproject.getProjectNo();
|
|
|
+ wsfcst.setWyqcid(projectNo);
|
|
|
+ wsfcst.setProjectid(decisionConvert.getProjectIdMap().get(projectNo));
|
|
|
+ wsfcst.setProjectname(windplantproject.getProjectName());
|
|
|
+ wsfcst.setWyanalogno(windplantproject.getAnalogNo());
|
|
|
+ wsfcsts.add(wsfcst);
|
|
|
+ day.add(Calendar.MINUTE, 15);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ wsfcsts = wsfcsts.stream().map(wct -> {
|
|
|
+ wfYcHistoryData1s.stream().filter(wyhd1 -> wct.getWyanalogno() == wyhd1.getAnalogNo() &&
|
|
|
+ wct.getCalctime().compareTo(wyhd1.getDataTime()) == 0).forEach(wyhd1 -> {
|
|
|
+ wct.setActualpower(wyhd1.getYcVal());
|
|
|
+ });
|
|
|
+ wfProjectStatPeriodDatas.stream().filter(wpspd -> wct.getWyfcid() == wpspd.getWindplantNo() &&
|
|
|
+ wct.getWyqcid() == wpspd.getProjectNo() && wct.getCalctime().compareTo(wpspd.getDataTime()) == 0).forEach(wpspd -> {
|
|
|
+ wct.setActualwindspeed(wpspd.getAvgWindSpeed());
|
|
|
+ });
|
|
|
+ noscalePrDaPfPeriodDatas.stream().filter(npdppd -> wct.getWyqcid() == npdppd.getWfPrNo() &&
|
|
|
+ wct.getCalctime().compareTo(npdppd.getDataTime()) == 0).forEach(npdppd -> {
|
|
|
+ wct.setWymodelno(npdppd.getModelNo());
|
|
|
+ wct.setAlgorithmmodel(decisionConvert.getModelNameMap().get(npdppd.getModelNo()));
|
|
|
+ wct.setForecastpower(npdppd.getValue());
|
|
|
+ });
|
|
|
+ return wct;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ return wsfcsts;
|
|
|
+ }
|
|
|
+
|
|
|
+ @SneakyThrows
|
|
|
+ @Scheduled(cron = "0 55 2 * * ?")
|
|
|
+ //超短期
|
|
|
+ public void specialShortTerm() {
|
|
|
+
|
|
|
+ Calendar today = Calendar.getInstance();
|
|
|
+ //getWfStatPeriodDatas(today);
|
|
|
+ //getWfNwpDatas(today);
|
|
|
+ getWfUspTsPeriodDatas(today);
|
|
|
+ //获取场站超短期风速功率预测
|
|
|
+ List<Windspeedforecastspshortterm> windspeedforecastspshorttermList1 = getStationWindspeedandpowerForecastSp();
|
|
|
+ //getWfYcHistoryData1s(today);
|
|
|
+ //getWfProjectStatPeriodDatas(today);
|
|
|
+ //getNoscalePrDaPfPeriodDatas(today);
|
|
|
+ getProjectUspTsPeriodDatas(today);
|
|
|
+ //获取期次超短期风速功率预测
|
|
|
+ List<Windspeedforecastspshortterm> windspeedforecastspshorttermList2 = getProjectSpWindspeedandpowerForecastSp();
|
|
|
+ windspeedforecastspshorttermList1.addAll(windspeedforecastspshorttermList2);
|
|
|
+ windspeedforecastspshorttermService.insertBatch(windspeedforecastspshorttermList1);
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<Windspeedforecastspshortterm> getStationWindspeedandpowerForecastSp() {
|
|
|
+ List<Windspeedforecastspshortterm> wsfcsts = new ArrayList<>();
|
|
|
+ if(wfUspTsPeriodDatas.size()==0) return wsfcsts;
|
|
|
+ for (short i = 1; i < 6; i++) {
|
|
|
+ Calendar day = Calendar.getInstance();
|
|
|
+ day.add(Calendar.DATE, -1);
|
|
|
+ day.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ day.set(Calendar.MINUTE, 0);
|
|
|
+ day.set(Calendar.SECOND, 0);
|
|
|
+ day.set(Calendar.MILLISECOND, 0);
|
|
|
+
|
|
|
+ for (short j = 0; j < 96; j++) {
|
|
|
+ for (short k = 0; k < 24; k++) {
|
|
|
+ Windspeedforecastspshortterm wsfcst = new Windspeedforecastspshortterm();
|
|
|
+ wsfcst.setForecasttype("station");
|
|
|
+ wsfcst.setStationid(decisionConvert.getStationIdMap().get(i));
|
|
|
+ wsfcst.setStationname(decisionConvert.getStationNameMap().get(i));
|
|
|
+ wsfcst.setCalctime(day.getTime());
|
|
|
+ wsfcst.setForecasttime(k);
|
|
|
+ wsfcst.setWyfcid(i);
|
|
|
+ wsfcsts.add(wsfcst);
|
|
|
+ }
|
|
|
+ day.add(Calendar.MINUTE, 15);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ wsfcsts = wsfcsts.stream().map(wct -> {
|
|
|
+ wfStatPeriodDatas.stream().filter(wspd -> wct.getWyfcid()==wspd.getWindplantNo() &&
|
|
|
+ wct.getCalctime().compareTo(wspd.getDataTime()) == 0).forEach(wspd -> {
|
|
|
+ wct.setActualpower(wspd.getp0());
|
|
|
+ wct.setActualwindspeed(wspd.getAvgWindSpeed());
|
|
|
+ });
|
|
|
+ wfNwpDatas.stream().filter(wnd -> wct.getWyfcid()==wnd.getWindplantNo().shortValue() &&
|
|
|
+ wct.getCalctime().compareTo(wnd.getDataTime()) == 0).forEach(wnd -> {
|
|
|
+ wct.setForecastwindspeed(wnd.getWindSpeed());
|
|
|
+ });
|
|
|
+ wfUspTsPeriodDatas.stream().filter(wutpd -> wct.getWyfcid()==wutpd.getWindplantNo() &&
|
|
|
+ wct.getCalctime().compareTo(wutpd.getDataTime()) == 0 && wct.getForecasttime()==wutpd.getTimeScale()).forEach(wutpd -> {
|
|
|
+ wct.setForecastpower(wutpd.getModPower());
|
|
|
+ wct.setAlgorithmmodel(decisionConvert.getSpModelNameMap().get(wutpd.getModelNo()));
|
|
|
+ });
|
|
|
+ return wct;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
+ return wsfcsts;
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<Windspeedforecastspshortterm> getProjectSpWindspeedandpowerForecastSp() {
|
|
|
+ List<Windspeedforecastspshortterm> wsfcsts = new ArrayList<>();
|
|
|
+ if(projectUspTsPeriodDatas.size()==0) return wsfcsts;
|
|
|
+ for (Windplantproject windplantproject : decisionConvert.getWindplantprojects()) {
|
|
|
+ Calendar day = Calendar.getInstance();
|
|
|
+ day.add(Calendar.DATE, -1);
|
|
|
+ day.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ day.set(Calendar.MINUTE, 0);
|
|
|
+ day.set(Calendar.SECOND, 0);
|
|
|
+ day.set(Calendar.MILLISECOND, 0);
|
|
|
+ for (Short j = 0; j < 96; j++) {
|
|
|
+ for (short k = 0; k < 24; k++) {
|
|
|
+ Windspeedforecastspshortterm wsfcst = new Windspeedforecastspshortterm();
|
|
|
+ wsfcst.setCalctime(day.getTime());
|
|
|
+ wsfcst.setForecasttype("project");
|
|
|
+ Short wpNo = windplantproject.getWpNo();
|
|
|
+ wsfcst.setWyfcid(wpNo);
|
|
|
+ wsfcst.setStationid(decisionConvert.getStationIdMap().get(wpNo));
|
|
|
+ wsfcst.setStationname(decisionConvert.getStationNameMap().get(wpNo));
|
|
|
+ Short projectNo = windplantproject.getProjectNo();
|
|
|
+ wsfcst.setWyqcid(projectNo);
|
|
|
+ wsfcst.setProjectid(decisionConvert.getProjectIdMap().get(projectNo));
|
|
|
+ wsfcst.setProjectname(windplantproject.getProjectName());
|
|
|
+ wsfcst.setWyanalogno(windplantproject.getAnalogNo());
|
|
|
+ wsfcst.setForecasttime(k);
|
|
|
+ wsfcsts.add(wsfcst);
|
|
|
+ }
|
|
|
+ day.add(Calendar.MINUTE, 15);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ wsfcsts = wsfcsts.stream().map(wct -> {
|
|
|
+ wfYcHistoryData1s.stream().filter(wyhd1 -> wct.getWyanalogno() == wyhd1.getAnalogNo() &&
|
|
|
+ wct.getCalctime().compareTo(wyhd1.getDataTime()) == 0).forEach(wyhd1 -> {
|
|
|
+ wct.setActualpower(wyhd1.getYcVal());
|
|
|
+ });
|
|
|
+ wfProjectStatPeriodDatas.stream().filter(wpspd -> wct.getWyfcid() == wpspd.getWindplantNo() &&
|
|
|
+ wct.getWyqcid() == wpspd.getProjectNo() && wct.getCalctime().compareTo(wpspd.getDataTime()) == 0).forEach(wpspd -> {
|
|
|
+ wct.setActualwindspeed(wpspd.getAvgWindSpeed());
|
|
|
+ });
|
|
|
+ projectUspTsPeriodDatas.stream().filter(putpd -> wct.getWyqcid() == putpd.getProjectNo() &&
|
|
|
+ wct.getCalctime().compareTo(putpd.getDataTime()) == 0 && wct.getForecasttime()==putpd.getTimeScale()).forEach(putpd -> {
|
|
|
+ wct.setWymodelno(putpd.getModelNo());
|
|
|
+ wct.setAlgorithmmodel(decisionConvert.getSpModelNameMap().get(putpd.getModelNo()));
|
|
|
+ wct.setForecastpower(putpd.getModPower());
|
|
|
+ });
|
|
|
+ return wct;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ return wsfcsts;
|
|
|
+ }
|
|
|
+
|
|
|
+ private Date getStarttime(Calendar date) {
|
|
|
+ Calendar time = (Calendar) date.clone();
|
|
|
+ time.add(Calendar.DATE, -1);
|
|
|
+ time.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ time.set(Calendar.MINUTE, 0);
|
|
|
+ time.set(Calendar.SECOND, 0);
|
|
|
+ time.set(Calendar.MILLISECOND, 0);
|
|
|
+ return time.getTime();
|
|
|
+ }
|
|
|
+
|
|
|
+ private Date getEndtime(Calendar date) {
|
|
|
+ Calendar time = (Calendar) date.clone();
|
|
|
+ time.add(Calendar.DATE, -1);
|
|
|
+ time.set(Calendar.HOUR_OF_DAY, 23);
|
|
|
+ time.set(Calendar.MINUTE, 59);
|
|
|
+ time.set(Calendar.SECOND, 59);
|
|
|
+ return time.getTime();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 线路预测功率-短期
|
|
|
+ * @param time
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<NoscaleCwDaPfPeriodData> getNoscaleCwDaPfPeriodDatas(Calendar time) {
|
|
|
+ QueryWrapper<NoscaleCwDaPfPeriodData> wrapper = new QueryWrapper();
|
|
|
+ wrapper.between("DATA_TIME", getStarttime(time), getEndtime(time));
|
|
|
+ //.orderByAsc("DATA_TIME");
|
|
|
+ noscaleCwDaPfPeriodDatas = noscaleCwDaPfPeriodDataMapper.selectList(wrapper);
|
|
|
+ return noscaleCwDaPfPeriodDatas;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 期次预测功率-短期
|
|
|
+ * @param time
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<NoscalePrDaPfPeriodData> getNoscalePrDaPfPeriodDatas(Calendar time) {
|
|
|
+ QueryWrapper<NoscalePrDaPfPeriodData> wrapper = new QueryWrapper();
|
|
|
+ wrapper.between("DATA_TIME", getStarttime(time), getEndtime(time))
|
|
|
+ .lt("WF_PR_NO",6);
|
|
|
+ noscalePrDaPfPeriodDatas = noscalePrDaPfPeriodDataMapper.selectList(wrapper);
|
|
|
+ return noscalePrDaPfPeriodDatas;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 场站预测功率-短期
|
|
|
+ * @param time
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<NoscaleWfDaPfPeriodData> getNoscaleWfDaPfPeriodDatas(Calendar time) {
|
|
|
+ QueryWrapper<NoscaleWfDaPfPeriodData> wrapper = new QueryWrapper();
|
|
|
+ wrapper.between("DATA_TIME", getStarttime(time), getEndtime(time))
|
|
|
+ .lt("WINDPLANT_NO",6);
|
|
|
+ //.orderByAsc("WINDPLANT_NO","DATA_TIME","MODEL_NO");
|
|
|
+ noscaleWfDaPfPeriodDatas = noscaleWfDaPfPeriodDataMapper.selectList(wrapper);
|
|
|
+ return noscaleWfDaPfPeriodDatas;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 风机预测功率-短期
|
|
|
+ * @param time
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<NoscaleWtgDaPfPeriodData> getNoscaleWtgDaPfPeriodDatas(Calendar time) {
|
|
|
+ QueryWrapper<NoscaleWtgDaPfPeriodData> wrapper = new QueryWrapper();
|
|
|
+ wrapper.between("DATA_TIME", getStarttime(time), getEndtime(time));
|
|
|
+ noscaleWtgDaPfPeriodDatas = noscaleWtgDaPfPeriodDataMapper.selectList(wrapper);
|
|
|
+ return noscaleWtgDaPfPeriodDatas;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 期次预测功率-超短期
|
|
|
+ * @param time
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<ProjectUspTsPeriodData> getProjectUspTsPeriodDatas(Calendar time) {
|
|
|
+ QueryWrapper<ProjectUspTsPeriodData> wrapper = new QueryWrapper();
|
|
|
+ wrapper.between("DATA_TIME", getStarttime(time), getEndtime(time));
|
|
|
+ projectUspTsPeriodDatas = projectUspTsPeriodDataMapper.selectList(wrapper);
|
|
|
+ return projectUspTsPeriodDatas;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 实际风速-期次
|
|
|
+ * @param time
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<WfProjectStatPeriodData> getWfProjectStatPeriodDatas(Calendar time) {
|
|
|
+ QueryWrapper<WfProjectStatPeriodData> wrapper = new QueryWrapper();
|
|
|
+ wrapper.between("DATA_TIME", getStarttime(time), getEndtime(time));
|
|
|
+ //.orderByAsc("DATA_TIME","PROJECT_NO");
|
|
|
+ wfProjectStatPeriodDatas = wfProjectStatPeriodDataMapper.selectList(wrapper);
|
|
|
+ return wfProjectStatPeriodDatas;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 场站实际功率、风速
|
|
|
+ * @param time
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<WfStatPeriodData> getWfStatPeriodDatas(Calendar time) {
|
|
|
+ QueryWrapper<WfStatPeriodData> wrapper = new QueryWrapper();
|
|
|
+ wrapper.between("DATA_TIME", getStarttime(time), getEndtime(time))
|
|
|
+ .lt("WINDPLANT_NO",6);
|
|
|
+ wfStatPeriodDatas = wfStatPeriodDataMapper.selectList(wrapper);
|
|
|
+ return wfStatPeriodDatas;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 场站预测功率-超短期
|
|
|
+ * @param time
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<WfUspTsPeriodData> getWfUspTsPeriodDatas(Calendar time) {
|
|
|
+ QueryWrapper<WfUspTsPeriodData> wrapper = new QueryWrapper();
|
|
|
+ wrapper.between("DATA_TIME", getStarttime(time), getEndtime(time))
|
|
|
+ .lt("WINDPLANT_NO",6);
|
|
|
+ wfUspTsPeriodDatas = wfUspTsPeriodDataMapper.selectList(wrapper);
|
|
|
+ return wfUspTsPeriodDatas;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 实际功率-期次、线路、风机
|
|
|
+ * @param time
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<WfYcHistoryData1> getWfYcHistoryData1s(Calendar time) {
|
|
|
+ List<Integer> analogNo = decisionConvert.getWindplantprojects().stream().map(Windplantproject::getAnalogNo).collect(Collectors.toList());
|
|
|
+ List<Integer> collect = decisionConvert.getCollectorwireprojects().stream().map(Collectorwireproject::getAnalogNo).collect(Collectors.toList());
|
|
|
+ analogNo.addAll(collect);
|
|
|
+ QueryWrapper<WfYcHistoryData1> wrapper = new QueryWrapper();
|
|
|
+ wrapper.between("DATA_TIME", getStarttime(time), getEndtime(time))
|
|
|
+ .in(true,"ANALOG_NO",analogNo);
|
|
|
+ wfYcHistoryData1s = wfYcHistoryData1Mapper.selectList(wrapper);
|
|
|
+ return wfYcHistoryData1s;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 预测风速
|
|
|
+ * @param time
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<WfNwpData> getWfNwpDatas(Calendar time) {
|
|
|
+ wfNwpDatas = wfNwpDataMapper.getAllInDate((short) 6,getStarttime(time),getEndtime(time));
|
|
|
+ return wfNwpDatas;
|
|
|
+ }
|
|
|
+}
|