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

[Bug]: The NCA_Kim2011 OCP curve CSV value is inconsistent with the original Article Function #2744

Closed
1836005678 opened this issue Mar 6, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@1836005678
Copy link
Contributor

PyBaMM Version

22.11.1

Python Version

3.9.13

Describe the bug

I am using the parameter set NCA_Kim2011. When I set the initial soc to 1 and begin my simulation just like
solver_used = pybamm.CasadiSolver(mode="safe")
sim = pybamm.Simulation(model_dfn, parameter_values=params_values_used, experiment = experiment_used, solver = solver_used)
sim.build_for_experiment(initial_soc=1)'
sim.solve()
then I come to the bug 'interpolation bounds were exceeded' "Interpolant 'nca_ocp_Kim2011_data' lower bound".
image
So I go to the nca_ocp_Kim2011_data.csv and find that the maxnimum sto provided is 0.993382838635443. This will arise problems not only when we set initial soc to 1, but also when we charge the battery to the Upper Voltage Cut-off. Therefore, I wanted to replace CSV Data with Function. However, when I compare the OCP curve provided from the CSV and the Kim2011 Article, I find that there are difference between them. The CSV Data Curve is higher than the Function Curve. The difference is much more obvious when sto is close to 1 or 0.37.
image
My question is:
1.Which curve is reliable.
2.If the CSV Data Curve is correct, to provide additional interpolation points, what the Voltage is when sto equals to 1?

Steps to Reproduce

1.CSV
Open pybamm\input\parameters\lithium_ion\data\nca_ocp_Kim2011_data.csv
Draw picture using scatter diagram.
2.Original Article
https://iopscience.iop.org/article/10.1149/1.3597614
Open page 8 of the article, see Table III, Positive electrode U+(V) item.
Draw picture using your code, or just like
x = 0.37:0.01:0.99
U_posi = 1.638*(x.^10) - 2.222*(x.^9) + 15.056*(x.^8) - 23.488*(x.^7) + 81.246*(x.^6) - 344.566*(x.^5) + 621.3475*(x.^4) - 554.774*x.^3 + 264.427*(x.^2) - 66.3691*x + 11.8058 - 0.61386*exp(5.8201*x.^136.4);
U_nega = 0.124 + 1.5*exp(-70*x) - 0.0351*tanh((x-0.286)/0.083) - 0.0045*tanh((x-0.9)/0.119) - 0.035*tanh((x-0.99)/0.05) -0.0147*tanh((x-0.5)/0.034) - 0.102*tanh((x-0.194)/0.142) - 0.022*tanh((x-0.98)/0.0164) - 0.011*tanh((x-0.124)/0.0226) + 0.0155*tanh((x-0.105)/0.029);
plot(x,U_posi,x,U_nega)

Compare the difference between them.

Relevant log output

No response

@1836005678 1836005678 added the bug Something isn't working label Mar 6, 2023
@1836005678
Copy link
Contributor Author

The OCP Function in Kim2011 article is
image

@1836005678
Copy link
Contributor Author

The CSV Data is

sto Voltage
0.370214 4.210441
0.375774 4.198215
0.38369 4.182142
0.391896 4.165163
0.401069 4.149605
0.406862 4.138287
0.41169 4.1298
0.419414 4.115654
0.426655 4.102923
0.43293 4.090189
0.439691 4.080292
0.445484 4.070391
0.45321 4.059079
0.458522 4.050594
0.462866 4.042105
0.471076 4.032212
0.476388 4.023727
0.483631 4.013831
0.489425 4.00393
0.498119 3.994039
0.507776 3.9799
0.516471 3.971426
0.528059 3.953041
0.537717 3.938902
0.549309 3.926186
0.556552 3.914873
0.567175 3.899319
0.576835 3.888014
0.586975 3.872459
0.596149 3.858318
0.608707 3.844189
0.615949 3.832875
0.624643 3.822984
0.635268 3.810265
0.646378 3.798965
0.660386 3.784841
0.676328 3.770722
0.691786 3.756603
0.703863 3.746723
0.724637 3.731204
0.739131 3.719916
0.753141 3.710043
0.767635 3.698754
0.779712 3.688875
0.791789 3.677578
0.804348 3.666283
0.814492 3.656396
0.826085 3.645098
0.835745 3.633793
0.846373 3.625326
0.856032 3.612604
0.86521 3.604131
0.873903 3.592823
0.884048 3.584354
0.892743 3.57588
0.902403 3.565993
0.912549 3.558941
0.922211 3.55047
0.933806 3.542006
0.948296 3.526466
0.957952 3.509492
0.965192 3.495344
0.970974 3.468437
0.974345 3.450024
0.976745 3.425939
0.980589 3.393356
0.98202 3.365016
0.983451 3.338094
0.984884 3.314005
0.985832 3.287081
0.987259 3.253073
0.989642 3.204895
0.99057 3.149626
0.991506 3.104277
0.993383 3.023502

@valentinsulzer
Copy link
Member

Let's switch to the function. Can you plot it from 0.3 to 1 to make sure the extrapolation behavior is ok?

@1836005678
Copy link
Contributor Author

sto from 0.3 0.31 0.32 ... to 1
image
sto from 0.3 0.31 0.32 ... to 0.99
image
The function curve descend too quickly between 0.99 and 1 due to the 'exp(5.8201*x^136.4)' item in the function. However, this does not matter. The simulation works well.

@valentinsulzer
Copy link
Member

Looks good. Can you open a PR replacing the csv with the function? Let me know if you need help for this.

The function curve descend too quickly between 0.99 and 1 due to the 'exp(5.8201*x^136.4)' item in the function.

This is actually useful for making sure we hit the voltage cut-off, instead of the particle stoichiometry going above 1

1836005678 added a commit to 1836005678/PyBaMM that referenced this issue Mar 7, 2023
Fixing pybamm-team#2744. to make sure we hit the voltage cut-off, instead of the particle stoichiometry going above 1.
Using the function in Kim2011 article to take the place of pybamm\input\parameters\lithium_ion\data\nca_ocp_Kim2011_data.csv for parameter 'Positive electrode OCP[V]' in Kim2011 parameter set.
The function 'nca_ocp_Kim2011(sto)' in pybamm\input\parameters\lithium_ion\NCA_Kim2011.py is edited.
@1836005678
Copy link
Contributor Author

Sorry for my misoperation. #2750 has done nothing. Replacing has been made in #2751.

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

No branches or pull requests

2 participants