| | |
| | |
|
| | | return batch;
|
| | | }
|
| | | |
| | | /**
|
| | | * 创建读取集合
|
| | | * @param master
|
| | | * @return
|
| | | */
|
| | | public BatchRead<Integer> createHeadBatchRead(MyModbusMaster master) {
|
| | | BatchRead<Integer> batch = new BatchRead<Integer>();
|
| | | batch.addLocator(0,MyModbusUtils.createBaseLocator(58, DataType.TWO_BYTE_INT_SIGNED, master)); //加载功率给定 58 |
| | | batch.addLocator(1,MyModbusUtils.createBaseLocator(364, DataType.TWO_BYTE_INT_SIGNED, master)); //加载转矩给定 364
|
| | | batch.addLocator(2,MyModbusUtils.createBaseLocator(366, DataType.TWO_BYTE_INT_UNSIGNED_SWAPPED, master)); //加载电机转速限制 366
|
| | | batch.addLocator(3,MyModbusUtils.createBaseLocator(367, DataType.TWO_BYTE_INT_SIGNED, master)); //加载电机转矩限制 367
|
| | | batch.addLocator(4,MyModbusUtils.createBaseLocator(505, DataType.TWO_BYTE_INT_UNSIGNED, master)); //加载步长 505
|
| | | batch.addLocator(5,MyModbusUtils.createBaseLocator(1006, DataType.TWO_BYTE_INT_UNSIGNED, master)); //加载电机水冷进水风温1006
|
| | | batch.addLocator(6,MyModbusUtils.createBaseLocator(1008, DataType.TWO_BYTE_INT_UNSIGNED, master)); //加载电机水冷出水风温1008
|
| | | batch.addLocator(7,MyModbusUtils.createBaseLocator(1096, DataType.TWO_BYTE_INT_SIGNED, master)); //加载电机电流 1096
|
| | | batch.addLocator(8,MyModbusUtils.createBaseLocator(1099, DataType.TWO_BYTE_INT_SIGNED, master)); //加载电机功率 1099
|
| | | return batch;
|
| | | }
|
| | | |
| | | /**
|
| | | * 创建读取集合
|
| | | * @param master
|
| | | * @return
|
| | | */
|
| | | public BatchRead<Integer> createBodyBatchRead(MyModbusMaster master) {
|
| | | BatchRead<Integer> batch = new BatchRead<Integer>();
|
| | | batch.addLocator(9,MyModbusUtils.createBaseLocator(1101, DataType.TWO_BYTE_INT_SIGNED, master)); //加载电机转速 1101
|
| | | batch.addLocator(10,MyModbusUtils.createBaseLocator(1103, DataType.TWO_BYTE_INT_SIGNED, master)); //加载电机电压 1103
|
| | | batch.addLocator(11,MyModbusUtils.createBaseLocator(1119, DataType.TWO_BYTE_INT_SIGNED, master)); //加载电机绕组温度1 1119
|
| | | batch.addLocator(12,MyModbusUtils.createBaseLocator(1120, DataType.TWO_BYTE_INT_SIGNED, master)); //加载电机绕组温度2 1120
|
| | | batch.addLocator(13,MyModbusUtils.createBaseLocator(1121, DataType.TWO_BYTE_INT_SIGNED, master)); //加载电机绕组温度3 1121
|
| | | batch.addLocator(14,MyModbusUtils.createBaseLocator(1122, DataType.TWO_BYTE_INT_SIGNED, master)); //加载电机轴承温度1 1122
|
| | | batch.addLocator(15,MyModbusUtils.createBaseLocator(1123, DataType.TWO_BYTE_INT_SIGNED, master)); //加载电机轴承温度2 1123
|
| | | batch.addLocator(16,MyModbusUtils.createBaseLocator(1250, DataType.TWO_BYTE_INT_SIGNED, master)); //加载电机出口温度 1250
|
| | | batch.addLocator(17,MyModbusUtils.createBaseLocator(1124, DataType.TWO_BYTE_INT_SIGNED, master)); //加载电机进口温度 1124
|
| | | batch.addLocator(18,MyModbusUtils.createBaseLocator(1251, DataType.TWO_BYTE_INT_SIGNED, master)); //加载电机转矩 1251
|
| | | batch.addLocator(19,MyModbusUtils.createBaseLocator(5680, master)); //加载电机启动 5680
|
| | | batch.addLocator(20,MyModbusUtils.createBaseLocator(5681, master)); //加载电机停机 5681
|
| | | batch.addLocator(21,MyModbusUtils.createBaseLocator(8000, master)); //加载 8000
|
| | | batch.addLocator(22,MyModbusUtils.createBaseLocator(8001, master)); //减载 8001
|
| | | batch.addLocator(23,MyModbusUtils.createBaseLocator(8040, master)); //手动加载 8040
|
| | | batch.addLocator(24,MyModbusUtils.createBaseLocator(16005, master)); //加载电机紧停 16005
|
| | | batch.addLocator(25,MyModbusUtils.createBaseLocator(17082, master)); //加载电机风机状态 17082
|
| | | return batch;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 解析State读取集合
|
| | |
| | | this.record_time = new Date();
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 解析State读取集合
|
| | | * @param res
|
| | | */
|
| | | public void putHeadBatchResult(BatchResults<Integer> res) {
|
| | | if(res != null) {
|
| | | this.load_power = MyModbusUtils.readShortToFloat(res.getValue(0)); //加载功率给定 58 |
| | | this.load_torque = MyModbusUtils.readShortToFloat(res.getValue(1)); //加载转矩给定 364 |
| | | this.load_motor_speed_limit = MyModbusUtils.readIntegerToFloat(res.getValue(2)); //加载电机转速限制 366
|
| | | this.load_motor_torque_limit = MyModbusUtils.readShortToFloat(res.getValue(3)); //加载电机转矩限制 367
|
| | | this.load_step_length = MyModbusUtils.readIntegerToFloat(res.getValue(4)); //加载步长 505 |
| | | this.load_motor_inwater_tmp = MyModbusUtils.readIntegerToFloat(res.getValue(5)); //加载电机水冷进水风温 1006
|
| | | this.load_motor_outwater_tmp = MyModbusUtils.readIntegerToFloat(res.getValue(6)); //加载电机水冷出水风温 1008
|
| | | this.load_motor_curr = MyModbusUtils.readShortToFloat(res.getValue(7)); //加载电机电流 1096
|
| | | this.load_motor_power = MyModbusUtils.readShortToFloat(res.getValue(8)); //加载电机功率 1099
|
| | | this.record_time = new Date();
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 解析State读取集合
|
| | | * @param res
|
| | | */
|
| | | public void putBodyBatchResult(BatchResults<Integer> res) {
|
| | | if(res != null) {
|
| | | this.load_motor_speed = MyModbusUtils.readShortToFloat(res.getValue(9)); //加载电机转速 1101
|
| | | this.load_motor_vol = MyModbusUtils.readShortToFloat(res.getValue(10)); //加载电机电压 1103
|
| | | this.load_motor_wind_tmp1 = MyModbusUtils.readShortToFloat(res.getValue(11)); //加载电机绕组温度1 1119
|
| | | this.load_motor_wind_tmp2 = MyModbusUtils.readShortToFloat(res.getValue(12)); //加载电机绕组温度2 1120
|
| | | this.load_motor_wind_tmp3 = MyModbusUtils.readShortToFloat(res.getValue(13)); //加载电机绕组温度3 1121
|
| | | this.load_motor_bear_tmp1 = MyModbusUtils.readShortToFloat(res.getValue(14)); //加载电机轴承温度1 1122
|
| | | this.load_motor_bear_tmp2 = MyModbusUtils.readShortToFloat(res.getValue(15)); //加载电机轴承温度2 1123
|
| | | this.load_motor_out_tmp = MyModbusUtils.readShortToFloat(res.getValue(16)); //加载电机出口温度 1250
|
| | | this.load_motor_into_tmp = MyModbusUtils.readShortToFloat(res.getValue(17)); //加载电机进口温度 1124
|
| | | this.load_motor_torque = MyModbusUtils.readShortToFloat(res.getValue(18)); //加载电机转矩 1251
|
| | | this.load_motor_start = MyModbusUtils.readBooleanToInt(res.getValue(19)); //加载电机启动 5680
|
| | | this.load_motor_downtime = MyModbusUtils.readBooleanToInt(res.getValue(20)); //加载电机停机 5681
|
| | | this.load_add = MyModbusUtils.readBooleanToInt(res.getValue(21)); //加载 8000
|
| | | this.load_reduct = MyModbusUtils.readBooleanToInt(res.getValue(22)); //减载 8001
|
| | | this.load_manual = MyModbusUtils.readBooleanToInt(res.getValue(23)); //手动加载 8040
|
| | | this.load_motor_stop = MyModbusUtils.readBooleanToInt(res.getValue(24)); //加载电机紧停 16005
|
| | | this.load_motor_fan_state = MyModbusUtils.readBooleanToInt(res.getValue(25)); //加载电机风机状态 17082 |
| | | this.record_time = new Date();
|
| | | }
|
| | | }
|
| | | }
|