A natural gas pipeline corrosion prediction and early warning method and system

By installing sensors on natural gas pipelines, a variety of environmental and stress data are collected, and long-term memory network models and graph neural network models are used to predict data and predict corrosion propagation paths, the problems of long detection cycles, incomplete data and lagging maintenance decisions in the existing system are solved, and high-precision corrosion prediction and intelligent early warning and maintenance suggestions are achieved.

CN119004336BActive Publication Date: 2025-03-07FOSHAN NATURAL GAS HIGH VOLTAGE TUBE MESHWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411318520.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-20
Publication Date
2025-03-07
Estimated Expiration
2044-09-20

AI Technical Summary

Technical Problem

The existing natural gas pipeline corrosion detection and early warning systems have problems such as long detection cycles, incomplete data, single prediction model and lagging maintenance decisions, which makes it difficult to effectively warn and prevent corrosion risks.

Method used

Using real-time monitoring, multi-source data fusion, high-precision prediction and intelligent decision support methods, by installing sensors on natural gas pipelines, a variety of environmental and stress data are collected, and long-term memory network models and graph neural network models are used to predict data and corrosion propagation path prediction, combined with ant colony algorithm to optimize model hyperparameters, generate intelligent early warning signals and maintenance suggestions.

Benefits of technology

It improves the accuracy of corrosion prediction and timely warning of natural gas pipelines, enhances the safety and maintenance efficiency of pipelines, and solves the problems of long detection cycles and lagging maintenance decisions in existing systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119004336B_ABST
    Figure CN119004336B_ABST
Patent Text Reader

Abstract

The present invention proposes a natural gas pipeline corrosion prediction and early warning method and system, which belongs to the technical field of natural gas pipelines. The method includes: installing sensors at different locations of the natural gas pipeline, collecting data, storing it in a central server, preprocessing it and then extracting features; constructing a long short-term memory network model based on the natural gas pipeline, optimizing the hyperparameters of the long short-term memory network model through an adaptive genetic algorithm to obtain an optimized long short-term memory network model, and predicting the corrosion trend of the natural gas pipeline; constructing a graph neural network model based on the pipeline network according to the location of the natural gas pipeline, and predicting the future corrosion propagation path; designing an early warning threshold, and generating an early warning signal, and providing intelligent maintenance and repair suggestions based on the early warning signal, optimizing resource configuration, and adjusting the early warning threshold and decision plan in real time according to the actual execution situation. The present invention realizes intelligent natural gas pipeline corrosion prediction and early warning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of natural gas pipelines, and in particular relates to a natural gas pipeline corrosion prediction and early warning method and system. Background Art

[0002] Natural gas pipelines are important infrastructure for energy transportation. With the increase in pipeline length and transportation volume, pipeline corrosion is becoming increasingly serious. Pipeline corrosion not only affects transportation efficiency, but may also lead to serious accidents such as leakage and explosion, posing a major threat to the environment and human safety. At present, the existing natural gas pipeline corrosion detection and early warning systems on the market mainly rely on physical detection methods and empirical judgments, such as ultrasonic detection, electromagnetic detection, etc. These methods have the following significant disadvantages:

[0003] 1. Long detection cycle: Traditional physical detection methods need to be carried out regularly, and the detection process is complicated, usually requiring shutdown for comprehensive inspection. This periodic detection cannot monitor the corrosion of the pipeline in real time, which can easily lead to missed detection and late reporting of corrosion points.

[0004] 2. Incomplete data: Existing detection methods are mostly based on a single data source, such as single environmental parameters such as pressure and temperature, which fail to fully capture the various factors that affect corrosion, resulting in inaccurate and incomplete prediction results.

[0005] 3. Single prediction model: Current corrosion prediction models mostly use simple linear regression or empirical formulas, which are difficult to handle complex nonlinear corrosion behaviors, have low prediction accuracy, and cannot accurately warn of potential corrosion risks.

[0006] 4. Delayed maintenance decisions: Maintenance decisions of existing systems are mostly based on manual judgment after test results, lacking intelligent and automated decision support, resulting in delayed maintenance measures and difficulty in timely preventing risks caused by corrosion.

[0007] In order to solve the above problems, a natural gas pipeline corrosion prediction and early warning system is urgently needed. Summary of the invention

[0008] The purpose of the present invention is to propose a natural gas pipeline corrosion prediction and early warning method and system, which improves the accuracy of pipeline corrosion prediction and the timeliness of early warning through real-time monitoring, multi-source data fusion, high-precision prediction, and intelligent decision support, can effectively improve the safety and maintenance efficiency of natural gas pipelines, and promote the advancement of related field technologies.

[0009] In order to achieve the above object, a first aspect of the present invention provides a natural gas pipeline corrosion prediction and early warning method, the method comprising:

[0010] S1. Install sensors at different locations of the natural gas pipeline to collect pipeline data of the natural gas pipeline, transmit and store the collected data on a central server, and pre-process the collected data, normalize the pre-processed data, and perform feature extraction; the feature extraction includes calculating the statistical features of each sensor as time domain features, then using fast Fourier transform to convert the time domain data into frequency domain data, and extracting spectrum features from the frequency domain data;

[0011] S2. Sort the spectral features of each sensor according to the timestamp to form a corresponding data sequence set, then merge the corresponding data sequence set to form a multidimensional time series, introduce environmental impact items and pipeline stress impact items to build a long short-term memory network model based on the natural gas pipeline, use the multidimensional time series as the input of the long short-term memory network model to obtain the predicted value at the current moment, calculate the deviation between the actual value and the predicted value at the current moment to obtain the hyperparameter, and optimize the hyperparameter of the long short-term memory network model through an adaptive genetic algorithm to obtain the optimized long short-term memory network model, and use the optimized long short-term memory network model to predict the corrosion trend of the natural gas pipeline according to the historical multidimensional time series; wherein, the introduction of environmental impact items and pipeline stress impact items to build a long short-term memory network model based on the natural gas pipeline is expressed as follows:

[0012] f t =σ(W f ·[h t-1 ,x t ,e t ,s t ]+b f )

[0013] i t =σ(W i ·[h t-1 ,x t ,e t ,s t ]+b i )

[0014] g t =tanh(W g ·[h t-1 ,x t ,e t ,s t ]+b g )

[0015] o t =σ(W o ·[h t-1 ,x t ,e t ,s t ]+bo )

[0016] c t =f t ⊙c t-1 +i t ⊙g t

[0017] h t =o t ⊙tanh(c t )

[0018] Among them, W f ,W i ,W g ,W o Represent the weight matrices of the forget gate, input gate, candidate memory and output gate respectively; f t Represents the forget gate vector at time t; i t represents the input gate vector at time t; g t represents the candidate memory vector at the tth moment; o t represents the output gate vector at time t; c t represents the cell state vector at time t; h t represents the hidden state vector at the tth moment; σ represents the Sigmoid activation function, which is used to limit the output of the gate between 0 and 1; tanh represents the hyperbolic tangent activation function, which is used to generate candidate memory vectors and adjust the output of the hidden state, and its value is between -1 and 1; h t-1 represents the hidden state vector at time t-1; c t-1 represents the cell state vector at time t-1; ⊙ represents the element-wise multiplication operator, which is used to combine the outputs of different gates and state updates; x t ∈R d represents the d-dimensional feature vector at the tth moment, and X={x 1 ,x 2 ,…,x t ,x T}, X is the multidimensional time series of sensor data merger; e t represents the environmental impact item at time t; s t represents the pipeline stress influence term at the tth moment; b f ,b i ,b g ,b o Represent the bias vectors of the forget gate, input gate, candidate memory, and output gate, respectively, which are used to adjust the output of each gate;

