Natural gas pipeline leak detection method, threshold setting method, system and medium
By establishing a natural gas pipeline flow prediction model and dynamic threshold adjustment, the problem of difficulty in setting fixed thresholds was solved, achieving accuracy and speed in natural gas pipeline leak detection, and reducing false alarm rate and missed alarm rate.
Patent Information
- Application Number
- CN202210498918.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2022-04-24
- Filing Date
- 2022-05-09
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2042-05-09
AI Technical Summary
In existing methods for detecting leaks in natural gas pipelines, setting a fixed threshold is difficult, resulting in thresholds that are too high or too low, which affects the detection results.
By establishing a natural gas pipeline flow prediction model, using a multi-layer BP neural network to predict flow data in real time, dynamically adjusting the threshold, using a dynamic threshold formula to determine whether a leak exists, and using the LMS algorithm to update the bandwidth coefficient, adaptive leak detection is achieved.
It improves the accuracy and speed of leak detection, reduces false alarm and false negative rates, adapts to fluctuations in actual data, and improves the reliability of detection.
Smart Images

Figure CN116972344B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to a natural gas pipeline leakage detection method, a threshold setting method, a system and a medium. BACKGROUND
[0002] Natural gas is a clean and efficient green energy, and natural gas storage and transportation is mainly in the form of pipeline transportation. This mode connects various regions through pipelines to form a complex large pipeline transmission system. Natural gas pipelines have characteristics such as high pressure, flammability and explosiveness, wide distribution, long transmission line, deep underground burial, and are easily affected by corrosion, aging, natural disasters and third-party damage and other factors, which can affect the normal operation of natural gas pipeline transmission and cause natural gas pipeline leakage events. Due to the complexity of the pipeline network, pipeline leakage events have strong accidental and uncontrollable characteristics. Natural gas is flammable and explosive and contains toxic gases. If natural gas leaks, it may cause an explosion accident, cause poisoning events, cause pollution to the surrounding environment, cause waste of resources, and pose a serious threat to human life safety and property safety. Therefore, it is necessary to detect natural gas pipeline leakage.
[0003] How to use relevant data reflecting the operating state of the pipeline to detect natural gas pipeline leakage is a trenchless and low-cost pipeline leakage detection method, especially for in-service pipelines. The existing methods are mostly through the installation of new equipment to detect by using negative pressure wave method, vibration wave method, and sound wave method. Due to the compressibility of natural gas and the actual long-distance transmission of natural gas pipelines, the negative pressure wave, vibration wave, and sound wave signals generated by leakage will attenuate and are easily affected by the environment. These methods determine whether there is leakage by comparing the difference in the change amplitude of the negative pressure wave, vibration wave, and sound wave generated by the normal data and the leakage data of the pipeline. A fixed threshold can also be set. When the change amplitude is less than the fixed threshold, it is determined that there is no leakage, and when the change amplitude is greater than the fixed threshold, it is determined that there is leakage. The threshold used in this method is a fixed threshold, but it is difficult to set an appropriate fixed threshold. If the fixed threshold is set too small, there will be a high false positive rate, and if the fixed threshold is set too large, there will be a high false negative rate. SUMMARY
[0004] To solve the technical problem that the existing natural gas pipeline leakage detection method has difficulty in setting an appropriate fixed threshold, resulting in a large or small fixed threshold affecting the natural gas leakage detection effect, the embodiments of the present application provide a natural gas pipeline leakage detection method, a threshold setting method, a system and a medium.
[0005] The embodiments of the present application are implemented by the following technical solutions:
[0006] In a first aspect, embodiments of the present invention provide a method for detecting leaks in natural gas pipelines, comprising:
[0007] The flow rate of the natural gas pipeline at time k is predicted in real time, and the prediction error at time k is obtained. in These represent the actual and predicted flow rates at time k, respectively.
[0008] Determine the prediction error x at time k k Is it greater than the dynamic threshold? If yes, then it is determined that there is a natural gas leak in the natural gas pipeline; if no, then it is determined that there is no natural gas leak in the natural gas pipeline.
[0009] The dynamic threshold It can be expressed by the following formula:
[0010]
[0011] Where, n k Let n0 be the bandwidth coefficient at time k and n0 = 3; S is the average prediction error at time k. k Let be the standard deviation of the prediction error at time k, where k is an integer greater than or equal to zero.
[0012] Furthermore, the natural gas pipeline flow rate is predicted in real time at time k, and the prediction error at time k is obtained. in These represent the actual and predicted flow rates at time k, respectively; including:
[0013] At time k, the pipeline flow rate is predicted in real time using a natural gas pipeline flow rate prediction model, and the prediction error at time k is obtained. in These represent the actual and predicted flow rates at time k, respectively.
[0014] The establishment of the traffic prediction model includes:
[0015] S1. Obtain historical data on the inlet flow rate and outlet flow rate of the leak-free natural gas pipeline;
[0016] S2. Select a sliding window of size M, and at time k, perform noise reduction on the historical data of the input flow at the beginning and the output flow at the end of the window respectively;
[0017] S3. Select the historical data of the input flow rate at the beginning and the output flow rate at the end of the pipeline with a length of N before time k as the input vector of the neural network, and use the historical data of the output flow rate at the end of the natural gas pipeline with a length of N before time k+1 as the output vector of the neural network.
[0018] S4. According to the pipeline data sampling period, k=k+1, moving the sliding window, returning to S2 until the data set for training and testing the neural network is established, executing S5;
[0019] S5. Dividing the data set for training and testing the neural network into a training data set and a testing data set, training the neural network with the training data set, and testing the trained neural network with the testing data set;
[0020] S6. Judging whether the neural network tested by the testing data set can be used for predicting the natural gas leakage, if yes, obtaining the flow prediction model;
[0021] Wherein, M, k, N are integers greater than zero and N≤M.
[0022] Further, the noise reduction processing of S2 is wavelet noise reduction preprocessing.
[0023] Further, the data amount ratio of the training data set and the testing data set is 3:1; and the neural network is a multi-layer BP neural network.
[0024] Further, the natural gas pipeline leakage detection method further comprises:
[0025] updating the bandwidth coefficient n k using the LMS algorithm, and the updating formula is as follows:
[0026] n k+1 =n k +ηe k (2)
[0027] Wherein, n k+1 and n k respectively represent the bandwidth coefficient at k+1 and k time, is the signal power at k time, e k is the threshold deviation at k time, e0=0; when calculating the threshold deviation at k+1 time, if the weather pipeline leaks at k time, then If the weather pipeline does not leak at k time, the threshold deviation is unchanged.
[0028] In the second aspect, the embodiment of the present application provides a natural gas pipeline leakage detection system, comprising:
[0029] A prediction unit is configured to predict the natural gas pipeline flow in real time at k time, and obtain the prediction error x at k time, wherein and respectively represent the actual flow value and the flow prediction value at k time; and
[0030] A determination unit is configured to determine whether the prediction error x k at k time is greater than a dynamic threshold If yes, it is determined that the natural gas pipeline has a natural gas leakage; if no, it is determined that the natural gas pipeline has no natural gas leakage;
[0031] The dynamic threshold which is expressed by the following formula:
[0032]
[0033] wherein n k is a bandwidth coefficient at the k moment and n0=3; is a predicted error average value at the k moment, S k is a predicted error standard deviation at the k moment, and k is an integer greater than or equal to zero.
[0034] Further, the method further comprises: a flow prediction model unit; the flow prediction model unit comprises:
[0035] a data acquisition unit configured to acquire historical data of an input flow at a first end and historical data of an output flow at a terminal end of a natural gas pipeline without leakage;
[0036] a noise reduction unit configured to select a sliding window with a size of M, and perform noise reduction on the historical data of the input flow at the first end and the historical data of the output flow at the terminal end in the window at the k moment;
[0037] a neural network processing unit configured to select the historical data of the input flow at the first end and the historical data of the output flow at the terminal end after noise reduction at the k moment and before the k moment with a length of N as input vectors of a neural network, and select historical data of an output flow at the terminal end after noise reduction of the natural gas pipeline at a k+1 moment as an output vector of the neural network;
[0038] a data set establishing unit configured to move the sliding window by setting k=k+1 according to a pipeline data sampling period, and return to the noise reduction unit until a data set for training and testing the neural network is established and returned to a model training and testing unit;
[0039] the model training and testing unit is configured to divide the data set for training and testing the neural network into a training data set and a testing data set, train the neural network by using the training data set, and test the trained neural network by using the testing data set; and
[0040] a judgment unit configured to judge whether the neural network after testing by using the testing data set can be used for predicting a natural gas leakage, and if yes, obtain a flow prediction model; wherein M, k, and N are integers greater than zero and N≤M;
[0041] the prediction unit is configured to perform real-time prediction on a pipeline flow at the k moment by using the natural gas pipeline flow prediction model, and obtain a predicted error at the k moment wherein respectively, the actual value of the flow at time k and the predicted value of the flow.
[0042] Further, the judging unit is further used for judging whether the neural network after testing of the test data set can be used for predicting natural gas leakage, and if not, adjusting related structures and parameters, and returning to the model training and testing unit;
[0043] The related structures and parameters include the size of the sliding window, the length of the selected flow historical data, the size of the training data set, the training iteration number of the neural network, the learning rate, the number of hidden layers and nodes, the activation function of the hidden layer and the output layer, the network training function and the training target accuracy.
[0044] In a third aspect, an embodiment of the present application provides a natural gas pipeline leakage detection system, comprising a memory, a processor and a transceiver connected in sequence and in communication, wherein the memory is used for storing a computer program, the transceiver is used for transceiving messages, and the processor is used for reading the computer program and executing the detection method.
[0045] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, which stores instructions, and when the instructions run on a computer, the detection method is executed.
[0046] In a fifth aspect, an embodiment of the present application provides a threshold setting method of a natural gas pipeline leakage detection method, comprising:
[0047] The threshold used for determining whether the natural gas pipeline has leakage in the natural gas pipeline leakage detection method is set as a dynamic threshold
[0048] The dynamic threshold is represented by the following formula:
[0049]
[0050] Wherein, n k is the bandwidth coefficient at time k and n0=3; is the average value of the prediction error at time k, S k is the standard deviation of the prediction error at time k, and k is an integer greater than or equal to zero.
[0051] Compared with the prior art, the embodiment of the present application has the following advantages and beneficial effects:
[0052] The natural gas pipeline leakage detection method, the threshold setting method, the system and the medium of the embodiment of the present application, by predicting the flow of the natural gas pipeline in real time at time k, obtaining the prediction error Wherein respectively are the actual value and the predicted value of the flow at time k; the predicted error x at time k is determined k whether greater than a dynamic threshold value If yes, it is determined that the natural gas pipeline has a natural gas leakage; if no, it is determined that the natural gas pipeline does not have a natural gas leakage; thus, the embodiment of the present application uses whether the prediction error is within the allowable range to determine whether the natural gas has a leakage, avoiding the technical defects that the existing natural gas pipeline leakage detection method has difficulty in setting a suitable fixed threshold value, resulting in the fixed threshold value being too large or too small to affect the natural gas leakage detection effect. BRIEF DESCRIPTION OF DRAWINGS
[0053] In order to more clearly illustrate the technical solutions of the exemplary embodiments of the present application, the drawings needed in the embodiments will be briefly introduced as follows, and it should be understood that the following drawings only show some embodiments of the present application, and therefore should not be regarded as a limitation on the scope, and for those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.
[0054] Figure 1 It is a natural gas pipeline leakage detection method flowchart.
[0055] Figure 2 It is a flowchart of the establishment method of the flow prediction model.
[0056] Figure 3 It is a structural diagram of the flow prediction model unit.
[0057] Figure 4 It is a structural diagram of the natural gas leakage detection system.
[0058] Figure 5 It is a natural gas pipeline leakage detection method flowchart of the implementation case. DETAILED DESCRIPTION
[0059] In order to make the purpose, technical solutions and advantages of the present application more clear and apparent, the present application will be further described in detail below with reference to the embodiments and drawings, and the exemplary embodiments of the present application and their descriptions are only used to explain the present application, and not as a limitation on the present application.
[0060] In the following description, a large number of specific details are set forth in order to provide a thorough understanding of the present application. However, it is apparent to those skilled in the art that the present application does not have to be implemented with these specific details. In other embodiments, in order to avoid obscuring the present application, well-known structures, circuits, materials or methods are not specifically described.
[0061] Throughout the specification, reference to "one embodiment," "an embodiment," "one example," or "an example" means that a particular feature, structure, or characteristic described in connection with the embodiment or example is included in at least one embodiment of the application. The appearances of the phrases "in one embodiment," "in an embodiment," "in one example," or "in an example" in various places in the specification are not necessarily all referring to the same embodiment or example. Furthermore, the particular features, structures, or characteristics can be combined in any suitable manner in one or more embodiments or examples. In addition, the skilled person should appreciate that the drawings provided herein are for illustration purposes and are not necessarily drawn to scale. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0062] In the description of the application, the terms "front", "back", "left", "right", "up", "down", "vertical", "horizontal", "high", "low", "inner", "outer", and the like indicate the orientation or positional relationship shown in the drawings based on the orientation or positional relationship shown in the drawings, which are only for the convenience of describing the application and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as limiting the scope of protection of the application.
[0063] Embodiments
[0064] To solve the technical problem that the existing natural gas pipeline leakage detection method has difficulty in setting a suitable fixed threshold, resulting in a large or small fixed threshold affecting the natural gas leakage detection effect, embodiments of the present application provide a natural gas pipeline leakage detection method, system and storage medium.
[0065] In a first aspect, embodiments of the present application provide a natural gas pipeline leakage detection method, as shown in Figure 1 , which comprises:
[0066] T1. Real-time prediction of the natural gas pipeline flow at time k to obtain the prediction error at time k
[0067]
[0068] Wherein are the actual flow value and the flow prediction value at time k, respectively;
[0069] T2. Determine whether the prediction error x k at time k is greater than the dynamic threshold If yes, it is determined that the natural gas pipeline has natural gas leakage; if no, it is determined that the natural gas pipeline does not have natural gas leakage;
[0070] The dynamic threshold is represented by the following formula:
[0071]
[0072] wherein, n k is the bandwidth coefficient at k moment and n0=3; is the average value of prediction error at k moment, S k is the standard deviation of prediction error at k moment, k is an integer greater than or equal to zero.
[0073] Therefore, the embodiment of the present application uses whether the prediction error is in the allowable range to judge whether the natural gas exists the leakage situation, avoids the technical defects that the fixed threshold is too large or too small to affect the natural gas leakage detection effect due to the difficulty in setting the appropriate fixed threshold in the existing natural gas pipeline leakage detection method. The embodiment of the present application establishes the natural gas pipeline flow prediction model to predict the pipeline flow in real time, proposes a setting method of the adaptive leakage detection threshold according to the prediction error, can realize the dynamic update of the leakage detection threshold, can well eliminate the influence of the fluctuation of the actual data, reduces the false positive rate and the false negative rate of the leakage detection, and improves the accuracy and rapidity of the leakage detection.
[0074] Further, T1. The natural gas pipeline flow is predicted in real time at k moment, and the prediction error at k moment is obtained
[0075]
[0076] wherein respectively, the actual value and the predicted value of the flow at k moment; including:
[0077] T11. The natural gas pipeline flow is predicted in real time at k moment by using the pipeline flow prediction model, and the prediction error at k moment is obtained
[0078]
[0079] wherein respectively, the actual value and the predicted value of the flow at k moment;
[0080] Referring to Figure 2 , the establishment of the flow prediction model includes:
[0081] S1. The historical data of the input flow at the first end and the historical data of the output flow at the end of the natural gas pipeline without leakage are obtained;
[0082] S2. A sliding window with a size of M is selected, and the historical data of the input flow at the first end and the historical data of the output flow at the end in the window are respectively denoised at k moment;
[0083] S3. Select the history data of the first-end input flow and the history data of the last-end output flow of the denoised pipeline in k time and before k time with a length of N as the input vector of the neural network, and the history data of the denoised output flow of the natural gas pipeline in k+1 time as the output vector of the neural network;
[0084] S4. According to the pipeline data sampling period, k=k+1, move the sliding window, return to S2, until the data set for training and testing the neural network is established, and execute S5;
[0085] S5. The data set for training and testing the neural network is divided into a training data set and a testing data set, the neural network is trained with the training data set, and the trained neural network is tested with the testing data set;
[0086] S6. Determine whether the neural network tested by the testing data set can be used for predicting natural gas leakage, if yes, the flow prediction model is obtained;
[0087] Wherein, M, k, N are integers greater than zero and N≤M.
[0088] Specifically, the flow prediction model training method and the natural gas leakage detection method comprise:
[0089] Step 1: Measure the history data of the first-end input flow and the history data of the last-end output flow under the normal operation of the pipeline to be detected;
[0090] Step 2: Select a sliding window with a size of M, and denoise the history data of the first-end input flow and the history data of the last-end output flow in the window at k time;
[0091] Step 3: In the denoised first-end and last-end flow data, select the history flow data of the first-end and last-end in k time and before k time with a length of N as the input vector of the neural network, and the output of the neural network after processing the input vector is the output of the neural network in k+1 time;
[0092] Step 4: According to the pipeline data sampling period, k=k+1, move the sliding window, repeat steps 2 to 3, and establish a data set for training the normal natural gas pipeline flow prediction model.
[0093] Further, the denoising processing of S2 is wavelet denoising preprocessing.
[0094] Further, the data amount ratio of the training data set and the testing data set is 3:1; and the neural network is a multi-layer BP neural network.
[0095] Step 5: The data set is divided into a training data set and a test data set in a ratio of 3:1, the training data set is used to train a normal natural gas pipeline end flow prediction model, the trained normal natural gas pipeline end flow prediction model is tested by using the test data set, and whether the prediction effect meets the requirements is observed. If the requirements are not met, the related structure and parameters are adjusted, and the training is re-performed until the requirements are met; if the requirements are met, the trained model is saved. The related structure and parameters include the size of the sliding window, the length of the selected flow historical data, the size of the training data set, the training iteration number of the neural network, the learning rate, the number of hidden layers and nodes, the activation function of the hidden layer and the output layer, etc. The neural network is a multilayer BP neural network.
[0096] Further, the natural gas pipeline leakage detection method further comprises:
[0097] The bandwidth coefficient n k is updated by using the LMS algorithm, and the update formula is as follows:
[0098] n k+1 =n k +ηe k (2)
[0099] In the formula, n k+1 and n k respectively represent the bandwidth coefficients at k+1 and k moments, is the signal power at k moment, e k is the threshold deviation at k moment, e0=0; when calculating the threshold deviation at k+1 moment, if the weather pipeline leaks at k moment, then If the weather pipeline does not leak at k moment, the threshold deviation remains unchanged.
[0100] Specifically, the embodiment is a single pipeline in service of a natural gas pipeline transportation department as an example to specifically describe the method, by collecting the flow data of the first and last ends of the natural gas pipeline, selecting the data for wavelet denoising processing, constructing a training set to train a natural gas pipeline end flow prediction model to predict the pipeline end flow in real time, and determining the upper and lower boundaries of the allowed range of the prediction error according to the self-adaptive threshold setting method, whether there is leakage is judged according to whether the prediction error is within the allowed range. The specific steps of the present application are described below with reference to Figure 5 The specific steps of the present application are described below:
[0101] Step 1: measuring the first and last end flow historical data of the pipeline to be detected;
[0102] Step 2: wavelet denoising preprocessing of data;
[0103] Step 3: Using the preprocessed data to establish a data set for training the pipeline end flow prediction model, the model input is the pipeline head input, the end output flow at the current time k and its history data with a certain length N, the model output is the end output flow of the pipeline at time k+1, and the data set is established;
[0104] Step 4: Training a pipeline flow prediction model using the data set and saving the trained model.
[0105] Step 5: Real-time prediction of the pipeline end flow at time k using the trained model to obtain the prediction error at time k Wherein are the actual value and the predicted value of the flow at time k respectively;
[0106] Step 6: Leak detection based on adaptive threshold:
[0107] Step 6.1: Update the bandwidth coefficient n k using the LMS algorithm, and the update formula is as follows:
[0108] n k+1 = n k + ηe k (2)
[0109] In the formula, n k+1 and n k represent the bandwidth coefficients at times k+1 and k respectively, is the signal power at time k, e k is the threshold deviation at time k, e0=0; when calculating the threshold deviation at time k+1, if the natural gas pipeline leaks at time k, then If the natural gas pipeline does not leak at time k, the threshold deviation remains unchanged.
[0110] The specific principle is: when real-time prediction of the pipeline end flow is performed, the historical prediction errors of the previous N steps at time k are recorded, that is, N prediction error data are saved, and the average value and the standard deviation of the N data are calculated, that is, the prediction error average value and the prediction error standard deviation at time k are obtained. When predicting at time k+1, if it is judged that the natural gas pipeline does not leak at time k, then the N historical prediction errors saved are updated, and the corresponding prediction error average value and prediction error standard deviation are recalculated, if it is judged that the natural gas pipeline leaks at time k, then the prediction error average value and the prediction error standard deviation remain unchanged, so as to obtain the prediction error average value and the prediction error standard deviation at time k+1, and complete the update of the prediction error average value and the prediction error standard deviation.
[0111] Step 6.2: Determine whether the prediction error x k at time k is greater than the dynamic threshold If yes, then it is determined that there is a natural gas leak in the natural gas pipeline; if no, then it is determined that there is no natural gas leak in the natural gas pipeline.
[0112] Secondly, embodiments of the present invention provide a natural gas pipeline leak detection system, referring to... Figure 4 As shown, it includes:
[0113] The prediction unit is used to predict the natural gas pipeline flow rate in real time at time k, and obtain the prediction error at time k. in These represent the actual and predicted flow rates at time k, respectively; and
[0114] The decision unit is used to determine the prediction error x at time k. k Is it greater than the dynamic threshold? If yes, then it is determined that there is a natural gas leak in the natural gas pipeline; if no, then it is determined that there is no natural gas leak in the natural gas pipeline.
[0115] The dynamic threshold It can be expressed by the following formula:
[0116]
[0117] Where, n k Let n0 be the bandwidth coefficient at time k and n0 = 3; S is the average prediction error at time k. k Let be the standard deviation of the prediction error at time k, where k is an integer greater than or equal to zero.
[0118] Furthermore, it also includes: a traffic prediction model unit; reference Figure 3 As shown, the traffic prediction model unit includes:
[0119] The data acquisition unit is used to acquire historical data of the inflow rate at the beginning and the outflow rate at the end of the leak-free natural gas pipeline.
[0120] The noise reduction unit is used to select a sliding window of size M and perform noise reduction on the historical data of the input flow at the beginning and the output flow at the end of the window at time k.
[0121] The neural network processing unit is used to select the historical data of the input flow at the head end and the historical data of the output flow at the tail end with a length of N before time k as the input vector of the neural network, and to use the historical data of the output flow at the tail end of the natural gas pipeline with a length of N before time k+1 as the output vector of the neural network.
[0122] a data set establishing unit, configured to move a sliding window by setting k=k+1 according to a pipeline data sampling period, and return to the noise reduction unit until a data set for training and testing a neural network is established, and return the model training and testing unit;
[0123] a model training and testing unit, configured to divide the data set for training and testing the neural network into a training data set and a testing data set, train the neural network by using the training data set, and test the trained neural network by using the testing data set; and
[0124] a judging unit, configured to judge whether the neural network after being tested by the testing data set can be used for predicting natural gas leakage, and obtain a flow prediction model if yes, wherein M, k, and N are integers greater than zero and N≤M.
[0125] the prediction unit, configured to perform real-time prediction on the pipeline flow at the k moment by using the natural gas pipeline flow prediction model to obtain a prediction error at the k moment wherein respectively represent an actual flow value and a predicted flow value at the k moment.
[0126] Further, the judging unit is further configured to judge whether the neural network after being tested by the testing data set can be used for predicting natural gas leakage, and adjust related structures and parameters and return to the model training and testing unit if no.
[0127] The related structures and parameters include a size of the sliding window, a length of selected flow historical data, a size of the training data set, a training iteration number of the neural network, a learning rate, a number of hidden layers and nodes, an activation function of the hidden layer and the output layer, a network training function, and a training target accuracy, etc.
[0128] In a third aspect, an embodiment of the present application provides a natural gas pipeline leakage detection system, which comprises a memory, a processor, and a transceiver connected in sequence and in communication, wherein the memory is configured to store a computer program, the transceiver is configured to transceive messages, and the processor is configured to read the computer program and execute the detection method.
[0129] The principle of the detection system is referred to the detection method, which is not described herein.
[0130] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, which stores instructions, and when the instructions are executed on a computer, the detection method is executed.
[0131] The principle of the detection method executed by the storage medium is referred to the principle of the detection method, which is not described herein.
[0132] In a fifth aspect, an embodiment of the present application provides a threshold setting method of the natural gas pipeline leakage detection method, which comprises:
[0133] The threshold for determining whether a natural gas pipeline has a leakage in a natural gas pipeline leakage detection method is set as a dynamic threshold
[0134] The dynamic threshold It is expressed by the following formula:
[0135]
[0136] Wherein, n k The bandwidth coefficient at k moment and n0=3; The predicted error average value at k moment, S k The predicted error standard deviation at k moment, and k is an integer greater than or equal to zero.
[0137] The setting principle and effect of the threshold setting method of the embodiment of the present application are referred to the above method, and will not be described here.
[0138] The above specific embodiments have further detailed the purposes, technical solutions and beneficial effects of the present application, and it should be understood that the above description is only a specific embodiment of the present application and is not used to limit the protection scope of the present application, and any modification, equivalent replacement, improvement, etc. within the spirit and principle of the present application should be included in the protection scope of the present application.
Claims
1. A method of natural gas pipeline leak detection, the method comprising: include: Real-time prediction is made on the gas pipeline flow at the k moment to obtain the prediction error at the k moment wherein respectively, the actual value and the predicted value of the flow at the k moment determining whether the prediction error x at time k is greater than a dynamic threshold k whether greater than a dynamic threshold if yes, determining that the natural gas pipeline has a natural gas leakage; if no, determining that the natural gas pipeline has no natural gas leakage The dynamic threshold is represented by the equation: wherein n k is the bandwidth coefficient at time k and n0= 3; is the average of the prediction errors at time k, S k is the standard deviation of the prediction errors at time k, k being an integer greater than or equal to zero.
2. The method of claim 1, wherein, Real-time prediction is made on the gas pipeline flow at the k moment, and the prediction error at the k moment is obtained wherein respectively, the actual value and the predicted value of the flow at the k moment; comprising: The pipeline flow is predicted in real time at the k moment by using the natural gas pipeline flow prediction model to obtain a prediction error at the k moment wherein respectively, the actual value and the predicted value of the flow at the k moment The establishment of the traffic prediction model includes: S1. Obtain historical data on the inlet flow rate and outlet flow rate of the leak-free natural gas pipeline; S2. Select a sliding window of size M, and at time k, perform noise reduction on the historical data of the input flow at the beginning and the output flow at the end of the window respectively; S3. Select the historical data of the input flow rate at the beginning and the output flow rate at the end of the pipeline with a length of N before time k as the input vector of the neural network, and use the historical data of the output flow rate at the end of the natural gas pipeline with a length of N before time k+1 as the output vector of the neural network. S4. Let k = k + 1 according to the pipeline data sampling period, move the sliding window, return to S2, and continue until a dataset for training and testing the neural network is established to execute S5; S5. Divide the dataset used for training and testing the neural network into a training dataset and a test dataset. Train the neural network with the training dataset and test the trained neural network with the test dataset. S6. Determine whether the neural network after testing the test dataset can be used to predict natural gas leaks. If so, obtain the flow prediction model. Where M, k, and N are integers greater than zero and N ≤ M.
3. The method of claim 2, wherein, The ratio of the training dataset to the test dataset is 3:1; the neural network is a multi-layer backpropagation neural network.
4. The method of claim 1-3, wherein, Also includes: The bandwidth coefficient n is updated using the LMS algorithm k The update formula is as follows: n k+1 = n k + ηe k (2) wherein n k+1 and n k respectively represent the bandwidth coefficient at k+1 and k time, is the signal power at k time, e k is the threshold deviation at k time, e0=0; when calculating the threshold deviation at k+1 time, if the weather pipe leaks at k time, then if the weather pipe does not leak at k time, the threshold deviation remains unchanged.
5. A natural gas pipeline leak detection system characterized by, include: A prediction unit is configured to predict the natural gas pipeline flow in real time at the k moment to obtain a k moment prediction error wherein respectively, the k moment flow actual value and the flow prediction value; and A determination unit is configured to determine whether the prediction error x at the kth moment is greater than a dynamic threshold value k whether the prediction error x at the kth moment is greater than a dynamic threshold value If yes, it is determined that the natural gas pipeline has a natural gas leakage; if no, it is determined that the natural gas pipeline has no natural gas leakage. The dynamic threshold is represented by the equation: wherein n k is the bandwidth coefficient at time k and n0= 3; is the prediction error average at time k, S k is the prediction error standard deviation at time k, k being an integer greater than or equal to zero.
6. The natural gas pipeline leak detection system of claim 5, wherein, Also includes: Traffic prediction model unit; The traffic prediction model unit includes: The data acquisition unit is used to acquire historical data of the inflow rate at the beginning and the outflow rate at the end of the leak-free natural gas pipeline. The noise reduction unit is used to select a sliding window of size M and perform noise reduction on the historical data of the input flow at the beginning and the output flow at the end of the window at time k. The neural network processing unit is used to select the historical data of the input flow at the head end and the historical data of the output flow at the tail end with a length of N before time k as the input vector of the neural network, and to use the historical data of the output flow at the tail end of the natural gas pipeline with a length of N before time k+1 as the output vector of the neural network. The dataset creation unit is used to move the sliding window according to the pipeline data sampling period, setting k = k + 1, and return to the noise reduction unit until a dataset for training and testing the neural network is created, returning to the model training and testing unit. The model training and testing unit is used to divide the dataset used for training and testing the neural network into a training dataset and a test dataset, using the training dataset to train the neural network and the test dataset to test the trained neural network; and The judgment unit is used to determine whether the neural network after testing the test dataset can be used to predict natural gas leaks. If so, the flow prediction model is obtained; where M, k, and N are integers greater than zero and N≤M. The prediction unit is configured to perform real-time prediction on the pipeline flow at the k moment by using the natural gas pipeline flow prediction model to obtain a prediction error at the k moment wherein respectively, are the actual value and the predicted value of the flow at the k moment.
7. The natural gas pipeline leak detection system of claim 6, wherein, The judgment unit is also used to determine whether the neural network after testing the test dataset can be used to predict natural gas leaks. If not, the relevant structure and parameters are adjusted, and the model training and testing unit is returned. The related structures and parameters include the size of the sliding window, the length of the selected traffic history data, the size of the training data set, the number of training iterations of the neural network, the learning rate, the number of hidden layers and nodes, the activation function of the hidden layer and the output layer, the network training function and the training target accuracy.
8. A threshold setting method of a natural gas pipeline leak detection method, characterized by, The method comprises the following steps: The threshold value for determining whether a natural gas pipeline exists leakage in a natural gas pipeline leakage detection method is set as a dynamic threshold value Real-time prediction is made on the gas pipeline flow at the k moment to obtain the prediction error at the k moment wherein respectively, the actual value and the predicted value of the flow at the k moment determining whether the prediction error x at time k is greater than a dynamic threshold k whether greater than a dynamic threshold if yes, determining that the natural gas pipeline has a natural gas leakage; if no, determining that the natural gas pipeline has no natural gas leakage The dynamic threshold is represented by the equation: wherein n k is the bandwidth coefficient at time k and n0= 3; is the average of the prediction errors at time k, S k is the standard deviation of the prediction errors at time k, k being an integer greater than or equal to zero.
9. A natural gas pipeline leak detection system characterized by, The device comprises a memory, a processor and a transceiver connected in sequence, wherein the memory is used to store a computer program, the transceiver is used to transmit and receive messages, and the processor is used to read the computer program and execute the detection method according to any one of claims 1-4.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores instructions, and when the instructions run on the computer, the detection method according to any one of claims 1-4 is executed.
Citation Information
Patent Citations
Alarm threshold generation method and device
CN111679952A