Commit 445dfae2 authored by Claes's avatar Claes Committed by Esteban Blanc

Sev mean calculation could be nan

parent 5cd7f49b
......@@ -311,13 +311,14 @@ pwr_tStatus sev_db::tree_update_value(int item_idx, int attr_idx, pwr_tTime time
prev_deviation = 0;
}
if (!feqf(scantime, 0.0f)) {
m_items[item_idx].mean_value
= (value * scantime
+ m_items[item_idx].mean_value * m_items[item_idx].mean_acc_time)
/ (scantime + m_items[item_idx].mean_acc_time);
m_items[item_idx].mean_acc_time += scantime;
m_items[item_idx].variance_acc
= prev_deviation * (value - m_items[item_idx].mean_value);
= fabs(prev_deviation * (value - m_items[item_idx].mean_value));
m_items[item_idx].variance_cnt++;
if (m_items[item_idx].mean_acc_time
......@@ -335,5 +336,6 @@ pwr_tStatus sev_db::tree_update_value(int item_idx, int attr_idx, pwr_tTime time
m_items[item_idx].variance_cnt = 0;
}
}
}
return SEV__SUCCESS;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment