Natural gas pipeline ball valve erosion depth prediction method combining improved hyperbolic sine and cosine algorithm and Elman neural network model

By combining the improved hyperbolic sine cosine algorithm and the Elman neural network model to optimize the model weights and thresholds, the problem of data discrepancy and large computing resource consumption in the prediction of erosion depth of natural gas pipeline ball valves was solved, and accurate prediction and efficiency improvement were achieved.

CN118779598APending Publication Date: 2024-10-15CHINA PETROLEUM & CHEMICAL CORP +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410734927.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-07
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

The existing technology has data differences, long time consumption and large consumption of computing resources when predicting the erosion depth of natural gas pipeline ball valves. The generalization ability of the Elman neural network model is insufficient, making it difficult to achieve accurate prediction.

Method used

Combining the improved hyperbolic sine cosine algorithm and the Elman neural network model, through data normalization, optimizing model weights and thresholds, and using Sine chaos mapping to improve optimization capabilities, an optimization model for predicting the erosion depth of pipeline ball valves was constructed.

Benefits of technology

It achieves accurate prediction of erosion depth of pipeline ball valves, saves manpower and financial resources, simplifies the implementation process, and improves prediction accuracy and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118779598A_ABST
    Figure CN118779598A_ABST
Patent Text Reader

Abstract

The invention discloses a natural gas pipeline ball valve erosion depth prediction method combining an improved hyperbolic sine and cosine algorithm and an Elman neural network model, and belongs to the technical field of natural gas pipeline ball valve erosion depth prediction.The natural gas pipeline ball valve erosion depth prediction method comprises the steps that measured data of the pipeline ball valve erosion depth are obtained, a data set for pipeline ball valve erosion depth prediction is established, and a prediction result is obtained; dividing and normalizing the data set, determining an input variable and an output variable, training an Elman neural network by using a training sample, completing the construction of an Elman neural network model, optimizing the Elman neural network model by using an improved hyperbolic sine and cosine algorithm, and predicting a test sample by using the optimized model. According to the method, the hyperbolic sine and cosine algorithm and the Elman neural network are applied to prediction of the erosion depth of the pipeline ball valve, and the candidate solutions randomly initialized by the hyperbolic sine and cosine algorithm are improved by using Sine chaotic mapping, so that the hyperbolic sine and cosine algorithm has better optimization capacity and has the advantage of being simple to implement.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of erosion depth prediction of ball valves in natural gas pipelines, and in particular relates to a method for predicting the erosion depth of ball valves in natural gas pipelines by combining an improved hyperbolic sine-cosine algorithm and an Elman neural network model. Background Art

[0002] In the process of natural gas transportation, as the amount of sand produced by gas wells increases, solid impurities such as small-sized sand particles in the gas will enter the pipeline and flow with the gas. As a key actuator in the oil and gas pipeline network, the ball valve plays an important role in stopping and starting flow, distributing and changing the medium, and is widely used in the oil and gas pipeline network. During frequent switching and long-term use, the ball valve is easily affected by the solid particles in the medium, causing erosion and wear on the sealing surface (a type of wear phenomenon in which the surface of the material is damaged when it is impacted by small and loose particles). After a long time, it will cause damage to the valve body and gas leakage, which will lead to major accidents.

[0003] In order to obtain the erosion rate / depth of natural gas pipelines or valve bodies under different working conditions, relevant experimental test devices and numerical simulation methods can be used for research. In the experimental process, the commonly used experimental devices are sandblasting experimental devices, centrifugal experimental test devices, pipe flow experimental test devices, etc. For each experimental device, although it can obtain relevant erosion experimental data, each device has its own characteristics and advantages and disadvantages, which causes certain differences in the test results of different scholars. In addition, the erosion depth experiment is time-consuming and has many influencing factors, which makes the experiment cost a lot of manpower and financial resources. The numerical simulation method is an important method for studying the erosion depth / rate at present, which has the advantages of saving manpower and financial resources and easy operation. Due to the complexity of multiphase flow and the diversity of factors affecting erosion behavior, this method often requires a lot of computing resources and takes a long time. In addition, in the simulation analysis process, the boundary conditions and material properties are often simplified, which will also affect the analysis results.

[0004] In recent years, with the continuous development of machine learning theory and intelligent algorithms, many scholars have adopted machine learning theory and algorithms to predict erosion rate / depth. This method has attracted more and more attention from researchers. Among the many theories and learning algorithms, the Elman neural network model is widely used. Although the Elman neural network has strong nonlinear fitting and self-learning capabilities, it also has shortcomings such as weak generalization ability and easy to fall into the minimum value. Considering the advantages and shortcomings of the neural network model, it is necessary to use relevant algorithms to improve it and establish an optimization model, so as to achieve accurate prediction of the erosion depth of the ball valve of the natural gas pipeline. Summary of the invention

