Power Cell SOC Modelling for Intelligent Virtual Sensor Implementation

Batteries are one of the principal components in electric vehicles and mobile electronic devices. They operate based on electrochemical reactions, which are exhaustively tested to check their behavior and to determine their characteristics at each working point. One remarkable issue of batteries is their complex behavior. The power cell type under analysis in this research is a LFP (Lithium Iron Phosphate LiFePO4). The purpose of this research is to predict the power cell State of Charge (SOC) by creating a hybrid intelligent model. All the operating points measured from a real system during a capacity confirmation test make up the dataset used to obtain the model. This dataset is clustered to obtain different behavior groups, which are used to develop the final model. Different regression techniques such as polynomial regression, support vector regression (SVR), and artificial neural networks (ANN) have been implemented for each cluster. A combination of these methods is performed to achieve an intelligent model. The SOC of the power cell can be predicted by this hybrid intelligent model, and good results are achieved.


Introduction
An electrical energy storage system is the most frequently used technology to solve the problem of intermittent energy production in renewable energy systems [1].In renewable energy systems, the electric energy storage is used as a method of storing the energy when production is higher than demand and returning the energy when demand is higher than production.Also, these systems are used to supply portable devices or replace the fossil fuels in vehicles, such as in electric vehicles [1].
Nowadays, an increasing number of studies aim to improve electrical energy storage systems.Some research is focused on dealing with intermittent energy generation in renewable energy such as solar and wind power systems, proposing to implement those methods in Smart Grid systems [2].Furthermore, the increasing use of portable devices like tablets or smartphones, which improve quality of life, demands higher autonomy, less charging time, or less weight at the energy storage components [3].
On the other hand, the electric vehicle forces the development and improvement of storage systems.Currently, a noticeable problem of the electric vehicle is the driving range, which is related to the storage system.Although the internal combustion engine is inefficient, it does at least provide long driving range due to the high energy density of fossil fuels [4].
This paper is focused on battery storage systems and especially on a Lithium-Ion (Li-Ion) power cell, which is commonly utilized in electric vehicles.The frequent use of this type of cells makes it possible to identify different characteristics, such as ageing forecasts, charging, and discharging behavior.This information is very important to model the power cells properly [5].
Li-Ion power cells are good candidates for electromobility and the renewable energy industry.The reasons why this battery is suitable for electric drive vehicles are its high power density, high voltage of the cell, low self-discharge, no memory effect, and long-life cycle [6].Also, the Li-Ion batteries can be found in different chemistries and each one has its specific characteristics, such as energy cells or power cells, fitting the different requirements of the vehicle industry [7].
Due to the extensive use of these batteries in portable devices as well as in electric vehicles and the need for safety, the failure analysis and modelling of these batteries are very important [8].
Multiple Regression Analysis (MRA) methods are based on the traditional regression models [9].These methods are used in several applications in different subjects due to their versatility [10][11][12].References [10,13] show a cost forecast in the early stage of projects, while [11,14] evaluate the suppliers performance.The MRA methods are limited in some cases, like in [9] and in [15].In these articles, MRA techniques were used, but due to the nonlinearity of the systems, a different approach was used.However, regression techniques based on soft computing can solve the problems of nonlinear systems, as was done in [16,17], where meta-classifiers were applied in a predictive control system with the aim of predicting the state of the model.In [18,19], artificial neural networks were combined with multiregression in order to optimize overbreak prediction.As shown in [20], failures in wind turbines can be detected and predicted using intelligent model techniques.
Although some regression problems are addressed with the new methods mentioned above, in several cases it is difficult to obtain accurate models, for various reasons.For instance, a model based on a highly nonlinear system can lead to a bad performance.Dividing the initial dataset into different groups before carrying out the regression could be a complementary solution [21,22].With this objective in mind, the clustering algorithm -means is commonly used [23][24][25].This method consists of splitting up the entire dataset into a number of clusters.Each piece of data will belong to a particular cluster, depending on its characteristics.After this step, the regression technique is made over each cluster.Prior researches like [26][27][28][29] solve other physical problems by using similar techniques.
This study develops an intelligent model that is able to predict the value of different system variables during a power cell test.Several clustering techniques were considered for grouping the data with similar behavior to implement the model.For each cluster, the three aforementioned regression methods were tested.The technique selection follows the minimum mean squared error criteria.
The present document is organized as follows.First, an introduction is described.Then, the case of study explains the test carried out and the process followed for obtaining the dataset.After the case study, the tested algorithms and the model approach considered in the study are presented.The obtained hybrid model and its configuration are shown in the Results.Finally, in the last section, future works and conclusions are presented.

Case Study
This research presents the SOC model of a LFP power cell used in electric vehicle battery systems.This power cell was tested as shown in Figure 1, obtaining different measurements.
The test carried out and power cell are explained in the subsections in more detail.
2.1.The Battery.One possible method of storing electric energy is by means of batteries.These devices store energy within an electrochemical medium, capable of storing and then supplying electrical energy due to electrochemical reactions [1].Batteries are composed of two electrodes and an electrolyte, where a redox reaction happens.During the discharging process, the cathode is reduced while the anode is oxidized, producing a current flow [1].During the charging process, the reaction occurs in reverse order.The number of times that the cycle can be repeated is determined by the use of the battery, up to the point at which the capacity decreases to unusable levels [30].
The most common batteries used in portable devices are the Lithium-Ion batteries.They are widely used in electronic devices and, more recently, in electric vehicles [31].The Li-Ion cells are characterized by their high energy density, due to the high voltage they can produce in comparison with other battery types, while weighing less [1].They also show a longlife cycle, low self-discharge, and no memory effect [30,31].

Capacity Confirmation
Test.The capacity confirmation test, which was performed on the battery, measures the capacity of the battery in ampere-hour [32].The measurement of the capacity was carried out at constant current.The test starts with the battery at full charge, so the SOC is at its maximum.Then, the battery starts to supply constant current until it reaches the discharge voltage, which is determined by the manufacturer [32].At this point, the battery rests till the voltage is recovered, so the charging process can begin.
Once the voltage has recovered to a certain value, the battery is again charged to its maximum voltage, also specified by the manufacturer [32].These processes are performed with constant current and the present SOC is calculated at each instant.
A battery tester was used for the capacity confirmation test.This device is able to charge and discharge the cell within the test parameters, in this case using a constant current and making the corresponding measurements.The 2800 3000 3200 3400 3600 3800 4000 4200 4400 4600 measurements made are the battery voltage, the current delivered or absorbed by the battery, the temperature at two different points, and how long the test lasts.
Figure 1 shows the test scheme.This figure also shows the different measurement devices used and where they are placed: ammeter (A), voltmeter (V), and temperature sensors (T1 and T2).Given the fact that the temperature of the Li-Ion batteries is uniform, the sensors location does not affect theoretically the temperature measured.Two redundant temperature sensors are used to detect wrong measurements.
The testing device, which supplies or absorbs the current, is represented as a current source ().
During this research, the power cell used was a LiFeBATT X-1P [33], which is a LiFePO4 cell.It is characterized by a nominal capacity of 8 Ah and nominal voltage of 3.3 V.
Four different steps can be distinguished in the test (Figure 2): (1) Charge: the initial voltage is 3 V and it is increased up to 3.65 V due to the constant current flowing from the tester to the battery.
(2) Rest after the charging process: there is no current flowing.During this step, the battery voltage reaches 3.3 V, which is the nominal value.
(3) Discharge: the 3.3 V achieved in the previous step is decreased to 2 V due to the constant current flowing from the battery to the tester.
(4) Rest after the discharging: there is no current flowing.The voltage of the battery goes from 2 V to 3 V.A new cycle is ready to be started again.
Figure 2 shows the voltage and current variation measured in one cycle.During the charging, the current is flowing from the tester to the battery, so it is considered positive.On the other hand, when the current flows from the battery to the tester, it is considered negative.
The energy provided or absorbed during the process can be obtained by integrating the current over time, obtaining the energy in ampere-hour.The representation of energy, at the top of Figure 3, shows how energy in the battery increases during the charging process and decreases during the discharging process.The representation of energy is shown as the SOC of the battery, which ranges from 100% with the battery fully charged, up to 0% with the battery completely discharged.
The two temperature sensors measure the temperature while the test is running.The measurement is made at two different locations.Their values also vary cyclically according to the state of the battery, depending on whether it is charging, discharging, or resting and also depending on the battery voltage.
The bottom of Figure 3 shows how the temperatures evolve in each operating region.
The full dataset used in this research has been obtained by testing a power cell, as explained before.The battery state is analyzed using the different parameters measured.Current and time are used to calculate the SOC of the battery at every moment.Furthermore, the temperatures were measured in order to detect a battery failure during the test.If values are far outside a typical range, a malfunction can be detected.All the data measured throughout the capacity battery test was labelled with the aim of determining the SOC.

Model Approach
The model approach is defined by the scheme shown in Figure 4. Taking into consideration the magnitudes measured during the capacity battery test and how the system behaves, the dataset can be split into several operation ranges.Thus, different clusters are obtained and regression techniques are applied for each one.A global model scheme is presented in Figure 4.The two inputs of this model are the voltage and current, and its output is the SOC.The cluster selector links the selected model with the output.Each cluster represents the best model obtained.The criterion used to assign input data to a specific cluster is the minimum Euclidean distance between the cluster centroids and the input data.The model is obtained as per the diagram of Figure 5.The figure shows only the data division for testing and training.However, a cross-validation technique (k-fold) was implemented to process the dataset with the aim of achieving better results.The validation of the k-fold model gives a more real performance and a better generalization [34].

Techniques Used.
In this research, different techniques were used in order to accomplish the best model.These techniques are described below.

Clustering
Principal Component Analysis.PCA is created by Pearson [35] and Hotelling [36].This statistical technique describes the variation of multivariate data in terms of variables that are not correlated.Uncorrelated variables can be expressed as a linear combination of the initial variables.The aim of this technique is to derive new uncorrelated variables as a linear combination of the initial variables.This method may help to reduce the number of variables that represent the data.
Data Clustering: The K-Means Algorithm.Clustering is technique of unsupervised data grouping used to measure similarity [37,38].The main aim of the data clustering technique is to organize unlabelled vectors into different groups.Thus, all similar data will belong to the same cluster [39].The means algorithm is frequently used to divide datasets into clusters.This algorithm organizes the samples by minimizing the function shown in (1), which represents the squared error function.
Each cluster is set around a centroid, so the final clustering will depend on the amount of clusters and on the initial position of their centroids.The selection of the number of clusters is very important and requires an initial study of the data composition.This value is extremely hard to estimate.The partitional algorithm -means performs well when the data is near its cluster and if each cluster is hyperspherical in shape and sufficiently separated in hyperspace.

Neural PCA and Maximum Likelihood Hebbian Learning (MLHL).
As mentioned above, PCA is a statistical compressing data method.The best linear compression of the data can be achieved in terms of LMSE.Some techniques of artificial neural networks (ANN) can be used to carry out PCA, for example, [40,41].
A PCA with a negative feedback network [40] can be used, according to the following definition.Given ×1 input matrix  and ×1 output matrix , a weight matrix   links each output  with the input ,  being a learning rate.At the beginning of the training process, the network does not have activation.The weights from the input layer neurons to the output layer neurons feed back the input data.The output neuron activation value is implemented using a linear sum.It can be expressed as shown in A feedback of the activation function is performed with the same weights.Then it is subtracted from the inputs and the inhibition is performed: Then, simple Hebbian learning is carried out between the outputs and the inputs, as shown in The network learning stability is a consequence of the negative feedback.In a similar way to Oja's Subspace algorithm [41], this network can find the main components of the input data [40].Therefore, the weights will find a subspace basis spanned by the current principal components whereas they will not find the theses components.MLHL [42] is described following the learning rules shown in the following equations: a feedforward step (2), a feedback step (3), and finally, a weight modification, which is presented in MLHL [42] is connected to the statistical standard method Exploratory Projection Pursuit (EPP) method [43].

Regression Techniques
Polynomial Regression.A model obtained with polynomial regression [34] can be described as a linear combination of basis functions.The number of inputs and the polynomial degree will affect the number of basis functions.
With a first-degree polynomial, the linear summation performed can be described as shown in ( 6) (for two inputs).If the polynomial degree increases, the model obtained will become more complex.A second-degree polynomial is shown in (7).
Multilayer Perceptron (MLP).The Multilayer Perceptron can be defined as a feedforward artificial neural network (ANN) [44,45].Its robustness and relative simplicity make this ANN the one most frequently used.Despite these advantages, the good performance of this technique depends heavily on the ANN architecture selected.The MLP architecture has three different layers: the input, the output, and one or more hidden ones.
A layer has a selected quantity of neurons, with a specific activation function.Commonly, the same activation function is used in all neurons of the same layer.Activation functions can be of three different types: linear, step, tan-sigmoid, or log-sigmoid.In MLP, the neurons have weighted links between layers.
The MPL output can be defined as in the following equation [46].
Least Square Support Vector Regression (LS-SVR).Support vector regression (SVR) is an adaptation of the support vector machines (SVM) classification algorithm.The principal aim of SVR is to plot the data in a high-dimensional space  using nonlinear mapping.Linear regression is then applied in the space  [47,48].The Least Square formulation of SVM, known as LS-SVM, is an approximation of the solution of a system.Its behavior is very similar to SVM in terms of general performance [49,50].The LS-SVR is the use of LS-SVM for regression [51,52].In LS-SVR, a typical squared loss function replaces an insensitive loss function.This squared loss function set up the Lagrangian matrix by solving a linear Karush-Kuhn-Tucker equation: where   is the  ones vector;  is the matrix or vector means transpose;  is the weight vector;  is the regression vector;  0 is the model offset.
To implement this technique two parameters are required:  and , where  is the kernel width [53].

