Skip to content

Commit

Permalink
Merge pull request #3186 from pybamm-team/issue-3185-fix_c_rate_drive…
Browse files Browse the repository at this point in the history
…_cycle

Fix simulation with c_rate drive cycles
  • Loading branch information
valentinsulzer committed Jul 24, 2023
2 parents 6707f81 + 64a6ab1 commit 7e6a3ca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,7 @@

## Bug fixes

- Fix to simulate c_rate steps with drive cycles ([#3186](https://github.com/pybamm-team/PyBaMM/pull/3186))
- Parameters in `Prada2013` have been updated to better match those given in the paper, which is a 2.3 Ah cell, instead of the mix-and-match with the 1.1 Ah cell from Lain2019.
- Error generated when invalid parameter values are passed.
- Thevenin() model is now constructed with standard variables: `Time [s], Time [min], Time [h]` ([#3143](https://github.com/pybamm-team/PyBaMM/pull/3143))
Expand Down
7 changes: 5 additions & 2 deletions pybamm/simulation.py
Expand Up @@ -291,8 +291,11 @@ def update_new_model_events(self, new_model, op):
# figure out whether the voltage event is greater than the starting
# voltage (charge) or less (discharge) and set the sign of the
# event accordingly
if isinstance(op.value, pybamm.Interpolant):
sign = np.sign(op.value.y[0])
if (isinstance(op.value, pybamm.Interpolant) or
isinstance(op.value, pybamm.Multiplication)):
inpt = {"start time":0}
init_curr = op.value.evaluate(t=0, inputs=inpt).flatten()[0]
sign = np.sign(init_curr)
else:
sign = np.sign(op.value)
if sign > 0:
Expand Down

0 comments on commit 7e6a3ca

Please sign in to comment.