From c56e1e74426238939f229f0005828d05089715ff Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期四, 03 七月 2025 17:30:58 +0800
Subject: [PATCH] 2025.7.3 1. 新增动态污染溯源新的判定逻辑

---
 src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/SourceTraceController.kt            |   10 ++
 src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedData.kt               |   18 ++++
 src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedSource.kt             |   10 +
 src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuous.kt         |   29 ++++++
 src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/config/RTExcWindLevelConfig.kt      |   33 +++++++-
 src/main/kotlin/com/flightfeather/uav/socket/sender/MsgType.kt                            |    3 
 src/test/kotlin/com/flightfeather/uav/Test.kt                                             |    5 +
 src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuousSingle.kt   |    2 
 src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/RTExcChangeRate.kt    |   26 +++++-
 src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/BaseRTExcWindLevel.kt |   15 +++
 src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/RTWarnChangeRate.kt   |   20 +++++
 src/main/kotlin/com/flightfeather/uav/socket/eunm/FactorType.kt                           |    7 -
 src/main/kotlin/com/flightfeather/uav/model/epw/EPWDataPrep.kt                            |    4 
 src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/model/ExceptionType.kt             |   15 ++-
 src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedSummary.kt            |    3 
 15 files changed, 168 insertions(+), 32 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuous.kt b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuous.kt
index 2bfe2be..7193e08 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuous.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuous.kt
@@ -53,6 +53,16 @@
     }
 
     /**
+     * 鍒ゆ柇鏁版嵁閲忕骇鍦ㄥ紓甯稿垽鏂殑鑼冨洿鍐�
+     * 榛樿鎵�鏈夐噺绾ч兘鍦ㄥ紓甯稿垽鏂殑鑼冨洿鍐�
+     */
+    open fun judgeDataScale(p: BaseRealTimeData?, n: BaseRealTimeData): MutableMap<FactorType, Boolean> {
+        val res = mutableMapOf<FactorType, Boolean>()
+        config.factorFilter.mainList().forEach { f -> res[f] = true }
+        return res
+    }
+
+    /**
      * 鍒ゆ柇鍓嶅悗鏁版嵁鏄惁婊¤冻寮傚父鏉′欢
      */
     abstract fun judgeException(p: BaseRealTimeData?, n: BaseRealTimeData): MutableMap<FactorType, Boolean>
@@ -62,6 +72,19 @@
      * @param tag 寮傚父鏁版嵁瀵硅薄
      */
     abstract fun judgeExceptionCount(tag: T, factorType: FactorType?): Boolean
