|
@@ -17,7 +17,6 @@ import com.sckj.iron.dto.*;
|
|
|
import com.sckj.iron.entity.*;
|
|
|
import com.sckj.iron.service.impl.*;
|
|
|
import com.sckj.iron.util.LocalDateUtils;
|
|
|
-import com.sckj.iron.util.RangeUtils;
|
|
|
import com.sckj.iron.vo.IronStepVO;
|
|
|
import com.sckj.l2.dto.TrendRequest;
|
|
|
import com.sckj.l2.entity.TL2Data;
|
|
@@ -215,10 +214,10 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
|
|
|
|
|
|
//实时温度最大值
|
|
|
- private AtomicDouble rtTempMax = new AtomicDouble(0);
|
|
|
+ private AtomicInteger rtTempMax = new AtomicInteger(0);
|
|
|
|
|
|
//实时温度最小值
|
|
|
- private AtomicDouble rtTempMin = new AtomicDouble(0);
|
|
|
+ private AtomicInteger rtTempMin = new AtomicInteger(0);
|
|
|
|
|
|
private String SERVER_URL = "";
|
|
|
|
|
@@ -248,6 +247,12 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
//预警出铁模型连续计数
|
|
|
private Map<String, Integer> tappingWarnCountMap = new ConcurrentHashMap<>();
|
|
|
|
|
|
+ //流速连续计数
|
|
|
+ private Map<String, Integer> speedWarnCountMap = new ConcurrentHashMap<>();
|
|
|
+
|
|
|
+ //温度连续计数
|
|
|
+ private Map<String, Integer> tempWarnCountMap = new ConcurrentHashMap<>();
|
|
|
+
|
|
|
// 定时任务统一管理
|
|
|
private Map<String, TIronSchedule> scheduleMap = new ConcurrentHashMap<>();
|
|
|
|
|
@@ -291,7 +296,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
if ("prod".equals(activeProfiles)) {
|
|
|
log.info("HDC subscribe available");
|
|
|
hdService.subscribeAvailable();
|
|
|
- } else {
|
|
|
+ } else if ("test".equals(activeProfiles)) {
|
|
|
log.info("DA subscribe available");
|
|
|
opcuaService.subscribeAvailable();
|
|
|
}
|
|
@@ -354,15 +359,15 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
mContext.setVariable(ExpressionConstants.stdPressureDiff, StandardConstans.STANDARD_PRESSURE_DIFF);
|
|
|
} else if (Objects.equals(mIronParam.getParamName(), ParamsConstants.iron_time)) {
|
|
|
StandardConstans.STANDARD_IRON_TIME = mIronParam.getParamValue();
|
|
|
- mContext.setVariable(ExpressionConstants.stdIronTimeMin, Double.parseDouble(StandardConstans.STANDARD_IRON_TIME.split("-")[0]));
|
|
|
- mContext.setVariable(ExpressionConstants.stdIronTimeMax, Double.parseDouble(StandardConstans.STANDARD_IRON_TIME.split("-")[1]));
|
|
|
+ mContext.setVariable(ExpressionConstants.stdIronTimeMin, Integer.parseInt(StandardConstans.STANDARD_IRON_TIME.split("-")[0]));
|
|
|
+ mContext.setVariable(ExpressionConstants.stdIronTimeMax, Integer.parseInt(StandardConstans.STANDARD_IRON_TIME.split("-")[1]));
|
|
|
} else if (Objects.equals(mIronParam.getParamName(), ParamsConstants.server_url)) {
|
|
|
SERVER_URL = mIronParam.getParamValue();
|
|
|
mContext.setVariable(ExpressionConstants.stdServerUrl, SERVER_URL);
|
|
|
} else if (Objects.equals(mIronParam.getParamName(), ParamsConstants.ironwater_temp)) {
|
|
|
StandardConstans.STANDARD_TEMP = mIronParam.getParamValue();
|
|
|
- mContext.setVariable(ExpressionConstants.stdTempMin, Double.parseDouble(StandardConstans.STANDARD_TEMP.split("-")[0]));
|
|
|
- mContext.setVariable(ExpressionConstants.stdTempMax, Double.parseDouble(StandardConstans.STANDARD_TEMP.split("-")[1]));
|
|
|
+ mContext.setVariable(ExpressionConstants.stdTempMin, Integer.parseInt(StandardConstans.STANDARD_TEMP.split("-")[0]));
|
|
|
+ mContext.setVariable(ExpressionConstants.stdTempMax, Integer.parseInt(StandardConstans.STANDARD_TEMP.split("-")[1]));
|
|
|
} else if (Objects.equals(mIronParam.getParamName(), ParamsConstants.open_hour)) {
|
|
|
StandardConstans.STANDARD_OPEN_HOUR = Integer.parseInt(mIronParam.getParamValue());
|
|
|
mContext.setVariable(ExpressionConstants.stdOpenHour, StandardConstans.STANDARD_OPEN_HOUR);
|
|
@@ -376,8 +381,8 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
StandardConstans.STANDARD_MUD_MACHINE_PRESSURE = Double.parseDouble(mIronParam.getParamValue());
|
|
|
}
|
|
|
}
|
|
|
- log.info("STANDARD_SPEED: {},PRESSURE_DIFF_VALUE:{}", StandardConstans.STANDARD_SPEED, StandardConstans.STANDARD_PRESSURE_DIFF);
|
|
|
- log.info("IRON_TIME: {},SERVER_URL:{}", StandardConstans.STANDARD_IRON_TIME, SERVER_URL);
|
|
|
+ // log.info("STANDARD_SPEED: {},PRESSURE_DIFF_VALUE:{}", StandardConstans.STANDARD_SPEED, StandardConstans.STANDARD_PRESSURE_DIFF);
|
|
|
+ // log.info("IRON_TIME: {},SERVER_URL:{}", StandardConstans.STANDARD_IRON_TIME, SERVER_URL);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -632,9 +637,9 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
int count = closureWarnCountMap.getOrDefault(modelKey1, 0) + 1;
|
|
|
closureWarnCountMap.put(modelKey1, count);
|
|
|
if (count >= triggerCount1) {
|
|
|
- PushData.send2Warn(WarnData.warnClose("铁水流速过快告警", closureAlarmUrl));
|
|
|
+ PushData.send2Warn(WarnData.warnClose("堵口告警", closureAlarmUrl));
|
|
|
taskExecutor.submit(() -> {
|
|
|
- exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType("7000").exceptionDesc(String.format("流速%s吨/分钟", mContext.lookupVariable(ExpressionConstants.rtIronSpeed))).build());
|
|
|
+ exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(ExceptionTypeEnum.JI_XU_DU_KOU.getCode()).exceptionDesc(String.format("流速%s吨/分钟", mContext.lookupVariable(ExpressionConstants.rtIronSpeed))).build());
|
|
|
//推送预警列表
|
|
|
getExceptionList();
|
|
|
});
|
|
@@ -654,9 +659,9 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
int count = closureWarnCountMap.getOrDefault(modelKey2, 0) + 1;
|
|
|
closureWarnCountMap.put(modelKey2, count);
|
|
|
if (count >= triggerCount2) {
|
|
|
- PushData.send2Warn(WarnData.warnClose("铁水流速过慢告警", closureAlarmUrl));
|
|
|
+ PushData.send2Warn(WarnData.warnClose("堵口告警", closureAlarmUrl));
|
|
|
taskExecutor.submit(() -> {
|
|
|
- exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType("8000").exceptionDesc(String.format("流速%s吨/分钟", mContext.lookupVariable(ExpressionConstants.rtIronSpeed))).build());
|
|
|
+ exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(ExceptionTypeEnum.JI_XU_DU_KOU.getCode()).exceptionDesc(String.format("流速%s吨/分钟", mContext.lookupVariable(ExpressionConstants.rtIronSpeed))).build());
|
|
|
//推送预警列表
|
|
|
getExceptionList();
|
|
|
});
|
|
@@ -676,9 +681,9 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
int count = closureWarnCountMap.getOrDefault(modelKey3, 0) + 1;
|
|
|
closureWarnCountMap.put(modelKey3, count);
|
|
|
if (count >= triggerCount3) {
|
|
|
- PushData.send2Warn(WarnData.warnClose("铁水流速过慢告警", closureAlarmUrl));
|
|
|
+ PushData.send2Warn(WarnData.warnClose("堵口告警", closureAlarmUrl));
|
|
|
taskExecutor.submit(() -> {
|
|
|
- exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType("8000").exceptionDesc(String.format("流速%s吨/分钟", mContext.lookupVariable(ExpressionConstants.rtIronSpeed))).build());
|
|
|
+ exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(ExceptionTypeEnum.JI_XU_DU_KOU.getCode()).exceptionDesc(String.format("流速%s吨/分钟", mContext.lookupVariable(ExpressionConstants.rtIronSpeed))).build());
|
|
|
//推送预警列表
|
|
|
getExceptionList();
|
|
|
});
|
|
@@ -728,15 +733,17 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
TIronSchedule tappingTimeoutWarn = scheduleMap.get(TaskNameConstants.TASKNAME_TAPPING_TIMEOUT_WARN);
|
|
|
if (tappingTimeoutWarn != null && "1".equals(tappingTimeoutWarn.getStatus())) {
|
|
|
scheduledTaskManager.addTask(tappingTimeoutWarn.getName(), tappingTimeoutWarn.getDelay(), tappingTimeoutWarn.getPeriod(), TimeUnit.SECONDS, () -> {
|
|
|
- // log.info("已出铁时间(秒):{},标准出铁时间(秒):{}", seconds, STANDARD_IRON_TIME.get());
|
|
|
- if (!RangeUtils.isInRange(StandardConstans.STANDARD_IRON_TIME, getIronElapsedMinute())) {
|
|
|
- PushData.send2Warn(WarnData.warnTappingTimeout("出铁时间过长告警", tappingTimeoutAlramUrl));
|
|
|
+ //出铁时间长短告警
|
|
|
+ int stdIronTimeMax = Integer.parseInt(mContext.lookupVariable(ExpressionConstants.stdIronTimeMax).toString());
|
|
|
+
|
|
|
+ if (getIronElapsedMinute() > stdIronTimeMax) {
|
|
|
taskExecutor.submit(() -> {
|
|
|
- exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType("3000").exceptionDesc(String.format("出铁时间:%s分钟", getIronElapsedMinute())).build());
|
|
|
+ exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(ExceptionTypeEnum.CHU_TIE_SHI_JIAN_TAI_CHANG.getCode()).exceptionDesc(String.format("出铁时间:%s分钟", getIronElapsedMinute())).build());
|
|
|
//推送预警列表
|
|
|
getExceptionList();
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -804,6 +811,43 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
mCalcHitMud = "";
|
|
|
PushData.send2IronHitMud(mCalcHitMud);
|
|
|
|
|
|
+ //出铁时间长短告警
|
|
|
+ int stdIronTimeMin = Integer.parseInt(mContext.lookupVariable(ExpressionConstants.stdIronTimeMin).toString());
|
|
|
+ int stdIronTimeMax = Integer.parseInt(mContext.lookupVariable(ExpressionConstants.stdIronTimeMax).toString());
|
|
|
+
|
|
|
+ if (getIronElapsedMinute() < stdIronTimeMin) {
|
|
|
+ taskExecutor.submit(() -> {
|
|
|
+ exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(ExceptionTypeEnum.CHU_TIE_SHI_JIAN_TAI_DUAN.getCode()).exceptionDesc(String.format("出铁时间:%s分钟", getIronElapsedMinute())).build());
|
|
|
+ //推送预警列表
|
|
|
+ getExceptionList();
|
|
|
+ });
|
|
|
+ } else if (getIronElapsedMinute() > stdIronTimeMax) {
|
|
|
+ taskExecutor.submit(() -> {
|
|
|
+ exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(ExceptionTypeEnum.CHU_TIE_SHI_JIAN_TAI_CHANG.getCode()).exceptionDesc(String.format("出铁时间:%s分钟", getIronElapsedMinute())).build());
|
|
|
+ //推送预警列表
|
|
|
+ getExceptionList();
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //出铁量多少告警
|
|
|
+ double stdIronWeightMin = Double.parseDouble(mContext.lookupVariable(ExpressionConstants.stdIronWeightMin).toString());
|
|
|
+ double stdIronWeightMax = Double.parseDouble(mContext.lookupVariable(ExpressionConstants.stdIronWeightMax).toString());
|
|
|
+
|
|
|
+ if (mTotalWeight.doubleValue() < stdIronWeightMin) {
|
|
|
+ taskExecutor.submit(() -> {
|
|
|
+ exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(ExceptionTypeEnum.CHU_TIE_LIANG_TAI_SHAO.getCode()).exceptionDesc(String.format("出铁量%s吨", mTotalWeight)).build());
|
|
|
+ //推送预警列表
|
|
|
+ getExceptionList();
|
|
|
+ });
|
|
|
+ } else if (mTotalWeight.doubleValue() > stdIronWeightMax) {
|
|
|
+ taskExecutor.submit(() -> {
|
|
|
+ exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(ExceptionTypeEnum.CHU_TIE_LIANG_TAI_DUO.getCode()).exceptionDesc(String.format("出铁量%s吨", mTotalWeight)).build());
|
|
|
+ //推送预警列表
|
|
|
+ getExceptionList();
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
// 出铁诊断模型
|
|
|
TIronSchedule tappingTest = scheduleMap.get(TaskNameConstants.TASKNAME_TAPPING_TEST);
|
|
|
TIronModel modelTappingTest = modelMap.get(ModelConstants.tapping_test);
|
|
@@ -848,9 +892,9 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
|
|
|
boolean ironTempChangeBool = mParser.parseExpression(split[3]).getValue(mContext, Boolean.class);
|
|
|
if (ironTempChangeBool) {
|
|
|
- testResultStr += "铁水温度变化符合预期。";
|
|
|
+ testResultStr += "铁水温度符合预期。";
|
|
|
} else {
|
|
|
- testResultStr += "铁水温度变化不符合预期。";
|
|
|
+ testResultStr += "铁水温度不符合预期。";
|
|
|
}
|
|
|
TIronTest ironTest = new TIronTest();
|
|
|
String testStatus = (ironTimeBool && ironWeightBool && ironSpeedBool && ironTempChangeBool) ? "1" : "0";
|
|
@@ -883,7 +927,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
tappingWarnCountMap.put(modelKey, count);
|
|
|
if (count >= triggerCount) {
|
|
|
PushData.send2Warn(WarnData.warnTapping("急需出铁告警", tappingAlramUrl));
|
|
|
- exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType("10000").exceptionDesc(String.format("压差压差超过:%s,请降低送风流量,并操作出铁",String.valueOf(mContext.lookupVariable(ExpressionConstants.stdPressureDiff)))).build());
|
|
|
+ exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(ExceptionTypeEnum.JI_XU_CHU_TIE.getCode()).exceptionDesc(String.format("压差压差超过:%s,请降低送风流量,并操作出铁", String.valueOf(mContext.lookupVariable(ExpressionConstants.stdPressureDiff)))).build());
|
|
|
tappingWarnCountMap.put(modelKey, 0);
|
|
|
//推送预警列表
|
|
|
getExceptionList();
|
|
@@ -928,7 +972,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
mRealtimeData.put(IRON_TEMP, realtimeData);
|
|
|
mRealtimeLegend.put(IRON_TEMP, realtimeData);
|
|
|
|
|
|
- double tempNow = Double.parseDouble(opcData.getData().toString());
|
|
|
+ int tempNow = Integer.parseInt(opcData.getData().toString());
|
|
|
|
|
|
if (rtTempMax.get() <= 0 || tempNow > rtTempMax.get()) {
|
|
|
rtTempMax.set(tempNow);
|
|
@@ -941,6 +985,38 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
mContext.setVariable(ExpressionConstants.rtIronTemp, opcData.getData());
|
|
|
mContext.setVariable(ExpressionConstants.rtIronTempDiff, rtTempMax.get() - rtTempMin.get());
|
|
|
|
|
|
+ int stdTempMin = Integer.parseInt(mContext.lookupVariable(ExpressionConstants.stdTempMin).toString());
|
|
|
+ int stdTempMax = Integer.parseInt(mContext.lookupVariable(ExpressionConstants.stdTempMax).toString());
|
|
|
+
|
|
|
+ if (tempNow < stdTempMin) {
|
|
|
+ int count = tempWarnCountMap.getOrDefault("tempMinWarn", 0) + 1;
|
|
|
+ tempWarnCountMap.put("tempMinWarn", count);
|
|
|
+ if (count >= 3) {
|
|
|
+ taskExecutor.submit(() -> {
|
|
|
+ exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(ExceptionTypeEnum.TIE_SHUI_WEN_DU_GUO_DI.getCode()).exceptionDesc(String.format("温度%s℃", mContext.lookupVariable(ExpressionConstants.rtIronSpeed))).build());
|
|
|
+ //推送预警列表
|
|
|
+ getExceptionList();
|
|
|
+ });
|
|
|
+ tempWarnCountMap.put("tempMinWarn", 0);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } else if (tempNow > stdTempMax) {
|
|
|
+ int count = tempWarnCountMap.getOrDefault("tempMaxWarn", 0) + 1;
|
|
|
+ tempWarnCountMap.put("tempMaxWarn", count);
|
|
|
+ if (count >= 3) {
|
|
|
+ taskExecutor.submit(() -> {
|
|
|
+ exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(ExceptionTypeEnum.TIE_SHUI_WEN_DU_GUO_GAO.getCode()).exceptionDesc(String.format("温度%s℃", mContext.lookupVariable(ExpressionConstants.rtIronSpeed))).build());
|
|
|
+ //推送预警列表
|
|
|
+ getExceptionList();
|
|
|
+ });
|
|
|
+ tempWarnCountMap.put("tempMaxWarn", 0);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ closureWarnCountMap.put("tempMinWarn", 0);
|
|
|
+ closureWarnCountMap.put("tempMaxWarn", 0);
|
|
|
+ }
|
|
|
+
|
|
|
} else if (opcData.getPointName().contains(SubscribeTagConstants.TAG_CAR11(opcData.getServerType())) || opcData.getPointName().contains(SubscribeTagConstants.TAG_CAR12(opcData.getServerType()))) {
|
|
|
//1TH-1号车受铁速度、1TH-2号车受铁速度、
|
|
|
RealtimeData realtimeData = new RealtimeData();
|
|
@@ -958,6 +1034,40 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
|
|
|
mRealtimeData.put(IRON_SPEED, realtimeData);
|
|
|
mRealtimeLegend.put(IRON_SPEED, realtimeData);
|
|
|
+
|
|
|
+
|
|
|
+ double stdSpeedMin = Double.parseDouble(mContext.lookupVariable(ExpressionConstants.stdSpeedMin).toString());
|
|
|
+ double stdSpeedMax = Double.parseDouble(mContext.lookupVariable(ExpressionConstants.stdSpeedMax).toString());
|
|
|
+
|
|
|
+ if (mMaxSpeed < stdSpeedMin) {
|
|
|
+ int count = speedWarnCountMap.getOrDefault("speedMinWarn", 0) + 1;
|
|
|
+ speedWarnCountMap.put("speedMinWarn", count);
|
|
|
+ if (count >= 3) {
|
|
|
+ taskExecutor.submit(() -> {
|
|
|
+ exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(ExceptionTypeEnum.TIE_SHUI_LIU_SU_GUO_MAN.getCode()).exceptionDesc(String.format("流速%s吨/分钟", mContext.lookupVariable(ExpressionConstants.rtIronSpeed))).build());
|
|
|
+ //推送预警列表
|
|
|
+ getExceptionList();
|
|
|
+ });
|
|
|
+ speedWarnCountMap.put("speedMinWarn", 0);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } else if (mMaxSpeed > stdSpeedMax) {
|
|
|
+ int count = speedWarnCountMap.getOrDefault("speedMaxWarn", 0) + 1;
|
|
|
+ speedWarnCountMap.put("speedMaxWarn", count);
|
|
|
+ if (count >= 3) {
|
|
|
+ taskExecutor.submit(() -> {
|
|
|
+ exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(ExceptionTypeEnum.TIE_SHUI_LIU_SU_GUO_KUAI.getCode()).exceptionDesc(String.format("流速%s吨/分钟", mContext.lookupVariable(ExpressionConstants.rtIronSpeed))).build());
|
|
|
+ //推送预警列表
|
|
|
+ getExceptionList();
|
|
|
+ });
|
|
|
+ speedWarnCountMap.put("speedMaxWarn", 0);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ speedWarnCountMap.put("speedMinWarn", 0);
|
|
|
+ speedWarnCountMap.put("speedMaxWarn", 0);
|
|
|
+ }
|
|
|
+
|
|
|
} else if (opcData.getPointName().contains(SubscribeTagConstants.TAG_TAPHOLE1_STATUS(opcData.getServerType()))) {
|
|
|
RealtimeData realtimeData = new RealtimeData();
|
|
|
realtimeData.setValue(opcData.getData());
|
|
@@ -1377,7 +1487,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
// 出铁预警,打开系统告警并记录
|
|
|
PushData.send2Warn(WarnData.warnOpen("急需开口告警", openAlarmUrl));
|
|
|
taskExecutor.submit(() -> {
|
|
|
- exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType("12000").exceptionDesc(String.format("开口耗时:%s分钟", minutesBetween)).build());
|
|
|
+ exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(ExceptionTypeEnum.KAI_KOU_CHAO_SHI.getCode()).exceptionDesc(String.format("开口耗时:%s分钟", minutesBetween)).build());
|
|
|
//推送预警列表
|
|
|
getExceptionList();
|
|
|
});
|