ソースを参照

实时指标计算

xieshengjie 2 年 前
コミット
278d68f8eb
13 ファイル変更670 行追加61 行削除
  1. 36 0
      common/src/main/java/com/gyee/common/util/algorithm/Underdelivery.java
  2. 10 10
      realtime/generationXK-service/src/main/java/com/gyee/generation/config/GeneratorCodeConfig.java
  3. 20 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/controller/ProBasicModelPowerRdController.java
  4. 15 33
      realtime/generationXK-service/src/main/java/com/gyee/generation/init/CacheContext.java
  5. 16 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProBasicModelPowerRdMapper.java
  6. 35 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProBasicModelPowerRd.java
  7. 0 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/PowerCurveFittingService.java
  8. 16 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/IProBasicModelPowerRdService.java
  9. 20 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/impl/ProBasicModelPowerRdServiceImpl.java
  10. 17 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/initalcache/CacheService.java
  11. 4 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/realtimelibrary/ElectricityMeteringService.java
  12. 393 16
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/realtimelibrary/RealtimeService.java
  13. 88 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/realtimelibrary/TheoreticalPowerService.java

+ 36 - 0
common/src/main/java/com/gyee/common/util/algorithm/Underdelivery.java

@@ -0,0 +1,36 @@
+package com.gyee.common.util.algorithm;
+
+/*
+@author   谢生杰
+@date   2022/11/6-15:40
+欠发算法
+*/
+
+public class Underdelivery {
+
+    /**
+     *
+     * @param pp
+     * @param zs
+     * @return
+     */
+    public static double underdeliveryStatusReal(double pp,double zs){
+        double ratioll = 0;
+        double qfzt = 0;
+        if (zs != 0){
+            ratioll = (zs-pp)/zs;
+        }
+        if (ratioll<0.05){
+            qfzt = 0;
+        }else if (ratioll >= 0.05 && ratioll < 0.1){
+            qfzt = 1;
+        }else if (ratioll >= 0.1 && ratioll < 0.2){
+            qfzt = 2;
+        }else if (ratioll >= 0.2 && ratioll < 0.4) {
+            qfzt = 3;
+        }else {
+            qfzt = 4;
+        }
+        return qfzt;
+    }
+}

+ 10 - 10
realtime/generationXK-service/src/main/java/com/gyee/generation/config/GeneratorCodeConfig.java