+
+    /**
+     * 鍒ゆ柇鐩戞祴鍥犲瓙鏄惁鍑虹幇寮傚父
+     */
+    open fun judge(p: BaseRealTimeData?, n: BaseRealTimeData): MutableMap<FactorType, Boolean> {
+        val jds = judgeDataScale(p, n)
+        val jex = judgeException(p, n)
+        val res = mutableMapOf<FactorType, Boolean>()
+        jds.forEach { (t, u) ->
+            res[t] = u && jex[t] ?: false
+        }
+        return res
+    }
 
     /**
      * 寮傚父鏁版嵁鐨勬埅鍙栧垽鏂�
@@ -83,7 +106,7 @@
 
     override fun onNextData(data: BaseRealTimeData) {
         val isContinue = isContinuous(lastData, data)
-        val hasException = judgeException(lastData, data)
+        val hasException = judge(lastData, data)
         config.factorFilter.selectedList.forEach { s ->
             val f = s.main
             tagMap[f]?.let {
@@ -114,7 +137,7 @@
                 // 3. 鏁版嵁姝e父锛屾棤浠讳綍寮傚父鏃禿
                 // TODO("2025.6.3锛氬叾浠栧瓙绫荤殑姝ゅ鍒锋柊閫昏緫寰呭畬鎴愨��)
                 else {
-                    it.refreshWithNoException(data)
+                    it.refreshWithNextException(data)
                 }
             }
         }
@@ -149,7 +172,7 @@
         } else {
             config.factorFilter.selectedList.forEach { f ->
                 val tag1 = tagMap[f.main] ?: return@forEach
-                if (tag1.exceptionExisted && judgeExceptionCount(tag1, null)) {
+                if (tag1.exceptionExisted && judgeExceptionCount(tag1, f.main)) {
                     onNewException(tag1, f, exceptionStatus)
                 }
             }
diff --git a/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuousSingle.kt b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuousSingle.kt
index 1abfb01..cd592ab 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuousSingle.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuousSingle.kt
@@ -11,7 +11,7 @@
 
     override fun onNextData(data: BaseRealTimeData) {
         val isContinue = isContinuous(lastData, data)
-        val hasException = judgeException(lastData, data)
+        val hasException = judge(lastData, data)
         config.factorFilter.selectedList.forEach { s ->
             val f = s.main
             tagMap[f]?.let {
diff --git a/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/model/ExceptionType.kt b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/model/ExceptionType.kt
index dac7f89..a80de91 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/model/ExceptionType.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/model/ExceptionType.kt
@@ -1,14 +1,15 @@
 package com.flightfeather.uav.biz.dataanalysis.model
 
 enum class ExceptionType(val value:Int, val des:String) {
-    TYPE0(0, "鏁版嵁缂哄け寮傚父"),
-    TYPE1(1, "鏁版嵁瓒呬綆寮傚父"),
+    TYPE0(0, "鏁版嵁缂哄け"),
+    TYPE1(1, "鏁版嵁瓒呬綆"),
     TYPE2(2, "鏁版嵁瓒呮爣"),
     TYPE3(3, "鏁版嵁闀挎椂娈垫棤娉㈠姩"),
-    TYPE4(4, "閲忕骇绐佸彉寮傚父"),
-    TYPE5(5, "涓磋繎瓒呮爣寮傚父"),
-    TYPE6(6, "鍗曟棩瓒呮爣娆℃暟涓磋繎澶勭綒寮傚父"),
-    TYPE7(7, "婊戝姩骞冲潎鍊肩獊鍙樺紓甯�"),
+    TYPE4(4, "閲忕骇绐佸彉"),
+    TYPE5(5, "涓磋繎瓒呮爣"),
+    TYPE6(6, "鍗曟棩瓒呮爣娆℃暟涓磋繎澶勭綒"),
+    TYPE7(7, "婊戝姩骞冲潎鍊肩獊鍙�"),
     TYPE8(8, "鏈夋晥鐜囧紓甯�"),
-    TYPE9(9, "鍙樺寲閫熺巼寮傚父"),
+    TYPE9(9, "蹇�熶笂鍗�"),
+    TYPE10(10, "蹇�熶笅闄�")
 }
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/SourceTraceController.kt b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/SourceTraceController.kt
index 662cd6b..9c522a0 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/SourceTraceController.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/SourceTraceController.kt
@@ -72,6 +72,7 @@
             add(RTExcWindLevel4(config) { exceptionCallback(it) }.also { it.init() })
             add(RTExcWindLevel6(config) { exceptionCallback(it) }.also { it.init() })
             add(RTExcChangeRate(config) { exceptionCallback(it) }.also { it.init() })
+            add(RTWarnChangeRate(config) { dataChangeCallback(it) }.also { it.init() })
         }
     }
 
@@ -110,6 +111,15 @@
         pollutedSummary.addClue(ex)
     }
 
+    // 鏁版嵁鍙樺寲鎻愰啋鍥炶皟
+    private fun dataChangeCallback(ex: PollutedClue) {
+        // 婧簮姹℃煋婧愪俊鎭�
+        ex.searchScenes(sceneInfoRep)
+
+        // 骞挎挱鏁版嵁鍙樺寲鎻愰啋
+        UnderwayWebSocketSender.broadcast(MsgType.DataChange.value, ex)
+    }
+
     private fun summaryCallback(ex: PollutedSummary.AnalysisResult) {
         // 骞挎挱姹℃煋婧簮寮傚父缁撴灉
         UnderwayWebSocketSender.broadcast(MsgType.AnaResult.value, ex)
diff --git a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/config/RTExcWindLevelConfig.kt b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/config/RTExcWindLevelConfig.kt
index 1bbd6b4..d39d51d 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/config/RTExcWindLevelConfig.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/config/RTExcWindLevelConfig.kt
@@ -28,7 +28,7 @@
     // 瀹氭椂绾跨储鍒嗘瀽鏃堕棿闂撮殧(鍗曚綅锛氬垎閽�)
     var analysisPeriod = 15
     // 瀹氭椂鍒嗘瀽闂撮殧涓紝绔嬪嵆杩涜绾跨储鍒嗘瀽鐨勬渶灏忕嚎绱㈤噺(鍗曚綅锛氫釜)
-    var analysisCount = 2
+    var analysisCount = 4
 
     /****鏁版嵁绐佸彉*****************************************************************************/
     // 0 - 1绾ч
