4.1.1.1. SOC: Coulomb Counting

4.1.1.1.1. Module Files

4.1.1.1.1.1. Driver

  • src/app/application/algorithm/state_estimation/soc/counting/soc_counting.c

4.1.1.1.1.2. Configuration

  • src/app/application/algorithm/state_estimation/soc/counting/soc_counting_cfg.h

4.1.1.1.1.3. Unit Test

  • tests/unit/app/application/algorithm/state_estimation/soc/counting/test_soc_counting.c

4.1.1.1.2. Detailed Description

By default, foxBMS 2 uses the internal integrator of the current sensor. If the current sensor integrator is not available, the integration is made directly in the foxBMS 2 software.

The check of the presence of the integrator and the software integration are made in the Function implementing Coulomb-counting.

Listing 4.1 Function implementing Coulomb-counting
1void SE_CalculateStateOfCharge(DATA_BLOCK_SOC_s *pSocValues) {

4.1.1.1.3. SE_CalculateStateOfCharge

Charge and Discharge Throughput can be calculated in two ways, depending if an external analog current counting value is available or not. The algorithm is implemented as follows:

If analog current counting value is available:

1. Calculate the charge difference between the latest and the previous current counting value. 1. Check current flow direction to evaluate if charge/discharge is ongoing. 1. Accumulate either charge or discharge throughput in SOC database entry. 1. Save time step 1. Save current counting value

If analog current counting value is NOT available:

1. Manually integrate current to calculate amount of charge since last call. 1. Check current flow direction to evaluate if charge/discharge is ongoing. 1. Accumulate either charge or discharge throughput in SOC database entry. 1. Save time step