# SOC Estimator (Coulomb Counting, Variable Capacity)

**Libraries:**

Simscape /
Battery /
BMS /
Estimators

## Description

The SOC Estimator (Coulomb Counting, Variable Capacity) block implements an estimator that calculates the state of charge (SOC) of a battery by using the Coulomb counting method. The cell capacity of the battery is an input to the block. The block calculates the state of charge by dividing the accumulated charge by the value of this input. The block then calculates the accumulated charge by integrating the battery current.

The SOC is the ratio of the released capacity
*C*_{releasable} to the rated capacity
*C*_{rated}. Manufacturers provide the value of
the rated capacity of each battery, which represents the maximum amount of charge in the battery:

$$SOC=\frac{{C}_{\text{releasable}}}{{C}_{\text{rated}}}.$$

This block supports single-precision and double-precision floating-point simulation.

**Note**

To enable single-precision floating-point simulation, the data type of all inputs and
parameters, except for the **Sample time (-1 for inherited)**
parameter, must be `single`

.

You can switch between continuous and discrete implementations of the block by using the
**Sample time (-1 for inherited)** parameter. To configure the
block for continuous time, set the **Sample time (-1 for
inherited)** parameter to `0`

. To configure the block for
discrete time, set the **Sample time (-1 for inherited)**
parameter to a positive, nonzero value, or to `-1`

to inherit the
sample time from an upstream block.

**Note**

Continuous-time implementation of this block works only in a double-precision floating-point simulation. If you provide single-precision floating-point parameters and inputs, this block casts them to double-precision floating-point values to prevent errors.

This diagram shows the structure of the block:

### Equations

To compute the SOC of the battery, the SOC Estimator (Coulomb Counting, Variable Capacity) block counts the Ampere hour and current integration:

$$SOC=SOC\left({t}_{0}\right)+\frac{1}{{C}_{\text{rated}}}{\displaystyle \underset{{t}_{0}}{\overset{{t}_{0}+\tau}{\int}}{I}_{\text{batt}}},$$

where *C*_{rated} is the
nominal battery capacity and *I*_{batt} is the
battery current.

## Assumptions and Limitations

The nominal capacity of the battery does not consider aging.

## Ports

### Input

### Output

## Parameters

## Extended Capabilities

## Version History

**Introduced in R2023a**