Coder Social home page Coder Social logo

pybamm-eis's Introduction

PyBaMM EIS

PyBaMM EIS rapidly calculates the electrochemical impedance of any battery model defined using PyBaMM, see the documentation

๐Ÿ”‹ Using PyBaMM EIS

The easiest way to use PyBaMM EIS is to compute the impedance of a model of your choice with the default parameters:

import pybammeis
import pybamm
import numpy as np

# DFN with capacitance
model = pybamm.lithium_ion.DFN(options={"surface form": "differential"})
eis_sim = pybammeis.EISSimulation(model)
# calculate impedance at log-spaced frequencies
eis_sim.solve(np.logspace(-4, 4, 30))
eis_sim.nyquist_plot()

๐Ÿ’ป About PyBaMM

The example simulations use the package PyBaMM (Python Battery Mathematical Modelling). PyBaMM 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 notebooks in this repository you will need to install the pybamm-eis package. 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/pybamm-eis
  2. Change into the pybamm-eis directory

    cd pybamm-eis
  3. Create a virtual environment

    virtualenv env
  4. Activate the virtual environment

    source env/bin/activate
  5. Install the pybammeis package

    pip install .

Windows

To install the requirements on Windows use the following commands:

  1. Clone the repository

    git clone https://github.com/pybamm-team/pybamm-eis
  2. Change into the pybamm-eis directory

    cd pybamm-eis
  3. Create a virtual environment

    python -m virtualenv env
  4. 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).

  5. Install the pybammeis package

    pip install .

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

Developer

To install as a developer follow the instructions above, replacing the final step with

pip install -e .

This will allow you to edit the code locally.

๐Ÿ“– Documentation

API documentation for the pybammeis package can be built locally using Sphinx. To build the documentation, first change into the docs directory, and then execute the following command:

make html

This will generate a number of html files in the docs/_build/html directory. To view the documentation, open the file docs/_build/html/index.html in a web browser.

๐Ÿ› ๏ธ 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.

๐ŸŽ‰ Acknowledgments

This code was developed as part of the Oxford Mathematics Summer Project "Efficient Linear Algebra Methods to Determine Li-ion Battery Behaviour".

Student: Rishit Dhoot Supervisors: Prof Colin Please and Dr. Robert Timms

๐Ÿ“ซ Get in touch

For any questions, comments, suggestions or bug reports, please see the contact page.

๐Ÿ“ƒ License

pybamm-eis is fully open source. For more information about its license, see LICENSE.

pybamm-eis's People

Contributors

rtimms avatar rish31415 avatar kratman avatar arjxn-py avatar noelhallemans avatar

Stargazers

Julia Wind avatar  avatar Wenlin Zhang avatar Ferran Brosa Planella avatar Hangyue Li avatar  avatar yutian yu avatar  avatar Brady Planden avatar

Watchers

Martin Robinson avatar Valentin Sulzer avatar  avatar

pybamm-eis's Issues

Semi-circle for the SPMe

Hi,

Comparing EIS data of different models in compare_models.py, it appears that the SPMe does not have a semi-circle for the same electrode double-layer capacity as the other models.

options={"surface form": "differential"} and both positive and negative electrode double-layer capacities are set to 0.2 F m-2 for the figure below

Screenshot 2024-07-12 at 14 31 47

This is unexpected as the semi-circles of all models should be quite similar!

Interestingly, semi-circles for the SPMe appear when choosing the electrode double-layer capacity values unreasonably high:

100 F/m2: image

compared to 0.2 F/m2: Screenshot 2024-07-12 at 14 38 43

This may be related to the bug in leading surface form conductivity (pybamm-team/PyBaMM#4139), however, using the develop branch does not solve this issue.

We use PyBAMM version 24.1.

Kind regards,

Noรซl

Avoiding spectral leakage in time domain (brute force) simulation

Hi,

To compute the impedance in the time domain in examples/compare_methods.py the model response to a sinusoidal current is computed.

To avoid spectral leakage when taking the FFT I recommend to simulate an integer number of periods.

This can be solved by removing the 1+ on line 38 and -1 on lines 41 to 43.

The difference between frequency domain and time domain simulations will then become smaller!

Kind regards,

Noรซl

Try out `pybamm-cookiecutter`

@santacodes I think this repo could be a suitable candidate for you to try https://github.com/pybamm-team/pybamm-cookiecutter when we have the basic structure ready within a few weeks.

For context, this repo was originally proposed for adding the calculation of electrochemical impedance spectroscopy within the PyBaMM framework as a GSoC project (https://pybamm.org/gsoc/2022/#electrochemical-impedance-spectroscopy-eis-modelling), and later worked on as a summer project at the University of Oxford (see https://github.com/pybamm-team/pybamm-eis#-acknowledgments).

P.S. EIS is like a fancy tool to measure the battery's internal resistances and activities at different points, it acts like an AC tester of sorts that can give out information like how easily electrons are flowing through the materials the battery is made out of. Imagine gently pushing tiny electrical charges back and forth at various frequencies, which can help you find stuff like the resistance at the electrode surfaces (where the reactions are happening). @rtimms can probably correct me if I am wrong ๐Ÿ˜…

Though this project has been set up and hosted already, if we can verify from start to end that the template is able to generate all the files here and provide a reasonable starting point for constructing the files under https://github.com/pybamm-team/pybamm-eis/tree/main/pbeis, while also providing a way to integrate the docs under docs/ and with RTD, we can say that the template is ready to handle reasonably sized real-world research projects and we can then work on any shortcomings we find

Hard coded reaction rate and electrode charge transfer coefficients

The reaction rate and electrode charge transfer coefficient parameters are hard coded in the exchange current density function (through the Butler-Volmer kinetics). I believe these are parameters that vary from battery to battery.

Wouldn't it make more sense to also consider these parameters in the parameter set? This would help for model parametrisation from impedance data as the reaction rate parameter could then represent the charge transfer resistance in a model where parameters are grouped.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.