pybamm.Experiment encodes the electrical protocol applied to the battery during a simulation. Each experiment is composed of one or more cycles, and each cycle is a sequence of steps.
Class signature
Constructor parameters
list[str | tuple | pybamm.step.BaseStep]
required
A list of steps or cycles. Each element is either:
- A string describing a single step (parsed by
pybamm.step.string). - A
pybamm.step.BaseStepobject created withpybamm.step.current(),pybamm.step.voltage(), etc. - A tuple of the above, grouping multiple steps into one cycle.
[(...)] * N.str
Output recording interval (1/frequency). Applies to all steps that do not specify their own period. Examples:
"1 minute", "10 seconds". Default is 1 minute.float | str
Global experiment temperature. Overridden by a temperature specified in an individual step. If a float, the value is in Kelvin. If a string, use formats like
"25 oC" or "298.15 K". Defaults to the ambient temperature from the parameter set.str | list[str]
Global stopping condition(s) for the entire experiment (not a single step). The experiment stops when any condition is met. Supported formats:
- Capacity:
"80% capacity","4 Ah capacity","4 A.h capacity" - Voltage:
"2.5 V" - Time:
"10 hours","60 minutes","3600 s"
Step string syntax
When passing a plain string as a step, PyBaMM parses it withpybamm.step.string. The following formats are supported:
Step termination suffixes
Each step string can include an optional termination clause"or until <condition>":
"for 1 hour"— fixed duration"until 2.5 V"— voltage cut-off"until C/50"— C-rate cut-off (current drops below C/50)"until 50 mA"— absolute current cut-off
Temperature override per step
Append"at 25 oC" or "at 298.15 K" to any step string:
pybamm.step module
For programmatic step construction, use the pybamm.step functions instead of strings:
Attributes
list[tuple]
The operating conditions restructured as a list of cycles, where each cycle is a tuple of steps.
list[pybamm.step.BaseStep]
Flat list of all processed step objects in order.
set[pybamm.step.BaseStep]
The set of distinct steps. Used internally to avoid redundant model builds.
dict
Parsed termination conditions as a dictionary, e.g.
{"capacity": (80.0, "%")} or {"voltage": (2.5, "V")}.float | None
Global output period in seconds.
float | None
Global temperature in Kelvin.
Examples
Global
termination stops the whole experiment. Step-level termination (e.g. "until 2.5 V") only ends the current step and moves to the next one.