package com.dev.fgcd.fbo;
|
|
|
|
import java.nio.ByteBuffer;
|
import java.nio.ByteOrder;
|
import java.util.Arrays;
|
import java.util.GregorianCalendar;
|
|
import com.battmonitor.sql.Com;
|
import com.dev.fgcd.data.FGCD_TestFBOFile;
|
|
|
public class FboDataInf {
|
public static final int MaxLowMonCount = 6; //×îµÍÂäºóµ¥ÌåÊýÁ¿
|
|
public FboDateTime TestStartTime = new FboDateTime(); //·Åµç¿ªÊ¼µÄʱ¼ä
|
public int Device; //ÒDZíÀàÐÍ
|
public int DataVersion; //Êý¾Ý°æ±¾
|
public int DataType; //Êý¾ÝÀàÐÍ;0xFD±íʾ·Åµç,0xFC±íʾ³äµç
|
public int HourRate; //СʱÂÊ
|
public int SaveInterval; //²É¼¯¼ä¸ô
|
public float MonomerVol; //µ¥ÌåµçѹÀàÐÍ
|
public int STDCap; //±ê³ÆÈÝÁ¿
|
public float TestCur; //²âÊÔµçÁ÷
|
public float MVLLimit; //µ¥ÌåÏÂÏÞ
|
public float SumVLLimit; //×é¶ËÏÂÏÞ
|
public int BattSum; //µ¥ÌåÊýÁ¿
|
public int BattGroup; //µç³Ø×éÊý
|
public float MVLLimitCount; //µ¥ÌåÏÂÏÞ¸öÊý
|
|
public FboTestTime TestTimeLong = new FboTestTime(); //²âÊÔʱ³¤
|
public int StopType; //½áÊø·½Ê½
|
public int BlockSum; //±£´æÊý¾ÝµÄ×Ü¿éÊý
|
public int StandBy; //±£Áô±¸ÓÃ
|
public int[] SMaxIndex = new int[4]; //×î¸ßµ¥ÌåË÷Òý
|
public int[] SMinIndex = new int[4]; //×îµÍµ¥ÌåË÷Òý
|
public float[] SMaxVol = new float[4]; //×î¸ßµ¥Ìå
|
public float[] SMinVol = new float[4]; //×îµÍµ¥Ìå
|
public double realcap; //Ô¤¹Àʵ¼ÊÈÝÁ¿
|
public float TestCap; //²âÊÔÈÝÁ¿
|
public float avg_curr; //ƽ¾ùµçÁ÷
|
public double[] monRealCap;
|
public String lowMonNum=""; //Âäºóµ¥Ìå±àºÅ
|
public int lowMonCount; //Âäºóµ¥ÌåÊýÁ¿
|
public int batt_qualified; //0:²»ºÏ¸ñ 1:ºÏ¸ñ
|
|
public void setDataInf(byte[] inf_data)
|
{
|
ByteBuffer bf = ByteBuffer.allocate(2048);
|
bf.order(ByteOrder.LITTLE_ENDIAN);
|
bf.put(inf_data);
|
bf.position(0);
|
|
TestStartTime.year = (int) (bf.get()&0xFF);
|
TestStartTime.month = (int) (bf.get()&0xFF)-1;
|
//System.out.println(TestStartTime.month+" setDataInf(byte[] inf_data)");
|
TestStartTime.day = (int) (bf.get()&0xFF);
|
TestStartTime.hour = (int) (bf.get()&0xFF);
|
TestStartTime.minute = (int) (bf.get()&0xFF);
|
TestStartTime.second = (int) (bf.get()&0xFF);
|
|
//System.out.println(Com.getDateTimeFormat(TestStartTime.getFBODateTime(), Com.DTF_YMDhms));
|
|
Device = (int) (bf.get()&0xFF);
|
DataVersion = (int) (bf.get()&0xFF); //Êý¾Ý°æ±¾
|
DataType = FGCD_TestFBOFile.getFBSDevType((int) (bf.get()&0xFF)); //Êý¾ÝÀàÐÍ;0xFD±íʾ·Åµç,0xFC±íʾ³äµç
|
HourRate = (int) (bf.get()&0xFF); //СʱÂÊ
|
SaveInterval = (int) (bf.get()&0xFF); //²É¼¯¼ä¸ô
|
MonomerVol = (float) (bf.get()&0xFF)/10; //µ¥ÌåµçѹÀàÐÍ
|
STDCap = (int) (bf.getShort()&0xFFFF); //±ê³ÆÈÝÁ¿
|
TestCur = (float) (bf.getShort()&0xFFFF)/10; //²âÊÔµçÁ÷
|
MVLLimit = ((float) (bf.getShort()&0xFFFF)) / 1000; //µ¥ÌåÏÂÏÞ
|
SumVLLimit = ((float) (bf.getShort()&0xFFFF)) / 10; //×é¶ËÏÂÏÞ
|
BattSum = (int) (bf.getShort()&0xFFFF); //µ¥ÌåÊýÁ¿
|
BattGroup = (int) (bf.getShort()&0xFFFF); //µç³Ø×éÊý
|
MVLLimitCount = (int) (bf.getShort()&0xFFFF); //µ¥ÌåÏÂÏÞ¸öÊý
|
|
TestTimeLong.hour = (int) (bf.get()&0xFF);
|
TestTimeLong.minute = (int) (bf.get()&0xFF);
|
TestTimeLong.second = (int) (bf.get()&0xFF);
|
StopType = (int) (bf.get()&0xFF);
|
//µ±·Åµç½áÊøºó¼ÆË㵱ǰֹͣÔÒò
|
if(StopType > 0x80) {
|
StopType = StopType - 0x80;
|
}
|
BlockSum = (int) (bf.get()&0xFF);
|
StandBy = (int) (bf.get()&0xFF);
|
for(int n=0; n<4; n++)
|
{
|
SMaxIndex[n] = (int) (bf.getShort()&0xFFFF);
|
}
|
for(int n=0; n<4; n++)
|
{
|
SMinIndex[n] = (int) (bf.getShort()&0xFFFF);
|
}
|
for(int n=0; n<4; n++)
|
{
|
SMaxVol[n] = ((float) (bf.getShort()&0xFFFF)) / 1000;
|
}
|
for(int n=0; n<4; n++)
|
{
|
SMinVol[n] = ((float) (bf.getShort()&0xFFFF)) / 1000;
|
}
|
|
TestCap = (float) (bf.getShort()&0xFFFF)/10;
|
avg_curr = TestCap*3600/TestTimeLong.getTestTimeLong();
|
//System.out.println("avg_curr:"+avg_curr);
|
realcap = BattCapFactory.GetMonomerCap(STDCap,HourRate, TestCap, SMaxVol[0], MonomerVol, SMinVol[0], BattCapFactory.CapType_Real);
|
}
|
|
public int getTestTimeLong() {
|
return TestTimeLong.hour*60*60+TestTimeLong.minute*60+TestTimeLong.second;
|
}
|
|
public void setDataInf(IdcDataInf d_inf)
|
{
|
GregorianCalendar gc = (GregorianCalendar) GregorianCalendar.getInstance();
|
gc.setTime(d_inf.m_TestTime);
|
|
TestStartTime.year = gc.get(GregorianCalendar.YEAR);
|
TestStartTime.month = gc.get(GregorianCalendar.MONTH)-1;
|
//System.out.println(TestStartTime.month+" IdcDataInf d_inf ");
|
TestStartTime.day = gc.get(GregorianCalendar.DATE);
|
TestStartTime.hour = gc.get(GregorianCalendar.HOUR);
|
TestStartTime.minute = gc.get(GregorianCalendar.MINUTE);
|
TestStartTime.second = gc.get(GregorianCalendar.SECOND);
|
|
Device = IdcDataInf.DevType_Idc;
|
DataVersion = 0; //Êý¾Ý°æ±¾
|
DataType = d_inf.m_TestType; //Êý¾ÝÀàÐÍ;0xFD±íʾ·Åµç,0xFC±íʾ³äµç
|
HourRate = d_inf.m_HourRate; //СʱÂÊ
|
SaveInterval = 0; //²É¼¯¼ä¸ô
|
MonomerVol = (int) d_inf.m_MonomerVol; //µ¥ÌåµçѹÀàÐÍ
|
STDCap = d_inf.m_STDAH; //±ê³ÆÈÝÁ¿
|
TestCur = 0; //²âÊÔµçÁ÷
|
MVLLimit = d_inf.m_MonomerVolLL; //µ¥ÌåÏÂÏÞ
|
SumVLLimit = d_inf.m_SumVolLL; //×é¶ËÏÂÏÞ
|
BattSum = d_inf.m_EachBattSum * d_inf.m_BattGroup; //µ¥ÌåÊýÁ¿
|
BattGroup = d_inf.m_BattGroup; //µç³Ø×éÊý
|
MVLLimitCount = 1; //µ¥ÌåÏÂÏÞ¸öÊý
|
|
TestTimeLong.hour = 0;
|
TestTimeLong.minute = 0;
|
TestTimeLong.second = 0;
|
StopType = 0;
|
BlockSum = 0;
|
StandBy = 0;
|
for(int n=0; n<4; n++)
|
{
|
SMaxIndex[n] = 0;
|
}
|
for(int n=0; n<4; n++)
|
{
|
SMinIndex[n] = 0;
|
}
|
for(int n=0; n<4; n++)
|
{
|
SMaxVol[n] = 0;
|
}
|
for(int n=0; n<4; n++)
|
{
|
SMinVol[n] = 0;
|
}
|
|
TestCap = 0;
|
}
|
|
public static String getDeviceType(int type)
|
{
|
String dev_type = "δ֪";
|
switch(type) //²âÊÔÒDZíÀàÐÍ
|
{
|
case 0xFB : dev_type = "FBO4815-CT"; break;
|
case 0xDC : dev_type = "IDCE4815-CT";break;
|
case 0x2F : dev_type = "FBO2205-CT"; break;
|
case 0x2E : dev_type = "IDCE2205-CT";break;
|
case 0x26 : dev_type = "FBO2206-CT"; break;
|
case 0x25 : dev_type = "IDCE2206-CT";break;
|
case 0x3F : dev_type = "FBO4830-CT"; break;
|
case 0x3E : dev_type = "IDCE4830-CT";break;
|
case 0x6F : dev_type = "FBO6003-CT"; break;
|
case 0x6E : dev_type = "IDCE6003-CT";break;
|
case 0x66 : dev_type = "FBO6006-CT"; break;
|
case 0x67 : dev_type = "IDCE6006-CT";break;
|
case 0x60 : dev_type = "FBO60010-CT";break;
|
case 0x61 : dev_type = "IDCE60010-CT";break;
|
case 0x0F : dev_type = "FBO1101-CT"; break;
|
case 0x0E : dev_type = "IDCE1101-CT";break;
|
case 0x1F : dev_type = "FBO1110-CT"; break;
|
case 0x1E : dev_type = "IDCE1110-CT";break;
|
case 0xF2 : dev_type = "FBI-4548CT";break;
|
case 0xF3 : dev_type = "FBI-3048CT";break;
|
case 0xF1 : dev_type = "FBI-3015CT";break;
|
case 0xF4 : dev_type = "FBI-10480CT";break;
|
case 0xF5 : dev_type = "FBI-05480CT";break;
|
case 0xF6 : dev_type = "FBI-15480CT";break;
|
case 0xF7 : dev_type = "FBI-20480CT";break;
|
case 0xE1 : dev_type = "FBI-05240CT";break;
|
case 0xE2 : dev_type = "FBI-10240CT";break;
|
case 0xE3 : dev_type = "FBI-15240CT";break;
|
case 0xE4 : dev_type = "FBI-20240CT";break;
|
case 0x22 : dev_type = "FBO2210-CT"; break;
|
case 0x21 : dev_type = "IDCE2210-CT";break;
|
case 0x15 : dev_type = "FBO2415-CT"; break;
|
case 0x16 : dev_type = "IDCE2415-CT";break;
|
case 0x12 : dev_type = "FBO1230-CT";break;
|
case 0x11 : dev_type = "IDCE1230-CT";break;
|
case 0x84 : dev_type = "FBO840-CT";break;
|
case 0x85 : dev_type = "IDCE840-CT";break;
|
case 0x13 : dev_type = "IDC_DEV";break;
|
case 0x45 : dev_type = "Ser_DEV";break;
|
case 0x46 : dev_type="DevType_FBR";break;
|
}
|
|
return dev_type;
|
}
|
|
public static String getTestType(int type)
|
{
|
String test_type = "δ֪";
|
switch(type)
|
{
|
case 0xFD : test_type = "·Åµç"; break;
|
case 0xFC : test_type = "³äµç"; break;
|
case 0xCD : test_type = "³ä·Åµç"; break;
|
case CsvData.DevType_Csv : test_type = "µçµ¼"; break;
|
case CsvData.DevType_FBR : test_type = "ÄÚ×è"; break;
|
}
|
return test_type;
|
}
|
|
public static String getStopType(int type)
|
{
|
String stop_type = "δ֪";
|
switch(type)
|
{
|
case 0 : stop_type = "ÊÖ¶¯Í£Ö¹"; break;
|
case 1 : stop_type = "·Åµçʱ¼äµ½"; break;
|
case 2 : stop_type = "·ÅµçÈÝÁ¿µ½"; break;
|
case 3 : stop_type = "µ¥ÌåÏÂÏÞµ½"; break;
|
case 4 : stop_type = "×é¶ËÏÂÏÞµ½"; break;
|
case 5 : stop_type = "ÊеçÖжÏ"; break;
|
case 6 : stop_type = "ÄÚ´æ²»×ã"; break;
|
case 7 : stop_type = "ζÈÒì³£"; break;
|
}
|
return stop_type;
|
}
|
|
@Override
|
public String toString() {
|
return "FboDataInf [TestStartTime=" + TestStartTime + ", Device=" + Device + ", DataVersion=" + DataVersion
|
+ ", DataType=" + DataType + ", HourRate=" + HourRate + ", SaveInterval=" + SaveInterval
|
+ ", MonomerVol=" + MonomerVol + ", STDCap=" + STDCap + ", TestCur=" + TestCur + ", MVLLimit="
|
+ MVLLimit + ", SumVLLimit=" + SumVLLimit + ", BattSum=" + BattSum + ", BattGroup=" + BattGroup
|
+ ", MVLLimitCount=" + MVLLimitCount + ", TestTimeLong=" + TestTimeLong + ", StopType=" + StopType
|
+ ", BlockSum=" + BlockSum + ", StandBy=" + StandBy + ", SMaxIndex=" + Arrays.toString(SMaxIndex)
|
+ ", SMinIndex=" + Arrays.toString(SMinIndex) + ", SMaxVol=" + Arrays.toString(SMaxVol) + ", SMinVol="
|
+ Arrays.toString(SMinVol) + ", realcap=" + realcap + ", TestCap=" + TestCap + "]";
|
}
|
|
|
|
|
}
|