Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Very large differences between cell and pack currents using Equivalent Circuit model #244

Closed
TomTranter opened this issue Mar 31, 2023 Discussed in #242 · 1 comment · Fixed by #245
Closed

Very large differences between cell and pack currents using Equivalent Circuit model #244

TomTranter opened this issue Mar 31, 2023 Discussed in #242 · 1 comment · Fixed by #245
Assignees
Labels
bug Something isn't working

Comments

@TomTranter
Copy link
Collaborator

Discussed in #242

Originally posted by MustafaDragonborne March 31, 2023
image

image

I simulated a simple 2p1s configuration using the ECM (not sure if the problem is ECM specific) but I see that the difference between the accumulated cell currents and the total pack current is too large. Sometimes, the pack current is much higher than the accumulated cell currents as is evident from the last graph (Pack current - accumulated cell currents) which means there is alot of extra current coming in.

This is because of the fact that the cell currents are displaced one step forward which cause the error. This difference becomes negligible if the cell currents are moved one step back with respect to the pack current. This is a bug that needs to be fixed.

image

@TomTranter TomTranter self-assigned this Mar 31, 2023
@TomTranter TomTranter added the bug Something isn't working label Mar 31, 2023
@TomTranter
Copy link
Collaborator Author

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)

@TomTranter TomTranter linked a pull request Mar 31, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant