Bohrium
robot
新建

空间站广场

论文
Notebooks
比赛
课程
Apps
我的主页
我的Notebooks
我的论文库
我的足迹

我的工作空间

任务
节点
文件
数据集
镜像
项目
数据库
公开
AI+电芯 | 充电数据曲线预测电池阻抗谱
AI
锂电池
EIS
AI锂电池EIS
JiaweiMiao
发布于 2023-08-24
推荐镜像 :Third-party software:d2l-ai:pytorch
推荐机型 :c12_m46_1 * NVIDIA GPU B
赞 4
16
EIS_public(v3)

AI+电芯 | 使用部分充电数据曲线预测电池阻抗谱

代码
文本

快速开始:点击上方的 开始连接 按钮,选择 d2l-ai:pytorch镜像 和任意GPU配置机型即可开始。

代码
文本
代码
文本

背景

代码
文本

锂离子电池(LIB)具有能量密度高、使用寿命长、环境友好等优点,广泛应用于电动汽车和便携式电子设备中。 然而,锂离子电池的老化对存储和使用过程中的安全性提出了巨大的挑战,这促使了电池预测技术的发展和应用。**电化学阻抗谱(EIS)**可用于呈现电池健康状态、电池内部阻抗以及锂离子(Li-ions)的动态扩散等。

EIS(electrochemical impedence spectroscopy, EIS)。它是在电化学电池处于平衡状态下(开路状态)或者某一稳定的直流极化条件下,按照正弦规律施加小幅度交流信号,研究电化学的交流阻抗随频率的变化关系的一种方法。广泛应用于锂离子电池、钠离子电池、燃料电池和腐蚀防护等领域,是一种常用的电化学检测手段,用于分析电极过程动力学、双电层和扩散等。

EIS1.png

其原理可以直观地从上图获得:通过波形发生器产生小幅正弦电势信号,再通过恒电位仪施加到电化学系统上。将输出的电势/电流信号经过转换,最后利用锁相放大器、频谱分析仪输出阻抗模量、相位角~频率关系等(正弦波的频率不断变化)。我们可以将电化学系统看作是一个等效电路。该电路由电阻(R)、电感(L)、和电容(C)等通过串并联的方式组成。利用EIS的结果可以分析出各个等效电路原件的阻抗值等大小,并分析其含义,有助于测试者对所测的电化学系统做出判断(电化学系统的结构和电极过程的性质),或进行结果的得出或电化学系统的改进。奈奎斯特图(Nyquist plot)是一种常见的阻抗谱表现形式,如下图所示。

EIS2.png

EIS已广泛用于识别等效电路模型(ECM) 的参数,以支持电池状态的估计,例如电池内部阻抗、充电状态(SOC) 和健康状况(SOH)等。 充电状态(SOC)是指蓄电池使用一段时间或长期搁置不用后的剩余容量与其完全充电状态的容量的比值,常用百分数表示。其取值范围为0~1,当SOC=0时表示电池放电完全,当SOC=1时表示电池完全充满。健康状况(SOH)是表征电池老化程度与健康状况的关键指标,其通常定义为当前可用最大容量与出厂额定容量之间的比值。随着电池老化程度的加深,SOH逐渐降低,在SOH下降到80%时,电池衰减至寿命终止。对于SOC的估计和SOH的预测也是AI+电芯的重要研究课题。

ECM模型的参数已被证明与电池老化状态具有高度相关性。因此,机器学习已被用来开发算法来估计SOH并通过输入整个 EIS 曲线或从 EIS 曲线中提取特征来预测电池的寿命。 此外,EIS结果可以赋予电池内部更多的物理老化意义,例如锂离子的扩散、界面阻抗的形成和欧姆阻抗。 然而,由于测量设备成本高、测试结果受SOC和温度变化的影响以及测量时间要求高,EIS测量的实施受到阻碍。 这些限制阻碍了基于EIS的在线电池健康预测方法的开发。因此,EIS的预测对于为电池健康预测提供阻抗信息至关重要。

