Method and device for predicting corrosion defect depth in whole natural gas gathering and transportation pipeline

By combining RF random forest, MLP neural network and LightGBM model, the fourth prediction model of RF-MLP-LightGBM with corrosion defect depth in the entire line of the natural gas collection and transmission pipeline was established, which solved the problem of low prediction accuracy in the existing technology and achieved higher prediction accuracy and stability.

CN119558436APending Publication Date: 2025-03-04PETROCHINA CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311126627.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-01
Publication Date
2025-03-04

AI Technical Summary

Technical Problem

The prior art is difficult to accurately predict the depth of corrosion defects in the entire line of natural gas collection and transmission pipelines, and the prediction accuracy of a single data-driven model is relatively low.

Method used

A variety of data-driven models are adopted, including prediction models based on RF random forest, MLP neural network and LightGBM. By combining these models, the fourth prediction model of RF-MLP-LightGBM is established to predict the depth of corrosion defects in the entire line of the natural gas collection and transmission pipeline.

Benefits of technology

The accuracy of predicting the depth of corrosion defects in the entire line of the natural gas collection and transmission pipeline is improved, and the prediction error can reach a minimum of 0.0374, which has good generalization and robustness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119558436A_ABST
    Figure CN119558436A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of oil and gas pipelines, and discloses a natural gas gathering and transportation pipeline whole-line internal corrosion defect depth prediction method and device, and the method comprises the steps: collecting internal corrosion data of a natural gas gathering and transportation pipeline; preprocessing the internal corrosion data; discrete text type data in the internal corrosion data are converted into numerical data; establishing an RF first prediction model; establishing a second MLP prediction model; a third LightGBM prediction model is established; an RF-MLP-LightGBM fourth prediction model is established, and an RF-MLP-LightGBM And on the basis of a trained RF-MLP-LightGBM fourth prediction model, predicting and calculating to obtain the depth percentage of the internal corrosion defect. According to the method, the corrosion defect depth in the whole natural gas gathering and transportation pipeline can be effectively predicted on the basis of a large amount of field corrosion defect depth data in the natural gas gathering and transportation pipeline in combination with the three data driving models, good generalization and robustness are achieved, the precision of the prediction model is greatly improved, and the minimum prediction error can reach 0.0374.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of oil and gas pipelines, and in particular relates to a method and a device for predicting the depth of corrosion defects in the entire natural gas gathering and transportation pipeline. Background Art

[0002] Leakage caused by corrosion in natural gas gathering and transportation pipelines can bring huge negative environmental problems, including environmental pollution and explosions, which can cause the release of toxic substances and difficult-to-extinguish fires. In the process of transporting oil and natural gas, the integrity and safety of pipelines play an important role in the economic security of the oil and gas industry.

[0003] The internal corrosion status of the oil and gas gathering and transportation pipelines in operation can be detected by using intelligent pigs and verified by on-site excavation measurements. However, the cost of related operations is relatively high, especially for large pipeline systems. In addition, some gathering and transportation pipelines are not equipped with relevant detection devices. At the same time, there is a risk of damaging the pipeline during excavation verification, and the corrosion status of the pipeline will change with different operating conditions. Therefore, there are certain limitations in detecting the corrosion status of the pipeline through measuring equipment.

[0004] Through investigation, it was found that many researchers and scholars used empirical, semi-empirical, and mechanism models to predict internal corrosion of natural gas gathering and transmission pipelines that transport acidic media. There are relatively mature theoretical results, but different empirical mechanism models are suitable for different scenarios. Most prediction models are not sufficiently integrated with oil and gas field production sites.

[0005] During the design and operation of natural gas pipelines, a large amount of data will be generated, which can be used for reliability analysis of transmission pipelines and pipeline corrosion prediction. Many researchers have used massive pipeline data to propose data-driven models based on artificial intelligence algorithms such as machine learning to predict the corrosion condition inside the pipeline. This method has the advantages of low cost and the ability to monitor the corrosion condition inside the pipeline at any time compared to on-site measurement equipment. However, most data-driven models used for pipeline corrosion prediction have the following shortcomings: ① They can only predict the internal corrosion rate, remaining life of the pipeline, and deepest corrosion depth at a certain point in the pipeline, but do not predict the depth of corrosion defects inside the entire pipeline; ② A single data-driven prediction model is often used, and the prediction model has limitations, resulting in reduced prediction accuracy.

