mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-04 18:29:48 +02:00
Bandaid SOH% bug
This commit is contained in:
parent
ca1b9681c7
commit
cfe18aa9e5
1 changed files with 4 additions and 0 deletions
|
@ -172,6 +172,10 @@ void update_values_battery() { //This function maps all the values fetched via
|
||||||
StateOfHealth =
|
StateOfHealth =
|
||||||
static_cast<uint16_t>((static_cast<double>(nominal_full_pack_energy) / bat_beginning_of_life) * 10000.0);
|
static_cast<uint16_t>((static_cast<double>(nominal_full_pack_energy) / bat_beginning_of_life) * 10000.0);
|
||||||
}
|
}
|
||||||
|
//If the calculation went wrong, set SOH to 100%
|
||||||
|
if (StateOfHealth > 10000) {
|
||||||
|
StateOfHealth = 10000;
|
||||||
|
}
|
||||||
//If the value is unavailable, set SOH to 99%
|
//If the value is unavailable, set SOH to 99%
|
||||||
if (nominal_full_pack_energy < REASONABLE_ENERGYAMOUNT) {
|
if (nominal_full_pack_energy < REASONABLE_ENERGYAMOUNT) {
|
||||||
StateOfHealth = 9900;
|
StateOfHealth = 9900;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue