Real Time Determination of Rechargeable Batteries ’ Type and the State of Charge via Cascade Correlation Neural Network

1Abstract—Batteries are used to store electrical energy as chemical energy. They have a wide using area from portable equipment to electric vehicles. It is important to know the state of charge of a battery to use it efficiently. In this study, a graphical user interface is developed using a visual programming language to monitor the electrical situations of batteries. Cascade neural network, which is one of the most chosen artificial neural networks, is used to determine the type and state of charge of batteries. The software is able to identify type and state of charge of batteries online. Lead acid, Lithium Ion, Lithium polymer, Nickel Cadmium, Nickel Metal Hydride rechargeable batteries are used in experiments. The experimental results indicate that accurate estimation results can be obtained by the proposed method.


I. INTRODUCTION
Although batteries seem to be simple, they are nonlinear and complex systems because of their physical and chemical structure. Depending on the development of technology the usage area of batteries is increasing. It is important to estimate the state of charge (SOC) of the battery accurately in battery management systems to use the battery efficiently. Mathematical, electrical, electrochemical methods are used to estimate to the SoC of the battery; Mathematical and electrochemical methods include complex equations, and these equations must be redesigned for other types of batteries. The electrical method is easy to calculate, and the user can develop a battery model by looking at a datasheet of the battery or by measuring the battery parameters. Satisfactory battery models can be achieved using datasets generated by electrical methods.
Various SoC estimation methods are proposed in the literature that uses experimental dataset. The dataset used in electrical battery models can be obtained by monitoring battery voltage, current, electrochemical impedance spectroscopy, etc. and parameters. Data collecting is possible by measuring parameters while charging the battery, discharging the battery or in a steady state. Most known methods are ANN, fuzzy logic, Kalman filter and radial basis function neural network (RBFNN). The artificial Manuscript received 11 August, 2017; accepted 21 October, 2017. neural network (ANN) method is easy to build because it doesn't have complex mathematical equations and works with high accuracy [1]- [7]. Developing fuzzy rules and membership functions and fuzzy outputs are difficult. It requires a lot of data and expert knowledge to develop a fuzzy system [8]- [10]. The Kalman filter is computationally complex and requires conditional independence of the measurement errors [11]- [15]. RBFNN is easy to build, but it is slow when the dataset is large [16]. In [17] a model is developed to estimate the usable capacity of lead acid batteries used in electric vehicles. High accuracy is obtained using ANN. In [18] three layer feed forward neural network is used to estimate SoC of NiMH batteries. SoC is estimated under 5 % error rate with this method. In [2] back propagation neural network is applied successfully to estimate SoC of NiMH batteries used in electric vehicles. The SoC of the battery can be estimated while charging, discharging the battery and the steady state after charging. The open circuit voltage of the battery is applied as an input parameter of a neural network. The simulation results suggest that this method is suitable for hybrid electric vehicles. In [19] a three-layer back propagation neural network is used to estimate the SoC of a high powered NiMH battery. Five input parameters are applied to the neural network; these are battery discharge current, total ampere-hour, open circuit voltage of the battery, timedependent average open circuit voltage and twice of time dependent average open circuit voltage. The datasets are obtained while discharging the battery from full charge to full discharge. The Levenberg Marquart algorithm is used in training. Simulation and measurement results are compared to test the performance of the artificial neural network. After ten minutes the SoC of the battery can be estimated with fewer than 5 % error rate.
Knowing the percentage of energy left in a battery gives the user information on how much time a battery will continue to operate without recharging. It is important to charge and discharge the battery in the correct form to prevent fires and explosions; furthermore, proper use of the battery provides more efficiency and longer life for users. On the other side of the spectrum, improper use will reduce the lifetime of the battery, and the defective battery creates chemical pollution in nature. In this study, an experimental setup is developed to monitor the batteries' electrical parameters. Special software is designed to save the measured data systematically and determine the type and SoC of rechargeable batteries online. The software is also able to stop an experiment while the battery is out of voltage, current or temperature boundaries. Cascade Correlation Neural Network (CCNN) is used to determine the type and SoC of batteries while discharging the battery at a constant load. The terminal voltage of the battery, current, power data is used to generate the dataset. Lead acid (Pb), Lithium Ion (Li-Ion), Lithium polymer (LiPo), Nickel Cadmium (NiCd), Nickel Metal Hydride (NiMH) rechargeable batteries are used in the experiments. The Watt-hour values of experimental batteries are chosen which are very similar; this is to successfully determine the type of batteries that have nearly the same properties. The difference between this study and other academic studies is the idea of determining the type of battery and the charging, discharging form. The experimental setup and database structure can be an example for people who are working on monitoring the electrical behaviours of batteries.
The goal of this study is to determine type and SoC of rechargeable batteries via CCNN with high accuracy. There are many applications to determine the SoC of a battery but estimating the type of batteries is a new study. Estimating of the battery via CCNN is another innovation of the study. Pb, Li-Ion, Li-Po, NiCd and NiMH rechargeable batteries are used in the experiments.

II. RECHARGEABLE BATTERIES
Batteries are a part of our everyday lives at the moment, all of the wireless equipment that operates using electrical energy take this power from batteries. In the modern day, portability is important, which in turn has increased the importance of batteries. The usage rate of batteries in a country is directly proportional to the usage of technology. There are many different rechargeable battery types, in this study, Pb, Li-Ion, Li-Po, NiCd, NiMH rechargeable batteries have been used.
Pb batteries are suitable for applications where weight and dimensions of the battery are not necessary. Therefore they are cheap. Mostly these batteries are used in vehicles, medical devices, and motorized chairs for disabled people and emergency lighting spotlights and uninterruptible power supplies. Li-Ion batteries are more stable and lightweight; the organic electrolyte provides the practical cell voltage to be above 4 V. They have high energy densities, and they provide easy applications without the need for connecting several cells in a series [20]- [22]. They are used in laptops, mobile phones, music players and much more digital portable devices. LiPo batteries are rechargeable batteries that continue on from the Li-Ion battery technology. LiPo batteries have high energy densities according to their volume and weights because of this; they have a large usage area. They are used in electrical vehicles, laptops, and many electronic applications. The most important property of NiCd batteries is that they hold the capacity inside it without losing it, in essence, it has the same capacity two weeks after the last charging time. NiCd batteries are used in single or grouped form in drills, measuring instruments, etc. The fast charge of these types of batteries decreases their using life. With standard charging, NiCd batteries have an average life of 5 years. NiMH batteries have more energy density than NiCd batteries, but their rechargeable number is lower. They are used in laptops, mobile phones, cameras, toys, etc. There is some memory effect in NiMH batteries.

A. Experimental Setup
In electrical battery test setups the experimental setup is shaped according to the measuring parameters. If the battery's internal resistance will be measured, the internal resistance meter is used, if the current will be measured, the current sensor will be used, if voltage is measured, the voltage sensor must be used. A charger must be used to charge the battery, and a load must be used to discharge the battery. If the temperature parameter is necessary temperature sensors must be used in the system. The collected data can be processed by a computer or embedded systems. Successful battery models can be obtained with collected data from electrical measurements. In this study, open circuit voltage, current, power, load, ambient temperature and battery temperature are all measured during charging and discharging of the batteries.
The measurement setup of this study is given in Fig. 1. To charge the battery, Imax B8+ charge equipment and to discharge battery Array 3711A programmable DC load equipment is used. A circuit is designed to choose the charger or load from software. A LTS25-NP current sensor, a LV25P voltage sensor and a LM35 temperature sensor are also located on this circuit. Three batteries can be connected to this circuit and the experiment battery can be chosen from the software. There are also contacts to control buttons of the charger on this circuit. The contacts on this circuit are controlled by digital I/O on Advantech USB-4716 data acquisition (DAQ) card. The output of K-type thermocouple is connected to digital I/O of DAQ card through the circuit. The programmable DC load is connected to the PC via Array 3312 Seri-USB port converter. Square codes are glued to all batteries that define their identity. Perkon Spider SP400 square code reader is used to read codes. This equipment is connected to the computer via a USB port. A web camera is used to watch the experimental setup.  While discharging the battery, the current, voltage, load and power parameters are taken from the load equipment, while charging the battery, current and voltage parameters are measured with sensors and transferred to a computer via DAQ card. While charging, the battery load and power parameters are calculated using voltage and current data. The percentage of maximum difference with average Wh value is 4,15 %. The batteries capacities are very similar, and this property makes it difficult to determine the battery type. Although the capacities of these chosen batteries are similar, their charging types and charging currents are different.

