瀏覽代碼

theoreticalPower_CAL、realtime_CAL计算服务调通

hlf 2 月之前
父節點
當前提交
0303ee4f75

+ 46 - 43
generationXK-service/src/main/java/com/gyee/generation/service/realtimelibrary/RealtimeService.java

@@ -159,54 +159,57 @@ public class RealtimeService {
             }
             wtResultList.add(ssbfPointDate);
             double v = DoubleUtils.keepPrecision(ssbf, 2);
-            if (theoreticalPowerMap.containsKey(wt.getModelId())) {
-                //                double v = DoubleUtils.keepPrecision(ssbf, 2);
-                if (theoreticalPowerMap.get(wt.getModelId()).containsKey(v)) {
-                    ProBasicModelPowerRd basicModelPowerRd = theoreticalPowerMap.get(wt.getModelId()).get(v);
-                    wtResultList.add(PointUtil.createPointData(currentDate, basicModelPowerRd.getTheoryPower(), llglPoint.getNemCode(), llglPoint.getName()));
-                    wtResultList.add(PointUtil.createPointData(currentDate, basicModelPowerRd.getEnsurePower(), bzglPoint.getNemCode(), bzglPoint.getName()));
-                } else {
-                    wtResultList.add(PointUtil.createPointData(currentDate, 0, llglPoint.getNemCode(), llglPoint.getName()));
-                    wtResultList.add(PointUtil.createPointData(currentDate, 0, bzglPoint.getNemCode(), bzglPoint.getName()));
+            if (null != theoreticalPowerMap){
+                if (theoreticalPowerMap.containsKey(wt.getModelId())) {
+                    //                double v = DoubleUtils.keepPrecision(ssbf, 2);
+                    if (theoreticalPowerMap.get(wt.getModelId()).containsKey(v)) {
+                        ProBasicModelPowerRd basicModelPowerRd = theoreticalPowerMap.get(wt.getModelId()).get(v);
+                        wtResultList.add(PointUtil.createPointData(currentDate, basicModelPowerRd.getTheoryPower(), llglPoint.getNemCode(), llglPoint.getName()));
+                        wtResultList.add(PointUtil.createPointData(currentDate, basicModelPowerRd.getEnsurePower(), bzglPoint.getNemCode(), bzglPoint.getName()));
+                    } else {
+                        wtResultList.add(PointUtil.createPointData(currentDate, 0, llglPoint.getNemCode(), llglPoint.getName()));
+                        wtResultList.add(PointUtil.createPointData(currentDate, 0, bzglPoint.getNemCode(), bzglPoint.getName()));
+                    }
                 }
             }
-            if (curveFittingPowerMap.containsKey(wt.getId())) {
-                if (curveFittingPowerMap.get(wt.getId()).containsKey(v)) {
-                    ProEconWtCurveFittingMonth wtPowerCurveFitting = curveFittingPowerMap.get(wt.getId()).get(v);
-                    Double actualPower = wtPowerCurveFitting.getActualPower();
-                    double[] underissuanceArray = {0, 1, 2, 3, 8, 9, 11};
-                    double qfzt = 0;
-                    double lsqfzt = 0;
-                    double ssgl15 = 0;
-                    double zsgl15 = 0;
-                    //                    if (ssglOptional.isPresent()) {
-                    //                        ssgl15 = ssglOptional.get().getPointValueInDouble();
-                    zsgl15 = wtPowerCurveFitting.getActualPower();
-                    //                    }
-                    if (Arrays.asList(underissuanceArray).contains(mxzt)) {
-                        qfzt = Underdelivery.underdeliveryStatusReal(ssgl, actualPower);
-                        lsqfzt = Underdelivery.underdeliveryStatusReal(ssgl15, zsgl15);
+            if (null != curveFittingPowerMap){
+                if (curveFittingPowerMap.containsKey(wt.getId())) {
+                    if (curveFittingPowerMap.get(wt.getId()).containsKey(v)) {
+                        ProEconWtCurveFittingMonth wtPowerCurveFitting = curveFittingPowerMap.get(wt.getId()).get(v);
+                        Double actualPower = wtPowerCurveFitting.getActualPower();
+                        double[] underissuanceArray = {0, 1, 2, 3, 8, 9, 11};
+                        double qfzt = 0;
+                        double lsqfzt = 0;
+                        double ssgl15 = 0;
+                        double zsgl15 = 0;
+                        //                    if (ssglOptional.isPresent()) {
+                        //                        ssgl15 = ssglOptional.get().getPointValueInDouble();
+                        zsgl15 = wtPowerCurveFitting.getActualPower();
+                        //                    }
+                        if (Arrays.asList(underissuanceArray).contains(mxzt)) {
+                            qfzt = Underdelivery.underdeliveryStatusReal(ssgl, actualPower);
+                            lsqfzt = Underdelivery.underdeliveryStatusReal(ssgl15, zsgl15);
+                        }
+                        wtResultList.add(PointUtil.createPointData(currentDate, qfzt, ssqfztPoint.getNemCode(), ssqfztPoint.getName()));
+                        wtResultList.add(PointUtil.createPointData(currentDate, lsqfzt, lsqfztPoint.getNemCode(), lsqfztPoint.getName()));
+
+                        wtResultList.add(PointUtil.createPointData(currentDate, wtPowerCurveFitting.getActualPower(), zsglPoint.getNemCode(), zsglPoint.getName()));
+                        wtResultList.add(PointUtil.createPointData(currentDate, wtPowerCurveFitting.getOptimalPower(), zyglPoint.getNemCode(), zyglPoint.getName()));
+                        //                    if (mxzt == 4 || mxzt == 5 || mxzt == 6 || mxzt == 7) {
+                        //                        wtResultList.add(PointUtil.createPointData(currentDate, 0, kyglPoint.getNemCode(), kyglPoint.getName()));
+                        //                    } else {
+                        //                        wtResultList.add(PointUtil.createPointData(currentDate, wtPowerCurveFitting.getActualPower(), kyglPoint.getNemCode(), kyglPoint.getName()));
+                        //                    }
+                    } else {
+                        wtResultList.add(PointUtil.createPointData(currentDate, 0, ssqfztPoint.getNemCode(), ssqfztPoint.getName()));
+                        wtResultList.add(PointUtil.createPointData(currentDate, 0, lsqfztPoint.getNemCode(), lsqfztPoint.getName()));
+
+                        wtResultList.add(PointUtil.createPointData(currentDate, 0, zsglPoint.getNemCode(), zsglPoint.getName()));
+                        wtResultList.add(PointUtil.createPointData(currentDate, 0, zyglPoint.getNemCode(), zyglPoint.getName()));
+                        //                    wtResultList.add(PointUtil.createPointData(currentDate, 0, kyglPoint.getNemCode(), kyglPoint.getName()));
                     }
-                    wtResultList.add(PointUtil.createPointData(currentDate, qfzt, ssqfztPoint.getNemCode(), ssqfztPoint.getName()));
-                    wtResultList.add(PointUtil.createPointData(currentDate, lsqfzt, lsqfztPoint.getNemCode(), lsqfztPoint.getName()));
-
-                    wtResultList.add(PointUtil.createPointData(currentDate, wtPowerCurveFitting.getActualPower(), zsglPoint.getNemCode(), zsglPoint.getName()));
-                    wtResultList.add(PointUtil.createPointData(currentDate, wtPowerCurveFitting.getOptimalPower(), zyglPoint.getNemCode(), zyglPoint.getName()));
-                    //                    if (mxzt == 4 || mxzt == 5 || mxzt == 6 || mxzt == 7) {
-                    //                        wtResultList.add(PointUtil.createPointData(currentDate, 0, kyglPoint.getNemCode(), kyglPoint.getName()));
-                    //                    } else {
-                    //                        wtResultList.add(PointUtil.createPointData(currentDate, wtPowerCurveFitting.getActualPower(), kyglPoint.getNemCode(), kyglPoint.getName()));
-                    //                    }
-                } else {
-                    wtResultList.add(PointUtil.createPointData(currentDate, 0, ssqfztPoint.getNemCode(), ssqfztPoint.getName()));
-                    wtResultList.add(PointUtil.createPointData(currentDate, 0, lsqfztPoint.getNemCode(), lsqfztPoint.getName()));
-
-                    wtResultList.add(PointUtil.createPointData(currentDate, 0, zsglPoint.getNemCode(), zsglPoint.getName()));
-                    wtResultList.add(PointUtil.createPointData(currentDate, 0, zyglPoint.getNemCode(), zyglPoint.getName()));
-                    //                    wtResultList.add(PointUtil.createPointData(currentDate, 0, kyglPoint.getNemCode(), kyglPoint.getName()));
                 }
             }
-
             //        });
         }
         edosUtil.sendMultiPoint(wtResultList);

+ 18 - 12
generationXK-service/src/main/java/com/gyee/generation/util/realtimesource/timeseries/JsonObjectHelper.java

@@ -186,20 +186,26 @@ public class JsonObjectHelper {
             }
             switch (type) {
                 case 0:
-                    data.setPointValue(String.valueOf(maxData.getString("doubleValue")));
-                    data.setPointValueInDouble(Double.valueOf(maxData.getString("doubleValue")));
-                    data.setPointTime(Long.valueOf(maxData.getString("ts")));
-                    break;
+                    if (null != maxData){
+                        data.setPointValue(String.valueOf(maxData.getString("doubleValue")));
+                        data.setPointValueInDouble(Double.valueOf(maxData.getString("doubleValue")));
+                        data.setPointTime(Long.valueOf(maxData.getString("ts")));
+                        break;
+                    }
                 case 1:
-                    data.setPointValue(String.valueOf(minData.getString("doubleValue")));
-                    data.setPointValueInDouble(Double.valueOf(minData.getString("doubleValue")));
-                    data.setPointTime(Long.valueOf(minData.getString("ts")));
-                    break;
+                    if (null != minData){
+                        data.setPointValue(String.valueOf(minData.getString("doubleValue")));
+                        data.setPointValueInDouble(Double.valueOf(minData.getString("doubleValue")));
+                        data.setPointTime(Long.valueOf(minData.getString("ts")));
+                        break;
+                    }
                 case 2:
-                    data.setPointValue(String.valueOf(avgData.getString("doubleValue")));
-                    data.setPointValueInDouble(Double.valueOf(avgData.getString("doubleValue")));
-                    data.setPointTime(Long.valueOf(avgData.getString("ts")));
-                    break;
+                    if (null != avgData){
+                        data.setPointValue(String.valueOf(avgData.getString("doubleValue")));
+                        data.setPointValueInDouble(Double.valueOf(avgData.getString("doubleValue")));
+                        data.setPointTime(Long.valueOf(avgData.getString("ts")));
+                        break;
+                    }
                 default:
                     break;
             }

+ 37 - 37
generationXK-service/src/test/java/com/gyee/generation/SaticScheduleCALTaskTest.java

@@ -50,46 +50,46 @@ public class SaticScheduleCALTaskTest {
 
     @Test
     public void all() throws Exception {
-        saticScheduleCALTask.status_powerRationing();
-        //        saticScheduleCALTask.status_powerRationing();//status_middleStatusReal
-        //        saticScheduleCALTask.status_statusReal();
-        //          saticScheduleCALTask.calculate_powerRationing();
-        //        saticScheduleCALTask.calculateStatusNumber();
+        //saticScheduleCALTask.status_powerRationing();
+        //saticScheduleCALTask.status_powerRationing();//status_middleStatusReal
+        //saticScheduleCALTask.status_statusReal();
+        //saticScheduleCALTask.calculate_powerRationing();
+        //saticScheduleCALTask.calculateStatusNumber();
 
         //saticSchedulePgTask.shutdown_All_STA();
 
-        //        saticScheduleCALTask.theoreticalPower_CAL();
-        //        saticScheduleCALTask.realtime_CAL();
-        //        saticScheduleCALTask.realtime_Wp_CAL();
-        //        saticScheduleCALTask.electricityMetering_CAL();
-
-        //        saticScheduleCALTask.accessStatus_CAL();
-        //        saticScheduleCALTask.cycleCalculation_CAL();
-
-
-        //        saticSchedulePgTask.inputOrOutPutSpeed_PG();
-        //        saticSchedulePgTask.inputOrOutPut_PG();
-        //        saticSchedulePgTask.shutdown_PG();
-
-        //        saticSchedulePgTask.equipment_PowerInfo1_PG();
-        //        saticSchedulePgTask.equipment_PowerInfo2_PG();
-        //        saticSchedulePgTask.equipment_PowerInfo3_PG();
-        //        saticSchedulePgTask.equipment_PowerInfo5_PG();
-        //        saticSchedulePgTask.equipment_PowerInfo4_PG();
-        //        saticSchedulePgTask.equipmentInfoDayTop_PG();
-        //        saticSchedulePgTask.wtAlysisDay_PG();
-
-        //        saticSchedulePgTask.windturbineGoodness_PG();
-        //        saticSchedulePgTask.calWindDeviation_PG();
-        //        saticSchedulePgTask.calFailRate_PG();
-        //        saticSchedulePgTask.brownouts_PG();
-        //
-        //        saticSchedulePgTask.windPowerInfo1_PG();
-        //        saticSchedulePgTask.windPowerInfo2_PG();
-        //        saticSchedulePgTask.windPowerInfo3_PG();
-        //        saticSchedulePgTask.windPowerInfo4_PG();
-        //        saticSchedulePgTask.windPowerInfo5_PG();
-        //        saticSchedulePgTask.windPowerInfo6_PG();
+        //saticScheduleCALTask.theoreticalPower_CAL();
+        saticScheduleCALTask.realtime_CAL();
+        //saticScheduleCALTask.realtime_Wp_CAL();
+        //saticScheduleCALTask.electricityMetering_CAL();
+
+        //saticScheduleCALTask.accessStatus_CAL();
+        //saticScheduleCALTask.cycleCalculation_CAL();
+
+
+        //saticSchedulePgTask.inputOrOutPutSpeed_PG();
+        //saticSchedulePgTask.inputOrOutPut_PG();
+        //saticSchedulePgTask.shutdown_PG();
+
+        //saticSchedulePgTask.equipment_PowerInfo1_PG();
+        //saticSchedulePgTask.equipment_PowerInfo2_PG();
+        //saticSchedulePgTask.equipment_PowerInfo3_PG();
+        //saticSchedulePgTask.equipment_PowerInfo5_PG();
+        //saticSchedulePgTask.equipment_PowerInfo4_PG();
+        //saticSchedulePgTask.equipmentInfoDayTop_PG();
+        //saticSchedulePgTask.wtAlysisDay_PG();
+
+        //saticSchedulePgTask.windturbineGoodness_PG();
+        //saticSchedulePgTask.calWindDeviation_PG();
+        //saticSchedulePgTask.calFailRate_PG();
+        //saticSchedulePgTask.brownouts_PG();
+
+        //saticSchedulePgTask.windPowerInfo1_PG();
+        //saticSchedulePgTask.windPowerInfo2_PG();
+        //saticSchedulePgTask.windPowerInfo3_PG();
+        //saticSchedulePgTask.windPowerInfo4_PG();
+        //saticSchedulePgTask.windPowerInfo5_PG();
+        //saticSchedulePgTask.windPowerInfo6_PG();
 
 
     }