Technology Overview on Software Development for Battery Management Systems (BMS)
Chief Technology Officer, PhD in Physics and Mathematics
Writer With Expertise in Covering Electronics Design Topics
A battery management system (BMS) operating in your smartphone is similar to the one controlling the battery of an electric car. However, the functionality of these two systems may be totally different. The design complexity depends on the battery characteristics that you need to monitor with your BMS. Here, you will get to know more about BMS functionality, as well as battery states and how you can estimate them.
Nowadays, a battery management system (BMS) is a must for any smart system operating on a rechargeable battery. A BMS takes control of the battery performance, protects it from anomalous behavior, and communicates with battery-powered devices.
According to Statista, the installed electricity generation capacity from battery storage will grow worldwide at an unprecedented rate in the coming decades, from 3 gigawatts in 2020 to 778 gigawatts by 2050.
A rechargeable battery is a grey box system that operates with the aid of physical processes and electrochemical reactions. So, on the one hand, it is easy to measure the battery’s parameters, depending on the physical quantities, but on the other hand, some characteristics are hard to measure without taking a battery to pieces.
BMS software helps you look inside the battery to see the actual state of things. It provides estimations of the battery characteristics and ensures its operational stability.
Writing reliable BMS software is challenging, but there are some recommendations on how to do this properly. We would like to share them with you.
What is BMS?
In short, a BMS is an electronic system responsible for the correct and safe operation of a rechargeable battery.
A BMS finds a use in a wide range of electronics: from consumer devices, like smartphones, to life-critical medical equipment and electric vehicles.
BMSs are in demand like never before. The global electric vehicle market alone is expected to more than quadruple between 2021 and 2027, reaching approximately $1.4 trillion by 2027.
BMS functionality directly depends on the system requirements.
The minimum set of BMS components includes a:
- Control unit
- Measurement unit
A simple device, like a power bank, needs a simple BMS. You can implement its functionality at the hardware level without any software development.
The architecture of high-end BMSes has the same principle, but it is multilevel. Complex BMSes may have extra power supplies, sensors, contactors, fans, and other units. The multilevel BMSs developed by our engineering team includes:
- An energy management system (EMS)
- A sensing subsystem
- A protection subsystem
- A security subsystem
- measure and control current and voltage input/output;
- monitor critical parameters;
- control battery environment;
- calculate, store, and report battery data to the user or a higher-level system.
Multifunctional battery management systems require comprehensive BMS software development. Thus, a control unit uses software to manage BMS components’ interaction and coordination. A measurement unit needs software to collect and transmit battery data. For a high-end BMS, it is advisable to implement automated testing software.
Voltage, current, and temperature belong to the physical parameters that a BMS can measure directly. Yet, a BMS with extended functionality may require estimations of the battery states that depend on many factors. Such states rely on physical quantities, chemistry, and the operating conditions of the battery. They include:
- State-of-charge (SOC)
- State-of-health (SOH)
- State-of-energy (SOE)
- State-of-power (SOP)
These characteristics can be critical for some systems, but the problem is the lack of a single approach to their measurement. You need to choose an appropriate method since the accuracy of the state estimation is essential for system reliability.
By developing BMS software with simulation, you can create a more accurate mathematical model used for battery state estimation. Our engineers build models using MATLAB, GNU Octave, and other simulation software.
Simulation makes it possible to reproduce the behavior of the battery and its operating environment. Battery models are implemented with the help of different algorithms that serve as estimators. You can use simulation to validate the BMS algorithms.
Artificial intelligence and cloud network development have brought new battery state estimation methods, especially suitable for severe operating conditions.
Mathematical modeling often uses an equivalent circuit as an analog of a battery cell. It represents electrical characteristics and processes, including voltage, current, internal resistance, charging, and discharging.
You can replace an equivalent circuit with an approximate battery model based only on the data from the manufacturer’s datasheet. Anyway, you can use both types of models - equivalent circuits and approximations - to estimate battery parameters with the help of the Kalman filter or any other algorithm.
A model helps you estimate the battery states and characteristics with the measured data. For example, by measuring the charging/discharging time, you can estimate the battery capacity and SOC. You can also program the model for testing the BMS algorithms.
The complexity of algorithms depends on system requirements and BMS responsibilities. Advanced systems need sophisticated algorithms. The more battery characteristics and states that need to be evaluated, the more complex the battery management system algorithms will be. In some cases, you may not need any software at all.
Before proceeding to the development of BMS software, you should know for sure which state estimations are mandatory for your particular device. In case your system requires data of all the battery states, you should know how to estimate them.
How to Estimate State-of-Charge
State-of-charge or SOC shows the charging level of the battery from 0% (completely discharged) to 100% (fully charged). SOC estimation depends on the charging/discharging rate and capacity of the battery.
Correct estimations of the SOC are necessary to avoid overcharge and overdischarge of the battery. For Li-ion batteries, overdischarge is critical and may lead to battery death. Lead-acid batteries are overdischarge-resistant.
Battery chemistry is one of the key factors that you need to consider as you write algorithms to estimate state-of-charge. You can use a BMS with different batteries and you should develop it according to your battery type. The most common types include:
- Li-ion batteries (LiCoO2, LiMn2O4, LiNiMnCoO2, LiFePO4)
- Nickel-based batteries (NiCd, NiMH)
- Lead-acid batteries (sealed lead-acid, valve-regulated lead-acid)
Lead-acid batteries are simpler in use. Their physical parameters, such as voltage and charge/discharge capacity, have direct proportions. So lead-acid battery characteristics are easier to calculate with the help of datasheets and formulas.
You can estimate the capacity and SOC of such batteries by measuring the voltage and using the voltage-capacity relationship (discharge curve) from the battery specification chart. Normally, manufacturers provide specifications for every battery model that include charts or graphs showing the dependencies of battery parameters.
Discharge curves are different for the open-circuit voltage (OCV) and the closed-circuit voltage (CCV). In the case of the closed-circuit voltage (CCV), the load is connected and the discharge curve depends on the battery current too.
The OCV provides a more explicit discharge curve, and it’s the easiest way to estimate the battery SOC. In this case, the current load is disconnected and you can only measure the battery voltage.
The discharge curve method is not very accurate since it relies on the minimum number of battery parameters. Besides, it works for batteries with the proportional voltage-capacity relationship.
In Li-ion batteries, the voltage dynamics is not distinct for both charge and discharge characteristics. For some temperature values, you can’t define the charging level of the battery by the voltage. Estimating the SOC for such a battery type, you will need to build a more complex mathematical model and algorithm.
Coulomb counting or current integration is another method on how to implement state-of-charge (SOC) estimators. It is more complicated, but it provides an accurate measurement of the electric charge that correlates with the battery capacity. The idea of this method is to calculate the electric charge by measuring the battery input and output current flowing at regular time intervals.
The Coulomb counting method renders a relative change in SoC. By measuring the current for a given period, you get the number of Ah left or obtained by the battery.
You can use coulomb counting together with the Kalman filter, which helps implement BMS algorithms using real-time simulation. This will increase the filtration accuracy of the changes in battery parameters and calculations of its derivatives. The Kalman filter takes into account the physical models of real-time processes running in the system.
How to Estimate State-of-Health
State-of-health (SOH) shows the battery wear level and comprises capacity, internal resistance, age, and other battery parameters.
A 100% SOH is the condition of a newly manufactured battery. As a battery wears down, the SOH level gets lower. SOH shows the present condition of the battery and helps predict when you should replace it.
SOH estimation doesn’t depend on the battery chemistry directly. When you decide about how to implement state-of-health (SOH) estimators, you should consider the operating time, temperature, and charge/discharge cycle of the battery. The more parameters you consider, the more accurate your estimation will be.
Calculation of charge/discharge cycles is one of the SOH estimation methods. This is the simplest method because it does not involve sophisticated BMS state-of-health algorithms. Besides, the battery manufacturer provides information on the guaranteed minimum number of charge/discharge cycles. To make this method more accurate, you can use it together with coulomb counting.
Capacity is one of the important criteria showing battery degradation. The capacity decreases as the battery ages and degrades. Thus you can estimate the battery SOH by its capacity loss. The coulomb counting method will help you calculate the initial and present capacity of the battery and the capacity fading rate.
The SOH estimation accuracy directly depends on the number of methods you use. Except for the cycle calculation and coulomb counting, you can measure the internal resistance of the battery. To calculate this, you should compare the measurements of the battery parameters with the connected and the disconnected current load. This is a more complicated method that can give you a clearer picture of your battery’s state-of-health.
It is crucially important for a battery not to exceed the specified temperature range and discharging rate. Batteries degrade much faster if they operate outside the rated values. To prolong your battery life, we highly recommend you consider this while implementing BMS monitoring and control algorithms.
How to Estimate State-of-Energy and State-of-Power
State-of-energy (SOE) shows the relationship between the energy remaining in the battery and the maximum energy that the battery can store.
The SOE tells you how much energy is available for a certain current load to perform a certain operation during a certain time interval.
To estimate the SOE, it is necessary to consider the complete charge/discharge cycle of the battery. You can count the SOE by calculating the remaining and maximum energy of the battery.
The remaining energy is the difference between the energy consumed during the previous and current charge/discharge cycles. The maximum energy is the energy available for the current battery SOH with the maximum charging level.
State-of-power (SOP) shows the maximum power of the battery available for a certain operation at a particular time. It depends on the discharging level, operating voltage, and temperature.
The estimation of the SOP can be rather simple. To estimate it, you can measure the operating voltage and multiply it by the maximum discharge current, which is a rated value specified in the battery’s datasheet.
However, as the battery degrades, the rated current value changes. The above formulas do not consider internal resistance and self-heating, which can lead to the loss of power and energy of the battery. You have to keep these inaccuracies in mind while estimating SOE and SOP.
If you want to design a state-of-the-art BMS, you can estimate the SOP by measuring the battery’s maximum output current through the internal resistance. This method provides a more accurate measurement.
How to Balance Cells in a Battery Pack
The battery pack contains several cells that may have different parameters and states, including SOC, SOH, SOE, and SOP. Different cell states negatively affect the overall battery performance and keep the battery from working to its full capacity.
Cell balancing equalizes the charging level, voltage, and other characteristics of the cells within the pack.
To balance the battery, you need to increase charge, current, or voltage in a cell with a lack of charge and decrease these parameters in a cell with excess charge.
Cell balancing is implemented at the hardware level with the help of the charger and measurement unit. But you still need software to monitor and control the balancing process. Balancing resistors are the components of the BMS circuit intended for cell balancing. For example, you can decrease the voltage during the cell charging by connecting a balancing load.
The image above shows the battery pack consisting of three cells designed for the voltage of 4V. We need to charge the battery by connecting 12V to the pack. At the present moment, the first cell has a voltage of 4V, the second cell is 3.7V, the third cell is 3.5V. To balance the cells, we need to charge them equally to achieve the voltage of 4V in each cell.
The first cell is fully charged and to avoid its overcharge, we connect the balancing load that keeps the cell from charging. Meanwhile, we charge the other two cells. As soon as the voltage of the second and third cells reaches 4V, we will connect the load to stop the charging.
Battery states such as SOC, SOH, SOE, SOP rely on the same measurements and provide a comprehensive view of the battery’s condition. However, the battery state estimations have different objectives, and not all of them are vital for the proper system operation. BMS software design entirely depends on the functions your BMS should perform.
The primary goal of any BMS is to monitor the key parameters essential for battery life. Every battery has its own safe operating environment. In other words, it should operate within the specified conditions that include certain voltage, current, and temperature range.
Operating above or under the set limits will lead to the battery’s fault conditions such as:
To ensure the reliability and safety of a battery management system, you should equip it with quality monitoring software with a two-layer implementation.
At the low level, the MCU processes input values from sensors and the ADC and filters them using filtering algorithms to cut out noise or fluctuations.
The MCU sends the filtered data to the BMS dashboard, or human-machine interface (HMI).
The dashboard is the result of high-level programming. It displays the actual parameter values of the battery in a user-friendly way and notifies of abnormal situations and incorrect battery operation.
The dashboard is like a hub, getting data about the entire system, sorting it out, and showing the states and parameters of each unit.
BMS software can be created with C++ cross-platform toolkits, such as the Qt framework, which provides speedy and efficient development.
The design of the monitoring software depends on the BMS’s complexity. Advanced BMSes require more sophisticated implementations at higher levels. Simple BMSes may not need an HMI or even dashboard at all.
HMI displays battery data and enables the user to interact with the system. Implementing a BMS for a complex industrial solution, our Qt developers created an intuitive full-featured dashboard/HMI. It displays complete data of the entire battery pack, low-level battery elements, and the battery cells. The HMI allows the user to:
- monitor battery parameters and states;
- enable/disable battery units; and
- acknowledge and clear errors.
Below is a screenshot of HMI development for our industrial BMS solution. The HMI application, created by Integra Sources, shows the characteristics of all battery units and allows users to monitor their voltage and SOC. Besides, the dashboard helps keep track of voltage, current, SOC, SOH, and temperature of the entire battery and controls its alarm conditions.
The importance of a battery management system lies in its ability to control the battery and protect it from hazardous conditions. A BMS enables the efficient and long-lasting performance of the battery and the device it powers.
BMSs may have different functionalities. Simple systems may perform a couple of functions like measuring temperature and the battery’s state-of-charge. Complex BMSes monitor a full range of characteristics. To estimate the unmeasurable characteristics, BMS developers implement estimation algorithms.
Algorithms for battery management systems are based on mathematical models and formulas. They can make simple calculations using battery specifications and datasheets. But if you want to introduce more functions and consider a variety of characteristics, your BMS algorithms inevitably get more complicated.
We create BMS solutions within our power electronics development services. Integra’s engineers design electronics and embedded software for battery management systems used in various applications. Depending on the system requirements, we implement BMS features either through hardware or with the help of complex algorithms.
The principal purpose of BMS algorithms is to provide high accuracy of battery state estimations and measurements. Correct estimations ensure battery safety and the reliability of the entire system.
You can also read about BMS Safety & Security Solutions in Infographics.
Share this article
Battery Management System Development
Integra Sources completed the revision of the hardware and software complex of the battery management system, including firmware, server and...
Designing a BMS (Battery Management System) for a Stationary Battery Storage Solution
What are the components of a BMS? How can they interact? We’ll tell you this and more drawing on our...
Shortly about BMS design in Infographics
We have prepared another infographic on BMS Design. Check out the basic summary in the infographic and read the full...