@@ -12,9 +12,12 @@ def __init__(self, param, external_circuit_class):
12
12
super ().__init__ (param )
13
13
self .external_circuit_class = external_circuit_class
14
14
15
+ def _get_current_variable (self ):
16
+ return pybamm .Variable ("Total current density" )
17
+
15
18
def get_fundamental_variables (self ):
16
19
# Current is a variable
17
- i_cell = pybamm . Variable ( "Total current density" )
20
+ i_cell = self . _get_current_variable ( )
18
21
variables = self ._get_current_variables (i_cell )
19
22
20
23
# Add discharge capacity variable
@@ -24,9 +27,9 @@ def get_fundamental_variables(self):
24
27
# These are not implemented yet but can be used later with the Experiment class
25
28
# to simulate different external circuit conditions sequentially within a
26
29
# single model (for example Constant Current - Constant Voltage)
27
- for i in range (self .external_circuit_class .num_switches ):
28
- s = pybamm .Parameter ("Switch {}" .format (i + 1 ))
29
- variables ["Switch {}" .format (i + 1 )] = s
30
+ # for i in range(self.external_circuit_class.num_switches):
31
+ # s = pybamm.Parameter("Switch {}".format(i + 1))
32
+ # variables["Switch {}".format(i + 1)] = s
30
33
31
34
return variables
32
35
@@ -81,26 +84,10 @@ class LeadingOrderFunctionControl(FunctionControl, LeadingOrderBaseModel):
81
84
"""External circuit with an arbitrary function, at leading order. """
82
85
83
86
def __init__ (self , param , external_circuit_class ):
84
- super ().__init__ (param )
85
- self .external_circuit_class = external_circuit_class
86
-
87
- def get_fundamental_variables (self ):
88
- # Current is a variable
89
- i_cell = pybamm .Variable ("Leading-order total current density" )
90
- variables = self ._get_current_variables (i_cell )
91
-
92
- # Add discharge capacity variable
93
- variables .update (super ().get_fundamental_variables ())
94
-
95
- # Add switches
96
- # These are not implemented yet but can be used later with the Experiment class
97
- # to simulate different external circuit conditions sequentially within a
98
- # single model (for example Constant Current - Constant Voltage)
99
- for i in range (self .external_circuit_class .num_switches ):
100
- s = pybamm .Parameter ("Switch {}" .format (i + 1 ))
101
- variables ["Switch {}" .format (i + 1 )] = s
87
+ super ().__init__ (param , external_circuit_class )
102
88
103
- return variables
89
+ def _get_current_variable (self ):
90
+ return pybamm .Variable ("Leading-order total current density" )
104
91
105
92
106
93
class LeadingOrderVoltageFunctionControl (LeadingOrderFunctionControl ):
0 commit comments