Battery simulation with BattMo in Python.
Project description
PyBattMo
PyBattMo is a Python wrapper around the Julia-based BattMo.jl.
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")
# Set up the simulation
sim = Simulation(model, cell_parameters, cycling_protocol)
# Run the simulation
output = solve(sim)
# Have a quick look into what kind of cell we're dealing with
print_cell_info(cell_parameters)
# Setup model and simulation
model = LithiumIonBattery()
sim = Simulation(model, cell_parameters, cycling_protocol)
output = solve(sim)
# Have a look into which output quantities are available
print_output_overview(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
install_plotting()
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, simulation_settings=simulation_settings)
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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file battmo-0.2.0.tar.gz.
File metadata
- Download URL: battmo-0.2.0.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
488a491f7136ea8f2ca50d4184a9a73686dbbc6a8f40b8443e866d5a82b0c23e
|
|
| MD5 |
8fc4d77fa15771008746faeecfe405ca
|
|
| BLAKE2b-256 |
bd285318664c9f5fdf16999d2786edb9fa1da148b8fc1c74a2caca48acb9b535
|
File details
Details for the file battmo-0.2.0-py3-none-any.whl.
File metadata
- Download URL: battmo-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78c16090d5f46e99277f74a6d7a1426e2c8450c4627213ecedc119e868df1c60
|
|
| MD5 |
e5378bc8fd8621dbad325fefb838d06a
|
|
| BLAKE2b-256 |
f17d1a839485081550a2ff5f6c33740306e3fff7592821cf32a024f479f69052
|