Преглед на файлове

更改项如下:
1.修改析锂检测函数LI_plated,增加判断条件;
2.修改main函数,暂时不计算内阻及电压估计,内阻估计算法运行时间较长,看看后面如何优化,优化后再运行。

shangguanlie23 преди 2 години
родител
ревизия
42db8e0f96
променени са 2 файла, в които са добавени 26 реда и са изтрити 24 реда
  1. 3 1
      LIB/MIDDLE/SaftyCenter/Liplated/Li_plated.py
  2. 23 23
      LIB/MIDDLE/SaftyCenter/Liplated/main.py

+ 3 - 1
LIB/MIDDLE/SaftyCenter/Liplated/Li_plated.py

@@ -140,7 +140,9 @@ class Liplated_test:
                     peak_pos = np.where(df_check_plated_data == -2)
                     bot_pos = np.where(df_check_plated_data == 2)
                     if len(peak_pos[0]) & len(bot_pos[0]):
-                        if (peak_pos[0][0] > bot_pos[0][0]) & (df_lipltd_volt_temp_dif[cell_name][peak_pos[0][0] + 1] < 0):
+                        peak_hight = df_lipltd_volt_temp_dif[cell_name][peak_pos[0][0] + 1] - df_lipltd_volt_temp_dif[cell_name][0]
+                        peak_bot_hight = df_lipltd_volt_temp_dif[cell_name][peak_pos[0][0] + 1] - df_lipltd_volt_temp_dif[cell_name][bot_pos[0][0] + 1]
+                        if (peak_pos[0][0] > bot_pos[0][0]) & (df_lipltd_volt_temp_dif[cell_name][peak_pos[0][0] + 1] < 0) & (peak_bot_hight > 0.2*peak_hight):
                             lipltd_confirm.append(1)#1为析锂,0为非析锂
                             lipltd_amount.append((df_check_liplated_temp['时间戳'][bot_pos[0][0] + 2] - df_check_liplated_temp['时间戳'][0])/pd.Timedelta(1, 'min'))
                         else:

+ 23 - 23
LIB/MIDDLE/SaftyCenter/Liplated/main.py

@@ -49,32 +49,32 @@ def cell_platd_sorvol_test():
         if not df_bms.empty:
             Diag_lipltd_temp = Li_plated.Liplated_test(sn,celltype,df_bms)#析锂检测
             df_Diag_lipltd_add = Diag_lipltd_temp.liplated_detect()
-            Diag_sorvol_temp = vol_sor_est.vol_sor_est(sn,celltype,df_bms)#电压内阻估计
-            [df_diag_sor_add, df_diag_vol_add, df_diag_sorvol_add] = Diag_sorvol_temp.volsor_cal()           
+            # Diag_sorvol_temp = vol_sor_est.vol_sor_est(sn,celltype,df_bms)#电压内阻估计
+            # [df_diag_sor_add, df_diag_vol_add, df_diag_sorvol_add] = Diag_sorvol_temp.volsor_cal()           
         if not df_Diag_lipltd_add.empty:
             df_Diag_lipltd_temp = df_Diag_lipltd.append(df_Diag_lipltd_add)
             df_Diag_lipltd = df_Diag_lipltd_temp.drop_duplicates(subset = ['sn','time'], keep = 'first', inplace = False)
             df_Diag_lipltd.reset_index(drop = True)
             df_Diag_lipltd.sort_values(by = ['sn'], axis = 0, ascending=True,inplace=True)#对故障信息按照时间进行排序
             df_Diag_lipltd.to_csv(r'D:\Work\Code_write\data_analyze_platform\USER\lzx\01算法开发\02析锂检测\01下载数据\格林美-力信7255\SNnums_6040_liplated_sn.csv',index=False,encoding='GB18030')
