Standard friction prediction model of long-distance hot oil pipelines

We developed a predictive model for the pipeline friction in the 520–730 m3/h transmission range using the multi-layer-perceptron–back-propagation (MLP–BP) method and analyzing the unit friction data after the pigging of a hot oil pipeline. In view of the shortcomings of the MLP–BP model, two optimization methods, the genetic algorithm (GA) and mind evolutionary algorithm (MEA), were used to optimize the MLP–BP model. The research results were applied to the standard friction prediction of three sections of a hot oil pipeline. After the GA and MEA optimizations, the average errors of the three sections were 0.0041 MPa for the GA and 0.0012 MPa for the MEA, and the mean-square errors were 0.083 and 0.067, respectively. The MEA-BP model prediction results were characterized by high precision and small dispersion. The MEA-BP prediction model was applied to the analysis of the wax formation 60 and 90 days after pigging. The analysis results showed that the model can effectively guide pipe pigging and optimization. There was little sample data for the individual transmission and oil temperature steps because the model was based on actual production data modeling and analysis, which may have affected the accuracy and adaptability of the model.


Introduction
During the operation of long-distance crude oil pipelines, the friction along the pipeline is affected by factors such as the pipe diameter, oil viscosity, and pipe flow. The change in the pipe diameter is mainly due to the waxing of the pipe wall, which leads to the reduction in the effective diameter of the pipe and the loss of a greater amount of kinetic energy under the same flow rate (Yao et al. 2016). The viscosity of the oil is related to the temperature and flow rate (shearing force) of the oil in the pipe, and it is difficult to calculate due to the nonlinearity of the oil temperature along the pipeline. In the actual production process, the viscosity of the oil is unknown due to the nonlinear change of the oil temperature along the line, and the flow state inside the pipe varies. It is difficult to effectively evaluate the wax layer of the pipeline, and impossible to effectively guide the pipeline cleaning and internal inspection (Obanijesu and Omidiora 2008). We studied the relationship between the parameters, such as the oil temperature and flow rate in the pipeline and the frictional resistance along the line. We then developed an effective evaluation of the wax layer of the pipeline, which acts an important guarantee for the safe and optimized operation of a long-distance high-wax crude oil pipeline.
Researchers have mainly evaluated two aspects of the wax layer of pipelines. For example, researchers have studied the oil properties of pipeline transportation and predicted the friction between the thickness of the wax layer of the pipeline and the physical properties of the oil and its influencing factors. Huang et al. (2008), Zhang et al. (2013) and Huang et al. (2011) used the F-test method to screen the main influencing factors of crude oil waxing. The universal waxing model of waxy crude oil was obtained using the experimental data from indoor loop waxing and the stepwise linear regression method. The model was applied to the Edited by Xiu-Qiu Peng actual production of pipelines, and the friction distribution along the line was predicted. The average error was 6.32%, and the maximum error was 20%. The prediction results provided a basis for on-site pigging operations. Others have studied the change of the pipeline flow state, divided the pipeline into different sections, applied different friction characteristic formulas based on the oil temperature, calculated the friction loss, and evaluated the wax layer of the pipeline. Dosunmu and Shah (2013), Chen and Zhang (2003) and Li et al. (2014) comprehensively considered the changes of the parameters like the density, specific heat capacity, viscosity, and total heat transfer coefficient based on the change of the flow regime of the pipeline. They used the average method to determine the trend of the wax thickness variation and analyzed the influence of the wax layer on different operating conditions. In recent years, scholars have created pipeline wax prediction models based on data mining. Gholami et al. (2018) and Xie and Xing (2017) used support vector regression (SVR) to estimate wax deposition, developed a human ANN, and constructed a mixed model of SVR and ANN. The analysis and acquisition of a hybrid model optimized using the genetic algorithm (GA) can effectively improve the prediction accuracy of the model. However, the above theoretically based prediction models were studied using specific oils or pipelines, which affects the applicability of those prediction models. In addition, the prediction models established using data mining algorithms included input parameters, such as the crude oil viscosity, temperature gradient, and wax crystal solubility at the wall of the tube, which are difficult to obtain accurately in the actual production process, and thus affect the practical application of the models. Long-distance pipelines are remotely regulated by the SCADA system, and the existing prediction models are difficult to integrate into a big data platform to achieve the long-term and effective monitoring of the wax layer of the pipe wall.
Artificial neural networks (ANNs) are widely used to solve engineering problems. Unlike the approaches used in traditional experimental research, ANNs can learn, construct nonlinear and complex relational models, and explore the implicit relationship between data (Sotirov et al. 2010). The MLP neural network combined with a BP algorithm is one of the most successful applications of neural networks (Guo et al. 2016). The MLP-BP neural network algorithm is composed of two processes: the forward propagation of the learning process signal and the back-propagation of the error. The MLP-BP network therefore has a strong nonlinear mapping capability and flexible network structure, and it is widely used in pattern recognition (Wang et al. 2016;Yao et al. 2018).
Scholars have used MLP-BP and its corresponding deeplearning methods to evaluate long-distance pipelines (Zhao and Jia 2019;Nguyen et al. 2006). Xie and Xing (2017) used the gray correlation method to analyze the 7 influencing factors affecting the wax deposition rate of pipelines and established a 7-100 back-propagation (BP) neural network prediction model. The accuracy of the tested model can be controlled at approximately 0.5%. However, in this method, the accuracy of the MLP-BP prediction model is related to the input dimensions. Different initial weights and thresholds have a great influence on the prediction accuracy and generalization ability, and so its engineering application is greatly limited. Moreover, both the genetic (GA) and thought evolution (MEA) optimizations (Ding and Yu 2011;Yu and Xu 2014) have global optimization capabilities and can be applied to the optimization of algorithms, such as neural networks.
The GA is a global optimization probability search algorithm that draws on the natural selection and evolution mechanism of the biological world (Yan et al. 2018). The object of GA processing is not the data, but the individual genes obtained by coding and solving complex problems, such as in nonlinear and multi-objective optimizations. GA processing can incorporate multiple data in parallel, which gives it a high processing efficiency and makes it easy to combine with other algorithm technologies.
The MEA was proposed by Sun (1998). The algorithm targeted the shortcomings of the GA, such as its slow convergence rate and poor local search ability (Liu et al. 2013). The MEA follows the basic concepts of the "group" and "evolution" of the GA. The generation is divided into a few winning and temporary sub-groups, and the individual information and the competition process are recorded separately. At the same time, the algorithm innovatively proposes "convergence" and "alienation." The competition process in which individuals within a group become superior individuals, which is called a convergence operation through the information exchange in the local bulletin board, achieves rapid optimization (Cheng 2000;Sun et al. 2000). Compared with the GA, the crossover and mutation operators may produce different genes, and the convergence and dissimilation in the MEA can avoid this problem (Du 2018;Xu 2014).
We used actual production data from the SCADA system in this study. We combined the friction data of a HY high waxy hot oil pipeline after pigging. The friction in this period was friction of the pipeline without a waxing, i.e., a standard pipeline. By analyzing the pipeline flow and oil temperature range in the standard pipeline period, the obtained sample data had the characteristics of a large sample size and full coverage of the working conditions. This information was then used as the dataset of the pipeline standard friction prediction model. The correlation between the standard friction of the pipeline and the oil temperature, ground temperature, and flow rate collected by the SCADA system was studied to determine the factors affecting the friction of the standard pipeline. The MLP-BP neural network algorithm was used to establish the pipeline standard friction prediction model, and the GA and MEA optimization algorithms were used to improve the convergence speed and prediction accuracy of the prediction model. The MEA was more effective than the GA optimization algorithm. The prediction model accurately predicted the standard friction of the pipelines under different oil temperature and flow conditions. The prediction results were compared with the pressure drop data of the SCADA system to realize the long-term monitoring and evaluation of the pipeline wax layer. This model can help guide pipeline pigging and optimize operation.

