Kaynağa Gözat

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

shangguanlie23 2 yıl önce
ebeveyn
işleme
b93cc08aba

+ 211 - 158
LIB/MIDDLE/CellStateEstimation/BatSafetyWarning/V1_0_1/CBMSBatInterShort.py

@@ -1,6 +1,7 @@
 import pandas as pd
 import numpy as np
 import matplotlib.pyplot as plt
+import datetime
 # from pymysql import paramstyle
 from LIB.MIDDLE.CellStateEstimation.Common.V1_0_1 import BatParam
 
@@ -16,12 +17,13 @@ class BatInterShort():
         self.sn=sn
         self.celltype=celltype
         self.param=BatParam.BatParam(celltype)
-        self.df_bms=df_bms
         self.packcrnt=df_bms['总电流[A]']*self.param.PackCrntDec
         self.packvolt=df_bms['总电压[V]']
         self.bms_soc=df_bms['SOC[%]']
-        self.bmstime= pd.to_datetime(df_bms['时间戳'], format='%Y-%m-%d %H:%M:%S')
+        df_bms['time']=pd.to_datetime(df_bms['时间戳'], format='%Y-%m-%d %H:%M:%S')
+        self.bmstime= df_bms['time']
 
+        self.df_bms=df_bms
         self.df_soh=df_soh
         self.df_last=df_last
         self.df_last1=df_last1
@@ -49,12 +51,12 @@ class BatInterShort():
     #寻找当前行数据的最小温度值.............................................................................
     def _celltemp_weight(self,num):   
         celltemp = list(self.df_bms.loc[num,self.celltemp_name])
-        celltemp=np.mean(celltemp)
+        celltemp=min(celltemp)
         self.celltemp=celltemp
         if self.celltype==99:
             if celltemp>=25:
                 self.tempweight=1
-                self.StandardStandingTime=3600
+                self.StandardStandingTime=4800
             elif celltemp>=15:
                 self.tempweight=0.6
                 self.StandardStandingTime=7200
@@ -65,12 +67,12 @@ class BatInterShort():
                 self.tempweight=0.1
                 self.StandardStandingTime=10800
         else:
-            if celltemp>=20:
+            if celltemp>=25:
                 self.tempweight=1
-                self.StandardStandingTime=3600
-            elif celltemp>=10:
+                self.StandardStandingTime=4800
+            elif celltemp>=15:
                 self.tempweight=0.8
-                self.StandardStandingTime=3600
+                self.StandardStandingTime=7200
             elif celltemp>=5:
                 self.tempweight=0.6
                 self.StandardStandingTime=7200
@@ -78,8 +80,29 @@ class BatInterShort():
                 self.tempweight=0.2
                 self.StandardStandingTime=10800
 
+    #获取前半个小时每个电压的平均值........................................................................................
+    def _avgvolt_get(self,num): 
+        time_now=self.df_bms.loc[num, 'time']
+        time_last=time_now-datetime.timedelta(seconds=1800)
+        df_volt=self.df_bms[(self.df_bms['time']>=time_last) & (self.df_bms['time']<=time_now)]
+        df_volt=df_volt[self.cellvolt_name]
+        cellvolt_std=df_volt.std(axis=0)
+        if len(df_volt)>2 and max(cellvolt_std)<1.5:
+            cellvolt_sum=df_volt.sum(0)-df_volt.max(0)-df_volt.min(0)
+            cellvolt_mean=cellvolt_sum/(len(df_volt)-2)
+            cellvolt=cellvolt_mean/1000
+        elif len(df_volt)==2:
+            # df_volt=pd.DataFrame(df_volt,dtype=np.float)
+            if max(abs(df_volt.iloc[1]-df_volt.iloc[0]))<3:
+                cellvolt=df_volt.mean(0)/1000
+            else:
+                cellvolt=pd.DataFrame()
+        else:
+            cellvolt=pd.DataFrame()
+        return cellvolt
+
     #获取当前行所有电压数据........................................................................................
-    def _cellvolt_get(self,num): 
+    def _cellvolt_get(self,num):
         cellvolt = np.array(self.df_bms.loc[num,self.cellvolt_name])/1000
         return cellvolt
 
@@ -109,6 +132,20 @@ class BatInterShort():
                 else:
                     celldeltsoc.append(cellsoc[j]-cellsocmean2)
             return np.array(celldeltsoc), np.array(cellsoc)
+        
+        elif self.celltype==99:
+            consum_num=10
+            cellsoc1=cellsoc[:self.param.CellVoltNums-consum_num]    #切片,将bms耗电的电芯和非耗电的电芯分离开
+            cellsocmean1=(sum(cellsoc1)-max(cellsoc1)-min(cellsoc1))/(len(cellsoc1)-2)
+            cellsoc2=cellsoc[self.param.CellVoltNums-consum_num:]
+            cellsocmean2=(sum(cellsoc2)-max(cellsoc2)-min(cellsoc2))/(len(cellsoc2)-2)
+            
+            for j in range(len(cellsoc)):   #计算每个电芯的soc差
+                if j<self.param.CellVoltNums-consum_num:
+                    celldeltsoc.append(cellsoc[j]-cellsocmean1)
+                else:
+                    celldeltsoc.append(cellsoc[j]-cellsocmean2)
+            return np.array(celldeltsoc), np.array(cellsoc)
 
         else:
             cellsocmean=(sum(cellsoc)-max(cellsoc)-min(cellsoc))/(len(cellsoc)-2)
@@ -277,48 +314,54 @@ class BatInterShort():
                 if firsttime==1:    
                     if standingtime>self.StandardStandingTime*2:      #静置时间满足要求
                         standingtime=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_min<4.5 and 2<cellvolt_max<4.5 and deltvolt<0.005: 
-                            dict_baltime={}   #获取每个电芯的均衡时间
-                            deltsoc_last, cellsoc_last=self._celldeltsoc_get(i,dict_baltime,capacity)
-                            time_last=self.bmstime[i]
-                            firsttime=0
-                            df_ram_last.loc[0]=[self.sn,time_last,deltsoc_last,cellsoc_last]   #更新RAM信息
+                        cellvolt_now=self._avgvolt_get(i)
+                        if not cellvolt_now.empty:
+                            cellvolt_min=min(cellvolt_now)
+                            cellvolt_max=max(cellvolt_now)
+                            # cellvolt_last=self._avgvolt_get(i-1)
+                            # deltvolt=max(abs(cellvolt_now-cellvolt_last))
+                            cellsoc_max=np.interp(cellvolt_max,self.param.LookTab_OCV,self.param.LookTab_SOC)
+                            cellsoc_min=np.interp(cellvolt_min,self.param.LookTab_OCV,self.param.LookTab_SOC)
+
+                            if 2<cellvolt_min<4.5 and 2<cellvolt_max<4.5 and (45<cellsoc_max or cellsoc_max<30) and (45<cellsoc_min or cellsoc_min<30): 
+                                dict_baltime={}   #获取每个电芯的均衡时间
+                                deltsoc_last, cellsoc_last=self._celldeltsoc_get(i,dict_baltime,capacity)
+                                time_last=self.bmstime[i]
+                                firsttime=0
+                                df_ram_last.loc[0]=[self.sn,time_last,deltsoc_last,cellsoc_last]   #更新RAM信息
                     else:
                         pass                
-                elif standingtime>3600*10:
+                elif standingtime>3600*12:
                     standingtime=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_min<4.5 and 2<cellvolt_max<4.5 and deltvolt<0.005:
-                        dict_baltime=self._bal_time(dict_bal)   #获取每个电芯的均衡时间
-                        deltsoc_now, cellsoc_now=self._celldeltsoc_get(i,dict_baltime,capacity)
-                        time_now=self.bmstime[i]
-                        if -5<max(cellsoc_now-cellsoc_last)<5:
-                            df_ram_last.loc[0]=[self.sn,time_now,deltsoc_now,cellsoc_now] #更新RAM信息
-                            
-                            list_sub=deltsoc_now-deltsoc_last
-                            list_pud=(0.01*capacity*3600*1000)/(time_now-time_last).total_seconds()
-                            leak_current=list_sub*list_pud
-                            # leak_current=np.array(leak_current)
-                            leak_current=np.round(leak_current,3)
-                            leak_current=list(leak_current)
-                            
-                            df_res.loc[len(df_res)]=[time_last,time_now,self.sn,1,str(leak_current),str(dict_baltime)]  #计算结果存入Dataframe
-                            time_last=time_now  #更新时间
-                            deltsoc_last=deltsoc_now    #更新soc差
-                            dict_bal={}
-                        else:
-                            firsttime=1
+                    cellvolt_now=self._avgvolt_get(i)
+                    if not cellvolt_now.empty:
+                        cellvolt_min=min(cellvolt_now)
+                        cellvolt_max=max(cellvolt_now)
+                        # cellvolt_last=self._avgvolt_get(i-1)
+                        # deltvolt=max(abs(cellvolt_now-cellvolt_last))
+                        cellsoc_max=np.interp(cellvolt_max,self.param.LookTab_OCV,self.param.LookTab_SOC)
+                        cellsoc_min=np.interp(cellvolt_min,self.param.LookTab_OCV,self.param.LookTab_SOC)
+                        
+                        if 2<cellvolt_min<4.5 and 2<cellvolt_max<4.5 and (45<cellsoc_max or cellsoc_max<30) and (45<cellsoc_min or cellsoc_min<30):
+                            dict_baltime=self._bal_time(dict_bal)   #获取每个电芯的均衡时间
+                            deltsoc_now, cellsoc_now=self._celldeltsoc_get(i,dict_baltime,capacity)
+                            time_now=self.bmstime[i]
+                            if -5<max(cellsoc_now-cellsoc_last)<5:
+                                df_ram_last.loc[0]=[self.sn,time_now,deltsoc_now,cellsoc_now] #更新RAM信息
+                                
+                                list_sub=deltsoc_now-deltsoc_last
+                                list_pud=(0.01*capacity*3600*1000)/(time_now-time_last).total_seconds()
+                                leak_current=list_sub*list_pud
+                                # leak_current=np.array(leak_current)
+                                leak_current=np.round(leak_current,3)
+                                leak_current=list(leak_current)
+                                
+                                df_res.loc[len(df_res)]=[time_last,time_now,self.sn,1,str(leak_current),str(dict_baltime)]  #计算结果存入Dataframe
+                                time_last=time_now  #更新时间
+                                deltsoc_last=deltsoc_now    #更新soc差
+                                dict_bal={}
+                            else:
+                                firsttime=1
                 else: 
                     try:  
                         balstat=int(self.df_bms.loc[i,'单体均衡状态'])
@@ -337,40 +380,41 @@ class BatInterShort():
                 #满电静置法计算内短路-开始.....................................................................................................................................................
                 if self.StandardStandingTime<standingtime1:  
                     standingtime1=0
-                    cellvolt_now1=self._cellvolt_get(i)
-                    cellvolt_max1=max(cellvolt_now1)
-                    cellvolt_min1=min(cellvolt_now1)
-                    cellvolt_last1=self._cellvolt_get(i-1)
-                    deltvolt1=max(abs(cellvolt_now1-cellvolt_last1))
-                    cellsoc_now1=np.interp(cellvolt_max1,self.param.LookTab_OCV,self.param.LookTab_SOC)
-
-                    if cellsoc_now1>=self.param.FullChrgSoc-10 and 2<cellvolt_min1<4.5 and 2<cellvolt_max1<4.5 and deltvolt1<0.005:
-                        if firsttime1==1:
-                            dict_baltime1={}   #获取每个电芯的均衡时间
-                            deltsoc_last1, cellsoc_last1=self._celldeltsoc_get(i,dict_baltime1,capacity)
-                            time_last1=self.bmstime[i]
-                            firsttime1=0
-                            df_ram_last1.loc[0]=[self.sn,time_last1,deltsoc_last1]    #更新RAM信息
-                        else:
-                            dict_baltime1=self._bal_time(dict_bal1)   #获取每个电芯的均衡时间
-                            time_now1=self.bmstime[i]
-                            if (time_now1-time_last1).total_seconds()>3600*12:
-                                deltsoc_now1, cellsoc_now1=self._celldeltsoc_get(i,dict_baltime1,capacity)
-                                df_ram_last1.loc[0]=[self.sn,time_now1,deltsoc_now1] #更新RAM信息
-
-                                list_sub1=deltsoc_now1-deltsoc_last1
-                                list_pud1=(0.01*capacity*3600*1000)/(time_now1-time_last1).total_seconds()
-                                leak_current1=list_sub1*list_pud1
-                                # leak_current1=np.array(leak_current1)
-                                leak_current1=np.round(leak_current1,3)
-                                leak_current1=list(leak_current1)
-                                
-                                df_res.loc[len(df_res)]=[time_last1,time_now1,self.sn,2,str(leak_current1),str(dict_baltime1)]  #计算结果存入Dataframe
-                                time_last1=time_now1  #更新时间
-                                deltsoc_last1=deltsoc_now1    #更新soc差
-                                dict_bal1={}
+                    cellvolt_now1=self._avgvolt_get(i)
+                    if not cellvolt_now1.empty:
+                        cellvolt_max1=max(cellvolt_now1)
+                        cellvolt_min1=min(cellvolt_now1)
+                        # cellvolt_last1=self._avgvolt_get(i-1)
+                        # deltvolt1=max(abs(cellvolt_now1-cellvolt_last1))
+                        cellsoc_now1=np.interp(cellvolt_max1,self.param.LookTab_OCV,self.param.LookTab_SOC)
+
+                        if cellsoc_now1>=self.param.FullChrgSoc-10 and 2<cellvolt_min1<4.5 and 2<cellvolt_max1<4.5:
+                            if firsttime1==1:
+                                dict_baltime1={}   #获取每个电芯的均衡时间
+                                deltsoc_last1, cellsoc_last1=self._celldeltsoc_get(i,dict_baltime1,capacity)
+                                time_last1=self.bmstime[i]
+                                firsttime1=0
+                                df_ram_last1.loc[0]=[self.sn,time_last1,deltsoc_last1]    #更新RAM信息
                             else:
-                                pass
+                                dict_baltime1=self._bal_time(dict_bal1)   #获取每个电芯的均衡时间
+                                time_now1=self.bmstime[i]
+                                if (time_now1-time_last1).total_seconds()>3600*20:
+                                    deltsoc_now1, cellsoc_now1=self._celldeltsoc_get(i,dict_baltime1,capacity)
+                                    df_ram_last1.loc[0]=[self.sn,time_now1,deltsoc_now1] #更新RAM信息
+
+                                    list_sub1=deltsoc_now1-deltsoc_last1
+                                    list_pud1=(0.01*capacity*3600*1000)/(time_now1-time_last1).total_seconds()
+                                    leak_current1=list_sub1*list_pud1
+                                    # leak_current1=np.array(leak_current1)
+                                    leak_current1=np.round(leak_current1,3)
+                                    leak_current1=list(leak_current1)
+                                    
+                                    df_res.loc[len(df_res)]=[time_last1,time_now1,self.sn,2,str(leak_current1),str(dict_baltime1)]  #计算结果存入Dataframe
+                                    time_last1=time_now1  #更新时间
+                                    deltsoc_last1=deltsoc_now1    #更新soc差
+                                    dict_bal1={}
+                                else:
+                                    pass
                     else:
                         pass
                 else:   
@@ -483,52 +527,58 @@ class BatInterShort():
                 if firsttime==1:    
                     if standingtime>self.StandardStandingTime:      #静置时间满足要求
                         standingtime=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 abs(deltvolt)<0.003:
-                            dict_baltime={}  #获取每个电芯的均衡时间
-                            deltsoc_last, cellsoc_last=self._celldeltsoc_get(i,dict_baltime,capacity)
-                            time_last=self.bmstime[i]
-                            firsttime=0
-                            df_ram_last.loc[0]=[self.sn,time_last,deltsoc_last,cellsoc_last]   #更新RAM信息
-                        else:
-                            pass
+                        cellvolt_now=self._avgvolt_get(i)
+                        if not cellvolt_now.empty:
+                            cellvolt_min=min(cellvolt_now)
+                            cellvolt_max=max(cellvolt_now)
+                            # cellvolt_last=self._avgvolt_get(i-1)
+                            # deltvolt=max(abs(cellvolt_now-cellvolt_last))
+                            cellsoc_max=np.interp(cellvolt_max,self.param.LookTab_OCV,self.param.LookTab_SOC)
+                            cellsoc_min=np.interp(cellvolt_min,self.param.LookTab_OCV,self.param.LookTab_SOC)
+
+                            if cellsoc_max<self.param.SocInflexion1-2 and 12<cellsoc_min:
+                                dict_baltime={}  #获取每个电芯的均衡时间
+                                deltsoc_last, cellsoc_last=self._celldeltsoc_get(i,dict_baltime,capacity)
+                                time_last=self.bmstime[i]
+                                firsttime=0
+                                df_ram_last.loc[0]=[self.sn,time_last,deltsoc_last,cellsoc_last]   #更新RAM信息
+                            else:
+                                pass
                     else:
                         pass                
-                elif standingtime>3600*10:
+                elif standingtime>3600*12:
                     standingtime=0
