Skip to content

Commit

Permalink
Fix for charge W value
Browse files Browse the repository at this point in the history
  • Loading branch information
dalathegreat committed Sep 17, 2023
1 parent 0c6fe1f commit cb0522f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Software/TESLA-MODEL-3-BATTERY.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,12 @@ void update_values_tesla_model_3_battery()
max_target_discharge_power = temporaryvariable;
}

//Calculate the allowed charge power, cap it if it gets too large
temporaryvariable = (max_charge_current * volts);
if(temporaryvariable > 60000){
max_target_charge_power = 60000;
//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{
max_target_charge_power = temporaryvariable;
max_target_charge_power = 15000; //Otherwise we can push 15kW into the pack!
}

stat_batt_power = (volts * amps); //TODO, check if scaling is OK
Expand Down

0 comments on commit cb0522f

Please sign in to comment.