소스 검색

解冻开机修改

songhaodong 2 년 전
부모
커밋
fde014bc8f
1개의 변경된 파일84개의 추가작업 그리고 38개의 파일을 삭제
  1. 84 38
      ipfcst/ipfcst-console/src/main/java/com/jiayue/ipfcst/fileupload/job/UploadFileMatoushanJob.java

+ 84 - 38
ipfcst/ipfcst-console/src/main/java/com/jiayue/ipfcst/fileupload/job/UploadFileMatoushanJob.java

@@ -153,7 +153,7 @@ public class UploadFileMatoushanJob extends BaseService {
     }
     // 是否开启了解冻开机
     if(yesorno_start_thaw_boot.equals("1")){
-      icingShutdownList = parkedWindTurbine();
+      icingShutdownList = thawBoot();
     }
     for (Nwp nwp: listTemperature) {
 
@@ -226,6 +226,7 @@ public class UploadFileMatoushanJob extends BaseService {
           forecastPowerShortTerm.setFpValue(NumberUtil.round(totalPower/1000 - 2 * icingShutdown.getShutDownNumber(),2));
         }
       }
+
       // 解冻开机
       for(IcingShutdown icingShutdown:icingShutdownList){
         if(icingShutdown.getStartTime() < nwp.getPreTime() && nwp.getPreTime() < icingShutdown.getEndTime()){
@@ -233,7 +234,6 @@ public class UploadFileMatoushanJob extends BaseService {
         }
       }
 
-
       // 计算超装机容量设置为92.7
       if(forecastPowerShortTerm.getFpValue().compareTo(new BigDecimal(93))> 0 ){
         forecastPowerShortTerm.setFpValue(BigDecimal.valueOf(random()));
@@ -316,7 +316,7 @@ public class UploadFileMatoushanJob extends BaseService {
     String modleFanId = fanUnitInfoRepository.findAll().get(0).getBenchmarkFan();
     AtomicReference<Float> modleFanSpeed = new AtomicReference<>(0f);
 
-    //按照4个风向分组,以风向为key,每个风向的数据为value list
+    //按照8个风向分组,以风向为key,每个风向的数据为value list
     Map<Integer, List<WindSpeedPointInfo>> map = WindSpeedPointInfos.stream().collect(Collectors.groupingBy(WindSpeedPointInfo::getWind));
 
     map.forEach((wind, v) -> {
@@ -604,9 +604,9 @@ public class UploadFileMatoushanJob extends BaseService {
    */
   public List<IcingShutdown> thawBoot(){
     // 解冻间隔时间 马头山
-    String thawing_interval_m = super.getSysParameter("THAWING_INTERVAL_M", "1");
+    Integer thawing_interval_m = Integer.parseInt(super.getSysParameter("THAWING_INTERVAL_M", "1"));
     // 解冻间隔时间 将军山
-    String thawing_interval_j = super.getSysParameter("THAWING_INTERVAL_J", "1.2");
+    Integer thawing_interval_j = Integer.parseInt(super.getSysParameter("THAWING_INTERVAL_J", "1.2"));
     // 开机温度
     String thawing_interval_temperature = super.getSysParameter("THAWING_INTERVAL_TEMPERATURE", "-1");
     // 系统时间
@@ -624,53 +624,99 @@ public class UploadFileMatoushanJob extends BaseService {
 
     Integer ifOfCount = 0;
     Integer ifOfCountM = 0;
-    log.info("执行解冻开机方法开始,系统时间:"+ new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
+    Integer forM = 0;
+    Integer forJ = 0;
+
+    if(thawing_interval_m > 0 && thawing_interval_m <= 1){
+      forM = 4;
+    }else if(thawing_interval_m > 1 && thawing_interval_m <= 1.2){
+      forM = 5;
+    }else if(thawing_interval_m > 1.2 && thawing_interval_m <= 1.4){
+      forM = 6;
+    }else if(thawing_interval_m > 1.4 && thawing_interval_m <= 1.6){
+      forM = 7;
+    }else if(thawing_interval_m > 1.6 && thawing_interval_m <= 2){
+      forM = 8;
+    }
+
+    if(thawing_interval_j > 0 && thawing_interval_j <= 1){
+      forJ = 4;
+    }else if(thawing_interval_j > 1 && thawing_interval_j <= 1.2){
+      forJ = 5;
+    }else if(thawing_interval_j > 1.2 && thawing_interval_j <= 1.4){
+      forJ = 6;
+    }else if(thawing_interval_j > 1.4 && thawing_interval_j <= 1.6){
+      forJ = 7;
+    }else if(thawing_interval_j > 1.6 && thawing_interval_j <= 2){
+      forJ = 8;
+    }
+    log.info("执行解冻开机方法开始,系统时间:"+ DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
     // 停机台数大于0
     if(Integer.parseInt(shut_down_number) > 0) {
       for (int i = 0; i < nwpData.size(); i++) {
         if (Integer.parseInt(shut_down_number) > 0) {
           // 当前点温度是否高于解冻温度  并判断下一小时内四个点的温度
-          if(nwpData.get(i).getT().compareTo(new BigDecimal(thawing_interval_temperature)) > 0){
-            if(nwpData.get(i+1).getT().compareTo(new BigDecimal(thawing_interval_temperature)) > 0){
-              if(nwpData.get(i+2).getT().compareTo(new BigDecimal(thawing_interval_temperature)) > 0){
-                if(nwpData.get(i+3).getT().compareTo(new BigDecimal(thawing_interval_temperature)) > 0){
-                  if(nwpData.get(i+4).getT().compareTo(new BigDecimal(thawing_interval_temperature)) > 0){
-                    ifOfCount = ifOfCount + 1;
-                    Long preTime = nwpData.get(i).getPreTime();
-                    Long preTimeJ = DateUtil.offsetHour(new Date(preTime),Integer.parseInt(thawing_interval_j)).getTime();
-                    Long preTimeM = DateUtil.offsetHour(new Date(preTime),Integer.parseInt(thawing_interval_m)).getTime();
-                    icingShutdown.setStartTime(preTime);
-                    icingShutdown.setEndTime(preTimeJ);
-                    icingShutdown.setShutDownNumber(ifOfCount);
-                    ifOfCountM = ifOfCountM + 1;
-                    icingShutdowns.add(icingShutdown);
-                    icingShutdownM.setStartTime(preTime);
-                    icingShutdownM.setEndTime(preTimeM);
-                    icingShutdownM.setShutDownNumber(ifOfCountM);
-                    i += 4;
-                  }else{
-                    continue;
-                  }
-                }else{
-                  continue;
-                }
-              }else{
-                continue;
-              }
-            }else{
-              continue;
+          for (int j = i; j <= forJ; j++){
+            if(nwpData.get(i).getT().compareTo(new BigDecimal(thawing_interval_temperature)) > 0) {
+              ifOfCount = ifOfCount + 1;
+              Long preTime = nwpData.get(j).getPreTime();
+              Long preTimeJ = DateUtil.offsetHour(new Date(preTime), thawing_interval_j).getTime();
+              icingShutdown.setStartTime(preTime);
+              icingShutdown.setEndTime(preTimeJ);
+              icingShutdown.setShutDownNumber(ifOfCount);
+            }
+          }
+          for (int k = i; k <= forM; k++) {
+            if (nwpData.get(i).getT().compareTo(new BigDecimal(thawing_interval_temperature)) > 0) {
+              ifOfCountM = ifOfCountM + 1;
+              Long preTime = nwpData.get(k).getPreTime();
+              Long preTimeM = DateUtil.offsetHour(new Date(preTime), thawing_interval_m).getTime();
+              icingShutdownM.setStartTime(preTime);
+              icingShutdownM.setEndTime(preTimeM);
+              icingShutdownM.setShutDownNumber(ifOfCountM);
             }
-          }else{
-            continue;
           }
         }
       }
     }
-    log.info("执行解冻开机方法结束,系统时间:"+ new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
+    log.info("执行解冻开机方法结束,系统时间:"+ DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
 
     return icingShutdowns;
   }
 
+//            if(nwpData.get(i).getT().compareTo(new BigDecimal(thawing_interval_temperature)) > 0){
+//    if(nwpData.get(i+1).getT().compareTo(new BigDecimal(thawing_interval_temperature)) > 0){
+//      if(nwpData.get(i+2).getT().compareTo(new BigDecimal(thawing_interval_temperature)) > 0){
+//        if(nwpData.get(i+3).getT().compareTo(new BigDecimal(thawing_interval_temperature)) > 0){
+//          if(nwpData.get(i+4).getT().compareTo(new BigDecimal(thawing_interval_temperature)) > 0){
+//            ifOfCount = ifOfCount + 1;
+//            Long preTime = nwpData.get(i).getPreTime();
+//            Long preTimeJ = DateUtil.offsetHour(new Date(preTime),thawing_interval_j).getTime();
+//            Long preTimeM = DateUtil.offsetHour(new Date(preTime),Integer.parseInt(thawing_interval_m)).getTime();
+//            icingShutdown.setStartTime(preTime);
+//            icingShutdown.setEndTime(preTimeJ);
+//            icingShutdown.setShutDownNumber(ifOfCount);
+//            ifOfCountM = ifOfCountM + 1;
+//            icingShutdowns.add(icingShutdown);
+//            icingShutdownM.setStartTime(preTime);
+//            icingShutdownM.setEndTime(preTimeM);
+//            icingShutdownM.setShutDownNumber(ifOfCountM);
+//            i += 4;
+//          }else{
+//            continue;
+//          }
+//        }else{
+//          continue;
+//        }
+//      }else{
+//        continue;
+//      }
+//    }else{
+//      continue;
+//    }
+//  }else{
+//    continue;
+//  }
 
 
   /**