From 2f6d6cfae846da65a61e3729087fcf3f6b23e041 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 20 Nov 2023 23:14:36 +0200 Subject: [PATCH] Fix division error --- Software/src/battery/TESLA-MODEL-3-BATTERY.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Software/src/battery/TESLA-MODEL-3-BATTERY.cpp b/Software/src/battery/TESLA-MODEL-3-BATTERY.cpp index 41f9cf8cf..b28c8a181 100644 --- a/Software/src/battery/TESLA-MODEL-3-BATTERY.cpp +++ b/Software/src/battery/TESLA-MODEL-3-BATTERY.cpp @@ -198,7 +198,7 @@ void update_values_tesla_model_3_battery() { //This function maps all the value if (SOC == 10000) { 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); + max_target_charge_power = MAXCHARGEPOWERALLOWED * (1 - (SOC - 9500) / 500.0); } else { // Outside the specified SOC range, set the charge power to the maximum max_target_charge_power = MAXCHARGEPOWERALLOWED; }