-        if not df_diag_sor_add.empty:
-            df_diag_sor_temp = df_diag_sor.append(df_diag_sor_add)
-            df_diag_sor = df_diag_sor_temp.drop_duplicates(subset = ['sn','time'], keep = 'first', inplace = False)
-            df_diag_sor.reset_index(drop = True)
-            df_diag_sor.sort_values(by = ['sn'], axis = 0, ascending=True,inplace=True)#对故障信息按照时间进行排序
-            df_diag_sor.to_csv(r'D:\Work\Code_write\data_analyze_platform\USER\lzx\01算法开发\05内阻及电压估计\02算法检测\判断结果\内阻偏离.csv',index=False,encoding='GB18030')
-        if not df_diag_vol_add.empty:
-            df_diag_vol_temp = df_diag_vol.append(df_diag_vol_add)
-            df_diag_vol = df_diag_vol_temp.drop_duplicates(subset = ['sn','time'], keep = 'first', inplace = False)
-            df_diag_vol.reset_index(drop = True)
-            df_diag_vol.sort_values(by = ['sn'], axis = 0, ascending=True,inplace=True)#对故障信息按照时间进行排序
-            df_diag_vol.to_csv(r'D:\Work\Code_write\data_analyze_platform\USER\lzx\01算法开发\05内阻及电压估计\02算法检测\判断结果\电压偏离.csv',index=False,encoding='GB18030')
-        if not df_diag_sorvol_add.empty:
-            df_diag_volsor_temp = df_diag_volsor.append(df_diag_sorvol_add)
-            df_diag_volsor = df_diag_volsor_temp.drop_duplicates(subset = ['sn','time'], keep = 'first', inplace = False)
-            df_diag_volsor.reset_index(drop = True)
-            df_diag_volsor.sort_values(by = ['sn'], axis = 0, ascending=True,inplace=True)#对故障信息按照时间进行排序
-            df_diag_volsor.to_csv(r'D:\Work\Code_write\data_analyze_platform\USER\lzx\01算法开发\05内阻及电压估计\02算法检测\判断结果\电压内阻偏离.csv',index=False,encoding='GB18030')
+        # if not df_diag_sor_add.empty:
+        #     df_diag_sor_temp = df_diag_sor.append(df_diag_sor_add)
+        #     df_diag_sor = df_diag_sor_temp.drop_duplicates(subset = ['sn','time'], keep = 'first', inplace = False)
+        #     df_diag_sor.reset_index(drop = True)
+        #     df_diag_sor.sort_values(by = ['sn'], axis = 0, ascending=True,inplace=True)#对故障信息按照时间进行排序
+        #     df_diag_sor.to_csv(r'D:\Work\Code_write\data_analyze_platform\USER\lzx\01算法开发\05内阻及电压估计\02算法检测\判断结果\内阻偏离.csv',index=False,encoding='GB18030')
+        # if not df_diag_vol_add.empty:
+        #     df_diag_vol_temp = df_diag_vol.append(df_diag_vol_add)
+        #     df_diag_vol = df_diag_vol_temp.drop_duplicates(subset = ['sn','time'], keep = 'first', inplace = False)
+        #     df_diag_vol.reset_index(drop = True)
+        #     df_diag_vol.sort_values(by = ['sn'], axis = 0, ascending=True,inplace=True)#对故障信息按照时间进行排序
+        #     df_diag_vol.to_csv(r'D:\Work\Code_write\data_analyze_platform\USER\lzx\01算法开发\05内阻及电压估计\02算法检测\判断结果\电压偏离.csv',index=False,encoding='GB18030')
+        # if not df_diag_sorvol_add.empty:
+        #     df_diag_volsor_temp = df_diag_volsor.append(df_diag_sorvol_add)
+        #     df_diag_volsor = df_diag_volsor_temp.drop_duplicates(subset = ['sn','time'], keep = 'first', inplace = False)
+        #     df_diag_volsor.reset_index(drop = True)
+        #     df_diag_volsor.sort_values(by = ['sn'], axis = 0, ascending=True,inplace=True)#对故障信息按照时间进行排序
+        #     df_diag_volsor.to_csv(r'D:\Work\Code_write\data_analyze_platform\USER\lzx\01算法开发\05内阻及电压估计\02算法检测\判断结果\电压内阻偏离.csv',index=False,encoding='GB18030')
         end=time.time()
         print(end-start)
 
@@ -108,9 +108,9 @@ if __name__ == "__main__":
     mylog.logcfg()
     #............................模块运行前,先读取数据库中所有结束时间为0的数据,需要从数据库中读取................
     df_Diag_lipltd=pd.read_csv(r'D:\Work\Code_write\data_analyze_platform\USER\lzx\01算法开发\02析锂检测\01下载数据\格林美-力信7255\析锂.csv',encoding='GB18030')
-    df_diag_sor = pd.read_csv(r'D:\Work\Code_write\data_analyze_platform\USER\lzx\01算法开发\05内阻及电压估计\02算法检测\判断结果\内阻偏离.csv',encoding='GB18030')
-    df_diag_vol = pd.read_csv(r'D:\Work\Code_write\data_analyze_platform\USER\lzx\01算法开发\05内阻及电压估计\02算法检测\判断结果\电压偏离.csv',encoding='GB18030')
-    df_diag_volsor = pd.read_csv(r'D:\Work\Code_write\data_analyze_platform\USER\lzx\01算法开发\05内阻及电压估计\02算法检测\判断结果\电压内阻偏离.csv',encoding='GB18030')
+    # df_diag_sor = pd.read_csv(r'D:\Work\Code_write\data_analyze_platform\USER\lzx\01算法开发\05内阻及电压估计\02算法检测\判断结果\内阻偏离.csv',encoding='GB18030')
+    # df_diag_vol = pd.read_csv(r'D:\Work\Code_write\data_analyze_platform\USER\lzx\01算法开发\05内阻及电压估计\02算法检测\判断结果\电压偏离.csv',encoding='GB18030')
+    # df_diag_volsor = pd.read_csv(r'D:\Work\Code_write\data_analyze_platform\USER\lzx\01算法开发\05内阻及电压估计\02算法检测\判断结果\电压内阻偏离.csv',encoding='GB18030')
 
     print('-------计算中-----------')
     #定时任务.......................................................................................................................................................................