Designing an accurate SOC estimator for embedded implementation is a very involved task that goes beyond desktop simulation. Entire teams devote their time to developing and testing this kind of algorithms.
There is plenty of literature that you can consult to become familiar with standard techniques, requirements, and challenges.
Here is a good introduction:
- Plett, G., Extended Kalman filtering for battery management systems of LiPB-based HEV battery packs (3 parts), Journal of Power Sources 134 (2004)
And here is an example that we developed based on our modeling approach
Even before thinking about generating code for your embedded controller, you must define your algorithm. It is important to take into account that the true state of charge depends on ambient and operating conditions, in addition to the amount of current that has flown in and out of the battery. The actual total capacity of a battery is in general lower at low temperatures and at high discharge rates, and these are factors that your algorithm needs to consider, for which you need a complete set of measurements.
You may want to start performing the estimation of parameters in different conditions and in this way you can assess this capacity dependence. Eventually you will have a number of look-up tables that you can think of as the “electrochemical fingerprints” of your battery. This is very important because different battery chemistry types will have very different electrical and thermal dynamic behavior. For example, the pulse discharge curve you show in your diagram will look differently at different temperatures.
Your design may include coulomb counting (keeping track of the current in and out of the battery) as a rough first estimate, since errors accumulate over time and you need some correction / recalibration. Kalman filtering is a popular way to do this, as we show in the example cited above.
Finally, you may want to consider using rapid prototyping hardware for your on-board implementation, as opposed to production hardware, to avoid all the complications associated with targeting microprocessors, such as fixed point algebra, limited memory footprint, etc.
Should you have questions during the course of your project please do not hesitate to write us and we will do whatever we can to help you.
With best wishes,