## 4 Simulation Test and Result Analysis
### Test Content and Assessment Metrics  
The experimental facet of this paper encompasses three pivotal sections devised for the purpose of exploring and appraising the effectiveness and performance of distinct methodologies:  
1. Data-balancing experiments, predicated on the application of GAN-GRU, constitute the first section. This innovative methodology was employed to address dataset imbalances, and its effectiveness in performing classification tasks was explored. 2. Throughout the process of Transformer training, the 2-norm was set to 1.0, and the consequent variations in accuracy and loss values were meticulously observed across the training epochs. An in-depth analysis was undertaken to comprehensively investigate the impact of this 2-norm on the training process of the Transformer model, thereby assessing its resilience and stability. 3. Comparative experiments were conducted, involving 2-norm values ranging from 0.5 to 2.5. By systematically manipulating the 2-norm level, the performance of the models was meticulously compared across varying degrees of attack intensity. Extensive analysis was performed to identify the implications and distinctive features of these differing 2-norm levels. For the purpose of conducting a comprehensive comparison, we performed a comparative experiment in which the Transformer classifier was juxtaposed against three alternative classifiers: the enhanced CNN-GRU [28], the conventional LSTM deep learning approach [29; 30], and the SVM machine learning method [31; 32; 33]. This approach facilitates a holistic assessment of the Transformer classifier's performance and effectiveness. To expedite network convergence and mitigate the risk of overfitting, the mini-batch gradient descent technique was employed. In our model, each mini-batch encompassed 128 data samples. During each iteration, a specified number of samples were randomly selected from the training set to construct a mini-batch, which was then utilized for gradient computation and parameter updates. Following established practices in machine learning, the batch was divided into training and test sets, with three-fourths of the data allocated for training and the remaining one-fourth for testing. For model optimization, we employed the Adam optimizer with an initial learning rate of 0.001. Additionally, the patience parameter was set to five to monitor performance and enable the early termination of training when deemed appropriate. The algorithm performance was evaluated by calculating metrics using confusion matrices, including accuracy \(\lambda_{\text{Accuracy}}\), detection rate \(\lambda_{\text{Precision}}\), recall \(\lambda_{\text{Recall}}\), and the harmonized mean value of detection rate and completeness \(\lambda_{\text{FI}}\). \[\lambda_{\text{Accuracy}}=\frac{T_{\text{P}}+T_{\text{N}}}{T_{\text{P}}+T_{ \text{N}}+F_{\text{P}}+F_{\text{N}}}, \tag{19}\]  
\[\lambda_{\text{Precision}}=\frac{T_{\text{P}}}{T_{\text{P}}+F_{\text{P}}}, \tag{20}\]  
\[\lambda_{\text{Recall}}=\frac{T_{\text{P}}}{T_{\text{P}}+F_{\text{N}}}, \tag{21}\]  
\[\lambda_{\text{FI}}=\frac{2\times\lambda_{\text{Precision}}\times\lambda_{ \text{Recall}}}{\lambda_{\text{Precision}}+\lambda_{\text{Recall}}}, \tag{22}\]  
where \(T_{\text{P}}\) (true positive) indicates the number of samples with a true value of FDIA and a predicted value of FDIA; \(F_{\text{N}}\) (false negative) indicates the number of samples with a true \begin{table}
\begin{tabular}{c c c} \hline \hline
**Data Category** & **Label** & **Sample Size** \\ \hline normal operation & 0 & 3698 \\
30 attacked buses & 1 & 2400 \\
65 attacked buses & 2 & 1800 \\
100 attacked buses & 3 & 1200 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Classification and grouping of original datasets.