Pārlūkot izejas kodu

磷酸铁力内短路优化

qingfeng 2 gadi atpakaļ
vecāks
revīzija
b36deffadf

+ 41 - 41
LIB/MIDDLE/CellStateEstimation/BatSafetyWarning/V1_0_1/CBMSBatInterShort.py

@@ -912,58 +912,58 @@ class BatInterShort():
                 if self.packcrnt[i]<=-1 and self.packcrnt[i-1]<=-1 and self.packcrnt[i+1]<=-1:
                     celltemp_now=self._celltemp_get(i)
                     cellvolt_now=self._cellvolt_get(i)
-                    if min(celltemp_now)>0 and max(cellvolt_now)<3.4:
+                    if min(celltemp_now)>0 and max(cellvolt_now)<3.45:
                         charging=2
-                    if charging==2 and min(cellvolt_now)>2 and 3.44<max(cellvolt_now)<3.7:
+                    if charging==2 and min(cellvolt_now)>2 and 3.46<max(cellvolt_now)<3.7:
                         charging=1
                         chrg_start=i
                     else:
                         pass
 
             else: #充电中
-                cellvolt_now=self._cellvolt_get(i)
+                cellvolt_now=self._cellvolt_get(i-1)
                 #计算漏电流......................................................................
                 if max(cellvolt_now)>3.51 and self.packcrnt[i]>-0.1 and self.packcrnt[i+1]>-0.1:   #电压>93%对应的电压
-                    if i-chrg_start>10:
-                        chrg_end=i
-                        charging=0
+                    # if i-chrg_start>10:
+                    chrg_end=i
+                    charging=0
 
-                        #计算漏电流值...................................................................
-                        if firsttime2==1:
-                            firsttime2=0
-                            voltmax_index=list(cellvolt_now).index(max(cellvolt_now))+1
-                            # cellvolt_max=(self.df_bms['单体电压'+str(voltmax_index)][chrg_start:chrg_end])/1000
-                            
-                            deltvolt_last2,packcrnt_mean_last,temp_mean_last=self._deltvolt(chrg_start,chrg_end,voltmax_index)  #获取deltAs
-                            
-                            time_last2=self.bmstime[chrg_end]
-                            df_ram_chrgvolt.loc[0]=[self.sn,time_last2,list(map(list,deltvolt_last2)),packcrnt_mean_last,temp_mean_last]    #更新RAM信息
-                        else:
-                            dict_baltime2={}
-                            time_now2=self.bmstime[chrg_end]
-                            voltmax_index=list(cellvolt_now).index(max(cellvolt_now))+1
-                            # cellvolt_max=(self.df_bms['单体电压'+str(voltmax_index)][chrg_start:chrg_end])/1000
-                            
-                            deltvolt_now2,packcrnt_mean_now,temp_mean_now=self._deltvolt(chrg_start,chrg_end,voltmax_index)
-                            leak_current2=[]
-                            for j in range(min(len(deltvolt_now2),len(deltvolt_last2))):
-                                if abs(packcrnt_mean_now[j]-packcrnt_mean_last[j])<10 and (abs(temp_mean_now[j]-temp_mean_last[j])<10 or (temp_mean_now[j]>20 and temp_mean_last[j]>20)) and (time_now2-time_last2).total_seconds()<14*24*3600:
-                                    list_sub2=(deltvolt_now2[j]-deltvolt_last2[j])*1000
-                                    list_sub2=np.round(list_sub2,1)
-                                    leak_current2.append(list(list_sub2))
-                                else:
-                                    break
-                            if len(leak_current2)>0:
-                                df_res.loc[len(df_res)]=[time_last2,time_now2,self.sn,4,str(leak_current2),str(dict_baltime2)]  #计算结果存入Dataframe
-                            time_last2=time_now2
-                            deltvolt_last2=deltvolt_now2
-                            packcrnt_mean_last=packcrnt_mean_now
-                            temp_mean_last=temp_mean_now
-                            dict_bal2={}
-                            df_ram_chrgvolt.loc[0]=[self.sn,time_last2,list(map(list,deltvolt_last2)),packcrnt_mean_last,temp_mean_last]    #更新RAM信息
-                    
+                    #计算漏电流值...................................................................
+                    if firsttime2==1:
+                        firsttime2=0
+                        voltmax_index=list(cellvolt_now).index(max(cellvolt_now))+1
+                        # cellvolt_max=(self.df_bms['单体电压'+str(voltmax_index)][chrg_start:chrg_end])/1000
+                        
+                        deltvolt_last2,packcrnt_mean_last,temp_mean_last=self._deltvolt(chrg_start,chrg_end,voltmax_index)  #获取deltAs
+                        
+                        time_last2=self.bmstime[chrg_end]
+                        df_ram_chrgvolt.loc[0]=[self.sn,time_last2,list(map(list,deltvolt_last2)),packcrnt_mean_last,temp_mean_last]    #更新RAM信息
                     else:
-                        charging=0
+                        dict_baltime2={}
+                        time_now2=self.bmstime[chrg_end]
+                        voltmax_index=list(cellvolt_now).index(max(cellvolt_now))+1
+                        # cellvolt_max=(self.df_bms['单体电压'+str(voltmax_index)][chrg_start:chrg_end])/1000
+                        
+                        deltvolt_now2,packcrnt_mean_now,temp_mean_now=self._deltvolt(chrg_start,chrg_end,voltmax_index)
+                        leak_current2=[]
+                        for j in range(min(len(deltvolt_now2),len(deltvolt_last2))):
+                            if abs(packcrnt_mean_now[j]-packcrnt_mean_last[j])<10 and (abs(temp_mean_now[j]-temp_mean_last[j])<10 or (temp_mean_now[j]>20 and temp_mean_last[j]>20)) and (time_now2-time_last2).total_seconds()<14*24*3600:
+                                list_sub2=(deltvolt_now2[j]-deltvolt_last2[j])*1000
+                                list_sub2=np.round(list_sub2,1)
+                                leak_current2.append(list(list_sub2))
+                            else:
+                                break
+                        if len(leak_current2)>0:
+                            df_res.loc[len(df_res)]=[time_last2,time_now2,self.sn,4,str(leak_current2),str(dict_baltime2)]  #计算结果存入Dataframe
+                        time_last2=time_now2
+                        deltvolt_last2=deltvolt_now2
+                        packcrnt_mean_last=packcrnt_mean_now
+                        temp_mean_last=temp_mean_now
+                        dict_bal2={}
+                        df_ram_chrgvolt.loc[0]=[self.sn,time_last2,list(map(list,deltvolt_last2)),packcrnt_mean_last,temp_mean_last]    #更新RAM信息
+                    
+                    # else:
+                    #     charging=0
                 
                 elif self.packcrnt[i]>-0.1 and self.packcrnt[i-1]>-0.1: #(self.packcrnt[i]<-eval(self.pack_param['capacity'])/2 and self.packcrnt[i-1]<-eval(self.pack_param['capacity'])/2):  #如果充电过程中时间间隔>180s,则舍弃该次充电
                     charging=0