## 3 Methods
### Overview
Experimental results indicate that STformer maintains high detection performance against various types of network attacks (such as DoS and FDIA), demonstrating its strong adaptability in handling diverse anomalies in PV systems. However, despite STformer's satisfactory performance, there are some limitations worthy of further exploration. First, the data used in this study primarily came from a \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**SNR (dB)** & **Models** & **Precision** & **Recall** & **F1-Score** \\ \hline \multirow{6}{*}{30} & OmniAnomaly & 95.96 & 89.89 & 92.83 \\ \cline{2-5}  & InterFusion & 94.88 & 90.37 & 92.57 \\ \cline{2-5}  & THOC & 90.32 & 92.51 & 91.41 \\ \cline{2-5}  & LSSL & 88.14 & 90.99 & 89.54 \\ \cline{2-5}  & Ours & 98.22 & 92.21 & 95.21 \\ \hline \multirow{6}{*}{60} & OmniAnomaly & 96.64 & 91.37 & 93.93 \\ \cline{2-5}  & InterFusion & 95.81 & 91.96 & 93.85 \\ \cline{2-5}  & THOC & 91.88 & 94.19 & 93.02 \\ \cline{2-5}  & LSSL & 88.98 & 92.81 & 90.81 \\ \cline{2-5}  & Ours & 98.37 & 95.97 & 97.15 \\ \hline \multirow{6}{*}{90} & OmniAnomaly & 97.49 & 92.07 & 94.70 \\ \cline{2-5}  & InterFusion & 96.81 & 92.33 & 94.52 \\ \cline{1-1} \cline{2-5}  & THOC & 92.19 & 95.01 & 93.58 \\ \cline{1-1} \cline{2-5}  & LSSL & 89.51 & 95.83 & 92.56 \\ \cline{1-1} \cline{2-5}  & Ours & 97.82 & 96.76 & 97.29 \\ \hline \hline \end{tabular}
\end{table} 
Table 6: Performance metrics comparison at different noise levels in Case 1.

simulated environment. Although these data provided a solid validation basis for model development, their complexity and diversity are limited compared to actual operating conditions in PV systems. Data from real PV systems are often influenced by uncertain factors such as environmental changes, equipment aging, and sensor failures, which may significantly impact the model's practical performance. Second, the computational complexity of STformer may pose a challenge for large-scale applications. Although STformer's architecture has distinct advantages in capturing complex temporal relationships, its multi-head self-attention mechanism and high-dimensional data processing requirements increase computational costs, especially in large-scale deployments of distributed PV systems, where real-time performance may be difficult to ensure. Therefore, future research needs to focus on optimizing resource utilization while maintaining model performance and enhancing real-time processing capabilities. In recent years, various methods for detecting network attacks in distributed PV systems have emerged, each demonstrating their advantages and limitations in different scenarios. To comprehensively assess the superiority of STformer, it is essential to conduct a detailed comparative analysis with current mainstream methods. OCSVM (One-Class Support Vector Machine), a commonly used unsupervised learning method suitable for scenarios with only normal samples, performs well on simple datasets but shows limited performance in complex and diverse anomaly detection contexts like distributed PV systems. In experiments, OCSVM performed poorly with high-dimensional data, achieving only 87.61% accuracy and 88.29% Recall in Case 1, 88.09% accuracy, and 88.17% Recall in Case 2. In contrast, STformer effectively captured temporal dependencies through its multi-head self-attention mechanism, significantly improving detection accuracy and Recall in both cases to 98.19% and 99.07%, with Recall rates increasing to 96.76% and 98.68%. This indicates that STformer significantly outperforms OCSVM in handling complex time series. Deep-SVDD (Deep One-Class Classification), which expands SVDD by incorporating deep neural networks, aims to enhance its ability to handle high-dimensional data. Although Deep-SVDD performs well in certain scenarios, it struggles with long-range dependencies in time-series data. In our experiments, Deep-SVDD achieved 88.45% accuracy and 90.97% Recall in Case 1, and its performance was similarly limited in Case 2 with 88.09% accuracy and 88.17% Recall.