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

Add SOC% plausibility detection #90

merged 3 commits into from
Nov 22, 2023

Conversation

dalathegreat
Copy link
Owner

What

This PR adds plausibility checks for SOC% on Nissan LEAFs batteries.

Why

Using a Nissan LEAF battery below 1A for extended periods of times will cause the BMS to not calculate SOC% correctly. This can happen for instance when using a Checkwatt profile. When this happens, the BMS needs to be rebooted.

How

We check that if the battery voltage is close to max, and the SOC% is low, we raise a FAULT(red LED) to stop charging/discharging. We also send a message on the USB to inform the user what has happened, so they can take action.

@@ -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 !

@rjsc rjsc merged commit 375d3a8 into main Nov 22, 2023
31 checks passed
@rjsc rjsc deleted the bugfix/LEAF-frozen branch November 22, 2023 22:15
@rjsc rjsc restored the bugfix/LEAF-frozen branch November 22, 2023 22:59
@dalathegreat dalathegreat deleted the bugfix/LEAF-frozen branch November 25, 2023 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants