qingfeng 2 år sedan
förälder
incheckning
4331702dba

+ 23 - 12
LIB/MIDDLE/CellStateEstimation/BatSafetyWarning/V1_0_1/CBMSSafetyWarning.py

@@ -91,8 +91,9 @@ class SafetyWarning:
             if min(cellshort_sum)<2*self.param.LeakCurrentLv2:
                 cellshort_num=cellshort_sum.index(min(cellshort_sum))+1
                 cellshort=df_short_current['cellshort'+str(cellshort_num)]   #获取内短路电芯的所有漏电流值,且最小值<阈值
+                cellshort_last = cellshort.iloc[-1] #最近一次的漏电流
                 cellshort_sum.remove(min(cellshort_sum))    #删除最小值,并判断其他所有电芯内短路电流>阈值
-                if min(cellshort)<self.param.LeakCurrentLv2 and min(cellshort_sum)>self.param.LeakCurrentLv2:
+                if min(cellshort)<self.param.LeakCurrentLv2 and min(cellshort_sum)>self.param.LeakCurrentLv2 and cellshort_last<self.param.LeakCurrentLv2/2:
                     cellshortfault=1
                 else:
                     cellshortfault=0
@@ -116,7 +117,7 @@ class SafetyWarning:
         if not df_short1.empty:
             for i in range(3):
                 deltvolt_init=eval(df_short1.loc[0,'short_current'])
-                deltvolt_rst=np.array(deltvolt_init[0])
+                deltvolt_rst=np.array(deltvolt_init[i])
                 for j in range(len(df_short1)):
                     try:
                         deltvolt=eval(df_short1.loc[j+1,'short_current'])
@@ -124,20 +125,30 @@ class SafetyWarning:
                     except:
                         continue
                 
-                # 故障判断
-                if min(deltvolt_rst)<-6 and i>1:
+                #获取压降最大电芯的最近一次压降值
+                try:
+                    deltvolt_last = eval(df_short1.iloc[-1]['short_current'])
+                    deltvolt_last_list = list(deltvolt_last[i])
+                except:
+                    deltvolt_last_list = [0]*self.param.CellVoltNums
+                
+                # 故障判断:1.压降累计最大>6mV,次大<3mV,2.最近一次对应电芯的压降>3mV,且离群
+                if min(deltvolt_rst)<-6:
                     deltvolt_rst1=list(deltvolt_rst)
+                    deltvolt_min_index = list(deltvolt_rst).index(min(deltvolt_rst))
+                    deltvolt_last_list1 = deltvolt_last_list
+                    deltvolt_last_list1.pop(deltvolt_min_index)
                     deltvolt_rst1.remove(min(deltvolt_rst))
-                    if min(deltvolt_rst1)>-3:
+                    if min(deltvolt_rst1)>-3 and deltvolt_last_list[deltvolt_min_index]<-3 and min(deltvolt_last_list1)>-2.5:
                         cellshortfault1=1
-                        cellshort_num=list(deltvolt_rst).index(min(deltvolt_rst))+1
+                        cellshort_num=deltvolt_min_index+1
                         break
-                elif min(deltvolt_rst)<-6:
-                    deltvolt_rst1=list(deltvolt_rst)
-                    deltvolt_rst1.remove(min(deltvolt_rst))
-                    if min(deltvolt_rst1)>-3:
-                        cellshortfault1=1
-                        cellshort_num=list(deltvolt_rst).index(min(deltvolt_rst))+1
+                # elif min(deltvolt_rst)<-6:
+                #     deltvolt_rst1=list(deltvolt_rst)
+                #     deltvolt_rst1.remove(min(deltvolt_rst))
+                #     if min(deltvolt_rst1)>-3:
+                #         cellshortfault1=1
+                #         cellshort_num=list(deltvolt_rst).index(min(deltvolt_rst))+1
                 else:
                     cellshortfault1=0