Add ramp down of discharge power

This commit is contained in:
freddanastrom 2025-07-15 15:53:38 +02:00
parent 917d27e134
commit 1477ea2f81
2 changed files with 13 additions and 0 deletions

View file

@ -176,6 +176,14 @@ void BydAttoBattery::
datalayer_battery->status.max_charge_power_W = BMS_allowed_charge_power * 10; //TODO: Scaling unknown, *10 best guess
if (SOC_method ==
ESTIMATED) { // If we are using estimated SOC, maximum discharge power is ramped down towards the end.
if (battery_estimated_SOC * 0.1 < RAMPDOWN_SOC) {
datalayer.battery.status.max_discharge_power_W =
RAMPDOWN_POWER_ALLOWED * ((battery_estimated_SOC * 0.1) / RAMPDOWN_SOC);
}
}
datalayer_battery->status.cell_max_voltage_mV = BMS_highest_cell_voltage_mV;
datalayer_battery->status.cell_min_voltage_mV = BMS_lowest_cell_voltage_mV;

View file

@ -17,6 +17,11 @@
//Make sure you understand risks associated with disabling. Values can be read via "More Battery info"
//#define SKIP_TEMPERATURE_SENSOR_NUMBER 1
// Ramp down settings that are used when SOC is estimated from voltage
static const int RAMPDOWN_SOC = 100; // SOC to start ramping down from. Value set here is scaled by 10 (100 = 10.0%)
static const int RAMPDOWN_POWER_ALLOWED =
10000; // The power to start ramping down from, can be set to a lower value if you want to limit the power at the end of discharge even further
/* Do not modify the rows below */
#ifdef BYD_ATTO_3_BATTERY
#define SELECTED_BATTERY_CLASS BydAttoBattery