package com.dev.fbs9009;
|
|
import java.nio.ByteBuffer;
|
import java.nio.ByteOrder;
|
import java.util.Arrays;
|
import java.util.Date;
|
|
import com.base.ComBase;
|
import com.dev.fbs9100.ComFn;
|
import com.mysql.fabric.xmlrpc.base.Array;
|
|
public class MyModBusData {
|
public static final int[] SYS_STATE_ADDR_INDEX = new int[]{0x2000,0x2020,0x2040,0x2060}; //¶Áȡϵͳ״̬µÄ¼Ä´æÆ÷µØÖ·
|
public static final int[] BATT_STATE_ADDR_INDEX = new int[] {0x2100,0x2200,0x2300,0x2400}; //¶ÁÈ¡µç³Ø×´Ì¬µÄ¼Ä´æÆ÷µØÖ·
|
public static final int[] BATT_MON_DATA_ADDR_INDEX = new int[]{0x5000,0x5030,0x5060,0x5090}; //¶ÁÈ¡ÄÚ×èζȵļĴæÆ÷µØÖ·
|
|
private int cmd_addr; //·¢ËÍÊý¾ÝÃüÁîµÄÆðʼµØÖ·
|
|
private int cmd; //·¢ËÍÊý¾ÝµÄÃüÁî
|
private int dev_addr; //É豸µØÖ·
|
|
private int dev_id; //É豸id
|
private String dev_ip; //É豸ip
|
|
private int dev_count = 1; //´®ÁªÉ豸ÊýÁ¿
|
private int battgroupid; //µ±Ç°µÄµç³Ø×é
|
private int test_record_count = 1; //µ±Ç°µç³Ø×éµÄ·Åµç²âÊÔ´ÎÊý
|
|
private Date threadRunTime; //µ±Ç°Ï̵߳ÄÔËÐÐʱ¼ä
|
|
|
private Date recordhistorytime = new Date(2000,0,1); //¼Ç¼ÀúÊ·Êý¾ÝµÄʱ¼ä
|
|
private LD_sys_state[] ld_sys;
|
private LD_param ld_param;
|
private LD_date_time ld_date;
|
private LD_sys_version ld_version;
|
private LD_batt_states[] ld_batt_states;
|
|
private ConcentratorState concenState; //»ã¼¯Æ÷״̬±í
|
private ConcentratorParam concenParam; //»ã¼¯Æ÷²ÎÊý±í
|
|
private String err_logo = "";
|
|
private int Coment_errorcount = 0; //ͨÐÅ´íÎó¼ÆÊý
|
private int coment_totalcount = 0; //ͨÐżÆÊý
|
|
public MyModBusData() {
|
super();
|
//this.ld_sys = new LD_sys_state();
|
this.ld_param = new LD_param();
|
this.ld_date = new LD_date_time();
|
this.ld_version = new LD_sys_version();
|
//this.ld_batt_states = new LD_batt_states();
|
this.threadRunTime = new Date();
|
this.concenState = new ConcentratorState();
|
this.concenParam = new ConcentratorParam();
|
this.ld_sys = new LD_sys_state[1];
|
this.ld_sys[0] = new LD_sys_state();
|
this.ld_batt_states = new LD_batt_states[1];
|
this.ld_batt_states[0] = new LD_batt_states();
|
}
|
|
//³õʼ»¯É豸µÄ½ÚÊý(¼æÈݶą̀LD9¶ÈÉ豸´®Áª)
|
public void init(int moncount) {
|
int device_count = (int) Math.ceil((double)moncount/9);
|
if(device_count > 4) {
|
device_count =4; //×î¶à´®ÁªËĄ̈LD9¶ÈÉ豸
|
}else if(device_count <= 0){
|
device_count = 1;
|
}
|
if(this.ld_sys == null) {
|
this.ld_sys = new LD_sys_state[device_count];
|
for(int i=0;i<device_count;i++) {
|
this.ld_sys[i] = new LD_sys_state();
|
}
|
}else if(this.ld_sys.length < device_count){
|
LD_sys_state[] states = new LD_sys_state[device_count];
|
for(int i = 0 ;i<device_count;i++) {
|
if(i< this.ld_sys.length) {
|
states[i] = this.ld_sys[i];
|
}else {
|
states[i] = new LD_sys_state();
|
}
|
}
|
this.ld_sys = states;
|
}else if(this.ld_sys.length > device_count){
|
LD_sys_state[] states = new LD_sys_state[device_count];
|
for(int i = 0 ;i<device_count;i++) {
|
states[i] = this.ld_sys[i];
|
}
|
this.ld_sys = states;
|
|
}
|
if(this.ld_batt_states == null) {
|
this.ld_batt_states = new LD_batt_states[device_count];
|
for(int i=0;i<device_count;i++) {
|
this.ld_batt_states[i] = new LD_batt_states();
|
}
|
}else if(this.ld_batt_states.length < device_count) {
|
LD_batt_states[] battstates = new LD_batt_states[device_count];
|
for(int i=0;i<device_count;i++) {
|
if(i<this.ld_batt_states.length) {
|
battstates[i] = this.ld_batt_states[i];
|
}else {
|
battstates[i] = new LD_batt_states();
|
}
|
}
|
this.ld_batt_states = battstates;
|
}else if(this.ld_batt_states.length > device_count) {
|
LD_batt_states[] battstates = new LD_batt_states[device_count];
|
for(int i=0;i<device_count;i++) {
|
battstates[i] = this.ld_batt_states[i];
|
}
|
this.ld_batt_states = battstates;
|
}
|
this.dev_count = device_count;
|
//System.err.println(this.ld_sys.length);
|
//System.err.println(this.ld_batt_states.length);
|
}
|
|
/**
|
* »ñÈ¡µ±Ç°É豸µÄ×é¶ËµçѹÀÛ¼ÓºÍ
|
* @return
|
*/
|
public double getTotalGroupVol() {
|
double group_vols = 0;
|
for(int i=0;i<dev_count && i<ld_sys.length;i++) {
|
group_vols += this.ld_sys[i].getSys_group_vol();
|
}
|
return group_vols;
|
}
|
|
|
/*private int cmd; //·¢ËÍÊý¾ÝµÄÃüÁî
|
|
|
private int dataCount; //Êý¾ÝµÄ³¤¶È
|
|
private int dev_addr; //É豸µØÖ·
|
private int first_num; //µÚһ·µ¥ÌåÊýÄ¿
|
private int second_num; //µÚ¶þ·µ¥ÌåÊýÄ¿
|
private int thrid_num; //µÚÈý·µ¥ÌåÊýÄ¿
|
private int forth_num; //µÚËÄ·µ¥ÌåÊýÄ¿
|
private int fifth_num; //µÚÎå·µ¥ÌåÊýÄ¿
|
|
private float curr_range; //µçÁ÷ǯÁ¿³Ì
|
private float float_curr_limit; //¸¡³äµçÁ÷ÃÅÏÞ(0.1)
|
private float Curr_threshold; //ÎÆ²¨µçÁ÷·§Öµ (×Ô¶¯·¨²âÄÚ×èʱ,ÅжÏÎÆ²¨µçÁ÷´óСµÄ·§Öµ 0.01)
|
private float res_testcycle; //ÄÚ×è×Ô¶¯²âÊÔÖÜÆÚ(Сʱ)
|
private int res_testmethod; //ÄÚ×è²âÊÔ·½·¨
|
private int dischage_model; //·Åµçģʽ (·Åµç·¨²âÄÚ×èʱ,²ÉÓõķŵçģʽ 0-µ¥½Ú·Åµç 1-¹ã²¥·Åµç )
|
private double MonStdCap; //±ê³ÆÈÝÁ¿
|
|
|
|
private float system_version; //ϵͳ°æ±¾
|
private int system_state; //ϵͳ״̬ 0-³£¹æÄ£Ê½ 1-ÄÚ×èģʽ 2-±àַģʽ
|
private double group_vol; //×é¶Ëµçѹ
|
private double group_curr; //×é¶ËµçÁ÷
|
|
private int battstate; //µç³Ø×´Ì¬ 0-¸¡³ä 1-·Åµç 2-³äµç
|
private int curr_direction; //µçÁ÷·½Ïò 0-³äµç 1-·Åµç
|
|
private double curr_avg; //ÎÆ²¨µçÁ÷¾ùÖµ (0.01)
|
private double curr_peak; //ÎÆ²¨µçÁ÷·åÖµ (0.01)
|
|
private double reser1; //±£Áôλ1
|
private double reser2; //±£Áôλ1
|
private double reser3; //±£Áôλ1
|
private double reser4; //±£Áôλ1
|
private double reser5; //±£Áôλ1
|
private double reser6; //±£Áôλ1
|
|
private int res_testcount; //ÄÚ×è²âÊÔ´ÎÊý
|
private int monres_testmethod; //µ¥ÌåÄÚ×è²âÊÔ·½·¨
|
|
private double[] mon_vols; //µ¥Ìåµçѹ(0.01 V)
|
private double[] mon_tmps; //µ¥ÌåζÈ(ϵÊý0.1 ¡æ ÐèÒª¼õÈ¥10.0¡æ)
|
private double[] mon_ress; //µ¥ÌåÄÚ×è(ϵÊý0.001 m¦¸)
|
private double[] mon_currs; //µ¥Ìå¾ùºâµçÁ÷( µ¥Î»mA)
|
|
public int TOTAL_READ_MESSAGE = 126; //×î´ó¼Ä´æÆ÷ÊýÁ¿
|
|
public int mon_vol_start_index=0; //µ¥ÌåµçѹÆðʼλÖÃ
|
public int mon_vol_end_index=TOTAL_READ_MESSAGE; //µ¥Ìåµçѹ½áÊøÎ»ÖÃ
|
|
public int mon_tmp_start_index=0; //µ¥ÌåÎÂ¶ÈÆðʼλÖÃ
|
public int mon_tmp_end_index=TOTAL_READ_MESSAGE; //µ±ÌåζȽáÊøÎ»ÖÃ
|
|
public int mon_res_start_index=0; //µ¥ÌåÄÚ×èÆðʼλÖÃ
|
public int mon_res_end_index=TOTAL_READ_MESSAGE; //µ¥ÌåÄÚ×è½áÊøÎ»ÖÃ
|
|
public int mon_curr_start_index=0; //µ¥Ìå¾ùºâµçÁ÷ÆðʼλÖÃ
|
public int mon_curr_end_index=TOTAL_READ_MESSAGE; //µ¥Ìå¾ùºâµçÁ÷½áÊøÎ»ÖÃ
|
*/
|
public void setCmd(int cmd_addr) {
|
this.cmd_addr = cmd_addr;
|
}
|
|
/**
|
* дÈëÉ豸µÄ·µ»ØÊý¾Ý
|
* @param bf
|
* @return
|
*/
|
public boolean getDataFromTcp(ByteBuffer bf,int byteCount){
|
boolean flag = false;
|
//System.err.println("½ÓÊÕµ½Êý¾Ý"+ComFn.bytesToHexString(bf.array(), bf.array().length));
|
bf.position(0);
|
bf.order(ByteOrder.BIG_ENDIAN);
|
this.dev_addr = ComBase.changeByteToInt(bf.get());
|
this.cmd = ComBase.changeByteToInt(bf.get());
|
this.cmd_addr = ComBase.changeShortToInt(bf.getShort());
|
int code = ComBase.changeShortToInt(bf.getShort());
|
//System.err.println("code:"+code +"\t bytecount:"+byteCount);
|
if(code == byteCount){
|
//²Ù×÷½á¹ûµÈÓڼĴæÆ÷¸öÊýÊDzÙ×÷³É¹¦
|
err_logo = "²Ù×÷³É¹¦";
|
flag = true;
|
}else if(code != byteCount){
|
System.out.println(code +" == "+ byteCount);
|
|
err_logo = "²Ù×÷ʧ°Ü";
|
}
|
System.err.println(err_logo+"@@@@@@@@@@@@");
|
return flag;
|
}
|
|
/**
|
* Åж϶ÁÈ¡µÄÊý¾Ý
|
* @param bf
|
* @return
|
*/
|
public boolean checkData(ByteBuffer bf){
|
boolean flag = false;
|
//System.out.println("cmd_addr = " + cmd_addr);
|
bf.order(ByteOrder.BIG_ENDIAN);
|
int index = -1;
|
if((index = getDev_indexBySysReg_index(this.cmd_addr, BATT_STATE_ADDR_INDEX))> -1) {
|
return ld_batt_states[index].setLD_batt_state(bf); //¶ÁÈ¡µ¥ÌåÐÅÏ¢
|
}else if((index = getDev_indexBySysReg_index(this.cmd_addr, BATT_MON_DATA_ADDR_INDEX))>-1) {
|
return ld_batt_states[index].setLD_battmon_state(bf); //¶ÁÈ¡µç³Ø×éµ¥ÌåµçѹζÈÄÚ×èÊý¾Ý
|
}else if(MyModBusCom.LD_CMD_SYS_VERSION_ADDR == this.cmd_addr) {
|
return ld_version.setLD_sys_tem_version(bf); //¶ÁÈ¡É豸µÄ°æ±¾ÐÅÏ¢
|
}else if(MyModBusCom.LD_PARM_ADDR == this.cmd_addr) {
|
return ld_param.setLD_param(bf); //¶ÁÈ¡É豸²ÎÊýÐÅÏ¢
|
}else if(MyModBusCom.LD_DATE_TIME_ADDR == this.cmd_addr) {
|
return ld_date.setLD_param(bf); //¶ÁÈ¡É豸ʱ¼ä
|
}else if((index = getDev_indexBySysReg_index(this.cmd_addr, SYS_STATE_ADDR_INDEX))>-1) {
|
return ld_sys[index].setLD_sys_state(bf); //¶ÁÈ¡É豸״̬
|
}else if(MyModBusCom.LD_BATT_COLLECTIO_DATA_ADDR == this.cmd_addr) {
|
return concenState.setConcenState(bf); //¶ÁÈ¡»ã¼¯Æ÷״̬
|
}else if(MyModBusCom.LD_BATT_COLLECTIO_PARAM_ADDR == this.cmd_addr) {
|
return concenParam.setConcenParam(bf); //¶ÁÈ¡»ã¼¯Æ÷²ÎÊý
|
}
|
//System.out.println("@@@@@@@@@@@@@@@@@@@@@@@@@");
|
return flag;
|
}
|
|
public int getCmd_addr() {
|
return cmd_addr;
|
}
|
|
public void setCmd_addr(int cmd_addr) {
|
this.cmd_addr = cmd_addr;
|
}
|
|
public LD_param getLd_param() {
|
return ld_param;
|
}
|
|
public void setLd_param(LD_param ld_param) {
|
this.ld_param = ld_param;
|
}
|
|
public LD_date_time getLd_date() {
|
return ld_date;
|
}
|
|
public void setLd_date(LD_date_time ld_date) {
|
this.ld_date = ld_date;
|
}
|
|
public LD_sys_version getLd_version() {
|
return ld_version;
|
}
|
|
public void setLd_version(LD_sys_version ld_version) {
|
this.ld_version = ld_version;
|
}
|
|
public int getBattgroupid() {
|
return battgroupid;
|
}
|
|
|
|
public void setBattgroupid(int battgroupid) {
|
this.battgroupid = battgroupid;
|
}
|
|
|
|
public int getTest_record_count() {
|
return test_record_count;
|
}
|
|
|
|
public void setTest_record_count(int test_record_count) {
|
this.test_record_count = test_record_count;
|
}
|
|
public Date getThreadRunTime() {
|
return threadRunTime;
|
}
|
|
|
|
public void setThreadRunTime(Date threadRunTime) {
|
this.threadRunTime = threadRunTime;
|
}
|
|
|
|
public int getDev_id() {
|
return dev_id;
|
}
|
|
|
|
public void setDev_id(int dev_id) {
|
this.dev_id = dev_id;
|
}
|
|
public Date getRecordhistorytime() {
|
return recordhistorytime;
|
}
|
|
public String getDev_ip() {
|
return dev_ip;
|
}
|
|
|
|
public void setDev_ip(String dev_ip) {
|
this.dev_ip = dev_ip;
|
}
|
|
public ConcentratorState getConcenState() {
|
return concenState;
|
}
|
public ConcentratorParam getConcenParam() {
|
return concenParam;
|
}
|
public void setConcenState(ConcentratorState concenState) {
|
this.concenState = concenState;
|
}
|
public void setConcenParam(ConcentratorParam concenParam) {
|
this.concenParam = concenParam;
|
}
|
|
public LD_sys_state[] getLd_sys() {
|
return ld_sys;
|
}
|
|
public LD_batt_states[] getLd_batt_states() {
|
return ld_batt_states;
|
}
|
|
public void setLd_sys(LD_sys_state[] ld_sys) {
|
this.ld_sys = ld_sys;
|
}
|
|
public void setLd_batt_states(LD_batt_states[] ld_batt_states) {
|
this.ld_batt_states = ld_batt_states;
|
}
|
|
//Èç¹ûÉ豸ÕýÔڷŵçÔò·µ»Øµ±Ç°É豸״̬, ÕýÔڷŵçµÄÉ豸µÄ״̬,Èç¹ûÉ豸δ·ÅµçÔòÏÔʾµÚÒ»×éÉ豸µÄ״̬
|
public LD_sys_state getDischageSysState() {
|
for(int i = 0 ; i < this.dev_count ; i++) {
|
LD_sys_state sys_state = this.getLd_sys()[i];
|
//System.out.println(sys_state);
|
//Åжϵ±Ç°É豸ÊÇ·ñÕýÔڷŵç
|
if(sys_state.getSys_state() == MyModBusCom.SYS_STATE_HRTEST &&
|
((sys_state.getSys_now_battstate() == MyModBusCom.BATT_DISCHARGE)||
|
(sys_state.getSys_next_battstate() == MyModBusCom.BATT_DISCHARGE))) {
|
return sys_state;
|
}
|
}
|
return this.getLd_sys()[0];
|
}
|
|
/*//ÉèÖõ¥ÌåµçѹµÄÊý¾ÝÐÅÏ¢
|
private boolean setMon_vols(ByteBuffer bf) {
|
boolean flag = false;
|
ByteBuffer tmpbuf = bf;
|
System.out.println("pos:"+bf.position()+"\tlimit:"+bf.limit()+"\tcap"+bf.capacity());
|
tmpbuf.position(0);
|
try {
|
for(int i=mon_vol_start_index;i<mon_vol_end_index;i++){
|
mon_vols[i] = ComBase.changeShortToDouble(tmpbuf.getShort());
|
}
|
if(mon_vol_end_index<299){
|
if((mon_vol_end_index +TOTAL_READ_MESSAGE)>299){
|
mon_vol_end_index = 299;
|
mon_vol_start_index = mon_vol_end_index + 1;
|
|
System.out.println(mon_vol_start_index + "~" +mon_vol_end_index);
|
}else{
|
mon_vol_start_index = mon_vol_end_index;
|
mon_vol_end_index = mon_vol_end_index + TOTAL_READ_MESSAGE;
|
|
System.out.println(mon_vol_start_index + "~" +mon_vol_end_index);
|
}
|
}else{
|
mon_vol_start_index = 0;
|
mon_vol_end_index = TOTAL_READ_MESSAGE;
|
|
System.out.println(mon_vol_start_index + "~" +mon_vol_end_index);
|
}
|
|
} catch (Exception e) {
|
flag = false;
|
e.printStackTrace();
|
}
|
return flag;
|
}
|
|
//»ñÈ¡É豸ÉϵIJÎÊýÉèÖÃÐÅÏ¢
|
public boolean setDev_Param(ByteBuffer bf){
|
boolean flag = false;
|
ByteBuffer tmpbuf = bf;
|
System.out.println("pos:"+bf.position()+"\tlimit:"+bf.limit()+"\tcap"+bf.capacity());
|
tmpbuf.position(0);
|
try {
|
this.dev_addr = ComBase.changeByteToInt(tmpbuf.get()); //»ñÈ¡É豸µØÖ·
|
this.cmd = ComBase.changeByteToInt(tmpbuf.get());
|
//this.dataCount = ComBase.changeByteToInt(tmpbuf.get()); //Êý¾ÝÇø×Ö½ÚÊý
|
this.dataCount = ComBase.changeByteToInt(tmpbuf.get());
|
this.dev_addr = ComBase.changeShortToInt(tmpbuf.getShort()); //»ñÈ¡É豸µØÖ·
|
|
System.out.println("Êý¾ÝÇø×Ö½ÚÊýµÄ³¤¶È:"+this.dataCount);
|
|
this.first_num = ComBase.changeShortToInt(tmpbuf.getShort()); //µÚһ·µ¥ÌåÊýÄ¿
|
this.second_num = ComBase.changeShortToInt(tmpbuf.getShort()); //µÚ¶þ·µ¥ÌåÊýÄ¿
|
this.thrid_num = ComBase.changeShortToInt(tmpbuf.getShort()); //µÚÈý·µ¥ÌåÊýÄ¿
|
this.forth_num = ComBase.changeShortToInt(tmpbuf.getShort()); //µÚËÄ·µ¥ÌåÊýÄ¿
|
this.fifth_num = ComBase.changeShortToInt(tmpbuf.getShort()); //µÚÎå·µ¥ÌåÊýÄ¿
|
this.curr_range = ComBase.changeShortToInt(tmpbuf.getShort()); //µçÁ÷ǯÁ¿³Ì
|
this.float_curr_limit = ComBase.changeShortToByte(tmpbuf.getShort()); //¸¡³äµçÁ÷ÃÅÏÞ
|
this.Curr_threshold = ComBase.changeShortToInt(tmpbuf.getShort()); //ÎÆ²¨µçÁ÷·§Öµ
|
this.res_testcycle = ComBase.changeShortToInt(tmpbuf.getShort()); //ÄÚ×è×Ô¶¯²âÊÔÖÜÆÚ
|
this.res_testmethod = ComBase.changeShortToInt(tmpbuf.getShort()); //ÄÚ×è²âÊÔ·½·¨
|
this.dischage_model = ComBase.changeShortToInt(tmpbuf.getShort()); //·Åµçģʽ
|
this.MonStdCap = ComBase.changeShortToDouble(tmpbuf.getShort()); //±ê³ÆÈÝÁ¿
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
flag = true;
|
return flag;
|
}
|
|
//¶ÁÈ¡²âÊÔÊý¾Ý´Óϵͳ°æ±¾
|
public boolean readTestData(ByteBuffer bf){
|
boolean flag = false;
|
ByteBuffer tmpbuf = bf;
|
tmpbuf.position(0);
|
this.dev_addr = ComBase.changeByteToInt(tmpbuf.get()); //»ñÈ¡É豸µØÖ·
|
this.cmd = ComBase.changeByteToInt(tmpbuf.get()); //ÃüÁîµØÖ·
|
//this.dataCount = ComBase.changeByteToInt(tmpbuf.get()); //Êý¾ÝÇø×Ö½ÚÊý
|
this.dataCount = ComBase.changeByteToInt(tmpbuf.get());
|
|
System.out.println("Êý¾ÝÇø×Ö½ÚÊýµÄ³¤¶È:"+this.dataCount);
|
this.system_version = ComBase.changeShortToInt(tmpbuf.getShort()); //°æ±¾ºÅ
|
this.system_state = ComBase.changeShortToInt(tmpbuf.getShort()); //ϵͳ״̬
|
this.group_vol = ComBase.changeShortToInt(tmpbuf.getShort()); //×é¶Ëµçѹ
|
this.group_curr = ComBase.changeShortToByte(tmpbuf.getShort()); //×é¶ËµçÁ÷
|
this.battstate = ComBase.changeShortToInt(tmpbuf.getShort()); //µç³Ø×´Ì¬
|
this.curr_direction = ComBase.changeShortToInt(tmpbuf.getShort()); //µçÁ÷·½Ïò
|
this.curr_avg = ComBase.changeShortToDouble(tmpbuf.getShort()); //ÎÆ²¨µçÁ÷¾ùÖµ (0.01)
|
this.curr_peak = ComBase.changeShortToDouble(tmpbuf.getShort()); //ÎÆ²¨µçÁ÷·åÖµ (0.01)
|
|
this.reser1 = ComBase.changeShortToDouble(tmpbuf.getShort()); //±£Áôλ1
|
this.reser2 = ComBase.changeShortToDouble(tmpbuf.getShort()); //±£Áôλ2
|
this.reser3 = ComBase.changeShortToDouble(tmpbuf.getShort()); //±£Áôλ3
|
this.reser4 = ComBase.changeShortToDouble(tmpbuf.getShort()); //±£Áôλ4
|
this.reser5 = ComBase.changeShortToDouble(tmpbuf.getShort()); //±£Áôλ5
|
this.reser6 = ComBase.changeShortToDouble(tmpbuf.getShort()); //±£Áôλ6
|
|
this.res_testcount =ComBase.changeShortToInt(tmpbuf.getShort()); //ÄÚ×è²âÊÔ´ÎÊý
|
this.monres_testmethod = ComBase.changeShortToInt(tmpbuf.getShort()); //µç³Øµ¥ÌåÄÚ×è²âÊÔ·½·¨
|
return flag;
|
|
}
|
|
@Override
|
public String toString() {
|
return "MyModBusData [cmd=" + cmd + ", dataCount=" + dataCount + ", dev_addr=" + dev_addr + ", first_num="
|
+ first_num + ", second_num=" + second_num + ", thrid_num=" + thrid_num + ", forth_num=" + forth_num
|
+ ", fifth_num=" + fifth_num + ", curr_range=" + curr_range + ", float_curr_limit=" + float_curr_limit
|
+ ", Curr_threshold=" + Curr_threshold + ", res_testcycle=" + res_testcycle + ", res_testmethod="
|
+ res_testmethod + ", dischage_model=" + dischage_model + ", MonStdCap=" + MonStdCap
|
+ ", system_version=" + system_version + ", system_state=" + system_state + ", group_vol=" + group_vol
|
+ ", group_curr=" + group_curr + ", battstate=" + battstate + ", curr_direction=" + curr_direction
|
+ ", curr_avg=" + curr_avg + ", curr_peak=" + curr_peak + ", res_testcount=" + res_testcount
|
+ ", monres_testmethod=" + monres_testmethod + ", mon_vols=" + Arrays.toString(mon_vols) + ", mon_tmps="
|
+ Arrays.toString(mon_tmps) + ", mon_ress=" + Arrays.toString(mon_ress) + ", mon_currs="
|
+ Arrays.toString(mon_currs) + "]";
|
}
|
*/
|
|
|
/**
|
* »ñÈ¡µ±Ç°É豸µÄË÷ÒýºÅ
|
* @param reg_index
|
* @return
|
*/
|
public static int getDev_indexBySysReg_index(int reg_index,int[] arr) {
|
for(int i = 0;i<arr.length;i++) {
|
if(reg_index == arr[i]) {
|
return i;
|
}
|
}
|
return -1;
|
}
|
|
public int getComent_errorcount() {
|
return Coment_errorcount;
|
}
|
|
public void setComent_errorcountIncrease(){
|
this.Coment_errorcount ++;
|
if(this.Coment_errorcount >= 90000000){
|
this.Coment_errorcount = 1;
|
}
|
}
|
|
public void setComent_errorcount(int coment_errorcount) {
|
Coment_errorcount = coment_errorcount;
|
}
|
|
public int getComent_totalcount() {
|
return coment_totalcount;
|
}
|
|
public void setComent_totalcountIncrease() {
|
this.coment_totalcount += 1;
|
if(this.coment_totalcount >= 90000000 ){
|
this.coment_totalcount = 1;
|
}
|
}
|
|
|
public int getDev_count() {
|
return dev_count;
|
}
|
|
public void setDev_count(int dev_count) {
|
this.dev_count = dev_count;
|
}
|
|
public void setComent_totalcount(int coment_totalcount) {
|
this.coment_totalcount = coment_totalcount;
|
}
|
|
public static void main(String[] args) {
|
int[] a = new int[]{1,2,3};
|
for(int i = 0;i<20;i++) {
|
System.out.println(i+"=="+(int)Math.ceil((double)i/9));
|
}
|
}
|
}
|
|