BEST - Battery SOC estimator
The CAPRA firmware includes the BEST module to estimate the battery SOC (State Of Charge) and SOH (State Of Health). CAPRA uses the OCV table variant — the cell OCV curve is entered as a table per temperature breakpoint (T, ocv_T1..ocv_T6, 6 breakpoints), with a cell resistance per temperature (R0).
The CAPRA build additionally enables:
- Current-dependent SOC gain — separate voltage-correction strengths at rest and under load (
soc_gain,soc_gain_I) - Flat-curve (LFP) tuning — advanced tuning of the voltage correction for chemistries with a flat voltage curve (
slope_ref,slope_min) - Online SOH & R0 tracking — battery capacity and internal resistance are estimated during operation
- SOC reserve — the reported SOC is remapped to hide a bottom/top capacity reserve
- Cycle counting — battery charge/discharge cycles are accumulated in a permanent
The BEST parameters are located in the /driver/best folder.
CAPRA runs BEST in single-cell mode — the S and Rs parameters are not present, and all voltages and capacities are per cell. The battery temperature for the OCV lookup is taken from the BMS battery temperature sensors.
Parameters
P
Number of cells in parallel. Set to 0 to disable coulomb counting.
soc_gain
Array of 2 gains: soc_gain[0] sets how fast the SOC follows the cell voltage when the battery is at rest; soc_gain[1] the same under load above soc_gain_I. Higher values re-align the SOC with the voltage faster, lower values give a steadier SOC. Set to 0 to disable voltage correction.
soc_gain_I [A]
Load current above which soc_gain[1] applies.
slope_ref [V]
Advanced tuning of the voltage correction for chemistries with a flat voltage curve (LFP). Leave at default unless advised by siliXcon.
slope_min
Advanced tuning of the voltage correction for chemistries with a flat voltage curve (LFP). Leave at default unless advised by siliXcon.
soc_rsv [%]
SOC reserve array (index 0 = bottom, index 1 = top). The reported SOC reaches 0% / 100% at the reserve limits — e.g. {10, 3} means internal 10% is displayed as 0% and internal 97% as 100%.
The SOC reserve remapping applies to the SOC and energy values reported to the application. The SOC state always shows the internal, unmapped value.
reset_time [ms]
How long the SOC re-sync phase at device startup lasts. Negative value for manual-only reset via the breset command or from the app. Set to 0 to disable the reset feature.
reset_gain
How fast the SOC re-syncs to the cell voltage during the reset phase (reset_time after startup or breset).
Cc [mAh]
Cell nominal capacity.
OCV tables
| Parameter | Unit | Description |
|---|---|---|
T | C | Temperature breakpoints array (6 values) |
R0 | Ohm | Cell resistance per temperature (array, one value per temperature breakpoint) |
ocv_T1 | V | OCV table for temperature T[0] (index 0 = 0% SOC, last index = 100% SOC) |
ocv_T2 | V | OCV table for temperature T[1] |
ocv_T3 | V | OCV table for temperature T[2] |
ocv_T4 | V | OCV table for temperature T[3] |
ocv_T5 | V | OCV table for temperature T[4] |
ocv_T6 | V | OCV table for temperature T[5] |
SOH tracking
| Parameter | Unit | Description |
|---|---|---|
soh_Trest | s | How long the battery must be at rest before the health estimate is updated |
soh_Ithr | A | Current below which the battery is considered at rest |
Cmax_lpf | Smoothing of the reported capacity (Cmax) estimate | |
R0_lpf | Smoothing of the reported cell resistance (R0_est) estimate |
States
| State | Unit | Description |
|---|---|---|
SOC | 0-1 | Battery state of charge |
OCV | V | Estimated cell open circuit voltage |
SOH | 0-1 | Battery state of health |
R0_est | Ohm | Estimated cell resistance at the current temperature |
R0_rel | - | Relative cell resistance estimate, 1.0 = nominal |
Permanents
Located at folder /permanents.
| Permanent | Unit | Description |
|---|---|---|
Cmax | mAh | Maximum battery capacity (at 100% charge) |
Cact | mAh | Actual battery capacity |
cycles | % | Battery cycle counter; divide by 200 to obtain full charge/discharge cycles |
R0r | - | Relative cell resistance estimate, 1.0 = nominal |
Shell commands
| Command | Description |
|---|---|
breset | Reset the whole BEST algorithm — SOC, SOH and R0. During reset_time, SOC is corrected using reset_gain |
breset soc | Reset SOC only |
breset soh | Reset SOH only (capacity back to nominal) |
breset r0 | Reset the R0 estimate to nominal. Use breset r0 nan to invalidate the estimate |