Modeling and optimization
The relationships between the flow parameters, pressure, ground temperature, and oil temperature of the hot oil pipeline are complex. A BP neural network can realize arbitrarily complex nonlinear mapping and is suitable for solving such complex problems. However, a BP neural network has some problems. For example, it can easily fall to a local minimum value, suffers from slow network convergence, and lacks a unified standard for network structure and parameter selection. Thus, we used the GA and MEA optimization algorithms to improve the accuracy and efficiency of the model.

GA optimization
The hybrid (Hu 2016;Andrab et al. 2017;Hossain and Capi 2018) model used a GA to optimize the initial weight and threshold of the BP neural network to optimize the BP network elements, including the population initialization, fitness function, selection operation, cross-operation, and mutation operation. The GA also optimized the block diagram, as shown in Fig. 1.
Through calculation and analysis, the training error accuracy and training time were comprehensively evaluated. The population size was 20; the evolutionary algebra 30 is the best combination. The fitness value F was set to be the sum of the predicted value obtained by the BP algorithm training and the absolute value of the expected value error as follows: where m is the number of network output nodes, y k is the predicted output of the kth node, d k is the corresponding expected value, and a is the coefficient. Using the fitness proportional method, we set the size of the group to N and calculated the probability that the individual i was selected as p i . This value reflects the proportion of individuals in the whole, and the greater the value, the greater the probability of being selected, as shown in Eqs. (2) and (3), where the crossover probability was 0.9 and the mutation probability was 0.05:

