-
-
Notifications
You must be signed in to change notification settings - Fork 566
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#492 reformat constant current to be a submodel
- Loading branch information
1 parent
81bc4b6
commit c16b916
Showing
12 changed files
with
105 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from .base_external_circuit import BaseModel | ||
from .current_control_external_circuit import CurrentControl | ||
|
||
# from .voltage_control_external_circuit import VoltageControl |
11 changes: 11 additions & 0 deletions
11
pybamm/models/submodels/external_circuit/base_external_circuit.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# | ||
# Base model for the external circuit | ||
# | ||
import pybamm | ||
|
||
|
||
class BaseModel(pybamm.BaseSubModel): | ||
"""Model to represent the behaviour of the external circuit. """ | ||
|
||
def __init__(self, param): | ||
super().__init__(param) |
27 changes: 27 additions & 0 deletions
27
pybamm/models/submodels/external_circuit/current_control_external_circuit.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# | ||
# External circuit with current control | ||
# | ||
import pybamm | ||
from .base_external_circuit import BaseModel | ||
|
||
|
||
class CurrentControl(BaseModel): | ||
"""External circuit with current control. """ | ||
|
||
def __init__(self, param): | ||
super().__init__(param) | ||
|
||
def get_fundamental_variables(self): | ||
# Current is given as a function of time | ||
i_cell = self.param.current_with_time | ||
i_cell_dim = self.param.dimensional_current_density_with_time | ||
I = self.param.dimensional_current_with_time | ||
|
||
variables = { | ||
"Total current density": i_cell, | ||
"Total current density [A.m-2]": i_cell_dim, | ||
"Current [A]": I, | ||
"Discharge capacity [A.h]": I * pybamm.t * self.param.time_scale / 3600, | ||
} | ||
|
||
return variables |
27 changes: 27 additions & 0 deletions
27
pybamm/models/submodels/external_circuit/voltage_control_external_circuit.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# | ||
# External circuit with voltage control | ||
# | ||
import pybamm | ||
from .base_external_circuit import BaseModel | ||
|
||
|
||
class VoltageControl(BaseModel): | ||
"""External circuit with voltage control. """ | ||
|
||
def __init__(self, param): | ||
super().__init__(param) | ||
|
||
def get_fundamental_variables(self): | ||
# Current is given as a function of time | ||
i_cell = pybamm.electrical_parameters.current_with_time | ||
i_cell_dim = pybamm.electrical_parameters.dimensional_current_density_with_time | ||
I = pybamm.electrical_parameters.dimensional_current_with_time | ||
|
||
variables = { | ||
"Total current density": i_cell, | ||
"Total current density [A.m-2]": i_cell_dim, | ||
"Current [A]": I, | ||
"Discharge capacity [A.h]": I * pybamm.t * self.param.time_scale / 3600, | ||
} | ||
|
||
return variables |