Skip to content

Commit

Permalink
Merge pull request #864 from pybamm-team/issue-863-double-count
Browse files Browse the repository at this point in the history
#863 remove double-count
  • Loading branch information
valentinsulzer authored Mar 4, 2020
2 parents d704c9e + 412fe37 commit bf5283c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Breaking changes

- Removed double-counted "number of electrodes connected in parallel" from simulation ([#864](https://github.com/pybamm-team/PyBaMM/pull/864))
- Removed "set external temperature" and "set external potential" options. Use "external submodels" option instead ([#862](https://github.com/pybamm-team/PyBaMM/pull/862))

# [v0.2.0](https://github.com/pybamm-team/PyBaMM/tree/v0.2.0) - 2020-02-26
Expand Down
17 changes: 4 additions & 13 deletions pybamm/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,11 @@ def constant_current_constant_voltage_constant_power(variables):
s_I = pybamm.InputParameter("Current switch")
s_V = pybamm.InputParameter("Voltage switch")
s_P = pybamm.InputParameter("Power switch")
n_electrodes_parallel = pybamm.electrical_parameters.n_electrodes_parallel
n_cells = pybamm.electrical_parameters.n_cells
return (
s_I * (I - pybamm.InputParameter("Current input [A]") / n_electrodes_parallel)
s_I * (I - pybamm.InputParameter("Current input [A]"))
+ s_V * (V - pybamm.InputParameter("Voltage input [V]") / n_cells)
+ s_P
* (
V * I
- pybamm.InputParameter("Power input [W]")
/ (n_cells * n_electrodes_parallel)
)
+ s_P * (V * I - pybamm.InputParameter("Power input [W]") / n_cells)
)


Expand Down Expand Up @@ -212,21 +206,18 @@ def set_up_experiment(self, model, experiment):

# add current and voltage events to the model
# current events both negative and positive to catch specification
n_electrodes_parallel = pybamm.electrical_parameters.n_electrodes_parallel
n_cells = pybamm.electrical_parameters.n_cells
self.model.events.extend(
[
pybamm.Event(
"Current cut-off (positive) [A] [experiment]",
self.model.variables["Current [A]"]
- abs(pybamm.InputParameter("Current cut-off [A]"))
/ n_electrodes_parallel,
- abs(pybamm.InputParameter("Current cut-off [A]")),
),
pybamm.Event(
"Current cut-off (negative) [A] [experiment]",
self.model.variables["Current [A]"]
+ abs(pybamm.InputParameter("Current cut-off [A]"))
/ n_electrodes_parallel,
+ abs(pybamm.InputParameter("Current cut-off [A]")),
),
pybamm.Event(
"Voltage cut-off [V] [experiment]",
Expand Down

0 comments on commit bf5283c

Please sign in to comment.