Closed TomTranter closed 1 year ago
Steps to reproduce:
import liionpack as lp
import pybamm
import numpy as np
import matplotlib.pyplot as plt
lp.set_logging_level('NOTICE')
# Define parameters
Np = 2
Ns = 1
# Generate the netlist
netlist = lp.setup_circuit(Np=Np, Ns=Ns)
# Define a cycling experiment using PyBaMM
experiment = pybamm.Experiment([
'Charge at 2 A for 2 minutes',
'Rest for 2 minutes',
'Discharge at 1 A for 2 minutes',
'Rest for 2 minutes'
],
period='10 seconds')
# Define the PyBaMM parameters
parameter_values = pybamm.ParameterValues("Chen2020")
# Solve the pack
output = lp.solve(netlist=netlist,
parameter_values=parameter_values,
experiment=experiment,
initial_soc=0.5,
manager='casadi')
sum_cell = np.sum(output['Cell current [A]'], axis=1)
pack = output['Pack current [A]']
diff = sum_cell - pack
if np.any(np.abs(diff)>0.001):
print('Differences in pack and cell current')
print('Time steps', np.argwhere(np.abs(diff)>0.001).flatten())
print(diff[np.abs(diff)>0.001])
plt.figure()
plt.plot(pack)
plt.plot(sum_cell)
Discussed in https://github.com/pybamm-team/liionpack/discussions/242