Skip to main content

Python Battery Mathematical Modelling.

Project description

PyBaMM_logo

Build readthedocs codecov Open In Colab DOI release black code style

All Contributors

PyBaMM

PyBaMM (Python Battery Mathematical Modelling) solves physics-based electrochemical DAE models by using state-of-the-art automatic differentiation and numerical solvers. The Doyle-Fuller-Newman model can be solved in under 0.1 seconds, while the reduced-order Single Particle Model and Single Particle Model with electrolyte can be solved in just a few milliseconds. Additional physics can easily be included such as thermal effects, fast particle diffusion, 3D effects, and more. All models are implemented in a flexible manner, and a wide range of models and parameter sets (NCA, NMC, LiCoO2, ...) are available. There is also functionality to simulate any set of experimental instructions, such as CCCV or GITT, or specify drive cycles.

๐Ÿ’ป 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 CCCV:

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.

๐Ÿš€ 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

Following GNU/Linux and macOS 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

Thanks goes to these wonderful people (emoji key):


Valentin Sulzer

๐Ÿ› ๐Ÿ’ป ๐Ÿ“– ๐Ÿ’ก ๐Ÿค” ๐Ÿšง ๐Ÿ‘€ โš ๏ธ โœ… ๐Ÿ“

Robert Timms

๐Ÿ› ๐Ÿ’ป ๐Ÿ“– ๐Ÿ’ก ๐Ÿค” ๐Ÿšง ๐Ÿ‘€ โš ๏ธ โœ…

Scott Marquis

๐Ÿ› ๐Ÿ’ป ๐Ÿ“– ๐Ÿ’ก ๐Ÿค” ๐Ÿšง ๐Ÿ‘€ โš ๏ธ โœ…

Martin Robinson

๐Ÿ› ๐Ÿ’ป ๐Ÿ“– ๐Ÿ’ก ๐Ÿค” ๐Ÿ‘€ โš ๏ธ โœ…

Ferran Brosa Planella

๐Ÿ‘€ ๐Ÿ› ๐Ÿ’ป ๐Ÿ“– ๐Ÿ’ก ๐Ÿค” ๐Ÿšง โš ๏ธ โœ… ๐Ÿ“

Tom Tranter

๐Ÿ› ๐Ÿ’ป ๐Ÿ“– ๐Ÿ’ก ๐Ÿค” ๐Ÿ‘€ โš ๏ธ โœ…

Thibault Lestang

๐Ÿ› ๐Ÿ’ป ๐Ÿ“– ๐Ÿ’ก ๐Ÿค” ๐Ÿ‘€ โš ๏ธ ๐Ÿš‡

Diego

๐Ÿ› ๐Ÿ‘€ ๐Ÿ’ป ๐Ÿš‡

felipe-salinas

๐Ÿ’ป โš ๏ธ

suhaklee

๐Ÿ’ป โš ๏ธ

viviantran27

๐Ÿ’ป โš ๏ธ

gyouhoc

๐Ÿ› ๐Ÿ’ป โš ๏ธ

Yannick Kuhn

๐Ÿ’ป โš ๏ธ

Jacqueline Edge

๐Ÿค” ๐Ÿ“‹ ๐Ÿ”

Fergus Cooper

๐Ÿ’ป โš ๏ธ

jonchapman1

๐Ÿค” ๐Ÿ”

Colin Please

๐Ÿค” ๐Ÿ”

cwmonroe

๐Ÿค” ๐Ÿ”

Greg

๐Ÿค” ๐Ÿ”

Faraday Institution

๐Ÿ’ต

Alexander Bessman

๐Ÿ› ๐Ÿ’ก

dalbamont

๐Ÿ’ป

Anand Mohan Yadav

๐Ÿ“–

WEILONG AI

๐Ÿ’ป ๐Ÿ’ก โš ๏ธ

lonnbornj

๐Ÿ’ป โš ๏ธ ๐Ÿ’ก

Priyanshu Agarwal

โš ๏ธ ๐Ÿ’ป ๐Ÿ› ๐Ÿ‘€ ๐Ÿšง โœ…

DrSOKane

๐Ÿ’ป ๐Ÿ’ก ๐Ÿ“– โš ๏ธ โœ…

Saransh Chopra

๐Ÿ’ป โš ๏ธ ๐Ÿ“– โœ… ๐Ÿ‘€ ๐Ÿšง

David Straub

๐Ÿ› ๐Ÿ’ป

maurosgroi

๐Ÿค”

Amarjit Singh Gaba

๐Ÿ’ป

KennethNwanoro

๐Ÿ’ป โš ๏ธ

Ali Hussain Umar Bhatti

๐Ÿ’ป โš ๏ธ

Leshinka Molel

๐Ÿ’ป ๐Ÿค”

tobykirk

๐Ÿค” ๐Ÿ’ป โš ๏ธ โœ…

Chuck Liu

๐Ÿ› ๐Ÿ’ป

partben

๐Ÿ“–

Gavin Wiggins

๐Ÿ› ๐Ÿ’ป

Dion Wilde

๐Ÿ› ๐Ÿ’ป

Elias Hohl

๐Ÿ’ป

KAschad

๐Ÿ›

Vaibhav-Chopra-GT

๐Ÿ’ป

bardsleypt

๐Ÿ› ๐Ÿ’ป

ndrewwang

๐Ÿ› ๐Ÿ’ป

MichaPhilipp

๐Ÿ›

This project follows the all-contributors specification. Contributions of any kind welcome!

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

Uploaded Source

Built Distributions

pybamm-22.9-cp39-cp39-win_amd64.whl (2.5 MB view details)

Uploaded CPython 3.9 Windows x86-64

pybamm-22.9-cp39-cp39-manylinux2010_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