通过可测量参数进行EIS准确预测有助于发展和推广基于EIS的先进预测方法并显着降低成本。已经有一些工作使用完整的电池充电数据基于机器学习实现了准确的阻抗谱预测1,均方根误差(RMSE)小于1.862 mΩ。 这种有前景的预测方法可以准确估计阻抗谱,并为基于 EIS 的实时电池状态估计和健康预测提供可能性。

这个Notebook通过电池充电曲线预测阻抗谱,基于序列到序列的预测,采用Encoder-Decoder机器学习算法来验证所提出的框架。

本文的算例模型与代码实现方法来自论文[2]2 [3]3,数据来自公开数据集4。值得一提的是,公开数据集的EIS分布并非按常见的SOC排序,而且在一个充放电流程中选取不同的时间点进行收集数据(见下图I 到 IX)。而由于数据集中有些数据EIS存在异常点,因此我们这里只选用其中的部分进行训练和预测。

EIS pic.png

背景参考

代码
文本

实践

代码
文本
[1]
!pip install ipython-autotime

%load_ext autotime
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting ipython-autotime
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/b4/c9/b413a24f759641bc27ef98c144b590023c8038dfb8a3f09e713e9dff12c1/ipython_autotime-0.3.1-py2.py3-none-any.whl (6.8 kB)
Requirement already satisfied: ipython in /opt/miniconda/lib/python3.7/site-packages (from ipython-autotime) (7.34.0)
Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/miniconda/lib/python3.7/site-packages (from ipython->ipython-autotime) (3.0.31)
Requirement already satisfied: pygments in /opt/miniconda/lib/python3.7/site-packages (from ipython->ipython-autotime) (2.13.0)
Requirement already satisfied: traitlets>=4.2 in /opt/miniconda/lib/python3.7/site-packages (from ipython->ipython-autotime) (5.5.0)
Requirement already satisfied: pickleshare in /opt/miniconda/lib/python3.7/site-packages (from ipython->ipython-autotime) (0.7.5)
Requirement already satisfied: backcall in /opt/miniconda/lib/python3.7/site-packages (from ipython->ipython-autotime) (0.2.0)
Requirement already satisfied: pexpect>4.3 in /opt/miniconda/lib/python3.7/site-packages (from ipython->ipython-autotime) (4.8.0)
Requirement already satisfied: matplotlib-inline in /opt/miniconda/lib/python3.7/site-packages (from ipython->ipython-autotime) (0.1.6)
Requirement already satisfied: jedi>=0.16 in /opt/miniconda/lib/python3.7/site-packages (from ipython->ipython-autotime) (0.18.1)
Requirement already satisfied: setuptools>=18.5 in /opt/miniconda/lib/python3.7/site-packages (from ipython->ipython-autotime) (61.2.0)
Requirement already satisfied: decorator in /opt/miniconda/lib/python3.7/site-packages (from ipython->ipython-autotime) (5.1.1)
Requirement already satisfied: parso<0.9.0,>=0.8.0 in /opt/miniconda/lib/python3.7/site-packages (from jedi>=0.16->ipython->ipython-autotime) (0.8.3)
Requirement already satisfied: ptyprocess>=0.5 in /opt/miniconda/lib/python3.7/site-packages (from pexpect>4.3->ipython->ipython-autotime) (0.7.0)
Requirement already satisfied: wcwidth in /opt/miniconda/lib/python3.7/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython->ipython-autotime) (0.2.5)
Installing collected packages: ipython-autotime
Successfully installed ipython-autotime-0.3.1
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
time: 444 µs (started: 2023-09-06 10:33:12 +08:00)
代码
文本

加载pytorch、数据处理和画图的package

代码
文本
[2]
import torch
import torch.nn as nn
import torch.optim as optim
from torch.nn.utils.rnn import pad_sequence
import torch.nn.functional as F
import random
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
time: 3.83 s (started: 2023-09-06 10:33:12 +08:00)
代码
文本

设置随机数种子,确保每次训练和测试的结果一致。

