%pip install --upgrade pip ipywidgets -q
%pip install pybop -q
import pybop
pybop.plot.PlotlyManager().pio.renderers.default = "notebook_connected"
/Users/engs2510/Documents/Git/Second_PyBOP/.nox/notebooks-overwrite/bin/python3: No module named pip Note: you may need to restart the kernel to use updated packages. /Users/engs2510/Documents/Git/Second_PyBOP/.nox/notebooks-overwrite/bin/python3: No module named pip Note: you may need to restart the kernel to use updated packages.
PyBOP offers the both forward emperical and physics-based forward models. These are provided by PyBaMM, with PyBOP adding wrappers on the underlying classes to reduce complexity and improve stability with parameter inference and design optimisation. Likewise, PyBOP provides a light wrapper on the PyBaMM parameter sets, with user-defined parameters available through the same pybop.ParameterSet
class.
Let's construct the parameter set and then the single-particle model (SPM):
parameter_set = pybop.ParameterSet.pybamm("Marquis2019")
model = pybop.lithium_ion.SPM(parameter_set=parameter_set)
Now that the model is constructed with the Maquis parameter set, we can use the model.predict
method as a light wrapper on the PyBaMM.Simulation
class. This is the recommended way to generate synthetic data, but not for parameter inference as the performance cost of constructing the Simulation
class is high. For parameter inference, model.simulate
and model.simulateS1
offer a performant way to solve the forward model with and without sensitivities respectively.
Having constructed the model, we can now have a look at its voltage discharge curve to verify that it is working. The discharge curve is evaluated on the time interval specified by t_eval
. model.predict
returns the PyBaMM.solution
object with all of its functionality. As we are only working with the forward model, PyBaMM plotting methods will be used; however, when performing parameter inference or design optimisation, PyBOP plotting methods are recommended.
t_eval = [0, 3700]
solution = model.predict([], t_eval) # No inputs i.e []
# Plot with PyBaMM
solution.plot_voltage_components()
(<Figure size 800x400 with 1 Axes>, <Axes: xlabel='Time [h]'>)