Experiment step functions#
The following functions can be used to define steps in an experiment.
- pybamm.step.string(string, **kwargs)#
Create a step from a string.
string (str) – The string to parse. 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”. The instructions can be of the form “(Dis)charge at x A/C/W”, “Rest”, or “Hold at x V until y A”. 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”.
**kwargs – Any other keyword arguments are passed to the
A step parsed from the string.
- Return type:
- pybamm.step.current(value, **kwargs)#
Create a current-controlled step. Current is positive for discharge and negative for charge.
- pybamm.step.voltage(value, **kwargs)#
Create a voltage-controlled step. Voltage should always be positive.
- pybamm.step.power(value, **kwargs)#
Create a power-controlled step. Power is positive for discharge and negative for charge.
- pybamm.step.resistance(value, **kwargs)#
Create a resistance-controlled step. Resistance is positive for discharge and negative for charge.
These functions return the following step class, which is not intended to be used directly:
- class pybamm.step._Step(typ, value, duration=None, termination=None, period=None, temperature=None, tags=None, start_time=None, description=None)#
Class representing one step in an experiment. All experiment steps are functions that return an instance of this class. This class is not intended to be used directly.
typ (str) – The type of step, can be “current”, “voltage”, “c_rate”, “power”, or “resistance”.
value (float) – The value of the step, corresponding to the type of step. Can be a number, a 2-tuple (for cccv_ode), or a 2-column array (for drive cycles)
duration (float, optional) – The duration of the step in seconds.
period (float or string, optional) – The period of the step. If a float, the value is in seconds. If a string, the value should be a valid time string, e.g. “1 hour”.
temperature (float or string, optional) – The temperature of the step. If a float, the value is in Kelvin. If a string, the value should be a valid temperature string, e.g. “25 oC”.
datetime (str or datetime, optional) – A string or list of strings indicating the tags associated with the step.
description (str, optional) – A description of the step.
Return a basic representation of the step, only with type, value, termination and temperature, which are the variables involved in processing the model. Also used for hashing.