Battery voltage & current filtering to improve charging algorithm

For PWM charge controllers, the topping stage was sometimes very short
and the battery did not get fully charged.

This commit adds a voltage_filtered and current_filtered member variable
to DcBus and PowerPort classes which can hold measurements more heavily
filtered (initial time constant setting: 10 seconds). This should fix
above issues with the charging algorithm.
This commit is contained in:
Martin Jäger
2021-02-04 17:28:52 +01:00
parent 269ce762a0
commit 35b390ff24
4 changed files with 44 additions and 2 deletions
+2 -2
View File
@@ -490,10 +490,10 @@ void Charger::charge_control(BatConf *bat_conf)
port->bus->sink_voltage_intercept = bat_conf->topping_voltage +
bat_conf->temperature_compensation * (bat_temperature - 25);
if (port->bus->voltage >= port->bus->sink_control_voltage() - 0.05F) {
if (port->bus->voltage_filtered >= port->bus->sink_control_voltage() - 0.05F) {
// battery is full if topping target voltage is still reached (i.e. sufficient
// solar power available) and time limit or cut-off current reached
if (port->current < bat_conf->topping_current_cutoff ||
if (port->current_filtered < bat_conf->topping_current_cutoff ||
target_voltage_timer > bat_conf->topping_duration)
{
full = true;