| | |
| | | private static String GROUP_NAME = "BOP040B_P";//组名 |
| | | private static List list = null; |
| | | private static Group group = null; |
| | | |
| | | private int count = 0; |
| | | |
| | | /** |
| | | * 设置心跳标志位,保存到全局变量 |
| | | */ |
| | | public void setHeartbeat(String value) { |
| | | if (value.equals("false")) { |
| | | OPCUnit.write(opc.getBOP040B_F_HEART_BEAT(), "true"); |
| | | GlobalVariable.BOP040B_F_HEART_BEAT = true; |
| | | count = 0; |
| | | } else { |
| | | count++; |
| | | } |
| | | // 循环读取频率是:500ms一次,如果超过6次,也就是3s认定超时 |
| | | if (count > GlobalVariable.HEART_MAX_COUNT) { |
| | | GlobalVariable.BOP040B_F_HEART_BEAT = false; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public synchronized void monitor() { |
| | | String ecpStr = "";//异常记录标记 |
| | | try{ |
| | | |
| | | String isHeartBeat = OPCUnit.read(opc.getBOP040B_F_HEART_BEAT()); |
| | | assert isHeartBeat != null; |
| | | setHeartbeat(isHeartBeat); |
| | | |
| | | if(GlobalVariable.BOP040B_F_HEART_BEAT) { |
| | | //PC读工单 |
| | | String isPLCStart = OPCUnit.read(opc.getBOP040B_J_PLC_START());//PLC开始 |