package com.dev.fgcd.data;
|
|
public class FGCD_ComBase
|
{
|
public static final int BattGroupCountMax = 4;
|
public static final int MonomerCountMax = 480;
|
public static final int FBOMonomerCountMax = 300;
|
|
public static final int CMD_STARTCNNECT = 0x01;
|
|
//----------------------------------------------------------------------------
|
public static final int CMD_NULL = 0x00;
|
//----------------------------------------------------------------------------
|
//------------ ÖØÆôFBS9100É豸 ------------------------------------------------
|
public static final int CMD_ResetSystem = 0x10;
|
//------------ Éý¼¶FBS9100Èí¼þ ------------------------------------------------
|
public static final int CMD_SystemUpdate = 0x11;
|
//----------------------------------------------------------------------------
|
//------------ ¶ÁÈ¡É豸°æ±¾ºÅ¡¢ÊµÊ±ÈÎÎñÁбíµÈ ----------------------------------
|
public static final int CMD_GetDeviceInf = 0x15;
|
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_StartResDischarge = 0x32;
|
public static final int CMD_GetResTestState = 0x34;
|
//-----------------------------------------------------------------------------
|
//------------ ¶ÁÈ¡ºÍÉèÖÃµç³Ø²ÎÊý-----------------------------------------------
|
public static final int CMD_GetBattParam = 0x36;
|
public static final int CMD_SetBattParam = 0x37;
|
//----------------------------------------------------------------------------
|
//------------ Í£Ö¹ÈκεIJâÊÔ --------------------------------------------------
|
public static final int CMD_Stop = 0x53; //Í£Ö¹²âÊÔ
|
public static final int CMD_Suspended = 0x54; //ÔÝÍ£²âÊÔ
|
|
//------------ É豸ÉÏÀúÊ·Êý¾ÝÎļþ²Ù×÷ --------------------------------------------------
|
public static final int CMD_ReadFBDFile = 0xA1; //¶ÁÈ¡ÀúÊ·Îļþ
|
public static final int CMD_ReadFBDFile_ACK = 0xA2; //¶ÁÈ¡ÀúÊ·Îļþ³É¹¦
|
|
public static final int CMD_DownLoadFBDFile = 0xA3; //¿ªÊ¼ÏÂÔØ
|
public static final int CMD_DownLoadFBDFile_ACK = 0xA4; //ÏÂÔØ³É¹¦
|
|
public static final int CMD_DownLoadFBDFile_Over = 0xA5; //Í£Ö¹
|
public static final int CMD_DownLoadFBDFile_Over_ACK = 0xA6; //Í£Ö¹³É¹¦
|
|
|
//----------------------------------------------------------------------------
|
//------------ ¶ÁÈ¡µçѹµçÁ÷¡¢³ä·Åµç²âÊÔ¡¢ÄÚ×è²âÊÔÊý¾Ý ---------------------------
|
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_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_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 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 TestType_HuoHua = 0xD2; //»î»¯²âÊÔ
|
//------------------------------------------------------------------------------
|
//------------ µç³Ø×´Ì¬ ---------------------------------------------------------
|
public static final int BattState_Float = 0x00; //¸¡³ä
|
public static final int BattState_PauseDischarge = 0x01; //ÔÝÍ£·Åµç
|
public static final int BattState_Discharge = 0x02; //ÕýÔڷŵç
|
public static final int BattState_PauseCharge = 0x03; //ÔÝÍ£³äµç
|
public static final int BattState_Charge = 0x04; //ÕýÔÚ³äµç
|
//------------------------------------------------------------------------------
|
//------------ Êý¾ÝÀàÐÍ ---------------------------------------------------------
|
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;
|
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
//------------ FBO·µ»Ø×´Ì¬ ---------------------------------------------------------
|
public static final int DataReturn_Successs = 0x00;
|
public static final int DataReturn_Fail = 0x01;
|
|
|
public static final int WORK_STATE_STOPPED = 0; //ֹͣ״̬
|
public static final int WORK_STATE_STOPDIS = 1; //ÔÝÍ£·Åµç
|
public static final int WORK_STATE_DISTEST = 2; //·Åµç²âÊÔ
|
public static final int WORK_STATE_STOPCHAR = 3; //ÔÝÍ£³äµç
|
public static final int WORK_STATE_CHARTEST = 4; //ÕýÔÚ³äµç
|
|
public static final int WORK_STATE_HUOHUA = 5; //É豸ÎÞ¶ÔÓ¦,ͨÐųÌÐòÌí¼Ó
|
|
//------------------------------------------------------------------------------
|
//------------ FGCD_A059 É豸Ïà¹ØÃüÁî ------------------------------------------------------
|
//-----------------------------¶ÁÈ¡·Åµç²ÎÊý
|
public static final int CMD_GetDischargeParm = 0x29;
|
public static final int CMD_GetDischargeParmAck = 0x30;
|
//-----------------------------ÉèÖ÷ŵç²ÎÊý
|
public static final int CMD_SetDischargeParmAck = 0x27;
|
public static final int CMD_SetDischargeParm = 0x28;
|
//-----------------------------Æô¶¯/Í£Ö¹·Åµç²âÊÔÃüÁî
|
public static final int CMD_StartDischarge = 0x25; //Æô¶¯·Åµç
|
public static final int CMD_StartDischargeAck = 0x26; //Æô¶¯·Åµç³É¹¦
|
public static final int CMD_StopDischarge = 0x23; //Í£Ö¹·Åµç
|
public static final int CMD_StopDischargeAck = 0x24; //Í£Ö¹·Åµç³É¹¦
|
public static final int CMD_PauseDischarge = 0x21; //ÔÝÍ£·Åµç
|
public static final int CMD_PauseDischargeAck = 0x22; //ÔÝÍ£·Åµç³É¹¦
|
//-----------------------------Æô¶¯/Í£Ö¹³äµç²âÊÔÃüÁî
|
public static final int CMD_StartCharTest = 0xB1; //Æô¶¯³äµç
|
public static final int CMD_StartCharTestAck = 0xB2; //Æô¶¯³äµç³É¹¦
|
public static final int CMD_StopCharTest = 0xB3; //Í£Ö¹³äµç
|
public static final int CMD_StopCharTestAck = 0xB4; //Í£Ö¹³äµç³É¹¦
|
public static final int CMD_PauseCharTest = 0xB5; //ÔÝÍ£³äµç
|
public static final int CMD_PauseCharTestAck = 0xB6; //ÔÝÍ£³äµç³É¹¦
|
//-----------------------------Æô¶¯»î»¯²âÊÔÃüÁî
|
public static final int CMD_StartHUOHUATest = 0xC1; //Æô¶¯»î»¯²âÊÔ
|
public static final int CMD_StartHUOHUATestACK = 0xC2; //Æô¶¯»î»¯²âÊԳɹ¦
|
public static final int CMD_StopHUOHUATest = 0xC3; //Í£Ö¹»î»¯²âÊÔ
|
public static final int CMD_StopHUOHUATestACK = 0xC4; //Í£Ö¹»î»¯²âÊԳɹ¦
|
public static final int CMD_PauseHUOHUATest = 0xC5; //ÔÝÍ£»î»¯²âÊÔ
|
public static final int CMD_PauseHUOHUATestACK = 0xC6; //ÔÝÍ£»î»¯²âÊԳɹ¦
|
//-----------------------------Çå³ý¸æ¾¯
|
public static final int CMD_ClearSysAlarm = 0xB8; //Çå³ý¸æ¾¯
|
public static final int CMD_ClearSysAlarm_ACK = 0xB9; //Çå³ý¸æ¾¯³É¹¦
|
|
//------------ Android ¶ÁÈ¡ÃüÁî ---------------------------------------------------------------------
|
public static final int CMD_InterFace_Main = 0x00; //Ö÷½çÃæ
|
public static final int CMD_InterFace_Disc = 0x01; //·Åµç²ÎÊý½çÃæ
|
public static final int CMD_InterFace_Char = 0x02; //³äµç²ÎÊý½çÃæ
|
public static final int CMD_InterFace_HuoH = 0x03; //»î»¯²ÎÊý½çÃæ
|
public static final int CMD_InterFace_Data = 0x04; //Êý¾Ý½çÃæ
|
public static final int CMD_InterFace_Conf = 0x05; //ÉèÖýçÃæ
|
public static final int CMD_InterFace_Adjust = 0x06; //У׼½çÃæ
|
public static final int CMD_InterFace_Test = 0x07; //²âÊÔ½çÃæ
|
//------------------------------------------------------------------------------
|
|
|
//------------ Android ¶ÁÈ¡ÃüÁî ---------------------------------------------------------------------
|
public static final int CMD_HEARTBEAT = 0X0A01; //ÐÄÌø°ü
|
public static final int CMD_EXITMACHINECONTROL = 0X0A02; //Í˳öÉÏλ»ú¿ØÖÆ
|
public static final int CMD_ENTERMACHINECONTROL = 0X0A03; //½øÈëÉÏλ»ú¿ØÖÆ
|
public static final int CMD_GETDISCHARGEPARAM = 0X0A04; //¶ÁÈ¡·Åµç²ÎÊý
|
public static final int CMD_SETDISCHARGEPARAM = 0X0A05; //ÉèÖ÷ŵç²ÎÊý
|
public static final int CMD_GETBATTDATA = 0X0A06; //»ñÈ¡µ¥ÌåÊý¾Ý
|
public static final int CMD_GETFILELIST = 0X0A07; //»ñÈ¡ÎļþÁбí
|
public static final int CMD_GETFILE = 0X0A08; //»ñÈ¡Îļþ
|
public static final int CMD_SETCHARGEPARAM = 0X0A09; //ÉèÖóäµç²ÎÊý
|
public static final int CMD_GETCHARGEPARAM = 0X0A0A; //¶ÁÈ¡³äµç²ÎÊý
|
public static final int CMD_STARTDISCHARGE = 0X0A0B; //Æô¶¯·Åµç
|
public static final int CMD_PAUSEDISCHARGE = 0X0A0C; //·ÅµçÔÝÍ£
|
public static final int CMD_GETDISCHARGEDATA = 0X0A0D; //»ñÈ¡·ÅµçÊý¾Ý
|
public static final int CMD_STARTCHARGE = 0X0A0E; //Æô¶¯³äµç
|
public static final int CMD_PAUSECHARGE = 0X0A0F; //³äµçÔÝÍ£
|
public static final int CMD_GETCHARGEDATA = 0X0A10; //»ñÈ¡³äµçÊý¾Ý
|
public static final int CMD_GETJIAOZHUNDATA = 0X0A11; //»ñȡУ׼½çÃæÊý¾Ý
|
public static final int CMD_JIAOZHUNPARAMS = 0X0A12; //У׼¸÷¸ö²ÎÊý
|
public static final int CMD_JIAOZHUNDISCHARGE = 0X0A13; //У׼½çÃæ·Åµç
|
public static final int CMD_JIAOZHUNCHARGE = 0X0A14; //У׼½çÃæ³äµç
|
public static final int CMD_JIAOZHUNSTOP = 0X0A15; //У׼½çÃæÍ£Ö¹
|
public static final int CMD_RETURNMAIN = 0X0A16; //·µ»ØÖ÷½çÃæ[½çÃæÍ¬²½]
|
public static final int CMD_GETCYCLEPARAM = 0X0A17; //»ñȡѻ·²ÎÊý
|
public static final int CMD_SETCYCLEPARAM = 0X0A18; //ÉèÖÃÑ»·²ÎÊý
|
public static final int CMD_CREATENEWBATT = 0X0A19; //н¨µç³Ø×é
|
public static final int CMD_CHANGEBATT = 0X0A1A; //Çл»µç³Ø×é
|
public static final int CMD_DELETENOWBATT = 0X0A1B; //ɾ³ýµ±Ç°µç³Ø×é
|
public static final int CMD_STOPDISCHARGE = 0X0A1C; //Í£Ö¹·Åµç
|
public static final int CMD_STOPCHARGE = 0X0A1D; //Í£Ö¹³äµç
|
public static final int CMD_CLEARALARM = 0X0A1E; //Çå³ý¸æ¾¯
|
|
public static final int CMD_STARTHHTEST = 0X0A1F; //Æô¶¯»î»¯²âÊÔ
|
public static final int CMD_PAUSEHHTEST = 0X0A20; //ÔÝÍ£»î»¯²âÊÔ
|
public static final int CMD_STOPHHTEST = 0X0A21; //Í£Ö¹»î»¯²âÊÔ
|
|
public static final int CMD_GETBATTNAME = 0x0A22; //»ñÈ¡µç³Ø×éÃû
|
public static final int CMD_GETTESTFILENAME = 0x0A23; //»ñÈ¡²âÊÔÎļþÃû
|
public static final int CMD_GETBATTTESTFILE = 0x0A24; //»ñÈ¡µç³Ø×é²âÊÔÎļþ
|
public static final int CMD_SETTRIPEN = 0x0A25; //ÉèÖÃÍÑ¿ÛÆ÷ʹÄÜ
|
public static final int CMD_SETFANEN = 0x0A26; //ÉèÖ÷çÉÈʹÄÜ
|
public static final int CMD_READRESTESTDATA = 0x0A27; //»ñÈ¡ÄÚ×è²âÊÔÊý¾Ý
|
public static final int CMD_READTMPTESTDATA = 0x0A28; //»ñȡζȲâÊÔÊý¾Ý
|
public static final int CMD_DELBATTTESTFILE = 0x0A29; //»ñȡζȲâÊÔÊý¾Ý
|
|
public static final int WORKSTATE_Stopped = 0; //Í£Ö¹
|
public static final int WORKSTATE_Paused_Dischg = 1; //ÔÝÍ£·Åµç
|
public static final int WORKSTATE_Discharging = 2; //ÕýÔڷŵç
|
public static final int WORKSTATE_Paused_charge = 3; //ÔÝÍ£³äµç
|
public static final int WORKSTATE_Charging = 4; //ÕýÔÚ³äµç
|
|
public static final int RETURN_SUCCESS = 0X00; //²Ù×÷³É¹¦
|
public static final int RETURN_ERRORLEN = 0X01; //Êý¾Ý³¤¶È´íÎó
|
public static final int RETURN_ERRORCRC = 0X02; //CRC´íÎó
|
public static final int RETURN_ERRORMODE = 0X03; //½øÈëAndroidģʽʧ°Ü
|
public static final int RETURN_ERRORINDEX = 0X04; //Ë÷Òý´íÎó
|
public static final int RETURN_ERRORTEST = 0X05; //ÕýÔÚ²âÊÔ´íÎó
|
|
|
|
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);
|
}
|
//------------------------------------------------------------------------------
|
public static double changeShortToDouble(short data)
|
{
|
int tmp = data & 0xFFFF;
|
return (double)(tmp);
|
}
|
//------------------------------------------------------------------------------
|
public static short changeDoubleToShort(double 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);
|
}
|
//----------------------------------------------------------------------------------
|
*/
|
}
|
/***************************************************************************************
|
******************************* end of file (FBS_ComBase)*******************************
|
***************************************************************************************/
|