package com.dev.fg;
|
|
import java.nio.ByteBuffer;
|
import java.nio.ByteOrder;
|
import java.util.Date;
|
|
import com.battdata_rt.BattData_RT;
|
import com.battdata_rt.BattStatData;
|
import com.dev.fbs9100.FBS9100_ComBase;
|
import com.dev.fbs9100.FBS9100_Crc16;
|
import com.dev.modbus4j.MyModbusMaster;
|
import com.dev.modbus4j.MyModbusUtils;
|
import com.serotonin.modbus4j.BatchRead;
|
import com.serotonin.modbus4j.BatchResults;
|
import com.serotonin.modbus4j.code.DataType;
|
|
public class FBS9600_State {
|
private static final int GroupInfoLen = 20;
|
public static final int GroupRegCount = 6;
|
|
|
private static final int BYTE_LEN = 35;
|
|
private static final int BATT_MAXGOROUP_COUNT = 16; //最大电池组数目
|
private static final int BATT_MAXMONDATA_COUNT = 256; //单组最大单体数目
|
|
/****************** 电池状态 **********************************/
|
final public static byte BATTSTATE_FLOAT = 0; //浮充
|
final public static byte BATTSTATE_DISCHARGE = 1; //放电
|
final public static byte BATTSTATE_CHARGE = 2; //充电
|
final public static byte BATTSTATE_RESTEST = 4; //内阻测试
|
|
|
public int batt_res_test_cnt; //
|
|
private int dev_testgroupnum; //被测电池组号
|
private int dev_workstate; //设备状态,电池组放电或充电时可自动加快数据采集速率
|
|
|
static final int UsrCmdNull = 0;
|
static final int UsrCmdTestRes = 81;
|
static final int UsrCmdTestResSuc = 82;
|
static final int WorkStateNull = 0;
|
static final int WorkStateRes = 1;
|
public String ip_addr;
|
public int dev_id;
|
public int check_dev_id; //校验设备id
|
|
public int op_cmd;
|
public int test_cmd;
|
public int BattGroupNum; //当前电池组号启动或停止时判断要启动和停止的组号
|
private boolean op_cmd_ack_fromdev = false;
|
int work_state;
|
public int com_count;
|
public int com_err_count;
|
long alm_rec_id = 0L;
|
|
public int[] ResState = new int[BATT_MAXGOROUP_COUNT]; //内阻测试状态
|
|
public int[] battState = new int[BATT_MAXGOROUP_COUNT]; //电池状态
|
public double[] groupVol = new double[BATT_MAXGOROUP_COUNT]; //组端电压
|
public double[] groupCurr = new double[BATT_MAXGOROUP_COUNT]; //组端电流
|
public double[] groupTmp = new double[BATT_MAXGOROUP_COUNT]; //环境温度
|
public int[] totalEndurance = new int[BATT_MAXGOROUP_COUNT]; //总续航时间
|
public int[] remainEndurance = new int[BATT_MAXGOROUP_COUNT]; //剩余续航时间
|
public double[] realCap = new double[BATT_MAXGOROUP_COUNT]; //预估实际容量
|
public double[] reCharAmount = new double[BATT_MAXGOROUP_COUNT]; //预估可充电量
|
public double[] reDisAmount = new double[BATT_MAXGOROUP_COUNT]; //预估可放电量
|
public double[] restCap = new double[BATT_MAXGOROUP_COUNT]; //剩余容量SOC
|
public int[] monCount = new int[BATT_MAXGOROUP_COUNT]; //单体总数
|
public int[] battCount = new int[BATT_MAXGOROUP_COUNT]; //电池组总数
|
public double[] capStd = new double[BATT_MAXGOROUP_COUNT]; //标称容量
|
public double[] battSoh = new double[BATT_MAXGOROUP_COUNT]; //电池组SOH
|
|
public double[][] mon_vols = new double[BATT_MAXGOROUP_COUNT][BATT_MAXMONDATA_COUNT]; //单体电压
|
public double[][] mon_ress = new double[BATT_MAXGOROUP_COUNT][BATT_MAXMONDATA_COUNT]; //单体内阻
|
public double[][] mon_tmps = new double[BATT_MAXGOROUP_COUNT][BATT_MAXMONDATA_COUNT]; //单体温度
|
public double[][] mon_caps = new double[BATT_MAXGOROUP_COUNT][BATT_MAXMONDATA_COUNT]; //单体剩余容量
|
public double[][] mon_cap_pers = new double[BATT_MAXGOROUP_COUNT][BATT_MAXMONDATA_COUNT]; //单体容量百分比
|
public double[][] mon_socs = new double[BATT_MAXGOROUP_COUNT][BATT_MAXMONDATA_COUNT]; //单体SOC
|
|
|
public FBS9600_State(String ipaddr, int id) {
|
this.ip_addr = ipaddr;
|
this.dev_id = id;
|
}
|
|
public void setWorkState() {
|
this.work_state = 1;
|
}
|
|
public void clearWorkState() {
|
this.work_state = 0;
|
}
|
|
public int getWorkState() {
|
return this.work_state;
|
}
|
|
public void setFBS9600CmdAckFromDev(boolean stat) {
|
this.op_cmd_ack_fromdev = stat;
|
}
|
|
public boolean getFBS9600CmdAckFromDev() {
|
return this.op_cmd_ack_fromdev;
|
}
|
|
public void setFBS9600Cmd(int cmd) {
|
this.op_cmd = cmd;
|
}
|
|
public int getFBS9600Cmd() {
|
return this.op_cmd;
|
}
|
|
public int getOp_cmd() {
|
return op_cmd;
|
}
|
|
public int getTest_cmd() {
|
return test_cmd;
|
}
|
|
public int getBattGroupNum() {
|
return BattGroupNum;
|
}
|
|
public void setOp_cmd(int op_cmd) {
|
this.op_cmd = op_cmd;
|
}
|
|
public void setTest_cmd(int test_cmd) {
|
this.test_cmd = test_cmd;
|
}
|
|
public void setBattGroupNum(int battGroupNum) {
|
BattGroupNum = battGroupNum;
|
}
|
|
public void setComCountInc() {
|
this.com_count += 1;
|
if (this.com_count >= 90000000)
|
this.com_count = 1;
|
}
|
|
public void setComErrCountInc() {
|
this.com_err_count += 1;
|
if (this.com_err_count >= 90000000)
|
this.com_err_count = 20;
|
}
|
|
/**
|
* 构造State读取集合
|
* @param master
|
* @return
|
*/
|
public BatchRead<Integer> createBatchRead(MyModbusMaster master) {
|
BatchRead<Integer> batch = new BatchRead<Integer>();
|
batch.addLocator(0,MyModbusUtils.createBaseLocator(0xF001,DataType.TWO_BYTE_INT_UNSIGNED, master)); //机箱跳闸输出
|
batch.addLocator(1,MyModbusUtils.createBaseLocator(0xF002, DataType.TWO_BYTE_INT_UNSIGNED, master)); //故障复位信号
|
|
return batch;
|
}
|
|
/**
|
* 解析State读取集合
|
* @param res
|
*/
|
public boolean putBatchResult(BatchResults<Integer> res) {
|
if(res != null) {
|
int dev_head = res.getIntValue(0);
|
int dev_food = res.getIntValue(1);
|
|
this.check_dev_id = dev_head*100000+dev_food;
|
System.err.println(this.check_dev_id+"===="+dev_head+"==="+dev_food);
|
return true;
|
}
|
return false;
|
}
|
|
/**
|
* 读取电池组组端数据信息
|
* @param master
|
* @return
|
*/
|
public BatchRead<Integer> createGruopBatchRead(MyModbusMaster master,int index) {
|
int offset = index*0x1000;
|
BatchRead<Integer> batch = new BatchRead<Integer>();
|
batch.addLocator(0,MyModbusUtils.createBaseLocator(0x0000+offset,DataType.TWO_BYTE_INT_UNSIGNED, master)); //电池组状态
|
batch.addLocator(1,MyModbusUtils.createBaseLocator(0x0001+offset,DataType.FOUR_BYTE_INT_SIGNED, master)); //组端电压
|
batch.addLocator(2,MyModbusUtils.createBaseLocator(0x0003+offset,DataType.FOUR_BYTE_INT_SIGNED, master)); //组端电流
|
batch.addLocator(3,MyModbusUtils.createBaseLocator(0x0005+offset,DataType.TWO_BYTE_INT_SIGNED, master)); //环境温度
|
batch.addLocator(4,MyModbusUtils.createBaseLocator(0x0006+offset,DataType.FOUR_BYTE_INT_UNSIGNED, master)); //总续航时间
|
batch.addLocator(5,MyModbusUtils.createBaseLocator(0x0008+offset,DataType.FOUR_BYTE_INT_UNSIGNED, master)); //剩余续航时间
|
batch.addLocator(6,MyModbusUtils.createBaseLocator(0x000C+offset,DataType.FOUR_BYTE_INT_SIGNED, master)); //预估实际容量
|
batch.addLocator(7,MyModbusUtils.createBaseLocator(0x000E+offset,DataType.FOUR_BYTE_INT_SIGNED, master)); //可充电量
|
batch.addLocator(8,MyModbusUtils.createBaseLocator(0x0010+offset,DataType.FOUR_BYTE_INT_SIGNED, master)); //可放电量
|
batch.addLocator(9,MyModbusUtils.createBaseLocator(0x0012+offset,DataType.TWO_BYTE_INT_UNSIGNED, master)); //电池组剩余容量SOC
|
batch.addLocator(10,MyModbusUtils.createBaseLocator(0x001B+offset,DataType.TWO_BYTE_INT_UNSIGNED, master)); //电池组单体总数
|
batch.addLocator(11,MyModbusUtils.createBaseLocator(0x001E+offset,DataType.TWO_BYTE_INT_UNSIGNED, master)); //平板挂载电池组总数
|
batch.addLocator(12,MyModbusUtils.createBaseLocator(0x001F+offset,DataType.FOUR_BYTE_INT_SIGNED, master)); //电池组标称容量
|
batch.addLocator(13,MyModbusUtils.createBaseLocator(0x0021+offset,DataType.TWO_BYTE_INT_UNSIGNED, master)); //电池组SOH
|
|
return batch;
|
}
|
|
public boolean putGroupInfo(ByteBuffer buff,int index,BattData_RT battData_RT) {
|
if(buff.limit() < GroupRegCount*2) {
|
return false;
|
}
|
ByteBuffer tmpbuf = buff;
|
if(index < BATT_MAXGOROUP_COUNT) {
|
|
battState[index] = FBS9100_ComBase.changeShortToInt(tmpbuf.getShort()); //电池状态
|
|
groupVol[index] = (double)tmpbuf.getInt()/1000; //组端电压
|
groupCurr[index] = (double)tmpbuf.getInt()/1000; //组端电流
|
groupTmp[index] = (double)tmpbuf.getShort()/10; //环境温度
|
|
|
// tmpbuf.position(0);
|
// System.out.println("状态:"+tmpbuf.getShort());
|
// System.out.println("组压"+tmpbuf.getInt());
|
// System.out.println("电流"+tmpbuf.getInt());
|
// tmpbuf.position(0);
|
// System.out.println("状态:"+tmpbuf.getShort());
|
// System.out.println("组压"+tmpbuf.getInt());
|
// System.out.println("电流"+tmpbuf.getInt());
|
//System.out.println(battState[index]+"==="+groupVol[index]+"=="+groupCurr[index]+"=="+groupTmp[index]);
|
// totalEndurance[index] = tmpbuf.getInt(); //总续航时间
|
// remainEndurance[index] = tmpbuf.getInt(); //剩余续航时间
|
// realCap[index] = (double)tmpbuf.getFloat()/1000; //预估实际容量
|
// reCharAmount[index] = (double)tmpbuf.getFloat()/10; //预估可充电量
|
// reDisAmount[index] = (double)tmpbuf.getFloat()/10; //预估可放电量
|
// restCap[index] = (double)tmpbuf.getShort()/10; //剩余容量SOC
|
// monCount[index] = tmpbuf.getShort(); //单体总数
|
// battCount[index] = tmpbuf.getShort(); //电池组总数
|
// capStd[index] = (double)tmpbuf.getInt()/1000; //标称容量
|
// battSoh[index] = (double) tmpbuf.getShort()/10; //电池组SOH
|
|
//groupCurr[index] = Math.abs(groupCurr[index]);
|
if(BATTSTATE_DISCHARGE == battState[index]) {
|
//放电状态
|
//groupCurr[index] = (-1)*groupCurr[index];
|
if(BATTSTATE_FLOAT == dev_workstate) {
|
dev_workstate = BATTSTATE_DISCHARGE;
|
dev_testgroupnum = index+1;
|
}else if(dev_testgroupnum == (index+1) && BATTSTATE_CHARGE == dev_workstate){
|
dev_workstate = BATTSTATE_DISCHARGE;
|
}
|
|
}else if(BATTSTATE_CHARGE == battState[index]) {
|
//充电状态
|
if(BATTSTATE_FLOAT == dev_workstate) {
|
dev_workstate = BATTSTATE_FLOAT;
|
dev_testgroupnum = index+1;
|
}else if(dev_testgroupnum == (index+1) && BATTSTATE_DISCHARGE == dev_workstate) {
|
dev_workstate = BATTSTATE_DISCHARGE;
|
}
|
}else {
|
if(dev_testgroupnum == (index+1)) {
|
dev_workstate = BATTSTATE_FLOAT;
|
dev_testgroupnum = 0;
|
}
|
}
|
|
// System.err.println("电池状态:"+battState[index]);
|
//battData_RT.mTestData.updateCurrFrom_FBSDev(10);
|
|
int last_res_state = battData_RT.mTestData.batt_res_test_state;
|
|
battData_RT.mTestData.updateCurrFrom_FBSDev((float)groupCurr[index]);
|
battData_RT.mTestData.updateGroupVolFrom_FBSDev((float)groupVol[index]);
|
battData_RT.mTestData.updateGroupTempFrom_FBSDev((float)groupTmp[index]);
|
battData_RT.mTestData.updateNewDataRCTime(new Date());
|
|
battData_RT.updata_BattRtSate_To_RamDb();
|
|
if(BATTSTATE_RESTEST == battState[index]) {
|
//内阻测试判断
|
if(last_res_state != 1) {
|
battData_RT.mTestData.batt_res_test_state = 1;
|
battData_RT.mTestData.addBatt_res_test_cnt();
|
}
|
battData_RT.mTestData.batt_res_test_cnt_out = 0;
|
}else {
|
battData_RT.mTestData.batt_res_test_cnt_out ++;
|
if(battData_RT.mTestData.batt_res_test_cnt_out > 3) {
|
battData_RT.mTestData.batt_res_test_state = 0;
|
}
|
}
|
ResState[index] = battData_RT.mTestData.batt_res_test_state;
|
batt_res_test_cnt = battData_RT.mTestData.batt_res_test_cnt;
|
}
|
return true;
|
}
|
|
/**
|
* 获取单体电压
|
* @param buff
|
* @param index
|
* @param battData_RT
|
* @return
|
*/
|
public boolean putMonVolData(ByteBuffer buff,int index,BattData_RT battData_RT) {
|
if(buff.limit() < battData_RT.MonCount*2) {
|
return false;
|
}
|
ByteBuffer tmpbuf = buff;
|
for(int i=0;i<battData_RT.MonCount;i++) {
|
battData_RT.al_MonVol.get(i).monVol = (float)FBS9100_ComBase.changeShortToDouble(tmpbuf.getShort())/1000;
|
//System.out.println(battData_RT.al_MonVol.get(i));
|
|
}
|
return true;
|
}
|
/**
|
* 获取单体内阻
|
* @param buff
|
* @param index
|
* @param battData_RT
|
* @return
|
*/
|
public boolean putMonResData(ByteBuffer buff,int index,BattData_RT battData_RT) {
|
if(buff.limit() < battData_RT.MonCount*2) {
|
return false;
|
}
|
ByteBuffer tmpbuf = buff;
|
for(int i=0;i<battData_RT.MonCount;i++) {
|
battData_RT.al_MonVol.get(i).monRes = (float)FBS9100_ComBase.changeShortToDouble(tmpbuf.getShort())/1000;
|
}
|
return true;
|
}
|
/**
|
* 获取单体电压
|
* @param buff
|
* @param index
|
* @param battData_RT
|
* @return
|
*/
|
public boolean putMonTmpData(ByteBuffer buff,int index,BattData_RT battData_RT) {
|
if(buff.limit() < battData_RT.MonCount*2) {
|
return false;
|
}
|
ByteBuffer tmpbuf = buff;
|
for(int i=0;i<battData_RT.MonCount;i++) {
|
battData_RT.al_MonVol.get(i).monTmp = (float)FBS9100_ComBase.changeShortToDouble(tmpbuf.getShort())/10;
|
}
|
return true;
|
}
|
/**
|
* 读取组端数据
|
* @param res
|
* @param index
|
* @param battData_RT
|
* @return
|
*/
|
public boolean putGroupBatchResult(BatchResults<Integer> res, int index, BattData_RT battData_RT) {
|
if(null != res && index < BATT_MAXGOROUP_COUNT) {
|
battState[index] = res.getIntValue(0); //电池状态
|
groupVol[index] = (double)res.getIntValue(1)/1000; //组端电压
|
groupCurr[index] = (double)res.getIntValue(2)/1000; //组端电流
|
groupTmp[index] = MyModbusUtils.readShortToDouble(res.getValue(3), true)/10; //环境温度
|
|
totalEndurance[index] = Long.signum(res.getLongValue(4)); //总续航时间
|
remainEndurance[index] = Long.signum(res.getLongValue(5)); //剩余续航时间
|
realCap[index] = (double)res.getIntValue(6)/1000; //预估实际容量
|
reCharAmount[index] = (double)res.getIntValue(7)/10; //预估可充电量
|
reDisAmount[index] = (double)res.getIntValue(8)/10; //预估可放电量
|
restCap[index] = (double)res.getIntValue(9)/10; //剩余容量SOC
|
monCount[index] = res.getIntValue(10); //单体总数
|
battCount[index] = res.getIntValue(11); //电池组总数
|
capStd[index] = (double)res.getIntValue(12)/1000; //标称容量
|
battSoh[index] = (double)res.getIntValue(13)/10; //电池组SOH
|
|
groupCurr[index] = Math.abs(groupCurr[index]);
|
if(BATTSTATE_DISCHARGE == battState[index]) {
|
//放电状态
|
groupCurr[index] = (-1)*groupCurr[index];
|
if(BATTSTATE_FLOAT == dev_workstate) {
|
dev_workstate = BATTSTATE_DISCHARGE;
|
dev_testgroupnum = index+1;
|
}else if(dev_testgroupnum == (index+1) && BATTSTATE_CHARGE == dev_workstate){
|
dev_workstate = BATTSTATE_DISCHARGE;
|
}
|
|
}else if(BATTSTATE_CHARGE == battState[index]) {
|
//充电状态
|
if(BATTSTATE_FLOAT == dev_workstate) {
|
dev_workstate = BATTSTATE_FLOAT;
|
dev_testgroupnum = index+1;
|
}else if(dev_testgroupnum == (index+1) && BATTSTATE_DISCHARGE == dev_workstate) {
|
dev_workstate = BATTSTATE_DISCHARGE;
|
}
|
}else {
|
if(dev_testgroupnum == (index+1)) {
|
dev_workstate = BATTSTATE_FLOAT;
|
dev_testgroupnum = 0;
|
}
|
}
|
battData_RT.mTestData.updateCurrFrom_FBSDev((float)groupCurr[index]);
|
battData_RT.mTestData.updateGroupVolFrom_FBSDev((float)groupVol[index]);
|
battData_RT.mTestData.updateGroupTempFrom_FBSDev((float)groupTmp[index]);
|
battData_RT.mTestData.updateNewDataRCTime(new Date());
|
|
return true;
|
}
|
return false;
|
}
|
|
/**
|
* 读取单体电压
|
* @param master
|
* @param index
|
* @param monCount
|
* @return
|
*/
|
public BatchRead<Integer> createMonVolBatchRead(MyModbusMaster master, int index,int monCount) {
|
int offset = index*0x1000;
|
BatchRead<Integer> batch = new BatchRead<Integer>();
|
for(int i=0;i<monCount;i++) {
|
batch.addLocator(i,MyModbusUtils.createBaseLocator(0x0100+offset+i,DataType.TWO_BYTE_INT_UNSIGNED, master)); //单体电压
|
}
|
return batch;
|
}
|
|
/**
|
* 读取单体电压
|
* @param res
|
* @param index
|
* @param battData_RT
|
* @return
|
*/
|
public boolean putMonVolBatchResult(BatchResults<Integer> res, int index, BattData_RT battData_RT) {
|
if(res != null) {
|
for(int i=0;i<battData_RT.MonCount;i++) {
|
battData_RT.al_MonVol.get(i).monVol = ((float)res.getIntValue(i))/1000;
|
}
|
return true;
|
}
|
return false;
|
}
|
|
/**
|
* 读取单体内阻
|
* @param master
|
* @param index
|
* @param monCount
|
* @return
|
*/
|
public BatchRead<Integer> createMonResBatchRead(MyModbusMaster master, int index,int monCount) {
|
int offset = index*0x1000;
|
BatchRead<Integer> batch = new BatchRead<Integer>();
|
for(int i=0;i<monCount;i++) {
|
batch.addLocator(i,MyModbusUtils.createBaseLocator(0x0200+offset+i,DataType.TWO_BYTE_INT_UNSIGNED, master)); //单体内阻
|
}
|
return batch;
|
}
|
|
/**
|
* 读取单体内阻
|
* @param res
|
* @param index
|
* @param battData_RT
|
* @return
|
*/
|
public boolean putMonResBatchResult(BatchResults<Integer> res, int index, BattData_RT battData_RT) {
|
if(res != null) {
|
for(int i=0;i<battData_RT.MonCount;i++) {
|
battData_RT.al_MonVol.get(i).monRes = ((float)res.getIntValue(i))/1000;
|
}
|
return true;
|
}
|
return false;
|
}
|
|
/**
|
* 读取单体温度
|
* @param master
|
* @param index
|
* @param monCount
|
* @return
|
*/
|
public BatchRead<Integer> createMonTmpBatchRead(MyModbusMaster master, int index,int monCount) {
|
int offset = index*0x1000;
|
BatchRead<Integer> batch = new BatchRead<Integer>();
|
for(int i=0;i<monCount;i++) {
|
batch.addLocator(i,MyModbusUtils.createBaseLocator(0x0300+offset+i,DataType.TWO_BYTE_INT_UNSIGNED, master)); //单体温度
|
}
|
return batch;
|
}
|
|
/**
|
* 读取单体温度
|
* @param res
|
* @param index
|
* @param battData_RT
|
* @return
|
*/
|
public boolean putMonTmpBatchResult(BatchResults<Integer> res, int index, BattData_RT battData_RT) {
|
if(res != null) {
|
for(int i=0;i<battData_RT.MonCount;i++) {
|
battData_RT.al_MonVol.get(i).monTmp = ((float)res.getIntValue(i))/10; //单体温度
|
}
|
|
return true;
|
}
|
return false;
|
}
|
|
/**
|
* 读取单体剩余容量
|
* @param master
|
* @param index
|
* @param monCount
|
* @return
|
*/
|
public BatchRead<Integer> createMonCapBatchRead(MyModbusMaster master, int index,int monCount) {
|
int offset = index*0x1000;
|
BatchRead<Integer> batch = new BatchRead<Integer>();
|
for(int i=0;i<monCount;i++) {
|
batch.addLocator(i,MyModbusUtils.createBaseLocator(0x0400+offset+i,DataType.FOUR_BYTE_INT_SIGNED, master)); //单体剩余容量
|
}
|
return batch;
|
}
|
|
/**
|
* 读取单体剩余容量
|
* @param res
|
* @param index
|
* @param battData_RT
|
* @return
|
*/
|
public boolean putMonCapBatchResult(BatchResults<Integer> res, int index, BattData_RT battData_RT) {
|
if(res != null) {
|
for(int i=0;i<battData_RT.MonCount;i++) {
|
battData_RT.al_MonVol.get(i).monCap = ((float)res.getIntValue(i))/1000; //单体温度
|
}
|
return true;
|
}
|
return false;
|
}
|
|
public void setCommData(MyModbusMaster master) {
|
this.com_count = master.getTolcommcount();
|
this.com_err_count = master.getTotalerr();
|
|
}
|
|
public boolean putByteBuffer(ByteBuffer buffer) {
|
boolean flag = false;
|
if(buffer.limit() < BYTE_LEN) {
|
return flag;
|
}
|
ByteBuffer tmpbuf = buffer;
|
int crc0 = tmpbuf.getShort(BYTE_LEN-2) & 0xFFFF;
|
int crc1 = FBS9100_Crc16.CalCRC16(tmpbuf, BYTE_LEN-2);
|
if(crc0 != crc1) {
|
return false;
|
}
|
tmpbuf.position(0);
|
|
|
|
flag = true;
|
tmpbuf.compact();
|
tmpbuf.flip();
|
return flag;
|
}
|
|
public ByteBuffer crateControlByteBuffer(int value) {
|
ByteBuffer tmpbuf = ByteBuffer.allocate(2);
|
tmpbuf.order(ByteOrder.BIG_ENDIAN);
|
tmpbuf.putShort(FBS9100_ComBase.changeIntToShort(value));
|
tmpbuf.flip();
|
return tmpbuf;
|
}
|
|
public static void main(String[] args) {
|
short ff = 12;
|
System.out.println((float)ff);
|
}
|
|
}
|