Rename defines

This commit is contained in:
Daniel 2024-02-26 11:56:07 +02:00
parent cf50eca513
commit be662e4fe0
2 changed files with 10 additions and 10 deletions

View file

@ -204,17 +204,17 @@ void update_values_battery() { //This function maps all the values fetched via
system_max_charge_power_W = 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));
system_max_charge_power_W = FLOAT_MAX_POWER_W;
} else if (soc_vi > RAMPDOWN_SOC) { // When real SOC is between RAMPDOWN_SOC-99%, ramp the value between Max<->0
system_max_charge_power_W = MAXCHARGEPOWERALLOWED * (1 - (soc_vi - RAMPDOWN_SOC) / (1000.0 - RAMPDOWN_SOC));
//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)) {
system_max_charge_power_W = FLOATPOWERMAX;
if (cell_max_v > (MAX_CELL_VOLTAGE_LFP - FLOAT_START_MV)) {
system_max_charge_power_W = FLOAT_MAX_POWER_W;
}
} else { //NCM/A
if (cell_max_v > (MAX_CELL_VOLTAGE_NCA_NCM - MILLIVOLTFLOAT)) {
system_max_charge_power_W = FLOATPOWERMAX;
if (cell_max_v > (MAX_CELL_VOLTAGE_NCA_NCM - FLOAT_START_MV)) {
system_max_charge_power_W = FLOAT_MAX_POWER_W;
}
}
} else { // No limits, max charging power allowed

View file

@ -7,9 +7,9 @@
#define BATTERY_SELECTED
#define RAMPDOWNSOC 900 // 90.0 SOC% to start ramping down from max charge power towards 0 at 100.00%
#define FLOATPOWERMAX 200 // W, what power to allow for top balancing battery
#define MILLIVOLTFLOAT 20 // mV, how many mV under overvoltage to start float charging
#define RAMPDOWN_SOC 900 // 90.0 SOC% to start ramping down from max charge power towards 0 at 100.00%
#define FLOAT_MAX_POWER_W 200 // W, what power to allow for top balancing battery
#define FLOAT_START_MV 20 // mV, how many mV under overvoltage to start float charging
#define MAXCHARGEPOWERALLOWED 15000 // 15000W we use a define since the value supplied by Tesla is always 0
#define MAXDISCHARGEPOWERALLOWED \
60000 // 60000W we need to cap this value to max 60kW, most inverters overflow otherwise