Week 7 State of charge estimation
AIM:-
1. Simulate the 3 test cases from the harness dashboard and write a detailed report on the results.
2. What is coulomb counting? Refer to the above model and explain how BMS implements coulomb counting for SOC estimation?
SOLUTION:-
(1) Simulation of BMS with 3 different test cases from the harness dashboard.
Battery Management System:-
Electric vehicles run on rechargeable battery packs that are made of multiple cell modules arranged in a series and parallel. These battery packs produce several hundred volts of electricity. Various functions inside the car are dependent on them. That is why it becomes a critical component of the vehicle that requires constant monitoring and control.
Battery Management System (BMS) is an embedded system, which monitors the components closer to the battery cell, as each cell needs to be closely monitored so that there are no voltage fluctuations or imbalances in voltage conditions. The BMS consists of different components that ensure that the battery runs efficiently without chances of possible failures.
Need for BMS:
The main function of BMS is to ensure that the battery is protected and any operation out of its safety limit is prevented. It monitors the battery pack’s state of charge (SOC) along with the state of health. BMS also manages the battery optimization via cell balancing improves the life of the battery in the long run. The BMS will also monitor voltage, different temperature parameters, and coolant flow.
Lithium-ion batteries that possess high charge density, power most electric cars. These battery packs even though are not very big; can be highly unstable. Therefore, these batteries should never be overcharged or be allowed to reach a state of deep discharge at any point. Thermal Runaway is a condition where the current flowing through the battery on charging or overcharging causes the cell temperature to rise. Conditions like these can harm the lifespan or the capacity of the battery. To ensure this does not happen, we require BMS to monitor its voltage and current.
This process is very challenging as many cells are put together to form a battery pack in an electric vehicle and every cell needs to be individually monitored for its safety and efficient operation, which requires a specially dedicated system called the Battery Management System (BMS).
The primary function of BMS:
- Safety,
- Performance optimization,
- Health monitoring and diagnosis, and
- Communication.
MATLAB Model of BMS:

fig. Simulink configuration of BMS.
(A) BMS ECU:
The above model consists of the following BMS Algorithms:-
1. State of Charge estimation using Extended Kalman Filter, Unscented Kalman Filter:
In the BMS model, the SOC is calculated by 3 different methods
- Coulomb counting
- Extended Kalman filter
- Unscented Kalman filter.

Kalman filtering:-
- It is also known as linear quadratic estimation (LQE), is an algorithm that uses a series of measurements observed over time, containing statistical noise and other inaccuracies, and produces estimates of unknown variables that tend to be more accurate than those based on a single measurement alone, by estimating a joint probability distribution over the variables for each timeframe.
fig. Kalman filtering
2. Passive Battery Cell Balancing:
- A passive system potentially burns off excess energy from the high cells through a resistive element until the charge matches the lower energy cells in the pack.
- If you have cells packed in series and you notice that some of the cells have higher energy than the other lower energy cells, you can balance the cells in burning energy of the top cells simply by attaching a resistor to the cells which release the energy into heat thereby equalizing the cell energy of the battery pack.
fig. Cell balancing
Cell Balancing System:
- The cell balancing system continuously monitors and measures the voltage difference between battery cells and once the vehicle is not in driving and the difference between the cell voltages increases beyond a certain value the balancing starts to happen.

fig. State-flow of the cell balancing
3. Pre-charging and Contactor Management:
- Pre-charge of the powerline voltages in a high voltage DC application is a preliminary mode that limits the inrush current during the power-up procedure.

fig. DC pre-charge circuit flow - A high-voltage system with a large capacitive load can be exposed to the high electric current during the initial turn-on. This current, if not limited, can cause considerable stress or damage to the system components. In other systems such as vehicle applications, pre-charge will occur with each use of the system, multiple times per day. Precharging is implemented to increase the lifespan of electronic components and increase the reliability of the high voltage system.
- The below state system represents the pre-charging check included in the fault monitoring system. The check is performed before charging when the charger is connected and when it is removed and in the same way for the power converter circuit when the load is connected and disconnected.

