A New Charging Algorithm for Li-Ion Battery Packs Based on Artiﬁcial Neural Networks

: This paper shows the potential of artiﬁcial intelligence (AI) in Li-ion battery charging methods by introducing a new charging algorithm based on artiﬁcial neural networks (ANNs). The proposed charging algorithm is able to ﬁnd an optimized charging current proﬁle, through ANNs, considering the real-time conditions of the Li-ion batteries. To test and validate the proposed approach, a low-cost battery management system (BMS) was developed, supporting up to 168 cells in series and n cells in parallel. When compared with the multistage charging algorithm, the proposed charging algorithm revealed a shorter charging time (7.85%) and a smaller temperature increase (32.95%). Thus, the results show that the proposed algorithm based on AI is able to effectively charge and balance batteries and can be regarded as a subject of interest for future research.


Introduction
Lithium-ion (Li-ion) batteries have emerged as an enabling technology, and several studies have included them in energy storage systems (ESSs) due to their characteristics, as follows: high specific energy, high energy density, high energy efficiency, high working cell voltage, long cycle life, no memory effects, relative low cost and low self-discharge rate [1,2].
Despite all the improvements and technological advances, Li-ion batteries still face some concerns and technical challenges. To address these challenges, some studies have been undertaken to develop new and more environmentally friendly Li-ion batteries with high performance/energy density as well as cost-efficiency and safety. Innovative materials and chemistries have been used to accelerate the design and optimization of the next generation of Li-ion batteries [3]. One of the most promising solutions is lithium-sulfur batteries (Li-S), which replace the cobalt cathodes of conventional Li-ion batteries with sulfur cathodes, producing thinner, lighter and lower-cost lithium batteries [4,5].
However, new lithium battery technologies raise several concerns. A key concern is the charging approach, essential to improve efficiency, charging time, battery aging and lifespan, and to avoid battery overcharging, one of the most severe safety problems for the large-scale application of Li-ion batteries [6]. To reduce charging time, higher charger rates are required to replenish the charge in the battery in the minimum possible time. However, this results in an accelerated battery capacity fade, leading to a lower lifespan and decreased charging efficiency due to the Joule heating effect [7,8].
Another concern is related to the inevitable need to interconnect multiple Li-ion batteries cells in series to obtain the required voltage levels. The intrinsic and extrinsic differences between cells result in a lack of uniformity that reduces usable capacity and, and presents several advantages over the existing methods. For example, unlike simple charging methods that operate based on static battery parameters, the proposed approach can find the charging current profile considering the real-time conditions of the battery pack. When compared with optimized charging methods and model-based methods, the proposed approach has some key advantages. For instance, it does not require any physical knowledge of the modelled system, is able to generalize, and can detect complex nonlinear relationships between different battery pack parameters. Regarding the AC charging approach, the proposed method leads to a simpler control and easier implementation.
The use of ANNs applied to battery charging is a promising and innovative approach that allows shorter charging time and smaller temperature increase. Therefore, this approach is an interesting line for future research. Moreover, the proposed approach includes a cell balancing strategy based on ANNs, which is especially important to ensure the safety and efficiency of the system. To demonstrate the effectiveness of the proposed approach, a battery management system (BMS) platform with a passive balancing method was introduced. The implemented BMS is based on the Intersil ISL 94212 device, which enables a chain connection of up to a maximum of 14 devices, supporting systems up to 168SnP (168 cells in series and n cells in parallel). The Coulomb counting method was implemented to estimate state of charge (SOC). This method measures the charging/discharging current of a battery and integrates the current over time to estimate the SOC.
This paper is organized as follows: Section 2 presents a background on charging methods, balancing methods and artificial neural networks; Section 3 describes the proposed charging algorithm with cell balancing strategy based on two FFNNs and their training process with the PSO algorithm; Section 4 presents the implemented hardware, as well as the experimental results and compares the proposed approach with a multistage method, in terms of their charging time, cell temperature and cell voltage deviation; lastly, Section 5 concludes the paper and discusses the system implementation and algorithm.

