PREDICTION MODEL OF WAX DEPOSITION RATE BASED ON WOA-BPNN ALGORITHM such as Frontiers in Heat and

BSTRACT A model for predicting wax deposition rate in pipeline transportation is constructed to predict wax deposition in actual pipeline, which can provide decision support for the flow guarantee of waxy crude oil in pipeline transportation. This paper analyzes the working principle of Back Propagation Neural Networks (BPNN). Aiming at the problems of BPNN model, such as over learning, long training time, low generalization ability and easy to fall into local minimum, the paper proposes an improved scheme of using Whale Optimization Algorithm (WOA) to optimize BPNN model(WOA-BPNN).Taking 38 groups of crude oil wax deposition experimental data in Huachi operation area as an example, the simulation calculation is carried out in MATLAB, and the Genetic Algorithm optimized BPNN(GA-BPNN) and the non Optimized BP neural network are used as comparative models for comparative analysis. The results show that the Mean Relative Error ( MRE ) of WOA-BPNN model in predicting wax deposition rate is 2.72% and the coefficient of determination( R 2 ) is 0.9966, which are better than those of BPNN and GA-BPNN models. It is proved that WOA-BPNN model has higher accuracy and robustness in predicting wax deposition


1.INTRODUCTION
In the process of pipeline transportation of waxy crude oil, wax deposition has always been a major problem in the process of oil exploitation and transportation. Due to the heat transfer to the external environment during the pipeline transportation process, when the temperature of the pipeline decreases to the wax precipitation point, heavy components such as the wax, colloid and asphaltene in the crude oil will deposit on the pipe wall (Liu et al., 2021;Huang et al., 2016). Wax deposition will reduce the flow area of the pipeline, increase the transmission friction resistance, and reduce the transmission efficiency. In serious cases, it may cause pipeline blockage and shutdown and other accidents, which can not guarantee the safe and economic operation of the pipeline (Quan et al., 2014;Lou et al., 2018;Ye et al., 2018;Liu et al., 2017;Fan et al., 2020). With the joint efforts of many scholars, the research on single-phase wax deposition model has been more mature. The models can be roughly divided into thermodynamic model, dynamic model and computer-based training model (Su et al., 2016). The thermodynamic model mainly predicts the parameters such as wax precipitation point and wax precipitation amount based on the thermodynamic theory of phase equilibrium and phase transformation; The dynamic model is mainly based on the analysis of the deposition mechanism and influencing factors, the wax deposition experiment is carried out, and the wax deposition rate model is established; The computer-based training model mainly uses machine learning algorithm to train the experimental data of wax deposition, and directly predicts the wax deposition rate without considering the deposition mechanism. By applying the above wax deposition model to the actual pipeline, the wax deposition status of the actual pipeline can be predicted.
With the rapid development and application of computer technology, computer training models based on various intelligent algorithms have  Corresponding Author. E-mail: xiaorongge@163.com. also developed rapidly. Zhou Shidong et al considered the influence of the shear stress at the pipe wall, the temperature gradient at the pipe wall, the wax molecular concentration gradient at the pipe wall, and the dynamic viscosity of crude oil on the influence of the four factors on the wax deposition rate of the pipeline, and established the 4-7-1 three-layer BPNN model and stepwise regression method to predict wax deposition rate Zhou et al., 2003). The results show that the wax deposition rate based on artificial neural network method is more accurate than that based on stepwise regression analysis method . Tian Zhen et al comprehensively considered the influence of oil temperature, wall temperature, dynamic viscosity of crude oil, shear stress at pipe wall, flow velocity, temperature gradient at pipe wall and wax molecular concentration gradient at pipe wall on wax deposition rate in pipeline. A 7-10-1 three-layer BPNN model is established and the influence of the dimension of wax deposition rate on the prediction accuracy is analyzed. The results show that different initial weights and thresholds have a greater impact on the prediction accuracy and generalization ability, but the accuracy of the model is still within an acceptable range for the BP neural network model . Jin Wenbo et al predicted wax deposition rate based on least square support vector machine. Compared with BPNN model, this method can get intuitive functional expression . In recent years, Mirjalili et al proposed Whale Optimization Algorithm (WOA) inspired by the unique bubble net predation mechanism of whales (Mirjalili et al., 2016). Ma Hongguang et al used WOA algorithm to optimize the initial weights and thresholds of BPNN, and verified the feasibility of WOA-BP algorithm (Ma et al., 2020).
The wax deposition rate has many influencing factors and influences each other. The prediction of wax deposition rate is a multifactor nonlinear problem. However, the current artificial neural network method used for wax deposition rate prediction has problems such as

Frontiers in Heat and Mass Transfer
Available at www.ThermalFluidsCentral.org

BPNN Model
Artificial neural network is a highly complex nonlinear dynamic system composed of a large number of simple neurons. One of its main features is its learning function. By training samples, when all the actual outputs of the network are consistent with their ideal outputs, indicating the end of training; Otherwise, the learning process ends by modifying the weights until the actual output of the network is consistent with the ideal output (Yan et al., 1900). There are dozens of artificial neural network models, among which BPNN model is the most widely used (Li et al., 2008). BPNN generally adopts a three-layer network structure: an input layer for inputting relevant data information, a hidden layer for intermediate process calculation, and an output layer for outputting operation and simulation results. Its network topology diagram is shown in Figure 1. Among them, the input signal enters the neural network from the input layer, and is transmitted to the hidden layer node through the weighted operation, and then transmitted to the output layer node after being processed by the activation function. The output error is calculated by the loss function, back-propagated, and the weights and biases between neurons in each layer are continuously corrected to minimize the error. This is the basic step of BP neural network. The n nodes of the input layer respectively correspond to the input vector X= (x1, x2, …, xn), which is composed of n input components, the output vector y1 corresponding to 1 node in the output layer, the hidden layer node zj and the output node y1 are respectively calculated by Equation (1).

GA Model
Genetic Algorithm is an intelligent algorithm of "natural selection, survival of the fittest" based on biological evolution and genetics, which is proposed by Holland et al. Its main body is divided into three parts: selection, crossover and mutation (Ji, 2004;Zhou and Sun, 1999). 1) Choose. This part uses the classic roulette method, and its calculation is shown in Equation (2).
Where, m is the total number of chromosomes; fi is the fitness of the i-th individual; Pi is the probability that the i-th individual will be selected.
2) Crossover. This part adopts the real number crossover method, and its calculation is shown in Equation (3).
Where, xA t and xB t represent the intersection of chromosomes A and B at the t-th position; a is a random number between [0,1].
3) Mutation. This part is calculated as shown in Equation (4).
Where, xmin and xmax are the lower and upper bounds of genes; β is a random number between [0,1]; xk is a new gene after mutation.

WOA Model
Whale Optimization Algorithm is a population intelligence algorithm proposed by Mirjalili et al, who is inspired by humpback whale predation behavior. Its main body is divided into three parts: random hunting, encircling prey and preying prey (Guo and Zhao, 2021).
1) Random hunting. A feasible solution is obtained by simulating the random hunting of whales, and its calculation is shown in Equation Where, A and C are control parameter vectors; r is an arbitrary vector; tMaxlter is the maximum iterative algebra; A decreases from 2 to 0 with the increase of iteration times, thus realizing the shrinking surrounding mechanism; X* is the current optimal position vector; t is the current iteration number; D is the position measurement parameter; X is the position vector.
2) Encircling prey. The surround renewal position is expressed by spiral equation, and its calculation is shown in Equation (6).
Where, D' is the distance between the best position and the current position; l is any number in [-1, -2]; b is the constant of logarithmic spiral shape.
3 When the solution is solved, the shrinkage wrap and spiral update are carried out simultaneously, and each is given two ways 1/2 probability execution. Its calculation is shown in Equation (7).
Where, P is a random number of [0, 1]. 3) Preying prey. Update the best position by global search to achieve the optimal exploration process, and its calculation is shown in Equation (8). ( 1) Where, Xrand is the random position vector in the current generation; when |A|<1, use contraction and surround local optimization; when |A|≥ 1, use exploration global optimization.

Model Constructing
Combining the theoretical basis of each algorithm in Section 1, using GA and WOA algorithms to optimize the initial weights and thresholds of the BPNN model constructs the wax deposition rate prediction models GA-BPNN and WOA-BPNN of waxy crude oil. The specific model construction process is shown in Figure 2. Since the GA-BPNN model is relatively common, the following mainly introduces the construction steps of the WOA-BPNN model. First, initialize the BP neural network, including determining the initial structure of the neural network, as well as the initial weights and initial thresholds of the connected neurons; Then, convert the initial weight and initial threshold of the BPNN model into the position vector of humpback whales, set the population size, the maximum number of iterations, the initial minimum and maximum weights, and the convergence factor, and select the mean square error as the optimization objective function; Then find and record the individual position of the optimal fitness value, take it as the optimal individual position, and assign the optimized weights and threshold parameters to the BP neural network; Finally, the individual position is updated according to the position update strategy, and the operation is terminated until the maximum number of iterations or the accuracy requirement is met, and the optimal value is assigned to the BP neural network.

