# Prediction Model of Corrosion Current Density Induced by Stray Current Based on QPSO-Driven Neural Network

Authors: Chengtao Wang; Wei Li; Gaifang Xin; Yuqiao Wang; Shaoyi Xu
Journal: Complexity
 (2019)

---

## Abstract

The buried pipelines and metallic structures in subway systems are subjected to electrochemical corrosion under the stray current interference. The corrosion current density determines the degree and the speed of stray current corrosion. A method combining electrochemical experiment with the machine learning algorithm was utilized in this research to study the corrosion current density under the coupling action of stray current and chloride ion. In this study, a quantum particle swarm optimization-neural network (QPSO-NN) model was built up to predict the corrosion current density in the process of stray current corrosion. The QPSO algorithm was employed to optimize the updating process of weights and biases in the artificial neural network (ANN). The results show that the accuracy of the proposed QPSO-NN model is better than the model based on backpropagation neural network (BPNN) and particle swarm optimization-neural network (PSO-NN). The accuracy distribution of the QPSO-NN model is more stable than that of the BPNN model and the PSO-NN model. The presented model can be used for the prediction of corrosion current density and provides the possibility to monitor the stray current corrosion in subway system through an intelligent learning algorithm.


---

## Body

## 1. Introduction

Stray current is defined as electric currents flowing along other elements, which are not components of the purpose-built electric current [1]. Stray current can originate from electrified traction system, offshore structure, marine platforms, cathodic protection system, etc. Stray current leakage and its corrosion in the direct current (DC) mass transit system are shown in Figure 1. Stray current will cause electrochemical corrosion in some of the infrastructure, such as the running rails [2], buried pipelines [3], and concrete structures [4, 5], which overall reduces the safety performance of the DC mass transit system. In particular, it needs to be explained that most pipelines consist of carbon steel, which makes corrosion one of the most common integrity threats of these systems [6]. In some extreme cases, severe structural damage has occurred as a result of stray current leakage [7]. The reasons for stray current formation are diversified and complex and are easily affected by many factors, such as stray current density, structure of buried metal, salt content and composition, soil moisture content, soil texture and tightness, organic content, and temperature.Figure 1
Stray current in the DC mass transit system.In the face of rapid development of urban rail transit, it is especially important to understand and monitor the process of stray current corrosion that happens in the DC transit system. The existing monitoring of stray current corrosion is mainly conducted through reference electrode. However, problems existed. For example, the polarization potential of reference electrode sometimes cannot represent the corrosion status of buried pipelines accurately due to the influence of IR drop and internal reactants. The faulty reference electrode is hard to replace in the subway system because it is difficult to excavate the electrode from the concrete structure in order to ensure the overall strength of the system. Besides, because the subway system is difficult to make structural changes after completion, accurate corrosion monitoring without excavation is especially important. Therefore, a method for accurately establishing the mapping relationship between the external environment factors and corrosion status is urgently needed. Based on Faraday’s law, corrosion current densityicorr is an important parameter in the direct evaluation of stray current corrosion. The corrosion current density not only reflects the degree of stray current corrosion but also the corrosion rate. Corrosion current density is affected by external factors during stray current corrosion. Since the stray current corrosion is a complex process with multiple factors, it is difficult to accurately establish the relationship between external factors and corrosion current density through numerical modelling. The prediction of corrosion current density by a machine learning algorithm is of great practical significance for the evaluation of stray current corrosion state.As an effective tool to study the corrosion process, many methods based on the machine learning algorithm have been employed, such as the backpropagation neural network (BPNN) model [8, 9], radial basis function (RBF) neural network model [10], support vector machine (SVM) model [11, 12], self-organized map (SOM) model [13], and grey theory model [14]. The intelligence algorithm is often utilized to predict the corrosion current density in steel reinforced concrete structures [13], polarization potential [10], stray current density [8], weight loss [14], corrosion rate [11], corrosion hazard classification of stray current [15], and so on. In the last few years, artificial neural network (ANN) has emerged as powerful devices that can be used in many engineering applications [16–21]. The ANN has been widely employed in the field of corrosion prediction. Some important research results on corrosion prediction have been carried out based on the ANN [22–24]. The main advantage of ANN is its outstanding capabilities in capturing the nonlinear relationships between input and output corrosion data sets. However, some problems also exist in the application of ANN, such as weak global search ability, and poor robustness, and it is easy to fall into local minimum value. Therefore, many algorithms such as the genetic algorithm (GA) [25, 26], gravitational search algorithm (GSA) [27], and particle swarm optimization (PSO) [28, 29] are utilized to optimize the ANN.In this paper, stray currents existing in the main structure of the subway systems, buried pipelines, and metal structures around the system are studied using the intelligent algorithm-based method combining with an electrochemical experiment. NaCl is an important composition of the extracted soil solution [3]. Thus, the NaCl solution is adopted as the corrosive medium in this study. The quantum particle swarm optimization-neural network (QPSO-NN) model is established to predict the corrosion current density under the coupling excitation of stray current and chloride ion. The quantum particle swarm optimization (QPSO) is utilized to optimize the weight and threshold of each layer. Compared with PSO, QPSO has less parameters, better robustness, and faster convergence rate [10], which has been successfully employed in many optimization problems [30], including the neural network [31]. However, the QPSO algorithm is rarely utilized in the field of corrosion prediction, especially the electrochemical corrosion induced by stray current, in which some new explorations and attempts are needed to improve the performance of stray current corrosion prediction. QPSO can better converge to the global best, shows strong global search ability, and local search ability, which is not easy to fall into the local best [32, 33]. The database for training the QPSO-NN model is collected from the electrochemical experiment of Q235A.Aiming at stray current corrosion process, the purpose of this paper is to realize the prediction of corrosion current density considering multiple environment factors based on the QPSO-NN algorithm, and then to provide the possibility of accurately monitoring the corrosion status of buried pipelines without excavation. Thus, the experimental process is firstly conducted to determine the main factors affecting the corrosion current density and then to set up the prediction database. The rest of this paper is organized as follows: The theory of the proposed QPSO-NN algorithm is described in Section2. Section 3 introduces the experimental system designed for generating data set for the prediction model of corrosion current density and experimental results. Section 4 introduces the corrosion current density prediction framework and the related technique details. In Section 5, the training process is stated and the QPSO-NN method is compared with the BPNN method and the particle swarm-neural network (PSO-NN) method. Further analysis of parameters in the algorithm is also conducted in Section 5. Section 6 draws the conclusions.


## 2. Training Algorithm of the Proposed Model Based on QPSO

### 2.1. Brief Review on Artificial Neural Network

In 1949, Donald Hebb’s research showed that biological conditioning is generally caused by the nature of neurons, pointing to a learning method of the biological neural unit’s learning mechanism, which is now known as neural plasticity [34]. Frank Rosenblatt firstly proposed the perception network model and used it in the computer addition, subtraction, and pattern recognition calculation in 1958 [35]. In 1982, the Hopfield model was proposed to provide nonlinear neural summarization for the information storage and extraction functions of the ANN33, in which the dynamic equations and learning equations were also put forward. This model provides theoretical guidance for the construction and learning of ANN [36]. The ANN has strong nonlinear mapping capabilities, self-learning and self-adaptive capabilities, generalization capabilities, and fault tolerance. The basic structure of the ANN includes information called the processing unit or node of neuron and the connection relationship of each node, which simplifies the imitation and abstraction of the biological neural network. The neurons in the ANN are classified into three types of layers: input layer, hidden layer(s), and output layer. The relationship between various neurons is a singular relationship, and there is no difference. The connection weights can be adaptively adjusted through continuous learning.


### 2.2. Quantum Particle Swarm Optimization

The QPSO algorithm based on quantum behavior is generated from the classical PSO algorithm. It is mainly combined with the improvement of quantum theory behavior, which improves the global optimization performance of the algorithm. In quantum mechanics, the state of a particle is described by a wave functionΨX,t, which is a complex function of the particle position X (X is a position vector) and time t. The physical meaning of the wave function can be expressed as the square of the wave function modulus represents the probability density at which the particle appears at spatial position X. By integrating the wave function over entire space, the sum of the probability of particles appearing at various points in space is obtained. In n-dimensional space, one-dimensional potential well δ at the centre of pi for each dimension is defined, in coordination with the attractor pi=pi1,pi2,…,piN. Each particle converges to a certain area by an attractor pi. The position coordinate of the attractor pi is as follows:(1)pi,jt=φi,jtPi,jt+1−φi,jt,1≤j≤N,(2)φi,jt=c1r1,jtc1r1,jt+c2r2,jt,where r1,j, r2,j, and φi,j are all independent random positive real numbers between [0, 1]; Pi,jt represents the local optimal position of attractor pi; Gjt represents the global optimal position of the population; c1 and c2 is local cognitive coefficient and overall cognitive coefficient, respectively.According to the theory of quantum mechanics, the dynamic behavior of particles in quantum space can be described by Schrödinger equation. In the QPSO algorithm, the wave function in the Schrödinger equation is used to express the position of the particles in the quantum particle space. The wave function of a particle with the position ofXi,jt+1 in each dimension for pi,j can be obtained as follows:(3)ψXi,jt+1=1Li,jtexp−Xi,jt+1−pi,jtLi,jt.After the probability density function for a particle appearing at a certain point in the quantum space is calculated, the Monte Carlo method is employed to obtain the position equation of the particle. The position equation is given in the following equation:(4)xi,jt+1=pi,jt±Li,jt2ln1ui,jt,(5)ui,jt∼U0,1.TheLi,jt in equation (4) is the characteristic length of the potential well δ, which is calculated as follows:(6)Li,jt=2αmbestjt−xi,jt,where α is the contraction-expansion coefficient, the only parameter in the QPSO algorithm except from population size and iteration times.The mean best positionmbestt in equation (6) is the individual optimal mean of all particles, which is defined as follows:(7)mbestt=1M∑i=1MPit=1M∑i=1MPi1t,1M∑i=1MPi2t,…,1M∑i=1MPiDt.In equation (7), Pijt represents the individual best position of the jth dimension of the ith particle at the tth iteration. For minimization, the smaller the objective function value, the better the fitness it corresponds to. When the current position of the ith particle is Xit=Xi,1t,Xi,2t,…,Xi,Dt (i = 1, 2, …, M), the current individual optimal position of the ith particle can be updated through equation (8), where f is the object function. The current global optimal position Gt can be obtained through equation (9), where Gt=G1t,G2t,…,GDt:(8)Pit=Xit,if:fXit<fPit−1,Pit−1,if:fPit−1≤fXit,(9)Gt=Pgt,g=argmin1≤i≤MfPit.Finally, the evolution formula of the QPSO can be expressed as follows:(10)RPijt=φjt×Pijt+1−φjt×Gjt,(11)Xijt+1=RPijt+Randt×at×mbestt−Xijt×ln1uijt,where fijt=rad and uijt=rad; the function radf produces a random number that is uniformly distributed between [0, 1]; the function Randt in equation (11) is given as follows:(12)Randt=−1,if:radf<0.5,+1,if:radf>0.5.M is the total number of particles; D is the dimension of the particle; RPijt is the random point between the individual optimal position of the ith particle at the jth dimension Pijt and the global optimal position at the jth dimension Gjt; φjt is the random number between [0, 1]; and at represents the contraction-expansion coefficient of QPSO, which is an important parameter of convergence. The value of at depends on the situation, which can be dynamically changed in a certain way. The variable at can be determined according to the following formula:(13)at=m−m−n×1MaxTimes.Them and n in equation (13) usually are set as 1 and 0.5, and the MaxTimes represent the maximum number of iterations.The flow of the QPSO algorithm is stated in detail as follows:(1)
Randomly initialize the initial position ofM particles Xi0, and set the current best position of each particle as Pi0=Xi0; the initial global optimal value is the minimum value of the local optimal values of all current particles (assuming to find the minimum value of the function as an example), which is Pg0=minX10,X20,…,XD0(2)
Calculate the fitness value of particles according to object functionfXit(3)
Update current position of each particleXit based on the calculated current fitness value(4)
Compare the last individual optimal valuesPit−1 with current position of each particle Xit to update current individual optimal position of each particle Pit through equation (8) and update current global optimal position Gt through equation (9)(5)
Compare current global optimal positionGt with last global optimal position Gt−1, if fGt<fGt−1, Gt updates as the global optimal position; otherwise, Gt−1 remains the global optimal position (for minimization)(6)
Calculate mean best positionmbestt according to equation (7)(7)
For each dimension of the particle, calculate random pointRPijt between Pijt and Gjt according to equation (6)(8)
Update new position of each particleXit+1 based on equations (10) and (11)(9)
Repeat Step 2 to Step 8, until iteration MaxTimes is met


## 2.1. Brief Review on Artificial Neural Network

In 1949, Donald Hebb’s research showed that biological conditioning is generally caused by the nature of neurons, pointing to a learning method of the biological neural unit’s learning mechanism, which is now known as neural plasticity [34]. Frank Rosenblatt firstly proposed the perception network model and used it in the computer addition, subtraction, and pattern recognition calculation in 1958 [35]. In 1982, the Hopfield model was proposed to provide nonlinear neural summarization for the information storage and extraction functions of the ANN33, in which the dynamic equations and learning equations were also put forward. This model provides theoretical guidance for the construction and learning of ANN [36]. The ANN has strong nonlinear mapping capabilities, self-learning and self-adaptive capabilities, generalization capabilities, and fault tolerance. The basic structure of the ANN includes information called the processing unit or node of neuron and the connection relationship of each node, which simplifies the imitation and abstraction of the biological neural network. The neurons in the ANN are classified into three types of layers: input layer, hidden layer(s), and output layer. The relationship between various neurons is a singular relationship, and there is no difference. The connection weights can be adaptively adjusted through continuous learning.


## 2.2. Quantum Particle Swarm Optimization

The QPSO algorithm based on quantum behavior is generated from the classical PSO algorithm. It is mainly combined with the improvement of quantum theory behavior, which improves the global optimization performance of the algorithm. In quantum mechanics, the state of a particle is described by a wave functionΨX,t, which is a complex function of the particle position X (X is a position vector) and time t. The physical meaning of the wave function can be expressed as the square of the wave function modulus represents the probability density at which the particle appears at spatial position X. By integrating the wave function over entire space, the sum of the probability of particles appearing at various points in space is obtained. In n-dimensional space, one-dimensional potential well δ at the centre of pi for each dimension is defined, in coordination with the attractor pi=pi1,pi2,…,piN. Each particle converges to a certain area by an attractor pi. The position coordinate of the attractor pi is as follows:(1)pi,jt=φi,jtPi,jt+1−φi,jt,1≤j≤N,(2)φi,jt=c1r1,jtc1r1,jt+c2r2,jt,where r1,j, r2,j, and φi,j are all independent random positive real numbers between [0, 1]; Pi,jt represents the local optimal position of attractor pi; Gjt represents the global optimal position of the population; c1 and c2 is local cognitive coefficient and overall cognitive coefficient, respectively.According to the theory of quantum mechanics, the dynamic behavior of particles in quantum space can be described by Schrödinger equation. In the QPSO algorithm, the wave function in the Schrödinger equation is used to express the position of the particles in the quantum particle space. The wave function of a particle with the position ofXi,jt+1 in each dimension for pi,j can be obtained as follows:(3)ψXi,jt+1=1Li,jtexp−Xi,jt+1−pi,jtLi,jt.After the probability density function for a particle appearing at a certain point in the quantum space is calculated, the Monte Carlo method is employed to obtain the position equation of the particle. The position equation is given in the following equation:(4)xi,jt+1=pi,jt±Li,jt2ln1ui,jt,(5)ui,jt∼U0,1.TheLi,jt in equation (4) is the characteristic length of the potential well δ, which is calculated as follows:(6)Li,jt=2αmbestjt−xi,jt,where α is the contraction-expansion coefficient, the only parameter in the QPSO algorithm except from population size and iteration times.The mean best positionmbestt in equation (6) is the individual optimal mean of all particles, which is defined as follows:(7)mbestt=1M∑i=1MPit=1M∑i=1MPi1t,1M∑i=1MPi2t,…,1M∑i=1MPiDt.In equation (7), Pijt represents the individual best position of the jth dimension of the ith particle at the tth iteration. For minimization, the smaller the objective function value, the better the fitness it corresponds to. When the current position of the ith particle is Xit=Xi,1t,Xi,2t,…,Xi,Dt (i = 1, 2, …, M), the current individual optimal position of the ith particle can be updated through equation (8), where f is the object function. The current global optimal position Gt can be obtained through equation (9), where Gt=G1t,G2t,…,GDt:(8)Pit=Xit,if:fXit<fPit−1,Pit−1,if:fPit−1≤fXit,(9)Gt=Pgt,g=argmin1≤i≤MfPit.Finally, the evolution formula of the QPSO can be expressed as follows:(10)RPijt=φjt×Pijt+1−φjt×Gjt,(11)Xijt+1=RPijt+Randt×at×mbestt−Xijt×ln1uijt,where fijt=rad and uijt=rad; the function radf produces a random number that is uniformly distributed between [0, 1]; the function Randt in equation (11) is given as follows:(12)Randt=−1,if:radf<0.5,+1,if:radf>0.5.M is the total number of particles; D is the dimension of the particle; RPijt is the random point between the individual optimal position of the ith particle at the jth dimension Pijt and the global optimal position at the jth dimension Gjt; φjt is the random number between [0, 1]; and at represents the contraction-expansion coefficient of QPSO, which is an important parameter of convergence. The value of at depends on the situation, which can be dynamically changed in a certain way. The variable at can be determined according to the following formula:(13)at=m−m−n×1MaxTimes.Them and n in equation (13) usually are set as 1 and 0.5, and the MaxTimes represent the maximum number of iterations.The flow of the QPSO algorithm is stated in detail as follows:(1)
Randomly initialize the initial position ofM particles Xi0, and set the current best position of each particle as Pi0=Xi0; the initial global optimal value is the minimum value of the local optimal values of all current particles (assuming to find the minimum value of the function as an example), which is Pg0=minX10,X20,…,XD0(2)
Calculate the fitness value of particles according to object functionfXit(3)
Update current position of each particleXit based on the calculated current fitness value(4)
Compare the last individual optimal valuesPit−1 with current position of each particle Xit to update current individual optimal position of each particle Pit through equation (8) and update current global optimal position Gt through equation (9)(5)
Compare current global optimal positionGt with last global optimal position Gt−1, if fGt<fGt−1, Gt updates as the global optimal position; otherwise, Gt−1 remains the global optimal position (for minimization)(6)
Calculate mean best positionmbestt according to equation (7)(7)
For each dimension of the particle, calculate random pointRPijt between Pijt and Gjt according to equation (6)(8)
Update new position of each particleXit+1 based on equations (10) and (11)(9)
Repeat Step 2 to Step 8, until iteration MaxTimes is met


## 3. Experimental System

### 3.1. Specimen and Solution

Specimens fabricated from the sheet of Q235A pipelines were used, and the chemical composition in wt.% is shown in Table1. Q235A steel is Class A ordinary carbon structural steel with a yield of strength of 235 MPa and a carbon content of 0.13∼0.22%, which corresponds to Cr. D in America, 080A15 in UK, and E235B in ISO [37]. The specimens of 20 mm × 20 mm × 7 mm in size were adopted, and all the surfaces were subsequently grounded with 80, 240, 400, 600, 800, 1000, 1500, 2000, and 5000 sandpaper and cleaned by acetone and anhydrous ethanol. The epoxy resin was utilized to isolate the contact of the other five faces with the NaCl solution, and a working surface of 20 mm × 20 mm was left for the stray current corrosion.Table 1
Element composition of Q235A specimen.
C
Si
Mn
P
S
As
Alt
V
Nb
Ti
Cu
Ni
Cr
Mo
B
N
Ceq
10–2
10–2
10–2
10–3
10–3
10–3
10–3
10–3
10–3
10–3
10–2
10–2
10–2
10–4
10–4
10–4
10–2
13
19
49
28
19
10
1
2
2
1
1
1
3
1
1
37
22In this paper, the accelerated simulation corrosion was conducted by the experimental system shown in Figure2. A DC power supply is employed to apply the excitation of 0.0125 A/cm2, 0.025 A/cm2, 0.05 A/cm2, and 0.075 A/cm2, respectively. The input current is chosen based on the previous field test in a DC transit system with a directly grounded scheme, which is conducted through a noncontact fibre-optic current sensor embedded in the flange joint of the buried pipeline [37]. When the stray current corrosion was conducted for 10 min, the Tafel curve was tested until a total corrosion time of 60 min is reached. In this experimental system, the time of each corrosion interval is realized through the switch S1. A system of three electrodes was used in the corrosion cell. The preparation of NaCl solution was carried out using the chemically analytical grade reagents, the pH of which is 7.1. The concentration of NaCl solution is 0.05 mol/L, 0.1 mol/L, 0.2 mol/L, and 0.3 mol/L, respectively. The redox characteristic was changed by adding FeCl3 to the solution.Figure 2
Experimental system of electrochemical corrosion under the coupling excitation of stray current and Cl− ion.The counter electrode used in this experiment is a 4 cm2 Ti electrode, and the reference electrode is a saturated calomel electrode (SCE). The potential values shown here and in the next are of the relative SCE. There is a maintained gap of 15 mm between the counterelectrode and counterelectrode during each measurement. A CHI604e electrochemical workstation was employed as the electrochemical measurement instrument. During electrochemical testing, the test loop is independent of the applied DC loop. Each time before the testing of Tafel polarization curves, the open-circuit potential (OCP) needs to be measured to ensure scanning range. The potential scanning direction in the Tafel method is from negative to positive. The potential range of each scan is based on the testing result of OCP. The scanning rate utilized in the Tafel method was set to 2 mV/s. All experiments were performed in an indoor environment at 20°C. The solution remained undisturbed during polarization curve measurement.


### 3.2. Experimental Results and Database

In the case of excitation amplitude of 0.025 A/cm2, the polarization curve under stray current corrosion in the initial oxidation-reduction potential of 230 mV and 0.2 mol/L NaCl is shown in Figure 3. The complete cathode and anode processes are exhibited on the polarization curve in Figure 3 during the stray current corrosion of different electrolyte concentrations. Taking the curve of 10 min as an example, there is an exponential increase of icorr due to the oxidation reaction of steel electrode in the anodic polarization zone, which can be explained by Bulter–Volmer equation. The Bulter–Volmer equation is given in equation (14), where I is the polarization current, Ia is the anodic current, Ic is the cathodic current, Icorr is the corrosion current, E represents the applied potential, Ecorr represents the corrosion potential, βa is the anode Tafel slope, and βc is the cathode Tafel slope. Under this circumstance, the corrosion current density measured at different corrosion time is illustrated in Figure 4. The corrosion current density icorr increases nonlinearly with the increasing corrosion time, while the linear polarization resistance decreases:(14)I=Ia−Ic=IcorrexpE−Ecorrβa−expE−Ecorrβc.Figure 3
Experimental results of stray current corrosion on Q235A steel test samples.Figure 4
Electrochemical parameters during stray current corrosion on Q235A steel test samples.The experimental database is obtained from the electrochemical corrosion experiment stated above. The stray current densityIs, corrosion time tcorr, chloride concentration Cl%, and oxidation-reduction potential ORP were set as input valuables. The corrosion current density icorr was set as output valuable. The correlation coefficient values between input variables and icorr were calculated to demonstrate that there is a strong correlation between these parameters and icorr, as shown in Figure 5. The correlations were investigated using Pearson’s, Spearman’s, and Kendall’s correlation coefficients. The absolute correlation coefficients of four input variables range from 0.6071 to 0.8680, which indicates that these parameters are of great significance in predicting the icorr in the QPSO-NN model.Figure 5
Correlation coefficient between input variables andicorr.


## 3.1. Specimen and Solution

Specimens fabricated from the sheet of Q235A pipelines were used, and the chemical composition in wt.% is shown in Table1. Q235A steel is Class A ordinary carbon structural steel with a yield of strength of 235 MPa and a carbon content of 0.13∼0.22%, which corresponds to Cr. D in America, 080A15 in UK, and E235B in ISO [37]. The specimens of 20 mm × 20 mm × 7 mm in size were adopted, and all the surfaces were subsequently grounded with 80, 240, 400, 600, 800, 1000, 1500, 2000, and 5000 sandpaper and cleaned by acetone and anhydrous ethanol. The epoxy resin was utilized to isolate the contact of the other five faces with the NaCl solution, and a working surface of 20 mm × 20 mm was left for the stray current corrosion.Table 1
Element composition of Q235A specimen.
C
Si
Mn
P
S
As
Alt
V
Nb
Ti
Cu
Ni
Cr
Mo
B
N
Ceq
10–2
10–2
10–2
10–3
10–3
10–3
10–3
10–3
10–3
10–3
10–2
10–2
10–2
10–4
10–4
10–4
10–2
13
19
49
28
19
10
1
2
2
1
1
1
3
1
1
37
22In this paper, the accelerated simulation corrosion was conducted by the experimental system shown in Figure2. A DC power supply is employed to apply the excitation of 0.0125 A/cm2, 0.025 A/cm2, 0.05 A/cm2, and 0.075 A/cm2, respectively. The input current is chosen based on the previous field test in a DC transit system with a directly grounded scheme, which is conducted through a noncontact fibre-optic current sensor embedded in the flange joint of the buried pipeline [37]. When the stray current corrosion was conducted for 10 min, the Tafel curve was tested until a total corrosion time of 60 min is reached. In this experimental system, the time of each corrosion interval is realized through the switch S1. A system of three electrodes was used in the corrosion cell. The preparation of NaCl solution was carried out using the chemically analytical grade reagents, the pH of which is 7.1. The concentration of NaCl solution is 0.05 mol/L, 0.1 mol/L, 0.2 mol/L, and 0.3 mol/L, respectively. The redox characteristic was changed by adding FeCl3 to the solution.Figure 2
Experimental system of electrochemical corrosion under the coupling excitation of stray current and Cl− ion.The counter electrode used in this experiment is a 4 cm2 Ti electrode, and the reference electrode is a saturated calomel electrode (SCE). The potential values shown here and in the next are of the relative SCE. There is a maintained gap of 15 mm between the counterelectrode and counterelectrode during each measurement. A CHI604e electrochemical workstation was employed as the electrochemical measurement instrument. During electrochemical testing, the test loop is independent of the applied DC loop. Each time before the testing of Tafel polarization curves, the open-circuit potential (OCP) needs to be measured to ensure scanning range. The potential scanning direction in the Tafel method is from negative to positive. The potential range of each scan is based on the testing result of OCP. The scanning rate utilized in the Tafel method was set to 2 mV/s. All experiments were performed in an indoor environment at 20°C. The solution remained undisturbed during polarization curve measurement.


## 3.2. Experimental Results and Database

In the case of excitation amplitude of 0.025 A/cm2, the polarization curve under stray current corrosion in the initial oxidation-reduction potential of 230 mV and 0.2 mol/L NaCl is shown in Figure 3. The complete cathode and anode processes are exhibited on the polarization curve in Figure 3 during the stray current corrosion of different electrolyte concentrations. Taking the curve of 10 min as an example, there is an exponential increase of icorr due to the oxidation reaction of steel electrode in the anodic polarization zone, which can be explained by Bulter–Volmer equation. The Bulter–Volmer equation is given in equation (14), where I is the polarization current, Ia is the anodic current, Ic is the cathodic current, Icorr is the corrosion current, E represents the applied potential, Ecorr represents the corrosion potential, βa is the anode Tafel slope, and βc is the cathode Tafel slope. Under this circumstance, the corrosion current density measured at different corrosion time is illustrated in Figure 4. The corrosion current density icorr increases nonlinearly with the increasing corrosion time, while the linear polarization resistance decreases:(14)I=Ia−Ic=IcorrexpE−Ecorrβa−expE−Ecorrβc.Figure 3
Experimental results of stray current corrosion on Q235A steel test samples.Figure 4
Electrochemical parameters during stray current corrosion on Q235A steel test samples.The experimental database is obtained from the electrochemical corrosion experiment stated above. The stray current densityIs, corrosion time tcorr, chloride concentration Cl%, and oxidation-reduction potential ORP were set as input valuables. The corrosion current density icorr was set as output valuable. The correlation coefficient values between input variables and icorr were calculated to demonstrate that there is a strong correlation between these parameters and icorr, as shown in Figure 5. The correlations were investigated using Pearson’s, Spearman’s, and Kendall’s correlation coefficients. The absolute correlation coefficients of four input variables range from 0.6071 to 0.8680, which indicates that these parameters are of great significance in predicting the icorr in the QPSO-NN model.Figure 5
Correlation coefficient between input variables andicorr.


## 4. Corrosion Current Density Prediction Framework

### 4.1. Overall Framework and Algorithm Description

The whole prediction algorithm can be divided into preparation phase, optimization phase, training phase, and prediction phase. The backpropagation (BP) learning is to generate a final prediction model. The QPSO algorithm is employed to search for the suitable connection weights and biases for the initial structure of the neural network. The framework of the QPSO-NN method for predicting corrosion current density is shown in Figure6. In the QPSO-NN algorithm, the NN training process is embedded in the fitness calculation function for processing. The NN training phase is continuously cycled throughout the prediction algorithm. The algorithm flow is given specifically as follows:(1)
Prepare the training and validation data sets and set the training ratio, validation ratio, and testing ratio in data normalization process(2)
Initialize the input weights, output weights, and hidden biases of NN structure, establish the initial NN model, and initialize the vector containing optimization object(3)
Update particles according to the QPSO evolution equations (10) and (11), which has been stated in Section 2(4)
Update the parameters for each particle according to the global optimal solutiongbest in the QPSO algorithm(5)
When the weights and the hidden biases are updated, the NN model will be correspondingly updated with new parameters(6)
Calculate the fitness according to the prediction results with the training data sets. (the fitness calculation method will be explained detailedly in equation (16))(7)
Judge whether meeting end of criterion, if yes, obtain the optimal input weights, output weights, and the hidden biases; if not, jump to step 3(8)
Establish the optimal NN model based on the optimization results returning from QPSO (optimized weights and biases)(9)
Predict corrosion current density based on the built QPSO-NN model(10)
Evaluate prediction results of corrosion current densityFigure 6
Structure of the ANN and encoding details in QPSO.


### 4.2. Technical Details

