Skip to main content

Python Battery Mathematical Modelling.

Project description

PyBaMM

travis Build status readthedocs codecov Binder black_code_style

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.

How do I use 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()
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.

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. A set of slides giving an overview of PyBaMM can be found here.

For further examples, see the list of repositories that use PyBaMM here

How can I obtain & install PyBaMM?

Linux

For instructions on installing PyBaMM on Debian-based distributions, please see here.

Mac OS

For instructions on installing PyBaMM on Mac OS distributions, please see here.

Windows

For instructions on installing PyBaMM on Windows distributions, please see here. If you want to install the optional solvers (such as scikits-odes and KLU solvers), install PyBaMM on the Windows Subsystem for Linux following the instructions here

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. (2020). Python Battery Mathematical Modelling (PyBaMM). ECSarXiv. February, 7.

You can use the bibtex

@article{sulzer2020python,
  title={Python Battery Mathematical Modelling (PyBaMM)},
  author={Sulzer, Valentin and Marquis, Scott G and Timms, Robert and Robinson, Martin and Chapman, S Jon},
  journal={ECSarXiv. February},
  volume={7},
  year={2020}
}

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.

How can I contribute 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.

Licensing

PyBaMM is fully open source. For more information about its license, see LICENSE.

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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pybamm-0.2.1-py3-none-any.whl (402.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pybamm-0.2.1.tar.gz
  • Upload date:
  • Size: 231.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.6.7

File hashes

Hashes for pybamm-0.2.1.tar.gz
Algorithm Hash digest
SHA256 90b28e2f8bedfa1f23522c089f85611603d61afec4dca1df855e6ec1bafec3fb
MD5 b944987831af3e9de213878b5239adf2
BLAKE2b-256 261edff4a3df3d54d6b802b2ddaed3c93b03e76bf4821fa97c54810fa1ef25c6

See more details on using hashes here.

File details

Details for the file pybamm-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: pybamm-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 402.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.6.7

File hashes

Hashes for pybamm-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f615216786180babafc5a176b9bde2264d02ff2b0678b94cd5eb2f7611e0c663
MD5 e70256c42a9f73f19c32918605dc05aa
BLAKE2b-256 d39d28c483c46fef614809cfb1b1e3661c673abd218b319a8535ecc478f16e09

See more details on using hashes here.

Supported by

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