Offshore wind power short-term output prediction method and system based on Swinin-CNN-LSTM
By using the Swin-CNN-LSTM model, the adaptability and accuracy issues of offshore wind power output prediction in complex marine environments were addressed, achieving high-precision short-term output prediction and improving the power generation efficiency and reliability of wind farms.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGXI POWER GRID CORP
- Filing Date
- 2025-12-11
- Publication Date
- 2026-04-24
AI Technical Summary
Existing offshore wind power output prediction methods are not adaptable enough to complex marine environments, exhibiting randomness, intermittency, and volatility, resulting in insufficient prediction accuracy and making it difficult to meet the demand for high-efficiency power generation.
The Swin-CNN-LSTM model is used to achieve feature extraction and prediction of multi-source heterogeneous data from offshore wind farms through data preprocessing, local feature extraction, spatiotemporal correlation feature construction, and long short-term memory network fusion.
It improves the prediction accuracy of offshore wind power output, enhances feature extraction and spatiotemporal correlation analysis capabilities, captures long-term time series dependencies, and improves the reliability and accuracy of prediction.
Smart Images

Figure CN121920587A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of new energy power generation and planning technology in power systems, and in particular to a method and system for predicting short-term offshore wind power output based on Swin-CNN-LSTM. Background Technology
[0002] With the depletion of traditional energy resources and the intensification of the greenhouse effect, under the dual pressure of energy crisis and global ecological degradation, wind energy, as a pollution-free and sustainably developed renewable energy source, has shown great development potential. As the global offshore wind power installed capacity continues to expand, the limitations of the current power generation assessment methods are becoming increasingly apparent: (1) Existing offshore wind energy assessment methods tend to be oversimplified and are not adaptable to complex marine environmental conditions, resulting in significant constraints on practical applications; (2) Offshore wind power output exhibits more significant randomness, intermittency, and volatility compared to traditional thermal power; (3) The harsh marine operating environment and the difficulty of operation and maintenance significantly affect the unit's operating efficiency, thereby reducing the accuracy of wind power forecasting and resulting in insufficient reliability of short-term output forecasting.
[0003] As early as 2013, the Technical University of Denmark and the Riso Lab jointly developed the Zephyr prediction system, which reduced prediction errors through the collaborative optimization of adaptive regression statistical models and physical models. In recent years, breakthroughs in artificial intelligence technology have significantly improved prediction accuracy. Deep learning-based prediction methods have made important progress and are increasingly exploring the integration of CNN feature extraction with various algorithms to further enhance prediction accuracy and efficiency. Furthermore, attempts are being made to integrate and optimize different types of neural networks and prioritize the processing of key information by adding self-attention mechanisms. However, there is still considerable room for improvement in the accuracy of current AI-based predictions of offshore wind power output.
[0004] Therefore, a method and system for predicting short-term offshore wind power output based on Swin-CNN-LSTM is needed. Summary of the Invention
[0005] To address the problems in existing technologies, this invention provides a method and system for predicting short-term offshore wind power output based on Swin-CNN-LSTM, the specific technical solution of which is as follows: A method for predicting short-term offshore wind power output based on Swin-CNN-LSTM includes the following steps: Step S1, data preprocessing, standardizes the multi-source heterogeneous data of offshore wind farms, including wind speed, ocean surface current velocity, and ocean surface temperature. Step S2: Establish a CNN neural network model to capture and extract local features of wind speed, ocean surface current velocity, and ocean surface temperature, thereby achieving local spatial feature extraction; Step S3: Construct the Swin Transformer module and use the self-attention mechanism to build the spatiotemporal correlation features of the ocean scene within a local window; Step S4: Construct an LSTM neural network and fuse the spatiotemporal correlation features obtained from the Swing Transformer module to obtain the predicted power output of offshore wind power for the next 24 hours.
[0006] Preferably, the standardization process for multi-source heterogeneous data from offshore wind farms in step S1 specifically includes the following steps: The wind speed, ocean surface current velocity, and ocean surface temperature are normalized, and the specific calculation formulas are shown below: ; In the formula: x The raw data are for wind speed, ocean surface current velocity, and ocean surface temperature. x’ It is normalized data; x max This represents the maximum values of the raw data corresponding to wind speed, ocean surface current velocity, and ocean surface temperature. x min This represents the minimum value of the raw data corresponding to wind speed, ocean surface current velocity, and ocean surface temperature.
[0007] Preferably, in step S2, a CNN neural network model is established to capture and extract local features of wind speed, ocean surface current velocity, and ocean surface temperature, achieving local spatial feature extraction as follows: (1) Establish a CNN neural network model, including an input layer, a convolutional layer, a pooling layer, a fully connected layer and an output layer, wherein the input data of the input layer are standardized wind speed, ocean surface current velocity and ocean surface temperature; (2) Perform convolution operations in the convolutional layer to extract the depth features of the data. The calculation formula is shown below.
[0008] ; In the formula: Indicates the first l The data on wind speed, ocean surface current velocity, and ocean surface temperature at -1 level. i There are 1 feature map, where ⊗ represents the convolution operation. The feature set represents the wind speed, ocean surface current velocity, and ocean surface temperature data of the input layer. Indicates the first l The data on wind speed, ocean surface current velocity, and ocean surface temperature at -1 level. i The first feature map and the second l The first layer of wind speed, ocean surface current velocity, and ocean surface temperature data j Weights between feature maps Indicates the first l The data on wind speed, ocean surface current velocity, and ocean surface temperature at -1 level. i The first feature map and the second l The first layer of wind speed, ocean surface current velocity, and ocean surface temperature data j Bias between feature maps Indicates the first l The first layer of wind speed, ocean surface current velocity, and ocean surface temperature data j Each feature map f (•) indicates the activation function used; (3) Pooling calculations are performed in the pooling layer. The calculation formula for the pooling layer is as follows: ; In the formula: Indicates the first l The data on wind speed, ocean surface current velocity, and ocean surface temperature at -1 level. i Each feature map Indicates the first l The first layer of wind speed, ocean surface current velocity, and ocean surface temperature data j The weight coefficients of each feature map. down (•) represents the pooling function. Indicates the first l The first layer of wind speed, ocean surface current velocity, and ocean surface temperature data j Each feature map; This represents the bias term corresponding to the j-th feature map of the l-th pooling layer; (4) Use a fully connected layer to summarize all input feature information. Each neuron in the layer is fully connected to the neurons in the upper layer. The calculation formula for the fully connected layer is as follows: ; In the formula: For the first l The first layer j One neuron; This represents the i-th neuron in the (l-1)-th layer.
[0009] Preferably, the tanh function and the ReLU function are selected as activation functions in the CNN neural network model. The calculation formulas for the two functions are shown below: ; In the formula: x This represents the data obtained after processing the actual inputs of wind speed, ocean surface current velocity, and ocean surface temperature using a layered structure, tanh( x ) and ReLU x) represents the output after processing by the activation function.
[0010] Preferably, step S3, which constructs the Swin Transformer module and utilizes a self-attention mechanism to build the spatiotemporal correlation features of the ocean scene within a local window, specifically includes the following steps: (1) During the forward propagation process, all features of each input sample after feature extraction using the CNN neural network model are normalized. The specific formula is as follows: ; ; ; In the formula: x represents the feature input vector after feature extraction by the CNN neural network model and input to the Swing Transformer module. i Let σ represent the value of the i-th element in the input vector, μ represent the average value of the input vector x, D represent the length of the input vector, and σ represent the average value of the input vector x. 2 ϵ represents the variance of the input vector, ϵ represents a minimum value to prevent the denominator from being 0, γ represents the weight parameter of the scientific system, β represents the bias parameter of the scientific system, and x' represents the data after layer normalization. The output features of the self-attention mechanism are obtained by utilizing the self-attention mechanism, specifically using multi-head window self-attention, as shown in the following formula: 1) First, divide the feature map into M*M non-overlapping windows, each containing k=M*M feature vectors, and then recombine the vectors: ; In the formula: H represents the height of the input feature data, W represents the width of the input feature data, d represents the number of channels of the input feature data, M represents the window size, and Xwindows represents the feature vector after partitioning and recombination; 2) Perform single-head computation, linearly projecting the feature vectors (Xwindows) within each window to generate the query matrix, key matrix, and value matrix: ; ; ; ; ; In the formula: Q, K, and V represent the query matrix, key matrix, and value matrix, respectively, and W Q W K W V This represents the weight matrix corresponding to the query matrix, key matrix, and value matrix, where h represents the number of heads; The dimension representing each attention head; 3) Introduce a learnable relative position bias matrix B, where the structure of B is as follows: ; 4) Calculate the relative position index. For two positions i and j within the window, their absolute coordinates are represented as (x, j) and (j) respectively. i ,y i ) and (x j ,y j ), calculate the relative coordinate difference between position i and position j: ; ; In the formula: Δx and Δy represent the relative coordinate differences between the horizontal and vertical coordinates, respectively; 5) Mapping the two-dimensional coordinates to a one-dimensional index, the process of retrieving each value from B is as follows: ; In the formula: Bi,j represents the bias term for the attention weight calculation, and [·] represents the indexing operation on the bias matrix B; 6) Calculate the attention weights, using the formula shown below: ; In the formula: Attention(Q,K,V) represents the attention weight matrix, and the definition of the Softmax(·) function is as follows: ; In the formula: z i This represents the i-th element of the input vector z; Then, the outputs of h heads are concatenated into a multi-head output and linearly projected to obtain the windowed output result; (2) After another layer normalization process, the result of the layer normalization is input into the multilayer perceptron to obtain the output result of the multilayer perceptron.
[0011] Preferably, the structure of the multilayer perceptron includes two fully connected layers and one activation function layer; the specific calculation process of the multilayer perceptron is as follows: 1) The input vector is processed through a fully connected layer, and the calculation formula is as follows: ; In the formula: W1 represents the weight matrix, X represents the input vector data, b1 represents the bias vector, and X1 represents the output result.
[0012] 2) Input the output of the fully connected layer into the activation function layer and process it using the GELU activation function. The calculation formula is shown below: ; In the formula: GELU(·) represents the GELU activation function, Φ(·) represents the cumulative distribution function of the standard Gaussian distribution, and X2 represents the output result after the activation layer; 3) The result output from the activation layer is multiplied by 2 and then processed through a fully connected layer. The calculation formula is shown below: ; In the formula: W2 represents the weight matrix, b2 represents the bias vector, and X3 represents the output of the multilayer perceptron.
[0013] Preferably, the step S4 of constructing an LSTM neural network and fusing the spatiotemporal correlation features obtained from the Swing Transformer module to obtain the predicted power output of offshore wind power for the next 24 hours specifically includes the following steps: (1) Construct an LSTM model, which includes three gate structures: forget gate, input gate, and output gate. The input data is first filtered by the forget gate to select the information to be retained and the information to be forgotten. The calculation formula is shown below.
[0014] ; In the formula: f t This is the final output of the Forgotten Gate. As weight, As a bias term, the input to the forget gate is the output of the hidden layer of the previous unit and the feature maps of wind speed, ocean surface current velocity, and ocean surface temperature data extracted by the CNN neural network model at the current time step. (2) Integrate the Swing Transformer module into the path between the input gate and the output gate to realize the fusion of the Swing Transformer module and the LSTM neural network to form a new network structure; update the cell state through the input gate, update the information using the activation function, obtain the two parts of data, and combine the two parts of data to complete the update of the entire cell state; the calculation process is shown below.
[0015] ; ; In the formula: i t This is the computational structure for the input gate. This represents the weight matrix of the input gate; This represents the bias vector of the input gate; A weight matrix representing the state of candidate cells; A bias vector representing the state of a candidate cell; STB represents the output obtained after updating the features of preceding wind speed, ocean surface current velocity, and ocean surface temperature data; Then, combining the output from the previous time step with the forget gate content, the network structure is updated. The calculation process is shown below: ; In the formula: C t This is the output of the cell at the current time. f t Output for the forget gate. C t-1 This is the output of the cell from the previous time step. i t Indicates the input of the input gate; (3) The final output state is determined by the output gate. The output gate outputs by multiplying the matrix formed by connecting the control unit state of the previous time step with the input of the current time step and the weights. C t The output is calculated using tanh to obtain the final output, and the calculation process is shown below.
[0016] ; ; In the formula: O t For the output of the output gate, h t The final output is the result of comprehensive processing of the input wind speed, ocean surface current velocity, and ocean surface temperature, yielding the predicted offshore wind power output for the corresponding region. This is the weight matrix of the output gate; This is the bias vector for the output gate.
[0017] A prediction system for short-term offshore wind power output based on Swin-CNN-LSTM, employing the method described herein, includes: The data processing module is used for data preprocessing, which standardizes the multi-source heterogeneous data of offshore wind farms, including wind speed, ocean surface current velocity, and ocean surface temperature. The feature extraction module is used to build a CNN neural network model to capture and extract local features of wind speed, ocean surface current velocity, and ocean surface temperature, thereby achieving local spatial feature extraction. The feature association module is used to build the Swing Transformer module, which uses a self-attention mechanism to construct spatiotemporal associated features of the ocean scene within a local window; The power output prediction module is used to construct an LSTM neural network and fuse the spatiotemporal correlation features obtained from the Swing Transformer module to obtain the predicted power output of offshore wind power for the next 24 hours.
[0018] A computer-readable storage medium includes a stored program, wherein, when the program is executed, it controls the device where the computer-readable storage medium is located to execute the aforementioned method for predicting short-term offshore wind power output based on Swin-CNN-LSTM.
[0019] A processor for running a program, wherein the program executes the aforementioned method for predicting short-term offshore wind power output based on Swin-CNN-LSTM.
[0020] Compared with the prior art, the beneficial effects of the present invention are as follows: This invention has powerful feature extraction capabilities, spatiotemporal correlation analysis capabilities, and long-term time series dependency capture capabilities, which greatly improves the prediction accuracy of offshore wind power output. Attached Figure Description
[0021] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the accompanying drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. In all the drawings, similar elements or parts are generally identified by similar reference numerals. In the drawings, the elements or parts are not necessarily drawn to scale.
[0022] Figure 1 This is a flowchart of the method of the present invention.
[0023] Figure 2 This is a structural diagram of the Swing Transformer module.
[0024] Figure 3 This is a diagram of an LSTM neural network structure that incorporates the Swing Transformer module.
[0025] Figure 4 This is a comparison chart of the final prediction results. Detailed Implementation
[0026] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0027] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.
[0028] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0029] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0030] Example 1: like Figure 1 As shown, this embodiment provides a method for predicting short-term offshore wind power output based on Swin-CNN-LSTM, including the following steps: Step S1, data preprocessing, standardizes the multi-source heterogeneous data of offshore wind farms, which includes wind speed, ocean surface current velocity, and ocean surface temperature.
[0031] The standardization process for multi-source heterogeneous data from offshore wind farms includes the following steps: Wind speed, ocean surface current velocity, and ocean surface temperature are normalized. Since there are dimensional differences between the original inputs and wind power output, extreme value normalization is used to scale the original data. The specific calculation formula is shown below: ; In the formula: x The raw data are for wind speed, ocean surface current velocity, and ocean surface temperature. x’ It is normalized data; x max This represents the maximum values of the raw data corresponding to wind speed, ocean surface current velocity, and ocean surface temperature. x min This represents the minimum value of the raw data corresponding to wind speed, ocean surface current velocity, and ocean surface temperature.
[0032] Step S2: Establish a CNN neural network model to capture and extract local features of wind speed, ocean surface current velocity, and ocean surface temperature, thereby achieving local spatial feature extraction.
[0033] Convolutional Neural Networks (CNNs) are used to extract local patterns and spatial dependencies from the input data. Convolutional operations effectively capture local features of data such as wind speed, ocean surface current velocity, and ocean surface temperature. After initial data processing, the data is fed into subsequent Swin Transformer modules and LSTM neural network structures to obtain the final prediction results. A CNN neural network model is established to capture and extract local features of wind speed, ocean surface current velocity, and ocean surface temperature, achieving local spatial feature extraction as follows: (1) Establish a CNN neural network model, including an input layer, a convolutional layer, a pooling layer, a fully connected layer and an output layer, wherein the input data of the input layer are standardized wind speed, ocean surface current velocity and ocean surface temperature; (2) Perform convolution operations in the convolutional layer to extract the depth features of the data. The calculation formula is shown below.
[0034] ; In the formula: Indicates the first l The data on wind speed, ocean surface current velocity, and ocean surface temperature at -1 level. i There are 1 feature map, where ⊗ represents the convolution operation. The feature set represents the wind speed, ocean surface current velocity, and ocean surface temperature data of the input layer. Indicates the first l The data on wind speed, ocean surface current velocity, and ocean surface temperature at -1 level. i The first feature map and the second l The first layer of wind speed, ocean surface current velocity, and ocean surface temperature data j Weights between feature maps Indicates the first l The data on wind speed, ocean surface current velocity, and ocean surface temperature at -1 level. i The first feature map and the second l The first layer of wind speed, ocean surface current velocity, and ocean surface temperature data j Bias between feature maps Indicates the first l The first layer of wind speed, ocean surface current velocity, and ocean surface temperature data j Each feature map f (•) indicates the activation function used; (3) Pooling calculations are then performed using pooling layers to reduce the dimensionality of the feature data, thereby reducing the number of network parameters, decreasing computational load, and improving computational efficiency. This enables secondary extraction of data features such as wind speed, ocean surface current velocity, and ocean surface temperature, and reduces overfitting. The pooling calculations are performed in the pooling layers, and the calculation formula for the pooling layers is shown below: ; In the formula: Indicates the first l The data on wind speed, ocean surface current velocity, and ocean surface temperature at -1 level. i Each feature map Indicates the first l The first layer of wind speed, ocean surface current velocity, and ocean surface temperature data j The weight coefficients of each feature map. down (•) represents the pooling function. Indicates the first l The first layer of wind speed, ocean surface current velocity, and ocean surface temperature data j Each feature map; This represents the bias term corresponding to the j-th feature map of the l-th pooling layer; (4) After processing by convolutional and pooling layers, a fully connected layer is used to comprehensively summarize all input feature information. Each neuron in the fully connected layer is fully connected to the neurons in the upper layer to facilitate subsequent feature classification, prediction, and other operations. The calculation formula for the fully connected layer is shown below: ; In the formula: For the first l The first layer j One neuron; This represents the i-th neuron in the (l-1)-th layer.
[0035] In the CNN neural network model, the tanh and ReLU functions are chosen as activation functions. The calculation formulas for each function are shown below: ; In the formula: x This represents the data obtained after processing the actual inputs of wind speed, ocean surface current velocity, and ocean surface temperature using a layered structure, tanh( x ) and ReLU x ) represents the output after processing by the activation function.
[0036] Step S3: Construct the Swing Transformer module and use the self-attention mechanism to build the spatiotemporal correlation features of the marine scene within a local window, thereby further improving the prediction robustness in complex marine environments.
[0037] The construction of the Swin Transformer module, utilizing the self-attention mechanism, to build spatiotemporal correlation features of the ocean scene within a local window specifically includes the following steps: (1) During the forward propagation process, all features of each input sample after feature extraction using the CNN neural network model are normalized (Layer Normalization, LN) to maintain the independence between samples. The specific formula is as follows: ; ; ; In the formula: x represents the feature input vector after feature extraction by the CNN neural network model and input to the Swing Transformer module. i Let σ represent the value of the i-th element in the input vector, μ represent the average value of the input vector x, D represent the length of the input vector, and σ represent the average value of the input vector x. 2 ϵ represents the variance of the input vector, ϵ represents a minimum value to prevent the denominator from being 0, γ represents the weight parameter of the scientific system, β represents the bias parameter of the scientific system, and x' represents the data after layer normalization. By utilizing a special self-attention mechanism, the output features of the self-attention mechanism are obtained. Specifically, multi-head self-attention with a window is employed, and the specific formula is shown below: 1) First, divide the feature map into M*M non-overlapping windows, each containing k=M*M feature vectors, and then recombine the vectors: ; In the formula: H represents the height of the input feature data, W represents the width of the input feature data, d represents the number of channels of the input feature data, M represents the window size, and Xwindows represents the feature vector after partitioning and recombination; 2) Perform single-head computation, linearly projecting the feature vectors of each window onto the Xwindows matrix to generate the query matrix, key matrix, and value matrix: ; ; ; ; ; In the formula: Q, K, and V represent the query matrix, key matrix, and value matrix, respectively, and W Q W K W V This represents the weight matrix corresponding to the query matrix, key matrix, and value matrix, where h represents the number of heads; This represents the dimension of each attention head; to ensure the feasibility of the model, the number of channels d should be an integer multiple of the number of heads h; 3) Introduce a learnable relative position bias matrix B, where the structure of B is as follows: ; 4) Calculate the relative position index. For two positions i and j within the window, their absolute coordinates are represented as (x, j) and (j) respectively. i ,y i ) and (x j ,y j ), calculate the relative coordinate difference between position i and position j: ; ; In the formula: Δx and Δy represent the relative coordinate differences between the horizontal and vertical coordinates, respectively; 5) Mapping the two-dimensional coordinates to a one-dimensional index, the process of retrieving each value from B is as follows: ; In the formula: B i,j [·] represents the bias term used in the attention weight calculation, and [·] represents the indexing operation on the bias matrix B; 6) Calculate the attention weights, using the formula shown below: ; In the formula: Attention(Q,K,V) represents the attention weight matrix, and the definition of the Softmax(·) function is as follows: ; In the formula: z i This represents the i-th element of the input vector z; Then, the outputs of h heads are concatenated into a multi-head output and obtained by linear projection to obtain the windowed output result.
[0038] For Shift Window Multi-Head Self-Attention (SW-MSA), a window shifting process is added, moving the window to the lower right corner by ⌊M / 2⌋ pixels, so that windows of adjacent layers cover different areas, realizing cross-window information interaction. The rest of the process is the same as W-MSA.
[0039] (2) After another layer normalization process, the result of the layer normalization is input into the multilayer perceptron (MLP) to obtain the output result of the multilayer perceptron.
[0040] The structure of a multilayer perceptron consists of two fully connected layers and one activation function layer; the specific computation process of a multilayer perceptron is shown below: 1) The input vector is processed through a fully connected layer, and the calculation formula is as follows: ; In the formula: W1 represents the weight matrix, X represents the input vector data, b1 represents the bias vector, and X1 represents the output result.
[0041] 2) Input the output of the fully connected layer into the activation function layer and process it using the GELU activation function. The calculation formula is shown below: ; In the formula: GELU(·) represents the GELU activation function, Φ(·) represents the cumulative distribution function of the standard Gaussian distribution, and X2 represents the output result after the activation layer; 3) The result of the activation layer is multiplied by 2 and then processed through a fully connected layer. The calculation formula is shown below: ; In the formula: W2 represents the weight matrix, b2 represents the bias vector, and X3 represents the output of the multilayer perceptron.
[0042] See the overall structure diagram of the Swin Transformer module. Figure 2 As shown, Z l Z refers to the feature data of the l-th layer. ^l Then, for the intermediate feature data after the attention mechanism, that is, the features between layers.
[0043] Step S4: Construct an LSTM neural network and fuse the spatiotemporal correlation features obtained from the Swing Transformer module to obtain the predicted power output of offshore wind power for the next 24 hours.
[0044] The specific steps involved in constructing an LSTM neural network and fusing the spatiotemporal correlation features obtained from the Swing Transformer module to obtain the predicted power output of offshore wind power for the next 24 hours are as follows: We construct a Long Short-Term Memory (LSTM) network to capture long-term dependencies in time series data. The input of the LSTM is the feature output of the CN (Conceptual Network), and the LSTM is used for further data processing. The LSTM involves multiple steps of computation and transmission, using a three-gate structure—forget gate, input gate, and output gate—to filter and memorize information, thereby achieving long-term memory capabilities.
[0045] (1) Construct an LSTM model, which includes three gate structures: forget gate, input gate, and output gate. The input data is first filtered by the forget gate to select the information to be retained and the information to be forgotten. The calculation formula is shown below.
[0046] ; In the formula: f t This is the final output of the Forgotten Gate. As weight, As a bias term, the input to the forget gate is the output of the previous hidden layer and the feature maps of wind speed, ocean surface current velocity, and ocean surface temperature data extracted by the CNN neural network model at the current time step; its calculation result determines the bias term in the network structure. C t-1 The retention ratio refers to how much information the neuron's output from the previous time step needs to retain.
[0047] (2) Integrate the Swing Transformer module into the path between the input gate and the output gate to realize the fusion of the Swing Transformer module and the LSTM neural network to form a new network structure; update the cell state through the input gate, update the information using the activation function, obtain the two parts of data, and combine the two parts of data to complete the update of the entire cell state; the calculation process is shown below.
[0048] ; ; In the formula: i t This is the computational structure for the input gate. This represents the weight matrix of the input gate; This represents the bias vector of the input gate; A weight matrix representing the state of candidate cells; A bias vector representing the state of a candidate cell; STB represents the output obtained after updating the features of preceding wind speed, ocean surface current velocity, and ocean surface temperature data; Then, combining the output from the previous time step with the forget gate content, the network structure is updated. The calculation process is shown below: ; In the formula: C t This is the output of the cell at the current time. f t Output for the forget gate. C t-1 This is the output of the cell from the previous time step. i t Indicates the input of the input gate; (3) The final output state is determined by the output gate. The output gate outputs by multiplying the matrix formed by connecting the control unit state of the previous time step with the input of the current time step and the weights. C t The output is calculated using tanh to obtain the final output, and the calculation process is shown below.
[0049] ; ; In the formula: O t For the output of the output gate, h t The final output is the result of comprehensive processing of the input wind speed, ocean surface current velocity, and ocean surface temperature, yielding the predicted offshore wind power output for the corresponding region. This is the weight matrix of the output gate; This is the bias vector for the output gate.
[0050] The LSTM neural network architecture diagram after incorporating the Swing Transformer module is shown below. Figure 3 As shown.
[0051] Evaluation metrics were selected. To accurately assess the accuracy of the mixed model, two metrics, Mean Absolute Percentage Error (MAPE) and Root Mean Square Error (RMSE), were chosen to evaluate the results. The formulas for calculating the two metrics are as follows: ; ; In the formula: N To predict the number of samples, y i This represents the actual wind power output. y’ i This represents the predicted wind power output.
[0052] Meanwhile, to verify the effectiveness and superiority of the model, separate CNN and LSTM neural networks were constructed and their prediction results were compared with those of the Swin-CNN-LSTM neural network. Specific results are shown in the figure below. Figure 4 As shown.
[0053] Figure 4 The comparison results of the three models at 96 prediction points are presented. Quantitative evaluation shows that the MAPE of the Swin-CNN-LSTM model is 5.12%; the MAPE of the LSTM model is 11.86%; and the MAPE of the CNN model is 13.95%, with an RMSE of 38.6MW. Compared with a single model, the method of this invention improves the prediction accuracy by more than 55%. Qualitatively, it can be clearly seen from the figure that the model in this embodiment has the highest degree of fit to the actual values and the smallest error.
[0054] This invention has powerful feature extraction capabilities, spatiotemporal correlation analysis capabilities, and long-term time series dependency capture capabilities, which greatly improves the prediction accuracy of offshore wind power output.
[0055] Example 2: Based on the same inventive concept as Embodiment 1, this embodiment provides a prediction system for short-term offshore wind power output based on Swin-CNN-LSTM, and the method described includes: The data processing module is used for data preprocessing, which standardizes the multi-source heterogeneous data of offshore wind farms, including wind speed, ocean surface current velocity, and ocean surface temperature. The feature extraction module is used to build a CNN neural network model to capture and extract local features of wind speed, ocean surface current velocity, and ocean surface temperature, thereby achieving local spatial feature extraction. The feature association module is used to build the Swing Transformer module, which uses a self-attention mechanism to construct spatiotemporal associated features of the ocean scene within a local window; The power output prediction module is used to construct an LSTM neural network and fuse the spatiotemporal correlation features obtained from the Swing Transformer module to obtain the predicted power output of offshore wind power for the next 24 hours.
[0056] Example 3: Based on the same inventive concept as Embodiment 1, this embodiment provides a computer-readable storage medium, which includes a stored program, wherein, when the program is executed, it controls the device where the computer-readable storage medium is located to execute the aforementioned method for predicting short-term offshore wind power output based on Swin-CNN-LSTM.
[0057] Example 4: Based on the same inventive concept as Embodiment 1, this embodiment provides a processor for running a program, wherein the program executes the aforementioned method for predicting short-term offshore wind power output based on Swin-CNN-LSTM.
[0058] Those skilled in the art will recognize that the modules of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components of the examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of the invention.
[0059] In the embodiments provided by this invention, it should be understood that the division of modules is only a logical functional division. In actual implementation, there may be other division methods, such as multiple modules can be combined into one module, one module can be split into multiple modules, or some features can be ignored.
[0060] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.
[0061] If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0062] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention, and they should all be covered within the scope of the claims and specification of the present invention.
Claims
1. A method for predicting short-term offshore wind power output based on Swin-CNN-LSTM, characterized in that, Includes the following steps: Step S1, data preprocessing, standardizes the multi-source heterogeneous data of offshore wind farms, including wind speed, ocean surface current velocity, and ocean surface temperature. Step S2: Establish a CNN neural network model to capture and extract local features of wind speed, ocean surface current velocity, and ocean surface temperature, thereby achieving local spatial feature extraction; Step S3: Construct the Swin Transformer module and use the self-attention mechanism to build the spatiotemporal correlation features of the ocean scene within a local window; Step S4: Construct an LSTM neural network and fuse the spatiotemporal correlation features obtained from the Swing Transformer module to obtain the predicted power output of offshore wind power for the next 24 hours.
2. The method for predicting short-term offshore wind power output based on Swing-CNN-LSTM according to claim 1, characterized in that, The standardization process for multi-source heterogeneous data from offshore wind farms in step S1 specifically includes the following steps: The wind speed, ocean surface current velocity, and ocean surface temperature are normalized, and the specific calculation formulas are shown below: ; In the formula: x The raw data are for wind speed, ocean surface current velocity, and ocean surface temperature. x’ It is normalized data; x max This represents the maximum values of the raw data corresponding to wind speed, ocean surface current velocity, and ocean surface temperature. x min This represents the minimum value of the raw data corresponding to wind speed, ocean surface current velocity, and ocean surface temperature.
3. The method for predicting short-term offshore wind power output based on Swin-CNN-LSTM according to claim 1, characterized in that, In step S2, a CNN neural network model is established to capture and extract local features of wind speed, ocean surface current velocity, and ocean surface temperature. The specific details of local spatial feature extraction are as follows: (1) Establish a CNN neural network model, including an input layer, a convolutional layer, a pooling layer, a fully connected layer and an output layer, wherein the input data of the input layer are standardized wind speed, ocean surface current velocity and ocean surface temperature; (2) Perform convolution operations in the convolutional layer to extract the depth features of the data. The calculation formula is shown below. ; In the formula: Indicates the first l The data on wind speed, ocean surface current velocity, and ocean surface temperature at -1 level. i There are 1 feature map, where ⊗ represents the convolution operation. The feature set represents the wind speed, ocean surface current velocity, and ocean surface temperature data of the input layer. Indicates the first l The data on wind speed, ocean surface current velocity, and ocean surface temperature at -1 level. i The first feature map and the second l The first layer of wind speed, ocean surface current velocity, and ocean surface temperature data j Weights between feature maps Indicates the first l The data on wind speed, ocean surface current velocity, and ocean surface temperature at -1 level. i The first feature map and the second l The first layer of wind speed, ocean surface current velocity, and ocean surface temperature data j Bias between feature maps Indicates the first l The first layer of wind speed, ocean surface current velocity, and ocean surface temperature data j Each feature map f (•) indicates the activation function used; (3) Pooling calculations are performed in the pooling layer. The calculation formula for the pooling layer is as follows: ; In the formula: Indicates the first l The data on wind speed, ocean surface current velocity, and ocean surface temperature at -1 level. i Each feature map Indicates the first l The first layer of wind speed, ocean surface current velocity, and ocean surface temperature data j The weight coefficients of each feature map. down (•) represents the pooling function. Indicates the first l The first layer of wind speed, ocean surface current velocity, and ocean surface temperature data j Each feature map; This represents the bias term corresponding to the j-th feature map of the l-th pooling layer; (4) Use a fully connected layer to summarize all input feature information. Each neuron in the layer is fully connected to the neurons in the upper layer. The calculation formula for the fully connected layer is as follows: ; In the formula: For the first l The first layer j One neuron; This represents the i-th neuron in the (l-1)-th layer.
4. The method for predicting short-term offshore wind power output based on Swin-CNN-LSTM according to claim 3, characterized in that, In CNN neural network models, the tanh and ReLU functions are chosen as activation functions. The calculation formulas for each function are shown below: ; In the formula: x This represents the data obtained after processing the actual inputs of wind speed, ocean surface current velocity, and ocean surface temperature using a layered structure, tanh( x ) and ReLU x ) represents the output after processing by the activation function.
5. The method for predicting short-term offshore wind power output based on Swin-CNN-LSTM according to claim 1, characterized in that, Step S3 involves constructing the Swin Transformer module and using a self-attention mechanism to build spatiotemporal correlation features of the ocean scene within a local window. This includes the following steps: (1) During the forward propagation process, all features of each input sample after feature extraction using the CNN neural network model are normalized. The specific formula is as follows: ; ; ; In the formula: x represents the feature input vector after feature extraction by the CNN neural network model and input to the Swing Transformer module. i Let σ represent the value of the i-th element in the input vector, μ represent the average value of the input vector x, D represent the length of the input vector, and σ represent the average value of the input vector x. 2 ϵ represents the variance of the input vector, ϵ represents a minimum value to prevent the denominator from being 0, γ represents the weight parameter of the scientific system, β represents the bias parameter of the scientific system, and x' represents the data after layer normalization. The output features of the self-attention mechanism are obtained by utilizing the self-attention mechanism, specifically using multi-head window self-attention, as shown in the following formula: 1) First, divide the feature map into M*M non-overlapping windows, each containing k=M*M feature vectors, and then recombine the vectors: ; In the formula: H represents the height of the input feature data, W represents the width of the input feature data, d represents the number of channels of the input feature data, M represents the window size, and Xwindows represents the feature vector after partitioning and recombination; 2) Perform single-head computation, linearly projecting the feature vectors (Xwindows) within each window to generate the query matrix, key matrix, and value matrix: ; ; ; ; ; In the formula: Q, K, and V represent the query matrix, key matrix, and value matrix, respectively, and W Q W K W V This represents the weight matrix corresponding to the query matrix, key matrix, and value matrix, where h represents the number of heads; The dimension representing each attention head; 3) Introduce a learnable relative position bias matrix B, where the structure of B is as follows: ; 4) Calculate the relative position index. For two positions i and j within the window, their absolute coordinates are represented as (x, j) and (j, j). i ,y i ) and (x j ,y j ), calculate the relative coordinate difference between position i and position j: ; ; In the formula: Δx and Δy represent the relative coordinate differences between the horizontal and vertical coordinates, respectively; 5) Mapping the two-dimensional coordinates to a one-dimensional index, the process of retrieving each value from B is as follows: ; In the formula: Bi,j represents the bias term for the attention weight calculation, and [·] represents the indexing operation on the bias matrix B; 6) Calculate the attention weights, using the formula shown below: ; In the formula: Attention(Q,K,V) represents the attention weight matrix, and the definition of the Softmax(·) function is as follows: ; In the formula: z i This represents the i-th element of the input vector z; Then, the outputs of h heads are concatenated into a multi-head output and linearly projected to obtain the windowed output result; (2) After another layer normalization process, the result of the layer normalization is input into the multilayer perceptron to obtain the output result of the multilayer perceptron.
6. The method for predicting short-term offshore wind power output based on Swin-CNN-LSTM according to claim 5, characterized in that, The structure of a multilayer perceptron consists of two fully connected layers and one activation function layer; the specific computation process of a multilayer perceptron is shown below: 1) The input vector is processed through a fully connected layer, and the calculation formula is as follows: ; In the formula: W1 represents the weight matrix, X represents the input vector data, b1 represents the bias vector, and X1 represents the output result. 2) Input the output of the fully connected layer into the activation function layer and process it using the GELU activation function. The calculation formula is shown below: ; In the formula: GELU(·) represents the GELU activation function, Φ(·) represents the cumulative distribution function of the standard Gaussian distribution, and X2 represents the output result after the activation layer; 3) The result of the activation layer is multiplied by 2 and then processed through a fully connected layer. The calculation formula is shown below: ; In the formula: W2 represents the weight matrix, b2 represents the bias vector, and X3 represents the output of the multilayer perceptron.
7. The method for predicting short-term offshore wind power output based on Swing-CNN-LSTM according to claim 1, characterized in that, Step S4 involves constructing an LSTM neural network and fusing the spatiotemporal correlation features obtained from the Swing Transformer module to obtain the predicted power output of offshore wind power for the next 24 hours. This process specifically includes the following steps: (1) Construct an LSTM model, which includes three gate structures: forget gate, input gate, and output gate. The input data is first filtered by the forget gate to select the information to be retained and the information to be forgotten. The calculation formula is shown below. ; In the formula: f t This is the final output of the Forgotten Gate. As weight, As a bias term, the input to the forget gate is the output of the hidden layer of the previous unit and the feature maps of wind speed, ocean surface current velocity, and ocean surface temperature data extracted by the CNN neural network model at the current time step. (2) Integrate the Swing Transformer module into the path between the input gate and the output gate to realize the fusion of the Swing Transformer module and the LSTM neural network to form a new network structure; update the cell state through the input gate, update the information using the activation function, obtain the two parts of data, and combine the two parts of data to complete the update of the entire cell state; the calculation process is shown below. ; ; In the formula: i t This is the computational structure for the input gate. This represents the weight matrix of the input gate; This represents the bias vector of the input gate; A weight matrix representing the state of candidate cells; A bias vector representing the state of a candidate cell; STB represents the output obtained after updating the features of preceding wind speed, ocean surface current velocity, and ocean surface temperature data, and is processed by the Swing Transformer module. Then, combining the output from the previous time step with the forget gate content, the network structure is updated. The calculation process is shown below: ; In the formula: C t This is the output of the cell at the current time. f t Output for the forget gate. C t-1 This is the output of the cell from the previous time step. i t Indicates the input of the input gate; (3) The final output state is determined by the output gate. The output gate outputs by multiplying the matrix formed by connecting the control unit state of the previous time step with the input of the current time step and the weights. C t The output is calculated using tanh to obtain the final output, and the calculation process is shown below. ; ; In the formula: O t For the output of the output gate, h t The final output is the result of comprehensive processing of the input wind speed, ocean surface current velocity, and ocean surface temperature, yielding the predicted offshore wind power output for the corresponding region. This is the weight matrix of the output gate; This is the bias vector for the output gate.
8. A prediction system for short-term offshore wind power output based on Swin-CNN-LSTM, characterized in that, The method described by any one of claims 1 to 7 includes: The data processing module is used for data preprocessing, which standardizes the multi-source heterogeneous data of offshore wind farms, including wind speed, ocean surface current velocity, and ocean surface temperature. The feature extraction module is used to build a CNN neural network model to capture and extract local features of wind speed, ocean surface current velocity, and ocean surface temperature, thereby achieving local spatial feature extraction. The feature association module is used to build the Swing Transformer module, which uses a self-attention mechanism to construct spatiotemporal associated features of the ocean scene within a local window; The power output prediction module is used to construct an LSTM neural network and fuse the spatiotemporal correlation features obtained from the Swing Transformer module to obtain the predicted power output of offshore wind power for the next 24 hours.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein, when the program is executed, it controls the device containing the computer-readable storage medium to perform a method for predicting short-term offshore wind power output based on Swin-CNN-LSTM as described in any one of claims 1 to 7.
10. A processor, characterized in that, The processor is used to run a program, wherein the program executes a method for predicting short-term offshore wind power output based on Swin-CNN-LSTM as described in any one of claims 1 to 7.