Gas load prediction method, device and equipment based on space frequency attention mechanism and storage medium

Through the LSTM model based on the air frequency attention mechanism, the airspace and frequency domain characteristics of the gas load data are extracted, and the problem of insufficient random prediction capabilities for short-term gas loads in the prior art is solved, thereby achieving higher prediction accuracy and reliability of gas supply plans.

CN120146235APending Publication Date: 2025-06-13PETROCHINA CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311698764.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-12
Publication Date
2025-06-13

AI Technical Summary

Technical Problem

The existing gas load prediction methods lack the ability to predict randomness of early and evening peaks of short-term gas loads.

Method used

The LSTM model based on the air frequency attention mechanism is adopted to extract the characteristics of gas load data through the air and frequency domain attention mechanism, and combine the one-dimensional Fourier transform to remove the complex coupling relationship between load-influence factors.

Benefits of technology

The accuracy of gas load prediction has been improved, especially during peak hours in the morning and evening, which has significantly improved the ability of gas supply companies to make gas supply plans in advance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120146235A_ABST
    Figure CN120146235A_ABST
Patent Text Reader

Abstract

The invention discloses a gas load prediction method, device and equipment based on a space-frequency attention mechanism, and a storage medium, and the method comprises the steps: starting from a space-frequency domain, combining the morning and evening peak phenomena of a gas load, employing the feature extraction capability of an LSTM model, and employing the attention mechanism of the space domain and one-dimensional Fourier transform, thereby achieving the prediction of the gas load. Spatial domain feature extraction and frequency domain feature extraction are carried out on multiple factors such as collected gas load air temperature and climate types, complex coupling relations existing among all load influence factors are removed, and the precision of gas load prediction is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of gas load prediction, and particularly relates to a gas load prediction method based on spatio-frequency attention mechanism. Background Art

[0002] With the advent of the low-carbon era, the consumption of natural gas is increasing day by day. At this time, "ensuring supply" and "safety" are the problems faced by gas companies. Safe and stable gas supply can ensure the normal life of residents and the normal production of industrial users. For gas production and operation companies, insufficient upstream gas supply or sudden increase in downstream demand will break the gas supply-demand balance. For gas supply companies, in the face of the dual challenges of diversified gas demand, fragmented demand time and supply safety, improving the gas load prediction ability can effectively solve these challenges. If the gas load at a certain place in the future can be accurately predicted, the gas supply enterprise can make a gas supply plan in advance, ensure the safety of user supply, and meet the gas demand for industrial and civil production and life.

[0003] The load of urban gas pipeline networks has similar characteristics to the electric load, both being affected by the consumption behavior of end - consumer entities. However, natural gas has storability and can be stored in gas pipelines. The load flow of its pipeline network shows more obvious non - linear and random characteristics. Moreover, there is an obvious time periodicity in residential gas use, generally showing morning and evening peak phenomena. In the short term, the change in the load volume is significantly affected by temperature. When the temperature is low, the gas consumption is large; when the temperature is high, the gas consumption is small. These characteristics make the gas load have typical characteristics of time non - stationarity, non - linearity, and high randomness. The gas load is a time series with non - stationary and non - linear properties, which poses an important challenge to gas load prediction. Currently, the commonly used prediction methods are: (1) Traditional time - series data modeling methods. Such as AR model, MA model, ARMA model, ARIMA model, etc.; these statistical models can better depict the change trend of medium - and long - term gas load, but are not sensitive enough to random changes, and their prediction performance is relatively limited. This type of method is usually applicable to time series with trends and no seasonal components. Since the gas load has a seasonal trend, with large loads in winter and small loads in summer, the accuracy of such methods is not high. (2) Traditional machine - learning models. Such as support vector regression (SVR), radial basis function neural network (RBF), BP neural network, etc. This type of method requires constructing the time problem as a supervised learning problem, that is, a regression problem. This requires using the lagged observations of the sequence as input features and discarding the time relationship in the data. This type of method can not only perform single - variable time - series prediction but also multi - variable time - series prediction. However, in order to ensure model fitting and evaluation and retain the time structure in the data, a large amount of feature engineering is required. In short, the ARIMA model can only extract linear features from the data, and it is difficult to characterize non - linear features. SVR still has problems such as kernel function selection, difficult parameter tuning with too many parameters, and extraction of shallow features. Deep neural networks have more layers and more complex structures, and can transform the shallow information in the data into more abstract high - level feature information. Summary of the Invention