The ratio of training set, validation set, and testing set were preliminarily set as 70%, 15%, and 15%, respectively. The error minimization tolerance was set to 1%. The ANN training target was set to MSE of 0.01. The establishment, optimization, training, and testing of the QPSO-NN were carried out in the environment of MATLAB R2015b. The parameters of the QPSO-NN are given in Table2.Table 2
Parameters of the QPSO-ANN algorithm.
QPSO
Population size
80
Max iterations
300
Contraction-expansion coefficient
0.5
ANN
Number of input neurons
4
Number of output neurons
1
Transfer function in hidden layer
Tansig
Transfer function in output layer
Purelin
Learning rate
0.01
Training times
300The input weights, hidden biases, output weights, and output biases are the optimization target of the QPSO algorithm. The details of the QPSO-NN algorithm are shown in Figure7. The number of hidden nodes m remains to be determined in the next section.(1)
Encoding for particle in QPSO and pretreatment for data set in the NN: the structure of the ANN model is shown in Figure5. A position vector of particle pj is built up to store the parameter information of the ANN. The vector consists of four parts: input weights between input layer and hidden layer: ωih1,1,…,ωih4,1,…,ωih1,m,…,ωih4,m, hidden biases on hidden layer: θ1,1,θ1,2,…,θ1,m, output weights between hidden layer and output layer:ωho1,1,ωho2,1,…,ωhom,1, and output bias on output layer: θ2,1.(2)
Data normalization: before the training and optimization process in the QPSO-NN model, the data set needs to be normalized to induct statistical distribution of unified samples and eliminate the dimensional impact between input indicators. In this model, linear min-max normalization was employed. Taking the input parameter stray current densityIs as an example, the Isi is mapped to Isi∗ through equation the following equation:(15)Isi∗=Isi−IminImax−Imin,whereImin and Imax is the minimum and maximum of stray current density Is in the input samples.(3)
Optimization process in QPSO: in general, two termination conditions can be chosen: the max generationGmax is met or the deviation between adjacent generations is within a specified range [38]. In this model, the max generation Gmax is utilized as the termination condition. The particle pm (1≤m≤Gmax) is updated for each searching process until the Gmax is reached, as shown in Figure 6.(4)
Fitness function in the QPSO-NN model: when a search process is finished and a particle is updated with the determined weights and biases, the fitness of this particlepj needs to be calculated to evaluate the performance of these structure parameters of the ANN. In this model, the fitness function is defined as equation (16). The calculation results of fitness will be discussed in Section 5 to determine the best topological structure of the ANN:(16)fitnesspj=∑i=1batchabsIi−Ii′,whereIi is the real value of icorr, Ii′ is the predicted value of icorr, and batch is the number of training set during one training session.Figure 7
Structure of the ANN and encoding details in QPSO.


## 4.1. Overall Framework and Algorithm Description

The whole prediction algorithm can be divided into preparation phase, optimization phase, training phase, and prediction phase. The backpropagation (BP) learning is to generate a final prediction model. The QPSO algorithm is employed to search for the suitable connection weights and biases for the initial structure of the neural network. The framework of the QPSO-NN method for predicting corrosion current density is shown in Figure6. In the QPSO-NN algorithm, the NN training process is embedded in the fitness calculation function for processing. The NN training phase is continuously cycled throughout the prediction algorithm. The algorithm flow is given specifically as follows:(1)
Prepare the training and validation data sets and set the training ratio, validation ratio, and testing ratio in data normalization process(2)
Initialize the input weights, output weights, and hidden biases of NN structure, establish the initial NN model, and initialize the vector containing optimization object(3)
Update particles according to the QPSO evolution equations (10) and (11), which has been stated in Section 2(4)
Update the parameters for each particle according to the global optimal solutiongbest in the QPSO algorithm(5)
When the weights and the hidden biases are updated, the NN model will be correspondingly updated with new parameters(6)
Calculate the fitness according to the prediction results with the training data sets. (the fitness calculation method will be explained detailedly in equation (16))(7)
Judge whether meeting end of criterion, if yes, obtain the optimal input weights, output weights, and the hidden biases; if not, jump to step 3(8)
Establish the optimal NN model based on the optimization results returning from QPSO (optimized weights and biases)(9)
Predict corrosion current density based on the built QPSO-NN model(10)
Evaluate prediction results of corrosion current densityFigure 6
Structure of the ANN and encoding details in QPSO.


## 4.2. Technical Details

The ratio of training set, validation set, and testing set were preliminarily set as 70%, 15%, and 15%, respectively. The error minimization tolerance was set to 1%. The ANN training target was set to MSE of 0.01. The establishment, optimization, training, and testing of the QPSO-NN were carried out in the environment of MATLAB R2015b. The parameters of the QPSO-NN are given in Table2.Table 2
Parameters of the QPSO-ANN algorithm.
QPSO
Population size
80
Max iterations
300
Contraction-expansion coefficient
0.5
ANN
Number of input neurons
4
Number of output neurons
1
Transfer function in hidden layer
Tansig
Transfer function in output layer
Purelin
Learning rate
0.01
Training times
300The input weights, hidden biases, output weights, and output biases are the optimization target of the QPSO algorithm. The details of the QPSO-NN algorithm are shown in Figure7. The number of hidden nodes m remains to be determined in the next section.(1)
Encoding for particle in QPSO and pretreatment for data set in the NN: the structure of the ANN model is shown in Figure5. A position vector of particle pj is built up to store the parameter information of the ANN. The vector consists of four parts: input weights between input layer and hidden layer: ωih1,1,…,ωih4,1,…,ωih1,m,…,ωih4,m, hidden biases on hidden layer: θ1,1,θ1,2,…,θ1,m, output weights between hidden layer and output layer:ωho1,1,ωho2,1,…,ωhom,1, and output bias on output layer: θ2,1.(2)
Data normalization: before the training and optimization process in the QPSO-NN model, the data set needs to be normalized to induct statistical distribution of unified samples and eliminate the dimensional impact between input indicators. In this model, linear min-max normalization was employed. Taking the input parameter stray current densityIs as an example, the Isi is mapped to Isi∗ through equation the following equation:(15)Isi∗=Isi−IminImax−Imin,whereImin and Imax is the minimum and maximum of stray current density Is in the input samples.(3)
Optimization process in QPSO: in general, two termination conditions can be chosen: the max generationGmax is met or the deviation between adjacent generations is within a specified range [38]. In this model, the max generation Gmax is utilized as the termination condition. The particle pm (1≤m≤Gmax) is updated for each searching process until the Gmax is reached, as shown in Figure 6.(4)
Fitness function in the QPSO-NN model: when a search process is finished and a particle is updated with the determined weights and biases, the fitness of this particlepj needs to be calculated to evaluate the performance of these structure parameters of the ANN. In this model, the fitness function is defined as equation (16). The calculation results of fitness will be discussed in Section 5 to determine the best topological structure of the ANN:(16)fitnesspj=∑i=1batchabsIi−Ii′,whereIi is the real value of icorr, Ii′ is the predicted value of icorr, and batch is the number of training set during one training session.Figure 7
Structure of the ANN and encoding details in QPSO.


## 5. Corrosion Current Density Prediction and Results Analysis

### 5.1. Training Process

In this section, the effectiveness of the QPSO-NN is validated through experiments on the experimental data. The work in this paper is mainly to improve the performance of the traditional NN for theicorr prediction problem in the process of stray current corrosion. Hence, the specific contrast between the QPSO-NN algorithm and the basic PSO-NN algorithm and the proposed QPSO-NN algorithm is indispensable in the next section. In the experiments, the QPSO-NN and the PSO-NN were implemented on MATLAB software, and the prediction process of the BPNN was realized by using the toolbox in the MATLAB. There is one more important parameter that needs to be determined, which is the number of hidden nodes in the NN. The number of hidden nodes in the NN is selected according to the calculation results. Figure 8 gives the value of fitness function corresponding to the number of hidden nodes. It can be observed from Figure 6 that the lowest validation is achieved, when the number of hidden nodes is 7. Thus, the basic topological structure of the QPSO-NN is determined as 4-7-1.Figure 8
Fitness versus number of hidden nodes in the ANN.The experiments were performed on a computer running 64 bits Windows 10 system. In order to perform quantitative comparison, the following indexes are used to measure the performance of each prediction model, such as the precision, mean absolute error (MAE), mean square error (MSE), root mean square error (RMSE), proportional error (PERR), and coefficient of determination:(17)precision=Ii′−IiIi×100%,MAE=∑i=1nIi′−Iin,MSE=∑i=1nIi′−Ii2n,RMSE=∑i=1nIi′−Ii2n,PERR=∑i=1nIi′−Ii2∑i=1nIi2,R2=1−∑i=1nIi′−Ii2∑i=1nIi−I¯2,where n is the number of samples; i ∈ [1, n]; Ii′ is the predicted value; Ii is the measured value; and I¯ is the mean value of Ii.


### 5.2. QPSO-NN vs. BPNN and PSO-NN

Comparative study needs to be conducted first to determine the proposed model for corrosion current density is effective. While comparing the QPSO-NN with the BPNN and PSO-NN, 100 runs are repeated to get the average value of prediction results. Based on the prediction results in Table3, a higher prediction accuracy of the QPSO-NN is always observed regardless of the proportion of training set, compared to the BPNN and PSO-NN. There is about 7 to 9 percent difference in prediction accuracy between BPNN and QPSO-NN, while the difference between the PSO-NN and the QPSO-NN is about 5 to 6 percent. The biggest difference in accuracy between the BPNN and the QPSO-NN is 9.39%, while the biggest difference between the PSO-NN and the QPSO-NN is 6.64%. To quantitatively verify the advantage of the QPSO-NN over traditional algorithms, an analysis of variance (ANOVA) test is employed for evaluating the difference among the BPNN, PSO-NN, and QPSO-NN. As can be seen from the 6th and 8th column in Table 4, the P values of the data column among the BPNN, PSO-NN, and QPSO-NN in all cases of the proportion of all training set are far less than 1 × 10−4. Thus, a conclusion can be drawn from Table 4 that the proposed QPSO-NN model is obviously more applicable than the PSO-NN and BPNN for this prediction problem.Table 3
Comparison on prediction among the QPSO-NN, PSO-NN, and BPNN.
Ratio of training set (%)
Prediction precision and ANOVA test
BPNN (x) (%)
PSO-NN (y) (%)
QPSO-NN (z) (%)
z–y (%)
P value
z–x (%)
P value
40
80.12
82.87
89.51
6.64
8.65 × 10−7
9.39
4.13 × 10−13
50
80.23
84.03
89.65
5.62
1.12 × 10−7
9.42
1.39 × 10−9
60
81.26
84.26
90.11
5.85
1.03 × 10−7
8.85
1.68 × 10−11
70
82.75
85.10
90.23
5.13
5.99 × 10−8
7.48
1.22 × 10−11
80
83.33
85.80
91.34
5.54
3.49 × 10−5
8.01
1.26 × 10−11
90
83.41
86.02
91.95
5.93
1.67 × 10−6
8.54
6.29 × 10−18Table 4
Evaluation indexes on prediction results.
Error
BPNN
PSO-NN
QPSO-NN
MAE
0.0837
0.0720
0.0454
MSE
0.0110
0.0097
0.0039
RMSE
0.1047
0.0983
0.0624
PERR
0.5478
0.4830
0.1949Although the precision of the QPSO-NN model is proved to be better than the PSO-NN and the BPNN model through the general statistics analysis like mean value, the comparison conducted above is rough. Furthermore, a deeper analysis is indispensable to be carried out. In this analysis, the accuracy distribution of each algorithm is conducted after running 100 times. The corresponding results of the BPNN, PSO-NN, and QPSO-NN with six different proportions of training set are illustrated in Figure9. With the ratio of the training set increasing from 40% to 80% in Figures 9(a)–9(e), the distribution range of QPSO-NN’s accuracy in 100 trials is smaller than that of QPSO-NN’s and BPNN’s. The QPSO-NN exhibits a better performance and higher stability than the PSO-NN and BPNN in the prediction problem of corrosion current density induced by stray current. Thus, the strategy of using QPSO instead of PSO to optimize neural networks is effective, which improves the accuracy of the prediction. In the case of ratio = 90%, the highest and lowest prediction is 98.32% and 81.22%, and the mean precision is 91.95%.Figure 9
Precision distributions of three algorithms in different training set ratios: (a) 40%; (b) 50%; (c) 60%; (d) 70%; (e) 80%; (f) 90%.
(a)
(b)
(c)
(d)
(e)
(f)Next, the effect on prediction precision due to different proportions of training set is analysed in this section. The effect of ratio on the precision results is shown in Figure10. No matter the population size is 60 or 80, the prediction precision of the QPSO-NN, PSO-NN, and BPNN gradually increases with the increasing proportion of the training set. With population size of 60, the precision increases from 88.60% to 90.77%. The precision increases from 89.51% to 91.95% when the population size is 80. Thus, the precision is improved by 2.17% and 2.44%, which indicates that the ratio of training set has little influence on the prediction accuracy.Figure 10
The impact on precision caused by ratio of training set. (a) Population size = 60; (b) population size = 80.
(a)
(b)When the ratio of training set is 80% and parameters are used as given in Table2, the prediction results of the QPSO-NN, PSO-NN, and BPNN are intuitively illustrated in Figure 11. The testing set contains 50 samples. The precision of three algorithms is 82.86%, 85.38%, and 90.32%, respectively. Compared with the BPNN and PSO-NN, the predicted results of the PSO-NN are more consistent with the measured results. The evaluation indexes MAE, MSE, and RMSE are shown in Table 4. The MAE, MSE, RMSE, and PERR of prediction results in the QPSO-NN model are smaller than those in the BPNN model and PSO-NN model, which also indicates the prediction accuracy of the QPSO-NN is better than the BPNN and PSO-NN from another point of view.Figure 11
Prediction results of the QPSO-NN model, PSO-NN model, and BPNN model.The regression lines between tested and predicted values of three algorithms are displayed in Figure12. The correlation coefficient of determination R2 is calculated so as to test how well the model fits the sample observations. The model is considered to be more successful when the R2 is close to 1. The correlation coefficient of determination for the BPNN, PSO-NN, and QPSO-NN is 0.9440, 0.9552, and 0.9867, respectively. The regression lines are given in equations (18)–(20). The results of correlation coefficient also demonstrate that the QPSO-NN model shows better accuracy than the PSO-NN model and BPNN model:(18)Regression Line1:y=0.8826x+0.0425,(19)Regression Line2:y=0.9158x+0.0575,(20)Regression Line3:y=1.0760x−0.0222.Figure 12
Regression lines between measured values and predicted values of three algorithms. (a) BPNN model; (b) PSO-NN model; (c) QPSO-NN model.
(a)
(b)
(c)Based on the comparison analysis from multiple aspects in this section, a higher precision is achieved by the QPSO-NN model regardless of the ratio of the training set. In terms of computational efficiency, the QPSO-NN model costs a relatively longer time than the BPNN due to the optimization process of the QPSO algorithm. Since the corrosion is a long-term process, real-time performance is not a major factor in corrosion current density prediction, which means the offline analysis can be performed based on the collected data. Therefore, the model based on the QPSO-NN algorithm is feasible and more resultful for this prediction problem.


### 5.3. Analysis of Training Times of NN

The parameter of training times represents the times of iterations for optimizing the configuration of a neural network during the training process [39], which affects the performance of the neural network. To investigate its effect on the prediction accuracy, the corrosion current density prediction under two different proportions of training set (60% and 80%) is conducted with varied training times of the NN. The results are illustrated in Figure 13.Figure 13
Prediction precision versus training times of NN. (a) Ratio of training set = 60%; (b) ratio of training set = 80%.
(a)
(b)Based on the results in Figure13, with the ratio of training set = 60%, the average precision is 87.40% when the training times of the NN is 100, and the average precision is 90.44% when the training times of the NN is 400. When the training times of the NN is 100 and 400, the average precision is 88.13% and 91.62%, with the ratio of training set = 80%, respectively. In both cases, the average precision is improved by 3.04% and 3.49%. Thus, the training times of the NN have a little impact on the precision. However, there is no further increase in accuracy when the training times of the NN is bigger than 300, as can been seen from Figures 13(a) and 13(b). When the training times of the NN is bigger than 300, the increase of training times will not significantly improve the prediction accuracy but increase the algorithm runtime.In terms of distribution of precision, the mean precision is looser when the training times of the NN is small. With the increase in training times, the distribution of mean prediction is more concentrated, which indicates that the algorithm is more stable.


### 5.4. Analysis of Population Size

Generally speaking, the population size of whole particle is a significant parameter that has an impact on the convergence speed, accuracy, and stability of QPSO. In order to evaluate its impact on the QPSO-NN, the population size varies from 20 to 80, and then the results corresponding to each parameter are compared for difference.As can be seen from Figure14, the prediction accuracy of the QPSO-NN increases rapidly with the increasing population size no matter how much the proportion of the training set is. Furthermore, the mean precision is compared when the ratio of training set is 80% and 90%. In Figure 14(a), the average precision is 88.92% when the population size is 20 and the ratio of training set is 80%, while the average precision is 91.34% when the population size is 80 and the ratio of training set is 90%. In Figure 14(b), the average accuracy is 88.91% when the population size is 20, and the average precision is 91.95% when the population size is 80. When the population size varies from 20 to 80 in both cases, the average precision is increased by 2.42% and 3.04%.Figure 14
Prediction precision versus population size of QPSO. (a) Ratio of training set = 40%, 60%, and 80%; (b) ratio of training set = 30%, 50%, and 70%.
(a)
(b)


### 5.5. Analysis of Max Generation QPSO

The max generation of QPSO affects the optimization process to a large extent, which determines the effectiveness and efficiency of the search process. Therefore, it is essential to study the impact of the maximum generationGmax on the QPSO-NN. In this section, the max generation of QPSO was examined from 50 to 300, in the step of 50, with the ratio of training set = 60% and 80%, respectively. The prediction results are shown in Figure 15.Figure 15
Prediction precision versus max generation of QPSO. (a) Ratio of training set = 60%; (b) ratio of training set = 80%.
(a)
(b)It can be seen from Figure14 that QPSO-NN’s mean precision increases slowly with the increasing max generation QPSO. In Figure 15(a), the average precision is 87.31% when Gmax=50, while the average precision is 90.10% when Gmax=300. Under this circumstance, the prediction accuracy is improved by 2.79%. In Figure 15(b), the average precision is 89.16% when Gmax=50, while the average precision is 91.34% when Gmax=300. The prediction accuracy is improved by 2.18% on this occasion. Thus, the increasing max generation of QPSO makes little contribution to the improvement of precision.In addition, the mean precision is relatively loose-distributed in the lowGmax. When the Gmax increases, the distribution of mean precision becomes narrower, which means the prediction performance is more stable than the lower Gmax. However, the distribution of mean precision does not stay monotonically increasing over the Gmax but the trend is increasing.


## 5.1. Training Process

In this section, the effectiveness of the QPSO-NN is validated through experiments on the experimental data. The work in this paper is mainly to improve the performance of the traditional NN for theicorr prediction problem in the process of stray current corrosion. Hence, the specific contrast between the QPSO-NN algorithm and the basic PSO-NN algorithm and the proposed QPSO-NN algorithm is indispensable in the next section. In the experiments, the QPSO-NN and the PSO-NN were implemented on MATLAB software, and the prediction process of the BPNN was realized by using the toolbox in the MATLAB. There is one more important parameter that needs to be determined, which is the number of hidden nodes in the NN. The number of hidden nodes in the NN is selected according to the calculation results. Figure 8 gives the value of fitness function corresponding to the number of hidden nodes. It can be observed from Figure 6 that the lowest validation is achieved, when the number of hidden nodes is 7. Thus, the basic topological structure of the QPSO-NN is determined as 4-7-1.Figure 8
Fitness versus number of hidden nodes in the ANN.The experiments were performed on a computer running 64 bits Windows 10 system. In order to perform quantitative comparison, the following indexes are used to measure the performance of each prediction model, such as the precision, mean absolute error (MAE), mean square error (MSE), root mean square error (RMSE), proportional error (PERR), and coefficient of determination:(17)precision=Ii′−IiIi×100%,MAE=∑i=1nIi′−Iin,MSE=∑i=1nIi′−Ii2n,RMSE=∑i=1nIi′−Ii2n,PERR=∑i=1nIi′−Ii2∑i=1nIi2,R2=1−∑i=1nIi′−Ii2∑i=1nIi−I¯2,where n is the number of samples; i ∈ [1, n]; Ii′ is the predicted value; Ii is the measured value; and I¯ is the mean value of Ii.


## 5.2. QPSO-NN vs. BPNN and PSO-NN

Comparative study needs to be conducted first to determine the proposed model for corrosion current density is effective. While comparing the QPSO-NN with the BPNN and PSO-NN, 100 runs are repeated to get the average value of prediction results. Based on the prediction results in Table3, a higher prediction accuracy of the QPSO-NN is always observed regardless of the proportion of training set, compared to the BPNN and PSO-NN. There is about 7 to 9 percent difference in prediction accuracy between BPNN and QPSO-NN, while the difference between the PSO-NN and the QPSO-NN is about 5 to 6 percent. The biggest difference in accuracy between the BPNN and the QPSO-NN is 9.39%, while the biggest difference between the PSO-NN and the QPSO-NN is 6.64%. To quantitatively verify the advantage of the QPSO-NN over traditional algorithms, an analysis of variance (ANOVA) test is employed for evaluating the difference among the BPNN, PSO-NN, and QPSO-NN. As can be seen from the 6th and 8th column in Table 4, the P values of the data column among the BPNN, PSO-NN, and QPSO-NN in all cases of the proportion of all training set are far less than 1 × 10−4. Thus, a conclusion can be drawn from Table 4 that the proposed QPSO-NN model is obviously more applicable than the PSO-NN and BPNN for this prediction problem.Table 3
Comparison on prediction among the QPSO-NN, PSO-NN, and BPNN.
Ratio of training set (%)
Prediction precision and ANOVA test
BPNN (x) (%)
PSO-NN (y) (%)
QPSO-NN (z) (%)
z–y (%)
P value
z–x (%)
P value
40
80.12
82.87
89.51
6.64
8.65 × 10−7
9.39
4.13 × 10−13
50
80.23
84.03
89.65
5.62
1.12 × 10−7
9.42
1.39 × 10−9
60
81.26
84.26
90.11
5.85
1.03 × 10−7
8.85
1.68 × 10−11
70
82.75
85.10
90.23
5.13
5.99 × 10−8
7.48
1.22 × 10−11
80
83.33
85.80
91.34
5.54
3.49 × 10−5
8.01
1.26 × 10−11
90
83.41
86.02
91.95
5.93
1.67 × 10−6
8.54
6.29 × 10−18Table 4
Evaluation indexes on prediction results.
Error
BPNN
PSO-NN
QPSO-NN
MAE
0.0837
0.0720
0.0454
MSE
0.0110
0.0097
0.0039
RMSE
0.1047
0.0983
0.0624
PERR
0.5478
0.4830
0.1949Although the precision of the QPSO-NN model is proved to be better than the PSO-NN and the BPNN model through the general statistics analysis like mean value, the comparison conducted above is rough. Furthermore, a deeper analysis is indispensable to be carried out. In this analysis, the accuracy distribution of each algorithm is conducted after running 100 times. The corresponding results of the BPNN, PSO-NN, and QPSO-NN with six different proportions of training set are illustrated in Figure9. With the ratio of the training set increasing from 40% to 80% in Figures 9(a)–9(e), the distribution range of QPSO-NN’s accuracy in 100 trials is smaller than that of QPSO-NN’s and BPNN’s. The QPSO-NN exhibits a better performance and higher stability than the PSO-NN and BPNN in the prediction problem of corrosion current density induced by stray current. Thus, the strategy of using QPSO instead of PSO to optimize neural networks is effective, which improves the accuracy of the prediction. In the case of ratio = 90%, the highest and lowest prediction is 98.32% and 81.22%, and the mean precision is 91.95%.Figure 9
Precision distributions of three algorithms in different training set ratios: (a) 40%; (b) 50%; (c) 60%; (d) 70%; (e) 80%; (f) 90%.
(a)
(b)
(c)
(d)
(e)
(f)Next, the effect on prediction precision due to different proportions of training set is analysed in this section. The effect of ratio on the precision results is shown in Figure10. No matter the population size is 60 or 80, the prediction precision of the QPSO-NN, PSO-NN, and BPNN gradually increases with the increasing proportion of the training set. With population size of 60, the precision increases from 88.60% to 90.77%. The precision increases from 89.51% to 91.95% when the population size is 80. Thus, the precision is improved by 2.17% and 2.44%, which indicates that the ratio of training set has little influence on the prediction accuracy.Figure 10
The impact on precision caused by ratio of training set. (a) Population size = 60; (b) population size = 80.
(a)
(b)When the ratio of training set is 80% and parameters are used as given in Table2, the prediction results of the QPSO-NN, PSO-NN, and BPNN are intuitively illustrated in Figure 11. The testing set contains 50 samples. The precision of three algorithms is 82.86%, 85.38%, and 90.32%, respectively. Compared with the BPNN and PSO-NN, the predicted results of the PSO-NN are more consistent with the measured results. The evaluation indexes MAE, MSE, and RMSE are shown in Table 4. The MAE, MSE, RMSE, and PERR of prediction results in the QPSO-NN model are smaller than those in the BPNN model and PSO-NN model, which also indicates the prediction accuracy of the QPSO-NN is better than the BPNN and PSO-NN from another point of view.Figure 11
Prediction results of the QPSO-NN model, PSO-NN model, and BPNN model.The regression lines between tested and predicted values of three algorithms are displayed in Figure12. The correlation coefficient of determination R2 is calculated so as to test how well the model fits the sample observations. The model is considered to be more successful when the R2 is close to 1. The correlation coefficient of determination for the BPNN, PSO-NN, and QPSO-NN is 0.9440, 0.9552, and 0.9867, respectively. The regression lines are given in equations (18)–(20). The results of correlation coefficient also demonstrate that the QPSO-NN model shows better accuracy than the PSO-NN model and BPNN model:(18)Regression Line1:y=0.8826x+0.0425,(19)Regression Line2:y=0.9158x+0.0575,(20)Regression Line3:y=1.0760x−0.0222.Figure 12
Regression lines between measured values and predicted values of three algorithms. (a) BPNN model; (b) PSO-NN model; (c) QPSO-NN model.
(a)
(b)
(c)Based on the comparison analysis from multiple aspects in this section, a higher precision is achieved by the QPSO-NN model regardless of the ratio of the training set. In terms of computational efficiency, the QPSO-NN model costs a relatively longer time than the BPNN due to the optimization process of the QPSO algorithm. Since the corrosion is a long-term process, real-time performance is not a major factor in corrosion current density prediction, which means the offline analysis can be performed based on the collected data. Therefore, the model based on the QPSO-NN algorithm is feasible and more resultful for this prediction problem.