代码
文本
[3]
#seed = 42
#torch.manual_seed(seed)
#np.random.seed(seed)
#random.seed(seed)
#if torch.cuda.is_available():
#torch.cuda.manual_seed(seed)
#torch.cuda.manual_seed_all(seed)
#torch.backends.cudnn.deterministic = True
#torch.backends.cudnn.benchmark = False
time: 418 µs (started: 2023-09-06 10:33:16 +08:00)
代码
文本

接下来我们需要定义encoder的部分。在这里,我们定义了一个 LSTM 层,其输入维度为 1,隐藏状态维度为 256

代码
文本
[4]
# define encoder
class Encoder(nn.Module):
def __init__(self):
super(Encoder, self).__init__()
self.lstm = nn.LSTM(1, 256, batch_first=True, num_layers=2, dropout=0.5)

def forward(self, x):
_, (h_n, c_n) = self.lstm(x)
return h_n, c_n
time: 816 µs (started: 2023-09-06 10:33:16 +08:00)
代码
文本

然后是decoder的部分。在这里,我们定义了一个 LSTM 层,其输入维度为 2,隐藏状态维度为 256。然后,我们定义了一个全连接层,输入维度为 256(与 LSTM 的隐藏状态维度相同),输出维度为 2。输入输出维度由target数据的维度决定。

代码
文本
[5]
# define decoder
class Decoder(nn.Module):
def __init__(self):
super(Decoder, self).__init__()
self.lstm = nn.LSTM(2, 256, batch_first=True, num_layers=2)
self.dense = nn.Linear(256, 2)

def forward(self, x, hidden):
x, _ = self.lstm(x, hidden)
x = self.dense(x)
return x
time: 774 µs (started: 2023-09-06 10:33:16 +08:00)
代码
文本

然后Encoder-Decoder类。

代码
文本
[6]
# define Encoder-Decoder model
class EncoderDecoder(nn.Module):
def __init__(self, encoder, decoder):
super(EncoderDecoder, self).__init__()
self.encoder = encoder
self.decoder = decoder

def forward(self, encoder_input, decoder_input, use_teacher_forcing):
hidden = self.encoder(encoder_input)

if use_teacher_forcing:
output = self.decoder(decoder_input, hidden)
else:
batch_size, seq_len, _ = decoder_input.size()
output = torch.zeros_like(decoder_input)

decoder_input_t = decoder_input[:, 0, :]
for t in range(seq_len):
decoder_output_t = self.decoder(decoder_input_t.unsqueeze(1), hidden)
output[:, t, :] = decoder_output_t.squeeze(1)
decoder_input_t = decoder_output_t.squeeze(1)

return output
#def forward(self, encoder_input, decoder_input):
# hidden = self.encoder(encoder_input)
# output = self.decoder(decoder_input, hidden)
# return output
time: 1.27 ms (started: 2023-09-06 10:33:16 +08:00)
代码
文本

将定义好的encoder和decoder类组合成一个Encoder-Decoder模型。

代码
文本
[7]
# build model
encoder = Encoder()
decoder = Decoder()
model = EncoderDecoder(encoder, decoder)
print(model)
EncoderDecoder(
  (encoder): Encoder(
    (lstm): LSTM(1, 256, num_layers=2, batch_first=True, dropout=0.5)
  )
  (decoder): Decoder(
    (lstm): LSTM(2, 256, num_layers=2, batch_first=True)
    (dense): Linear(in_features=256, out_features=2, bias=True)
  )
)
time: 38.2 ms (started: 2023-09-06 10:33:16 +08:00)
代码
文本
[8]
def split_list_by_value(lst):
result = []
temp = []
for i in range(len(lst)):
if lst[i] != 0:
temp.append(lst[i])
if i == len(lst)-1 or lst[i] != lst[i+1]:
result.append(temp)
temp = []
return result

def split_list_by_lengths(lst, lengths):
result = []
start = 0
for length in lengths:
result.append(lst[start:start+length])
start += length
return result
time: 981 µs (started: 2023-09-06 10:33:16 +08:00)
代码
文本

这里输入充电数据的格式为[585,1],输出EIS的格式为[240,2] 一共八百零三组数据

代码
文本
[9]
# prepare input data
start_symbol = 0
end_symbol = 1
total_num = 803
train_size = 700
test_size = 103

# encoder input data
CC_input = []
cyc_len = []
baty_lst = [2,3,4,6,7,8]
for i in baty_lst:
CC_data = pd.read_csv(f"/bohr/eisp-q8by/v3/excel_0824/Data_Capacity_25C0{i}.csv")
cycle_num = CC_data.iloc[:,1:2]["cycle_number"].tolist()
vol_all = CC_data.iloc[:,3:4]['Ewe/V'].tolist()
cyc = split_list_by_value(cycle_num)
if i == 7:
cyc = cyc[:-7]
cyc_len.append(len(cyc))
lengths = [len(sublist) for sublist in cyc]
vol_list = split_list_by_lengths(vol_all, lengths)
tensor_vol = [torch.tensor(sublist) for sublist in vol_list]
padded_vol = pad_sequence(tensor_vol, batch_first=True, padding_value=0)
#print(padded_vol.shape)
new_vol = [t[:585].view(1, 585, 1) for t in padded_vol]
CC_input += new_vol
print(len(CC_input),cyc_len)

# 随机打乱索引
indices = list(range(len(CC_input)))
random.shuffle(indices)

# 将索引分为训练集和测试集
train_indices = indices[:train_size]
test_indices = indices[train_size:]

# 从CC_input中提取训练集和测试集
encoder_input_train = [CC_input[i] for i in train_indices]
encoder_input_test = [CC_input[i] for i in test_indices]
803 [180, 201, 34, 212, 140, 36]
time: 619 ms (started: 2023-09-06 10:33:16 +08:00)
代码
文本
[10]
# decoder data
decoder_input = []
decoder_target = []
cyc_tot = 0
EIS_list = [[[0 for i in range(240)] for j in range(2)] for r in range(803)]
lst = [1,4,5,9]
for k in baty_lst:
EIS_tot = []
for i in lst:
EIS = pd.read_csv(f"/bohr/eisp-q8by/v3/excel_0824/EIS_state_{i}_25C0{k}.csv")
cyc_n = cyc_len[baty_lst.index(k)]
#print(cyc_n)
EIS_tot.append(EIS.iloc[:,3:7]["Re(Z)/Ohm"].tolist()[0:60*cyc_n])
EIS_tot.append(EIS.iloc[:,4:7]["-Im(Z)/Ohm"].tolist()[0:60*cyc_n])
cyc_tot += cyc_n
EIS_totm = [[e2 for e2 in e1] for e1 in EIS_tot]
print(np.array(EIS_totm).shape,cyc_tot)
lengths = [60 for i in range(cyc_n)]
#print(lengths)
for i in range(4):
EIS_R = split_list_by_lengths(EIS_totm[2*i], lengths)
EIS_I = split_list_by_lengths(EIS_totm[2*i+1], lengths)
for j in range(cyc_tot-cyc_n,cyc_tot,1):
EIS_list[j][0][60*i:60*(i+1)] = EIS_R[j-cyc_tot+cyc_n]
EIS_list[j][1][60*i:60*(i+1)] = EIS_I[j-cyc_tot+cyc_n]
EIS_list = [np.array(t).squeeze().T for t in EIS_list]
print(np.array(EIS_list)[0].shape)

# decoder_input = [torch.tensor(np.hstack((np.full((60, 1), start_symbol), t)), dtype=torch.float32).view(10, 6, 9) for t in EIS_list]
# decoder_target = [torch.tensor(np.hstack((t, np.full((60, 1), end_symbol))), dtype=torch.float32).view(10, 6, 9) for t in EIS_list]

