Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tesla: Tweak plausable SOC% limits #191

Merged
merged 4 commits into from
Feb 19, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Software/src/battery/TESLA-MODEL-3-BATTERY.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ void update_values_battery() { //This function maps all the values fetched via
StateOfHealth =
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) {
StateOfHealth = 9900;
Expand Down Expand Up @@ -268,8 +272,8 @@ void update_values_battery() { //This function maps all the values fetched via
}

//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 (SOC < 6500) { //When SOC is less than 65.00% when approaching max voltage
if (battery_voltage > (max_voltage - 20)) { // When pack voltage is close to max, and SOC% is still low, raise FAULT
if (SOC < 5000) { //When SOC is less than 50.00% when approaching max voltage
set_event(EVENT_SOC_PLAUSIBILITY_ERROR, SOC / 100);
}
}
Expand Down
Loading