data_analy.py 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. from ctypes import Structure
  2. from re import M
  3. import pandas as pd
  4. import numpy as np
  5. import datetime
  6. import time, datetime
  7. import matplotlib.pyplot as plt
  8. from pylab import*
  9. from scipy.signal import savgol_filter
  10. import os
  11. import log
  12. path = r'D:\Work\Code_write\data_analyze_platform\USER\lzx\01算法开发\02析锂检测\01下载数据\格林美-Catl7255\原始数据'
  13. def get_file(): #创建一个空列表
  14. files =os.listdir(path)
  15. files.sort() #排序
  16. file_list= []
  17. for file in files:
  18. if not os.path.isdir(path +file): #判断该文件是否是一个文件夹
  19. f_name = str(file)
  20. # print(f_name)
  21. tr = '\\' #多增加一个斜杠
  22. filename = path + tr + f_name
  23. file_list.append(filename)
  24. return file_list
  25. mylog=log.Mylog('log_diag.txt','error')
  26. mylog.logcfg()
  27. file_list = get_file()
  28. for file in file_list:
  29. data = pd.read_csv(file,encoding='GB18030')
  30. #----------------------------------------定义滤波函数-----------------------------------------------------------------------
  31. def moving_average(interval, windowsize):
  32. window = np.ones(int(windowsize)) / float(windowsize)
  33. re = np.convolve(interval, window, 'same')
  34. return re
  35. #----------------------------------------区分充放电数据----------------------------------------------------------------------
  36. df_soc = data['SOC[%]']
  37. df_soc_len = len(df_soc)
  38. df_soc_add = df_soc.iloc[df_soc_len-3:df_soc_len-1]#由于对SOC二次微分,需要增加两行数据
  39. df_soc_new = df_soc.append(df_soc_add)
  40. df_soc_new_dif = np.diff(df_soc_new,axis=0)#电压一次微分,判断升降
  41. df_soc_new_dif = pd.DataFrame(df_soc_new_dif)
  42. df_soc_new_dif[df_soc_new_dif >= 0] = 1#SOC升高或静置
  43. df_soc_new_dif[df_soc_new_dif < 0] = -1#SOC下降
  44. df_soc_new_difdif = np.diff(df_soc_new_dif,axis=0)#三次微分,利用-2,2判断充电-静置与放电-静置的区别
  45. df_soc_new_difdif = pd.DataFrame(df_soc_new_difdif)
  46. peak_pos = np.where(df_soc_new_difdif == -2)
  47. bot_pos = np.where(df_soc_new_difdif == 2)
  48. chrgr_rest_data_temp = data.loc[((data['充电状态'] == 0) & (data['SOC[%]'] > 98) & (data['总电流[A]'] == 0))|
  49. ((data['充电状态'] == 2) & (data['SOC[%]'] > 98) & (data['总电流[A]'] == 0))]#接近慢充后静置数据
  50. chrgr_rest_data = chrgr_rest_data_temp.reset_index(drop=True)
  51. temp_rest_time = chrgr_rest_data['时间戳'].reset_index(drop=True)
  52. rest_time = pd.to_datetime(temp_rest_time)
  53. # rest_chrg_time = datetime(rest_time)
  54. # delta_time = np.diff(rest_chrg_time)
  55. delta_time = (np.diff(rest_time)/pd.Timedelta(1, 'min'))#计算时间差的分钟数
  56. pos = np.where(delta_time > 30)
  57. pos_ful_tem = np.insert(pos, 0, 0)
  58. pos_len = len(pos_ful_tem)
  59. data_len = len(rest_time)
  60. pos_ful = np.insert(pos_ful_tem, pos_len, data_len-1)
  61. splice_num = []
  62. if len(pos[0]) >= 1:
  63. pos_ful_tem = np.insert(pos, 0, 0)
  64. pos_len = len(pos_ful_tem)
  65. data_len = len(rest_time)
  66. pos_ful = np.insert(pos_ful_tem, pos_len, data_len-1)
  67. for item in range(0,len(pos_ful)-1):
  68. splice_num.extend(item*np.ones(pos_ful[item +1]-pos_ful[item]))
  69. splice_num = np.insert(splice_num, 0, 0)
  70. else:
  71. splice_num = np.zeros(len(temp_rest_time))
  72. pos_ful = np.array([0])
  73. chrgr_rest_data['chrgr_rest'] = splice_num
  74. #---------------------------判断数据点数大于30的数据段,对电压微分并画图--------------------------------------------
  75. cellvolt_name=['单体电压'+str(x) for x in range(1,21)]
  76. cellvolt_list = cellvolt_name
  77. chrgr_rest_check_data = chrgr_rest_data.drop(['GSM信号','故障等级','故障代码','单体压差','绝缘电阻','总电流[A]','总电压[V]','充电状态','单体压差','SOC[%]'],axis=1,inplace=False)
  78. chrgr_rest_check_data.fillna(value=0)
  79. df_rest_volt_diffdt = pd.DataFrame()
  80. df_rest_volt_smooth = pd.DataFrame()
  81. df_ini_volt_total = pd.DataFrame()
  82. k = 0
  83. for j in range(0,len(pos_ful)-1):#len(pos_ful)-1#有几段充电后静置数据
  84. df_test_rest_data = chrgr_rest_check_data.loc[chrgr_rest_check_data['chrgr_rest'] == j]
  85. df_rest_volt_smooth = pd.DataFrame()
  86. df_ini_volt = pd.DataFrame()
  87. df_test_rest_time = pd.to_datetime(df_test_rest_data['时间戳'],format='%Y-%m-%d %H:%M:%S')
  88. df_test_rest_time = df_test_rest_time.reset_index(drop=True)
  89. df_data_length = len(df_test_rest_time)
  90. if (df_data_length > 30) & ((df_test_rest_time[df_data_length - 1] - df_test_rest_time[0])/pd.Timedelta(1, 'min') > 40):#静置时间大于40min
  91. df_test_rest_time_dif_temp = np.diff(df_test_rest_time)/pd.Timedelta(1, 'min')
  92. num_list = []
  93. data_jump_pos = np.where(df_test_rest_time_dif_temp > 3)
  94. if len(data_jump_pos[0]) > 0:
  95. if data_jump_pos[0][0] > 100:
  96. for i in range(0,data_jump_pos[0][0],15):##采样密集时每隔10行取数据
  97. num_list.append(i)
  98. df_rest_data_temp = df_test_rest_data.iloc[num_list]
  99. df_test_rest_data_choose = pd.DataFrame(df_rest_data_temp)
  100. df_test_rest_data_choose_else = df_test_rest_data.iloc[data_jump_pos[0][0]+1:len(df_test_rest_data)-1]
  101. df_rest_data_recon_temp = df_test_rest_data_choose.append(df_test_rest_data_choose_else)
  102. df_rest_data_recon =df_rest_data_recon_temp.reset_index(drop=True)
  103. else:
  104. df_rest_data_recon = df_test_rest_data
  105. else:
  106. df_rest_data_recon = df_test_rest_data
  107. df_rest_time = pd.to_datetime(df_rest_data_recon['时间戳'],format='%Y-%m-%d %H:%M:%S')
  108. df_rest_time = df_rest_time.reset_index(drop=True)
  109. df_rest_time_dif_temp = np.diff(df_rest_time)/pd.Timedelta(1, 'min')
  110. df_rest_volt = df_rest_data_recon[cellvolt_list]
  111. for item in cellvolt_list:
  112. window_temp = int(len(df_rest_volt[item])/3)
  113. if window_temp%2:#滤波函数的窗口长度需为奇数
  114. window = window_temp
  115. else:
  116. window = window_temp - 1
  117. step = min(int(window/3),5)
  118. df_volt_smooth = savgol_filter(df_rest_volt[item],window,step)
  119. df_rest_volt_smooth[item] = df_volt_smooth
  120. df_ini_volt = df_ini_volt.append(df_rest_volt_smooth)
  121. df_ini_volt.columns = cellvolt_list
  122. df_test_rest_volt_diff_temp = np.diff(df_rest_volt_smooth,axis=0)
  123. df_test_rest_time_dif = pd.DataFrame(df_rest_time_dif_temp)
  124. df_test_rest_volt_diff = pd.DataFrame(df_test_rest_volt_diff_temp)
  125. df_test_rest_volt_diffdt_temp = np.divide(df_test_rest_volt_diff,df_test_rest_time_dif)#电压对时间的微分
  126. df_test_rest_volt_diffdt = pd.DataFrame(df_test_rest_volt_diffdt_temp)
  127. df_test_rest_volt_diffdt = df_test_rest_volt_diffdt.append(df_test_rest_volt_diffdt.iloc[len(df_test_rest_volt_diffdt)-1])
  128. df_test_rest_volt_diffdt.columns = cellvolt_list
  129. if len(df_test_rest_volt_diffdt) > 25:
  130. for item in cellvolt_list:
  131. df_volt_diffdt_smooth = savgol_filter(df_test_rest_volt_diffdt[item],13,3)
  132. df_test_rest_volt_diffdt[item] = df_volt_diffdt_smooth
  133. df_test_rest_volt_diffdt['chrgr_rest'] = k
  134. df_test_rest_volt_diffdt['时间戳'] = list(df_rest_time)
  135. df_ini_volt['chrgr_rest'] = k
  136. df_ini_volt['时间戳'] = list(df_rest_time)
  137. k = k+1
  138. df_rest_volt_diffdt = df_rest_volt_diffdt.append(df_test_rest_volt_diffdt)#电压对时间的一次微分
  139. df_rest_volt_diffdt.reset_index()
  140. df_ini_volt_total = df_ini_volt_total.append(df_ini_volt)
  141. df_ini_volt_total.reset_index()
  142. #--------------------------------------------------------确认是否析锂----------------------------------------------------------------------------
  143. # df_lipltd_data = pd.DataFrame(columns=['sn','date','liplated'])
  144. m_num = 0
  145. df_fig_dvdtdata = pd.DataFrame()
  146. df_fig_voltdata = pd.DataFrame()
  147. for item in range(0,k):
  148. lipltd_confirm = []
  149. lipltd_amount = []
  150. df_check_liplated_temp = df_rest_volt_diffdt.loc[df_rest_volt_diffdt['chrgr_rest'] == item].reset_index(drop = True)
  151. df_check_volt_temp = df_ini_volt_total.loc[df_ini_volt_total['chrgr_rest'] == item].reset_index(drop = True)
  152. df_lipltd_volt_temp = df_check_liplated_temp[cellvolt_list]
  153. df_lipltd_volt_len = len(df_lipltd_volt_temp)
  154. df_data_temp_add = df_lipltd_volt_temp.iloc[df_lipltd_volt_len-3:df_lipltd_volt_len-1]#电压对时间的一次微分
  155. df_lipltd_volt_temp_add = df_lipltd_volt_temp.append(df_data_temp_add)
  156. # df_lipltd_volt_temp_dif = np.diff(df_lipltd_volt_temp_add,axis=0)#电压一次微分,计算dv/dt
  157. # df_lipltd_volt_temp_dif = pd.DataFrame(df_lipltd_volt_temp_dif)
  158. # df_lipltd_volt_temp_dif.columns = cellvolt_list
  159. df_lipltd_volt_temp_difdif = np.diff(df_lipltd_volt_temp_add,axis=0)#电压二次微分,判断升降
  160. df_lipltd_volt_temp_difdif = pd.DataFrame(df_lipltd_volt_temp_difdif)
  161. df_lipltd_volt_temp_difdif.columns = cellvolt_list
  162. df_lipltd_volt_temp_difdif_temp = df_lipltd_volt_temp_difdif
  163. df_lipltd_volt_temp_difdif_temp[df_lipltd_volt_temp_difdif_temp >= 0] = 1
  164. df_lipltd_volt_temp_difdif_temp[df_lipltd_volt_temp_difdif_temp < 0] = -1
  165. df_lipltd_volt_temp_difdifdif = np.diff(df_lipltd_volt_temp_difdif_temp,axis=0)#三次微分,利用-2,2判断波分和波谷
  166. df_lipltd_volt_difdifdif = pd.DataFrame(df_lipltd_volt_temp_difdifdif)
  167. df_lipltd_volt_difdifdif.columns = cellvolt_list
  168. df_lipltd_volt_difdifdif['chrgr_rest'] = k
  169. df_lipltd_volt_difdifdif['时间戳'] = list(df_check_liplated_temp['时间戳'])
  170. df_lipltd_volt_difdifdif = df_lipltd_volt_difdifdif.reset_index(drop = True)
  171. df_lipltd_data_temp = df_lipltd_volt_difdifdif.loc[df_lipltd_volt_difdifdif['时间戳'] < (df_check_liplated_temp['时间戳'][0] + datetime.timedelta(minutes=90))]
  172. for cell_name in cellvolt_list:#对每个电芯判断
  173. df_check_plated_data = df_lipltd_data_temp[cell_name]
  174. peak_pos = np.where(df_check_plated_data == -2)
  175. bot_pos = np.where(df_check_plated_data == 2)
  176. if len(bot_pos[0]) & len(peak_pos[0]):
  177. ini_dvdt = df_check_liplated_temp[cell_name][0]
  178. peak_dvdt = df_check_liplated_temp[cell_name][peak_pos[0][0] + 1]
  179. bot_dvdt = df_check_liplated_temp[cell_name][bot_pos[0][0] + 1]
  180. peak_hight = peak_dvdt - ini_dvdt
  181. peak_bot_hight = peak_dvdt - bot_dvdt
  182. liplted_amount_temp = (df_check_liplated_temp['时间戳'][bot_pos[0][0] + 1] - df_check_liplated_temp['时间戳'][0])/pd.Timedelta(1, 'min')
  183. 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):
  184. lipltd_confirm.append(1)#1为析锂,0为非析锂
  185. lipltd_amount.append(liplted_amount_temp)
  186. else:
  187. lipltd_confirm.append(0)
  188. lipltd_amount.append(0)
  189. else:
  190. lipltd_confirm.append(0)
  191. lipltd_amount.append(0)
  192. if any(lipltd_confirm):
  193. temp = file.split('\\')
  194. sn_name = temp[11].split('.')[0]
  195. df_lipltd_confir_temp = pd.DataFrame({"sn":[sn_name], "time":[df_check_liplated_temp['时间戳'][0]], "liplated":[str(lipltd_confirm)], "liplated_amount":[str(lipltd_amount)]})
  196. df_lipltd_data = df_lipltd_data.append(df_lipltd_confir_temp)
  197. df_lipltd_data = df_lipltd_data.reset_index(drop = True)
  198. df_lipltd_data.sort_values(by = ['time'], axis = 0, ascending=True,inplace=True)#对故障信息按照时间进行排序
  199. df_fig_dvdtdata_temp = df_check_liplated_temp
  200. df_fig_dvdtdata_temp['chrgr_rest'] = m_num
  201. df_fig_dvdtdata = df_fig_dvdtdata.append(df_fig_dvdtdata_temp)#电压对时间微分数据
  202. df_fig_dvdtdata = df_fig_dvdtdata.reset_index(drop = True)
  203. df_fig_voltdata_temp = df_check_volt_temp
  204. df_fig_voltdata_temp['chrgr_rest'] = m_num
  205. df_fig_voltdata = df_fig_voltdata.append(df_fig_voltdata_temp)#原始电压数据
  206. df_fig_voltdata = df_fig_voltdata.reset_index(drop = True)
  207. m_num = m_num + 1
  208. df_lipltd_data.to_csv(r'D:\Work\Code_write\data_analyze_platform\USER\lzx\01算法开发\02析锂检测\01下载数据\格林美-Catl7255\析锂检测结果\MGMCLN750N215N155.csv',index=False,encoding='GB18030')
  209. df_fig_dvdtdata.to_csv(r'D:\Work\Code_write\data_analyze_platform\USER\lzx\01算法开发\02析锂检测\01下载数据\格林美-Catl7255\析锂检测结果\微分电压曲线.csv',index=False,encoding='GB18030')
  210. df_fig_voltdata.to_csv(r'D:\Work\Code_write\data_analyze_platform\USER\lzx\01算法开发\02析锂检测\01下载数据\格林美-Catl7255\析锂检测结果\电压曲线.csv',index=False,encoding='GB18030')
  211. for i in range(0,m_num):
  212. fig = plt.figure(figsize=(20,10))
  213. df_fig_temp = df_fig_dvdtdata.loc[df_fig_dvdtdata['chrgr_rest'] == i]
  214. df_fig_temp = df_fig_temp.reset_index(drop=True)
  215. df_fig = df_fig_temp.loc[df_fig_temp['时间戳'] < (df_fig_temp['时间戳'][0] + datetime.timedelta(hours=1))]
  216. length = len(df_fig)
  217. df_hms_temp = pd.to_datetime(df_fig['时间戳'])#转换时间格式
  218. df_hms = df_hms_temp.dt.time#仅保留时分秒
  219. df_hms_fig = df_hms.apply(lambda x:x.strftime('%H:%M:%S'))
  220. for volt_num in cellvolt_name[0:10]:
  221. # plt.scatter([x for x in range(0, length)], df_fig[volt_num][0:length], label=volt_num)
  222. plt.plot(df_hms_fig, df_fig[volt_num],linewidth = 2, linestyle = '-', marker = 's',label=volt_num)
  223. mpl.rcParams['font.sans-serif']=['KaiTi']
  224. mpl.rcParams['axes.unicode_minus']=False #用来正常显示负号
  225. plt.legend()
  226. temp = file.split('\\')
  227. sn_name = temp[-1].split('.')[0]
  228. title = sn_name + '-' + df_fig['时间戳'][0].strftime('%y-%m-%d')#df_fig['device_id'][0] + '-' +
  229. plt.xlabel('时间', fontsize=16)
  230. plt.ylabel('电压的时间微分(mv/min)', fontsize=16)
  231. plt.xticks(range(1,len(df_hms_fig),5),rotation=45, fontsize=16)
  232. plt.yticks(fontsize=16)
  233. # plt.xlim((df_hms_temp[0]-datetime.timedelta(minutes=5)).dt.time,(df_hms_temp[0] + datetime.timedelta(hours=1.5)).dt.time)
  234. # plt.ylim(-2.5,0.5)
  235. plt.title(title, fontsize=20)
  236. # plt.show()
  237. plt.savefig(r'D:\Work\Code_write\data_analyze_platform\USER\lzx\01算法开发\02析锂检测\01下载数据\格林美-Catl7255\析锂分析画图\析锂微分电压曲线\\'+title+'前.png', dpi=300)
  238. for i in range(0,m_num):
  239. fig = plt.figure(figsize=(20,10))
  240. df_fig_temp = df_fig_dvdtdata.loc[df_fig_dvdtdata['chrgr_rest'] == i]
  241. df_fig_temp = df_fig_temp.reset_index(drop=True)
  242. df_fig = df_fig_temp.loc[df_fig_temp['时间戳'] < (df_fig_temp['时间戳'][0] + datetime.timedelta(hours=1))]
  243. length = len(df_fig)
  244. df_hms_temp = pd.to_datetime(df_fig['时间戳'])#转换时间格式
  245. df_hms = df_hms_temp.dt.time#仅保留时分秒
  246. df_hms_fig = df_hms.apply(lambda x:x.strftime('%H:%M:%S'))
  247. for volt_num in cellvolt_name[10:21]:
  248. # plt.scatter([x for x in range(0, length)], df_fig[volt_num][0:length], label=volt_num)
  249. plt.plot(df_hms_fig, df_fig[volt_num],linewidth = 2, linestyle = '-', marker = 's',label=volt_num)
  250. mpl.rcParams['font.sans-serif']=['KaiTi']
  251. mpl.rcParams['axes.unicode_minus']=False #用来正常显示负号
  252. plt.legend()
  253. temp = file.split('\\')
  254. sn_name = temp[-1].split('.')[0]
  255. title = sn_name + '-' + df_fig['时间戳'][0].strftime('%y-%m-%d')#df_fig['device_id'][0] + '-' +
  256. plt.xlabel('时间', fontsize=16)
  257. plt.ylabel('电压的时间微分(mv/min)', fontsize=16)
  258. plt.xticks(range(1,len(df_hms_fig),5),rotation=45, fontsize=16)
  259. plt.yticks(fontsize=16)
  260. # plt.xlim((df_hms_temp[0]-datetime.timedelta(minutes=5)).dt.time,(df_hms_temp[0] + datetime.timedelta(hours=1.5)).dt.time)
  261. # plt.ylim(-2.5,0.5)
  262. plt.title(title, fontsize=20)
  263. # plt.show()
  264. plt.savefig(r'D:\Work\Code_write\data_analyze_platform\USER\lzx\01算法开发\02析锂检测\01下载数据\格林美-Catl7255\析锂分析画图\析锂微分电压曲线\\'+title+'后.png', dpi=300)
  265. #-------------------------------------原始电压变化曲线-------------------------------------------------
  266. fig = plt.figure(figsize=(20,15))
  267. for i in range(0,m_num):#0,k
  268. # fig = plt.figure(figsize=(20,10))
  269. df_fig = df_fig_voltdata.loc[df_fig_voltdata['chrgr_rest'] == i]
  270. df_fig = df_fig.reset_index(drop=True)
  271. length = len(df_fig)
  272. temp = file.split('\\')
  273. sn_name = temp[-1].split('.')[0]
  274. title = sn_name + '-' + df_fig['时间戳'][0].strftime('%y-%m-%d')#df_fig['device_id'][0] + '-' +
  275. plt_data_len = len(df_fig)
  276. # for volt_num in cellvolt_name[5:6]:
  277. # plt.scatter([x for x in range(0, length)], df_fig[volt_num][0:length], label=volt_num)
  278. # plt.plot([x for x in range(0, plt_data_len)], df_fig[cellvolt_name[5]],linewidth = 2, linestyle = '-', marker = 's',label = title)
  279. plt.plot([x for x in range(0, plt_data_len)], df_fig[cellvolt_name[2]],linewidth = 2, linestyle = '-', marker = 's',label = title)
  280. # plt.plot(df_fig['时间戳'], df_fig[cellvolt_name[5]],linewidth = 2, linestyle = '-', marker = 's',label = title)#cellvolt_name[5]
  281. mpl.rcParams['font.sans-serif']=['KaiTi']
  282. mpl.rcParams['axes.unicode_minus']=False #用来正常显示负号
  283. plt.legend(fontsize=24)
  284. plt.xlabel('采样点', fontsize=24)
  285. plt.ylabel('电压(mV)', fontsize=24)
  286. plt.xticks(fontsize=20)
  287. plt.yticks(fontsize=20)
  288. # plt.xlim(df_fig['时间戳'][0]-datetime.timedelta(minutes=5),df_fig['时间戳'][0] + datetime.timedelta(hours=1.5))
  289. # plt.xlim(0, 30)
  290. # plt.ylim(4120, 4200)
  291. # plt.ylim(-2.5,0.5)
  292. plt.title('3#电芯不同时刻电压曲线', fontsize=30)
  293. plt.savefig(r'D:\Work\Code_write\data_analyze_platform\USER\lzx\01算法开发\02析锂检测\01下载数据\格林美-Catl7255\析锂分析画图\充电后静置电压曲线\\'+'3#电芯不同时刻电压曲线'+'.png', dpi=300)
  294. # # plt.show()
  295. # fig = plt.figure(figsize=(20,10))
  296. # for i in range(3,4):#0,k
  297. # # fig = plt.figure(figsize=(20,10))
  298. # df_fig = df_rest_volt_diffdt.loc[df_rest_volt_diffdt['chrgr_rest'] == i]
  299. # df_fig = df_fig.reset_index(drop=True)
  300. # length = len(df_fig)
  301. # temp = file.split('\\')
  302. # sn_name = temp[9].split('.')[0]
  303. # title = sn_name + '-' + df_fig['时间戳'][0].strftime('%y-%m-%d')#df_fig['device_id'][0] + '-' +
  304. # plt_data_len = len(df_fig)
  305. # # for volt_num in cellvolt_name[5:6]:
  306. # # plt.scatter([x for x in range(0, length)], df_fig[volt_num][0:length], label=volt_num)
  307. # # plt.plot([x for x in range(0, plt_data_len)], df_fig[cellvolt_name[5]],linewidth = 2, linestyle = '-', marker = 's',label = title)
  308. # # plt.plot([x for x in range(0, plt_data_len)], df_fig[cellvolt_name[2]],linewidth = 2, linestyle = '-', marker = 's',label = title)
  309. # plt.plot(df_fig['时间戳'], df_fig[cellvolt_name[5]],linewidth = 2, linestyle = '-', marker = 's',label = cellvolt_name[5])
  310. # mpl.rcParams['font.sans-serif']=['SimHei']
  311. # mpl.rcParams['axes.unicode_minus']=False #用来正常显示负号
  312. # plt.legend()
  313. # plt.xlabel('采样点', fontsize=14)
  314. # plt.ylabel('电压的时间微分(mv/min)', fontsize=14)
  315. # plt.xlim(df_fig['时间戳'][0]-datetime.timedelta(minutes=5),df_fig['时间戳'][0] + datetime.timedelta(hours=5))
  316. # # plt.xlim(0, 60)
  317. # # plt.ylim(-2.5,0.5)
  318. # plt.title('6#电芯不同时间电压微分曲线')
  319. # plt.savefig(r'D:\Work\Code_write\data_analyze_platform\USER\lzx\01算法开发\02析锂检测\01下载数据\MGMCLN750N215N049\\'+'6#电芯析锂'+'.png', dpi=300)
  320. # plt.show()