Meteorological-wind power joint prediction method based on Swin-Transformer framework
By integrating meteorological and wind power data through the improved Swin-Transformer framework and utilizing local window self-attention and shift window operations, the problem of inconsistency between meteorological and wind power data fusion is solved, and high-precision wind power prediction is achieved.
Patent Information
- Application Number
- CN202411535676.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2044-10-31
AI Technical Summary
Existing short-term wind power forecasting methods ignore a lot of useful information when interpolating meteorological forecast data to wind farms, resulting in low forecast accuracy. Furthermore, traditional deep learning models have limitations in handling complex spatiotemporal dependencies.
An improved Swin-Transformer framework is adopted, which integrates meteorological and wind power data by combining temporal and spatial location encoding with convolution. Multi-scale modeling is achieved through local window self-attention and shift window operations, thereby improving data fusion and prediction accuracy.
It effectively solves the problem of inconsistency between meteorological grid data and wind power time series data modes, improves the accuracy of wind power prediction, makes full use of redundant information in meteorological data, and enhances the accuracy of prediction.
Smart Images

Figure CN119476586B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application relates to the field of wind power short-term prediction, in particular to a meteorological-wind power combined prediction method based on a Swin-Transformer framework. BACKGROUND
[0002] Wind power short-term prediction refers to predicting 96-point power output values from 00:00 to 23:45 of the next day at a fixed time point (usually 8-12 am) of the day. The power output of a wind farm is strongly affected by meteorological conditions, and changes in meteorological factors such as wind speed, temperature and humidity directly determine the volatility and uncertainty of wind power. Therefore, meteorological forecast data is needed as input to predict the power of a wind farm. Meteorological forecast data is usually in grid form, and for convenience, existing short-term power prediction methods usually interpolate the grid form meteorological forecast data to the wind farm station. However, this approach ignores a large amount of useful information, thereby affecting the accuracy of power prediction.
[0003] In recent years, with the rapid development of deep learning technology, new energy prediction technology based on deep learning has made significant progress. For example, convolutional neural networks (CNN), long short-term memory networks (LSTM) and other models have been widely used in time series prediction tasks. However, these models have certain limitations in capturing complex spatio-temporal dependencies.
[0004] Swin-Transformer, as a new deep learning model, was originally used in the field of computer vision. Its local self-attention structure based on sliding window mechanism can more effectively process high-resolution data and capture local and global information. Compared with traditional convolutional neural networks, Swin-Transformer has better performance in processing complex data structures, and is particularly suitable for meteorological and wind power data with strong spatio-temporal dependencies. SUMMARY
[0005] The purpose of the present application is to provide a meteorological-wind power combined prediction method based on a Swin-Transformer framework, which improves the Swin-Transformer model in the field of machine vision according to the characteristics of meteorological grid data and wind power time series data, effectively integrates meteorological and wind power data of different modalities, and thus effectively improves the accuracy of wind power short-term prediction.
[0006] To achieve the above purpose, the application provides a meteorological-wind power combined prediction method based on a Swin-Transformer framework, comprising the following steps:
[0007] obtaining historical wind power time series data and future meteorological grid forecast data;
[0008] The obtained historical wind power time series data and future meteorological grid forecast data are time-position coded, space-position coded and convolved to output meteorological prediction arrays and initial features of historical power respectively, and the two groups of initial features are merged and padded in the last dimension to form a new feature data;
[0009] The new feature data is input into a meteorological-new energy prediction model to output fusion features, and the fusion features are convolved again with an MLP layer to obtain the final prediction results.
[0010] Preferably, the specific formula of the space position coding is as follows:
[0011]
[0012] In the formula, p x,2j represents the elements of the even column, p y,2j represents the elements of the even row, the array is two-dimensional, (n, 2), n represents the number of wind farms, 2 represents the longitude and latitude coordinates, so x represents the longitude, y represents the latitude, d represents the dimension of the feature, and 2j represents the even column and 2j+1 represents the odd column.
[0013] Preferably, the time position coding is as follows:
[0014]
[0015] In the formula, i represents time, p i,2j represents the elements of the even column, p i,2j+1 represents the elements of the odd column.
[0016] Preferably, the meteorological-new energy prediction model is based on an improved Swin-Transformer, which realizes multi-scale modeling of features by stacking multiple layers of models, each layer including local window self-attention, shift window operation and fully connected layer.
[0017] Preferably, the shift window operation connects information in different windows
[0018]
[0019] In the formula, S is the number of pixels shifted, X ω represents the original feature, represents the feature after shifting.
[0020] The meteorological-wind power combined prediction system based on the Swin-Transformer framework comprises
[0021] The data acquisition module is used to acquire historical wind power time series data and future meteorological grid forecast data;
[0022] The data processing module is used for time position coding, space position coding and convolution of the obtained historical wind power time series data and future meteorological grid prediction data, and outputs meteorological prediction arrays and initial features of historical power respectively, and the two groups of initial features are merged and filled in the last dimension to form a new feature data;
[0023] The prediction module is used for inputting the new feature data into a meteorological-new energy prediction model, outputting fusion features, and obtaining a final prediction result by convolution and an MLP layer again.
[0024] An electronic device comprises a memory and a processor, the memory stores a computer program, and the processor calls the computer program in the memory to realize the steps of the meteorological-wind power joint prediction method based on the Swin-Transformer framework.
[0025] A storage medium stores computer executable instructions, and the computer executable instructions are loaded and executed by a processor to realize the steps of the meteorological-wind power joint prediction method based on the Swin-Transformer framework.
[0026] Therefore, the meteorological-wind power joint prediction method based on the Swin-Transformer framework has the following technical effects:
[0027] (1) The problem that the meteorological grid data and the wind power time series data modal are inconsistent and difficult to effectively fuse and be understood by a machine learning model is solved;
[0028] (2) The problem that the meteorological grid data has high redundancy, and the traditional machine learning model is difficult to effectively utilize and improve the prediction accuracy is solved. BRIEF DESCRIPTION OF DRAWINGS
[0029] Figure 1 The flowchart of the meteorological-wind power joint prediction method based on the Swin-Transformer framework is shown in the figure.
[0030] Figure 2 The model framework of the Swin-Transformer is improved, wherein Figure 2 (a) is a meteorological-new energy prediction model based on the transformer framework; Figure 2 (b) is a transformer module based on the attention mechanism. DETAILED DESCRIPTION
[0031] The technical solutions of the present application are further described below by means of the accompanying drawings and examples.
[0032] Unless otherwise defined, technical terms or scientific terms used in the present application shall have the ordinary meaning as understood by a person having ordinary skill in the art to which the present application pertains.
[0033] Embodiment one
[0034] As shown in Figure 1 The present application proposes a meteorological-wind power short-term prediction method based on the Swin-Transformer framework, which includes the following steps:
[0035] Step one, obtaining historical wind power time series data and future meteorological grid forecast data
[0036] The dimension of the wind power time series data is 1x96, 96 representing 1 day of 15-minute time intervals, a total of 96 points; the dimension of the future meteorological grid forecast data is 48x64x25, 48 representing 48 hours of hourly, 64 representing an 8x8 grid around the wind farm station, and 25 representing meteorological elements, respectively from the high-resolution prediction model of ECMWF (European Centre for Medium-Range Weather Forecasts) (meteorological elements include 200-meter wind speed, 200-meter wind u component, 200-meter wind v component, 100-meter wind u component, 100-meter wind v component, 10-meter wind u component, 10-meter wind v component, 2-meter temperature, and terrain), the Panggu meteorological large model of Huawei (meteorological elements 10-meter wind u component, 10-meter wind v component, 2-meter temperature, 1000-hundred-pa wind u component, 1000-hundred-pa wind v component, 1000-hundred-pa temperature, 1000-hundred-pa absolute humidity, 1000-hundred-pa potential), and the wind-uw meteorological large model of Shanghai Artificial Intelligence Laboratory (meteorological elements are the same as the Panggu model).
[0037] Step two, time and position encoding, spatial position encoding, and convolution are performed on the obtained historical wind power time series data and future meteorological grid forecast data, respectively, to output meteorological forecast arrays and initial features of historical power, and the two groups of initial features are merged and padded in the last dimension to form a new feature data
[0038] The meteorological and power data need to be added with spatiotemporal positional encoding. For the spatial positional encoding of meteorological data, first, the relative position of the wind farm station coordinates and the 8x8 meteorological grid point coordinates is calculated, that is, the wind farm station longitude and latitude-meteorological grid point longitude and latitude, forming a (64, 2) dimensional array, second, the coordinates are encoded by a trigonometric function, forming a (1, 64, 25) dimensional spatial positional encoding, and then directly added to the (48, 64, 25) dimensional meteorological forecast data (the number of elements in different dimensions is expanded by a broadcast mechanism). The specific formula of the spatial positional encoding is as follows:
[0039]
[0040] In the formula, p x,2j represents the elements of the even column, p y,2j represents the elements of the even row, the array is two-dimensional, (n, 2), n represents the number of wind farms, 2 represents the longitude and latitude coordinates, so x represents the longitude, y represents the latitude, d represents the dimension of the feature, 2j represents the even column, and 2j+1 represents the odd column. Both the meteorological data and the power data need to be added with temporal positional encoding. The temporal positional encoding of the meteorological data is as follows:
[0041]
[0042] In the formula, i represents time, taking values [25, 72] with a step size of 1, d takes a value of 25, forming a (48, 1, 25) dimensional array which is directly added to the meteorological prediction data, p i,2j represents the elements of the even column, p i,2j+1 represents the elements of the odd column. The temporal positional encoding of the power data is also based on formulas (3) and (4), where i takes values [0, 24] with a step size of 0.25, d takes a value of 1, forming a (96, 1) dimensional array which is directly added to the historical power data.
[0043] The meteorological prediction data is passed through a convolution layer (Conv2d layer, Kernal=2, Stride=4) to output a (24, 16, C) dimensional array; the historical power data is passed through a convolution layer (Conv1d layer, Kernal=4, Stride=4) to output a (24, C) dimensional array. The two arrays are merged in the last dimension to form a (24, 17, C) dimensional array, and then filled in the second dimension to finally form a (24, 18, C) dimensional array.
[0044] Step three, input the new feature data into the meteorological-new energy prediction model, output the fused features, and then convolve the fused features with an MLP layer to obtain the final prediction result
[0045] The above array input is input into the improved Swin-transformer model, the model layer is 4, the depth is 2, 6, 6, 2 respectively, and the specific model framework is as shown in Figure 2 The Transformer module is composed of a multi-head self-attention mechanism (MSA) module and a nonlinear MLP module, and layer normalization (LN) is applied before each MSA module and each MLP, and a residual connection is applied after each module. Among them, the local window self-attention mechanism is the core of Swin-Transformer. First, the input data X is divided into fixed-size local windows, and each window contains a part of the feature map. Assuming that the size of the feature map is HxWxC, where H and W represent the height and width of the feature map respectively, and C represents the number of channels. Within each MxM size window, the model calculates self-attention to learn the relationship between the features within the window. The window division is to divide the feature map X into multiple local windows X ω of size MxM. In this way, the features within each window can be processed separately. The feature matrix within the window is calculated by the following formula to obtain the query (Query), key (Key) and value (Value) vectors:
[0046] Q=X ω W Q (5);
[0047] K=X ω W K (6);
[0048] V=X ω W V (7);
[0049] In the formula, W Q ,W K ,W V are learned weight matrices, Q, K and V represent query, key and value vectors respectively. The attention mechanism is to calculate self-attention using the query, key and value vectors, and the attention output within the window is obtained by the following formula:
[0050]
[0051] In the formula, d k is the dimension of the key vector, the softmax function is used to calculate the weight, and the attention result is obtained by weighted average. The shift window operation is another important feature of Swin-Transformer. In order to realize the information interaction between windows, the feature windows of each layer are shifted before self-attention calculation. This shift operation can be used to connect the information in different windows, thereby enhancing the global context modeling ability of the model:
[0052]
[0053] where S is the number of shifted pixels, X ω denotes the original feature, denotes the shifted feature. By shifting the window between different layers, the model can effectively combine the information between windows and further improve the accuracy of prediction. In terms of feature fusion, Swin-Transformer realizes multi-scale modeling of features by stacking multiple layers of models. Each layer includes local window self-attention, shifted window operation and fully connected layer. The final feature is processed by an MLP to generate the final prediction output:
[0054] X out = MLP (LayerNorm (X in + Attention (X in )) ) (10).
[0055] Finally, after passing through the Swin-transformer model, an array of dimensions (24, 18, 2C) is output, and then a convolutional layer (Conv2d layer, Kernal = 1, Stride = 1) and an MLP layer are used to finally obtain a power prediction result with a length of 192.
[0056] The meteorological-wind power joint prediction system based on the Swin-Transformer framework comprises
[0057] The data acquisition module is configured to acquire historical wind power time series data and future meteorological grid forecast data.
[0058] The data processing module is configured to perform spatio-temporal position coding convolution on the acquired historical wind power time series data and future meteorological grid forecast data, and output meteorological forecast arrays and initial features of historical power, respectively.
[0059] The prediction module is configured to input the new feature data into a meteorological-new energy prediction model, output fused features, and then perform convolution and an MLP layer on the fused features to obtain a final prediction result.
[0060] Since the embodiments of the device part correspond to the embodiments of the method part, the embodiments of the device part are described in the description of the embodiments of the method part, and will not be described here.
[0061] The application further provides a storage medium having a computer program stored thereon, the computer program being executable to implement the steps provided by the above-mentioned embodiments. The storage medium can include a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media capable of storing program codes.
[0062] The application further provides an electronic device, which can include a memory having a computer program stored therein and a processor, the processor being capable of invoking the computer program in the memory to implement the steps provided by the above-mentioned embodiments. Of course, the electronic device can further include various network interfaces, power supplies and other components.
[0063] Therefore, the application adopts the above-mentioned meteorological-wind power joint prediction method based on the Swin-Transformer framework, can fully mine meteorological grid data, and fuse it with wind power time series data in a high-dimensional space, so as to better capture the spatio-temporal relationship between meteorology and wind power, and realize high-precision prediction of wind power.
[0064] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application rather than limit them, although the present application has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that: it can still modify or equivalently replace the technical solutions of the present application, and these modifications or equivalent replacements cannot make the modified technical solutions deviate from the spirit and scope of the technical solutions of the present application.
Claims
1. A meteorological-wind power joint prediction method based on a Swin-Transformer framework, characterized in that, The method comprises the following steps: obtaining historical wind power time series data and future meteorological grid forecast data; encoding the obtained historical wind power time series data in time position, encoding the future meteorological grid forecast data in time position and space position, respectively convolving the encoded historical wind power time series data and future meteorological grid forecast data, respectively outputting a meteorological forecast array and initial features of historical power, and merging and padding the two groups of initial features in the second dimension to form a new feature data; The specific formula of the space position encoding is as follows: (1); (2); wherein represents elements of even columns, represents elements of even rows, the array is two-dimensional, (n, 2), n represents the number of wind farms, 2 represents the longitude and latitude coordinates, so x represents the longitude, y represents the latitude, and d represents the dimension of the feature, represents even columns, represents odd columns; inputting the new feature data into a meteorological-new energy prediction model, outputting fusion features, and again convolving the fusion features and an MLP layer to obtain a final prediction result; The meteorological-new energy prediction model is based on an improved Swin-Transformer and realizes multi-scale modeling of features by stacking multiple layers of models, each layer including local window self-attention, shift window operation and a fully connected layer; The shift window operation connects information in different windows (5); In the formula, is the number of pixels shifted, denotes the original feature, denotes the shifted feature.
2. The method according to claim 1, wherein, The time position encoding is as follows: (3); (4); where i represents time, represents an even-numbered element, represents an odd-numbered element.
3. A meteorological-wind power combined prediction system based on a Swin-Transformer framework, characterized in that it is used to execute the meteorological-wind power combined prediction method based on the Swin-Transformer framework of claim 1, comprising The data acquisition module is used to obtain historical wind power time series data and future meteorological grid forecast data; The data processing module is used to encode the obtained historical wind power time series data in time position, encode the future meteorological grid forecast data in time position and space position, respectively convolve the encoded historical wind power time series data and future meteorological grid forecast data, respectively output a meteorological forecast array and initial features of historical power, and merge and pad the two groups of initial features in the last dimension to form a new feature data; The prediction module is used to input the new feature data into a meteorological-new energy prediction model, output fusion features, and again convolve the fusion features and an MLP layer to obtain a final prediction result.
4. An electronic device, comprising: The memory and the processor, the memory stores a computer program, the processor calls the computer program in the memory to realize the steps of the meteorological-wind power combined prediction method based on the Swin-Transformer framework of any one of claims 1 to 3.
5. A storage medium, characterized by The storage medium stores computer executable instructions, and the computer executable instructions are loaded and executed by the processor to realize the steps of the meteorological-wind power combined prediction method based on the Swin-Transformer framework of any one of claims 1 to 3.
Citation Information
Patent Citations
Picture classification method based on improved SwinTransform
CN117132825A
Intra-day wind power prediction method based on high-frequency update numerical weather forecast
CN118074097A