This package is a wrapper for the well-known Thevenin equivalent circuit model. The model is comprised of a single series resistor followed by any number of parallel RC pairs. Figure 1 below illustrates a circuit with 2 RC pairs; however, the model can be run with as few as zero, and as many as
Figure 1: 2RC Thevenin circuit.
This system is governed by the evolution of the state of charge (SOC, -), hysteresis (
where
The hysteresis only includes a dynamic component and neglects any instantaneous effects when switching between charging and discharging directions. The hysteresis dynamics are captured by
The solution to this expression causes
The thermal submodel assumes uniform temperature within the cell. The temperature increases while the cell is active, according to
where
where
The overall cell voltage is
where
thevenin is installable via either pip or conda. To install from PyPI use the following command.
pip install thevenin
If you prefer using the conda package manager, you can install thevenin from the conda-forge channel using the command below.
conda install -c conda-forge thevenin
If you run into issues with installation due to the scikit-sundae dependency, please submit an issue here. We also manage this solver package, but distribute it separately since it is not developed in pure Python.
For those interested in setting up a developer and/or editable version of this software, please see the directions available in the "Development" section of our documentation.
The API is organized around three main classes that allow you to construct the model, define an experiment, and interact with the solution. A basic example for a constant-current discharge is given below. To learn more about the model and see more detailed examples, check out the documentation on Read the Docs. Note that there are two interfaces to the model: Simulation and Prediction. These are optimized for full timeseries simulations and step-by-step state predictions, respectively.
import thevenin as thev
sim = thev.Simulation()
expr = thev.Experiment()
expr.add_step('current_A', 75., (3600., 1.), limits=('voltage_V', 3.))
soln = sim.run(expr)
soln.plot('time_h', 'voltage_V')Notes:
- If you are new to Python, check out Spyder IDE. Spyder is a powerful interactive development environment (IDE) that can make programming in Python more approachable to new users.
- Another friendly option for getting started in Python is to use Jupyter Notebooks. We write our examples in Jupyter Notebooks since they support both markdown blocks for explanations and executable code blocks.
- Python, Spyder, and Jupyter Notebooks can be setup using Anaconda. Anaconda provides a convenient way for new users to get started with Python due to its friendly graphical installer and environment manager.
This work was authored by researchers at the National Laboratory of the Rockies (NLR). If you use this package in your work, please include the following citation:
Randall, Corey R. "thevenin: Equivalent circuit models in Python [SWR-24-132]." Computer software, Nov. 2024. url: github.com/NREL/thevenin. doi: 10.11578/dc.20241125.2.
For convenience, we also provide the following for your BibTex:
@misc{Randall-2024,
author = {Randall, Corey R.},
title = {{thevenin: Equivalent circuit models in Python [SWR-24-132]}},
url = {github.com/NREL/thevenin},
month = {Nov.},
year = {2024},
doi = {10.11578/dc.20241125.2},
}
The motivation and funding for this project came from the Rapid Operational Validation Initiative (ROVI) sponsored by the Office of Electricity. The focus of ROVI is "to greatly reduce time required for emerging energy storage technologies to go from lab to market by developing new tools that will accelerate the testing and validation process needed to ensure commercial success." If interested, you can read more about ROVI here.
If you'd like to contribute to this package, please look through the existing issues. If the bug you've caught or the feature you'd like to add isn't already being worked on, please submit a new issue before getting started. You should also read through the developer guidelines.
This work was authored by the National Laboratory of the Rockies (NLR), operated by Alliance for Energy Innovation, LLC, for the U.S. Department of Energy (DOE). The views expressed in the repository do not necessarily represent the views of the DOE or the U.S. Government.