chenminghua 1 år sedan
förälder
incheckning
929b72ea08

+ 12 - 0
power-fitting/pom.xml

@@ -131,6 +131,18 @@
             <version>42.4.1</version>
             <version>42.4.1</version>
         </dependency>
         </dependency>
 
 
+        <!--解析excel-  xls-->
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi</artifactId>
+            <version>3.17</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml</artifactId>
+            <version>3.17</version>
+        </dependency>
+
 
 
     </dependencies>
     </dependencies>
 
 

+ 1 - 28
power-fitting/src/main/java/com/gyee/power/fitting/common/alg/PowerProcessALG.java

@@ -31,19 +31,15 @@ public class PowerProcessALG {
      * @param isqfh  是否欠符合
      * @param isqfh  是否欠符合
      * @param qfhdj  欠符合等级
      * @param qfhdj  欠符合等级
      * @return
      * @return
-     * // 0-待机  1-手动停机  2-正常发电  3-缺陷降出力  4-限电降出力  5-限电停机  6-故障停机
-     * // 7-场内受累停机  8-检修停机  9-场内受累检修  10-电网受累  11-环境受累  12-风机离线
      */
      */
     public static List<PowerPointData> dataProcess(List<PowerPointData> list, Map<Double, Double> map,
     public static List<PowerPointData> dataProcess(List<PowerPointData> list, Map<Double, Double> map,
                                                    Double maxs, Double mins, Double maxp, Double minp, Boolean isfbw,
                                                    Double maxs, Double mins, Double maxp, Double minp, Boolean isfbw,
                                                    Boolean isfhl, Boolean isbw, Boolean istj, Boolean isglpc, Boolean isqfh, Integer qfhdj){
                                                    Boolean isfhl, Boolean isbw, Boolean istj, Boolean isglpc, Boolean isqfh, Integer qfhdj){
         String timeBW = DateUtil.format(new Date(0), DateUtil.DATE_TIME_PATTERN);
         String timeBW = DateUtil.format(new Date(0), DateUtil.DATE_TIME_PATTERN);
-        String timeTJ = DateUtil.format(new Date(0), DateUtil.DATE_TIME_PATTERN);
         List<PowerPointData> tempei = new ArrayList<>();
         List<PowerPointData> tempei = new ArrayList<>();
         List<PowerPointData> tempqf = new ArrayList<>();
         List<PowerPointData> tempqf = new ArrayList<>();
-        List<PowerPointData> temptj = new ArrayList<>();
 
 
-        //TODO 数据过滤  // 0正常,1过滤掉,2停机数据过滤
+        //TODO 数据过滤  // 0正常,1过滤掉
         for (PowerPointData item : list) {
         for (PowerPointData item : list) {
             int filter = 0;
             int filter = 0;
             int fjstatus = 0;
             int fjstatus = 0;
@@ -137,29 +133,6 @@ public class PowerProcessALG {
                     }
                     }
                 }
                 }
             }
             }
-
-            int tjstatus = 0;
-            int tjflag = -1;
-            //过滤停机、待机等后10分钟和并网前10分钟数据
-            if (item.getMxzt() == 0 || item.getMxzt() == 1 || item.getMxzt() == 5 || item.getMxzt() == 6 || item.getMxzt() == 7 || item.getMxzt() == 8 || item.getMxzt() == 9){
-                tjstatus = 1;
-                tjflag = item.getMxzt();
-                timeTJ = item.getTime();
-            } else {
-                tjstatus = 0;
-                tjflag = -1;
-            }
-            if (tjstatus == 1){
-                if (temptj.size() > 0){
-                    if (DateUtil.getTimeDiff(temptj.get(0).getTime(), timeTJ) >= 10 && tjflag == item.getMxzt()){
-                        item.setFilter(2);
-                        temptj.remove(0);
-                    }
-                }
-                temptj.add(item);
-            } else {
-                temptj.clear();
-            }
         }
         }
 
 
         return list;
         return list;

+ 3 - 0
power-fitting/src/main/java/com/gyee/power/fitting/controller/fj/BladeController.java

@@ -11,6 +11,9 @@ import org.springframework.web.bind.annotation.RestController;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 
 
+/**
+ * 桨叶分析
+ */
 @RestController
 @RestController
 @CrossOrigin
 @CrossOrigin
 @RequestMapping("/blade")
 @RequestMapping("/blade")

+ 5 - 19
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/curve/DataFittingService.java

@@ -71,14 +71,8 @@ public class DataFittingService {
                 List<Double> arrayPower = new ArrayList<>();
                 List<Double> arrayPower = new ArrayList<>();
                 List<String> line = FileUtil.readFile(list.get(0).getPath(), true);
                 List<String> line = FileUtil.readFile(list.get(0).getPath(), true);
                 csvParse(line, arraySpeed, arrayPower, mins, maxs, minp, maxp);
                 csvParse(line, arraySpeed, arrayPower, mins, maxs, minp, maxp);
-                Double maxP = 0.0;
-                try {
-                    List<Modelpowerdetails> mp = InitialRunner.modelPowerDetailMap.get(InitialRunner.wtMap.get(list.get(0).getWindturbine()).getModelid());
-                    maxP = mp.stream().map(Modelpowerdetails::getEnsurepower).max(Comparator.comparing(Double::doubleValue)).get();
-                } catch (Exception e) {}
-                if (maxP == 0.0){
-                    maxP = 2500.0;
-                }
+                List<Modelpowerdetails> mp = InitialRunner.modelPowerDetailMap.get(InitialRunner.wtMap.get(list.get(0).getWindturbine()).getModelid());
+                Double maxP = mp.stream().map(Modelpowerdetails::getEnsurepower).max(Comparator.comparing(Double::doubleValue)).get();
                 object.set(fittingMode(list, maxP, arraySpeed, arrayPower, dimension, mode));
                 object.set(fittingMode(list, maxP, arraySpeed, arrayPower, dimension, mode));
             }
             }
         }
         }
@@ -194,12 +188,8 @@ public class DataFittingService {
         }
         }
 
 
         //保证功率
         //保证功率
-        List<Modelpowerdetails> modelPower;
-        List<Object> bzglList = null;
-        try {
-            modelPower = InitialRunner.modelPowerDetailMap.get(InitialRunner.wtMap.get(obj.getWindturbine()).getModelid());
-            bzglList = modelPower.stream().sorted(Comparator.comparing(Modelpowerdetails::getSpeed)).map(m -> new double[]{m.getSpeed(), m.getEnsurepower()}).collect(Collectors.toList());
-        } catch (Exception e){}
+        List<Modelpowerdetails> modelPower = InitialRunner.modelPowerDetailMap.get(InitialRunner.wtMap.get(obj.getWindturbine()).getModelid());
+        List<Object> bzglList = modelPower.stream().sorted(Comparator.comparing(Modelpowerdetails::getSpeed)).map(m -> new double[]{m.getSpeed(), m.getEnsurepower()}).collect(Collectors.toList());
 
 
         //散点
         //散点
         String[] ids = obj.getProcessid().split(",");
         String[] ids = obj.getProcessid().split(",");
@@ -306,12 +296,8 @@ public class DataFittingService {
         List<Point> temp = PowerFittingALG.buildLine(arrX, arrY, arraySpeed.size(), dimension, 0.01);
         List<Point> temp = PowerFittingALG.buildLine(arrX, arrY, arraySpeed.size(), dimension, 0.01);
         //推力系数 CP值
         //推力系数 CP值
         LineCurveFitting lf = new LineCurveFitting();
         LineCurveFitting lf = new LineCurveFitting();
-        Double sweptarea = 4600.0;
         lf.setYLines(temp);
         lf.setYLines(temp);
-        try {
-            sweptarea = InitialRunner.equipmentMap.get(InitialRunner.wtMap.get(obj.getWindturbine()).getModelid()).getSweptarea();
-        } catch (Exception e){}
-        lf = PowerFittingALG.buildCp(sweptarea, lf);
+        lf = PowerFittingALG.buildCp(InitialRunner.equipmentMap.get(InitialRunner.wtMap.get(obj.getWindturbine()).getModelid()).getSweptarea(), lf);
         lf.getCpValue().forEach(f -> {if(f.getX() <= 2.5) f.setY(0);});
         lf.getCpValue().forEach(f -> {if(f.getX() <= 2.5) f.setY(0);});
         //曲线偏差率
         //曲线偏差率
         dataCurveRatio(lf, obj);
         dataCurveRatio(lf, obj);

+ 11 - 23
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/curve/DataProcessService.java

@@ -15,7 +15,6 @@ import com.gyee.power.fitting.model.anno.FixedVo;
 import com.gyee.power.fitting.model.custom.PowerPointData;
 import com.gyee.power.fitting.model.custom.PowerPointData;
 import com.gyee.power.fitting.model.custom.TableTitle;
 import com.gyee.power.fitting.model.custom.TableTitle;
 import com.gyee.power.fitting.service.PowerfittinganalysisService;
 import com.gyee.power.fitting.service.PowerfittinganalysisService;
-import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
@@ -26,7 +25,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
-@Slf4j
 @Service
 @Service
 public class DataProcessService {
 public class DataProcessService {
 
 
@@ -65,27 +63,17 @@ public class DataProcessService {
                 eis.add(new PowerPointData(list.get(i).split(","), false));
                 eis.add(new PowerPointData(list.get(i).split(","), false));
             }
             }
 
 
-            // 静风频率、平均风速
-            double frequency =0;
-            double speed = 0;
-            String content;
-
-            /** 风速  ->  保证功率  来自数据库  没有配置特殊处理 **/
-            try {
-                List<Modelpowerdetails> modelPowerList = InitialRunner.modelPowerDetailMap.get(InitialRunner.wtMap.get(obj.getWindturbine()).getModelid());
-                Map<Double, Double> modelPowerMap = modelPowerList.stream().collect(Collectors.toMap(Modelpowerdetails::getSpeed, Modelpowerdetails::getEnsurepower));
-                /** 数据预处理 **/
-                List<PowerPointData> data = PowerProcessALG.dataProcess(eis, modelPowerMap, maxs, mins, maxp, minp, isfbw, isfhl, isbw, istj, isglpc, isqfh, qfhdj);
-                /** 静风频率 **/
-                List<Double> ls = WindDirectionALG.frequency(data.stream().map(PowerPointData::getSpeed).collect(Collectors.toList()), 3);
-                frequency = ls.get(0);
-                speed = ls.get(1);
-                content = assemble(data);
-            } catch (Exception e){
-                log.error(e.getMessage());
-                content = assemble(eis);
-            }
-
+            /** 风速  ->  保证功率  来自数据库 **/
+            List<Modelpowerdetails> modelPowerList = InitialRunner.modelPowerDetailMap.get(InitialRunner.wtMap.get(obj.getWindturbine()).getModelid());
+            Map<Double, Double> modelPowerMap = modelPowerList.stream().collect(Collectors.toMap(Modelpowerdetails::getSpeed, Modelpowerdetails::getEnsurepower));
+            /** 数据预处理 **/
+            List<PowerPointData> data = PowerProcessALG.dataProcess(eis, modelPowerMap, maxs, mins, maxp, minp, isfbw, isfhl, isbw, istj, isglpc, isqfh, qfhdj);
+            /** 静风频率 **/
+            List<Double> ls = WindDirectionALG.frequency(data.stream().map(PowerPointData::getSpeed).collect(Collectors.toList()), 3);
+            double frequency = ls.get(0);
+            double speed = ls.get(1);
+
+            String content = assemble(data);
             String fileName = config.getFilePathProcess() + obj.getStation() + "_" + obj.getCode() + "_" + SnowFlakeUtil.generateIdL() / 100000 + ".csv";
             String fileName = config.getFilePathProcess() + obj.getStation() + "_" + obj.getCode() + "_" + SnowFlakeUtil.generateIdL() / 100000 + ".csv";
             boolean flag = FileUtil.writeFile(fileName, content);
             boolean flag = FileUtil.writeFile(fileName, content);
             if (flag) {  // TODO  保存数据库
             if (flag) {  // TODO  保存数据库

+ 11 - 25
power-fitting/src/main/resources/application.yaml

@@ -36,18 +36,18 @@ spring:
   main:
   main:
     allow-bean-definition-overriding: false #当遇到同样名字的时候,是否允许覆盖注册
     allow-bean-definition-overriding: false #当遇到同样名字的时候,是否允许覆盖注册
   datasource:
   datasource:
-#    type: com.alibaba.druid.pool.DruidDataSource
-#    # 宁夏三区oracle
-#    driver-class-name: oracle.jdbc.OracleDriver
-#    url: jdbc:oracle:thin:@192.168.1.105:1521:gdnxfd
-#    username: nxfdprod
-#    password: gdnxfd123
-
-    url: jdbc:postgresql://123.60.221.117:5432/powerfitting
-    username: postgres
-    password: gyee@123
-    driver-class-name: org.postgresql.Driver
     type: com.alibaba.druid.pool.DruidDataSource
     type: com.alibaba.druid.pool.DruidDataSource
+    # 宁夏三区oracle
+    driver-class-name: oracle.jdbc.OracleDriver
+    url: jdbc:oracle:thin:@192.168.1.105:1521:gdnxfd
+    username: nxfdprod
+    password: gdnxfd123
+
+#    url: jdbc:postgresql://123.60.221.117:5432/powerfitting
+#    username: postgres
+#    password: gyee@123
+#    driver-class-name: org.postgresql.Driver
+#    type: com.alibaba.druid.pool.DruidDataSource
 
 
     druid:
     druid:
       # 初始化大小,最小,最大
       # 初始化大小,最小,最大
@@ -81,20 +81,6 @@ logging:
   file:
   file:
     path: ./logs
     path: ./logs
 
 
-uniformcode:
-  power: AI130  #功率
-  speed: AI022  #风速
-  rr: AI128  #转速
-  mxzt: ZTMX  #风机状态
-  dl: RFDL  #电量
-  qfzt: RSSQFZT  #欠发状态
-  fx: AI008  #风向
-  dfwc: AI036  #对风误差
-  angle: AI034  #偏航角度
-  hjwd: AI056  #环境温度
-  yp1: AI085  #叶片1
-  yp2: AI086  #叶片2
-  yp3: AI087  #叶片3
 
 
 uniformcodegf:
 uniformcodegf:
   gfgzqd: SSFS #光伏光照强度
   gfgzqd: SSFS #光伏光照强度