Natural gas moisture pipeline liquid holdup prediction model method based on FPA-BP neural network
By using the pollination algorithm to optimize the BP neural network in the prediction of moisture pipeline liquid holding rate, the problems of large prediction errors and unstable prediction in the prior art are solved, and high-precision and high-stable prediction of moisture pipeline liquid holding rate are achieved. Suitable for different working conditions.
Patent Information
- Application Number
- CN202411017605.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2024-11-15
AI Technical Summary
When the prior art predicts the liquid holding rate of the moisture pipeline, the calculation results are relatively errors, and the BP neural network is prone to fall into a local minimum value, resulting in insufficient prediction accuracy and stability, making it difficult to adapt to different working conditions.
The BP neural network (FPA-BP) optimized based on the flower pollination algorithm is adopted to analyze the influencing factors of moisture pipelines, establish the mapping relationship between independent variables and objective functions, and use the FPA algorithm to optimize the weight value and threshold of the BP neural network to improve the Training process to improve prediction accuracy and stability.
It realizes high-precision prediction of liquid holding rate in moisture pipelines, has the advantages of high calculation accuracy, strong stability and wide adaptability, and can better adapt to the complex characteristics of gas-liquid two-phase flow and meet the liquid holding under different working conditions. Rate calculation requirements.
Smart Images

Figure CN118965981A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a natural gas wet gas pipeline liquid holdup prediction model method based on FPA-BP (flower pollination algorithm optimized BP neural network), and belongs to the field of gas-liquid two-phase flow prediction. Background Art
[0002] At present, the demand for natural gas in my country is increasing year by year, and as a clean energy, natural gas has great prospects for future development. In natural gas pipeline transportation, especially in long-distance pipeline wet gas transportation, low-liquid gas-liquid two-phase flow is very common. Usually, wet natural gas is produced together with liquid hydrocarbons, free water, water vapor and other components in gas wells. In many wet natural gas long-distance pipelines, due to the reduction of pressure and temperature along the line, terrain factors and insufficient pipeline pressurization and drying, heavy hydrocarbon components and water may condense in the pipeline to form a liquid phase. Its formation converts the flow in the pipeline into a gas-liquid two-phase flow, and its liquid phase will form liquid accumulation in the low-lying areas that cannot be carried out of the pipeline. The generation of liquid accumulation will increase the friction loss in the pipeline, reduce the flow cross-sectional area, and cause many safety problems such as reduced transportation efficiency. Therefore, it is very important to accurately predict the liquid holdup in wet gas pipeline transportation. Liquid holdup, also known as cross-sectional liquid content, refers to the ratio of the cross-sectional area of the liquid phase to the total flow area on a specific flow cross-section, which represents the filling degree of the liquid phase in the entire flow space. Liquid holdup is crucial to understanding the flow characteristics, mass transfer and heat transfer behavior of gas-liquid two-phase flow. Accurate calculation of liquid holdup of two-phase flow is of great significance for gas-liquid two-phase flow pattern identification, pipeline corrosion evaluation and prediction, and pressure drop calculation along the gas pipeline during transportation. In order to ensure the smooth, safe and efficient operation of the gas pipeline, accurate prediction of liquid holdup is required.
[0003] At present, the calculation of liquid holdup of gas-liquid two-phase flow in horizontal pipelines usually relies on experimental data and theoretical models. Most of these models are empirical formulas, semi-empirical formulas or numerical models based on physical principles, and the calculation results have large errors. With the development of computer science, intelligent algorithms have gradually been applied to liquid holdup prediction. Among them, liquid holdup reflects the situation of liquid filling the pipeline, and is a bridge connecting flow pattern identification and pressure drop calculation. Its calculation results directly affect the distribution of liquid accumulation in the pipe and the amount of liquid accumulation. With the promotion of learning algorithms, Osman, Shippen, Shao Mengliang, etc. have established neural network models of liquid holdup and influencing parameters, but Osman did not consider the influence of fluid properties; Shippen et al. had less training data, which was not enough to expand the scope of use of the calculation model; Shao Mengliang et al. did not distinguish between training sets and validation sets, and used 10-fold cross validation, but due to the small amount of data, a certain "singularity" offset phenomenon would occur. Wang Hongyu proposed the use of SOA-LSSVM model to predict the liquid holdup of gas-liquid two-phase flow, and the calculation accuracy and convergence speed were significantly improved. The research results greatly expanded the prediction accuracy and application scope of the liquid holdup model; Liao Ruiquan et al. established a liquid holdup calculation model based on GA-RBF neural network with higher calculation accuracy and stronger generalization ability; Qi Mingjun et al. used the improved Salp Intense algorithm to improve the prediction accuracy of liquid holdup; Xiao Rongge et al. established a liquid holdup prediction model based on the whale algorithm optimized BP neural network based on grey theory and WOA-BP algorithm, which has higher calculation accuracy and wider application scope; Chen Xingyu et al. established a horizontal pipeline liquid holdup calculation model based on ACE algorithm, and the calculation results were more accurate; Emad A et al. used adaptive fuzzy neural network algorithm to establish a multiphase flow pattern discrimination model and a liquid holdup prediction model, which provided new ideas for liquid holdup calculation in the oil and gas industry.
[0004] The factors affecting the liquid holdup include the diameter, pressure, gas velocity, liquid velocity, temperature, liquid viscosity, etc. of the wet gas pipeline. The liquid holdup of horizontal and undulating pipelines is affected by many factors. Therefore, the prediction of liquid holdup is a complex nonlinear mapping problem affected by multiple factors, and the BP neural network algorithm can solve this kind of problem. However, the training of the BP neural network relies on the gradient descent method to adjust the weights and biases. This method is prone to fall into the local minimum, resulting in poor model performance. In addition, the BP neural algorithm has a great deal of randomness in the selection of initial weight values and thresholds. The randomly initialized weights may not be the best starting point. Different initial settings may lead to completely different final network structures and performances, and there are problems such as poor prediction accuracy, unstable prediction, and poor data generalization ability. In order to solve this problem, the researchers proposed a new prediction model method combining the optimization algorithm with the BP neural network. The wet gas pipeline liquid holdup calculation model based on the FPA-BP algorithm has the advantages of high calculation accuracy, strong stability, and wide adaptability, which can meet the needs of liquid holdup calculation under different working conditions. Summary of the invention
[0005] The purpose of the present invention is to design a wet gas pipeline liquid holdup prediction method based on FPA (flower pollination algorithm)-BP neural network, to accurately predict the liquid holdup of the wet gas pipeline, so as to perform flow pattern identification, liquid holdup calculation, pressure drop calculation, pipeline corrosion evaluation and prediction, and gas pipeline transportation efficiency calculation according to the liquid holdup of the wet gas pipeline.
[0006] The present invention takes the liquid holdup of wet gas pipeline as the objective function, and six influencing factors of the wet gas pipeline, namely, pipe diameter, pressure, gas velocity, liquid velocity, temperature, and liquid phase viscosity, as independent variables. The independent variables and the objective function are analyzed and normalized to establish a mapping relationship between the independent variables and the objective function. The FPA-BP neural network is used for continuous training and learning to finally predict the liquid holdup of wet gas pipeline.
[0007] The method for predicting the liquid holdup of wet gas pipeline based on FPA-BP neural network has the following specific steps:
[0008] Step 1: Collect the experimental data of wet gas pipeline liquid holdup and divide them into training group and test group;
[0009] Step 2: Based on the input and output sample sets of the neural network, pre-process the sample data, determine the BP neural network structure and initialize the connection weights and thresholds of each layer of the BP neural network;
[0010] Step 3: Initialize the population size, population individuals, number of iterations, maximum and minimum membership, and maximum and minimum values of the weights of the flower pollination algorithm;
[0011] Step 4: Use the error between the predicted value and the true value obtained by the trained BP neural network as the fitness value, substitute the sample data into the fitness function, and calculate the global optimum, individual optimum, individual best fitness and global best fitness;
[0012] Step 5: Initialize the empirical gradient direction, determine the search step size, search direction, and search strategy, update the calculated step size and direction, update the individual and global optimal and best fitness values, iterate until the termination condition is met, and output the global optimal fitness value;
[0013] Step 6: Assign the optimal weight value and threshold to the initial weight median value and threshold of the BP neural network;
[0014] Step 7: BP neural network training, initialize network parameters, create a neural network, call the trainparam function as the training function, use the BP neural network for simulation prediction, calculate the error, and analyze the results;
[0015] Advantages of the invention: high calculation accuracy, strong stability and wide adaptability.
[0016] Both the flower pollination algorithm and the BP neural network are important algorithms in the field of computer artificial intelligence. The flower pollination algorithm is a new heuristic random search algorithm based on populations. In this algorithm, the search direction is selected according to the empirical gradient by evaluating the response to the corresponding position change, and the step size is determined based on the uncertainty reasoning of fuzzy rules. The flower pollination algorithm has the characteristics of clear concepts, easy understanding, fast convergence speed and high accuracy. The BP neural network is a multi-layer feedforward network trained by the error back propagation algorithm. Because it has strong nonlinear mapping ability, strong generalization ability, high self-learning and adaptive ability, simple principle and high fault tolerance, it is widely used in many fields. The FPA algorithm and the BP neural network algorithm are applied simultaneously. On the basis of adjusting the weight value and threshold by the standard BP gradient descent method, the flower pollination position update method in the flower pollination algorithm is introduced to correct the weight and threshold. The FPA algorithm does not have the evolutionary process of crossover and mutation, and its computational efficiency is much better than other algorithms. In addition, the FPA algorithm is a global optimization algorithm with better search and optimization capabilities. Therefore, using the FPA algorithm to correct the weights and thresholds of the BP neural network can make up for the defects that the initial weights and thresholds randomly generated by the standard BP algorithm are difficult to obtain accurately, and they are prone to falling into local optimal points in the later stages of iteration, resulting in large differences in prediction results and unstable prediction effects.
[0017] The present invention is a method for calculating the liquid holdup in wet gas pipelines based on an FPA-BP neural network. The method can predict the liquid holdup in wet gas pipelines, can better adapt to the complex characteristics of gas-liquid two-phase flow, has the advantages of high calculation accuracy, strong stability, wide adaptability, etc., and can meet the needs of liquid holdup calculation under different working conditions. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 This is a flow chart of the liquid holdup prediction method based on FPA-BP neural network.
[0019] Figure 2 This is the fitness curve of the liquid holdup prediction method based on FPA-BP neural network.
[0020] Figure 3 The predicted output values of pipeline liquid holdup predicted by BP neural network and FPA-BP neural network are compared with the actual experimental data values.
[0021] Figure 4 This is the error comparison of BP neural network and FPA-BP neural network in predicting pipeline liquid holdup.
[0022] Table 1 shows some original experimental data of pipeline liquid holdup based on FPA-BP neural network. DETAILED DESCRIPTION
[0023] The following is combined with Figure 1 The method of the present invention is described in further detail:
[0024] The method for predicting liquid holdup in wet gas pipelines based on FPA-BP neural network, the specific calculation process is shown in Figure 1 , the steps include:
[0025] Determine the initial structure of BP neural network
[0026] Usually, when designing a BP neural network, a three-layer network (i.e., one hidden layer) should be given priority. Although increasing the number of hidden layers in the BP neural network can reduce calculation errors and improve calculation accuracy, it will make the structure of the BP neural network more complex, thereby extending the training time of the BP neural network and increasing the tendency of the BP neural network to "overfit".
[0027] The neural network designed and used in the present invention has three layers of networks.
[0028] The input quantities of the BP neural network input layer include the diameter of the wet gas pipeline, pressure, gas velocity, liquid velocity, temperature, and liquid viscosity.
[0029] Initialize various parameters, including the number of flower populations n and the transition probability p.
[0030] Calculate the fitness value of each solution and solve the current optimal solution and optimal value.
[0031] If the condition of transition probability p>rand is met, the solution is updated according to equation (1) and out-of-bounds processing is performed. in: are the solutions of the t+1th generation and the $tth generation respectively; g* is the global optimal solution; L$ is the step size, and the calculation formula of $L$ is: Where: λ=3 / 2, Γ(λ) is the standard gamma function.
[0032] If the condition of transition probability p<rand is met, the solution is updated according to equation (3) and out-of-bounds processing is performed. Where: ∈ is a random number that follows a uniform distribution on [0, 1], It is pollen from different flowers of the same plant species.
[0033] Calculate the fitness value corresponding to the new solution obtained by
[0031] or
[0032] . If the fitness value of the new solution is good, replace the current solution and the current fitness value with the new solution and the fitness value corresponding to the new solution respectively; otherwise, retain the current solution and the current fitness value.
[0034] If the fitness value corresponding to the new solution is better than the global optimal value, the global optimal solution and the global optimal value are updated. The end condition is judged. If it is satisfied, the program is exited and the optimal value and the optimal solution are output. Otherwise, go to
[0031] .
[0035] The output layer of the BP neural network has only one output, which is the wet gas pipeline liquid holdup, so the output layer of the BP neural network has only one neuron.
[0036] Considering the characteristics of liquid holdup, linear transfer functions are used between the input layer, hidden layer and output layer. Therefore, the transfer function of the output layer neurons uses the S-type logarithmic function logsig(), and the transfer function of the hidden layer neurons of the neural network uses the S-type tangent function tansig(). This is because the output mode 0-1 just meets the output requirements of the network. After many experiments, the number of training times is set to 1000 and the training target is set to 10 -5 , the learning rate is set to 0.1.
[0037] The flower pollination algorithm optimizes the BP neural network by optimizing the initial weights and thresholds of the BP neural network, so that the optimized BP neural network can better predict samples. The steps of the flower pollination algorithm to optimize the BP neural network include: initializing the BP network structure, initializing the searcher position, determining the empirical gradient direction and search step length, updating the position of each individual, calculating the fitness value of each individual, calculating the global minimum fitness value of the population, and outputting the network weight value and threshold determined by the global optimization.
[0038] In this example, the target is the pipeline liquid holdup. Figure 3 , Figure 4 This is an example of the implementation of the liquid holdup prediction method based on FPA-BP neural network.
[0039] Initialize BP network structure
[0040] It includes setting the number of neurons and learning rate of the network's input layer, hidden layer, and output layer, as well as the input and output of training samples.
[0041] Population initialization
[0042] It includes initializing the population size, the maximum number of iterations, the spatial dimension, the minimum and maximum membership, the minimum and maximum values of the weights, initializing the individuals in the population, etc., and calculating the fitness of each individual.
[0043] Finding the best individual fitness
[0044] Find the individual with the best fitness, find the global best, individual best, individual best fitness value and global best fitness value. The most important thing in this step is the design of the fitness function. In this experiment, the error obtained from the BP neural network training set is used as the fitness value.
[0045] Iterative Optimization
[0046] First, initialize the empirical gradient direction, search step size and direction, and the parameters of the Gaussian function δ ij Then it enters the iterative loop, and the termination condition of the loop is the double loop of the maximum number of iterations and the population size.
[0047] The search direction is determined according to the following formula.
[0048] d i,ego (t) = g i,best -x i (t) (4)
[0049] d i,alt (t) = z i,best -x i (t) (5)
[0050] In the formula, x i (t) represents the best position of the i-th individual at the t-th iteration; g i,best represents the current best position of the i-th individual; z i,best is represented as the global optimal position.
[0051] Determine the direction of the empirical gradient according to the following formula.
[0052]
[0053]
[0054] Where W is the inertia weight; φ1 and φ2 are constants, and their value range is a constant uniformly distributed in [0, 1]; t is the current iteration number, and its value range is an integer between [2, maxgen]; W max =0.9 is the maximum weight, W min =0.1 is the minimum weight.
[0055] The parameter δ of the Gaussian function is determined according to the following formula: ii。
[0056] δ ij =H(t)×|zbest-5×rands(1,10)| (8)
[0057]
[0058] Where zbest represents the global best; rands(1, 10) represents a random real number between [1, 10]; H(t) represents the weight function value of the tth iteration, which changes continuously during the iteration process and is affected by the maximum number of iterations and the current number of iterations, where maxgen = 100.
[0059] The search step size is determined according to the following formula.
[0060]
[0061] In the formula, a ij It is represented as the search step length of the i-th individual in the j-dimensional search space; δ ii is the parameter of Gaussian membership function; u ij It is expressed as the membership degree corresponding to the objective function value i in the j-dimensional exploration space.
[0062] Update Location
[0063] According to the calculated step size and direction, the position is updated according to the following formula, and the individual optimal and optimal fitness values are updated. In addition, the global optimal and fitness values are also updated. The loop is iterated until the termination condition is met, and the global optimal fitness value is output.
[0064] Δx ij (t+1)=Δx ij (t)+a ij (t)×d ij (t) (11)
[0065] In order to compare the differences between the BP neural network and the FPA-BP neural network, the present invention lists the error comparison between the BP neural network and the FPA-BP neural network under the same pipeline operation conditions, such as Figure 4 As shown. Five groups of data were randomly selected to verify the model. The comparison shows that the prediction error of the improved model is significantly reduced and the prediction effect is significantly improved.
[0066] The present invention uses the experimental data of wet gas pipeline liquid holdup rate of previous researchers as verification data. After the FPA-BP neural network model completes training and learning, the neural network is used to predict and verify 100 groups of working conditions. The verification results are as follows: Figure 3 and Figure 4 In this verification, the average error of the five groups of liquid holdup was 5.6372%, which meets the requirements of actual industrial applications. Table 1 Liquid holdup data of some horizontal pipes
Claims
1. The method for predicting liquid holdup in wet gas pipeline based on FPA-BP neural network described in this claim. Its characteristics are The prediction results are more ideal, with better stability and accuracy.
2. The flower pollination algorithm described in this claim constructs a neural network structure, mainly include: The connection weights and thresholds of the BP neural network are regarded as elements of the position vector of individuals in the population; Then, the flower pollination optimization method is used to replace the gradient descent method of the BP network to optimize the network connection weights and thresholds; the individual with the highest fitness is found through iteration to form a neural network with the optimal structure.
3. The flower pollination algorithm described in this claim optimizes the neural network. Its characteristics are: The population-based global search strategy is retained, and the speed-displacement model adopted is simple to operate and avoids complex genetic operations. Compared with the training effects of the basic BP algorithm and GA-BP algorithm, it has smaller training error and test error, and improves the learning ability and generalization ability to a certain extent. The main steps are: Step 1: Initialize the BP network structure, including setting the number of neurons in the network's input layer, hidden layer, and output layer, as well as the learning rates a and β and the input and output of the training samples; initialize the population, including initializing the population size, the maximum number of iterations, the spatial dimension, the minimum and maximum membership, the minimum and maximum values of the weights, and initializing the individuals in the population. Step 2: Use the error between the predicted value and the true value obtained by the trained BP neural network as the fitness value, substitute the sample data into the fitness function, and calculate the global optimal, individual optimal, individual optimal fitness and global optimal fitness. Step 3: Initialize the empirical gradient direction, determine the search step size, search direction, and search strategy, update the calculated step size and direction, update the individual and global optimal and best fitness values, until the iteration meets the termination condition, and output. Step 4: Output the network weights and thresholds determined by the position of the global extreme value, and the algorithm ends. At this point, the BP neural network training is completed, and the FPA-BP neural network prediction model for the liquid holdup of gas-liquid two-phase flow pipeline is established.
