Skip to content

Commit

Permalink
update parameter_values.py to use upper and lowwer voltage limits if …
Browse files Browse the repository at this point in the history
…not defined, need to add a warning if we skip loading from the file and use a the limits
  • Loading branch information
js1tr3 committed May 23, 2023
1 parent 16385d7 commit 449cf33
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions pybamm/parameters/parameter_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,21 @@ def create_from_bpx(filename, target_soc=1):
bpx = parse_bpx_file(filename)
pybamm_dict = _bpx_to_param_dict(bpx)

if "Open circuit potential at 0% SOC [V]" not in pybamm_dict:
pybamm_dict["Open circuit potential at 0% SOC [V]"] = pybamm_dict[
"Lower voltage cut-off [V]"
]
pybamm_dict["Open circuit potential at 100% SOC [V]"] = pybamm_dict[
"Upper voltage cut-off [V]"
]
# probably should put a warning here to indicate we are going
# ahead with the low voltage limit.

# get initial concentrations based on SOC
c_n_init, c_p_init = get_electrode_concentrations(target_soc, bpx)
pybamm_dict["Initial concentration in negative electrode [mol.m-3]"] = c_n_init
pybamm_dict["Initial concentration in positive electrode [mol.m-3]"] = c_p_init
pybamm_dict["Open circuit potential at 0% SOC [V]"] = pybamm_dict[
"Lower voltage cut-off [V]"
]
pybamm_dict["Open circuit potential at 100% SOC [V]"] = pybamm_dict[
"Upper voltage cut-off [V]"
]

return pybamm.ParameterValues(pybamm_dict)

def __getitem__(self, key):
Expand Down

0 comments on commit 449cf33

Please sign in to comment.