Preprocessing the Dataset.
The dataset was obtained during the described capacity confirmation test performed on the power cell.The State of Charge was determined by the current and the time for each test.Voltage and current were monitored to determine the SOC.As explained in previous sections, temperatures were measured at two points of the battery in order to find malfunctions.
The SOC parameter of the battery should go sequentially from 0% to 100% and then from 100% to 0%.All incomplete cycles which did not fulfill this condition were discarded.After the data filtering, only completed cycles were taken into consideration for the implementation of the model.The measured data was registered with a sample of 1 Hertz.After this discard, the dataset for implementing the model was reduced from 18131 to 16370 samples.
The cycle consists of four different states: charge (1), rest (2), discharge (3), and rest (4).During the test, all data measured was labelled with the current state of the power cell.
Before developing the regression models, clustering algorithms were applied to the dataset.For this purpose, an analysis with MHLH and PCA was performed.The analysis showed that four different groups of samples could be appreciated, as Figures 6 and 7 show.Following the criteria suggested by PCA and MHLH, -means algorithm was applied to create the four clusters.Each group represents the four different states of the battery during the test.
The number of samples assigned to each cluster is shown in Table 1.It is remarkable that the cluster distribution corresponds to the four steps of the capacity confirmation test mentioned in Section 2.2.Polynomial regression, MLP-ANN, and LS-SVR were the three techniques trained for the clusters.

Results
The real state of the cell labelled during the test was compared with the data distribution obtained as a result of the clustering.The dataset has the requisite characteristics to be  applied by -means and the clusters accomplished had 100% correct assignation.Due to the good performance achieved, the model approach is not required to know the state of the cycle.
The MLP-ANN algorithm was implemented with different configurations; the number of hidden layer neurons changed from 2 to 15, while only one hidden layer was used.All hidden layer neurons shared the same activation function (tan-sigmoid).A linear activation function was used as an output layer neuron.The Levenberg-Marquardt algorithm was applied on the training process.Learning algorithm was  The LS-SVR regression algorithm was trained with the autotuning implemented in the Matlab toolbox developed by KU Leuven-ESAT-SCD.The chosen model kernel was Radial Basis Function (RBF) and "Function Estimation" the kind selected to make the regression.The cost-criterion is "leaveoneoutlssvm," with an MSE performance function and an optimization function type "simplex." The polynomial regression technique was applied with varying polynomial order from 1 to 10.
The Mean Square Error (MSE) value is used to compare the accuracy of the models.The lowest MSEs obtained for each technique are shown in Table 2.
In Table 3, the best regression results are shown, as well as the technique applied to achieve them.
The technique selection takes into consideration the computational cost when the MSEs achieved for two or more techniques are similar.Here, the results of the statistical analysis are shown with the aim of determining the accuracy of the selected models compared with that of those nonselected.
For each cluster, the best model selected is compared statistically with the others, in terms of MSE, to determine if there is a difference between their MSEs.
Figure 8 shows the boxplot for each cluster using ANN-MLP, polynomial regression, and LS-SVR, while the results of the statistical analysis using a -test analysis with a 5% -level are shown in Table 4.
Based on the results of Table 4, the following may be concluded: (i) Cluster 1: there is no statistical difference between ANN-MLP, 10 neurons, and LS-SVR.
(ii) Cluster 2: there is no statistical difference between any of the three models.(iii) Cluster 3: there is no statistical difference between ANN-MLP, 10 neurons, and LS-SVR.
(iv) Cluster 4: there is no statistical difference between any of the three models.
In any of the previous cases, the difference between the MSEs, in the best case, is lower than 0.0052 so it can be considered that the model selected does not significantly affect the results.

Conclusions and Future Works
The approach used in this study presents remarkable results.The MSE average is 0.1815, varying from 0.0865 to 0.4767, depending on the variable and the cycle state.
The State of Charge value for the confirmation of the battery capacity can be predicted in real time.The model obtained is capable of checking that the power cell test is functioning correctly when it offers wrong results.
The overall efficiency of this novel approach is increased if a hybrid model is implemented.This way, each local model was obtained by training one group of the initial dataset.Better results were achieved by employing MLPs and LS-SVR.However, the difference between the two, in terms of MSE, is not statistically great, so both models may be used in any of the clusters.
The temperature measured in the cell is highly important parameter relating to health of the device.Using the temperatures measured in the tests, a study and a modelling of these parameters will be undertaken to detect deviations in behavior.This new model would be used with the one-class classifier algorithm in order to detect any faults in this type of systems.

Figure 2 :
Figure 2: Current and voltage measured during one cycle.

Figure 3 :
Figure 3: Energy and temperatures measured in one cycle.

Table 1 :
Samples assigned to clusters.

Table 2 :
Best MSE achieved for each technique.

Table 3 :
MSE for the best methods.

Table 4 :
value for each model in each cluster.