mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-04 18:29:48 +02:00
Fix ramp function overflow
This commit is contained in:
parent
ae7bfa2d36
commit
2d83c9c029
1 changed files with 5 additions and 2 deletions
|
@ -202,8 +202,11 @@ void update_values_battery() { //This function maps all the values fetched via
|
|||
//The allowed charge power behaves strangely. We instead estimate this value
|
||||
if (system_scaled_SOC_pptt == 10000) { // When scaled SOC is 100.00%, set allowed charge power to 0
|
||||
system_max_charge_power_W = 0;
|
||||
} else if (soc_vi > RAMPDOWNSOC) { // When real SOC is between RAMPDOWNSOC-99.99%, ramp the value between Max<->0
|
||||
system_max_charge_power_W = MAXCHARGEPOWERALLOWED * (1 - (soc_vi - RAMPDOWNSOC) / 50.0);
|
||||
}
|
||||
if (soc_vi > 990) {
|
||||
system_max_charge_power_W = FLOATPOWERMAX;
|
||||
} else if (soc_vi > RAMPDOWNSOC) { // When real SOC is between RAMPDOWNSOC-99%, ramp the value between Max<->0
|
||||
system_max_charge_power_W = MAXCHARGEPOWERALLOWED * (1 - (soc_vi - RAMPDOWNSOC) / (1000.0 - RAMPDOWNSOC));
|
||||
//If the cellvoltages start to reach overvoltage, only allow a small amount of power in
|
||||
if (system_LFP_Chemistry) {
|
||||
if (cell_max_v > (MAX_CELL_VOLTAGE_LFP - MILLIVOLTFLOAT)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue