Browse Source

Merge remote-tracking branch 'origin/master'

wangb@gyee-china.com 1 year ago
parent
commit
e00dfaba8c

+ 6 - 0
benchmarking-impala/pom.xml

@@ -180,6 +180,12 @@
             <scope>compile</scope>
         </dependency>
 
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-core</artifactId>
+            <version>5.8.13</version>
+        </dependency>
+
     </dependencies>
 
     <build>

+ 5 - 0
power-fitting-JN/pom.xml

@@ -128,6 +128,11 @@
             <version>1.6.2</version>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-core</artifactId>
+            <version>5.8.16</version>
+        </dependency>
 
     </dependencies>
 

+ 3 - 4
power-fitting-JN/src/main/java/com.gyee.power.fitting/common/feign/IAdapterService.java

@@ -1,13 +1,12 @@
 package com.gyee.power.fitting.common.feign;
 
-import com.alibaba.fastjson.JSONObject;
 import com.gyee.power.fitting.model.custom.TsDoubleData;
 import feign.Headers;
 import feign.Param;
 import feign.RequestLine;
-import org.springframework.web.bind.annotation.GetMapping;
 
 import java.util.List;
+import java.util.Map;
 
 
 public interface IAdapterService {
@@ -15,7 +14,7 @@ public interface IAdapterService {
 
     @Headers({"Content-Type: application/json", "Accept: application/json"})
     @RequestLine("GET /ts/latest?keys={points}")
-    JSONObject getLatest(@Param(value = "points") String points);
+    TsDoubleData getLatest(@Param(value = "points") String points);
 
     @Headers({"Content-Type: application/json", "Accept: application/json"})
     @RequestLine("GET /ts/history/snap?tagName={tagName}&startTs={startTs}&endTs={endTs}&interval={interval}")
@@ -34,5 +33,5 @@ public interface IAdapterService {
 
     @Headers({"Content-Type: application/json", "Accept: application/json"})
     @RequestLine("GET /ts/history/section?tagNames={tagNames}&ts={ts}")
-    JSONObject getHistorySection(@Param(value = "tagNames") String tagNames, @Param(value = "ts") long ts);
+    Map<String, TsDoubleData> getHistorySection(@Param(value = "tagNames") String tagNames, @Param(value = "ts") long ts);
 }

+ 1 - 2
power-fitting-JN/src/main/java/com.gyee.power.fitting/controller/gf/NewPhotovoltaicController.java

@@ -14,7 +14,6 @@ import com.gyee.power.fitting.model.custom.TableTitle;
 import com.gyee.power.fitting.service.ProBasicEquipmentService;
 import com.gyee.power.fitting.service.impl.NewIvPvCurveFittingService;
 import com.gyee.power.fitting.service.impl.ScatterpointService;
-import io.swagger.annotations.ApiOperation;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
@@ -202,7 +201,7 @@ public class NewPhotovoltaicController {
     }
 
     @GetMapping(value = "/wtByWplist")
-    @ApiOperation(value = "风机列表", notes = "风机列表")
+    //@ApiOperation(value = "风机列表", notes = "风机列表")
     public R wtByWplist(@RequestParam(value = "wpids", required = true) String wpids) {
 
         List<ProBasicEquipment> resultList = curveFittingService.wtByWplist(wpids);

+ 99 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/dispersionanalysis/InverterAnalysis.java

@@ -0,0 +1,99 @@
+package com.gyee.power.fitting.dispersionanalysis;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class InverterAnalysis {
+    public static void main(String[] args) {
+        // 模拟全站逆变单元的发电数据,这里用一个Map来表示每个逆变单元的发电量
+        Map<String, Double> inverterData = new HashMap<>();
+        inverterData.put("Inverter1", 950.0);
+        inverterData.put("Inverter2", 980.0);
+        inverterData.put("Inverter3", 1020.0);
+        inverterData.put("Inverter4", 940.0);
+        inverterData.put("Inverter5", 990.0);
+
+        // 时间段,以小时为单位
+        double hours = 8760.0; // 假设一年的小时数
+
+        // 计算等效发电时的平均值
+        double average = calculateAverageEquivalentOperatingHours(inverterData, hours);
+
+        // 计算等效发电时的标准差
+        double stdDeviation = calculateStandardDeviationEquivalentOperatingHours(inverterData, hours, average);
+
+        // 存储极差逆变单元的列表
+        List<String> outlierInverters = new ArrayList<>();
+
+        // 进行等效发电时分析并找出极差逆变单元
+        for (Map.Entry<String, Double> entry : inverterData.entrySet()) {
+            String inverterName = entry.getKey();
+            double inverterPower = entry.getValue();
+
+            double equivalentOperatingHours = calculateEquivalentOperatingHours(inverterPower, hours);
+
+            // 判断逆变单元的运行水平并根据枚举值进行分类
+            OperatingLevel currentLevel = determineOperatingLevel(equivalentOperatingHours, average, stdDeviation);
+
+            // 如果运行水平是差或非常差,将逆变单元添加到极差逆变单元列表中
+            if (currentLevel == OperatingLevel.POOR || currentLevel == OperatingLevel.VERY_POOR) {
+                outlierInverters.add(inverterName);
+            }
+        }
+
+        // 将极差逆变单元推送给运维人员
+        if (!outlierInverters.isEmpty()) {
+            System.out.println("需要重点关注的极差逆变单元:");
+            for (String outlier : outlierInverters) {
+                System.out.println(outlier);
+            }
+        } else {
+            System.out.println("没有发现极差逆变单元。");
+        }
+    }
+
+    // 计算等效发电时的平均值
+    private static double calculateAverageEquivalentOperatingHours(Map<String, Double> data, double hours) {
+        double sum = 0.0;
+        for (double value : data.values()) {
+            sum += calculateEquivalentOperatingHours(value, hours);
+        }
+        return sum / data.size();
+    }
+
+    // 计算等效发电时的标准差
+    private static double calculateStandardDeviationEquivalentOperatingHours(Map<String, Double> data, double hours, double average) {
+        double sum = 0.0;
+        for (double value : data.values()) {
+            double equivalentOperatingHours = calculateEquivalentOperatingHours(value, hours);
+            sum += Math.pow(equivalentOperatingHours - average, 2);
+        }
+        double variance = sum / data.size();
+        return Math.sqrt(variance);
+    }
+
+    // 计算等效发电时
+    private static double calculateEquivalentOperatingHours(double power, double hours) {
+        return (power / 1000) * hours; // 假设power是千瓦
+    }
+
+    // 根据等效发电时、平均值和标准差确定运行水平
+    private static OperatingLevel determineOperatingLevel(double equivalentOperatingHours, double average, double stdDeviation) {
+        double deviation = equivalentOperatingHours - average;
+
+        // 使用标准差的倍数来判断运行水平
+        if (deviation > 2 * stdDeviation) {
+            return OperatingLevel.EXCELLENT;
+        } else if (deviation > stdDeviation) {
+            return OperatingLevel.GOOD;
+        } else if (deviation >= -stdDeviation && deviation <= stdDeviation) {
+            return OperatingLevel.AVERAGE;
+        } else if (deviation >= -2 * stdDeviation) {
+            return OperatingLevel.POOR;
+        } else {
+            return OperatingLevel.VERY_POOR;
+        }
+    }
+}

+ 148 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/dispersionanalysis/InverterAnalysis2.java

@@ -0,0 +1,148 @@
+package com.gyee.power.fitting.dispersionanalysis;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.power.fitting.common.feign.RemoteServiceBuilder;
+import com.gyee.power.fitting.common.result.JsonResult;
+import com.gyee.power.fitting.common.result.ResultCode;
+import com.gyee.power.fitting.model.ProBasicEquipment;
+import com.gyee.power.fitting.model.ProBasicEquipmentPoint;
+import com.gyee.power.fitting.model.ProEconEquipmentmodel;
+import com.gyee.power.fitting.model.custom.TsDoubleData;
+import com.gyee.power.fitting.service.ProBasicEquipmentPointService;
+import com.gyee.power.fitting.service.ProBasicEquipmentService;
+import com.gyee.power.fitting.service.ProEconEquipmentmodelService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+//等效发电时分析
+@CrossOrigin
+@RequestMapping("/equivalent")
+@RestController
+public class InverterAnalysis2 {
+
+    @Resource
+    private ProBasicEquipmentService proBasicEquipmentService;
+    @Resource
+    private ProEconEquipmentmodelService proEconEquipmentmodelService;
+    @Resource
+    private ProBasicEquipmentPointService proBasicEquipmentPointService;
+    @Resource
+    private RemoteServiceBuilder remoteService;
+
+    // 计算等效发电时的标准差
+    private static double calculateStandardDeviationEquivalentOperatingHours(Map<String, Double> data, double average) {
+        double sum = 0.0;
+        for (double value : data.values()) {
+            sum += Math.pow(value - average, 2);
+        }
+        return Math.sqrt(sum / data.size());
+    }
+
+    @GetMapping("/powertime")
+    private JSONObject getFileList(
+            @RequestParam(value = "station", required = true) String station,
+            @RequestParam(value = "inverters", required = false) List<String> inverters,
+            @RequestParam(value = "startdate", required = true) long startdate,
+            @RequestParam(value = "enddate", required = true) long enddate) {
+
+        //获取逆变器
+        QueryWrapper<ProBasicEquipment> eWrapper = new QueryWrapper<>();
+        eWrapper.eq("spare1", "IN").eq("windpowerstation_id", station);
+        List<ProBasicEquipment> eList = proBasicEquipmentService.list(eWrapper);
+        List<String> inverterIds = eList.stream().map(ProBasicEquipment::getId).collect(Collectors.toList());
+        //逆变器id,机型
+        Map<String, String> inverterModelMap = eList.stream().collect(Collectors.toMap(ProBasicEquipment::getId, ProBasicEquipment::getModelId));
+
+        //获取机型的装机容量
+        List<ProEconEquipmentmodel> emList = proEconEquipmentmodelService.list();
+        //机型、装机容量
+        Map<String, Double> emMap = emList.stream().collect(Collectors.toMap(ProEconEquipmentmodel::getNemCode, ProEconEquipmentmodel::getPowerProduction));
+
+        //获取年发电量
+        QueryWrapper<ProBasicEquipmentPoint> epWrapper = new QueryWrapper<>();
+        epWrapper.eq("uniform_code", "NFDL").eq("windpowerstation_id", station).like("windturbine_id", "_IN_");
+        List<ProBasicEquipmentPoint> epList = proBasicEquipmentPointService.list(epWrapper);
+        String points = epList.stream().map(ProBasicEquipmentPoint::getNemCode).collect(Collectors.joining(","));
+        //逆变器id,测点
+        Map<String, String> epMap = epList.stream().collect(Collectors.toMap(ProBasicEquipmentPoint::getWindturbineId, ProBasicEquipmentPoint::getNemCode));
+
+        //开始、结束时间的年发电量
+        Map<String, TsDoubleData> startSection = remoteService.adaptergf().getHistorySection(points, startdate);
+        Map<String, TsDoubleData> endSection = remoteService.adaptergf().getHistorySection(points, enddate);
+
+        // 模拟全站逆变单元的发电数据,这里用一个Map来表示每个逆变单元的发电量
+        Map<String, Double> dxfdsData = new HashMap<>();
+        double dxfdsSum = 0;//等效发电时之和
+        TsDoubleData endData, startData;
+        String ims, p;
+        double dxfds;
+        for (String s : inverterIds) {
+            p = epMap.get(s);
+            if (StringUtils.isEmpty(p)) continue;
+            endData = endSection.get(p);
+            startData = startSection.get(p);
+            ims = inverterModelMap.get(s);
+            if (endData == null || startData == null || ims == null) {
+                dxfds = 0;
+            } else {
+                dxfds = calculateEquivalentOperatingHours(endData.getDoubleValue() - startData.getDoubleValue(), emMap.get(ims));
+            }
+            dxfdsSum += dxfds;
+            dxfdsData.put(s, dxfds);
+        }
+
+        // 时间段,以小时为单位
+        //double hours = DateUtil.between(new Date(startdate),new Date(enddate), DateUnit.HOUR);
+
+        // 计算等效发电时的平均值
+        double average = dxfdsSum / inverterIds.size();
+
+        // 计算等效发电时的标准差
+        double stdDeviation = calculateStandardDeviationEquivalentOperatingHours(dxfdsData, average);
+
+        // 存储极差逆变单元的列表
+        List<String> outlierInverters = new ArrayList<>();
+
+        // 进行等效发电时分析并找出极差逆变单元
+        List<InverterData2> inverterData2s = new ArrayList<>();
+        dxfdsData.forEach((k, v) -> {
+            // 判断逆变单元的运行水平并根据枚举值进行分类
+            String currentLevel = determineOperatingLevel(v, average, stdDeviation);
+            inverterData2s.add(new InverterData2(k, v, average, currentLevel, "等效发电时"));
+        });
+
+        return JsonResult.successData(ResultCode.SUCCESS, inverterData2s);
+    }
+
+    // 计算等效发电时
+    private double calculateEquivalentOperatingHours(double power, double installedCapacity) {
+        if (installedCapacity == 0) return 0;
+        return power / installedCapacity;
+    }
+
+    // 根据等效发电时、平均值和标准差确定运行水平
+    private String determineOperatingLevel(double equivalentOperatingHours, double average, double stdDeviation) {
+        double deviation = equivalentOperatingHours - average;
+
+        // 使用标准差的倍数来判断运行水平
+        if (deviation > 2 * stdDeviation) {
+            return "优秀";
+        } else if (deviation > stdDeviation) {
+            return "良好";
+        } else if (deviation >= -stdDeviation && deviation <= stdDeviation) {
+            return "平均";
+        } else if (deviation >= -2 * stdDeviation) {
+            return "差";
+        } else {
+            return "非常差";
+        }
+    }
+}

+ 7 - 1
power-fitting-JN/src/main/java/com.gyee.power.fitting/dispersionanalysis/InverterData.java

@@ -5,11 +5,13 @@ class InverterData {
     private String inverterId;
     private long timestamp;
     private double outputPower;
+    private double lightIntensity;
 
-    public InverterData(String inverterId, long timestamp, double outputPower) {
+    public InverterData(String inverterId, long timestamp, double outputPower, double lightIntensity) {
         this.inverterId = inverterId;
         this.timestamp = timestamp;
         this.outputPower = outputPower;
+        this.lightIntensity = lightIntensity;
     }
 
     public String getInverterId() {
@@ -23,4 +25,8 @@ class InverterData {
     public double getOutputPower() {
         return outputPower;
     }
+
+    public double getLightIntensity() {
+        return lightIntensity;
+    }
 }

+ 38 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/dispersionanalysis/InverterData2.java

@@ -0,0 +1,38 @@
+package com.gyee.power.fitting.dispersionanalysis;
+
+// 逆变器数据类,包含逆变器ID、时间戳和输出功率
+class InverterData2 {
+    private String inverterId;
+    private double powerDeviation;//等效发电时、离散率、转换效率
+    private double averagePower;//平均功率
+    private String status;//状态
+    private String type;//等效发电时、离散率、转换效率
+
+    public InverterData2(String inverterId, double powerDeviation, double averagePower, String status, String type) {
+        this.inverterId = inverterId;
+        this.powerDeviation = powerDeviation;
+        this.averagePower = averagePower;
+        this.status = status;
+        this.type = type;
+    }
+
+    public String getInverterId() {
+        return inverterId;
+    }
+
+    public double getPowerDeviation() {
+        return powerDeviation;
+    }
+
+    public double getAveragePower() {
+        return averagePower;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public String getType() {
+        return type;
+    }
+}

+ 5 - 1
power-fitting-JN/src/main/java/com.gyee.power.fitting/dispersionanalysis/InverterPowerAnalysis.java

@@ -1,9 +1,12 @@
 package com.gyee.power.fitting.dispersionanalysis;
 
+import org.springframework.stereotype.Service;
+
 import java.io.FileWriter;
 import java.io.IOException;
 import java.util.*;
 
+@Service
 public class InverterPowerAnalysis {
 
     public static void main(String[] args) {
@@ -35,7 +38,8 @@ public class InverterPowerAnalysis {
             String inverterId = "Inverter" + i;
             long timestamp = System.currentTimeMillis();
             double outputPower = rand.nextDouble() * 1000;
-            data.add(new InverterData(inverterId, timestamp, outputPower));
+            double lightIntensity = rand.nextDouble() * 1000;
+            data.add(new InverterData(inverterId, timestamp, outputPower, lightIntensity));
         }
         return data;
     }

+ 155 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/dispersionanalysis/InverterPowerAnalysis2.java

@@ -0,0 +1,155 @@
+package com.gyee.power.fitting.dispersionanalysis;
+
+import com.alibaba.fastjson.JSONObject;
+import com.gyee.power.fitting.common.alg.PolynomialCurveFitting;
+import com.gyee.power.fitting.common.result.JsonResult;
+import com.gyee.power.fitting.common.result.ResultCode;
+import com.gyee.power.fitting.model.custom.PhotovoltaicInfo;
+import com.gyee.power.fitting.service.impl.IvPvCurveFittingService;
+import org.apache.commons.math3.fitting.WeightedObservedPoints;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.stream.Collectors;
+
+//逆变器单位装机输出功率离散率分析
+@CrossOrigin
+@RequestMapping("/discreteness")
+@RestController
+public class InverterPowerAnalysis2 {
+
+    @Resource
+    private IvPvCurveFittingService curveFittingService;
+    @Resource
+    private PolynomialCurveFitting pncf;
+
+    // 模拟生成逆变器数据
+    private static List<InverterData> generateInverterData() {
+        List<InverterData> data = new ArrayList<>();
+        Random rand = new Random();
+        for (int i = 1; i <= 10; i++) {
+            String inverterId = "Inverter" + i;
+            long timestamp = System.currentTimeMillis();
+            double outputPower = rand.nextDouble() * 1000;
+            double lightIntensity = rand.nextDouble() * 1000;
+            data.add(new InverterData(inverterId, timestamp, outputPower, lightIntensity));
+        }
+        return data;
+    }
+
+    // 计算平均功率
+    private static double calculateAveragePower(List<Double> powerData) {
+        double sum = 0.0;
+        for (Double power : powerData) {
+            sum += power;
+        }
+        return sum / powerData.size();
+    }
+
+    // 根据复杂规则分析逆变器状态
+    private static String analyzeInverterStatus(double powerDeviation, double averagePower) {
+        if (powerDeviation < 0.1 && averagePower > 800) {
+            return "运行稳定";
+        } else if (powerDeviation < 0.2 && averagePower > 600) {
+            return "运行良好";
+        } else if (powerDeviation < 0.3 && averagePower > 400) {
+            return "运行水平有待提高";
+        } else {
+            return "必须整改";
+        }
+    }
+
+    // 将数据存储到CSV文件
+    private static void saveDataToCSV(Map<String, List<Double>> historicalPowerData, String fileName) {
+        try {
+            FileWriter writer = new FileWriter(fileName);
+            writer.append("InverterId,PowerData\n");
+            for (Map.Entry<String, List<Double>> entry : historicalPowerData.entrySet()) {
+                String inverterId = entry.getKey();
+                List<Double> powerData = entry.getValue();
+                StringBuilder powerDataStr = new StringBuilder();
+                for (Double power : powerData) {
+                    powerDataStr.append(power).append(",");
+                }
+                writer.append(inverterId).append(",").append(powerDataStr.toString()).append("\n");
+            }
+            writer.flush();
+            writer.close();
+            System.out.println("数据已保存到 " + fileName);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    @GetMapping("/rate")
+    private JSONObject getFileList(
+            @RequestParam(value = "station", required = true) String station,
+            @RequestParam(value = "inverters", required = false) List<String> inverters,
+            @RequestParam(value = "startdate", required = true) long startdate,
+            @RequestParam(value = "interval", required = false) Integer interval,
+            @RequestParam(value = "enddate", required = true) long enddate) {
+
+        Map<String, List<PhotovoltaicInfo>> datasInfos = curveFittingService.getDatas2File1(station, startdate, enddate, interval);
+
+        /*List<PhotovoltaicInfo> infos = new ArrayList<>();
+        //单台拟合
+        if (inverters.size() == 1) {
+            infos = datasInfos.get(inverters.get(0));
+        //多台拟合
+        } else if (inverters.size() > 1) {
+            infos = inverters.stream().flatMap(inverter -> datasInfos.get(inverter).stream()).collect(Collectors.toList());
+        //全场拟合
+        } else {
+            infos = datasInfos.values().stream().flatMap(List::stream).collect(Collectors.toList());
+        }*/
+
+        List<InverterData2> inverterData2s = new ArrayList<>();
+        datasInfos.forEach((k, v) -> {
+
+            WeightedObservedPoints points = new WeightedObservedPoints();
+            for (PhotovoltaicInfo info : v) {
+                if (info.getS() < 1) {
+                    points.add(0, 0);
+                }
+                points.add(info.getS(), info.getActualP());
+            }
+
+            double[] run = pncf.run(points);
+
+            inverterData2s.add(analyzeInverterPerformance(v, run, k));
+        });
+
+        return JsonResult.successData(ResultCode.SUCCESS, inverterData2s);
+    }
+
+    // 分析逆变器性能,包括计算离散率和平均功率
+    private InverterData2 analyzeInverterPerformance(List<PhotovoltaicInfo> infos, double[] run, String inverterId) {
+
+        List<Double> collect = infos.stream().map(info -> info.getS()).collect(Collectors.toList());
+        // 计算功率离散率
+        double powerDeviation = calculatePowerDeviation(collect, run);
+        // 计算平均功率
+        double averagePower = calculateAveragePower(collect);
+        // 分析逆变器状态
+        String inverterStatus = analyzeInverterStatus(powerDeviation, averagePower);
+
+        return new InverterData2(inverterId, powerDeviation, averagePower, inverterStatus, "离散率");
+    }
+
+    // 计算功率离散率
+    private double calculatePowerDeviation(List<Double> powerData, double[] run) {
+        double sum = 0.0;
+
+        // 计算标准差
+        for (Double power : powerData) {
+            sum += Math.pow(power - pncf.calcPoly(power, run), 2);
+        }
+        return Math.sqrt(sum / powerData.size());
+    }
+}

+ 12 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/dispersionanalysis/OperatingLevel.java

@@ -0,0 +1,12 @@
+package com.gyee.power.fitting.dispersionanalysis;
+
+public enum OperatingLevel {
+    POOR,
+    VERY_POOR,
+    EXCELLENT,
+    GOOD,
+    AVERAGE,
+    STABLE,
+    NEEDS_IMPROVEMENT,
+    MUST_CORRECT
+}

+ 49 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/dispersionanalysis/PhotovoltaicEfficiencyAnalysis.java

@@ -0,0 +1,49 @@
+package com.gyee.power.fitting.dispersionanalysis;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class PhotovoltaicEfficiencyAnalysis {
+    public static void main(String[] args) {
+        // 模拟全站光伏逆变单元的数据,这里用一个Map来表示每个逆变单元的发电功率和入射光能
+        Map<String, Double[]> inverterData = new HashMap<>();
+        inverterData.put("Inverter1", new Double[]{500.0, 600.0});
+        inverterData.put("Inverter2", new Double[]{550.0, 600.0});
+        inverterData.put("Inverter3", new Double[]{450.0, 600.0});
+        inverterData.put("Inverter4", new Double[]{600.0, 600.0});
+        inverterData.put("Inverter5", new Double[]{350.0, 600.0});
+
+        // 分析光伏逆变单元的运行水平
+        for (Map.Entry<String, Double[]> entry : inverterData.entrySet()) {
+            String inverterName = entry.getKey();
+            Double[] data = entry.getValue();
+            double actualOutputPower = data[0]; // 实际发电功率
+            double incidentSolarPower = data[1]; // 入射光能
+
+            double efficiency = calculatePhotovoltaicEfficiency(actualOutputPower, incidentSolarPower);
+            OperatingLevel currentLevel = determinePhotovoltaicLevel(efficiency);
+
+            // 输出每个逆变单元的运行水平
+            System.out.println(inverterName + "的运行水平是: " + currentLevel);
+        }
+    }
+
+    // 根据转换效率确定光伏运行水平
+    private static OperatingLevel determinePhotovoltaicLevel(double efficiency) {
+        if (efficiency >= 90.0) {
+            return OperatingLevel.STABLE;
+        } else if (efficiency >= 80.0) {
+            return OperatingLevel.GOOD;
+        } else if (efficiency >= 70.0) {
+            return OperatingLevel.NEEDS_IMPROVEMENT;
+        } else {
+            return OperatingLevel.MUST_CORRECT;
+        }
+    }
+
+    // 计算光伏转换效率
+    private static double calculatePhotovoltaicEfficiency(double actualOutputPower, double incidentSolarPower) {
+        // 转换为百分比
+        return (actualOutputPower / incidentSolarPower) * 100.0;
+    }
+}

+ 75 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/dispersionanalysis/PhotovoltaicEfficiencyAnalysis2.java

@@ -0,0 +1,75 @@
+package com.gyee.power.fitting.dispersionanalysis;
+
+import com.alibaba.fastjson.JSONObject;
+import com.gyee.power.fitting.common.result.JsonResult;
+import com.gyee.power.fitting.common.result.ResultCode;
+import com.gyee.power.fitting.model.custom.PhotovoltaicInfo;
+import com.gyee.power.fitting.service.impl.IvPvCurveFittingService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+//光伏转换效率分析
+@Slf4j
+@CrossOrigin
+@RequestMapping("/conversion")
+@RestController
+public class PhotovoltaicEfficiencyAnalysis2 {
+
+    @Resource
+    private IvPvCurveFittingService curveFittingService;
+
+    // 计算光伏转换效率
+    private static double calculatePhotovoltaicEfficiency(double actualOutputPower, double incidentSolarPower) {
+        double v = (actualOutputPower / incidentSolarPower) * 100.0;
+        if (v > 95) v = 95.0;
+        // 转换为百分比
+        return v;
+    }
+
+    @GetMapping("/efficiency")
+    private JSONObject getFileList(
+            @RequestParam(value = "station", required = true) String station,
+            @RequestParam(value = "inverters", required = false) List<String> inverters,
+            @RequestParam(value = "startdate", required = true) long startdate,
+            @RequestParam(value = "interval", required = false) Integer interval,
+            @RequestParam(value = "enddate", required = true) long enddate) {
+
+        Map<String, List<PhotovoltaicInfo>> datasInfos = curveFittingService.getDatas2File1(station, startdate, enddate, interval);
+        List<PhotovoltaicInfo> bzdList = curveFittingService.standardPointCalculate1(datasInfos);
+
+        Map<String, List<PhotovoltaicInfo>> bzdInfos = curveFittingService.calculatAnalysis1(bzdList, datasInfos);
+
+        List<InverterData2> inverterData2s = new ArrayList<>();
+        // 分析光伏逆变单元的运行水平
+        datasInfos.forEach((k, v) -> {
+            double actualOutputPower = v.stream().mapToDouble(PhotovoltaicInfo::getActualP).sum();
+            double incidentSolarPower = v.stream().mapToDouble(PhotovoltaicInfo::getIdeaP).sum();
+            double sPower = v.stream().mapToDouble(PhotovoltaicInfo::getS).sum();
+            log.info(k + "逆变器转换率2:" + actualOutputPower / sPower);
+
+            double efficiency = calculatePhotovoltaicEfficiency(actualOutputPower, incidentSolarPower);
+            String currentLevel = determinePhotovoltaicLevel(efficiency);
+            inverterData2s.add(new InverterData2(k, efficiency, actualOutputPower / v.size(), currentLevel, "转换效率"));
+        });
+
+        return JsonResult.successData(ResultCode.SUCCESS, inverterData2s);
+    }
+
+    // 根据转换效率确定光伏运行水平
+    private String determinePhotovoltaicLevel(double efficiency) {
+        if (efficiency >= 90.0) {
+            return "运行稳定";
+        } else if (efficiency >= 80.0) {
+            return "运行良好";
+        } else if (efficiency >= 70.0) {
+            return "运行水平有待提高";
+        } else {
+            return "必须整改";
+        }
+    }
+}

File diff suppressed because it is too large
+ 764 - 561
power-fitting-JN/src/main/java/com.gyee.power.fitting/service/impl/IvPvCurveFittingService.java