Przeglądaj źródła

Merge branch 'dev' of http://git.fast-fun.cn:92/lmstack/data_analyze_platform into dev

qingfeng 2 lat temu
rodzic
commit
39a38d34b6

+ 2 - 2
LIB/FRONTEND/CellStateEstimation/BatSafetyWarning/deploy.py

@@ -206,7 +206,7 @@ def saftywarning_cal():
                         update all_fault_info set update_time='{}',end_time='{}', Batpos={} where product_id='{}' and code={} and end_time='0000-00-00 00:00:00'
                         '''.format(datetime.datetime.now(), df_res_chg.iloc[-1]['end_time'], df_res_chg.iloc[-1]['Batpos'],sn, 'C490'))
                 conn_platform.commit()
-        except:
+        except Exception as e:
             logger.error(traceback.format_exc)
             logger.error(u"{} :{},{} 任务运行错误\n".format(sn,start_time,end_time), exc_info=True)
     cursor_platform.close()
@@ -305,7 +305,7 @@ if __name__ == "__main__":
     df_warning_ram=pd.DataFrame(columns=['sn','time','deltsoc','cellsoc'])
     df_warning_ram1=pd.DataFrame(columns=['sn','time1','deltsoc1'])
     df_warning_ram2=pd.DataFrame(columns=['sn','time2','deltAs2'])
-    df_warning_ram3=pd.DataFrame(columns=['sn','time3','standingtime','standingtime1','standingtime2','standingtime3'])
+    df_warning_ram3=pd.DataFrame(columns=['sn','time3','standingtime','standingtime1','standingtime2'])
     df_lfp_ram=pd.DataFrame()
     df_lfp_ram1=pd.DataFrame()
     df_chrgvolt_ram=pd.DataFrame(columns=['sn','time','deltvolt','packcrnt_avg','temp_avg'])

+ 2 - 2
LIB/MIDDLE/CellStateEstimation/BatSafetyWarning/V1_0_1/CBMSBatUniform.py

@@ -339,7 +339,6 @@ class BatUniform():
                         #     else:
                         #         pass
                     elif standingtime2>3600*6:
-                        standingtime2=0
                         cellvolt_now=self._cellvolt_get(i)
                         cellvolt_min=min(cellvolt_now)
                         cellvolt_max=max(cellvolt_now)
@@ -347,6 +346,7 @@ class BatUniform():
                         deltvolt=max(abs(cellvolt_now-cellvolt_last))                  
                         
                         if 2 < cellvolt_max < self.param.OcvInflexionBelow-0.002 and 2<cellvolt_min<4.5 and deltvolt<0.005: 
+                            standingtime2=0
                             cellvolt_sort=np.argsort(cellvolt_now)
                             cellvolt_rank=list(np.argsort(cellvolt_sort)+1)
                             cellmin_num=list(cellvolt_now).index(cellvolt_min)+1
@@ -373,13 +373,13 @@ class BatUniform():
                         #         pass
                     
                     elif i>=len(self.df_bms)-3:
-                        standingtime2=0
                         cellvolt_now=self._cellvolt_get(i)
                         cellvolt_min=min(cellvolt_now)
                         cellvolt_max=max(cellvolt_now)
                         cellvolt_last=self._cellvolt_get(i-1)
                         deltvolt=max(abs(cellvolt_now-cellvolt_last)) 
                         if 2 < cellvolt_max < self.param.OcvInflexionBelow-0.002 and 2<cellvolt_min<4.5 and deltvolt<0.003:
+                            standingtime2=0
                             cellvolt_sort=np.argsort(cellvolt_now)
                             cellvolt_rank=list(np.argsort(cellvolt_sort)+1) 
                             cellmin_num=list(cellvolt_now).index(cellvolt_min)+1

+ 4 - 4
LIB/MIDDLE/CellStateEstimation/BatSafetyWarning/V1_0_1/CBMSSafetyWarning.py

@@ -45,7 +45,7 @@ class SafetyWarning:
             df_short1.reset_index(drop=True,inplace=True)
             self.df_short=self.df_short.drop(self.df_short[self.df_short['method']==4].index)
             self.df_short.reset_index(drop=True,inplace=True)
-            short_name=['cellshort'+str(i) for i in range(1,self.CellVoltNums+1)]
+            short_name=['cellshort'+str(i) for i in range(1,self.param.CellVoltNums+1)]
             df_short_current=pd.DataFrame(columns=short_name)
             self.df_short['cellshort_sigma']=0
             for i in range(len(self.df_short)):
@@ -60,7 +60,7 @@ class SafetyWarning:
         self.df_uniform=self.df_uniform.drop(self.df_uniform[self.df_uniform['cellvolt_rank']=='0'].index)
         self.df_uniform.reset_index(inplace=True,drop=True)
         if not self.df_uniform.empty:
-            rank_name=['cellvolt_rank'+str(i) for i in range(1,self.CellVoltNums+1)]
+            rank_name=['cellvolt_rank'+str(i) for i in range(1,self.param.CellVoltNums+1)]
             df_rank=pd.DataFrame(columns=rank_name)
             for i in range(len(self.df_uniform)):
                 df_rank.loc[i]=eval(self.df_uniform.loc[i,'cellvolt_rank'])
@@ -68,7 +68,7 @@ class SafetyWarning:
     
         if len(df_short)>1.5:     #超过2行
             #出现两次漏电流<阈值...........................................................................
-            for i in range(self.CellVoltNums):
+            for i in range(self.param.CellVoltNums):
                 cellshort=df_short['cellshort'+str(i+1)]
                 index_list=cellshort[cellshort<self.param.LeakCurrentLv2].index
                 if len(index_list)>1:   
@@ -92,7 +92,7 @@ class SafetyWarning:
                 cellshort_num=cellshort_sum.index(min(cellshort_sum))+1
                 cellshort=df_short_current['cellshort'+str(cellshort_num)]   #获取内短路电芯的所有漏电流值,且最小值<阈值
                 cellshort_sum.remove(min(cellshort_sum))    #删除最小值,并判断其他所有电芯内短路电流>阈值
-                if min(cellshort)<self.df_adjust_param.loc[24,'threshold'] and min(cellshort_sum)>self.df_adjust_param.loc[24,'threshold']:
+                if min(cellshort)<self.param.LeakCurrentLv2 and min(cellshort_sum)>self.param.LeakCurrentLv2:
                     cellshortfault=1
                 else:
                     cellshortfault=0