Skip to main content
Firmware Stable

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
info

The BEST parameters are located in the /driver/best folder.

Single-cell mode

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%.

note

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

ParameterUnitDescription
TCTemperature breakpoints array (6 values)
R0OhmCell resistance per temperature (array, one value per temperature breakpoint)
ocv_T1VOCV table for temperature T[0] (index 0 = 0% SOC, last index = 100% SOC)
ocv_T2VOCV table for temperature T[1]
ocv_T3VOCV table for temperature T[2]
ocv_T4VOCV table for temperature T[3]
ocv_T5VOCV table for temperature T[4]
ocv_T6VOCV table for temperature T[5]

SOH tracking

ParameterUnitDescription
soh_TrestsRest time before an OCV reference point for SOH tracking is taken
soh_IthrACurrent threshold below which the battery is considered at rest
Cmax_lpfLow-pass filter coefficient for Cmax (capacity) SOH tracking
R0_lpfLow-pass filter coefficient for online R0 tracking

States

StateUnitDescription
SOC0-1Battery state of charge
OCVVExtrapolated cell open circuit voltage
SOH0-1Battery state of health
R0_estOhmOnline R0 estimate at the current temperature
R0_rel-Relative R0 estimate, 1.0 = nominal

Permanents

tip

Located at folder /permanents.

PermanentUnitDescription
CmaxmAhMaximum battery capacity (at 100% charge)
CactmAhActual 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

CommandDescription
bresetReset the whole BEST algorithm — SOC, SOH and R0. During reset_time, SOC is corrected using reset_gain
breset socReset SOC only
breset sohReset SOH only (capacity back to nominal)
breset r0Reset the R0 estimate to nominal. Use breset r0 nan to invalidate the estimate