Browse Source

逆变器分析9

xushili 1 year ago
parent
commit
ee8fc315b0

+ 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;
     }
 
     /**

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

@@ -142,7 +142,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) {

+ 11 - 10
power-fitting-JN/src/main/java/com.gyee.power.fitting/dispersionanalysis/PhotovoltaicAnalysisTask.java

@@ -5,7 +5,6 @@ import cn.hutool.core.date.DateRange;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
 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 +15,6 @@ 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.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
@@ -46,11 +44,7 @@ public class PhotovoltaicAnalysisTask {
     @Resource
     private InverterPowerAnalysis2 inverterPowerAnalysis;
     @Resource
-    private NewIvPvCurveFittingService curveFittingService;
-    @Resource
     private PhotovoltaicEfficiencyAnalysis2 photovoltaicEfficiencyAnalysis;
-    @Resource
-    private GyeeConfig gyeeConfig;
 
     //秒 分 时 日 月 周
     @Scheduled(cron = "0 22 1 * * ?")
@@ -137,27 +131,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);
 

+ 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 > 70) {
+            v = v / gyeeConfig.getGfzhxlxs().get(modelId);
+            if (v > 88) v = 90;
         }
+
         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 - 0
power-fitting-JN/src/main/resources/application.yaml

@@ -101,4 +101,26 @@ logging:
 #光伏三相电流电压计算功率的场站
 gf3xjscz: HZJ_GDC,AK_GDC
 
+#光伏转换效率系数
+gfzhxlxs:
+  SG500MX: 145
+  SUN2000-28KTL: 139 #未确认
+  SG630KTL: 357
+  EA500KM-M: 139 #未确认
+  AE-500-50-PV-X-HV: 101
+  SG50KTL-M: 934
+  SG500KTL: 139 #未确认
+  SG630MX: 92
+  SGI-500KTL: 101
+  SG1250UD: 114
+  SG60KTL-M: 189
+  PVS-800-57-100KW-A: 139 #未确认
+  SSL500: 139 #未确认
+  Sunny Central 500HE: 139 #未确认
+  SG630-MX: 139 #未确认
+  SG50KTL: 121
+  TS80KTL-PLUS: 297
+  SUN2000-125KTL-MO: 287
+  SG136TX: 140
+