| | |
| | | } |
| | | |
| | | /** |
| | | * 判断数据量级在异常判断的范围内 |
| | | * 默认所有量级都在异常判断的范围内 |
| | | */ |
| | | 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> |
| | |
| | | * @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 |
| | | } |
| | | |
| | | /** |
| | | * 异常数据的截取判断 |
| | |
| | | |
| | | 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 { |
| | |
| | | // 3. 数据正常,无任何异常时d |
| | | // TODO("2025.6.3:其他子类的此处刷新逻辑待完成“) |
| | | else { |
| | | it.refreshWithNoException(data) |
| | | it.refreshWithNextException(data) |
| | | } |
| | | } |
| | | } |
| | |
| | | } 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) |
| | | } |
| | | } |