Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#863 remove double-count #864

Merged
merged 3 commits into from
Mar 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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