{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Analysing GITT data\n", "\n", "PyProBE includes built-in analysis methods for pulsing experiments, which this example\n", "will demonstrate.\n", "\n", "First import the required libraries and data:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import pyprobe\n", "\n", "info_dictionary = {'Name': 'Sample cell',\n", " 'Chemistry': 'NMC622',\n", " 'Nominal Capacity [Ah]': 0.04,\n", " 'Cycler number': 1,\n", " 'Channel number': 1,}\n", "data_directory = '../../../tests/sample_data/neware'\n", "\n", "# Create a cell object\n", "cell = pyprobe.Cell(info=info_dictionary)\n", "cell.add_procedure(procedure_name='Sample',\n", " folder_path = data_directory,\n", " filename = 'sample_data_neware.parquet')\n", "print(cell.procedure['Sample'].experiment_names)\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We will plot the Break-in Cycles and Discharge Pulses:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fig = pyprobe.Plot()\n", "fig.add_line(cell.procedure['Sample'].experiment('Break-in Cycles'), 'Time [hr]', 'Voltage [V]', label = 'Break-in Cycles', color = 'blue')\n", "fig.add_line(cell.procedure['Sample'].experiment('Discharge Pulses'), 'Time [hr]', 'Voltage [V]', label = 'Discharge Pulses', color = 'red')\n", "fig.show_image()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "State-of-charge is a useful metric when working with battery data, however it must be carefully defined. PyProBE doesn't automatically calculate a value for cell SOC until instructed to by the user for this reason.\n", "\n", "To add an SOC column to the data, we call `set_SOC()` on the procedure. We are going to provide an argument to `reference_charge`. This will be the final charge of the break-in cycles. This argument instructs PyProBE that the final data point of this charge is our 100% SOC reference." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "reference_charge = cell.procedure['Sample'].experiment('Break-in Cycles').charge(-1)\n", "cell.procedure['Sample'].set_SOC(reference_charge=reference_charge)\n", "\n", "fig = pyprobe.Plot()\n", "fig.add_line(cell.procedure['Sample'].experiment('Break-in Cycles'), 'Time [hr]', 'SOC', label = 'Break-in Cycles', color = 'blue')\n", "fig.add_line(cell.procedure['Sample'].experiment('Discharge Pulses'), 'Time [hr]', 'SOC', label = 'Discharge Pulses', color = 'red')\n", "fig.show_image()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Then we'll filter to only the pulsing experiment:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "pulsing_experiment = cell.procedure['Sample'].experiment('Discharge Pulses')\n", "\n", "fig = pyprobe.Plot()\n", "fig.add_line(pulsing_experiment, 'Experiment Time [hr]', 'Voltage [V]')\n", "fig.show_image()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "And then create our pulsing analysis object." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from pyprobe.analysis import pulsing\n", "pulse_object = pulsing.Pulsing(input_data=pulsing_experiment)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "With the pulsing object we can separate out individual pulses:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fig = pyprobe.Plot()\n", "fig.add_line(pulse_object.input_data, 'Experiment Time [hr]', 'Voltage [V]', color='blue', label='Full Experiment')\n", "fig.add_line(pulse_object.pulse(4), \"Experiment Time [hr]\", \"Voltage [V]\", label = 'Pulse 5', color = 'red')\n", "fig.show_image()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can also extract key parameters from the pulsing experiment, with the `get_resistances()` method." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "pulse_resistances = pulsing.get_resistances(input_data=pulsing_experiment)\n", "print(pulse_resistances.data)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The `get_resistances()` method can take an argument of a list of times at which to evaluate the resistance after the pulse, for instance at 10s after the pulse:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "pulse_resistances = pulsing.get_resistances(input_data=pulsing_experiment, r_times=[10])\n", "print(pulse_resistances.data)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "As a result object, the pulse summary can also be plotted:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fig = pyprobe.Plot()\n", "fig.add_line(pulse_resistances, 'SOC', 'R0 [Ohms]', color='blue', label='R0')\n", "fig.add_line(pulse_resistances, 'SOC', 'R_10s [Ohms]', color='red', label='R_10s')\n", "fig.yaxis_title = 'Resistance [Ohms]'\n", "fig.show_image()" ] } ], "metadata": { "kernelspec": { "display_name": "pyprobe-dev", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.3" } }, "nbformat": 4, "nbformat_minor": 2 }