Support non-Li-ion models#16
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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 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 |
| 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 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 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 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 | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #15.