[0005] In view of the above problems existing in the prior art, the present invention proposes a natural gas pipeline ball valve erosion depth prediction method combining an improved hyperbolic sine-cosine algorithm and an Elman neural network model. The method has a reasonable design, solves the shortcomings of the prior art, and has good effects.

[0006] A method for predicting erosion depth of ball valves in a natural gas pipeline by combining an improved hyperbolic sine-cosine algorithm and an Elman neural network model comprises the following steps:

[0007] Step 1: Obtain measured data on the erosion depth of pipeline ball valves, that is, the erosion depth corresponding to different influencing factors, including erosion time, particle size, erosion angle, sand production rate, and gas flow rate, so as to establish a data set for predicting the erosion depth of pipeline ball valves;

[0008] Step 2: Divide the established data set, where the training samples account for 80% of the entire data set and the test samples account for 20% of the entire data set. Use the mapminmax function to normalize the data set.

[0009] Step 3: Determine the input variables and output variables, use the training samples to train the Elman neural network, and complete the construction of the Elman neural network model;

[0010] Step 4, improve the hyperbolic sine-cosine algorithm;

[0011] Step 5: Using an improved hyperbolic sine-cosine algorithm to optimize the initial weights and thresholds of the Elman neural network model to obtain an optimized Elman neural network model;

[0012] Step 6: For the test samples, prediction is performed based on the optimized Elman neural network model, and the final prediction result of the erosion depth is obtained through inverse normalization processing.

[0013] Furthermore, in step 2, the mapminmax function expression is as follows:

[0014]

[0015] In the formula, y i represents the normalized data, x i represents the data before processing, max(x i ) and min(x i ) are the maximum and minimum values ​​of the data before processing.

[0016] Furthermore, in step 3, the Elman neural network is composed of an input layer, a hidden layer, a receiving layer and an output layer, and the structural expression of the model is:

[0017] y(t)=g(w3x(t));

[0018] x(t)=f(w1(u(t-1))+w2x c (t));

[0019] x c (t) = x(t-1);

[0020] In the formula, y(t) is the output vector, x(t) is the output vector of the hidden layer, u(t) is the input vector, and x c (t) is the output vector of the receiving layer, w1 is the connection weight from the input layer to the hidden layer, w2 is the connection weight from the receiving layer to the hidden layer, w3 is the connection weight from the hidden layer to the output layer, g(·) and f(·) are the transfer functions of the output layer and the hidden layer respectively;

[0021] By calculating the mean square error of training samples with different numbers of hidden layer nodes, the number of hidden layer nodes corresponding to the minimum mean square error is selected; the influencing factors in the measured data of erosion depth of pipeline ball valves are used as model input, and the erosion depth is used as model output. The training samples are used to train the Elman neural network to obtain the Elman neural network model.

[0022] Furthermore, in step 4, the optimization steps of the improved hyperbolic sine-cosine algorithm are specifically as follows:

[0023] Step 4.1, set the population size, maximum number of iterations max_iteration and problem dimension dim of the improved hyperbolic sine cosine algorithm;

[0024] Step 4.2, initializing the relevant parameters of the improved hyperbolic sine-cosine algorithm;

[0025] Step 4.3: Use Sine chaotic mapping to randomly initialize the candidate solution positions;

[0026] Step 4.4, calculate the fitness values ​​of all individual particles, find the optimal fitness value of the current position and store it, and record the particle position information corresponding to the optimal fitness value of the current iteration;

[0027] Step 4.5: Use the exploration and optimization mechanism of the hyperbolic sine-cosine algorithm to perform global and local searches, iteratively update the particle positions, record the fitness value corresponding to each particle calculated in each iteration and compare it with the optimal fitness value in step 4.4, and re-obtain the optimal fitness value; follow this optimization method until the number of iterations reaches the set maximum number of iterations, and finally output the optimal fitness value and its corresponding particle position.

[0028] Furthermore, in step 4.3, the expression of the Sine chaotic map is as follows:

[0029]

[0030] Among them, a is 2.5, X n Iteration sequence value.

[0031] Furthermore, in step 4.4, the fitness value is the calculation result of the fitness function. The mean square error between the predicted value and the actual value of the training sample is selected as the fitness function and the fitness value is obtained. The expression is as follows:

[0032]

[0033] Among them, P is the number of samples, d fi is the model prediction output value of the i-th training sample, d vi is the actual value of the i-th training sample.

[0034] Furthermore, step 5 includes the following sub-steps:

