Gathering and transportation pipeline liquid accumulation amount fuzzy real-time prediction method based on KNN algorithm

The method of fuzzy real-time prediction of liquid accumulation in gathering and transportation pipelines based on the KNN algorithm solves the problem of difficult prediction of liquid accumulation in gathering and transportation pipelines, realizes intelligent and automated liquid accumulation calculation, optimizes the operating efficiency of the gathering and transportation system, and reduces the error and time cost of human judgment.

CN121997686APending Publication Date: 2026-05-08PETROCHINA CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
PETROCHINA CO LTD
Filing Date
2024-11-01
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

In existing technologies, it is difficult to accurately predict the amount of liquid accumulated in gathering and transportation pipelines, leading to manual judgment of venting operations, which wastes manpower and time costs and is prone to pipeline freezing and blockage.

Method used

A fuzzy real-time prediction method for liquid accumulation in gathering and transportation pipelines based on the KNN algorithm is adopted. The liquid accumulation is calculated using the FLAT model, KNN algorithm parameters are set, bad points are removed, data normalization and K-fold cross-validation are performed, the KNN model is trained, and the liquid accumulation is calculated using the momentum equation.

Benefits of technology

It enables intelligent and automated real-time prediction of liquid accumulation in gathering and transportation pipelines, optimizes processes, reduces human judgment, lowers back pressure, increases flow rate, avoids pipeline freezing and blockage, and provides support for energy saving and efficiency improvement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121997686A_ABST
    Figure CN121997686A_ABST
Patent Text Reader

Abstract

The invention provides a gathering and transportation pipeline liquid accumulation amount fuzzy real-time prediction method based on a KNN algorithm, and the method comprises the steps: carrying out the calculation of a liquid accumulation amount through a FLAT model, carrying out the first defective pixel elimination, and carrying out the second defective pixel elimination through the given production time (h) and the gas-water ratio (G / L) range. And finally, an interval is determined by adding and subtracting two times of a standard value to the mean value of the oil pressure to serve as a standard for judging the dead pixels to perform third-time dead pixel elimination, real-time calculation is performed through a KNN algorithm, the liquid accumulation amount of the gathering and transportation pipeline is obtained through iteration of the algorithm, the problem that the liquid accumulation amount is difficult to predict in the prior art is solved, the design optimization process is intelligent and automatic, and the working efficiency is improved. And certain technical support is provided for energy conservation and efficiency improvement of a gathering and transportation system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of oil and gas storage and transportation, specifically relating to a fuzzy real-time prediction method for liquid accumulation in gathering and transportation pipelines based on the KNN algorithm. Background Technology

[0002] Most gas fields have entered the late stages of development, characterized by decreased formation pressure, reduced gas production, increased water production, and an increase in low-yield and low-pressure wells, severely impacting the overall efficiency of the gas fields. The gathering and transportation system is affected by factors such as reduced well production, decreased wellhead pressure, increased back pressure due to increased produced fluid, longer gathering and transportation radii, and undulating pipeline routes, leading to reduced gas flow velocity and decreased fluid-carrying capacity in the pipeline network. If not detected and addressed promptly, this can easily cause pipeline freezing and blockage, necessitating venting of the gathering and transportation network with fluid to reduce back pressure, increase flow velocity, and remove accumulated fluid from wellbores and surface pipelines. However, at present, the amount of accumulated fluid is difficult to predict, and the decision to vent largely relies on human judgment. Therefore, establishing a fuzzy real-time calculation model and algorithm for the fluid accumulation status and volume of gathering and transportation pipelines, along with intelligent rotation and fixed-point pumping and pressurization technology devices for single wells to achieve energy conservation and efficiency improvement, is highly significant. Currently, calculating the fluid accumulation status of gathering and transportation pipelines typically requires extensive trial calculations, which consumes considerable manpower and time. Summary of the Invention

[0003] The purpose of this invention is to provide a fuzzy real-time prediction method for the amount of liquid accumulated in gathering and transportation pipelines based on the KNN algorithm, so as to solve the problem that the amount of liquid accumulated is difficult to predict in existing methods.

[0004] The objective of this invention is achieved through the following technical means: a fuzzy real-time prediction method for liquid accumulation in gathering and transportation pipelines based on the KNN algorithm.

[0005] Calculate the liquid accumulation in the gathering and transportation pipeline using the FLAT model;

[0006] Set KNN algorithm parameters, including production time, oil pressure, casing pressure, liquid accumulation in gathering and transportation pipelines, annual water production, cumulative gas production, gas-water ratio, formation, commissioning time, wellhead temperature, geographical location, and degree of change in liquid accumulation as labels;

