Merge branch 'main' into refactor/variable-naming

This commit is contained in:
Daniel Öster 2024-02-19 15:16:19 +02:00 committed by GitHub
commit 3a90c333b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -169,6 +169,10 @@ void update_values_battery() { //This function maps all the values fetched via
system_SOH_pptt =
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 (nominal_full_pack_energy < REASONABLE_ENERGYAMOUNT) {
system_SOH_pptt = 9900;
@ -249,8 +253,8 @@ 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 (system_LFP_Chemistry) {
system_max_design_voltage_dV = 3640;
system_min_design_voltage_dV = 2450;
system_max_design_voltage_dV = 3880;
system_min_design_voltage_dV = 2968;
} else { // NCM/A chemistry
system_max_design_voltage_dV = 4030;
system_min_design_voltage_dV = 3100;
@ -258,8 +262,8 @@ void update_values_battery() { //This function maps all the values fetched via
//Check if SOC% is plausible
if (system_battery_voltage_dV >
(system_max_design_voltage_dV - 100)) { // When pack voltage is close to max, and SOC% is still low, raise FAULT
if (system_real_SOC_pptt < 6500) { //When SOC is less than 65.00% when approaching max voltage
(system_max_design_voltage_dV - 20)) { // When pack voltage is close to max, and SOC% is still low, raise FAULT
if (system_real_SOC_pptt < 5000) { //When SOC is less than 50.00% when approaching max voltage
set_event(EVENT_SOC_PLAUSIBILITY_ERROR, system_real_SOC_pptt / 100);
}
}