#decoder_input = [torch.cat([torch.zeros(1, 1, 2), torch.tensor(t).float().view(1, 240, 2)], dim=1) for t in EIS_list]
decoder_target = [torch.tensor(t).float().view(1, 240, 2) for t in EIS_list]
decoder_input = [torch.ones(1,240,2) for t in EIS_list]

decoder_input_train = [decoder_input[i] for i in train_indices]
decoder_target_train = [decoder_target[i] for i in train_indices]
decoder_input_test = [decoder_input[i] for i in test_indices]
decoder_target_test = [decoder_target[i] for i in test_indices]

print(decoder_input[0].shape)
#print(np.array(EIS_totm[1]).shape)
(8, 10800) 180
(8, 12060) 381
(8, 2040) 415
(8, 12720) 627
(8, 8400) 767
(8, 2160) 803
(240, 2)
torch.Size([1, 240, 2])
time: 510 ms (started: 2023-09-06 10:33:16 +08:00)
代码
文本

判断GPU是否可用

代码
文本
[11]
#判断GPU是否可用
if torch.cuda.is_available():
model = model.cuda()
for i in range(train_size):
encoder_input_train[i] = encoder_input_train[i].cuda()
decoder_input_train[i] = decoder_input_train[i].cuda()
decoder_target_train[i] = decoder_target_train[i].cuda()
for i in range(test_size):
encoder_input_test[i] = encoder_input_test[i].cuda()
decoder_input_test[i] = decoder_input_test[i].cuda()
decoder_target_test[i] = decoder_target_test[i].cuda()
print("CUDE = True")
CUDE = True
time: 5.6 s (started: 2023-09-06 10:33:17 +08:00)
代码
文本

定义loss function和优化器。这里我们使用均方误差和Adam优化器。因为数据量的原因,这里我们把epoch的数量设为1500,batch size设为4。

代码
文本
[12]
criterion = nn.MSELoss()
optimizer = optim.Adam(model.parameters(), lr=0.001)
num_epochs = 1500
batch_size = 4
time: 879 µs (started: 2023-09-06 10:33:23 +08:00)
代码
文本

训练过程及记录。

代码
文本
[13]
train_losses = [] # 记录每个epoch的训练损失
for epoch in range(num_epochs):
epoch_loss = 0.0
# Scheduled sampling probability
teacher_forcing_ratio = max(0.5 * (1 - epoch / num_epochs), 0.0)
#use_teacher_forcing = torch.rand(1).item() < teacher_forcing_ratio
use_teacher_forcing = True
for batch_idx in range(0, train_size, batch_size):
batch_encoder_input = torch.cat(encoder_input_train[batch_idx:batch_idx+batch_size], dim=0)
batch_decoder_input = torch.cat(decoder_input_train[batch_idx:batch_idx+batch_size], dim=0)
batch_decoder_target = torch.cat(decoder_target_train[batch_idx:batch_idx+batch_size], dim=0)

optimizer.zero_grad()
outputs = model(batch_encoder_input, batch_decoder_input, use_teacher_forcing)
loss = criterion(outputs, batch_decoder_target)
loss.backward()
optimizer.step()
epoch_loss += loss.item()
train_losses.append(epoch_loss / (train_size / batch_size))
if (epoch + 1) % 20 == 0:
mean_mse = epoch_loss / (train_size / batch_size)
rmse = mean_mse ** 0.5
print(f"Epoch [{epoch + 1}/{num_epochs}], Loss: {mean_mse:.8f}, RMSE: {rmse}")
# 绘制训练过程中loss的变化曲线
plt.plot(train_losses, label='Training loss')
plt.xlabel('Epochs')
plt.ylabel('MSE Loss')
plt.legend()
plt.show()
代码
文本
[14]
# 绘制训练过程中loss的变化曲线(对数作图)
import math
losses_log = [math.log(t) for t in train_losses]
plt.plot(losses_log, label='Training loss')
plt.xlabel('Epochs')
plt.ylabel('MSE Loss')
plt.legend()
plt.show()
代码
文本

使用测试数据集进行预测

代码
文本
[15]
# 使用测试数据进行预测
model.eval()
test_losses = []
for batch_idx in range(0, test_size, batch_size):
batch_encoder_input = torch.cat(encoder_input_test[batch_idx:batch_idx+batch_size], dim=0)
batch_decoder_input = torch.cat(decoder_input_test[batch_idx:batch_idx+batch_size], dim=0)
batch_decoder_target = torch.cat(decoder_target_test[batch_idx:batch_idx+batch_size], dim=0)

with torch.no_grad():
outputs = model(batch_encoder_input, batch_decoder_input, use_teacher_forcing)
loss = criterion(outputs, batch_decoder_target)
test_losses.append(loss.item())
mean_mse = np.mean(test_losses)
test_rmse = mean_mse ** 0.5
print(f"Test Loss: {mean_mse:.4f} Test RMSE: {test_rmse:.4f}")
Test Loss: 0.0057 Test RMSE: 0.0752
time: 522 ms (started: 2023-09-06 14:41:47 +08:00)
代码
文本

测试集预测结果与ground truth比较(4 state)

代码
文本
[16]
#prediction comparation plot
predict_outputs = outputs[0].view(1, 240, 2).tolist()
predict_data = np.array(predict_outputs).squeeze().T
decoder_target = batch_decoder_target[0].view(1, 240, 2).tolist()
target_data = np.array(decoder_target).squeeze().T

#print(predict_data[0],predict_data[1])

for i in range(4):
if i == 1:
label_p = 'Predict EIS'
label_t = 'Target EIS'
else:
label_p = None
label_t = None
plt.plot(predict_data[0][60*i:60*(i+1)],predict_data[1][60*i:60*(i+1)],'ro-',label=label_p)
plt.plot(target_data[0][60*i:60*(i+1)],target_data[1][60*i:60*(i+1)],'bo-',label=label_t)

plt.xlabel('Z_re')
plt.ylabel('Z_im')
plt.legend()
plt.show()
代码
文本

测试集预测结果与ground truth比较(每张图展示单一state下的比较结果)

代码
文本
[17]
plt.figure(figsize=(11,25))
title_name = [1,4,5,9]
for i in range(4):
label_p = 'Predict EIS'
label_t = 'Target EIS'
plt.subplot(5, 2, i+1)
plt.plot(predict_data[0][60*i:60*(i+1)],predict_data[1][60*i:60*(i+1)],'ro-',label=label_p)
plt.plot(target_data[0][60*i:60*(i+1)],target_data[1][60*i:60*(i+1)],'bo-',label=label_t)
titname = title_name[i]
plt.title(f"state {titname}")
plt.xlabel('Z_re')
plt.ylabel('Z_im')
plt.legend()
plt.show()
代码
文本

计算并绘制出测试数据集的RMSE。

代码
文本
[18]
import json

RMSE = [[],[]]
for i in range(4):
R1 = 0
R2 = 0
for j in range(len(predict_data[0][50*i:50*(i+1)])):
R1 += (predict_data[0][60*i:60*(i+1)][j] - target_data[0][60*i:60*(i+1)][j]) ** 2
R2 += (predict_data[1][60*i:60*(i+1)][j] - target_data[1][60*i:60*(i+1)][j]) ** 2

RMSE[0].append(np.sqrt(R1/len(predict_data[0][60*i:60*(i+1)])))
RMSE[1].append(np.sqrt(R2/len(predict_data[0][60*i:60*(i+1)])))

Stage_list = lst
plt.plot(Stage_list,RMSE[0],'rv-',label="Z_re")
plt.plot(Stage_list,RMSE[1],'bv-',label="Z_im")
plt.xlabel('State')
plt.ylabel('Omega')
plt.legend()
plt.savefig(f"state-rmse.png", dpi=300, bbox_inches='tight')
plt.show
代码
文本

添加平均R2 score和绘图

