State of charge estimation
Objective:
- To simulate the 3 cases from harness dashborad of the BMS_ClosedLoop model.
- To explain the coulomb counting and how BMS implements counting for SOC estimation.
Simulink model of BMS and Test harness:

This BMS model is a closed loop feedback control model consists of BMS ECU block and a Plant block. The control unit with its various monitoring and control algorithms is connected to a block with the representation of the battery pack and associated circuitry and peripherals.
The BMS ECU is the main component of this BMS model. It contains 4 important blocks: Current/Power limits calculator, State Machine, SOC estimator, and Cell Balancing Blocks.

- The Current_Power_Limits_Calc block takes the input as Cell Voltages and Cell Temperatures and gives the output as Discharge Current limits,Charge Current limits, Max Cell Voltages & Min Cell Voltages.
- The State_Machine is a control logic block which gives the output as a boolean commands.
- The SOC_Estimation block calculates the State of Charge of the BMS. It takes the input from the Plant and the State_Machine blocks and then gives the output as SOC%.
- The Balancing_Logic block takes the input from the Current_Power_Limits_Calc block as Min cell voltage and Max Cell voltage, and the other input it takes direct from the plant to balance all the cell voltages and gives the output as the balanced cell voltage.
There is a test harness model which is connected to this system. This system test the whole system and indicates the faults arises during the running of the system.

The harness dashboard is used to control and identify the test case states in the state machine. It consists of the test sequence variant subsystem which holds three different test cases. This dashboard also helps in determining the fault states and other parameters as shown in the diagram below. The green color indicates that the system is working without any errors while the red signal will indicate that there is a fault in the system.
Case 1:
Let's choose the case 1 from the test sequence variant block and run the model.

- The Simulation runs for 20,000 sec.
- The Vehicle is in the driving state initially until 3000 sec.
- At 3000 - 4000 sec there is no process going on, the SOC% hit its minimum value and remains constant until 4000 sec. The current becomes zero and voltage reaches the cutoff limit.
- At 4000 sec the charging of the battery pack has started. The charging process runs from 4000 s - 9000 s. For the first 500 sec it undergoes Constant Current Charging so that the cell reaches its peak voltage value which is 4.2 V. After that the charging is done at Constant Voltage mode.
- The last state is the Standby state. In this state the voltages and SOC of the cells are at their and maximum level. There is zero current as there is no driving of the vehicle.

There are no faults occur in this case.
Case 2:
Choosing the case 2 from the test sequence variant block and analyse the results.
After 10,000 sec when the driving cycle is over, the fault condition occurs and so the SOC does not increase even for the charging phase.

- Cell temperature increases during the driving. The battery stops charging since the temperature of the battery is higher than recommended.After that the temperature of the cells gradually decreased.
Case 3:
Choosing the case 3 from the test sequence variant block and analyse the results.

- The simulation runs for 3000 sec.
- plot shows that the Vehicle is in the driving mode only.
- There is a continuous decreasing of the cell voltage.
- There is no cell balancing command by the BMS.
- The Cells temperature are continously increasing and SOC% is continously decreasing.

There is no fault detected during the test.
Coulomb Counting:
The SOC is one of the most important parameters for batteries, but its definition presents many different issues. In general, the SOC of a battery is defined as the ratio of its current capacity `Q(t)` to the nominal capacity `Q_n`. The nominal capacity is given by the manufacturer and represents the maximum amount of charge that can be stored in the battery. The SOC can be defined as follows:
The various mathematical methods of estimation are classified according to methodology. The classification of these SOC estimation methods is different in the various literatures. However, some literatures allow a division into the following four categories.
(i)Direct measurement: this method uses physical battery properties, such as the voltage and impedance of the battery.
(ii)Book-keeping estimation: this method uses discharging current as the input and integrates the discharging current over time to calculate the SOC.
(iii)Adaptive systems: the adaptive systems are self-designing and can automatically adjust the SOC for different discharging conditions. Various new adaptive systems for SOC estimation have been developed.
(iv)Hybrid methods: the hybrid models benefit from the advantages of each SOC estimation method and allow a globally optimal estimation performance. The literature shows that the hybrid methods generally produce good estimation of SOC, compared to individual methods.
The Coulomb counting method measures the discharging current of a battery and integrates the discharging current over time in order to estimate SOC [20]. Coulomb counting method is done to estimate the `SOC(t)` , which is estimated from the discharging current `I(t)`, , and previously estimated SOC values `SOC(t - 1)`, . SOC is calculated by the following equation:
`SOC(t) = SOC(t - 1) + (I(t))/Q_n`
But there are several factors that affect the accuracy of Coulomb counting method including temperature, battery history, discharge current, and cycle life.

This is the Coulomb Counting block for the SOC estimation.
This block will follow the same formula as we have mentioned above to calculate the SOC% of the battery pack.

As we can see that the Current and the Temperature are taken input and then it is formulated in terms of the blocks as shown above.
`SOC(t) = SOC(t - 1) + (I(t))/Q_n`.
And hence the SOC% is calculated using Coulomb Counting method.