[0004] Aiming at the deficiencies of the existing technology, the present invention provides a gas load prediction method based on spatio - frequency attention mechanism, which solves the problem of insufficient prediction ability of the existing gas load methods for the randomness of morning and evening peaks of short - term gas load. Starting from the spatio - frequency domain and combining the morning and evening peak phenomena of gas load, the present invention uses the powerful feature extraction ability of deep learning, and uses the attention mechanism in the spatial domain and one - dimensional Fourier transform to extract spatial - domain features and frequency - domain features from numerous factors such as gas load temperature and climate type collected, and removes the complex coupling relationship existing between various load influencing factors. The gas load model based on spatio - frequency domain attention mechanism includes a spatially - attention module, a frequency - attention module, a convolutional module, and a fully - connected layer connected in sequence, which improves the accuracy of gas load prediction.

[0005] In view of the above deficiencies in the prior art, the present invention provides a gas load prediction method based on spatio-frequency attention mechanism, which solves the problem of insufficient prediction ability of the existing gas load method for the randomness of morning and evening peaks of short-term gas load. To achieve the above object, the present invention provides the following technical solutions:

[0006] A gas load prediction method based on spatio-frequency attention mechanism includes the following steps:

[0007] S1. Collect gas load data;

[0008] S2. Construct an LSTM model based on spatio-frequency attention mechanism;

[0009] S3. Use the LSTM model based on spatio-frequency attention mechanism to extract features from gas load data and complete gas load prediction.

[0010] The beneficial effects of the present invention are as follows: Starting from the spatio-frequency domain, combining with the morning and evening peak phenomena of gas load, using the feature extraction ability of the LSTM model, and using the attention mechanism in the spatial domain and one-dimensional Fourier transform, spatial domain feature extraction and frequency domain feature extraction are carried out on many factors such as gas load temperature and climate type collected, and the complex coupling relationship between various load influencing factors is removed. The gas load model based on spatio-frequency domain attention mechanism includes a spatial attention module, a frequency attention module, a convolution module and a fully connected layer connected in sequence, which improves the accuracy of gas load prediction.

[0011] Further, the LSTM model based on spatio-frequency attention mechanism in step S2 includes an input layer, a spatio-frequency domain attention layer, an LSTM layer and an output layer;

[0012] The input layer is used to input gas load data;

[0013] The spatio-frequency domain attention layer is used to extract spatial attention features and frequency domain attention features of gas load data, and obtain an adaptive weighted fusion feature according to the spatial attention feature and the frequency domain attention feature;

[0014] The LSTM layer is used to perform time series prediction according to the adaptive weighted fusion feature to obtain a prediction result;

[0015] The output layer is used to output the prediction result.

[0016] The beneficial effects of the above further solution are as follows: It can improve the accuracy of the prediction model and the prediction effect during morning and evening peaks.

[0017] Further, the method for extracting the spatial attention feature of the gas load data includes the following steps:

[0018] A1. Compress the gas load characteristics in the channel dimension to obtain a one-dimensional channel feature map;

[0019] A2. Perform a non-linear transformation on the gas load characteristics to obtain gas load transformation characteristics;

[0020] A3. Perform matrix multiplication on the gas load transformation characteristics and the gas load feature map to obtain a gas load feature representation;

[0021] A4. Use softmax to encode the gas load feature representation to obtain an attention probability distribution of the gas load features;

[0022] A5. Fuse the one-dimensional channel feature map and the attention probability distribution of the gas load features through matrix multiplication to obtain a spatial attention feature.

[0023] The beneficial effect of the above further solution is: focusing on the essential features of the gas load in the gas load input.

[0024] Further, the method for extracting the frequency-domain attention features of the gas load data includes the following steps:

[0025] B1. Perform a short-time Fourier transform on the gas load characteristics to obtain a frequency-domain feature map;

