| | |
| | | |
| | | import com.base.Com; |
| | | import com.base.ComBase; |
| | | import com.log.User_Log; |
| | | import com.log.User_Log_SQL; |
| | | import com.modbus.data.MyModbusMaster; |
| | | import com.modbus.data.MyModbusUtils; |
| | | import com.serotonin.modbus4j.BatchRead; |
| | |
| | | |
| | | public MyModbusMaster master; |
| | | |
| | | public List<User_Log> logs; |
| | | |
| | | //public static final int MAX_READALARM_COUNT = 20; //一次读取告警节点的最大数量 |
| | | //public int read_alarm_index = 0; //读取告警索引 |
| | | |
| | |
| | | this.conn_pool = conn_pool; |
| | | this.einf = einf; |
| | | |
| | | |
| | | logs = new ArrayList<>(); |
| | | ert = einf.rt; |
| | | estate = einf.state; |
| | | eAlarm = einf.alarm; |
| | |
| | | //System.out.println(ecs.isControl_en()+"################33 "+runCount); |
| | | if(ecs.isControl_en()) { |
| | | //************************** 单点控制输出 *******************************//* |
| | | logs.clear(); |
| | | writeElectricalControlSignal(master,ecs); |
| | | Electrical_Task_SQL.update_Electric_Control_Single(conn_pool, ecs); |
| | | User_Log_SQL.recordUserLog(conn_pool, logs); |
| | | } |
| | | |
| | | if(econn.electric_id==4001||econn.electric_id==4003) { |
| | | logs.clear(); |
| | | Electrical_Task_SQL.queryElectric_Control_Conn(conn_pool, econn); |
| | | if(econn.isControl_en()) { |
| | | //************************** 组合控制输出 *******************************//* |
| | | writeElectricalControlConn(master, econn); |
| | | Electrical_Task_SQL.update_Electric_Control_Conn(conn_pool, econn); |
| | | } |
| | | User_Log_SQL.recordUserLog(conn_pool, logs); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | private void writeElectricalControlSignal(MyModbusMaster master, Electric_Control_Single ecs) { |
| | | //System.out.println(ecs); |
| | | //上位机设定电流 |
| | | if(ecs.upsetcurr >0) { |
| | | MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "upsetcurr"), ecs.upsetcurr, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | boolean flag = MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "upsetcurr"), ecs.upsetcurr, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | logs.add(new User_Log(User_Log.Alter,User_Log.electricsystem,einf.electric_name+"上位机设定电流为:"+ecs.upsetcurr,flag)); |
| | | } |
| | | //上位机设定电压 |
| | | if(ecs.upsetvol >0) { |
| | | MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "upsetvol"), ecs.upsetvol, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | boolean flag = MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "upsetvol"), ecs.upsetvol, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | logs.add(new User_Log(User_Log.Alter,User_Log.electricsystem,einf.electric_name+"上位机设定电压为:"+ecs.upsetvol,flag)); |
| | | } |
| | | //恒压控制 |
| | | if(ecs.convolcontrol >0) { |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "convolcontrol"), true, master); |
| | | try { |
| | | boolean flag = MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "convolcontrol"), true, master); |
| | | //300毫秒后复原 |
| | | Thread.sleep(300); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "convolcontrol"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "convolcontrol"),false, master); |
| | | logs.add(new User_Log(User_Log.Alter,User_Log.electricsystem,einf.electric_name+"恒压控制",flag)); |
| | | } catch (InterruptedException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | //恒流控制 |
| | | if(ecs.concurrcontrol >0) { |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "concurrcontrol"),true, master); |
| | | try { |
| | | boolean flag = MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "concurrcontrol"),true, master); |
| | | //300毫秒后复原 |
| | | Thread.sleep(300); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "concurrcontrol"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "concurrcontrol"),false, master); |
| | | logs.add(new User_Log(User_Log.Alter,User_Log.electricsystem,einf.electric_name+"恒流控制",flag)); |
| | | } catch (InterruptedException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | |
| | | }*/ |
| | | //单套电源启动:启动位=1;其他模式运行=1;风机启动=1; |
| | | if(ecs.startposition >0) { |
| | | //System.out.println("单套电源启动"); |
| | | try { |
| | | //System.out.println("ecs.startposition==="+ecs.startposition); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "startposition"),true, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "othermodes"),true, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "fanstart"),true, master); |
| | | try { |
| | | boolean flag = MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "startposition"),true, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "othermodes"),true, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "fanstart"),true, master); |
| | | //300毫秒后复原 |
| | | Thread.sleep(300); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "startposition"),false, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "othermodes"),false, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "fanstart"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "startposition"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "othermodes"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "fanstart"),false, master); |
| | | logs.add(new User_Log(User_Log.Start_up,User_Log.electricsystem,einf.electric_name,flag)); |
| | | } catch (InterruptedException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | //单套电源停止:停止位=1;风机停止=1 |
| | | if(ecs.stopposition >0) { |
| | | //System.out.println("单套电源停止"); |
| | | //System.out.println("ecs.stopposition==="+ecs.stopposition); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "stopposition"),true, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "fanstop"),true, master); |
| | | try { |
| | | boolean flag = MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "stopposition"),true, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "fanstop"),true, master); |
| | | //300毫秒后复原 |
| | | Thread.sleep(300); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "stopposition"),false, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "fanstop"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "stopposition"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "fanstop"),false, master); |
| | | logs.add(new User_Log(User_Log.End,User_Log.electricsystem,einf.electric_name,flag)); |
| | | } catch (InterruptedException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | //复位 |
| | | if(ecs.resetposition >0) { |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "resetposition"),true,master); |
| | | boolean flag = MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "resetposition"),true,master); |
| | | logs.add(new User_Log(User_Log.Alter,User_Log.electricsystem,einf.electric_name+"复位",flag)); |
| | | } |
| | | |
| | | //故障复位 |
| | | if(ecs.screen_reset >0) { |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "screen_reset"),true,master); |
| | | try { |
| | | boolean flag = MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "screen_reset"),true,master); |
| | | Thread.sleep(300); |
| | | //300毫秒复原 |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "screen_reset"),false,master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "screen_reset"),false,master); |
| | | logs.add(new User_Log(User_Log.Alter,User_Log.electricsystem,einf.electric_name+"故障复位",flag)); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | if(ecs.fanstop >0) { |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "fanstop"),true, master); |
| | | }*/ |
| | | //直流电压 |
| | | if(ecs.dcvol >0) { |
| | | MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "dcvol"), ecs.dcvol, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | boolean flag = MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "dcvol"), ecs.dcvol, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | logs.add(new User_Log(User_Log.Alter,User_Log.electricsystem,einf.electric_name+"直流电压为:"+ecs.dcvol,flag)); |
| | | } |
| | | //直流电流 |
| | | if(ecs.dccurr >0) { |
| | | MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "dccurr"), ecs.dccurr, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | boolean flag = MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "dccurr"), ecs.dccurr, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | logs.add(new User_Log(User_Log.Alter,User_Log.electricsystem,einf.electric_name+"直流电流为:"+ecs.dccurr,flag)); |
| | | } |
| | | //控制角 |
| | | if(ecs.controlangle >0) { |
| | | MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "controlangle"), ecs.controlangle, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | boolean flag = MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "controlangle"), ecs.controlangle, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | logs.add(new User_Log(User_Log.Alter,User_Log.electricsystem,einf.electric_name+"控制角为:"+ecs.controlangle,flag)); |
| | | } |
| | | //电源对应输出开关 |
| | | /* |
| | |
| | | C 电源对应输出开关:二号转换开关柜KM1,KM2 |
| | | D电源对应输出开关:二号转换开关柜KM3,KM4 |
| | | */ |
| | | //开关柜合闸指令 |
| | | if(ecs.switchon >0) { |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "switchon_1"),true, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "switchon_2"),true, master); |
| | | try { |
| | | boolean flag = MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "switchon_1"),true, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "switchon_2"),true, master); |
| | | //300毫秒后复原 |
| | | Thread.sleep(300); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "switchon_1"),false, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "switchon_2"),false, master); |
| | | } catch (InterruptedException e) { |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "switchon_1"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "switchon_2"),false, master); |
| | | logs.add(new User_Log(User_Log.Alter,User_Log.electricsystem,einf.electric_name+"开关合闸",flag)); |
| | | } catch (InterruptedException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | //开关柜分闸指令 |
| | | if(ecs.switchoff >0) { |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "switchoff_1"),true, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "switchoff_2"),true, master); |
| | | try { |
| | | boolean flag = MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "switchoff_1"),true, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "switchoff_2"),true, master); |
| | | //300毫秒后复原 |
| | | Thread.sleep(300); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "switchoff_1"),false, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "switchoff_2"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "switchoff_1"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(ecs.getElectric_id(), "switchoff_2"),false, master); |
| | | logs.add(new User_Log(User_Log.Alter,User_Log.electricsystem,einf.electric_name+"开关分闸",flag)); |
| | | } catch (InterruptedException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取组合名称 |
| | | */ |
| | | public String getGroupName(int ele_id) { |
| | | if(ele_id == 4001) { |
| | | return "AB套"; |
| | | }else if(ele_id == 4003) { |
| | | return "CD套"; |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 获取组合名称 |
| | | */ |
| | | public String getGroupSingleName(int ele_id,boolean close) { |
| | | if(close) { |
| | | if(ele_id == 4001) { |
| | | return "AB组合A套合闸"; |
| | | }else if(ele_id == 4002) { |
| | | return "AB组合B套合闸"; |
| | | }else if(ele_id == 4003) { |
| | | return "CD组合C套合闸"; |
| | | }else if(ele_id == 4004) { |
| | | return "CD组合D套合闸"; |
| | | } |
| | | }else { |
| | | if(ele_id == 4001) { |
| | | return "AB组合A套分闸"; |
| | | }else if(ele_id == 4002) { |
| | | return "AB组合B套分闸"; |
| | | }else if(ele_id == 4003) { |
| | | return "CD组合C套分闸"; |
| | | }else if(ele_id == 4004) { |
| | | return "CD组合D套分闸"; |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 组合控制输出 |
| | | * @param master |
| | | * @param ecs |
| | |
| | | \\本站点\B套恒压控制=1; |
| | | */ |
| | | if(econn.convolcontrol >0) { |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "convolcontrol"), true, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "convolcontrol"), true, master); |
| | | try { |
| | | boolean flag = MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "convolcontrol"), true, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "convolcontrol"), true, master); |
| | | //300毫秒后复原 |
| | | Thread.sleep(300); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "convolcontrol"), false, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "convolcontrol"), false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "convolcontrol"), false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "convolcontrol"), false, master); |
| | | logs.add(new User_Log(User_Log.Alter,User_Log.electricsystem,getGroupName(econn.electric_id)+"恒压控制",flag)); |
| | | } catch (InterruptedException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | |
| | | \\本站点\B套恒流控制=1; |
| | | */ |
| | | if(econn.concurrcontrol >0) { |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "concurrcontrol"), true, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "concurrcontrol"), true, master); |
| | | try { |
| | | boolean flag = MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "concurrcontrol"), true, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "concurrcontrol"), true, master); |
| | | //300毫秒后复原 |
| | | Thread.sleep(300); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "concurrcontrol"), false, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "concurrcontrol"), false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "concurrcontrol"), false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "concurrcontrol"), false, master); |
| | | logs.add(new User_Log(User_Log.Alter,User_Log.electricsystem,getGroupName(econn.electric_id)+"恒流控制",flag)); |
| | | } catch (InterruptedException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | |
| | | //并联模式(按钮按下):\\本站点\AB并串联标志位=0; |
| | | if(econn.conn_flag >0) { |
| | | //System.out.println("econn.conn_flag===="+econn.conn_flag); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getConnAddress(econn.getElectric_id(), "conn_flag"), false, master); |
| | | boolean flag = MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getConnAddress(econn.getElectric_id(), "conn_flag"), false, master); |
| | | logs.add(new User_Log(User_Log.Alter,User_Log.electricsystem,getGroupName(econn.electric_id)+"并联模式",flag)); |
| | | } |
| | | //串联模式(按钮按下):\\本站点\AB并串联标志位=1; |
| | | if(econn.divide_flag >0) { |
| | | //System.out.println("econn.divide_flag===="+econn.divide_flag); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getConnAddress(econn.getElectric_id(), "conn_flag"), true, master); |
| | | boolean flag = MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getConnAddress(econn.getElectric_id(), "conn_flag"), true, master); |
| | | logs.add(new User_Log(User_Log.Alter,User_Log.electricsystem,getGroupName(econn.electric_id)+"串联模式",flag)); |
| | | } |
| | | //电流电压给定确认(按钮按下): |
| | | /* |
| | |
| | | \\本站点\A套其他模式运行=1; |
| | | \\本站点\B套其他模式运行=1;} |
| | | */ |
| | | if(econn.volset >0) { |
| | | MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getConnAddress(econn.getElectric_id(), "givevol"), econn.givevol, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "upsetvol"),econn.givevol, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "othermodes"),true, master); |
| | | |
| | | MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "upsetvol"),econn.givevol, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "othermodes"),true, master); |
| | | |
| | | if(econn.volset >0) { |
| | | try { |
| | | //300毫秒后复原 |
| | | Thread.sleep(300); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "othermodes"),false, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "othermodes"),false, master); |
| | | boolean flag = MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getConnAddress(econn.getElectric_id(), "givevol"), econn.givevol, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | flag = flag&&MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "upsetvol"),econn.givevol, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "othermodes"),true, master); |
| | | |
| | | flag = flag&&MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "upsetvol"),econn.givevol, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "othermodes"),true, master); |
| | | |
| | | //300毫秒后复原 |
| | | Thread.sleep(300); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "othermodes"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "othermodes"),false, master); |
| | | |
| | | logs.add(new User_Log(User_Log.Alter,User_Log.electricsystem,getGroupName(econn.electric_id)+"电压给定确认:"+econn.givevol,flag)); |
| | | } catch (InterruptedException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | //电压电流给定确认 |
| | | if(econn.currset >0) { |
| | | MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getConnAddress(econn.getElectric_id(), "givecurr"), econn.givecurr, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "upsetcurr"),econn.givecurr, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "othermodes"),true, master); |
| | | |
| | | MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "upsetcurr"),econn.givecurr, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "othermodes"),true, master); |
| | | |
| | | try { |
| | | boolean flag = MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getConnAddress(econn.getElectric_id(), "givecurr"), econn.givecurr, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | flag = flag&&MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "upsetcurr"),econn.givecurr, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "othermodes"),true, master); |
| | | |
| | | flag = flag&&MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "upsetcurr"),econn.givecurr, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "othermodes"),true, master); |
| | | |
| | | //300毫秒后复原 |
| | | Thread.sleep(300); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "othermodes"),false, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "othermodes"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "othermodes"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "othermodes"),false, master); |
| | | |
| | | logs.add(new User_Log(User_Log.Alter,User_Log.electricsystem,getGroupName(econn.electric_id)+"电流给定确认",flag)); |
| | | } catch (InterruptedException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | //并联运行启动 |
| | | if(econn.conn_start >0) { |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getConnAddress(econn.getElectric_id(), "conn_start"),true, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "fanstart"),true, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "fanstart"),true, master); |
| | | |
| | | try { |
| | | boolean flag = MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getConnAddress(econn.getElectric_id(), "conn_start"),true, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "fanstart"),true, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "fanstart"),true, master); |
| | | |
| | | //300毫秒后复原 |
| | | Thread.sleep(300); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getConnAddress(econn.getElectric_id(), "conn_start"),false, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "fanstart"),false, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "fanstart"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getConnAddress(econn.getElectric_id(), "conn_start"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "fanstart"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "fanstart"),false, master); |
| | | |
| | | logs.add(new User_Log(User_Log.Alter,User_Log.electricsystem,getGroupName(econn.electric_id)+"组合启动",flag)); |
| | | } catch (InterruptedException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | //并联运行停止 |
| | | if(econn.conn_stop >0) { |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getConnAddress(econn.getElectric_id(), "conn_stop"),true, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "fanstop"),true, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "fanstop"),true, master); |
| | | |
| | | try { |
| | | boolean flag = MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getConnAddress(econn.getElectric_id(), "conn_stop"),true, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "fanstop"),true, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "fanstop"),true, master); |
| | | |
| | | //300毫秒后复原 |
| | | Thread.sleep(300); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getConnAddress(econn.getElectric_id(), "conn_stop"),false, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "fanstop"),false, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "fanstop"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getConnAddress(econn.getElectric_id(), "conn_stop"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "fanstop"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "fanstop"),false, master); |
| | | |
| | | logs.add(new User_Log(User_Log.Alter,User_Log.electricsystem,getGroupName(econn.electric_id)+"组合停止",flag)); |
| | | } catch (InterruptedException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | //第一套合闸 |
| | | if(econn.switchon1 >0) { |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "switchon_1"),true, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "switchon_2"),true, master); |
| | | try { |
| | | boolean flag = MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "switchon_1"),true, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "switchon_2"),true, master); |
| | | //300毫秒后复原 |
| | | Thread.sleep(300); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "switchon_1"),false, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "switchon_2"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "switchon_1"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "switchon_2"),false, master); |
| | | |
| | | logs.add(new User_Log(User_Log.Alter,User_Log.electricsystem,getGroupSingleName(econn.electric_id,true),flag)); |
| | | } catch (InterruptedException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | //第二套合闸 |
| | | if(econn.switchon2 >0) { |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "switchon_1"),true, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "switchon_2"),true, master); |
| | | try { |
| | | boolean flag = MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "switchon_1"),true, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "switchon_2"),true, master); |
| | | //300毫秒后复原 |
| | | Thread.sleep(300); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "switchon_1"),false, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "switchon_2"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "switchon_1"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "switchon_2"),false, master); |
| | | logs.add(new User_Log(User_Log.Alter,User_Log.electricsystem,getGroupSingleName(econn.getElectric_id()+1,true),flag)); |
| | | } catch (InterruptedException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | //第一套分闸 |
| | | if(econn.switchoff1 >0) { |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "switchoff_1"),true, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "switchoff_2"),true, master); |
| | | try { |
| | | boolean flag = MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "switchoff_1"),true, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "switchoff_2"),true, master); |
| | | //300毫秒后复原 |
| | | Thread.sleep(300); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "switchoff_1"),false, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "switchoff_2"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "switchoff_1"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "switchoff_2"),false, master); |
| | | logs.add(new User_Log(User_Log.Alter,User_Log.electricsystem,getGroupSingleName(econn.getElectric_id(),false),flag)); |
| | | } catch (InterruptedException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | //第二套分闸 |
| | | if(econn.switchoff2 >0) { |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "switchoff_1"),true, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "switchoff_2"),true, master); |
| | | try { |
| | | boolean flag = MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "switchoff_1"),true, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "switchoff_2"),true, master); |
| | | //300毫秒后复原 |
| | | Thread.sleep(300); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "switchoff_1"),false, master); |
| | | MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "switchoff_2"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "switchoff_1"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "switchoff_2"),false, master); |
| | | logs.add(new User_Log(User_Log.Alter,User_Log.electricsystem,getGroupSingleName(econn.getElectric_id()+1,false),flag)); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |