mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-05 02:39:57 +02:00
Merge branch 'main' into refactor/variable-naming
This commit is contained in:
commit
3a90c333b9
1 changed files with 8 additions and 4 deletions
|
@ -169,6 +169,10 @@ void update_values_battery() { //This function maps all the values fetched via
|
||||||
system_SOH_pptt =
|
system_SOH_pptt =
|
||||||
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) {
|
||||||
system_SOH_pptt = 9900;
|
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
|
//Once cell chemistry is determined, set maximum and minimum total pack voltage safety limits
|
||||||
if (system_LFP_Chemistry) {
|
if (system_LFP_Chemistry) {
|
||||||
system_max_design_voltage_dV = 3640;
|
system_max_design_voltage_dV = 3880;
|
||||||
system_min_design_voltage_dV = 2450;
|
system_min_design_voltage_dV = 2968;
|
||||||
} else { // NCM/A chemistry
|
} else { // NCM/A chemistry
|
||||||
system_max_design_voltage_dV = 4030;
|
system_max_design_voltage_dV = 4030;
|
||||||
system_min_design_voltage_dV = 3100;
|
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
|
//Check if SOC% is plausible
|
||||||
if (system_battery_voltage_dV >
|
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
|
(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 < 6500) { //When SOC is less than 65.00% when approaching max voltage
|
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);
|
set_event(EVENT_SOC_PLAUSIBILITY_ERROR, system_real_SOC_pptt / 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue