LSTM (Long Short Term Memory)-based modeling method for gas transmission system outside gas storage
Through the modeling method of the external gas transmission system of the gas storage based on LSTM, the problem of large fluctuations in the external gas content is solved, high-precision temperament prediction and real-time control are achieved, and the operating efficiency and safety of the system are improved.
Patent Information
- Application Number
- CN202411702780.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-05-06
- Estimated Expiration
- Not applicable · inactive patent
Smart Images

Figure CN119939829A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of oil and gas field surface engineering instruments and meters, and in particular relates to a LSTM-based gas storage external gas transmission system modeling method. Background Art
[0002] Gas transmission system outside the gas storage facility, such as Figure 1 As shown in the figure, affected by the coupling of multiple parameters such as operating temperature, pressure, flow, liquid level and gas quality change, it is impossible to find the optimal control parameters by relying solely on the operator's experience and conventional PID control, resulting in free water in the external gas and fluctuations in gas quality indicators. Through research to determine the operating boundaries of the key control parameters of the gas storage system that affect the gas quality indicators, and to perform APC-based model predictive control on the gas storage external gas transmission system, reducing the water content of the gas storage external gas transmission is the key to achieving the optimal gas quality indicators of the gas storage external gas transmission. Therefore, how to solve the problem of predicting and controlling the optimal control parameters of the external gas transmission system is urgently needed.
[0003] At present, the production process of gas storage is equipped with a dehydration system, and the DCS is used to monitor and manage the process of production. However, the water content of the transmitted gas is strongly affected by multiple parameters such as operating temperature, pressure, flow, liquid level and gas quality changes. It is impossible to find the optimal control setting value by relying solely on the operator's experience and DCS conventional PID control. This traditional method is difficult to establish to achieve the reduction of the water content of the gas transmitted from the gas storage. The main reason is that the setting value of the PID control loop is set based on experience and cannot reflect the changes in operating conditions and the influence of multiple parameter coupling in real time. In addition, there are problems such as the inability to realize predictive analysis functions, lack of strong coupling and robustness, inability to implement multi-variable optimization algorithms, and inability to handle multi-level and multi-constraint control problems. The prior art CN116307706B discloses a method for early warning of geological risks in gas storage operation and optimization of injection and production plans based on a time series model. However, the technology does not consider the coupling correlation between the process parameters of the front-end and rear-end subsystems of the gas storage, and the technology is mainly aimed at optimizing and adjusting the injection and production parameters to prevent geological risks. The present technology solves the problem of large fluctuations in the water content of the gas transmitted from the gas storage due to the mismatch between the design parameters and the operating conditions. Summary of the invention
[0004] In order to solve the above problems, the present invention proposes: a gas storage external gas transmission system modeling method based on LSTM, comprising the following steps:
[0005] S1. Process data;
[0006] S2. Establish an LSTM model for a single system;
[0007] S3. Establish a complete model of the gas transmission system outside the gas storage facility.
[0008] Furthermore, in step S1, the collected data of various operating conditions of the gas transmission system outside the gas storage reservoir contain noise and outliers, and data cleaning and preprocessing are performed to remove invalid data and correct outliers.
[0009] Furthermore, for the missing data in the data set, we need to fill it. The solution is as follows:
[0010] a) Identify missing values: traverse the entire dataset to identify where the missing values are located and represent the missing values with a specific symbol NaN;
[0011] b) Calculate the feature average: For each feature column containing missing values, ignore the missing values and calculate the average of the remaining non-missing values in the column; the calculation formula is:
[0012]
[0013] Among them, x i represents non-missing data points, and n represents the number of non-missing data points;
[0014] c) Filling in missing values: Replace all missing values in the column with the calculated average value. This step is implemented through loops or vectorized operations. The filled data column will no longer contain missing values, thus ensuring the integrity of the data set.
[0015] d) Check the filling effect: After the filling is completed, it is necessary to traverse the data set again to confirm that all missing values have been correctly filled.
[0016] Furthermore, we can identify outliers by defining a reasonable range of data, and use the mean and standard deviation in statistics to determine a data range. The data range is defined as:
[0017] Data range = [μ-kσ, μ+kσ]
[0018] Among them, μ is the mean of the data and σ is the standard deviation;
[0019] First, the mean and standard deviation of the entire data set are calculated, and a data range is determined based on the set constant, and the constant k is set to 2 or 3; data points in the data set that exceed this range are considered outliers, and outliers are filled with vacant values NaN; this method is based on the assumption of normal distribution, and most data points will fall within k times the standard deviation of the mean. By adjusting the value of k, the sensitivity of outlier detection can be controlled;
[0020] The K-nearest neighbor algorithm KNN is used to fill the outliers identified in the data set. This method uses similar data points in the data set to fill the outliers. After identifying the outliers, the features used to calculate the similarity are selected. These features should be related to the columns where the outliers are located and can effectively represent the structure and distribution of the data. Then, using these selected features, the distance between the outliers and all other non-outliers is calculated. The distance measurement method uses the Euclidean distance for calculation. The calculation formula is:
[0021]
[0022] After calculating the distance, find the K non-outlier neighbors closest to each outlier and replace the outlier with the mean of the K neighbors.
[0023]
[0024] Among them, x new Indicates the value after filling, x i Represents the value of each neighbor among the K neighbors; after completing the filling, the filling effect needs to be verified to ensure that the filled data is reasonable and no new outliers are introduced.
[0025] Furthermore, the data set is normalized to convert data of different scales and units to the same scale range to eliminate the dimensional differences between features. The minimum-maximum normalization subtracts the minimum value in the data set from each data point and then divides it by the range of the data in the data set (maximum value minus minimum value) to scale the data to a specified range [0,1].
[0026]
[0027] Where x is the original data, x′ is the normalized data, min(X) and max(X) are the minimum and maximum values in the data set, respectively.
[0028] Furthermore, in step S2, a long short-term memory network LSTM in a machine learning method is used to solve the problem, and the storage and retrieval of information are regulated by the memory unit and the gating mechanism of the LSTM. The gating mechanism includes an input gate, a forget gate and an output gate. The input gate determines how much input information is stored in the memory unit, the forget gate determines which information in the memory unit is discarded, and the output gate determines how the information in the memory unit affects the current output.
[0029] Furthermore, the training of the LSTM network includes the forward propagation:
[0030] During the forward propagation process, the input vector x is passed to the LSTM unit to calculate the output of each time step. The LSTM unit regulates the flow of information through the input gate, forget gate, and output gate, and calculates the output state of the current time step based on the input data and the state of the previous time step; the formula is as follows:
[0031] f t =σ(W f ·[h t-1 ,x t ]+b f )
[0032] i t =σ(W i ·[h t-1 ,x t ]+b i )
[0033] C' t =tanh(W C ·[h t-1 ,x t ]+b C )
[0034] C t =f t *C t-1 +i t *C′ t
[0035] o t =σ(W o ·[h t-1 ,x t ]+b o )
[0036] h t =o t *tanh(C t )
[0037] Among them, f t It is the forget gate, t is the input gate, is the candidate memory cell state, C t is the memory cell state, o t is the output gate, h t is the output of the current time step, and σ is the activation function.
[0038] Furthermore, the training of the LSTM network involves backpropagation:
[0039] During the back-propagation process, the LSTM network calculates the error between the output value and the actual value, propagates the error back to each LSTM unit, and updates the weights and bias items based on the error; back-propagation calculates the gradient of the error through the chain rule, and uses an optimization algorithm to update the weights and bias items.
[0040] Furthermore, in step S3, after the LSTM models of the various subsystems are established, the individual models are connected to form a complete model network.
[0041] Furthermore, the combined complete model network is globally trained, and after the global training is completed, the model is verified and optimized; the prediction accuracy and generalization ability of the model are evaluated through cross-validation and validation set testing methods; the structure and parameters of the model are adjusted according to the verification results; and each LSTM sub-model is connected into a complete model network to achieve high-precision modeling and dynamic analysis of the gas transmission system and gas quality outside the gas storage.
[0042] The beneficial effects of the present invention are as follows: after adopting the LSTM-based gas quality modeling method for gas storage external transmission of the present invention, the accuracy and real-time performance of quality prediction can be significantly improved. This method can also respond to the operating status of the gas storage external transmission system in real time, and provide timely warnings and adjustment suggestions for managers, thereby avoiding possible quality fluctuations and operational risks. The present invention provides an efficient and accurate tool for gas storage management and operation, which helps to improve the operating efficiency and safety of the entire system. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 This is a process principle diagram of the gas transmission system outside the gas storage reservoir of the present invention;
[0044] Figure 2 Schematic diagram of the long short-term memory network (LSTM) of the present invention;
[0045] Figure 3 This is a schematic diagram of the LSTM training process of the present invention;
[0046] Figure 4 This is a schematic diagram of a complete model network of a gas storage external transmission system of the present invention;
[0047] Figure 5 Forward modeling loss curve graph for the production separator of the present invention;
[0048] Figure 6 This is a diagram of the forward modeling prediction results of the separator produced by the present invention. DETAILED DESCRIPTION
[0049] Example 1
[0050] In order to make the technical means and objectives adopted by the present invention easy to understand, the present invention is further described below in combination with a specific implementation method. A method for modeling a gas storage external gas transmission system based on LSTM includes the following steps:
[0051] (1) Process data;
[0052] (2) Establish an LSTM model for a single system;
[0053] (3) Establish a complete model of the gas transmission system outside the gas storage facility.
[0054] To achieve the above object, the technical solution of the present invention is as follows:
[0055] (1) Data processing: The quality modeling of gas transmission from gas storage facilities relies on high-quality data sets to ensure the accuracy and effectiveness of the model. The various operating data collected from the gas storage facilities’ gas transmission systems often contain noise and outliers, which requires data cleaning and preprocessing to remove invalid data and correct outliers.
[0056] Missing Values
[0057] For the missing data in the data set, it is necessary to fill it, otherwise in the subsequent modeling process, the missing values will affect the accuracy of the final model. The solution is as follows:
[0058] a) Identify missing values: Iterate through the entire dataset to identify where the missing values are located and represent the missing values with a specific symbol (NaN).
[0059] b) Calculate the feature average: For each feature column that contains missing values, ignore the missing values and calculate the average of the remaining non-missing values in the column. This average reflects the central trend of the data in the column and can provide a reasonable filling value. The calculation formula is:
[0060]
[0061] Among them, x i represents the non-missing data points, and n represents the number of non-missing data points.
[0062] c) Fill in missing values: Replace all missing values in the column with the calculated mean value. This step is implemented through loops or vectorized operations. The filled data column will no longer contain missing values, thus ensuring the integrity of the data set.
[0063] d) Check the filling effect: After the filling is completed, it is necessary to traverse the data set again to confirm that all missing values have been correctly filled. At the same time, the statistical properties of the data set before and after filling, such as the mean and variance, can be calculated to ensure that the filling operation has not significantly changed the distribution of the data.
[0064] Outliers
[0065] During the actual operation of the on-site equipment of the gas storage external transmission system, unexpected situations may occur, resulting in abnormal values. These abnormal values may be caused by various reasons, such as equipment failure, sensor error, sudden changes in environmental conditions or operational errors, which cause the real-time collected data to deviate from the normal range. Processing abnormal values is an important step in data preprocessing, because abnormal values may have an adverse effect on subsequent analysis and modeling. Therefore, timely identification and processing of these abnormal values is an important step to ensure the stable operation of the system and improve the accuracy of data analysis. By effectively detecting and processing abnormal values, their impact on system operation can be reduced, and the reliability and safety of the entire gas storage external transmission system can be improved.
[0066] Identifying outliers can be done by defining a reasonable range of data. Using the mean and standard deviation in statistics to determine a data range, the data range can be defined as:
[0067] Data range = [μ-kσ, μ+kσ]
[0068] Among them, μ is the mean of the data and σ is the standard deviation.
[0069] First, the mean and standard deviation of the entire data set are calculated, and a data range is determined based on the set constant. The constant k is generally set to 2 or 3. Data points in the data set that are outside this range are considered outliers, and outliers are filled with vacant values (NaN). This method is based on the assumption of normal distribution, and most data points will fall within k times the standard deviation of the mean. By adjusting the value of k, the sensitivity of outlier detection can be controlled.
[0070] The outliers identified in the data set can be filled using the K-nearest neighbor algorithm (KNN). This method uses similar data points in the data set to fill the outliers. After identifying the outliers, the next step is to select features for calculating similarity. These features should be related to the column where the outliers are located and can effectively represent the structure and distribution of the data. Then, using these selected features, the distance between the outliers and all other non-outliers is calculated. The distance metric method uses the Euclidean distance for calculation, and the calculation formula is:
[0071]
[0072] After calculating the distance, find the K non-outlier neighbors closest to each outlier and replace the outlier with the mean of the K neighbors.
[0073]
[0074] Among them, x new Indicates the value after filling, x iRepresents the value of each neighbor in the K neighbors. After completing the filling, the filling effect needs to be verified to ensure that the filled data is reasonable and no new outliers are introduced. The KNN algorithm can effectively fill in the outliers in the data set, thereby improving the integrity and quality of the data and providing a reliable data foundation for subsequent analysis and modeling.
[0075] Dataset Normalization
[0076] Normalizing the data set is a key data preprocessing step. Its main purpose is to convert data of different scales and units into the same scale range, thereby eliminating dimensional differences between features and improving the accuracy and efficiency of data analysis and modeling.
[0077] Min-max normalization subtracts the minimum value in the data set from each data point and then divides it by the range of the data in the data set (maximum value minus minimum value). This can scale the data to a specified range (usually [0,1]).
[0078]
[0079] Among them, x is the original data, x′ is the normalized data, min(X) and max(X) are the minimum and maximum values in the data set, respectively.
[0080] Through normalization, each feature can have the same influence weight on the distance calculation, thereby improving the accuracy and stability of the model. Normalization can also accelerate the convergence speed of the gradient descent optimization algorithm. When training deep learning models such as neural networks, normalization can avoid the problem of gradient explosion or disappearance caused by large differences in feature values, thereby speeding up the model training process and improving the convergence effect of the model.
[0081] (2) Establishing a LSTM model for a single system: The quality of gas transported from a gas storage facility is affected by a variety of factors, including flow, pressure, temperature, pipeline layout, etc. It is difficult for traditional analytical mathematical models to accurately describe the complex changes in quality, because the properties of gas are affected by a variety of factors and there are nonlinearities and uncertainties. To address this problem, the present invention uses a long short-term memory network (LSTM) in a machine learning method to solve it.
[0082] like Figure 2 As shown in the figure, the basic principle of LSTM is to regulate the storage and retrieval of information through memory cells and gating mechanisms (input gate, forget gate and output gate). The input gate determines how much input information is stored in the memory cell, the forget gate determines which information in the memory cell is discarded, and the output gate determines how the information in the memory cell affects the current output. Through these gating mechanisms, LSTM can effectively retain and transmit key information over a long time span.
[0083] like Figure 3 As shown, the training of LSTM network is divided into two processes: forward propagation and back propagation:
[0084] Forward propagation: During forward propagation, the input vector x is passed to the LSTM unit to calculate the output for each time step. The LSTM unit regulates the flow of information through the input gate, forget gate, and output gate, and calculates the output state of the current time step based on the input data and the state of the previous time step. The formula is as follows:
[0085] f t =σ(W f ·[h t-1 ,x t ]+b f )
[0086] i t =σ(W i ·[h t-1 ,x t ]+b i )
[0087] C' t =tanh(W C ·[h t-1 ,x t ]+b C )
[0088] C t =f t *C t-1 +i t *C′ t
[0089] o t =σ(W o ·[h t-1 ,x t ]+b o )
[0090] h t =o t *tanh(C t )
[0091] Among them, f t It is the forget gate, t is the input gate, is the candidate memory cell state, C t is the memory cell state, o t is the output gate, h t is the output of the current time step, and σ is the activation function.
[0092] Back propagation: During the back propagation process, the LSTM network calculates the error between the output value and the actual value, propagates the error back to each LSTM unit, and updates the weights and bias terms based on the error. Back propagation calculates the gradient of the error through the chain rule and uses an optimization algorithm to update the weights and bias terms.
[0093] This LSTM-based modeling method can more accurately predict the quality changes of gas transported from the gas storage under different operating conditions, thereby achieving precise control of the quality. Compared with traditional methods, the LSTM-based model has stronger adaptability and robustness, and can better cope with complex and changing operating environments. In addition, the model can be continuously updated and optimized, and the prediction performance can be gradually improved as new data is continuously input.
[0094] (3) Establishment of a complete model of the gas transmission system outside the gas storage: After establishing the LSTM models of each subsystem, the individual models can be connected to form a complete model network, such as Figure 4 As shown. During the connection process, the input features of the LSTM models of each subsystem must be aligned to ensure that they use consistent input data at the same time step.
[0095] The combined complete model network is trained globally. The goal of global training is to optimize the parameters of the entire model network so that it can accurately predict the changes in the quality of gas transmitted outside the gas storage under different working conditions. After the global training is completed, the model needs to be verified and optimized. The prediction accuracy and generalization ability of the model are evaluated through methods such as cross-validation and validation set testing. According to the verification results, the structure and parameters of the model are adjusted to further improve its performance.
[0096] Connecting each LSTM sub-model into a complete model network can achieve high-precision modeling and dynamic analysis of the gas transmission system and gas quality outside the gas storage. This complete model network can not only capture the dynamic changes within each subsystem, but also reflect the mutual influence between subsystems, thereby providing a more comprehensive and accurate gas quality prediction.
[0097] Example 2
[0098] Taking the modeling of the production separator as an example, the established LSTM model has two input attributes (inlet pressure, inlet temperature), two output attributes (outlet pressure, outlet temperature), and the hidden layer of the model consists of multiple LSTM units, which can capture the time dependency and nonlinear relationship in the input data. The LSTM model is trained using preprocessed data. Through back propagation and optimization techniques, the weights and bias terms of the model are continuously adjusted to minimize the error between the predicted output and the actual output. During the training process, the performance of the model is evaluated through cross-validation and validation set testing to ensure that it has good prediction capabilities on unseen data. Based on the verification results, the model is optimized to further improve the prediction accuracy and stability of the model.
[0099] according to Figure 5 It can be seen that the loss function curve of the production separator LSTM model decreases rapidly at the beginning of training as the number of training times increases, and then enters a relatively stable decline stage, and finally stabilizes and converges to about 0.003 after multiple iterations. This trend shows that the model is constantly learning the characteristics of the input data and gradually optimizing its internal parameters, thereby improving the prediction accuracy. The smooth convergence of the loss function curve shows that the training process of the model is effective. The LSTM model can find the global optimal solution or a parameter combination close to the optimal solution after multiple iterations, ensuring the accuracy and stability of the prediction results.
[0100] according to Figure 6 It can be seen from the prediction result graph that the overall trend of the prediction results is basically consistent with the actual results. At most time points, the predicted values closely follow the fluctuations of the actual values. This shows that the LSTM model can accurately capture the dynamic changes and nonlinear relationships in the production separator system. Further analysis shows that the prediction error of the model is small, indicating that the model has successfully learned the complex mapping relationship between input attributes (inlet pressure and inlet temperature) and output attributes (outlet pressure and outlet temperature) during the training process. The small error makes the model highly reliable in practical applications, proving its great potential in industrial applications. Through this model, the operating efficiency and stability of the system can be significantly improved, providing reliable prediction support and decision-making basis for the production process.
[0101] Example 3
[0102] A method for modeling a gas storage external transmission system based on LSTM includes the following steps:
[0103] (1) Historical data collection: Collect relevant data of the gas transmission system outside the gas storage reservoir, including temperature, pressure, physical properties, gas quality water content and other operating parameters of the gas transmission system.
[0104] (2) Historical data preprocessing: The collected data is cleaned and normalized to eliminate noise and outliers, and the scale and range of the data are unified to ensure data quality and provide the high-quality data required for modeling.
[0105] (3) Establish a single system LSTM model: Use the long short-term memory network (LSTM) to model the quality of gas transported from the gas storage, effectively adjust information through memory units and gating mechanisms, and accurately capture the nonlinear laws of quality changes. The LSTM model is trained through forward and backward propagation, and uses historical data to optimize predictions to ensure accurate quality control.
[0106] (4) Establishment of a complete model of the gas transmission system outside the gas storage reservoir: The LSTM models of each subsystem are connected into a complete model network to ensure that the input features are aligned before global training and optimization, capture the dynamic changes inside and outside the system, and achieve high-precision prediction and analysis of the quality of gas transmitted outside the gas storage reservoir.
[0107] (5) Model application: The model is applied to actual production. Real-time data is accessed through DCS and then used as the input of the LSTM model to obtain the predicted values of various process parameters of the gas storage external transmission system and the quality of the external gas.
[0108] In view of the existing problems, the present invention utilizes data-driven system comprehensive modeling technology and system optimization solution technology to optimize the set value parameters of the PID control loop of the gas transmission system outside the gas storage reservoir, obtain the optimal control parameter boundary, and adopts APC advanced control technology (including model predictive control MPC, fuzzy control, network neural control, nonlinear control, robust control and other control methods) to perform closed-loop control of model prediction, rolling optimization and feedback correction on the key parameters of the gas storage system that affect the quality index, which is an effective means to effectively optimize and improve the quality index of the gas transmitted outside the gas storage reservoir, eliminate the influence of personal one-sided operating experience, reduce the water content of the gas transmitted outside the gas storage reservoir and improve the intelligent application level of the control layer.
[0109] In view of the existing technical difficulties, we intend to use the historical data obtained from the gas storage external gas transmission system, adopt advanced deep neural network modeling technology, and realize the forward modeling and reverse modeling of each unit of the gas storage external gas transmission system layer by layer, so that the formed deep neural network forward and reverse models can accurately simulate the dynamic characteristics of the gas storage external gas transmission system. Furthermore, with the help of the prediction ability of the deep neural network reverse model, the optimal setting values of each control loop of the gas storage external gas transmission system are calculated. Finally, the deep neural network forward model is used, combined with the obtained optimal setting values, to update and correct the control parameters of the corresponding PID control loop, so as to determine and control the operating boundaries of the key parameters of the gas storage system.
[0110] In order to solve the problems existing in the above-mentioned traditional gas storage external gas quality modeling method, the present invention proposes a gas storage external gas quality modeling method based on long short-term memory network (Long Short-Term Memory, LSTM). LSTM is a special recurrent neural network (Recurrent Neural Network, RNN) that can effectively capture long-range dependencies and nonlinear characteristics in time series data. In the present invention, the key factors affecting the quality of gas transmitted from the gas storage, such as pressure, flow rate, water content, etc., are first determined through expert knowledge and historical data analysis. These factors are selected as the input features of the LSTM model. Then, these input features are used to train the LSTM model. During the model training process, the model gradually learns the dynamic relationship between the input features and the quality of the external gas through the input of historical data. The loss function and optimization algorithm used in the training process ensure that the model can effectively fit the data.
[0111] By capturing and learning the dynamic relationship between factors in historical data, the quality changes of the gas exported from the gas storage under different operating conditions can be accurately predicted, thereby achieving precise control of the quality.
[0112] The present invention has the following characteristics:
[0113] 1) Compared with the traditional gas quality modeling method for gas storage, the present invention has the following differences: 1) A gas quality modeling method for gas storage based on long short-term memory network (LSTM) is proposed, which greatly improves the accuracy and real-time performance of gas quality prediction; 2) By connecting the LSTM models of each subsystem into a complete model network, the dynamic changes within the system and between subsystems are captured, thereby providing a more comprehensive and accurate quality prediction.
[0114] 2) This paper applies the long short-term memory network (LSTM) to the quality modeling of gas transmitted from the gas storage for the first time, and forms a quality model of gas transmitted from the gas storage based on LSTM. This model can not only intuitively reveal the dynamic changes of the quality of gas transmitted from the gas storage under different working conditions, but also achieves high-precision prediction of the quality of gas transmitted from the gas storage with the help of the powerful time series processing and prediction capabilities of LSTM.
[0115] 3) The LSTM-based gas quality modeling method for gas storage external transmission proposed in the present invention has significant practicality and advantages. LSTM can accurately predict the changing trend of external gas quality under different operating conditions by analyzing the complex time series patterns in historical data. Compared with traditional methods, the LSTM model does not require an in-depth prior understanding of the physical mechanism of the system, and only requires a large amount of historical data for effective training. This data-driven feature makes the LSTM model widely applicable in different types of gas storage external transmission systems, and can provide efficient and accurate decision support for system management and operation.
[0116] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical solutions and concepts of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. A gas storage external transmission system modeling method based on LSTM, characterized in that: The steps include: S1. Process data; S2. Establish an LSTM model for a single system; S3. Establish a complete model of the gas transmission system outside the gas storage facility.
2. The LSTM-based gas storage external gas transmission system modeling method according to claim 1, characterized in that: In step S1, the collected data of various operating conditions of the gas transmission system outside the gas storage reservoir contain noise and abnormal values, and data cleaning and preprocessing are performed to remove invalid data and correct abnormal values.
3. The LSTM-based gas storage external gas transmission system modeling method according to claim 2, characterized in that: To fill the missing data in the data set, the solution is as follows: a) Identify missing values: traverse the entire dataset to identify where the missing values are located and represent the missing values with a specific symbol NaN; b) Calculate the feature average: For each feature column containing missing values, ignore the missing values and calculate the average of the remaining non-missing values in the column; the calculation formula is: Among them, x i represents non-missing data points, and n represents the number of non-missing data points; c) Filling in missing values: Replace all missing values in the column with the calculated average value. This step is implemented through loops or vectorized operations. The filled data column will no longer contain missing values, thus ensuring the integrity of the data set. d) Check the filling effect: After the filling is completed, it is necessary to traverse the data set again to confirm that all missing values have been correctly filled.
4. The LSTM-based gas storage external gas transmission system modeling method according to claim 3 is characterized in that: By defining a reasonable range of data to identify outliers, we use the mean and standard deviation in statistics to determine a data range. The data range is defined as: Data range = [μ-kσ, μ+kσ] Among them, μ is the mean of the data and σ is the standard deviation; First, the mean and standard deviation of the entire data set are calculated, and a data range is determined based on the set constant, and the constant k is set to 2 or 3; data points in the data set that exceed this range are considered outliers, and outliers are filled with vacant values NaN; this method is based on the assumption of normal distribution, and most data points will fall within k times the standard deviation of the mean. By adjusting the value of k, the sensitivity of outlier detection can be controlled; The K-nearest neighbor algorithm KNN is used to fill the outliers identified in the data set. This method uses similar data points in the data set to fill the outliers. After identifying the outliers, the features used to calculate the similarity are selected. These features should be related to the columns where the outliers are located and can effectively represent the structure and distribution of the data. Then, using these selected features, the distance between the outliers and all other non-outliers is calculated. The distance measurement method uses the Euclidean distance for calculation. The calculation formula is: After calculating the distance, find the K non-outlier neighbors closest to each outlier and replace the outlier with the mean of the K neighbors. Among them, x new Indicates the value after filling, x i Represents the value of each neighbor among the K neighbors; after completing the filling, the filling effect needs to be verified to ensure that the filled data is reasonable and no new outliers are introduced.
5. The LSTM-based gas storage external gas transmission system modeling method according to claim 4 is characterized in that: Normalize the data set, convert data of different scales and units to the same scale range, eliminate the dimensional differences between features, and min-max normalization subtracts the minimum value in the data set from each data point, and then divides it by the range of the data in the data set, subtracting the minimum value from the maximum value, and scaling the data to a specified range [0,1]. Where x is the original data, x′ is the normalized data, min(X) and max(X) are the minimum and maximum values in the data set, respectively.
6. The LSTM-based gas storage external gas transmission system modeling method according to claim 5, characterized in that: In the step S2, the long short-term memory network LSTM in the machine learning method is used to solve the problem. The storage and retrieval of information are regulated by the memory unit and the gating mechanism of the LSTM. The gating mechanism includes an input gate, a forget gate and an output gate. The input gate determines how much input information is stored in the memory unit, the forget gate determines which information in the memory unit is discarded, and the output gate determines how the information in the memory unit affects the current output.
7. The LSTM-based gas storage external gas transmission system modeling method according to claim 6, characterized in that: The training of LSTM network consists of forward propagation: During the forward propagation process, the input vector x is passed to the LSTM unit to calculate the output of each time step. The LSTM unit regulates the flow of information through the input gate, forget gate, and output gate, and calculates the output state of the current time step based on the input data and the state of the previous time step; the formula is as follows: f t =σ(W f ·[h t-1 ,x t ]+b f ) i t =σ(W i ·[h t-1 ,x t ]+b i ) C' t =tanh(W C ·[h t-1 ,x t ]+b C ) C t =f t *C t-1 +i t *C′ t the t =σ(W o ·[h t-1 ,x t ]+b o ) h t =o t *tanh(C t ) Among them, f t It is the forget gate, t is the input gate, is the candidate memory cell state, C t is the memory cell state, o t is the output gate, h t is the output of the current time step, and σ is the activation function.
8. The LSTM-based gas storage external gas transmission system modeling method according to claim 7, characterized in that: The training of LSTM network consists of back-propagation: During the back-propagation process, the LSTM network calculates the error between the output value and the actual value, propagates the error back to each LSTM unit, and updates the weights and bias items based on the error; back-propagation calculates the gradient of the error through the chain rule, and uses an optimization algorithm to update the weights and bias items.
9. The LSTM-based gas storage external gas transmission system modeling method according to claim 8, characterized in that: In step S3, after the LSTM models of the various subsystems are established, the individual models are connected to form a complete model network.
10. The LSTM-based gas storage external gas transmission system modeling method according to claim 9, characterized in that: The combined complete model network is trained globally. After the global training is completed, the model is verified and optimized. The prediction accuracy and generalization ability of the model are evaluated through cross-validation and validation set testing. The structure and parameters of the model are adjusted according to the verification results. The various LSTM sub-models are connected into a complete model network to achieve high-precision modeling and dynamic analysis of the gas transmission system and gas quality outside the gas storage.
Citation Information
Patent Citations
A method for geological risk early warning and gas injection-production scheme optimization for gas storage operation based on time series model
CN116307706B
Comprehensive evaluation method for peak shaving schemes of gas pipe network and gas storage
CN107169633A
A short-term load forecasting method based on multi-model fusion neural network
CN109255505A
Power supply equipment load and life prediction model construction method
CN114091724A
Structure-based neural net model establishing and optimizing method
CN1349198A