| | |
| | | recordException(s, it, data) |
| | | } |
| | | } |
| | | // 3. 数据正常,无任何异常时d |
| | | // TODO("2025.6.3:其他子类的此处刷新逻辑待完成“) |
| | | else { |
| | | it.refreshWithNoException(data) |
| | | } |
| | | } |
| | | } |
| | | lastData = data |
| | |
| | | */ |
| | | open fun onNewException(tag: T, factor: FactorFilter.SelectedFactor, exceptionStatus: ExceptionStatusType) { |
| | | if (tag.startData == null) return |
| | | val ex = newResult(tag.startData!!, lastData, factor, tag.exceptionData) |
| | | val ex = newResult(tag.startData!!, tag.endData, factor, tag.exceptionData) |
| | | .apply { status = exceptionStatus.value } |
| | | // 异常已创建时,更新异常信息 |
| | | if (tag.exceptionCreated) { |
| | |
| | | if (factor != null && tag != null) { |
| | | if (tag.exceptionExisted) { |
| | | tag.startData?.let { |
| | | resultList.add(newResult(it, lastData, factor, tag.exceptionData)) |
| | | resultList.add(newResult(it, tag.endData, factor, tag.exceptionData)) |
| | | } |
| | | tag.exceptionExisted = false |
| | | } |
| | |
| | | val tag1 = tagMap[f.main] ?: return@forEach |
| | | if (tag1.exceptionExisted) { |
| | | tag1.startData?.let { |
| | | resultList.add(newResult(it, lastData, f, tag1.exceptionData)) |
| | | resultList.add(newResult(it, tag1.endData, f, tag1.exceptionData)) |
| | | } |
| | | tag1.exceptionExisted = false |
| | | } |
| | |
| | | exceptionData.add(data) |
| | | } |
| | | |
| | | fun refreshWithNextException(data: BaseRealTimeData) { |
| | | fun refreshWithNoException(data: BaseRealTimeData) { |
| | | sIndex = eIndex |
| | | startData = data |
| | | } |
| | | |
| | | fun refreshWithNextException(data: BaseRealTimeData) { |
| | | refreshWithNoException(data) |
| | | exceptionData.clear() |
| | | exceptionExisted = false |
| | | exceptionCreated = false |
| | |
| | | |
| | | inner class WindLevelCondition( |
| | | val windSpeed: Pair<Double, Double>, |
| | | val mutationRate: Pair<Double, DistanceType>, |
| | | val mutationRate: Pair<Double, Double>, |
| | | val distanceType: DistanceType, |
| | | val countLimit: Int, |
| | | ) |
| | | |
| | |
| | | // 0 - 1级风 |
| | | var windLevelCondition1 = WindLevelCondition( |
| | | .0 to 1.5, |
| | | 0.5 to DistanceType.TYPE1, |
| | | 0.5 to Double.MAX_VALUE, |
| | | DistanceType.TYPE1, |
| | | 1 |
| | | ) |
| | | |
| | | // 0 - 1级风 |
| | | var windLevelCondition1_1 = WindLevelCondition( |
| | | .0 to 1.5, |
| | | 0.2 to DistanceType.TYPE2, |
| | | 0.2 to 0.5, |
| | | DistanceType.TYPE2, |
| | | 1 |
| | | ) |
| | | |
| | | // 2 - 4级风 |
| | | var windLevelCondition2 = WindLevelCondition( |
| | | 1.6 to 7.9, |
| | | 0.2 to DistanceType.TYPE3, |
| | | 3 |
| | | 0.2 to Double.MAX_VALUE, |
| | | DistanceType.TYPE3, |
| | | // 3 |
| | | 1 |
| | | ) |
| | | |
| | | // 5 - 6级风 |
| | | var windLevelCondition3 = WindLevelCondition( |
| | | 8.0 to 13.8, |
| | | 0.1 to DistanceType.TYPE4, |
| | | 0.1 to Double.MAX_VALUE, |
| | | DistanceType.TYPE4, |
| | | 3 |
| | | ) |
| | | |
| | |
| | | var analysisPeriod = 15 |
| | | // 定时分析间隔中,立即进行线索分析的最小线索量(单位:个) |
| | | var analysisCount = 3 |
| | | |
| | | |
| | | |
| | | // // 0 - 1级风 |
| | | // var windLevelCondition1 = WindLevelCondition( |
| | | // .0 to 1.5, |
| | | // listOf(0.5 to DistanceType.TYPE1, 0.2 to DistanceType.TYPE2,), |
| | | // listOf(1, 1) |
| | | // ) |
| | | // |
| | | // // 0 - 1级风 |
| | | // var windLevelCondition1_1 = WindLevelCondition( |
| | | // .0 to 1.5, |
| | | // 0.2 to DistanceType.TYPE2, |
| | | // 1 |
| | | // ) |
| | | // |
| | | // // 2 - 4级风 |
| | | // var windLevelCondition2 = WindLevelCondition( |
| | | // 1.6 to 7.9, |
| | | // listOf(0.2 to DistanceType.TYPE3), |
| | | //// listOf(3) |
| | | // listOf(1) |
| | | // ) |
| | | // |
| | | // // 5 - 6级风 |
| | | // var windLevelCondition3 = WindLevelCondition( |
| | | // 8.0 to 13.8, |
| | | // listOf(0.1 to DistanceType.TYPE4), |
| | | // listOf(3) |
| | | // ) |
| | | } |
| | |
| | | val nValue = n.getByFactorType(f)!! |
| | | // 计算后一个数据相比于前一个数据的变化率 |
| | | val r = (nValue - pValue) / pValue |
| | | val b1 = r >= con.mutationRate.first |
| | | val b1 = r >= con.mutationRate.first && r < con.mutationRate.second |
| | | println("因子:${f.des},幅度:${r},限定:${con.mutationRate.first},${b1}") |
| | | res[f] = b1 |
| | | } else { |
| | |
| | | * @date 2025/5/29 |
| | | * @author feiyu02 |
| | | */ |
| | | |
| | | class RTExcWindLevel1_1 : BaseRTExcWindLevel { |
| | | |
| | | constructor(config: RTExcWindLevelConfig) : super(config) |
| | |
| | | */ |
| | | open fun onNewException(tag: ExceptionSlideAverageTag, factor: FactorFilter.SelectedFactor, exceptionStatus: ExceptionStatusType) { |
| | | if (tag.startData == null) return |
| | | val ex = newResult(tag.startData!!, lastData, factor, tag.exceptionData) |
| | | val ex = newResult(tag.startData!!, tag.endData, factor, tag.exceptionData) |
| | | .apply { status = exceptionStatus.value } |
| | | // 异常已创建时,更新异常信息 |
| | | if (tag.exceptionCreated) { |
| | |
| | | config: RTExcWindLevelConfig, |
| | | windLevelCondition: RTExcWindLevelConfig.WindLevelCondition, |
| | | ) : this() { |
| | | distanceType = windLevelCondition.mutationRate.second |
| | | distanceType = windLevelCondition.distanceType |
| | | sourceTrace(exceptionData, config, windLevelCondition) |
| | | } |
| | | |
| | |
| | | polygon = calSector( |
| | | avgData.windSpeed!!.toDouble(), |
| | | pair, |
| | | windLevelCondition.mutationRate.second.disRange, |
| | | windLevelCondition.distanceType.disRange, |
| | | config.sourceTraceDegOffset |
| | | ) |
| | | ).map { |
| | | // 将坐标转换为gcj02(火星坐标系),因为污染源场景信息都为此坐标系 |
| | | MapUtil.wgs84ToGcj02(it) |
| | | } |
| | | |
| | | try { |
| | | val address = AMapService.reGeo(pair) |
| | | this.address = address.township + address.street |
| | | this.address = address.district + address.township + address.street |
| | | } catch (e: Exception) { |
| | | e.printStackTrace() |
| | | } |
| | |
| | | |
| | | startTime = DateUtil.instance.dateToString(start.dataTime, DateUtil.DateStyle.HH_MM_SS) |
| | | endTime = DateUtil.instance.dateToString(end?.dataTime, DateUtil.DateStyle.HH_MM_SS) ?: startTime |
| | | startData = start.getByFactorType(factor.main) |
| | | endData = end?.getByFactorType(factor.main) ?: startData |
| | | // startData = start.getByFactorType(factor.main) |
| | | // endData = end?.getByFactorType(factor.main) ?: startData |
| | | startData = start |
| | | endData = end |
| | | |
| | | windSpeed = exceptionData.first().windSpeed?.toDouble() |
| | | percentage = windLevelCondition.mutationRate.first |
| | | times = windLevelCondition.countLimit |
| | | |
| | | dataList.add(start) |
| | | exceptionData.forEach { |
| | | dataList.add(it) |
| | | dataVoList.add(it.toDataVo()) |
| | | } |
| | | dataVoList.addAll(dataList.map { it.toDataVo() }) |
| | | |
| | | calPer() |
| | | } |
| | |
| | | var startTime: String? = null |
| | | var endTime: String? = null |
| | | |
| | | var startData: Float? = null |
| | | var endData: Float? = null |
| | | var startData: BaseRealTimeData? = null |
| | | var endData: BaseRealTimeData? = null |
| | | |
| | | // 风速 |
| | | var windSpeed: Double? = null |
| | |
| | | var dataVoList: MutableList<DataVo> = mutableListOf() |
| | | |
| | | private fun calPer() { |
| | | if (dataList.size < 2) return |
| | | val list = dataList |
| | | // list.add(startData) |
| | | // list.addAll(dataList) |
| | | if (list.size < 2) return |
| | | |
| | | var total = .0 |
| | | for (i in 0 until dataList.size - 1) { |
| | | total += dataList[i].getByFactorType(selectedFactor!!.main)!! |
| | | 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) / p |
| | | } |
| | | avgPer = total / (dataList.size - 1) |
| | | avgPer = total / (list.size - 1) |
| | | } |
| | | } |
| | |
| | | fun searchScenes(pollutedArea: PollutedArea, sceneInfoRep: SceneInfoRep, factor: FactorFilter.SelectedFactor) { |
| | | // Fixme 2025.5.14: 污染源的坐标是高德地图坐标系(火星坐标系),而走航数据是WGS84坐标系 |
| | | // 按照区域检索内部污染源信息 |
| | | // 1. 首先按照四至范围从数据库初步筛选污染源,需要先将坐标转换为gcj02(火星坐标系),因为污染源场景信息都为此坐标系 |
| | | // 1. 首先按照四至范围从数据库初步筛选污染源 |
| | | // val polygonTmp = pollutedArea.polygon!!.map { |
| | | // MapUtil.gcj02ToWgs84(it) |
| | | // } |