Google Summer of Code NumFOCUS PyBaMM

Blogs Project page on the Google Summer of Code website Proposal on Google Docs

View my GitHub profile

This page serves as a permalink to the final report that provides details of Julian Eversโ€™s project in the Google Summer of Code 2023 programme.

๐Ÿ“– TL;DR

A summary of some of the tasks I achieved throughout the community bonding and the coding periods is given below.

  • Adding a package for techno-economic analysis of batteries to the PyBaMM ecosystem; PyBaMM-TEA
  • Functionality for the calculation of cell metrics, such as gravimetric and volumetric energies (specific to various masses/volumes)
  • The package can use PyBaMM’s functionality, but does not require a full parameter-set and enables many input options

Much focus on electrode design:

  • Calculation of masses and volumes, e.g., top-down or bottom-up calculation of inactive material densities
  • Calculation of capacities and voltages considering stoichiometry/voltage limits and losses of lithium inventory

๐Ÿ”‹ About PyBaMM

PyBaMM is an open-source Python package for the mathematical modelling of batteries and running fast, flexible, and accurate simulations for myriads of battery models. Its mission is to accelerate battery modelling research by providing open-source tools for multi-institutional, interdisciplinary collaboration; it is fiscally sponsored by NumFOCUS and The Faraday Institution in the U.K. The use of the software in academia and industry has been prolific since its inceptionโ€”it has been used at a multitude of universities, research institutions, and commercial research labs in collaborative settings.

๐Ÿ“„ Project abstract

The project aims at a techno-economic toolbox to analyze the influences of electrode-, cell- and process designs on e.g. cost per energy, which can utilize PyBaMM’s functionality as for creating a Ragone plot. While it can be used with PyBaMM to estimate losses of lithium inventory (LLI) during formation and degradation, LLI can also be supplied as an input, so that a working parameter-set is not obligatory and also hypothetical chemistries can be modelled with the TEA. Similarly, also stoichiometries can be limited - alternatively to cutting-off voltages - so that capacity balancing can also be done with an average electrode potential as input instead of an OCV curve. An emphasis is on bottom-up calculation of electrode and separator densities, so that specific energies and costs can be described dependent on conductive additive- and binder weight fractions and densities. Generally, as with the density calculation, the TEA offers various input options e.g., the wet separator density can be calculated based on the dry separator density or the separator material density. The calculation of form factors, as well as costs and emissions originating from components and manufacturing steps is developing and will be continuously added to the repository. When adding new functionality - among other checks - all entries in printable dataframes are tested.

๐Ÿš€ Motivation

The motivation for the work on the library is to create a techno-economic design tool for battery cells, that can be combined with PyBaMM. Thereby, fundamentals of electrode-, cell- and manufacturing process designs should be connected for a holistic techno-economic analysis of batteries.

๐Ÿ€ Benefits to the community

The availability of a techno-economic analysis library connected with PyBaMM has a great chance of supporting people with the development of inexpensive and environmentally friendly batteries. The overview and combination of costs with electrode-, cell- and process design fundamentals could attract new users with diverse backgrounds to PyBaMM.

๐Ÿง‘โ€๐Ÿ’ป Work done

๐Ÿ‹๐Ÿฝ Masses and volumes

Much time went into the (first) example notebook, which covers the mass and volume loadings of electrodes. The example notebook shows how a default PyBaMM parameter-set can be combined with an additional input-set to calculate/update densities, volume fractions/porosities, etc. to plot the mass and volume loadings against each other with a rectangle plot and print them - together with the densities - to a dataframe. PyBaMM parameter-sets include the (wet-) electrode density, porosity and active material volume fraction, when inputting the active material densities, the inactive material density is calculated top-down. Alternatively, the inactive material density can also be calculated bottom-up from binder and conductive additive density and weight fractions, then the (wet-) electrode density is updated accordingly. There are many more input options shown with the respective calculations in the notebook.

โšก๏ธ Capacities and potentials

