Skip to content

Add initial_soc parameter to EISSimulation#45

Merged
rtimms merged 6 commits intomainfrom
add-initial-soc
Mar 31, 2026
Merged

Add initial_soc parameter to EISSimulation#45
rtimms merged 6 commits intomainfrom
add-initial-soc

Conversation

@rtimms
Copy link
Copy Markdown
Collaborator

@rtimms rtimms commented Mar 31, 2026

Summary

  • Add initial_soc parameter to EISSimulation.__init__() and solve(), accepting a float (0-1) or voltage string (e.g. "3.8 V")
  • Delegates to PyBaMM's Simulation.build(initial_soc=...) machinery, retaining the internal pybamm.Simulation object
  • Simplifies examples/soc_sweep.py by removing ~15 lines of manual stoichiometry boilerplate

Test plan

  • Existing tests pass
  • New test: test_solve_with_initial_soc — confirms different SOCs produce different impedances
  • New test: test_initial_soc_in_constructor — confirms constructor and solve-time SOC give identical results
  • New test: test_initial_soc_voltage_string — confirms voltage string input works

🤖 Generated with Claude Code

rtimms and others added 5 commits March 31, 2026 13:50
Allow users to set the initial state of charge directly via
`EISSimulation(initial_soc=0.5)` or `solve(initial_soc=0.5)` instead of
manually computing stoichiometries. Delegates to PyBaMM's
`Simulation.build(initial_soc=...)` machinery. Also accepts voltage
strings like "3.8 V".

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Delegate initial_soc handling to PyBaMM's Simulation.build which uses
eSOH fingerprinting internally, so repeated calls with the same
(initial_soc, inputs) combination skip redundant rebuilds. Also pass
inputs to build() so that parameters affecting capacity (e.g. active
material volume fraction) are accounted for in the fingerprint.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
BradyPlanden
BradyPlanden previously approved these changes Mar 31, 2026
Copy link
Copy Markdown
Member

@BradyPlanden BradyPlanden left a comment

Choose a reason for hiding this comment

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

Thanks, just one comment on the docstring

Comment thread pybammeis/eis_simulation.py Outdated
@rtimms rtimms merged commit 4fc9817 into main Mar 31, 2026
4 checks passed
@rtimms rtimms deleted the add-initial-soc branch March 31, 2026 13:44
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.

2 participants