Skip to content

A Python module for identifying the location of knee/elbow points and onsets in battery capacity/internal resistance degradation curves.

Notifications You must be signed in to change notification settings

rg1990/knee-finder

Repository files navigation

knee-finder

This repository implements the algorithm described here: https://www.mdpi.com/1996-1073/14/4/1206, used to identify the location of knee points and knee onsets in battery capacity degradation curves. The paper describes internal resistance "elbows", however the algorithm and this implementation can be applied to both knees and elbows.

Usage

Creating an instance of KneeFinder only requires x and y data arrays. The analysis is performed upon instantiation.
# Use default settings
kf = KneeFinder(x, y)

You can optionally enable automatic truncation for handling sigmoid-like curves. Valid options for mode are 'knee' and 'elbow'.

# Other optional settings
kf = KneeFinder(x, y, automatic_truncation=False, mode='knee')

The results are stored in the attributes onset, point, onset_y, point_y, eol_cycle, and eol_val.

# Print x results (cycle numbers)
print(np.round(kf.onset, 2))
>> 280.76
print(np.round(kf.point, 2))
>> 344.69

# Print y results (capacity values)
print(np.round(kf.onset_y, 2))
>> 1.04
print(np.round(kf.point_y, 2))
>> 1.01

# Print the end of life info
print(np.round(kf.eol_cycle, 2))
>> 447
print(np.round(kf.eol_val, 2))
>> 0.86

You can plot the results using kf.plot_results. This method has optional parameters to show different curve fits (monotonic, line-plus-exponential, asymmetric sigmoid.) The data_style parameter controls the line style for the data.

kf.plot_results(mon=False, line_exp=False, sig=False, data_style='-')


Try it Yourself

You can play with KneeFinder using the interactive Streamlit app available here: https://rg1990-knee-finder-streamlit-knee-finder-mwgskp.streamlit.app/. In the app, you can see the results using example data from 120 cells (Severson et al. [2]), a fake sigmoidal degradation curve, or you can upload your own data in CSV format.

Acknolwedgements & References

The application of Bacon-Watts and double Bacon-Watts to locate the knee point and onset was described by Fermín-Cueto et al. in [1].

The data used in this repo and in the associated Streamlit app is taken from [2].

The method was extended by me (Richard Gilchrist), Calum Strange, Shawn Li and Goncalo dos Reis, as described in Strange et al. [3]. KneeFinder implementation by Richard Gilchrist.



[1] P. Fermín-Cueto et al., "Identification and machine learning prediction of knee-point and knee-onset in capacity degradation curves of lithium-ion cells," Energy and AI, vol. 1, p. 100006, 2020. doi:10.1016/j.egyai.2020.100006

[2] Severson, K.A., Attia, P.M., Jin, N. et al. "Data-driven prediction of battery cycle life before capacity degradation." Nat Energy 4, 383–391 (2019). doi: 10.1038/s41560-019-0356-8

[3] C. Strange, S. Li, R. Gilchrist, and G. dos Reis, "Elbows of internal resistance rise curves in li-ion cells," Energies, vol. 14, no. 4, p. 1206, 2021. doi:10.3390/en14041206

Releases

No releases published

Packages

No packages published

Languages