High-performance simulations of the Porous Electrode Theory for Li-ion batteries
47 Stars
Updated Last
7 Months Ago
Started In
February 2021

PETLION – Porous Electrode Theory for Li-ion Batteries

High-performance simulations of the pseudo-2D porous electrode theory (PET) model in Julia

  • Built for efficient controls, parameter estimation, and other complex battery simulations using the rigorous PET model
  • Runs a full charge or discharge with 301 DAEs in ~3 ms on a laptop with 1 MB total memory usage
  • Includes thermal and aging modes


After installing Julia, run the following command to add the PETLION package

import Pkg; Pkg.add("PETLION")

Getting started

To get started, we recommend checking out the list of examples. To simulate a constant current-constant temperature-constant voltage (CC-CT-CV) fast charge, run the following:

p = petlion(LCO; temperature=true)

sol = simulate(p, I=4, SOC=0, V_max=4.1, T_max=40+273.15)
simulate!(sol, p, dT=:hold, V_max=4.1)
simulate!(sol, p, V=:hold)

julia> PETLION simulation
 Runs:    I → dT → V
 Time:    1865.61 s
 Current: 0.1959C
 Voltage: 4.1 V
 Power:   23.47 W/m²
 SOC:     1.0
 Temp.:   25.6963 °C
 Exit:    Above max. SOC



If you use PETLION in your work, please cite the paper:

  title={Methods---{PETLION}: Open-Source Software for Millisecond-Scale Porous Electrode Theory-Based Lithium-Ion Battery Simulations},
  author={Berliner, Marc D and Cogswell, Daniel A and Bazant, Martin Z and Braatz, Richard D},
  journal={Journal of The Electrochemical Society},
  publisher={IOP Publishing}


This work was supported by the Toyota Research Institute through the D3BATT Center on Data-Driven-Design of Rechargeable Batteries.

See also

Check out these high-quality and open-source battery simulation tools