-                    cellvolt_now=np.array(self._cellvolt_get(i))
-                    cellvolt_min=min(cellvolt_now)
-                    cellvolt_max=max(cellvolt_now)
-                    cellvolt_last=np.array(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 abs(deltvolt)<0.003:
-                        dict_baltime=self._bal_time(dict_bal)   #获取每个电芯的均衡时间
-                        deltsoc_now, cellsoc_now=self._celldeltsoc_get(i, dict_baltime,capacity)    #获取每个电芯的SOC差
-                        time_now=self.bmstime[i]
-                        if -5<max(cellsoc_now-cellsoc_last)<5:
-                            df_ram_last.loc[0]=[self.sn,time_now,deltsoc_now,cellsoc_now]   #更新RAM信息
-
-                            list_sub=deltsoc_now-deltsoc_last
-                            list_pud=(0.01*capacity*3600*1000)/(time_now-time_last).total_seconds()
-                            leak_current=list_sub*list_pud
-                            # leak_current=np.array(leak_current)
-                            leak_current=np.round(leak_current,3)
-                            leak_current=list(leak_current)
-                            
-                            df_res.loc[len(df_res)]=[time_last,time_now,self.sn,1,str(leak_current),str(dict_baltime)]  #计算结果存入Dataframe
-                            time_last=time_now  #更新时间
-                            deltsoc_last=deltsoc_now    #更新soc差
-                            dict_bal={}
+                    cellvolt_now=np.array(self._avgvolt_get(i))
+                    if not cellvolt_now.empty:
+                        cellvolt_min=min(cellvolt_now)
+                        cellvolt_max=max(cellvolt_now)
+                        # cellvolt_last=np.array(self._avgvolt_get(i-1))
+                        # deltvolt=max(abs(cellvolt_now-cellvolt_last))
+                        cellsoc_max=np.interp(cellvolt_max,self.param.LookTab_OCV,self.param.LookTab_SOC)
+                        cellsoc_min=np.interp(cellvolt_min,self.param.LookTab_OCV,self.param.LookTab_SOC)
+
+                        if cellsoc_max<self.param.SocInflexion1-2 and 12<cellsoc_min:
+                            dict_baltime=self._bal_time(dict_bal)   #获取每个电芯的均衡时间
+                            deltsoc_now, cellsoc_now=self._celldeltsoc_get(i, dict_baltime,capacity)    #获取每个电芯的SOC差
+                            time_now=self.bmstime[i]
+                            if -5<max(cellsoc_now-cellsoc_last)<5:
+                                df_ram_last.loc[0]=[self.sn,time_now,deltsoc_now,cellsoc_now]   #更新RAM信息
+
+                                list_sub=deltsoc_now-deltsoc_last
+                                list_pud=(0.01*capacity*3600*1000)/(time_now-time_last).total_seconds()
+                                leak_current=list_sub*list_pud
+                                # leak_current=np.array(leak_current)
+                                leak_current=np.round(leak_current,3)
+                                leak_current=list(leak_current)
+                                
+                                df_res.loc[len(df_res)]=[time_last,time_now,self.sn,1,str(leak_current),str(dict_baltime)]  #计算结果存入Dataframe
+                                time_last=time_now  #更新时间
+                                deltsoc_last=deltsoc_now    #更新soc差
+                                dict_bal={}
+                            else:
+                                firsttime=1
                         else:
-                            firsttime=1
-                    else:
-                        pass
+                            pass
                 else: 
                     try:  
                         balstat=int(self.df_bms.loc[i,'单体均衡状态'])
@@ -547,41 +597,44 @@ class BatInterShort():
                 #非平台区间静置法计算内短路-开始.....................................................................................................................................................
                 if standingtime1>self.StandardStandingTime: 
                     standingtime1=0
-                    cellvolt_now1=self._cellvolt_get(i)
-                    cellvolt_max1=max(cellvolt_now1)
-                    cellvolt_min1=min(cellvolt_now1)
-                    cellvolt_last1=self._cellvolt_get(i-1)
-                    deltvolt1=max(abs(cellvolt_now1-cellvolt_last1))
-                
-                    if 2<cellvolt_max1<self.param.OcvInflexionBelow-0.002 and 2<cellvolt_min1<4.5 and deltvolt1<0.005:
-                        if firsttime1==1:
-                            dict_baltime1=self._bal_time(dict_bal1)   #获取每个电芯的均衡时间
-                            deltsoc_last1, cellsoc_last1=self._celldeltsoc_get(i,dict_baltime1,capacity)
-                            time_last1=self.bmstime[i]
-                            firsttime1=0
-                            df_ram_last1.loc[0]=[self.sn,time_last1,deltsoc_last1]    #更新RAM信息
-                        else:
-                            dict_baltime1=self._bal_time(dict_bal1)   #获取每个电芯的均衡时间
-                            deltsoc_now1, cellsoc_now1=self._celldeltsoc_get(i,dict_baltime1,capacity)
-                            time_now1=self.bmstime[i]
-                            df_ram_last1.loc[0]=[self.sn,time_now1,deltsoc_now1]    #更新RAM信息
-
-                            if (time_now1-time_last1).total_seconds()>3600*24:
-                                list_sub1=deltsoc_now1-deltsoc_last1
-                                list_pud1=(0.01*capacity*3600*1000)/(time_now1-time_last1).total_seconds()
-                                leak_current1=list_sub1*list_pud1
-                                # leak_current1=np.array(leak_current1)
-                                leak_current1=np.round(leak_current1,3)
-                                leak_current1=list(leak_current1)
-                                
-                                df_res.loc[len(df_res)]=[time_last1,time_now1,self.sn,2,str(leak_current1),str(dict_baltime1)]  #计算结果存入Dataframe
-                                time_last1=time_now1  #更新时间
-                                deltsoc_last1=deltsoc_now1    #更新soc差
-                                dict_bal1={}
+                    cellvolt_now1=self._avgvolt_get(i)
+                    if not cellvolt_now1.empty:
+                        cellvolt_max1=max(cellvolt_now1)
+                        cellvolt_min1=min(cellvolt_now1)
+                        # cellvolt_last1=self._avgvolt_get(i-1)
+                        # deltvolt1=max(abs(cellvolt_now1-cellvolt_last1))
+                        cellsoc_max1=np.interp(cellvolt_max1,self.param.LookTab_OCV,self.param.LookTab_SOC)
+                        cellsoc_min1=np.interp(cellvolt_min1,self.param.LookTab_OCV,self.param.LookTab_SOC)
+                    
+                        if cellsoc_max1<self.param.SocInflexion1-2 and 12<cellsoc_min1:
+                            if firsttime1==1:
+                                dict_baltime1=self._bal_time(dict_bal1)   #获取每个电芯的均衡时间
+                                deltsoc_last1, cellsoc_last1=self._celldeltsoc_get(i,dict_baltime1,capacity)
+                                time_last1=self.bmstime[i]
+                                firsttime1=0
+                                df_ram_last1.loc[0]=[self.sn,time_last1,deltsoc_last1]    #更新RAM信息
                             else:
-                                pass
-                    else:
-                        pass
+                                dict_baltime1=self._bal_time(dict_bal1)   #获取每个电芯的均衡时间
+                                deltsoc_now1, cellsoc_now1=self._celldeltsoc_get(i,dict_baltime1,capacity)
+                                time_now1=self.bmstime[i]
+                                df_ram_last1.loc[0]=[self.sn,time_now1,deltsoc_now1]    #更新RAM信息
+
+                                if (time_now1-time_last1).total_seconds()>3600*24:
+                                    list_sub1=deltsoc_now1-deltsoc_last1
+                                    list_pud1=(0.01*capacity*3600*1000)/(time_now1-time_last1).total_seconds()
+                                    leak_current1=list_sub1*list_pud1
+                                    # leak_current1=np.array(leak_current1)
+                                    leak_current1=np.round(leak_current1,3)
+                                    leak_current1=list(leak_current1)
+                                    
+                                    df_res.loc[len(df_res)]=[time_last1,time_now1,self.sn,2,str(leak_current1),str(dict_baltime1)]  #计算结果存入Dataframe
+                                    time_last1=time_now1  #更新时间
+                                    deltsoc_last1=deltsoc_now1    #更新soc差
+                                    dict_bal1={}
+                                else:
+                                    pass
+                        else:
+                            pass
                 else:   
                     pass
 
@@ -628,7 +681,7 @@ class BatInterShort():
                         continue
                     elif min(cellvolt_now)>self.param.CellFullChrgVolt-0.13:   #电压>满充电压-0.13V,即3.37V
                         self._celltemp_weight(i)
-                        if i-chrg_start>10 and self.celltemp>15:
+                        if i-chrg_start>10 and self.celltemp>20:
                             chrg_end=i+1
                             charging=0
 

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

@@ -325,19 +325,19 @@ class BatUniform():
                             cellsoc_diff=eval(format(cellsoc_diff,'.1f'))
                             cellvolt_diff=eval(format(cellvolt_diff,'.0f'))
                             df_res.loc[len(df_res)]=[self.bmstime[i], self.sn, cellsoc_diff, cellvolt_diff, cellmin_num, cellmax_num, str(cellvolt_rank)]
-                        elif 2<cellvolt_max<4.5 and 2<cellvolt_min<4.5 and deltvolt<0.005: 
-                            cellvolt_sort=np.argsort(cellvolt_now)
-                            cellvolt_rank=list(np.argsort(cellvolt_sort)+1)
-                            if not df_res.empty:
-                                df_res.loc[len(df_res)]=df_res.loc[len(df_res)-1]
-                                df_res.loc[len(df_res)-1,'cellvolt_rank']=str(cellvolt_rank)
-                                df_res.loc[len(df_res)-1,'time']=self.bmstime[i]
-                            elif not self.df_uniform.empty:
-                                df_res.loc[len(df_res)]=self.df_uniform.iloc[-1]
-                                df_res.loc[len(df_res)-1,'cellvolt_rank']=str(cellvolt_rank)
-                                df_res.loc[len(df_res)-1,'time']=self.bmstime[i]
-                            else:
-                                pass
+                        # elif 2<cellvolt_max<4.5 and 2<cellvolt_min<4.5 and deltvolt<0.005: 
+                        #     cellvolt_sort=np.argsort(cellvolt_now)
+                        #     cellvolt_rank=list(np.argsort(cellvolt_sort)+1)
+                        #     if not df_res.empty:
+                        #         df_res.loc[len(df_res)]=df_res.loc[len(df_res)-1]
+                        #         df_res.loc[len(df_res)-1,'cellvolt_rank']=str(cellvolt_rank)
+                        #         df_res.loc[len(df_res)-1,'time']=self.bmstime[i]
+                        #     elif not self.df_uniform.empty:
+                        #         df_res.loc[len(df_res)]=self.df_uniform.iloc[-1]
+                        #         df_res.loc[len(df_res)-1,'cellvolt_rank']=str(cellvolt_rank)
+                        #         df_res.loc[len(df_res)-1,'time']=self.bmstime[i]
+                        #     else:
+                        #         pass
                     elif standingtime2>3600*6:
                         standingtime2=0
                         cellvolt_now=self._cellvolt_get(i)
@@ -358,19 +358,19 @@ class BatUniform():
                             cellsoc_diff=eval(format(cellsoc_diff,'.1f'))
                             cellvolt_diff=eval(format(cellvolt_diff,'.0f'))
                             df_res.loc[len(df_res)]=[self.bmstime[i], self.sn, cellsoc_diff, cellvolt_diff, cellmin_num, cellmax_num, str(cellvolt_rank)]
-                        elif 2<cellvolt_max<4.5 and 2<cellvolt_min<4.5 and deltvolt<0.005: 
-                            cellvolt_sort=np.argsort(cellvolt_now)
-                            cellvolt_rank=list(np.argsort(cellvolt_sort)+1)
-                            if not df_res.empty:
-                                df_res.loc[len(df_res)]=df_res.loc[len(df_res)-1]
-                                df_res.loc[len(df_res)-1,'cellvolt_rank']=str(cellvolt_rank)
-                                df_res.loc[len(df_res)-1,'time']=self.bmstime[i]
-                            elif not self.df_uniform.empty:
-                                df_res.loc[len(df_res)]=self.df_uniform.iloc[-1]
-                                df_res.loc[len(df_res)-1,'cellvolt_rank']=str(cellvolt_rank)
-                                df_res.loc[len(df_res)-1,'time']=self.bmstime[i]
-                            else:
-                                pass
+                        # elif 2<cellvolt_max<4.5 and 2<cellvolt_min<4.5 and deltvolt<0.005: 
+                        #     cellvolt_sort=np.argsort(cellvolt_now)
+                        #     cellvolt_rank=list(np.argsort(cellvolt_sort)+1)
+                        #     if not df_res.empty:
+                        #         df_res.loc[len(df_res)]=df_res.loc[len(df_res)-1]
+                        #         df_res.loc[len(df_res)-1,'cellvolt_rank']=str(cellvolt_rank)
+                        #         df_res.loc[len(df_res)-1,'time']=self.bmstime[i]
+                        #     elif not self.df_uniform.empty:
+                        #         df_res.loc[len(df_res)]=self.df_uniform.iloc[-1]
+                        #         df_res.loc[len(df_res)-1,'cellvolt_rank']=str(cellvolt_rank)
+                        #         df_res.loc[len(df_res)-1,'time']=self.bmstime[i]
+                        #     else:
+                        #         pass
                     
                     elif i>=len(self.df_bms)-3:
                         standingtime2=0
@@ -391,19 +391,19 @@ class BatUniform():
                             cellsoc_diff=eval(format(cellsoc_diff,'.1f'))
                             cellvolt_diff=eval(format(cellvolt_diff,'.0f'))
                             df_res.loc[len(df_res)]=[self.bmstime[i], self.sn, cellsoc_diff, cellvolt_diff, cellmin_num, cellmax_num, str(cellvolt_rank)]
-                        elif 2<cellvolt_max<4.5 and 2<cellvolt_min<4.5 and deltvolt<0.005: 
-                            cellvolt_sort=np.argsort(cellvolt_now)
-                            cellvolt_rank=list(np.argsort(cellvolt_sort)+1)
-                            if not df_res.empty:
-                                df_res.loc[len(df_res)]=df_res.loc[len(df_res)-1]
-                                df_res.loc[len(df_res)-1,'cellvolt_rank']=str(cellvolt_rank)
-                                df_res.loc[len(df_res)-1,'time']=self.bmstime[i]
-                            elif not self.df_uniform.empty:
-                                df_res.loc[len(df_res)]=self.df_uniform.iloc[-1]
-                                df_res.loc[len(df_res)-1,'cellvolt_rank']=str(cellvolt_rank)
-                                df_res.loc[len(df_res)-1,'time']=self.bmstime[i]
-                            else:
-                                pass
+                        # elif 2<cellvolt_max<4.5 and 2<cellvolt_min<4.5 and deltvolt<0.005: 
+                        #     cellvolt_sort=np.argsort(cellvolt_now)
+                        #     cellvolt_rank=list(np.argsort(cellvolt_sort)+1)
+                        #     if not df_res.empty:
+                        #         df_res.loc[len(df_res)]=df_res.loc[len(df_res)-1]
+                        #         df_res.loc[len(df_res)-1,'cellvolt_rank']=str(cellvolt_rank)
+                        #         df_res.loc[len(df_res)-1,'time']=self.bmstime[i]
+                        #     elif not self.df_uniform.empty:
+                        #         df_res.loc[len(df_res)]=self.df_uniform.iloc[-1]
+                        #         df_res.loc[len(df_res)-1,'cellvolt_rank']=str(cellvolt_rank)
+                        #         df_res.loc[len(df_res)-1,'time']=self.bmstime[i]
+                        #     else:
+                        #         pass
                     else:
                         pass
                 else:
@@ -484,7 +484,7 @@ class BatUniform():
                         cellsoc_diff=peaksoc_max-peaksoc_min
                         cellsoc_diff=eval(format(cellsoc_diff,'.1f'))
                         if not df_res.empty:
-                            cellvolt_rank=df_res.loc[-1]['cellvolt_rank']
+                            cellvolt_rank=df_res.iloc[-1]['cellvolt_rank']
                             df_res.loc[len(df_res)]=[self.bmstime[chrg_start[i]], self.sn, cellsoc_diff, 0, peaksoc_minnum, peaksoc_maxnum, cellvolt_rank]
                         elif not self.df_uniform.empty:
                             cellvolt_rank=self.df_uniform.iloc[-1]['cellvolt_rank']

+ 79 - 59
LIB/MIDDLE/CellStateEstimation/BatSafetyWarning/V1_0_1/CBMSSafetyWarning.py

@@ -6,15 +6,15 @@ from matplotlib import pyplot as plt
 from LIB.MIDDLE.CellStateEstimation.Common.V1_0_1 import BatParam
 
 class SafetyWarning:
-    def __init__(self,sn,celltype,df_short,df_liplated,df_uniform,OutLineVol_Rate):  #参数初始化
+    def __init__(self,sn,celltype,df_short,df_uniform,OutLineVol_Rate,df_soh):  #参数初始化
 
         self.sn=sn
         self.celltype=celltype
         self.param=BatParam.BatParam(celltype)
         self.df_short=df_short
-        self.df_liplated=df_liplated
-        self.df_uniform=df_uniform.dropna(axis=0,how='any')
+        self.df_uniform=df_uniform
         self.OutLineVol_Rate=OutLineVol_Rate
+        self.df_soh=df_soh
     
     def diag(self):
         if self.celltype<=50:
@@ -34,10 +34,13 @@ class SafetyWarning:
         time_sp='0000-00-00 00:00:00'
 
         #参数初始化.......................................
-        shortfault=0
-        liplatedfault=0
+        voltsigmafault=0
         uniformfault=0
+        cellshortfault=0
         volt_rate=[]
+        R2_list=[]
+        voltsigmafault_list=[]
+        uniformfault_list=[]
 
         if not self.df_short.empty:
             short_current=self.df_short['short_current']
@@ -50,77 +53,84 @@ class SafetyWarning:
             self.OutLineVol_Rate['VolChng_Uni']=self.OutLineVol_Rate['VolChng_Uni'].str.replace("]","")
             self.OutLineVol_Rate['VolOl_Uni']=self.OutLineVol_Rate['VolOl_Uni'].str.replace("[","")
             self.OutLineVol_Rate['VolOl_Uni']=self.OutLineVol_Rate['VolOl_Uni'].str.replace("]","")
-            VoltChangeOutLine_Rate=self.OutLineVol_Rate['VolChng_Uni'].str.split(',',expand=True)
             Volt_3Sigma=self.OutLineVol_Rate['VolOl_Uni'].str.split(',',expand=True)
-            VoltChangeOutLine_Rate.columns=volt_column
             Volt_3Sigma.columns=volt_column
-            VoltChangeOutLine_Rate['time']=self.OutLineVol_Rate['time']
-            time0=time.mktime(VoltChangeOutLine_Rate.loc[0,'time'].timetuple())
-            for i in range(0,len(VoltChangeOutLine_Rate)):
-                VoltChangeOutLine_Rate.loc[i,'time']=(time.mktime(VoltChangeOutLine_Rate.loc[i,'time'].timetuple())-time0)/60000
-        
-        if not self.df_liplated.empty:
-            liplated=self.df_liplated['liplated_amount']
-            liplated=liplated.str.replace("[", '')
-            liplated=liplated.str.replace("]", '')
-        
+
+            #电压变化率
+            VoltChange=self.OutLineVol_Rate['VolChng_Uni'].str.split(',',expand=True)
+            VoltChange.columns=volt_column
+            VoltChange['time']=self.OutLineVol_Rate['time']
+            VoltChange = VoltChange.reset_index(drop=True)
+            xtime1=VoltChange['time']
+            time0=time.mktime(VoltChange.loc[0,'time'].timetuple())
+            for i in range(0,len(VoltChange)):
+                VoltChange.loc[i,'time']=(time.mktime(VoltChange.loc[i,'time'].timetuple())-time0)/36000
+            
+        #计算漏电流离群度
+        if not self.df_short.empty:
+            self.df_short['cellshort_sigma']=0
+            for i in range(len(self.df_short)):
+                cellshort=eval(self.df_short.loc[i,'short_current'])
+                cellshort_std=np.std(cellshort)
+                cellshort_mean=np.mean(cellshort)
+                self.df_short.loc[i,'cellshort_sigma']=str(list((cellshort-cellshort_mean)/cellshort_std))
+            
+    
         if not self.df_uniform.empty:
             cellvolt_rank=self.df_uniform['cellvolt_rank']
             cellvolt_rank=cellvolt_rank.str.replace("[", '')
             cellvolt_rank=cellvolt_rank.str.replace("]", '')
 
+        # plt.figure()
         for i in range(self.param.CellVoltNums):
-
             #漏电流故障判断...........................................................................
             if not self.df_short.empty:
                 self.df_short['cellshort'+str(i+1)]=short_current.map(lambda x:eval(x.split(',')[i]))
-
                 cellshort=self.df_short['cellshort'+str(i+1)]
                 index_list=cellshort[cellshort<self.param.LeakCurrentLv2].index
-                if len(index_list)==2 and (index_list[1]-index_list[0])==1:
-                    shortfault=1
-                elif len(index_list)>3:
-                    shortfault=1
+                if len(index_list)>1:
+                    for j in range(1,len(index_list)):
+                        if index_list[j]-index_list[j-1]==1:
+                            cellshort_sigma1=eval(self.df_short.loc[index_list[j],'cellshort_sigma'])
+                            cellshort_sigma2=eval(self.df_short.loc[index_list[j-1],'cellshort_sigma'])
+                            if cellshort_sigma1[i]<-3 or cellshort_sigma2[i]<-3:
+                                cellshortfault=1                       
+                        else:
+                            pass
                 else:
-                    shortfault=0
+                    pass
             
             #电压变化率及电压离群度.................................................................................
-            if not self.OutLineVol_Rate.empty and VoltChangeOutLine_Rate.iloc[-1]['time']*60000>24*3600 and len(VoltChangeOutLine_Rate)>10:
-                VoltChangeOutLine_Rate[volt_column[i]]=VoltChangeOutLine_Rate[volt_column[i]].map(lambda x:eval(x))
+            if not self.OutLineVol_Rate.empty and VoltChange.iloc[-1]['time']*36000>18*3600 and len(VoltChange)>5:
+
                 volt3sigma=np.array(Volt_3Sigma[volt_column[i]].map(lambda x:eval(x)))
                 volt3sigma_sum=np.sum(volt3sigma<-3)
-                a1,b1=np.polyfit(VoltChangeOutLine_Rate['time'].tolist(),VoltChangeOutLine_Rate[volt_column[i]].tolist(),1)
-                y=a1*VoltChangeOutLine_Rate['time']+b1
+                #电压变化率
+                VoltChange[volt_column[i]]=VoltChange[volt_column[i]].map(lambda x:eval(x))
+                y=VoltChange[volt_column[i]]
+                a1,b1=np.polyfit(VoltChange['time'].tolist(),y.tolist(),1)
+                y1=a1*VoltChange['time']+b1
+                y_mean=y.mean()
+                R2=1-(np.sum((y1-y)**2))/(np.sum((y-y_mean)**2))
+                R2_list.append(R2)
+                
                 volt_rate.append(a1)
-                # plt.plot(VoltChangeOutLine_Rate['time'],y,label=volt_column[i])
-                # plt.scatter( VoltChangeOutLine_Rate['time'],VoltChangeOutLine_Rate[volt_column[i]],marker='o')
+                # 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 a1<self.param.TrwVoltRate:
-                    voltratefault=1
-                else:
-                    voltratefault=0
-                if volt3sigma_sum>len(self.OutLineVol_Rate)/2:
+                if volt3sigma_sum>len(volt3sigma)/2:
                     voltsigmafault=1
                 else:
                     voltsigmafault=0
             else:
-                voltratefault=0
-                voltsigmafault=0
-            
-            #析锂故障判断...............................................................................
-            # if not self.df_liplated.empty:
-            #     self.df_liplated['liplated_amount'+str(i+1)]=liplated.map(lambda x:eval(x.split(',')[i]))
-
-            #     if max(self.df_liplated['liplated_amount'+str(i+1)])>30:
-            #         liplatedfault=1
-            #     else:
-            #         liplatedfault=0
-            # else:
-            #     liplatedfault=0
+                volt_rate.append(0)
+                R2_list.append(0)
+            voltsigmafault_list.append(voltsigmafault)
 
             #电芯SOC排名判断.............................................................................
             if not self.df_uniform.empty:
@@ -132,29 +142,39 @@ class SafetyWarning:
                     uniformfault=0
             else:
                 uniformfault=0
+            uniformfault_list.append(uniformfault)
             
-            #电池热安全预警...............................................................................
-            if (shortfault==1 or voltratefault==1)and (voltsigmafault==1 or uniformfault==1):
+            #漏电流热失控预警确认........................................................
+            if cellshortfault==1:
                 faultcode=110
                 faultlv=4
                 faultinfo='电芯{}发生热失控安全预警'.format(i+1)
                 faultadvice='1联系用户远离电池,立刻召回电池'
                 df_res.loc[0]=[time_now, time_sp, self.sn, faultcode, faultlv, faultinfo, faultadvice]
-            elif voltratefault==1:
+            else:
+                pass       
+        
+        #电池电压变化率热失控预警...............................................................................
+        volt_rate_std=np.std(volt_rate)
+        volt_rate_mean=np.mean(volt_rate)
+        volt_rate_3sigma=(np.array(volt_rate)-volt_rate_mean)/volt_rate_std
+        if not self.df_soh.empty and self.celltype<50:
+            cellsoh=eval(self.df_soh.loc[0,'cellsoh'])
+            cellsoh_std=np.std(cellsoh)
+            cellsoh_mean=np.mean(cellsoh)
+            cellsoh_3sigma=((np.array(cellsoh)-cellsoh_mean)/cellsoh_std)
+        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 and  voltsigmafault_list[i]==1:
                 faultcode=110
                 faultlv=4
                 faultinfo='电芯{}发生热失控安全预警'.format(i+1)
                 faultadvice='2联系用户远离电池,立刻召回电池'
                 df_res.loc[0]=[time_now, time_sp, self.sn, faultcode, faultlv, faultinfo, faultadvice]
-            elif shortfault==1:
-                faultcode=110
-                faultlv=4
-                faultinfo='电芯{}发生热失控安全预警'.format(i+1)
-                faultadvice='3联系用户远离电池,立刻召回电池'
-                df_res.loc[0]=[time_now, time_sp, self.sn, faultcode, faultlv, faultinfo, faultadvice]
             else:
                 pass
         
-        # print(volt_rate)
-            
+        # plt.show()
+
         return df_res

+ 66 - 52
LIB/MIDDLE/CellStateEstimation/BatSafetyWarning/V1_0_1/VoltStray.py

@@ -1,3 +1,4 @@
+from re import X
 import pandas as pd
 import numpy as np
 from pandas.core.frame import DataFrame
@@ -8,25 +9,25 @@ def preprocess(df):
     # 滤除前后电压存在一增一减的情况(采样异常)
     pass
 
-# 计算电压的偏离度    
-def cal_volt_uniform(dfin, volt_column, window=10, step=5, threshold=3):
+# 计算SOC变化率  
+def cal_volt_change(dfin, volt_column):
     
     df = dfin.copy()
-    # time_list = dfin['time'].tolist()
-
-    # # 电压滤波
-    # df_volt = df[volt_column] 
-    # df_volt_rolling = df_volt.rolling(window).mean()[window-1::step]  # 滑动平均值
-    # time_list = time_list[window-1::step]
     df_volt_rolling = df[volt_column] 
 
-    # 电压偏离度
     df_volt_rolling_sum=df_volt_rolling.sum(1)-df_volt_rolling.max(1)
     df_volt_rolling_sum=df_volt_rolling_sum-df_volt_rolling.min(1)
-    mean = df_volt_rolling_sum/(len(volt_column)-2)
-    df_volt_rolling_norm = df_volt_rolling.sub(mean, axis=0)#.div(std,axis=0)
+    mean1 = df_volt_rolling_sum/(len(volt_column)-2)
+    df_volt_rolling_norm = df_volt_rolling.sub(mean1, axis=0)#.div(std,axis=0)
     df_volt_rolling_norm = df_volt_rolling_norm.reset_index(drop=True)#和均值的距离
+
+    return df_volt_rolling_norm
+
+# 计算电压离群  
+def cal_volt_sigma(dfin, volt_column):
     
+    df = dfin.copy()
+    df_volt_rolling = df[volt_column] 
     
     mean1=df_volt_rolling.mean(axis=1)
     std = df_volt_rolling.std(axis=1)
@@ -34,7 +35,7 @@ def cal_volt_uniform(dfin, volt_column, window=10, step=5, threshold=3):
     df_volt_rolling = df_volt_rolling.sub(mean1, axis=0).div(std,axis=0)
     df_volt_rolling = df_volt_rolling.reset_index(drop=True)#分布
 
-    return df_volt_rolling_norm,df_volt_rolling
+    return df_volt_rolling
 
 
 # # 计算电压变化量的偏离度    
@@ -73,56 +74,69 @@ def cal_volt_uniform(dfin, volt_column, window=10, step=5, threshold=3):
 #     return df_voltdiff_rolling_norm, time_list
 def main(sn,df_bms,celltype):
     param=BatParam.BatParam(celltype)
+    df_bms['总电流[A]']=df_bms['总电流[A]']*param.PackCrntDec
+    df_bms.rename(columns = {'总电流[A]':'PackCrnt'}, inplace=True)
+    df_bms['time']=pd.to_datetime(df_bms['时间戳'], format='%Y-%m-%d %H:%M:%S')
     volt_column = ['单体电压'+str(i) for i in range(1,param.CellVoltNums+1)]
-    columns=['时间戳']+volt_column
-    df_bms=df_bms[df_bms['SOC[%]']>15]
-    df_ori = df_bms[columns]
-    df_ori.rename(columns = {'时间戳':'time'}, inplace=True)
-    df_ori['time']=pd.to_datetime(df_ori['time'], format='%Y-%m-%d %H:%M:%S')
-    df = df_ori.drop_duplicates(subset=['time']) # 删除时间相同的数据
-    df= df.set_index('time')
-    df=df[(df[volt_column]>2000) & (df[volt_column]<4500)]
-    time_list=df.index.tolist()
-    df = df.reset_index(drop=True)
-
-    window = 50
-    step = 10
-    window2 = 5
-    step2 = 3
-    OutLineVol=DataFrame(columns=['time','sn','VolOl_Uni','VolChng_Uni'])
-    #df_result_1,time_list_1 = cal_voltdiff_uniform(df,volt_column, window=window, step=step, window2=window2, step2=step2)
-    VolChng_Uni,VolOl_Uni= cal_volt_uniform(df,volt_column, window=window, step=step)
+    columns=['time']+volt_column
+    df_bms=df_bms[df_bms['SOC[%]']>10]
+    # df_standing=df_bms[(df_bms['PackCrnt']>-0.1) & (df_bms['PackCrnt']<0.1)]
+    # df_chrg=df_bms[(df_bms['PackCrnt']<-1)]
+
+    #电压/SOC变化率计算
+    if celltype<50:
+        df_ori = df_bms[columns]
+        df = df_ori.drop_duplicates(subset=['time']) # 删除时间相同的数据
+        df= df.set_index('time')
+        df=df[(df[volt_column]>2000) & (df[volt_column]<4500)]
+        df[volt_column]=pd.DataFrame(df[volt_column],dtype=np.float)
+        df=df.resample('H').mean()  #取一个小时的平均值
+        df=df.dropna(how='any')
+        time_list1=df.index.tolist()
     
-    if len(VolChng_Uni)>10 and len(VolOl_Uni)>10:
-        #df_result_1['time'] = time_list_1
-        VolChng_Uni['time'] = time_list
-        # VolChng_Uni['time']=pd.to_datetime(VolChng_Uni['time'], format='%Y-%m-%d %H:%M:%S')
-        # df_result_1['time'].apply(lambda x: x.datetime.strptime('%Y-%m-%d %H:%M:%S'))
-        VolChng_Uni= VolChng_Uni.set_index('time')
-        VolChng_Uni[volt_column]=pd.DataFrame(VolChng_Uni[volt_column],dtype=np.float)
-        VolChng_Uni=VolChng_Uni.resample('H').mean()
-        VolChng_Uni=VolChng_Uni.dropna(how='any')#改
-        VolChng_Uni_result=VolChng_Uni.values.tolist()#改
-        
-        VolOl_Uni['time'] = time_list
-        VolOl_Uni= VolOl_Uni.set_index('time')
-        VolOl_Uni.index = pd.to_datetime(VolOl_Uni.index)
-        VolOl_Uni[volt_column]=pd.DataFrame(VolOl_Uni[volt_column],dtype=np.float)
-        VolOl_Uni=VolOl_Uni.resample('H').mean()
-        VolOl_Uni=VolOl_Uni.dropna(how='any')#改
-        VolOl_Uni_result=VolOl_Uni.values.tolist()#改
-        #df_result_VoltDif_Uni=str(df_result_VoltDif_Uni.tolist())
-        
+        fun=lambda x: np.interp(x/1000, param.LookTab_OCV, param.LookTab_SOC)
+        df_soc=df.applymap(fun)
+
+        VolChng = cal_volt_change(df_soc,volt_column)
+    else:
+        df_bms=df_bms[df_bms['SOC[%]']<95]
+        # df_bms=df_bms[(df_bms['PackCrnt']>-0.1) & (df_bms['PackCrnt']<0.1)]
+        df_ori = df_bms[columns]
+        df = df_ori.drop_duplicates(subset=['time']) # 删除时间相同的数据
+        df= df.set_index('time')
+        df=df[(df[volt_column]>3200) & (df[volt_column]<3400)]
+        df[volt_column]=pd.DataFrame(df[volt_column],dtype=np.float)
+        df=df.resample('H').mean()  #取一个小时的平均值
+        df=df.dropna(how='any')
+        time_list1=df.index.tolist()
+
+        VolChng = cal_volt_change(df,volt_column)
+    
+
+    VolSigma = cal_volt_sigma(df,volt_column)
+
+    OutLineVol=DataFrame(columns=['time','sn','VolOl_Uni','VolChng_Uni'])
+
+    #静置电压变化率和离群度计算
+    if len(VolChng)>5 and len(VolSigma)>5:
+        VolChng['time'] = time_list1
+        VolChng= VolChng.set_index('time')
+        VolChng_Uni_result=VolChng.values.tolist()#改
         
-        for i in range(0,len(VolChng_Uni)):
+        VolSigma['time'] = time_list1
+        VolSigma= VolSigma.set_index('time')
+        VolOl_Uni_result=VolSigma.values.tolist()#改
+       
+        for i in range(0,len(VolChng)):
             OutLineVol.loc[i,'VolOl_Uni']=str(list(np.around(VolOl_Uni_result[i],decimals=2)))
             OutLineVol.loc[i,'VolChng_Uni']=str(list(np.around(VolChng_Uni_result[i],decimals=2)))
         OutLineVol=OutLineVol[~OutLineVol['VolOl_Uni'].str.contains('nan')]
         OutLineVol=OutLineVol[~OutLineVol['VolChng_Uni'].str.contains('nan')]
         OutLineVol=OutLineVol.applymap((lambda x:''.join(x.split()) if type(x) is str else x)) 
         OutLineVol=OutLineVol.reset_index(drop=True) 
-        OutLineVol['time']= VolOl_Uni.index
+        OutLineVol['time']= VolSigma.index
         OutLineVol['sn']=sn
+
     return(OutLineVol)
     # this_alarm = {}
     # df_alarm = df_voltdiff_rolling_norm[abs(df_voltdiff_rolling_norm)>threshold].dropna(how='all')

+ 10 - 13
LIB/MIDDLE/CellStateEstimation/BatSafetyWarning/main.py

@@ -26,10 +26,10 @@ def saftywarning_cal():
     
     # start=time.time()
     now_time=datetime.datetime.now()
-    start_time=now_time-datetime.timedelta(hours=12)
+    start_time=now_time-datetime.timedelta(hours=6)
     start_time1=now_time-datetime.timedelta(days=7)
-    start_time2=now_time-datetime.timedelta(days=90)
-    start_time3=now_time-datetime.timedelta(days=3)
+    start_time2=now_time-datetime.timedelta(days=3)
+    start_time3=now_time-datetime.timedelta(days=1)
     start_time=start_time.strftime('%Y-%m-%d %H:%M:%S')
     start_time1=start_time1.strftime('%Y-%m-%d %H:%M:%S')
     start_time2=start_time2.strftime('%Y-%m-%d %H:%M:%S')
@@ -127,11 +127,10 @@ def saftywarning_cal():
                     file.write(str(df_rank_res)+'\n')
             
             #电压离群.....................................................................................................................................................
-            OutLineVol=VoltStray.main(sn,df_bms,celltype)
-            if not OutLineVol.empty:
-                df_voltsigma=OutLineVol
+            df_voltsigma=VoltStray.main(sn,df_bms,celltype)
+            if not df_voltsigma.empty:
                 with open(r'D:\Platform\platform_python\data_analyze_platform\USER\spf\01qixiang\07BatSafetyWarning\电压离群.txt','a') as file:
-                    file.write(str(OutLineVol)+'\n')
+                    file.write(str(df_voltsigma)+'\n')
 
             #ram处理................................................................................................................
             df_warning_ram=df_warning_ram.drop(df_warning_ram[df_warning_ram.sn==sn].index)
@@ -156,14 +155,12 @@ def saftywarning_cal():
         db='qx_cas'
         mode=2
         tablename1='cellstateestimation_intershort'
-        tablename2='mechanism_liplated'   #析锂表单
         tablename3='cellstateestimation_uniform_socvoltdiff'
-        tablename4=''   #电压离群表单
+        tablename4='outlier_voltchangeratio'   #电压离群表单
         DBRead=DBDownload.DBDownload(host, port, db, user, password,mode)
         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_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_time2, 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
@@ -171,7 +168,7 @@ def saftywarning_cal():
         
         #热安全预警
         if df_fault_ram_sn.empty:
-            BatWarning=CBMSSafetyWarning.SafetyWarning(sn,celltype,df_short,df_liplated,df_uniform,df_voltsigma)
+            BatWarning=CBMSSafetyWarning.SafetyWarning(sn,celltype,df_short,df_uniform,df_voltsigma,df_soh)
             df_warning_res=BatWarning.diag()
             #当前热失控故障写入数据库
             if not df_warning_res.empty:
@@ -220,7 +217,7 @@ if __name__ == "__main__":
 
     #定时任务.......................................................................................................................................................................
     scheduler = BlockingScheduler()
-    scheduler.add_job(saftywarning_cal, 'interval', hours=12)
+    scheduler.add_job(saftywarning_cal, 'interval', hours=6)
 
     try:  
         scheduler.start()

+ 16 - 5
LIB/MIDDLE/CellStateEstimation/Common/V1_0_1/BatParam.py

@@ -16,7 +16,6 @@ class BatParam:
         self.TrwCellVoltFall=1
         self.TrwCellVoltLow=1.5
         self.TrwPackVoltFall=1.5
-        self.TrwVoltRate=-6
 
         self.SocJump=10
         self.SocClamp=0.1
@@ -76,6 +75,8 @@ class BatParam:
             self.CellTempLowLv2=-25
             self.CellTempDiffLv1=10
             self.CellTempDiffLv2=15
+
+            self.TrwVoltRate=-1
         elif celltype==2: #4840
             self.Capacity = 41
             self.PackFullChrgVolt=69.99
@@ -113,6 +114,8 @@ class BatParam:
             self.CellTempLowLv2=-25
             self.CellTempDiffLv1=10
             self.CellTempDiffLv2=15
+
+            self.TrwVoltRate=-1
         elif celltype==3:   #力信50ah三元电芯
             self.Capacity = 51
             self.PackFullChrgVolt=80
@@ -149,7 +152,9 @@ class BatParam:
             self.CellTempLowLv1=-20
             self.CellTempLowLv2=-25
             self.CellTempDiffLv1=10
-            self.CellTempDiffLv2=15            
+            self.CellTempDiffLv2=15  
+
+            self.TrwVoltRate=-1         
         elif celltype==4:   #CATL 50ah三元电芯
             self.Capacity = 50
             self.PackFullChrgVolt=80
@@ -187,7 +192,9 @@ class BatParam:
             self.CellTempLowLv1=-20
             self.CellTempLowLv2=-25
             self.CellTempDiffLv1=10
-            self.CellTempDiffLv2=15            
+            self.CellTempDiffLv2=15   
+
+            self.TrwVoltRate=-1        
         elif celltype==99:   #60ah磷酸铁锂电芯
             self.Capacity = 54
             self.PackFullChrgVolt=69.99
@@ -235,7 +242,9 @@ class BatParam:
             self.CellTempLowLv1=-20
             self.CellTempLowLv2=-25
             self.CellTempDiffLv1=10
-            self.CellTempDiffLv2=15                       
+            self.CellTempDiffLv2=15   
+
+            self.TrwVoltRate=-8                    
         elif celltype==100:
             self.Capacity = 228*2
             self.PackFullChrgVolt=3.65*192
@@ -279,7 +288,9 @@ class BatParam:
             self.CellTempLowLv1=-30
             self.CellTempLowLv2=-35
             self.CellTempDiffLv1=28
-            self.CellTempDiffLv2=32                            
+            self.CellTempDiffLv2=32   
+
+            self.TrwVoltRate=-8                         
             
         else:
             print('未找到对应电池编号!!!')

+ 48 - 50
LIB/MIDDLE/SaftyCenter/DataDiag_Static/CBMSBatDiag.py

@@ -132,37 +132,37 @@ class BatDiag:
                     else:
                         pass
 
-                #温升判断
-                time2=self.bmstime[i]
-                delttime=(time2-time1).total_seconds()
-                if delttime>20:
-                    temp2=np.array(self._celltemp_get(i))
-                    celltemp_rate=round((max(temp2-temp1)*60)/delttime,2)    #计算最大温升速率
-                    temp1=temp2 #更新初始温度
-                    time1=time2 #更新初始时间
-                    if not 9 in list(self.df_diag_ram['code']):#当前故障中没有该故障,则判断是否发生该故障
-                        if celltemp_rate>self.param.CellTempRate:
-                            temprate_cnt=temprate_cnt+1
-                            if temprate_cnt>2:  #温升故障进入
-                                time=self.bmstime[i]
-                                code=9
-                                faultlv=3
-                                faultinfo='温升速率过快:{}℃/min'.format(celltemp_rate)
-                                faultadvice='技术介入诊断'
-                                self.df_diag_ram.loc[len(self.df_diag_ram)]=[time, end_time, self.sn, code, faultlv, faultinfo, faultadvice]
-                            else:
-                                pass
-                        else:   #ram当前故障中有该故障,则判断是否退出该故障
-                           pass
-                    else:
-                        if celltemp_rate<self.param.CellTempRate-1: #温升故障恢复
-                            time=self.bmstime[i]
-                            self.df_diag_ram.loc[self.df_diag_ram[self.df_diag_ram['code']==9].index, 'end_time'] = time
-                else:
-                    pass
+            #     #温升判断
+            #     time2=self.bmstime[i]
+            #     delttime=(time2-time1).total_seconds()
+            #     if delttime>20:
+            #         temp2=np.array(self._celltemp_get(i))
+            #         celltemp_rate=round((max(temp2-temp1)*60)/delttime,2)    #计算最大温升速率
+            #         temp1=temp2 #更新初始温度
+            #         time1=time2 #更新初始时间
+            #         if not 9 in list(self.df_diag_ram['code']):#当前故障中没有该故障,则判断是否发生该故障
+            #             if celltemp_rate>self.param.CellTempRate:
+            #                 temprate_cnt=temprate_cnt+1
+            #                 if temprate_cnt>2:  #温升故障进入
+            #                     time=self.bmstime[i]
+            #                     code=9
+            #                     faultlv=3
+            #                     faultinfo='温升速率过快:{}℃/min'.format(celltemp_rate)
+            #                     faultadvice='技术介入诊断'
+            #                     self.df_diag_ram.loc[len(self.df_diag_ram)]=[time, end_time, self.sn, code, faultlv, faultinfo, faultadvice]
+            #                 else:
+            #                     pass
+            #             else:   #ram当前故障中有该故障,则判断是否退出该故障
+            #                pass
+            #         else:
+            #             if celltemp_rate<self.param.CellTempRate-1: #温升故障恢复
+            #                 time=self.bmstime[i]
+            #                 self.df_diag_ram.loc[self.df_diag_ram[self.df_diag_ram['code']==9].index, 'end_time'] = time
+            #     else:
+            #         pass
             
-            else:
-                pass
+            # else:
+            #     pass
             
             #电压诊断功能.................................................................................................
             cellvolt0=self._cellvolt_get(i-1)
@@ -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])

