From caf2599a9869244ded811018811c37a2aabac3fc Mon Sep 17 00:00:00 2001 From: vince <757871790@qq.com> Date: 星期三, 08 一月 2025 11:29:05 +0800 Subject: [PATCH] 优化测温协议 --- src/main/java/com/fzzy/protocol/youxian0/analysis/AnalysisService.java | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/fzzy/protocol/youxian0/analysis/AnalysisService.java b/src/main/java/com/fzzy/protocol/youxian0/analysis/AnalysisService.java index 0d38c29..75489e9 100644 --- a/src/main/java/com/fzzy/protocol/youxian0/analysis/AnalysisService.java +++ b/src/main/java/com/fzzy/protocol/youxian0/analysis/AnalysisService.java @@ -257,11 +257,11 @@ GrainOutPut outPut = new GrainOutPut(); - double max = ReMessageBuilder.MAX_TEMP, min = ReMessageBuilder.MIN_TEMP, sumT = 0.0, sumNum = cableX * cableY * cableZ; + double max = ReMessageBuilder.MAX_TEMP, min = ReMessageBuilder.MIN_TEMP, sumT = 0.0; List<GrainTemp> temperature = new ArrayList<>(); //鏍瑰彿 - int cableNum = 1, position = 0; + int cableNum = 1, position = 0,sumNum = 0; double curTemp; int x = 0, y = 0, z = 0; @@ -277,12 +277,15 @@ temperature.add(new GrainTemp(cableNum + "", z + "", curTemp + "", position + "")); - sumT += curTemp; - if (curTemp > max) { + if (curTemp > max && curTemp < 40) { max = curTemp; } - if (curTemp < min) { + if (curTemp < min && curTemp > 3) { min = curTemp; + } + if(curTemp > 3 && curTemp < 40){ + sumT += curTemp; + sumNum++; } } @@ -328,7 +331,7 @@ weatherStation.setId(device.getDeviceId()); } weatherStation.setAirPressure(weather.getPressure()); - weatherStation.setHumidity(weather.getHumidity()); + weatherStation.setHumidity(weather.getHumidity().replaceAll("%","")); weatherStation.setPm(weather.getAir_pm25()); weatherStation.setRadiation("0"); weatherStation.setRainfallAmount(weather.getWea()); -- Gitblit v1.9.3