WaterSystem_MonitorServer/src/com/base/ComBase.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WaterSystem_MonitorServer/src/com/modbus/data/MyModbusUtils.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WaterSystem_MonitorServer/src/com/watersystem/monitor/Water_brach.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WaterSystem_MonitorServer/src/com/watersystem/monitor/Water_rt.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
WaterSystem_MonitorServer/src/com/base/ComBase.java
@@ -34,6 +34,18 @@ int tmp = data; return (tmp & 0xFFFF); } /** * * @param data * @param signed true:有符号 false:无符号 * @return */ public static int changeShortToInt(short data,boolean signed) { int tmp = data; return !signed?tmp&0xFFFF:tmp; } //------------------------------------------------------------------------------ public static double changeShortToDouble(short data) { WaterSystem_MonitorServer/src/com/modbus/data/MyModbusUtils.java
@@ -395,7 +395,15 @@ public static float readShortToFloat(Object obj) { return (float)ComBase.changeShortToInt((Short)obj); } /** * * @param obj * @param signed true:有符号数 false:无符号 * @return */ public static float readShortToFloat(Object obj,boolean signed) { return (float)ComBase.changeShortToInt((Short)obj,signed); } /** * 读取int类型数据 * @param obj Short类型 WaterSystem_MonitorServer/src/com/watersystem/monitor/Water_brach.java
@@ -359,25 +359,25 @@ this.Branch_flow_8 = MyModbusUtils.readShortToFloat(res.getValue(7))/100; this.Branch_flow_9 = MyModbusUtils.readShortToFloat(res.getValue(8))/100; this.Branch_tmp_1 = MyModbusUtils.readShortToFloat(res.getValue(9))/10; this.Branch_tmp_2 = MyModbusUtils.readShortToFloat(res.getValue(10))/10; this.Branch_tmp_3 = MyModbusUtils.readShortToFloat(res.getValue(11))/10; this.Branch_tmp_4 = MyModbusUtils.readShortToFloat(res.getValue(12))/10; this.Branch_tmp_5 = MyModbusUtils.readShortToFloat(res.getValue(13))/10; this.Branch_tmp_6 = MyModbusUtils.readShortToFloat(res.getValue(14))/10; this.Branch_tmp_7 = MyModbusUtils.readShortToFloat(res.getValue(15))/10; this.Branch_tmp_8 = MyModbusUtils.readShortToFloat(res.getValue(16))/10; this.Branch_tmp_9 = MyModbusUtils.readShortToFloat(res.getValue(17))/10; this.Branch_tmp_1 = MyModbusUtils.readShortToFloat(res.getValue(9),true)/10; this.Branch_tmp_2 = MyModbusUtils.readShortToFloat(res.getValue(10),true)/10; this.Branch_tmp_3 = MyModbusUtils.readShortToFloat(res.getValue(11),true)/10; this.Branch_tmp_4 = MyModbusUtils.readShortToFloat(res.getValue(12),true)/10; this.Branch_tmp_5 = MyModbusUtils.readShortToFloat(res.getValue(13),true)/10; this.Branch_tmp_6 = MyModbusUtils.readShortToFloat(res.getValue(14),true)/10; this.Branch_tmp_7 = MyModbusUtils.readShortToFloat(res.getValue(15),true)/10; this.Branch_tmp_8 = MyModbusUtils.readShortToFloat(res.getValue(16),true)/10; this.Branch_tmp_9 = MyModbusUtils.readShortToFloat(res.getValue(17),true)/10; this.Branch_pre_1 = MyModbusUtils.readShortToFloat(res.getValue(18))/100; this.Branch_pre_2 = MyModbusUtils.readShortToFloat(res.getValue(19))/100; this.Branch_pre_3 = MyModbusUtils.readShortToFloat(res.getValue(20))/100; this.Branch_pre_4 = MyModbusUtils.readShortToFloat(res.getValue(21))/100; this.Branch_pre_5 = MyModbusUtils.readShortToFloat(res.getValue(22))/100; this.Branch_pre_6 = MyModbusUtils.readShortToFloat(res.getValue(23))/100; this.Branch_pre_7 = MyModbusUtils.readShortToFloat(res.getValue(24))/100; this.Branch_pre_8 = MyModbusUtils.readShortToFloat(res.getValue(25))/100; this.Branch_pre_9 = MyModbusUtils.readShortToFloat(res.getValue(26))/100; this.Branch_pre_1 = MyModbusUtils.readShortToFloat(res.getValue(18),true)/100; this.Branch_pre_2 = MyModbusUtils.readShortToFloat(res.getValue(19),true)/100; this.Branch_pre_3 = MyModbusUtils.readShortToFloat(res.getValue(20),true)/100; this.Branch_pre_4 = MyModbusUtils.readShortToFloat(res.getValue(21),true)/100; this.Branch_pre_5 = MyModbusUtils.readShortToFloat(res.getValue(22),true)/100; this.Branch_pre_6 = MyModbusUtils.readShortToFloat(res.getValue(23),true)/100; this.Branch_pre_7 = MyModbusUtils.readShortToFloat(res.getValue(24),true)/100; this.Branch_pre_8 = MyModbusUtils.readShortToFloat(res.getValue(25),true)/100; this.Branch_pre_9 = MyModbusUtils.readShortToFloat(res.getValue(26),true)/100; //System.out.println(this.Branch_pre_9+"*****"); } } WaterSystem_MonitorServer/src/com/watersystem/monitor/Water_rt.java
@@ -155,18 +155,18 @@ */ public void putBatchResult(BatchResults<Integer> res) { if(res != null) { this.cooling_flow = MyModbusUtils.readShortToFloat(res.getValue(0))/10; this.supply_tmp = MyModbusUtils.readShortToFloat(res.getValue(1))/10; this.Supply_pre = MyModbusUtils.readShortToFloat(res.getValue(2))/100; this.back_tem = MyModbusUtils.readShortToFloat(res.getValue(3))/10; this.back_pre = MyModbusUtils.readShortToFloat(res.getValue(4))/100; this.cooling_flow = MyModbusUtils.readShortToFloat(res.getValue(0),true); this.supply_tmp = MyModbusUtils.readShortToFloat(res.getValue(1),true)/10; this.Supply_pre = MyModbusUtils.readShortToFloat(res.getValue(2),true)/100; this.back_tem = MyModbusUtils.readShortToFloat(res.getValue(3),true)/10; this.back_pre = MyModbusUtils.readShortToFloat(res.getValue(4),true)/100; this.Cooling_ser = MyModbusUtils.readShortToFloat(res.getValue(5))/100; this.Buffer_tank_level = MyModbusUtils.readShortToFloat(res.getValue(6)); this.Buffer_tank_pre = MyModbusUtils.readShortToFloat(res.getValue(7))/100; this.Buffer_tank_pre = MyModbusUtils.readShortToFloat(res.getValue(7),true)/100; this.Humidity_chamber = MyModbusUtils.readShortToFloat(res.getValue(8))/10; this.Tem_chamber= MyModbusUtils.readShortToFloat(res.getValue(9))/10; this.External_tmp= MyModbusUtils.readShortToFloat(res.getValue(10))/10; this.External_pre = MyModbusUtils.readShortToFloat(res.getValue(11))/100; this.Tem_chamber= MyModbusUtils.readShortToFloat(res.getValue(9),true)/10; this.External_tmp= MyModbusUtils.readShortToFloat(res.getValue(10),true)/10; this.External_pre = MyModbusUtils.readShortToFloat(res.getValue(11),true)/100; } }