package com.table.badbatt; public class BattCapFactory { public static int CapType_Rest = 0; //µ±²éѯʣÓàÈÝÁ¿Ê±´«µÝ public static int CapType_Real = 1; //µ±²éѯʵ¼ÊÈÝÁ¿Ê±´«µÝ public static int CapType_type=2; //ÈÝÁ¿ public static int CapType_name=1; //´ÎµÍ public static int CapType_method=0; //±ê³Æ//0.01 public static final int Alarm_CapAlarm =119010; //--ÈÝÁ¿¸æ¾¯¸æ¾¯ public static final int Alarm_CapChange =119011; //--ÈÝÁ¿¸ü»»¸æ¾¯ //Âäºóµ¥ÌåɸѡÖÁtb_batttestdatastop_id±íʱ×é¶Ëµçѹ>±ê´æµçѹ*ãÐÖµ public static final float test_stop = 0.9f;//ãÐÖµ //Âäºóµ¥Ìåɸѡ·ÅµçÀàÐÍ public static final int test2=2;//³äµç public static final int test3=3;//·Åµç public static final int test_start3=3;//½ÚÄܷŵç // »ñÈ¡±ê´¿µçÁ÷ 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); } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // »ñÈ¡·ÅµçСʱÂÊ stdah£º±ê´¿ÈÝÁ¿ current:µ±Ç°µçÁ÷ public static int GetHourRate(double stdah, double current) { int index = 0; double value[]={5.14, 3.06, 2.50,2.00, 1.66, 1.46, 1.31, 1.18, 1.08, 1.00, 0.55, 0.40}; double res; current = Math.abs(current); res = current/(stdah/10); if(res >= 5.14) return 1; else if(res <= 0.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; } //------------------------------------------------------------------------------- //------------------------------------------------------------------------------- //»ñȡʣÓàÈÝÁ¿ STDAH£º±ê³ÆÈÝÁ¿ HourRate£º·ÅµçСʱÂÊ SumAH£º²âÊÔÈÝÁ¿ MaxMonomerVol£º×î´óµç³Øµçѹ MonomerVol£ºµ±Ç°µç³Ø×éµÄ×îµÍµ¥Ìåµçѹ //MonomerVolType:µç³ØµçѹÀàÐÍ 2v,6v,12v CapType:ÈÝÁ¿ÀàÐÍ£¨¶¨ÖµÊdz£Á¿£© //СʱÂÊ ÒѲâÊÔÈÝÁ¿ ×îÈÝÁ¿ public static 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)); double dt_vol = MaxMonomerVol - MonomerVolType*0.9; if(dt_vol < 0.01) dt_vol = 0.01; tmp_cap = tmp_cap/dt_vol; if(tmp_cap < 0) tmp_cap = 0; if(CapType == CapType_Rest) return tmp_cap; else if(CapType == CapType_Real) return (tmp_cap + SumAH * N_TO_10H(HourRate)); else return ((tmp_cap + SumAH * N_TO_10H(HourRate))*100 / STDAH); } //---------------------------------------------------------------------------------- //---------------------------------------------------------------------------------- //»ñÈ¡ºó±¸Ê±¼ä public static int GetRestTimeSecond(double restcap, double curr) { double tmp_curr = Math.abs(curr); if(tmp_curr < 0.1) tmp_curr = 0.1; int rest_time = (int)((restcap / tmp_curr) * 3600); if(rest_time > (99*3600)) rest_time = (99*3600); return rest_time; } //ÅжÏͨ¹ýʵ¼ÊÈÝÁ¿ÅжÏij´Î·Åµç²âÊÔÊÇ·ñÓÐЧ /* * STDAH:±ê´æÈÝÁ¿ * param:ÈÝÁ¿ÓÐЧ²ÎÊý*/ public static int Judge(double testCap,float param,double STDAH){ int flag=0; if(Math.abs(testCap)>(param*STDAH)){ flag=1; }else{ flag=0; } return flag; } //ÅжÏͨ¹ýʵ¼ÊÈÝÁ¿ÅжÏij´Î·Åµç²âÊÔÊÇ·ñÓÐЧ /* * STDAH:±ê´æÈÝÁ¿ * param:ÈÝÁ¿¸æ¾¯²ÎÊý*/ public static int JudgeAlarm(double realCap,float param,float Cparam,double STDAH){ Integer flag=0; if(realCap>(param*STDAH)){ flag=1; }else{ if(realCap<(Cparam*STDAH)){ flag=BattCapFactory.Alarm_CapChange; }else{ flag=BattCapFactory.Alarm_CapAlarm; } //System.out.println(realCap+" "+param+" "+STDAH+" "+flag); } return flag; } }