FPGA-Based battery management system for real-time monitoring and instantaneous SOC prediction

ABSTRACT


Introduction
Although electric vehicles are essential in improving air quality and reducing chemical pollution against fossil fuel vehicles today, the convenience and performance of fossil fuel use cause users to prefer fossil fuel vehicles more.In order to compete with fossil fuel vehicles, electricpowered vehicles must provide the necessary power, range, and durability for users.Battery-powered vehicles are currently used in various industrial areas to provide high power and capacity.However, for general use, the battery needs of electric vehicles should be met with more practical, high-capacity, and small-sized batteries.For this purpose, lithium-ion batteries are the most widely used battery types today with their high-power capacity, safety, and fast charging features.Since lithium-ion batteries provide energy based on chemical reactions, they are often controlled by a control mechanism called a battery management system, allowing them to operate safely for long periods.
Batteries for electric vehicles in battery packs consisting of series and parallel groups.However, each battery's internal resistance, charge, and discharge rate may differ due to production.This situation causes voltage imbalance in battery groups.However, drawing more current from a battery and overcharging or discharging it causes excessive heat generation due to chemical reactions, creating a dangerous situation.For this reason, the batteries should be used and controlled within the safe current, voltage, and temperature range offered by the manufacturer.The task of a battery management system (BMS) is to prevent batteries from being overcharged and discharged, to prevent damage to the group due to overheating, and to provide voltage balancing between battery groups [1,2].
In line with the increasing demand for electric vehicles, research on battery management systems is increasing rapidly to ensure battery packs' safe and efficient use.Battery fault detection, battery pack status monitoring, state of charge (SOC), and state of health (SOH) monitoring and control are still challenging.The presence of multiple sensors in the system and the execution of prediction algorithms by processing the data from each sensor often lead to many problems in the field [3,4].One of them is hardware shortage, which is those weak processors trying to perform multiple tasks rapidly, causing instability over time.
The battery's state of charge (SOC) is defined as a measure of the instantaneous current capacity of the battery.There is no standard measurement and calculation technique in the industry for SOC, and its inference is provided through estimation algorithms.Information such as the battery's open circuit voltage and discharge current is used for the estimation process.Providing an accurate SOC estimation prevents the battery from being overcharged or over-discharged, increasing the lifetime of the battery pack [5][6][7].At the same time, it is one of the critical parameters that help to keep the battery within appropriate limits and provides safe use.For this reason, continuous and accurate estimation of the SOC status in the system is an important factor in terms of system health.
Studies on BMS have generally been made on the development of appropriate algorithms and the collection of the management system in a single circuit.BMSs consist of different sub-circuits, which are controlled by many algorithms and control signals, including sensors, switches, and converters.Controlling all these sensors and circuit elements in the system and providing calculation processes is only possible with the use of powerful processors [4,8,9].The speed of operations with the data received from the sensors is directly related to the system's stability.For this reason, it is extremely important to use multiprocessing and high computing capacity processors instead of traditional processors in terms of BMS stability and system security.
In researches, many different algorithms and estimation methods have been presented to ensure the stability of the BMS and increase its efficiency.In general, various methods have been mentioned in the modeling of BMS, from the creation of the battery group to the modeling of SOC and SOH estimation with artificial intelligence methods.Dinesh and Teja [5] presented a SOC estimation method, including an improved Kalman filter for renewable energy systems using lead-acid batteries, battery testing systems, and smart residential energy systems.Kassim and Jamil [10] presented a study on SOC and SOH estimation methods and their applications and mentioned the advantages of SOC methods over each other.Similarly, other studies focused on accelerating and improving SOC estimation algorithms for BMS, simplifying BMS hardware, balancing battery cells with various methods, remote monitoring of BMS hardware, and creating a hybrid structure [10][11][12][13][14].
This study includes the design of the BMS using FPGA and the real-time SOC estimation on the FPGA with the data received from the sensors.The use of FPGA in the system aims to eliminate hardware instabilities and improve the BMS hardware due to its high computing capacity and parallel processing capability.The present study focuses on lithium-ion battery packs widely used for electric vehicles.FPGA provides a high computational power advantage and low power consumption for executing BMS algorithms while instantly monitoring multi-sensor tasks.
The study is structured in four parts BMS design, SOC estimation, experimental study, and simulation results.The design of the BMS on the FPGA is explained in Chapter 2. The algorithm and FPGA block related to SOC estimation are given in Chapter 3. The main BMS blocks and the experimental work with the SOC are described in Chapter 4. The simulation of the application on the FPGA and the experimental results are analysed in Chapter 5, and the result explanations of the design of the BMS on the FPGA are given in Chapter 6.