[0035] Step 5.1, using the weights and thresholds initialized by the Elman neural network model as the initial particle position vector for optimizing the improved hyperbolic sine cosine algorithm, and setting the initial parameters of the improved hyperbolic sine cosine algorithm, including the population size, the number of iterations, and the problem dimension, to initialize the relevant parameters of the improved hyperbolic sine cosine algorithm;

[0036] Step 5.2, introduce Sine chaotic mapping, initialize the particle population sequence and randomly distribute the particles to explore the space, and use the above fitness function to calculate the particle population sequence to measure the optimal solution in the overall optimization process;

[0037] Step 5.3, update the current position of each individual particle by improving the optimization step of the hyperbolic sine-cosine algorithm, that is, adjust the weights and thresholds of the Elman neural network model, and calculate the fitness value corresponding to each individual particle at the current position, record the position and fitness value of the optimal fitness particle individual at each iteration, if the optimal individual fitness value of the current position is better than the historical optimal fitness value, then update it, otherwise, do not update it;

[0038] Step 5.4: If the current number of iterations is less than the total number of iterations, execute steps 5.3 and 5.4; otherwise, output the optimal solution.

[0039] Step 5.5: Assign the obtained optimal solution, i.e., the optimal weight and threshold, to the Elman neural network model, and construct an optimized Elman neural network model after matrix reconstruction.

[0040] Further, in step 6, the denormalization is achieved by the following formula:

[0041] Zi =Z a ·Z f +Z m ;

[0042] Among them, Z i is the output value of the prediction model, Z a is the model output value before denormalization, Z f is the difference between the maximum and minimum values ​​of the data before normalization, Z m is the minimum value of the data used before normalization.

[0043] Beneficial technical effects brought by the present invention:

[0044] 1. The present invention applies the related ideas of intelligent algorithm and machine learning, namely the hyperbolic sine-cosine algorithm and the Elman neural network, to the prediction of the erosion depth of pipeline ball valves. The prediction method used has the advantages of saving manpower and financial resources and being easy to implement.

[0045] 2. Based on the conventional hyperbolic sine-cosine algorithm, the present invention uses Sine chaotic mapping to improve the candidate solutions randomly initialized by the hyperbolic sine-cosine algorithm, so that the hyperbolic sine-cosine algorithm has better optimization ability and can more accurately predict the erosion depth of pipeline ball valves.

[0046] 3. The present invention provides a new idea for accurately predicting the erosion depth of pipeline ball valves, and the Sine chaotic mapping method used therein has the advantage of being simple to implement. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 It is a flow chart of the method for predicting erosion depth of ball valves in natural gas pipelines in the present invention;

[0048] Figure 2 The flowchart of the improved hyperbolic sine-cosine algorithm in the present invention;

[0049] Figure 3 It is a flow chart of optimizing the Elman neural network model based on the improved hyperbolic sine-cosine algorithm in the present invention; DETAILED DESCRIPTION

[0050] The specific implementation of the present invention is further described below in conjunction with specific embodiments:

[0051] Example 1

[0052] A method for predicting the erosion depth of ball valves in natural gas pipelines combining an improved hyperbolic sine-cosine algorithm and an Elman neural network model is proposed. Figure 1 As shown, the following steps are included:

[0053] Step 1: Obtain measured data on the erosion depth of pipeline ball valves, that is, the erosion depth corresponding to different influencing factors, including erosion time, particle size, erosion angle, sand production rate, and gas flow rate, so as to establish a data set for predicting the erosion depth of pipeline ball valves;

[0054] Step 2: Divide the established data set, where the training samples account for 80% of the entire data set and the test samples account for 20% of the entire data set. To eliminate the influence of different dimensions, the mapminmax function is used to normalize the data set;

[0055] The mapminmax function expression is as follows:

[0056]

[0057] In the formula, y i represents the normalized data, x i represents the data before processing, max(x i ) and min(x i ) are the maximum and minimum values ​​of the data before processing.

[0058] Step 3: Determine the input variables and output variables, use the training samples to train the Elman neural network, and complete the construction of the Elman neural network model;

[0059] The Elman neural network consists of an input layer, a hidden layer, a receiving layer, and an output layer. Its structural expression is:

[0060] y(t)=g(w3x(t));

[0061] x(t)=f(w1(u(t-1))+w2x c (t));

[0062] x c (t) = x(t-1);

[0063] In the formula, y(t) is the output vector, x(t) is the output vector of the hidden layer, u(t) is the input vector, and x c (t) is the output vector of the receiving layer, w1 is the connection weight from the input layer to the hidden layer, w2 is the connection weight from the receiving layer to the hidden layer, w3 is the connection weight from the hidden layer to the output layer, g(·) and f(·) are the transfer functions of the output layer and the hidden layer, respectively.

