## 4 Simulation Test and Result Analysis
### Experiments on FDIA Detection of Grid Loads  
#### 4.4.1 FDIA Testing Experiments under Standard Operating Conditions  
To assess the FDIA detection model based on the Transformer, the balanced dataset was divided into training and testing sets at a ratio of 3:1. As described in Section 3, distinct labels were allocated to each dataset. The segmentation outcomes are presented in Table 3, wherein the training set encompasses 2773 instances of normal data along with each of the three attack categories. With respect to the Transformer test set, comparative experiments were conducted. One set of experiments involved the utilization of the test dataset following GAN-GRU balancing, while the other set involved the unbalanced test dataset, which corresponds to real-world scenarios. These experiments were undertaken to assess the performance of the model proposed in this paper under varying conditions. This meticulous dataset segmentation strategy optimally harnesses the samples within the dataset. Such a stratagem not only aims to facilitate robust model evaluation and performance validation but also ensures a precise estimation of the model's capacity to extrapolate its efficacy across diverse data subsets. The original dataset utilized in this study comprised 9098 sets of unattacked load datasets recorded during normal operation. This dataset was divided into three distinct categories of attack vectors, each contingent on the number of targeted attack nodes. Consequently, an imbalanced dataset was created to simulate real-world scenarios where historical data often contain a scarcity of attack samples. In subsequent experiments, we rectified this imbalance by employing a data-balancing processing model rooted in GAN-GRU. This strategic adjustment ensured that each category of data achieved a state of complete balance, thus enhancing the efficacy of model training in the subsequent FDIA detection phase. A comprehensive overview of the dataset changes and divisions throughout this entire process is presented in Table 3.  
Following the achievement of sample balancing, the overarching dataset imbalance was effectively alleviated to a level of 0. This intervention markedly enhanced the precision and dependability of the FDIA detection model. In the course of conducting experiments on this dataset, the attack 2-norm was established under the standard operational parameters of 1. Four distinct detection methods were employed. Table 4 delineates the performance metrics of the diverse methods in relation to the accuracy \(\lambda_{\text{Accuracy}}\), detection rate \(\lambda_{\text{Precision}}\), recall \(\lambda_{\text{Recall}}\), and F1 value \(\lambda_{\text{F1}}\): \begin{table}
\begin{tabular}{c c c c c} \hline \hline \multirow{2}{*}{**Sample Type**} & **Before Data** & **After Data** & \multirow{2}{*}{**Training Set**} & **Balanced** & **Unbalanced** \\  & **Balancing** & & & **Data Test Set** & **Data Test Set** \\ \hline
0 & 3698 & 3698 & 2773 & 925 & 925 \\
1 & 2400 & 3698 & 2773 & 925 & 300 \\
2 & 1800 & 3698 & 2773 & 925 & 200 \\
3 & 1200 & 3698 & 2773 & 925 & 100 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Statistics of sample quantity in each stage. Based on our analysis of the experimental findings, it can be deduced that, within the scope of this study, the Transformer classifier emerges as the most adept performer, achieving the highest values in terms of accuracy, overall detection rate, recall, and F1 score. The improved convolutional neural network CNN-GRU classifier is the second-best model, followed by the LSTM classifier, while the SVM classifier achieves the least favorable performance. Upon evaluating the performance of the trained Transformer with an unbalanced dataset, it is observed that there are decreases in accuracy, detection rate, recall, and F1 value by 1.41%, 2.56%, 3.89%, and 3.22%, respectively. A similar trend is noted across all metrics for other deep learning methods. Nevertheless, the Transformer continues to exhibit high-performance metrics overall.