Assistance Required in Minimizing Error Between Experimental and SPMe Model Charging Profile

Dear PyBaMM Team,

I am currently working on comparing experimental charging profiles with the simulation results from the Single Particle Model (SPMe) in PyBaMM. Despite my efforts, I am encountering discrepancies between the two, and I would appreciate your guidance in identifying the key parameters that need to be adjusted to minimize this error.

To better illustrate the issue, I have attached the relevant code and the charging profile graph showing both the experimental and simulated data.

Could you kindly advise on which specific parameters should be fine-tuned in the SPMe model to reduce the error between the experimental and simulated charging profiles? Additionally, if there are any best practices or common adjustments that are typically effective in this context, that would be very helpful.

Thank you for your time and assistance!

model=pybamm.lithium_ion.SPMe()
parameter_values=pybamm.ParameterValues(‘Prada2013’)

parameter_values.update({
“Upper voltage cut-off [V]”: 3.6
})

parameter_values.update({
“Open-circuit voltage at 0% SOC [V]”: 2.8
})

parameter_values.update({
“Open-circuit voltage at 100% SOC [V]”: 3.6
})
parameter_values.update({
“Current function [A]”:current_interpolant
})

parameter_values.update({
“Negative particle diffusivity [m2.s-1]”:2.979E-15
})

parameter_values.update({
“Positive particle diffusivity [m2.s-1]”: 5.860E-15
})

parameter_values.update({
“Negative particle radius [m]”:15.758E-06
})

parameter_values.update({
“Positive particle radius [m]”:15.758E-08
})

parameter_values.update({
“Electrode height [m]”:5.96
})

parameter_values.update({
“Electrode width [m]”:0.9454
})

parameter_values.update({
“Initial concentration in positive electrode [mol.m-3]”: 1355
})
parameter_values.update({
“Cation transference number”: 0.24
})
parameter_values.update({
“Negative electrode charge transfer coefficient”: 0.6
})
parameter_values.update({
“Positive electrode charge transfer coefficient”: 0.6
})

parameter_values.update({
“Positive electrode porosity”: 0.55
})
parameter_values.update({
“Negative electrode porosity”: 0.5
})

def electrolyte_conductivity(c_e, T):

# convert c_e from mol/m3 to mol/L
c_e = c_e / 1e7

sigma_e = (
    4.1253e-4
    + 5.007 * c_e
    - 4721.2 * c_e**2
    + 1.5094e6 * c_e**3
    - 1.6018e8 * c_e**4
) * 1e3

return sigma_e

parameter_values.update({
“Electrolyte conductivity [S.m-1]”: electrolyte_conductivity
})

#solver = pybamm.CasadiSolver(mode=“fast”, rtol=1e-6, atol=1e-6)
sim=pybamm.Simulation(model, parameter_values=parameter_values) #(experiment=experiment)
sim.solve(initial_soc=0)
solution = sim.solution
time_model = solution[‘Time [h]’].entries*3600
voltage_model= solution[‘Terminal voltage [V]’].entries
current_model=solution[‘Current [A]’].entries

extract data from above simulation

negative_concentration = solution[“Negative particle surface concentration [mol.m-3]”].entries
positive_concentration = solution[“Positive particle surface concentration [mol.m-3]”].entries

negative_con = negative_concentration[-1, :] # Last row of negative electrode concentration
positive_con = positive_concentration[-1, :] # Last row of positive electrode concentration

Y_positive=solution[‘Positive particle surface stoichiometry’].entries
X_negative=solution[‘Negative particle surface stoichiometry’].entries
negative_stoichiometery=X_negative[-1, :]
positive_stoichiometery=Y_positive[-1, :]

positive_ocpp =solution[“Positive electrode open-circuit potential [V]”].entries
negative_ocpp = solution[“Negative electrode open-circuit potential [V]”].entries
positive_ocp = positive_ocpp[-1, :]
negative_ocp = negative_ocpp[-1, :]
OCV=positive_ocp-negative_ocp

## RMSE

rmse = np.sqrt(np.mean((voltage_lab - voltage_model) ** 2))

graph

plt.figure()
plt.plot(time_model, voltage_model, color=‘Red’,label=‘SPMe_Model_PE_changed’)
#plt.plot(time_model, OCV, color=‘Pink’,label=‘SPMe_Model_OCV’)
plt.plot(time_lab, voltage_lab, color=‘Black’,label=‘Experimental_based_Lab_Data’)
#plt.plot(df_1[‘time (sec)’], df_1 [‘Terminal Voltage (V)’], color=‘Green’,label=‘SPMe_Model_defult’)
plt.xlabel(‘Time (sec)’)
plt.ylabel(‘Voltage [V]’)
plt.legend()
plt.show()

Hi Jitendra,

This is not a bad first fit! Good job.

Although I am not sure, I’d have a look at the overpotential that is created by the SPMe. If you have sources for experimentally obtained values for your cell, I’d start by filling those (or searching the literature for them). E.g. Particle size & diffusion constants and electrolyte conductivity & concentration. It seems like your model would need bit more overpotential, at least if your OCP(stoichi) functions are correct.

Hopefully, this aids in solving the horizontal discrepancy too. If not, then my best guess is to mess with the initial stoichiometries of the electrodes.

If you don’t want to experiment by hand, you could look into refining the parameters automatically, e.g. by your own algo, scipy or if i recall correctly, this is what they made PyBOP for (I haven’t tried it myself).

PS: For the future, please place all your code in a formatted code block, preferably with highlighting, so it is easier to read. It might make people more happy to help you.

Good Luck! :slight_smile:

1 Like

Thank you, the key points really helped me

1 Like