| | |
| | | * 每一刻钟对历史线索进行统计,提出会商建议(离污染源较远、污染源数量、出现次数)、走航路线调整建议(离污染源较近、走航轨迹未接近溯源场景) |
| | | */ |
| | | |
| | | constructor(sceneInfoRep: SceneInfoRep, sourceTraceRep: SourceTraceRep, factorFilter: FactorFilter?) { |
| | | constructor( |
| | | sceneInfoRep: SceneInfoRep, |
| | | sourceTraceRep: SourceTraceRep, |
| | | factorFilter: FactorFilter?, |
| | | isSearchAddress: Boolean, |
| | | ) { |
| | | this.sceneInfoRep = sceneInfoRep |
| | | this.sourceTraceRep = sourceTraceRep |
| | | this.config = if (factorFilter != null) { |
| | |
| | | } else { |
| | | RTExcWindLevelConfig( |
| | | FactorFilter.builder() |
| | | // .withMain(FactorType.NO2) |
| | | // .withMain(FactorType.CO) |
| | | .withMain(FactorType.NO2) |
| | | .withMain(FactorType.CO) |
| | | // .withMain(FactorType.H2S) |
| | | // .withMain(FactorType.SO2) |
| | | // .withMain(FactorType.O3) |
| | | .withMain(FactorType.O3) |
| | | .withMain(FactorType.PM25) |
| | | .withMain(FactorType.PM10) |
| | | .withMain(FactorType.VOC) |
| | | .withCombination( |
| | | listOf( |
| | | listOf(FactorType.PM25, FactorType.PM10), |
| | | listOf(FactorType.VOC, FactorType.CO), |
| | | ) |
| | | ) |
| | | .create() |
| | | ) |
| | | } |
| | | this.config.isSearchAddress = isSearchAddress |
| | | |
| | | pollutedSummary = PollutedSummary(config) { summaryCallback(it) } |
| | | newTask() |
| | | } |
| | | |
| | | constructor(sceneInfoRep: SceneInfoRep, sourceTraceRep: SourceTraceRep) : this(sceneInfoRep, sourceTraceRep, null) |
| | | constructor(sceneInfoRep: SceneInfoRep, sourceTraceRep: SourceTraceRep, isSearchAddress: Boolean = true) |
| | | : this(sceneInfoRep, sourceTraceRep, null, isSearchAddress) |
| | | |
| | | private val pollutedSummary: PollutedSummary |
| | | private val sceneInfoRep: SceneInfoRep |
| | | private val sourceTraceRep: SourceTraceRep |
| | | private val config: RTExcWindLevelConfig |
| | | private val timer = Timer() |
| | | private var timerTask: TimerTask? = null |
| | | |
| | | private val taskList = mutableListOf<BaseExceptionAnalysis<RTExcWindLevelConfig, PollutedClue>>() |
| | | |
| | |
| | | * 计算新的一条实时走航数据 |
| | | */ |
| | | fun addOneData(data: BaseRealTimeData) { |
| | | // println("====================>") |
| | | // 计算异常 |
| | | taskList.forEach { it.onNextData(data) } |
| | | pollutedSummary.refreshLatestMonitorData(data) |
| | | // 限定时间内没有新数据传入,则结束当前的计算 |
| | | dealOnTimeout() |
| | | } |
| | | |
| | | fun addDataList(dataList: List<BaseRealTimeData>) { |
| | | // 计算异常 |
| | | dataList.forEach { data -> |
| | | taskList.forEach { it.onNextData(data) } |
| | | pollutedSummary.refreshLatestMonitorData(data) |
| | | } |
| | | // 限定时间内没有新数据传入,则结束当前的计算 |
| | | dealOnTimeout() |
| | | } |
| | | |
| | | /** |
| | | * 超时处理,较长时间没有新数据进入,进行初始化操作 |
| | | */ |
| | | private fun dealOnTimeout() { |
| | | val timer = Timer(true) |
| | | timer.schedule(object : TimerTask() { |
| | | // val timer = Timer() |
| | | timerTask?.cancel() |
| | | timer.purge() |
| | | timerTask = object : TimerTask() { |
| | | override fun run() { |
| | | TODO("Not yet implemented") |
| | | initTask() |
| | | } |
| | | }, 60 * 1000) |
| | | timer.cancel() |
| | | } |
| | | timer.schedule(timerTask, 2 * 60 * 60 * 1000) |
| | | } |
| | | |
| | | // 数据突变异常回调 |