Algorithmic Architecture for BMS
By: Easha Ranade
Tags: Technology, Algorithms, Intelligence, Battery, Charging

Battery Algorithms

Shivaram N V, Hari Vasudevan

A battery management system or BMS is core to the functionality of an EV. While much has been documented, written and talked about the mechanical, electrical and software architecture of a BMS, not much has been written about the algorithmic architecture of the BMS. Of-course a relevant question that could be asked at this point is - is the time spent in creating an algorithmic platform worth it? Here at Ather, developing and deploying such an architecture has helped us immensely in creating a robust and reusable platform. In this post we are going to detail the basic algorithmic structure of the Ather BMS and how it has helped accommodate the many different use cases of the 450X.

Algorithm Fragmentation

A cursory search of BMS algorithms often yields a number of various algorithms, dealing with charging, protection and discharge. Take charging for instance, even the very basic CC-CV charging flow that is common to most chargers has a number of caveats related to temperature, voltage and charging currents. What makes this trickier is that a variety of such chargers are encountered by the vehicle. For eg, fast chargers have different charging current capacities, temperature limits and protections when compared with a slow home charger. In addition to this the EV will most likely encounter multiple generations of these chargers each with its own rules. In fact since Ather continually upgrades the public charging infrastructure to improve the access and reliability of the fast charging network, it causes much (happy) consternation internally as now the algorithms will need to track these changes also. Similarly, discharge of a battery pack also needs to be handled by the BMS algorithms. Discharge control of the battery pack needs to ensure that we are able to maintain the right cell temperatures, avoid drops in individual cell voltages and gracefully transition to a lower power mode at low States of Charge (SOC). The BMS also needs to ensure consistency in performance even as the battery pack ages as part of natural degradation in cell capacity. Last but not least, the BMS also needs to compute the right SOC for display to the user.

Optimality & Robustness

The most commonly known charging algorithm like the CC-CV belongs to a class of heuristic algorithms that gets the job done but not necessarily in the most optimal way. In the case of charging, we’re chasing minimum charging time while adhering to battery safety constraints. Similarly take the case of SOC - there are quite a few heuristic methodologies to estimate the SOC to a “decent” extent. But to maximise the usable energy consumption from a battery, it is necessary to have an algorithm that is not only accurate but also robust to a whole bunch of noise factors that a Battery Management System is exposed to.

Accommodating all of the above functionality with a multiple different algorithms paired up with the corresponding hardware or vehicle platform or scenario will eventually lead to fragmentation of the code. Finally the maintainability of the code-base will also take a hit as verification and validation start to consume increased time and effort. To get around these issues on the 450X we have developed a scalable BMS algorithm architecture (Figure 1 below) that attempts to provide a framework wherein all the above described optimality criteria and variations can be accommodated.

Figure 1: Battery Charge & Discharge Vehicle Application Architecture

SOC & The Kalman Filter

Literature on the SOC estimation of a cell or battery pack is available in plenty. In fact a cursory glance through literature on this leads to various formulations of the Kalman Filter for the estimation of SOC. Literature is peppered with various Kalman Filter formulations for SOC such as the Extended Kalman Filter (EKF), or the Sigma Point Kalman Filter (SPKF) and further varieties of these with each providing added benefits for added complexity. However often literature on SOC estimation is the end in itself and further development of the Kalman filter towards an LQG (Linear Quadratic Gaussian) controller for discharge/charge regulation is overlooked. Here at Ather, we have developed a framework that can further put the state estimate obtained as part of the Kalman filter structure to create a flexible and powerful framework to accommodate most charging and discharge functions of the BMS.

Cell Dynamics & State-Space formulation

A number of cell models are generally used for formulation of the Kalman Filter. In Figure 1 below we present a simplified lumped parameter model that is in widespread use. A description of these parameters is given in 1. It is important to understand that all the RC parameters in this model are functions of SOC. Estimation of the RC parameters is a topic in itself and will be the contents of a subsequent blog post.

Additionally we would like to point out that our model is a second order model, whereas higher model orders may be used for higher accuracies with the trade off of complexity. Given the above model and parameters, the equations that define this system are as shown below. The voltages V₁ and V₂ are described by the dynamic equations 4, 5, while SOC dynamics by 6. The OC voltage Voc is linearized (in equation 2) and re-written to cast it in a form suitable for LTI state-space analysis. This assumption is valid as long as the SOC does not change very fast, or in other words the rate of change in SOC is an order of magnitude different from V₁ and V₂ dynamics, which thankfully is the case.

Figure 2: RC parameter Model

Using these above equations we are now able to formulate a state-space model for an individual cell. This formulation is described in the following equations, with the state equation 7 and output equation 8 formulated as shown.

State Estimators

In the prior section we have a model for cell dynamics, we now explain the basis for formulating a state estimator. Of-course the way we have described the cell dynamics model is by no means the only way to describe the dynamics. Ours is a current input and voltage output system, and there exist equally valid models with voltage in and current out. Furthermore, we have not included the Voc hysteresis in this model, which for certain cell chemistries can be dominant.

All state estimators function via a ‘plant’ model that mimics the dynamics of the system under observation and a ‘correction’ term which is usually a measurable output of the system. Eventually the plant model and the correction term are fused together to arrive at a state estimate that is more accurate than either relying on the model or the sensor alone. The beauty of the Kalman filter is of-course that it estimates the least squares optimal estimate of the state even under varying noise conditions. A basic state estimator and its formulation is described below in equations 9 and 10.

In state estimator design of course the main question is how we design the correction gain ‘L’. Whether we are designing a Luenberger or a Kalman Filter, there’s tons and tons of literature on how best to pick ‘L’. We would like to refer the reader of this blog to the excellent webpage of Dr. Gregory L. Plett, Professor, University of Colorado. A thorough description of Kalman Filter equations is described in his course notes on Battery management and Control.

Charge & Discharge Controllers

At this point if our intent was to only describe a better way to estimate the State of Charge (SOC), we would be done. However, while the state estimator is a great way of arriving at the true SOC of the cell, it can also be put to other uses namely in the charge and discharge control of the battery pack.

Charging Controllers

The most widely used charging controller for EV is the CC-CV controller, meaning that the charger charges at a constant current until it hits a terminal cell voltage and then transitions to a CV charging mode, which applies a constant voltage until the cell voltage rises to equalize this voltage and the charging current drops to zero. This transition from CC to CV on chargers is what mostly causes much of the grief in creating a scalable architecture.