mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-05 10:49:42 +02:00
Add ramped charge value for Tesla
This commit is contained in:
parent
179b8eeaa2
commit
3aa3d8ead9
2 changed files with 7 additions and 4 deletions
|
@ -197,8 +197,10 @@ 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 {
|
||||
max_target_charge_power = 15000; //Otherwise we can push 15kW into the pack!
|
||||
} else if (SOC >= 9500 && SOC <= 9999) { // 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;
|
||||
}
|
||||
|
||||
stat_batt_power = (volts * amps); //TODO: check if scaling is OK
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#define ABSOLUTE_MAX_VOLTAGE \
|
||||
4030 // 403.0V,if battery voltage goes over this, charging is not possible (goes into forced discharge)
|
||||
#define ABSOLUTE_MIN_VOLTAGE 2450 // 245.0V if battery voltage goes under this, discharging further is disabled
|
||||
#define MAXCHARGEPOWERALLOWED 15000 // 15000W we use a define since the value supplied by Tesla is always 0
|
||||
|
||||
// These parameters need to be mapped for the Inverter
|
||||
extern uint16_t SOC;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue