A dynamic distance coding method for abnormal identification in oil and gas gathering and transportation process
Through dynamic distance coding and deep learning technology, abnormal working conditions in the oil and gas gathering and transportation process are identified, which solves the identification difficulties of traditional methods under high coupling, high noise and sparse label data, and achieves rapid and accurate identification and mechanism of petrochemical processes. explanation, improving the robustness and reliability of fault identification.
Patent Information
- Application Number
- CN202210301009.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-25
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2042-03-25
AI Technical Summary
In the petrochemical industry, traditional fault identification methods are difficult to effectively identify abnormal working conditions in the oil and gas gathering and transportation process. Especially due to the high coupling, high noise and sparse label sample characteristics of process data, deep learning models lack interpretability and robustness. , and insufficient sample quality leads to poor performance.
The dynamic distance coding method is used to generate a dynamic coding diagram by calculating the spatial distance between variables, and combines deep learning technology to identify abnormal working conditions online, provide mechanism explanations, and improve the robustness of the model. Specific steps include data collection, noise reduction processing, distance metric calculation, deep learning model construction and training to identify anomalies.
It achieves rapid and accurate identification of abnormal working conditions in the oil and gas gathering and transportation process, provides mechanism explanations, improves the reliability and accuracy of fault identification, and overcomes the lack of interpretability and robustness of deep learning models in the petrochemical process. question.
Smart Images

