-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
Consider the throttle load for battery voltage calculation #1211
Conversation
…to not trigger the warning too early (at 50%) as it was before
@@ -56,7 +56,7 @@ PARAM_DEFINE_FLOAT(TRIM_YAW, 0.0f); | |||
* | |||
* @group Battery Calibration | |||
*/ | |||
PARAM_DEFINE_FLOAT(BAT_V_EMPTY, 3.4f); | |||
PARAM_DEFINE_FLOAT(BAT_V_EMPTY, 3.3f); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3.4V was definitely too high. 3.3V is better, but might still be a bit high. We could consider going to 3.25 or 3.2 (note that with default params under load empty == 3.2 - 0.1V then).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After 3.4V voltage drops much faster and deep discharge (3.2 is deep enough!) is very bad for battery health. Default parameters should be tuned for safe flight. With 3.2V copter may crash after 3 seconds after first warning if user forgot to charge battery, it may be not enough to land.
Of course it depends on battery model, but I would like to stay on safe side with 3.4V. If user wants to kill the battery, he can change parameter.
The problem with voltage drops on high thrust should be solved by internal resistance compensation I think, that you are already trying to do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, convinced - I'll change this back.
Why not to use current and battery resistance instead of thrust (that strictly is incorrect at all, because of limiting in mixer)? |
The internal resistance is a function of the current, which is correlated to trust. Since there are no specs available for those batteries taking the observed voltage drop from flight logs is the most accurate guess we have. |
I thought that we assuming internal resistance constant... :) |
@DrTon I have to think a bit more about what to prefer as a model. All I know right now is that the voltage drop can be read off a log file quite easily for a given setup and its a simple number for users to enter. |
And yes, current would be more accurate. The problem is that the current sensor right now is not very useful for all setups, as it has huge offsets. Not a problem for a quad drawing 16 amps, but a plane just drawing 4-8A peak is easily off (because the sensor has a ~4A offset). The commanded throttle is a probably a more stable estimate, although it will have indeed some error. There is another factor I like about it: It leads the current. So when applying the voltage scaling the voltage has not yet dropped, not creating a false alarm. If we go for current, we might have a drop before the correct scaling has been applied. But I think this needs more testing and log file analysis. This current simple approach will however for sure improve the response for most setups without overcomplicating things. |
@sjwilks This would also be a flight testing candidate. |
~4A offset is too much, I never had such big values. What about internal resistance - it depends not only on battery model, but also on temerature significantly. It would be good to do estimation for it, need to think how to do this. |
… users to new value by param renaming. Since this will tend to show batteries as more drained than before, this is a change in a safe direction and will not trigger unnoticed discharges.
… second unit. Pending testing
Here is a dataset from a test with full throttle - note that the charging estimate only varies slightly thanks to the compensation:
|
@sjwilks I fixed the IO voltage estimate over lunch break based on a dataset I captured during the weekend. I would appreciate if you could validate this. It should now read the same voltage as your lab supply. |
…ggests this is the most accurate measurement
After more meticulous testing I went for the theoretical voltage divider values, which is actually the best we can do. This should now be fairly accurate and outperform the simpler voltage measurement devices (e.g. in standard power supplies). Merging. Yay! |
Consider the throttle load for battery voltage calculation
@DrTon @sjwilks This change considers the internal resistance of the batteries for charge calculation.
@DrTon I'm aware of your capacity PR and want to integrate it as well. However, while this change allows us to get closer to the lower limit (and hence warn at the right time) the charge based approach (without a smart battery) requires still a voltage based sanity check/limit.
So while this PR does not improve accuracy, it helps to not warn the user too soon because of high throttle events.