PyBaMM
PyBaMM copied to clipboard
How to set specific voltage curve as model input instead of current curve in drive cycle
Here is the code taking the current curve as input. Is it possible to set voltage curve as input?
model = pybamm.lithium_ion.DFN()
parameter_values = pybamm.ParameterValues("Prada2013")
# parameter_values.update({"Voltage function [V]": pybamm.InputParameter("Voltage [V]")}, check_already_exists=False)
t = np.array([0., 1., 2.]
t = np.array([.1, .1, .1]
drive_cycle = np.stack((t, I), axis=1)
current_interpolant = pybamm.Interpolant(drive_cycle[:, 0], drive_cycle[:, 1], pybamm.t)
parameter_values["Current function [A]"] = current_interpolant
solver = pybamm.IDAKLUSolver()
sim = pybamm.Simulation(model, parameter_values=parameter_values, solver=solver)
sol = sim.solve()