+ 1 - 1
LIB/MIDDLE/SaftyCenter/DataDiag_Static/DiagDataMerge.py

@@ -31,6 +31,6 @@ class DiagDataMerge():
         df_Diag_Cal_Update=pd.concat([df_Diag_Cal_finish,df_Diag_Cal_unfinish])    
         df_Diag_Ram_add = pd.concat([df_Diag_Cal_Update,df_Diag_Ram_sn,df_Diag_Ram_sn]).drop_duplicates(subset=['start_time','code'],keep=False)#此次判断中新增故障
         df_Diag_Ram_Update_old = pd.concat([df_Diag_Cal_Update,df_Diag_Ram_add,df_Diag_Ram_add]).drop_duplicates(subset=['start_time','code'],keep=False)#此次判断中新增故障
-        df_Diag_Ram_Update_change = pd.concat([df_Diag_Ram_Update_old,df_Diag_Ram_sn,df_Diag_Ram_sn]).drop_duplicates(subset=['start_time','code','Batpos'],keep=False)#此次判断中新增故障
+        df_Diag_Ram_Update_change = pd.concat([df_Diag_Ram_Update_old,df_Diag_Ram_sn,df_Diag_Ram_sn]).drop_duplicates(subset=['start_time','end_time','code','Batpos'],keep=False)#此次判断中新增故障
         # df_Diag_Ram = pd.concat([df_Diag_Ram_sn_else,df_Diag_Cal_unfinish])    
         return df_Diag_Ram_add,df_Diag_Ram_Update_change

