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 model — the cell OCV curve is defined by multi-point lookup tables with bilinear interpolation across SOC and temperature (6 temperature breakpoints), with per-temperature cell resistance.
The CAPRA build additionally enables:
- Current-dependent SOC gain — at rest the estimator trusts the OCV correction more, at high load it relies more on coulomb counting
- OCV slope gain scaling — the voltage correction is reduced in flat regions of the OCV curve to prevent noise-driven drift
- 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] is used at rest, soc_gain[1] at full load. The effective gain is interpolated between them based on the actual current — at high current the estimator relies more on coulomb counting. Set to 0 to disable voltage correction.
soc_gain_I [A]
Current at which soc_gain[1] is fully used.
slope_ref [V]
dOCV/dSOC reference at which the full correction gain applies.
slope_min
Minimum gain fraction applied in flat regions of the OCV curve (e.g. LFP plateau).
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]
SOC reset time at device startup. Negative value for manual-only reset via the breset command or from the app. Set to 0 to disable the reset feature.
reset_gain
SOC reset correction weight. Same role as soc_gain, but applied during the BEST reset period.
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 | Rest time before an OCV reference point for SOH tracking is taken |
soh_Ithr | A | Current threshold below which the battery is considered at rest |
Cmax_lpf | Low-pass filter coefficient for Cmax (capacity) SOH tracking | |
R0_lpf | Low-pass filter coefficient for online R0 tracking |
States
| State | Unit | Description |
|---|---|---|
SOC | 0-1 | Battery state of charge |
OCV | V | Extrapolated cell open circuit voltage |
SOH | 0-1 | Battery state of health |
R0_est | Ohm | Online R0 estimate at the current temperature |
R0_rel | - | Relative R0 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. Accumulates SOC percent changes — 200 counts correspond to one full charge/discharge cycle |
R0r | - | Relative R0 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 |