Explorar o código

风速功率曲线问题处理

wangb hai 1 mes
pai
achega
59cdf7dfd7

+ 13 - 2
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/agc/AgcDeviateService.java

@@ -367,7 +367,8 @@ public class AgcDeviateService {
                     .map(point->{
                         double value = point.getPointValueInDouble();
                         return  NumberUtil.round(value, 2).doubleValue();
-                    }).collect(Collectors.toList());
+                    })
+                    .collect(Collectors.toList());
             spa.setWindSpeed(speedDatas);
             List<Long> time = historyspeedDatas.stream().map(PointData::getPointTime).collect(Collectors.toList());
             spa.setTime(time);
@@ -383,7 +384,13 @@ public class AgcDeviateService {
             ConcurrentHashMap<Double, Double> wtyc = JSON.parseObject(yc, new com.alibaba.fastjson.TypeReference<ConcurrentHashMap<Double, Double>>() {
             }.getType());
             fitcoef.put(firstKey.replaceFirst(powerCurveMonth, ""), wtyc);
-            List<Double> llgl = speedDatas.stream().map(a -> fitcoef.get(wtId).get(a)).collect(Collectors.toList());
+            List<Double> llgl = speedDatas.stream().map(a ->{
+                double ll = 0.0;
+                if (a > 0) {
+                     ll = fitcoef.get(wtId).get(a);
+                }
+                return ll;
+            } ).collect(Collectors.toList());
             spa.setTheoreticalPower(llgl);
             ls.add(spa);
             map.put(wtId, ls);
@@ -406,6 +413,10 @@ public class AgcDeviateService {
                 length = Math.min(actuatedPower.size(), theoreticalPower.size());
             }
             for (int i = 0; i < length; i++) {
+                if (null == theoreticalPower.get(i) || null == actuatedPower.get(i)) {
+                    theoreticalPower.set(i, 0.0);
+                    actuatedPower.set(i, 0.0);
+                }
                 if (theoreticalPower.get(i) < actuatedPower.get(i)) {
                     double act = 0.0;
                     if (actuatedPower.get(i) > 0) {