## 5.3. Analysis of Training Times of NN

The parameter of training times represents the times of iterations for optimizing the configuration of a neural network during the training process [39], which affects the performance of the neural network. To investigate its effect on the prediction accuracy, the corrosion current density prediction under two different proportions of training set (60% and 80%) is conducted with varied training times of the NN. The results are illustrated in Figure 13.Figure 13
Prediction precision versus training times of NN. (a) Ratio of training set = 60%; (b) ratio of training set = 80%.
(a)
(b)Based on the results in Figure13, with the ratio of training set = 60%, the average precision is 87.40% when the training times of the NN is 100, and the average precision is 90.44% when the training times of the NN is 400. When the training times of the NN is 100 and 400, the average precision is 88.13% and 91.62%, with the ratio of training set = 80%, respectively. In both cases, the average precision is improved by 3.04% and 3.49%. Thus, the training times of the NN have a little impact on the precision. However, there is no further increase in accuracy when the training times of the NN is bigger than 300, as can been seen from Figures 13(a) and 13(b). When the training times of the NN is bigger than 300, the increase of training times will not significantly improve the prediction accuracy but increase the algorithm runtime.In terms of distribution of precision, the mean precision is looser when the training times of the NN is small. With the increase in training times, the distribution of mean prediction is more concentrated, which indicates that the algorithm is more stable.


## 5.4. Analysis of Population Size

Generally speaking, the population size of whole particle is a significant parameter that has an impact on the convergence speed, accuracy, and stability of QPSO. In order to evaluate its impact on the QPSO-NN, the population size varies from 20 to 80, and then the results corresponding to each parameter are compared for difference.As can be seen from Figure14, the prediction accuracy of the QPSO-NN increases rapidly with the increasing population size no matter how much the proportion of the training set is. Furthermore, the mean precision is compared when the ratio of training set is 80% and 90%. In Figure 14(a), the average precision is 88.92% when the population size is 20 and the ratio of training set is 80%, while the average precision is 91.34% when the population size is 80 and the ratio of training set is 90%. In Figure 14(b), the average accuracy is 88.91% when the population size is 20, and the average precision is 91.95% when the population size is 80. When the population size varies from 20 to 80 in both cases, the average precision is increased by 2.42% and 3.04%.Figure 14
Prediction precision versus population size of QPSO. (a) Ratio of training set = 40%, 60%, and 80%; (b) ratio of training set = 30%, 50%, and 70%.
(a)
(b)


## 5.5. Analysis of Max Generation QPSO

The max generation of QPSO affects the optimization process to a large extent, which determines the effectiveness and efficiency of the search process. Therefore, it is essential to study the impact of the maximum generationGmax on the QPSO-NN. In this section, the max generation of QPSO was examined from 50 to 300, in the step of 50, with the ratio of training set = 60% and 80%, respectively. The prediction results are shown in Figure 15.Figure 15
Prediction precision versus max generation of QPSO. (a) Ratio of training set = 60%; (b) ratio of training set = 80%.
(a)
(b)It can be seen from Figure14 that QPSO-NN’s mean precision increases slowly with the increasing max generation QPSO. In Figure 15(a), the average precision is 87.31% when Gmax=50, while the average precision is 90.10% when Gmax=300. Under this circumstance, the prediction accuracy is improved by 2.79%. In Figure 15(b), the average precision is 89.16% when Gmax=50, while the average precision is 91.34% when Gmax=300. The prediction accuracy is improved by 2.18% on this occasion. Thus, the increasing max generation of QPSO makes little contribution to the improvement of precision.In addition, the mean precision is relatively loose-distributed in the lowGmax. When the Gmax increases, the distribution of mean precision becomes narrower, which means the prediction performance is more stable than the lower Gmax. However, the distribution of mean precision does not stay monotonically increasing over the Gmax but the trend is increasing.


## 6. Conclusions

In this paper, a QPSO-NN model was proposed to predict the corrosion current densityicorr under the coupling effect of stray current and Cl− ion, in which the corrosion time tcorr, oxidation-reduction potential ORP, stray current density Is, and chloride ion concentration Cl% were set as input variables. The database was generated from a stray current electrochemical experiment. The QPSO-driven neural network was compared with the BPNN model and PSO-NN model and proved to be with better accuracy. Compared to the BPNN model and PSO-NN model, the prediction accuracy of the QPSO-NN model is more stable. The best average prediction accuracy of the QPSO-NN during 100 trials is 91.95%.The proposed model indicates that the QPSO-NN model exhibits a theoretical value in the prediction of corrosion current densityicorr under the coupling effect of stray current and Cl− ion. The max generation of QPSO, training times of the NN, ratio of training set, and population size of QPSO show little impact on the precision of prediction accuracy. The model built up provided the possibility to monitor the corrosion status of buried metallic pipeline based on the information measured without excavation.The proposed model is designed for the prediction of corrosion current density for Q235A steel. However, buried pipelines contain a variety of metals, stray current corrosion characteristics of which are different. Future work will concentrate on predicting the corrosion current density under the coupling action of stray current and multiple ions regardless of the type of buried pipeline metal. To establish the prediction model dealing with different pipeline metals, new database has to be created through extra electrochemical experiments.



---

*Source: 3429816-2019-10-31.xml*