Hii all i am trying to simulate the aging of Lg 18650 MH1 cell and matching my simulation plot with experimental data/plot, but not getting the desired plot. Experimental plot
Pybamm code
import pybamm
import numpy as np
import matplotlib.pyplot as plt
model = pybamm.lithium_ion.SPMe({“SEI”: “solvent-diffusion limited”})
param = pybamm.ParameterValues(“OKane2022”)
experiment = pybamm.Experiment(
[
“Discharge at 0.5C until 2.95V”,
“Charge at 0.5C until 4.15V”,
“Hold at 4.15V until 50mA”,
“Rest for 10 minutes”,
] * 5 # Example with 5 cycles for demonstration
)
time = solution[“Time [s]”].data
current = solution[“Current [A]”].data
discharge_capacity = solution[“Discharge capacity [A.h]”].data
discharge_capacities =
cycle_numbers =
for i in range(1, len(time)):
# Check for the end of discharge: current transitions to zero or positive
if current[i] > 0 and current[i - 1] <= 0: # Discharge phase ends when current becomes positive
discharge_capacities.append(discharge_capacity[i - 1]) # Record capacity at the end of discharge
cycle_numbers.append(len(discharge_capacities)) # Cycle number corresponds to the index
I think this is because of PyBaMM convention use for current. Discharge capacity always starts at zero then increases during a discharge. The convention PyBaMM use is that current is positive for a discharge and negative for a charge. Refer: This discussion
However, I also tried with enabling other degradation mechanisms with DFN model, and it gives me following plot. But for SPMe still the same.
import pybamm
import numpy as np
import matplotlib.pyplot as plt
# Define the model and parameters
#model = pybamm.lithium_ion.SPMe({"SEI": "solvent-diffusion limited"})
model = pybamm.lithium_ion.DFN(
{
"SEI": "solvent-diffusion limited",
"SEI porosity change": "true",
"lithium plating": "partially reversible",
"lithium plating porosity change": "true", # alias for "SEI porosity change"
"particle mechanics": ("swelling and cracking", "swelling only"),
"SEI on cracks": "true",
"loss of active material": "stress-driven",
}
)
param = pybamm.ParameterValues("OKane2022")
# Define the experiment
experiment = pybamm.Experiment(
[
"Discharge at 0.5C until 2.95V",
"Charge at 0.5C until 4.15V",
"Hold at 4.15V until 50mA",
"Rest for 10 minutes",
] * 5 # Example with 5 cycles for demonstration
)
# Create and solve the simulation
sim = pybamm.Simulation(model, parameter_values=param, experiment=experiment)
solution = sim.solve()
# Extract solution variables
time = solution["Time [s]"].data
current = solution["Current [A]"].data
discharge_capacity = solution["Discharge capacity [A.h]"].data
#discharge_capacity = np.abs(solution["Discharge capacity [A.h]"].data)
# Initialize lists to store discharge capacities and cycle numbers
discharge_capacities = []
cycle_numbers = []
# Iterate to find discharge capacities at the end of each discharge phase
for i in range(1, len(time)):
# Check for the end of discharge: current transitions to zero or positive
if current[i] > 0 and current[i - 1] <= 0: # Discharge ends when current becomes positive
discharge_capacities.append(discharge_capacity[i - 1]) # Record capacity at end of discharge
cycle_numbers.append(len(discharge_capacities)) # Cycle number corresponds to the index
# Plot discharge capacity vs. cycle number
plt.figure(figsize=(8, 5))
plt.plot(cycle_numbers, discharge_capacities, 'bo-', label="Discharge Capacity")
plt.xlabel("Cycle Number")
plt.ylabel("Capacity (A.h)")
plt.title("Discharge Capacity vs Cycle Number")
plt.legend()
plt.grid(True)
plt.show()
VS18-191 is the experimental plot. The simulated plot in blue is not matching with experimental plot. There is huge difference in capacity of plots. How can I match both plot capacities?