[0064] The operating principle of the Elman neural network is as follows: the input layer inputs data information, which is passed to the hidden layer with two types of activation functions, linear and nonlinear. The receiving layer memorizes the output value of the neural unit at the previous moment. Its delay and memory effect cause the hidden layer output to be associated with the input, and finally weighted processing is performed in the output layer.

[0065] According to the number of dependent variables and independent variables of the data set, the number of nodes in the input layer and output layer is first determined, and then the number of nodes in the hidden layer is determined. Among them, the number of nodes in the hidden layer is determined by calculating the mean square error of the training samples when the hidden layer takes different numbers of nodes. The number of nodes in the hidden layer corresponding to the minimum mean square error is the determined result, and finally the Elman neural network model structure is constructed.

[0066] The influencing factors in the measured data of erosion depth of pipeline ball valves are used as model input, and the erosion depth is used as model output. The Elman neural network model is trained using training samples to obtain the Elman neural network model.

[0067] Step 4, improve the hyperbolic sine-cosine algorithm;

[0068] The hyperbolic sine-cosine algorithm (SCHO) is developed based on the characteristics of hyperbolic sine and hyperbolic cosine. Its entire optimization process is mainly divided into four stages (initialization stage, exploration stage, development stage and bounded search strategy stage). In the process of improving the algorithm, Sine chaotic mapping is used to improve the candidate solutions randomly initialized by the traditional algorithm, thereby improving the optimization ability of the hyperbolic sine-cosine algorithm. The improved hyperbolic sine-cosine algorithm is mainly divided into four stages: Sine chaotic mapping initialization stage, exploration stage, development stage and bounded search strategy stage.

[0069] The first stage: Sine chaos map initialization stage;

[0070] Like other metaheuristic algorithms, the mathematical formula of SCHO initial candidate solution is as follows:

[0071]

[0072] Where X is a random candidate solution set obtained by the following formula, x i,j represents the jth position of the ith solution, N represents the number of candidate solutions, and dim represents the problem dimension;

[0073] The expression of the initial candidate solution of the hyperbolic sine-cosine algorithm is:

[0074] X=rand(N,dim)×(ub-lb)+lb;

[0075] Among them, rand represents a random number between [0,1], ub and lb are the upper and lower bounds of the variable respectively;

[0076] The expression of the Sine chaotic map used is:

[0077]

[0078] Among them, a is 2.5, X n Iteration sequence value.

[0079] Phase 2: Exploration phase;

[0080] In this optimization process, the exploration is divided into two stages, namely the first exploration stage and the second exploration stage. The conversion value between the two stages is realized by the following formula:

[0081]

[0082] Among them, max_iteration is the maximum number of iterations, floor is the function of rounding down in MATLAB software, and ct is the coefficient of the switching point between the two sub-stages;

[0083] In the first exploration phase, the outer part of the search space near the search agent's position will be explored (in early iterations), and then the search agent will gradually approach the best solution it has obtained. The position update function explored in the first exploration phase is as follows:

[0084]

[0085] Where t is the current iteration number, denote the jth position of the ith solution in the current iteration and the next iteration respectively, is the jth position of the optimal solution obtained so far, r1, r2 are random numbers in the interval [0,1], and W1 is the first exploration stage The weight coefficient (controlling the first-stage candidate solution away from itself and gradually exploring the optimal solution) is calculated by the following formula:

[0086] W1=r3×a1×(coshr4+u×sinhr4-1);

[0087] Where r3 and r4 are random numbers in the interval [0,1], u is the sensitivity coefficient that controls the accuracy of the first stage of exploration, and a1 is a monotonically decreasing function, which is calculated by the following formula:

[0088]

[0089] In the formula, m is the sensitivity coefficient for controlling exploration accuracy;

[0090] In the second exploration phase, the search agent non-directionally explores the next position based on the current position, and its position update function is as follows:

[0091]

[0092] Among them, ε is a very small positive number, and W2 is the second exploration stage The weight coefficient is calculated by the following formula:

[0093] W2=r6×a2;

[0094] Among them, r5 and r6 are random numbers between [0,1], and a2 is calculated by the following formula:

[0095]

[0096] Among them, n is the sensitivity coefficient that controls the exploration accuracy of the second stage.

[0097] Phase 3: Development phase;

[0098] In the entire iterative process, the development is divided into two stages, namely the first development stage and the second development stage. In the first development stage, the adjacent space of X will be developed, and its mathematical expression is as follows:

[0099]

[0100] Among them, r7 and r8 are random numbers in the interval [0,1], and W3 is the weight coefficient of the first development stage, which controls the candidate solution to develop the surrounding search space from near to far. The expression is as follows:

