-
This is probably more of a Python question than a pybamm question. I have computed the OCV curve from the data used using: giving the OCV as a function of t(I think). I can't seem to plot this as I get an "Attribute error" whatever that is. I'm guessing I can't plot the function. How do I plot two things on one graph? Can I let the OCV as a function of time perhaps? that would be good to compare the terminal voltage with. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
You did mean to say |
Beta Was this translation helpful? Give feedback.
-
I think this does what you want, but the individual OCPs might not actually line up this way to give the OCV (e.g. fully-charged might not be sto=1, 0 in neg., pos.). import pybamm
import matplotlib.pyplot as plt
parameter_values = pybamm.ParameterValues("Chen2020")
x = pybamm.linspace(0, 1, 1000) # sto
U_n = parameter_values["Negative electrode OCP [V]"]
U_p = parameter_values["Positive electrode OCP [V]"]
fig, ax = plt.subplots(1, 3, figsize=(12, 4))
ax[0].plot(x.entries, U_n(x).entries)
ax[0].set(xlabel="sto [-]", ylabel="$U_n$ [V]")
ax[1].plot(x.entries, U_p(x).entries)
ax[1].set(xlabel="sto [-]", ylabel="$U_p$ [V]")
ax[2].plot(x.entries, U_p(x).entries - U_n(1-x).entries)
ax[2].set(xlabel="sto [-]", ylabel="$U$ [V]")
plt.tight_layout() |
Beta Was this translation helpful? Give feedback.
I think this does what you want, but the individual OCPs might not actually line up this way to give the OCV (e.g. fully-charged might not be sto=1, 0 in neg., pos.).