@@ -52,8 +52,8 @@
         1.6 to 7.9,
         0.2 to Double.MAX_VALUE,
         DistanceType.TYPE3,
-//        3
-        1
+        3
+//        1
     )
 
     // 5 - 6绾ч
@@ -64,7 +64,7 @@
         3
     )
 
-    /****鏁版嵁鍙樺寲閫熺巼*****************************************************************************/
+    /****鏁版嵁蹇�熶笂鍗�*****************************************************************************/
     var changeRateCondition = WindLevelCondition(
         .0 to Double.MAX_VALUE,
         0.1 to Double.MAX_VALUE,
@@ -72,7 +72,7 @@
         3
     )
     // 鐩戞祴鍥犲瓙鍦ㄤ竴涓洃娴嬪懆鏈燂紙4绉掞級鍐呮甯稿彉鍖栫殑閲忕骇鑼冨洿
-    var changeRate = mutableMapOf(
+    var changeRateUp = mutableMapOf(
         FactorType.PM25 to WindLevelCondition(
             .0 to Double.MAX_VALUE,
             4.0 to Double.MAX_VALUE,
@@ -92,4 +92,27 @@
             1
         ),
     )
+
+    /****鏁版嵁蹇�熶笅闄�*****************************************************************************/
+    // 鐩戞祴鍥犲瓙鍦ㄤ竴涓洃娴嬪懆鏈燂紙4绉掞級鍐呮甯稿彉鍖栫殑閲忕骇鑼冨洿
+    var changeRateDown = mutableMapOf(
+        FactorType.PM25 to WindLevelCondition(
+            .0 to Double.MAX_VALUE,
+            -Double.MAX_VALUE to -2.0,
+            DistanceType.TYPE1,
+            3
+        ),
+        FactorType.PM10 to WindLevelCondition(
+            .0 to Double.MAX_VALUE,
+            -Double.MAX_VALUE to -2.0,
+            DistanceType.TYPE1,
+            3
+        ),
+        FactorType.VOC to WindLevelCondition(
+            .0 to Double.MAX_VALUE,
+            -Double.MAX_VALUE to -3.0,
+            DistanceType.TYPE1,
+            3
+        ),
+    )
 }
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/BaseRTExcWindLevel.kt b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/BaseRTExcWindLevel.kt
index f78fd15..84933af 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/BaseRTExcWindLevel.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/BaseRTExcWindLevel.kt
@@ -37,9 +37,22 @@
         return ExceptionType.TYPE4
     }
 