[0101] W3=r9×a1×(coshr 10 +u×sinhr 10 );

[0102] Among them, r9, r 10 is a random number in the interval [0,1];

[0103] In the second development phase, the candidate solution will be further developed based on the currently obtained optimal solution, and the development intensity increases with the number of iterations. The position update function is as follows:

[0104]

[0105] Among them, r 11 ,r 12 is a random number in the interval [0,1], and W2 is used to control the degree of the second development stage.

[0106] The fourth stage: bounded search strategy stage;

[0107] The strategy finds a latent search space by exploring the entire search area in early iterations. All candidate solutions are first randomly initialized in the latent space, and then the space is deeply explored and developed. Each start of the strategy is implemented as follows:

[0108]

[0109] Among them, k is a positive integer starting from 1, α is the sensitivity coefficient, BS k ,BS k+1 They represent the number of iterations for starting the current bounded search strategy and the next bounded search strategy. k Calculated by the following formula:

[0110]

[0111] Among them, β is used to control the value when starting the bounded search strategy.

[0112] Each time SCHO uses a bounded search strategy, the upper and lower bounds of the optimization problem are calculated using the following formula:

[0113]

[0114] Among them, ub k and lb k denotes the upper and lower bounds of the potential search space, represents the jth position of the suboptimal solution.

[0115] Conversion mechanism;

[0116] In the SCHO algorithm, a conversion mechanism is used to achieve the conversion between exploration and exploitation. In order to achieve exploration and exploitation of the entire search space and get rid of the local optimum in the later iterations, the conversion mechanism should focus on the exploration strategy and only perform a small amount of exploitation strategy (in the early iterations). In the later iterations, the conversion mechanism should focus mainly on the exploitation strategy and only perform a small amount of exploration strategy. The expression that implements the principle of the conversion mechanism is as follows:

[0117]

[0118] Among them, r 13 is a random number in the interval [0,1], p and q are balance coefficients (used to control exploration and development during iterations). When A>1, the exploration strategy is executed; when A<1, the development strategy is executed.

[0119] The improved hyperbolic sine-cosine algorithm initializes the population position through Sine chaotic mapping to improve the optimization ability of the traditional hyperbolic sine-cosine algorithm. The optimization steps are as follows:

[0120] Step 4.1, set the population size, maximum number of iterations max_iteration and problem dimension dim of the improved hyperbolic sine cosine algorithm;

[0121] Step 4.2, initializing the relevant parameters of the improved hyperbolic sine-cosine algorithm;

[0122] Step 4.3: Use Sine chaotic mapping to randomly initialize the candidate solution positions;

[0123] Step 4.4, calculate the fitness values ​​of all individual particles, find the optimal fitness value of the current position and store it, and record the particle position information corresponding to the optimal fitness value of the current iteration;

[0124] The fitness value is the calculation result of the fitness function. The mean square error between the predicted value and the actual value of the training sample is selected as the fitness function and the fitness value is obtained. The expression is as follows:

[0125]

[0126] Among them, P is the number of samples, d fi is the model prediction output value of the i-th training sample, d vi is the actual value of the i-th training sample.

[0127] Step 4.5: Use the exploration and optimization mechanism of the hyperbolic sine-cosine algorithm to perform global and local searches, iteratively update the particle positions, record the fitness value corresponding to each particle calculated in each iteration and compare it with the optimal fitness value in step 4.4, and re-obtain the optimal fitness value; follow this optimization method until the number of iterations reaches the set maximum number of iterations, and finally output the optimal fitness value and its corresponding particle position.

[0128] like Figure 2 As shown, steps 4.4 and 4.5 are specifically as follows:

[0129] a. If t<max_iteration, calculate the fitness function values ​​of all particles, determine the optimal fitness value and the corresponding particle position as the optimal solution;

[0130] b. Update the value of A and determine whether t is equal to BS k , if t≠BS k , then execute step c, if t = BS k , then update the search space and then execute step c;

[0131] c. Determine whether A is greater than 1. If A is greater than 1, calculate W1 and W2. If t≤T, use the first exploration stage expression to update the candidate solution position. If t>T, use the second exploration stage expression to update the candidate solution position. If A is not greater than 1, update W3. If t≤T, use the first development stage expression to update the candidate solution position. If t>T, use the second development stage expression to update the candidate solution position.

[0132] d. Let t = t + 1, and re-determine whether t is less than max_iteration. If t < max_iteration, repeat steps a, b, c, and d. If t ≥ max_iteration, output the best solution.

[0133] Step 5: Using an improved hyperbolic sine-cosine algorithm to optimize the initial weights and thresholds of the Elman neural network model to obtain an optimized Elman neural network model;

[0134] like Figure 3 As shown, step 5 includes the following sub-steps:

[0135] Step 5.1, using the weights and thresholds initialized by the Elman neural network model as the initial particle position vector for optimizing the improved hyperbolic sine cosine algorithm, and setting the initial parameters of the improved hyperbolic sine cosine algorithm, including the population size, the number of iterations, and the problem dimension, etc., to initialize the relevant parameters of the improved hyperbolic sine cosine algorithm;

[0136] Step 5.2, introduce Sine chaotic mapping, initialize the particle population sequence and randomly distribute the particles to explore the space, and use the above fitness function to calculate the particle population sequence to measure the optimal solution in the overall optimization process;

[0137] Step 5.3, update the current position of each individual particle by improving the optimization step of the hyperbolic sine-cosine algorithm, that is, adjust the weights and thresholds of the Elman neural network model, and calculate the fitness value corresponding to each individual particle at the current position, record the position and fitness value of the optimal fitness particle individual at each iteration, if the optimal individual fitness value of the current position is better than the historical optimal fitness value, then update it, otherwise, do not update it;

[0138] Step 5.4: If the current number of iterations is less than the total number of iterations, execute steps 5.3 and 5.4; otherwise, output the optimal solution.

[0139] Step 5.5: Assign the obtained optimal solution, i.e., the optimal weight and threshold, to the Elman neural network model. After matrix reconstruction, an optimized Elman neural network model is constructed for sample prediction.

[0140] Step 6: For the test samples, prediction is performed based on the optimized Elman neural network model, and the final prediction result of the erosion depth is obtained through inverse normalization processing.

[0141] Denormalization is achieved by:

[0142] Z i =Z a ·Z f +Zm ;

[0143] Among them, Z i is the output value of the prediction model, Z a is the model output value before denormalization, Z f is the difference between the maximum and minimum values ​​of the data before normalization, Z m is the minimum value of the data used before normalization.

[0144] Example 2

[0145] This embodiment provides a method for predicting the erosion depth of a ball valve in a natural gas pipeline by combining an improved hyperbolic sine-cosine algorithm and an Elman neural network model, comprising the following steps:

[0146] Step 1: Select 25 sets of measured data on the erosion depth of pipeline ball valves collected from domestic literature. The data include the erosion depth under different influencing factors. Among them, the influencing factors are: experimental time, particle size, erosion angle, sand production rate, total sand volume, gas flow rate, and air velocity. Based on the measured data obtained, a data set for predicting the erosion depth of pipeline ball valves is established, as shown in Table 1;

[0147] Table 1 Measured data of erosion depth of pipeline ball valve

[0148]

[0149]

[0150] Step 2: Divide the established data set, where the training sample data set accounts for 80% of the entire data set, as shown in Table 2, and the test sample data set accounts for 20% of the entire data set, as shown in Table 3. In order to eliminate the influence of different dimensions, the mapminmax function is used to normalize the data set.

[0151] Table 2 Training samples

[0152]

[0153] Table 3 Test samples

[0154]

[0155]

[0156] Step 3: Determine the input variables and output variables. Using MATLAB software, set the Elman neural network model learning parameters as follows: the number of training times is set to 1000; the learning rate is set to 0.01; the minimum error of the training target is set to 1×10 -6 ; Momentum factor is set to 0.01; Minimum performance gradient is set to 1×10-6 Based on the above-mentioned method for determining the structure of the Elman neural network model, the determined network structure is 7-5-1. The training samples in Table 2 are used to train the Elman neural network model;

[0157] Step 4: According to Figure 2 The algorithm flow chart is combined with the principle of improved hyperbolic sine cosine algorithm to compile the program code of improved hyperbolic sine cosine algorithm;

[0158] Step 5: According to Figure 3 The flowchart of the paper adopts the improved hyperbolic sine-cosine algorithm to optimize the initial weights and thresholds of the Elman neural network model, and constructs an optimized Elman neural network model.

[0159] Step 6: For the test samples shown in Table 3, prediction is performed based on the optimized Elman neural network model, and the prediction result of the erosion depth of the pipeline ball valve is finally obtained through processing with the above-mentioned inverse normalization formula.

[0160] In order to prove the effectiveness of the improved algorithm, the present invention uses MATLAB software to construct three prediction models for this embodiment: Elman neural network prediction model, hyperbolic sine cosine algorithm optimized Elman neural network prediction model (SCHO-Elman) and improved hyperbolic sine cosine algorithm optimized Elman neural network prediction model (ISCHO-Elman). The prediction results and relative errors of each model are shown in Table 4;

[0161] Table 4 Prediction results and relative errors of each model

[0162]

[0163] Based on the calculation results in Table 4, the commonly used evaluation indicators in regression prediction (mean absolute percentage error and root mean square error) are selected to evaluate the prediction accuracy of each model. The specific results are shown in Table 5;

[0164] Table 5 Average absolute percentage error and root mean square error of prediction results of each model

[0165]

[0166] The calculation formulas for the above mean absolute percentage error (MAPE) and root mean square error (RMSE) are as follows:

[0167]

[0168]

[0169] In the formula, l is the number of samples, y is iis the predicted value of the model, Y i is the measured value;

[0170] The prediction results in Table 4 and Table 5 show that the maximum relative error, average absolute percentage error, and root mean square error of the prediction results of the ISCHO-Elman model and the SCHO-Elman model are lower than those of the traditional Elman neural network model (the maximum relative error, average absolute percentage error, and root mean square error of the ISCHO-Elman model are 5.480%, 2.164%, and 0.036, respectively; the maximum relative error, average absolute percentage error, and root mean square error of the SCHO-Elman model are 5.517%, 3.408%, and 0.045, respectively; the maximum relative error, average absolute percentage error, and root mean square error of the Elman neural network model are 22.760%, 12.555%, and 0.205, respectively). It can be seen that the introduction of the hyperbolic sine cosine algorithm can improve the prediction accuracy of the traditional Elman neural network model.

[0171] Compared with the SCHO-Elman model, the maximum relative error, mean absolute percentage error and root mean square error of the ISCHO-Elman model are all lower. That is, the prediction accuracy of the ISCHO-Elman model is higher than that of the SCHO-Elman model, which also proves the effectiveness of the improved algorithm. For the optimized Elman neural network model of the improved hyperbolic sine-cosine algorithm, the Sine chaotic map is introduced to initialize the population, which can improve the quality of the initial population and enhance the diversity of the population, and can better explore the particle optimization space, thus helping to improve the prediction accuracy of the SCHO-Elman model.

[0172] In the above embodiments, the hyperbolic sine-cosine algorithm and the Elman neural network model are existing technologies and are well known to those skilled in the art; the measured data of the erosion depth of the pipeline ball valve under the different influencing factors (experimental time, particle size, erosion angle, sand production rate, total sand volume, gas flow rate, air velocity) are also well known to those skilled in the art.

[0173] Of course, the above description is not a limitation of the present invention, and the present invention is not limited to the above examples. Changes, modifications, additions or substitutions made by technicians in this technical field within the essential scope of the present invention should also fall within the protection scope of the present invention.

Claims

1. A method for predicting the erosion depth of ball valves in natural gas pipelines by combining an improved hyperbolic sine-cosine algorithm and an Elman neural network model, characterized in that: The following steps are involved: Step 1: Obtain measured data on the erosion depth of pipeline ball valves, that is, the erosion depth corresponding to different influencing factors, including erosion time, particle size, erosion angle, sand production rate, and gas flow rate, so as to establish a data set for predicting the erosion depth of pipeline ball valves; Step 2: Divide the established data set, where the training samples account for 80% of the entire data set and the test samples account for 20% of the entire data set. Use the mapminmax function to normalize the data set. Step 3: Determine the input variables and output variables, use the training samples to train the Elman neural network, and complete the construction of the Elman neural network model; Step 4, improving the hyperbolic sine-cosine algorithm; Step 5: Using an improved hyperbolic sine-cosine algorithm to optimize the initial weights and thresholds of the Elman neural network model to obtain an optimized Elman neural network model; Step 6: For the test samples, prediction is performed based on the optimized Elman neural network model, and the final prediction result of the erosion depth is obtained through inverse normalization processing.

2. According to claim 1, a natural gas pipeline ball valve erosion depth prediction method combining an improved hyperbolic sine-cosine algorithm and an Elman neural network model is characterized in that: In step 2, the mapminmax function expression is as follows: In the formula, y i represents the normalized data, x i represents the data before processing, max(x i ) and min(x i ) are the maximum and minimum values ​​of the data before processing.

3. The method for predicting erosion depth of ball valves in natural gas pipelines combining an improved hyperbolic sine-cosine algorithm and an Elman neural network model according to claim 2 is characterized in that: In step 3, the Elman neural network consists of an input layer, a hidden layer, a receiving layer and an output layer, and its structural expression is: y(t)=g(w3x(t)); x(t)=f(w1(u(t-1))+w2x c (t)); x c (t)=x(t-1); In the formula, y(t) is the output vector, x(t) is the output vector of the hidden layer, u(t) is the input vector, and x c (t) is the output vector of the receiving layer, w1 is the connection weight from the input layer to the hidden layer, w2 is the connection weight from the receiving layer to the hidden layer, w3 is the connection weight from the hidden layer to the output layer, g(·) and f(·) are the transfer functions of the output layer and the hidden layer respectively; By calculating the mean square error of training samples with different numbers of hidden layer nodes, the number of hidden layer nodes corresponding to the minimum mean square error is selected; the influencing factors in the measured data of erosion depth of pipeline ball valves are used as model input, and the erosion depth is used as model output. The training samples are used to train the Elman neural network to obtain the Elman neural network model.

4. The method for predicting erosion depth of ball valves in natural gas pipelines combining an improved hyperbolic sine-cosine algorithm and an Elman neural network model according to claim 3 is characterized in that: In step 4, the optimization steps of the improved hyperbolic sine-cosine algorithm are as follows: Step 4.1, set the population size, maximum number of iterations max_iteration and problem dimension dim of the improved hyperbolic sine cosine algorithm; Step 4.2, initializing the relevant parameters of the improved hyperbolic sine-cosine algorithm; Step 4.3: Use Sine chaotic mapping to randomly initialize the candidate solution positions; Step 4.4, calculate the fitness values ​​of all individual particles, find the optimal fitness value of the current position and store it, and record the particle position information corresponding to the optimal fitness value of the current iteration; Step 4.5: Use the exploration and optimization mechanism of the hyperbolic sine-cosine algorithm to perform global and local searches, iteratively update the particle positions, record the fitness value corresponding to each particle calculated in each iteration and compare it with the optimal fitness value in step 4.4, and re-obtain the optimal fitness value; follow this optimization method until the number of iterations reaches the set maximum number of iterations, and finally output the optimal fitness value and its corresponding particle position.

5. The method for predicting erosion depth of ball valves in natural gas pipelines combining an improved hyperbolic sine-cosine algorithm and an Elman neural network model according to claim 4 is characterized in that: In step 4.3, the expression of Sine chaotic map is as follows: Among them, a is 2.5, X n Iteration sequence value.

6. The method for predicting erosion depth of ball valves in natural gas pipelines combining an improved hyperbolic sine-cosine algorithm and an Elman neural network model according to claim 5, characterized in that: In step 4.4, the fitness value is the calculation result of the fitness function. The mean square error between the predicted value and the actual value of the training sample is selected as the fitness function and the fitness value is obtained. The expression is as follows: Among them, P is the number of samples, d fi is the model prediction output value of the i-th training sample, d vi is the actual value of the i-th training sample.

7. The method for predicting erosion depth of ball valves in natural gas pipelines combining an improved hyperbolic sine-cosine algorithm and an Elman neural network model according to claim 6, characterized in that: Step 5 includes the following sub-steps: Step 5.1, using the weights and thresholds initialized by the Elman neural network model as the initial particle position vector for optimizing the improved hyperbolic sine cosine algorithm, and setting the initial parameters of the improved hyperbolic sine cosine algorithm, including the population size, the number of iterations, and the problem dimension, to initialize the relevant parameters of the improved hyperbolic sine cosine algorithm; Step 5.2, introduce Sine chaotic mapping, initialize the particle population sequence and randomly distribute the particles to explore the space, and use the above fitness function to calculate the particle population sequence to measure the optimal solution in the overall optimization process; Step 5.3, update the current position of each individual particle by improving the optimization step of the hyperbolic sine-cosine algorithm, that is, adjust the weights and thresholds of the Elman neural network model, and calculate the fitness value corresponding to each individual particle at the current position, record the position and fitness value of the optimal fitness particle individual at each iteration, if the optimal individual fitness value of the current position is better than the historical optimal fitness value, then update it, otherwise, do not update it; Step 5.4: If the current number of iterations is less than the total number of iterations, execute steps 5.3 and 5.4; otherwise, output the optimal solution. Step 5.5: Assign the obtained optimal solution, i.e., the optimal weight and threshold, to the Elman neural network model, and construct an optimized Elman neural network model after matrix reconstruction.

8. The method for predicting erosion depth of ball valves in natural gas pipelines combining an improved hyperbolic sine-cosine algorithm and an Elman neural network model according to claim 7, characterized in that: In step 6, the anti-normalization is achieved by the following formula: WITH i =Z a ·WITH f +Z m ; Among them, Z i is the output value of the prediction model, Z a is the model output value before denormalization, Z f is the difference between the maximum and minimum values ​​of the data before normalization, Z m is the minimum value of the data used before normalization.

Citation Information

Cited By

  • High-speed heavy-load ball screw assembly with variable-curvature raceway cross section

    CN120520945A