@@ -48,24 +48,24 @@ public class GeneratorCodeConfig {
 
         // 数据源配置
         DataSourceConfig dsc = new DataSourceConfig();
-        /*dsc.setUrl("jdbc:mysql://127.0.0.1:3306/test?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true");
+        dsc.setUrl("jdbc:mysql://127.0.0.1:3306/test?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true");
         dsc.setDriverName("com.mysql.jdbc.Driver");
         dsc.setUsername("root");
         dsc.setPassword("root");
-        mpg.setDataSource(dsc);*/
+        mpg.setDataSource(dsc);
 //        dsc.setDriverName("oracle.jdbc.driver.OracleDriver");
 //        dsc.setUsername("gdprod");
 //        dsc.setPassword("gd123");
 //        dsc.setUrl("jdbc:oracle:thin:@10.83.68.165:1521:gdsj");
 
-        dsc.setDriverName("org.postgresql.Driver");
-//        dsc.setUsername("postgres");
-//        dsc.setPassword("postgres");
-//        dsc.setUrl("jdbc:postgresql://192.168.11.248:5432/eng_mctl");
-        dsc.setUrl("jdbc:postgresql://120.46.148.180:5432/postgres");
-        dsc.setUsername("gdprod");
-        dsc.setPassword("gd123");
-        mpg.setDataSource(dsc);
+//        dsc.setDriverName("org.postgresql.Driver");
+////        dsc.setUsername("postgres");
+////        dsc.setPassword("postgres");
+////        dsc.setUrl("jdbc:postgresql://192.168.11.248:5432/eng_mctl");
+//        dsc.setUrl("jdbc:postgresql://120.46.148.180:5432/postgres");
+//        dsc.setUsername("gdprod");
+//        dsc.setPassword("gd123");
+//        mpg.setDataSource(dsc);
 
 
 

+ 20 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/controller/ProBasicModelPowerRdController.java

@@ -0,0 +1,20 @@
+package com.gyee.generation.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-11-06
+ */
+@RestController
+@RequestMapping("//pro-basic-model-power-rd")
+public class ProBasicModelPowerRdController {
+
+}

+ 15 - 33
realtime/generationXK-service/src/main/java/com/gyee/generation/init/CacheContext.java

@@ -6,6 +6,7 @@ import com.alibaba.fastjson.TypeReference;
 import com.gyee.common.model.StringUtils;
 import com.gyee.generation.model.auto.*;
 import com.gyee.generation.service.auto.*;
+import com.gyee.generation.service.realtimelibrary.TheoreticalPowerService;
 import com.gyee.generation.util.redis.RedisService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -53,6 +54,8 @@ public class CacheContext implements CommandLineRunner {
     private IProBasicCompanyService proBasicCompanyService;
     @Resource
     private IProBasicRegionService proBasicRegionService;
+    @Resource
+    private TheoreticalPowerService theoreticalPowerService;
 
     @Value("${runWindpowerstation}")
     private String runWindpowerstation;
@@ -104,9 +107,14 @@ public class CacheContext implements CommandLineRunner {
     public static List<ProBasicModelPower> mpls=new ArrayList<>();
 
     public static List<ProEconEquipmentmodel> equipmentmodels=new ArrayList<>();
+
+    public static Map<String, Map<Double,ProBasicModelPowerRd>> theoreticalPowerMap = new HashMap<>(); //理论,保证功率
+    public static Map<String, Map<Double,ProEconWtPowerCurveFitting>> curveFittingPowerMap = new HashMap<>(); //自算,最优功率
     @Override
     public void run(String... args) throws Exception {
         logger.info("缓存开始------------------------------------------------------------");
+
+
         List<String> runWpids = Arrays.asList(runWindpowerstation.split(","));
         logger.info(runWpids.get(0)+"------------------"+runWpids.size());
 
@@ -328,39 +336,13 @@ public class CacheContext implements CommandLineRunner {
             wppointmap.put(wp.getId(),stringMapMap);
         });
 
-//        String sszzt = redisService.get("SSZZT");
-//
-//
-//
-//        String zbzgl = redisService.get("ZBZGL");
-//        zbzglMap = JSONObject.parseObject(zbzgl, new TypeReference<Map<String,Map<Double,Double>>>() {
-//        });
-
-//        List<ProBasicWindturbinePower> windturbinepowerList = proBasicWindturbinePowerService.list().stream().filter(windturbinepower -> runWindpowerstation.contains(windturbinepower.getWindpowerstationId())).collect(Collectors.toList());
-//        windturbinepowerList.stream().forEach(w -> {
-//            if (zzsglMap.containsKey(w.getWindturbineId())){
-//                zzsglMap.get(w.getWindturbineId()).put(w.getSpeed(),w.getTheoryPower());
-//            }else {
-//                Map<Double,Double> tempMap = new HashMap<>();
-//                tempMap.put(w.getSpeed(),w.getTheoryPower());
-//                zzsglMap.put(w.getWindturbineId(),tempMap);
-//            }
-//
-//        });
-
-//        String wpString = redisService.get("PRODUCT-WP");
-//        wppointmap = JSONObject.parseObject(wpString, new TypeReference<Map<String, Map<String, ProBasicWppoint>>>() {
-//        });
-//        String pjString = redisService.get("PRODUCT-PJ");
-//        propointmap = JSONObject.parseObject(pjString, new TypeReference<Map<String, Map<String, ProBasicWppoint>>>() {
-//        });
-//        String lnString = redisService.get("PRODUCT-LN");
-//        linepointmap = JSONObject.parseObject(lnString, new TypeReference<Map<String, Map<String, ProBasicWppoint>>>() {
-//        });
-
-//        String wtString = redisService.get("PRODUCT-WT");
-//        wtpAimap = JSONObject.parseObject(wtString, new TypeReference<Map<String, Map<String, ProBasicEquipmentPoint>>>() {
-//        });
+
+        String llglString = redisService.get("ZLLGL");
+        theoreticalPowerMap = JSONObject.parseObject(llglString, new TypeReference<Map<String, Map<Double,ProBasicModelPowerRd>>>() {
+        });
+
+
+
         logger.info("缓存结束------------------------------------------------------------");
     }
 }

+ 16 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProBasicModelPowerRdMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.generation.mapper.auto;
+
+import com.gyee.generation.model.auto.ProBasicModelPowerRd;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-11-06
+ */
+public interface ProBasicModelPowerRdMapper extends BaseMapper<ProBasicModelPowerRd> {
+
+}

+ 35 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProBasicModelPowerRd.java

@@ -0,0 +1,35 @@
+package com.gyee.generation.model.auto;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-11-06
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ProBasicModelPowerRd extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    private String id;
+
+    private String modelId;
+
+    private Double speed;
+
+    private Double theoryPower;
+
+    private Double ensurePower;
+
+    private String windpowerstationId;
+
+
+}

+ 0 - 1
realtime/generationXK-service/src/main/java/com/gyee/generation/service/PowerCurveFittingService.java

@@ -14,7 +14,6 @@ import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.math.LineUtil;
 import com.gyee.generation.util.StringUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
-import org.jetbrains.annotations.NotNull;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Value;

+ 16 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/IProBasicModelPowerRdService.java

@@ -0,0 +1,16 @@
+package com.gyee.generation.service.auto;
+
+import com.gyee.generation.model.auto.ProBasicModelPowerRd;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-11-06
+ */
+public interface IProBasicModelPowerRdService extends IService<ProBasicModelPowerRd> {
+
+}

+ 20 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/impl/ProBasicModelPowerRdServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.generation.service.auto.impl;
+
+import com.gyee.generation.model.auto.ProBasicModelPowerRd;
+import com.gyee.generation.mapper.auto.ProBasicModelPowerRdMapper;
+import com.gyee.generation.service.auto.IProBasicModelPowerRdService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-11-06
+ */
+@Service
+public class ProBasicModelPowerRdServiceImpl extends ServiceImpl<ProBasicModelPowerRdMapper, ProBasicModelPowerRd> implements IProBasicModelPowerRdService {
+
+}

