## 3 Methods
### Overview
The significant drop in Recall led to an overall reduction in F1-score, highlighting the key role of the variable attention mechanism in analyzing complex relationships and potential interactions among different variables, which are often crucial for detecting anomalous activities or security threats. Overall, the model achieved its best performance when all components worked together. The Time Block is the most critical for ensuring high Precision and balanced performance, while the Variable Block and UMAP also play important roles in maintaining Recall and enhancing model performance. These results validate the significant contributions of each proposed component to the overall model performance. ### Robustness to Noise

In this section, we evaluated the performance of the proposed distributed photovoltaic communication anomaly detection algorithm under different signal-to-noise ratio (SNR) conditions. Since communication links in actual power systems are often subject to noise interference, assessing the algorithm's performance across various SNR conditions is crucial for validating its stability and effectiveness. To simulate the different noise levels that may be encountered in real-world environments, we added zero-mean white noise to the training and testing datasets and compared the performance metrics across an SNR range of 30 to 100 dB. Subsequently, we compared the performance of our proposed STformer algorithm with several advanced baseline models, including LSSL, THOC, InterFusion, and \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Models** & **Precision** & **Recall** & **F1-Score** \\ \hline -WO-UMAP & 97.82 & 96.76 & 97.29 \\ \hline -WO-Time-Block & 91.88 & 94.73 & 93.29 \\ \hline -WO- Variable-Block & 98.07 & 92.29 & 95.09 \\ \hline STformer & 98.19 & 96.76 & 97.47 \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Performance analysis of ablation variants in Case 1. Omni anomaly. This comparative analysis helps to comprehensively evaluate the ability of STformer to detect communication anomalies in various noise environments. As shown in Table 6, the experimental results demonstrate that STformer outperforms the baseline models across different noise levels. Specifically, the Recall rate slightly decreases as the signal-to-noise ratio (SNR) drops. This decrease occurs because higher noise levels impact the detection performance of the proposed algorithm, requiring an increase in the threshold to accommodate the noise. As a result, the detection algorithm struggles to identify attacks with magnitudes lower than the noise level present in the data samples. ## 5 Discussion

This study proposes a Transformer-based model, STformer, for detecting communication anomalies in distributed photovoltaic (PV) systems. Compared to traditional methods, STformer demonstrates significant advantages in capturing temporal dependencies and interactions between variables, particularly excelling in complex multivariate time-series scenarios. However, despite its outstanding performance in simulation experiments, several issues warrant further discussion. The following sections provide a detailed discussion of model performance, limitations, and comparisons with existing methods, aiming to offer insights and references for future research. First, from the perspective of model performance, STformer exhibits strong anomaly detection capabilities. In various experimental scenarios, STformer achieved leading levels in accuracy, Recall, and F1-score, particularly performing well in high-dimensional data and long-horizon forecasting tasks. Unlike traditional LSTM and RNN models, STformer effectively avoids sequential dependency issues by leveraging a multi-head self-attention mechanism, efficiently capturing global information. Furthermore, STformer introduces a variable attention mechanism that identifies and utilizes the complex dependencies among sensor variables while modeling temporal data, significantly enhancing detection accuracy.