fig. State-flow of the Pre-charging and Contactor Management chart
4. Fault Management - Over/Under Voltage, Over Current, Over Temperature:
- The battery Management System is to provide the necessary monitoring and control to protect the cells from out-of-tolerance ambient or operating conditions. This is of particular importance in automotive applications because of the harsh working environment. As well as individual cell protection the automotive system must be designed to respond to external fault conditions by isolating the battery as well as addressing the cause of the fault. For example, cooling fans can be turned on if the battery overheats. If the overheating becomes excessive then the battery can be disconnected.
- The Fault Monitoring system continuously monitors the parameters such as temperature, voltage, and current.
- The current monitoring system checks the current being drawn and put inside the battery whenever the time duration of the peak current increases or the time duration of peak requirement is more than fault is generated and the battery is sent into a fault state.
- Similarly, cell voltage and temperature are continuously compared to the maximum and the minimum limits, and a fault is generated whenever the limits are crossed.

fig. State-flow chart of the Fault management
The complete state monitoring system also includes a pre-charging check for load and the charger

5. Charge and Discharge Current Limit Calculations:
- The charge and discharge calculation is also a part of the fault management and protection function performed by the Battery Management System to restrict the operation in safe working points within limits.
- The voltage level of 6 cells is given as input from which the minimum voltage is used to find the max discharge current of the battery and similarly, the maximum voltage of the cell is used to find the max charging current for the battery.

Charging/Discharge Current Limit Subsystem:
- The minimum voltage is then fed to the discharge current subsystem where minimum the difference between cutoff voltage and cell minimum voltage is used to find the maximum instantaneous discharge current using the resistance of the cell. The minimum discharge current is then chosen by considering the cell instantaneous temperature, resistance, and voltage of the cell.
- Similarly, the maximum charging current is found based on the maximum instantaneous voltage which is then compared to the max safe voltage of the cell. Also, the cell's instantaneous temperature, resistance, and voltage are taken into consideration.
Discharge Current Limit Subsystem:

Charge Current Limit Subsystem:

(B) Plant:

fig.Simulink model of Sub-system of the Plant
The Plant model consists of 3 main subsystems consisting of the following:-
1. Battery Pack:-
- The battery pack consists of a module with 6 cells connected in series along with the cell balancing circuit.
- The voltmeter is connected in parallel to the battery pack and an ammeter is connected in series to the negative terminal of the battery.

Cell Module:-
- It shows 6 cells connected in series along with the temperature sensor. The simulation is stopped when the SOC of the cell drops below 0.00

Cell-Balancing Circuit:-
- Here we only passive cell balancing technique as it is comparatively cheaper and less complex than the active cell balancing technique.
- In the cell balancing circuit, we use only a resistor in parallel to dissipate the charge stored in the form of heat. This is controlled using a voltage sensor which checks when to stop balancing to stop over-discharge.

2. Precharge Circuit:-
- The precharge circuit is used in order to prevent the current rush while charging and discharging the battery and to prevent the spark generation, the wiring, and the components from the sudden flow of high current.
- A resistor is connected in series to limit the current flow and a capacitor is connected to prevent the voltage ripple. At first, the negative of the battery is connected and then the capacitor is charged via a resistor, and at the end step positive terminal is connected.

3. Charging/Discharging Load:-
- The charging or the load is applied using based on the user input given is state request given as input in the subsystem.

Charging:-
- When the state input for charging is "1" then the battery is charged via a controlled current source and the amount is charged is mapped to data stored under the variable "ChargeCurrentReq".

Discharging:-
- Here the charge given by the battery is considered positive and the charge given to the battery is considered negative.
- The state requirement is checked and the current profile for discharge is made as a repeating sequence from remapped data in the variable "BattCrnt'. The battery is discharged using a controlled current source.

Simulate the different test cases:-
This is the BMS close-loop harness dashboard to design and test these 3 algorithm and this project also includes files for:
1. Li-ion Battery Cell Parameter Estimation
2. Battery Pack with 6 cells in series and 96 cells in series
3. Simulink Test files with test cases to test State Machine Logic
4. Linking requirements to Models

fig. Simulink configuration of Harness Dashboard
(1) Test Sequence 01:
The simulation is run for 20000 seconds in which the first 3000 seconds is the discharge or the driving mode then the next 1000 seconds are in balancing or standby mode then 5000 seconds in charging and balancing mode and afterward the in standby or balancing mode.

Output:-

Comments:-
- The first plot with Cell_Voltages displays the voltages of all 6 cells connected in the series. While the first 3000 seconds the voltage of the cells drops as the battery is discharging and during the standby period the voltage stabilizes as the cell balancing gets activated and even due to cell inherit behaviour. Then while charging the cell voltage increases and while the cell balancing the voltage stabilizes.
- The second plot with Pack_Current represents the current drawn and given to the battery while charging and discharging. It is also seen that while charging, first the current remains constant, and then it drops its charges in constant voltage mode.
- The third plots the cell temperature of all individual cells and we can see then while charging and discharging the cell temperature increases.
- The fourth plot shows the input state as per the given state input.
- The fifth plot shows the state of charge of the entire pack by 3 different methods of calculation. The soc curve decreases as we discharge the battery and increases while charging.
- The sixth plot shows the cell balancing command for all six cells. The 1st cell is having the lowest voltage and does not need balancing thus we can see that all the other cell's signals have a magnitude of 1 whereas the 1st cell signal is at zero magnitudes.

(2) Test Sequence 02:
The simulation is to run for 20000 seconds in which the first 5000 seconds is the discharge or the driving mode then the rest of the time is set to charge the battery.

Output:-

Comments:-
- The first plot with Cell_Voltages displays the voltages of all 6 cells connected in the series. While the first 5000 seconds the voltage of the cells drops as the battery is discharging and then while charging the cell voltage increases and while the cell balancing the voltage stabilizes.
- The second plot with Pack_Current represents the current drawn and given to the battery while charging and discharging. It is also seen that while charging, first the current remains constant, and then it drops its charges in constant voltage mode.
- The third plots the cell temperature of all individual cells and we can see then while charging and discharging the cell temperature increases, at about 6000 seconds the cell temperature of the 6th cell increases to about 323.15 Kelvin, and the battery is sent to fault state.
- The fourth plot shows the input state as per the given state input until the fault occurs at about 6000 seconds.
- The fifth plot shows the state of charge of the entire pack by 3 different methods of calculation. The soc curve decreases as we discharge the battery and increases while charging. The battery is charged up to 70-75% and stops charging once the fault occurs.
- The sixth plot shows the cell balancing command for all six cells. The 1st cell is having the lowest voltage does not need balancing thus we can see that all the other cell's signal have a magnitude of 1 whereas the 1st cell signal is at zero magnitudes. The cell balancing starts when the battery starts to charge and at the onset of the fault the battery charging is stopped but the balancing happens.

(3) Test Sequence 03:
The simulation is run for 20000 seconds in which the first 10000 seconds is the discharge or the driving mode then the rest of the time is set to charge the battery.

Output:-

Comments:-
- The first plot with Cell_Voltages displays the voltages of all 6 cells connected in the series. The cell voltage keeps on dropping as the battery keeps on discharging up to zero state of charge and the simulation is stopped.
- The second plot with Pack_Current represents the current drawn and given to the battery while charging and discharging. Here we can see that battery repeats the charging and discharging pattern as explained above in the charging and discharging load.
- The third plots the cell temperature of all individual cells and we can see then while charging and discharging the cell temperature increases.
- The fourth plot shows the input state as per the given state input, the simulation only runs in discharging mode and when the SOC reaches zero the simulation is stopped at about 8692 seconds.
- The fifth plot shows the state of charge of the entire pack by 3 different methods of calculation. The soc curve decreases as we discharge the battery and increases while charging. Here the battery keeps on discharging as the regenerative charging is very less.
- The sixth plot shows the cell balancing command for all six cells. The cell balancing does not take place as the simulation runs only in a driving state.

------------------------------------------------------------------------------------------------------------------------------------------------------------------------
(2) Coulomb counting:
Coulomb counting is a technique used to track the state of charge of a battery pack. It works by integrating the active flowing current (measured in amps) over time to derive the total sum of energy entering or leaving the battery pack. This produces a capacity that is typically measured in Amp-hours.
The Coulomb counting method measures the discharging current of a battery and integrates the discharging current over time in order to estimate SOC. It 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)QN⋅ΔtSOC(t)=SOC(t-1)+I(t)QN⋅Δt
Where,
SOC(t)SOC(t) = State of charge at estimated time;
I(t)I(t) = Discharging current;
QNQN = Nominal battery capacity.
Implementation of coulomb counting for SOC estimation in the BMS:

fig. Coulombs counting method
- The discharge current signal is converted from the physical system using a gain block.
- The gain block is integrated by 130⋅3600130⋅3600 is applied to the integrated signal which gives us the discrete data.
- The temperature data is divided by using a lookup table with the discharge current rate.
- The output is then integrated with a discrete-time integrator block with a sample time of 0.1 sec to calculate the SOC of the battery pack.