B. Cascade Correlation Neural Network
The CCNN is developed by Fahlman in 1990. CCNN is a supervised learning algorithm. CCNN begins with a minimal network, then automatically trains and adds new hidden units one by one, creating a multi-layer structure. The CCNN architecture has several advantages over existing algorithms: it learns very quickly, the network determines its own size and topology, it retains the structures it has built even if the training set changes, and it requires no backpropagation of error signals through the connections of the network [23].
An untrained cascade correlation network is a blank slate; it has no hidden units. A cascade correlation network's output weights are trained until either the solution is found, or progress stagnates. If a single layered network will suffice, training is complete. The weights of hidden neurons are static; once they are initially trained, they are not touched again. The features they identify are permanently cast into the memory of the network. Preserving the orientation of hidden neurons allows cascade correlation to accumulate experience after its initial training session. Few neural network architectures allow this. If a backpropagation network is retrained, it 'forgets' it's initial training [24].
The CCNN architecture is shown in Fig. 2

IV.
SPECIAL SOFTWARE TO DETERMINE TYPE AND SOC OF BATTERIES A graphical user interface is developed in Visual Studio 2010 software in C# programming language to monitor conditions of batteries, saving measurement data to a database to determine the type and SoC of batteries. Users can add a new battery to the database. Users select the test battery, duration of the experiment, sample time, and choose to charge or to discharge the battery. When all the adjustments are made an experiment code is generated automatically. A table is created called this code in the database, and the measurement data is saved to this table. The measurement data curves can be seen online. The measurements saved to the database before can be listed.
The battery can be inserted into charge-discharge loop safely because during the experiments the battery is controlled if it achieved to critical limit values of voltage, current, and temperature. If one of these value is achieved the software close the system automatically and generate alarms. The rest periods between charging and discharging are adjustable. The user can generate the dataset and normalize the data to recognize the battery for CCNN and save it in Excel format. The input variables of CCNN to recognize the battery are voltage, current, power, voltage decreasing angle and current decreasing angle. To determine the voltage and current decreasing angles the battery must be discharged for a determined time. 400 second is selected for this application. The dataset to train CCNN to determine SoC of the battery can be generated and normalized. The SoC value is determined according to the measurement data. The input variables of this CCNN are voltage, current, power and time: The SoC of the battery can be determined from the current curve of the battery while discharging the battery. From full charge to full discharge the area under the current curve represents 100 % SOC. In (1) the equation of total area (TA) under from full charge to full discharge of the battery curve is given. In this equation, I represents current value and t represents time. In the software, the integral can be determined by the trapezoid method; this method is applied as given in (2) where gi is current value of ith time, gi+1 is the current value of i+1 th time; ti is i th time value, ti+1 is i+1 th time value; n is a number of measurements. For a m th measurement data, the area (IA) under up to this time can be determined according to (3), IA represents the used capacity of the battery. The SoC of the battery can be determined by dividing the remaining capacity of the battery to full capacity of the battery as given in (4). In this equation, QC is the remaining capacity of the battery and QMax is the maximum capacity of the battery. So the rate of remaining capacity of the battery can be derived from (5). In this equation (TA-IA) gives the remaining capacity of the battery and TA gives the maximum capacity of the battery [25].

V. EXPERIMENTAL STUDY
To obtain the dataset for usage to determine the type and SoC of batteries the batteries are full charged firstly then they are fully discharged under constant loads. 3 Ω, 5 Ω, and 10 Ω constant load values are used. All experiments are done in an ambient temperature and with healthy batteries. This experimental data is used as training data for CCNN to determine the type and SoC of batteries.

