Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/master'

全业务考评 1 anno fa
parent
commit
d858bca6ae

+ 18 - 5
power-fitting-JN/src/main/java/com.gyee.power.fitting/common/config/GyeeConfig.java

@@ -12,6 +12,7 @@ import org.springframework.stereotype.Component;
 
 import java.io.File;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 @Data
@@ -38,16 +39,28 @@ public class GyeeConfig {
     private String filePathFitting;
     /** 配置文件路径 **/
     private String filePathPower;
-    /** 数据压缩下载 **/
+    /**
+     * 数据压缩下载
+     **/
     private String filePathDownload;
-    /** 功率曲线拟合测点 **/
+    /**
+     * 功率曲线拟合测点
+     **/
     private String points;
-    /** 适配器读取数据等间隔时间 **/
+    /**
+     * 适配器读取数据等间隔时间
+     **/
     private Integer interval;
-    /** 数据是否离线执行 **/
+    /**
+     * 数据是否离线执行
+     **/
     private boolean offLine;
-    /** 是否实时计算 **/
+    /**
+     * 是否实时计算
+     **/
     private boolean realTimeCal;
+    //光伏转换效率系数
+    private Map<String, Double> gfzhxlxs;
 
     public List<String> getPoints() {
         return getUniformCodes();

+ 3 - 1
power-fitting-JN/src/main/java/com.gyee.power.fitting/dispersionanalysis/InverterAnalysis2.java

@@ -148,7 +148,9 @@ public class InverterAnalysis2 {
      */
     public double calcEquivalentOperatingHours(double power, double installedCapacity) {
         if (installedCapacity == 0) return 0;
-        return power / installedCapacity;
+        double v = power / installedCapacity;
+        if (v > 12) v = 12;
+        return v;
     }
 
     /**

+ 5 - 2
power-fitting-JN/src/main/java/com.gyee.power.fitting/dispersionanalysis/InverterPowerAnalysis2.java

@@ -1,5 +1,6 @@
 package com.gyee.power.fitting.dispersionanalysis;
 
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.collection.CollectionUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.gyee.power.fitting.common.alg.PolynomialCurveFitting;
@@ -119,7 +120,7 @@ public class InverterPowerAnalysis2 {
 
     // 计算功率离散率
     public double calcPowerDeviation(List<TsDoubleData> gzqd, List<TsDoubleData> yggl, double averagePower, long startTime, long endTime) {
-        if (CollectionUtil.isEmpty(gzqd) || CollectionUtil.isEmpty(yggl)) return 0;
+        if (CollUtil.isEmpty(gzqd) || CollUtil.isEmpty(yggl)) return 0;
         //List<TsDoubleData> S = dataCompletion(gzqd, startTime, endTime);
         //List<TsDoubleData> P = dataCompletion(yggl, startTime, endTime);
         WeightedObservedPoints points = new WeightedObservedPoints();
@@ -142,7 +143,9 @@ public class InverterPowerAnalysis2 {
             p = yggl.get(i).getDoubleValue();
             sum += Math.pow(p - pncf.calcPoly(s, run), 2);
         }
-        return Math.sqrt(sum / gzqd.size());
+        double sqrt = Math.sqrt(sum / gzqd.size());
+        if (sqrt > 80) sqrt = 80;
+        return sqrt;
     }
 
     private List<TsDoubleData> dataCompletion(List<TsDoubleData> gzqd, long startTime, long endTime) {

+ 19 - 13
power-fitting-JN/src/main/java/com.gyee.power.fitting/dispersionanalysis/PhotovoltaicAnalysisTask.java

@@ -1,11 +1,13 @@
 package com.gyee.power.fitting.dispersionanalysis;
 
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.date.DateField;
 import cn.hutool.core.date.DateRange;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.stream.CollectorUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.gyee.power.fitting.common.config.GyeeConfig;
 import com.gyee.power.fitting.common.feign.RemoteServiceBuilder;
 import com.gyee.power.fitting.model.PhotovoltaicAnalysis;
 import com.gyee.power.fitting.model.ProBasicEquipment;
@@ -16,7 +18,7 @@ import com.gyee.power.fitting.service.IPhotovoltaicAnalysisService;
 import com.gyee.power.fitting.service.ProBasicEquipmentPointService;
 import com.gyee.power.fitting.service.ProBasicEquipmentService;
 import com.gyee.power.fitting.service.ProEconEquipmentmodelService;
-import com.gyee.power.fitting.service.impl.NewIvPvCurveFittingService;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
@@ -46,14 +48,10 @@ public class PhotovoltaicAnalysisTask {
     @Resource
     private InverterPowerAnalysis2 inverterPowerAnalysis;
     @Resource
-    private NewIvPvCurveFittingService curveFittingService;
-    @Resource
     private PhotovoltaicEfficiencyAnalysis2 photovoltaicEfficiencyAnalysis;
-    @Resource
-    private GyeeConfig gyeeConfig;
 
     //秒 分 时 日 月 周
-    @Scheduled(cron = "0 22 1 * * ?")
+    @Scheduled(cron = "0 06 15 * * ?")
     public void doTask() {
         //获取逆变器
         QueryWrapper<ProBasicEquipment> eWrapper = new QueryWrapper<>();
@@ -137,27 +135,34 @@ public class PhotovoltaicAnalysisTask {
                     double dxfds = inverterAnalysis.calcEquivalentOperatingHours(rfdl, zjrl);
                     analysis.setEquivalentGeneratingTime(dxfds);
                     //有功功率
-                    String s = ygglPointMap.get(equipmentId);
                     List<TsDoubleData> ygglInfoList = remoteService.adaptergf().getHistorySnap(ygglPointMap.get(equipmentId), dateTime.getTime(), endTime.getTime(), 60);
                     //平均功率
                     double pjGl = ygglInfoList.stream().filter(i -> i.getDoubleValue() > 1).mapToDouble(TsDoubleData::getDoubleValue).average().orElse(0);
+                    /*月有功功率
+                    long y_time = DateUtil.beginOfMonth(dateTime.toJdkDate()).getTime();
+                    List<TsDoubleData> y_ygglInfoList = remoteService.adaptergf().getHistorySnap(ygglPointMap.get(equipmentId), y_time, endTime.getTime(), 5*60);
+                    double y_pjGl = y_ygglInfoList.stream().filter(i -> i.getDoubleValue() > 1).mapToDouble(TsDoubleData::getDoubleValue).average().orElse(0);*/
                     analysis.setAveragePower(pjGl);
 
                     //光照强度
-                    String s1 = gzqdPointMap.get(equipmentId);
                     List<TsDoubleData> gzqdInfoList = remoteService.adaptergf().getHistorySnap(gzqdPointMap.get(equipmentId), dateTime.getTime(), endTime.getTime(), 60);
                     double pjGzqd = gzqdInfoList.stream().filter(i -> i.getDoubleValue() > 1).mapToDouble(TsDoubleData::getDoubleValue).average().orElse(0);
+                    //月光照强度
+                    //List<TsDoubleData> y_gzqdInfoList = remoteService.adaptergf().getHistorySnap(gzqdPointMap.get(equipmentId), y_time, endTime.getTime(), 5*60);
 
                     //平均理论功率
-                    analysis.setAverageTheoryPower(pjGzqd);
+                    analysis.setAverageLightIntensity(pjGzqd);
                     //光伏转换效率
-                    double zhxl = photovoltaicEfficiencyAnalysis.calculatePhotovoltaicEfficiency(pjGl, pjGzqd, zjrl);
+                    double zhxl = photovoltaicEfficiencyAnalysis.calculatePhotovoltaicEfficiency(pjGl, pjGzqd, zjrl, modelId);
                     analysis.setConversionEfficiency(zhxl);
                     String zhxlZt = photovoltaicEfficiencyAnalysis.determinePhotovoltaicLevel(zhxl);
                     analysis.setConversionEfficiencyStatus(zhxlZt);
                     //离散率
                     double lsl = inverterPowerAnalysis.calcPowerDeviation(gzqdInfoList, ygglInfoList, pjGl, dateTime.getTime(), endTime.getTime());
+                    //月离散率
+                    //double y_lsl = inverterPowerAnalysis.calcPowerDeviation(y_gzqdInfoList, y_ygglInfoList, y_pjGl, y_time, endTime.getTime());
                     analysis.setScatter(lsl);
+                    //analysis.setMonthlyScatter(y_lsl);
                     String lslZt = inverterPowerAnalysis.analyzeInverterStatus(lsl, pjGl);
                     analysis.setScatterStatus(lslZt);
 
@@ -180,7 +185,7 @@ public class PhotovoltaicAnalysisTask {
             photovoltaicAnalysisService.saveBatch(photovoltaicAnalyses);
             //            CsvWriter writer = CsvUtil.getWriter(gyeeConfig.getGfDataPath() + "testWrite.csv", CharsetUtil.CHARSET_UTF_8);
             //            writer.write(photovoltaicAnalyses);
-            System.out.println("计算完成!");
+            System.out.println("计算完成!" + DateUtil.formatDate(dateTime));
         }
     }
 
@@ -195,6 +200,7 @@ public class PhotovoltaicAnalysisTask {
     }
 
     private double calcDowntimeByFailure(List<TsDoubleData> sbztInfoList) {
+        if (CollUtil.isEmpty(sbztInfoList)) return 0;
         sbztInfoList = sbztInfoList.stream().sorted(Comparator.comparing(TsDoubleData::getTs).reversed()).collect(Collectors.toList());
 
         long duration = 0;//故障或检修时间
@@ -215,7 +221,7 @@ public class PhotovoltaicAnalysisTask {
         //paList.setDataDate(DateUtil.parse("2023-10-14"));
         DateTime startTime;
         DateTime endTime = DateUtil.beginOfDay(DateUtil.yesterday());
-        if (paList == null || paList.getDataDate()==null) {
+        if (paList == null || paList.getDataDate() == null) {
             startTime = endTime;
         } else {
             startTime = DateUtil.offsetDay(paList.getDataDate(), 1);

+ 11 - 15
power-fitting-JN/src/main/java/com.gyee.power.fitting/dispersionanalysis/PhotovoltaicEfficiencyAnalysis2.java

@@ -1,6 +1,7 @@
 package com.gyee.power.fitting.dispersionanalysis;
 
 import com.alibaba.fastjson.JSONObject;
+import com.gyee.power.fitting.common.config.GyeeConfig;
 import com.gyee.power.fitting.common.result.JsonResult;
 import com.gyee.power.fitting.common.result.ResultCode;
 import com.gyee.power.fitting.model.custom.PhotovoltaicInfo;
@@ -14,7 +15,6 @@ import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
-import java.util.Random;
 
 //光伏转换效率分析
 @Slf4j
@@ -26,23 +26,19 @@ public class PhotovoltaicEfficiencyAnalysis2 {
 
     @Resource
     private IvPvCurveFittingService curveFittingService;
-
-    private Random random = new Random();
-    double min = 80;
-    double max = 90;
+    @Resource
+    private GyeeConfig gyeeConfig;
 
     // 计算光伏转换效率
-    public double calculatePhotovoltaicEfficiency(double power, double lightIntensity, double installedCapacity) {
+    public double calculatePhotovoltaicEfficiency(double power, double lightIntensity, double installedCapacity, String modelId) {
         if (lightIntensity == 0) return 0;
-        double v = (power * 100.0) / (lightIntensity * installedCapacity);
-        // 转换为百分比
-        if (v > 2000 && v < 3300) {
-            v = v / 3300;
-        } else if (v > 0.5 && v < 0.9) {
-            v = v * 100;
-        } else {
-            v = min + (max - min) * random.nextDouble();
+        double v = (power * 100000.0) / (lightIntensity * installedCapacity);
+
+        if (v > 30) {
+            v = v / gyeeConfig.getGfzhxlxs().get(modelId);
+            if (v > 85) v = 86;
         }
+
         return v;
     }
 
@@ -67,7 +63,7 @@ public class PhotovoltaicEfficiencyAnalysis2 {
             //double sPower = v.stream().mapToDouble(PhotovoltaicInfo::getS).sum();
             //log.info(k + "逆变器转换率2:" + actualOutputPower / sPower);
 
-            double efficiency = calculatePhotovoltaicEfficiency(actualOutputPower, incidentSolarPower, 100.0);
+            double efficiency = calculatePhotovoltaicEfficiency(actualOutputPower, incidentSolarPower, 100.0, "modelId");
             String currentLevel = determinePhotovoltaicLevel(efficiency);
             inverterData2s.add(new InverterData2(k, efficiency, actualOutputPower / v.size(), currentLevel, "转换效率"));
         });

+ 26 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/model/PhotovoltaicAnalysis.java

@@ -115,6 +115,16 @@ public class PhotovoltaicAnalysis implements Serializable {
      */
     private Double deviceAvailability;
 
+    /**
+     * 平均光照强度
+     */
+    private Double averageLightIntensity;
+
+    /**
+     * 月离散率
+     */
+    private Double monthlyScatter;
+
     public Integer getId() {
         return id;
     }
@@ -123,6 +133,22 @@ public class PhotovoltaicAnalysis implements Serializable {
         this.id = id;
     }
 
+    public Double getAverageLightIntensity() {
+        return averageLightIntensity;
+    }
+
+    public void setAverageLightIntensity(Double averageLightIntensity) {
+        this.averageLightIntensity = NumberUtil.round(averageLightIntensity, 2).doubleValue();
+    }
+
+    public Double getMonthlyScatter() {
+        return monthlyScatter;
+    }
+
+    public void setMonthlyScatter(Double monthlyScatter) {
+        this.monthlyScatter = NumberUtil.round(monthlyScatter, 2).doubleValue();
+    }
+
     public Double getConversionEfficiency() {
         return conversionEfficiency;
     }

+ 22 - 1
power-fitting-JN/src/main/resources/application.yaml

@@ -18,7 +18,27 @@ gyee:
   off-line: true
   # 是否实时计算五损数据   true:连接实时数据库按天计算   false:使用离线数据按月计算
   real-time-cal: false
-
+  #光伏转换效率系数
+  gfzhxlxs:
+    SG500MX: 1.45
+    SUN2000-28KTL: 1.39 #未确认
+    SG630KTL: 3.57
+    EA500KM-M: 1.39 #未确认
+    AE-500-50-PV-X-HV: 1.01
+    SG50KTL-M: 9.34
+    SG500KTL: 1.39 #未确认
+    SG630MX: 0.92
+    SGI-500KTL: 1.01
+    SG1250UD: 1.14
+    SG60KTL-M: 1.89
+    PVS-800-57-100KW-A: 1.39 #未确认
+    SSL500: 1.39 #未确认
+    Sunny Central 500HE: 1.39 #未确认
+    SG630-MX: 1.39 #未确认
+    SG50KTL: 1.21
+    TS80KTL-PLUS: 2.97
+    SUN2000-125KTL-MO: 2.87
+    SG136TX: 1.4
 
 server:
   port: 9002
@@ -116,3 +136,4 @@ logging:
 gf3xjscz: HZJ_GDC,AK_GDC
 
 
+