[0019] S3. Build a pipeline network-based graph neural network model according to the location of the natural gas pipeline. Use the graph neural network model to predict the corrosion propagation path in the pipeline based on the predicted corrosion trend and the historical corrosion propagation path. Then, use the ant colony algorithm to optimize the hyperparameters of the graph neural network model according to the historical corrosion propagation path and the structural data of the pipeline to obtain the optimized graph neural network model. Use the optimized graph neural network model to predict the future corrosion propagation path.

[0020] S4. Based on the prediction results of the optimized long short-term memory network model and the optimized graph neural network model, combined with real-time sensor data and historical sensor data, the warning threshold is designed and the warning signal is generated. At the same time, intelligent maintenance and repair suggestions are provided based on the warning signal to optimize the resource configuration. According to the actual implementation of the resource configuration strategy, the warning threshold and resource configuration strategy are adjusted in real time.

[0021] Furthermore, the sensors include a temperature sensor, a humidity sensor, a pressure sensor and a gas composition sensor; wherein the optimal spacing of the sensors is designed to be:

[0022]

[0023] Where D is the distance between sensors, L is the length of the pipeline, and N is the number of sensors.

[0024] Further, the preprocessing includes smoothing the data using a moving average filter and detecting outliers using the 3σ principle.

[0025] The moving average filter is used to smooth the data, which is expressed as follows:

[0026]

[0027] in, represents the smoothed value of the ith data point, x i represents the i-th original data point, k represents the window size; j represents the offset relative to the i-th data point, ranging from -k to k; x i+j represents the i+jth original data point;

[0028] The 3σ principle is used to detect outliers, which is expressed as follows:

[0029]

[0030] x i is an outlier if|x i -μ|>3σ

[0031] Among them, μ represents the data mean, σ represents the data standard deviation, and n represents the total number of data points; xi is an outlier if|x i -μ|>3σ means that if the absolute value of the difference between the ith original data point and the data mean is greater than 3σ, the ith original data point is an outlier;

[0032] The feature extraction includes time domain feature extraction and frequency domain feature extraction;

[0033] The time domain feature extraction calculates the statistical features of each sensor data, which is expressed as follows:

[0034]

[0035] Among them, x i represents the i-th data point, n represents the total number of data points, σ ​​represents the data standard deviation, Mean represents the mean, Variance represents the variance, Skewness represents the skewness, and Kurtosis represents the kurtosis;

[0036] The frequency domain feature extraction uses fast Fourier transform to convert time domain data into frequency domain data and extract spectrum features, which are expressed as follows:

[0037]

[0038] Among them, X(f) represents the frequency domain signal, x(n) represents the time domain signal, and N outlier represents the total number of data points and f represents the frequency.

[0039] Furthermore, the method of optimizing the hyperparameters of the long short-term memory network model by an adaptive genetic algorithm to obtain an optimized long short-term memory network model specifically includes the following steps:

[0040] (1) Randomly generate a set of long short-term memory network model hyperparameters as the initial population;

[0041] (2) Calculate the fitness of each individual. The fitness function is the prediction error of the long short-term memory network model. The fitness function of the long short-term memory network model is expressed in weighted mean square error, which is expressed as follows:

[0042]

[0043] Among them, WMSE 1 Represents the fitness value of the long short-term memory network model, w i represents the weight of the i-th sample, y i Indicates the actual value, represents the predicted value, n Aga Indicates the number of samples of the genetic algorithm;

[0044] (3) The roulette wheel selection method is used to select excellent individuals for reproduction according to the fitness value, which is expressed as follows:

[0045]

[0046] Among them, P i represents the selection probability of individual i, f i represents the fitness of individual i, K represents the population size, and f j represents the fitness of individual j;

[0047] (4) Perform multi-point crossover operations on the selected individuals to generate new individuals;

[0048] (5) Perform mutation operations on the new individuals to change the parameters of the individuals;

[0049] (6) According to the fitness value of the current generation, the crossover rate and mutation rate are dynamically adjusted, as shown below:

[0050]

[0051] Among them, p c represents the crossover rate, p m represents the mutation rate, α and β represent the adjustment coefficients, mean(f) represents the mean fitness, and f max represents the maximum fitness, f min Indicates the minimum fitness value;

[0052] (8) Repeat steps (2) to (6) until the predetermined stop condition is reached.

[0053] Furthermore, the propagation rules of each layer in the graph neural network model are expressed as follows:

[0054] H (k+1) =σ(AH (k) W (k) +B)

[0055] Among them, H (k) represents the node feature matrix of the kth layer, A represents the adjacency matrix of the graph, and W (k) represents the weight matrix of the kth layer, B represents the bias vector, σ represents the activation function, and H (k+1) Represents the node feature matrix of the k+1th layer;

[0056] By stacking multiple graph convolutional layers, high-order features of nodes are extracted layer by layer to form a deep graph neural network model.

[0057] Furthermore, the hyperparameters of the graph neural network model are optimized by the ant colony algorithm to obtain an optimized graph neural network model, which specifically includes:

[0058] a. Initialize the ant colony;

[0059] b. Each ant builds a graph neural network model according to the current parameter settings and calculates the fitness value. The fitness function is the prediction error of the graph neural network model, expressed as a weighted mean absolute error, as follows:

[0060]

[0061] Among them, WMAE 2 Represents the fitness value of the graph neural network model, w i represents the weight of the i-th node, r i represents the corrosion rate of the i-th node, y i Indicates the actual value, Represents the predicted value, N Aco Represents the total number of nodes of the ant colony algorithm;

[0062] c. According to the fitness value WMAE 2 Update the cumulative effect of pheromone concentration and corrosion propagation path, introduce the cumulative impact factor γ, expressed as follows:

[0063]

[0064] Among them, τ ij (t) represents edge e ij The pheromone concentration at time t, ρ represents the pheromone volatility coefficient, Δτ ij (t) represents the amount of pheromone added when ants pass by the edge, and γ represents the cumulative impact factor;

[0065] d. Each ant selects a path based on the pheromone concentration and heuristic information, combined with the spatial weight of the corrosion effect, expressed as follows:

[0066]

[0067] Among them, P ij represents the probability of an ant choosing from node i to node j, η ij Represents heuristic information, which is edge e ij The reverse distance of ij Represents edge e ij The corrosion influence weight, δ represents the corrosion influence factor, allowed represents the set of nodes allowed to be selected, and α and β represent the adjustment coefficients;

[0068] e. Repeat steps b to d until the predetermined stopping condition is reached.

[0069] Furthermore, the weight w i and corrosion rate r i Dynamically adjust according to the importance and corrosion level of the node.

[0070] Furthermore, the step S4 specifically includes:

[0071] S401. The future corrosion trend prediction value output by the long short-term memory network model Corrosion propagation path prediction value output by graph neural network model Fusion is performed to form comprehensive prediction data P, which is then combined with real-time sensor data R and historical data H to construct a comprehensive feature matrix F, from which key features are extracted;

[0072] S402, use the sliding window method to calculate the dynamic mean μ of each feature i (t) and dynamic standard deviation σ i (t), and according to the dynamic mean μ of each feature i (t) and dynamic standard deviation σ i (t) Set the warning threshold τ i (t), the warning threshold τ i (t) The threshold is adjusted dynamically according to actual needs, and the early warning signal is generated for the comprehensive feature matrix F. If the eigenvalue f of any sensor ij (t) exceeds the warning threshold τ i (t), then generate the warning signal S j (t);

[0073] S403, according to the warning signal S j (t) Generate strategies for optimal resource allocation;

[0074] S404: Collect feedback data after executing resource allocation strategy and dynamically adjust warning threshold τ i (t) and adjustment coefficient k, dynamically update the alarm threshold, so as to modify the alarm threshold according to the latest feedback data and actual situation, and combine the latest execution status and historical data of the resource allocation strategy, resource allocation strategy; wherein, the dynamic adjustment of the warning threshold τ i (t) and the adjustment factor are expressed as follows:

[0075] τ i ′(t)=μ i (t)+k′σ i (t)

[0076] Among them, k′ represents the new adjustment coefficient, τ i ′(t) represents the updated warning threshold.

[0077] Furthermore, the step S403 specifically includes:

[0078] For each time S when a warning signal is generated j(t), analyze the corresponding comprehensive feature vector f j (t), identify specific corrosion risk factors, generate maintenance and repair suggestions based on the identified corrosion risk factors, combined with real-time sensor data collected in the pipeline and historical maintenance records, and provide a solution for the optimal configuration of resources; wherein the optimization formula for the solution for the optimal configuration of resources is expressed as follows:

[0079]

[0080] Among them, Cost inspection,i represents the inspection cost of the i-th position, Cost repair,i represents the repair cost of the i-th location, M represents the total number of locations that need to be maintained, and S i Indicates the warning signal of the corresponding location.

[0081] In a second aspect of the present invention, a natural gas pipeline corrosion prediction and early warning system is provided, the system comprising:

[0082] A prediction data acquisition unit is used to install sensors at different locations of the natural gas pipeline, collect pipeline data of the natural gas pipeline, transmit and store the collected data on a central server, and pre-process the collected data, normalize the pre-processed data and perform feature extraction; the feature extraction includes calculating the statistical features of each sensor as time domain features, then using fast Fourier transform to convert the time domain data into frequency domain data, and extracting spectrum features from the frequency domain data;

[0083] The corrosion time prediction unit is used to sort the spectrum characteristics of each sensor according to the timestamp to form a corresponding data sequence set, and then merge the corresponding data sequence set to form a multidimensional time series, introduce environmental impact items and pipeline stress impact items to build a long short-term memory network model based on the natural gas pipeline, use the multidimensional time series as the input of the long short-term memory network model to obtain the predicted value at the current moment, calculate the deviation between the actual value and the predicted value at the current moment to obtain the hyperparameter, and optimize the hyperparameter of the long short-term memory network model through an adaptive genetic algorithm to obtain the optimized long short-term memory network model, and use the optimized long short-term memory network model to predict the corrosion trend of the natural gas pipeline according to the historical multidimensional time series; wherein, the introduction of environmental impact items and pipeline stress impact items to build a long short-term memory network model based on the natural gas pipeline is expressed as follows:

[0084] f t =σ(W f ·[h t-1 ,x t ,e t ,s t ]+b f )

[0085] i t =σ(W i ·[h t-1 ,x t ,e t ,s t ]+b i )

[0086] g t =tanh(W g ·[h t-1 ,x t ,e t ,s t ]+b g )

[0087] o t =σ(W o ·[h t-1 ,x t ,e t ,s t ]+b o )

[0088] c t =f t ⊙c t-1 +i t ⊙g t

[0089] h t =o t ⊙tanh(c t )

[0090] Among them, W f ,W i ,W g ,W o Represent the weight matrices of the forget gate, input gate, candidate memory and output gate respectively; f t Represents the forget gate vector at time t; i t represents the input gate vector at time t; g t represents the candidate memory vector at the tth moment; o t represents the output gate vector at time t; c t represents the cell state vector at time t; h t represents the hidden state vector at the tth moment; σ represents the Sigmoid activation function, which is used to limit the output of the gate between 0 and 1; tanh represents the hyperbolic tangent activation function, which is used to generate candidate memory vectors and adjust the output of the hidden state, and its value is between -1 and 1; h t-1 represents the hidden state vector at time t-1; c t-1represents the cell state vector at time t-1; ⊙ represents the element-wise multiplication operator, which is used to combine the outputs of different gates and state updates; x t ∈R d represents the d-dimensional feature vector at the tth moment, and X={x 1 ,x 2 ,…,x t ,x T}, X is the multidimensional time series of sensor data merger; e t represents the environmental impact item at time t; s t represents the pipeline stress influence term at the tth moment; b f ,b i ,b g ,b o Represent the bias vectors of the forget gate, input gate, candidate memory, and output gate, respectively, which are used to adjust the output of each gate;

[0091] The corrosion location prediction unit is used to build a graph neural network model based on the pipeline network according to the location of the natural gas pipeline. The graph neural network model is used to predict the corrosion propagation path in the pipeline according to the predicted corrosion trend and the historical corrosion propagation path. Then, the hyperparameters of the graph neural network model are optimized according to the historical corrosion propagation path and the structural data of the pipeline through the ant colony algorithm to obtain the optimized graph neural network model. The optimized graph neural network model is used to predict the future corrosion propagation path.

[0092] The pipeline corrosion early warning unit is used to design early warning thresholds and generate early warning signals based on the prediction results of the optimized long short-term memory network model and the optimized graph neural network model, combined with real-time sensor data and historical sensor data, and provide intelligent maintenance and repair suggestions based on the early warning signals to optimize resource configuration. According to the actual execution of the resource configuration strategy, the early warning threshold and resource configuration strategy are adjusted in real time. The beneficial technical effects of the present invention are at least as follows:

[0093] The present invention collects real-time pipeline internal and external environmental data (such as temperature, humidity, pressure, gas composition, etc.) and historical corrosion data through a sensor network, and uses edge computing technology for preliminary processing to ensure the accuracy and real-time nature of the data. This innovation solves the problem of incomplete data in the prior art, making corrosion prediction more accurate and comprehensive.

[0094] The present invention adopts the long short-term memory model (LSTM) and graph neural network model (GNN) optimized by adaptive genetic algorithm (AGA), and jointly optimizes the parameters of LSTM and GNN models through AGA to achieve high-precision prediction of time series data and pipeline network structure data. The integrated model can handle complex nonlinear corrosion behavior, improve the accuracy of prediction, and overcome the problem of single prediction model and low accuracy in the prior art.

[0095] The present invention combines the results of the integrated prediction model to analyze potential corrosion risks in real time and send warning information, including warning level, location and recommended measures. At the same time, the system provides intelligent maintenance and decision-making suggestions, dynamically adjusts the maintenance plan, and achieves the optimal allocation of resources. This innovation solves the problems of long detection cycles and delayed maintenance decisions in the prior art, and realizes real-time, intelligent and automated corrosion monitoring and maintenance decisions. BRIEF DESCRIPTION OF THE DRAWINGS

[0096] The present invention is further described using the accompanying drawings, but the embodiments in the accompanying drawings do not constitute any limitation to the present invention. A person skilled in the art can obtain other drawings based on the following drawings without creative work.

[0097] Figure 1 The present invention is a flow chart of a natural gas pipeline corrosion prediction and early warning method.

[0098] Figure 2 This is a framework diagram of a natural gas pipeline corrosion prediction and early warning system of the present invention. DETAILED DESCRIPTION

[0099] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.

[0100] like Figure 1 As shown, an embodiment of the present invention provides a natural gas pipeline corrosion prediction and early warning method, which includes the following steps S1-S4.

[0101] S1. Install sensors at different locations of the natural gas pipeline to collect pipeline data of the natural gas pipeline, transmit and store the collected data on a central server, and pre-process the collected data, normalize the pre-processed data, and perform feature extraction.

[0102] Specifically, temperature sensors (T), humidity sensors (H), pressure sensors (P), and gas composition sensors (G) are installed at different locations of the pipeline (including the inner and outer walls) to collect the corresponding physical quantities. Determine the spacing and layout of the sensors to ensure comprehensive coverage of data collection. The layout of the sensors should take into account factors such as pipeline length, curvature, and environmental complexity. Use the formula to calculate the optimal spacing between sensors:

[0103]

[0104] Where D is the sensor spacing, L is the pipe length, and N is the number of sensors.

[0105] Furthermore, the real-time transmission of data is achieved through the Internet of Things technology and stored in the central server. 1. The sensor sends data to a nearby gateway device through a wireless transmission module (such as LoRa, NB-IoT). The gateway device collects the data and transmits the data to the central server through a 4G / 5G network or a wired network. A database is established on the central server to store sensor data. The database structure should include fields such as timestamp, sensor ID, data type, and data value.

[0106] Furthermore, the collected raw data is cleaned to remove noise and outliers to ensure the accuracy and consistency of the data. The moving average filter is used to smooth the data. The formula is as follows:

[0107]

[0108] in, is the smoothed value of the ith data point, x i is the ith original data point, and k is the window size.

[0109] Then use the 3σ principle to detect outliers, the formula is as follows:

[0110]

[0111] x i is an outlier if |x i -μ|>3σ (5)

[0112] Where μ is the data mean, σ is the data standard deviation; x i is an outlier if|x i -μ|>3σ means that if the absolute value of the difference between the ith original data point and the data mean is greater than 3σ, the ith original data point is an outlier.

[0113] Furthermore, different types of data are normalized to ensure that the weights of each data type are consistent in subsequent analysis.

[0114] Among them, the minimum-maximum normalization method is used to normalize the data to the [0,1] interval. The formula is as follows:

[0115]

[0116] Among them, x′ i is the normalized data, x i is the original data, x min and x max are the minimum and maximum values ​​of the data respectively.

[0117] Furthermore, key features are extracted from the preprocessed data for subsequent corrosion prediction.

[0118] Specifically, time domain feature extraction: calculate the statistical characteristics of each sensor data, such as mean, variance, skewness and kurtosis. The formula is as follows:

[0119]

[0120] Among them, x i is the i-th data point, n is the total number of data points, σ ​​is the data standard deviation, Mean represents mean, Variance represents variance, Skewness represents skewness, and Kurtosis represents kurtosis.

[0121] Frequency domain feature extraction: Use Fast Fourier Transform (FFT) to convert time domain data into frequency domain data and extract spectrum features. The formula is as follows:

[0122] Among them, X(f) is the frequency domain signal, x(n) is the time domain signal, and N outlier is the total number of data points and f is the frequency.

[0123] Through the above steps, a complete multi-source data acquisition and preprocessing system is constructed. The system can collect and process environmental data and corrosion-related data of natural gas pipelines in real time, comprehensively and accurately, providing a reliable data basis for subsequent corrosion prediction and early warning. Each step is closely connected to ensure the integrity and effectiveness of the data, solve the problem of incomplete and inaccurate data in the background technology, and lay the foundation for efficient corrosion prediction and early warning.

[0124] S2. Introduce environmental impact items and pipeline stress impact items to construct a long short-term memory network model based on the natural gas pipeline. Use the features extracted in step S1 as the input of the long short-term memory network model, and optimize the hyperparameters of the long short-term memory network model through an adaptive genetic algorithm to obtain an optimized long short-term memory network model. Use the optimized long short-term memory network model to predict the corrosion trend of the natural gas pipeline.

[0125] Specifically, the data from step 1 are sorted by timestamp to form a time series dataset.

[0126] The sensor data are combined to form a multidimensional time series, which can be expressed as:

[0127] X={x 1 ,x 2 ,…,x t ,x T} (12)

[0128] Among them, x t ∈R d Represents the d-dimensional feature vector at the tth time.

[0129] Furthermore, the LSTM model is used to capture the long-term dependencies and nonlinear relationships in time series data for corrosion trend prediction.

[0130] Specifically, construct an LSTM unit and introduce environmental impact items and pipeline stress impact items:

[0131] f t =σ(W f ·[h t-1 ,x t ,e t ,s t ]+b f )

[0132] i t =σ(W i ·[h t-1 ,x t ,e t ,s t ]+b i )

[0133] g t =tanh(W g ·[h t-1 ,x t ,e t ,s t ]+b g )

[0134] o t =σ(W o·[h t-1 ,x t ,e t ,s t ]+b o )

[0135] c t =f t ⊙c t-1 +i t ⊙g t

[0136] h t =o t ⊙tanh(c t )

[0137] Among them, f t Represents the forget gate vector at time t. It is used to determine which information needs to be forgotten at the current moment. In combination with the patent scenario, this vector is composed of the hidden state h at the previous moment. t-1 , the current input data x t 、Environmental impact items t and the pipe stress term s t Its function is to filter out unimportant historical information to adapt to changes in the environment and stress. t Represents the input gate vector at time t. It is used to determine what new information needs to be written into the cell state at the current moment. The input gate takes into account the hidden state h at the previous moment. t-1 , the input data x at the current moment t 、Environmental impact items t and the pipe stress term s t . g t Represents the candidate memory vector at time t. It is generated by the hyperbolic tangent function tanh, combined with the hidden state h at the previous moment t-1 , the input data x at the current moment t 、Environmental impact items t and the pipe stress term s t , used to update the cell state. o t Represents the output gate vector at time t. It determines which parts of the cell state need to be output. The output gate also considers the hidden state h at the previous moment. t-1 , the current input data x t 、Environmental impact items t and the pipe stress term s t .c t Represents the cell state vector at time t. Through the forget gate f t Adjust the cell state c at the previous moment t-1 , and input gate i t and candidate memory g tJoint decision. t Represents the hidden state vector at time t. Through the output gate o t Regulate cell status t The output of W is combined with the result after tanh function processing. f ,W i ,W g ,W o Represent the weight matrices of the forget gate, input gate, candidate memory, and output gate, respectively. These matrices are used to weight the input features to better meet the specific needs of corrosion prediction. f ,b i ,b g ,b o They represent the bias vectors of the forget gate, input gate, candidate memory, and output gate, respectively, and are used to adjust the output of each gate to improve the flexibility and predictive power of the model. t Represents the environmental impact item at time t, including environmental data such as temperature and humidity. These data have a significant impact on pipeline corrosion and are used as part of LSTM input to improve prediction accuracy. t Represents the pipeline stress influence term at the tth moment, including stress data such as the internal and external pressure difference. These data have an important impact on pipeline corrosion and are used as part of the LSTM input to more accurately predict corrosion. σ represents the Sigmoid activation function, which is used to limit the output of the gate between 0 and 1 for gating operations. tanh represents the hyperbolic tangent activation function, which is used to generate candidate memory vectors and adjust the output of hidden states, and its value is between -1 and 1. ⊙ represents the element-by-element multiplication operator, which is used to combine the outputs of different gates and state updates.

[0138] It can be understood that a multi-layer LSTM network is constructed, and multiple LSTM units are connected to form a deep LSTM model to capture the complex time dependencies and environment and deal with the impact of corrosion.

[0139] Furthermore, the hyperparameters of the LSTM model are optimized by an adaptive genetic algorithm (AGA) to improve the prediction accuracy of the model.

[0140] Specifically, the following steps are included:

[0141] (1) Initialize the population: Randomly generate a set of LSTM model hyperparameters (such as the number of layers, number of hidden units, learning rate, etc.) as the initial population.

[0142] (2) Fitness evaluation: Calculate the fitness of each individual. The fitness function is the prediction error of the LSTM model, expressed as weighted mean square error (WMSE) to better consider the prediction accuracy at important moments:

[0143]

[0144] Among them, w i is the weight of the i-th sample, y i is the actual value, is the predicted value, n Aga is the number of samples. The weight w i It can be dynamically adjusted according to the importance of the data. 1 Represents the fitness value of the LSTM model.

[0145] (3) Selection operation: Select excellent individuals for reproduction based on fitness values, using the roulette wheel selection method:

[0146]

[0147] Among them, P i is the choice probability of individual i, f i is the fitness of individual i, and N is the population size.

