فهرست منبع

解决预警uniform空值报错问题

qingfeng 3 سال پیش
والد
کامیت
a7a8a4f4ab

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

@@ -13,7 +13,7 @@ class SafetyWarning:
         self.param=BatParam.BatParam(celltype)
         self.df_short=df_short
         self.df_liplated=df_liplated
-        self.df_uniform=df_uniform
+        self.df_uniform=df_uniform.dropna(axis=0,how='any')
         self.OutLineVol_Rate=OutLineVol_Rate
     
     def diag(self):

+ 3 - 6
LIB/MIDDLE/CellStateEstimation/BatSafetyWarning/main.py

@@ -2,7 +2,7 @@ import pandas as pd
 import pymysql
 from LIB.BACKEND import DBManager, Log
 from apscheduler.schedulers.blocking import BlockingScheduler
-import time, datetime
+import datetime
 from LIB.MIDDLE.CellStateEstimation.Common.V1_0_1 import DBDownload
 from LIB.MIDDLE.CellStateEstimation.Common.V1_0_1 import log
 import CBMSBatInterShort
@@ -163,12 +163,9 @@ def saftywarning_cal():
         with DBRead as DBRead:
             df_short=DBRead.getdata('time_sp,sn,short_current', tablename=tablename1, sn=sn, timename='time_sp', st=start_time1, sp=end_time)
             df_liplated=DBRead.getdata('time,sn,liplated,liplated_amount', tablename=tablename2, sn=sn, timename='time', st=start_time2, sp=end_time)
-            # df_uniform=DBRead.getdata('time,sn,cellsoc_diff,cellvolt_diff,cellmin_num,cellmax_num,'cellvolt_rank', tablename=tablename3, sn=sn, timename='time', st=start_time1, sp=end_time)
-            # df_voltsigma=DBRead.getdata('time,sn,VolOl_Uni,VolChng_Uni', tablename=tablename4, sn=sn, timename='time', st=start_time3, sp=end_time)
+            df_uniform=DBRead.getdata('time,sn,cellsoc_diff,cellvolt_diff,cellmin_num,cellmax_num,cellvolt_rank', tablename=tablename3, sn=sn, timename='time', st=start_time3, sp=end_time)
+            df_voltsigma=DBRead.getdata('time,sn,VolOl_Uni,VolChng_Uni', tablename=tablename4, sn=sn, timename='time', st=start_time3, sp=end_time)
 
-            
-            
-        
         #获取sn的故障RAM
         df_fault_ram_sn=df_fault_ram[df_fault_ram['product_id']==sn]
         

+ 4 - 4
LIB/MIDDLE/SaftyCenter/DataDiag_Static/CBMSBatDiag.py

@@ -273,9 +273,9 @@ class BatDiag:
             
             #电流过流诊断.......................................................................................................................
             step=(self.bmstime[i]-self.bmstime[i-1]).total_seconds()
-            if step<120 and self.packcrnt[i]>self.param.PackDisOc:
+            if step<120 and self.packcrnt[i]>self.param.PackDisOc and self.packcrnt[i-1]>self.param.PackDisOc:
                 as_dis=as_dis+(self.packcrnt[i]-self.param.PackDisOc)*step    #ah累计
-            elif step<120 and self.packcrnt[i]<self.param.PackChgOc:
+            elif step<120 and self.packcrnt[i]<self.param.PackChgOc and self.packcrnt[i-1]<self.param.PackChgOc:
                 as_chg=as_chg+(self.param.PackDisOc-self.packcrnt[i])*step    #ah累计
             else:
                 as_dis=0
@@ -292,7 +292,7 @@ class BatDiag:
                 else:
                     pass
             else:
-                if self.packcrnt[i-1]<self.param.PackDisOc-10 and self.packcrnt[i]<self.param.PackDisOc-10:
+                if self.packcrnt[i]<self.param.PackDisOc-10:
                     time=self.bmstime[i]
                     self.df_diag_ram.loc[self.df_diag_ram[self.df_diag_ram['code']==22].index, 'end_time'] = time
                 else:
@@ -309,7 +309,7 @@ class BatDiag:
                 else:
                     pass
             else:
-                if self.packcrnt[i-1]>self.param.PackChgOc+10 and self.packcrnt[i]>self.param.PackChgOc+10:
+                if self.packcrnt[i]>self.param.PackChgOc+10:
                     time=self.bmstime[i]
                     self.df_diag_ram.loc[self.df_diag_ram[self.df_diag_ram['code']==22].index, 'end_time'] = time
                 else: