mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-05 10:49:42 +02:00
Add charge/discharge logic for scaled SOC
This commit is contained in:
parent
8905e4d74a
commit
68f6ff81f9
1 changed files with 8 additions and 0 deletions
|
@ -434,11 +434,19 @@ void update_values_battery() { //This function maps all the values fetched via
|
|||
} else {
|
||||
datalayer.battery.status.max_discharge_power_W = battery_BEV_available_power_longterm_discharge;
|
||||
}
|
||||
if (datalayer.battery.status.reported_soc == 0) { //Scaled SOC% is 0.00%, we should not discharge battery further
|
||||
datalayer.battery.status.max_discharge_power_W = 0;
|
||||
}
|
||||
|
||||
if (battery_BEV_available_power_longterm_charge > 65000) {
|
||||
datalayer.battery.status.max_charge_power_W = 65000;
|
||||
} else {
|
||||
datalayer.battery.status.max_charge_power_W = battery_BEV_available_power_longterm_charge;
|
||||
}
|
||||
if (datalayer.battery.status.reported_soc == 10000) //Scaled SOC% value is 100.00%
|
||||
{
|
||||
datalayer.battery.status.max_charge_power_W = 0; //No need to charge further, set max power to 0
|
||||
}
|
||||
|
||||
battery_power = (datalayer.battery.status.current_dA * (datalayer.battery.status.voltage_dV / 100));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue