diff options
author | Aseda Aboagye <aaboagye@google.com> | 2020-11-30 19:42:36 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-12-10 00:47:07 +0000 |
commit | 1797020481b8db91aa9a6092b9db52043695d514 (patch) | |
tree | 19d37f75de591ee1215095e29e3b69ccb90d3775 /common | |
parent | aaf852575f971098412a39ce0a8a63ddbffda671 (diff) | |
download | chrome-ec-1797020481b8db91aa9a6092b9db52043695d514.tar.gz |
ocpc: Center hysteresis around target
We add a bit of hysteresis when determining our error for the OCPC PID
loop equivalent to charger IC's "step" in regulating current. We had
set the band above and below the target for the full step. In order
to reduce overshoot, this commit centers the band around the current
target.
BUG=b:174167890
BRANCH=dedede
TEST=Build and flash drawlat; verify that steady state now settles
around a shorter band and overshoot is reduced.
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Change-Id: I8f8c7305c3973fb5cedecdd14e5466f11a0e85a7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2567035
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/ocpc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/common/ocpc.c b/common/ocpc.c index ff42d679a1..04a9fa9855 100644 --- a/common/ocpc.c +++ b/common/ocpc.c @@ -321,7 +321,7 @@ int ocpc_config_secondary_charger(int *desired_input_current, if (ocpc->last_vsys != OCPC_UNINIT) { error = i_ma - batt.current; /* Add some hysteresis. */ - if (ABS(error) < i_step) + if (ABS(error) < (i_step / 2)) error = 0; /* Make a note if we're significantly over target. */ |