Skip to content

An example showing how to use import BPX parameters into PyBaMM

License

Notifications You must be signed in to change notification settings

pybamm-team/bpx-example

Repository files navigation

🔋 PyBaMM BPX example

An example repository showing how to import parameters defined using the BPX standard. To try out the examples locally on your own machine follow the installation instructions below.

The simplest way to use BPX parameters in PyBaMM is to run a 1C constant-current discharge with a model of your choice with all the default settings and load the BPX JSON file:

import pybamm
model = pybamm.lithium_ion.DFN()  # Doyle-Fuller-Newman model
parameter_values = pybamm.ParameterValues.create_from_bpx("example-params.json")
sim = pybamm.Simulation(model, parameter_values=parameter_values)
sim.solve([0, 3600])  # solve for 1 hour
sim.plot()

💻 About PyBaMM

The example simulations use the package PyBaMM (Python Battery Mathematical Modelling). 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.

🚀 Installation

In order to run the examples in this repository you will need to install PyBaMM (version 22.12 or newer) and BPX.

We recommend installing within a virtual environment in order to not alter any python distribution files on your machine.

PyBaMM is available on GNU/Linux, MacOS and Windows. For more detailed instructions on how to install PyBaMM, see the PyBaMM documentation.

Linux/Mac OS

To install the requirements on Linux/Mac OS use the following terminal commands:

  1. Clone the repository
git clone https://github.com/pybamm-team/bpx-example
  1. Change into the bpx-example directory
cd bpx-example
  1. Create a virtual environment
virtualenv env
  1. Activate the virtual environment
source env/bin/activate
  1. Install the required packages
pip install -r requirements.txt

Windows

To install the requirements on Windows use the following commands:

  1. Clone the repository
git clone https://github.com/pybamm-team/bpx-example
  1. Change into the bpx-example directory
cd bpx-example
  1. Create a virtual environment
python -m virtualenv env
  1. Activate the virtual environment
\path\to\env\Scripts\activate

where \path\to\env is the path to the environment created in step 3 (e.g. C:\Users\'Username'\env\Scripts\activate.bat).

  1. Install the required packages
pip install -r requirements.txt

As an alternative, you can set up Windows Subsystem for Linux. This allows you to run a full Linux distribution within Windows.

Troubleshooting

Problem: ModuleNotFoundError: No module named 'wheel'.

Solution: Use the command pip install wheel before installing the requirements.

Problem: error: unable to create file "...": Filename too long. fatal: unable to checkout working tree

Solution: 1. Configure Windows to accept long file paths. 2. Configure git client to accept long paths: git config --global core.longpaths true

About

An example showing how to use import BPX parameters into PyBaMM

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages