riku
2021-06-21 62a55369aa23d4b9cee5e66e0520b3803c33de6f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package com.flightfeather.uav.model.epw
 
import com.flightfeather.uav.model.BaseWeight
import kotlin.math.abs
import kotlin.math.sqrt
 
/**
 * 风速距离权重
 * 监测点与污染源之间的物理距离与当前风速得出的权重
 */
class WindDisWeight : BaseWeight() {
 
    override val sectionValues: List<Double> = listOf(2.0, 5.0, 8.0, 12.0, 20.0, 30.0)
    override val weights: List<Double> = listOf(1.0, 0.8, 0.6, 0.5, 0.3, 0.0)
 
    fun getWeight(dis: Double, ws: Double): Double {
        val value = dis / 1000 / ws / 60
        return weightCal(value)
    }
 
    fun getWeight(p1: Pair<Double, Double>, p2: Pair<Double, Double>, ws: Double): Double {
        val dx = p2.first - p1.first
        val dy = p2.second - p1.second
        val dis = sqrt(abs(dx * dx) + abs(dy * dy)) * 100
        return getWeight(dis, ws)
    }
}