-
Notifications
You must be signed in to change notification settings - Fork 0
Implement Coulomb Counting #46
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
base: develop
Are you sure you want to change the base?
Conversation
jr1221
left a comment
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.
awesome. Technically rather than doing get_tick we should eventually read the time increment register in the 2950. But this is good enough for our purposes probably.
| } | ||
|
|
||
| // Coulomb Counting | ||
| // SoC(t) = SoC(t-1) + I(t)/Qn * (t1 - t0) |
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.
the order of operations below is different, coreect? THis makes it look like the divide by capacity happens to I(t) then its multiplied by delta t
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.
Yes, but the order of the multiplication and division does not affect result so its the same
Core/Src/soc.c
Outdated
| // SoC(t) = SoC(t-1) + I(t)/Qn * (t1 - t0) | ||
|
|
||
| float last_soc = analyzer->soc; | ||
| float curr_time = (float)HAL_GetTick(); // in milliseconds |
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.
dont we need to convert hal_gettick to ms technically?
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.
Not sure if we should be using tx_time_get() (converted to milliseconds) instead of HAL_GetTick() here, since this code runs in a ThreadX task.
Core/Src/soc.c
Outdated
|
|
||
| float current = hv_plate->pack_current; // in Amperes | ||
|
|
||
| float soc = last_soc + (current * delta_time) / FULL_CAPACITY_AH; |
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.
If the ADBMS2950 reports positive current during discharge, the current sign may need to be inverted before applying this formula. Otherwise, SOC would increase during discharge.
Changes
Added calculation for pack SoC as a result of Coulomb counting with a look-up table at start up in new file
soc.c.To Do
Any remaining things that need to get done
-[ ] Cell profiling with the P50Bs
-[ ] Potentially incorporate pack average temp to have a more accurate estimate of the pack SoC?
Checklist
It can be helpful to check the
ChecksandFiles changedtabs.Please reach out to your Project Lead if anything is unclear.
Please request reviewers and ping on slack only after you've gone through this whole checklist.
Closes #5