+ 25 - 25
LIB/MIDDLE/SaftyCenter/Low_Soc_Alarm/low_soc_alarm.py

@@ -7,29 +7,29 @@ import datetime,time
 
 class Low_soc_alarm():
     def low_soc_alarm(param,df_bms,low_soc_bat_list,sn,df_OprtnSta):
-        if len(df_bms) and df_OprtnSta.loc[0,'status'] !=3:#0禁用 1正常 2故障 3返修 4 损毁 5丢失已赔偿,6丢失未赔偿:
-            VoltageNum=['单体电压'+str(i) for i in range(1,param.CellVoltNums+1)]
-            df_bms[VoltageNum]=df_bms[VoltageNum]/1000
-            CellVol=df_bms[VoltageNum]
-            PackCrnt=df_bms['总电流[A]']
-            ZeroCrntCount=len(df_bms[abs(df_bms['总电流[A]'])<=1])
-            CrntCount=len(PackCrnt)-ZeroCrntCount
-            if CrntCount>0:
-                ZeroCrntRate=(ZeroCrntCount/len(PackCrnt))*100
-            else:
-                ZeroCrntRate=100
-            if ZeroCrntRate>99.85:#静置比大于99.85%
-                ZeroSoc_Volt=np.interp(0,param.LookTab_SOC,param.LookTab_OCV)
-                FiveSoc_Volt=np.interp(10,param.LookTab_SOC,param.LookTab_OCV)
-                CellVolMean=DataFrame()
-                CellVolMean=CellVol.mean()
-                CellVolMin_Index=CellVolMean.idxmin()
-                print(ZeroSoc_Volt)
-                CellLowVolZERO=df_bms[df_bms[CellVolMin_Index] < ZeroSoc_Volt]
-                CellLowVolFive=df_bms[df_bms[CellVolMin_Index] > FiveSoc_Volt]
-                CellLowVolZeroCrnt=CellLowVolZERO[abs(CellLowVolZERO['总电流[A]'])<1]
-                CellLowVolFiveCrnt=CellLowVolFive[abs(CellLowVolFive['总电流[A]'])<1]
-                if len(CellLowVolZeroCrnt)>3 and len(CellLowVolFiveCrnt)<3:
-                    CellLowVolZeroCrnt=CellLowVolZeroCrnt.reset_index(drop=True)
-                    low_soc_bat_list.loc[len(low_soc_bat_list)]=[sn,CellLowVolZeroCrnt.loc[len(CellLowVolZeroCrnt)-1,'时间戳'],3]
+        #if len(df_bms) and df_OprtnSta.loc[0,'status'] !=3:#0禁用 1正常 2故障 3返修 4 损毁 5丢失已赔偿,6丢失未赔偿:
+        VoltageNum=['单体电压'+str(i) for i in range(1,param.CellVoltNums+1)]
+        df_bms[VoltageNum]=df_bms[VoltageNum]/1000
+        CellVol=df_bms[VoltageNum]
+        PackCrnt=df_bms['总电流[A]']
+        ZeroCrntCount=len(df_bms[abs(df_bms['总电流[A]'])<=1])
+        CrntCount=len(PackCrnt)-ZeroCrntCount
+        if CrntCount>0:
+            ZeroCrntRate=(ZeroCrntCount/len(PackCrnt))*100
+        else:
+            ZeroCrntRate=100
+        if ZeroCrntRate>99.85:#静置比大于99.85%
+            ZeroSoc_Volt=np.interp(0,param.LookTab_SOC,param.LookTab_OCV)
+            FiveSoc_Volt=np.interp(10,param.LookTab_SOC,param.LookTab_OCV)
+            CellVolMean=DataFrame()
+            CellVolMean=CellVol.mean()
+            CellVolMin_Index=CellVolMean.idxmin()
+            print(ZeroSoc_Volt)
+            CellLowVolZERO=df_bms[df_bms[CellVolMin_Index] < ZeroSoc_Volt]
+            CellLowVolFive=df_bms[df_bms[CellVolMin_Index] > FiveSoc_Volt]
+            CellLowVolZeroCrnt=CellLowVolZERO[abs(CellLowVolZERO['总电流[A]'])<1]
+            CellLowVolFiveCrnt=CellLowVolFive[abs(CellLowVolFive['总电流[A]'])<1]
+            if len(CellLowVolZeroCrnt)>3 and len(CellLowVolFiveCrnt)<3:
+                CellLowVolZeroCrnt=CellLowVolZeroCrnt.reset_index(drop=True)
+                low_soc_bat_list.loc[len(low_soc_bat_list)]=[sn,CellLowVolZeroCrnt.loc[len(CellLowVolZeroCrnt)-1,'时间戳'],3]
         return low_soc_bat_list

