Employing Extended Kalman Filter for battery SOC meter

Status
Not open for further replies.

offgrid

Active member
Hello all,
First of all, I'd like to thank all of the forum members, and especially Paul S. for all of the amazing ideas, code and work product that is available on this forum to the greater world, and of course for the great Teensy product line. I've stood on your shoulders to produce a new Teensy LC and 3.2 based (20 - 18650 cell) battery block kit for electric vehicles that I call DKblock, that has uses gold plated phosphor bronze spring contacts for a compression cell connection, and is capable of 100A discharges. I'm using nRF24L01 for wireless communications to get rid of the common BMS problem of bad or loose small wire connections. I'd be happy to post the data sheet on the web or send to anyone interested. Below is a picture I uploaded of the basic components of the kit.

Now for my basic question. I like the idea of using the extended Kalman filter for state of charge (SOC) estimation, right now I'm only using battery and voltage information for SOC. Can the Kalman filter code used in the new Prop Shield be used as a standalone C or C++ function, and if so, are there any hints on extracting and applying that code. The Kalman inputs are voltage, current and temperature, and of course time. Filter delay is not an issue. A new estimation every few seconds would be excellent. If this seems unlikely, are there other extended Kalman filters available? I've looked at the TinyEKF code, and it seems so specific to the LM35 and the BMP180 barometer, but maybe it can be modified for V and I.
https://github.com/simondlevy/TinyEKF/blob/master/examples/SensorFusion/SensorFusion.ino

There are some nice articles on using the Kalman filter predictor for SOC designs, here is one:
https://www.mathworks.com/tagteam/76108_SAE 2013 - Simplified EKF Battery Model.pdf


I'm open to any ideas that get an accurate SOC meter using Teensy 3.2. And yes, I would be happy to share any SOC code found or written along the way!

Thanks so much!
Tim
offgrid

Here is the DKblock kit part picture:
dkblock.jpg

And a picture of the 'Pack Supervisor':
dk supervisor.jpg
 
Last edited:
Looks like a very cool project, congratulations on the 100A discharge!

The kalman filter for the propsheild is (I imagine) deeply tied into the use of Quaternions and you'll find most of the code is working with that. This is because the filter needs to operate in 3D with that extra 1D to prevent gimbal lock, I won't go too far into this but the basics of it is that you'll basically end up rewriting it anyways. Embedded kalman filters are very specific to one application as they are built around a mathematical model that describes the physics of the input variables and how this relates to the output

That second paper you linked to seems to have a pretty good explanation of how it's been implemented. Why not write your own with their guidelines?
 
As for the observation about most Kalman filters being specific, that is just what I am finding also. I'll go get the Prop Shield code and check it, but I'm just wondering if it was made for general use or not. Or for that matter, had anyone else adapted the filter to SOC estimation?
The array math seems to be a little daunting to me, but maybe I could use the TinyEKF for that part of the code. That might be the way to go, and if so I may be checking back with more specific code questions for debugging the math stuff.
Another good paper that uses a lot of testing to prove SOC accuracy using extended Kalman is at:
https://www.google.com/url?sa=t&rct...VAYCkOJ4_Tge68vJ7eRhyg&bvm=bv.127521224,d.cGc
 

Attachments

  • State of Charge Estimation Using the Extended Kalman Filter for BMS systems.pdf
    935 KB · Views: 756
Last edited:
Yeah that is a good one, and in that tutorial is Levy's recommendation for Kalman Filter for Dummies, which is pretty good too!
http://bilgin.esme.org/BitsAndBytes/KalmanFilterforDummies

The most complete work I found on Kalman and battery state of charge is by Gregory L. Plett, a professor at University of Colorado. This link will take you to the book he has written on the subject,
http://mocha-java.uccs.edu/bms2/
as well as some video courses on battery managment, electric vehicle monitoring and control, and SOC estimation. Pretty cool stuff. The Kalman estimators have been studied and documented very well, in my opinion.
The videos take a lot of time to go through, but they help explain alot. There are PDF documents for the course material too. The link for the courses,
ECE5720: Battery Management and Control:
http://mocha-java.uccs.edu/ECE5720/index.html
ECE4710/5710: Modeling, Simulation, and Identification of Battery Dynamics, is:
http://mocha-java.uccs.edu/ECE5710/index.html

Professor Pletts 2004 paper was really pretty good too "Plett - Kalman filter SOC estimation for LiPB HEV cells", where he actually tests his algorithms.
View attachment Plett - Kalman filter SOC estimation for LiPB HEV cells.pdf



Now I need to get back to work on the math myself. I'm starting to bug my wife with muttering about Kalman, SOC and array math...
 
Last edited:
Status
Not open for further replies.
Back
Top