mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-05 19:42:08 +02:00
Merge remote-tracking branch 'upstream/main' into mqtt-cleanup
This commit is contained in:
commit
263fe1027c
1 changed files with 8 additions and 4 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;
|
||||||
|
@ -260,16 +264,16 @@ void update_values_battery() { //This function maps all the values fetched via
|
||||||
|
|
||||||
//Once cell chemistry is determined, set maximum and minimum total pack voltage safety limits
|
//Once cell chemistry is determined, set maximum and minimum total pack voltage safety limits
|
||||||
if (LFP_Chemistry) {
|
if (LFP_Chemistry) {
|
||||||
max_voltage = 3640;
|
max_voltage = 3880;
|
||||||
min_voltage = 2450;
|
min_voltage = 2968;
|
||||||
} else { // NCM/A chemistry
|
} else { // NCM/A chemistry
|
||||||
max_voltage = 4030;
|
max_voltage = 4030;
|
||||||
min_voltage = 3100;
|
min_voltage = 3100;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check if SOC% is plausible
|
//Check if SOC% is plausible
|
||||||
if (battery_voltage > (max_voltage - 100)) { // When pack voltage is close to max, and SOC% is still low, raise FAULT
|
if (battery_voltage > (max_voltage - 20)) { // When pack voltage is close to max, and SOC% is still low, raise FAULT
|
||||||
if (SOC < 6500) { //When SOC is less than 65.00% when approaching max voltage
|
if (SOC < 5000) { //When SOC is less than 50.00% when approaching max voltage
|
||||||
set_event(EVENT_SOC_PLAUSIBILITY_ERROR, SOC / 100);
|
set_event(EVENT_SOC_PLAUSIBILITY_ERROR, SOC / 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue