be-smith / navani

Module for processing and plotting electrochemical data from battery cyclers. Contains functions to extract dQ/dV.
MIT License
11 stars 3 forks source link

what happens if a cycle is not strictly monotonic #15

Open elena-pascal opened 1 month ago

elena-pascal commented 1 month ago

Hello!

I am wrong to understand that navani assumes a cycle is strictly monotonic because of this:

    df = pd.DataFrame({'Capacity': capacity, 'Voltage':voltage})
    unique_v = df.astype(float).groupby('Voltage').mean().index
    unique_v_cap = df.astype(float).groupby('Voltage').mean()['Capacity']

Otherwise, if there are turning points, the data gets a bit scrambled. Or is it relying on groupby doing a lot of heavy lifting to still find the correct peaks despite the scrambling?

Thanks

be-smith commented 1 month ago

Navani assumes the data is broadly monotonic yes, i.e that on discharge any increases in voltage are likely noise related. If you have a voltage profile that has a lot of up and down I'm not sure of the physical meaning of this. Also if there is a turning point in the data you can end up with two or three dQ/dV values for the same voltage point, and dQ/dV values of inifinity at the turning point.

The best way to deal with this using navani is to split up your data into increasing and decreasing sections and process them individually, and then plot them on the same graph

dqdv_cycle1_2_100

Here is an example figure where for cycle one the voltage increases on discharge - shown in green. And i split the data to before and after this increases and processed them individually, shown by the dashed and solid lines.

If you have any better ideas or physical explanations for this I would be very interested!

elena-pascal commented 1 month ago

Hi @be-smith, thanks for confirming my guess. I am not a battery chemistry person, but from what Alice and Jiho tell me, turning points in Voltage are not uncommon per cycle. Not only that, but the data I'm dealing with can have big turning points (as below) as well as small localised turning points. Maybe document these limitations, especially because your pipeline will not break or complain if this assumption is not satisfied. Maybe do both. At least Alice said she used the software before and didn't realise it assumes no turning points.

Here is an example where using groupby is really scrambling things up

this when not

I won't be able to use Navani for my purposes, since if I am looking for an automated general approach where I don't knew where the turning points are when I start. But good luck with the repo it looks good 😃 .

be-smith commented 1 month ago

Yeah this is a limitation with how it currently works, I will note it in the documentation. For your case you should be able to find turning points in the data that large quite easily and simply split the data before and after those turning points and apply the dQ/dV function to each section. You could also just filter out the first 0.3 mAh of the data, I doubt there is much in the dQ/dV there that is relevant/interpretable, and with the turning points in the data no matter the approach you will have dQ/dV as undefined due to dividing by zero.

I used groupby to ensure there is only a single capacity value for each voltage value - so that a spline can be fitted to the data for differentiation.

elena-pascal commented 1 month ago

Do you mainly target the digital noise with groupby? Because it is great for that. Your example data seems pretty clean (not noisy).

I do unfortunately have turning points that are on a scale comparable with the digital noise, that is my current pickle.