Ver código fonte

添加日志输出

miaolijing 3 anos atrás
pai
commit
d0cf0c53bc

+ 1 - 1
src/main/java/com/persagy/apm/diagnose/feign/client/CenterMiddlewareClient.java

@@ -15,7 +15,7 @@ import com.alibaba.fastjson.JSONObject;
  * @Description 中间件
  * @createTime 2021/9/24 15:12
  */
-//@FeignClient(name = "CENTER-MIDDLEWARE",url="http://develop2.persagy.com/center-middleware")
+//@FeignClient(name = "CENTER-MIDDLEWARE",url="http://testibmp.scpgroup.com.cn/center-middleware")
 @FeignClient(name = "CENTER-MIDDLEWARE")
 public interface CenterMiddlewareClient {
 

+ 74 - 3
src/main/java/com/persagy/apm/diagnose/maintenance/service/impl/ProjectDataRecordServiceImpl.java

@@ -106,7 +106,8 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
                 // 获取不到锁,略过
                 return new AsyncResult<>("【监测维保数据计算线程】项目:" + projectDTO.getProjectId() + "被占用");
             }
-
+            Date startDate = com.persagy.apm.diagnose.utils.DateUtils.addDays(todayDate,-1);
+            computerWetBallTempMap(projectDTO,startDate,todayDate);
             long start = System.currentTimeMillis();
             AsyncResult<String> projectDTOBack = computeProjectMaintenanceData(todayDate, projectDTO);
             if (projectDTOBack != null) {
@@ -1101,10 +1102,10 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
                     List<TimeDataDTO> timeDataDTOList = new ArrayList<>();
                     for (WeatherDTO dto:dtoList) {
                         //根据温度和湿度 计算出湿空气焓值
-                        Double hVal = TwdTempUtil.getHVal(dto.getTemperature(),dto.getHumidity());
+                        Double hVal = getHVal(dto.getTemperature(),dto.getHumidity());
                         log.info("项目编号为:"+projectDTO.getProjectId()+"日期为:"+dto.getHourTime()+"温度:"+dto.getTemperature()+"湿度:"+dto.getHumidity());
                         //根据允许范围推出Tw值
-                        Double Tw = TwdTempUtil.getTw(dto.getTemperature(),hVal,TwdTemp_Limit);
+                        Double Tw = getTw(dto.getTemperature(),hVal,TwdTemp_Limit);
                         log.info("项目编号为:"+projectDTO.getProjectId()+"日期为:"+dto.getHourTime()+"温度:"+dto.getTemperature()+"湿度:"+dto.getHumidity()+"湿球温度:"+Tw);
                         //小时时间
                         Date hour = dto.getHourTime();
@@ -1156,5 +1157,75 @@ public class ProjectDataRecordServiceImpl implements IProjectDataRecordService {
         return null;
     }
 
+    /**
+     * 根据允许范围推出Tw值
+     */
+    public Double getTw(Double Td, Double hVal, Double limit){
+        Double Tw = Td-3;
+        Double num = 0.0;
+        Boolean isOk = false;
+        Boolean isTrueVal = false;
+        Integer zNum = 0,jNum = 0;
+        while (!isOk){
+            //湿空气焓值
+            Double hwVal = getHwVal(Tw);
+            //两种湿空气焓值  差值
+            Double hc = DataUtils.subtract(hVal,hwVal);
+            //判断范围
+            if (hc<limit && hc > 0.0){
+                isOk = true;
+                isTrueVal = true;
+            }else if (hc > 0){//hw 小于 h  增加湿球温度数据值
+                Tw = Tw + 0.25;
+                zNum++;
+            }else if (hc < 0){//hw 大于 h  减小湿球温度数据值
+                Tw = Tw - 0.25;
+                jNum++;
+            }
+            num++;
+            if (num > 20){
+                isOk = true;
+            }
+        }
+        if (isTrueVal){
+            return Tw;
+        }else {
+            if (zNum > 0 && jNum > 0){
+                return Tw;
+            }else{
+                return getTw(Td,hVal,limit+0.5);
+            }
+        }
+    }
+
+    /**
+     * 根据湿球温度计算出湿空气焓值
+     */
+    public double getHwVal(Double Tw){
+        Double eVal = (18.678-Tw/234.5)*Tw/(Tw+257.14);
+        Double ev= Math.exp(eVal);
+        Double Pv = 611.2 * ev; //Td时的水蒸汽饱和压力
+        //含湿量
+        Double dw = 0.6219*(Pv/(101326-Pv));
+        //湿空气焓值
+        Double hw = 1.01*Tw + (2500+1.84*Tw)*dw;
+        return hw;
+    }
+
+    /**
+     * 根据温度和湿度 计算出湿空气焓值
+     */
+    public double getHVal(Double Td,Double Hr){
+        Double eVal = (18.678-Td/234.5)*Td/(Td+257.14);
+        Double ev= Math.exp(eVal);
+        Double Pv = 611.2*ev; //Td时的水蒸汽饱和压力
+        Double hrPv = 0.01*Hr*Pv;
+        //含湿量
+        Double d = 0.6219*(hrPv/(101326-hrPv));
+        //湿空气焓值
+        Double h = 1.01*Td + (2500+1.84*Td)*d;
+        return h;
+    }
+
 
 }

+ 3 - 0
src/main/java/com/persagy/apm/diagnose/service/MaintenanceDataService.java

@@ -43,6 +43,9 @@ public class MaintenanceDataService {
         List<Future<String>> futureList = new ArrayList<>();
         CountDownLatch latch = new CountDownLatch(projectDTOList.size());
         for (ProjectDTO projectDTO : projectDTOList) {
+            if (!"Pj3302030001".equals(projectDTO.getProjectId())){
+                continue;
+            }
             futureList.add(projectDataRecordService.computeMaintenanceData(todayDate,projectDTO, latch));
         }
         //等待所有任务执行完