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

Add ECM variables #1204

Merged
merged 2 commits into from
Oct 23, 2020
Merged
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
35 changes: 34 additions & 1 deletion pybamm/models/full_battery_models/base_battery_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -786,14 +786,17 @@ def set_voltage_variables(self):

# Battery-wide variables
V_dim = self.variables["Terminal voltage [V]"]
eta_e_av = self.variables.get("X-averaged electrolyte ohmic losses", 0)
eta_c_av = self.variables.get(
"X-averaged concentration overpotential", 0
)
eta_e_av_dim = self.variables.get("X-averaged electrolyte ohmic losses [V]", 0)
eta_c_av_dim = self.variables.get(
"X-averaged concentration overpotential [V]", 0
)
num_cells = pybamm.Parameter(
"Number of cells connected in series to make a battery"
)

self.variables.update(
{
"X-averaged battery open circuit voltage [V]": ocv_av_dim * num_cells,
Expand All @@ -809,6 +812,36 @@ def set_voltage_variables(self):
"Battery voltage [V]": V_dim * num_cells,
}
)
# Variables for calculating the equivalent circuit model (ECM) resistance
# Need to compare OCV to initial value to capture this as an overpotential
ocv_init = self.param.U_p(
self.param.c_p_init(1), self.param.T_init
) - self.param.U_n(self.param.c_n_init(0), self.param.T_init)
ocv_init_dim = (
self.param.U_p_ref
- self.param.U_n_ref
+ self.param.potential_scale * ocv_init
)
eta_ocv = ocv - ocv_init
eta_ocv_dim = ocv_dim - ocv_init_dim
# Current collector current density for working out euiqvalent resistance
# based on Ohm's Law
i_cc = self.variables["Current collector current density"]
i_cc_dim = self.variables["Current collector current density [A.m-2]"]
# Gather all overpotentials
v_ecm = -(eta_ocv + eta_r_av + eta_c_av + eta_e_av + delta_phi_s_av)
v_ecm_dim = -(eta_ocv_dim + eta_r_av_dim + eta_c_av_dim + eta_e_av_dim +
delta_phi_s_av_dim)
# Current collector area for turning resistivity into resistance
A_cc = self.param.A_cc
self.variables.update(
{
"Change in measured open circuit voltage": eta_ocv,
"Change in measured open circuit voltage [V]": eta_ocv_dim,
"Local ECM resistance": v_ecm / (i_cc * A_cc),
"Local ECM resistance [Ohm]": v_ecm_dim / (i_cc_dim * A_cc),
}
)

# Cut-off voltage
voltage = self.variables["Terminal voltage"]
Expand Down