Base Experiment Class#

class pybamm.Experiment(operating_conditions, period='1 minute', temperature=None, termination=None, drive_cycles={}, cccv_handling='two-step')[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 of the form “Do this for this long” or “Do this until this happens”. For example, “Charge at 1 C for 1 hour”, or “Charge at 1 C until 4.2 V”, or “Charge at 1 C for 1 hour or until 4.2 V at 25oC”. The instructions can be of the form “(Dis)charge at x A/C/W”, “Rest”, or “Hold at x V until y A at z oC”. The running time should be a time in seconds, minutes or hours, e.g. “10 seconds”, “3 minutes” or “1 hour”. The stopping conditions should be a circuit state, e.g. “1 A”, “C/50” or “3 V”. The parameter drive_cycles is mandatory to run drive cycle. For example, “Run x”, then x must be the key of drive_cycles dictionary. The temperature should be provided after the stopping condition but before the period, e.g. “1 A at 25 oC (1 second period)”. It is not essential to provide a temperature and a global temperature can be set either from within the paramter values of passing a temperature to this experiment class. If the temperature is not specified in a line, then the global temperature is used, even if another temperature has been set in an earlier line.

Parameters:
  • operating_conditions (list) – List of operating conditions

  • period (string, 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, optional) – List of conditions under which to terminate the experiment. Default is None.

  • drive_cycles (dict) – Dictionary of drive cycles to use for this experiment.

  • cccv_handling (str, optional) – How to handle CCCV. If “two-step” (default), then the experiment is run in two steps (CC then CV). If “ode”, then the experiment is run in a single step using an ODE for current: see pybamm.external_circuit.CCCVFunctionControl for details.

convert_electric(electric)[source]#

Convert electrical instructions to consistent output

convert_time_to_seconds(time_and_units)[source]#

Convert a time in seconds, minutes or hours to a time in seconds

extend_drive_cycle(drive_cycle, end_time)[source]#

Extends the drive cycle to enable for event

is_cccv(step, next_step)[source]#

Check whether a step and the next step indicate a CCCV charge

read_string(cond, drive_cycles)[source]#

Convert a string to a dictionary of the right format

Parameters:
  • cond (str) – String of appropriate form for example “Charge at x C for y hours”. x and y must be numbers, ‘C’ denotes the unit of the external circuit (can be A for current, C for C-rate, V for voltage or W for power), and ‘hours’ denotes the unit of time (can be second(s), minute(s) or hour(s))

  • drive_cycles (dict) – A map specifying the drive cycles

read_termination(termination)[source]#

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