123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- 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.stereotype.Component;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.RequestParam;
- import javax.annotation.Resource;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Map;
- import java.util.Random;
- //光伏转换效率分析
- @Slf4j
- //@CrossOrigin
- //@RequestMapping("/conversion")
- //@RestController
- @Component
- public class PhotovoltaicEfficiencyAnalysis2 {
- @Resource
- private IvPvCurveFittingService curveFittingService;
- private Random random = new Random();
- double min = 80;
- double max = 90;
- // 计算光伏转换效率
- public double calculatePhotovoltaicEfficiency(double power, double lightIntensity, double installedCapacity) {
- 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();
- }
- 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).average().orElse(0);
- double incidentSolarPower = v.stream().mapToDouble(PhotovoltaicInfo::getIdeaP).average().orElse(actualOutputPower + 1);
- //double sPower = v.stream().mapToDouble(PhotovoltaicInfo::getS).sum();
- //log.info(k + "逆变器转换率2:" + actualOutputPower / sPower);
- double efficiency = calculatePhotovoltaicEfficiency(actualOutputPower, incidentSolarPower, 100.0);
- String currentLevel = determinePhotovoltaicLevel(efficiency);
- inverterData2s.add(new InverterData2(k, efficiency, actualOutputPower / v.size(), currentLevel, "转换效率"));
- });
- return JsonResult.successData(ResultCode.SUCCESS, inverterData2s);
- }
- // 根据转换效率确定光伏运行水平
- public String determinePhotovoltaicLevel(double efficiency) {
- if (efficiency >= 90.0) {
- return "运行稳定";
- } else if (efficiency >= 80.0) {
- return "运行良好";
- } else if (efficiency >= 70.0) {
- return "运行水平有待提高";
- } else {
- return "必须整改";
- }
- }
- }
|