Experiment step functions#
The following functions can be used to define steps in an experiment.
- pybamm.step.string(string, **kwargs)[source]#
Create a step from a string.
- Parameters:
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
pybamm.step._Step
class.
- Returns:
A step parsed from the string.
- Return type:
- pybamm.step.current(value, **kwargs)[source]#
Create a current-controlled step. Current is positive for discharge and negative for charge.
- Parameters:
value (float) – The current value in A.
**kwargs – Any other keyword arguments are passed to the
pybamm.step._Step
class.
- Returns:
A current-controlled step.
- Return type:
- pybamm.step.voltage(value, **kwargs)[source]#
Create a voltage-controlled step. Voltage should always be positive.
- Parameters:
value (float) – The voltage value in V.
**kwargs – Any other keyword arguments are passed to the
pybamm.step._Step
class.
- Returns:
A voltage-controlled step.
- Return type:
- pybamm.step.power(value, **kwargs)[source]#
Create a power-controlled step. Power is positive for discharge and negative for charge.
- Parameters:
value (float) – The power value in W.
**kwargs – Any other keyword arguments are passed to the
pybamm.step._Step
class.
- Returns:
A power-controlled step.
- Return type:
- pybamm.step.resistance(value, **kwargs)[source]#
Create a resistance-controlled step. Resistance is positive for discharge and negative for charge.
- Parameters:
value (float) – The resistance value in Ohm.
**kwargs – Any other keyword arguments are passed to the
pybamm.step._Step
class.
- Returns:
A resistance-controlled step.
- Return type:
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)[source]#
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.
- Parameters:
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.
termination (str or list, optional) – A string or list of strings indicating the condition(s) that will terminate the step. If a list, the step will terminate when any of the conditions are met.
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”.
tags (str or list, optional) – A string or list of strings indicating the tags associated with the step.
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.