Lithium-Ion Battery State of Charge Challenge
The estimation of SoC in Lithium-Ion batteries is crucial for battery management systems, especially in electric vehicles, smartphones, and other portable devices. An accurate SoC estimation ensures optimal performance, prolongs battery life, and enhances user safety. Traditional methods often face challenges due to the non-linear characteristics of battery dynamics. This project leverages an Extended Kalman Filter (EKF) for real-time, accurate SoC estimation.
We use an empirical model because we got the OCV-SOC relationship provided by the challenge. The model is based on the Open-Circuit Voltage (OCV) curve, which relates the SoC to the terminal voltage of the battery. The EKF algorithm handles the non-linear behavior of battery characteristics by linearizing the state and measurement equations around the current estimate. We also compute Jacobians for both the state transition and the measurement model to improve the estimation accuracy.
.
├── data/
│ ├── Cha_Dis_OCV_SOC_Data.xlsx # OCV-SOC relationship
│ ├── EVE_HPPC_1_25degree_CHG-injectionTemplate.xlsx # HPPC charging tests
| └── EVE_HPPC_1_25degree_DSG-injectionTemplate.xlsx # HPPC discharging tests
├── main.py # Main Python script
├── test.xlsx # Input test data Excel spreadsheet
├── README.md # Project documentation
├── requirements.txt # Python dependencies
└── (out.xlsx) # (Output data Excel spreadsheet, generated by the script)
Run the main.py
script with python and choose the excel file you would like to use for the analysis.
$ python main.py
Running in prod mode
Getting data from OCV-SOC file...
data_ocv_charge (head):
[...]
data_ocv_discharge (head):
[...]
Reading ./test.xlsx file... (THE SPREADSHEET FORMATTING MUST BE THE SAME AS THE PROVIDED TEST DATA)
voltage current_inv SOC_true temperature
[...]
Time to read data: [...] s
Initial voltage: [...]
Initial SoC: [...], true initial SoC: [...]
Total nb of steps : [...]
[...etc...]
It will then get the test.xlsx
file in the script directory and read it, execute the algorithm with the data, and generate the output out.xlsx
results file.
We use an EKF algorithm to estimate the SoC by linearizing the non-linear state and measurement equations around the current estimate. This method involves computing Jacobians for both the state transition and the measurement model.
We prefered the EKF over other types of algorithm like neural networks because it is more suitable for embedded systems and can be easily implemented in a BMS (incorporated in an FPGA or even an ASIC). The EKF is also more efficient and requires less computational resources compared to neural networks.
Papers:
- Wei, J., Dong, G., & Chen, Z. (2017). On-board adaptive model for state of charge estimation of lithium-ion batteries based on Kalman filter with proportional integral-based error adjustment. Journal of Power Sources, 365, 308-319.
- Wang, W., & Mu, J. (2019). State of charge estimation for lithium-ion battery in electric vehicle based on Kalman filter considering model error. Ieee Access, 7, 29223-29235.
- Ahmed, M. S., Raihan, S. A., & Balasingam, B. (2020). A scaling approach for improved state of charge representation in rechargeable batteries. Applied energy, 267, 114880.
- El Maliki, A., Benlafkih, A., Anoune, K., & Hadjoudja, A. (2024). Reduce state of charge estimation errors with an extended Kalman filter algorithm. International Journal of Electrical and Computer Engineering (IJECE), 14(1), 57-65. doi:http://doi.org/10.11591/ijece.v14i1.pp57-65
Maximum Absolute Error (MaxAE) : 0.10682889559265618 %
Root Mean Square Error (RMSE): 0.0624526869097305 %
![Capture d’écran 2024-11-17 à 22 57 52](https://private-user-images.githubusercontent.com/23436953/387010381-d61d3c4b-38e2-4d00-a6f5-8014063e5668.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0NzY0MjYsIm5iZiI6MTczOTQ3NjEyNiwicGF0aCI6Ii8yMzQzNjk1My8zODcwMTAzODEtZDYxZDNjNGItMzhlMi00ZDAwLWE2ZjUtODAxNDA2M2U1NjY4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDE5NDg0NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTIwMmJkZjZiYmUxZTU4NTlmOTViNzYyNTAxYjQ5MDJiMmYzZWJkYjhmNTZiN2EwYWQzMjVlNGVlM2E1N2ZjNTkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.yIsVZOyJhQ4xpiSpJ55lFWvGdIQ1vPVT3KBFT_1pwdA)
It is difficult to see both colored lines as they are almost on top of each other.
- Algorithm: We use the initial state of charge directly due to some issues with interpolation of the data in the HPPC files.
- Battery Caracteristics: the battery characteristics are defined as constants as it was considered as a sufficient simplification. It would be interesting to consider them as variables.
- Modeling: Implement a more accurate battery model to improve the estimation accuracy.
- Optimization: Optimize the EKF algorithm to reduce the computational complexity and improve real-time performance.
- Validation: Validate the algorithm on a wider range of scenarios.
We would like to thank the organizers for hosting this challenge/hackathon, which enabled us to learn many new concepts and develop new skills.
- Chloé Blommaert
- Numa Deville
- Lucas Placentino
All rights reserved.