Skip to content

Commit

Permalink
Tweak ramp if-statement
Browse files Browse the repository at this point in the history
  • Loading branch information
dalathegreat committed Nov 20, 2023
1 parent 19e3372 commit 1e91bd6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Software/src/battery/TESLA-MODEL-3-BATTERY.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1e91bd6

Please sign in to comment.