| | |
| | | import com.modbus.data.MyModbusUtils; |
| | | import com.serotonin.modbus4j.BatchRead; |
| | | import com.serotonin.modbus4j.BatchResults; |
| | | import com.serotonin.modbus4j.code.DataType; |
| | | |
| | | public class Water_alarm implements Serializable{ |
| | | public int num; |
| | |
| | | */ |
| | | public BatchRead<Integer> createBatchRead(MyModbusMaster master){ |
| | | BatchRead<Integer> batch = new BatchRead<Integer>(); |
| | | batch.addLocator(0,MyModbusUtils.createBaseLocator(Watersystem_ModbusAddress.Watersystem_Operation_Fault ,master));//冷却系统各部件故障信息 |
| | | batch.addLocator(1,MyModbusUtils.createBaseLocator(Watersystem_ModbusAddress.Watersystem_BranchFlowTmp_Fault ,master));//冷却系统支路流量/温度故障信息 |
| | | batch.addLocator(2,MyModbusUtils.createBaseLocator(Watersystem_ModbusAddress.Watersystem_Pre_Fault , master));//冷却水压力故障 |
| | | batch.addLocator(3,MyModbusUtils.createBaseLocator(Watersystem_ModbusAddress.Watersystem_Operation_highorlow, master));//冷却系统各部件低/高 |
| | | batch.addLocator(4,MyModbusUtils.createBaseLocator(Watersystem_ModbusAddress.Watersystem_Tmp_highorlow, master));//冷却系统温度高/超高 |
| | | batch.addLocator(5,MyModbusUtils.createBaseLocator(Watersystem_ModbusAddress.Watersystem_TmpFlow_highorlow, master));//冷却系统支路温度/流量低/超低 |
| | | batch.addLocator(6,MyModbusUtils.createBaseLocator(Watersystem_ModbusAddress.Watersystem_Flow_ighorlow, master));//冷却水部分支路流量低/超低 |
| | | batch.addLocator(0,MyModbusUtils.createBaseLocator(Watersystem_ModbusAddress.Watersystem_Operation_Fault,DataType.TWO_BYTE_INT_UNSIGNED,master));//冷却系统各部件故障信息 |
| | | batch.addLocator(1,MyModbusUtils.createBaseLocator(Watersystem_ModbusAddress.Watersystem_BranchFlowTmp_Fault,DataType.TWO_BYTE_INT_UNSIGNED,master));//冷却系统支路流量/温度故障信息 |
| | | batch.addLocator(2,MyModbusUtils.createBaseLocator(Watersystem_ModbusAddress.Watersystem_Pre_Fault ,DataType.TWO_BYTE_INT_UNSIGNED, master));//冷却水压力故障 |
| | | batch.addLocator(3,MyModbusUtils.createBaseLocator(Watersystem_ModbusAddress.Watersystem_Operation_highorlow,DataType.TWO_BYTE_INT_UNSIGNED, master));//冷却系统各部件低/高 |
| | | batch.addLocator(4,MyModbusUtils.createBaseLocator(Watersystem_ModbusAddress.Watersystem_Tmp_highorlow,DataType.TWO_BYTE_INT_UNSIGNED, master));//冷却系统温度高/超高 |
| | | batch.addLocator(5,MyModbusUtils.createBaseLocator(Watersystem_ModbusAddress.Watersystem_TmpFlow_highorlow,DataType.TWO_BYTE_INT_UNSIGNED, master));//冷却系统支路温度/流量低/超低 |
| | | batch.addLocator(6,MyModbusUtils.createBaseLocator(Watersystem_ModbusAddress.Watersystem_Flow_ighorlow,DataType.TWO_BYTE_INT_UNSIGNED, master));//冷却水部分支路流量低/超低 |
| | | return batch; |
| | | } |
| | | /** |
| | |
| | | */ |
| | | public void putBatchResult(BatchResults<Integer> res) { |
| | | if(res != null) { |
| | | this.Watersystem_Operation_Fault = MyModbusUtils.readShortToInt(res.getValue(0)); |
| | | this.Watersystem_BranchFlowTmp_Fault = MyModbusUtils.readShortToInt(res.getValue(1)); |
| | | this.Watersystem_Pre_Fault = MyModbusUtils.readShortToInt(res.getValue(2)); |
| | | this.Watersystem_Operation_highorlow = MyModbusUtils.readShortToInt(res.getValue(3)); |
| | | this.Watersystem_Tmp_highorlow = MyModbusUtils.readShortToInt(res.getValue(4)); |
| | | this.Watersystem_TmpFlow_highorlow = MyModbusUtils.readShortToInt(res.getValue(5)); |
| | | this.Watersystem_Flow_ighorlow = MyModbusUtils.readShortToInt(res.getValue(6)); |
| | | this.Watersystem_Operation_Fault = MyModbusUtils.readIntergerToInt(res.getValue(0)); |
| | | this.Watersystem_BranchFlowTmp_Fault = MyModbusUtils.readIntergerToInt(res.getValue(1)); |
| | | this.Watersystem_Pre_Fault = MyModbusUtils.readIntergerToInt(res.getValue(2)); |
| | | this.Watersystem_Operation_highorlow = MyModbusUtils.readIntergerToInt(res.getValue(3)); |
| | | //System.out.println("1296:"+this.Watersystem_Operation_highorlow); |
| | | this.Watersystem_Tmp_highorlow = MyModbusUtils.readIntergerToInt(res.getValue(4)); |
| | | this.Watersystem_TmpFlow_highorlow = MyModbusUtils.readIntergerToInt(res.getValue(5)); |
| | | this.Watersystem_Flow_ighorlow = MyModbusUtils.readIntergerToInt(res.getValue(6)); |
| | | } |
| | | } |
| | | |