Charging Methods
Many charging methods have been reported in the literature, with various objectives, e.g., improving charging performance, charging time, energy loss, temperature rise, aging and lifespan. As seen in Figure 1, these methods can be roughly classified into the following four main groups with different levels of complexity: simple charging methods, optimized charging methods, model-based charging methods, and AC charging methods.
Simple charging methods are the most primitive charging approaches and can be divided into the CC and CV methods. In these charging approaches, one of the charging parameters, either current or voltage, remains constant throughout the charging process. However, due to the high currents used, battery lifespan may decrease [10].
Optimized charging methods were created to overcome the limitations of simple charging methods and can be divided into the following groups: multi-stage constantcurrent charging, constant-current/constant-voltage (CC/CV), boost charging, and pulse charging. The CC/CV method is the most popular strategy for Li-ion battery charging. It is divided into three distinct charging phases. In the first phase, named trickle charge (TC), the Li-ion battery is charged with a low charging current when cell voltage is below a critical value. When the Li-ion battery voltage is equal or higher than the critical value, the algorithm starts the second phase, named constant current (CC), wherein the Li-ion battery is subjected to a constant current until it reaches the full charge voltage. Then, the algorithm starts the third phase, named constant voltage (CV), when the Li-ion battery is subjected to a constant voltage until the minimum charging current or the charging time limit is reached [31,32]. Li-ion battery is subjected to a constant current until it reaches the full charge voltage. Then, the algorithm starts the third phase, named constant voltage (CV), when the Li-ion battery is subjected to a constant voltage until the minimum charging current or the charging time limit is reached [31,32]. The multistage method divides the charging time into different charging current stages [33]. In each current stage, the cell is charged with a lower current value than the previous stage. The criterion most often used to switch between stages (threshold crossing criterion) is when cells reach full charge voltage (typically 4.2 V). The authors in [34] proposed a new transition criterion based on the difference between the full charge voltage and the actual cell voltage, thereby reducing charging time and resulting in a small temperature increase. In [21], the authors proposed a new charging strategy whereby a Taguchi based PSO is used to search an optimal four-stage constant current pattern. Some authors use other optimization algorithms to find the best values of current for each stage, e.g., GA, Fuzzy, PSO and numerical optimization [11,20,35,36].
The pulse charge method can be divided into the following two different approaches: variable frequency pulse charge (VFPC) and variable duty pulse charge (VDPC). The basic idea of the VFPC is to optimize the frequency of the current pulse in order to minimize cell impedance (best electrochemical reaction of the battery) and, consequently, maximize energy transfer by varying the pulse amplitude while fixing pulse width, or vice versa [10,32,37]. There are many variants of this method. For example, in [38], the authors proposed a VFPC variant with the objective of determining the optimal charging frequency, i.e., the frequency for which the internal battery impedance is minimal and consequently energy transfer is maximum. Another variant was proposed in [39] with the same concept but using the VDPC. Boost charging consists of applying a very high current, during a short period, to charge a depleted battery and then switching to the standard CC-CV charging method. This method was first proposed in [40], and showed that it can charge a depleted battery to one-third of its rated capacity within 5 min. Another study [41] showed that the maximum boost charging current that could be safely applied to the tested high-energy cells was 6.7 times higher than the manufacturer-stated maximum. The multistage method divides the charging time into different charging current stages [33]. In each current stage, the cell is charged with a lower current value than the previous stage. The criterion most often used to switch between stages (threshold crossing criterion) is when cells reach full charge voltage (typically 4.2 V). The authors in [34] proposed a new transition criterion based on the difference between the full charge voltage and the actual cell voltage, thereby reducing charging time and resulting in a small temperature increase. In [21], the authors proposed a new charging strategy whereby a Taguchi based PSO is used to search an optimal four-stage constant current pattern. Some authors use other optimization algorithms to find the best values of current for each stage, e.g., GA, Fuzzy, PSO and numerical optimization [11,20,35,36].
The pulse charge method can be divided into the following two different approaches: variable frequency pulse charge (VFPC) and variable duty pulse charge (VDPC). The basic idea of the VFPC is to optimize the frequency of the current pulse in order to minimize cell impedance (best electrochemical reaction of the battery) and, consequently, maximize energy transfer by varying the pulse amplitude while fixing pulse width, or vice versa [10,32,37]. There are many variants of this method. For example, in [38], the authors proposed a VFPC variant with the objective of determining the optimal charging frequency, i.e., the frequency for which the internal battery impedance is minimal and consequently energy transfer is maximum. Another variant was proposed in [39] with the same concept but using the VDPC. Boost charging consists of applying a very high current, during a short period, to charge a depleted battery and then switching to the standard CC-CV charging method. This method was first proposed in [40], and showed that it can charge a depleted battery to one-third of its rated capacity within 5 min. Another study [41] showed that the maximum boost charging current that could be safely applied to the tested high-energy cells was 6.7 times higher than the manufacturer-stated maximum.
The model-based charging methods calculate the charging current of a battery using the electrochemical model or the equivalent circuit model. The optimized charging process is achieved by controlling the polarization voltage. In addition, the equivalent circuit model can be combined with the temperature model, power loss model or the aging model to obtain a better charging performance [42]. In [43], a new model-based approach was proposed that resulted in significant improvement in terms of battery charging time and lifespan. In [1], the equivalent circuit model of Li-ion batteries was used to optimize the stages of the multistage method. The study shows that an optimal value for the multistage method can obtain faster charging, reduced capacity loss and longer cycle life.
Finally, the AC charging method seeks to charge Li-ion batteries at an optimal frequency (obtained from electrochemical impedance spectroscopy (EIS) analysis), thereby minimizing frequency-dependent impedance [44]. In [45], the authors proposed the sinusoidal-ripple-current, again based on the minimization of the internal impedance of the cell, allowing for maximum energy transfer.