+    override fun judgeDataScale(p: BaseRealTimeData?, n: BaseRealTimeData): MutableMap<FactorType, Boolean> {
+        val res = mutableMapOf<FactorType, Boolean>()
+        config.factorFilter.mainList().forEach { f ->
+            if (p?.getByFactorType(f) == null || n.getByFactorType(f) == null || n.windSpeed == null) {
+                res[f] = (false)
+                return@forEach
+            }
+            val nValue = n.getByFactorType(f)!!
+            val minValue = FactorType.getVMin(f)
+            res[f] = nValue >= minValue
+        }
+        return res
+    }
+
     override fun judgeException(p: BaseRealTimeData?, n: BaseRealTimeData): MutableMap<FactorType, Boolean> {
         val res = mutableMapOf<FactorType, Boolean>()
-        println()
         config.factorFilter.mainList().forEach { f ->
             if (p?.getByFactorType(f) == null || n.getByFactorType(f) == null || n.windSpeed == null) {
                 res[f] = (false)
diff --git a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/RTExcChangeRate.kt b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/RTExcChangeRate.kt
index c6360d3..f07fd1c 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/RTExcChangeRate.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/RTExcChangeRate.kt
@@ -19,7 +19,7 @@
  * @date 2025/6/10
  * @author feiyu02
  */
-class RTExcChangeRate(config: RTExcWindLevelConfig) :
+open class RTExcChangeRate(config: RTExcWindLevelConfig) :
     BaseExceptionContinuous<ExceptionTag, RTExcWindLevelConfig, PollutedClue>(config, ExceptionTag::class.java) {
 
     constructor(config: RTExcWindLevelConfig, callback: NewPolluteClueCallback) : this(config){
@@ -28,8 +28,24 @@
 
     private var callback: NewPolluteClueCallback? = null
 
+    open var changeRate = this.config.changeRateUp
+
     override fun getExceptionType(): ExceptionType {
         return ExceptionType.TYPE9
+    }
+
+    override fun judgeDataScale(p: BaseRealTimeData?, n: BaseRealTimeData): MutableMap<FactorType, Boolean> {
+        val res = mutableMapOf<FactorType, Boolean>()
+        config.factorFilter.mainList().forEach { f ->
+            if (p?.getByFactorType(f) == null || n.getByFactorType(f) == null || n.windSpeed == null) {
+                res[f] = (false)
+                return@forEach
+            }
+            val nValue = n.getByFactorType(f)!!
+            val minValue = FactorType.getVMin(f)
+            res[f] = nValue >= minValue
+        }
+        return res
     }
 
     override fun judgeException(p: BaseRealTimeData?, n: BaseRealTimeData): MutableMap<FactorType, Boolean> {
@@ -40,7 +56,7 @@
                 return@forEach
             }
 
-            val rate = config.changeRate[f]
+            val rate = changeRate[f]
 
             val pValue = p.getByFactorType(f)!!
             val nValue = n.getByFactorType(f)!!
@@ -48,7 +64,7 @@
             val v = (nValue - pValue)
 
             val b1 = if (rate != null) {
-                v >= rate.mutationRate.first
+                v in rate.mutationRate.first..rate.mutationRate.second
             } else {
                 false
             }
@@ -61,7 +77,7 @@
     }
 
     override fun judgeExceptionCount(tag: ExceptionTag, factorType: FactorType?): Boolean {
-        return tag.exceptionData.size >= (config.changeRate[factorType]?.countLimit ?: 1)
+        return tag.exceptionData.size >= (changeRate[factorType]?.countLimit ?: 1)
     }
 
     override fun needCut(tag: ExceptionTag, hasException: Boolean?): Boolean {
@@ -97,7 +113,7 @@
     }
 
     override fun newResult(tag: ExceptionTag, factor: FactorFilter.SelectedFactor): PollutedClue {
-        return PollutedClue(tag, factor, getExceptionType(), config, config.changeRate[factor.main])
+        return PollutedClue(tag, factor, getExceptionType(), config, changeRate[factor.main])
     }
 
     override fun onNewException(
diff --git a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/RTWarnChangeRate.kt b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/RTWarnChangeRate.kt
new file mode 100644
index 0000000..7dce4e3
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/RTWarnChangeRate.kt
@@ -0,0 +1,20 @@
+package com.flightfeather.uav.biz.sourcetrace.exceptiontype
+
+import com.flightfeather.uav.biz.dataanalysis.model.ExceptionType
+import com.flightfeather.uav.biz.sourcetrace.config.RTExcWindLevelConfig
+
+/**
+ * 鏁版嵁蹇�熶笅闄嶆彁閱�
+ * @date 2025/7/3
+ * @author feiyu02
+ */
+class RTWarnChangeRate : RTExcChangeRate {
+    constructor(config: RTExcWindLevelConfig):super(config)
+    constructor(config: RTExcWindLevelConfig, callback: NewPolluteClueCallback) : super(config, callback)
+
+    override fun getExceptionType(): ExceptionType {
+        return ExceptionType.TYPE10
+    }
+
+    override var changeRate = config.changeRateDown
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedData.kt b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedData.kt
index 4a599d7..5661859 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedData.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedData.kt
@@ -59,6 +59,7 @@
         historyDataList.addAll(historyData.map { it.toDataVo() })
 
         calPer()
+        calRate()
     }
 
     var deviceCode: String? = null
@@ -85,6 +86,8 @@
     var percentage: Double? = null
     // 鍥犲瓙閲忕骇骞冲潎鍙樺寲骞呭害
     var avgPer: Double? = null
+    // 鍥犲瓙閲忕骇骞冲潎鍙樺寲閫熺巼
+    var avgRate: Double? = null
 
     // 鍙戠敓娆℃暟
     var times: Int? = null
@@ -108,4 +111,19 @@
         }
         avgPer = total / (list.size - 1)
     }
+
+    private fun calRate() {
+        val list = dataList
+//        list.add(startData)
+//        list.addAll(dataList)
+        if (list.size < 2) return
+
+        var total = .0
+        for (i in 0 until list.size - 1) {
+            val p = list[i]?.getByFactorType(selectedFactor!!.main)!!
+            val n = list[i + 1]?.getByFactorType(selectedFactor!!.main)!!
+            total += (n - p) / 4
+        }
+        avgRate = total / (list.size - 1)
+    }
 }
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedSource.kt b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedSource.kt
index d74ceaa..1543d33 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedSource.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedSource.kt
@@ -107,18 +107,22 @@
             FactorType.PM25,
             FactorType.PM10,
                 -> {
+                val pm25Avg = round(pollutedData.dataList.map { it.pm25!! }.average() * 10) / 10
+                val pm10Avg = round(pollutedData.dataList.map { it.pm10!! }.average() * 10) / 10
                 // 璁$畻寮傚父鏁版嵁鐨刾m2.5鍗爌m10姣旈噸鐨勫潎鍊�
                 val percentageAvg = pollutedData.dataList.map {
                     it.pm25!! / it.pm10!!
                 }.average()
+                val str =
+                    "PM2.5閲忕骇涓�${pm25Avg}渭g/m鲁锛孭M10閲忕骇涓�${pm25Avg}渭g/m鲁锛孭M2.5鍗燩M10鐨勬瘮閲嶄负${round(percentageAvg * 100)}%"
                 return if (percentageAvg > 0.666) {
-                    "PM2.5鍗燩M10鐨勬瘮閲嶄负${round(percentageAvg * 100)}%锛屾瘮閲嶈緝澶э紝姹℃煋婧愪互椁愰ギ涓轰富锛屽伐鍦版涔�" to
+                    "${str}锛屾瘮閲嶈緝澶э紝姹℃煋婧愪互椁愰ギ涓轰富锛屽伐鍦版涔�" to
                             listOf(SceneType.TYPE1, SceneType.TYPE2, SceneType.TYPE3, SceneType.TYPE14, SceneType.TYPE5)
                 } else if (percentageAvg < 0.333) {
-                    "PM2.5鍗燩M10鐨勬瘮閲嶄负${round(percentageAvg * 100)}%锛屾瘮閲嶈緝灏忥紝灞炰簬澶ч绮掓壃灏樻薄鏌擄紝姹℃煋婧愪互宸ュ湴涓轰富" to
+                    "${str}锛屾瘮閲嶈緝灏忥紝灞炰簬澶ч绮掓壃灏樻薄鏌擄紝姹℃煋婧愪互宸ュ湴涓轰富" to
                             listOf(SceneType.TYPE1, SceneType.TYPE2, SceneType.TYPE3, SceneType.TYPE14, SceneType.TYPE5)
                 } else {
-                    "PM2.5鍗燩M10鐨勬瘮閲嶄负${round(percentageAvg * 100)}%锛屾薄鏌撴簮浠ラ楗�佸伐鍦颁负涓�" to
+                    "${str}锛屾薄鏌撴簮浠ラ楗�佸伐鍦颁负涓�" to
                             listOf(SceneType.TYPE1, SceneType.TYPE2, SceneType.TYPE3, SceneType.TYPE14, SceneType.TYPE5)
                 }
             }
diff --git a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedSummary.kt b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedSummary.kt
index 58b3e29..53532f6 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedSummary.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedSummary.kt
@@ -168,7 +168,8 @@
             val closetScene = result.sortedSceneList?.first()
             // 璧拌埅璺嚎璋冩暣寤鸿
             result.advice =
-                "鏍规嵁${sT}鑷�${eT}鐨�${clueList.size}鏉℃渶鏂版薄鏌撶嚎绱紝姹℃煋婧愩��${closetScene?.first?.name}銆戣澶氭婧簮锛屽叿鏈夎緝楂樻薄鏌撻闄╋紝鐜版彁渚涙柊鐨勮蛋鑸帹鑽愯矾绾匡紝鍙粡杩囪姹℃煋婧愩��"
+                "鏍规嵁${sT}鑷�${eT}鐨�${clueList.size}鏉℃函婧愬垏鐗囷紝椋庨櫓婧愩��" +
+                        "${closetScene?.first?.name}銆戣澶氭婧簮锛屽叿鏈夎緝楂樻薄鏌撻闄╋紝鐜版彁渚涙柊鐨勮蛋鑸帹鑽愯矾绾匡紝鍙粡杩囪姹℃煋婧愩��"
 
             val lastP = realTimeDataList.last()
             // 寤鸿瀵瑰簲鐨勬暟鎹噰鏍锋椂闂�
diff --git a/src/main/kotlin/com/flightfeather/uav/model/epw/EPWDataPrep.kt b/src/main/kotlin/com/flightfeather/uav/model/epw/EPWDataPrep.kt
index 40bfa5a..45f9b80 100644
--- a/src/main/kotlin/com/flightfeather/uav/model/epw/EPWDataPrep.kt
+++ b/src/main/kotlin/com/flightfeather/uav/model/epw/EPWDataPrep.kt
@@ -82,7 +82,7 @@
                 val it = mDataList[i].values?.get(y) ?: continue
 
                 if (!calTypes.contains(it.factorName)) continue
-                val vMax = FactorType.getVMax(it.factorName) ?: continue
+                val vMax = FactorType.getVMin(it.factorName) ?: continue
                 it.factorData ?: continue
 
                 if (it.factorData!! > vMax) {
@@ -150,7 +150,7 @@
         while (i < mDataList.size) {
             for (y in mDataList[i].values?.indices ?: 0..0) {
                 val it = mDataList[i].values?.get(y) ?: continue
-                val vMax = FactorType.getVMax(it.factorName) ?: continue
+                val vMax = FactorType.getVMin(it.factorName) ?: continue
                 it.factorData ?: continue
 
                 if (it.factorData!! > vMax) {
diff --git a/src/main/kotlin/com/flightfeather/uav/socket/eunm/FactorType.kt b/src/main/kotlin/com/flightfeather/uav/socket/eunm/FactorType.kt
index 9874aa7..bd019b6 100644
--- a/src/main/kotlin/com/flightfeather/uav/socket/eunm/FactorType.kt
+++ b/src/main/kotlin/com/flightfeather/uav/socket/eunm/FactorType.kt
@@ -125,9 +125,9 @@
             else -> null
         }
 
-        fun getVMax(name: String?): Double? {
+        fun getVMin(name: String?): Double? {
             getByName(name)?.let {
-                return getVMax(it)
+                return getVMin(it)
             }
             return null
         }
@@ -135,7 +135,7 @@
         /**
          * 涓嶅鐞嗕綆浜庢鍊肩殑鍊�
          */
-        fun getVMax(type: FactorType): Double? = when (type) {
+        fun getVMin(type: FactorType): Double = when (type) {
             NO -> 1.0
             NO2 -> 10.0
             CO -> 100.0
@@ -155,7 +155,6 @@
             WIND_SPEED -> 2.0
             WIND_DIRECTION -> 0.0
             HEIGHT -> 0.0
-            else -> null
         }
 
         /**
diff --git a/src/main/kotlin/com/flightfeather/uav/socket/sender/MsgType.kt b/src/main/kotlin/com/flightfeather/uav/socket/sender/MsgType.kt
index be86205..6aba55f 100644
--- a/src/main/kotlin/com/flightfeather/uav/socket/sender/MsgType.kt
+++ b/src/main/kotlin/com/flightfeather/uav/socket/sender/MsgType.kt
@@ -15,4 +15,7 @@
      * @see [PollutedSummary.AnalysisResult]
      */
     AnaResult(2),
+
+    // 鏁版嵁鍙樺寲鎻愰啋锛堥潪寮傚父锛�
+    DataChange(3),
 }
\ No newline at end of file
diff --git a/src/test/kotlin/com/flightfeather/uav/Test.kt b/src/test/kotlin/com/flightfeather/uav/Test.kt
index eca3219..4941af9 100644
--- a/src/test/kotlin/com/flightfeather/uav/Test.kt
+++ b/src/test/kotlin/com/flightfeather/uav/Test.kt
@@ -163,4 +163,9 @@
 
         println("${period?.first};${period?.second};${period?.third}")
     }
+
+    @Test
+    fun foo18() {
+        println(-4.382398 in 4.0..Double.MAX_VALUE)
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3