The capacities and potentials notebook gives an overview of the various input options for the electrode potentials and capacities. In PyBaMM, capacities are defined by the maximal concentrations of the particles [mol.m-3]. An alternative input with the (theoretical) gravimetric capacity [mA.h.g-1] has been added, which can be calculated from molar masses and updates the maximal concentrations. The stoichiometries at 0% and 100% can be calculated - as usual in PyBaMM - from the voltage cut-offs. Alternatively, the stoichiometry limits of one electrode can be set, which is useful for capacity balancing in case an average electrode voltage is supplied instead of a voltage curve or to set target capacities. The initial concentrations can also be set, e.g., based on the maximum amount of lithium from the positive electrode. This reinitialization can increase the amount of lithium inventory in PyBaMM parameter-sets, but the LLI can be set. The example notebook shows how practical active material capacities, stoichiometries, voltages, energies and more evolve with the LLI. Losses of active materials (LAM) will be added to the notebook, rate-dependent losses are not considered in the TEA, but can be estimated mechanistically with PyBaMM.

๐ŸŽ๏ธ Simulation’s with PyBaMM

The combination of the TEA package with existing PyBaMM functionality is shown in the ragone example notebook, where the evolution of the gravimetric energy with the applied C-rate is plotted. The notebook is basically a copy of PyBaMM’s rate capability notebook and serves as an example for the combination of PyBaMM-TEA with PyBaMM. More specific simulations can be added to benchmark rate capability - in the form of maximum pulse power at different SoC’s or minimum charging time from 10% to 80% SoC, but also thermal behavior and degradation can be benchmarked.

๐Ÿ”‹ Form factors

The form factor calculation is an essential part of the TEA and still needs to be added. From the cell design, the effective length of the electrode(s) is calculated, which determines absolute cell masses and capacities. Many cell designs can be modelled with three main classes: cylindric cells, stacked - not necessarily rectangular-shaped - and flat-winded cells with a hard or soft case. Thereby the electrode stack and outer housing mass can be calculated and excess volume and mass can be added. Also, excess electrolyte, excess electrode/capacity due to “anode-overhang” and various choices of outer layers could be modelled.

๐Ÿ’ต Costs

The cost model is proposed to cover a large part of the project work and still needs to be added. It connects the electrode and cell design with the process design e.g., the choice of the active material and binder relate to the choice of the solvent and the form factor to the assembly cost. In the cost model, manufacturing and component costs have three input categories: Material cost, Production cost and emissions which refer to different - single - functional units of the electrodes and cell and are put in relation to the energy throughput of the cell. The manufacturing process design can be decomposed into independent modules, for which costs can be assigned from the literature and which can be expanded e.g., with pack assembly and recycling. Optionally, cost inputs are described mechanistically e.g. considering electricity cost, scale and waste production.

๐Ÿ“‘ A full list of issues and pull requests from pybamm-tea

This list contains all issues and pull requests that are in the pybamm-tea repository at the time of writing the report.

๐Ÿ› ๏ธ Issues

๐Ÿ‘ท Pull requests

๐Ÿ”ฎ Future work

  • Form factors: Add functionality for different form factors, e.g., for a form factor with multiple, flat-winded cells inside one hard casing and create a database with typical input values for common form factors.

  • Cost models: Decompose and describe manufacturing costs, e.g., by considering waste production

  • Sensitivity analysis: Add standard deviations to the input values and create functionality for sensitivity analysis.

  • Cell metrics: Create functions to estimate specific metrics with simulations, e.g., pulse power or charging time or many other cell metrics which utilize PyBaMM’s functionality.


The Google Summer of Code project with PyBaMM offered me so many insights into techno-economics of batteries, continuum modelling of battery cells and open-source modelling software development. I am incredibly thankful to Robert Timms, Jacqueline Edge and Valentin Sulzer for the very supportive and enjoyable mentoring. The positive atmosphere and the understanding, even when there was no progress at times meant very much to me. Also I am very thankful that it was possible to extend the project timeline, which helped arranging the project with studying and working part-time. The conversations with the my fellow students at GSoC Agriya and Arjun, and with all the attendees in the monthly developer meetings felt like a huge privilege to me. I am grateful, that I can support the PyBaMM ecosystem and that I can continue the work on the TEA.

๐Ÿ”ญ References