|
@@ -31,7 +31,7 @@ public class AlarmTag {
|
|
/**
|
|
/**
|
|
* 报警类别,0触发,1触发,-1变化触发,大于等于3ai点触发
|
|
* 报警类别,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) {
|
|
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)
|
|
if(null ==oval)
|
|
{
|
|
{
|
|
oval=pointData.getPointValueInDouble();
|
|
oval=pointData.getPointValueInDouble();
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
- if (pointData.getPointValueInDouble() == oval) {
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if (pointData.getPointValueInDouble() == oval.doubleValue()) {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
ts = pointData.getPointTime();
|
|
ts = pointData.getPointTime();
|
|
@@ -128,26 +141,25 @@ public class AlarmTag {
|
|
if(decimal==0)
|
|
if(decimal==0)
|
|
{
|
|
{
|
|
val=0.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;
|
|
val=1.0;
|
|
- }else if(triggerType==0)
|
|
|
|
|
|
+ }else if(triggerType.intValue()==0)
|
|
{
|
|
{
|
|
- if (oval == 0)
|
|
|
|
|
|
+ if (oval.intValue() == 0)
|
|
{
|
|
{
|
|
val=1.0;
|
|
val=1.0;
|
|
}else
|
|
}else
|
|
@@ -155,9 +167,9 @@ public class AlarmTag {
|
|
val=0.0;
|
|
val=0.0;
|
|
|
|
|
|
}
|
|
}
|
|
- }else if(triggerType==1)
|
|
|
|
|
|
+ }else if(triggerType.intValue()==1)
|
|
{
|
|
{
|
|
- if (oval == 1)
|
|
|
|
|
|
+ if (oval.intValue() == 1)
|
|
{
|
|
{
|
|
val=1.0;
|
|
val=1.0;
|
|
}else
|
|
}else
|
|
@@ -166,7 +178,7 @@ public class AlarmTag {
|
|
|
|
|
|
}
|
|
}
|
|
}else {
|
|
}else {
|
|
- if (oval.intValue() == triggerType) {
|
|
|
|
|
|
+ if (oval.intValue() == triggerType.intValue()) {
|
|
val=1.0;
|
|
val=1.0;
|
|
}else {
|
|
}else {
|
|
val=2.0;
|
|
val=2.0;
|
|
@@ -196,19 +208,19 @@ public class AlarmTag {
|
|
String binary = intToBinary32(decimal, 32); // 转换为二进制报警字符串
|
|
String binary = intToBinary32(decimal, 32); // 转换为二进制报警字符串
|
|
|
|
|
|
String reverse = new StringBuffer(binary).reverse().toString();//翻转字符串,便于报警分析
|
|
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) {
|
|
if (value == 1) {
|
|
val=1.0;
|
|
val=1.0;
|
|
}else {
|
|
}else {
|
|
val=0.0;
|
|
val=0.0;
|
|
}
|
|
}
|
|
|
|
|
|
- }else if(triggerType==-1)
|
|
|
|
|
|
+ }else if(triggerType.intValue()==-1)
|
|
{
|
|
{
|
|
val=1.0;
|
|
val=1.0;
|
|
- }else if(triggerType==0)
|
|
|
|
|
|
+ }else if(triggerType.intValue()==0)
|
|
{
|
|
{
|
|
- if (oval == 0)
|
|
|
|
|
|
+ if (oval.intValue() == 0)
|
|
{
|
|
{
|
|
val=1.0;
|
|
val=1.0;
|
|
}else
|
|
}else
|
|
@@ -216,9 +228,9 @@ public class AlarmTag {
|
|
val=0.0;
|
|
val=0.0;
|
|
|
|
|
|
}
|
|
}
|
|
- }else if(triggerType==1)
|
|
|
|
|
|
+ }else if(triggerType.intValue()==1)
|
|
{
|
|
{
|
|
- if (oval == 1)
|
|
|
|
|
|
+ if (oval.intValue() == 1)
|
|
{
|
|
{
|
|
val=1.0;
|
|
val=1.0;
|
|
}else
|
|
}else
|