Skip to main content

Battery simulation with BattMo in Python.

Project description

Logo


Documentation Build Status DOI

PyBattMo

PyBattMo is a Python wrapper around the Julia-based BattMo.jl. The Battery Modelling Toolbox (BattMo) is a resource for continuum modelling of electrochemical devices in MATLAB. The initial development features a pseudo X-dimensional (PXD) framework for the Doyle-Fuller-Newman model of lithium-ion battery cells. This is currently a early release that implements a subset of features from the MATLAB version of BattMo.

BattMo Family

BattMo can be used through several interfaces:

Installation

In addition to Python, Julia needs to be installed. Visit the Julia website for more information on how to install Julia. To install PyBattMo, use the following pip command:

pip install battmo

Quick start

Run examples using our internal library, for example the cell parameters from Chen et al.

P2D example

Here are a few examples to get you started:

from battmo import *
import plotly.express as px
import pandas as pd
import numpy as np

# Initialize the model
model = LithiumIonBattery()

# Load cell parameters and cycling protocol
cell_parameters = load_cell_parameters(from_default_set = "Chen2020")
cycling_protocol = load_cycling_protocol(from_default_set = "CCDischarge")

# Have a quick look into what kind of cell we're dealing with
quick_cell_check(cell_parameters)

# Set up the simulation
sim = Simulation(model, cell_parameters, cycling_protocol)

# Run the simulation
output = solve(sim)

# Have a look into which output quantities are available
print_info(output)

# Plotting using Plotly
df = to_pandas(output.time_series)
fig = px.line(df, x="Time", y="Voltage", title="Voltage curve")
fig.show()

# Use BattMo internal plotting functions
plot_dashboard(output, plot_type="contour")

Run a 3D simulation

from battmo import *

# Load parameter sets and settings
cell_parameters = load_cell_parameters(from_default_set="Chen2020")
cycling_protocol = load_cycling_protocol(from_default_set="CCDischarge")
model_settings = load_model_settings(from_default_set="P4D_cylindrical")

# Setup model and simulation
model = LithiumIonBattery(model_settings=model_settings)
sim = Simulation(model, cell_parameters, cycling_protocol)
output = solve(sim)

# Plot interative 3D results
plot_interactive_3d(output)

Documentation

Some additional examples are be found in the BattMo.jl documentation as well as a comprehensive documentation on the API and architecture of BattMo.jl.

Acknowledgements

BattMo has received funding from the European Union’s Horizon 2020 innovation program under grant agreement numbers:

  • 875527 HYDRA
  • 957189 BIG-MAP
  • 101104013 BATMAX
  • 101103997 DigiBatt

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

battmo-0.2.1.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

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

battmo-0.2.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file battmo-0.2.1.tar.gz.

File metadata

  • Download URL: battmo-0.2.1.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for battmo-0.2.1.tar.gz
Algorithm Hash digest
SHA256 51527c6108a7b4495dbe256fd7c711bbdd1dc62bd624dfb48ad200e1f973bba6
MD5 a18fca71141eee29f96866ed375fe1a1
BLAKE2b-256 b57b4971dad87c6671510e39c007adfcb1763f54b3c7a951fc8b8384d11a0341

See more details on using hashes here.

File details

Details for the file battmo-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: battmo-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for battmo-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4d0eb09765c4620914543dc40e2e5e48ab1cc1af24f9d35fa4bf45934c5f180c
MD5 c8737a3518ca10031cf850ce653c2dc9
BLAKE2b-256 2692cc3c430a2bac01631cb601d271ae552ac183e6fe623c24e3afc204efce16

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