[0006] Therefore, it is necessary to provide a pipeline full-line internal corrosion defect depth prediction model based on multiple data-driven methods, which can accurately predict the pipeline full-line internal corrosion defect depth and greatly improve the accuracy of the prediction model. Summary of the invention

[0007] In order to overcome the defects of the above-mentioned prior art, the purpose of the present invention is to provide a method and device for predicting the depth of corrosion defects in the entire natural gas gathering and transportation pipeline based on multiple data-driven methods, which can accurately predict the depth of corrosion defects in the entire pipeline and greatly improve the accuracy of the prediction model.

[0008] To achieve the above object, the present invention provides the following technical solutions:

[0009] A method for predicting the depth of corrosion defects in the entire natural gas gathering and transportation pipeline, comprising:

[0010] Collect internal corrosion data of natural gas gathering and transportation pipelines;

[0011] Preprocess the internal corrosion data;

[0012] Convert the discrete text data in the internal corrosion data into numerical data;

[0013] Establish the first prediction model for corrosion defect depth of natural gas gathering and transmission pipelines based on RF random forest;

[0014] Establish the second prediction model of corrosion defect depth in the entire natural gas gathering and transportation pipeline based on MLP neural network;

[0015] Establish the third prediction model of corrosion defect depth in the entire natural gas gathering and transportation pipeline based on LightGBM;

[0016] Establishing the RF-MLP-LightGBM fourth prediction model based on the first prediction model, the second prediction model and the third prediction model;

[0017] Based on the trained RF-MLP-LightGBM fourth prediction model, the final percentage of corrosion defect depth within the entire natural gas gathering and transportation pipeline is predicted and calculated.

[0018] In some embodiments of the present invention, collecting internal corrosion data of a natural gas gathering and transportation pipeline includes:

[0019] Collect data on the diameter, length, wall thickness, pipe material, operating time, operating pressure, operating temperature, operating output, water content, sulfur content, pipeline mapping data, corrosion defect mileage location and internal corrosion defect depth of natural gas gathering and transportation pipelines.

[0020] In some embodiments of the present invention, the internal corrosion data is preprocessed, including:

[0021] Based on the mileage position of the corrosion defect, the pipeline surveying data collected on site is converted into the corresponding elevation position of the corrosion defect using cubic spline interpolation method;

[0022] Eliminate missing data;

[0023] Use box plots to identify and remove outliers;

[0024] The characteristic data are standardized by rescaling them to zero mean and unit variance, where the characteristic data are numerical data corresponding to pipe diameter, pipe length, wall thickness, pipe material, operating time, operating pressure, operating temperature, operating output, moisture content, sulfur content, corrosion defect elevation position, and corrosion defect mileage position.

[0025] In some embodiments of the invention, the data is normalized by rescaling the feature data to zero mean and unit variance, including:

[0026] Normalized data is based on the following formula:

[0027] Among them, x is the feature data before preprocessing, μ is the mean of the feature data before preprocessing, σ is the standard deviation of the feature data before preprocessing, and y is the standardized feature data.

[0028] In some embodiments of the present invention, converting discrete text data in the internal corrosion data into numerical data includes:

[0029] The discrete text data in the inner corrosion data is converted into numerical data using one-hot encoding.

[0030] In some embodiments of the present invention, the first prediction model takes pipe diameter, pipe length, wall thickness, pipe material, operating time, operating pressure, operating temperature, operating output, water content, sulfur content, corrosion defect elevation position, and corrosion defect mileage position parameters as input, and uses the percentage of internal corrosion defect depth as output.

[0031] In some embodiments of the present invention, the second prediction model takes pipe diameter, pipe length, wall thickness, pipe material, operating time, operating pressure, operating temperature, operating output, water content, sulfur content, corrosion defect elevation position, and corrosion defect mileage position parameters as input, and uses the percentage of internal corrosion defect depth as output.

[0032] In some embodiments of the present invention, the third prediction model takes pipe diameter, pipe length, wall thickness, pipe material, operating time, operating pressure, operating temperature, operating output, water content, sulfur content, corrosion defect elevation position, and corrosion defect mileage position parameters as input, and uses the percentage of internal corrosion defect depth as output.

[0033] In some embodiments of the present invention, a RF-MLP-LightGBM fourth prediction model is established based on the first prediction model, the second prediction model and the third prediction model, including:

[0034] Define the error value RMSE between the actual value and the predicted value of the corrosion defect depth percentage: Among them, yi is the actual percentage value of the corrosion defect depth, is the predicted value of the percentage of corrosion defect depth, n is the number of actual or predicted values ​​of the percentage of corrosion defect depth, i = 1, 2, 3...n;

[0035] Calculate the error values ​​RMSE1, RMSE2 and RMSE3 of the RF first prediction model, the MLP second prediction model and the LightGBM third prediction model, and sort them by numerical value;

[0036] Define a, b, and c as the quotient of the absolute value of the difference between RMSE1, RMSE2, and RMSE3 and the maximum value among RMSE1, RMSE2, and RMSE3, respectively. Set the threshold to 0.05.

[0037] When a, b, and c are all greater than 0.05, the single prediction model with the smallest RMSE error value is selected as the fourth prediction model to participate in subsequent prediction calculations;

[0038] When one of a, b, and c is less than 0.05 and two of them are greater than 0.05, take the two prediction models corresponding to the one less than 0.05, calculate their weights and combine them as the fourth prediction model for subsequent prediction calculations;

[0039] When at least two of a, b, and c are less than 0.05, the weights of the three prediction models are determined according to the error values ​​of the three prediction models, and the three prediction models are combined as the fourth prediction model to participate in subsequent prediction calculations.

[0040] In some embodiments of the present invention, the trained RF-MLP-LightGBM fourth prediction model is used to input pipe diameter, pipe length, wall thickness, pipe material, operating time, operating pressure, operating temperature, operating output, water content, sulfur content, corrosion defect elevation position, and corrosion defect mileage position parameters to predict and calculate the final percentage of corrosion defect depth within the entire natural gas gathering and transmission pipeline.

[0041] In a second aspect, the present invention discloses a device for predicting the depth of corrosion defects in the entire natural gas gathering and transportation pipeline, comprising:

[0042] Data collection unit, used to collect internal corrosion data of natural gas gathering and transportation pipelines;

[0043] A data preprocessing unit, used for preprocessing the internal corrosion data;

[0044] A data conversion unit, used for converting discrete text data in the internal corrosion data into numerical data;

[0045] RF first prediction model building unit, used to build the first prediction model of corrosion defect depth in the entire natural gas gathering and transportation pipeline based on RF random forest;

[0046] The MLP second prediction model establishment unit is used to establish the second prediction model of the corrosion defect depth of the entire natural gas gathering and transportation pipeline based on the MLP neural network;

[0047] LightGBM third prediction model establishment unit, used to establish the third prediction model of corrosion defect depth in the entire natural gas gathering and transmission pipeline based on LightGBM;

[0048] An RF-MLP-LightGBM fourth prediction model establishing unit, used to establish an RF-MLP-LightGBM fourth prediction model based on the first prediction model, the second prediction model and the third prediction model;

[0049] The prediction calculation unit is used to predict and calculate the percentage of corrosion defect depth in the entire natural gas gathering and transportation pipeline based on the trained RF-MLP-LightGBM fourth prediction model.

[0050] In a third aspect, the present invention discloses an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the above-mentioned method for predicting the depth of corrosion defects within the entire natural gas gathering and transmission pipeline are implemented.

[0051] In a fourth aspect, the present invention discloses a computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the steps of the above-mentioned method for predicting the depth of corrosion defects within the entire natural gas gathering and transmission pipeline are implemented.

[0052] Technical effects and advantages of the present invention:

[0053] The present invention is based on a large amount of on-site natural gas gathering and transportation pipeline internal corrosion defect depth data, combined with three data-driven models, and can effectively predict the internal corrosion defect depth of the entire natural gas gathering and transportation pipeline. It has good generalization and robustness, greatly improves the accuracy of the prediction model, and the lowest prediction error can reach 0.0374.

[0054] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 This is a flow chart of a method for predicting the depth of corrosion defects in the entire natural gas gathering and transportation pipeline of the present invention;

[0056] Figure 2This is a flow chart of a method for establishing the fourth prediction model of RF-MLP-LightGBM of the present invention;

[0057] Figure 3 This is a comparison curve diagram of the final output predicted value and the actual value of the fourth prediction model of RF-MLP-LightGBM in an embodiment of the present invention;

[0058] Figure 4 The present invention is a schematic structural diagram of a device for predicting the depth of corrosion defects within the entire natural gas gathering and transportation pipeline. DETAILED DESCRIPTION

[0059] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0060] like Figure 1 As shown, the present invention provides a method for predicting the depth of corrosion defects within the entire natural gas gathering and transportation pipeline, including:

[0061] Collect internal corrosion data of natural gas gathering and transportation pipelines;

[0062] Preprocess the internal corrosion data;

[0063] Convert the discrete text data in the internal corrosion data into numerical data;

[0064] Establish the first prediction model for corrosion defect depth of natural gas gathering and transmission pipelines based on RF random forest;

[0065] Establish the second prediction model of corrosion defect depth in the entire natural gas gathering and transportation pipeline based on MLP neural network;

[0066] Establish the third prediction model of corrosion defect depth in the entire natural gas gathering and transportation pipeline based on LightGBM;

[0067] Establishing the RF-MLP-LightGBM fourth prediction model based on the first prediction model, the second prediction model and the third prediction model;

[0068] Based on the trained RF-MLP-LightGBM fourth prediction model, the final percentage of corrosion defect depth within the entire natural gas gathering and transportation pipeline is predicted and calculated.

[0069] In some embodiments of the present invention, collecting internal corrosion data of a natural gas gathering and transportation pipeline includes:

[0070] Collect data on the diameter, length, wall thickness, pipe material, operating time, operating pressure, operating temperature, operating output, water content, sulfur content, pipeline mapping data, corrosion defect mileage location and internal corrosion defect depth of natural gas gathering and transportation pipelines.

[0071] In some embodiments of the present invention, the internal corrosion data is preprocessed, including:

[0072] Based on the mileage position of the corrosion defect, the pipeline surveying data collected on site is converted into the corresponding elevation position of the corrosion defect using cubic spline interpolation method;

[0073] Eliminate missing data;

[0074] Use box plots to identify and remove outliers;

[0075] The characteristic data are standardized by rescaling them to zero mean and unit variance, where the characteristic data are numerical data corresponding to pipe diameter, pipe length, wall thickness, pipe material, operating time, operating pressure, operating temperature, operating output, moisture content, sulfur content, corrosion defect elevation position, and corrosion defect mileage position.

[0076] In some embodiments of the invention, the data is normalized by rescaling the feature data to zero mean and unit variance, including:

[0077] Normalized data is based on the following formula:

[0078] Among them, x is the feature data before preprocessing, μ is the mean of the feature data before preprocessing, σ is the standard deviation of the feature data before preprocessing, and y is the standardized feature data.

[0079] In some embodiments of the present invention, converting discrete text data in the internal corrosion data into numerical data includes:

[0080] The discrete text data in the internal corrosion data is converted into numerical data using the unique hot encoding form. It should be noted that since most deep learning and machine learning models can only recognize numerical data, discrete text data must be converted into numerical data when faced with it. For example, there are many types of pipe materials such as 20#, L360, L360QB, L360QS, L245NCS, 16Mn, etc. The unique hot encoding form is used to convert the discrete text type data of pipes into numerical data. The specific conversion rules are shown in Table 1.

[0081] Table 1 Pipe conversion rules

[0082] Text form 20# L360 L360QB L360QS L245NCS 16Mn Conversion form 100000 010000 001000 000100 000010 000001

[0083] In some embodiments of the present invention, the first prediction model takes pipe diameter, pipe length, wall thickness, pipe material, operating time, operating pressure, operating temperature, operating output, water content, sulfur content, corrosion defect elevation position, and corrosion defect mileage position parameters as input, and uses the percentage of internal corrosion defect depth as output.

[0084] In some embodiments of the present invention, the second prediction model takes pipe diameter, pipe length, wall thickness, pipe material, operating time, operating pressure, operating temperature, operating output, water content, sulfur content, corrosion defect elevation position, and corrosion defect mileage position parameters as input, and uses the percentage of internal corrosion defect depth as output.

[0085] In some embodiments of the present invention, the third prediction model takes pipe diameter, pipe length, wall thickness, pipe material, operating time, operating pressure, operating temperature, operating output, water content, sulfur content, corrosion defect elevation position, and corrosion defect mileage position parameters as input, and uses the percentage of internal corrosion defect depth as output.

[0086] In some embodiments of the present invention, Figure 2 As shown, the RF-MLP-LightGBM fourth prediction model is established based on the first prediction model, the second prediction model and the third prediction model, including:

[0087] Define the error value RMSE between the actual value and the predicted value of the corrosion defect depth percentage: Among them, y i is the actual percentage value of the corrosion defect depth, is the predicted value of the percentage of corrosion defect depth, n is the number of actual or predicted values ​​of the percentage of corrosion defect depth, i = 1, 2, 3...n. It should be noted that since the percentage of corrosion defect depth is greater than zero and the percentages of depths of different defects vary greatly, the logarithm of the model prediction value is used to measure the error;

[0088] Calculate the error values ​​RMSE1, RMSE2 and RMSE3 of the RF first prediction model, the MLP second prediction model and the LightGBM third prediction model, and sort them by numerical value;

[0089] Define a, b, and c as the quotient of the absolute value of the difference between RMSE1, RMSE2, and RMSE3 and the maximum value among RMSE1, RMSE2, and RMSE3, respectively. Set the threshold to 0.05.

[0090] When a, b, and c are all greater than 0.05, it indicates that the RMSE of the three prediction models differ greatly, and the single prediction model with the smallest RMSE error is selected as the fourth prediction model to participate in subsequent prediction calculations;

[0091] When one of a, b, and c is less than 0.05 and two are greater than 0.05, take the two prediction models corresponding to the one less than 0.05, calculate the weights of the two and combine them as the fourth prediction model for subsequent prediction calculations. Taking a less than 0.05 and b and c greater than 0.05 as an example, it shows that the error values ​​of the RF first prediction model and the MLP second prediction model are slightly different, and the error value deviation of the LightGBM third prediction model is large. Therefore, the RF first prediction model and the MLP second prediction model are combined as the fourth prediction model, and the weights of the two are calculated and applied to subsequent prediction calculations.

[0092]

[0093]

[0094] Ypred=Ypred_RF×Q1+Ypred_MLP×Q2

[0095] Among them, Ypred_RF is the predicted value of the RF first prediction model; Ypred_MLP is the predicted value of the MLP second prediction model, Q1 is the weight of the predicted value of the RF first prediction model in the combined model, Q2 is the weight of the predicted value of the MLP second prediction model in the combined model, and Ypred is the final predicted output value of the combined model.

[0096] When at least two of a, b, and c are less than 0.05, it indicates that the RMSE of the error values ​​of the three prediction models are slightly different. Therefore, the combined RF-MLP-LightGBM is used as the prediction model to participate in subsequent prediction calculations. The weight of each model is determined according to the error value of the three prediction models. The three prediction models are combined as the fourth pre-stored model to participate in subsequent prediction calculations. The calculation formula is as follows.

[0097]

[0098]

[0099]

[0100] Ypred=Ypred_RF×Q1+Ypred_MLP×Q2+Ypred_LightGBM×Q3

[0101] Among them, Ypred_RF is the predicted value of the first prediction model RF, Ypred_MLP is the predicted value of the second prediction model MLP, Ypred_LightGBM is the predicted value of the third prediction model LightGBM, Q1 is the weight of the predicted value of the first prediction model RF in the combined model, Q2 is the weight of the predicted value of the second prediction model MLP in the combined model, Q3 is the weight of the predicted value of the third prediction model LightGBM in the combined model, and Ypred is the final predicted output value of the combined model.

[0102] In some embodiments of the present invention, the trained RF-MLP-LightGBM prediction model is used to input pipe diameter, pipe length, wall thickness, pipe material, operating time, operating pressure, operating temperature, operating output, water content, sulfur content, corrosion defect elevation position, and corrosion defect mileage position parameters to predict and calculate the final percentage of corrosion defect depth within the entire natural gas gathering and transmission pipeline.

[0103] Second, as Figure 4 As shown, the present invention provides a device for predicting the depth of corrosion defects in the entire natural gas gathering and transportation pipeline, comprising:

[0104] Data collection unit, used to collect internal corrosion data of natural gas gathering and transportation pipelines;

[0105] A data preprocessing unit, used for preprocessing the internal corrosion data;

[0106] A data conversion unit, used for converting discrete text data in the internal corrosion data into numerical data;

[0107] RF prediction model building unit, used to build a prediction model for corrosion defect depth within the entire natural gas gathering and transportation pipeline based on RF random forest;

[0108] LightGBM prediction model building unit, used to build a LightGBM-based natural gas gathering and transportation pipeline internal corrosion defect depth prediction model;

[0109] RF-MLP-LightGBM prediction model building unit, used to build the RF-MLP-LightGBM prediction model;

[0110] The prediction calculation unit is used to predict and calculate the percentage of corrosion defect depth in the entire natural gas gathering and transportation pipeline based on the trained RF-MLP-LightGBM prediction model.

[0111] In a third aspect, the present invention provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the above-mentioned method for predicting the depth of corrosion defects within the entire natural gas gathering and transmission pipeline are implemented.

[0112] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the steps of the above-mentioned method for predicting the depth of corrosion defects within the entire natural gas gathering and transmission pipeline are implemented.

[0113] In order to better illustrate the present solution, the following embodiments are also provided.

[0114] Example

[0115] Taking a gathering and transportation pipeline of a well field in a gas field in the southwest as an example, the method of the present invention is used to predict the depth of corrosion defects in the pipeline along the entire line:

[0116] The first step is to collect the pipe diameter, length, wall thickness, pipe material, operating time, operating pressure, operating temperature, operating output, water content, sulfur content, pipeline mapping data, corrosion defect mileage location and internal corrosion defect depth data of the natural gas gathering and transportation pipeline.

[0117] In the second step, based on the mileage position of the corrosion defect, the pipeline mapping data collected on site is converted into the corresponding elevation position of the corrosion defect using cubic spline interpolation; missing data are eliminated; abnormal data are identified and eliminated using box plots; and the characteristic data are standardized by rescaling them to zero mean and unit variance, where the characteristic data are numerical data corresponding to pipe diameter, pipe length, wall thickness, pipe material, operating time, operating pressure, operating temperature, operating output, water content, sulfur content, corrosion defect elevation position, corrosion defect mileage position and internal corrosion defect depth.

[0118] The third step is to use one-hot encoding to convert the discrete text data in the inner corrosion data into numerical data.

[0119] The fourth step is to complete the establishment of the first prediction model for the corrosion defect depth of the entire natural gas gathering and transmission pipeline based on RF random forest, use 80% of the collected sample data as a training set for model training, and complete the model training.

[0120] The fifth step is to complete the establishment of the second prediction model for the corrosion defect depth of the entire natural gas gathering and transportation pipeline based on the MLP neural network, use the collected 80% sample data as a training set for model training, and complete the model training.

[0121] The sixth step is to complete the establishment of the third prediction model for the corrosion defect depth of the entire natural gas gathering and transmission pipeline based on LightGBM, use the collected 80% sample data as a training set for model training, and complete the model training.

[0122] In the seventh step, the fourth prediction model of RF-MLP-LightGBM is established based on the first prediction model, the second prediction model and the third prediction model. The remaining 20% ​​of the sample data of steps four, five and six are used as the validation set for model validation, among which: the validation set error RMSE1 of the first prediction model of RF random forest is 0.0378; the validation set error RMSE2 of the second prediction model of MLP neural network is 0.0375; the validation set error RMSE3 of the third prediction model of LightGBM is 0.0374. Secondly, a is calculated to be 0.0079, b is 0.0026, and c is 0.01, all less than 0.05, so the fourth prediction model is obtained by combining the three models. Next, the weight Q1 of the predicted value of the first prediction model of RF random forest is calculated to be 0.3319, the weight Q2 of the predicted value of the second prediction model of MLP neural network is 0.3327, and the weight Q3 of the predicted value of the third prediction model of LightGBM is 0.3354. Finally, the output value of the fourth prediction model of RF-MLP-LightGBM is as follows. The final output prediction value is compared with the actual value. Figure 3 As shown, it can be found that both curves are wavy, mainly concentrated in the corrosion defect depth percentage of 4%-8%. The predicted value curve can fit the actual value curve well. On the whole, the actual value curve includes the predicted value curve.

[0123] Ypred=Ypred_RF×0.3319+Ypred_MLP×0.3327+Ypred_LightGBM×0.3354

[0124] In the eighth step, based on the trained RF-MLP-LightGBM fourth prediction model, the relevant data of the test natural gas gathering and transportation pipeline, such as pipe diameter, pipe length, wall thickness, pipe material, operating time, operating pressure, operating temperature, operating flow, water content, sulfur content, elevation position, and mileage position, are input, and the percentage of corrosion defect depth in the entire pipeline is finally predicted and calculated, as shown in Table 2 below.

[0125] Table 2 Depth of corrosion defects in the entire pipeline

[0126] Mileage location 370.9 403.3 426.9 581.0 831.8 907.8 925.6 …… Internal corrosion defect depth 1% 4% 11% 14% 5% 11% 19% ……

[0127] In summary, based on a large amount of on-site natural gas gathering and transportation pipeline internal corrosion defect depth data and combined with three data-driven models, the present invention can effectively predict the internal corrosion defect depth of the entire natural gas gathering and transportation pipeline, has good generalization and robustness, greatly improves the accuracy of the prediction model, and the lowest prediction error can reach 0.0374.

[0128] Finally, it should be noted that the above is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, it is still possible for those skilled in the art to modify the technical solutions described in the aforementioned embodiments or to make equivalent substitutions for some of the technical features therein. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for predicting the depth of corrosion defects in the entire natural gas gathering and transportation pipeline, characterized in that: include: Collect internal corrosion data of natural gas gathering and transportation pipelines; Preprocessing the internal corrosion data; Converting the discrete text data in the internal corrosion data into numerical data; Establish the first prediction model for corrosion defect depth of natural gas gathering and transmission pipelines based on RF random forest; Establish the second prediction model of corrosion defect depth in the entire natural gas gathering and transportation pipeline based on MLP neural network; Establish the third prediction model of corrosion defect depth in the entire natural gas gathering and transportation pipeline based on LightGBM; Establishing the RF-MLP-LightGBM fourth prediction model based on the first prediction model, the second prediction model and the third prediction model; Based on the trained RF-MLP-LightGBM fourth prediction model, the final percentage of corrosion defect depth within the entire natural gas gathering and transportation pipeline is predicted and calculated.

2. A method for predicting the depth of corrosion defects in the entire natural gas gathering and transportation pipeline according to claim 1, characterized in that: The collection of internal corrosion data of natural gas gathering and transportation pipelines includes: Collect data on the diameter, length, wall thickness, pipe material, operating time, operating pressure, operating temperature, operating output, water content, sulfur content, pipeline mapping data, corrosion defect mileage location and internal corrosion defect depth of natural gas gathering and transportation pipelines.

3. A method for predicting the depth of corrosion defects in the entire natural gas gathering and transportation pipeline according to claim 2, characterized in that: The preprocessing of the internal corrosion data comprises: Based on the mileage position of the corrosion defect, the pipeline surveying data collected on site is converted into the corresponding elevation position of the corrosion defect using cubic spline interpolation method; Eliminate missing data; Use box plots to identify and remove outliers; Standardize the feature data by rescaling them to zero mean and unit variance.

4. A method for predicting the depth of corrosion defects in the entire natural gas gathering and transportation pipeline according to claim 3, characterized in that: The described method standardizes the data by rescaling the feature data to zero mean and unit variance, including: The normalized data is based on the following formula: Among them, x is the feature data before preprocessing, μ is the mean of the feature data before preprocessing, σ is the standard deviation of the feature data before preprocessing, and y is the standardized feature data.

5. The method for predicting the depth of corrosion defects in the entire natural gas gathering and transportation pipeline according to claim 1 is characterized in that: The step of converting the discrete text data in the internal corrosion data into numerical data includes: The discrete text data in the inner corrosion data is converted into numerical data by using one-hot encoding.

6. A method for predicting the depth of corrosion defects in the entire natural gas gathering and transportation pipeline according to claim 3, characterized in that: The first prediction model takes pipe diameter, pipe length, wall thickness, pipe material, operating time, operating pressure, operating temperature, operating output, moisture content, sulfur content, corrosion defect elevation position, and corrosion defect mileage position parameters as input, and internal corrosion defect depth percentage as output.

7. A method for predicting the depth of corrosion defects in the entire natural gas gathering and transportation pipeline according to claim 6, characterized in that: The second prediction model takes pipe diameter, pipe length, wall thickness, pipe material, operating time, operating pressure, operating temperature, operating output, moisture content, sulfur content, corrosion defect elevation position, and corrosion defect mileage position parameters as input, and uses the internal corrosion defect depth percentage as output.

8. A method for predicting the depth of corrosion defects in the entire natural gas gathering and transportation pipeline according to claim 7, characterized in that: The third prediction model takes pipe diameter, pipe length, wall thickness, pipe material, operating time, operating pressure, operating temperature, operating output, water content, sulfur content, corrosion defect elevation position, and corrosion defect mileage position parameters as input, and uses the internal corrosion defect depth percentage as output.

9. A method for predicting the depth of corrosion defects in the entire natural gas gathering and transportation pipeline according to claim 8, characterized in that: The fourth prediction model of RF-MLP-LightGBM is established based on the first prediction model, the second prediction model and the third prediction model, including: The error value RMSE between the actual value and the predicted value of the corrosion defect depth percentage is defined as: Among them, y i is the actual value of the corrosion defect depth percentage, is the predicted value of the percentage of corrosion defect depth, n is the number of actual or predicted values ​​of the percentage of corrosion defect depth, i = 1, 2, 3...n; Calculate the error values ​​RMSE1, RMSE2 and RMSE3 of the RF first prediction model, the MLP second prediction model and the LightGBM third prediction model, and sort them by numerical value; Define a, b, and c as the quotient of the absolute value of the difference between RMSE1, RMSE2, and RMSE3 and the maximum value among RMSE1, RMSE2, and RMSE3, respectively. Set the threshold to 0.

05. When a, b, and c are all greater than 0.05, the single prediction model with the smallest RMSE error value is selected as the fourth prediction model to participate in subsequent prediction calculations; When one of a, b, and c is less than 0.05 and two of them are greater than 0.05, take the two prediction models corresponding to the one less than 0.05, calculate their weights and combine them as the fourth prediction model for subsequent prediction calculations; When at least two of a, b, and c are less than 0.05, the weights of the three prediction models are determined according to the error values ​​of the three prediction models, and the three prediction models are combined as the fourth prediction model to participate in subsequent prediction calculations.

10. A method for predicting the depth of corrosion defects in the entire natural gas gathering and transportation pipeline according to claim 9, characterized in that: The trained RF-MLP-LightGBM fourth prediction model is used to input pipe diameter, pipe length, wall thickness, pipe material, operating time, operating pressure, operating temperature, operating output, water content, sulfur content, corrosion defect elevation position, and corrosion defect mileage position parameters to predict and calculate the final percentage of corrosion defect depth within the entire natural gas gathering and transmission pipeline.

11. A device for predicting the depth of corrosion defects in the entire natural gas gathering and transportation pipeline, characterized in that: include: Data collection unit, used to collect internal corrosion data of natural gas gathering and transportation pipelines; A data preprocessing unit, used for preprocessing the internal corrosion data; A data conversion unit, used for converting the discrete text data in the internal corrosion data into numerical data; RF first prediction model building unit, used to build the first prediction model of corrosion defect depth in the entire natural gas gathering and transportation pipeline based on RF random forest; The MLP second prediction model establishment unit is used to establish the second prediction model of the corrosion defect depth of the entire natural gas gathering and transportation pipeline based on the MLP neural network; LightGBM third prediction model establishment unit, used to establish the third prediction model of corrosion defect depth in the entire natural gas gathering and transmission pipeline based on LightGBM; An RF-MLP-LightGBM fourth prediction model establishing unit, used to establish an RF-MLP-LightGBM fourth prediction model based on the first prediction model, the second prediction model and the third prediction model; The prediction calculation unit is used to predict and calculate the percentage of corrosion defect depth in the entire natural gas gathering and transportation pipeline based on the trained RF-MLP-LightGBM fourth prediction model.

12. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of a method for predicting the depth of corrosion defects in the entire natural gas gathering and transportation pipeline as described in any one of claims 1-10 are implemented.

13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of a method for predicting the depth of corrosion defects in the entire natural gas gathering and transportation pipeline as described in any one of claims 1 to 10 are implemented.