pybamm.Experiment lets you define realistic battery test protocols as a sequence of operating steps. Each step can specify the operating mode (current, voltage, power, resistance), magnitude, duration, and termination conditions.
Creating an experiment
Pass a list of strings (or step objects) topybamm.Experiment:
pybamm.Simulation:
Step string syntax
Each step string follows a human-readable format. The parser is flexible about spacing and capitalisation.Discharge / Charge
A, mA, C (C-rate), C/2, 2C, etc.
Rest
Hold (constant voltage)
Termination conditions in steps
Step-level terminations stop the current step and move to the next one:Cycling
Group steps into cycles by wrapping them in a tuple, then multiply by the number of cycles:When steps are grouped in a tuple, an infeasible step (e.g. the voltage is already below the cut-off) causes that cycle to stop early rather than raising an error. Use tuples for proper cycle grouping.
Global experiment options
TheExperiment constructor accepts optional global settings:
Experiment-level termination
This is different from step-level termination — it stops the entire multi-cycle experiment:Using step objects
For programmatic construction, use thepybamm.step functions instead of strings:
Experiment:
Accessing results by cycle and step
After solving, the solution is structured by cycle and step:Summary variables
Summary variables aggregate key metrics per cycle (capacity, SOH indicators, etc.):Complete example
CCCV charge + discharge cycling