[0026] B2. Perform autocorrelation on the columns of the frequency-domain feature map to obtain an autocorrelation feature map;

[0027] B3. Sum each column of the autocorrelation feature map and perform softmax normalization to obtain a one-dimensional data attention probability;

[0028] B4. Perform global average pooling on the rows of the frequency-domain feature map to obtain one-dimensional data;

[0029] B5. Fuse the one-dimensional data attention probability and the one-dimensional data through matrix multiplication to obtain a frequency-domain attention feature.

[0030] The beneficial effect of the above further solution is: modeling the time-frequency domain features of the load distribution and extracting the correlation features between time and load.

[0031] Further, the method for obtaining the adaptively weighted fusion feature includes the following steps:

[0032] C1. Calculate the weights of the spatial attention feature and the weights of the frequency-domain attention feature respectively;

[0033] C2. According to the weights of the spatial attention feature and the weights of the frequency-domain attention feature, perform weighted summation on the spatial attention feature and the frequency-domain attention feature to obtain the spatial feature after attention and the frequency-domain feature after attention;

[0034] C3. Concatenate the spatially-attentioned features and the frequency-domain-attentioned features to obtain self-adaptive weighted fusion features.

[0035] The beneficial effects of the above further solution are as follows: The features of the samples are adaptively fused in the spatial domain and the frequency domain, improving the accuracy of gas load prediction.

[0036] The present invention also relates to a gas load prediction device based on a spatio-frequency attention mechanism, including a data acquisition module for acquiring gas load data; a model construction module for constructing an LSTM model based on a spatio-frequency attention mechanism; a data feature extraction module for extracting features from the gas load data according to the constructed LSTM model; and a prediction module for making predictions based on the features of the extracted gas load data.

[0037] Further, the model construction module includes an input module, a spatial attention module, a frequency attention module, a convolutional module, and a fully-connected layer connected in sequence; the input module is used to input gas load data; the spatial attention module and the frequency attention module are used to extract the spatial attention features and the frequency-domain attention features of the gas load data, and obtain self-adaptive weighted fusion features according to the spatial attention features and the frequency-domain attention features; the convolutional module is used to perform time series prediction on the obtained self-adaptive weighted fusion features to obtain the prediction result of the LSTM model; and the fully-connected layer is used to generate a prediction output.

[0038] The present invention also relates to a device, which includes: a data acquisition device, a processor, and a memory; the data acquisition device is used to acquire data; the memory is used to store one or more program instructions; and the processor is used to execute one or more program instructions to perform the above gas load prediction method based on a spatio-frequency attention mechanism.

[0039] The present invention also relates to a computer-readable storage medium, which contains one or more program instructions, and the one or more program instructions are used to perform the above gas load prediction method based on a spatio-frequency attention mechanism.

[0040] In summary, due to the adoption of the above technical solutions, compared with the prior art, the present invention has at least the following beneficial effects:

[0041] 1. Accurate prediction of gas load;

[0042] 2. It is beneficial for gas supply enterprises to make gas supply plans in advance, ensure the safety of user supply, and guide the formulation of gas supply guarantee plans. Description of the Drawings:

[0043] Figure 1This is the flowchart of the method of the present invention. Specific embodiments

[0044] The present invention will be further described in detail below in conjunction with embodiments and specific embodiments. However, this should not be construed as limiting the scope of the above-mentioned subject matter of the present invention to the following embodiments. Any technology implemented based on the content of the present invention belongs to the scope of the present invention.

[0045] In the description of the present invention, it should be understood that the orientation or positional relationships indicated by the terms "longitudinal", "lateral", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc. are based on the orientation or positional relationships shown in the drawings. They are only for the convenience of describing the present invention 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 thus should not be construed as limiting the present invention.

[0046] As Figure 1 shown, in an embodiment of the present invention, a gas load prediction method based on a spatio-frequency attention mechanism includes the following steps:

[0047] S1. Collect gas load data; including gas load temperature and climate type;

[0048] S2. Construct an LSTM model based on a spatio-frequency attention mechanism;

[0049] S3. Use the LSTM model based on the spatio-frequency attention mechanism to extract features from the gas load data and complete the gas load prediction.

[0050] The LSTM model based on the spatio-frequency attention mechanism in step S2 includes an input layer, a spatio-frequency domain attention layer, an LSTM layer, and an output layer;

[0051] The input layer is used to input gas load data;

[0052] The spatio-frequency domain attention layer is used to extract the spatial attention features and frequency domain attention features of the gas load data, and obtain an adaptive weighted fusion feature according to the spatial attention features and frequency domain attention features;

[0053] The LSTM layer is used to perform time series prediction according to the adaptive weighted fusion feature to obtain a prediction result;

[0054] The output layer is used to output the prediction result.

[0055] The method for extracting the spatial attention features of the gas load data includes the following steps:

[0056] A1. Compress the gas load characteristics in the channel dimension to obtain a one-dimensional channel feature map;

[0057] A2. Perform a non-linear transformation on the gas load characteristics to obtain gas load transformation characteristics;

[0058] A3. Perform matrix multiplication on the gas load transformation characteristics and the gas load feature map to obtain a gas load feature representation;

[0059] A4. Use softmax to encode the gas load feature representation to obtain an attention probability distribution of the gas load characteristics;

[0060] A5. Fuse the one-dimensional channel feature map and the attention probability distribution of the gas load characteristics through matrix multiplication to obtain a spatial attention feature.

[0061] The method for extracting the frequency-domain attention feature of the gas load data includes the following steps:

[0062] B1. Perform a short-time Fourier transform on the gas load characteristics to obtain a frequency-domain feature map;

[0063] B2. Perform autocorrelation on the columns of the frequency-domain feature map to obtain an autocorrelation feature map;

[0064] B3. Sum the columns of the autocorrelation feature map and perform softmax normalization to obtain a one-dimensional data attention probability;

[0065] B4. Perform global average pooling on the rows of the frequency-domain feature map to obtain a one-dimensional data;

[0066] B5. Fuse the one-dimensional data attention probability and the one-dimensional data through matrix multiplication to obtain a frequency-domain attention feature.

[0067] The method for obtaining the adaptively weighted fusion feature includes the following steps:

[0068] C1. Calculate the weights of the spatial attention feature and the frequency-domain attention feature respectively;

[0069] C2. According to the weights of the spatial attention feature and the frequency-domain attention feature, perform weighted summation on the spatial attention feature and the frequency-domain attention feature to obtain the spatial feature after attention and the frequency-domain feature after attention;

[0070] C3. Concatenate the spatial feature after attention and the frequency-domain feature after attention to obtain an adaptively weighted fusion feature.

[0071] The present invention also relates to a gas load prediction device based on a spatio-frequency attention mechanism, including a data acquisition module for acquiring gas load data; a model construction module for constructing an LSTM model based on the spatio-frequency attention mechanism; a data feature extraction module for extracting features of the gas load data according to the constructed LSTM model; and a prediction module for making predictions based on the features of the extracted gas load data.

[0072] Further, the model construction module includes an input module, a spatial attention module, a frequency attention module, a convolution module, and a fully connected layer connected in sequence; the input module is used to input gas load data; the spatial attention module and the frequency attention module are used to extract the spatial attention features and frequency domain attention features of the gas load data, and obtain an adaptive weighted fusion feature according to the spatial attention features and frequency domain attention features; the convolution module is used to perform time series prediction on the obtained adaptive weighted fusion feature to obtain the prediction result of the LSTM model; and the fully connected layer is used to generate a prediction output.

[0073] The present invention also relates to a device, which includes: a data acquisition device, a processor, and a memory; the data acquisition device is used to acquire data; the memory is used to store one or more program instructions; and the processor is used to execute one or more program instructions to perform the above-mentioned gas load prediction method based on the spatio-frequency attention mechanism.

[0074] The present invention also relates to a computer-readable storage medium, which contains one or more program instructions, and the one or more program instructions are used to perform the above-mentioned gas load prediction method based on the spatio-frequency attention mechanism.

[0075] Those of ordinary skill in the art can understand that the above embodiments are specific embodiments for implementing the present invention, and in practical applications, various changes can be made in form and details without departing from the spirit and scope of the present invention.

Claims

1. A gas load prediction method based on spatio - frequency attention mechanism, characterized in that, it includes the following steps: S1. Collect gas load data; S2. Construct an LSTM model based on spatio - frequency attention mechanism; S3. Use the LSTM model based on spatio - frequency attention mechanism to extract features from gas load data and complete gas load prediction.

2. The prediction method according to claim 1, characterized in that, the data in step S1 includes gas load temperature and climate type.

3. The prediction method according to claim 1, characterized in that, the LSTM model based on spatio - frequency attention mechanism in step S2 includes an input layer, a spatio - frequency domain attention layer, an LSTM layer and an output layer; the input layer is used to input gas load data; the spatio - frequency domain attention layer is used to extract the spatial attention feature and frequency domain attention feature of gas load data, and obtain an adaptive weighted fusion feature according to the spatial attention feature and frequency domain attention feature; the LSTM layer is used to perform time - series prediction according to the adaptive weighted fusion feature to obtain a prediction result; the output layer is used to output the prediction result.

4. The prediction method according to claim 3, characterized in that, the method for extracting the spatial attention feature of gas load data includes the following steps: A1. Compress the gas load feature in the channel dimension to obtain a one - dimensional channel feature map; A2. Perform a non - linear transformation on the gas load feature to obtain a gas load transformation feature; A3. Perform matrix multiplication on the gas load transformation feature and the gas load feature map to obtain a gas load feature expression; A4. Use softmax to encode the gas load feature expression to obtain the attention probability distribution of the gas load feature; A5. Fuse the one - dimensional channel feature map and the attention probability distribution of the gas load feature through matrix multiplication to obtain the spatial attention feature.

5. The prediction method according to claim 3, characterized in that, the method for extracting the frequency domain attention feature of gas load data includes the following steps: B1. Perform short - time Fourier transform on the gas load feature to obtain a frequency domain feature map; B2. Perform autocorrelation on the columns of the frequency domain feature map to obtain an autocorrelation feature map; B3. Sum each column of the autocorrelation feature map and perform softmax normalization to obtain a one - dimensional data attention probability; B4. Perform global average pooling on the rows of the frequency domain feature map to obtain a one - dimensional data; B5. Fuse the one - dimensional data attention probability and the one - dimensional data through matrix multiplication to obtain the frequency domain attention feature.

6. The prediction method according to claim 3, characterized in that, the method for obtaining the adaptive weighted fusion feature includes the following steps: C1. Calculate the weight of the spatial attention feature and the weight of the frequency domain attention feature respectively; C2. According to the weight of the spatial attention feature and the weight of the frequency domain attention feature, perform weighted summation on the spatial attention feature and the frequency domain attention feature to obtain the spatial feature after attention and the frequency domain feature after attention; C3. Concatenate the spatially attended features and the frequency-domain attended features to obtain the self-adaptive weighted fusion features.

7. A gas load prediction device based on a spatio-frequency attention mechanism, characterized in that it includes a data acquisition module for acquiring gas load data; a model construction module for constructing an LSTM model based on a spatio-frequency attention mechanism; a data feature extraction module for extracting features from the gas load data according to the constructed LSTM model; a prediction module for making predictions based on the features of the extracted gas load data.

8. A prediction device according to claim 7, characterized in that the model construction module includes an input module, a spatial attention module, a frequency attention module, a convolutional module, and a fully connected layer connected in sequence; the input module is used to input gas load data; the spatial attention module and the frequency attention module are used to extract the spatial attention features and the frequency-domain attention features of the gas load data, and obtain the self-adaptive weighted fusion features according to the spatial attention features and the frequency-domain attention features; the convolutional module is used to perform time series prediction on the obtained self-adaptive weighted fusion features to obtain the prediction result of the LSTM model; the fully connected layer is used to generate the prediction output.

9. A device, characterized in that the device includes: a data acquisition device, a processor, and a memory; the data acquisition device is used to acquire data; the memory is used to store one or more program instructions; the processor is used to execute one or more program instructions to perform the prediction method according to any one of claims 1-6.

10. A computer-readable storage medium, characterized in that the computer storage medium contains one or more program instructions, and the one or more program instructions are used to perform the method according to any one of claims 1-6.