Estimating Lithium-ion Battery Health¶
Introduction to Lithium-based batteries, their cycles characteristics and aging¶
Lithium-ion (or Li-ion) batteries are rechargeable batteries used for a variety of electronic devices, which range from eletric vehicles, smartphones, and even satellites.
However, despite their wide adoption, research isn't mature enough to avoid problems with battery health and safety, and given the ubiquity of consumer electronics using the technology, this has led to some poor outcomes that range from poor user-experience to public safety concerns (see, for example, the Samsung Galaxy Note 7 explosions from 2016).
Dataset¶
In this example of predictive maintenance, we propose a data-driven method to estimate the health of a battery using the Li-ion battery dataset released by NASA (csv).
This dataset includes information on Li-ion batteries over several charge and discharge cycles at room temperature. Charging was at a constant current (CC) at 1.5A until the battery voltage reached 4.2V and then continued in a constant voltage (CV) mode until the charge current dropped to 20mA. Discharge was at a constant current (CC) level of 2A until the battery voltage fell to 2.7V.
You can download the Jupyter notebook of this study here.
The dataset includes the following:
- Voltage_measured: Battery's terminal voltage (Volts) for charging and discharging cycles
- Current_measured: Battery's output current (Amps) for charging and discharging cycles
- Temperature_measured: Battery temperature (degree Celsius)
- Current_charge: Current measured at charger for charging cycles and at load for discharging cycles (Amps)
- Voltage_charge: Voltage measured at charger for charging cycles and at load for discharging ones (Volts)
- Start_time: Starting time of the cycle
- Time: Time in seconds after the starting time for the cycle (seconds)
- Capacity: Battery capacity (Ahr) for discharging until 2.7V. Battery capacity is the product of the current drawn from the battery (while the battery is able to supply the load) until its voltage drops lower than a certain value for each cell.
Initialization¶
This example uses the following version of VerticaPy:
import verticapy as vp
vp.__version__
Connect to Vertica. This example uses an existing connection called "VerticaDSN." For details on how to create a connection, use see the connection tutorial.
vp.connect("VerticaDSN")
Before we import the data, we'll drop any existing schemas of the same name.
vp.drop("battery_data", method="schema")
vp.create_schema("battery_data", True)
Since our data is in a .csv file, we'll injest it with read_csv().
battery5 = vp.read_csv("data/battery5_data.csv")
Understanding the Data¶
Let's examine our data. Here, we use vDataFrame.head() to retrieve the first five rows of the dataset.
display(battery5.head(5))
Let's perform a few aggregations with vDataFrame.describe() to get a high-level overview of the dataset.
battery5.describe()
To get a better idea of the changes between each cycle, we look at an aggregation at their start time, duration, and voltage at the beginning and the end of each cycle.
battery5['start_time'].describe()
To see how the voltage changes during the cycle, we extract the initial and final voltage measurements for each cycle.
battery5.analytic(func="first_value",
columns="Voltage_measured",
by="start_time",
order_by={"Time":"asc"},
name="first_voltage_measured")
battery5.analytic(func="first_value",
columns="Voltage_measured",
by="start_time",
order_by={"Time":"desc"},
name="last_voltage_measured")
cycling_info = battery5.groupby(columns = ['start_time',
'type',
'first_voltage_measured',
'last_voltage_measured'],
expr = ["COUNT(*) AS nr_of_measurements",
"MAX(Time) AS cycle_duration"]).sort('start_time')
cycling_info['cycle_id'] = "ROW_NUMBER() OVER(ORDER BY start_time)"
cycling_info
We can see from the "duration" column that charging seems to take a longer time than discharging. Let's visualize this trend with an animated graph.
import warnings
warnings.filterwarnings('ignore')
cycling_info.animated(ts="start_time",
columns= ["type","cycle_duration"],
by="type",
kind="bar",)