暂态严重度计算
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package com.njcn.event.utils;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
/**
|
||||
* Description:暂态事件工具类
|
||||
* Date: 2025/03/12 上午 9:26【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public class EventUtil {
|
||||
/**
|
||||
* @Description: 暂态严重度计算
|
||||
* @Param: persisttime持续时间毫秒,eventvaule暂减深度
|
||||
* @return: java.lang.String
|
||||
* @Author: clam
|
||||
* @Date: 2025/03/12
|
||||
*/
|
||||
public static String getYzd(Float persisttime, Float eventvaule) {
|
||||
float yzd;
|
||||
DecimalFormat df = new DecimalFormat("0.000");// 格式化小数
|
||||
if (persisttime <= 20) {
|
||||
yzd = 1 - eventvaule;
|
||||
} else if (persisttime > 20 && persisttime <= 200) {
|
||||
yzd = 2 * (1 - eventvaule);
|
||||
} else if (persisttime > 200 && persisttime <= 500) {
|
||||
yzd = 3.3f * (1 - eventvaule);
|
||||
} else if (persisttime > 500 && persisttime <= 10000) {
|
||||
yzd = 5 * (1 - eventvaule);
|
||||
} else {
|
||||
yzd = 10 * (1 - eventvaule);
|
||||
}
|
||||
return df.format(yzd);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user