Base Experiment Class#

class pybamm.Experiment(operating_conditions: list[str | tuple[str]], period: str = '1 minute', temperature: float | None = None, termination: list[str] | None = None)[source]#

Base class for experimental conditions under which to run the model. In general, a list of operating conditions should be passed in. Each operating condition should be either a pybamm.step.BaseStep class, which can be created using one of the methods pybamm.step.current, pybamm.step.c_rate, pybamm.step.voltage , pybamm.step.power, pybamm.step.resistance, or pybamm.step.string, or a string, in which case the string is passed to pybamm.step.string.

Parameters:
  • operating_conditions (list[str]) – List of strings representing the operating conditions.

  • period (str, optional) – Period (1/frequency) at which to record outputs. Default is 1 minute. Can be overwritten by individual operating conditions.

  • temperature (float, optional) – The ambient air temperature in degrees Celsius at which to run the experiment. Default is None whereby the ambient temperature is taken from the parameter set. This value is overwritten if the temperature is specified in a step.

  • termination (list[str], optional) – List of strings representing the conditions to terminate the experiment. Default is None. This is different from the termination for individual steps. Termination for individual steps is specified in the step itself, and the simulation moves to the next step when the termination condition is met (e.g. 2.5V discharge cut-off). Termination for the experiment as a whole is specified here, and the simulation stops when the termination condition is met (e.g. 80% capacity).

static read_termination(termination)[source]#

Read the termination reason. If this condition is hit, the experiment will stop.

Parameters:

termination (str or list[str], optional) – A single string, or a list of strings, representing the conditions to terminate the experiment. Only capacity or voltage can be provided as a termination reason. e.g. ‘4 Ah capacity’ or [‘80% capacity’, ‘2.5 V’]

Returns:

A dictionary of the termination conditions. e.g. {‘capacity’: (4.0, ‘Ah’)} or {‘capacity’: (80.0, ‘%’), ‘voltage’: (2.5, ‘V’)}

Return type:

dict

search_tag(tag)[source]#

Search for a tag in the experiment and return the cycles in which it appears.

Parameters:

tag (str) – The tag to search for

Returns:

A list of cycles in which the tag appears

Return type:

list