Battery Management System (BMS) Design
The battery management system (BMS) is the system responsible for the supervision and management of the battery pack in electric vehicles.BMS generally consists of voltage measurement, current measurement, temperature measurement, balancing, and calculation modules.In current systems, measurement and calculation modules are considered separate units for ease of implementation and separation of units.In advanced systems, BMS is used in the master-slave structure to support more than one battery group.The master-slave application is based on the transfer of the measurements and calculations made by the slave units configured for each battery group to the main processor unit [15].In this structure, the main processor unit produces output and controls the system by processing the data from all groups.Thus, a central and stable control can be achieved.

Battery Pack
BMS is configured depending on the battery pack to be used.For this reason, the capacity and characteristics of the battery pack are important factors in the design of the BMS.Battery packs are formed by combining the modules obtained by connecting the battery cells in series and parallel.Cells connected in series determine the voltage value, while cells connected in parallel determine the current and capacity of the battery pack.This study modelled a battery pack of twenty-eight serial and eight parallel connected cells prepared for typical electric vehicles.The battery pack image given in Figure 1.

Figure 1. 28S8P Battery pack display
The modeled battery pack output voltage is in the range of 101.78V-117.6Vand produces a maximum power of 3250W at 28A output current.On the FPGA, this block is defined as an adjustable variable.

Voltage Measurement Block
Accurate measurement of the voltage values of lithium batteries is an important factor for the health of the battery pack and for accurate SOC estimation.The better the accuracy of the measured voltage, the more accurate the SOC estimate will be [9,16].In BMS, each serial module in the battery group must be measured separately.With the development of IC technology, great convenience has been provided in measuring multiple cells.Measurements that used to be made with the channel-switching method are now carried out quickly using customised ICs.The LTC6802 IC, which is used as a broadcast for electric vehicles, enables 12 independent cells to be measured in 13ms.At the same time, it provides digital transfer of measurement to the controller with its built-in analogue/digital converter feature [16,17].This study created a voltage block on the FPGA by taking the LTC6802 measurement time as a reference.Since the battery pack contains 28 serial modules, separate variables were defined for three integrated units in the block.The illustration of the assembly of the building is given in Figure 2.

Current Measurement Block
It is an important parameter for monitoring battery pack current, providing information about SOC and SOH status, and for safety.There are studies on different current measurement methods in the literature.Current measurement is generally performed using the hall-effect sensor and the shunt method [18,19].Due to the increasing need for current measurement precision, the shunt method is mostly preferred in the automotive industry today.Although the use of the Hall-effect sensor is safer due to its closed structure, the shunt method is seen as more advantageous in applications requiring high sensitivity.In this study, a loop block with eight variables is designed, which allows the current to be processed from the analogue converter, regardless of the measurement method used.A related variable was defined for each parallel group in the battery pack, and the total current of all groups was calculated in the application.The representation of the building is given in Figure 3.

Temperature Measurement Block
For high-power applications, temperature management is required for safety reasons.The task of the temperature management system is to equalise the intercellular temperature and to keep the battery pack temperature within a safe range.In addition, the operation of the batteries in the optimum temperature range is an important factor in terms of battery life.In general, LM35 temperature sensors were used for temperature measurement in studies [20].The LTC6802 simulated in this study's voltage measurement block includes two internal temperature measurement inputs.In terms of the health of the battery pack, it is recommended to measure the groups with at least two sensors.For this reason, a module containing two measurement variables for each battery group is designed in the temperature measurement block.The illustration of the application given in Figure 4.

Cell Balancing Block
The cell balancing module is the unit that switches between groups depending on the voltage level of the groups in the battery pack.Batteries with different internal resistance values may be overcharged or discharged due to this change in their structure during charging and discharging.This can cause permanent damage to the battery, overheating, and posing a safety risk.The BMS balancing module detects the group with the highest voltage and the lowest voltage in the package and provides action according to the difference between them.This prevents low-resistance batteries from overcharging and low-capacity batteries from over-discharging.Since the balancing process requires the voltage value of each cell, the voltage measurement should be done as quickly as possible.In this study, the balancing module is designed to measure each group in parallel with the FPGA.The illustration of the balancing module is given in Figure 5.

SOC Estimation
SOC is defined as the amount of energy in a battery pack for electric vehicles.The best possible SOC assessment is important to achieve better charge/discharge control and longer battery life.In the literature, there are studies on various estimation methods for SOC estimation.Algorithms are generally classified as regression and probabilistic, time series, and hybrid algorithms.These algorithms are grouped as coulomb counting and voltagebased estimation [3,6,8].The Coulomb count-based method uses the integral function of the measured current, while the voltage-based estimation method uses the open circuit voltage of the battery pack.
In the Coulomb counting method, SOC information is calculated by measuring the current entering and leaving the system to determine the state of charge.In order to use this method, the initial value of the battery must be known.The actual charge capacity can be calculated by dividing the amount of current entering and leaving the initial value.The equation given in Equation ( 1) is used for this process [10]: Here, SOC(0) is the initial value of the battery, ib is the battery current, Cn is the nominal battery capacity, and t is the sampling period.The coulomb counting method is widely used for SOC estimation applications with the advantage of low power consumption.
In this study, the SOC prediction block was designed using the coulomb counting method on FPGA.The estimation block, which is integrated with the current measurement block, uses the current data received via the ADC.It calculates the sampled current data within a certain period using the SOC equation and determines the instantaneous state of charge.The module representation of the SOC estimation process is given in Figure 6.

Experimental Study
The design of the battery management system is carried out by bringing together the necessary modules for the BMS on the FPGA and producing the output signals.BMS is obtained by combining current, voltage, temperature measurement, and balancing systems, prepared in separate modules under a single structure.Making the design on FPGA allows measurement and calculation processes to be done in parallel.Thus, all measurement and calculation operations are performed in a single processing period.Figure 7 shows the schematic of the measurement and calculation cycle of the system.

Figure 7. BMS work cycle on FPGA
In this structure, measurement, calculation, and output signal generation are divided into three stages.In the first stage, when the system starts to work, the data coming from the current, voltage, and temperature sensors are assigned to the variables in the relevant modules.In the second stage, the SOC state and the cell equilibrium state are calculated, and in the last stage, switching signals are generated based on these data.The output block is responsible for charging cut-off and switching on, controlling the compensation switching, and generating information signals to be printed on the screen.
In practice, the sensor data is obtained by reading the XADJ port of the FPGA at the sampling time specified in the design.Since the LTC6802 IC, which is referenced in the design, can convert 12 serial groups into digital data in 13ms, the lowest processing cycle in the design is determined as 15ms.Due to the delay that may occur between the 3 IC modules used for the measurement of 28 serial groups, 1ms is reserved as a waiting time.The FPGA circuit diagram of the ADC reading block is given in Figure 8.

