package com.fgkj.bts;
|
|
public class BTS_ComBase
|
{
|
public static final int DataType_Dis = 0xFD; //放电
|
public static final int DataType_Char = 0xFC; //充电
|
public static final int DataType_Peac = 0xFB; //常规
|
|
public static final int PARSE_RESULT_NULL = 0; //未知
|
public static final int PARSE_RESULT_SUCCESS = 1; //解析成功
|
public static final int PARSE_RESULT_NOTFOUNDFILE = 2; //文件未找到
|
public static final int PARSE_RESULT_FILETYPEERR = 3; //文件格式错误
|
public static final int PARSE_RESULT_FILEERROR = 4; //文件异常
|
//----------------------------------------------------------------------------
|
public static final int BattGroupCountMax = 4;
|
|
public static final int BattGroupCountMax_Mutl = 9;
|
/**
|
* 2022-03-29 lijun 新疆锂电BTS扩展支持2组每组320节单体情况
|
*/
|
public static final int MonomerCountMax = 640;
|
//----------------------------------------------------------------------------
|
public static final int BTS_DCDC_CountMax = 8;
|
public static final int LIBTS_DCDC_CountMax = 4; //锂电BTS的最大DCDC模块信息
|
//----------------------------------------------------------------------------
|
public static final int CMD_NULL = 0x00;
|
//----------------------------------------------------------------------------
|
//------------ 重启FBS9100设备 ------------------------------------------------
|
public static final int CMD_ResetSystemAck = 0x0F;
|
public static final int CMD_ResetSystem = 0x10;
|
//------------ 升级FBS9100软件 ------------------------------------------------
|
public static final int CMD_SystemUpdate = 0x11;
|
public static final int CMD_SystemUpdateAck = 0x12;
|
//----------------------------------------------------------------------------
|
//------------ 读取设备版本号、实时任务列表等 ----------------------------------
|
public static final int CMD_GetDeviceInf = 0x15;
|
public static final int CMD_GetDeviceTaskInfAck = 0x16;
|
public static final int CMD_GetDeviceTaskInf = 0x17;
|
public static final int CMD_GetSyslogFileLen = 0x18;
|
public static final int CMD_GetSyslogFileStr = 0x19;
|
public static final int CMD_ClearSyslogFile = 0x1A;
|
|
public static final int CMD_Connect = 0x20;
|
public static final int CMD_GetState = 0x22;
|
|
//public static final int CMD_GETDEVID = 0x23; //获取设备id
|
|
//----------------------------------------------------------------------------
|
//------------ 启动放电测试和读取设置参数,读取放电测试状态----------------------
|
public static final int CMD_StartDischarge = 0x25;
|
public static final int CMD_StartDischargeAck = 0x26;
|
public static final int CMD_SetDischargeParmAck = 0x27;
|
public static final int CMD_SetDischargeParm = 0x28;
|
public static final int CMD_GetDischargeParm = 0x29;
|
public static final int CMD_GetDischargeParmAck = 0x30;
|
public static final int CMD_GetDischargeState = 0x31;
|
//----------------------------------------------------------------------------
|
//------------ 启动内阻测试和读取内阻测试状态-----------------------------------
|
public static final int CMD_StartResDischarge = 0x32;
|
public static final int CMD_GetResTestState = 0x34;
|
//-----------------------------------------------------------------------------
|
//------------ 读取和设置电池参数-----------------------------------------------
|
public static final int CMD_GetBattParam = 0x36;
|
public static final int CMD_SetBattParam = 0x37;
|
public static final int CMD_GetBattParamACK = 0x38;
|
public static final int CMD_SetBattParamACK = 0x39;
|
//----------------------------------------------------------------------------
|
//------------ 启动充电测试和读取设置参数,读取充电测试状态-----------------------
|
public static final int CMD_StartCharge = 0x40;
|
public static final int CMD_SetChargeParm = 0x43;
|
public static final int CMD_GetChargeParm = 0x44;
|
public static final int CMD_GetChargeState = 0x46;
|
|
public static final int CMD_Set_BattOFFLine = 0x4A;
|
public static final int CMD_Set_BattONLine = 0x4B;
|
//-----------------------------------------------------------------------------
|
//------------ 停止任何的测试 --------------------------------------------------
|
public static final int CMD_Start = 0x51;
|
public static final int CMD_StartAck = 0x52;
|
public static final int CMD_Stop = 0x53;
|
public static final int CMD_StopAck = 0x54;
|
//----------------------------------------------------------------------------
|
//------------ 读取电压电流、充放电测试、内阻测试数据 ---------------------------
|
public static final int CMD_GetVIData = 0x60;
|
public static final int CMD_GetMonomerData = 0x61;
|
public static final int CMD_GetMonomerRES = 0x62;
|
public static final int CMD_GetMonomerCAP = 0x63;
|
public static final int CMD_GetMonomerChargeCAP = 0x64;
|
public static final int CMD_GetMonomerTMP = 0x65;
|
public static final int CMD_GetMonomerJHcurr = 0x66;
|
public static final int CMD_Get_DCDC_Data = 0x67; //铁塔版本获取DCDC命令
|
public static final int CMD_Get_K_D_TestData = 0x68;
|
|
/**
|
* 2021-08-31 @lijun 假负载版本新增均衡电流和漏液电压读取
|
*/
|
public static final int CMD_GetMonomerLYVolt = 0x78; //漏液电压
|
public static final int CMD_GetMonomerJHCUR = 0x69; //增加均衡电流
|
|
|
public static final int CMD_GetLiDCDCParam = 0x8B; //读取锂电DCDC参数
|
public static final int CMD_SetLiDCDCParam = 0x8C; //设置锂电DCDC参数
|
|
public static final int CMD_GetPbDCDCParam = 0x8D; //读取铅酸DCDC参数
|
public static final int CMD_SetPbDCDCParam = 0x8E; //设置铅酸DCDC参数
|
|
public static final int CMD_GetSXDCDCData = 0x8F; //读取双向DCDC内部数据
|
|
public static final int CMD_GetLiBMSData = 0x95; //读取锂电池BMS模拟量
|
public static final int CMD_GetLiBMSState = 0x96; //读取锂电池BMS告警量
|
|
public static final int CMD_ReStartDCDC = 0x9A; //远程重启内部DCDC模块
|
|
|
/**
|
* 读取新疆锂电的组合BMS信心命令
|
*/
|
public static final int CMD_ReadLiBTSData = 0x9B; //读取新疆锂电BMS组合信息
|
|
/**
|
* 读取切换箱正负极开关状态
|
*/
|
public static final int CMD_ReadQHZZFZCDState = 0xC3; //读取切换箱正负极开关状态
|
|
|
/**
|
* 2022-01-06 edit by lijun 逆变设备新增机柜头数据
|
*
|
* 读取
|
*/
|
public static final int CMD_GetSimData = 0x99; //读取逆变机柜头数据
|
//------------ 平台锂电池命令 -----------------------------------------------------------------
|
public static final int CMD_GetLiDCDCParam_Ack = 0x8D; //读取锂电BTS参数成功
|
public static final int CMD_SetLiDCDCParam_Ack = 0x8E; //设置锂电BTS参数成功
|
|
public static final int CMD_GetSXDCDCData_Ack = 0x92; //读取双向DCDC内部数据成功
|
public static final int CMD_GetLiBMSData_Ack = 0x93; //读取锂电池BMS模拟量
|
public static final int CMD_GetLiBMSState_Ack = 0x94; //读取锂电池BMS告警量
|
|
public static final int CMD_ReStartDCDC_Ack = 0x9B; //远程重启内部DCDC模块成功
|
|
|
//----------------------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
//------------ 在线电压校准 ----------------------------------------------------
|
public static final int CMD_GetOnlineVolAdjParam = 0x6A;
|
public static final int CMD_SetOnlineVolAdjParam = 0x6B;
|
//------------ 组端电压校准 ----------------------------------------------------
|
public static final int CMD_GetBattGroupVolAdjParam = 0x6C;
|
public static final int CMD_SetBattGroupVolAdjParam = 0x6D;
|
//------------ 放电电流校准 ----------------------------------------------------
|
public static final int CMD_GetDischargeCurrAdjParam = 0x6E;
|
public static final int CMD_SetDischargeCurrAdjParam = 0x6F;
|
//------------ 充电电流校准 ----------------------------------------------------
|
public static final int CMD_GetChargeCurrAdjParam = 0x70;
|
public static final int CMD_SetChargeCurrAdjParam = 0x71;
|
//------------ 单体内阻校准 ----------------------------------------------------
|
public static final int CMD_GetBattResAdjParam = 0x72;
|
public static final int CMD_SetBattResAdjParam = 0x73;
|
//------------ 单体电压偏移/斜率校准 --------------------------------------------
|
public static final int CMD_GetMonVolAdjParam = 0x74;
|
public static final int CMD_SetMonVolAdjOffset = 0x75;
|
public static final int CMD_SetMonVolAdjSlope = 0x76;
|
public static final int CMD_ResetMonVolAdjParam = 0x77;
|
//-----------------------------------------------------------------------------
|
//------------ 设置日期时间 ----------------------------------------------------
|
public static final int CMD_SetDateTime = 0x7A;
|
//------------ 读取设置系统参数和告警参数 ---------------------------------------
|
public static final int CMD_GetSYSSetParamAck = 0x7E;
|
public static final int CMD_SetSYSSetParamAck = 0x7F;
|
public static final int CMD_GetSYSSetParam = 0x80;
|
public static final int CMD_SetSYSSetParam = 0x81;
|
|
public static final int CMD_GetAlarmParam = 0x82;
|
public static final int CMD_SetAlarmParam = 0x83;
|
public static final int CMD_GetAlarmParamAck = 0x84;
|
public static final int CMD_SetAlarmParamAck = 0x85;
|
|
public static final int CMD_GetJuHengParam = 0xC1; //读取均衡参数
|
public static final int CMD_GetJuHengParamAck = 0xC2; //读取均衡参数成功
|
public static final int CMD_SetJuHengParam = 0xC3; //设置均衡参数
|
public static final int CMD_SetJuHengParamAck = 0xC4; //设置均衡参数成功
|
|
//-------------- 清除告警 --------------------------------------------------
|
public static final int CMD_ClearSysAlarm = 0xB8; //清除告警
|
public static final int CMD_ClearSysAlarm_ACK = 0xB9; //清除告警成功
|
//------------------------------------------------------------------------------
|
//------------ DFU 命令 ---------------------------------------------------------
|
public static final int CMD_FBS9100_WriteDFU = 0x86;
|
public static final int CMD_FBS9100_ReadDFU = 0x87;
|
//------------------------------------------------------------------------------
|
//读取cmcc的电压电流
|
public static final int CMD_ReadCMCCVolCurr = 0x8A;
|
|
//读取GPRS模块的信号质量
|
public static final int CMD_ReadGPRSCSQ = 0x91;
|
public static final int CMD_ReadGPRSCSQAck = 0x92;
|
|
//读取干节点数据
|
public static final int CMD_ReadStemNode = 0xC2;
|
//清除告警
|
public static final int CMD_ClearAlarm = 0x90;
|
|
/**
|
* @lijun 2021-11-13
|
* 假负载BTS新增连接条阻抗信息以及温湿度信息读取
|
*/
|
public static final int CMD_ReadConnRes = 0x97; //读取连接条阻抗信息
|
public static final int CMD_ReadTmpHum = 0x98; //读取温湿度传感器信息
|
|
public static final int CMD_ReadBusCoupleState = 0x9D; //读取智能母联状态
|
|
public static final int CMD_GetJunHengState = 0xA8; //读取均衡供电模块信息
|
|
public static final int CMD_ReadJunHengParam = 0xB0; //读取均衡参数信息
|
public static final int CMD_WriteJunHengParam = 0xB1; //设置均衡参数信息
|
|
|
public static final int CMD_MutilMode_Control = 0xB3; //并联电源控制命令
|
|
public static final int CMD_ReadMutilMode_Control = 0xB4; //并联电源控制命令
|
public static final int CMD_WriteMutilMode_Control = 0xB5; //并联电源控制命令
|
|
|
public static final int CMD_GetMutilMode_Param = 0xB4; //读取并联电源参数
|
public static final int CMD_GetMutilMode_Param_Ack = 0xB2; //读取并联电源参数成功
|
|
public static final int CMD_SetMutilMode_Param = 0xB5; //设置并联电源参数
|
public static final int CMD_SetMutilMode_Param_Ack = 0xB6; //设置并联电源参数成功
|
|
/**
|
* @lijun 2022-08-23
|
* 并联电源新增并联参数相关读取设置主机命令
|
*/
|
public static final int CMD_ReadMultModeParam = 0x3A; //读取并联电源模块参数
|
public static final int CMD_WriteMultModeParam = 0x3B; //设置并联电源模块参数
|
|
public static final int CMD_GetMultModeParam = 0x3A; //读取并联电源模块参数
|
public static final int CMD_GetMultModeParam_Ack = 0x3C; //读取并联电源模块参数成功
|
public static final int CMD_SetMultModeParam = 0x3B; //设置并联电源模块参数
|
public static final int CMD_SetMultModeParam_Ack = 0x3D; //设置并联电源模块参数成功
|
|
|
|
public static final int CMD_ReadMutilTopology = 0xB6; //读取并联BTS拓扑状态信息
|
|
public static final int CMD_ReadMutilMode_Param = 0xB7; //读取并联BTS参数[9组]
|
public static final int CMD_WriteMutilMode_Param = 0xB8; //设置并联BTS参数[9组]
|
|
//------------ 测试类型 ---------------------------------------------------------
|
public static final int TestType_NULL = 0x00;
|
public static final int TestType_VOL = 0xF9;
|
public static final int TestType_MDISCHARGE = 0xFA;
|
public static final int TestType_MCHARGE = 0xFB;
|
public static final int TestType_Charge = 0xFC;
|
public static final int TestType_CAP = 0xFD; //正常核容放电测试类型
|
public static final int TestType_RES = 0xFE;
|
public static final int TestType_Charge_HELUQI = 0xBC;
|
public static final int TestType_CAP_HELUQI = 0xBD; //升压续航放电测试类型
|
public static final int TestType_SwitchDiode = 0xD1; //KD测试
|
//------------------------------------------------------------------------------
|
//------------ 电池状态 ---------------------------------------------------------
|
public static final int BattState_Float = 0x00;
|
public static final int BattState_Discharge = 0x01;
|
public static final int BattState_Charge = 0x02;
|
//------------------------------------------------------------------------------
|
//------------ 数据类型 ---------------------------------------------------------
|
public static final int DataType_Null = 0x00;
|
public static final int DataType_MonVol = 0x01;
|
public static final int DataType_MonCap = 0x02;
|
public static final int DataType_MonRes = 0x03;
|
public static final int DataType_Temp = 0x04;
|
public static final int DataType_GrpVol = 0x05;
|
public static final int DataType_Curr = 0x06;
|
public static final int DataType_MonTmp = 0x07;
|
public static final int DataType_MonJHcurr = 0x08; //均衡电流
|
|
public static final int DataType_MonLYvol = 0x09; //漏液电压
|
public static final int DataType_MonConnRes = 0x10; //连接条阻抗
|
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
public static final int BTSE_DevType_BTS = 0x02; //常规BTS
|
public static final int BTSE_DevType_XJBTS = 0x09; //新疆锂电BTS
|
public static final int BTSE_DevType_TieTa = 0x08; //铁塔版本的bt
|
public static final int BTSE_DevType_NiBian = 0x06; //逆变版本的bts
|
public static final int BTSE_DevType_LIBTS = 0x05; //锂电池版本的bts
|
public static final int BTSE_DevType_MULBTS = 0x04; //并联BTS
|
//------------------------------------------------------------------------------
|
public static final int SYS_STATE_STOPPED = 0x00;
|
public static final int SYS_STATE_DISCHARGING = 0x01;
|
public static final int SYS_STATE_CHARGING = 0x02;
|
public static final int SYS_STATE_HELUQI_DISCHARGING = 0x03;
|
//------------------------------------------------------------------------------
|
public static final int STOP_CommErr = 0; //核容中模块内部通信故障,核容失败
|
public static final int STOP_Manual = 1; //手动停止核容,核容失败
|
public static final int STOP_VolLow2Min = 2; //时长过短,核容失败
|
public static final int STOP_TimeOut = 3; //达到最长核容时间,核容失败
|
public static final int STOP_Success = 4; //电池电压低于核容终止电压,核容成功
|
public static final int STOP_CurrLow = 5; //核容放电电流过小,核容失败
|
public static final int STOP_User = 6; //手动停止
|
public static final int STOP_TimeEnd = 7; //时间到停止
|
public static final int STOP_MonVolL = 8; //单体下限停止
|
public static final int STOP_BattVolL = 9; //电池电压下限到
|
public static final int STOP_MonTmpH = 10; //单体温度上限到
|
|
//-------------------------------------------------------------------------------------------
|
public static final int ALARM_NULL = 0; //无
|
public static final int ALARM_PAUSED = 1; //暂停
|
public static final int ALARM_DISCHARGING = 2; //正在放电测试
|
public static final int ALARM_DISCHARGEWAIT = 3; //正在等待放电
|
public static final int ALARM_LimitCHARGING = 4; //正在限流充电
|
public static final int ALARM_LargeCHARGING = 5; //正在直连充电
|
public static final int ALARM_CHARGEWAIT = 6; //正在等待充电
|
public static final int ALARM_TIMESTOP = 7; //放电时间到停止
|
public static final int ALARM_CAPSTOP = 8; //放电容量到停止
|
public static final int ALARM_MVLLSTOP = 9; //单体电压下限到停止
|
public static final int ALARM_SVLLSTOP = 10; //组端电压下限到停止
|
public static final int ALARM_POWERBREAKSTOP = 11; //市电中断停止
|
public static final int ALARM_FLASHUPSTOP = 12; //存储数据满停止
|
public static final int ALARM_TEMPHIGHSTOP = 13; //机内温度异常停止
|
public static final int ALARM_CURRSTOP = 14; //放电电流过流停止
|
public static final int ALARM_PCCOMMBREAKSTOP = 15; //后台通信中断停止
|
public static final int ALARM_LoaderCOMMBREAKSTOP = 16; //负载模块通信中断停止
|
public static final int ALARM_Sel2TO1COMMBREAKSTOP = 17; //选择模块通信中断停止
|
public static final int ALARM_LoaderPowerError = 18; //负载模块放电过功率停止
|
public static final int ALARM_Malloc_ERROR = 19; //内部程序异常停止
|
public static final int ALARM_POWERRESUMESTOP_HELUQI = 20; //合路器放电功能,市电恢复停止升压放电
|
public static final int ALARM_POWERBREAKSTOP_HELUQI = 21; //合路器放电功能,充电过程中市电中断
|
public static final int ALARM_SVLLSTOP_HELUQI = 22; //合路器放电功能组端电压下限
|
public static final int ALARM_MOMTEMP_HL_STOP = 23; //单体温度上限到停止
|
public static final int ALARM_ONLINEVOL_HL_STOP = 24; //在线电压异常高停止
|
public static final int ALARM_XIEZHUANG_COMM_ERR_STOP = 25; //协转通信异常停止
|
public static final int ALARM_MONOMER_COMM_ERR_STOP = 26; //单体通信异常停止
|
public static final int ALARM_UNKOWN = 27; //未知
|
//-------------------------------------------------------------------------------------------
|
public static byte changeIntToByte(int data)
|
{
|
return (byte)(data & 0xFF);
|
}
|
//------------------------------------------------------------------------------
|
public static short changeIntToShort(int data)
|
{
|
return (short)(data & 0xFFFF);
|
}
|
//------------------------------------------------------------------------------
|
public static byte changeShortToByte(short data)
|
{
|
return (byte)(data & 0xFF);
|
}
|
//------------------------------------------------------------------------------
|
public static int changeByteToInt(byte data)
|
{
|
int tmp = data;
|
return (tmp & 0xFF);
|
}
|
//------------------------------------------------------------------------------
|
public static int changeShortToInt(short data)
|
{
|
int tmp = data;
|
return (tmp & 0xFFFF);
|
}
|
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
/**
|
* 有符号数转成int
|
* @param data
|
* @return
|
*/
|
public static int changeSingeShortToInt(short data)
|
{
|
int tmp = data;
|
return (tmp);
|
}
|
//------------------------------------------------------------------------------
|
public static double changeShortToDouble(short data)
|
{
|
int tmp = data & 0xFFFF;
|
return (double)(tmp);
|
}
|
public static float changeShortToFloat(short data)
|
{
|
int tmp = data & 0xFFFF;
|
return (float)(tmp);
|
}
|
//------------------------------------------------------------------------------
|
public static short changeDoubleToShort(double data)
|
{
|
int tmp = (int)data;
|
//System.out.println("tmp:"+tmp);
|
return (short)(tmp & 0xFFFF);
|
}
|
public static short changeFloatToShort(float data)
|
{
|
int tmp = (int)data;
|
return (short)(tmp & 0xFFFF);
|
}
|
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
public static double GetFDCurrent(double stdcap, int hourrate)
|
{
|
double res = 0.055;
|
switch(hourrate)
|
{
|
case 1: res = 0.514; break;
|
case 2: res = 0.306; break;
|
case 3: res = 0.250; break;
|
case 4: res = 0.200; break;
|
case 5: res = 0.166; break;
|
case 6: res = 0.146; break;
|
case 7: res = 0.131; break;
|
case 8: res = 0.118; break;
|
case 9: res = 0.108; break;
|
case 10: res = 0.100; break;
|
case 20: res = 0.055; break;
|
default: res = 0.055; break;
|
}
|
|
return (stdcap * res);
|
}
|
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
public static int GetHourRate(int stdah, int current)
|
{
|
int index = 0;
|
int value[]={514, 306, 250, 200, 166, 146, 131, 118, 108, 100, 55};
|
int res;
|
res = (current*100)/(stdah/10);
|
if(res>=514) return 1;
|
else if(res<=55) return 20;
|
else
|
{
|
for(index=0; index<10; index++)
|
{
|
if((res<=value[index]) && (res>value[index+1])) break;
|
else continue;
|
}
|
if((value[index]-res) < (res-value[index+1]))
|
{
|
return (index+1);
|
}
|
else
|
{
|
if(index+2 > 10) return (20);
|
else return (index+2);
|
}
|
}
|
}
|
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
public static double N_TO_10H(int n_H)
|
{
|
switch(n_H)
|
{
|
case 1 : return(1/0.55);
|
case 2 : return(1/0.61);
|
case 3 : return(1/0.75);
|
case 4 : return(1/0.79);
|
case 5 : return(1/0.833);
|
case 6 : return(1/0.876);
|
case 7 : return(1/0.917);
|
case 8 : return(1/0.944);
|
case 9 : return(1/0.974);
|
case 10: return(1/1);
|
case 20: return(1/1.1);
|
}
|
return 1.0;
|
}
|
//-------------------------------------------------------------------------------
|
/*
|
//-------------------------------------------------------------------------------
|
double GetMonomerCap(double STDAH, int HourRate, double SumAH, double MaxMonomerVol,
|
double MonomerVol, double MonomerVolType, int CapType)
|
{
|
if(MaxMonomerVol - MonomerVolType*0.9 == 0)
|
return 0;
|
|
if(SumAH < 0)
|
SumAH *= (-1);
|
|
double tmp_cap;
|
tmp_cap = MonomerVol - MonomerVolType * 0.9;
|
tmp_cap *= (STDAH - SumAH * N_TO_10H(HourRate));
|
tmp_cap = tmp_cap/(MaxMonomerVol - MonomerVolType*0.9);
|
if(tmp_cap < 0)
|
tmp_cap = 0;
|
|
if(CapType == CapType_Rest)
|
return tmp_cap;
|
else if(CapType == CapType_Sum)
|
return (tmp_cap + SumAH * N_TO_10H(HourRate));
|
else
|
return ((tmp_cap + SumAH * N_TO_10H(HourRate))*100 / STDAH);
|
}
|
//----------------------------------------------------------------------------------
|
*/
|
}
|