Solid-Energy-Systems / NewareNDA

Python module and command line tool for reading and converting Neware nda and ndax battery cycling data files.
BSD 3-Clause "New" or "Revised" License
15 stars 8 forks source link

In search of .NDA's hidden mass #58

Closed AdamOpps closed 4 months ago

AdamOpps commented 5 months ago

I have delved into the depths of binary data extraction and have successfully found Active Mass, Remarks, and some other interesting data points for .nda files generated by Neware 4000 and 9000 instruments. I do not have access to .ndax files, so I cannot provide any information about those unfortunately.

NEWARE 4000 (and perhaps other machines)

NEWARE 9000

I leave implementation details to the more experienced among us. I can certainly take a stab at adding some extraction code, as I plan on doing so for my personal work in the meantime. However, I don't know whether any of these extractions should be added to the main "read()" functions, or if they should be their own methods.

I can imagine extracting the mass and adding dedicated "Specific Capacity" Columns to the main read_nda() function. It is also possible to have some separate function along the lines of a "read_metadata()" function that returns a simple dictionary with Remarks, Active Material, P/N, Run Date, etc. as we find them. Either implementation would be valuable in my opinion.

There are a few other data structures that I have found in the Neware 4000 file format. In short, they aren't useful, so I wont provide too much detail. One instance is a data structure that extracts with the same format as the main data points, but it has a different identifier ('\xAA' instead of '\x55'). These data blocks appear to be the last data point of each step. Within these data blocks, there are 8 bytes of unidentified data that appear to be values for Differential Capacity.

d-cogswell commented 4 months ago

Hey @AdamOpps , this is great, thanks for investigating. Do you have any of this implemented in code? I'll look through my internal nda/ndax files and see if this additional data shows up in the same places.

AdamOpps commented 4 months ago

Yeah, I have written some very simple helper functions that will search for the nda version, and then use that to find the mass or remarks. Would you like me to submit a PR into the dev branch, or submit it someplace else?

d-cogswell commented 4 months ago

I started looking for active mass in some Neware 4000 files, and I think the number should be a 4-byte unsigned int. When I read 8 bytes, some of the files returned nonsense values. Can you check if 4 bytes still gives correct values for your files?

NewareNDA already returns some additional information via logging , so I'm thinking it's best to return active mass this way too. Otherwise there will need to be a new keyword argument, and I don't really want to get into post-processing.

AdamOpps commented 4 months ago

4-byte unsigned integer is what I meant. Thanks for the clarification! I think I misread ImHex's data identifier and that Is what I quoted above.

I think putting the Active Material and Remarks into the log would be appropriate! I would advocate, however, for including columns for Specific Capacity directly into the returned dataframe from the read functions. If mass isn't specified, we could fill the column with zeros or NaNs or something. I doubt it would break compatibility for users with this solution. Let me know your thoughts though!

d-cogswell commented 4 months ago

I created a new PR #59 for extracting active mass as logging information. I prefer this approach since many of my test files have an active mass of zero. For Neware 9000 I just looked for the mass bytes from the end of the file, but I only have 3 files to test. Can you check if this works on more files?

AdamOpps commented 4 months ago

I gave it some tests, check out my comments! #59

AdamOpps commented 4 months ago

59 Code changes have been merged into development branch. Closing this issue for now, until any other breakthroughs are found!