# Anomaly Identification of Wind Turbine Yaw System Based on Two-Stage Attention-Informer Algorithm
## 3 Yaw Position Anomaly Recognition Model
### Sliding Window Residual Analysis  
The residual distribution characteristics of the state parameters of the yaw system under a normal operating state reflect its normal features. When the yaw system is in normal operation, the residuals of these state parameters should fluctuate within a small range [31]. However, if an abnormality occurs in the yaw system, resulting in a larger difference between the actual and expected values, the residuals will become larger. Therefore, by  
\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline \multirow{2}{*}{**Prediction Model**} & \multicolumn{3}{c}{**SGD Optimization Algorithm**} & \multicolumn{3}{c}{**Adam Optimization Algorithm**} \\ \cline{2-7}  & **MAE** & **RMSE** & **R\({}^{2}\)** & **MAE** & **RMSE** & **R\({}^{2}\)** \\ \hline BPNN & 432.06 & 487.51 & 0.693 & 411.26 & 426.60 & 0.728 \\ RNN & 379.21 & 413.89 & 0.714 & 363.08 & 387.59 & 0.753 \\ GRU & 274.46 & 306.70 & 0.829 & 234.53 & 281.02 & 0.851 \\ CNN & 296.30 & 320.47 & 0.803 & 259.01 & 299.74 & 0.839 \\ Transformer & 244.77 & 267.91 & 0.837 & 221.60 & 239.83 & 0.874 \\ Informer & 201.92 & 232.44 & 0.859 & 170.92 & 201.07 & 0.903 \\ TSA–Informer & 165.38 & 198.62 & 0.894 & 126.45 & 150.36 & 0.947 \\ \hline \hline \end{tabular}
\end{table}
Table 4: Performance evaluation of different models.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Hyperparameter** & **Parameter Value** & **Hyperparameter** & **Parameter Value** \\ \hline freq & 7 s & e\_layers & 2 \\ seq\_len & 900 & d\_layers & 1 \\ pred\_len & 300 & enc\_in & 3 \\ d\_model & 468 & dec\_in & 3 \\ n\_heads & 8 & d\_ff & 2632 \\ activation & Gelu & dropout & 0.05 \\ bath\_size & 64 & itr & 6 \\ learning\_rate & 0.0001 & train\_epochs & 200 \\ \hline \hline \end{tabular}
\end{table}
Table 3: Hyperparameter settings of the TSA–Informer model.  
monitoring the residuals of the yaw system's state parameters, abnormal characteristics can be identified. This paper primarily focuses on the residual distribution characteristics of the yaw position and combines them with an auxiliary analysis of other state parameters to identify abnormal patterns in the yaw system.  
As shown in Figure 2, the residual range is divided using the 0.025 and 0.975 quantiles (0.025 and 0.975 correspond to the critical values in the standard normal distribution, representing the upper and lower 2.5% cumulative probabilities in the normal distribution. This approach allows for a more comprehensive consideration of outlier situations and ensures the robustness and effectiveness of the model under different conditions).  
Compared to methods such as the sequential probability ratio test, time series analysis, neural network residual analysis, and other residual analysis methods, the sliding window method offers advantages in terms of real-time capability, adaptability, simplicity in principle, and practical engineering applicability in residual analysis. This paper utilizes the sliding window method to achieve early warning for generator anomalies through the analysis of residuals.  
We assume that the residual sequence of the model over a period of time is as follows:  
\[\varepsilon=\left[\varepsilon_{1}\quad\varepsilon_{2}\quad\cdots\quad \varepsilon_{n}\quad\cdots\right] \tag{15}\]  
Assuming the length of the window is N, calculate the average of the consecutive N residuals within the window:  
\[\overline{\varepsilon}=\frac{1}{N}\sum_{i=1}^{N}\varepsilon_{1} \tag{16}\]  
Based on this, the window has a width of 10 min and moves in steps of 30 s. Define the anomaly degree formula:  
\[e_{\text{AI}}=\frac{N1+N3}{N1+N2+N3} \tag{17}\]  
In the formula, N1 represents the number of residuals falling into area 1; it is the same with N2 and N3.  
The degree of abnormality in yaw position is directly proportional to \(e_{\text{AI}}\) (AI: Anomaly Index). Based on expert experience, this paper defines yaw position as abnormal when \(e_{\text{AI}}\) exceeds 0.6.