Fix load overvoltage control for 24V systems (#96)
This commit is contained in:
+3
-3
@@ -69,8 +69,8 @@ void LoadOutput::control()
|
||||
|
||||
// long-term overvoltage (overvoltage transients are detected as an ADC alert and switch
|
||||
// off the solar input instead of the load output)
|
||||
if (bus->voltage > overvoltage || bus->voltage >
|
||||
DT_CHARGE_CONTROLLER_PCB_LS_VOLTAGE_MAX)
|
||||
if (bus->voltage > bus->series_voltage(overvoltage) ||
|
||||
bus->voltage > DT_CHARGE_CONTROLLER_PCB_LS_VOLTAGE_MAX)
|
||||
{
|
||||
ov_debounce_counter++;
|
||||
if (ov_debounce_counter > CONFIG_CONTROL_FREQUENCY) {
|
||||
@@ -108,7 +108,7 @@ void LoadOutput::control()
|
||||
}
|
||||
|
||||
if (flags_check(&error_flags, ERR_LOAD_OVERVOLTAGE) &&
|
||||
bus->voltage < (overvoltage - ov_hysteresis) &&
|
||||
bus->voltage < (bus->series_voltage(overvoltage) - ov_hysteresis) &&
|
||||
bus->voltage < (DT_CHARGE_CONTROLLER_PCB_LS_VOLTAGE_MAX - ov_hysteresis))
|
||||
{
|
||||
flags_clear(&error_flags, ERR_LOAD_OVERVOLTAGE);
|
||||
|
||||
+13
-1
@@ -35,7 +35,7 @@ public:
|
||||
*
|
||||
* Used for automatic 12V/24V battery detection at start-up (can be 1 or 2 only)
|
||||
*
|
||||
* This factur must be applied to all voltage setpoints
|
||||
* This factor must be applied to all voltage setpoints
|
||||
*/
|
||||
int16_t series_multiplier = 1;
|
||||
|
||||
@@ -120,6 +120,18 @@ public:
|
||||
return v0 * series_multiplier;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate voltage for series connected batteries based on setpoint for single battery
|
||||
*
|
||||
* @param single_voltage Voltage for single battery
|
||||
*
|
||||
* @returns Total voltage
|
||||
*/
|
||||
inline float series_voltage(float single_voltage)
|
||||
{
|
||||
return single_voltage * series_multiplier;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user