[0148] (4) Crossover operation: Perform a crossover operation on the selected individuals to generate new individuals. The crossover method is multi-point crossover. Assume that individuals A and B are crossed to generate individuals C and D:

[0149]

[0150] Among them, k and m are the crossover points, and n is the gene length of the individual.

[0151] (5) Mutation operation: Perform mutation operation on new individuals, randomly change certain parameters of individuals with a certain probability, and enhance population diversity. The mutation formula is:

[0152] x i ′=x i +δ·randn() (17)

[0153] Among them, x i ′ is the parameter after mutation, x i is the parameter before mutation, δ is the amplitude of mutation, and randn() is a standard normal distribution random number.

[0154] (6) Adaptive adjustment: According to the fitness value of the current generation, the crossover rate and mutation rate are dynamically adjusted to improve the convergence speed and stability of the algorithm. The adjustment formula of the crossover rate and mutation rate is:

[0155]

[0156] Among them, p c is the crossover rate, p m is the mutation rate, α and β are adjustment coefficients, mean(f) is the mean fitness, f max is the maximum fitness, fmin is the minimum fitness value.

[0157] (7) Iterative evolution: Repeat steps 2 to 6 until a predetermined stopping condition (such as the number of iterations or fitness threshold) is reached.

[0158] Furthermore, the optimized LSTM model is used to predict future corrosion trends. The multidimensional time series data in step 2.1 is used as input to the optimized LSTM model. The model outputs the corrosion prediction value at the future time h, expressed as:

[0159]

[0160] in, Represents the corrosion prediction value at the T+ith moment.

[0161] S3. Build a graph neural network model based on the pipeline network according to the location of the natural gas pipeline. Use the graph neural network model to predict the corrosion propagation path in the pipeline according to the predicted corrosion trend. Then optimize the hyperparameters of the graph neural network model through the ant colony algorithm to obtain the optimized graph neural network model. Use the optimized graph neural network model to predict future corrosion propagation paths.

[0162] Specifically, the corrosion trend prediction results output by the LSTM model are combined with the pipeline structure data to form graph structure data suitable for GNN input.

[0163] Corrosion trend prediction results based on the output from the LSTM model Extract corrosion data for a future period of time.

[0164] Construct the graph structure of the pipeline network, represented as G = (V, E), where V is the node set and E is the edge set. i ∈V represents a position in the pipeline, and edge e ij ∈E represents the position v i and v j The connection between.

[0165] The corrosion prediction value output by LSTM Mapped to the corresponding node feature vector Combined with other environmental and stress data, the initial node characteristic matrix H is formed 0 :

[0166]

[0167] in, is node v i is the initial eigenvector of , and N is the number of nodes.

[0168] Furthermore, the graph neural network (GNN) model is used to predict the corrosion propagation path in the pipeline.

[0169] Among them, the graph convolution layer of the GNN model is defined. The propagation rule of each layer is:

[0170] H (k+1) =σ(AH (k) W (k) +B) (22)

[0171] Among them, H (k) is the node feature matrix of the kth layer, A is the adjacency matrix of the graph, W (k) is the weight matrix of the kth layer, B is the bias vector, and σ is the activation function.

[0172] Then, a multi-layer GNN network is constructed. By stacking multiple graph convolutional layers, the high-order features of nodes are extracted layer by layer to form a deep GNN model.

[0173] Preferably, the hyperparameters of the GNN model are optimized by the ant colony algorithm (ACO) to improve the prediction accuracy of the model. The ant colony algorithm can effectively search the parameter space and find the global optimal solution, which is suitable for solving high-dimensional complex optimization problems.

[0174] Specifically, the ant colony algorithm (ACO) includes the following steps:

[0175] a. Initialize the ant colony: set parameters such as the number of ants m, pheromone intensity τ, pheromone volatility coefficient ρ, heuristic factor α and expectation factor β.

[0176] b. Fitness evaluation: Each ant builds a GNN model according to the current parameter settings and calculates the fitness value. The fitness function is the prediction error of the GNN model, which is expressed by the weighted mean absolute error (WMAE) to better consider the prediction accuracy of important nodes. To reflect the actual situation of corrosion propagation, the corrosion rate and key position weights are considered, and the formula is as follows:

[0177]

[0178] Among them, w i is the weight of the ith node, r i is the corrosion rate of the ith node, y i is the actual value, is the predicted value, N Aco is the number of nodes in the ant algorithm. Weight w i and corrosion rate r i Dynamically adjust according to the importance and corrosion degree of the node, WMAE 2 Represents the fitness value of the GNN model.

[0179] c. Pheromone update: Update the pheromone concentration according to the fitness value. In order to consider the cumulative effect of the corrosion propagation path, the cumulative impact factor γ is introduced. The formula is:

[0180]

[0181] Among them, τ ij (t) is edge e ij The pheromone concentration at time t, ρ is the pheromone volatility coefficient, Δτ ij (t) is the amount of pheromone added when ants pass by the edge, and γ is the cumulative impact factor.

[0182] d. Path selection: Each ant selects a path based on pheromone concentration and heuristic information, combined with the spatial weight of corrosion impact, the formula is:

[0183]

[0184] Among them, P ij is the probability of an ant choosing from node i to node j, η ij is the heuristic information, usually edge e ij The reverse distance, κ ij It is edge ij The corrosion influence weight, δ is the corrosion influence factor, and allowed is the set of nodes allowed to be selected.

[0185] e. Iterative optimization: Repeat steps b to d until a predetermined stopping condition (such as the number of iterations or fitness threshold) is reached.

[0186] Furthermore, the optimized GNN model is used to predict the future corrosion propagation path. 0 As input, the optimized GNN model is fed.

[0187] The model outputs the corrosion prediction value of each node in the future, which is expressed as:

[0188]

[0189] in, Represents node v i Corrosion prediction value.

[0190] S4. Based on the prediction results of the optimized long short-term memory network model and the optimized graph neural network model, combined with real-time sensor data and historical sensor data, the warning threshold is designed and the warning signal is generated. At the same time, intelligent maintenance and repair suggestions are provided based on the warning signal to optimize the resource allocation. According to the actual execution situation, the warning threshold and decision plan are adjusted in real time.

[0191] Specifically, the prediction results of LSTM and GNN models are fused, combined with real-time sensor data and historical data, to extract key features for use in early warning and decision support systems.

[0192] Furthermore, the future corrosion trend prediction value output by the LSTM model is Corrosion propagation path prediction value output by GNN model Fusion is performed to form comprehensive prediction data P:

[0193]

[0194] Combine real-time sensor data R and historical data H to construct a comprehensive feature matrix F:

[0195] F=[P,R,H] (28)

[0196] Feature extraction: Extract key features from the comprehensive feature matrix F, such as corrosion rate, environmental conditions, and pipeline stress:

[0197] F={f 1 ,f 2 ,…,f i ,f n} (29)

[0198] Among them, f i The feature vector at the i-th moment contains the fusion features of comprehensive forecast data, real-time data, and historical data. It refers to the j-th specific data point of the i-th feature at time t in the comprehensive feature matrix F. It represents a single feature (such as temperature or pressure at a certain moment).

[0199] Furthermore, based on the comprehensive feature matrix F, the warning threshold is calculated and a warning signal is generated.

[0200] Specifically, calculate the dynamic mean μ of each feature i (t) and dynamic standard deviation σ i (t), using the sliding window method:

[0201]

[0202] Where W is the sliding window size; f ij It is the value of the i-th feature in the feature matrix F at the j-th time, which refers to the j-th specific data point of the i-th feature at time t in the comprehensive feature matrix F. It represents a single feature (such as temperature or pressure at a certain moment).

[0203] Set the warning threshold τ i (t), dynamically adjust the threshold according to actual needs, the formula is:

[0204] τ i (t) = μ i (t)+kσ i (t) (32)

[0205] Among them, k is the adjustment coefficient, which is determined based on historical data and field experience.

[0206] Generate early warning signals for the comprehensive feature matrix F. If any eigenvalue f ij (t) exceeds the warning threshold τ i (t), then generate the warning signal S j (t):

[0207]

[0208] Among them, S j (t) is the early warning signal at the jth moment.

[0209] Furthermore, for each time S when a warning signal is generated j (t), analyze its corresponding comprehensive feature vector f j (t), identify specific corrosion risk factors.

[0210] By analyzing the comprehensive feature vector fj(t), different physical quantities (such as temperature, humidity, pressure, corrosion rate, etc.) can be combined to evaluate the corrosion risk of the pipeline. For example, when the temperature and humidity increase and the pressure fluctuation intensifies, the corrosion rate may increase, thus being identified as a potential corrosion risk. Therefore, the comprehensive feature vector fj(t) can be used for multidimensional analysis and identification of risk factors related to corrosion through the various types of feature information it contains.

[0211] Furthermore, based on the identified corrosion risk factors, combined with the actual operation of the pipeline and historical maintenance records, maintenance and repair recommendations are generated:

[0212] If the warning signal mainly comes from the predicted data P, it is recommended to conduct a detailed on-site inspection to determine the actual corrosion situation.

[0213] If the early warning signal mainly comes from the real-time data R, it is recommended to take emergency measures immediately to prevent further expansion of corrosion.

[0214] If the early warning signal mainly comes from historical data H, it is recommended to adjust the long-term maintenance plan and strengthen regular inspections and anti-corrosion treatments at relevant locations.

[0215] Furthermore, a resource optimization configuration plan is provided based on the generated maintenance and repair suggestions to ensure the reasonable allocation of human, material and financial resources during the maintenance and repair process to avoid resource waste. The resource optimization formula is:

[0216]

[0217] Among them, Cost inspection,i is the inspection cost of the ith position, Cost repair,i is the repair cost of the i-th location, M is the total number of locations that need to be maintained, S i It is the early warning signal of the corresponding position.

[0218] Furthermore, according to the actual execution situation, the warning threshold and decision plan are adjusted in real time to improve the adaptability and accuracy of the system.

[0219] Specifically, collect feedback data after execution, including inspection results, repair status, and actual costs, and update the comprehensive feature matrix F:

[0220] F′=F∪{F feedback} (35)

[0221] Dynamically adjust the warning threshold τ based on feedback data i (t) and adjustment coefficient k to ensure the accuracy and timeliness of the early warning signal:

[0222] τ i ′(t)=μ i (t)+k′σ i (t) (36)

[0223] Among them, k′ is the new adjustment coefficient, which is corrected according to the latest feedback data and actual situation.

[0224] Update the maintenance and repair suggestion library, combine the latest execution status and historical data, and continuously optimize the decision support system. The maintenance plan update formula is:

[0225] Plan new =Plan old +ΔPlan (37)

[0226] Among them, ΔPlan is the change in the maintenance plan adjusted according to the latest feedback data.

[0227] To better implement the above method, Figure 2 As shown, the present invention also proposes a natural gas pipeline corrosion prediction and early warning system, the system comprising:

[0228] The prediction data acquisition unit 301 is used to install sensors at different positions of the natural gas pipeline, collect pipeline data of the natural gas pipeline, transmit and store the collected data in a central server, and pre-process the collected data, normalize the pre-processed data and perform feature extraction; the feature extraction includes calculating the statistical features of each sensor as time domain features, then using fast Fourier transform to convert the time domain data into frequency domain data, and extracting spectrum features from the frequency domain data;

[0229] The corrosion time prediction unit 302 is used to sort the spectrum characteristics of each sensor according to the timestamp to form a corresponding data sequence set, and then merge the corresponding data sequence set to form a multidimensional time series, introduce environmental impact items and pipeline stress impact items to build a long short-term memory network model based on the natural gas pipeline, use the multidimensional time series as the input of the long short-term memory network model to obtain the predicted value at the current moment, calculate the deviation between the actual value and the predicted value at the current moment to obtain the hyperparameter, and optimize the hyperparameter of the long short-term memory network model through an adaptive genetic algorithm to obtain the optimized long short-term memory network model, and use the optimized long short-term memory network model to predict the corrosion trend of the natural gas pipeline according to the historical multidimensional time series; wherein, the introduction of environmental impact items and pipeline stress impact items to build a long short-term memory network model based on the natural gas pipeline is expressed as follows:

[0230] f t =σ(W f ·[h t-1 ,x t ,e t ,s t ]+b f )

[0231] i t =σ(W i ·[h t-1 ,x t ,e t ,s t ]+b i )

[0232] g t =tanh(W g ·[h t-1 ,x t ,e t ,s t ]+b g )

[0233] o t =σ(W o ·[h t-1 ,x t ,e t ,st ]+b o )

[0234] c t =f t ⊙c t-1 +i t ⊙g t

[0235] h t =o t ⊙tanh(c t )

[0236] Among them, W f ,W i ,W g ,W o Represent the weight matrices of the forget gate, input gate, candidate memory and output gate respectively; f t Represents the forget gate vector at time t; i t represents the input gate vector at time t; g t represents the candidate memory vector at the tth moment; o t represents the output gate vector at time t; c t represents the cell state vector at time t; h t represents the hidden state vector at the tth moment; σ represents the Sigmoid activation function, which is used to limit the output of the gate between 0 and 1; tanh represents the hyperbolic tangent activation function, which is used to generate candidate memory vectors and adjust the output of the hidden state, and its value is between -1 and 1; h t-1 represents the hidden state vector at time t-1; c t-1 represents the cell state vector at time t-1; ⊙ represents the element-wise multiplication operator, which is used to combine the outputs of different gates and state updates; x t ∈R d represents the d-dimensional feature vector at the tth moment, and X={x 1 ,x 2 ,…,x t ,x T}, X is the multidimensional time series of sensor data merger; e t represents the environmental impact item at time t; s t represents the pipeline stress influence term at the tth moment; b f ,b i ,b g ,b o Represent the bias vectors of the forget gate, input gate, candidate memory, and output gate, respectively, which are used to adjust the output of each gate;

[0237] The corrosion location prediction unit 303 is used to construct a graph neural network model based on the pipeline network according to the location of the natural gas pipeline, and use the graph neural network model to predict the corrosion propagation path in the pipeline according to the predicted corrosion trend and the historical corrosion propagation path, and then use the ant colony algorithm to optimize the hyperparameters of the graph neural network model according to the historical corrosion propagation path and the structural data of the pipeline to obtain an optimized graph neural network model, and use the optimized graph neural network model to predict the future corrosion propagation path;

[0238] The pipeline corrosion early warning unit 304 is used to design early warning thresholds and generate early warning signals based on the prediction results of the optimized long short-term memory network model and the optimized graph neural network model, combined with real-time sensor data and historical sensor data. It also provides intelligent maintenance and repair suggestions based on the early warning signals, optimizes resource allocation, and adjusts the early warning thresholds and resource allocation strategies in real time according to the actual implementation of the resource allocation strategy.

[0239] Unless otherwise specifically stated, the relative steps, numerical expressions and values ​​of the components and steps set forth in these embodiments do not limit the scope of the present application.

[0240] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0241] In the description of the present application, it should be noted that the terms "upper", "lower", etc. indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, or the orientations or positional relationships in which the inventive product is usually placed when in use. These are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present application.

[0242] In the description of this application, it should also be noted that, unless otherwise clearly specified and limited, the terms "set", "install", "connect", and "connect" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two elements. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.

[0243] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A natural gas pipeline corrosion prediction and early warning method, characterized in that: The method comprises: S1. Install sensors at different locations of the natural gas pipeline to collect pipeline data of the natural gas pipeline, transmit and store the collected data on a central server, pre-process the collected data, normalize the pre-processed data and perform feature extraction; the feature extraction includes calculating the statistical features of each sensor as time domain features, then using fast Fourier transform to convert the time domain data into frequency domain data, and extracting spectrum features from the frequency domain data; wherein the sensor installation specifically includes: Install temperature sensors T, humidity sensors H, pressure sensors P and gas composition sensors G at different locations of the pipeline to collect corresponding physical quantities; wherein the different locations include the inner wall and the outer wall; S2. Sort the spectral features of each sensor according to the timestamp to form a corresponding data sequence set, then merge the corresponding data sequence set to form a multidimensional time series, introduce environmental impact items and pipeline stress impact items to build a long short-term memory network model based on the natural gas pipeline, use the multidimensional time series as the input of the long short-term memory network model to obtain the predicted value at the current moment, calculate the deviation between the actual value and the predicted value at the current moment to obtain the hyperparameter, and optimize the hyperparameter of the long short-term memory network model through an adaptive genetic algorithm to obtain the optimized long short-term memory network model, and use the optimized long short-term memory network model to predict the corrosion trend of the natural gas pipeline according to the historical multidimensional time series; wherein, the introduction of environmental impact items and pipeline stress impact items to build a long short-term memory network model based on the natural gas pipeline is expressed as follows: in, Represent the weight matrices of the forget gate, input gate, candidate memory, and output gate respectively; Indicates The forget gate vector at the moment; Indicates The input gate vector at time t; Indicates Candidate memory vector at time instant; Indicates Output gate vector at time t; Indicates The cell state vector at the moment; Indicates The hidden state vector at time t; Represents the Sigmoid activation function, which is used to limit the output of the gate between 0 and 1; represents the hyperbolic tangent activation function, which is used to generate candidate memory vectors and adjust the output of hidden states, and its value is between -1 and 1; Indicates Hidden state vector at time -1; Indicates -1 cell state vector at time instant; Represents the element-wise multiplication operator, used to combine the outputs of different gates and state updates; Indicates Moment dimensional feature vector, and , Multidimensional time series merged for sensor data; Indicates Environmental impact items at the moment; Indicates The influence item of pipeline stress at the moment; Represent the bias vectors of the forget gate, input gate, candidate memory, and output gate, respectively, which are used to adjust the output of each gate; S3. Build a pipeline network-based graph neural network model according to the location of the natural gas pipeline. Use the graph neural network model to predict the corrosion propagation path in the pipeline based on the predicted corrosion trend and the historical corrosion propagation path. Then, use the ant colony algorithm to optimize the hyperparameters of the graph neural network model according to the historical corrosion propagation path and the structural data of the pipeline to obtain the optimized graph neural network model. Use the optimized graph neural network model to predict the future corrosion propagation path. S4. Based on the prediction results of the optimized long short-term memory network model and the optimized graph neural network model, combined with real-time sensor data and historical sensor data, the warning threshold is designed and a warning signal is generated. At the same time, intelligent maintenance and repair suggestions are provided based on the warning signal to optimize resource allocation. According to the actual implementation of the resource allocation strategy, the warning threshold and resource allocation strategy are adjusted in real time; The step S4 specifically includes: S401. The future corrosion trend prediction value output by the long short-term memory network model Corrosion propagation path prediction value output by graph neural network model Fusion to form comprehensive prediction data , combined with real-time sensor data and historical data , construct a comprehensive feature matrix , from the comprehensive feature matrix Extract key features from S402. Use the sliding window method to calculate the dynamic mean of each feature and dynamic standard deviation , and based on the dynamic mean of each feature and dynamic standard deviation Setting warning thresholds , according to the warning threshold The threshold is adjusted dynamically according to actual needs, and the comprehensive feature matrix Generate warning signals if the characteristic value of any sensor Exceeding the warning threshold , then an early warning signal is generated ; S403, according to the early warning signal Strategies for generating optimal allocations of resources; S404: Collect feedback data after executing resource allocation strategies and dynamically adjust warning thresholds and adjustment factor , dynamically update the alarm threshold, so that the alarm threshold is corrected according to the latest feedback data and actual situation, and at the same time, combined with the latest execution status and historical data of the resource allocation strategy, the resource allocation strategy; wherein, the dynamic adjustment of the warning threshold and adjustment coefficient, expressed as follows: in, represents the new adjustment factor, Indicates the updated warning threshold; The step S403 specifically includes: For each moment when a warning signal is generated , analyze the corresponding comprehensive feature vector , identify specific corrosion risk factors, generate maintenance and repair suggestions based on the identified corrosion risk factors, combined with real-time sensor data collected in the pipeline and historical maintenance records, and provide a solution for the optimal configuration of resources; wherein the optimization formula for the solution for the optimal configuration of resources is expressed as follows: in, Indicates The inspection cost of each location, Indicates The repair cost of each location, Indicates the total number of locations that need to be maintained, Indicates the warning signal of the corresponding location.

2. A natural gas pipeline corrosion prediction and early warning method according to claim 1, characterized in that: The sensors include a temperature sensor, a humidity sensor, a pressure sensor and a gas composition sensor; Among them, the optimal spacing of the designed sensors is: in, represents the sensor spacing, Indicates the length of the pipeline, Indicates the number of sensors.

3. A natural gas pipeline corrosion prediction and early warning method according to claim 1, characterized in that: The preprocessing includes smoothing the data using a moving average filter and detecting outliers using the 3σ rule. The moving average filter is used to smooth the data, which is expressed as follows: in, Indicates The smoothed value of the data points, Indicates The original data points, Indicates the window size; j indicates relative to the The offset of the data points ranges from − arrive ; Indicates +j original data points; The 3σ principle is used to detect outliers, which is expressed as follows: in, represents the data mean, represents the standard deviation of the data, and n represents the total number of data points; If The absolute value of the difference between the original data point and the data mean is greater than , then The original data points are outliers; The feature extraction includes time domain feature extraction and frequency domain feature extraction; The time domain feature extraction calculates the statistical features of each sensor data, which is expressed as follows: in, Indicates data points, represents the total number of data points, represents the standard deviation of the data, represents the mean, represents the variance, represents skewness, represents kurtosis; The frequency domain feature extraction uses fast Fourier transform to convert time domain data into frequency domain data and extract spectrum features, which are expressed as follows: in, represents the frequency domain signal, represents the time domain signal, represents the total number of data points, Indicates frequency.

4. A natural gas pipeline corrosion prediction and early warning method according to claim 1, characterized in that: The method of optimizing the hyperparameters of the long short-term memory network model by an adaptive genetic algorithm to obtain an optimized long short-term memory network model specifically includes the following steps: (1) Randomly generate a set of long short-term memory network model hyperparameters as the initial population; (2) Calculate the fitness of each individual. The fitness function is the prediction error of the long short-term memory network model. The fitness function of the long short-term memory network model is expressed in weighted mean square error, which is expressed as follows: in, Represents the fitness value of the long short-term memory network model, Indicates The weight of the samples, Indicates the actual value, represents the predicted value, Indicates the number of samples of the genetic algorithm; (3) The roulette wheel selection method is used to select excellent individuals for reproduction according to the fitness value, which is expressed as follows: in, Represents an individual The probability of selection, Represents an individual The fitness of the species, K represents the population size, Represents an individual Adaptability; (4) Perform multi-point crossover operations on the selected individuals to generate new individuals; (5) Perform mutation operations on the new individuals to change the parameters of the individuals; (6) According to the fitness value of the current generation, the crossover rate and mutation rate are dynamically adjusted, as shown below: in, represents the crossover rate, represents the mutation rate, and represents the adjustment factor, represents the mean fitness value, represents the maximum fitness value, Indicates the minimum fitness value; Repeat steps (2) to (6) until the predetermined stopping condition is reached.

5. A natural gas pipeline corrosion prediction and early warning method according to claim 1, characterized in that: The propagation rules of each layer in the graph neural network model are expressed as follows: in, Indicates The node feature matrix of the layer, represents the adjacency matrix of the graph, Indicates The weight matrix of the layer, represents the bias vector, represents the activation function, Indicates +1 layer node feature matrix; By stacking multiple graph convolutional layers, high-order features of nodes are extracted layer by layer to form a deep graph neural network model.

6. A natural gas pipeline corrosion prediction and early warning method according to claim 5, characterized in that: The optimized graph neural network model is obtained by optimizing the hyperparameters of the graph neural network model through the ant colony algorithm, including: a. Initialize the ant colony; b. Each ant builds a graph neural network model according to the current parameter settings and calculates the fitness value. The fitness function is the prediction error of the graph neural network model, expressed as a weighted mean absolute error, as follows: in, Represents the fitness value of the graph neural network model, Indicates The weight of the node, Indicates The corrosion rate of nodes, Indicates the actual value, represents the predicted value, Represents the total number of nodes of the ant colony algorithm; c. According to the fitness value Update the cumulative effect of pheromone concentration and corrosion propagation path, and introduce cumulative impact factors , which is expressed as follows: in, Represents edge At the moment The pheromone concentration, represents the pheromone volatility coefficient, represents the amount of pheromone added when ants pass by this edge, represents the cumulative impact factor; d. Each ant selects a path based on the pheromone concentration and heuristic information, combined with the spatial weight of the corrosion effect, expressed as follows: in, Represents an ant slave node To Node The probability of selection, Represents heuristic information, and is the edge The reverse distance of Represents edge The corrosion influence weight, represents the corrosion impact factor, Represents the set of nodes that are allowed to be selected. and represents the adjustment factor; e. Repeat steps b to d until the predetermined stopping condition is reached.

7. A natural gas pipeline corrosion prediction and early warning method according to claim 6, characterized in that: The weight and corrosion rate Dynamically adjust according to the importance and corrosion level of the node.

8. A natural gas pipeline corrosion prediction and early warning system, characterized in that: The system comprises: The prediction data acquisition unit is used to install sensors at different locations of the natural gas pipeline, collect pipeline data of the natural gas pipeline, transmit and store the collected data on a central server, pre-process the collected data, normalize the pre-processed data and perform feature extraction; the feature extraction includes calculating the statistical features of each sensor as time domain features, then using fast Fourier transform to convert the time domain data into frequency domain data, and extracting spectrum features from the frequency domain data; wherein the sensor installation specifically includes: Install temperature sensors T, humidity sensors H, pressure sensors P and gas composition sensors G at different locations of the pipeline to collect corresponding physical quantities; wherein the different locations include the inner wall and the outer wall; The corrosion time prediction unit is used to sort the spectrum characteristics of each sensor according to the timestamp to form a corresponding data sequence set, and then merge the corresponding data sequence set to form a multidimensional time series, introduce environmental impact items and pipeline stress impact items to build a long short-term memory network model based on the natural gas pipeline, use the multidimensional time series as the input of the long short-term memory network model to obtain the predicted value at the current moment, calculate the deviation between the actual value and the predicted value at the current moment to obtain the hyperparameter, and optimize the hyperparameter of the long short-term memory network model through an adaptive genetic algorithm to obtain the optimized long short-term memory network model, and use the optimized long short-term memory network model to predict the corrosion trend of the natural gas pipeline according to the historical multidimensional time series; wherein, the introduction of environmental impact items and pipeline stress impact items to build a long short-term memory network model based on the natural gas pipeline is expressed as follows: in, Represent the weight matrices of the forget gate, input gate, candidate memory, and output gate respectively; Indicates The forget gate vector at the moment; Indicates The input gate vector at time t; Indicates Candidate memory vector at time instant; Indicates Output gate vector at time t; Indicates The cell state vector at the moment; Indicates The hidden state vector at time t; Represents the Sigmoid activation function, which is used to limit the output of the gate between 0 and 1; represents the hyperbolic tangent activation function, which is used to generate candidate memory vectors and adjust the output of hidden states, and its value is between -1 and 1; Indicates Hidden state vector at time -1; Indicates -1 cell state vector at time instant; Represents the element-wise multiplication operator, used to combine the outputs of different gates and state updates; Indicates Moment dimensional feature vector, and , Multidimensional time series merged for sensor data; Indicates Environmental impact items at the moment; Indicates The influence item of pipeline stress at the moment; Represent the bias vectors of the forget gate, input gate, candidate memory, and output gate, respectively, which are used to adjust the output of each gate; The corrosion location prediction unit is used to build a graph neural network model based on the pipeline network according to the location of the natural gas pipeline. The graph neural network model is used to predict the corrosion propagation path in the pipeline according to the predicted corrosion trend and the historical corrosion propagation path. Then, the hyperparameters of the graph neural network model are optimized according to the historical corrosion propagation path and the structural data of the pipeline through the ant colony algorithm to obtain the optimized graph neural network model. The optimized graph neural network model is used to predict the future corrosion propagation path. The pipeline corrosion early warning unit is used to design early warning thresholds and generate early warning signals based on the prediction results of the optimized long short-term memory network model and the optimized graph neural network model, combined with real-time sensor data and historical sensor data. It also provides intelligent maintenance and repair suggestions based on the early warning signals, optimizes resource allocation, and adjusts the early warning thresholds and resource allocation strategies in real time according to the actual implementation of the resource allocation strategy; The pipeline corrosion early warning unit specifically includes: S401. The future corrosion trend prediction value output by the long short-term memory network model Corrosion propagation path prediction value output by graph neural network model Fusion to form comprehensive prediction data , combined with real-time sensor data and historical data , construct a comprehensive feature matrix , from the comprehensive feature matrix Extract key features from S402. Use the sliding window method to calculate the dynamic mean of each feature and dynamic standard deviation , and based on the dynamic mean of each feature and dynamic standard deviation Setting warning thresholds , according to the warning threshold The threshold is adjusted dynamically according to actual needs, and the comprehensive feature matrix Generate warning signals if the characteristic value of any sensor Exceeding the warning threshold , then an early warning signal is generated ; S403, according to the early warning signal Strategies for generating optimal allocations of resources; S404: Collect feedback data after executing resource allocation strategies and dynamically adjust warning thresholds and adjustment factor , dynamically update the alarm threshold, so that the alarm threshold is corrected according to the latest feedback data and actual situation, and at the same time, combined with the latest execution status and historical data of the resource allocation strategy, the resource allocation strategy; wherein, the dynamic adjustment of the warning threshold and adjustment coefficient, expressed as follows: in, represents the new adjustment factor, Indicates the updated warning threshold; The step S403 specifically includes: For each moment when a warning signal is generated , analyze the corresponding comprehensive feature vector , identify specific corrosion risk factors, generate maintenance and repair suggestions based on the identified corrosion risk factors, combined with real-time sensor data collected in the pipeline and historical maintenance records, and provide a solution for the optimal configuration of resources; wherein the optimization formula for the solution for the optimal configuration of resources is expressed as follows: in, Indicates The inspection cost of each location, Indicates The repair cost of each location, Indicates the total number of locations that need to be maintained, Indicates the warning signal of the corresponding location.

Citation Information

Patent Citations

  • Industrial circulating water online corrosion and scaling prediction system and method based on LSTM algorithm

    CN115631802A

  • Oil storage tank wall corrosion detection method, device and equipment and readable storage medium

    CN116361731A