Figure 8. ADC block FPGA circuit diagram
Since the sensor data received from the ADC in 12-bit data format can be a decimal number, it is stored in the fixed number type in the variables, and all calculations are performed in the fixed number type.
After the data is converted to fixed-point type number format, the calculation module is run for SOC and cell balancing, and necessary calculations are made.The circuit diagram of the calculation block given in Figure 9.The charge controller ensures that the battery can be charged in normal conditions and overcharge/discharge is avoided.The output signal transmitted to the controller is formed in the PWM waveform according to the SOC data obtained in the BMS.Similarly, the safety controller and stabiliser switching system are also controlled by the PWM signal.The safety controller is responsible for ensuring vehicle and battery pack safety for emergencies and includes electronic circuit breakers.On the other hand, the balancing system can be created in two different structures, classified as passive and active.
The battery management system obtained as a result of the design allows calculations to be made by simultaneously processing the data received from the sensors at the same time.In addition, a timing module has been created for the cycle time in the design.In this way, it is aimed to support ICs with different read times.

Simulation and Results
The FPGA simulation of the battery management system was run on the Vivado application, and the transaction blocks were examined.The resulting design has been prepared appropriately for structures with different conversion times.For the design, a test environment was created on the application, and the running of the modules on the FPGA was simulated.The data flow chart of the simulation is given in Figure 11.

Figure 11. BMS data flow chart
The modules were brought together in the system and synthesised.Input data has been simulated according to the 28S8P battery pack taken as a model.The core image of the synthesis of the system for FPGA is given in Figure 12.According to the result obtained, it was observed that the data reading and calculation processes were completed successfully in one clock pulse.3% of the current processing capacity is used for operations.This shows that high computing power is achieved at low power consumption.The estimated usage rates of the synthesis result are given in Figure 13.The simulation results show that the BMS design can be successfully implemented on the FPGA.The ability of FPGA to perform operations in parallel structure eliminates the problem of data delay and provides a fast result.

Conclusion
In this study, a field programmable battery management system was designed for electric vehicles.In addition to a battery management system, the design can also be used in research to speed up existing control systems.Measurement, calculation, and output blocks are designed as independent sub-modules.Therefore, blocks can be run by more than one controller at the same time so that multiple controllers can be managed using a single primary system.
In traditional processor types, modules and subprograms are executed in a certain sequence of operations.Considering the cycle time of the LTC6802 IC model used in this study, the calculation time is calculated as 39ms for three separate modules.If the same IC is used for current and temperature measurement, a 26-ms conversion time will be required for these measurements.In conventional processors, 65ms in total without delay will be required for reading data from sensors, excluding calculation processes.The parallel processing capability of the FPGA ensures that all these data can be read at the same time.In this case, only 13ms will be needed for measurement operations.Table 1 shows the comparison of traditional microcontrollers and FPGAs.It is important to read and finalise the data for an accurate SOC estimation and healthy battery management.As a result of the study, it is seen that FPGA is quite advantageous in terms of timing compared to other processor types for BMS.In addition, low power usage can increase efficiency by reducing system costs.

Table 1. Simulation model data and results
Experimental results show that the proposed FPGAbased battery management system can perform balancing, charge/discharge control, and temperature control functions with high speed and low power consumption.

Figure 3 .
Figure 3. Current measurement module display

Figure 4 .
Figure 4. Temperature measurement module display

Figure 6 .
Figure 6.SOC module display The data obtained from the SOC estimation helps to prevent the battery from being overcharged/discharged by providing the extraction of battery capacity information.

Figure 12 .
Figure 12.Synthesis of BMS in FPGA The simulation was run with the model data, and the signals produced by the modules were examined.According to the result obtained, it was observed that the data reading and calculation processes were completed successfully in one clock pulse.3% of the current processing capacity is used for operations.This shows that high computing power is achieved at low power consumption.The estimated usage rates of the synthesis result are given in Figure13.

Figure 13 .
Figure 13.FPGA estimated resource usage Figure 14 shows the timing of the computational operations of the simulation.The frequency for the simulation is set to 15ms periods.

Figure 14 .
Figure 14.BMS simulation output conversion time, TMU: Total memory usage MCP: Modules calculated in a period, PMC: Package maximum current PV: Package voltage