Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Battery: default to electrical current based load compensation #19429

Merged
merged 4 commits into from
May 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/battery/battery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ void Battery::estimateStateOfCharge(const float voltage_v, const float current_a
float cell_voltage = voltage_v / _params.n_cells;

// correct battery voltage locally for load drop to avoid estimation fluctuations
if (_params.r_internal >= 0.f) {
if (_params.r_internal >= 0.f && current_a > FLT_EPSILON) {
cell_voltage += _params.r_internal * current_a;

} else {
Expand Down
8 changes: 4 additions & 4 deletions src/lib/battery/module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ parameters:
reboot_required: true
num_instances: *max_num_config_instances
instance_start: 1
default: [0.3, 0.3]
default: [0.1, 0.1]

BAT${i}_R_INTERNAL:
description:
Expand All @@ -71,12 +71,12 @@ parameters:
unit: Ohm
min: -1.0
max: 0.2
decimal: 2
increment: 0.01
decimal: 4
increment: 0.0005
reboot_required: true
num_instances: *max_num_config_instances
instance_start: 1
default: [-1.0, -1.0]
default: [0.005, 0.005]

BAT${i}_N_CELLS:
description:
Expand Down