Skip to main content

PathSim-Batt Logo

Battery simulation blocks for PathSim

PyPI License

Documentation • PathSim Homepage • GitHub


PathSim-Batt extends the PathSim simulation framework with battery cell blocks backed by PyBaMM. All blocks follow the standard PathSim interface and can be wired into any simulation diagram.

Install

pip install pathsim-batt

Quick start

import pybamm
from pathsim import Connection, Simulation
from pathsim.blocks import Constant
from pathsim.solvers import ESDIRK43
from pathsim_batt import CellElectrothermal

cell = CellElectrothermal(initial_soc=1.0)   # defaults: SPMe + Chen2020
I_src = Constant(5.0)                         # 5 A discharge
T_src = Constant(298.15)                      # 25 °C ambient

sim = Simulation(
    blocks=[I_src, T_src, cell],
    connections=[Connection(I_src, cell["I"]), Connection(T_src, cell["T_amb"])],
    dt=1.0,
    Solver=ESDIRK43,
)
sim.run(3600)
print(f"V = {cell.outputs[0]:.3f} V  T = {cell.outputs[1]:.1f} K  SOC = {cell.outputs[3]:.3f}")

Choosing a block

Two decisions determine the right block: thermal ownership and integration strategy.

Block Thermal Strategy Use when
CellElectrothermal PyBaMM (internal) Monolithic ODE Single cell, coupled electro-thermal, ODE model
CellElectrical + LumpedThermal PathSim (external) Monolithic ODE Pack-level, custom cooling, ODE model
CellCoSimElectrothermal PyBaMM (internal) Co-simulation DAE models (DFN, lead_acid.Full), mixed solvers
CellCoSimElectrical + LumpedThermal PathSim (external) Co-simulation DAE models with external thermal network

LumpedThermal is a single-node thermal block (mass, Cp, UA, T0) that receives Q_dot from a CellElectrical block and feeds back cell temperature.

PyBaMM model compatibility

Thermal sub-model and heat-source options are injected automatically — pass the bare model class with no options=.

PyBaMM model Default parameter set CellElectrical CellElectrothermal CellCoSimElectrical CellCoSimElectrothermal
lithium_ion.SPM Chen2020 ✅ ✅ ✅ ✅
lithium_ion.SPMe Chen2020 ✅ ✅ ✅ ✅
lithium_ion.DFN Chen2020 ❌ DAE ❌ DAE ✅ ✅
lead_acid.LOQS Sulzer2019 ✅ ¹ ✅ ¹ ✅ ² ✅ ²
lead_acid.Full Sulzer2019 ❌ DAE ❌ DAE ✅ ✅
equivalent_circuit.Thevenin ECM_Example ✅ ✅ ✅ ³ ✅ ³

¹ Not on PyBaMM 26.7 — there LOQS is a DAE, use a CellCoSim* block instead. It is an ODE again from 26.8 on.

² PyBaMM < 26.7 only — pass pybamm_solver=pybamm.CasadiSolver(mode="safe"); the default IDAKLUSolver errors on LOQS. Fixed in 26.7.

³ initial_soc=1.0 fails because PyBaMM requires event values to be strictly positive at t=0; the "Maximum SoC" event is zero exactly at full charge. Any value below 1.0 (e.g. initial_soc=0.99) works.

import pybamm
from pathsim_batt import CellElectrothermal, CellCoSimElectrical

# Custom chemistry / parameter set
cell = CellElectrothermal(
    model=pybamm.lithium_ion.SPMe(),
    parameter_values=pybamm.ParameterValues("Mohtat2020"),
)

# Lead-acid via co-simulation (DAE model)
cell = CellCoSimElectrical(
    model=pybamm.lead_acid.Full(),
    parameter_values=pybamm.ParameterValues("Sulzer2019"),
    dt=1.0,
)

# Equivalent circuit model
cell = CellElectrical(
    model=pybamm.equivalent_circuit.Thevenin(),
    parameter_values=pybamm.ParameterValues("ECM_Example"),
    initial_soc=0.9,
)

License

MIT

Metadata

Release files for pathsim-batt 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pathsim-batt 0.4.1
File Size Uploaded Provenance Actions
pathsim_batt-0.4.1.tar.gz 52.1 kB With provenance Details for pathsim_batt-0.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pathsim-batt 0.4.1
File Interpreter ABI Platform Actions
pathsim_batt-0.4.1-py3-none-any.whl Python 3 none any Details for pathsim_batt-0.4.1-py3-none-any.whl

Total release size: 68.6 kB

Release files / pathsim_batt-0.4.1.tar.gz

Download URL pathsim_batt-0.4.1.tar.gz
Size 52.1 kB
Tags Source
SHA-256 checksum
How to use checksums
9786f364da6c420e3de69fa6990e67c4e3a4b9d72d6de82d79468b38598b8e0c
BLAKE2b-256 checksum
How to use checksums
98ec254db3ff9fdda492761320bcf5b1ca29055c11defbd62a60fc28e0de15d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Release files / pathsim_batt-0.4.1-py3-none-any.whl

Download URL pathsim_batt-0.4.1-py3-none-any.whl
Size 16.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9507f5dbc7bfaedbdcc78d5bb06a58924f59b9d95e485dbfbe7d6503628bf162
BLAKE2b-256 checksum
How to use checksums
9e3f0e88ee7576137ba333fcfe5bca0d1599c520e9e4e2c24f2f1519f96a2c17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Security for pathsim-batt 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pathsim_batt-0.4.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page