Creating a Python script to process raw CAN data from the vehicle
Opened this issue · 5 comments
I would like to create a script to convert .mdf raw CAN battery data into a pandas dataframe.
Can you convert the data into the BatteryData
format instead of DataFrame? Maybe I can help with this if you provide a data sample.
Hey Han! For sure, I will try something and share!
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
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.
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!