Python Battery Mathematical Modelling
Project description
PyBaMM
PyBaMM (Python Battery Mathematical Modelling) is an open-source battery simulation package written in Python. Our mission is to accelerate battery modelling research by providing open-source tools for multi-institutional, interdisciplinary collaboration. Broadly, PyBaMM consists of (i) a framework for writing and solving systems of differential equations, (ii) a library of battery models and parameters, and (iii) specialized tools for simulating battery-specific experiments and visualizing the results. Together, these enable flexible model definitions and fast battery simulations, allowing users to explore the effect of different battery designs and modeling assumptions under a variety of operating scenarios.
PyBaMM uses an open governance model and is fiscally sponsored by NumFOCUS. Consider making a tax-deductible donation to help the project pay for developer time, professional services, travel, workshops, and a variety of other needs.
💻 Using PyBaMM
The easiest way to use PyBaMM is to run a 1C constant-current discharge with a model of your choice with all the default settings:
import pybamm
model = pybamm.lithium_ion.DFN() # Doyle-Fuller-Newman model
sim = pybamm.Simulation(model)
sim.solve([0, 3600]) # solve for 1 hour
sim.plot()
or simulate an experiment such as a constant-current discharge followed by a constant-current-constant-voltage charge:
import pybamm
experiment = pybamm.Experiment(
[
(
"Discharge at C/10 for 10 hours or until 3.3 V",
"Rest for 1 hour",
"Charge at 1 A until 4.1 V",
"Hold at 4.1 V until 50 mA",
"Rest for 1 hour",
)
]
* 3,
)
model = pybamm.lithium_ion.DFN()
sim = pybamm.Simulation(model, experiment=experiment, solver=pybamm.CasadiSolver())
sim.solve()
sim.plot()
However, much greater customisation is available. It is possible to change the physics, parameter values, geometry, submesh type, number of submesh points, methods for spatial discretisation and solver for integration (see DFN script or notebook).
For new users we recommend the Getting Started guides. These are intended to be very simple step-by-step guides to show the basic functionality of PyBaMM, and can either be downloaded and used locally, or used online through Google Colab.
Further details can be found in a number of detailed examples, hosted here on github. In addition, there is a full API documentation, hosted on Read The Docs. Additional supporting material can be found here.
Note that the examples on the default develop
branch are tested on the latest develop
commit. This may sometimes cause errors when running the examples on the pybamm pip package, which is synced to the main
branch. You can switch to the main
branch on github to see the version of the examples that is compatible with the latest pip release.
Versioning
PyBaMM makes releases every four months and we use CalVer, which means that the version number is YY.MM
. The releases happen, approximately, at the end of January, May and September. There is no difference between releases that increment the year and releases that increment the month; in particular, releases that increment the month may introduce breaking changes. Breaking changes for each release are communicated via the CHANGELOG, and come with deprecation warnings or errors that are kept for at least one year (3 releases). If you find a breaking change that is not documented, or think it should be undone, please open an issue on GitHub.
🚀 Installing PyBaMM
PyBaMM is available on GNU/Linux, MacOS and Windows. We strongly recommend to install PyBaMM within a python virtual environment, in order not to alter any distribution python files. For instructions on how to create a virtual environment for PyBaMM, see the documentation.
Using pip
pip install pybamm
Using conda
PyBaMM is available as a conda package through the conda-forge channel.
conda install -c conda-forge pybamm
Optional solvers
The following solvers are optionally available:
- jax-based solver, see the documentation.
📖 Citing PyBaMM
If you use PyBaMM in your work, please cite our paper
Sulzer, V., Marquis, S. G., Timms, R., Robinson, M., & Chapman, S. J. (2021). Python Battery Mathematical Modelling (PyBaMM). Journal of Open Research Software, 9(1).
You can use the BibTeX
@article{Sulzer2021,
title = {{Python Battery Mathematical Modelling (PyBaMM)}},
author = {Sulzer, Valentin and Marquis, Scott G. and Timms, Robert and Robinson, Martin and Chapman, S. Jon},
doi = {10.5334/jors.309},
journal = {Journal of Open Research Software},
publisher = {Software Sustainability Institute},
volume = {9},
number = {1},
pages = {14},
year = {2021}
}
We would be grateful if you could also cite the relevant papers. These will change depending on what models and solvers you use. To find out which papers you should cite, add the line
pybamm.print_citations()
to the end of your script. This will print BibTeX information to the terminal; passing a filename to print_citations
will print the BibTeX information to the specified file instead. A list of all citations can also be found in the citations file. In particular, PyBaMM relies heavily on CasADi.
See CONTRIBUTING.md for information on how to add your own citations when you contribute.
🛠️ Contributing to PyBaMM
If you'd like to help us develop PyBaMM by adding new methods, writing documentation, or fixing embarrassing bugs, please have a look at these guidelines first.
📫 Get in touch
For any questions, comments, suggestions or bug reports, please see the contact page.
📃 License
PyBaMM is fully open source. For more information about its license, see LICENSE.
✨ Contributors
This project follows the all-contributors specification. Contributions of any kind are welcome!
Click here to see a full list of our contributors' profiles.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for pybamm-24.9.0-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 705b33863329aff494974b2ea1ecb2b113030bf0d6f93ac637fb8fe356941f63 |
|
MD5 | e4a91c01e246969af2b95bcb7c49cd1e |
|
BLAKE2b-256 | 1f79178d5e8ca73d311340f1feec35a84996ea03af10f2b275660b20b291acd3 |
Hashes for pybamm-24.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4c40fe1632403e4ff232e3c4e6b8d9a10f86d8111dbdbe38e4b53c56e1cb19d |
|
MD5 | 4c6770d608ab18d823a3b092f52c2823 |
|
BLAKE2b-256 | da50ffccbac7dd30d2226e1ab10553b30da44e107fbcbfcaf36805b877481ac9 |
Hashes for pybamm-24.9.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8cba0066cab642b98ef3d5e8de52973936a734292318ba583f252d8e8b8da7d7 |
|
MD5 | 60e97af946c0f9676527dc2dc73ffac8 |
|
BLAKE2b-256 | 4217bc3b0377c1f8f4cd5d41a220e688de97bb15fb68450a1f2ae114236ce86a |
Hashes for pybamm-24.9.0-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d10d312f985304b434466aab22107672706d01e70e6249ab5ec68d0d354b42e |
|
MD5 | 07ab323a14f1caa6567725710ab2fcef |
|
BLAKE2b-256 | 038e4505f82802f1556c089e417f25f9b173c1c22a2b9985fc6ea4fe7574ab50 |
Hashes for pybamm-24.9.0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42d681a5b284c3bc3b67afc2ac0cfaabe3f067533ca94b510a69694f93ecebbc |
|
MD5 | 51adcaaf266aacb5f036beb057cc2511 |
|
BLAKE2b-256 | a3c7f3e9c8bb88c52dd540e8dcf21e88679056369cbf521215fb875782ccf1cc |
Hashes for pybamm-24.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6832726197f3f1b0ee84b69169a7ce1ae8658a126d42896bab0acf6a500bf09f |
|
MD5 | b773ddedfe7ecb0dbb352d9e2eec9bc4 |
|
BLAKE2b-256 | 91a54c3ce9728be6282e1a39680a8040b8007b1bac43b0a62fcc682ac998a2b7 |
Hashes for pybamm-24.9.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c869dd3080235ad34f18196ed75d6be7341febd1c437e8a3cda7d474d8e857e8 |
|
MD5 | 005ea0bb03c34a6944533a51f7b13524 |
|
BLAKE2b-256 | 9c71cabd9c9f51f300b25bf4f43ff680423192d1293ada58f6b04729d3324bf0 |
Hashes for pybamm-24.9.0-cp311-cp311-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41ed26bbd464c9aadc485a80560d5dfdc4bdcc6b9247c94e8877ed50bf3bd94e |
|
MD5 | 53d171bdd9dfb7997694ba7d07cc871a |
|
BLAKE2b-256 | 1c08d7853bf76a85cf386c1c2d14d6f43bf86883f0005b2710b9b2b96b336d60 |
Hashes for pybamm-24.9.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bcb29e9873193c7d49e8c331b63a866d3aabda0fa0aa13d57fd61bebef38b64 |
|
MD5 | 8f244a010a2e1f411b15d34a8a7e69e4 |
|
BLAKE2b-256 | 637a0e8063c4e76e5cf1369cadc6397685c277ecaa66320f06edf06eaf41bcbb |
Hashes for pybamm-24.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92d1d5a26d188cd0a3a02ca85a292a67cb16175448507aca72539abd5b72a3d9 |
|
MD5 | 8a0975d065401803cb185a61d0f6544f |
|
BLAKE2b-256 | dba2f394e621d9a83274b8dadd0376521755d88bfde570ccdc3d4bfd8867bd62 |
Hashes for pybamm-24.9.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5526e2a7d32d354b281fd9150907f730cdc97a484f10ca456b2aa0cce8a9e07 |
|
MD5 | e334ebbec3b8950a73f33c7315a7b577 |
|
BLAKE2b-256 | 5342f749f4d959b5048c66f71d0493bd9f840d4cdb81760deb3f82cafc4287d1 |
Hashes for pybamm-24.9.0-cp310-cp310-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a51cef99ac6cb5a4c3716c5647d0524b1fb10a071ac7bbd8b99019f45e7e5e4 |
|
MD5 | 66ee40c25e79a3a8e6bbba11baaa5502 |
|
BLAKE2b-256 | caf55a7b4dc8475712dc5457be85c40e0d46babc365411f344f186ddfd54da34 |
Hashes for pybamm-24.9.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc885bc6256edfd143c83df27d4ee080d3d763aa2105ecfd4a7a6757b0f05d66 |
|
MD5 | 663830da09a824cae2dcf7dad2ce9118 |
|
BLAKE2b-256 | 9531c3a6680d9db9941864673b25bd7809a993bba5fffe50e950c2285e27962c |
Hashes for pybamm-24.9.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54340cbff8c35416c01e5f4c0ff699361297e9fc60c6180d3cafb0932a9788b8 |
|
MD5 | cf916bebe39c4b0dceed4a61a11fbeaf |
|
BLAKE2b-256 | dfae57ac820ac58e0fb01c095ef8108d8a2c1abd3a9eb007f96340cce4246e8b |
Hashes for pybamm-24.9.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0089ac45c5dbdb8cd4eb830a956a89b98ad211f1746ebbf6540c3b6cf434cc6 |
|
MD5 | 1b664266ab2cf0d315f63f11928ed050 |
|
BLAKE2b-256 | be75e6c52332e9c593d7e97ece921a19027ef9ba1150208752ae416c9ef95f12 |
Hashes for pybamm-24.9.0-cp39-cp39-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b09e814b105bbc784122c8696b248ed6921caa851a3fd4ec749c0883ec482c8 |
|
MD5 | 93d0827ed8da3079ef23d319f4059492 |
|
BLAKE2b-256 | 16d8d07f5d1d77d51bc6699461b0685a5610d1def35607d5876dd5c4e567a87e |