VI. DETERMINING TYPE AND SOC OF BATTERIES VIA CCNN
There are many studies on estimating the SoC of a battery but estimating the type of battery is a new study. In future, the usage of electrical cars will increase, and the importance of batteries will increase accordingly. The users will not wait at charge stations. Instead they will change the battery packs in these situations. So a software that determines the type and SoC of a battery and gives the information of how to charge and the usage of this battery pack will be very useful. From this idea, we initially tried to determine the type of battery in Matlab. There is a battery block in Simulink and it supports many types of rechargeable batteries. By using the full charge to full discharge values of voltage and current and using the CCNN method we succeeded in determining the type of battery. Then we studied this method in a real application.
The architecture of the CCNN used to determine the type of battery is given in Fig. 3. There are five inputs, one hidden layer and five outputs in this architecture. The input values are current, voltage, power, Vθ and iθ. Vθ is the angle of the voltage drop and iθ is the angle of the current drop while discharging the battery. These values are determined by calculating the difference of values over 400 seconds. This time value is determined by trying and considered as a time unit. ∆ V is the difference of voltage value, and ∆ i is the difference of current value after 400 seconds. iθ is arctan(∆i) and Vθ is arctan(∆V). The input values of CCNN is normalized between 0 and 1 dividing input value by the absolute value of the maximum value of the input vector. In this equation x' is the normalized value, x is the value to be normalized and |x| is the maximum value of input vector. The NN has five outputs and gives the result between 0 and 1 for each neuron. The maximum of these values represents the type of the battery. The architecture of CCNN to determine the SoC of the battery is given in Fig. 4. There are four inputs, one hidden layer and one output in this architecture. The input values are current, voltage, power and time (t). The output of NN is between 0 and 1. 0 represents the fully discharged battery and 1 represents the fully charged battery. The t value is calculated from (6). It is calculated from the change of voltage value. For each architecture, the neuron number of the hidden layer is determined by trying. The number that gives the best result is chosen old voltage value = new voltage value , t + 1, old voltage value new voltage value, 1.
Matlab Neural Network Toolbox is used to train neural networks. A Matlab function block is written to apply input variables to CCNN. The outputs are compared with targets and success rate is calculated according to (7). SR is success rate, REN is right estimation number, and TSN is total sample number in this equation. A similar model is used to calculate the success rate of type of battery determination The determination of the type of batteries results are shown in Table II and estimation of SoC of the batteries results are given in Table III. 20 % of data is used as test data. The estimation tolerance is ±1 %. For each table, it can be seen that the best results are obtained from 3 Ω constant load experiments.  After training networks in Matlab environment, the weight and bias values of these networks are used in software. A function is written to find the type of battery and a function is written to find the SoC of the battery. There are three CCNN to determine the type of battery. When the software is started according to constant load value the CCNN that will be used to determine the type of battery is found. 400 seconds later software can determine the type of battery. Then it determines the SoC of the battery. There are fifteen CCNN to determine the SoC of the battery. This CCNN is determined according to constant load value and type of battery. The software gives results for online measurements. The window of online results is presented in Fig. 5.

VII. CONCLUSIONS
Type and state of charge of rechargeable batteries are estimated in this study via CCNN. The maximum average success rate is 96,016 % for estimating the type of battery and Pb batteries can be determined with 100 % success during constant 3 Ω, 5 Ω and 10 Ω discharging conditions The maximum average success rate is 99,03 % for estimating the SoC of the battery.
In this study, healthy batteries are used in the experiments. This study can be extended by taking into account the state of health of the batteries. In the estimation, only voltage, current, load and power parameters are used while discharging the battery but the battery temperature and ambient temperature are also measured and saved to a database while charging and discharging the battery. This data can be used in future studies. The experimental setup and software can be used for another type of batteries too. The software is flexible and can be developed. The dataset obtained from the experiments is suitable to use with other artificial intelligence techniques to determine the type and SoC of a battery. This software can be used in battery maintenance services, battery tests for battery manufacturers and for determining undefined batteries efficiently.