Discrepancy in Degradation Calculations When Using Experiment Blocks #4786
Unanswered
jufi123456
asked this question in
Q&A
Replies: 1 comment
-
Hi! We have now moved our discussions to Discourse. Please post your question there. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Title: Discrepancy in Degradation Calculations When Using Experiment Blocks
Message:
Hello everyone,
I have encountered an issue with simulating degradation mechanisms in PyBaMM when splitting a long experiment into multiple blocks. Here are the details:
I have real-world power data over a month, provided in 10-minute intervals. These data include charge and discharge cycles, which I have converted into experiment steps (
experiment_steps
). This results in:When attempting to run such a long experiment in a single simulation, I encounter an error, which I interpret as a timeout. To address this, I attempted to split the experiment into smaller blocks. After each block, I calculated the SEI thickness and nominal cell capacity at the end of the block and passed them as updated parameters to the next block.
To verify the validity of this approach, I created an experiment with 144 steps and executed it in two ways:
Observation:
When comparing the results, I noticed that the degradation (e.g., SEI thickness, capacity loss) was significantly higher in the block-wise execution compared to the single-run experiment.
Questions:
Note:
The relevant code is attached to this discussion for reference.
Thank you in advance for any help or suggestions!
import pybamm
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from battery_classes import Cell, Battery
import time
import json
import os
os.chdir(os.path.dirname(file))
Load JSON
with open("experiment_steps.json", "r") as json_file:
experiment_steps = json.load(json_file)
battery = Battery()
soc = battery.initial_soc
Initialize model
parameter_values = pybamm.ParameterValues("OKane2022")
model = pybamm.lithium_ion.SPM(
{
"SEI": "solvent-diffusion limited",
"SEI porosity change": "false",
"lithium plating": "partially reversible",
"lithium plating porosity change": "false", # alias for "SEI porosity change"
"particle mechanics": ("swelling and cracking", "swelling only"),
"SEI on cracks": "true",
"loss of active material": "stress-driven",
"calculate discharge energy": "true", # for compatibility with older PyBaMM versions
}
)
solver = pybamm.CasadiSolver(mode="fast")
Initialize the simulation
block_size = 6 # Number of steps per block
test_steps = experiment_steps[:144] # 144 steps = 1 day
total_capacity = 5.0
Split the experiment into blocks
experiment_blocks = [test_steps[i:i + block_size] for i in range(0, len(test_steps), block_size)]
for block_index, block in enumerate(experiment_blocks):
print(f"Solving block {block_index + 1} of {len(experiment_blocks)}...")
print(block)
experiment_deg = pybamm.Experiment(block, period="10 minutes")
sim = pybamm.Simulation(model, experiment=experiment_deg, parameter_values=parameter_values, solver=solver)
solution = sim.solve(initial_soc=soc) # SOC solver from another file
Beta Was this translation helpful? Give feedback.
All reactions