From 1e91bd69aa2b98a622aefc3687c640edb481d6f3 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 20 Nov 2023 19:10:31 +0200 Subject: [PATCH] Tweak ramp if-statement --- Software/src/battery/TESLA-MODEL-3-BATTERY.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Software/src/battery/TESLA-MODEL-3-BATTERY.cpp b/Software/src/battery/TESLA-MODEL-3-BATTERY.cpp index 9d83bda7..41f9cf8c 100644 --- a/Software/src/battery/TESLA-MODEL-3-BATTERY.cpp +++ b/Software/src/battery/TESLA-MODEL-3-BATTERY.cpp @@ -196,8 +196,8 @@ void update_values_tesla_model_3_battery() { //This function maps all the value //The allowed charge power behaves strangely. We instead estimate this value if (SOC == 10000) { - max_target_charge_power = 0; // When battery is 100% full, set allowed charge W to 0 - } else if (SOC >= 9500 && SOC <= 9999) { // When battery is between 95-99.99%, ramp the value between Max<->0 + max_target_charge_power = 0; // When battery is 100% full, set allowed charge W to 0 + } else if (SOC > 9500) { // When battery is between 95-99.99%, ramp the value between Max<->0 max_target_charge_power = MAXCHARGEPOWERALLOWED * (1 - (SOC - 9500) / 500); } else { // Outside the specified SOC range, set the charge power to the maximum max_target_charge_power = MAXCHARGEPOWERALLOWED;