pybamm-team / PyBaMM

Fast and flexible physics-based battery models in Python
https://www.pybamm.org/
BSD 3-Clause "New" or "Revised" License
1.08k stars 533 forks source link

Allow functions of time in experiment step #4187

Closed valentinsulzer closed 3 months ago

valentinsulzer commented 3 months ago

Users should be able to pass in arbitrary functions of time as the argument for a pybamm.step in an experiment, e.g.

def oscillating(t):
    return 1 + 0.1*np.sin(2*np.pi*t)

pybamm.step.current(oscillating, duration=3600)

Time should be taken to start at the beginning of the step, just like with drive cycles.

Note: this can be already be done using custom steps, but it requires writing a more complex step object