Evaluation Model
In order to verify the prediction results of GA-BPNN and WOA-BPNN models, Mean Relative Error (MRE)、Root Mean Square Error (RMSE) and coefficient of determination(R 2 ) are selected as evaluation indexes. Among them, the smaller the MRE and the RMSE, the larger the R 2 and the closer to 1, indicates that the prediction effect of the model is better. And its calculation is shown in Equation (9) (Ling X al., 2021).

Data Collection
The 38 sets of wax deposition experimental data of the crude oil in the Huachi operation area are selected, as shown in Table 1 (Wang X L, 2010). Randomly select 30 sets of data as training samples, and the remaining 8 sets of data as test samples to verify the prediction effect of the model.

BPNN Model Parameter Setting
Setting the training times of BPNN is 1000, the learning rate is 0.01, and the minimum error of training target is 0.000001. BPNN adopts threelayer network structure. For the prediction of wax deposition rate, the input layer should be the factors affecting wax deposition rate: oil temperature, wall temperature, dynamic viscosity of crude oil, shear stress at pipe wall, flow velocity, temperature gradient at pipe wall and wax molecular concentration gradient at pipe wall, so the number of input layers is 7; The output layer should be wax deposition rate, so the output layer is 1; The number of hidden layers can be determined according to empirical formula. In this paper, the number of hidden layers is determined according to Equation (10) (Guan F S al., 2021). After calculation, the value of m is 3 ~ 12, and Figure 3 can be obtained by substituting it into the model. It can be seen from Figure 3 that the optimal number of hidden layer nodes is 7, and the corresponding mean square error is 0.00109. Therefore, the number of hidden layers in this model is 7.

Model Initialization Settings
Through the above analysis, set the the network topology of GA-BPNN and WOA-BPNN model is 7-9-1. The initial parameter settings of each optimization algorithm are shown in Table 2 and Table 3. Maximum evolutionary algebra 50 Minimum error of training target 0.00001

RESULT ANALYSIS
The prediction results of each model after training are shown in the table 4. Prediction error pairs are shown in Figure 4. It can be seen from Table  4 that the maximum relative error of predicting wax deposition rate by using unoptimized BPNN model is 18.96%, and the minimum relative error is 0.57%; The maximum relative error of GA-BPNN model is 6.38%, the minimum relative error is 1.97%; The maximum relative error of WOA-BPNN model is 4.44%, and the minimum relative error is 0.27%. Compared with BPNN and GA-BPNN models, WOA-BP model has the smallest error interval and the smallest span, which proves the superiority of WOA-BPNN model in predicting wax deposition rate. The training models BPNN, GA-BPNN and WOA-BPNN are used to test data, and the MRE are 8.78%, 3.78% and 2.72%, respectively; The RMSE were 0.8937, 0.3966 and 0.3126 respectively. It is further verified that the prediction accuracy of BPNN optimized by WOA can be effectively improved.  Figure 4 that the wax deposition rate predicted by WOA-BPNN is the closest to the measured value, and its prediction accuracy has been greatly improved compared with the unoptimized BPNN, and the prediction accuracy of WOA-BPNN model is also better than that of GA-BPNN model. It can be seen from Figure 5 that, compared with the BPNN model, the relative error distribution of the wax deposition rate prediction models established by GA-BPNN and WOA-BPNN is more concentrated, and the error value is closer to the Xaxis, it is shown that optimizing the weights and thresholds of the BP neural network model by a certain improvement method can indeed improve the prediction accuracy of the BPNN model. Moreover, the relative error of the prediction results of the WOA-BPNN model is the smallest, and the relative error curve is the flattest, which not only reflects the high accuracy of the prediction results of the WOA-BPNN model, but also reflects the strong robustness of the model.
The correlation analysis between the wax deposition rate predicted by BPNN, GA-BPNN and WOA-BPNN models and the actual wax deposition rate is carried out. The results are shown in Figure 6-

CONCLUSIONS
(1) Based on the experimental data of crude wax deposition in Huachi operation area, the WOA-BPNN wax deposition rate prediction model is established by considering seven factors affecting wax deposition rate of waxy crude oil transported in pipeline, and optimizing the initial weights and thresholds of BPNN model by Whale Optimization Algorithm. The results show that the experimental values of wax deposition rate are in good agreement with the predicted values, so WOA-BPNN model can be used to predict wax deposition rate.
(2) The models of BPNN、GA-BPNN and WOA-BPNN were used to train and predict the wax deposition data. Among them, the Mean Relative Error of WOA-BPNN model is 2.72%, and the coefficient of determination R 2 is 0.9966, which are better than the prediction results of BPNN and GA-BPNN models. It is verified that WOA-BPNN model has high accuracy and strong robustness in predicting wax deposition rate. The application of WOA-BPNN model for wax deposition rate can provide decision support for the flow guarantee of waxy crude oil in pipeline transportation.