pybamm-22.9-cp39-cp39-manylinux2010_i686.whl (5.1 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ i686

pybamm-22.9-cp39-cp39-macosx_10_9_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pybamm-22.9-cp38-cp38-win_amd64.whl (2.5 MB view details)

Uploaded CPython 3.8 Windows x86-64

pybamm-22.9-cp38-cp38-manylinux2010_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

pybamm-22.9-cp38-cp38-manylinux2010_i686.whl (5.1 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ i686

pybamm-22.9-cp38-cp38-macosx_10_9_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

pybamm-22.9-cp37-cp37m-win_amd64.whl (2.5 MB view details)

Uploaded CPython 3.7m Windows x86-64

pybamm-22.9-cp37-cp37m-manylinux2010_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

pybamm-22.9-cp37-cp37m-manylinux2010_i686.whl (5.1 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ i686

pybamm-22.9-cp37-cp37m-macosx_10_9_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: pybamm-22.9.tar.gz
  • Upload date:
  • Size: 946.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for pybamm-22.9.tar.gz
Algorithm Hash digest
SHA256 abd411a8fe14ced195611fb9ce67bf07dbb2625e98659bc520145f38d2886b04
MD5 f34d0f4414e2352c022697cbb69c8572
BLAKE2b-256 f76db4d839f32349389ab6e1a05fa07dc653fe17c05ae5d9d5c0c2ca1837bfb7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pybamm-22.9-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for pybamm-22.9-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 bf3314ab4002415f99e8a8a73f6c27705c1d3531fe3421a2f4cf030559174f82
MD5 9bb5a68a0c4b12768c8bc02b57ec66f2
BLAKE2b-256 bb57767bf31f991dc219354ac3370b684327f0fd8c9417912733c83b8ddfc770

See more details on using hashes here.

File details

Details for the file pybamm-22.9-cp39-cp39-manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for pybamm-22.9-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 62d87926ecc739dcdf26c7c75434eff03c6929aacee01d9178b197f78742cc83
MD5 f32f813f54f64e36f4bcbda80801660d
BLAKE2b-256 a6957d2bd92f7e6de13ca4ea1123f1b82e0838c7ea0d6adad1f2320fa664a7f4

See more details on using hashes here.

File details

Details for the file pybamm-22.9-cp39-cp39-manylinux2010_i686.whl.

File metadata

File hashes

Hashes for pybamm-22.9-cp39-cp39-manylinux2010_i686.whl
Algorithm Hash digest
SHA256 6c5da918415c9eb6d6bbf06d5d3170d2564452a95eec4bd1d91153968977ab66
MD5 a4214e3a3f0f5c95f29c226984d4090b
BLAKE2b-256 78427fbcf58995dff147799d500c079f2d01b5189462f4276c8d7a5008ff161d

See more details on using hashes here.

File details

Details for the file pybamm-22.9-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pybamm-22.9-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b20547cef82eea6e61b8943b02b8b9174075708ae5b5d27c218e0ba7de7549ff
MD5 c550040cb79cd0902f4530e34ff5836e
BLAKE2b-256 dc46dbfbff608f0b217ba716952b8e01430ec7f55d05bd9487d792e57efeb1a4

See more details on using hashes here.

File details

Details for the file pybamm-22.9-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: pybamm-22.9-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for pybamm-22.9-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 4388072787d652d84280b6934d51d2c7fb7590803e40707d2baa04946d3fda7d
MD5 39055c22f4e2153ceb290e0476bd7f85
BLAKE2b-256 8c9300b8df58914c368595b41066117069ca0013434f6f344b8a4d54d6746f2a

See more details on using hashes here.

File details

Details for the file pybamm-22.9-cp38-cp38-manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for pybamm-22.9-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 b4d655d269cdfb070fa5919d2332a009f3ec8097f985f0762b67ea6e6e99425e
MD5 1df7281e15878adfd8185aadad64dc60
BLAKE2b-256 240189c319b1faf3ae362821143f9e2b1dc274d0909faf99d0ce7ed5e2a10f53

See more details on using hashes here.

File details

Details for the file pybamm-22.9-cp38-cp38-manylinux2010_i686.whl.

File metadata

File hashes

Hashes for pybamm-22.9-cp38-cp38-manylinux2010_i686.whl
Algorithm Hash digest
SHA256 dfada958db7cf1d3b95f3fd9f7c098a8c759d03bdcb7544587ba98ad8b3dd31d
MD5 10992415c040a286d71ce9fe810963ae
BLAKE2b-256 7dd3475dedf5c478fe708c587c1d3e58e1be12eb3f0dfafcb4c3456934c94f53

See more details on using hashes here.

File details

Details for the file pybamm-22.9-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pybamm-22.9-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f25d148ffed5742fa767074f4a94cd6e97df8e05166c4eccf440e62fa75037cf
MD5 402d8808d9674d53405a5800c8c8516f
BLAKE2b-256 bfb1d1c436af121165bc4d2a3c2842ef5af34e9e2c8bdbebbcdb35ebaa955fe5

See more details on using hashes here.

File details

Details for the file pybamm-22.9-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: pybamm-22.9-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for pybamm-22.9-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 3c11afdc6abfb69ac4c40a6bd88c00ba70b5ce75b9aec83a7c0be54ee18e3c1f
MD5 8f5818116517382f7be4d243c5e93ba7
BLAKE2b-256 6200e30fc9691c2a21487eed47dbc68b8bdab12d1265fb02902a7122b0566066

See more details on using hashes here.

File details

Details for the file pybamm-22.9-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for pybamm-22.9-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 487ce3425d8bb09ef83298d1fb3dc3623f682664c73146b14752ef8c488ec15c
MD5 605af449be7ff2d713ee84cc27638f8b
BLAKE2b-256 0af5c92ae04357e06711b1dc48864c4cb1f160ffafaf73605aa639180a00bed1

See more details on using hashes here.

File details

Details for the file pybamm-22.9-cp37-cp37m-manylinux2010_i686.whl.

File metadata

File hashes

Hashes for pybamm-22.9-cp37-cp37m-manylinux2010_i686.whl
Algorithm Hash digest
SHA256 6ea19d36f927d2647e0d5fa21ca9ca418b982845d1f8dc26d45c006773114e67
MD5 e8126d9bdc42471439d27363033848bc
BLAKE2b-256 21972fbd4acf26997ae9a8b400c793d308bc4bc6402206dc7b1a6c8cf33906e1

See more details on using hashes here.

File details

Details for the file pybamm-22.9-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pybamm-22.9-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e18510eb8ccce96f3d8575f77526f565f5427e8dc3858fa0df8162d0b30d8811
MD5 87b816156d710223a8e14427160bfa0f
BLAKE2b-256 c7435c355a00c5c7d551093b6046620b362807dfc2b3aa2a6dcdcc922a73dde6

See more details on using hashes here.

Supported by

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