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 OpenSSF Scorecard

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


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.11.0.tar.gz (624.3 kB view details)

Uploaded Source

Built Distributions

pybamm-24.11.0-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12 Windows x86-64

pybamm-24.11.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.6 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

pybamm-24.11.0-cp312-cp312-macosx_11_0_arm64.whl (6.1 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pybamm-24.11.0-cp312-cp312-macosx_10_13_x86_64.whl (7.8 MB view details)

Uploaded CPython 3.12 macOS 10.13+ x86-64

pybamm-24.11.0-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pybamm-24.11.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.6 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

pybamm-24.11.0-cp311-cp311-macosx_11_0_arm64.whl (6.1 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pybamm-24.11.0-cp311-cp311-macosx_10_13_x86_64.whl (7.8 MB view details)

Uploaded CPython 3.11 macOS 10.13+ x86-64

pybamm-24.11.0-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pybamm-24.11.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.6 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pybamm-24.11.0-cp310-cp310-macosx_11_0_arm64.whl (6.1 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pybamm-24.11.0-cp310-cp310-macosx_10_13_x86_64.whl (7.8 MB view details)

Uploaded CPython 3.10 macOS 10.13+ x86-64

pybamm-24.11.0-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pybamm-24.11.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.6 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pybamm-24.11.0-cp39-cp39-macosx_11_0_arm64.whl (6.1 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pybamm-24.11.0-cp39-cp39-macosx_10_13_x86_64.whl (7.8 MB view details)

Uploaded CPython 3.9 macOS 10.13+ x86-64

File details

Details for the file pybamm-24.11.0.tar.gz.

File metadata

  • Download URL: pybamm-24.11.0.tar.gz
  • Upload date:
  • Size: 624.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pybamm-24.11.0.tar.gz
Algorithm Hash digest
SHA256 43a44e09fcf96c1b1a25cf14685c8d858a4b0ff0a9c7adb9bf6ef1fca18b7f0d
MD5 e7b39946801ec60cb50a8aa97d966644
BLAKE2b-256 1681a7804e5bbf4a3eb3e5f36d3307042346d0ec1d5fa8df75c4700986e8b805

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybamm-24.11.0.tar.gz:

Publisher: publish_pypi.yml on pybamm-team/PyBaMM

Attestations:

File details

Details for the file pybamm-24.11.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pybamm-24.11.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pybamm-24.11.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 72210051bcca6c0b41121bae2bb7a3edabb989d7853dae86469d50716c3cb341
MD5 eedca3a06c8a05182dab05cde3bbe965
BLAKE2b-256 32fa76683a1b2f8b88c00e1b6f3a762c3f02fd428807eb5bdb73bb752c97d053

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybamm-24.11.0-cp312-cp312-win_amd64.whl:

Publisher: publish_pypi.yml on pybamm-team/PyBaMM

Attestations:

File details

Details for the file pybamm-24.11.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pybamm-24.11.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ec7197c62dfe350775b0816ef07a4694a0d164843e713aec80dd9dd7620a7764
MD5 79020d0a2ee3ca794e4207084438ae06
BLAKE2b-256 8766dfe02f24b7951f07bdea71cf445da2f449ab1b324b14f8f65aba8dd9a65e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybamm-24.11.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish_pypi.yml on pybamm-team/PyBaMM

Attestations:

File details

Details for the file pybamm-24.11.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pybamm-24.11.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bed258e8b75f5491178e083473e9099a88eee0a184315d3d00908c6fc5fe4231
MD5 afae776c5591d5188001e301b2e6192b
BLAKE2b-256 9fcaf61a3d7a08cee05ab7e41282507ba77f98a57f403efb58743034211ae753

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybamm-24.11.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: publish_pypi.yml on pybamm-team/PyBaMM

Attestations:

File details

Details for the file pybamm-24.11.0-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pybamm-24.11.0-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 171807a273368bac155fdc816cb6c4ea351b7750823a478a705642df1965d1e4
MD5 5c912d391ea6201b928244546dbbba66
BLAKE2b-256 b3d1dae66d1473788a509dd978d1df9d1fd821f0d69f075d02572a33640510ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybamm-24.11.0-cp312-cp312-macosx_10_13_x86_64.whl:

Publisher: publish_pypi.yml on pybamm-team/PyBaMM

Attestations:

File details

Details for the file pybamm-24.11.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pybamm-24.11.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pybamm-24.11.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2a9a9eb54955d2273c9e0c924d65fcf0ce26cf5d34c2f2e40143481cbdcffa5c
MD5 7297fedca8757888071ac851283e9145
BLAKE2b-256 5dd102a704dc8c3e41e836bbae6543cc96be641d6d778d65156cd6348e0d2dba

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybamm-24.11.0-cp311-cp311-win_amd64.whl:

Publisher: publish_pypi.yml on pybamm-team/PyBaMM

Attestations:

File details

Details for the file pybamm-24.11.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pybamm-24.11.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1f3b16e659199c6e305bf6dfaeee629cd0759d9d88dcaca744fbf2616e464bb2
MD5 989d9f1a15f4ffc39877d6995d9091df
BLAKE2b-256 228e483eea3fca9e6b7275338ea3de1f5cc09194485528f202be8e3701cecf12

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybamm-24.11.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish_pypi.yml on pybamm-team/PyBaMM

Attestations:

File details

Details for the file pybamm-24.11.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pybamm-24.11.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 142c8e5d9e4817bdc35aeeb0cdd95e15661f8ee7a9beac41f29232b284eb3888
MD5 b76a8e34b99919f1bbd0dca4cb342604
BLAKE2b-256 edba4c75ac2f32b64928cb16d07e4dbcbfbd2244d2350e4fc070d0dee168b604

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybamm-24.11.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: publish_pypi.yml on pybamm-team/PyBaMM

Attestations:

File details

Details for the file pybamm-24.11.0-cp311-cp311-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pybamm-24.11.0-cp311-cp311-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 9c7bde2ec59bd1e2cd520c0393db25314f81a96633411f6ecd54dbf6f1c03d99
MD5 7f6a2df6aa38cdf27d57fd4baf687902
BLAKE2b-256 f60963ab4962998904b161de7dc8f9824de33bc484867da0722408d8ccdc90eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybamm-24.11.0-cp311-cp311-macosx_10_13_x86_64.whl:

Publisher: publish_pypi.yml on pybamm-team/PyBaMM

Attestations:

File details

Details for the file pybamm-24.11.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pybamm-24.11.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pybamm-24.11.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 cf91411ee23c23989f96ae544b387dd5d09a173ace081e90df01d16d12ddf9cf
MD5 e6fc4e5195abc249ae474c035abb8e40
BLAKE2b-256 8897faa2aba16889811c69f306c30ff76dc39b3c4889497454d530703fabc37d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybamm-24.11.0-cp310-cp310-win_amd64.whl:

Publisher: publish_pypi.yml on pybamm-team/PyBaMM

Attestations:

File details

Details for the file pybamm-24.11.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pybamm-24.11.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 506b5f7337bafba5fdd1f17a7485742359b369528b87f5bcf645429c60719cb7
MD5 1a12f9938c6e2fc621babedab973426f
BLAKE2b-256 0d187a87d8b4a5fc8c31a79888b7c446f26f3107454d571731d77ccc7be57b40

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybamm-24.11.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish_pypi.yml on pybamm-team/PyBaMM

Attestations:

File details

Details for the file pybamm-24.11.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pybamm-24.11.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e77d62962725fc5b419168dcd26c1a424423debcfee4035465d8c3d1179f020d
MD5 405a1fafbe26501a179173007536cdf5
BLAKE2b-256 ca3183493dd47a8243b54e8f9668e3ef98ffc97cd850e416d3057ff3ef063147

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybamm-24.11.0-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: publish_pypi.yml on pybamm-team/PyBaMM

Attestations:

File details

Details for the file pybamm-24.11.0-cp310-cp310-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pybamm-24.11.0-cp310-cp310-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 affcadd17d0d48863c581b9dcc779dfddd7a2916c06793d7e79c7edd0fe0bf05
MD5 53ed91758b948f18cfed6a42cfe95687
BLAKE2b-256 8f738b9058cc75ed85a2f4c35e2701f333a37b97495cb0f1e5352e47123fa6a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybamm-24.11.0-cp310-cp310-macosx_10_13_x86_64.whl:

Publisher: publish_pypi.yml on pybamm-team/PyBaMM

Attestations:

File details

Details for the file pybamm-24.11.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pybamm-24.11.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pybamm-24.11.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f11967467ea7bf3e886e14f68a895a9be1d9d296c63171f44387524e85c7cfbe
MD5 a54229a4c78e9a85ab9a597c06baebe1
BLAKE2b-256 acd6f7ef2c33a61226c53833be1552724f3f420b4a7f9dfc8e78ed2e958fa8d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybamm-24.11.0-cp39-cp39-win_amd64.whl:

Publisher: publish_pypi.yml on pybamm-team/PyBaMM

Attestations:

File details

Details for the file pybamm-24.11.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pybamm-24.11.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b857774e813c0f9ad6974bdc4598602acf860b6d2ab33df0867e20cc38c02a4a
MD5 e0ec0eaa2db33cb7e12a61b147e05d5f
BLAKE2b-256 4302b2428563233a6cb1db916a8ce17915fcd8b1609be5306eb0cb77eb175a74

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybamm-24.11.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish_pypi.yml on pybamm-team/PyBaMM

Attestations:

File details

Details for the file pybamm-24.11.0-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pybamm-24.11.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a5fdc9066316722da7a680021ba19cea4ab054b121ce6fb3fc30d13825a55b14
MD5 d47ceb457f05895f0d6a45d3e171128c
BLAKE2b-256 36712638568dd3e6ac5b17959803950a616123b06415fba624de46e87207250c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybamm-24.11.0-cp39-cp39-macosx_11_0_arm64.whl:

Publisher: publish_pypi.yml on pybamm-team/PyBaMM

Attestations:

File details

Details for the file pybamm-24.11.0-cp39-cp39-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pybamm-24.11.0-cp39-cp39-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 0f389fba2cceb119dd9740ec8a14b7eb17bc1aa6aa3c584722125173ca7508a3
MD5 56db81d3c8ae79fcbdd5e0542641a719
BLAKE2b-256 3d1586b7e36b8dfd4002294ee7bcb3f7c4af1f4a9106ee813b8043498ee80bc0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybamm-24.11.0-cp39-cp39-macosx_10_13_x86_64.whl:

Publisher: publish_pypi.yml on pybamm-team/PyBaMM

Attestations:

Supported by

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