+ 17 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/service/initalcache/CacheService.java

@@ -14,6 +14,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -42,6 +43,8 @@ public class CacheService {
     private IProBasicCompanyService companyService;
     @Autowired
     private IProBasicRegionService regionsService;
+    @Resource
+    private IProBasicModelPowerRdService proBasicModelPowerRdService;
 
 
     public void initRedisCache(){
@@ -141,6 +144,20 @@ public class CacheService {
             String s = JSONObject.toJSONString(codeaimap);
             redisService.set(i,s);
         });
+        log.info("--------------------------redis理论保证功率");
+        Map<String, Map<Double,ProBasicModelPowerRd>> powerrdMap = new HashMap<>();
+
+        List<ProBasicModelPowerRd> proBasicModelPowerRds = proBasicModelPowerRdService.list();
+        proBasicModelPowerRds.stream().forEach(powerrd->{
+            if (powerrdMap.containsKey(powerrd.getModelId())){
+                powerrdMap.get(powerrd.getModelId()).put(powerrd.getSpeed(),powerrd);
+            }else {
+                Map<Double,ProBasicModelPowerRd> powerMap = new HashMap<>();
+                powerMap.put(powerrd.getSpeed(),powerrd);
+                powerrdMap.put(powerrd.getModelId(),powerMap);
+            }
+        });
+        redisService.set("ZLLGL", JSONObject.toJSONString(powerrdMap));
 
 //        log.info("--------------------------redis十三种状态");
 //        Map<String,List<Windturbinestatusdi>> sszztMap = new HashMap<>();

+ 4 - 1
realtime/generationXK-service/src/main/java/com/gyee/generation/service/realtimelibrary/ElectricityMeteringService.java

@@ -31,7 +31,10 @@ public class ElectricityMeteringService {
     @Resource
     private IEdosUtil edosUtil;
 
-
+    /**
+     * 存储电计量实时数据
+     * @throws Exception
+     */
     public void saveGenerationDatas() throws Exception {
 
         List<ProBasicLine> lnls = CacheContext.lnls;

+ 393 - 16
realtime/generationXK-service/src/main/java/com/gyee/generation/service/realtimelibrary/RealtimeService.java

@@ -4,53 +4,430 @@ package com.gyee.generation.service.realtimelibrary;
 @date   2022/11/4-17:09
 */
 
-import com.gyee.common.contant.Contant;
 import com.gyee.common.contant.ContantXk;
 import com.gyee.common.model.PointData;
 import com.gyee.common.util.DateUtils;
+import com.gyee.common.util.algorithm.Underdelivery;
 import com.gyee.generation.init.CacheContext;
-import com.gyee.generation.model.auto.ProBasicEquipmentPoint;
-import com.gyee.generation.model.auto.ProBasicWindturbine;
+import com.gyee.generation.model.auto.*;
 import com.gyee.generation.util.PointUtil;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
+import java.util.concurrent.atomic.AtomicReference;
 
 @Service
 public class RealtimeService {
     @Resource
     private IEdosUtil edosUtil;
 
+    /**
+     * 存储补风风速实时点,理论保证自算最优可用功率,
+     *
+     * @throws Exception
+     */
     public void savaRealtimeTarget() throws Exception {
-        List<PointData> resultList = new ArrayList<>();
+
         List<ProBasicWindturbine> wtls = CacheContext.wtls;
+        List<ProBasicLine> lnls = CacheContext.lnls;
+        List<ProBasicProject> pjls = CacheContext.pjls;
+        List<ProBasicWindpowerstation> wpls = CacheContext.wpls;
+        Map<String, List<ProBasicWindturbine>> lnwtmap = CacheContext.lnwtmap;
+        Map<String, List<ProBasicLine>> prolinemap = CacheContext.prolinemap;
+        Map<String, List<ProBasicProject>> wppromap = CacheContext.wppromap;
+        Map<String, Map<Double, ProBasicModelPowerRd>> theoreticalPowerMap = CacheContext.theoreticalPowerMap; //理论保证功率
+        Map<String, Map<Double, ProEconWtPowerCurveFitting>> curveFittingPowerMap = CacheContext.curveFittingPowerMap; //最优自算功率
         Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
-
+        Map<String, Map<String, ProBasicWppoint>> linepointmap = CacheContext.linepointmap;
+        Map<String, Map<String, ProBasicWppoint>> propointmap = CacheContext.propointmap;
+        Map<String, Map<String, ProBasicWppoint>> wppointmap = CacheContext.wppointmap;
         Date currentDate = DateUtils.getCurrentDate();
-        wtls.stream().forEach(wt->{
+        Date minute15begin = DateUtils.addMinutes(currentDate, -15);
+        //保存风机点
+        List<PointData> wtResultList = new ArrayList<>();
+        wtls.stream().forEach(wt -> {
             Map<String, ProBasicEquipmentPoint> equipmentPointMap = wtpAimap.get(wt.getId());
             ProBasicEquipmentPoint speedPoint = equipmentPointMap.get(ContantXk.CJ_SSFS);
             ProBasicEquipmentPoint mxztPoint = equipmentPointMap.get(ContantXk.MXZT);
             ProBasicEquipmentPoint ssbfPoint = equipmentPointMap.get(ContantXk.SSBF);
+            ProBasicEquipmentPoint ssglPoint = equipmentPointMap.get(ContantXk.CJ_SSGL);
+            //理论功率测点
+            ProBasicEquipmentPoint llglPoint = equipmentPointMap.get(ContantXk.LLGL);
+            //保证功率测点
+            ProBasicEquipmentPoint bzglPoint = equipmentPointMap.get(ContantXk.BZGL);
+            //自算功率测点
+            ProBasicEquipmentPoint zsglPoint = equipmentPointMap.get(ContantXk.ZSGL);
+            //最优功率测点
+            ProBasicEquipmentPoint zyglPoint = equipmentPointMap.get(ContantXk.ZYGL);
+            //可用功率测点
+            ProBasicEquipmentPoint kyglPoint = equipmentPointMap.get(ContantXk.KYGL);
+            //实时欠发状态
+            ProBasicEquipmentPoint ssqfztPoint = equipmentPointMap.get(ContantXk.SSQFZT);
+            //历史欠发状态
+            ProBasicEquipmentPoint lsqfztPoint = equipmentPointMap.get(ContantXk.LSQFZT);
             double mxzt = 0;
             double speed = 0;
+            double ssbf = 0;
+            double ssgl = 0;
+            Optional<PointData> ssglOptional = null;
+            Optional<PointData> zsglOptional = null;
             try {
-                mxzt = edosUtil.getSectionData(mxztPoint,currentDate.getTime()).getPointValueInDouble();
-                speed = edosUtil.getSectionData(speedPoint,currentDate.getTime()).getPointValueInDouble();
+                mxzt = edosUtil.getSectionData(mxztPoint, currentDate.getTime()).getPointValueInDouble();
+                speed = edosUtil.getSectionData(speedPoint, currentDate.getTime()).getPointValueInDouble();
+                ssgl = edosUtil.getSectionData(ssglPoint, currentDate.getTime()).getPointValueInDouble();
+                ssglOptional = edosUtil.getHistStat(ssglPoint, minute15begin.getTime() / 1000, currentDate.getTime() / 1000, 1l, 900l, 2).stream().findFirst();
+                zsglOptional = edosUtil.getHistStat(zsglPoint, minute15begin.getTime() / 1000, currentDate.getTime() / 1000, 1l, 900l, 2).stream().findFirst();
             } catch (Exception e) {
                 e.printStackTrace();
             }
-            if (mxzt == 12 || mxzt == 13){
+            PointData ssbfPointDate = null;
+            if (mxzt == 12 || mxzt == 13) {
+                //补风算法(后续补充,暂时用0)
+                ssbfPointDate = PointUtil.createPointData(currentDate, 0, ssbfPoint.getNemCode(), ssbfPoint.getName());
+            } else {
+                ssbf = speed;
+                ssbfPointDate = PointUtil.createPointData(currentDate, ssbf, ssbfPoint.getNemCode(), ssbfPoint.getName());
+            }
+            wtResultList.add(ssbfPointDate);
+            ProBasicModelPowerRd basicModelPowerRd = theoreticalPowerMap.get(wt.getModelId()).get(ssbf);
+            wtResultList.add(PointUtil.createPointData(currentDate, basicModelPowerRd.getTheoryPower(), llglPoint.getNemCode(), llglPoint.getName()));
+            wtResultList.add(PointUtil.createPointData(currentDate, basicModelPowerRd.getEnsurePower(), bzglPoint.getNemCode(), bzglPoint.getName()));
+            ProEconWtPowerCurveFitting wtPowerCurveFitting = curveFittingPowerMap.get(wt.getId()).get(ssbf);
+            Double actualPower = wtPowerCurveFitting.getActualPower();
+            double[] underissuanceArray = {0, 1, 2, 3, 8, 9, 11};
+            double qfzt = 0;
+            double lsqfzt = 0;
+            double ssgl15 = 0;
+            double zsgl15 = 0;
+            if (ssglOptional.isPresent()) {
+                ssgl15 = ssglOptional.get().getPointValueInDouble();
+                zsgl15 = zsglOptional.get().getPointValueInDouble();
+            }
+            if (Arrays.asList(underissuanceArray).contains(mxzt)) {
+                qfzt = Underdelivery.underdeliveryStatusReal(ssgl, actualPower);
+                lsqfzt = Underdelivery.underdeliveryStatusReal(ssgl15, zsgl15);
+            }
+            wtResultList.add(PointUtil.createPointData(currentDate, qfzt, ssqfztPoint.getNemCode(), ssqfztPoint.getName()));
+            wtResultList.add(PointUtil.createPointData(currentDate, lsqfzt, lsqfztPoint.getNemCode(), lsqfztPoint.getName()));
 
-            }else {
-                resultList.add(PointUtil.createPointData(currentDate,speed,ssbfPoint.getNemCode(),ssbfPoint.getName()));
+            wtResultList.add(PointUtil.createPointData(currentDate, wtPowerCurveFitting.getActualPower(), zsglPoint.getNemCode(), zsglPoint.getName()));
+            wtResultList.add(PointUtil.createPointData(currentDate, wtPowerCurveFitting.getOptimalPower(), zyglPoint.getNemCode(), zyglPoint.getName()));
+
+            if (mxzt == 4 || mxzt == 5 || mxzt == 6 || mxzt == 7) {
+                wtResultList.add(PointUtil.createPointData(currentDate, 0, kyglPoint.getNemCode(), kyglPoint.getName()));
+            } else {
+                wtResultList.add(PointUtil.createPointData(currentDate, wtPowerCurveFitting.getActualPower(), kyglPoint.getNemCode(), kyglPoint.getName()));
             }
         });
-        edosUtil.sendMultiPoint(resultList);
+        edosUtil.sendMultiPoint(wtResultList);
+        //保存线路点
+        List<PointData> lineResultList = new ArrayList<>();
+        lnls.stream().forEach(line -> {
+            List<ProBasicWindturbine> proBasicWindturbines = lnwtmap.get(line.getId());
+            Map<String, ProBasicWppoint> proBasicWppointMap = linepointmap.get(line.getId());
+            AtomicReference<Double> zssbf = new AtomicReference<>((double) 0);
+            AtomicReference<Double> zssgl = new AtomicReference<>((double) 0);
+            AtomicReference<Double> zllgl = new AtomicReference<>((double) 0);
+            AtomicReference<Double> zbzgl = new AtomicReference<>((double) 0);
+            AtomicReference<Double> zzsgl = new AtomicReference<>((double) 0);
+            AtomicReference<Double> zzygl = new AtomicReference<>((double) 0);
+            AtomicReference<Double> zkygl = new AtomicReference<>((double) 0);
+
+            ProBasicWppoint ssfsWpPoint = proBasicWppointMap.get(ContantXk.SSPJFS);
+            ProBasicWppoint ssglWpPoint = proBasicWppointMap.get(ContantXk.SSZGL);
+            ProBasicWppoint llglWpPoint = proBasicWppointMap.get(ContantXk.SSZLLGL);
+            ProBasicWppoint bzglWpPoint = proBasicWppointMap.get(ContantXk.SSZBZGL);
+            ProBasicWppoint zsglWpPoint = proBasicWppointMap.get(ContantXk.SSZNHGLZS);
+            ProBasicWppoint zyglWpPoint = proBasicWppointMap.get(ContantXk.SSZZYGL);
+            ProBasicWppoint kyglWpPoint = proBasicWppointMap.get(ContantXk.SSZKYGL);
+
+            proBasicWindturbines.stream().forEach(wt -> {
+                Map<String, ProBasicEquipmentPoint> equipmentPointMap = wtpAimap.get(wt.getId());
+                ProBasicEquipmentPoint ssbfPoint = equipmentPointMap.get(ContantXk.SSBF);
+                ProBasicEquipmentPoint ssglPoint = equipmentPointMap.get(ContantXk.CJ_SSGL);
+                //理论功率测点
+                ProBasicEquipmentPoint llglPoint = equipmentPointMap.get(ContantXk.LLGL);
+                //保证功率测点
+                ProBasicEquipmentPoint bzglPoint = equipmentPointMap.get(ContantXk.BZGL);
+                //自算功率测点
+                ProBasicEquipmentPoint zsglPoint = equipmentPointMap.get(ContantXk.ZSGL);
+                //最优功率测点
+                ProBasicEquipmentPoint zyglPoint = equipmentPointMap.get(ContantXk.ZYGL);
+                //可用功率测点
+                ProBasicEquipmentPoint kyglPoint = equipmentPointMap.get(ContantXk.KYGL);
+
+                zssbf.updateAndGet(v -> {
+                    try {
+                        return new Double((double) (v + edosUtil.getSectionData(ssbfPoint, currentDate.getTime()).getPointValueInDouble()));
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    return v;
+                });
+                zssgl.updateAndGet(v -> {
+                    try {
+                        return new Double((double) (v + edosUtil.getSectionData(ssglPoint, currentDate.getTime()).getPointValueInDouble()));
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    return v;
+                });
+                zllgl.updateAndGet(v -> {
+                    try {
+                        return new Double((double) (v + edosUtil.getSectionData(llglPoint, currentDate.getTime()).getPointValueInDouble()));
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    return v;
+                });
+                zbzgl.updateAndGet(v -> {
+                    try {
+                        return new Double((double) (v + edosUtil.getSectionData(bzglPoint, currentDate.getTime()).getPointValueInDouble()));
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    return v;
+                });
+                zzsgl.updateAndGet(v -> {
+                    try {
+                        return new Double((double) (v + edosUtil.getSectionData(zsglPoint, currentDate.getTime()).getPointValueInDouble()));
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    return v;
+                });
+                zzygl.updateAndGet(v -> {
+                    try {
+                        return new Double((double) (v + edosUtil.getSectionData(zyglPoint, currentDate.getTime()).getPointValueInDouble()));
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    return v;
+                });
+                zkygl.updateAndGet(v -> {
+                    try {
+                        return new Double((double) (v + edosUtil.getSectionData(kyglPoint, currentDate.getTime()).getPointValueInDouble()));
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    return v;
+                });
+            });
+            lineResultList.add(PointUtil.createPointData(currentDate, zssbf.get() / proBasicWindturbines.size(), ssfsWpPoint.getNemCode(), ssfsWpPoint.getName()));
+            lineResultList.add(PointUtil.createPointData(currentDate, zssgl.get(), ssglWpPoint.getNemCode(), ssglWpPoint.getName()));
+            lineResultList.add(PointUtil.createPointData(currentDate, zllgl.get(), llglWpPoint.getNemCode(), llglWpPoint.getName()));
+            lineResultList.add(PointUtil.createPointData(currentDate, zbzgl.get(), bzglWpPoint.getNemCode(), bzglWpPoint.getName()));
+            lineResultList.add(PointUtil.createPointData(currentDate, zzsgl.get(), zsglWpPoint.getNemCode(), zsglWpPoint.getName()));
+            lineResultList.add(PointUtil.createPointData(currentDate, zzygl.get(), zyglWpPoint.getNemCode(), zyglWpPoint.getName()));
+            lineResultList.add(PointUtil.createPointData(currentDate, zkygl.get(), kyglWpPoint.getNemCode(), kyglWpPoint.getName()));
+        });
+        edosUtil.sendMultiPoint(lineResultList);
+        //保存期次点
+        List<PointData> projectResultList = new ArrayList<>();
+        pjls.stream().forEach(project -> {
+            List<ProBasicLine> proBasicLines = prolinemap.get(project.getId());
+            Map<String, ProBasicWppoint> proBasicWppointMap = propointmap.get(project.getId());
+            AtomicReference<Double> zssbf = new AtomicReference<>((double) 0);
+            AtomicReference<Double> zssgl = new AtomicReference<>((double) 0);
+            AtomicReference<Double> zllgl = new AtomicReference<>((double) 0);
+            AtomicReference<Double> zbzgl = new AtomicReference<>((double) 0);
+            AtomicReference<Double> zzsgl = new AtomicReference<>((double) 0);
+            AtomicReference<Double> zzygl = new AtomicReference<>((double) 0);
+            AtomicReference<Double> zkygl = new AtomicReference<>((double) 0);
+
+            ProBasicWppoint ssfsWpPoint = proBasicWppointMap.get(ContantXk.SSPJFS);
+            ProBasicWppoint ssglWpPoint = proBasicWppointMap.get(ContantXk.SSZGL);
+            ProBasicWppoint llglWpPoint = proBasicWppointMap.get(ContantXk.SSZLLGL);
+            ProBasicWppoint bzglWpPoint = proBasicWppointMap.get(ContantXk.SSZBZGL);
+            ProBasicWppoint zsglWpPoint = proBasicWppointMap.get(ContantXk.SSZNHGLZS);
+            ProBasicWppoint zyglWpPoint = proBasicWppointMap.get(ContantXk.SSZZYGL);
+            ProBasicWppoint kyglWpPoint = proBasicWppointMap.get(ContantXk.SSZKYGL);
+
+            proBasicLines.stream().forEach(wp -> {
+                Map<String, ProBasicWppoint> basicWppointMap = linepointmap.get(wp.getId());
+                ProBasicWppoint ssbfPoint = basicWppointMap.get(ContantXk.SSPJFS);
+                ProBasicWppoint ssglPoint = basicWppointMap.get(ContantXk.SSZGL);
+                //理论功率测点
+                ProBasicWppoint llglPoint = basicWppointMap.get(ContantXk.SSZLLGL);
+                //保证功率测点
+                ProBasicWppoint bzglPoint = basicWppointMap.get(ContantXk.SSZBZGL);
+                //自算功率测点
+                ProBasicWppoint zsglPoint = basicWppointMap.get(ContantXk.SSZNHGLZS);
+                //最优功率测点
+                ProBasicWppoint zyglPoint = basicWppointMap.get(ContantXk.SSZZYGL);
+                //可用功率测点
+                ProBasicWppoint kyglPoint = basicWppointMap.get(ContantXk.SSZKYGL);
+
+                zssbf.updateAndGet(v -> {
+                    try {
+                        return new Double((double) (v + edosUtil.getSectionData(ssbfPoint, currentDate.getTime()).getPointValueInDouble()));
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    return v;
+                });
+                zssgl.updateAndGet(v -> {
+                    try {
+                        return new Double((double) (v + edosUtil.getSectionData(ssglPoint, currentDate.getTime()).getPointValueInDouble()));
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    return v;
+                });
+                zllgl.updateAndGet(v -> {
+                    try {
+                        return new Double((double) (v + edosUtil.getSectionData(llglPoint, currentDate.getTime()).getPointValueInDouble()));
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    return v;
+                });
+                zbzgl.updateAndGet(v -> {
+                    try {
+                        return new Double((double) (v + edosUtil.getSectionData(bzglPoint, currentDate.getTime()).getPointValueInDouble()));
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    return v;
+                });
+                zzsgl.updateAndGet(v -> {
+                    try {
+                        return new Double((double) (v + edosUtil.getSectionData(zsglPoint, currentDate.getTime()).getPointValueInDouble()));
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    return v;
+                });
+                zzygl.updateAndGet(v -> {
+                    try {
+                        return new Double((double) (v + edosUtil.getSectionData(zyglPoint, currentDate.getTime()).getPointValueInDouble()));
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    return v;
+                });
+                zkygl.updateAndGet(v -> {
+                    try {
+                        return new Double((double) (v + edosUtil.getSectionData(kyglPoint, currentDate.getTime()).getPointValueInDouble()));
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    return v;
+                });
+            });
+            projectResultList.add(PointUtil.createPointData(currentDate, zssbf.get() / proBasicLines.size(), ssfsWpPoint.getNemCode(), ssfsWpPoint.getName()));
+            projectResultList.add(PointUtil.createPointData(currentDate, zssgl.get(), ssglWpPoint.getNemCode(), ssglWpPoint.getName()));
+            projectResultList.add(PointUtil.createPointData(currentDate, zllgl.get(), llglWpPoint.getNemCode(), llglWpPoint.getName()));
+            projectResultList.add(PointUtil.createPointData(currentDate, zbzgl.get(), bzglWpPoint.getNemCode(), bzglWpPoint.getName()));
+            projectResultList.add(PointUtil.createPointData(currentDate, zzsgl.get(), zsglWpPoint.getNemCode(), zsglWpPoint.getName()));
+            projectResultList.add(PointUtil.createPointData(currentDate, zzygl.get(), zyglWpPoint.getNemCode(), zyglWpPoint.getName()));
+            projectResultList.add(PointUtil.createPointData(currentDate, zkygl.get(), kyglWpPoint.getNemCode(), kyglWpPoint.getName()));
+        });
+        edosUtil.sendMultiPoint(projectResultList);
+        //保存场站点
+        List<PointData> wpResultList = new ArrayList<>();
+        wpls.stream().forEach(wps -> {
+            List<ProBasicProject> proBasicProjects = wppromap.get(wps.getId());
+            Map<String, ProBasicWppoint> proBasicWppointMap = wppointmap.get(wps.getId());
+            AtomicReference<Double> zssbf = new AtomicReference<>((double) 0);
+            AtomicReference<Double> zssgl = new AtomicReference<>((double) 0);
+            AtomicReference<Double> zllgl = new AtomicReference<>((double) 0);
+            AtomicReference<Double> zbzgl = new AtomicReference<>((double) 0);
+            AtomicReference<Double> zzsgl = new AtomicReference<>((double) 0);
+            AtomicReference<Double> zzygl = new AtomicReference<>((double) 0);
+            AtomicReference<Double> zkygl = new AtomicReference<>((double) 0);
+
+            ProBasicWppoint ssfsWpPoint = proBasicWppointMap.get(ContantXk.SSPJFS);
+            ProBasicWppoint ssglWpPoint = proBasicWppointMap.get(ContantXk.SSZGL);
+            ProBasicWppoint llglWpPoint = proBasicWppointMap.get(ContantXk.SSZLLGL);
+            ProBasicWppoint bzglWpPoint = proBasicWppointMap.get(ContantXk.SSZBZGL);
+            ProBasicWppoint zsglWpPoint = proBasicWppointMap.get(ContantXk.SSZNHGLZS);
+            ProBasicWppoint zyglWpPoint = proBasicWppointMap.get(ContantXk.SSZZYGL);
+            ProBasicWppoint kyglWpPoint = proBasicWppointMap.get(ContantXk.SSZKYGL);
+
+            proBasicProjects.stream().forEach(wp -> {
+                Map<String, ProBasicWppoint> basicWppointMap = propointmap.get(wp.getId());
+                ProBasicWppoint ssbfPoint = basicWppointMap.get(ContantXk.SSPJFS);
+                ProBasicWppoint ssglPoint = basicWppointMap.get(ContantXk.SSZGL);
+                //理论功率测点
+                ProBasicWppoint llglPoint = basicWppointMap.get(ContantXk.SSZLLGL);
+                //保证功率测点
+                ProBasicWppoint bzglPoint = basicWppointMap.get(ContantXk.SSZBZGL);
+                //自算功率测点
+                ProBasicWppoint zsglPoint = basicWppointMap.get(ContantXk.SSZNHGLZS);
+                //最优功率测点
+                ProBasicWppoint zyglPoint = basicWppointMap.get(ContantXk.SSZZYGL);
+                //可用功率测点
+                ProBasicWppoint kyglPoint = basicWppointMap.get(ContantXk.SSZKYGL);
+
+                zssbf.updateAndGet(v -> {
+                    try {
+                        return new Double((double) (v + edosUtil.getSectionData(ssbfPoint, currentDate.getTime()).getPointValueInDouble()));
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    return v;
+                });
+                zssgl.updateAndGet(v -> {
+                    try {
+                        return new Double((double) (v + edosUtil.getSectionData(ssglPoint, currentDate.getTime()).getPointValueInDouble()));
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    return v;
+                });
+                zllgl.updateAndGet(v -> {
+                    try {
+                        return new Double((double) (v + edosUtil.getSectionData(llglPoint, currentDate.getTime()).getPointValueInDouble()));
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    return v;
+                });
+                zbzgl.updateAndGet(v -> {
+                    try {
+                        return new Double((double) (v + edosUtil.getSectionData(bzglPoint, currentDate.getTime()).getPointValueInDouble()));
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    return v;
+                });
+                zzsgl.updateAndGet(v -> {
+                    try {
+                        return new Double((double) (v + edosUtil.getSectionData(zsglPoint, currentDate.getTime()).getPointValueInDouble()));
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    return v;
+                });
+                zzygl.updateAndGet(v -> {
+                    try {
+                        return new Double((double) (v + edosUtil.getSectionData(zyglPoint, currentDate.getTime()).getPointValueInDouble()));
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    return v;
+                });
+                zkygl.updateAndGet(v -> {
+                    try {
+                        return new Double((double) (v + edosUtil.getSectionData(kyglPoint, currentDate.getTime()).getPointValueInDouble()));
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    return v;
+                });
+            });
+            wpResultList.add(PointUtil.createPointData(currentDate, zssbf.get() / proBasicProjects.size(), ssfsWpPoint.getNemCode(), ssfsWpPoint.getName()));
+            wpResultList.add(PointUtil.createPointData(currentDate, zssgl.get(), ssglWpPoint.getNemCode(), ssglWpPoint.getName()));
+            wpResultList.add(PointUtil.createPointData(currentDate, zllgl.get(), llglWpPoint.getNemCode(), llglWpPoint.getName()));
+            wpResultList.add(PointUtil.createPointData(currentDate, zbzgl.get(), bzglWpPoint.getNemCode(), bzglWpPoint.getName()));
+            wpResultList.add(PointUtil.createPointData(currentDate, zzsgl.get(), zsglWpPoint.getNemCode(), zsglWpPoint.getName()));
+            wpResultList.add(PointUtil.createPointData(currentDate, zzygl.get(), zyglWpPoint.getNemCode(), zyglWpPoint.getName()));
+            wpResultList.add(PointUtil.createPointData(currentDate, zkygl.get(), kyglWpPoint.getNemCode(), kyglWpPoint.getName()));
+        });
+        edosUtil.sendMultiPoint(wpResultList);
+
     }
 }

+ 88 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/service/realtimelibrary/TheoreticalPowerService.java

@@ -0,0 +1,88 @@
+package com.gyee.generation.service.realtimelibrary;/*
+@author   谢生杰
+@date   2022/11/6-12:07
+*/
+
+import com.alibaba.fastjson.JSONObject;
+import com.gyee.common.contant.ContantXk;
+import com.gyee.common.util.DateUtils;
+import com.gyee.generation.init.CacheContext;
+import com.gyee.generation.model.auto.ProBasicEquipmentPoint;
+import com.gyee.generation.model.auto.ProBasicModelPowerRd;
+import com.gyee.generation.model.auto.ProBasicWindturbine;
+import com.gyee.generation.model.auto.ProEconWtPowerCurveFitting;
+import com.gyee.generation.service.auto.IProBasicModelPowerRdService;
+import com.gyee.generation.service.auto.IProEconWtPowerCurveFittingService;
+import com.gyee.generation.util.realtimesource.IEdosUtil;
+import com.gyee.generation.util.redis.RedisService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class TheoreticalPowerService {
+
+    @Resource
+    private RedisService redisService;
+    @Resource
+    private IProBasicModelPowerRdService proBasicModelPowerRdService;
+    @Resource
+    private IProEconWtPowerCurveFittingService proEconWtPowerCurveFittingService;
+    @Resource
+    private IEdosUtil edosUtil;
+    /**
+     * 缓存自算功率,最优功率
+     * 1个月
+     */
+    public void updateCachePower(){
+        Map<String, Map<Double,ProEconWtPowerCurveFitting>> resultMap = new HashMap<>();
+
+        List<ProEconWtPowerCurveFitting> econWtPowerCurveFittings = proEconWtPowerCurveFittingService.list();
+        econWtPowerCurveFittings.stream().forEach(curveFitting->{
+            if (resultMap.containsKey(curveFitting.getWindturbineId())){
+                resultMap.get(curveFitting.getWindturbineId()).put(curveFitting.getSpeed(),curveFitting);
+            }else {
+                Map<Double,ProEconWtPowerCurveFitting> powerMap = new HashMap<>();
+                powerMap.put(curveFitting.getSpeed(),curveFitting);
+                resultMap.put(curveFitting.getWindturbineId(),powerMap);
+            }
+        });
+        CacheContext.curveFittingPowerMap = resultMap;
+    }
+
+    /**
+     * 实时存储理论,保证,自算,最优,可用
+     */
+    public void saveWtRealTheoreticalPower(){
+
+        Date currentDate = DateUtils.getCurrentDate();
+
+        List<ProBasicWindturbine> wtls = CacheContext.wtls;
+        Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
+        wtls.stream().forEach(wt->{
+            Map<String, ProBasicEquipmentPoint> basicEquipmentPointMap = wtpAimap.get(wt.getId());
+            //理论功率测点
+            ProBasicEquipmentPoint llglPoint = basicEquipmentPointMap.get(ContantXk.LLGL);
+            //保证功率测点
+            ProBasicEquipmentPoint bzglPoint = basicEquipmentPointMap.get(ContantXk.BZGL);
+            //自算功率测点
+            ProBasicEquipmentPoint zsglPoint = basicEquipmentPointMap.get(ContantXk.ZSGL);
+            //最优功率测点
+            ProBasicEquipmentPoint zyglPoint = basicEquipmentPointMap.get(ContantXk.ZYGL);
+            //可用功率测点
+            ProBasicEquipmentPoint kyglPoint = basicEquipmentPointMap.get(ContantXk.KYGL);
+
+
+
+
+
+
+
+        });
+
+    }
+}