Week 7 State of charge estimation
Objective:
1.Simulate the 3 test cases from 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 ?
Theory:
Downloading and open closed loop BMS harness dashboard model:
Download the file from the link and go to SOC estimation model-ECU block
To open the Lithium Ion Battery Management algorithm, so we have to download the zip file from the link given in the task as copied below.
Download the Zip file and extract to a folder.

Inside main folder two version zip files are found and I choose again Battery_System_R2020a to extract to a a folder.

The folder consist of these files as shown below,

Open Matlab software and open the Simulink model file of 'Closed loop BMS harness dashboard' in
Tests-->System-->BMS_Closedloop_Harness_Dashboard model file.
- Open MATLAB-SIMULINK. Click on open and select the BMS closed loop model.





Open project and model in pop-up dialog box to install all the model related library files into the current folders and workspace.

- The above image shows there are certain errors. In order to remove these errors, we have to open the model from the correct source. For this, click on Battery_System.prj and make sure that all the files have a green tick indicating that the BMS model is ready to start without any interruptions. The command line shows a message “ Successfully created search data base” which means that the system has no errors.
- Now we have to open the BMS system and the closed loop harness dashboard. So , we go back to MATLAB window and select the BMS system and open the subsystem.

- 01 Cell Parameter Est.

- The BMS model consists of a BMS ECU (electrical control unit ) and a plant. 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. This model contains two versions of the battery pack: a small one with just 6 cell series, and a larger 16-module pack, each module containing a 6-cell series string. The architecture is 6s-1p and 96s-1p packs, respectively.

- When you click on the BMS ECU, its subsystem opens. Now, click on the state machine.

- State Machine defines the main operating state of the BMS. The state machine has four parallel states ( parallel meaning that they can be active at the same time):
- The first one defines the variable BMS_State which indicates standby, driving, charging , and fault. Charging comprises constant current and constant voltage stages.
- The second state switches the fault state ON in case a current, voltage, or temperature value reaches an unsafe level.
- The third and fourth states define the contactor ON and OFF switching sequence for the charger and inverter. This is needed to avoid an excessively large current inrush at the beginning of the charging stage.

- After opening the BMS system we have to go for the harness dashboard. This dashboard can be selected from the MATLAB window following the procedure shown below.

- The harness dashboard is shown below. It consists of the test sequence variant subsystem which hold a three different test cases. This dashboard also helps in determining the fault states and other parameters as shown in the diagram below. Green collar indicates that the system is working without any errors while red signal will indicate that there is a fault in the system.

Blocks in model:
1)Dash board
- Test Sequence Varient(Selector).
- Manual Varient(Selector).
- BMS_TestSequence state request(Subsystem) to provide state request commands.
- Lamps to indicate Fault state,High temperature,Over voltage,Over current, charging ,voltage sensor operation, inverter operation, low temperature, Under voltage.If any fault in these red indication will intimate us and all in good conditions indicated by green indication.
- Rotating switch for manual Variant changes while running simulation.
- In scope results the SOC of module,Module current,Individual cell voltages,Individual cell temperature,Battery state,Cell balancing states are seen as outputs.
2) BMS_Closed loop
In this main block consist of two subsystems,BMS ECU and PLANT units.
The plant output from plant unit given as input to BMS ECU as BMS_input feedback loop.The state request is given to BMS ECU unit.
The BMS Output commands given as input to plant unit as 'From_BMS'.Also the state request is given to Plant unit.
The final outputs from closed loop model are BMS_input,BMS_Output,BMs_info.

In BMS ECU unit, the current power limit calculations are done used in State machine block, SOC Estimations,Cell balancing logics as shown below,

Following these steps the BMS model can be implemented to check the faults and errors using the three different test cases from the harness dashboard.
Note :- The model has a combination of two sets of battery pack. One is for 16 cells and other is for 6 cells. With lesser number of cells the simulation takes less time. This can be selected following the steps discussed below.
- From the plant section select “ Set Plant Configuration”.

- The following system opens up. Double click on “Battery 1 pack 1RC” to activate the 6 cells battery pack. The other option “Battery 16 pack 1 RC” will activate the 96 cells connection.

- This can be cross verified from the plant—— Battery_pack option. This shows that the 6 cells module has been selected.

Study Project :
A)To run three test cases from harness dashboard of closed loop BMS control.
We have to test three cases for this model by selecting test sequence variant and select the cases one by one as fallows,
Test case 1:
Select 1 from test sequence variant dialog box and click apply as shown below.
- To check the faults in the system we have to go back to the harness dashboard. Here, in the first complication the test case 1 is selected.

- After applying the selected test case, we have to run the simulation. The dashboard shows there are no errors and faults.

Click on the “ BMS_TestSequesnce StateRequest” the following system opens up. Now we have to select “ TestSequesnce1”

- Selecting the first test sequence we can check the conditions for this particular condition.


Here from the above test sequence editor figure it was set as,
There are three stages of driving condition, namely-
- Driving
- Charging
- Standby
- Driving for first 3000 secs. When the simulation begins, initially the vehicle is in driving state and the SOC will decrease for this time period.
- After a time period of 3000 seconds the next step is balancing mode and the vehicle is in standby condition. After, another 1000 seconds, the vehicle is in charging phase and the battery’s SOC increases almost to 100 %..
- Then charging and balancing occurs for next 5000 secs.
- The next phase is the post charging phase in which the vehicle again goes for the standby mode.
Results:
Run the simulation and results are shown as,

The lamp indications are showing green for overall simulation period showing that there are no faults occurs during the sequences.
- The scope shows the following results for test case 1.


From the results we can understand that,
Cell Voltages and Pack Current-
For first 3000 secs all 6 cells are in drive mode where discharging occurs majorly and in standby mode for lesser duration at approximately 1000 to 2000 secs.The voltages varies from 3.1V(min) to 3.9V(max) in this range.
From 3000 secs to 4000 secs cell balancing occurs and in this stage the module in standby mode and voltage is constant at nearly 3.7V.
After 4000secs charging occurs, voltage raised from 3.7V to 4V. At 4V to 4.2V at constant current as nearly 30 A and after 4.2 V as constant voltage, current reduces from 30A to 2.6A at end of the charging and cell balancing occurs upto 9000Secs.
After 9000 secs post charge cell balancing starts. All cell voltages are balancing to a voltage with respect to cell 1 to 4.1 V as shown below, in this stage the pack is in stand by mode.
Cell temperatures:
Initially for 3000 secs the temperature range of cells increases gradually from ambient temperature 288K to 302K.
The temperature of cell 1 is lesser and cell 6 has higher temperature for all stages.
After 3000 secs upto 4000 secs the cell temperatures are reduced slightly as no current flows through cell in standby mode.
After 4000 secs temperature starts increases exponentially upto constant current region and start reduces as current flow reduces in constant voltage and cell balancing region upto 9000 secs.
Cell 1 max temperature raised upto 302K and cell 6 temperature raised upto 317K.
After 9000secs the temperatures still reduces and remains stable at reaching ambient temperature.

BMS State:
For 3000 secs the battery module in drive mode(discharging).
From 3000 secs to 4000secs the battery module in balancing standby mode as shown from result plot.
After 4000 secs upto 9000secs the battery module is charging and balancing mode.
After 9000secs only post charge balancing mode operates upto end of simulation.
SOC:

Initially the state of charge of battery module is in 80%.
Here the yellow plot represents SOC estimation done by coulomb counting technique.
Blue plot represents SOC estimation using Unscented Kalman filter technique.
Red plot represents SOC estimation using Extended Kalman filter technique. Among three UKF and EKF techniques estimate accurately than coulomb counting technique.
Initially for 3000 secs SOC decreases to nearly 45% during drive mode.
After 3000secs upto 4000 secs the SOC is constant at 45% as cell balancing occurs in standby mode.
From 4000 secs to 9000secs module in charging mode.(4000 to 7000=CC mode,7000 to 9000=CV mode).
After 9000 secs the SOC becomes constant approximately 94% as seen from above plots.
Balancing cells:
Initially upto 3000 secs balancing was not performing.
After 3000 secs cell balancing starts within cell 6 and cell 2 as they raised to 1 as shown above since its voltage is higher than all other cell voltages.
After this stage charging and balancing, post charge balancing are occurs as Cell 6 and cell 2 remains in 1 state till end of simulation.
As cell 1(yellow) is in lesser voltage than other cells it remains in 0 state through out the simulation.
At the end of the simulation all cell voltages try to balance equally as we seen earlier in single cell voltages plot.
Test case 2:
Now select test case 2 and click apply in test sequence variant dialog box as shown below. For this we have to go test case variant subsystem and select test case 2 from there and click on “OK”. Then we have to run the system for the given simulation time. The result shows that there is a fault condition in the vehicle . The dashboard on the model depicts the same with a red colour indication. Because of version MATLAB 2022B simulation will run till 10000 secs, but it is showing 8692.2 secs.

Click on the “ BMS_TestSequesnce StateRequest” the following system opens up. Now we have to select “ TestSequesnce2”

Selecting the second test sequence we can check the conditions for this particular condition.

This test case has two phases for the battery pack, i.e. Driving and Charging phases.This test case consist of drive mode for 10000 secs and after that charging occurs till end of simulation.

The scope shows the various parameters for the BMS model under second test case. 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.Because of version MATLAB 2022B simulation will run till 10000 secs, but it is showing 8692.2 secs.
Results:
The dashboard results are shown as without any faults occurred.

The scope result plotted as,

Here in these plots only driving mode of battery module is plotted.
Cell Voltages and Pack Current-
The cell voltages varies from maximum 3.9V and reduces to 3.05V as cutoff voltage upto 9000 secs.Entire capacity drained at 9000 secs.
The pack current discharges upto maximum 70A and slight charging occurs during the overall drive.
Some stand by mode conditions are in between the drive modes.

Cell temperature:
Here cell 1 having lesser temperature variations from 288K to approximately 302.5K.
Cell 6 is having higher temperature variation from 288K to approximately 322.5K.
The cell temperatures are slightly reducing in between the drive modes as these durations are in stand by modes.
Battery module state:
Entire sequence is performing in drive mode as shown from the above plot.
Small duration of standby modes are not plotted in this plot as simulation upto 10000 secs command is given as drive mode.
But in actual practical situation standby modes are not present present as battery current drains by other small auxiliaries of EV's.

SOC of module:

Here the SOC reduces from 80% to 0% (as current drained for longer duration) in entire drive mode as shown in above plot.
At stand by modes in between them the SOC remains constant as shown.
Balancing:
Here balancing of cells are not performed as shown as balance states are in 0 for entire drive mode.
Test case 3:
Now select test case 3 and click apply in test sequence variant dialog box as shown below,

After applying the selected test case, we have to run the simulation. The dashboard shows there are no errors and faults.

Click on the “ BMS_TestSequesnce StateRequest” the following system opens up. Now we have to select “ TestSequesnce3”

Selecting the third sequence we can check the conditions for this particular condition.

There is only a single phase here for the third test case, i.e. the charging phase.

Run the model and results can be viewed.
Result:
The dashboard lamps indications are shown as,

All indications are in green indicates no fault conditions are occurred.
The scope shows the results for the third test case. Here the SOC increases from 80 to 100 % and then remains in standby mode.

Cell voltages and pack current:
Initially cell 2 , voltages raises from 3.9V(approx.) to maximum 4.2V and stabilised to 4.15V.
Cell 1 raises from 3.85V to 4.1V and stabilised to 4.08V.
The battery pack current raising from 0A to 30A and starts to reduce to 2.5 A gradually at end of full charging upto 2000 secs.
At 2000secs the pack is fully charged to 100%.
After full charge current flow will be cutoff as shown in result plot.
Cell temperatures:
The cell temperatures continue to increase heat upto full charge and after that the temperatures get started to reduces to ambient temperature.
As shown from result plot the temperatures start decreases after full charge(at 2000 secs).
BMS state:
Entire battery pack sequence is operating in charging mode as shown above.
SOC:
The pack SOC gets fully charged at 2000secs and remains at full charge for rest of the sequence as shown above.
The actual state of charge is around 93% shown as full charge shown by UKF and EKF techniques.
Cell Balancing:
Here from 0sec the cell 6 and 2 starts to balance with respect to cell 1 and all cells are try to balancing at end of simulation.
Conclusion:
Hence from above three test cases the performance of BMS on various factors are discussed and analysed.
2.What is coulomb counting? Refer to the above model and explain how BMS implements coulomb counting for SOC estimation ?
SOC:
The state of charge (SOC) is a measurement of the amount of energy available in a battery at a specific point in time expressed as a percentage. For example, the SOC reading for a computer might read 95% or 100%.

Where
C = Total Capacity of the Battery
I = current
SOC Estimation:
The determination of battery SOC is always an essential part of a BMS. The accurate and reliable estimation of battery SOC can provide a necessary assessment factor for vehicle energy management and optimal design of the control system. Therefore, a larger number of methods have been proposed for estimating battery SOC in real-time. Here we are calculating state estimation by using the coulomb counting method.
Coulomb Counting Method :
The Coulomb counting method measures the discharging current of a battery and integrates the discharging current over time in order to estimate SOC. Coulomb counting method is done to estimate the SOC values, which is estimated from the discharging current and previously estimated SOC values, SOC is calculated by the following equation:

Modified Coulomb counting:
In this technique discharge current is corrected with a function and corrected current is found out for accurate SOC estimation.
The function can be given as,

Where K0,K1,K2 are constant values obtained from the practice experimental data.
The SOC relation can be given as,

SOC estimation in BMS model:
To see the model of coulomb counting technique in BMS model click the subsystem of SOC_Estimation and click Coulomb counting.

Click here to get into SOC estimation.

By opening the coulomb counting method we get to see the gain, 1-D look Up table, Product and Discrete Time Integrator block.
There are three method for calculation of SOC estimation.
i) Coulomb counting
ii) Unscented Kalman filter
iii) Extended laman filter.


Here the discharge current from battery given to gain with value as 1/3600 to convert current to Ahr.
The value is divided by capacity due to temperature change. Then integrated with a gain value of 1 with sample time -1 as we are using discrete integrator.
The saturation limits are from 0 to 1.
We will get the SOC values from 0 to 1 multiplied with 100 to get in percentage of SOC.

That current is divided by the capacity due to temperature change and then integrated with the gain value of -1 with sample time of -1 as discrete type integrator is used here.
The saturation limits are given which are 1 to 0. So that we get the SOC value from 0 to 1 multiplied with 100 to get percentage of SOC.
This Coulomb Counting method is simple and require less computational compared to other two methods.