package com.motor.data;
|
|
import java.util.Date;
|
import com.modbus.data.MyModbusMaster;
|
import com.modbus.data.MyModbusUtils;
|
import com.serotonin.modbus4j.BatchRead;
|
import com.serotonin.modbus4j.BatchResults;
|
import com.serotonin.modbus4j.code.DataType;
|
|
public class Subject_motor_state {
|
public int motor_id; //µç»úid
|
public Date record_time; //¸üÐÂʱ¼ä
|
public float sensor_torque; //´«¸ÐÆ÷ת¾Ø 330
|
public float sensor_power; //´«¸ÐÆ÷¹¦ÂÊ 514
|
public int fault_confirm; //¹ÊÕÏÈ·ÈÏ 801
|
public float gear_box_power; //³ÝÂÖÏäÖṦÂÊ 853
|
public float advance_power; //ÍÆ½øÖṦÂÊ 854
|
public float gear_box_tmp1; //³ÝÂÖÏäÖá³ÐζÈ1 1010
|
public float gear_box_tmp2; //³ÝÂÖÏäÖá³ÐζÈ2 1011
|
public float gear_box_tmp3; //³ÝÂÖÏäÖá³ÐζÈ3 1012
|
public float gear_box_tmp4; //³ÝÂÖÏäÖá³ÐζÈ4 1013
|
public float gear_box_tmp5; //³ÝÂÖÏäÖá³ÐζÈ5 1014
|
public float gear_box_tmp6; //³ÝÂÖÏäÖá³ÐζÈ6 1015
|
public int gas_station_start; //ÓÍÕ¾Æô¶¯ 4480
|
public int gas_station_stop; //ÓÍվͣ»ú 4481
|
public int pow_control; //¹¦ÂÊ¿ØÖÆ 5683
|
public int torque_control; //ת¾Ø¿ØÖÆ 5684
|
public int transformer_hightmp_alarm; //±äѹÆ÷¸ßα¨¾¯ 16000
|
public int transformer_hightmp_fault; //±äѹÆ÷¸ßιÊÕÏ 16001
|
public int transformer_lackphase_alarm; //±äѹÆ÷ȱÏ౨¾¯ 16007
|
public int lubrication_pump1_start; //È󻬱Ã1ÔËÐÐ 16008
|
public int lubrication_pump2_start; //È󻬱Ã2ÔËÐÐ 16009
|
public int lubrication_remote_start_allow; //Èó»¬ÔÊÐíÔ¶³ÌÆô¶¯ 16011
|
public int remote_control; //Ò£¿Ø/¾ÍµØ 17056
|
public int inverter_ready; //±äƵÆ÷¾ÍÐ÷ 17065
|
public int inverter_running; //±äƵÆ÷ÔËÐÐ 17066
|
public int inverter_alarm; //±äƵÆ÷±¨¾¯ 17067
|
public int inverter_fault; //±äƵÆ÷¹ÊÕÏ 17068
|
public int lubrication_host_running_allow; //Èó»¬ÔÊÐíÖ÷»úÔËÐÐ 17069
|
public int main_switch_state; //Ö÷¿ª¹Ø×´Ì¬ 17084
|
public int subject_motor_running; //ÊÜÊÔµç»úÔËÐÐ 17091
|
public int subject_motor_alarm; //ÊÜÊÔµç»ú±¨¾¯ 17136
|
public int subject_motor_fault; //ÊÜÊÔµç»ú¹ÊÕÏ 17346
|
public int subject_motor_stop; //ÊÜÊÔµç»ú½ôÍ£ 17347
|
public int lubrication_falut; //È󻬹ÊÕÏ 17348
|
public int lubrication_alarm; //È󻬱¨¾¯ 17349
|
|
public Subject_motor_state(int motor_id) {
|
this.motor_id = motor_id;
|
record_time = new Date();
|
}
|
public int getMotor_id() {
|
return motor_id;
|
}
|
public Date getRecord_time() {
|
return record_time;
|
}
|
public float getSensor_torque() {
|
return sensor_torque;
|
}
|
public float getSensor_power() {
|
return sensor_power;
|
}
|
public int getFault_confirm() {
|
return fault_confirm;
|
}
|
public float getGear_box_power() {
|
return gear_box_power;
|
}
|
public float getAdvance_power() {
|
return advance_power;
|
}
|
public float getGear_box_tmp1() {
|
return gear_box_tmp1;
|
}
|
public float getGear_box_tmp2() {
|
return gear_box_tmp2;
|
}
|
public float getGear_box_tmp3() {
|
return gear_box_tmp3;
|
}
|
public float getGear_box_tmp4() {
|
return gear_box_tmp4;
|
}
|
public float getGear_box_tmp5() {
|
return gear_box_tmp5;
|
}
|
public float getGear_box_tmp6() {
|
return gear_box_tmp6;
|
}
|
public int getGas_station_start() {
|
return gas_station_start;
|
}
|
public int getGas_station_stop() {
|
return gas_station_stop;
|
}
|
public int getPow_control() {
|
return pow_control;
|
}
|
public int getTorque_control() {
|
return torque_control;
|
}
|
public int getTransformer_hightmp_alarm() {
|
return transformer_hightmp_alarm;
|
}
|
public int getTransformer_hightmp_fault() {
|
return transformer_hightmp_fault;
|
}
|
public int getTransformer_lackphase_alarm() {
|
return transformer_lackphase_alarm;
|
}
|
public int getLubrication_pump1_start() {
|
return lubrication_pump1_start;
|
}
|
public int getLubrication_pump2_start() {
|
return lubrication_pump2_start;
|
}
|
public int getLubrication_remote_start_allow() {
|
return lubrication_remote_start_allow;
|
}
|
public int getRemote_control() {
|
return remote_control;
|
}
|
public int getInverter_ready() {
|
return inverter_ready;
|
}
|
public int getInverter_running() {
|
return inverter_running;
|
}
|
public int getInverter_alarm() {
|
return inverter_alarm;
|
}
|
public int getInverter_fault() {
|
return inverter_fault;
|
}
|
public int getLubrication_host_running_allow() {
|
return lubrication_host_running_allow;
|
}
|
public int getMain_switch_state() {
|
return main_switch_state;
|
}
|
public int getSubject_motor_running() {
|
return subject_motor_running;
|
}
|
public int getSubject_motor_alarm() {
|
return subject_motor_alarm;
|
}
|
public int getSubject_motor_fault() {
|
return subject_motor_fault;
|
}
|
public int getSubject_motor_stop() {
|
return subject_motor_stop;
|
}
|
public int getLubrication_falut() {
|
return lubrication_falut;
|
}
|
public int getLubrication_alarm() {
|
return lubrication_alarm;
|
}
|
public void setMotor_id(int motor_id) {
|
this.motor_id = motor_id;
|
}
|
public void setRecord_time(Date record_time) {
|
this.record_time = record_time;
|
}
|
public void setSensor_torque(float sensor_torque) {
|
this.sensor_torque = sensor_torque;
|
}
|
public void setSensor_power(float sensor_power) {
|
this.sensor_power = sensor_power;
|
}
|
public void setFault_confirm(int fault_confirm) {
|
this.fault_confirm = fault_confirm;
|
}
|
public void setGear_box_power(float gear_box_power) {
|
this.gear_box_power = gear_box_power;
|
}
|
public void setAdvance_power(float advance_power) {
|
this.advance_power = advance_power;
|
}
|
public void setGear_box_tmp1(float gear_box_tmp1) {
|
this.gear_box_tmp1 = gear_box_tmp1;
|
}
|
public void setGear_box_tmp2(float gear_box_tmp2) {
|
this.gear_box_tmp2 = gear_box_tmp2;
|
}
|
public void setGear_box_tmp3(float gear_box_tmp3) {
|
this.gear_box_tmp3 = gear_box_tmp3;
|
}
|
public void setGear_box_tmp4(float gear_box_tmp4) {
|
this.gear_box_tmp4 = gear_box_tmp4;
|
}
|
public void setGear_box_tmp5(float gear_box_tmp5) {
|
this.gear_box_tmp5 = gear_box_tmp5;
|
}
|
public void setGear_box_tmp6(float gear_box_tmp6) {
|
this.gear_box_tmp6 = gear_box_tmp6;
|
}
|
public void setGas_station_start(int gas_station_start) {
|
this.gas_station_start = gas_station_start;
|
}
|
public void setGas_station_stop(int gas_station_stop) {
|
this.gas_station_stop = gas_station_stop;
|
}
|
public void setPow_control(int pow_control) {
|
this.pow_control = pow_control;
|
}
|
public void setTorque_control(int torque_control) {
|
this.torque_control = torque_control;
|
}
|
public void setTransformer_hightmp_alarm(int transformer_hightmp_alarm) {
|
this.transformer_hightmp_alarm = transformer_hightmp_alarm;
|
}
|
public void setTransformer_hightmp_fault(int transformer_hightmp_fault) {
|
this.transformer_hightmp_fault = transformer_hightmp_fault;
|
}
|
public void setTransformer_lackphase_alarm(int transformer_lackphase_alarm) {
|
this.transformer_lackphase_alarm = transformer_lackphase_alarm;
|
}
|
public void setLubrication_pump1_start(int lubrication_pump1_start) {
|
this.lubrication_pump1_start = lubrication_pump1_start;
|
}
|
public void setLubrication_pump2_start(int lubrication_pump2_start) {
|
this.lubrication_pump2_start = lubrication_pump2_start;
|
}
|
public void setLubrication_remote_start_allow(int lubrication_remote_start_allow) {
|
this.lubrication_remote_start_allow = lubrication_remote_start_allow;
|
}
|
public void setRemote_control(int remote_control) {
|
this.remote_control = remote_control;
|
}
|
public void setInverter_ready(int inverter_ready) {
|
this.inverter_ready = inverter_ready;
|
}
|
public void setInverter_running(int inverter_running) {
|
this.inverter_running = inverter_running;
|
}
|
public void setInverter_alarm(int inverter_alarm) {
|
this.inverter_alarm = inverter_alarm;
|
}
|
public void setInverter_fault(int inverter_fault) {
|
this.inverter_fault = inverter_fault;
|
}
|
public void setLubrication_host_running_allow(int lubrication_host_running_allow) {
|
this.lubrication_host_running_allow = lubrication_host_running_allow;
|
}
|
public void setMain_switch_state(int main_switch_state) {
|
this.main_switch_state = main_switch_state;
|
}
|
public void setSubject_motor_running(int subject_motor_running) {
|
this.subject_motor_running = subject_motor_running;
|
}
|
public void setSubject_motor_alarm(int subject_motor_alarm) {
|
this.subject_motor_alarm = subject_motor_alarm;
|
}
|
public void setSubject_motor_fault(int subject_motor_fault) {
|
this.subject_motor_fault = subject_motor_fault;
|
}
|
public void setSubject_motor_stop(int subject_motor_stop) {
|
this.subject_motor_stop = subject_motor_stop;
|
}
|
public void setLubrication_falut(int lubrication_falut) {
|
this.lubrication_falut = lubrication_falut;
|
}
|
public void setLubrication_alarm(int lubrication_alarm) {
|
this.lubrication_alarm = lubrication_alarm;
|
}
|
@Override
|
public String toString() {
|
return "Subject_motor_state [motor_id=" + motor_id + ", record_time=" + record_time + ", sensor_torque="
|
+ sensor_torque + ", sensor_power=" + sensor_power + ", fault_confirm=" + fault_confirm
|
+ ", gear_box_power=" + gear_box_power + ", advance_power=" + advance_power + ", gear_box_tmp1="
|
+ gear_box_tmp1 + ", gear_box_tmp2=" + gear_box_tmp2 + ", gear_box_tmp3=" + gear_box_tmp3
|
+ ", gear_box_tmp4=" + gear_box_tmp4 + ", gear_box_tmp5=" + gear_box_tmp5 + ", gear_box_tmp6="
|
+ gear_box_tmp6 + ", gas_station_start=" + gas_station_start + ", gas_station_stop=" + gas_station_stop
|
+ ", pow_control=" + pow_control + ", torque_control=" + torque_control + ", transformer_hightmp_alarm="
|
+ transformer_hightmp_alarm + ", transformer_hightmp_fault=" + transformer_hightmp_fault
|
+ ", transformer_lackphase_alarm=" + transformer_lackphase_alarm + ", lubrication_pump1_start="
|
+ lubrication_pump1_start + ", lubrication_pump2_start=" + lubrication_pump2_start
|
+ ", lubrication_remote_start_allow=" + lubrication_remote_start_allow + ", remote_control="
|
+ remote_control + ", inverter_ready=" + inverter_ready + ", inverter_running=" + inverter_running
|
+ ", inverter_alarm=" + inverter_alarm + ", inverter_fault=" + inverter_fault
|
+ ", lubrication_host_running_allow=" + lubrication_host_running_allow + ", main_switch_state="
|
+ main_switch_state + ", subject_motor_running=" + subject_motor_running + ", subject_motor_alarm="
|
+ subject_motor_alarm + ", subject_motor_fault=" + subject_motor_fault + ", subject_motor_stop="
|
+ subject_motor_stop + ", lubrication_falut=" + lubrication_falut + ", lubrication_alarm="
|
+ lubrication_alarm + "]";
|
}
|
|
/**
|
* ´´½¨¶ÁÈ¡¼¯ºÏ
|
* @param master
|
* @return
|
*/
|
public BatchRead<Integer> createBatchRead(MyModbusMaster master) {
|
BatchRead<Integer> batch = new BatchRead<Integer>();
|
batch.addLocator(0,MyModbusUtils.createBaseLocator(330, DataType.TWO_BYTE_INT_SIGNED, master)); //´«¸ÐÆ÷ת¾Ø 330
|
batch.addLocator(1,MyModbusUtils.createBaseLocator(514, DataType.TWO_BYTE_INT_SIGNED, master)); //´«¸ÐÆ÷¹¦ÂÊ 514
|
batch.addLocator(2,MyModbusUtils.createBaseLocator(801, master)); //¹ÊÕÏÈ·ÈÏ 801
|
batch.addLocator(3,MyModbusUtils.createBaseLocator(853, DataType.TWO_BYTE_INT_SIGNED, master)); //³ÝÂÖÏäÖṦÂÊ 853
|
batch.addLocator(4,MyModbusUtils.createBaseLocator(854, DataType.TWO_BYTE_INT_SIGNED, master)); //ÍÆ½øÖṦÂÊ 854
|
batch.addLocator(5,MyModbusUtils.createBaseLocator(1010, DataType.TWO_BYTE_INT_UNSIGNED, master)); //³ÝÂÖÏäÖá³ÐζÈ1 1010
|
batch.addLocator(6,MyModbusUtils.createBaseLocator(1011, DataType.TWO_BYTE_INT_UNSIGNED, master)); //³ÝÂÖÏäÖá³ÐζÈ2 1011
|
batch.addLocator(7,MyModbusUtils.createBaseLocator(1012, DataType.TWO_BYTE_INT_UNSIGNED, master)); //³ÝÂÖÏäÖá³ÐζÈ3 1012
|
batch.addLocator(8,MyModbusUtils.createBaseLocator(1013, DataType.TWO_BYTE_INT_UNSIGNED, master)); //³ÝÂÖÏäÖá³ÐζÈ4 1013
|
batch.addLocator(9,MyModbusUtils.createBaseLocator(1014, DataType.TWO_BYTE_INT_UNSIGNED, master)); //³ÝÂÖÏäÖá³ÐζÈ5 1014
|
batch.addLocator(10,MyModbusUtils.createBaseLocator(1015, DataType.TWO_BYTE_INT_UNSIGNED, master)); //³ÝÂÖÏäÖá³ÐζÈ6 1015
|
batch.addLocator(11,MyModbusUtils.createBaseLocator(4480, master)); //ÓÍÕ¾Æô¶¯ 4480
|
batch.addLocator(12,MyModbusUtils.createBaseLocator(4481, master)); //ÓÍվͣ»ú 4481
|
batch.addLocator(13,MyModbusUtils.createBaseLocator(5683, master)); //¹¦ÂÊ¿ØÖÆ 5683
|
batch.addLocator(14,MyModbusUtils.createBaseLocator(5684, master)); //ת¾Ø¿ØÖÆ 5684
|
batch.addLocator(15,MyModbusUtils.createBaseLocator(16000, master)); //±äѹÆ÷¸ßα¨¾¯ 16000
|
batch.addLocator(16,MyModbusUtils.createBaseLocator(16001, master)); //±äѹÆ÷¸ßιÊÕÏ 16001
|
batch.addLocator(17,MyModbusUtils.createBaseLocator(16007, master)); //±äѹÆ÷ȱÏ౨¾¯ 16007
|
batch.addLocator(18,MyModbusUtils.createBaseLocator(16008, master)); //È󻬱Ã1ÔËÐÐ 16008
|
batch.addLocator(19,MyModbusUtils.createBaseLocator(16009, master)); //È󻬱Ã2ÔËÐÐ 16009
|
batch.addLocator(20,MyModbusUtils.createBaseLocator(16011, master)); //Èó»¬ÔÊÐíÔ¶³ÌÆô¶¯ 16011
|
batch.addLocator(21,MyModbusUtils.createBaseLocator(17056, master)); //Ò£¿Ø/¾ÍµØ 17056
|
batch.addLocator(22,MyModbusUtils.createBaseLocator(17065, master)); //±äƵÆ÷¾ÍÐ÷ 17065
|
batch.addLocator(23,MyModbusUtils.createBaseLocator(17066, master)); //±äƵÆ÷ÔËÐÐ 17066
|
batch.addLocator(24,MyModbusUtils.createBaseLocator(17067, master)); //±äƵÆ÷±¨¾¯ 17067
|
batch.addLocator(25,MyModbusUtils.createBaseLocator(17068, master)); //±äƵÆ÷¹ÊÕÏ 17068
|
batch.addLocator(26,MyModbusUtils.createBaseLocator(17069, master)); //Èó»¬ÔÊÐíÖ÷»úÔËÐÐ 17069
|
batch.addLocator(27,MyModbusUtils.createBaseLocator(17084, master)); //Ö÷¿ª¹Ø×´Ì¬ 17084
|
batch.addLocator(28,MyModbusUtils.createBaseLocator(17091, master)); //ÊÜÊÔµç»úÔËÐÐ 17091
|
batch.addLocator(29,MyModbusUtils.createBaseLocator(17136, master)); //ÊÜÊÔµç»ú±¨¾¯ 17136
|
batch.addLocator(30,MyModbusUtils.createBaseLocator(17346, master)); //ÊÜÊÔµç»ú¹ÊÕÏ 17346
|
batch.addLocator(31,MyModbusUtils.createBaseLocator(17347, master)); //ÊÜÊÔµç»ú½ôÍ£ 17347
|
batch.addLocator(32,MyModbusUtils.createBaseLocator(17348, master)); //È󻬹ÊÕÏ 17348
|
batch.addLocator(33,MyModbusUtils.createBaseLocator(17349, master)); //È󻬱¨¾¯ 17349
|
|
return batch;
|
}
|
|
/**
|
* ½âÎö¶ÁÈ¡¼¯ºÏ
|
* @param res
|
*/
|
public void putBatchResult(BatchResults<Integer> res) {
|
if(res != null) {
|
int index = 0;
|
this.sensor_torque = MyModbusUtils.readShortToFloat(res.getValue(index++),true); //´«¸ÐÆ÷ת¾Ø 330
|
this.sensor_power = MyModbusUtils.readShortToFloat(res.getValue(index++),true); //´«¸ÐÆ÷¹¦ÂÊ 514
|
this.fault_confirm = MyModbusUtils.readBooleanToInt(res.getValue(index++)); //¹ÊÕÏÈ·ÈÏ 801
|
this.gear_box_power = MyModbusUtils.readShortToFloat(res.getValue(index++),true); //³ÝÂÖÏäÖṦÂÊ 853
|
this.advance_power = MyModbusUtils.readShortToFloat(res.getValue(index++),true); //ÍÆ½øÖṦÂÊ 854
|
this.gear_box_tmp1 = MyModbusUtils.readIntegerToFloat(res.getValue(index++)); //³ÝÂÖÏäÖá³ÐζÈ1 1010
|
this.gear_box_tmp2 = MyModbusUtils.readIntegerToFloat(res.getValue(index++)); //³ÝÂÖÏäÖá³ÐζÈ2 1011
|
this.gear_box_tmp3 = MyModbusUtils.readIntegerToFloat(res.getValue(index++)); //³ÝÂÖÏäÖá³ÐζÈ3 1012
|
this.gear_box_tmp4 = MyModbusUtils.readIntegerToFloat(res.getValue(index++)); //³ÝÂÖÏäÖá³ÐζÈ4 1013
|
this.gear_box_tmp5 = MyModbusUtils.readIntegerToFloat(res.getValue(index++)); //³ÝÂÖÏäÖá³ÐζÈ5 1014
|
this.gear_box_tmp6 = MyModbusUtils.readIntegerToFloat(res.getValue(index++)); //³ÝÂÖÏäÖá³ÐζÈ6 1015
|
this.gas_station_start = MyModbusUtils.readBooleanToInt(res.getValue(index++)); //ÓÍÕ¾Æô¶¯ 4480
|
this.gas_station_stop = MyModbusUtils.readBooleanToInt(res.getValue(index++)); //ÓÍվͣ»ú 4481
|
this.pow_control = MyModbusUtils.readBooleanToInt(res.getValue(index++)); //¹¦ÂÊ¿ØÖÆ 5683
|
this.torque_control = MyModbusUtils.readBooleanToInt(res.getValue(index++)); //ת¾Ø¿ØÖÆ 5684
|
this.transformer_hightmp_alarm = MyModbusUtils.readBooleanToInt(res.getValue(index++)); //±äѹÆ÷¸ßα¨¾¯ 16000
|
this.transformer_hightmp_fault = MyModbusUtils.readBooleanToInt(res.getValue(index++)); //±äѹÆ÷¸ßιÊÕÏ 16001
|
this.transformer_lackphase_alarm = MyModbusUtils.readBooleanToInt(res.getValue(index++)); //±äѹÆ÷ȱÏ౨¾¯ 16007
|
this.lubrication_pump1_start = MyModbusUtils.readBooleanToInt(res.getValue(index++)); //È󻬱Ã1ÔËÐÐ 16008
|
this.lubrication_pump2_start = MyModbusUtils.readBooleanToInt(res.getValue(index++)); //È󻬱Ã2ÔËÐÐ 16009
|
this.lubrication_remote_start_allow = MyModbusUtils.readBooleanToInt(res.getValue(index++));//Èó»¬ÔÊÐíÔ¶³ÌÆô¶¯ 16011
|
this.remote_control = MyModbusUtils.readBooleanToInt(res.getValue(index++)); //Ò£¿Ø/¾ÍµØ 17056
|
this.inverter_ready = MyModbusUtils.readBooleanToInt(res.getValue(index++)); //±äƵÆ÷¾ÍÐ÷ 17065
|
this.inverter_running = MyModbusUtils.readBooleanToInt(res.getValue(index++)); //±äƵÆ÷ÔËÐÐ 17066
|
this.inverter_alarm = MyModbusUtils.readBooleanToInt(res.getValue(index++)); //±äƵÆ÷±¨¾¯ 17067
|
this.inverter_fault = MyModbusUtils.readBooleanToInt(res.getValue(index++)); //±äƵÆ÷¹ÊÕÏ 17068
|
this.lubrication_host_running_allow = MyModbusUtils.readBooleanToInt(res.getValue(index++));//Èó»¬ÔÊÐíÖ÷»úÔËÐÐ 17069
|
this.main_switch_state = MyModbusUtils.readBooleanToInt(res.getValue(index++)); //Ö÷¿ª¹Ø×´Ì¬ 17084
|
this.subject_motor_running = MyModbusUtils.readBooleanToInt(res.getValue(index++)); //ÊÜÊÔµç»úÔËÐÐ 17091
|
this.subject_motor_alarm = MyModbusUtils.readBooleanToInt(res.getValue(index++)); //ÊÜÊÔµç»ú±¨¾¯ 17136
|
this.subject_motor_fault = MyModbusUtils.readBooleanToInt(res.getValue(index++)); //ÊÜÊÔµç»ú¹ÊÕÏ 17346
|
this.subject_motor_stop = MyModbusUtils.readBooleanToInt(res.getValue(index++)); //ÊÜÊÔµç»ú½ôÍ£ 17347
|
this.lubrication_falut = MyModbusUtils.readBooleanToInt(res.getValue(index++)); //È󻬹ÊÕÏ 17348
|
this.lubrication_alarm = MyModbusUtils.readBooleanToInt(res.getValue(index++)); //È󻬱¨¾¯ 17349
|
this.record_time = new Date();
|
}
|
}
|
}
|