Tesla: Make min/max values chemistry dependent

This commit is contained in:
Daniel 2024-02-17 13:09:12 +02:00
parent f35db250f4
commit 8b0b57ea70
2 changed files with 12 additions and 5 deletions

View file

@ -257,8 +257,7 @@ void update_values_battery() { /* This function maps all the values fetched via
} }
//Check if SOC% is plausible //Check if SOC% is plausible
if (battery_voltage > if (battery_voltage > (max_voltage - 100)) { // When pack voltage is close to max, and SOC% is still low, raise FAULT
(ABSOLUTE_MAX_VOLTAGE - 100)) { // When pack voltage is close to max, and SOC% is still low, raise FAULT
if (LB_SOC < 650) { if (LB_SOC < 650) {
set_event(EVENT_SOC_PLAUSIBILITY_ERROR, LB_SOC / 10); // Set event with the SOC as data set_event(EVENT_SOC_PLAUSIBILITY_ERROR, LB_SOC / 10); // Set event with the SOC as data
} else { } else {

View file

@ -254,10 +254,18 @@ 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
if (LFP_Chemistry) {
max_voltage = 3640;
min_voltage = 2450;
} else { // NCM/A chemistry
max_voltage = 4030;
min_voltage = 3100;
}
//Check if SOC% is plausible //Check if SOC% is plausible
if (battery_voltage > if (battery_voltage > (max_voltage - 100)) { // When pack voltage is close to max, and SOC% is still low, raise FAULT
(ABSOLUTE_MAX_VOLTAGE - 100)) { // 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 < 6500) { //When SOC is less than 65.00% when approaching max voltage
set_event(EVENT_SOC_PLAUSIBILITY_ERROR, SOC / 100); set_event(EVENT_SOC_PLAUSIBILITY_ERROR, SOC / 100);
} }
} }