Skip to main content

Battery Degradation Mode Analysis - Python implementation of TUM-EES DegradationModeAnalysis

Project description

PyDMA - Battery Degradation Mode Analysis

Python implementation of TUM-EES DegradationModeAnalysis framework

Python BSD 3-Clause License Journal of Power Sources EES Batteries
OCV shift over SOC animation

🔭 Overview

PyDMA is a Python package for performing degradation mode analysis of lithium-ion and sodium-ion batteries. Among others, both electrodes can be modeled as blends, and inhomogeneity is available for both electrodes. It reconstructs measured pseudo-OCV curves using half-cell electrode potential curves to quantify three degradation mechanisms:

  • LLI: Loss of lithium inventory (charge carrier loss)
  • LAM_an: Loss of active material at anode
  • LAM_ca: Loss of active material at cathode

The core algorithm reconstructs full-cell OCV as:

OCV_cell(SOC) = U_cathode(α_ca · SOC + β_ca) - U_anode(α_an · SOC + β_an)

Where α scales capacity and β shifts the SOC window.

⚙️ Installation

PyPI release is coming soon:

# pip install pydma

Install from source:

git clone https://github.com/tum-ees/pydma.git
cd pydma
pip install .

For development installation:

git clone https://github.com/tum-ees/pydma.git
cd pydma
pip install -e ".[dev,notebook]"

🎮 Quick Start

import pydma
from pydma import DMAAnalyzer, DMAConfig

# Load your electrode OCP data
anode_ocp = pydma.load_ocp("path/to/anode_ocp.csv")
cathode_ocp = pydma.load_ocp("path/to/cathode_ocp.csv")

# Create analyzer with configuration
config = DMAConfig(
    direction="charge",
    weight_ocv=100,
    weight_dva=1,
    weight_ica=0,
)

analyzer = DMAAnalyzer(
    anode_ocp=anode_ocp,
    cathode_ocp=cathode_ocp,
    config=config,
)

# Run analysis on aging study data
results = analyzer.analyze_aging_study(
    pocv_data={"CU1": pocv_cu1, "CU2": pocv_cu2, ...},
)

# Access degradation modes
print(f"LLI: {results.lam_results['CU2'].lli:.2%}")
print(f"LAM_an: {results.lam_results['CU2'].lam_anode:.2%}")
print(f"LAM_ca: {results.lam_results['CU2'].lam_cathode:.2%}")

# Plot results
results.plot_degradation_modes()

📖 Key Features

Blend Electrode Model

Supports blended electrodes (e.g., Silicon-Graphite anodes):

config = DMAConfig(
    use_anode_blend=True,
    gamma_anode_blend2_upper=0.30,  # Max 30% silicon
)

analyzer = DMAAnalyzer(
    anode_blend1_ocp=graphite_ocp,  # Primary: Graphite
    anode_blend2_ocp=silicon_ocp,    # Secondary: Silicon
    cathode_ocp=cathode_ocp,
    config=config,
)

Inhomogeneity Modeling

Models electrode inhomogeneity effects:

config = DMAConfig(
    allow_anode_inhomogeneity=True,
    allow_cathode_inhomogeneity=True,
    max_inhomogeneity=0.3,
)

Multiple Fitting Objectives

Combine OCV, DVA, and ICA fitting with custom weights:

config = DMAConfig(
    weight_ocv=100,
    weight_dva=1,
    weight_ica=0,
    roi_dva_min=0.1,
    roi_dva_max=0.9,
)

Speed Presets

Choose optimization thoroughness:

config = DMAConfig(speed_preset="thorough")  # "fast", "medium", or "thorough"

🔧 Silicon OCP Generation

Generate silicon OCP from measured blend electrode data:

from pydma.silicon import generate_silicon_curve

silicon_ocp = generate_silicon_curve(
    blend_ocp=measured_blend_ocp,
    graphite_ocp=graphite_reference,
    gamma_si=0.245,
    direction="lithiation",
)

📊 Parameter Vector Layout

The optimizer uses an 8-element parameter vector internally:

Index Parameter Description
0 α_an Anode scaling / capacity ratio
1 β_an Anode offset / SOC shift
2 α_ca Cathode scaling
3 β_ca Cathode offset
4 γ_blend2_an Anode blend2 fraction (0 if disabled)
5 γ_blend2_ca Cathode blend2 fraction (0 if disabled)
6 σ_an Anode inhomogeneity magnitude
7 σ_ca Cathode inhomogeneity magnitude

📚 Documentation

See the Getting Started Notebook for detailed examples.

🎖️ Acknowledgments

This is a Python translation of the TUM-EES DegradationModeAnalysis MATLAB framework. We would like to thank Johannes Natterer for providing the aging data set of a cyclic aged P45B cell and for help in translating into Python.

📯 Developers

  • Mathias Rehm, Chair of Electrical Energy Storage Technology, School of Engineering and Design, Technical University of Munich, 80333 Munich, Germany
  • Josef Eizenhammer, Chair of Electrical Energy Storage Technology, School of Engineering and Design, Technical University of Munich, 80333 Munich, Germany
  • Moritz Günthner (student research project)
  • Can Korkmaz (student research project)

✒️ Citation

This framework is the Python implementation of the MATLAB DegradationModeAnalysis toolbox. If you use this repository in any publication, please cite:

M. Rehm et al., "How to determine the degradation modes of lithium-ion batteries with silicon–graphite blend electrodes," Journal of Power Sources, 2026, DOI: 10.1016/j.jpowsour.2026.239418

The framework is also applied and validated on commercial sodium-ion batteries in the following publication. We appreciate citing this work as well, and kindly ask you to do so if your work involves sodium-ion cells:

M. Rehm et al., "Aging of commercial sodium-ion batteries with layered oxides: how to measure and analyze it?," EES Batteries, 2026, DOI: 10.1039/D5EB00221D

📜 License

BSD 3-Clause "New" or "Revised" License - see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydma-0.1.0.tar.gz (71.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydma-0.1.0-py3-none-any.whl (79.2 kB view details)

Uploaded Python 3

File details

Details for the file pydma-0.1.0.tar.gz.

File metadata

  • Download URL: pydma-0.1.0.tar.gz
  • Upload date:
  • Size: 71.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for pydma-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6654b3203f65d4c54332b741168466db84f71c50bea85566f81e2e8d87db3074
MD5 631e74a664b97d273edbe0977624a642
BLAKE2b-256 05544edb3f897f539b1fc9de6f6ee282ca05c87d54c838690fada9d8911932ac

See more details on using hashes here.

File details

Details for the file pydma-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pydma-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 79.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for pydma-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d8296da243761647b29145248a0ecec82e0c6ce00abe1d75ec0dcb74e639a3e
MD5 9a02b8dac33d61f3c5ee1ebb14ddcb71
BLAKE2b-256 5ffd14b90344490ef46bbb796cf14a89d9a8b3476c1cc8e21b4cd525f170893d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page