代码
文本
[20]
def r2_score(y_true, y_pred):
ss_total = np.sum((y_true - np.mean(y_true))**2)
ss_res = np.sum((y_true - y_pred)**2)
r2 = 1 - (ss_res / ss_total)
return r2
r2_r = 0
r2_i = 0
for i in range(4):
r2_r += r2_score(target_data[0][60*i:60*(i+1)], predict_data[0][60*i:60*(i+1)])/4
r2_i += r2_score(target_data[1][60*i:60*(i+1)], predict_data[1][60*i:60*(i+1)])/4
print(f"R2 real score:{r2_r.item():.4f}",f"R2 imaginary score:{r2_i.item():.4f}")

for i in range(4):
if i == 0:
plt.plot(target_data[0][60*i:60*(i+1)],target_data[0][60*i:60*(i+1)],'c-', linewidth=2, label='ground truth')
label_p = f'R2_real score:{r2_r:.4f}'
else:
label_p = None
plt.plot(target_data[0][60*i:60*(i+1)],predict_data[0][60*i:60*(i+1)],'mo', markerfacecolor='none', label=label_p)
plt.xlabel('real_true')
plt.ylabel('real_pred')
plt.title('Z real R2')
plt.legend()
plt.show()

for i in range(4):
if i == 0:
plt.plot(target_data[1][60*i:60*(i+1)],target_data[1][60*i:60*(i+1)],'c-', linewidth=2, label='ground truth')
label_p = f'R2_image score:{r2_i:.4f}'
else:
label_p = None
plt.plot(target_data[1][60*i:60*(i+1)],predict_data[1][60*i:60*(i+1)],'mo', markerfacecolor='none', label=label_p)
plt.xlabel('real_true')
plt.ylabel('real_pred')
plt.title('Z image R2')
plt.legend()
plt.show()
代码
文本

总结

在这篇Notebook中,我们构建了一个机器学习模型。通过输入充电曲线(电压、电流等),预测了EIS阻抗谱。从结果中可以看出,使用充电电压和电流数据,预测精度保持在一个较好的水平。在当前数据集下,这几组试验的预测误差在绝大部分情况下小于100 mΩ。这给接下来我们探索电池性质和寿命预测提供了信心。

代码
文本

参考

[1] Yanzhou Duan, Jinpeng Tian, Jiahuan Lu, Chenxu Wang, Weixiang Shen, Rui Xiong, Deep neural network battery impedance spectra prediction by only using constant-current curve, Energy Storage Materials, Volume 41, 2021, Pages 24-31, ISSN 2405-8297.
[2] Jia Guo, Yunhong Che, Kjeld Pedersen, Daniel-Ioan Stroe, Battery impedance spectrum prediction from partial charging voltage curve by machine learning, Journal of Energy Chemistry, Volume 79, 2023, Pages 211-221, ISSN 2095-4956.
[3] Jinpeng Tian, Rui Xiong, Cheng Chen, Chenxu Wang, Weixiang Shen, Fengchun Sun, Simultaneous prediction of impedance spectra and state for lithium-ion batteries from short-term pulses, Electrochimica Acta, Volume 449, 2023, 142218, ISSN 0013-4686.
[4] Zhang, Y., Tang, Q., Zhang, Y. et al. Identifying degradation patterns of lithium ion batteries from impedance spectroscopy using machine learning. Nat Commun 11, 1706 (2020).
代码
文本
[ ]

代码
文本
AI
锂电池
EIS
AI锂电池EIS
已赞4
本文被以下合集收录
电芯
Piloteye
更新于 2024-07-22
17 篇3 人关注
电池计算
微信用户70yQ
更新于 2024-09-06
8 篇1 人关注
推荐阅读
公开
AI+电芯 | 基于时间和温度的动力电池剩余寿命RUL预测
AI+电芯RUL中文
AI+电芯RUL中文
JiaweiMiao
发布于 2023-09-08
2 转存文件
公开
AI+电芯 | 基于部分无label电池数据使用深度网络模型进行SOH预测
AI电芯SOH
AI电芯SOH
JiaweiMiao
发布于 2023-08-28
1 赞2 转存文件2 评论