Skip to content

Commit

Permalink
Merge pull request pybamm-team#3915 from pybamm-team/fix-voltage-comp…
Browse files Browse the repository at this point in the history
…onents

fix plot_voltage_components to work when time doesn't start at 0
  • Loading branch information
valentinsulzer authored Mar 20, 2024
2 parents 9bf979b + 4bad8f3 commit 8243c74
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

## Bug Fixes

- `plot_voltage_components` now works even if the time does not start at 0 ([#3915](https://github.com/pybamm-team/PyBaMM/pull/3915))
- Fixed bug where separator porosity was used in calculation instead of transport efficiency ([#3905](https://github.com/pybamm-team/PyBaMM/pull/3905))
- Initial voltage can now match upper or lower cut-offs exactly ([#3842](https://github.com/pybamm-team/PyBaMM/pull/3842))
- Fixed a bug where 1+1D and 2+1D models would not work with voltage or power controlled experiments([#3829](https://github.com/pybamm-team/PyBaMM/pull/3829))
Expand Down
6 changes: 3 additions & 3 deletions pybamm/plotting/plot_voltage_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,16 @@ def plot_voltage_components(
time = solution["Time [h]"].entries
if split_by_electrode is False:
ocv = solution["Battery open-circuit voltage [V]"]
initial_ocv = ocv(0)
initial_ocv = ocv(time[0])
ocv = ocv.entries
ax.fill_between(
time, ocv, initial_ocv, **kwargs_fill, label="Open-circuit voltage"
)
else:
ocp_n = solution["Battery negative electrode bulk open-circuit potential [V]"]
ocp_p = solution["Battery positive electrode bulk open-circuit potential [V]"]
initial_ocp_n = ocp_n(0)
initial_ocp_p = ocp_p(0)
initial_ocp_n = ocp_n(time[0])
initial_ocp_p = ocp_p(time[0])
initial_ocv = initial_ocp_p - initial_ocp_n
delta_ocp_n = ocp_n.entries - initial_ocp_n
delta_ocp_p = ocp_p.entries - initial_ocp_p
Expand Down

0 comments on commit 8243c74

Please sign in to comment.