From e8f935a01d75c89ac591a80b9318eac2480e2dcd Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期四, 27 六月 2024 17:40:01 +0800 Subject: [PATCH] 1. 新增走航轨迹融合功能 --- src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionValueMutation.kt | 32 +++++++++++++++++++++++--------- 1 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionValueMutation.kt b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionValueMutation.kt index f9da13a..0a9e73c 100644 --- a/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionValueMutation.kt +++ b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionValueMutation.kt @@ -4,6 +4,7 @@ import com.flightfeather.uav.biz.dataanalysis.model.DataAnalysisConfig import com.flightfeather.uav.biz.dataanalysis.model.ExceptionType import com.flightfeather.uav.domain.entity.BaseRealTimeData +import com.flightfeather.uav.socket.eunm.FactorType import kotlin.math.abs /** @@ -19,21 +20,34 @@ override fun getExceptionType(): ExceptionType = ExceptionType.TYPE4 - override fun judgeException(p: BaseRealTimeData?, n: BaseRealTimeData): List<Boolean> { - val res = mutableListOf<Boolean>() - repeat(config.factorCount) { i-> - if (p?.getByFactorIndex(i) == null || n.getByFactorIndex(i) == null) { - res.add(false) - return@repeat + override fun judgeException(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) { + res[f] = (false) + return@forEach } - val pValue = p.getByFactorIndex(i)!! - val nValue = n.getByFactorIndex(i)!! + val pValue = p.getByFactorType(f)!! + val nValue = n.getByFactorType(f)!! val r = abs((pValue - nValue) / pValue) val b1 = r >= (2 * config.mutationRate) val b2 = r >= config.mutationRate if (b1) special = true - res.add(b1 || b2) + res[f] = (b1 || b2) } +// repeat(config.factorCount) { i-> +// if (p?.getByFactorIndex(i) == null || n.getByFactorIndex(i) == null) { +// res.add(false) +// return@repeat +// } +// val pValue = p.getByFactorIndex(i)!! +// val nValue = n.getByFactorIndex(i)!! +// val r = abs((pValue - nValue) / pValue) +// val b1 = r >= (2 * config.mutationRate) +// val b2 = r >= config.mutationRate +// if (b1) special = true +// res.add(b1 || b2) +// } return res } -- Gitblit v1.9.3