Skip to content

Support non-Li-ion models#16

Merged
DavidMStraub merged 13 commits into
pathsim:masterfrom
DavidMStraub:non_li_ion
May 21, 2026
Merged

Support non-Li-ion models#16
DavidMStraub merged 13 commits into
pathsim:masterfrom
DavidMStraub:non_li_ion

Conversation

@DavidMStraub
Copy link
Copy Markdown
Collaborator

@DavidMStraub DavidMStraub commented May 20, 2026

Fixes #15.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds broader PyBaMM model-family compatibility (lead-acid + equivalent-circuit, and documented sodium-ion limitations) so the existing PathSim battery cell blocks can be used beyond lithium-ion models (Fixes #15).

Changes:

  • Resolve per-model variable-name aliases (voltage/heating/temperature) and support direct-SoC outputs when discharge-capacity isn’t available.
  • Add construction/smoke tests for lead-acid and ECM models, and document expected failures for sodium-ion BasicDFN with current blocks.
  • Expand CI to test a Python/PyBaMM version matrix and add a Python 3.14 trove classifier.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/pathsim_batt/cells/pybamm_cell.py Adds variable-alias resolution, model-family-specific build handling, and alternate SOC computation paths.
tests/cells/test_other_chemistries.py New smoke/behavior tests for lead-acid + ECM, and boundary/exception documentation tests for sodium-ion BasicDFN.
pyproject.toml Adds Python 3.14 classifier metadata.
.github/workflows/test.yml Expands test matrix across PyBaMM versions and Python versions; disables fail-fast.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/pathsim_batt/cells/pybamm_cell.py
Comment thread src/pathsim_batt/cells/pybamm_cell.py Outdated
Comment thread .github/workflows/test.yml Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread src/pathsim_batt/cells/pybamm_cell.py
@DavidMStraub DavidMStraub marked this pull request as ready for review May 20, 2026 15:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment thread tests/cells/_helpers.py Outdated
Comment thread tests/cells/_helpers.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Comment on lines +149 to +160
Models that already carry the required options are returned unchanged.
Models whose constructor does not accept the given options (e.g. ECM,
which has no ``"thermal"`` option) are returned unchanged with a
``UserWarning``.
"""
if not required_options:
return model
# Models that have no "thermal" key in their options (e.g. ECM) manage
# temperature through their own internal mechanism and do not use PyBaMM's
# thermal sub-model system. Injection is not applicable; skip silently.
if "thermal" in required_options and "thermal" not in model.options:
return model
Comment thread tests/cells/_helpers.py Outdated
if pybamm_solver is not None:
kwargs["pybamm_solver"] = pybamm_solver
cell = CellCoSimElectrical(
model=model, parameter_values=pv, dt=cosim_dt, initial_soc=initial_soc, **kwargs
Comment thread tests/cells/_helpers.py
Comment on lines +129 to +133
if pybamm_solver is not None:
kwargs["pybamm_solver"] = pybamm_solver
cell = CellCoSimElectrothermal(
model=model, parameter_values=pv, dt=cosim_dt, initial_soc=initial_soc, **kwargs
)
Comment thread tests/cells/test_ecm.py Outdated
Comment on lines +8 to +10
Co-simulation blocks are started at SOC=0.9 to avoid PyBaMM's internal
"Maximum SoC" event firing immediately at the upper boundary.
"""
Comment thread tests/cells/test_ecm.py
Comment on lines +60 to +64
def test_cosim_electrical_smoke(self):
# Start at 0.9: PyBaMM's Maximum-SoC event fires if initial == upper boundary.
cell = run_cosim_electrical(
self._model(), self.pv, current=10.0, initial_soc=0.99
)
@DavidMStraub DavidMStraub merged commit 7e8e923 into pathsim:master May 21, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make compatible with non-Li-ion models

2 participants