Browse Source

更改内短路两次时间间隔>1days

qingfeng 3 years ago
parent
commit
452076e5bc
1 changed files with 21 additions and 16 deletions
  1. 21 16
      LIB/MIDDLE/CellStateEstimation/InterShort/V1_0_0/CBMSBatInterShort.py

+ 21 - 16
LIB/MIDDLE/CellStateEstimation/InterShort/V1_0_0/CBMSBatInterShort.py

@@ -307,20 +307,23 @@ class BatInterShort:
                                     firsttime1=0
                                 else:
                                     dict_baltime1=self._bal_time(dict_bal1)   #获取每个电芯的均衡时间
-                                    deltsoc_now1=self._celldeltsoc_get(i,dict_baltime1,capacity)
                                     time_now1=self.bmstime[i]
+                                    if (time_now1-time_last1).total_seconds()>3600*24:
+                                        deltsoc_now1=self._celldeltsoc_get(i,dict_baltime1,capacity)
 
-                                    list_sub1=[a-b for a, b in zip(deltsoc_now1, deltsoc_last1)]
-                                    list_pud1=[0.01*capacity*3600*1000/(time_now1-time_last1).total_seconds()]*self.param.CellVoltNums
-                                    leak_current1=[a*b for a,b in zip(list_sub1,list_pud1)]
-                                    leak_current1=np.array(leak_current1)
-                                    leak_current1=np.round(leak_current1,3)
-                                    leak_current1=list(leak_current1)
-                                    
-                                    df_res.loc[len(df_res)]=[time_last1,time_now1,self.sn,2,str(leak_current1),str(dict_baltime1)]  #计算结果存入Dataframe
-                                    time_last1=time_now1  #更新时间
-                                    deltsoc_last1=deltsoc_now1    #更新soc差
-                                    dict_bal1={}
+                                        list_sub1=[a-b for a, b in zip(deltsoc_now1, deltsoc_last1)]
+                                        list_pud1=[0.01*capacity*3600*1000/(time_now1-time_last1).total_seconds()]*self.param.CellVoltNums
+                                        leak_current1=[a*b for a,b in zip(list_sub1,list_pud1)]
+                                        leak_current1=np.array(leak_current1)
+                                        leak_current1=np.round(leak_current1,3)
+                                        leak_current1=list(leak_current1)
+                                        
+                                        df_res.loc[len(df_res)]=[time_last1,time_now1,self.sn,2,str(leak_current1),str(dict_baltime1)]  #计算结果存入Dataframe
+                                        time_last1=time_now1  #更新时间
+                                        deltsoc_last1=deltsoc_now1    #更新soc差
+                                        dict_bal1={}
+                                    else:
+                                        pass
                             else:
                                 pass
                         else:
@@ -457,7 +460,8 @@ class BatInterShort:
                                     deltsoc_now1=self._celldeltsoc_get(i,dict_baltime1,capacity)
                                     time_now1=self.bmstime[i]
 
-                                    if abs(max(deltsoc_now1)-max(deltsoc_last1))<10:
+                                    time_now1=self.bmstime[i]
+                                    if abs(max(deltsoc_now1)-max(deltsoc_last1))<10 and (time_now1-time_last1).total_seconds()>3600*24:
                                         list_sub1=[a-b for a, b in zip(deltsoc_now1, deltsoc_last1)]
                                         list_pud1=[0.01*capacity*3600*1000/(time_now1-time_last1).total_seconds()]*self.param.CellVoltNums
                                         leak_current1=[a*b for a,b in zip(list_sub1,list_pud1)]
@@ -467,11 +471,12 @@ class BatInterShort:
                                     
                                         
                                         df_res.loc[len(df_res)]=[time_last1,time_now1,self.sn,2,str(leak_current1),str(dict_baltime1)]  #计算结果存入Dataframe
+                                        time_last1=time_now1  #更新时间
+                                        deltsoc_last1=deltsoc_now1    #更新soc差
+                                        dict_bal1={}
                                     else:
                                         pass
-                                    time_last1=time_now1  #更新时间
-                                    deltsoc_last1=deltsoc_now1    #更新soc差
-                                    dict_bal1={}
+                                    
                             else:
                                 pass
                         else: