feiyu02
2025-07-21 38d72198bfcced01ed9513b978163e5cd1d84625
src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionValueMutation.kt
@@ -1,7 +1,7 @@
package com.flightfeather.uav.biz.dataanalysis.exceptiontype
import com.flightfeather.uav.biz.dataanalysis.BaseExceptionContinuous
import com.flightfeather.uav.biz.dataanalysis.model.DataAnalysisConfig
import com.flightfeather.uav.biz.dataanalysis.model.ExceptionTag
import com.flightfeather.uav.biz.dataanalysis.model.ExceptionType
import com.flightfeather.uav.domain.entity.BaseRealTimeData
import com.flightfeather.uav.socket.eunm.FactorType
@@ -10,7 +10,7 @@
/**
 * 量级突变异常分析
 */
class ExceptionValueMutation(config: DataAnalysisConfig) : BaseExceptionContinuous(config) {
class ExceptionValueMutation(config: DataAnalysisConfig) : ExceptionContinuous(config) {
    /**
     * 本异常的连续发生次数会根据异常的程度变化
@@ -19,6 +19,8 @@
    private var special = false
    override fun getExceptionType(): ExceptionType = ExceptionType.TYPE4
    override var judgeMethod: JudgeMethod = JudgeMethod.M2
    override fun judgeException(p: BaseRealTimeData?, n: BaseRealTimeData): MutableMap<FactorType, Boolean> {
        val res = mutableMapOf<FactorType, Boolean>()
@@ -40,7 +42,11 @@
        return res
    }
    override fun judgeDuration(sIndex: Int, eIndex: Int): Boolean {
    override fun judgeExceptionCount(tag: ExceptionTag, factorType: FactorType?): Boolean {
        // 首个数据没有前一个数据参照,不算异常值,最后一个数据是判断结束的正常值,因此异常数据个数的计算下标为sIndex和eIndex
        val sIndex = tag.sIndex
        val eIndex = tag.eIndex - 1
        val b1 = special && (eIndex - sIndex) >= (config.mutationNum / 2)
        val b2 = (eIndex - sIndex) >= config.mutationNum
        special = false