Quellcode durchsuchen

析锂检测函数增加判断条件

shangguanlie23 vor 3 Jahren
Ursprung
Commit
9d8e79bad1
1 geänderte Dateien mit 13 neuen und 12 gelöschten Zeilen
  1. 13 12
      LIB/MIDDLE/SaftyCenter/Liplated/Li_plated.py

+ 13 - 12
LIB/MIDDLE/SaftyCenter/Liplated/Li_plated.py

@@ -96,7 +96,7 @@ class Liplated_test:
                     df_test_rest_volt_diff_temp = np.diff(df_rest_volt_smooth,axis=0)
                     df_test_rest_time_dif = pd.DataFrame(df_rest_time_dif_temp)
                     df_test_rest_volt_diff = pd.DataFrame(df_test_rest_volt_diff_temp)
-                    df_test_rest_volt_diffdt_temp = np.divide(df_test_rest_volt_diff,df_test_rest_time_dif)
+                    df_test_rest_volt_diffdt_temp = np.divide(df_test_rest_volt_diff,df_test_rest_time_dif)#电压的一次微分
                     df_test_rest_volt_diffdt = pd.DataFrame(df_test_rest_volt_diffdt_temp)
                     df_test_rest_volt_diffdt = df_test_rest_volt_diffdt.append(df_test_rest_volt_diffdt.iloc[len(df_test_rest_volt_diffdt)-1])
                     df_test_rest_volt_diffdt.columns = cellvolt_list
@@ -117,12 +117,9 @@ class Liplated_test:
                 df_check_liplated_temp = df_rest_volt_diffdt.loc[df_rest_volt_diffdt['chrgr_rest'] == item].reset_index(drop = True)
                 df_lipltd_volt_temp = df_check_liplated_temp[cellvolt_list]
                 df_lipltd_volt_len = len(df_lipltd_volt_temp)
-                df_data_temp_add = df_lipltd_volt_temp.iloc[df_lipltd_volt_len-4:df_lipltd_volt_len-1]
-                df_lipltd_volt_temp_add = df_lipltd_volt_temp.append(df_data_temp_add)
-                df_lipltd_volt_temp_dif = np.diff(df_lipltd_volt_temp_add,axis=0)#电压一次微分,计算dv/dt
-                df_lipltd_volt_temp_dif = pd.DataFrame(df_lipltd_volt_temp_dif)
-                df_lipltd_volt_temp_dif.columns = cellvolt_list
-                df_lipltd_volt_temp_difdif = np.diff(df_lipltd_volt_temp_dif,axis=0)#电压二次微分,判断升降
+                df_data_temp_add = df_lipltd_volt_temp.iloc[df_lipltd_volt_len-3:df_lipltd_volt_len-1]
+                df_lipltd_volt_temp_dif = df_lipltd_volt_temp.append(df_data_temp_add)
+                df_lipltd_volt_temp_difdif = np.diff(df_lipltd_volt_temp_dif,axis=0)#电压二次微分,判断电压微分曲线上升沿或下降沿
                 df_lipltd_volt_temp_difdif = pd.DataFrame(df_lipltd_volt_temp_difdif)
                 df_lipltd_volt_temp_difdif.columns = cellvolt_list
                 df_lipltd_volt_temp_difdif_temp = df_lipltd_volt_temp_difdif
@@ -140,18 +137,22 @@ 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]):
-                        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):
+                        ini_dvdt = df_check_liplated_temp[cell_name][0]
+                        peak_dvdt = df_check_liplated_temp[cell_name][peak_pos[0][0] + 1]
+                        bot_dvdt = df_check_liplated_temp[cell_name][bot_pos[0][0] + 1]
+                        peak_hight = peak_dvdt - ini_dvdt
+                        peak_bot_hight = peak_dvdt - bot_dvdt
+                        liplted_amount_temp = (df_check_liplated_temp['时间戳'][bot_pos[0][0] + 1] - df_check_liplated_temp['时间戳'][0])/pd.Timedelta(1, 'min')
+                        if ((bot_pos[0][0] - peak_pos[0][0]) > 3) & (df_check_liplated_temp[cell_name][peak_pos[0][0] + 1] < 0) & (peak_bot_hight > 0.05*peak_hight) & (liplted_amount_temp > 15):
                             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'))
+                            lipltd_amount.append(liplted_amount_temp)
                         else:
                             lipltd_confirm.append(0)
                             lipltd_amount.append(0)
                     else:
                         lipltd_confirm.append(0)
                         lipltd_amount.append(0)
-                if any(lipltd_confirm) & (max(lipltd_amount) > 5):
+                if any(lipltd_confirm):
                     df_lipltd_confir_temp = pd.DataFrame({"sn":[self.sn], "time":[df_check_liplated_temp['时间戳'][0]], "liplated":[str(lipltd_confirm)], "liplated_amount":[str(lipltd_amount)]})
                     df_lipltd_result = df_lipltd_result.append(df_lipltd_confir_temp)
                     df_lipltd_result = df_lipltd_result.reset_index(drop = True)