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

Add SOC% plausibility detection #90

Merged
merged 3 commits into from
Nov 22, 2023
Merged
Changes from 1 commit
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
8 changes: 8 additions & 0 deletions Software/src/battery/NISSAN-LEAF-BATTERY.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,14 @@ void update_values_leaf_battery() { /* This function maps all the values fetched
max_target_discharge_power = 0;
}

//Check if SOC% is plausible
if (battery_voltage > (ABSOLUTE_MAX_VOLTAGE - 100)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why deduct 10V from ABSOLUTE_MAX_VOLTAGE?

A comment explaining that would be nice.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see, so if the battery voltage is almost 100% but SOC is under 65% we report an error. Perhaps a comment explaining this, and why this range was chosen would be helpful.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matvey83 comment added in 3545c3d !

if (LB_SOC < 650) {
bms_status = FAULT;
Serial.println("ERROR: SOC% reported by battery not plausible. Restart battery!");
}
}

if (LB_Full_CHARGE_flag) { //Battery reports that it is fully charged stop all further charging incase it hasn't already
max_target_charge_power = 0;
}
Expand Down