Balancing Methodologies
There are two distinct methodologies for balancing Li-ion battery cells, as follows: active and passive methodologies. In passive methodologies, cells are balanced by discharging when the cell or pack is not being used, or by providing an alternative path for current flow during the charge operation. There are several distinct passive methodologies for Li-ion battery cells, such as the fixed shunt resistor, the shunt resistor, complete shunting, and the switched shunt resistor [46][47][48][49]. Passive methodologies are widely used due to their simplicity, cost, efficiency, volume, weight and robustness [46].
Active methodologies ideally use a non-dissipative process with external circuits, based on capacitors or inductors (DC-DC converters), to transfer energy among cells and balance the cell energy levels during the charge and discharge operation. Active balancing methodologies based on capacitors use a capacitor in parallel to transfer energy from a cell or pack with higher energy to a cell or pack with lower energy. Several balancing methodologies based on capacitors have been proposed, such as the modularized switched capacitor [46,47,[49][50][51], double-tiered switched capacitor [46], automatic switched capacitor [52,53], single switched capacitor [49,50], chain structure of switched capacitor [51], and series-parallel switched capacitor [54,55]. Active balancing methodologies based on inductors use DC-DC converters (isolated or non-isolated) to transfer energy among cells. There are several active methodologies using isolated DC-DC converters, for example, the multi-winding transformer [46][47][48][49] and the multiple transformers [46,48]. An alternative is the use of non-isolated DC-DC converters, such as the buck, boost or buck-boost [48,56], the Cuk [48,49], full-bridge DC-DC [46,48] and the quasi-resonant converters [48,57].

Artificial Neural Networks
Although criticized as "black boxes" (making it harder to understand the possible correlations), FFNNs have proven to be a powerful tool and can approximate any continuous function, as established by the Universal Approximation Theorem [58]. Therefore, FFNNs can determine the charging current (i k ) and the cell balancing orders (θ k ) in real-time. To perform an efficient and optimized control of the battery charging process, the proposed algorithm combines two FFNNs. The first FFNN (Figure 2a) is responsible for the determination of the charging current (i k ). This FFNN uses the following three inputs to accurately determine the charging current: the difference between the full charge voltage ( f cV) and the average cell voltage of the pack (Ψ k ), which is represented by γ k ; the maximum difference between cell voltages (φ k ); the pack temperature (T k ), where k is the instant of time. The second FFNN (Figure 2b) estimates the balancing orders (θ k ) using the following three inputs: the average cell voltage of the pack (Ψ k ), the voltage of each individual cell (V i,k ), and the standard deviation of the pack voltage (δ k ).
To ensure a reliable real-time charging current (i k ), the FFNN 1 training dataset was created with real data obtained through CC charging method wherein the Li-ion battery was subjected to different current values (from 0.25 A to 2 A with a 0.25 A step). Additionally, to improve the FFNN 1 generalization capability, the training dataset was enriched with artificial data created according to security and operational guidelines. The obtained training dataset is represented in Figure 3, by a three-dimensional map that correlates: the maximum difference between cells voltages (φ k ), the pack temperature (T k and the difference between the full charge voltage and the average cell voltage of the pack (γ k ).  To ensure a reliable real-time charging current ( ), the FFNN1 training dataset was created with real data obtained through CC charging method wherein the Li-ion battery was subjected to different current values (from 0.25 A to 2 A with a 0.25 A step). Additionally, to improve the FFNN1 generalization capability, the training dataset was enriched with artificial data created according to security and operational guidelines. The obtained training dataset is represented in Figure 3, by a three-dimensional map that correlates: the maximum difference between cells voltages ( ), the pack temperature ( and the difference between the full charge voltage and the average cell voltage of the pack ( ).
As seen in Figure 3, the parameter has a preponderant influence on the determination of the charging current, i.e., as the average cell voltage of the pack reaches the full charge voltage, the charging current must be reduced to protect the battery pack from overcharging and overheating. However, one must also consider the maximum difference between cells voltages. When the average cell voltage of the pack is far from the full charge voltage (4.2 V), the charging current only suffers a small decrease. As the average cell voltage of the pack gradually approaches the full charge voltage, the current is reduced to eliminate the imbalance between cells. Furthermore, the established guidelines prioritize the more effective top balancing. Another important aspect that can greatly affect battery pack lifespan is the operating temperature. Thus, to ensure a safe operation, the influence of temperature on the charging current is gradually increased, i.e., as the temperature rises the charging current is gradually reduced. However, if the pack operating temperature reaches 45 °C, the charging process is interrupted [59]. For the FFNN2 training process, the dataset was created according to Equations (1) and (2), such that when the voltage of each individual cell ( , ) exceeds the average cell voltage of the pack ( ) plus the standard deviation of the pack voltage ( ) multiplied by coefficient , the cell is considered balanced. As seen in Figure 3, the parameter γ k has a preponderant influence on the determination of the charging current, i.e., as the average cell voltage of the pack reaches the full charge voltage, the charging current must be reduced to protect the battery pack from overcharging and overheating. However, one must also consider the maximum difference between cells voltages. When the average cell voltage of the pack is far from the full charge voltage (4.2 V), the charging current only suffers a small decrease. As the average cell voltage of the pack gradually approaches the full charge voltage, the current is reduced to eliminate the imbalance between cells. Furthermore, the established guidelines prioritize the more effective top balancing. Another important aspect that can greatly affect battery pack lifespan is the operating temperature. Thus, to ensure a safe operation, the influence of temperature on the charging current is gradually increased, i.e., as the temperature rises the charging current is gradually reduced. However, if the pack operating temperature reaches 45 • C, the charging process is interrupted [59]. To ensure a reliable real-time charging current ( ), the FFNN1 training dataset was created with real data obtained through CC charging method wherein the Li-ion battery was subjected to different current values (from 0.25 A to 2 A with a 0.25 A step). Additionally, to improve the FFNN1 generalization capability, the training dataset was enriched with artificial data created according to security and operational guidelines. The obtained training dataset is represented in Figure 3, by a three-dimensional map that correlates: the maximum difference between cells voltages ( ), the pack temperature ( and the difference between the full charge voltage and the average cell voltage of the pack ( ).
As seen in Figure 3, the parameter has a preponderant influence on the determination of the charging current, i.e., as the average cell voltage of the pack reaches the full charge voltage, the charging current must be reduced to protect the battery pack from overcharging and overheating. However, one must also consider the maximum difference between cells voltages. When the average cell voltage of the pack is far from the full charge voltage (4.2 V), the charging current only suffers a small decrease. As the average cell voltage of the pack gradually approaches the full charge voltage, the current is reduced to eliminate the imbalance between cells. Furthermore, the established guidelines prioritize the more effective top balancing. Another important aspect that can greatly affect battery pack lifespan is the operating temperature. Thus, to ensure a safe operation, the influence of temperature on the charging current is gradually increased, i.e., as the temperature rises the charging current is gradually reduced. However, if the pack operating temperature reaches 45 °C, the charging process is interrupted [59]. For the FFNN2 training process, the dataset was created according to Equations (1) and (2), such that when the voltage of each individual cell ( , ) exceeds the average cell voltage of the pack ( ) plus the standard deviation of the pack voltage ( ) multiplied by coefficient , the cell is considered balanced. For the FFNN 2 training process, the dataset was created according to Equations (1) and (2), such that when the voltage of each individual cell (V i,k ) exceeds the average cell voltage of the pack (γ k ) plus the standard deviation of the pack voltage (δ k ) multiplied by coefficient α, the cell is considered balanced.
As can be seen in Figure 4, as the average cell voltage of the pack approaches the full charge voltage ( f cV), the voltage balancing threshold gradually becomes more stringent (by reducing coefficient α), making the balancing process more demanding at the end of charging. This procedure allows a more effective balancing process at the end of the charging process (top balancing), when the charging current is lower and the balancing current is higher. Additionally, a safety rule was implemented, i.e., if any cell reaches the full charge voltage and the stopping criteria was not fulfilled, the cell is considered balanced. charge voltage , the voltage balancing threshold gradually becomes more stringent (by reducing coefficient ), making the balancing process more demanding at the end of charging. This procedure allows a more effective balancing process at the end of the charging process (top balancing), when the charging current is lower and the balancing current is higher. Additionally, a safety rule was implemented, i.e., if any cell reaches the full charge voltage and the stopping criteria was not fulfilled, the cell is considered balanced.

Training Approach
The implemented training approach was an offline supervised method, using the particle swarm optimization (PSO) algorithm to optimize the FFNN's internal states (weights and bias). The PSO algorithm is inspired by the working principles of cooperation and social behavior. This algorithm has a population of agents (particles), each one representing possible solutions and capable of communicating and cooperating with each other, creating solutions that "navigate" the multidimensional search space in search of an optimal solution. Each agent's position is associated with a velocity, adjusted with an update equation that considers the individual and collective experiences, i.e., the agent's own experience and the collective experience of the rest of the population. The basic idea is that agents move through space in search of an optimal solution. At each iteration, the algorithm evaluates every agent's performance using a pre-defined objective function and then changes velocity towards the personal best performance until then ( ), as well as towards the best performance found among all particles ( ) [60].

Training Approach
The implemented training approach was an offline supervised method, using the particle swarm optimization (PSO) algorithm to optimize the FFNN's internal states (weights and bias). The PSO algorithm is inspired by the working principles of cooperation and social behavior. This algorithm has a population of agents (particles), each one representing possible solutions and capable of communicating and cooperating with each other, creating solutions that "navigate" the multidimensional search space in search of an optimal solution. Each agent's position is associated with a velocity, adjusted with an update equation that considers the individual and collective experiences, i.e., the agent's own experience and the collective experience of the rest of the population. The basic idea is that agents move through space in search of an optimal solution. At each iteration, the algorithm evaluates every agent's performance using a pre-defined objective function and then changes velocity towards the personal best performance until then (x g best ), as well as towards the best performance found among all particles (x g best ) [60].
Each agent's velocity and position are determined using the following equations, respectively: where, v i,d represents the velocity of the agent (i); x i,d is the position of the agent (i); φ is the inertia factor; c 1 and c 2 are the acceleration parameters; γ 1 and γ 2 are random numbers uniformly distributed between 0 and 1; x g best is the agent's personal best position; x g best is the global best position; t represents the iteration; and d the problem dimension. The flowchart of the implemented training approach is presented in Figure 5. This scheme generally illustrates the various steps, starting with dataset processing where the input dataset was normalized between −1 and 1, using the min-max normalizations method, thus ensuring a mean of 0 and a standard deviation of 1. Additionally, the input dataset was divided into two sets: the training set (N t ) and the validation set (N v ), corresponding to 75% and 25% of the data, respectively. Subsequently, all the variables and parameters were initiated, namely, the lower and upper bound (x lb and x ub ), the number of agents in the population, maximum number of iterations, and PSO control parameters. Once the input dataset was created and all the variables and parameters were initiated, the problem dimension ( ) was calculated through Equation (5), which depends on the number of inputs ( ), the number of neurons in the hidden layer ( ), and the number of outputs ( ).
The agent initialization was carried out with the Nguyen-Widrow method [61]. Each agent in the population is represented by Equation (6) Once the input dataset was created and all the variables and parameters were initiated, the problem dimension (d ann ) was calculated through Equation (5), which depends on the number of inputs (m), the number of neurons in the hidden layer (n), and the number of outputs (o).
The agent initialization was carried out with the Nguyen-Widrow method [61]. Each agent i in the population is represented by Equation (6). The representation format includes the weights between neurons, and the bias of the hidden and output layer of each FFNN.
In each iteration, agents move through the multidimensional search space trying to minimize the learning error. Then, the performance of each agent is evaluated with the mean squared error (MSE) of the training dataset, expressed by Equation (7).
whereŷ i is the output response of the FFNN, y i is the target output and N t is the number of samples of the training dataset. Each particle's velocity and position were updated with Equations (3) and (4), respectively. The hyperbolic strategy proposed in [62] was implemented, through successive iterations. In this strategy, if the lower or upper bound is exceeded, the movement of the particle is modified such that the new position is within the multidimensional search space. These procedures are represented by Equations (8) and (9).
There were two kinds of stopping criteria: the maximum number of iterations and a threshold based on the performance of the training and validation dataset. The latter is based on the MSE of the validation and training dataset given by x g best in each iteration. This technique aims to find the exact moment when the FFNN starts to lose the ability to generalize (overfitting).

System Description
The implemented system can be divided into the following three fundamental blocks: processing and control unit; acquisition and balancing unit; power unit. The implemented hardware blocks are shown in Figure 6. The processing and control unit can be subdivided into the following two distinct units: the main control unit and the auxiliary control unit. The main control unit algorithms were implemented in Mathworks Matlab ® software running on a desktop workstation. This type of centralized control architecture allows great flexibility in the development of new charging algorithms with cell balancing strategies.
However, despite the flexibility, the workstation desktop that runs the main control unit algorithms does not natively support serial peripheral interface (SPI) communication (required by the acquisition and balancing unit). To solve this constraint, an auxiliary control unit was implemented to act as intermediary in the communication between the main control unit and the acquisition and balancing unit. This unit was based on a Texas Instruments ® TMS320F28069 microcontroller. However, despite the flexibility, the workstation desktop that runs the main control unit algorithms does not natively support serial peripheral interface (SPI) communication (required by the acquisition and balancing unit). To solve this constraint, an auxiliary control unit was implemented to act as intermediary in the communication between the main control unit and the acquisition and balancing unit. This unit was based on a Texas Instruments ® TMS320F28069 microcontroller.
The acquisition and balancing unit were based on an Intersil ® ISL94212 device that allows a chain connection of up to 14 devices. Each device allows the simultaneous monitoring of 12 battery cells. In this study, the implemented system had 24 cells in series, resulting in a nominal power of 230 W/h.
Another important capability of this device is the possibility to easily implement lowcost balancing methods with few external components. Using this capability, the passive switched shunt resistor method, described in Figure 7, was implemented in this study. In this method, each cell in the pack is associated with a balancing resistor and a switch controlled by the ISL94212 device. The cells are balanced by discharging through a Rbal resistor (33Ohm) until all cells in the pack have reached the same voltage. However, the ISL94212 device only allows four temperature sensors. Therefore, using the capabilities of the TMS320F28069 microcontroller, a temperature acquisition system was developed to enable the use of a larger number of temperature sensors (in this case 12 sensors, 1 sensor for each 2 cells). Lastly, the power unit was the Magna-Power Electronics ® DC SL 500-5.2 programmable power supply, which communicated through Standard Commands for Programmable Instruments (SCPI) with the main control unit. The acquisition and balancing unit were based on an Intersil ® ISL94212 device that allows a chain connection of up to 14 devices. Each device allows the simultaneous monitoring of 12 battery cells. In this study, the implemented system had 24 cells in series, resulting in a nominal power of 230 W/h.
Another important capability of this device is the possibility to easily implement lowcost balancing methods with few external components. Using this capability, the passive switched shunt resistor method, described in Figure 7, was implemented in this study. In this method, each cell in the pack is associated with a balancing resistor and a switch controlled by the ISL94212 device. The cells are balanced by discharging through a R bal resistor (33Ohm) until all cells in the pack have reached the same voltage. However, the ISL94212 device only allows four temperature sensors. Therefore, using the capabilities of the TMS320F28069 microcontroller, a temperature acquisition system was developed to enable the use of a larger number of temperature sensors (in this case 12 sensors, 1 sensor for each 2 cells). Lastly, the power unit was the Magna-Power Electronics ® DC SL 500-5. As shown in Figure 8, the proposed charging process is categorized into four stages, as follows: • Stage 1. In this stage, all the system variables are initialized, and all the communication ports are configured. Additionally, the number of ISL94212 devices connected in the chain is checked and the initial voltages and temperatures of each battery pack is acquired.
• Stage 2. The stop criteria, represented by Equations (10) and (11), is checked to verify if the battery packs are in charging condition or already fully charged. • Stage 3. In this stage, the input data of the FFNNs is obtained. To accomplish this, the voltages and temperatures of each battery pack connected in the chain are acquired. When the acquisition process is complete, the data is passed through a moving average filter with the last six measured data points to reduce noise. • Stage 4. In this stage, the FFNN1 is executed, and the calculated charging current is communicated to the power unit through the SCPI. • Stage 5. Finally, FFNN2 is executed and then the output response value is evaluated in a comparison stage that normalizes the orders to binary values (0 or 1). Afterwards, the balancing orders are performed using the acquisition and balancing unit. The system then waits 60 s for the balancing process to finish in order to not compromise the accuracy of the next measurement process. As shown in Figure 8, the proposed charging process is categorized into four stages, as follows: • Stage 1. In this stage, all the system variables are initialized, and all the communication ports are configured. Additionally, the number of ISL94212 devices connected in the chain is checked and the initial voltages and temperatures of each battery pack is acquired. • Stage 2. The stop criteria, represented by Equations (10) and (11), is checked to verify if the battery packs are in charging condition or already fully charged.
where: • Stage 3. In this stage, the input data of the FFNNs is obtained. To accomplish this, the voltages and temperatures of each battery pack connected in the chain are acquired. When the acquisition process is complete, the data is passed through a moving average filter with the last six measured data points to reduce noise. • Stage 4. In this stage, the FFNN 1 is executed, and the calculated charging current is communicated to the power unit through the SCPI. • Stage 5. Finally, FFNN 2 is executed and then the output response value is evaluated in a comparison stage that normalizes the orders to binary values (0 or 1). Afterwards, the balancing orders are performed using the acquisition and balancing unit. The system then waits 60 s for the balancing process to finish in order to not compromise the accuracy of the next measurement process.

Experimental Results
The proposed algorithm was tested using 24 SAMSUNG ICR18650-26H 2600 mAh Li-ion battery cells [56], with reduced charge/discharge cycles. The results during the charging process with the proposed algorithm were also compared with the multistage method. Both charging algorithms were performed under the same conditions, i.e., the same stopping criteria and balancing algorithm, as previously explained. The multistage method was implemented with five current levels, using the conventional criterion of transition between current levels, i.e., transition occurs when a cell reaches the full charge voltage (4.2 V). The number of current levels was chosen based on the study carried out by [60], which concluded that the difference between applying different numbers of charging current levels is almost negligible when the number of charging current levels is greater than five. Figure 9 presents the charging current profiles, the battery pack temperature, the difference between the full charge voltage and the average cell voltage of the pack and, finally, the maximum difference between cell voltages, for both experimental tests. For the proposed algorithm, the current had an initial value of 1.64 A (Figure 9a), due to a considerable difference between the cell voltages of 0.07 V (Figure 9b). After 4 min and 40 s, the current reached the maximum value of 2.18 A, due to a decrease in the difference between cell voltages (0.03 V at that moment). During the remaining charge, there was an oscillatory profile in the current. This is justified by the difference between cell voltages, i.e., when there is an increase in the cell voltage difference, there is a decrease in the charge current, and vice versa. Although there was a slight difference between cell voltages during the entire charging process, this difference was gradually reduced as the charging progressed, ending the charging process with a value of 0.01 V. As seen in Figure 9c, the difference between the full charge voltage and the average cell voltage followed the expected profile, i.e., a gradual decrease until the end of the charge, with steeper slopes when the charging current was higher. Additionally, the temperature did not exceed the predefined values for the cells, reaching a maximum value of only 33.59 °C, corresponding to a 9.28 °C temperature variation.

Experimental Results
The proposed algorithm was tested using 24 SAMSUNG ICR18650-26H 2600 mAh Li-ion battery cells [56], with reduced charge/discharge cycles. The results during the charging process with the proposed algorithm were also compared with the multistage method. Both charging algorithms were performed under the same conditions, i.e., the same stopping criteria and balancing algorithm, as previously explained. The multistage method was implemented with five current levels, using the conventional criterion of transition between current levels, i.e., transition occurs when a cell reaches the full charge voltage (4.2 V). The number of current levels was chosen based on the study carried out by [60], which concluded that the difference between applying different numbers of charging current levels is almost negligible when the number of charging current levels is greater than five. Figure 9 presents the charging current profiles, the battery pack temperature, the difference between the full charge voltage and the average cell voltage of the pack and, finally, the maximum difference between cell voltages, for both experimental tests. For the proposed algorithm, the current had an initial value of 1.64 A (Figure 9a), due to a considerable difference between the cell voltages of 0.07 V (Figure 9b). After 4 min and 40 s, the current reached the maximum value of 2.18 A, due to a decrease in the difference between cell voltages (0.03 V at that moment). During the remaining charge, there was an oscillatory profile in the current. This is justified by the difference between cell voltages, i.e., when there is an increase in the cell voltage difference, there is a decrease in the charge current, and vice versa. Although there was a slight difference between cell voltages during the entire charging process, this difference was gradually reduced as the charging progressed, ending the charging process with a value of 0.01 V. As seen in Figure 9c, the difference between the full charge voltage and the average cell voltage followed the expected profile, i.e., a gradual decrease until the end of the charge, with steeper slopes when the charging current was higher. Additionally, the temperature did not exceed the predefined values for the cells, reaching a maximum value of only 33.59 • C, corresponding to a 9.28 • C temperature variation.  Figure 9b shows the current profile for the multistage method. The first transition between current levels occurred after 55 min and 40 s. However, the cell voltage exceeded the full charge voltage (4.2 V) and remained above this value for 3 min and 30 s. Therefore, and given the sampling time (60 s), the algorithm only performed one iteration at the second and third current levels. After 3 min and 30 s, the cell voltage dropped below 4.2 V and the charging current was fixed at the fourth level. This behavior occurred again in the next transition, but due to the absence of more current levels, the current was fixed at the fifth level. Figure 9d demonstrates that a much higher temperature value was obtained when compared with the proposed algorithm, due to the high charging time at high currents, reaching a maximum value of 38.68 °C, corresponding to a gradient of 13.84 °C. Figure 10 shows the individual voltage of each cell in the pack for both experimental tests. As aforementioned, in the tests performed with the proposed algorithm (Figure 10a), the difference between cell voltages decreased towards the end of charging. The magnification of this final stage (in Figure 10a) clearly reveals how the charging process was completed successfully, fulfilling the stopping criteria with an average cell voltage of 4.203 V and a difference between cell voltages of 0.01 V. In contrast, in the experimental test with the multistage method (Figure 10b), there was a reduced difference between cell voltages throughout the charging process and there was a higher slope in voltage until the first transition, which is justified by the high charging current of 2.5 A. The zoom in Figure 10b shows the fulfillment of the stopping criteria (an average cell voltage of 4.202  Figure 9b shows the current profile for the multistage method. The first transition between current levels occurred after 55 min and 40 s. However, the cell voltage exceeded the full charge voltage (4.2 V) and remained above this value for 3 min and 30 s. Therefore, and given the sampling time (60 s), the algorithm only performed one iteration at the second and third current levels. After 3 min and 30 s, the cell voltage dropped below 4.2 V and the charging current was fixed at the fourth level. This behavior occurred again in the next transition, but due to the absence of more current levels, the current was fixed at the fifth level. Figure 9d demonstrates that a much higher temperature value was obtained when compared with the proposed algorithm, due to the high charging time at high currents, reaching a maximum value of 38.68 • C, corresponding to a gradient of 13.84 • C. Figure 10 shows the individual voltage of each cell in the pack for both experimental tests. As aforementioned, in the tests performed with the proposed algorithm (Figure 10a), the difference between cell voltages decreased towards the end of charging. The magnification of this final stage (in Figure 10a) clearly reveals how the charging process was completed successfully, fulfilling the stopping criteria with an average cell voltage of 4.203 V and a difference between cell voltages of 0.01 V. In contrast, in the experimental test with the multistage method (Figure 10b), there was a reduced difference between cell voltages throughout the charging process and there was a higher slope in voltage until the first transition, which is justified by the high charging current of 2.5 A. The zoom in Figure 10b shows the fulfillment of the stopping criteria (an average cell voltage of 4.202 V and a difference between cell voltages of 0.01 V), confirming once again the excellent results obtained by the proposed balancing algorithm. V and a difference between cell voltages of 0.01 V), confirming once again the excellent results obtained by the proposed balancing algorithm.  Figure 11 illustrates the number of cells that required balancing during the charging process for both experimental tests, demonstrating the excellent performance of the proposed balancing algorithm using the FFNNs. For the proposed algorithm, after 1 h and 30 min of charging there was an increase in the number of cells that required balancing (Figure 11a), since the proposed algorithm privileges top balancing, making the balancing process more stringent at the end of the charging process. Before 1 h and 30 min of charging, few cells needed to be balanced, because balancing in this period is not very effective (compared with balancing performed at end of charging) and is only carried out to mitigate and prevent a higher difference between cell voltages. At the end of the charging process and since the stopping criteria were not met, all cells exceeded 4.2 V and, consequently, all cells were balanced. This procedure is essential to prevent cell voltage from further exceeding the full charge voltage (4.2 V) and allowing the stopping criteria to be met (Equations (10) and (11)).    Figure 11 illustrates the number of cells that required balancing during the charging process for both experimental tests, demonstrating the excellent performance of the proposed balancing algorithm using the FFNNs. For the proposed algorithm, after 1 h and 30 min of charging there was an increase in the number of cells that required balancing (Figure 11a), since the proposed algorithm privileges top balancing, making the balancing process more stringent at the end of the charging process. Before 1 h and 30 min of charging, few cells needed to be balanced, because balancing in this period is not very effective (compared with balancing performed at end of charging) and is only carried out to mitigate and prevent a higher difference between cell voltages. At the end of the charging process and since the stopping criteria were not met, all cells exceeded 4.2 V and, consequently, all cells were balanced. This procedure is essential to prevent cell voltage from further exceeding the full charge voltage (4.2 V) and allowing the stopping criteria to be met (Equations (10) and (11)).   Figure 11 illustrates the number of cells that required balancing during the charging process for both experimental tests, demonstrating the excellent performance of the proposed balancing algorithm using the FFNNs. For the proposed algorithm, after 1 h and 30 min of charging there was an increase in the number of cells that required balancing (Figure 11a), since the proposed algorithm privileges top balancing, making the balancing process more stringent at the end of the charging process. Before 1 h and 30 min of charging, few cells needed to be balanced, because balancing in this period is not very effective (compared with balancing performed at end of charging) and is only carried out to mitigate and prevent a higher difference between cell voltages. At the end of the charging process and since the stopping criteria were not met, all cells exceeded 4.2 V and, consequently, all cells were balanced. This procedure is essential to prevent cell voltage from further exceeding the full charge voltage (4.2 V) and allowing the stopping criteria to be met (Equations (10) and (11)).    At the transition between current levels, all the cells required balancing, because all cells exceeded the full charge voltage. At the end of charging, as in the previous experimental test, all cells required balancing. For both experimental tests, the proposed balancing algorithm presented excellent results, managing to minimize the difference between cell voltages and reaching the predetermined stopping criteria. Therefore, it is important to note that regardless of the charging algorithm, the proposed balancing algorithm managed to overcome the existent difference between cell voltages. Table 1 summarizes the performance of both charging algorithms concerning the charging time, difference between cell voltages at the end of the charging process, and temperature increase. When compared to the multistage method, the proposed algorithm presented superior results, achieving a 7.85% reduction in charging time and a 32.95% reduction in temperature increase. Regarding the difference between cell voltages at the end of the charging process, the proposed balancing algorithm was able to reduce this difference throughout the charging process, in both cases ending with the same difference. Therefore, it should be noted that the proposed charging algorithm achieved a major reduction in charging time and in temperature increase.

Conclusions
This paper presents a new charging algorithm and a new battery-balancing strategy for Li-ion batteries that reduces charging time and temperature increase. The proposed charging algorithm determines, through an FFNN, the charging current profile, considering the real-time conditions of the batteries, i.e., considering the difference between the full charge voltage and the average pack voltage, the difference between cell voltages and the battery temperature. When compared with the multistage algorithm, it showed better results regarding charging time and temperature increase. Additionally, the proposed charging method was able to adapt to different battery conditions, as it adapts to the actual state of the battery pack. Another distinctive feature of the proposed charging method is the cell balancing capability, which is especially important to maintain a safe and efficient operation. The balancing orders were calculated considering the average pack voltage, the voltage of each individual cell, and the standard deviation of the battery pack. The proposed balancing strategy was able to eliminate the difference between the voltage of the cells throughout the charging process, presenting an excellent performance. To compare the robustness and versatility of the proposed balancing strategy, the multistage algorithm was also implemented. Both cases resulted in the same difference between cell voltages. However, when compared to the multistage method, the proposed algorithm presented superior results, achieving a 7.85% reduction in charging time and a 32.95% reduction in temperature increase.