Skip to main content

Python Battery Mathematical Modelling

Project description

PyBaMM_logo

Powered by NumFOCUS Scheduled readthedocs codecov Open In Colab DOI release code style

All Contributors

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

pypi downloads

pip install pybamm

Using conda

PyBaMM is available as a conda package through the conda-forge channel.

conda_forge downloads

conda install -c conda-forge pybamm

Optional solvers

The following solvers are optionally available:

📖 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

pybamm-24.5rc2.tar.gz (575.6 kB view details)

Uploaded Source

Built Distributions

pybamm-24.5rc2-cp312-cp312-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.12Windows x86-64

pybamm-24.5rc2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pybamm-24.5rc2-cp312-cp312-macosx_11_0_x86_64.whl (7.7 MB view details)

Uploaded CPython 3.12macOS 11.0+ x86-64

pybamm-24.5rc2-cp312-cp312-macosx_11_0_arm64.whl (6.0 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pybamm-24.5rc2-cp311-cp311-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.11Windows x86-64

pybamm-24.5rc2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pybamm-24.5rc2-cp311-cp311-macosx_11_0_x86_64.whl (7.7 MB view details)

Uploaded CPython 3.11macOS 11.0+ x86-64

pybamm-24.5rc2-cp311-cp311-macosx_11_0_arm64.whl (6.0 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pybamm-24.5rc2-cp310-cp310-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.10Windows x86-64

pybamm-24.5rc2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

pybamm-24.5rc2-cp310-cp310-macosx_11_0_x86_64.whl (7.7 MB view details)

Uploaded CPython 3.10macOS 11.0+ x86-64

pybamm-24.5rc2-cp310-cp310-macosx_11_0_arm64.whl (6.0 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pybamm-24.5rc2-cp39-cp39-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.9Windows x86-64

pybamm-24.5rc2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.5 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

pybamm-24.5rc2-cp39-cp39-macosx_11_0_x86_64.whl (7.7 MB view details)

Uploaded CPython 3.9macOS 11.0+ x86-64

pybamm-24.5rc2-cp39-cp39-macosx_11_0_arm64.whl (6.0 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file pybamm-24.5rc2.tar.gz.

File metadata

  • Download URL: pybamm-24.5rc2.tar.gz
  • Upload date:
  • Size: 575.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for pybamm-24.5rc2.tar.gz
Algorithm Hash digest
SHA256 6021d7bbbe78d1871009306a32fef37c0641691806f3e306584bfb2800e4b44e
MD5 081cf9fa8a66491468beab24f3a8a83d
BLAKE2b-256 5ce87f9eb0b282a5c7c5c832b9331752645791d231c5d94a1f5c8ec4851b6e06

See more details on using hashes here.

File details

Details for the file pybamm-24.5rc2-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pybamm-24.5rc2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for pybamm-24.5rc2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e6fbd944626682da361701f340f465fc43e01e1207711a3e62baf42cea0c3fa2
MD5 0aba54419b7c342ebd2f9b8de850f9dc
BLAKE2b-256 97d59ae7c786ef1e15fdf20a49ea4a1ab374dee5c900f2c147ead096a45fc9a6

See more details on using hashes here.

File details

Details for the file pybamm-24.5rc2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pybamm-24.5rc2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 24395b3a3ecde43c3cfa8c4e89dd92f95949ad6489eac99d5178e8e1841255de
MD5 809d0a3191db5e22f89e498963b3b5f6
BLAKE2b-256 5e5d85544dc16915205595eed41e223fba9348f7446042fe83d51255d78868d5

See more details on using hashes here.

File details

Details for the file pybamm-24.5rc2-cp312-cp312-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for pybamm-24.5rc2-cp312-cp312-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 9a205b2dc54f8885ad5848203370e4e825825ffee8e24a7d500ea511b6be436b
MD5 9e2bd77474d95d35a7b3ac6b0b565cad
BLAKE2b-256 267802e41c243cdfd630a7023bfe537b0dd2d5c8e96ed7adf2e7ea5ee3f547e0

See more details on using hashes here.

File details

Details for the file pybamm-24.5rc2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pybamm-24.5rc2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 22dda72fbb7830a33c1b5208f20863fd38f08fbad5f74d38eed27f33df9f9c1d
MD5 0ae0e59ee968bec3c3488bc3a55c1f36
BLAKE2b-256 b8aa9c0962126e1992a5b570f8fabf6c40efa4870b70d241a9d68d25d43dd2cf

See more details on using hashes here.

File details

Details for the file pybamm-24.5rc2-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pybamm-24.5rc2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for pybamm-24.5rc2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 afa36232f2b45ab9d31cfcc96839e892a1a19e7e66d265e10a223363b687b730
MD5 82a877a8002bf59b31f15e1795c775ae
BLAKE2b-256 64c89a9810511796500e0d06ae94c37d5f20844e0fd4702d9d4f492f3ab2bc37

See more details on using hashes here.

File details

Details for the file pybamm-24.5rc2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pybamm-24.5rc2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a6f0e6104e48d71c98e0ce0216ea06e84a09b8a2cf2c12b8d4c08edd6d6e266a
MD5 31f13848e6df098da465c04b32c3ff06
BLAKE2b-256 4a7c320d4820f8f32e2b908a733415dd34884993bace7724ee017a29c608ee48

See more details on using hashes here.

File details

Details for the file pybamm-24.5rc2-cp311-cp311-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for pybamm-24.5rc2-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 d1c2ca268d9035b96868f5d0f2760495dd69e49ef5175a9ccccf0cead5b5d414
MD5 d6324d012adc251e08a09842069ddb77
BLAKE2b-256 9037f978d9baf9bde56eb006c0d5f88e7609cd9b49adc453923b612869eb117b

See more details on using hashes here.

File details

Details for the file pybamm-24.5rc2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pybamm-24.5rc2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1efe151f283f6d9f6de32959830ca063556849fe334205aaaf1d658577076ff4
MD5 02043b73b849c1e956e1c4d5fa47cf38
BLAKE2b-256 f5e3864c2ed0e286aeb1ad79856f07f1e9aa94f3a89878c6d9808ddcb5d86bb4

See more details on using hashes here.

File details

Details for the file pybamm-24.5rc2-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pybamm-24.5rc2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for pybamm-24.5rc2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 fc1e62954aba741821c1a20bb6fa99efd64e7e84083b84db0c00f3f6b37c2f39
MD5 d3cde9a4af120717309bf224db948929
BLAKE2b-256 c7b79860de2e25b584f30f13256673eccbba6a32c714765bd00deb2a7da34855

See more details on using hashes here.

File details

Details for the file pybamm-24.5rc2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pybamm-24.5rc2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8926c3672f8d6b9c9b1a000e51206322bd28ea1428e07f801c37170633f8263f
MD5 693e94aa7b698343f941507edaa8d469
BLAKE2b-256 fafc70454b5a91c3c793e0dfa7b1cd6e891197e3a86c938a61154700d571425f

See more details on using hashes here.

File details

Details for the file pybamm-24.5rc2-cp310-cp310-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for pybamm-24.5rc2-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 1325d1b79593b027b5e6f2230512da5c716bd0e66bf9628d0ee269de7bd82261
MD5 4c64e3a550bde0e7a3eb179ee1fa4622
BLAKE2b-256 81320cbaef45157a759624d024dd68feb6ca5ce934a5c3b1f0866ddcfaf616e9

See more details on using hashes here.

File details

Details for the file pybamm-24.5rc2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pybamm-24.5rc2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9d7da839734d6f7d861431f3c977c3fbdcf48aed19bf7d4d61903fd5d7b7c3d4
MD5 51ada1e5159594ccd8f0c21d0a252e96
BLAKE2b-256 534d506688c46f8daaf187681d484a9711e84a6a052edd93713fb76419c98538

See more details on using hashes here.

File details

Details for the file pybamm-24.5rc2-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pybamm-24.5rc2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for pybamm-24.5rc2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 e0a66cbad78223421faa20330244396e5d577b245e63721038188c764fd6e721
MD5 9e3f4b360bad1fe54342366542b599db
BLAKE2b-256 674af92196fdaeb22b7daaede075e210f80f9a43a6adc62786cce7ca9474d38c

See more details on using hashes here.

File details

Details for the file pybamm-24.5rc2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pybamm-24.5rc2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8e63026a1c60ea47fcd4fce12f0928f681f0fb8ed2d379291d7f7e5fa95e150d
MD5 14ec003c938a4b242942b87920d16aa4
BLAKE2b-256 a670dd11b4ae4ffcfdf9c64483104736b2af1c9fe0841f3f7c1f083cfda3570e

See more details on using hashes here.

File details

Details for the file pybamm-24.5rc2-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for pybamm-24.5rc2-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 747fa51ddac0a03670120e7c024eb74a41bb43500dbf07df99d8ef69d7c1c499
MD5 6c4582b2b22544e25cff358ac3af579c
BLAKE2b-256 760100f7de0a898df59a8d4da68e90f5255092a477dd3f63ab928b55c2d298bb

See more details on using hashes here.

File details

Details for the file pybamm-24.5rc2-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pybamm-24.5rc2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 779b254d2a22373dfd2dd7d10672d00f7709d4544896bc6573caccadc5daf4f5
MD5 6ac0ea28bbc933c87f588157c7f56a16
BLAKE2b-256 8240391b7d99c2ec0787fc4c2f8faf881f16df40bb4d79a27de6ae7832ec4b26

See more details on using hashes here.

Supported by

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