Skip to content

Commit df5ebe0

Browse files
committed
fix small near-zero value in dq_relative_li1
1 parent f14b644 commit df5ebe0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

shared/lib_battery_lifetime_nmc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ double lifetime_nmc_t::runQli(double T_battery_K) {
132132
(Ea_d0_2 / Rug) * pow(1 / T_battery_K - 1 / T_ref, 2));
133133

134134
double dQLi1dt = 0;
135-
if (state->nmc_li_neg->dq_relative_li1 == 0) {
135+
if (abs(state->nmc_li_neg->dq_relative_li1) < 1e-5) {
136136
if (state->day_age_of_battery > 0)
137137
dQLi1dt = b1 / sqrt(state->day_age_of_battery);
138138
}

shared/logger.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ std::ostream &operator<<(std::ostream &os, const cycle_state &p) {
126126
p.q_relative_cycle,
127127
p.rainflow_Xlt, p.rainflow_Ylt, p.rainflow_jlt);
128128
os << buf << p.rainflow_peaks;
129-
os << ", cum_dt: " << p.cum_dt << ", DOD_max: " << p.DOD_max << ", DOD_min:" << p.DOD_min << ", ";
130-
os << R"("cycle_DOD_max": ")" << p.cycle_DOD_max << "}";
129+
os << ", \"cum_dt\": " << p.cum_dt << ", \"DOD_max\": " << p.DOD_max << ", \"DOD_min\":" << p.DOD_min << ", ";
130+
os << R"("cycle_DOD_max": )" << p.cycle_DOD_max << "}";
131131
return os;
132132
}
133133

@@ -166,7 +166,7 @@ std::ostream &operator<<(std::ostream &os, const lifetime_state &p) {
166166
os.precision(3);
167167
char buf[1024];
168168
sprintf(buf, R"("lifetime_state": { "q_relative": %f, "n_cycles": %d, "cycle_DOD": %.3f, "cycle_range": %.3f,
169-
"average_range": %.3f, day_age_of_battery": %.3f, )",
169+
"average_range": %.3f, "day_age_of_battery": %.3f, )",
170170
p.q_relative, p.n_cycles, p.cycle_DOD, p.cycle_range, p.average_range, p.day_age_of_battery);
171171
os << buf << *p.cycle << ", ";
172172
if (p.calendar) {

0 commit comments

Comments
 (0)