+ 3 - 2
LIB/MIDDLE/SaftyCenter/Low_Soc_Alarm/low_soc_alarm_sta.py

@@ -6,7 +6,7 @@ from sqlalchemy.orm import sessionmaker
 from urllib import parse
 import pymysql
 
-def low_soc_alarm_sta(db_qxcas_engine, conn, db_sp_engine):
+def low_soc_alarm_sta(df_sns, db_qxcas_engine, conn, db_sp_engine):
     
     cursor = conn.cursor()
 
@@ -35,7 +35,8 @@ def low_soc_alarm_sta(db_qxcas_engine, conn, db_sp_engine):
     now = datetime.datetime.now()
     for sn in sn_new:
         df = df_lowsocalarm_lastday[df_lowsocalarm_lastday['sn']==sn]
-        df_new = df_new.append({'add_time':now, 'product_id':sn, 'start_time':df['time'].values[0], 'end_time':'0000-00-00 00:00:00', 'info':"低电量报警", 'code':58, 'level':1}, ignore_index=True)
+        factory = df_sns[df_sns['sn']==sn]['factory'].values[0]
+        df_new = df_new.append({'add_time':now, 'product_id':sn, 'factory':factory, 'start_time':df['time'].values[0], 'end_time':'0000-00-00 00:00:00', 'info':"低电量报警", 'code':58, 'level':1}, ignore_index=True)
     if not df_new.empty:
         df_new.to_sql('all_fault_info', db_sp_engine, if_exists='append', index=False)
 