MEA optimization
The MEA was used to optimize the initial weight and threshold of the BP neural network (Irani and Nasimi 2011;Yu and Xu 2014). First, according to the topology of the BP neural network, the space was mapped to the coding space. One solution to each coding problem was solved. The reciprocal of the mean-square error of the training set was selected as the score function of each individual and the population. Using the MEA, after continuous iteration, the optimal individual was output, and this output was used as the initial weight and threshold to train the BP neural network. The logic block diagram is shown in Fig. 2. After testing the different population sizes and evolutionary algebras of the MEA, the population size was determined to be 300 and the number of evolutions was 10.

Predictive model structure
We established the standard model of the thermal oil pipeline standard friction prediction through the optimization of the weights and thresholds of the MLP-BP neural network by the GA and MEA, combined with the characteristics of the MLP-BP neural network algorithm (Fig. 3). The data were downloaded from the SCADA system data every 5 min. The steps for this approach are as follows: preprocess the data, unify and improve the data format, eliminate the outliers, improve the data quality, and use the data for screening and preprocessing for model training and verification. Table 1 provides the sample properties of the pipeline oil based on the samples taken from a HY hot oil pipeline in Changqing Oilfield, China, which mainly exports high-wax crude oil. Figure 4 and Table 2 show the HY crude oil pipeline oil viscosity curve and pipeline elevation mileage data, respectively. The pipeline length is 132.4 km, the diameter is 457 mm, the design pressure is 6.3 MPa (partial 10 MPa), and the designed transmission volume is 500 × 10 4 t/yr. The first station (#1), heat station (#2), heat station (#3), and

Pipe friction analysis
(2) Because of the characteristics of mild oil and the oil properties along the pipeline, 4 different processes-a comprehensive heat treatment, a heat treatment, heating, and normal temperature transportation-were adopted. The oil temperature of the entire line is guaranteed to be higher than the pour point by 3 °C. Figure 5 and Table 3 provide data on the trends in the unit friction (MPa/100 km) after the hot oil pipeline pigging. The data show that the frictional change of the #1 pipe section before and after pigging is small, and therefore it can be reasonably assumed that the frictional resistance of the pipe before and after pigging is constant. The maximum deviations of the #2 and #3 pipe sections before pigging are 86% and 27%, respectively, and the average deviation and range of the two sections after the pigging are 8.6% (8.3%-8.9%) and 4.4% (4.3%-4.6%), respectively. The rate of change of the frictional resistance fluctuates little with the increasing 1 3 flow rate. The pigging operation removed the wax layer of the pipe wall, so the unit friction data of the time period can be used as the sample data of the standard friction prediction model.

Influencing factor selection
Five sets of pigging data of a hot oil pipeline, gathered from 2016 to 2017, were analyzed. Table 4 summarizes the pipeline's oil temperature data for 7 days after pigging by the SCADA system. In addition, the three pipe sections of the hot oil pipeline were analyzed for the oil temperature and flow sample data after five separate piggings, and the output steps are shown in Fig. 6. According to this data, the distribution of the pipeline flow after pigging is wide, but it is concentrated in the daily operational range of 520-730 m 3 /h. The flow-rate range is in line with the actual operation of a hot oil pipeline. In this paper, the flow range   Figure 8 shows that the oil temperature range corresponds to different flow steps. The sample interval at a low flow rate is 24.2-40.3 °C, and the highflow oil temperature range is small. Taking 715 m 3 /h as an example, we see that the temperature range is 24.8-32.8 °C. When the actual production runs at low flow, the heat loss of the entire line is large, and as a result, the oil-delivery system demands more heat. The high-flow oil is frictionally generated in the pipeline, the heat exchange time between the hot oil and the pipeline is short, and the oil temperature control of the entire line is low. Similarly, the corresponding range of the flow rate and upstream outbound oil temperature and downstream inbound oil temperature includes the oil temperature control range during its daily operation, so the selected sample dataset was taken from the flow step and the corresponding oil temperature data. The sample data set conforms to the oil temperature control of the actual production and operation, and it has the characteristics of a large sample size and full coverage of working conditions. The actual operation of the pipeline is mostly in the turbulent hydraulic smooth zone. The Binbinzong formula (Ding     1 3 selected the pipeline flow, upstream outbound oil temperature, downstream-inlet oil temperature, and ground temperature along the line as the modeling parameters, and used the gray correlation method (Gholami et al. 2018) and correlation formula analysis to determine the influence of the pipeline's friction factors. The predicted results are shown in Table 5 and indicate that the flow rate of the SCADA system data, the upstream-outlet oil temperature, and the downstream-inlet oil temperature are the main influencing factors of the pipeline friction, whereas the ground temperature correlation is small. These factors were used as the training dimensions for the BP neural network prediction.

Data preprocessing
We selected the production data of the SCADA system after the HY hot oil pipeline pigging and calculated the friction data of the pipeline to eliminate the abnormal value of the data jump caused by equipment failure to improve the data quality. We used the Z-score standardization method to preprocess the sample data, that is, we normalized the original data set into a data set of a mean of 0 and variance of 1, thereby reducing the impact of outliers on the data, as shown in the following formula: where μ and σ are the mean and variance of the original data set, respectively. The filtered and preprocessed data were used as the model sample and test data.

Model comparison analysis
In the previous stage, a total of more than 40,000 pieces of production data of the SCADA system were completed; 70% was selected as the training set and 30% as the test set. The dataset was trained and tested using the MLP-BP, GA-BP, and MEA-BP predictive models. Each of the three models has five hidden layers and 200 iterations. The number of iterations and training time when each model reached the minimum training error are shown in Table 6.  Table 6 and Fig. 9 show that the three friction prediction models can predict the friction. The average error of the MLP-BP prediction model is 0.041 MPa, and the error fluctuation is large. The BP neural network itself has poor stability and leads to the prediction error which is large. Moreover, the average number of iterations of the MLP-BP model is 69.1 times, resulting in a training time of up to 70.5 s. The average error of the GA-BP prediction model is better than that of the MLP-BP model. The average error, iteration number, and training time are 0.0336 MPa, 53.4 times, and 54.5 s, respectively, and the stability is also superior to that of the MLP-BP model. Although the GA has the  advantages of the global search and parallelism in practical applications, some shortcomings still exist, such as the coding mode, parameter uncertainty, and poor local search ability. In the process of adjusting the model parameters, we found that, upon increasing the population size and number of search iterations, the optimal initial weight threshold time is significantly longer, generally 5-20 min. The average error, iteration number, and training time of the MEA-BP prediction model prediction results are 0.0225 MPa, 47.6 times, and 42.5 s, respectively; these results are better than those of the other two models. The MEA uses the convergence and dissimilation operations on the basis of the GA, which can ensure a highly efficient global search and improve the shortcomings of the local search ability of the GA. Moreover, the number of parameters to be adjusted in the MEA is small, and it is simpler and faster to use than the GA algorithm. The optimized network prediction accuracy and training speed were improved to some extent.

Model application and evaluation
Three kinds of algorithm models-MLP-BP, GA-BP, and MEA-MLP-BP-were used to predict the friction of three sections of a hot oil pipeline. We used 70% of the sample data as the training set and 30% of the sample data as the prediction set. The errors between the predicted and actual value are shown in Table 7. The trend of the two methods after optimization is compared with the BP neural network error (Fig. 10). Table 7 shows that the prediction accuracy improved after the optimization with the MEA and GA. The average error of the three sections of the BP algorithm is 0.0076 MPa, the mean-square error is 0.137, the relative error is 2.56%, and the coefficient of determination is 0.9493. The model was optimized by the GA and MEA, and the three sections were optimized. The average error is 0.0041 and 0.0012 MPa, respectively, and the mean-square errors are 0.083 and 0.067, respectively. The relative errors are 1.84% and 1.34%, respectively, and the correlation coefficient is 0.9769 and 0.9914, respectively. The prediction accuracy of the model using the MEA optimization is better than that after the GA optimization; that is, the accurate prediction of the pipeline friction can be achieved using the MEA-optimized MLP-BP standard friction prediction model.
The MEA-BP model was employed to predict the standard friction of pipelines under different flow rates and oil temperatures in each pipe section. The actual frictional resistance after a period of pigging was compared with the standard frictional resistance under the same working conditions to obtain the data of the frictional increase caused

Conclusions
In this article, we analyzed the unit friction data after the pigging of a hot oil pipeline and developed a predictive model for the pipeline friction using the MLP-BP method; the model was optimized using the GA and MEA methods. The research results were subsequently applied to the standard friction prediction of three sections of a hot oil pipeline. The following conclusions were drawn: 1. We analyzed the friction data of a HY hot oil pipeline after pigging, and obtained the model of the training friction sample of a tube flow of 520-730 m 3 /h. In addition, we created the MLP-BP standard friction prediction model. Due to the shortcomings of the BP neural network, the GA and MEA optimization algorithms were used to optimize the MLP-BP model. 2. The established prediction model was applied to the standard friction model training and testing of three sections of a hot oil pipeline. The prediction results had high precision and good stability. The prediction results were applied to the pigging model, which showed that they could effectively guide the pigging cycle determination. 3. Due to the limitations of the friction sample set, the research results were mainly in the flow range of 520-730 m 3 /h, and the sample size of individual flow steps was small. In follow-up work, we will increase the flow step range and increase the flow according to the increase in the pigging conditions. The sample size within the steps further enhances the prediction accuracy of the model. 4. Because the prediction model is based on actual production data modeling and analysis, there was little available sample data about the individual transmission and oil temperature steps. The accuracy and adaptability of the model will improve with larger amounts of data.  Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creat iveco mmons .org/licen ses/by/4.0/.