Skip to content

Commit

Permalink
#492 remove direct voltage control, too much effort
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinsulzer committed Dec 3, 2019
1 parent 8710f5e commit f113293
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 126 deletions.
5 changes: 2 additions & 3 deletions docs/source/models/submodels/external_circuit/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ External circuit

Models to enforce different boundary conditions (as imposed by an imaginary external
circuit) such as constant current, constant voltage, constant power, or any other
relationship between the current and voltage. "Current control" and "Voltage control"
submodels enforce these directly through boundary conditions, while "Function control"
relationship between the current and voltage. "Current control" enforces these directly
through boundary conditions, while "Function control"
submodels add an algebraic equation (for the current) and hence can be used to set any
variable to be constant.

Expand All @@ -13,4 +13,3 @@ variable to be constant.

current_control_external_circuit
function_control_external_circuit
voltage_control_external_circuit

This file was deleted.

8 changes: 0 additions & 8 deletions pybamm/models/full_battery_models/lead_acid/full.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,3 @@ def set_side_reaction_submodels(self):
"negative oxygen interface"
] = pybamm.interface.lead_acid_oxygen.NoReaction(self.param, "Negative")

def set_external_circuit_submodel(self):
""" See :meth:`BaseBatteryModel.set_external_circuit_submodel` """
if self.options["operating mode"] == "voltage":
self.submodels["external circuit"] = pybamm.external_circuit.VoltageControl(
self.param
)
else:
super().set_external_circuit_submodel()
9 changes: 0 additions & 9 deletions pybamm/models/full_battery_models/lithium_ion/dfn.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,6 @@ def set_electrolyte_submodel(self):
self.param, self.reactions
)

def set_external_circuit_submodel(self):
""" See :meth:`BaseBatteryModel.set_external_circuit_submodel` """
if self.options["operating mode"] == "voltage":
self.submodels["external circuit"] = pybamm.external_circuit.VoltageControl(
self.param
)
else:
super().set_external_circuit_submodel()

@property
def default_geometry(self):
dimensionality = self.options["dimensionality"]
Expand Down
1 change: 0 additions & 1 deletion pybamm/models/submodels/external_circuit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@
LeadingOrderVoltageFunctionControl,
LeadingOrderPowerFunctionControl,
)
from .voltage_control_external_circuit import VoltageControl

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def __call__(self, variables):
pv1["Terminal voltage [V]"](solutions[0].t),
)

@unittest.skip("")
def test_constant_voltage(self):
class ConstantVoltage:
num_switches = 0
Expand All @@ -71,11 +70,9 @@ def __call__(self, variables):
return V - 4.1

# load models
# test the DFN for this one as it has a particular implementation of constant
# voltage
models = [
pybamm.lithium_ion.DFN({"operating mode": "voltage"}),
pybamm.lithium_ion.DFN({"operating mode": ConstantVoltage()}),
pybamm.lithium_ion.SPM({"operating mode": "voltage"}),
pybamm.lithium_ion.SPM({"operating mode": ConstantVoltage()}),
]

# load parameter values and process models and geometry
Expand Down Expand Up @@ -116,16 +113,14 @@ def __call__(self, variables):
).entries
np.testing.assert_array_almost_equal(V0, V1)

# TODO: improve the following test (better extrapolation?)
I0 = pybamm.ProcessedVariable(
models[0].variables["Current [A]"], solutions[0].t, solutions[0].y, mesh
).entries[:10]
).entries
I1 = pybamm.ProcessedVariable(
models[1].variables["Current [A]"], solutions[1].t, solutions[1].y, mesh
).entries[:10]
).entries
np.testing.assert_array_almost_equal(abs((I1 - I0) / I0), 0, decimal=1)

@unittest.skip("")
def test_constant_power(self):
class ConstantPower:
num_switches = 0
Expand Down

This file was deleted.

0 comments on commit f113293

Please sign in to comment.