|
@@ -0,0 +1,208 @@
|
|
|
+package com.gyee.runeconomy.service.Forecast;
|
|
|
+
|
|
|
+import com.gyee.common.contant.ContantXk;
|
|
|
+import com.gyee.common.model.PointData;
|
|
|
+import com.gyee.common.util.DateUtils;
|
|
|
+import com.gyee.runeconomy.dto.ForecastVo;
|
|
|
+import com.gyee.runeconomy.init.CacheContext;
|
|
|
+import com.gyee.runeconomy.model.auto.ProBasicPowerstation;
|
|
|
+import com.gyee.runeconomy.model.auto.ProBasicPowerstationPoint;
|
|
|
+import com.gyee.runeconomy.service.auto.IProBasicPowerstationPointService;
|
|
|
+import com.gyee.runeconomy.util.StringUtils;
|
|
|
+import com.gyee.runeconomy.util.realtimesource.IEdosUtil;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
+@Service
|
|
|
+public class ForecastService {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IEdosUtil edosUtil;
|
|
|
+ @Resource
|
|
|
+ private IProBasicPowerstationPointService proBasicPowerstationPointService;
|
|
|
+
|
|
|
+ public List<ForecastVo> getcockpit(String wpId, String beginDate, String endDate) throws Exception {
|
|
|
+
|
|
|
+ Date starttime = DateUtils.parseDate(beginDate);
|
|
|
+ Date endtime = DateUtils.parseDate(endDate);
|
|
|
+
|
|
|
+ List<ProBasicPowerstation> wpls = CacheContext.wpls;
|
|
|
+
|
|
|
+ List<ForecastVo> vos = new ArrayList<ForecastVo>();
|
|
|
+
|
|
|
+
|
|
|
+// ForecastVo vo = new ForecastVo();
|
|
|
+// vo.setPjfs(0.0); //平均风速
|
|
|
+// vo.setSjgl(0.0); //实际功率
|
|
|
+// vo.setDqglyc(0.0); //短期功率预测
|
|
|
+// vo.setCdqglyc(0.0); //超短期功率预测
|
|
|
+// vo.setRnycgl(0.0); //日内预测功率
|
|
|
+// vo.setHours(i); //时间戳
|
|
|
+// vo.setName(wpId);
|
|
|
+// vos.add(vo);
|
|
|
+
|
|
|
+ ProBasicPowerstationPoint pjfs = null;
|
|
|
+ ProBasicPowerstationPoint fsyc = null;
|
|
|
+ ProBasicPowerstationPoint ycgl = null;
|
|
|
+ ProBasicPowerstationPoint sjgl = null;
|
|
|
+ ProBasicPowerstationPoint llgl = null;
|
|
|
+
|
|
|
+ for (ProBasicPowerstation wp : wpls) {
|
|
|
+ if (wpId.equals(wp.getId())) {
|
|
|
+
|
|
|
+
|
|
|
+ if (wpId.endsWith("FDC_STA")) {
|
|
|
+ pjfs = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.PJFS15);
|
|
|
+ fsyc = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.FSYC);
|
|
|
+ ycgl = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.ZYCGL);
|
|
|
+ sjgl = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.PJGL15);
|
|
|
+ llgl = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.SSZLLGL);
|
|
|
+ }
|
|
|
+ if (wpId.endsWith("GDC_STA")) {
|
|
|
+ pjfs = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.PJGZD15);
|
|
|
+ fsyc = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.GZYC);
|
|
|
+ ycgl = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.ZYCGL);
|
|
|
+ sjgl = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.PJGL15);
|
|
|
+ llgl = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.SSZLLGL);
|
|
|
+ }
|
|
|
+ List<PointData> pjfsls = edosUtil.getHistoryDatasSnap(pjfs, starttime.getTime() / 1000, endtime.getTime() / 1000, null, 900L);
|
|
|
+ List<PointData> fsycls = edosUtil.getHistoryDatasSnap(fsyc, starttime.getTime() / 1000, endtime.getTime() / 1000, null, 900L);
|
|
|
+ List<PointData> ycglls = edosUtil.getHistoryDatasSnap(ycgl, starttime.getTime() / 1000, endtime.getTime() / 1000, null, 900L);
|
|
|
+ List<PointData> sjglls = edosUtil.getHistoryDatasSnap(sjgl, starttime.getTime() / 1000, endtime.getTime() / 1000, null, 900L);
|
|
|
+ List<PointData> llglls = edosUtil.getHistoryDatasSnap(llgl, starttime.getTime() / 1000, endtime.getTime() / 1000, null, 900L);
|
|
|
+ double temp1 = 0;
|
|
|
+ double temp2 = 0;
|
|
|
+ double temp3 = 0;
|
|
|
+ double temp4 = 0;
|
|
|
+ double temp5 = 0;
|
|
|
+ for (int i = 0; i < pjfsls.size(); i++) {
|
|
|
+
|
|
|
+ ForecastVo vo = new ForecastVo();
|
|
|
+ vo.setPjfs(0.0); //平均风速
|
|
|
+ vo.setYcfs(0.0); //平均风速
|
|
|
+ vo.setSjgl(0.0); //实际功率
|
|
|
+ vo.setYcgl(0.0); //功率预测
|
|
|
+ vo.setLlgl(0.0); //超短期功率预测
|
|
|
+ vo.setHours(2023L); //时间戳
|
|
|
+ vo.setName(wpId);
|
|
|
+
|
|
|
+ temp1 = pjfsls.get(i).getPointValueInDouble();
|
|
|
+ vo.setPjfs(StringUtils.round(temp1, 2));
|
|
|
+
|
|
|
+ temp2 = fsycls.get(i).getPointValueInDouble();
|
|
|
+ vo.setYcfs(StringUtils.round(temp2, 2));
|
|
|
+
|
|
|
+ temp3 = ycglls.get(i).getPointValueInDouble();
|
|
|
+ vo.setYcgl(StringUtils.round(temp3, 2));
|
|
|
+
|
|
|
+ temp4 = sjglls.get(i).getPointValueInDouble();
|
|
|
+ vo.setSjgl(StringUtils.round(temp4, 2));
|
|
|
+
|
|
|
+ temp5 = llglls.get(i).getPointValueInDouble();
|
|
|
+ vo.setLlgl(StringUtils.round(temp5, 2));
|
|
|
+
|
|
|
+ vo.setHours(pjfsls.get(i).getPointTime());
|
|
|
+
|
|
|
+ vo.setName(wp.getAname());
|
|
|
+ vo.setId(wpId);
|
|
|
+
|
|
|
+ vos.add(vo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return vos;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public Map<String, Object> getcockpittype(String beginDate, String endDate, String type) throws Exception {
|
|
|
+
|
|
|
+ Date starttime = DateUtils.parseDate(beginDate);
|
|
|
+ Date endtime = DateUtils.parseDate(endDate);
|
|
|
+ Map<String, Object> map = new LinkedHashMap<>();
|
|
|
+
|
|
|
+ Map<String, Object> map1 = new LinkedHashMap<>();
|
|
|
+
|
|
|
+
|
|
|
+ ProBasicPowerstationPoint pjfs = null;
|
|
|
+ ProBasicPowerstationPoint fsyc = null;
|
|
|
+ ProBasicPowerstationPoint ycgl = null;
|
|
|
+ ProBasicPowerstationPoint sjgl = null;
|
|
|
+ ProBasicPowerstationPoint llgl = null;
|
|
|
+
|
|
|
+
|
|
|
+ List<ProBasicPowerstation> wpls = CacheContext.wpls;
|
|
|
+
|
|
|
+ String wpId = null;
|
|
|
+
|
|
|
+ for (ProBasicPowerstation wp : wpls) {
|
|
|
+ if (wp.getId().contains("MLJ")) continue;
|
|
|
+ wpId = wp.getId();
|
|
|
+ List<ForecastVo> vos = new ArrayList<ForecastVo>();
|
|
|
+
|
|
|
+ if (wpId.endsWith("FDC_STA") && type.equals("F")) {
|
|
|
+ pjfs = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.PJFS15);
|
|
|
+// fsyc = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.FSYC);
|
|
|
+ ycgl = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.ZYCGL);
|
|
|
+ sjgl = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.PJGL15);
|
|
|
+ llgl = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.SSZLLGL);
|
|
|
+ }
|
|
|
+ if (wpId.endsWith("GDC_STA") && type.equals("G")) {
|
|
|
+ pjfs = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.PJGZD15);
|
|
|
+ fsyc = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.GZYC);
|
|
|
+ ycgl = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.ZYCGL);
|
|
|
+ sjgl = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.PJGL15);
|
|
|
+ llgl = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.SSZLLGL);
|
|
|
+ }
|
|
|
+ List<PointData> pjfsls = edosUtil.getHistoryDatasSnap(pjfs, starttime.getTime() / 1000, endtime.getTime() / 1000, null, 900L);
|
|
|
+// List<PointData> fsycls = edosUtil.getHistoryDatasSnap(fsyc, starttime.getTime() / 1000, endtime.getTime() / 1000, null, 900L);
|
|
|
+ List<PointData> ycglls = edosUtil.getHistoryDatasSnap(ycgl, starttime.getTime() / 1000, endtime.getTime() / 1000, null, 900L);
|
|
|
+ List<PointData> sjglls = edosUtil.getHistoryDatasSnap(sjgl, starttime.getTime() / 1000, endtime.getTime() / 1000, null, 900L);
|
|
|
+ List<PointData> llglls = edosUtil.getHistoryDatasSnap(llgl, starttime.getTime() / 1000, endtime.getTime() / 1000, null, 900L);
|
|
|
+ double temp1 = 0;
|
|
|
+ double temp2 = 0;
|
|
|
+ double temp3 = 0;
|
|
|
+ double temp4 = 0;
|
|
|
+ double temp5 = 0;
|
|
|
+ for (int i = 0; i < pjfsls.size(); i++) {
|
|
|
+
|
|
|
+ ForecastVo vo = new ForecastVo();
|
|
|
+ vo.setPjfs(0.0); //平均风速
|
|
|
+ vo.setYcfs(0.0); //平均风速
|
|
|
+ vo.setSjgl(0.0); //实际功率
|
|
|
+ vo.setYcgl(0.0); //功率预测
|
|
|
+ vo.setLlgl(0.0); //超短期功率预测
|
|
|
+ vo.setHours(2023L); //时间戳
|
|
|
+ vo.setName("wpId");
|
|
|
+ vo.setId(wpId);
|
|
|
+
|
|
|
+ temp1 = pjfsls.get(i).getPointValueInDouble();
|
|
|
+ vo.setPjfs(StringUtils.round(temp1, 2));
|
|
|
+
|
|
|
+// temp2 = fsycls.get(i).getPointValueInDouble();
|
|
|
+// vo.setYcfs(StringUtils.round(temp2, 2));
|
|
|
+
|
|
|
+ temp3 = ycglls.get(i).getPointValueInDouble();
|
|
|
+ vo.setYcgl(StringUtils.round(temp3, 2));
|
|
|
+
|
|
|
+ temp4 = sjglls.get(i).getPointValueInDouble();
|
|
|
+ vo.setSjgl(StringUtils.round(temp4, 2));
|
|
|
+
|
|
|
+ temp5 = llglls.get(i).getPointValueInDouble();
|
|
|
+ vo.setLlgl(StringUtils.round(temp5, 2));
|
|
|
+
|
|
|
+ vo.setHours(pjfsls.get(i).getPointTime());
|
|
|
+
|
|
|
+ vo.setName(wp.getAname());
|
|
|
+
|
|
|
+ vo.setId(wp.getNemCode());
|
|
|
+ vos.add(vo);
|
|
|
+ }
|
|
|
+ map.put(wp.getId(), vos);
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|