+ 3 - 2
LIB/MIDDLE/SaftyCenter/Offline/offline_alarm_sta.py

@@ -7,7 +7,7 @@ from urllib import parse
 import pymysql
 
 
-def offline_alarm_sta(db_iotp_engine, db_qxcas_engine, conn, db_sp_engine):
+def offline_alarm_sta(df_sns, db_iotp_engine, db_qxcas_engine, conn, db_sp_engine):
 
     cursor = conn.cursor()
     sql = "select sn, DATE_FORMAT(add_time, '%Y-%m-%d %H:%i:%s') as time, level, last_time from offline_info where add_time >= DATE_FORMAT( DATE_SUB(CURDATE(), INTERVAL 0 DAY), '%Y-%m-%d 00:00:00')"+ \
@@ -33,7 +33,8 @@ def offline_alarm_sta(db_iotp_engine, db_qxcas_engine, conn, db_sp_engine):
         df = df_offlinealarm_lastday[df_offlinealarm_lastday['sn']==sn]
         sql = "select * from ff_battery_status where devcode = '{}'".format(sn)
         df_on = pd.read_sql(sql, db_iotp_engine)
-        df_new = df_new.append({'add_time':now, 'product_id':sn, 'start_time':pd.to_datetime(df_on['status_time'].values[0]), 'end_time':'0000-00-00 00:00:00', 'info':'离线报警','code':59, 'level':1}, ignore_index=True)
+        factory = df_sns[df_sns['sn']==sn]['factory'].values[0]
+        df_new = df_new.append({'add_time':now, 'product_id':sn, 'factory':factory, 'start_time':pd.to_datetime(df_on['status_time'].values[0]), 'end_time':'0000-00-00 00:00:00', 'info':'离线报警','code':59, 'level':1}, ignore_index=True)
     if not df_new.empty:
         df_new.to_sql('all_fault_info', db_sp_engine, if_exists='append', index=False)
 

+ 21 - 12
LIB/MIDDLE/SaftyCenter/StatusSta/V1_0_0/status_sta.py

@@ -3,25 +3,34 @@ import pandas as pd
 from LIB.BACKEND import DataPreProcess
 
 
-def status_sta(df_bms, df_gps, start_time, charge_count, drive_count, stand_count):
+def status_sta(df_bms, df_gps, start_time, charge_count, drive_count, stand_count, factory='骑享'):
     dataPrePro = DataPreProcess.DataPreProcess()
     if not df_bms.empty:
-    # 时间完全相同的数据仅保留一行
-        df_bms_pro, df_gps_pro = dataPrePro.time_filter(df_bms, df_gps)
+        if factory == '骑享':
+        # 时间完全相同的数据仅保留一行
+            df_bms_pro, df_gps_pro = dataPrePro.time_filter(df_bms, df_gps)
 
-        # bms数据按照电流和状态分段, 然后在状态分段内部,根据时间跳变继续分段(解决段内数据丢失)
+            # bms数据按照电流和状态分段, 然后在状态分段内部,根据时间跳变继续分段(解决段内数据丢失)
 
-        df_bms_pro = dataPrePro.data_split_by_status(df_bms_pro)
-        df_bms_pro = dataPrePro.data_split_by_time(df_bms_pro)
+            df_bms_pro = dataPrePro.data_split_by_status(df_bms_pro)
+            df_bms_pro = dataPrePro.data_split_by_time(df_bms_pro)
 
-        if 'charge' in df_bms_pro['data_status'].tolist():
-            charge_count = charge_count + 1
-        elif 'drive' in df_bms_pro['data_status'].tolist():
-            drive_count = drive_count + 1
-        else:
-            stand_count = stand_count + 1
+            if 'charge' in df_bms_pro['data_status'].tolist():
+                charge_count = charge_count + 1
+            elif 'drive' in df_bms_pro['data_status'].tolist():
+                drive_count = drive_count + 1
+            else:
+                stand_count = stand_count + 1
+        elif factory == '金茂':
+            if 4 in df_bms['充电状态'].tolist():
+                charge_count = charge_count + 1
+            elif 3 in df_bms['充电状态'].tolist() or 5 in df_bms['充电状态'].tolist():
+                drive_count = drive_count + 1
+            else:
+                stand_count = stand_count + 1
     else:
         stand_count = stand_count + 1
+                
 
     return charge_count, drive_count, stand_count
     

+ 127 - 808
LIB/MIDDLE/SaftyCenter/StatusSta/main.ipynb