[0007] Obtain historical well site data corresponding to the algorithm parameters, and group the algorithm parameters corresponding to a certain moment into a group;

[0008] By using historical data, the range of some algorithm parameters can be determined, thereby eliminating bad points in the algorithm parameter data;

[0009] A range of oil pressure is determined by adding or subtracting twice the standard value from the average oil pressure. Bad points in the algorithm parameter data are then removed. When removing bad points, all data in the same group are also removed.

[0010] Data preprocessing involves normalizing each feature value, i.e. each data point, and plotting a scatter matrix of all attributes to obtain the relationships between the attributes and the trends of the data.

[0011] The dataset is divided into training and test sets using K-fold cross-validation.

[0012] Model training uses the K-nearest neighbor algorithm and training set data to train the KNN model. By calculating the distance between each training data point, sorting the distances from smallest to largest, selecting the K points with the smallest distance, determining the frequency of occurrence of the K point categories, and finally using the category with the highest frequency as the predicted classification.

[0013] To predict the liquid accumulation in a gathering and transportation pipeline, the algorithm parameter data of the pipeline to be predicted is collected and input into the trained model to obtain the predicted value of the liquid accumulation in the gathering and transportation pipeline.

[0014] The specific steps involved in predicting the liquid accumulation in the gathering and transportation pipeline using the FLAT model are as follows:

[0015] Obtain the gas velocity, liquid velocity, and inlet pressure within the gathering and transportation pipeline.

[0016] The amount of liquid accumulated in the pipe can be calculated using the momentum equation.

[0017]

[0018] A L =Aε (3)

[0019] Among them, A l A is the cross-sectional area of ​​the pipe occupied by the liquid phase. g S is the cross-sectional area of ​​the pipe occupied by the gas phase. i S is the perimeter of the gas-liquid interface. l Let S be the circumference of the liquid wall. g Let τ be the perimeter of the gas wall. i τ is the shear stress at the gas-liquid interface. wl For the shear stress on the liquid wall, τ wg For gas wall shear stress, For gas phase pressure drop, Where ε is the liquid phase pressure drop and ε is the liquid holdup.

[0020] Liquid accumulation = liquid holdup ε × pipeline mileage × pipeline cross-sectional area

[0021] ρ g g and β are the gas phase density, gravitational acceleration, and tilt angle, respectively; ρ1 is the liquid phase density.

[0022] A L A represents the liquid phase flow channel area and the total flow channel area, respectively.

[0023] The normalization specifically refers to...

[0024] α=2*(x i -x min ) / (x max -x min )-1 (5)

[0025] Where α is the normalized eigenvalue, x i For the eigenvalues ​​before normalization, x max x min are the maximum and minimum values ​​of the eigenvalues ​​before normalization, respectively, and i is the eigenvalue sequence number, representing the i-th eigenvalue, i∈1,...,n.

[0026] The training formula for the KNN model is as follows:

[0027]

[0028] The two points are X = (x1, x2, ..., x...). n Y = (y1, y2, ..., y) n );

[0029] Set the sample weights to distance, fine-tune the parameter n_neighbors, and use Lp distance. When p=2, it is the Euclidean distance. Before measurement, normalize the value of each attribute.

[0030] The K-nearest neighbor algorithm imports the KNeighborsClassifier model from the sklearn learning library, uses cross-validation to compare the AUC values ​​of the model under different K values, and finally obtains the optimal K value.

[0031] After the model training is completed, the model testing is also included. The non-gathering and transportation pipeline liquid accumulation data of the test set is input into the trained model to obtain the predicted data. If the error between the predicted data and the actual gathering and transportation pipeline liquid accumulation meets the requirements, the model training is completed; otherwise, the training is repeated.

[0032] The actual liquid holdup is also used as a constraint condition, where 0 ≤ actual liquid holdup ≤ liquid holdup calculated by the FLAT model in the gathering and transportation pipeline, thereby eliminating data groups with large errors in liquid accumulation in the historical data of the well site. Liquid accumulation = liquid holdup ε × pipeline mileage × pipeline cross-sectional area.

[0033] The beneficial effects of this invention are as follows: The fuzzy real-time calculation method for liquid accumulation in gathering and transportation pipelines based on the KNN algorithm determines the range of some variables and defines constraints. Considering that feature processing plays a crucial role in the accuracy of the final system, the liquid accumulation is calculated using the FLAT model for the first defect elimination. A second defect elimination is performed using a given production time (h) and air-to-water ratio (G / L) range. Finally, a third defect elimination is performed using the average oil pressure plus or minus twice the standard value to determine an interval as the criterion for judging defective points. The liquid accumulation in gathering and transportation pipelines is obtained in real time through the KNN algorithm and through algorithm iteration, solving the problem of difficult prediction of liquid accumulation in existing technologies. The optimized design process realizes intelligence and automation, providing certain technical support for energy saving and efficiency improvement of gathering and transportation systems. Attached Figure Description

[0034] Figure 1 This is a flowchart of the model training process of the present invention;

[0035] Figure 2 This is the machine learning prediction chaos matrix diagram in this invention;

[0036] Figure 3 This is the ROC matrix diagram for machine learning in this invention;

[0037] Figure 4 These are the AUC values ​​of the model under different K values ​​in this invention.

[0038] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Detailed Implementation

[0039]

Example 1

[0040] like Figure 1 As shown, a fuzzy real-time prediction method for liquid accumulation in gathering and transportation pipelines based on the KNN algorithm is presented.

[0041] Calculate the liquid accumulation in the gathering and transportation pipeline using the FLAT model;

[0042] The specific steps involved in predicting the liquid accumulation in the gathering and transportation pipeline using the FLAT model are as follows:

[0043] Obtain the gas velocity, liquid velocity, and inlet pressure within the gathering and transportation pipeline.

[0044] The amount of liquid accumulated in the pipe can be calculated using the momentum equation.

[0045]

[0046] A L =Aε (3)

[0047] Among them, A l Let A be the cross-sectional area of ​​the pipe occupied by the liquid phase.g S is the cross-sectional area of ​​the pipe occupied by the gas phase. i S is the perimeter of the gas-liquid interface. l Let S be the circumference of the liquid wall. g Let τ be the perimeter of the gas wall. i τ is the shear stress at the gas-liquid interface. wl For the shear stress on the liquid wall, τ wg For gas wall shear stress, For gas phase pressure drop,

[0048] Where ε is the liquid phase pressure drop and ε is the liquid holdup.

[0049] Liquid accumulation = Liquid holdup rate ε × Pipeline mileage × Pipeline cross-sectional area

[0050] ρ g g and β are the gas phase density, gravitational acceleration, and tilt angle, respectively; ρ1 is the liquid phase density.

[0051] A L A represents the liquid phase flow channel area and the total flow channel area, respectively.

[0052] Given the parameters of the gathering and transportation pipeline (including pipe diameter, surface tension, inclination angle, gas-liquid phase viscosity and density), the gas velocity and liquid velocity in the pipeline are calculated. Combined with the inlet pressure, the amount of liquid accumulated in the pipeline is calculated according to the momentum equations (1), (2), and (3). The amount of liquid accumulated is the liquid holdup rate × pipeline mileage × pipeline cross-sectional area.

[0053] Set KNN algorithm parameters, including production time, oil pressure, casing pressure, liquid accumulation in gathering and transportation pipelines, annual water production, cumulative gas production, gas-water ratio, formation, commissioning time, wellhead temperature, geographical location, and degree of change in liquid accumulation as labels;

[0054] Obtain historical well site data corresponding to the algorithm parameters, and group the algorithm parameters corresponding to a certain moment into a group; for example, the production time, oil pressure, casing pressure, liquid accumulation in the gathering and transportation pipeline, annual water production, cumulative gas production, gas-water ratio, formation, production time, wellhead temperature, geographical location and degree of change in liquid accumulation at a certain moment are grouped into a group.

[0055] Based on the actual site conditions, determine the design variables, optimization objectives, and constraints.

[0056] The actual liquid holdup is also used as a constraint condition, where 0 ≤ actual liquid holdup ≤ liquid holdup calculated by the FLAT model in the gathering and transportation pipeline, thereby eliminating data groups with large errors in liquid accumulation in the historical data of the well site. Liquid accumulation = liquid holdup ε × pipeline mileage × pipeline cross-sectional area.

[0057] Generally, the actual liquid holdup should not exceed 0.3. Alternatively, 0 ≤ actual liquid holdup ≤ 0.3 can be used as a constraint to eliminate data sets with large errors in liquid accumulation from historical well site data.

[0058] First, based on the fluid volume predicted by the FLAT model, remove the portion of historical data with large errors in fluid volume. Similarly, remove other data in the same group as the corresponding fluid volume, that is, remove the entire data group.

[0059] By using historical data, the range of some algorithm parameters can be determined, thereby eliminating bad points in the algorithm parameter data;

[0060] Specifically, the production time and air-to-water ratio should be within the following ranges: 0 ≤ h ≤ 24, 0 ≤ G / L ≤ 1; data exceeding these ranges are considered bad data and will be removed.

[0061] An oil pressure range is determined by adding or subtracting twice the standard value from the average oil pressure. Bad points in the algorithm parameter data are eliminated. When eliminating bad points, all data in the same group are also eliminated. The standard value is determined by a dataset composed of field data, which is used as the standard for judgment.

[0062] The hydraulic pressure formula is as follows:

[0063] data=(data[data['oil pressure'] < mean + (2 * std)]) (4)

[0064] Data preprocessing involves normalizing each feature value, i.e. each data point, to a mean of 0 and a variance of 1, and then plotting a scatter matrix of all attributes to obtain the relationships between the attributes and the trends of the data.

[0065] The normalization specifically refers to...

[0066] α=2*(x i -x min ) / (x max -x min )-1 (5)

[0067] Where α is the normalized eigenvalue, x i For the eigenvalues ​​before normalization, x max x min are the maximum and minimum values ​​of the eigenvalues ​​before normalization, respectively, and i is the eigenvalue sequence number, representing the i-th eigenvalue, i∈1,...,n.

[0068] To reduce the impact of data partitioning, the data set is divided into training and test sets using K-fold cross-validation.

[0069] like Figure 2 and Figure 3As shown, the model training uses the K-nearest neighbor algorithm and training set data to train the KNN model. By calculating the distance between each training data point, the distances are sorted from smallest to largest, and the K points with the smallest distances are selected to determine the frequency of occurrence of the K point categories. Finally, the category with the highest frequency is used as the predicted category.

[0070] The training formula for the KNN model is as follows:

[0071]

[0072] The two points are X = (x1, x2, ..., x...). n Y = (y1, y2, ..., y) n );

[0073] Set the sample weights to distance, fine-tune the parameter n_neighbors, and use Lp distance. When p=2, it is the Euclidean distance. Before measurement, normalize the value of each attribute.

[0074] like Figure 4 As shown, the K-nearest neighbor algorithm imports the KNeighborsClassifier model from the sklearn learning library, uses cross-validation to compare the model's AUC values ​​under different K values, and finally obtains the optimal K value. K=5.

[0075] To predict the liquid accumulation in a gathering and transportation pipeline, the algorithm parameter data of the pipeline to be predicted is collected and input into the trained model to obtain the predicted value of the liquid accumulation in the gathering and transportation pipeline.

[0076] After the model training is completed, the model testing is also included. The non-gathering and transportation pipeline liquid accumulation data of the test set is input into the trained model to obtain the predicted data. If the error between the predicted data and the actual gathering and transportation pipeline liquid accumulation meets the requirements, the model training is completed; otherwise, the training is repeated.

[0077] The entire prediction process involves first setting upper and lower limits for certain scalar parameters, such as the range of production time and air-to-water ratio, oil pressure range, and liquid holdup range, for subsequent defect elimination.

[0078] Set the error value E.

[0079] The second fluid accumulation volume Q2 was calculated using the FLAT model;

[0080] Based on the set upper and lower limits, bad data in the dataset is removed;

[0081] To perform data feature importance analysis, the remaining data after removing bad points are preprocessed, normalized to a mean of 0 and a variance of 1, and a scatter plot of all attributes is plotted. The importance of data features is obtained from the scatter plot of all attributes.

[0082] To build a machine learning model, the K-nearest neighbor algorithm and training set data are used to train the KNN model. By calculating the distance between each training data point, the distances are sorted from smallest to largest. The K points with the smallest distances are selected, and the frequency of occurrence of the K point categories is determined. Finally, the category with the highest frequency is used as the predicted category to complete the model training.

[0083] Model performance testing involves selecting non-fluid volume data from the test set and inputting it into the trained model to obtain the predicted first fluid volume Q1. The first fluid volume Q1 is then compared with the actual fluid volume Q in the data set. If the absolute value of the error between Q1 and Q is less than or equal to E, i.e., |Q1-Q|≤E, the model is considered to have sufficient accuracy and can be used for prediction. When using the model, the collected data is input into the model, and the output first fluid volume Q1 is the predicted value.

Claims

1. A fuzzy real-time prediction method for liquid accumulation in gathering and transportation pipelines based on the KNN algorithm, characterized in that: The amount of liquid accumulated in the gathering and transportation pipeline was calculated using the FLAT model. Set KNN algorithm parameters, including production time, oil pressure, casing pressure, liquid accumulation in gathering and transportation pipelines, annual water production, cumulative gas production, gas-water ratio, formation, commissioning time, wellhead temperature, geographical location, and degree of change in liquid accumulation as labels; Obtain historical well site data corresponding to the algorithm parameters, and group the algorithm parameters corresponding to a certain moment into a group; By using historical data, the range of some algorithm parameters can be determined, thereby eliminating bad points in the algorithm parameter data; A range of oil pressure is determined by adding or subtracting twice the standard value from the average oil pressure. Bad points in the algorithm parameter data are then removed. When removing bad points, all data in the same group are also removed. Data preprocessing involves normalizing each feature value, i.e. each data point, and plotting a scatter matrix of all attributes to obtain the relationships between the attributes and the trends of the data. The dataset is divided into training and test sets using K-fold cross-validation. Model training uses the K-nearest neighbor algorithm and training set data to train the KNN model. By calculating the distance between each training data point, sorting the distances from smallest to largest, selecting the K points with the smallest distance, determining the frequency of occurrence of the K point categories, and finally using the category with the highest frequency as the predicted classification. To predict the liquid accumulation in a gathering and transportation pipeline, the algorithm parameter data of the pipeline to be predicted is collected and input into the trained model to obtain the predicted value of the liquid accumulation in the gathering and transportation pipeline.

2. The method for real-time fuzzy prediction of liquid accumulation in gathering and transportation pipelines based on the KNN algorithm according to claim 1, characterized in that: The specific steps involved in predicting the liquid accumulation in the gathering and transportation pipeline using the FLAT model are as follows: Obtain the gas velocity, liquid velocity, and inlet pressure within the gathering and transportation pipeline. The amount of liquid accumulated in the pipe can be calculated using the momentum equation. A L =Aε (3) Among them, A l Let A be the cross-sectional area of ​​the pipe occupied by the liquid phase. g S is the cross-sectional area of ​​the pipe occupied by the gas phase. i S is the perimeter of the gas-liquid interface. l Let S be the circumference of the liquid wall. g Let τ be the perimeter of the gas wall. i τ is the shear stress at the gas-liquid interface. wl For the shear stress on the liquid wall, τ wg For gas wall shear stress, For gas phase pressure drop, Where ε is the liquid phase pressure drop and ε is the liquid holdup. Liquid accumulation = Liquid holdup rate ε × Pipeline mileage × Pipeline cross-sectional area ρg, g, and β represent the gas phase density, gravitational acceleration, and tilt angle, respectively; ρ1 represents the liquid phase density. A L A represents the liquid phase flow channel area and the total flow channel area, respectively.

3. The method for real-time fuzzy prediction of liquid accumulation in gathering and transportation pipelines based on the KNN algorithm according to claim 1, characterized in that: The normalization specifically refers to... α=2*(x i -x min ) / (x max -x min )-1 (5) Where α is the normalized eigenvalue, x i For the eigenvalues ​​before normalization, x max x min are the maximum and minimum values ​​of the eigenvalues ​​before normalization, respectively, and i is the eigenvalue sequence number, representing the i-th eigenvalue, i∈1,...,n.

4. The method for real-time fuzzy prediction of liquid accumulation in gathering and transportation pipelines based on the KNN algorithm according to claim 1, characterized in that: The training formula for the KNN model is as follows: The two points are X = (x1, x2, ..., x...). n Y = (y1, y2, ..., y) n ); Set the sample weights to distance, fine-tune the parameter n_neighbors, and use Lp distance. When p=2, it is the Euclidean distance. Before measurement, normalize the value of each attribute. The K-nearest neighbor algorithm imports the KNeighborsClassifier model from the sklearn learning library, uses cross-validation to compare the AUC values ​​of the model under different K values, and finally obtains the optimal K value.

5. A fuzzy real-time prediction method for liquid accumulation in gathering and transportation pipelines based on the KNN algorithm according to claim 1, characterized in that: After the model training is completed, the model testing is also included. The non-gathering and transportation pipeline liquid accumulation data of the test set is input into the trained model to obtain the predicted data. If the error between the predicted data and the actual gathering and transportation pipeline liquid accumulation meets the requirements, the model training is completed; otherwise, the training is repeated.

6. The method for real-time fuzzy prediction of liquid accumulation in gathering and transportation pipelines based on the KNN algorithm according to claim 1, characterized in that: The actual liquid holdup is also used as a constraint condition, where 0 ≤ actual liquid holdup ≤ liquid holdup calculated by the FLAT model in the gathering and transportation pipeline, thereby eliminating data groups with large errors in liquid accumulation in the historical data of the well site. Liquid accumulation = liquid holdup ε × pipeline mileage × pipeline cross-sectional area.