基于卷积神经网络的锂电池老化模式分析
锂离子电池在现代社会无处不在,存在于储能系统、电动汽车、便携式电子产品等许多应用中。因此,为了实现锂离子电池系统的安全可靠使用,诊断和预防已变得至关重要。在人工智能领域,深度学习算法在图像或对象识别方面取得了重大影响,然而它们在电池诊断方面的应用还处于初级发展阶段。在本notebook中展示了一种基于将电池数据表示为图像的电池退化诊断方法,以利用成熟的卷积神经网络,通过合成的数据集的电压信号,定量分析出不同情况下电池的老化模式。notebook内容改编搬运自GitHub,参考论文Costa el al.
锂离子电池中的退化是电池内部复杂的物理化学机制相互作用的结果,导致容量和功率的衰减。退化取决于使用路径,不同的使用条件(例如温度、载流、工作周期、放电深度、截止电压等)可能抑制或加剧特定的退化机制。退化机制包括SEI增长和分解、粘结剂分解、天然石墨剥落或结晶隔离,尽管退化机制起源和性质各异,但它们对电化学响应的影响仅有有限的几种。这些广泛的退化机制可以归类为几种退化模式,即活性锂损失(LLI)、负极和正极(NE和PE)的活性材料损失(LAM)以及动力学变化。
LLI通常是退化的主要来源,是由寄生反应消耗锂引起的,几乎总是完全导致容量衰减,并且它可以在半电池配置中建模为负极的“滑移”,相反,LAM的问题需要分解到电极或者混合物的水平,并且是由于用于脱嵌锂的活性物质量改变导致的。LAM通常在初期不会在石墨基电池中直接导致容量损失,因此它们可以称为“静音”或“隐藏”模式。这是因为锂电池会在全电池电压窗口之外为每个电极提供过剩的相对容量。
notebook中提到的方法流程如下所示:在预处理步骤中, IC曲线被输入到DTW算法中,并且计算了计算它们的图像表示。随后,经过处理的 IC 图像由一个 CNN 处理,数值化地量化每种退化模式的百分比。IC曲线图不能直接使用来预测老化机制,因为它们没有包含足够的像素点。在我们的图像中,形状、对称性和颜色的变化都反映了IC曲线的变化。
安装需要使用的python包
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
载入需要的环境
2023-09-01 13:30:57.405409: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 AVX512F FMA To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. 2023-09-01 13:31:00.736202: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/mpi/gcc/openmpi-4.1.0rc5/lib:/usr/local/nccl-rdma-sharp-plugins/lib:/usr/local/nvidia/lib64:/usr/local/cuda/lib64:/usr/local/nvidia/lib:/usr/local/nvidia/lib64 2023-09-01 13:31:00.737928: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/mpi/gcc/openmpi-4.1.0rc5/lib:/usr/local/nccl-rdma-sharp-plugins/lib:/usr/local/nvidia/lib64:/usr/local/cuda/lib64:/usr/local/nvidia/lib:/usr/local/nvidia/lib64 2023-09-01 13:31:00.737942: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.
载入数据:本案例中使用的数据分辨率为电压窗口上1001个点。为了减少计算图像的时间,使用Scipy Pchip 插值器进行1D单调立方插值,将分辨率下采样到每条IC曲线2.3 mV一个点。这保留了感兴趣的主要特征,同时限制了文件大小。因此,生成的图像都是128 x 128像素。dtaidistance包用于计算DTW矩阵。
选取一个样本的fresh电压和老化电压曲线绘制对比,y_test中包含了各类退化模式的百分比。
绘制IC曲线,IC曲线包含的是容量对于电压的微分,同样对比fresh和老化之后的IC曲线,此处生产IC曲线用到的函数包含在数据集中的utils中。也可以直接下载数据集中的文件进行阅读。
可以发现老化之后的电池IC曲线和fresh状态下存在明显区别,并且不同老化模式对IC曲线的影响也是不同的。
进一步我们通过DTW算法(一种动态时间规整算法,计算2个时间序列尤其是不同长度序列相似度的一种动态规划算法)来计算老化IC曲线和fresh电池IC曲线的相似性,并且保留完整的图像作为后续训练的输入。图像中包含的信息,比单纯对比IC曲线更加丰富,原因就是IC曲线的分辨率经常是不足的,直接对比的效果差,而图像中形状、对称性和颜色的变化都反映了IC曲线的变化。
展示了相关的数据生产方法,进一步我们定义网络结构并进行训练预测
为了作为对比,增加没有使用DTW图像数据,而是直接使用IC曲线进行训练的随机森林(RF),一维卷积神经网络(1DConv),前馈神经网络(FFN)作为对比。 同样给出这几种模型的建模:
这里,我们导入已经训练好的模型,对四种模型的效果进行比较,选择LFP的结果作为展示
对比三个测试集中的同一个cycle的电压曲线和IC曲线,可以发现IC曲线中的差异更加明显,比直接从电压曲线中更容易读取到信息。
把测试数据进行处理,把老化模型的百分比除以100
载入已经训练好的模型
对比四种方法的计算结果,这里的误差采用的是 RMSPE,对比四种方法,可以发现通过图像处理方法得到的结果更加准确,这里分别三个测试集中10 50 100 200 400 1000圈的老化模式误差。
前馈神经网络效果 32/32 [==============================] - 3s 1ms/step 32/32 [==============================] - 0s 994us/step 32/32 [==============================] - 0s 1ms/step 32/32 [==============================] - 0s 992us/step 32/32 [==============================] - 0s 1ms/step 32/32 [==============================] - 0s 978us/step
10 | 50 | 100 | 200 | 400 | 1000 | |
---|---|---|---|---|---|---|
LLI | 1.897387 | 1.937746 | 2.004652 | 1.820727 | 1.672401 | 3.916146 |
LAMPE | 2.533826 | 2.903455 | 3.098659 | 3.285527 | 3.583621 | 11.118142 |
LAMNE | 2.303765 | 2.328016 | 2.321713 | 2.103640 | 2.159654 | 6.319308 |
32/32 [==============================] - 0s 982us/step 32/32 [==============================] - 0s 1ms/step 32/32 [==============================] - 0s 1ms/step 32/32 [==============================] - 0s 1ms/step 32/32 [==============================] - 0s 995us/step 32/32 [==============================] - 0s 999us/step
10 | 50 | 100 | 200 | 400 | 1000 | |
---|---|---|---|---|---|---|
LLI | 2.065159 | 2.166341 | 2.234196 | 1.811591 | 1.558170 | 3.679649 |
LAMPE | 3.302189 | 2.941345 | 2.948705 | 2.735348 | 3.465126 | 11.320684 |
LAMNE | 3.413675 | 3.294413 | 3.289093 | 2.778901 | 2.350682 | 6.191302 |
32/32 [==============================] - 0s 1ms/step 32/32 [==============================] - 0s 964us/step 32/32 [==============================] - 0s 1ms/step 32/32 [==============================] - 0s 1ms/step 32/32 [==============================] - 0s 1ms/step 32/32 [==============================] - 0s 993us/step
10 | 50 | 100 | 200 | 400 | 1000 | |
---|---|---|---|---|---|---|
LLI | 1.451380 | 1.931783 | 1.889350 | 1.684941 | 1.733579 | 4.029704 |
LAMPE | 2.272202 | 3.145732 | 3.404698 | 3.524636 | 3.784330 | 11.310487 |
LAMNE | 3.047855 | 3.068851 | 2.984352 | 2.648277 | 2.443733 | 6.378585 |
随机森林效果
10 | 50 | 100 | 200 | 400 | 1000 | |
---|---|---|---|---|---|---|
LLI | 6.326812 | 5.696067 | 4.940409 | 3.629421 | 3.233855 | 9.211487 |
LAMPE | 5.896490 | 5.132423 | 4.262228 | 3.153127 | 5.164388 | 9.136563 |
LAMNE | 7.002441 | 6.064502 | 5.020779 | 3.820403 | 6.249853 | 11.837801 |
10 | 50 | 100 | 200 | 400 | 1000 | |
---|---|---|---|---|---|---|
LLI | 6.326812 | 5.696067 | 4.940409 | 3.642654 | 3.148818 | 9.222205 |
LAMPE | 5.896490 | 5.132423 | 4.262228 | 3.172645 | 4.971949 | 9.793606 |
LAMNE | 7.002441 | 6.064502 | 5.020779 | 3.826087 | 6.381696 | 11.558122 |
10 | 50 | 100 | 200 | 400 | 1000 | |
---|---|---|---|---|---|---|
LLI | 6.326812 | 5.696067 | 4.940409 | 3.629421 | 3.201966 | 9.135190 |
LAMPE | 5.896490 | 5.132423 | 4.262228 | 3.153127 | 5.071271 | 9.375053 |
LAMNE | 7.002441 | 6.064502 | 5.020779 | 3.820403 | 6.185985 | 11.665670 |
1维卷积神经网络效果 32/32 [==============================] - 3s 2ms/step 32/32 [==============================] - 0s 1ms/step 32/32 [==============================] - 0s 1ms/step 32/32 [==============================] - 0s 1ms/step 32/32 [==============================] - 0s 1ms/step 32/32 [==============================] - 0s 1ms/step
10 | 50 | 100 | 200 | 400 | 1000 | |
---|---|---|---|---|---|---|
LLI | 1.180207 | 0.951203 | 0.733230 | 1.065123 | 1.689569 | 3.216216 |
LAMPE | 1.901536 | 1.238536 | 1.805411 | 2.801487 | 3.385905 | 10.737504 |
LAMNE | 1.182501 | 1.336198 | 1.271987 | 1.719756 | 2.833926 | 6.605925 |
32/32 [==============================] - 0s 1ms/step 32/32 [==============================] - 0s 1ms/step 32/32 [==============================] - 0s 1ms/step 32/32 [==============================] - 0s 1ms/step 32/32 [==============================] - 0s 1ms/step 32/32 [==============================] - 0s 1ms/step
10 | 50 | 100 | 200 | 400 | 1000 | |
---|---|---|---|---|---|---|
LLI | 0.630394 | 0.596814 | 0.860183 | 1.113128 | 1.621577 | 3.155063 |
LAMPE | 0.418775 | 1.289180 | 2.760916 | 2.629114 | 3.504883 | 10.856303 |
LAMNE | 2.050357 | 1.832850 | 2.030776 | 2.364678 | 2.864635 | 6.581639 |
32/32 [==============================] - 0s 1ms/step 32/32 [==============================] - 0s 1ms/step 32/32 [==============================] - 0s 1ms/step 32/32 [==============================] - 0s 1ms/step 32/32 [==============================] - 0s 1ms/step 32/32 [==============================] - 0s 1ms/step
10 | 50 | 100 | 200 | 400 | 1000 | |
---|---|---|---|---|---|---|
LLI | 1.950258 | 0.899970 | 0.604320 | 0.969911 | 1.752042 | 3.351155 |
LAMPE | 2.085785 | 1.158399 | 2.012011 | 2.957312 | 3.447961 | 10.860979 |
LAMNE | 2.867555 | 1.979411 | 1.591946 | 2.074956 | 2.930548 | 6.616024 |
DTW图像的卷积神经网络效果 32/32 [==============================] - 0s 5ms/step 32/32 [==============================] - 0s 3ms/step 32/32 [==============================] - 0s 3ms/step 32/32 [==============================] - 0s 3ms/step 32/32 [==============================] - 0s 3ms/step 32/32 [==============================] - 0s 3ms/step
10 | 50 | 100 | 200 | 400 | 1000 | |
---|---|---|---|---|---|---|
LLI | 0.147196 | 0.533658 | 0.728286 | 1.161802 | 1.312177 | 2.474985 |
LAMPE | 0.968427 | 0.983055 | 1.826342 | 2.673091 | 3.591306 | 8.643712 |
LAMNE | 0.177229 | 0.706995 | 1.408830 | 1.984942 | 1.932054 | 3.867265 |
32/32 [==============================] - 0s 3ms/step 32/32 [==============================] - 0s 3ms/step 32/32 [==============================] - 0s 3ms/step 32/32 [==============================] - 0s 3ms/step 32/32 [==============================] - 0s 3ms/step 32/32 [==============================] - 0s 3ms/step
10 | 50 | 100 | 200 | 400 | 1000 | |
---|---|---|---|---|---|---|
LLI | 0.449007 | 0.842166 | 0.916717 | 1.186618 | 1.325559 | 2.155543 |
LAMPE | 0.785202 | 2.067853 | 2.765923 | 3.220182 | 3.926521 | 8.893262 |
LAMNE | 0.216501 | 0.574732 | 0.800012 | 1.117781 | 1.418099 | 4.011069 |
32/32 [==============================] - 0s 3ms/step 32/32 [==============================] - 0s 3ms/step 32/32 [==============================] - 0s 3ms/step 32/32 [==============================] - 0s 3ms/step 32/32 [==============================] - 0s 3ms/step 32/32 [==============================] - 0s 3ms/step
10 | 50 | 100 | 200 | 400 | 1000 | |
---|---|---|---|---|---|---|
LLI | 0.800950 | 0.568149 | 0.565061 | 0.953905 | 1.120238 | 2.588985 |
LAMPE | 2.309712 | 1.322498 | 2.038502 | 2.723597 | 3.678208 | 8.632853 |
LAMNE | 0.599812 | 0.553767 | 1.003389 | 1.433580 | 1.640688 | 3.940037 |