Procházet zdrojové kódy

修正升压站报警异常

shilin před 9 měsíci
rodič
revize
5bc4a4dea6

+ 38 - 26
alarm-scanner/src/main/java/com/gyee/alarm/model/vo/AlarmTag.java

@@ -31,7 +31,7 @@ public class AlarmTag {
     /**
      * 报警类别,0触发,1触发,-1变化触发,大于等于3ai点触发
      */
-    private Integer triggerType=0;
+    private Integer triggerType;
 
     /**
      * 测点
@@ -41,7 +41,7 @@ public class AlarmTag {
     /**
      * 过去值
      */
-    private Double oval=null;
+    private Double oval;
 
     /**
      * 报警级别
@@ -104,12 +104,25 @@ public class AlarmTag {
      */
     public synchronized Boolean updateAndCheck(PointData pointData) {
 
+        if(alarmType.equals(AlarmTypeValue.BT.getCode()))
+        {
+            if(pointData.getPointValueInDouble()<1)
+            {
+                pointData.setPointValueInDouble(0.0);
+            }else
+            {
+                pointData.setPointValueInDouble(1.0);
+            }
+        }
+
         if(null ==oval)
         {
             oval=pointData.getPointValueInDouble();
             return false;
         }
-        if (pointData.getPointValueInDouble() == oval) {
+
+
+        if (pointData.getPointValueInDouble() == oval.doubleValue()) {
             return false;
         }
         ts = pointData.getPointTime();
@@ -128,26 +141,25 @@ public class AlarmTag {
             if(decimal==0)
             {
                 val=0.0;
-            }else  if(decimal>0)
-            {
-                String binary = intToBinary32(decimal, 32); // 转换为二进制报警字符串
-
-                String reverse = new StringBuffer(binary).reverse().toString();//翻转字符串,便于报警分析
-                int value = (int) reverse.charAt(triggerType)-48;
-                if (value == 1) {
-                    val=1.0;
-                }else {
-                    val=0.0;
-                }
             }
 
+            String binary = intToBinary32(decimal, 32); // 转换为二进制报警字符串
+
+            String reverse = new StringBuffer(binary).reverse().toString();//翻转字符串,便于报警分析
+            int value = (int) reverse.charAt(triggerType.intValue())-48;
+            if (value == 1) {
+                val=1.0;
+            }else {
+                val=0.0;
+            }
 
-        }else  if(triggerType==-1)
+
+        }else  if(triggerType.intValue()==-1)
         {
             val=1.0;
-        }else  if(triggerType==0)
+        }else  if(triggerType.intValue()==0)
         {
-            if (oval == 0)
+            if (oval.intValue() == 0)
             {
                 val=1.0;
             }else
@@ -155,9 +167,9 @@ public class AlarmTag {
                 val=0.0;
 
             }
-        }else  if(triggerType==1)
+        }else  if(triggerType.intValue()==1)
         {
-            if (oval == 1)
+            if (oval.intValue() == 1)
             {
                 val=1.0;
             }else
@@ -166,7 +178,7 @@ public class AlarmTag {
 
             }
         }else {
-            if (oval.intValue() == triggerType) {
+            if (oval.intValue() == triggerType.intValue()) {
                 val=1.0;
             }else {
                 val=2.0;
@@ -196,19 +208,19 @@ public class AlarmTag {
             String binary = intToBinary32(decimal, 32); // 转换为二进制报警字符串
 
             String reverse = new StringBuffer(binary).reverse().toString();//翻转字符串,便于报警分析
-            int value = (int) reverse.charAt(triggerType)-48;
+            int value = (int) reverse.charAt(triggerType.intValue())-48;
             if (value == 1) {
                 val=1.0;
             }else {
                 val=0.0;
             }
 
-        }else if(triggerType==-1)
+        }else if(triggerType.intValue()==-1)
         {
             val=1.0;
-        }else  if(triggerType==0)
+        }else  if(triggerType.intValue()==0)
         {
-            if (oval == 0)
+            if (oval.intValue() == 0)
             {
                 val=1.0;
             }else
@@ -216,9 +228,9 @@ public class AlarmTag {
                 val=0.0;
 
             }
-        }else  if(triggerType==1)
+        }else  if(triggerType.intValue()==1)
         {
-            if (oval == 1)
+            if (oval.intValue() == 1)
             {
                 val=1.0;
             }else

+ 2 - 0
alarm-scanner/src/main/java/com/gyee/alarm/service/AlarmScannerService.java

@@ -79,6 +79,8 @@ public class AlarmScannerService {
                         {
                             if(tag.getTagId().startsWith("GF"))
                             {
+                                tag.setVal(-10000.0);
+                                tag.setOval(-10000.0);
                                 alarmInTags.add(tag);
                             }else
                             {

+ 1 - 1
alarm-scanner/src/main/java/com/gyee/alarm/task/thread/AlarmThreadPool.java

@@ -110,7 +110,7 @@ public class AlarmThreadPool implements Callable<String>, Serializable {
 
                         po.setId(vo.getId());
                         po.setTs(vo.getTs());
-                        po.setEndts(po.getEndts());
+//                        po.setEndts(po.getEndts());
                         po.setVal(vo.getVal());
                         po.setOval(vo.getOval());
                         po.setTriggerType(vo.getTriggerType());

+ 1 - 1
alarm-scanner/src/main/resources/application-in.yml

@@ -177,7 +177,7 @@ interval: 1
 
 #WT("wt_alarms", "设备报警超级表"),
 #BT("bt_alarms", "升压站报警超级表"),
-#CT("custom_alarms", "自定义报警超级表");
+#IN("ln_alarms", "逆变器报警超级表");
 alarmType: ln_alarms
 read-rows: 1000