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

This version

24.5

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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.12Windows x86-64

pybamm-24.5-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.5-cp312-cp312-macosx_11_0_x86_64.whl (7.7 MB view details)

Uploaded CPython 3.12macOS 11.0+ x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

pybamm-24.5-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.5-cp311-cp311-macosx_11_0_x86_64.whl (7.7 MB view details)

Uploaded CPython 3.11macOS 11.0+ x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

pybamm-24.5-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.5-cp310-cp310-macosx_11_0_x86_64.whl (7.7 MB view details)

Uploaded CPython 3.10macOS 11.0+ x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

pybamm-24.5-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.5-cp39-cp39-macosx_11_0_x86_64.whl (7.7 MB view details)

Uploaded CPython 3.9macOS 11.0+ x86-64

pybamm-24.5-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.5.tar.gz.

File metadata

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

File hashes

Hashes for pybamm-24.5.tar.gz
Algorithm Hash digest
SHA256 3a5caf51a2198a7a1d5470572702bee2dde90a9b1bc2c2674eae9ecbb69d3096
MD5 ef4cf6b2f0984c59429df754be845491
BLAKE2b-256 3b35ba18f3d6443d00db14e03a3e5622a766f7ad8f7054eae5df7d7e50dae04a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pybamm-24.5-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.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d61aeba577912f9365980164426c7275946be5c99732128df4e0d9262addd99c
MD5 d2a4d649f0f4f5bf8c2f43acc3ca6dca
BLAKE2b-256 c1d325b88cd16f046f1dfd4184cc7a64684a014e48392a55e56975ed69e18971

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pybamm-24.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 70629e7a0046431ff87ac5227d9593edd9bf613897a9542004d72443475d8684
MD5 43e2e61f8b4f4dae91ed1b92addcef7e
BLAKE2b-256 648f1b595bf630e715ac27e82d477fb79d1d61862b374f05bf41618e253889a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pybamm-24.5-cp312-cp312-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 88f03ebccb719c64b41dd8019d79a41fc204a917082d386c26e34c105d7ce102
MD5 441791b83e180561b8896e40bc3356a8
BLAKE2b-256 27ea037be7dcd4e6a102477da60d1198212a480c895f0e8814d3e105efa5e7f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pybamm-24.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f802acafaffab9bf9fa161b3831d0a6e33c5c6d1f46a47a4719d8d7ff5d490ce
MD5 1ffba539bd6b39fc177791cea37756f2
BLAKE2b-256 dc6665c54d57e2180505c33db17d3c908548d6b2832ebc8d423d502726ddb2e6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pybamm-24.5-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.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 6638b48d67d7a994cf9e8cc56fa4e97fbdcb202367e98b18ff7fbf83082facbd
MD5 f374204989b66cb3d13c426bc68fcf30
BLAKE2b-256 7a308faae01ae80843c950310f65cba4e5a8741bdab59b45298fc74535d8c16c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pybamm-24.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e4deb3879c795e0dd5dc99a1e31aad971e7d98a377823025c80be87991b62d0c
MD5 6115903bd59c458302cb3ad702eba543
BLAKE2b-256 06cf24125351d505fe77903e553b43963056bc3a7181063cb0d597ff7240ffbb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pybamm-24.5-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 1322f063ab15f808b763c509af1bd5f2d8a923692f7b9588641733ccb55a111e
MD5 d8a76a82ede60084dc74f3c9124d2dfb
BLAKE2b-256 faa79e5affc5f91afe8f7444f65fb898e87b0d5f610e0b7cc67bd2d11577d8e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pybamm-24.5-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3463c194cdfb91c0c3cf55145d39ad137e237bd0c2c228710d82f8e3777a7595
MD5 6c006620d010780935122bcdad23d7b5
BLAKE2b-256 7dda111f38af2bc46f9a5155671d234ecc974d357472e5bd2613652803376c54

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pybamm-24.5-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.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 8556d68a4e3563c002530148d806f60de5e60199f414519727753e2e64de1c2f
MD5 56fee58c90bb816474cd2b5058cc42e4
BLAKE2b-256 dc12c7f2b869671372191af0af278e1c3ea0c5d501ad365f2eb4a33c6fd44f89

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pybamm-24.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 29d7c7f2d1123073bf355b5892b3b02603c2f4a2be697f2fda83aa45cc498f2d
MD5 507c483e0bd2b06b68e03778baebe6e1
BLAKE2b-256 9774bd1643378bf9001f6cfea88266b137e87e7f850ed8ab93cb3b081b7902cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pybamm-24.5-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 519efa18b6f3d15bc5cda05023947c782ba31bd758519640931a96f7a2406f53
MD5 1fbbbbeb5369db962d8aa2a1e2cf65d7
BLAKE2b-256 f296682abfe4ac2cbf8041d3d9e9818d843d6cddcb04c3953985d24c20eb1fde

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pybamm-24.5-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8cffbc98f6a91b4b99eb471835961953111406e820c631b6fbe4fea744e8cc00
MD5 ab58822a6c4266a576ad98ee044ef26a
BLAKE2b-256 ecb11a4232e7780e3f7a637f71ee95f921f1113bbab387d5ddaa7d8498269409

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pybamm-24.5-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.5-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 675001a882a1553af214e298e85651215a4c9d9367043043fc94773e19351054
MD5 7d4c109c6a79ee77722fcf9a34741a21
BLAKE2b-256 52cee2f68344ee8444835a5ea48e348c2288f517285dc0d349e87a8e7d6d8910

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pybamm-24.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8bc9cd24c3bbdbf43e206a8f787655b15487105f2b1647aa32f370ea598a5386
MD5 b7a6a025e61456247c1c5feeafb1d5d4
BLAKE2b-256 c521bda16b7463bdf17a6cd68d1d845d1ec4c4c230aa020e9c8528385e9ddf85

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pybamm-24.5-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 1de9e81aee921c166c308f23724cf6869208d12a7321e75ebf8dd1d9d96804fb
MD5 7cdd93994e999a29947569b4bb675cd7
BLAKE2b-256 f42637d82414c5243c89aba2335218049ef1e146a80d3ac355554b891f9aac51

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pybamm-24.5-cp39-cp39-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 6.0 MB
  • Tags: CPython 3.9, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for pybamm-24.5-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dacdeb9591456c36c3b2cf1aea051f3de861a4d7d51e5deb2a57b6a0cdcae80d
MD5 470385550e1b1bec1f92b888504e03d4
BLAKE2b-256 29a75c8cda3b07b0ba97d6670f4d3e1e72f236f2b56671b96815895c9407e23c

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