The Battery Software Open Source Landscape
Tags: Data, Battery, Software, Energy, Open Source

This story is contributed by Jason Koeller.

The creation of open source software in the battery industry has gradually grown as computation, simulation, and data science become a critical part of the battery engineer’s everyday toolset.

Open source software for data processing, data analysis, and physics-based modeling — three of the core tasks in battery R&D — are reviewed in this article.

High quality documentation and community events, such as interactive workshops, are important ways to gain new users and convert users into developers.

This article provides an overview of the state of open source battery software and a summary of the most common battery-specific projects.

What is Open Source?

Broadly speaking, open source software is software for which the source code is freely available. It is characterized by an open source license, which allows “the source code, blueprint or design to be used, modified and/or shared under defined terms and conditions”.

Open source software is also characterized by collaborative development, based on the following key principles:

Treat your users as co-developers. Having more developers leads to faster development, and more bugs found and fixed.

Having more developers leads to faster development, and more bugs found and fixed. Release early. The earlier an initial version is released, the quicker new developers will contribute.

The earlier an initial version is released, the quicker new developers will contribute. Release often. A successful project will have frequent code contributions, and these changes should be integrated often to avoid large overhead.

A successful project will have frequent code contributions, and these changes should be integrated often to avoid large overhead. Several versions, in particular, a buggier “development” version with newer features and a “stable” version with fewer features.

in particular, a buggier “development” version with newer features and a “stable” version with fewer features. High modularity to facilitate parallel development, and

to facilitate parallel development, and Dynamic decision making structure to guide the strategic direction of the project.

Most open source software projects will have at least some, if not all of these elements. Note that open source software is not necessarily free to use, and vice versa. Software may be free to use without the underlying source code being available, and software may be open source but with mostly paid users (e.g. Darwin, the open source operating system underlying macOS).

The combination of the open source license and open source development model often means that open source software is easily accessible and easy to use, which makes open source a great way to start using a particular software functionality. These days, there exist high quality open source packages for a variety of battery-related software tasks, from modeling to data processing. Let’s take a look at the battery open source landscape.

The Software Landscape

The study of batteries is highly interdisciplinary. Packages from diverse fields such as data engineering, quantum chemistry, density functional theory, electrochemistry, economics, and machine learning are all battery-relevant. This article focuses on functionalities core to the study of batteries: battery data management, manipulation, and electrochemical battery modeling.

Open source software projects can be evaluated by the number of contributors and the number of active users. At the time of writing, PyBaMM — a physics-based battery modeling framework — leads the pack of battery-specific software in collaboration with 18 collaborators. Cellpy, a cycling data management package, is the most widely used, with 1000+ downloads in the last month.

The plot below shows the number of monthly downloads on the python package hosting site pypi versus the number of Github contributors for a selection of open source software packages (accessed on 11/23/20):

Battery-specific packages are orange. It is interesting to note the roughly quadratic relationship between the number of contributors and the number of downloads over several orders of magnitude. There is no “law of diminishing returns’’ here — each additional contributor is associated with an increased number of additional users. This is a reflection of open source software’s impact potential.

Most battery-specific packages are written in Python or Matlab. Packages referenced in this article are in Python unless indicated otherwise. The use of Julia for high-performance scientific computing is increasing, but this development is just beginning to make its way to the battery community.

Data Management and Analysis

Battery cycling data is highly complex. Different cycling protocols, cycler manufacturers, and experimental configurations make it difficult to compare different datasets. Fortunately, there already exist two open source cycling data management packages to jump-start analyses.

BEEP (Battery Evaluation and Early Prediction)

BEEP from the Toyota Research Institute (TRI) is a package for parsing and featurizing battery cycling data specifically geared towards cycle life prediction. It supports the data formats of a number of cycler manufacturers, including Arbin, Biologic, Maccor, and Neware. It implements the features used in Severson et al. 2019 to predict end of life with high accuracy in LFP cells operated under fast charge and discharge. It can even be used to programmatically set up cycling experiments for Arbin, Biologic, and Maccor cyclers.

A typical BEEP data pipeline includes validation, structuring, and featurization. During the validation step, checks are performed to ensure that the data obeys an expected user-defined schema. The first step in structuring is the extraction of summary metrics such as charge/discharge capacity and energy efficiency for each cycle. The second step is the interpolation of any time-series parameter (such as discharge capacity during a cycle) to ensure that a consistent number of data points exist for each cycle and cell. This makes it easier to compare quantities between different cycles and cells and is necessary for the featurization used in Severson et al. Structuring makes the cell data available in pandas dataframes for easy plotting and analysis. Finally, a featurization module exists for extracting various scalar values from a cycling profile, such as the number of cycles to 80% capacity retention or the average voltage during discharge for cycle 100, for example. These features can then be used for machine learning models to predict cycle life, as in Severson et al.

BEEP is actively maintained by researchers at TRI, and 14 people have contributed to the project at the time of writing.

cellpy

cellpy is a package created and mainly maintained by IFE in Norway, which parses Arbin cycler data and enables manipulation of cycling data using pandas dataframes. In addition, it enables incremental capacity (dQ/dV) analysis and the extraction of open circuit relaxation points.

impedance.py

impedance.py is a package for the analysis of electrochemical impedance spectroscopy (EIS) data. Core functionality includes plotting experimental impedance spectra, fitting impedance spectra to equivalent circuit models, computing and plotting the impedance spectra of equivalent circuit models, and validation of impedance spectra using the Kramers-Kronig relations.

The impedance.py project began at the 2018 Electrochemical Society Hack Week in Seattle, and has since been actively extended and maintained. It is well documented and easy to use. Fifteen individuals have contributed at the time of writing.

Modeling

PyBaMM (Python Battery Mathematical Modeling)

PyBaMM is a framework for running fast, reliable battery simulations. It can use both the full Doyle-Fuller-Newman and simpler Single Particle models to simulate physical properties such as voltages, concentrations, and temperatures of a battery operated under different experimental protocols. It includes built-in parameter sets for various chemistries, including graphite, LCO, NCA, and NMC, and it is easy to add new parameter sets for new chemistries. Charge / discharge protocols, including voltage and power control, can be specified in plain english through phrases such as “discharge at C/10 for 10 hours or until 3.3V”. PyBaMM also has growing capability for simulating degradation mechanisms such as SEI growth, active material particle cracking, and pore clogging, with additional mechanisms under development.

PyBaMM is built upon the principles of modularity and extensibility. With its highly object-oriented interface, users can easily compare the included models, parameter sets, discretizations, and solvers. Custom models can be implemented to study a new physical phenomena without having to implement a new solver or discretization. The solver translates high-level Python code to low-level C code and uses algorithmic Jacobian calculations to accelerate its simulations. Finally, built-in visualization tools help compare variables within and across different models.

PyBaMM is an impressive example of open source battery software. It is very well-documented, with interactive code tutorials, video tutorials, and even its own YouTube channel and Slack workspace. The strict use of unit tests and continuous integration ensure a high level of code reliability. The PyBaMM community has succeeded in creating software that enables both battery modeling novices to get started quickly and experts to advance their research. It is actively maintained by a core group, and has benefited from the work of 18 contributors at the time of writing.

LIONSIMBA: Li-ion Simulation Battery

LIONSIMBA is a Matlab framework for battery modeling. While it is open source by virtue of being hosted on Github, it is not being actively maintained or extended. Nearly all LIONSIMBA functionality has been incorporated into PyBaMM. Nevertheless, it may be a good choice for those seeking a Matlab modeling framework.

MPET: Multiphase Porous Electrode Theory

MPET’s core porous electrode modeling capability is similar to LIONSIMBA and PyBaMM. In addition, it can simulate the phase separation of active materials during operation — an effect that occurs in both graphite and LFP — and to model surface reaction kinetics beyond the Butler-Volmer equation. Both of these features become important when surface reaction kinetics play a dominant role. MPET is a good choice for experts who require maximum model accuracy, or anyone who wants a deeper understanding of the microscopic dynamics of their system. MPET is currently maintained by the Bazant group at MIT.

Open Source Data

“Open source” datasets have been steadily increasing in number as well. A recent list has been compiled in this BatteryBits article and is being kept up-to-date by Abolfazl Shahrooei. Well, what are you waiting for? Download some data, clone a Github repository or install a package, and get to work!

A Note on the Commercial Landscape

The need for a dedicated data infrastructure to track, manage, and optimize for the safety, performance, and even the economics of batteries has catalyzed the creation of a number of “battery intelligence” startups. Detailed analysis of commercial efforts is beyond the scope of this article, but this publicly maintained tracker is a good starting point for researchers interested in the topic.

Conclusion

Most battery-specific projects exhibit only one or two of the open source collaboration principles described in the introduction (PyBaMM being a notable exception). This is understandable given that open source collaboration and software development are still relatively new to the battery field.

In my opinion, the most obvious barrier to wider collaboration is the lack of documentation in many packages. More tutorials and examples enable individuals to quickly try packages and determine whether they are useful for the problem at hand. Better documentation also provides context for how a package is meant to be used, which helps potential developers gain intuition for how to best modify and extend the source code. Deliberate community building is also an indicator of open source project success. Both PyBaMM and impedance.py — two of the most successful battery open source projects — have benefitted from workshops aimed to attract potential developers and users.

Acknowledgements

Thanks to Linda Jing, Valentin Sulzer, Raymond Smith Maass, Tim Suen, and Yen T. Yeh for reviewing portions of the draft of this article and providing helpful feedback.

About the Author

Jason Koeller is a battery data scientist working at the intersection of batteries, chemistry, and AI. He has a PhD in theoretical physics from Berkeley, and has worked as a battery scientist at Cuberg, a lithium-metal battery startup, and as a data scientist at Citrine Informatics, a materials informatics software startup.