Battery simulation blocks for PathSim
Documentation • PathSim Homepage • GitHub
PathSim-Batt extends the PathSim simulation framework with battery cell blocks using PyBaMM as the electrochemical backend. All blocks follow the standard PathSim block interface and can be connected into simulation diagrams.
pip install pathsim-batt| Block | Description | Key Parameters |
|---|---|---|
CellElectrothermal |
Coupled electrical + thermal cell (PathSim integrates PyBaMM ODE incl. temperature) | model, parameter_values, initial_soc |
CellElectrical |
Electrical only, isothermal; wire to LumpedThermal for external thermal coupling |
model, parameter_values, initial_soc |
CellCoSimElectrothermal |
Coupled electrical + thermal co-simulation cell (PyBaMM steps internally) | model, parameter_values, initial_soc, dt |
CellCoSimElectrical |
Electrical co-simulation cell for external thermal coupling | model, parameter_values, initial_soc, dt |
LumpedThermal |
Single-node thermal model for external thermal coupling | mass, Cp, UA, T0 |
The cell blocks wrap PyBaMM models behind the PathSim block interface.
CellElectrothermal/CellElectricaluse PathSim monolithic integration (DynamicalSystem) and exported CasADi ODE right-hand sides.CellCoSimElectrothermal/CellCoSimElectricaluse periodic co-simulation (Wrapper) and callpybamm.Simulation.step()internally.
Only models that yield a pure ODE after discretisation are supported by the monolithic blocks (CellElectrothermal, CellElectrical) — currently SPMe and SPM. Models such as DFN that produce a DAE system (algebraic variables) will raise NotImplementedError there.
For DAE models (e.g. DFN), use the co-simulation blocks (CellCoSimElectrothermal, CellCoSimElectrical).
- ODE-type PyBaMM models (SPMe, SPM) can be injected via the
modelparameter - Any parameter set can be used via
parameter_values(defaults toChen2020) - Immediate initialisation — the PyBaMM model is discretised during block construction
import pybamm
model = pybamm.lithium_ion.SPMe(options={"thermal": "lumped"})
params = pybamm.ParameterValues("Mohtat2020")
cell = CellElectrothermal(model=model, parameter_values=params)
# DAE example (DFN): use co-simulation mode
dfn_cell = CellCoSimElectrothermal(
model=pybamm.lithium_ion.DFN(options={"thermal": "lumped"}),
parameter_values=params,
dt=0.1,
)| Mode | Block | Owns cell temperature | Use when |
|---|---|---|---|
| Internal | CellElectrothermal |
PyBaMM | Single-cell simulations, quick setup |
| External | CellElectrical + LumpedThermal |
PathSim | Multi-cell packs, custom cooling models |
| Co-sim internal | CellCoSimElectrothermal |
PyBaMM | DAE models (e.g. DFN), mixed-solver workflows |
| Co-sim external | CellCoSimElectrical + LumpedThermal |
PathSim | DAE models with external thermal network |
MIT
