Koishi hai 1 ano
pai
achega
8e8321d1aa

+ 56 - 45
power-fitting-JN/src/main/java/com.gyee.power.fitting/common/alg/WindDirectionALG.java

@@ -55,15 +55,21 @@ public class WindDirectionALG {
      * @return
      */
     public static int[] fxRadarRoses(List<PowerPointData> list){
-        int[] count = new int[16];
-        list.stream().sorted(Comparator.comparing(PowerPointData::getSpeed)).forEach(item -> {
-            int df = windDFAngle(item.getDfwc());
-            if (count[df] < 1000) {
-                count[df]++;
-            }
-        });
 
-        return count;
+        try {
+            int[] count = new int[16];
+            list.stream().sorted(Comparator.comparing(PowerPointData::getSpeed)).forEach(item -> {
+                int df = windDFAngle(item.getDfwc());
+                if (count.length > df && count[df] < 1000) {
+                    count[df]++;
+                }
+            });
+            return count;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+
     }
 
 
@@ -129,47 +135,52 @@ public class WindDirectionALG {
      * @return
      */
     public static Map<String, Object> windDeviationPoint(List<PowerPointData> points){
-        List<PowerPointData> list = new ArrayList<>();
-        List<Object> temp = new ArrayList<>();
-        Map<String, Object> result = new HashMap<>();
-        Map<Integer, double[]> map = new LinkedHashMap<>();
-
-        //过滤对风偏差
-        for (int i = 0; i < points.size(); i++){
-            PowerPointData item = points.get(i);
-            if ((item.getSpeed() < 4.5 || item.getSpeed() >= 10.5) && item.getMxzt() != 2)
-                continue;
-
-            list.add(item);
-            Integer speed = Math.toIntExact(Math.round(item.getSpeed()));
-            if (!map.containsKey(speed))
-                map.put(speed, new double[2]);  //[0]最小值 [1]最大值
-
-            double[] value = map.get(speed);
-            double power = item.getPower() < 0 ? 0 : item.getPower();
-            value[0] = power < value[0] ? power : value[0]; //最小值
-            value[1] = power > value[1] ? power : value[1]; //最大值
-        }
+        try {
+            List<PowerPointData> list = new ArrayList<>();
+            List<Object> temp = new ArrayList<>();
+            Map<String, Object> result = new HashMap<>();
+            Map<Integer, double[]> map = new LinkedHashMap<>();
+
+            //过滤对风偏差
+            for (int i = 0; i < points.size(); i++){
+                PowerPointData item = points.get(i);
+                if ((item.getSpeed() < 4.5 || item.getSpeed() >= 10.5) && item.getMxzt() != 2)
+                    continue;
+
+                list.add(item);
+                Integer speed = Math.toIntExact(Math.round(item.getSpeed()));
+                if (!map.containsKey(speed))
+                    map.put(speed, new double[2]);  //[0]最小值 [1]最大值
 
-        int avg = 0;
-        DecimalFormat sf = new DecimalFormat("0.00");
-        for (int i = 0; i < list.size(); i++){
-            PowerPointData item = list.get(i);
-            Integer speed = Math.toIntExact(Math.round(item.getSpeed()));
-            int ele = (int) (Math.abs(item.getFx()) + Math.abs(item.getAngle()));
-            int index = ele - 180;
-            if (index >= -30 && index <= 30 && item.getPower() > 0) {
-                avg += index;
                 double[] value = map.get(speed);
-                double v = (item.getPower() - value[0]) / (value[1] - value[0]);
-                double s[] = {speed, index, Double.valueOf(sf.format(v)).doubleValue()};
-                temp.add(s);
+                double power = item.getPower() < 0 ? 0 : item.getPower();
+                value[0] = power < value[0] ? power : value[0]; //最小值
+                value[1] = power > value[1] ? power : value[1]; //最大值
             }
-        }
-        result.put("data", temp);
-        result.put("avg", temp.size() > 0 ? avg/temp.size() : 0);
 
-        return result;
+            int avg = 0;
+            DecimalFormat sf = new DecimalFormat("0.00");
+            for (int i = 0; i < list.size(); i++){
+                PowerPointData item = list.get(i);
+                Integer speed = Math.toIntExact(Math.round(item.getSpeed()));
+                int ele = (int) (Math.abs(item.getFx()) + Math.abs(item.getAngle()));
+                int index = ele - 180;
+                if (index >= -30 && index <= 30 && item.getPower() > 0) {
+                    avg += index;
+                    double[] value = map.get(speed);
+                    double v = (item.getPower() - value[0]) / (value[1] - value[0]);
+                    double s[] = {speed, index, Double.valueOf(sf.format(v)).doubleValue()};
+                    temp.add(s);
+                }
+            }
+            result.put("data", temp);
+            result.put("avg", temp.size() > 0 ? avg/temp.size() : 0);
+
+            return result;
+        } catch (NumberFormatException e) {
+            e.printStackTrace();
+        }
+        return null;
     }
 
 

+ 2 - 1
power-fitting-JN/src/main/java/com.gyee.power.fitting/model/custom/PowerPointData.java

@@ -68,9 +68,10 @@ public class PowerPointData {
     private double dl = 0;
 
     //欠发状态 SSQFZT
-    @Desc(des = "欠发状态",  uniformCode = "SSQFZT", remark = "1")
+    @Desc(des = "欠发状态",  uniformCode = "RQFZT", remark = "1")
     private int qfzt = 0;
 
+
     //风向 AI067
     @Desc(des = "风向",  uniformCode = "AI067", remark = "1")
     private double fx = 0;

+ 3 - 3
power-fitting-JN/src/main/java/com.gyee.power.fitting/service/custom/curve/NewDataFittingService.java

@@ -68,7 +68,7 @@ public class NewDataFittingService {
 
         //1.数据获取
         List<String> wtIds = Arrays.asList(vo.getWtIds().split(","));
-        deleteDir(config.getFilePathPrepare());
+//        deleteDir(config.getFilePathPrepare());
         for (int k = 0; k < wtIds.size(); k++) {
             String wt = wtIds.get(k);
             List<List<TsDoubleData>> result = new ArrayList<>();
@@ -124,7 +124,7 @@ public class NewDataFittingService {
         //2.数据筛选
 
         try {
-            deleteDir(config.getFilePathProcess());
+//            deleteDir(config.getFilePathProcess());
             for (String key : prepareMap.keySet()){
 
                 ProEconPowerFittingAnalySis obj = proEconPowerFittingAnalySisService.getById(key);
@@ -167,7 +167,7 @@ public class NewDataFittingService {
         //3.数据拟合
 
         AtomicReference<ProEconPowerFittingAnalySis> object = new AtomicReference<>();
-        deleteDir(config.getFilePathFitting());
+//        deleteDir(config.getFilePathFitting());
         if (vo.getMode() == 0){  //单台拟合
             for (String processkey : processMap.keySet()){
                 List<ProEconPowerFittingAnalySis> list = proEconPowerFittingAnalySisService.selectListByIds(processkey);