Bladeren bron

1.热失控预警SOC变化率判断增加电压离群判断

qingfeng 2 jaren geleden
bovenliggende
commit
76bab510bd

+ 15 - 11
LIB/MIDDLE/CellStateEstimation/BatSafetyWarning/V1_0_1/CBMSSafetyWarning.py

@@ -39,6 +39,8 @@ class SafetyWarning:
         cellshortfault=0
         volt_rate=[]
         R2_list=[]
+        voltsigmafault_list=[]
+        uniformfault_list=[]
 
         if not self.df_short.empty:
             short_current=self.df_short['short_current']
@@ -79,7 +81,7 @@ class SafetyWarning:
             cellvolt_rank=cellvolt_rank.str.replace("[", '')
             cellvolt_rank=cellvolt_rank.str.replace("]", '')
 
-        # plt.figure()
+        plt.figure()
         for i in range(self.param.CellVoltNums):
             #漏电流故障判断...........................................................................
             if not self.df_short.empty:
@@ -113,21 +115,22 @@ class SafetyWarning:
                 R2_list.append(R2)
                 
                 volt_rate.append(a1)
-                # plt.plot(xtime1,y1,label=a1)
-                # plt.scatter( xtime1,VoltChange[volt_column[i]],marker='o')
-                # plt.legend(loc='best')
-                # plt.title('单体电压'+str(i+1))
-                # plt.rcParams['font.sans-serif']=['SimHei'] #用来正常显示中文标签
-                # plt.rcParams['axes.unicode_minus']=False #用来正常显示负号  
+                plt.plot(xtime1,y1,label=a1)
+                plt.scatter( xtime1,VoltChange[volt_column[i]],marker='o')
+                plt.legend(loc='best')
+                plt.title('单体电压'+str(i+1))
+                plt.rcParams['font.sans-serif']=['SimHei'] #用来正常显示中文标签
+                plt.rcParams['axes.unicode_minus']=False #用来正常显示负号  
                 # plt.show()
                 
-                if volt3sigma_sum>len(self.OutLineVol_Rate)/2:
+                if volt3sigma_sum>len(volt3sigma)/2:
                     voltsigmafault=1
                 else:
                     voltsigmafault=0
             else:
                 volt_rate.append(0)
                 R2_list.append(0)
+            voltsigmafault_list.append(voltsigmafault)
 
             #电芯SOC排名判断.............................................................................
             if not self.df_uniform.empty:
@@ -139,9 +142,10 @@ class SafetyWarning:
                     uniformfault=0
             else:
                 uniformfault=0
+            uniformfault_list.append(uniformfault)
             
             #漏电流热失控预警确认........................................................
-            if cellshortfault==1 and (uniformfault==1 or voltsigmafault==1):
+            if cellshortfault==1:
                 faultcode=110
                 faultlv=4
                 faultinfo='电芯{}发生热失控安全预警'.format(i+1)
@@ -162,7 +166,7 @@ class SafetyWarning:
         else:
             cellsoh_3sigma=[0]*self.param.CellVoltNums
         for i in range(len(volt_rate)):
-            if volt_rate[i]<self.param.TrwVoltRate and volt_rate_3sigma[i]<-3 and abs(cellsoh_3sigma[i])<2.5:
+            if volt_rate[i]<self.param.TrwVoltRate and volt_rate_3sigma[i]<-3 and abs(cellsoh_3sigma[i])<2.5 and (uniformfault_list[i]==1 or voltsigmafault_list[i]==1):
                 faultcode=110
                 faultlv=4
                 faultinfo='电芯{}发生热失控安全预警'.format(i+1)
@@ -171,6 +175,6 @@ class SafetyWarning:
             else:
                 pass
         
-        # plt.show()
+        plt.show()
 
         return df_res

+ 18 - 20
LIB/MIDDLE/SaftyCenter/DataDiag_Static/CBMSBatDiag.py

@@ -322,28 +322,26 @@ class BatDiag:
             else:
                 pass
             #SOC卡滞............................................................................................................
-            if abs(ah_accum)>self.param.Capacity*0.05:   
-                bmssoc_now=float(self.bms_soc[i])
-                if not 27 in list(self.df_diag_ram['code']):  #当前故障中没有该故障,则判断是否发生该故障
-                    if abs(bmssoc_now-bmssoc_st)<self.param.SocClamp:   #SOC卡滞故障进入
-                        time=self.bmstime[i]
-                        code=27
-                        faultlv=1
-                        faultinfo='电池SOC卡滞'
-                        faultadvice='技术介入诊断,检修电池BMS软件'
-                        self.df_diag_ram.loc[len(self.df_diag_ram)]=[time, end_time, self.sn, code, faultlv, faultinfo, faultadvice]
-                    else:
-                        pass
+            bmssoc_now=float(self.bms_soc[i])
+            if not 27 in list(self.df_diag_ram['code']):  #当前故障中没有该故障,则判断是否发生该故障
+                if abs(ah_accum)>self.param.Capacity*0.05 and abs(bmssoc_now-bmssoc_st)<self.param.SocClamp:   #SOC卡滞故障进入
+                    bmssoc_st=bmssoc_now
+                    ah_accum=0
+                    time=self.bmstime[i]
+                    code=27
+                    faultlv=1
+                    faultinfo='电池SOC卡滞'
+                    faultadvice='技术介入诊断,检修电池BMS软件'
+                    self.df_diag_ram.loc[len(self.df_diag_ram)]=[time, end_time, self.sn, code, faultlv, faultinfo, faultadvice]
                 else:
-                    if abs(bmssoc_now-bmssoc_st)>self.param.SocClamp:   #SOC卡滞故障退出
-                        time=self.bmstime[i]
-                        self.df_diag_ram.loc[self.df_diag_ram[self.df_diag_ram['code']==27].index, 'end_time'] = time
-                    else:
-                        pass
-                bmssoc_st=bmssoc_now
-                ah_accum=0
+                    pass
             else:
-                pass
+                if abs(bmssoc_now-bmssoc_st)>self.param.SocClamp:   #SOC卡滞故障退出
+                    time=self.bmstime[i]
+                    self.df_diag_ram.loc[self.df_diag_ram[self.df_diag_ram['code']==27].index, 'end_time'] = time
+                else:
+                    pass
+            
 
             #SOC跳变....................................................................................................................
             bmssoc_last=float(self.bms_soc[i-1])