@@ -9,805 +9,37 @@
      "name": "stdout",
      "output_type": "stream",
      "text": [
-      "### start to get data PK504B10100004341 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 8, gps_count is 0, system_count is 0, accum_count is 0 \n",
+      "### start to get data TJMCL120502305010 from 2021-12-09 10:00:00 to 2021-12-09 11:00:00\n",
+      "# get data from 2021-12-09 10:00:00 to 2021-12-09 11:00:00......... \n",
+      "all data-getting done, bms_count is 244, gps_count is 248, system_count is 0, accum_count is 0 \n",
       "\n",
-      "### start to get data PK504B10100004342 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
+      "### start to get data TJMCL120502305012 from 2021-12-09 10:00:00 to 2021-12-09 11:00:00\n",
+      "# get data from 2021-12-09 10:00:00 to 2021-12-09 11:00:00......... \n",
+      "all data-getting done, bms_count is 191, gps_count is 192, system_count is 0, accum_count is 0 \n",
       "\n",
-      "### start to get data PK504B10100004344 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
+      "### start to get data TJMCL120502305048 from 2021-12-09 10:00:00 to 2021-12-09 11:00:00\n",
+      "# get data from 2021-12-09 10:00:00 to 2021-12-09 11:00:00......... \n",
+      "all data-getting done, bms_count is 107, gps_count is 108, system_count is 0, accum_count is 0 \n",
       "\n",
-      "### start to get data PK504B10100004345 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 204, gps_count is 88, system_count is 0, accum_count is 0 \n",
+      "### start to get data TJMCL120502305044 from 2021-12-09 10:00:00 to 2021-12-09 11:00:00\n",
+      "# get data from 2021-12-09 10:00:00 to 2021-12-09 11:00:00......... \n",
+      "all data-getting done, bms_count is 156, gps_count is 161, system_count is 0, accum_count is 0 \n",
       "\n",
-      "### start to get data PK504B10100004346 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
+      "### start to get data TJMCL120502305026 from 2021-12-09 10:00:00 to 2021-12-09 11:00:00\n",
+      "# get data from 2021-12-09 10:00:00 to 2021-12-09 11:00:00......... \n",
+      "all data-getting done, bms_count is 225, gps_count is 227, system_count is 0, accum_count is 0 \n",
       "\n",
-      "### start to get data PK504B10100004347 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 4, gps_count is 0, system_count is 0, accum_count is 0 \n",
+      "### start to get data TJMCL120502305022 from 2021-12-09 10:00:00 to 2021-12-09 11:00:00\n",
+      "# get data from 2021-12-09 10:00:00 to 2021-12-09 11:00:00......... \n",
+      "all data-getting done, bms_count is 239, gps_count is 248, system_count is 0, accum_count is 0 \n",
       "\n",
-      "### start to get data PK504B10100004349 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 7, gps_count is 0, system_count is 0, accum_count is 0 \n",
+      "### start to get data TJMCL120502305032 from 2021-12-09 10:00:00 to 2021-12-09 11:00:00\n",
+      "# get data from 2021-12-09 10:00:00 to 2021-12-09 11:00:00......... \n",
+      "all data-getting done, bms_count is 162, gps_count is 169, system_count is 0, accum_count is 0 \n",
       "\n",
-      "### start to get data PK504B10100004350 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 2, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004351 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004352 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 328, gps_count is 163, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004353 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004354 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004355 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 188, gps_count is 93, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004356 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004357 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 60, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004358 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004359 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 45, gps_count is 12, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004360 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 2, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004361 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 182, gps_count is 89, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004362 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004363 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 339, gps_count is 166, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004364 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 130, gps_count is 62, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004365 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004366 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 323, gps_count is 158, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004367 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004368 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004369 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004370 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 60, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004371 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004372 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004373 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004374 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004376 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 75, gps_count is 34, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004377 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 77, gps_count is 17, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004378 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004379 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 114, gps_count is 54, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004380 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004381 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 60, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004383 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004384 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004385 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004386 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004387 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 9, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004390 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 4, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004391 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004392 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004393 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 268, gps_count is 134, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004394 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004395 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 166, gps_count is 83, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004396 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 173, gps_count is 85, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004397 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 4, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004398 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004399 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004400 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004401 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004402 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004403 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004404 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 150, gps_count is 70, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004405 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 60, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMLXN750N2189031 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004406 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004407 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004408 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 9, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004409 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 84, gps_count is 40, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004410 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 3, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004411 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004412 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004413 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 7, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004414 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004415 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 14, gps_count is 6, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004416 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 2, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004417 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 80, gps_count is 40, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004418 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004419 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004420 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 147, gps_count is 61, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMLXN750N218B019 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 120, gps_count is 122, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004421 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 66, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004422 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004423 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 55, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004424 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004425 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 353, gps_count is 77, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004426 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 9, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004427 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004428 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004429 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 139, gps_count is 68, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004430 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004431 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004432 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004433 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 341, gps_count is 167, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004434 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 239, gps_count is 109, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004435 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 2, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004436 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 134, gps_count is 62, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004437 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data K504B10100004438 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004439 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004441 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004442 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004443 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004444 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004445 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004446 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004447 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004448 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004449 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 8, gps_count is 3, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004450 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004451 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 9, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004452 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004453 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 5, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004454 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 8, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004455 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004456 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004457 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 339, gps_count is 169, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004458 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 60, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004459 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 60, gps_count is 19, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004460 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 60, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004461 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 319, gps_count is 40, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004462 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 262, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004463 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 3, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004464 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004465 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 352, gps_count is 176, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004468 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 58, gps_count is 27, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004469 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 52, gps_count is 14, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004470 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004471 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 3, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004472 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004473 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004474 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 63, gps_count is 29, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004475 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 59, gps_count is 29, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004476 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004477 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 4, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004478 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 4, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004479 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004480 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 85, gps_count is 41, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004481 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 53, gps_count is 25, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004482 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004483 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 229, gps_count is 73, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004484 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004485 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004486 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 58, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004487 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004488 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 214, gps_count is 29, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004489 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004490 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 304, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004491 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 4, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004492 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 227, gps_count is 4, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004493 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 4, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004494 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004495 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004496 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 93, gps_count is 47, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004497 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 4, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004498 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 88, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004499 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 60, gps_count is 7, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK504B10100004500 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 323, gps_count is 158, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK505B00100004166 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK50301A000001018 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data PK50301A000001029 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMLXN750N218C011 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 36, gps_count is 32, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMLXN750N2189029 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 361, gps_count is 121, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMLXN750N21AC017 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 111, gps_count is 101, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data UD02030118B4C0001 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 178, gps_count is 178, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data UD02030118B4C0012 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 6, gps_count is 6, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I034 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 75, gps_count is 75, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I035 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 12, gps_count is 12, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I036 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 7, gps_count is 7, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I037 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 6, gps_count is 6, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I038 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 6, gps_count is 6, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMLXN750N21AC029 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 119, gps_count is 119, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I039 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 190, gps_count is 190, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I040 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 6, gps_count is 6, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I041 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 315, gps_count is 315, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I042 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 6, gps_count is 6, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I043 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 7, gps_count is 7, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data UD02030118B4C0013 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 346, gps_count is 346, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I044 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 12, gps_count is 12, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I045 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 173, gps_count is 173, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I046 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 6, gps_count is 6, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I047 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 10, gps_count is 10, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I048 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 360, gps_count is 360, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I049 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 360, gps_count is 360, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I050 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 6, gps_count is 6, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I051 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 6, gps_count is 6, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I052 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 8, gps_count is 8, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I053 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 8, gps_count is 8, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data UD02030118B4C0014 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 239, gps_count is 239, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I054 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 131, gps_count is 131, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I055 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 12, gps_count is 12, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I056 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 360, gps_count is 360, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I057 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 316, gps_count is 316, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I058 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 8, gps_count is 8, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I059 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 361, gps_count is 361, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I060 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 6, gps_count is 6, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I061 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 9, gps_count is 9, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I062 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 12, gps_count is 12, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I063 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 6, gps_count is 6, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data UD02030118B4C0015 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I064 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 171, gps_count is 171, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I065 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 12, gps_count is 12, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I066 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I067 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 6, gps_count is 6, system_count is 0, accum_count is 0 \n",
-      "\n",
-      "### start to get data MGMCLN750N215I068 from 2021-11-07 22:00:00 to 2021-11-07 23:00:00\n",
-      "# get data from 2021-11-07 22:00:00 to 2021-11-07 23:00:00......... \n",
-      "all data-getting done, bms_count is 0, gps_count is 0, system_count is 0, accum_count is 0 \n",
+      "### start to get data TJMCL120502305038 from 2021-12-09 10:00:00 to 2021-12-09 11:00:00\n",
+      "# get data from 2021-12-09 10:00:00 to 2021-12-09 11:00:00......... \n",
+      "all data-getting done, bms_count is 6, gps_count is 18, system_count is 0, accum_count is 0 \n",
       "\n"
      ]
     }
@@ -824,17 +56,32 @@
     "import V1_0_0.status_sta as status_sta\n",
     "dataPrePro = DataPreProcess.DataPreProcess()\n",
     "\n",
+    "\n",
+    "# 更新sn列表\n",
     "host='rm-bp10j10qy42bzy0q7.mysql.rds.aliyuncs.com'\n",
     "port=3306\n",
     "db='qixiang_oss'\n",
-    "user='qixiang_oss'\n",
-    "password='Qixiang2021'\n",
+    "user='qx_algo_rw'\n",
+    "password='qx@123456'\n",
     "conn = pymysql.connect(host=host, port=port, user=user, password=password, database=db)\n",
     "cursor = conn.cursor()\n",
-    "cursor.execute(\"select sn, imei, add_time from app_device\")\n",
+    "cursor.execute(\"select sn, imei, add_time from app_device where status in (1,2,3)\")\n",
     "res = cursor.fetchall()\n",
     "df_sn = pd.DataFrame(res, columns=['sn', 'imei', 'add_time'])\n",
     "df_sn = df_sn.reset_index(drop=True)\n",
+    "cursor.close()\n",
+    "conn.close()\n",
+    "df_sn['factory'] = '骑享'\n",
+    "\n",
+    "db = 'qx_cas'\n",
+    "conn = pymysql.connect(host=host, port=port, user=user, password=password, database=db)\n",
+    "cursor = conn.cursor()\n",
+    "cursor.execute(\"select sn, factory from sn_list\")\n",
+    "res = cursor.fetchall()\n",
+    "df_sn2 = pd.DataFrame(res, columns=['sn', 'factory'])\n",
+    "df_sn2['imei'] = \"\"\n",
+    "df_sn = pd.concat([df_sn, df_sn2], axis=0)\n",
+    "df_sn = df_sn.reset_index(drop=True)\n",
     "\n",
     "now_time = datetime.datetime.now()\n",
     "pre_time = now_time + dateutil.relativedelta.relativedelta(hours=-1)#上个月时间\n",
@@ -845,14 +92,20 @@
     "charge_count = 0\n",
     "drive_count = 0\n",
     "stand_count = 0\n",
-    "for sn in df_sn['sn'].tolist()[0:200]:\n",
+    "charge_count_jinmao = 0\n",
+    "drive_count_jinmao = 0\n",
+    "stand_count_jinmao = 0\n",
+    "for sn in df_sn['sn'].tolist():\n",
+    "    if 'TJMCL'in sn: # 金茂\n",
+    "        df_data = dbManager.get_data(sn=sn, start_time=start_time, end_time=end_time, data_groups=['bms', 'gps'])\n",
+    "        # \n",
+    "        df_bms = df_data['bms']\n",
+    "        df_gps = df_data['gps']\n",
+    "        factory = '金茂'\n",
+    "        charge_count_jinmao, drive_count_jinmao, stand_count_jinmao = status_sta.status_sta(df_bms, df_gps, start_time, charge_count_jinmao, drive_count_jinmao, stand_count_jinmao, factory)\n",
+    "# df_result = pd.DataFrame({'factory':['骑享'], 'time':[start_time], 'charge_count':[charge_count], 'drive_count':[drive_count], 'stand_count':stand_count})\n",
+    "df_result = pd.DataFrame({'factory':['金茂'], 'time':[start_time], 'charge_count':[charge_count_jinmao], 'drive_count':[drive_count_jinmao], 'stand_count':stand_count_jinmao})\n",
     "\n",
-    "    df_data = dbManager.get_data(sn=sn, start_time=start_time, end_time=end_time, data_groups=['bms', 'gps'])\n",
-    "    # \n",
-    "    df_bms = df_data['bms']\n",
-    "    df_gps = df_data['gps']\n",
-    "    charge_count, drive_count, stand_count = status_sta.status_sta(df_bms, df_gps, start_time, charge_count, drive_count, stand_count)\n",
-    "df_result = pd.DataFrame({'factory':['骑享'], 'time':[start_time], 'charge_count':[charge_count], 'drive_count':[drive_count], 'stand_count':stand_count})\n",
     "\n",
     "    "
    ]
@@ -893,11 +146,11 @@
        "  <tbody>\n",
        "    <tr>\n",
        "      <th>0</th>\n",
-       "      <td>骑享</td>\n",
-       "      <td>2021-11-07 22:00:00</td>\n",
-       "      <td>19</td>\n",
-       "      <td>18</td>\n",
-       "      <td>163</td>\n",
+       "      <td>金茂</td>\n",
+       "      <td>2021-12-09 10:00:00</td>\n",
+       "      <td>0</td>\n",
+       "      <td>7</td>\n",
+       "      <td>1</td>\n",
        "    </tr>\n",
        "  </tbody>\n",
        "</table>\n",
@@ -905,7 +158,7 @@
       ],
       "text/plain": [
        "  factory                 time  charge_count  drive_count  stand_count\n",
-       "0      骑享  2021-11-07 22:00:00            19           18          163"
+       "0      金茂  2021-12-09 10:00:00             0            7            1"
       ]
      },
      "execution_count": 2,
@@ -917,6 +170,72 @@
     "df_result"
    ]
   },
+  {
+   "cell_type": "code",
+   "execution_count": 6,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "[0, 0, 0, 0, 0, 0]"
+      ]
+     },
+     "execution_count": 6,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "df_bms['充电状态'].tolist()"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 13,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "False"
+      ]
+     },
+     "execution_count": 13,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "4 in df_bms['充电状态'].tolist()"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 11,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "0    0\n",
+       "1    0\n",
+       "2    0\n",
+       "3    0\n",
+       "4    0\n",
+       "5    0\n",
+       "Name: 充电状态, dtype: object"
+      ]
+     },
+     "execution_count": 11,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "df_bms['充电状态']"
+   ]
+  },
   {
    "cell_type": "code",
    "execution_count": null,

Dosya farkı çok büyük olduğundan ihmal edildi
+ 6 - 23
LIB/MIDDLE/WinterCharging/V1_0_1/main.ipynb


Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor