Offshore wind power multi-unit spatio-temporal characteristics of ultra-short-term power prediction model establishment method
By using an improved Transformer model and DTW algorithm, the spatiotemporal characteristics of offshore wind turbines are quantified, solving the problems of long prediction time and low accuracy in offshore wind power forecasting. This enables faster and more accurate multi-unit power prediction, supporting efficient dispatching by power grid companies.
Patent Information
- Application Number
- CN202210377680.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-12
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2042-04-12
AI Technical Summary
Existing technologies fail to effectively quantify the spatiotemporal characteristics of wind turbines in offshore wind power forecasting, resulting in excessively long forecast times and poor overall forecast power curve quality, which makes it difficult to meet the high-efficiency dispatching needs of power grid companies.
An improved Transformer model is used in combination with the Dynamic Time Warp Distance (DTW) algorithm and a probabilistic sparse self-attention mechanism to quantify the spatiotemporal characteristics of offshore wind turbines, and the prediction process is optimized through clustering and prediction models.
It achieves higher prediction accuracy and speed, meets the grid company's specifications for ultra-short-term power prediction, and improves the overall prediction efficiency and accuracy of offshore wind farms.
Smart Images

Figure CN115587525B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application considers the method for establishing an ultra-short-term power prediction model of spatial and temporal characteristics of offshore wind power multi-units, which belongs to the technical field of wind power systems. BACKGROUND
[0002] Offshore wind power has the characteristics of randomness and uncontrollability, which can easily cause wind power generation companies to fail to correctly report power generation, resulting in active wind curtailment due to insufficient reported power or loss due to reduced grid stability due to excessive reported power. Therefore, in practical applications, it is necessary to accurately predict the ultra-short-term wind power. At present, the research on offshore wind power prediction is becoming more in-depth, and the OWPF statistical prediction model is developing. Its prediction superiority is based on historical output data, numerical weather prediction and measured meteorological data, and maps the power in the future short time sequence, such as support vector machine, random forest model and grey correlation analysis model. Under the support of artificial intelligence technology and data driving, in recent years, there have been many OWPF prediction models based on artificial intelligence models, such as convolutional neural network, long short-term memory, etc. Some studies use sparse vector autoregressive model fitting to model the wind power location to achieve 5-minute wind power prediction in advance. Some use principal component analysis method to cluster wind power output scenarios to establish different back propagation neural network prediction models. Some use wavelet decomposition and attention mechanism to process data and use bidirectional LSTM model for renewable energy ultra-short-term power prediction, which has good prediction performance. The above methods and strategies are used for clustering and power prediction of wind power or offshore wind power, but the clustering part does not effectively quantify the power spatial and temporal characteristics and similarity measurement between wind power units. In addition, the existence of offshore wind power wake characteristics and the harsh meteorological environment make it difficult to monitor the environmental factors in real time, data collection is difficult, and the change range is large. In the case of only offshore wind power, how to quantify and measure the spatial and temporal characteristics of offshore wind power units, and use advanced deep learning algorithms to achieve "multi-unit" fast prediction effect, needs further research. SUMMARY
[0003] The application provides a method for establishing an ultra-short-term power prediction model considering the spatial and temporal characteristics of offshore wind power multi-units to solve the problems of long prediction time and poor overall prediction power curve quality caused by predicting offshore wind power single units, and facilitate efficient scheduling of offshore wind power units by power grid companies.
[0004] To solve the above technical problems, the technical scheme adopted by the application is as follows: the method for establishing an ultra-short-term power prediction model considering the spatial and temporal characteristics of offshore wind power multi-units, comprising the following steps:
[0005] S1) analyzing the mechanism of the Transformer model;
[0006] S2) Establishing offshore wind power multi-unit ultra-short-term power prediction model based on improved Transformer;
[0007] S3) Example analysis verification.
[0008] The application proposes a method for establishing an ultra-short-term power prediction model considering the space-time characteristics of offshore wind power multi-units. First, the dynamic time warping (DTW) distance algorithm is used and the abstract and de-abstract ideas are added to improve the DTW algorithm, and the bus and geographic information are considered for unit clustering to form a unit group to quantify and measure the time sequence similarity between units. Then, the Transformer model based on attention mechanism is used and the probability improvement is made in the attention module to reduce the power prediction time. Finally, the sequence considering the space-time characteristics and position information is predicted and analyzed and compared with other common prediction methods. The prediction results show that the method proposed in the application can effectively measure the space-time characteristics between units, and the prediction model has higher prediction accuracy and speed compared with the traditional prediction model. BRIEF DESCRIPTION OF DRAWINGS
[0009] The application will be further described in detail below with reference to the accompanying drawings;
[0010] Figure 1 is a Transformer model structure diagram;
[0011] Figure 2 is a offshore wind farm unit power diagram;
[0012] Figure 3 is the abstract and de-abstract process of the DTW algorithm;
[0013] Figure 4 is a offshore wind power prediction model structure diagram;
[0014] Figure 5 is a offshore wind farm unit geographic position diagram;
[0015] Figure 6 is a offshore wind power multi-unit space-time characteristic similarity measurement DTW analysis;
[0016] Figure 7 is a offshore wind power multi-unit space-time characteristic similarity measurement DTW analysis;
[0017] Figure 8 is a offshore wind power multi-unit space-time characteristic similarity measurement DTW analysis;
[0018] Figure 9 is a offshore wind power multi-unit space-time characteristic similarity measurement DTW analysis;
[0019] Figure 10 is a offshore wind power multi-unit space-time characteristic similarity measurement DTW analysis;
[0020] Figure 11 For the cluster before and after the unit group power prediction error chart;
[0021] Figure 12 For other offshore wind turbine group power prediction error. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical scheme and advantages of the embodiments of the present application more clear, the technical scheme of the present application will be described clearly and completely below in combination with the embodiments in the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0023] The present application considers the offshore wind power multi-unit spatio-temporal characteristics of the ultra-short-term power prediction model establishment method, including the following steps:
[0024] S1) Analysis of Transformer model mechanism;
[0025] S2) Establishing an improved Transformer-based offshore wind power multi-unit ultra-short-term power prediction model;
[0026] S3) Example analysis and verification.
[0027] The step S1) analysis of the Transformer model mechanism includes:
[0028] S11) Analysis of Transformer model
[0029] The Transformer model is a kind of neural network, and the model adopts a self-attention mechanism instead of a conventional RNN to solve the global dependency between input and output, realize model parallelization, enable it to learn complex patterns and dynamic time series, and improve the generalization ability of the prediction RNN by using multivariate time series, and focus on using a scaled dot-product attention function, which is shown in the following formula:
[0030]
[0031] In the formula, A(Q, K, V) is an attention function, K is a key matrix of all key mappings, V is a value matrix of all value mappings, K and V information contains time and power information of the input time series, Q is all query mappings, d is the dimension of the time series matrix, and Softmax(·) is an activation function.
[0032] The Transformer model structure is as follows: Figure 1As shown in the figure, the Transformer model structure contains N encoders and N decoders, and the positional encoding (PE) obtains the position vector by inputting the time series position information and adding it to the input data, so that the model can perceive the input data position information without the RNN structure. The position information is shown in equations (2) and (3):
[0033]
[0034]
[0035] where pos is the time series position, 2i indicates that the time series position is even, 2i+1 indicates that the time series position is odd, and d is the time series dimension;
[0036] The Transformer model uses a multi-head self-attention mechanism, which maps Q, K, and V through their corresponding linear mapping matrices to different spaces, then calculates the attention function to form multi-head attention, and then concatenates the multi-head attention and maps it through a linear mapping matrix W O to output, as shown in the following formula:
[0037] M(Q,K,V)=Concat(head1,...,head h )W O (4)
[0038] head i =A(QW i Q ,KW i K ,VW i V ) (5)
[0039] where M(Q,K,V) is the multi-head self-attention function, W O ,W Q ,W K ,Q V are linear mapping matrices of M, Q, K, and V, and Concat(·) is a concatenation function;
[0040] The feed forward neural network (FFNN) is composed of two linear transformations and a ReLU activation function, as shown in the following formula:
[0041] FFNN(x)=max(0,xW1+b1)W2+b2 (6)
[0042] FFNN(x) is a feed-forward neural network function, W1, b1 is the first linear transformation parameter, and W2, b2 is the second linear transformation parameter;
[0043] Each sub-module is connected by addition and normalization. The addition focuses on the difference between the training and the change, and the normalization accelerates the network convergence and generalization ability.
[0044] S11) Probabilistic Transformer model
[0045] The Transformer model has great potential in processing time series prediction problems, but the computational complexity of the self-attention mechanism is high. Some scholars consider that the multi-head self-attention weight has potential sparsity and obeys the long tail distribution (LTD), and propose and design a probabilistic sparse self-attention mechanism model.
[0046] Among them, the probabilistic sparse multi-head self-attention mechanism uses the KL divergence (Kullback-Leibler divergence, KLD) method to measure the difference between two probability distributions to evaluate the LTD sparsity of the query, and the simplification is as follows:
[0047] Discrete KL divergence definition:
[0048]
[0049]
[0050] In the formula: P(i) is the true distribution of the query matrix Q and the key matrix K, and Q(i) is the theoretical distribution of the query matrix Q and the key matrix K.
[0051] The attention function formula (1) is expanded according to the ith row:
[0052]
[0053] In the formula: k(qi, kj) is an asymmetric exponential kernel function of qi and kj;
[0054]
[0055] Attention probability distribution formula:
[0056]
[0057]
[0058] In the formula: L k is the length of the query vector;
[0059] Bring in discrete KL divergence formula:
[0060]
[0061] Drop constant term lnL k :
[0062]
[0063] According to the logarithmic sum (LogSumExp, LSE) theorem:
[0064]
[0065] Bring in formula (B8) to get formula (7);
[0066] The final evaluation query sparsity formula is as follows:
[0067]
[0068] In the formula: q i is the i-th query value in the query matrix Q, k i is the i-th key value in the key matrix K, d is the matrix dimension of the key value, j is the number of keys, L k is the length of the query vector;
[0069] Using the evaluation query sparsity to improve the attention function, the query vector with larger impact probability on the prediction result is used as the main element of the sparse matrix, and the query vector with smaller impact probability on the prediction result is set to zero vector. Its query vector probability is known by using the final evaluation query sparsity formula, and the query vector with higher relevance is used for prediction to reduce the spatial complexity. The sparsity of the sparse matrix needs to be manually selected to achieve better prediction accuracy. The improved attention function is as follows:
[0070]
[0071] In the formula: Q is a sparse matrix with the same dimension as Q, and its sparsity is the number of effective query vectors, K is the key matrix of all keys, V is the value matrix of all values, d is the dimension of the time series matrix, and Softmax(·) is the activation function;
[0072] At the same time, the convolution layer and the maximum pooling layer are added after the probability sparse self-attention mechanism and the addition and normalization, and the output of the encoder which includes the information of other elements in the sequence is removed to shorten the length of the input sequence, reduce the model calculation complexity and spatial complexity, and at the same time guarantee the local correlation of the model input time power sequence.
[0073] The step S2) establishes an offshore wind power multi-unit ultra-short-term power prediction model based on an improved Transformer, and the specific process is as follows:
[0074] S21) Analysis of spatial and temporal characteristics similarity of offshore wind power multi-unit
[0075] The power of offshore wind power multi-unit is affected by regional wind speed and wind direction, and there is a certain wake effect, and different unit types and positions also affect the power change;
[0076] As Figure 2 The power of 42 units of a certain offshore wind farm in one day is shown, and it can be seen that the power values of some adjacent units are different, but the power change trend is almost the same, which shows that the power change of the unit has a certain spatial and temporal similarity, and if the bus position information of each unit is considered, the curve smoothness of the clustered unit and the accuracy of the power prediction can be improved to a certain extent;
[0077] The present application considers the time-power power sequence of offshore wind turbine power, introduces the DTW algorithm to analyze the spatial and temporal characteristics similarity of offshore wind power multi-unit, reflects the fluctuation trend between offshore wind power sequences, and then measures the spatial and temporal characteristics similarity of offshore wind power multi-unit, so as to achieve the effect of clustering prediction, and the smaller the DTW distance is, the higher the similarity between the unit power sequences is;
[0078] The DTW algorithm uses the calculated warp path distance (WPD) to quantitatively measure the similarity between time sequences, and if there are time sequences A and time sequences B, the lengths are a and b respectively, then the warp path (WP) is defined as:
[0079] WP(A,B)={w1,…,w k} (9)
[0080] max(a,b)≤k≤a+b (10)
[0081] w α =(i,j),w α+1 =(i′,j′)α∈k (11)
[0082]
[0083] Wherein: i is the coordinate of time sequence A, and j is the coordinate of time sequence B;
[0084] The Euclidean distance (ED) is used to measure the distance between w α and w α+1 , which can be expressed as:
[0085]
[0086] The minimum WPD is calculated by using the dynamic programming (DP) idea to calculate the DTW distance, so as to represent the correlation degree between two time series, and the DP implementation is as follows formula:
[0087]
[0088] Due to the long length of the offshore wind turbine power time sequence, the single DP idea cannot efficiently calculate the DTW distance, and the abstract and de-abstracted improved DTW algorithm is used, which combines the WPD matrix, and then performs the DTW algorithm in the abstracted WPD matrix, and the de-abstracted WPD matrix is expanded and the DP solving result is kept, and the WP is expanded in the horizontal direction, the vertical direction and the oblique direction, and the DP solving result and the expansion granularity are solved again to obtain a new DP solving result, and the process is repeated until the de-abstracted WPD matrix is restored to the original WPD matrix, as shown in Figure 3
[0089] The strategy of improving the DTW algorithm reduces the search space and the time complexity of the DTW algorithm, and the offshore wind turbine power sequence is long, so that the time-space characteristics of the offshore wind power multi-unit can be effectively measured, and the multi-unit clustering and hybrid prediction can be performed;
[0090] S22) prediction model structure
[0091] The application firstly improves the DTW algorithm to measure the time-space characteristics of the offshore wind power multi-unit, and according to the time-space characteristic measurement result and the addition of the geographical adjacent principle and the busbar information, the offshore wind turbine is clustered, the prediction efficiency of the offshore wind farm is improved, and the problem of too large prediction error caused by the unsmooth power curve after clustering is reduced, and after clustering, the improved Transformer prediction model is used to predict the ultra-short-term power of the unit group;
[0092] In order to improve the data input quality, the prediction accuracy and the convergence speed, the application adopts the standard normalization method to normalize the original wind power data, and converts it into data in the interval (-1, 1), and the formula of data normalization is:
[0093]
[0094] In the formula, x train is the normalized offshore wind power value; x max is the maximum value in the original offshore wind power data; x min is the minimum value in the original offshore wind power data; x i is the actual offshore wind power value;
[0095] Meanwhile, the input layer time series needs to be subjected to differential smoothing (DS) sequence to reduce the spatial complexity of the time series, reduce the prediction error, and the differential smoothing power sequence formula is as follows:
[0096] ΔP(t) = DS(ΔP(t-θ), ΔP(t-2θ), …) + e(t) (16)
[0097] In the formula: ΔP(t) is the change value of offshore wind power at t and t-θ; DS(·) is the time correlation function of offshore wind power differential sequence; e(t) is the minimum prediction error at t;
[0098] The prediction model structure is shown in Figure 4 The figure shows that the encoding layer uses one layer of improved Transformer structure, the decoding layer uses two layers of improved Transformer structure, and according to the data characteristics and debugging of the input, the improved Transformer structure sparsity, i.e. the number of effective query vectors, is set to 48, the convolution layer kernel in the encoding layer and the decoding layer is set to 3, the convolution step is set to 1, the activation function is ELU function, and the maximum pooling kernel is set to 3. In the clustering layer, all units are calculated by FDTW algorithm to generate WPD matrix, and the adjacent units are clustered considering the bus and position information. Then the clustered units are subjected to time series stitching (TSS):
[0099]
[0100] In the formula: m is the number of unit groups before clustering, and n is the time series scale.
[0101] S23) Loss function selection
[0102] The mean absolute error (MAE) is used to measure the sum of the absolute values of the difference between the target value and the predicted value, and the average modulus length of the prediction error, and the formula is as follows:
[0103]
[0104] In the formula: y i is the offshore wind power target value, is the offshore wind power prediction value, and m is the number of prediction values.
[0105] The mean square error (MSE) is the most commonly used regression loss function, which measures the error by solving the square sum of the distance between the target value and the predicted value, and the formula is as follows:
[0106]
[0107] The root mean square error (RMSE) is the arithmetic square root of the mean square error, which can more intuitively observe the error size between the actual value and the predicted value, and the formula is as follows:
[0108]
[0109] The R squared (R 2 ) is used to evaluate the model quality, and the result range is [0, 1], and the R 2 result is closer to 1, indicating that the model quality is better, and the formula is as follows:
[0110]
[0111] In the formula: Var (y) is the variance of the offshore wind power value.
[0112] The step S3) example analysis verification includes: offshore wind power multi-unit time and space characteristic analysis, prediction model structure accuracy verification and prediction model structure performance verification.
[0113] S31) Offshore wind power multi-unit time and space characteristics
[0114] The operating system used in the simulation verification of the application is Windows 108GB RAM, the CPU is Intel(R) Core(TM) i3-9100F CPU@3.60GHz, and the GPU is NVIDIA GeForce GTX 1650 experimental environment, and Python3.8 language and Pytorch1.8 framework are used for development.
[0115] The example data of the application is derived from the power data of the first to 42th offshore wind power units of a wind power plant in Jiangsu, and the units all use 1.5MW GE wind turbine, and the power data resolution used is 1min, and the unit geographic location map is as Figure 5 shown.
[0116] S32) Offshore wind power multi-unit time and space characteristic analysis
[0117] The application first uses the improved DTW algorithm to perform offshore wind power multi-unit time and space characteristic similarity measurement analysis, and the analysis result is as Figure 6Each value in the figure represents the WPD between the units. Since the WPD represents the time series characteristics between the units, it is symmetric to the main diagonal, and the elements on the main diagonal are all 0. Since the length of the time series of offshore wind power is too long, the present application uses MW as the power unit to calculate the WPD. After considering the number of clustered units and the quality of clustering, the strategy of WPD≤3 can effectively distinguish the spatio-temporal characteristics similarity between the units, form the clustering block effect, and the clustering results of the 42 offshore wind units are shown in Table 1.
[0118] Table 1 Clustering results of offshore wind farm clusters
[0119] Tab.1 Clustering results of offshore wind farm clusters
[0120]
[0121]
[0122] The typical unit group with a large number of units is selected for study, so the clustering effect and prediction effect of unit group 8 are studied first, which is composed of units 27 to 37, and the offshore wind power of the units within three days is shown in Table 2. Figure 7
[0123] It can be seen that the improved DTW algorithm clusters the units with high spatio-temporal characteristics similarity, and the clustered unit group still maintains the same extreme characteristics and operation rules. It can be seen that the clustering effect remains consistent for three days, has a certain timeliness, and maintains the periodic fluctuation of wind power, which is convenient for power combination prediction of the unit group.
[0124] S33) Prediction model structure accuracy
[0125] In terms of unit clustering, the improved Transformer model is used to predict the unit group 8, and the differences in time and accuracy between the single prediction of units 27-37 are compared. In terms of models, the algorithm of the application is compared with the traditional Transformer model, LSTM algorithm and autoregressive integrated moving average (ARIMA) model. At the same time, the sparsity of the sparse matrix of the algorithm of the application is set to 30, the algorithm of the application and the Transformer algorithm both use one encoding layer and two decoding layers, use ELU function and activation function, and use ADAM iterator for gradient descent calculation; the LSTM algorithm sets the sample number to 1, the training cycle number to 50 times, the number of LSTM layer neurons to 4, and the gradient descent uses ADAM iterator. At the same time, the test data set of the unit prediction model is the minute-level power data of 42 units of the offshore wind farm for three days, the training set is the power data of the first two days and the first 20 hours of the third day, and the verification set is the power data of the last 4 hours of the third day. The power prediction results of the unit group 8 in different models are as shown in Figure 8 Table 2.
[0126] Table 2 Evaluation of power loss functions of different models for predicting group of units
[0127] Tab.2 Evaluation of power loss functions ofdifferent models forpredicting group of units
[0128]
[0129] From Figure 8 (a) it can be seen that in the power rising period and the falling period, the algorithm of the application and the Transformer model can effectively follow the real power for prediction, while the LSTM model more or less appears a certain advance or lag in the predicted power. In the power fluctuation, the Transformer model and the algorithm of the application can follow the power fluctuation for adjustment, while the LSTM model can only show the prediction trend and cannot effectively follow the rapid change of power and quickly respond. The error distribution among the models is as shown in Figure 9 Table 3.
[0130] S34) Prediction model structure performance
[0131] The application considers the clustering speed of offshore wind turbine units. When clustering the units of the offshore wind farm, the improved DTW algorithm used by the application takes 6.74 minutes (404.39 seconds), while the traditional DTW algorithm takes 18.90 minutes (1134.24 seconds). It can be seen that the improved DTW algorithm can effectively reduce the calculation speed by using the abstraction and de-abstraction strategy when calculating WPD. If the number of subsequent units increases, the unit cluster can also be clustered in a shorter time, and if the clustering error increases, it can be clustered again in time. At the same time, the application takes into account the time gap and prediction accuracy gap before and after the unit prediction clustering. The prediction error of part of the offshore wind single unit is as shown in Figure 10 , the prediction error before and after clustering is as shown in Figure 11 , and the prediction results before and after clustering are shown in Table 3.
[0132] Table 3 Evaluation of power prediction of group of units before andafter clustering
[0133] Tab.3 Evaluation of power prediction of group of units before andafter clustering
[0134]
[0135] As can be seen from Table 3, the algorithm of the application has obvious advantages in time compared with the traditional Transformer model. Due to the consideration of clustering, the accuracy of the unit group prediction is not as good as that of the single unit prediction, but considering the prediction time, the prediction time of the unit group after clustering is significantly improved compared with the single unit prediction summation before clustering, and the error trend before and after clustering is basically the same as shown in Figure 7 . The power prediction error of other offshore wind turbine groups is shown in Figure 12 . In consideration of time and accuracy, the algorithm of the application can timely predict the overall power of the offshore wind farm. At the same time, since there is no need to consider clustering time every time, the overall prediction time of the offshore wind farm is 8.40 minutes, which meets the specification requirement of reporting a 4h ultra-short-term prediction curve every 15 minutes in the future. When the unit group prediction accuracy is lower than the preset accuracy or the wind direction changes significantly, re-clustering and prediction also basically meet the specification requirements.
[0136] To solve the problem of too long prediction time caused by predicting offshore wind single unit and poor quality of overall prediction power curve, and to facilitate efficient dispatching of offshore wind turbine units by power grid companies, the application proposes a method for establishing an ultra-short-term power prediction model considering the space-time characteristics of offshore wind multiple units, and the following conclusions are obtained:
[0137] (1) The improved DTW algorithm can effectively quantify the macro temporal and spatial characteristics and measure the temporal and spatial similarity between offshore wind turbines, thereby clustering the turbine groups to achieve the effect of "multi-machine integration" prediction, reduce repeated prediction time, and improve the DTW algorithm to reduce clustering operation time;
[0138] (2) By predicting the ultra-short-term power of offshore wind turbines and turbine groups, it can be seen that the improved probability-based Transformer prediction model effectively reduces the prediction time while ensuring the prediction accuracy, meeting the prediction specification requirements;
[0139] (3) Considering the temporal and spatial characteristics of the turbine, the clustered offshore wind turbine group completely retains the fluctuation rule, operation rule and extreme value characteristics of the single turbine, which significantly improves the prediction speed with little loss of prediction accuracy.
[0140] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for establishing an ultra-short-term power prediction model considering the spatiotemporal characteristics of offshore wind power multi-units, characterized in that Comprising the following steps: S1) analyzing the Transformer model mechanism; The step S1) analyzing the Transformer model mechanism comprises: S11) Transformer model analysis The Transformer model is a kind of neural network, whose model adopts a self-attention mechanism instead of a conventional RNN to solve the global dependency between input and output, realize model parallelization, enable it to learn complex patterns and dynamic time series, and improve the generalization ability of the prediction RNN by using multivariate time series, and focus on using a scaled dot-product attention function, which is shown in the following formula: In the formula: A(Q, K, V) is an attention function, K is a key matrix of all key mappings, V is a value matrix of all value mappings, K and V information contains time and power information of the input time series, Q is all query mappings, d is the dimension of the time series matrix, and Softmax(·) is an activation function; The Transformer model structure contains N encoders and N decoders, and the position encoding obtains a position vector by inputting the position information of the time series and adding it to the input data, so that the model can perceive the position information of the input data without the RNN structure. The position information is shown in formula (2) and formula (3): In the formula: pos is the position of the time series, 2i indicates that the position of the time series is even, 2i+1 indicates that the position of the time series is odd, and d is the dimension of the time series; The transformer model adopts a multi-head self-attention mechanism, which maps Q, K, and V to different spaces through their corresponding linear mapping matrices, respectively, calculates the attention function to form multi-head attention, and then splices the multi-head attention and maps it through a linear mapping matrix W O to map the output, and the calculation formula is as follows: M(Q, K, V) = Concat(head1,..., head h )W O (4) head i = A(QW i Q , KW i K , VW i V ) (5) wherein: M(Q, K, V) is a multi-head self-attention function, W O ,W Q ,W K Q V are linear mapping matrices of M, Q, K, V, respectively, and Concat(·) is a concatenation function. The feedforward neural network is composed of two linear transformations and a ReLU activation function, and the calculation formula is shown in the following formula: FFNN(x) = max(0, xW1 + b1)W2 + b2 (6) In the formula: FFNN(x) is a feedforward neural network function, W1 and b1 are the first linear transformation parameters, and W2 and b2 are the second linear transformation parameters; By adding and normalizing each sub-module, the difference between the training before and after the addition is focused on, and the normalization is used to accelerate network convergence and generalization ability; S11) Probabilistic Transformer model When the Transformer model is used to process time series prediction problems, a probabilistic sparse self-attention mechanism model is used. In the calculation of the attention function, the KL divergence method is used to measure the difference between two probability distributions to evaluate the LTD sparsity of the query. The final evaluation query sparsity formula is approximately shown in the following formula: where: q i is the ith query value in the query matrix Q, k i is the ith key value in the key matrix K, d is the matrix dimension of the key value, j is the number of keys, L k is the query vector length; By using the evaluation query sparsity to improve the attention function, the query vector with a larger probability of affecting the prediction result is used as the main element of the sparse matrix, and the query vector with a smaller probability of affecting the prediction result is set to zero. It is shown that the query vector probability can be used for prediction by using the final evaluation query sparsity formula, so as to reduce the space complexity. The sparsity of the sparse matrix needs to be manually selected to achieve better prediction accuracy. The improved attention function is shown in the following formula: In the formula: Q is a sparse matrix of Q dimensions, the sparsity is the number of effective query vectors, K is the key matrix of all key mappings, V is the value matrix of all value mappings, d is the dimension of the time series matrix, Softmax(·) is an activation function; Meanwhile, the convolution layer and the maximum pooling layer are added after the probabilistic sparse self-attention mechanism and the addition and normalization, the output of the information of other elements in the sequence included in the encoder is removed, the length of the input sequence is shortened, the model calculation complexity and space complexity are reduced, and the local correlation of the model input time power sequence is guaranteed; S2) Establishing an offshore wind power multi-unit ultra-short-term power prediction model based on an improved Transformer; The step S2) of establishing an offshore wind power multi-unit ultra-short-term power prediction model based on an improved Transformer is specifically: S21) Analysis of offshore wind power multi-unit spatio-temporal characteristic similarity The power of offshore wind power units is affected by regional wind speed and wind direction, and there is a certain wake effect. Different unit models and positions also affect the power change, and the unit power change has a certain spatio-temporal similarity. If the bus position information of each unit is considered, the curve smoothness of the clustered units and the accuracy of the power prediction can be improved to a certain extent. Considering the time-power power sequence of offshore wind power unit power, the DTW algorithm is introduced to analyze the spatio-temporal characteristic similarity of offshore wind power multi-unit, reflect the fluctuation trend between offshore wind power sequences, and then measure the spatio-temporal characteristic similarity of offshore wind power multi-unit to achieve the effect of clustering prediction. The smaller the DTW distance, the higher the similarity between the unit power sequences. The DTW algorithm uses the calculated normalized path distance to quantify the similarity between time series. If there are time series A and time series B with lengths a and b, respectively, the normalized path is defined as: WP(A, B) = {wl,..., w k} (9) max(a,b)≤k≤a+b (10) w α = (i,j), w α+1 = (i',j') α∈k (11) Where i is the coordinate of time series A, and j is the coordinate of time series B. Using the Euclidean distance metric w α from w α+1 , which can be expressed as: The dynamic programming idea is used to calculate the minimum WPD to calculate the DTW distance, which is used to represent the correlation between two time series. The DP implementation is as follows: Because the length of the offshore wind power unit power time series is long, the single DP idea cannot efficiently calculate the DTW distance. The improved DTW algorithm uses abstraction and de-abstraction. It combines the entire WPD matrix pixels, then performs the DTW algorithm in the abstracted WPD matrix, and then de-abstracts the WPD matrix by expanding the WPD matrix and keeping the DP solution result. At the same time, the WP is expanded in the horizontal, vertical, and diagonal directions, and the DP solution result and the expansion granularity are obtained again by solving the DP solution. The process continues until the de-abstracted WPD matrix is the original WPD matrix. The improved DTW algorithm reduces the search space and reduces the time complexity of the DTW algorithm. The offshore wind power unit power sequence is long, and the method can effectively measure the spatio-temporal characteristic similarity of offshore wind power multi-unit to perform multi-unit clustering and hybrid prediction. S22) Prediction model structure Firstly, the DTW algorithm is improved to measure the spatio-temporal characteristics of offshore wind power multi-units. According to the spatio-temporal characteristic measurement results and the addition of the geographical adjacent principle and the busbar information, the offshore wind power units are clustered, the prediction efficiency of the offshore wind farm is improved, and the problem of too large prediction error caused by the instability of the power curve after clustering is reduced. After clustering, the improved Transformer prediction model is used to predict the ultra-short-term power of the unit group; In order to improve the data input quality, prediction accuracy and convergence speed, the original wind power data is normalized by using the standard normalization method, which is converted to data in the interval (-1, 1). The formula for data normalization is: wherein: x train is the normalized offshore wind power value; x max is the maximum value in the original offshore wind power data; x min is the minimum value in the original offshore wind power data; x i is the actual offshore wind power value; At the same time, the input layer time series needs to be differentiated and smoothed, which reduces the spatial complexity of the time series and reduces the prediction error. The formula for differentiating and smoothing the power sequence is as follows: ΔP(t)=DS(ΔP(t-θ),ΔP(t-2θ),…)+e(t) (16) Where: ΔP(t) is the change value of offshore wind power at t and t-θ; DS(·) is the time correlation function of offshore wind power difference sequence; e(t) is the minimum prediction error at t; The prediction model structure is given; S23) Loss function selection The mean absolute error is used to measure the sum of the absolute values of the difference between the target value and the predicted value, and the average modulus length of the prediction error. The formula is as follows: In the formula: y i is the offshore wind power target value, is the offshore wind power prediction value, and m is the number of prediction values. The mean square error is the most commonly used regression loss function, which measures the error by solving the square sum of the distance between the target value and the predicted value. The formula is as follows: The root mean square error is the arithmetic square root of the mean square error, which can more intuitively observe the error size between the actual value and the predicted value. The formula is as follows: The R-square value is used to evaluate the model quality, and its result ranges from [0, 1], R 2 The closer the result is to 1, the better the model quality, and the formula is as follows: where y is the offshore wind power sequence, is the mean value of the offshore wind power sequence, and Var(y) is the variance of the offshore wind power value. S3) Example analysis and verification.
2. The method of claim 1, wherein the method further comprises: In the step S22) prediction model structure, the encoding layer uses one layer of improved Transformer structure, the decoding layer uses two layers of improved Transformer structure, and according to the data characteristics and debugging of the input, the improved Transformer structure sparsity, i.e. the number of effective query vectors, is set to 48. The convolution layer kernel in the encoding layer and the decoding layer is set to 3, the convolution step is set to 1, the activation function is ELU function, and the maximum pooling kernel is set to 3. In the clustering layer, all units are calculated by FDTW algorithm to generate WPD matrix, and adjacent unit clustering is performed considering busbar and location information. Then the clustered units are spliced into time series: Where: m is the number of unit groups before clustering, and n is the time series scale.
3. The method of claim 1, wherein the method further comprises: The content of the step S3) example analysis and verification includes: spatio-temporal characteristic analysis of offshore wind power multi-units, prediction model structure accuracy verification and prediction model structure performance verification.