mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-05 10:49:42 +02:00
Tesla: Make min/max values chemistry dependent
This commit is contained in:
parent
f35db250f4
commit
8b0b57ea70
2 changed files with 12 additions and 5 deletions
|
@ -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 {
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue