microsoft / BatteryML

MIT License
480 stars 101 forks source link

Creating a Python script to process raw CAN data from the vehicle #14

Open eymenipek opened 1 year ago

eymenipek commented 1 year ago

I would like to create a script to convert .mdf raw CAN battery data into a pandas dataframe.

fingertap commented 12 months ago

Can you convert the data into the BatteryData format instead of DataFrame? Maybe I can help with this if you provide a data sample.

eymenipek commented 12 months ago

Hey Han! For sure, I will try something and share!

eymenipek commented 12 months ago

The sample data is available here and attached (.dbc is the database and mf4 is the MDF data): https://www.csselectronics.com/pages/tesla-data-dashboard-telematics-can-bus-grafana#ev-data-pack Here the example code would be to convert to DataFrame: from asammdf import MDF df = MDF(File).extract_bus_logging(database_files=database).to_dataframe() How can we convert to BatteryData? Sample_Data.zip

fingertap commented 12 months ago

The definition of BatteryData can be found here. It simply records the meta info of the battery and its cycling history. For each cycle, it records the current, voltage and time (and more) as a timeseries list, in a CycleData object. To convert the data into BatteryData objects, we may need to fill in the meta information and then split the electrical signals into cycles.

fingertap commented 10 months ago

Hi @eymenipek ! We now reorganized the repo to use a more convenient CLI to handle the data download and preprocessing (#19 ). Will look into this data soon!