Figure CN114722864B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of deep learning and identification of petrochemical processes, and in particular to a method for identifying abnormalities in oil and gas gathering and transportation processes using dynamic distance coding. Background Art
[0002] As an important part of the petroleum industry, the safety of oil and gas gathering and transportation processes has always been valued. In the early stages of risk, the lack of effective process control will lead to serious accidents such as fire and explosion. Timely and reliable fault identification methods are essential to ensure the smooth operation of the process. However, process data has the characteristics of high coupling, high noise and sparse label samples, which makes traditional fault identification methods difficult to apply. Therefore, the development of intelligent and reliable fault identification methods has become a key means for the safe operation of petrochemical processes including crude oil transportation, pretreatment, catalytic cracking, etc.
[0003] In recent years, with the complexity and high correlation of industrial data, scholars have developed deep learning and its derivative methods to learn mapping from collected feature data for fault identification. However, two major shortcomings of deep learning are still difficult to solve, affecting its application in petrochemical processes: (1) as a black box model, it is impossible to explore the physical meaning of the results and lacks interpretability; (2) the sample quality limits its feasibility, and insufficient labeled abnormal condition samples lead to poor performance.
[0004] Distance metrics are used to evaluate the similarity of different data distributions and have been applied to data dimensionality reduction, clustering, identification, etc. Distance metrics reduce the loss of model robustness due to different dynamic data distributions, but have not been applied in the field of fault identification. Summary of the invention
[0005] In response to the problems existing in the above-mentioned prior art, the present invention provides a method for identifying abnormalities in the oil and gas gathering and transportation process based on dynamic distance coding. It dynamically calculates the spatial distance between variables and uses deep learning technology to identify abnormal conditions, thereby providing a mechanism explanation for the abnormal conditions and having strong robustness.
[0006] To achieve the above object, the present invention provides the following technical solutions:
[0007] A dynamic distance coding anomaly recognition method for oil and gas gathering and transportation process includes data acquisition and preprocessing, sample dynamic distance calculation and coding, and deep learning online recognition. The specific implementation steps are as follows:
[0008] Step (1) collecting oil and gas gathering and transportation process data to construct real-time samples; and performing noise reduction processing on steady-state data to construct a normal sample data set, where the steady-state data is historical data under normal operating conditions;
[0009] Step (2) selects the data of each real-time sample and normal sample by sliding the window, calculates the spatial difference of the data distribution in the window based on the distance metric, and obtains the dynamic data set; then, generates the dynamic coding map of the real-time sample by sliding the window on the dynamic data set;
[0010] Step (3) uses the dynamic data set obtained in step (2) to build a deep learning model. The deep learning model quickly identifies anomalies by learning the deep features between variables.
[0011] Preferably, in step (1), the oil and gas gathering and transportation process data is collected by sensors, and the oil and gas gathering and transportation process data includes the following types of variables: flow, temperature and pressure. There are 20 key variables studied in total, as shown in Table 2. Normal labels and fault labels are set, and the normal labels and 8 fault labels are listed in Table 3:
[0012] Table 2 Variable information table of oil and gas gathering and transportation process
[0013] Variable number Variable Description Variable number Variable Description 1 1# Oil flow 11 Settling tank temperature 2 2# oil flow 12 Purified oil tank temperature 3 3# Oil flow 13 No. 2 heating furnace outlet temperature 4 4# Oil flow 14 No. 4 oil pressure 5 Three-phase separator outlet flow 15 Three-phase separator pressure 6 No. 1 heating furnace outlet flow 16 No. 1 heating furnace pressure 7 Purified oil tank outlet flow 17 Condenser pressure 8 No. 2 heating furnace outlet flow 18 Three-phase separator oil-water level 9 No. 1 heating furnace outlet temperature 19 Settling tank level 10 Condenser temperature 20 Purified oil tank level
[0014] Table 3 Label information
[0015] Tag Number Tag Description Tag Type 1 normal - 2 No. 4 oil flow Step 3 No. 1 pump speed Random Variation 4 Three-phase separator oil-water outlet flow Random Variation 5 Condenser outlet flow Step 6 No. 2 oil flow Random Variation 7 No. 1 oil valve Sticky 8 No. 2 pump speed Random Variation 9 Settling tank outlet flow Random Variation
[0016] Furthermore, the steady-state data is denoised based on the Savitzky-Golay (SG) filter, which denoises the normalized data based on the local polynomial least squares method of time domain fitting. The weighted filter obtained by fitting reduces the noise while ensuring the consistency of data shape and width.
[0017] Furthermore, the variables in Table 2 are normalized to map the oil and gas process data of different attributes to the same space to obtain normalized data, as shown in formula (1), which eliminates the distance deviation caused by different variable values and pays more attention to the fluctuation of the variables.
[0018]
[0019] In the formula, x * is the normalized variable value, x min and x max are the minimum and maximum values of the variable in the entire data set, respectively.
[0020] Preferably, the distance metric in step (2) includes Euclidean distance (ED), Hellinger distance (HD), and bulldozer distance (WD), and the respective distance calculation formulas are shown in formulas (2) to (4):
[0021]
[0022] Where x1 and x2 are the horizontal coordinates of the two points in space, and y1 and y2 are the vertical coordinates of the two points in space.
[0023]
[0024] Where p(x) and q(x) are two spatial distribution functions.
[0025]
[0026] Where P1 is the original distribution, P2 is the target distribution, x and y are the values of the original distribution and the target distribution respectively, γ is the joint distribution, Π(P1,P2) is the set of all possible combinations of the two distributions, E is the expected value, and inf is the lower bound value of the function.
[0027] In step (2), the dynamic encoding graph of the real-time sample is generated by the following method: a sliding window is introduced to calculate the distance between the normal sample and the input sample of a single variable in the window size, thereby generating an encoding block; the window slides on the variable to present the dynamic change of the distance; multiple variables between the normal sample and the input sample are encoded to generate an encoding heat map, which visualizes the spatial distribution difference between the normal and input states of each variable. By analyzing the changes in multiple variables, the cause of the current state can be found.
[0028] Furthermore, the dynamic distance between normal samples and real-time samples is encoded to generate a heat map. The window size of dynamic encoding is set to 100, the sliding step is 50, and finally 1200 continuous time data are generated in 24 time steps. At the same time, the variables with larger fluctuations in the heat map are selected to analyze the causes of the anomaly.
[0029] In the embodiment, by comparing the variable trend and the heat map, it can be seen that the change in the heat map color is consistent with the trend of the variable in time, and becomes more significant as the value deviation increases. It is proved that dynamic coding can capture the current state abnormality in time and has strong robustness under various operating conditions. This method not only provides a mechanistic explanation of the cause of abnormal operating conditions based on variable changes, but also further indicates the data characteristics of the input deep learning model.
[0030] Preferably, the deep learning model in step (3) includes a long short-term memory network model (LSTM) and its derivative models ED_LSTM, HD_LSTM and WD_LSTM, or a combination of several of them; the four models are independent of each other.
[0031] Furthermore, in step (3), the data sets were constructed using ED, HD or WD dynamic encoding, and the original data was used as a comparison, for a total of 4 data sets; each data set was divided into a training set, a validation set and a test set in a ratio of 8:1:1 to construct LSTM, ED-LSTM, HD-LSTM and WD-LSTM deep learning models. The complex relationship between the variables in the training set was learned to obtain deep features, the validation set was used for hyperparameter tuning and preliminary evaluation of network performance, and finally the results of model learning were evaluated through the test set.
[0032] In order to achieve the best performance of the model, the verification and confirmation method is used to search for the best hyperparameters. The specific verification and confirmation method is described in two steps: the first step is to design the network hyperparameter range and verify whether it is reasonable through expert experience and whether it conforms to the optimal design principle of the network; the second step is to use the training set for network training and verify the network performance through the test set. If it is not optimal, the network hyperparameters are readjusted. If it reaches the optimal, it is terminated, which means finding the optimal network hyperparameters.
[0033] Furthermore, the model selected 4 network layers and 250 hidden layers, which consisted of 4 single-layer LSTM chain cells, and the output of each cell was the input of the next layer of cells; the network settings were as follows: the optimization algorithm Early Stopping was used to interrupt the training when the loss function of the validation set increased; the optimizer used Adam adaptive moment estimation, the learning rate was 0.005, and the maximum gradient norm during training was 5; the Dropout layer was added at the end of the network hidden layer in order to temporarily discard some hidden nodes during training to prevent the network from overfitting.
[0034] The results of the implementation example show that as the number of learning steps increases, the loss function gradually decreases, indicating that the model captures the deep features of the data samples and continuously optimizes itself during the learning process. The loss function of the traditional LSTM shows a smooth downward trend, with a minimum of 0.0036 in the validation set of 9900 steps. ED_LSTM, HD_LSTM, and WD_LSTM drop rapidly in the early stages of training, and the loss function of the validation set reaches below 0.003 at 3000 steps. The final loss functions of ED_LSTM, HD_LSTM, and WD_LSTM reach 0.0004, 0.0006, and 0.0008, respectively. The final validation set accuracies are 0.808, 0.983, 0.973, and 0.957, respectively, and the distance metric improves the accuracy by at least 0.149. The stable performance of other models ED_LSTM, HD_LSTM, and WD_LSTM provides further evidence for helping LSTM process information.
[0035] Three evaluation indicators are introduced in the embodiment: precision, recall rate and F1 score to evaluate the performance of four deep learning models. Experiments show that the complex information and redundant features of the original data make the traditional LSTM perform poorly. Based on the comprehensive performance of the model, ED-LSTM stands out, with the accuracy, recall rate and F1 score under all working conditions reaching 0.987, 0.987 and 0.986 respectively, which are 0.185, 0.191 and 0.193 higher than those of the traditional LSTM, respectively, proving the reliability of the dynamic coding deep learning method combined with distance metric in fault identification.
[0036] Compared with the prior art, the present invention has the following beneficial effects:
[0037] (1) The present invention provides a method for identifying abnormalities in oil and gas gathering and transportation processes using dynamic distance coding. The distance metric is used to evaluate the spatial distribution of normal and real-time samples and dynamically encode the data, making the process characteristics dynamic and visual. The obtained features help the deep learning model to quickly and accurately identify samples without being limited by the influence of complex data features. Compared with the classic data-driven model, it has higher reliability.
[0038] (2) To address the defect that deep learning cannot provide a mechanistic explanation for the results, the coding diagram highlights the variables that deviate from the normal values to provide a mechanistic explanation for the abnormal operating conditions, supplement the database, solve the problem of insufficient label data in the oil and gas gathering and transportation process, and assist workers in determining the cause of the failure and ensuring the safe and smooth operation of the process. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.
[0040] Figure 1 : The overall flow chart of a method for identifying abnormalities in oil and gas gathering and transportation processes using dynamic distance coding provided by the present invention.
[0041] Figure 2 : Distance measurement description method, where (a): Euclidean distance (ED), (b): Hellinger distance (HD), (c): Bulldozer distance (WD).
[0042] Figure 3 : Dynamic encoding schematic diagram.
[0043] Figure 4 : LSTM working principle diagram, including (a) external connection and (b) internal logic.
[0044] Figure 5 :Flow chart of oil and gas gathering and transportation process.
[0045] Figure 6 : Figure 5 Comparison of the data of heating furnace No. 1 before and after noise reduction: (a) flow rate, (b) temperature, and (c) pressure.
[0046] Figure 7 : Label 2-9 (ah) Encoded heat map and main analysis variables of abnormal operating conditions.
[0047] Figure 8 : Deep learning model hyperparameter optimization, including (a) LSTM, (b) ED_LSTM, (c) HD_LSTM, (d) WD_LSTM.
[0048] Fig. 9 : Loss functions of deep learning model training set and validation set, including (a) LSTM, (b) ED_LSTM, (c) HD_LSTM, and (d) WD_LSTM.
[0049] Fig.10 : Accuracy of deep learning model training set and validation set, including (a) LSTM, (b) ED_LSTM, (c) HD_LSTM, and (d) WD_LSTM.
[0050] Fig.11 : Visualization results of confusion matrix of deep learning models, including (a) LSTM, (b) ED_LSTM, (c) HD_LSTM, and (d) WD_LSTM. DETAILED DESCRIPTION
[0051] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs.
[0052] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprising" and / or "including" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.
[0053] The terms in the embodiments are explained and described as follows:
[0054] "Steady-state data" in step (1): The operating status data of each key process control point of the chemical production device under normal operating conditions is collected as steady-state data.
[0055] "Key variables" in step (1): Key variables are the variables that need to be monitored and controlled based on the factory HAZOP analysis. Changes in these variables often have a greater impact on the entire process.
[0056] The “normal sample” in step (2) refers to the data set after steady-state data denoising, corresponding to the “normal sample data set”.
[0057] The "input sample" in step (2) refers to: real-time sample, real-time data collected online on the factory DCS.
[0058] The "dynamic data set" in step (3) means: the dynamic here means that the data set is collected in real time, and the data changes over time, which is convenient for LSTM model recognition. In the ED-LSTM, HD-LSTM or WD-LSTM deep learning model, the dynamic data set is the data set of the distance between the real-time samples and the normal samples after the distance metric is calculated.
[0059] A dynamic distance coding anomaly recognition method for oil and gas gathering and transportation process, the theoretical framework is as follows Figure 1 As shown, the specific steps are as follows:
[0060] (1) Collect oil and gas gathering and transportation process data through sensors to construct real-time samples. Perform noise reduction on steady-state data based on Savitzky-Golay (SG) filter to construct a normal sample data set.
[0061] Oil and gas gathering and transportation process flow chart Figure 5 The oil supply information is shown in Table 1.
[0062] Table 1 Oil information table of oil and gas gathering and transportation process
[0063] Oil serial number Molar flow rate (kmol / h) Temperature (K) Pressure(MPa) 1 481.5 377.15 0.23 2 1583.7 338.15 0.23 3 506.7 323.15 0.2 4 14687.2 323.15 0.23
[0064] The risks in the oil and gas gathering and transportation process mainly include the physical and chemical properties of the oil and gas fields and the temperature of crude oil transportation. The heating furnace, as a device that controls the temperature of crude oil to reduce viscosity and increase fluidity, is the main object of safety risk analysis. The key variables of the study are determined based on the hazard and operability (HAZOP) node analysis of the plant, and a total of 20 are listed in Table 2. The existing fault labels (normal, 8 faults) are listed in Table 3, each label contains 1200 continuous time data, and the total process data set dimension is (1200*20*9).
[0065] Table 2 Variable information table of oil and gas gathering and transportation process
[0066] Variable number Variable Description Variable number Variable Description 1 1# Oil flow 11 Settling tank temperature 2 2# oil flow 12 Purified oil tank temperature 3 3# Oil flow 13 No. 2 heating furnace outlet temperature 4 4# Oil flow 14 No. 4 oil pressure 5 Three-phase separator outlet flow 15 Three-phase separator pressure 6 No. 1 heating furnace outlet flow 16 No. 1 heating furnace pressure 7 Purified oil tank outlet flow 17 Condenser pressure 8 No. 2 heating furnace outlet flow 18 Three-phase separator oil-water level 9 No. 1 heating furnace outlet temperature 19 Settling tank level 10 Condenser temperature 20 Purified oil tank level
[0067] Table 3 Label description
[0068]
[0069]
[0070] Distance metrics evaluate the spatial distribution of data, and their results are affected by the attributes of the variables. By normalizing, data with different attributes are mapped to the same space as shown in Equation (1), which eliminates the distance deviation caused by different variable values and pays more attention to the fluctuation of the variables in Table 2.
[0071]
[0072] In the formula, x * is the normalized variable value, x min and x max are the minimum and maximum values of the variable in the entire data set, respectively.
[0073] The oil and gas gathering and transportation process contains a lot of noise due to the influence of unstable factors such as equipment load, external environment, and sensors. The SG filter reduces the noise of normalized data based on the local polynomial least squares method of time domain fitting. The weighted filter obtained by fitting reduces the noise while ensuring the consistency of data shape and width. Taking the flow, temperature, and pressure of the #1 heating furnace as an example, the data denoising comparison is as follows: Figure 6 shown.
[0074] exist Figure 6 In the example, the original data fluctuates greatly with the time step, especially in (a) and (c), which causes the features to be masked by noise and difficult to extract. The SG filter is used to eliminate some outliers (marked with circles) that affect model recognition, as shown in Figure 2. Figure 6 (a) 115, 415, 514 time steps, Figure 6 (b) 155 time steps, Figure 6 (c) 415, 430, and 1046 time steps. It is particularly noteworthy that the data collected by the sensor has Figure 6 (b) The steps of 965-1035 time steps. The SG filter restores the data features as much as possible through spatial domain selection and polynomial order optimization, providing a more accurate distance metric for the encoding work in the next section.
[0075] (2) Select the data of each real-time sample and normal sample by sliding the window. Calculate the spatial difference of data distribution within the window based on the distance metric. Then, generate the dynamic encoding map of the real-time sample by sliding the window on the data set.
[0076] The distance metric chosen is Figure 2 As shown, the distance calculation of Euclidean distance (ED), Hellinger distance (HD), and bulldozer distance (WD) are shown in formulas (2)-(4).
[0077]
[0078] Where x1 and x2 are the horizontal coordinates of the two points in space, and y1 and y2 are the vertical coordinates of the two points in space.
[0079]
[0080] Where p(x) and q(x) are two spatial distribution functions.
[0081]
[0082] Where P1 is the original distribution, P2 is the target distribution, x and y are the values of the original distribution and the target distribution respectively, γ is the joint distribution, Π(P1,P2) is the set of all possible combinations of the two distributions, E is the expected value, and inf is the lower bound value of the function.
[0083] Dynamic encoding principle Figure 3 As shown. Figure 3 In (a), a sliding window is introduced to calculate the distance between normal samples and input samples of a single variable in the window size to generate the encoding block. The window slides over the variable to show the dynamic change of the distance, such as Figure 3 (b) as shown. Figure 3 (c) Encode multiple variables between two samples to generate an encoding heat map, which visualizes the difference in spatial distribution of each variable between the input and normal states. By analyzing the changes in multiple variables, the cause of the current state can be found.
[0084] The dynamic distance between normal samples (1200*20*1) and real-time samples (1200*20*8) is encoded to generate a heat map. The window size of dynamic encoding is set to 100, the sliding step is 50, and finally 1200 continuous time data are generated in 24 time steps. At the same time, the variables with large fluctuations in the heat map are selected to analyze the causes of the anomaly. The encoded heat map and main analysis variables of fault labels 2-9 in Table 3 are as follows: Figure 7 As shown, the heat bar is the distance between the real-time sample and the normal sample, and the trend of the main variables over time is shown above the heat map.
[0085] According to the number of color anomalies in the heat map, the causes of the eight working conditions are divided into two categories: (1) Single variable conditions include Figure 7 (b), (d), (e), (g) and (h). Figure 7 (b) The speed of pump 1 changes randomly, combined with Figure 5It can be seen that the 1# pump speed controls the pressure of 4# oil, thus having a direct impact on it. Similarly, (d) the condenser outlet flow jump has a direct impact on the condenser temperature, (e) the 2# oil flow itself, (g) the random change of the 2# pump speed has a direct impact on the finished oil flow, and (h) the random change of the settling tank outlet flow has a direct impact on the settling tank liquid level. It can be seen that the single variable case can clearly analyze the cause of the abnormality based on manual experience.
[0086] (2) Non-single variable situations include Figure 7 (a), (c) and (f). Figure 7 In (a), in addition to the direct effect of variable 4, a complex display of multivariate effects emerges. Figure 7 The random variation of the oil-water outlet flow rate of the three-phase separator in (c) causes fluctuations in the downstream flow rate (variables 5, 6, 7, 8) and temperature (variables 11, 12, 13). Figure 7 (f) shows that the stuck 1# oil valve has an impact on variables 1, 7, and 12, among which the 1# oil flow (variable 1) is the direct impact. Figure 5 It can be seen from Table 1 that 80% of the 1# oil flow directly enters the high-temperature purification tank, which indirectly affects the flow (variable 7) and temperature (variable 12). In general, the non-univariate case cannot explain the indirect variables under individual conditions based on artificial experience, but most of the results are still satisfactory.
[0087] Comparing the variable trend and the heat map, it can be seen that the change in the heat map color is consistent with the trend of the variable in time and becomes more significant as the value deviation increases. It is proved that dynamic coding can capture the current state abnormality in time and has strong robustness under various operating conditions. This method not only provides a mechanistic explanation of the cause of abnormal operating conditions based on variable changes, but also further indicates the data characteristics of the input deep learning model.
[0088] (3) Based on the open source python 3.5 code package, the long short-term memory network (LSTM) and its derivative models ED_LSTM, HD_LSTM and WD_LSTM were built. The hyperparameters of the four deep learning models were optimized through verification and confirmation methods, and the dynamic data set was divided into training set, validation set and test set in a ratio of 8:1:1. The deep learning model quickly identifies anomalies by learning the deep features between variables.
[0089] The structure and internal principle of LSTM are as follows Figure 4 Compared with the RNN structure, LSTM adds a new unit state C t , which can realize long-term information transmission and storage, such as Figure 4 (a) shows the internal working of LSTM. The internal working of LSTM is divided into three main stages: forgetting stage, selective memory stage and output stage, as shown in Figure 4(b) The three stages and outputs are shown in equations (5) to (11).
[0090] i t =σ(W i h t-1 +W i X t +b i ) (5)
[0091] f t =σ(W f h t-1 +W f X t +b f ) (6)
[0092] o t =σ(W o h t-1 +W o X t +b o ) (7)
[0093]
[0094]
[0095] h t =o t e tanh(C t ) (10)
[0096] y t =σ(Wh t +b) (11)
[0097] Where W () is the gate weight matrix, h t-1 is the calculated output vector of the LSTM unit at time t-1, X t is the input value at time t, b () is the bias of the gate, σ and tanh are the activation functions.
[0098] The datasets were constructed using ED, HD and WD dynamic encoding, and the original data was used as a comparison, for a total of 4 datasets. Each dataset was divided into a training set (960*20*9), a validation set (120*20*9) and a test set (120*20*9) in a ratio of 8:1:1 to construct LSTM, ED-LSTM, HD-LSTM and WD-LSTM deep learning models. The complex relationship between the variables in the training set was learned to obtain deep features, the validation set was used for hyperparameter tuning and preliminary evaluation of network performance, and finally the results of model learning were evaluated through the test set. In order to achieve the best performance of the model, the verification and confirmation method was used to search for the best hyperparameters within the initial range determined by manual experience. Figure 8 The accuracy on the test set is shown for four models with network layers ranging from 2 to 6 and hidden layer sizes ranging from 100 to 250.
[0099] Figure 8 The test set accuracy (ACC) of the model increases with the increase of the number of network layers and the size of the hidden layer, but shows a slight decrease or plateau in the later stage of training. This shows that the improved network fitting and feature capture capabilities can effectively learn the deep relationship between variables, but as the network structure becomes more complex, neurons will extract redundant features, causing the model to overfit in the training set, resulting in a decrease in generalization ability. Figure 8 In (d), WD_LSTM presents the same results in hidden layer size 250 and network layers 4 and 5. Considering the increased computational cost, a 4-layer network structure is preferred, consisting of 4 single-layer LSTM chain cells, where the output of each cell is the input of the next layer of cells. Table 4 lists the optimal hyperparameter information and accuracy.
[0100] Table 4 Optimal hyperparameters and accuracy of deep learning models
[0101] Network Layers Hidden layer size Test accuracy LSTM 5 150 0.795 ED_LSTM 5 200 0.986 HD_LSTM 5 200 0.981 WD_LSTM 4 250 0.965
[0102] The other settings of the network are described as follows: The optimization algorithm Early Stopping is used to interrupt the training when the loss function of the validation set increases. The optimizer uses the adaptive moment estimate (Adam), the learning rate is 0.005, and the maximum gradient norm during training is 5. A Dropout layer is added at the end of the hidden layer of the network to temporarily discard some hidden nodes during training to prevent the network from overfitting. The loss function and accuracy of the training set and validation set of the four models are shown in Fig. 9 and Fig.10 shown.
[0103] exist Fig. 9 As can be seen from the figure, as the number of learning steps increases, the loss function gradually decreases, indicating that the model captures the deep features of the data samples and continuously optimizes itself during the learning process. Fig. 9(a) shows that the loss function of the traditional LSTM presents a smooth downward trend, with a minimum of 0.0036 in the validation set of 9900 steps. Fig. 9 (b)(c)(d) show a rapid decrease in the early stages of training, with the validation set loss function reaching below 0.003 at 3000 steps. The final loss functions of ED_LSTM, HD_LSTM, and WD_LSTM reach 0.0004, 0.0006, and 0.0008, respectively. Fig.10 The accuracy of the training set and the validation set are almost overlapping, indicating that the model is not overfitting. The final validation set accuracies are 0.808, 0.983, 0.973, and 0.957, respectively. The distance metric improves the accuracy by at least 0.149. Fig. 9 (a), 10(a) Compared with other distance metric deep learning models, it is found that LSTM fluctuates more during training, which indicates that the redundant noise characteristics of the original data cause neurons to have biases in memorizing and storing information. The stable performance of other models provides further evidence to help LSTM process information.
[0104] Three evaluation indicators are introduced: precision, recall and F1 score to evaluate the performance of the four deep learning models. Their formulas are shown in Equations (12)-(14) respectively.
[0105]
[0106]
[0107]
[0108] Where TP is the number of correctly identified target samples, FP is the number of other samples identified as target samples, and FN is the number of incorrectly identified target samples.
[0109] In order to further study the recognition performance of the deep learning model for each working condition, a confusion matrix is introduced to visualize the classification of the true label and the predicted label, such as Fig.11 The points on the diagonal line in the figure represent the proportion of samples that are correctly identified, and the others represent the proportion of samples that are incorrectly identified. Fig.11 In (a), the traditional LSTM shows recognition errors for 36 sample types, and the recognition results for multiple working conditions are not ideal. Among them, the correct sample percentage for working condition 8 is only 48.7%, 12.6% are incorrectly identified as working condition 4, and 15.1% are incorrectly identified as working condition 9. Fig.11 (b), (c) and (d) show that the minimum percentage of correct identification under all conditions reaches 93.3% (label 8), 95.8% (label 8) and 88.6% (label 4), respectively, and the number of incorrect sample types is significantly reduced.
[0110] Evaluation indicators are introduced to quantify the recognition performance of deep learning models. Table 5 lists the accuracy, recall and F1 scores of the four models under 9 working conditions.
[0111] Table 5. Comparison of deep learning model evaluation indicators
[0112]
[0113]
[0114] As can be seen from Table 5, the complex information and redundant features of the original data make the traditional LSTM perform poorly. The accuracy, recall and F1 scores under all working conditions are only 0.802, 0.796 and 0.793 respectively, especially under working condition 8, which is lower than 0.5. The model with the best recognition false alarm performance for working condition 9 is HD-LSTM, which reaches 0.934. Although WD-LSTM performs perfectly in working conditions 1 and 2, all three indicators under working condition 8 are 0.916, which is lower than ED and HD methods, and the final F1 score is 0.965. Based on the comprehensive performance of the model, ED-LSTM stands out, with the accuracy, recall and F1 scores under all working conditions reaching 0.987, 0.987 and 0.986 respectively, which are 0.185, 0.191 and 0.193 higher than the traditional LSTM, respectively, proving the reliability of the dynamic encoding deep learning method combined with distance metric in fault identification.
[0115] At this point, the dynamic distance coding anomaly identification method for oil and gas gathering and transportation process has been successfully completed.
[0116] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for identifying abnormalities in oil and gas gathering and transportation processes based on dynamic distance coding, characterized in that: Here are the steps: Step (1) collecting oil and gas gathering and transportation process data to construct real-time samples; and performing noise reduction processing on steady-state data to construct a normal sample data set, where the steady-state data is historical data under normal operating conditions; Step (2) selects the data of each real-time sample and normal sample by sliding the window, calculates the spatial difference of the data distribution in the window based on the distance metric, and obtains the dynamic data set; then, generates the dynamic coding map of the real-time sample by sliding the window on the dynamic data set; The dynamic coding map of the real-time samples is generated by the following method: a sliding window is introduced to calculate the distance between the normal sample and the real-time sample of a single variable in the window size, thereby generating a coding block; the window slides on the variable to present the dynamic change of the distance; each variable between the two samples is encoded to generate a coding heat map; by analyzing the changes of each variable, the variable with the largest distance difference from the normal sample in the heat map is selected to analyze the cause of the anomaly; Step (3) uses the dynamic data set obtained in step (2) to build a deep learning model. The deep learning model identifies anomalies by learning the deep features between variables in the oil and gas gathering and transportation process.
2. The method for identifying abnormalities in oil and gas gathering and transportation process using dynamic distance coding according to claim 1 is characterized in that: In step (1), the oil and gas gathering and transportation process data is collected through sensors. The oil and gas gathering and transportation process data includes the following types of variables: flow, temperature and pressure, and normal labels and fault labels are set.
3. The method for identifying abnormalities in oil and gas gathering and transportation process using dynamic distance coding according to claim 2 is characterized in that: The oil and gas process data with different attributes are mapped to the same space by normalizing the variables to obtain normalized data, as shown in formula (1): (1) In the formula, x * is the normalized variable value, x min and x max are the minimum and maximum values of the variable in the entire data set, respectively.
4. The method for identifying abnormalities in oil and gas gathering and transportation process using dynamic distance coding according to claim 3 is characterized in that: The steady-state data is denoised based on the SG filter, which is based on the local polynomial least squares method of time domain fitting to denoise the normalized data.
5. The method for identifying abnormalities in oil and gas gathering and transportation process using dynamic distance coding according to claim 1 is characterized in that: In step (2), the distance metric is selected from Euclidean distance ED, Hellinger distance HD or bulldozer distance WD, and the respective distance calculation formulas are shown in equations (2) to (4): (2) In the formula, x1 and x2 are the horizontal coordinates of two points in space, and y1 and y2 are the vertical coordinates of two points in space; (3) In the formula, p(x) and q(x) are two spatial distribution functions respectively; (4) Where P1 is the original distribution, P2 is the target distribution, x and y are the values of the original distribution and the target distribution respectively, γ is the joint distribution, Π(P1,P2) is the set of all possible combinations of the two distributions, E is the expected value, and inf is the lower bound value of the function.
6. The method for identifying abnormalities in oil and gas gathering and transportation process using dynamic distance coding according to claim 1, characterized in that: In step (3), the deep learning model is selected from LSTM, or its derivative models ED_LSTM, HD_LSTM or WD_LSTM, wherein ED_LSTM is a deep learning model built for a data set constructed by Euclidean distance ED dynamic coding, HD_LSTM is a deep learning model built for a data set constructed by Hellinger distance HD dynamic coding, and WD_LSTM is a deep learning model built for a data set constructed by bulldozer distance WD dynamic coding.
7. The method for identifying abnormalities in oil and gas gathering and transportation process using dynamic distance coding according to claim 1, characterized in that: The deep learning model in step (3) is ED_LSTM.
8. The method for identifying abnormalities in oil and gas gathering and transportation process using dynamic distance coding according to claim 6 is characterized in that: In step (3), the dataset is divided into training set, validation set and test set in a ratio of 8:1:1, and LSTM, ED-LSTM, HD-LSTM or WD-LSTM deep learning models are constructed respectively; the complex relationship between variables in the training set is learned to obtain deep features, the validation set is used for hyperparameter tuning and preliminary evaluation of network performance, and finally the test set is used to evaluate the results of model learning.
9. The method for identifying abnormalities in oil and gas gathering and transportation process using dynamic distance coding according to claim 8, characterized in that: The model has 4 network layers, which are composed of 4 single-layer LSTM chain cells. The output of each cell is the input of the next layer of cells. The network settings are as follows: the optimization algorithm Early Stopping is used to interrupt the training when the loss function of the validation set increases; the optimizer uses Adam adaptive moment estimation, the learning rate is 0.005, and the maximum gradient norm during training is 5; a Dropout layer is added at the end of the network hidden layer.
