False data injection attack detection and positioning method based on TGRU model
Through the TGRU model combined with the feature extraction and processing of Transformer and GRU, the dual Euclidean distance mechanism and meta-model are used to solve the problem of insufficient detection accuracy and low computational efficiency in complex network environments, and the efficient Attack detection and location.
Patent Information
- Application Number
- CN202411783759.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2044-12-06
AI Technical Summary
Existing false data injection attack detection methods are insufficient in detection accuracy and low in computing efficiency in complex network environments, especially when processing high-dimensional timing data, it is difficult to accurately locate the attack source.
Using a false data injection attack detection and positioning method based on the TGRU model, preprocessing sensor data, combining Transformer's global feature extraction and time series processing of GRU, the detection threshold is set using the dual Euclidean distance mechanism, and the meta-model is passed Achieve accurate positioning of attack location.
It significantly improves the detection accuracy and positioning accuracy of false data injection attacks, reduces the computational complexity, and realizes real-time attack detection and positioning, which is better than existing methods.
Smart Images

Figure CN119272205A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of network security and data protection, and more specifically, relates to a false data injection attack detection and positioning method based on a TGRU model. Background Art
[0002] With the widespread application of information technology in various types of infrastructure, the deep integration of traditional systems and modern information technology has significantly improved management efficiency and resource utilization. However, this high degree of automation also exposes various types of automation systems to network security threats such as false data injection attacks (FDIA). FDIA affects system state estimation by manipulating sensor data, which may lead to system misjudgment, resulting in huge economic losses and security risks. Although traditional bad data detection (BDD) algorithms can effectively identify certain data anomalies, they often fail when dealing with more complex and covert attacks such as FDIA. Therefore, various types of automation systems urgently need more advanced detection and defense mechanisms.
[0003] Existing FDIA detection methods are mainly divided into two categories: model-based methods and data-driven methods. Model-based methods judge anomalies by analyzing the input and output data of the system, but their performance often depends on the accuracy and completeness of the system model. When the model is inaccurate, the detection effect will be greatly reduced. In contrast, data-driven methods use machine learning and deep learning technologies to achieve efficient fault detection through a large amount of historical data. For example, frameworks such as R2N2 and LSTM have achieved certain results in improving detection accuracy. In addition, ensemble learning methods are gradually applied to the field of network security, combining the advantages of multiple models to improve the robustness and accuracy of detection.
[0004] Chinese patent document CN118779787A discloses a method for detecting false data injection attacks on electric power based on deep learning, including: collecting the electric power data set of the power station as the original data set, and preprocessing the original data set; simulating the flow calculation process through a virtual power grid to obtain flow data, constructing a false data injection attack, and obtaining a bad data set after the attack; using a long short-term memory neural network that introduces a multi-head self-attention mechanism to establish a detection model, and using the detection model to perform attack detection on the bad data set.
[0005] Chinese patent document CN116881714A discloses a power grid false data injection detection method based on a dual-branch CNN-LSTM, which preprocesses a data set containing normal data samples and false data samples of a smart grid, and divides the preprocessed data set into a training set and a test set; constructs a dual-branch CNN-LSTM power grid false data injection detection model, and uses the divided training set to train the detection model; inputs the test set into the trained dual-branch CNN-LSTM power grid false data injection detection model to determine whether a false data injection attack occurs in the smart grid.
[0006] However, existing FDIA detection methods still have deficiencies in detection accuracy and localization capabilities, especially when dealing with complex structures and spatiotemporal correlations, making it more challenging to accurately locate the attack source.
[0007] In view of this, the present invention designs a false data injection attack detection and positioning method based on TGRU, aiming to solve the limitations of the existing technology in dealing with complex network environments, and can be applied to smart grids and other Internet of Things systems to improve the security and data integrity of the system. Summary of the invention
[0008] The present invention aims to overcome at least one defect in the prior art and provide a false data injection attack detection and positioning method based on TGRU, aiming to solve the limitations of the prior art in processing complex network environments, especially the problems of insufficient accuracy and low computational efficiency when dealing with high-dimensional time series data. SUMMARY OF THE INVENTION The present invention first pre-processes the measurement data of various sensors and inputs them into the TGRU model for training, and then performs data analysis by combining the global feature extraction capability of Transformer with the time series processing capability of GRU. The distribution of normal data and attack data is analyzed using a dual calculation mechanism based on Euclidean distance to set the detection threshold. Once an attack is detected, the system integrates the predicted data generated by the TGRU model at the current moment with the detected attack data, and trains the meta-model to accurately locate the attack position. Finally, the calculation steps are reduced by optimizing the model architecture to ensure efficient operation.
[0010] The detailed technical scheme of the present invention is as follows: A false data injection attack detection and location method based on TGRU, the method comprising: S1, obtain normal measurement data from the historical data of multiple sensors, preprocess the data, and initialize the TGRU model parameters; S2. Use the preprocessed normal measurement data to train the TGRU model: use the Transformer encoder to extract global features, and process the time series data through GRU to generate prediction values; use the Adam optimizer during training; S3. After the TGRU model training is completed, simulated attack data is generated, and a dual Euclidean distance calculation mechanism is used to calculate the Euclidean distance between the TGRU predicted value and the normal measurement data on the one hand, and the Euclidean distance between the TGRU predicted value and the generated attack data on the other hand, to form a distribution map based on the dual Euclidean distance. The distribution difference between the normal measurement data and the generated attack data is used to set a threshold to distinguish between normal data and attack data.
[0011] S4. After the attack is detected, the meta-model is trained using the TGRU’s prediction data and the detected attack data to accurately locate the attack location; S5. Repeat steps S2 to S4 to optimize the TGRU model and meta-model through multiple rounds of iterative training, continuously optimize the parameters of the TGRU model and meta-model, and set the maximum number of training rounds.
[0012] Preferably, according to the present invention, the specific steps in step S1 are as follows: S11. Data Acquisition Extract measurement data within a specific time range from the historical data of the sensor as historical measurement data, and the historical measurement data is the operation data of the automation system in a normal state, that is, normal measurement data; S12. Data preprocessing First, data cleaning is performed to remove outliers and noise caused by sensor failure, external interference, and acquisition errors. Second, missing value filling is performed. When data is lost due to sensor failure or communication problems, missing values need to be filled to ensure data integrity. Finally, normalization is performed, using Min-Max scaling to scale the data to the same range. S13. Model initialization After data preprocessing is completed, the TGRU model for false data injection attack FDIA detection needs to be initialized: First, the Transformer encoder is initialized. The Transformer encoder is used to extract the global features of the input data. The parameters of the Transformer encoder include the attention weight matrix, multi-head attention layer, and fully connected layer. Next, the GRU is initialized. The GRU is responsible for processing the dependencies of time series data. The parameters of the GRU include the input weight matrix, hidden state weight matrix, and bias term. Finally, the meta-model is initialized. The meta-model is used to locate attacks. The meta-model is a fully connected neural network used to process the combination of prediction data and attack data generated by TGRU. Preferably, according to the present invention, the specific steps in step S2 are as follows: S21, the first part of the TGRU model, the Transformer encoder extracts global features from the input data: In time series data, the Transformer calculates the correlation between each time step and other time steps through a multi-head self-attention mechanism, focusing on the most relevant information, which enables the model to consider both current and contextual information and capture complex dependencies; during training, the Transformer layer encodes normal measurement data, extracts dependencies between sensors and between different time steps, and provides a higher level of feature representation for subsequent time series processing; S22. After extracting global features, the second part of the TGRU model, GRU, processes dependencies in time series: GRU controls the flow of information through update gates and reset gates, decides which historical information to retain or discard, avoids gradient vanishing, and ensures that important timing information is captured; during training, GRU gradually processes the features generated by Transformer to generate predicted values for sensor data at the current moment.
[0013] Preferably, according to the present invention, the specific steps of step S3 are as follows: S31. Simulated attack data generation After the TGRU model training is completed, in order to compare the feature distribution of normal data and attack data and set an effective detection threshold, simulated FDIA data needs to be generated. The simulated attack data is obtained by injecting specific false data into normal data. S32. Calculation of Euclidean distance The double Euclidean distance mechanism is used for analysis to form a distribution graph based on the double Euclidean distance. First, the Euclidean distance between the predicted value of the TGRU model for each time step and the normal data is calculated. The formula is as follows: (1); In formula (1), Indicates that the TGRU model is The predicted value on a feature represents the TGRU model's estimate of the time step and the feature; Indicates the actual value measured by the sensor. The value of a feature represents the real state of the power grid at this time step, that is, normal data; The number of features representing the sensor data; Secondly, the Euclidean distance between the predicted value of the TGRU model for each time step and the simulated attack data is calculated as follows: (2); In formula (2), It represents the value of the i-th feature in the simulated attack state. It is the simulated attack data generated by injecting specific false data into normal data, which is used to help the model distinguish between normal data and attack data. S33, threshold setting The threshold is set based on the distribution graph of the double Euclidean distance. In the distribution graph, the distance distribution of normal data is usually relatively concentrated, indicating that the difference between the model predicted data and the actual measured data is small when the system is in a normal state; the distance distribution of the attack data is relatively discrete, indicating that the attack will cause a large deviation between the model predicted value and the actual value; Analyze the distance distribution of normal data and attack data, determine the distinction between the two, and set a threshold; S34. Detection Mechanism When new sensor data enters the system, the TGRU model predicts the data at the current moment and calculates the Euclidean distance between the predicted value at the current moment and the actual sensor reading. If the Euclidean distance between the predicted value at the current moment and the actual sensor reading is less than the set threshold, the data is normal data; if the Euclidean distance between the predicted value at the current moment and the actual sensor reading exceeds the set threshold, the system will issue an alarm to indicate the presence of a false data injection attack.
[0014] By combining simulated attack data and the dual Euclidean distance mechanism, the TGRU model can not only accurately predict normal data but also effectively detect false data attacks.
[0015] Preferably, according to the present invention, the specific steps of step S4 are as follows: S41. Data processing and metamodel training Once the false data injection attack FDIA is detected at the current moment, the prediction data generated by the TGRU model at the current moment will be integrated with the detected attack data to form combined data; The system then inputs these combined data into a simplified positioning model, namely the meta-model; the meta-model uses a fully connected neural network FCL to process the combined data, identifies the abnormal behavior of each sensor by analyzing the difference between the TGRU prediction value and the actual attack data, and combines the multi-label classification method to enable the meta-model to simultaneously detect the status of multiple sensors, thereby accurately locating the attacked sensor.
[0016] S42. Multi-label classification method Each sensor is regarded as an independent label, and the meta-model uses a multi-label classification method to identify and locate multiple sensors that are attacked at the same time. Through the multi-label classification method, the meta-model can detect each sensor one by one to determine whether they are attacked.
[0017] Preferably, according to the present invention, in the process of optimizing the TGRU model and the meta-model through multiple rounds of iterative training, the error between the predicted value and the normal measurement data is calculated by the loss function MSE, and then the weight parameters of the model are updated by the gradient descent algorithm. The formula is as follows: (3); In formula (3), For the TGRU model parameters after rounds of iterative training; For the TGRU model parameters in round iterative training; is the learning rate, which controls the step size of model parameter update; It is The gradient of the loss function in the training round; The loss function of the meta-model adopts the binary cross entropy loss function in the multi-label classification task to calculate the difference between the actual label and the predicted label of each sensor: (4); In formula (4), It is The actual label of the sensor, 0 means normal, 1 means attacked, is the meta-model’s predicted label for the sensor’s attack status; The meta-model updates the weight parameters according to the gradient of the loss function through the gradient descent algorithm. The formula is as follows: (5); In formula (5), For the metamodel in Weight parameters after rounds of iterative training; is the learning rate of the meta-model; is the gradient of the meta-model multi-label classification loss function.
[0018] Compared with the prior art, the present invention has the following beneficial effects: (1) The TGRU model of the present invention combines the global feature extraction capability of Transformer with the advantage of GRU in processing time series data, and can effectively capture the spatiotemporal dependencies of data, thereby significantly improving the detection accuracy of false data injection attacks. Compared with existing traditional detection methods, this model is more adaptable to complex data structures and can detect FDIA attacks with higher accuracy.
[0019] (2) The present invention can accurately locate the location of the attack while detecting the FDIA attack. By combining the real-time prediction data generated by the TGRU model with the actual attack data, a simplified positioning model, namely the meta-model, is trained. This not only improves the accuracy of attack positioning, but also reduces the computational complexity of the model, achieving real-time attack detection and positioning, which is superior to the detection and positioning separation mode in the existing methods.
[0020] (3) The present invention introduces a threshold determination method based on Euclidean distance. Through double Euclidean distance analysis, the distance between normal data and predicted data is compared, and the distance between simulated attack data and predicted data is analyzed, and finally an optimal attack detection threshold is found. This method improves accuracy and reliability in the detection process.
[0021] (4) The present invention reduces the reliance on expert experience through a data-driven approach. Existing methods often require experts to conduct in-depth analysis of the system, while the TGRU model automatically identifies anomalies and attacks through data training, which simplifies the operation process and improves the degree of automation of detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 It is a flow chart of the false data injection attack detection and positioning method based on the TGRU model described in the present invention.
[0023] Figure 2 It is a Euclidean distance distribution diagram of normal and attack data based on the TGRU model of the present invention.
[0024] Figure 3 It is the change curve of precision, recall rate and F1 value under different thresholds of the present invention. DETAILED DESCRIPTION
[0025] The present disclosure is further described below in conjunction with the accompanying drawings and embodiments. This method is applicable to a variety of sensor networks and complex network environments. For ease of explanation, the following embodiments are described in detail using a smart grid scenario as an example.
[0026] Embodiment 1, Ginseng Figure 1This embodiment provides a method for detecting and locating a false data injection attack in a smart grid based on a TGRU model, the method comprising: S1, obtain historical measurement data from multiple sensors of the smart grid, preprocess the data, and initialize the TGRU model parameters; Here is a detailed description of the process: S11. Data Acquisition The sensors in the smart grid are responsible for collecting the electrical parameters of each node. These parameters are stored in the database of the power grid in the form of time series for system state estimation and safety detection. In order to detect false data attacks FDIA, sensor measurement data within a specific time range is extracted from historical data. These historical measurement data are the operating data of the automation system in normal state, that is, normal measurement data.
[0027] These sensor data usually have multi-dimensional features, such as voltage (V), current (I), active power (P), reactive power (Q), etc. These multi-dimensional time series data provide sufficient information for detecting false data. However, due to the complexity of smart grids and possible measurement errors of sensors, the acquired raw data often needs to be further processed before it can be used for model training.
[0028] S12. Data preprocessing Before model training, sensor data needs to go through a series of preprocessing steps to improve data quality and model learning effect. First, data cleaning is performed. This step reduces the bias of the model by removing outliers and noise caused by sensor failure, external interference or acquisition errors. Secondly, missing value filling is performed. When the sensor loses data due to failure or communication problems, the missing values need to be filled to ensure data integrity. Finally, normalization is performed. In order to balance the magnitude differences of different features, Min-Max scaling is used to scale the data to the same range.
[0029] S13. Model initialization After data preprocessing is completed, the TGRU model for false data attack FDIA detection needs to be initialized. The TGRU model combines the advantages of Transformer and GRU, and can capture global features and process time series dependencies at the same time.
[0030] First, the Transformer encoder is initialized. The Transformer encoder is used to extract the global features of the input data. The parameters of the Transformer encoder include the attention weight matrix, multi-head attention layer and fully connected layer. Next is the initialization of GRU. GRU is responsible for processing the dependencies of time series data. The parameters of GRU include the input weight matrix, hidden state weight matrix and bias term. Finally, the meta-model is initialized. The meta-model is used to locate attacks. The meta-model is a fully connected neural network used to process the combination of prediction data and attack data generated by TGRU.
[0031] S2, train the pre-processed historical sensor data through the TGRU model, use the Transformer encoder to extract global features, and process the time series data through GRU to generate prediction results; In the TGRU model, model training mainly relies on historical sensor data for fitting, and the training data set only contains normal operating data to ensure that the model can accurately identify and predict the normal state of the power grid. By combining the advantages of Transformer and GRU, the TGRU model can efficiently process multi-dimensional time series data in the power grid. The following is a detailed description of this process: S21. Selection of model training data During the training process of the TGRU model, only historical normal measurement data is used to ensure that the model can accurately learn the characteristic patterns of the system in a normal state. The selection of these normal data is particularly important because they directly affect the model's ability to recognize normal behavior.
[0032] To this end, sensor measurement data over a long period of time is selected to ensure that the data covers various normal operating states of the system, such as data under different loads, different time periods, and different operating conditions. This helps the model capture the global characteristics and temporal dependencies of the system under normal conditions.
[0033] S22. Time series feature learning and prediction based on TGRU model The first part of the TGRU model is the Transformer encoder, which is responsible for extracting global features from the input data. In time series data, the Transformer calculates the correlation of each time step with other time steps through a multi-head self-attention mechanism to focus on the most relevant information. This enables the model to consider both current and contextual information and capture complex dependencies. During training, the Transformer layer encodes historical sensor data, extracts dependencies between sensors and different time steps, and provides a higher level of feature representation for subsequent time series processing.
[0034] After extracting global features, the second part of the TGRU model, GRU, processes dependencies in the time series. GRU controls the flow of information through update gates and reset gates, deciding which historical information to keep or discard, avoiding gradient vanishing, and ensuring that important time series information is captured. During training, GRU gradually processes the features generated by Transformer to generate predictions for the sensor data at the current moment.
[0035] S3. After the training is completed, combined with the simulated attack data, a dual Euclidean distance calculation mechanism is used to calculate the Euclidean distance between the TGRU predicted data and the normal data on the one hand, and the Euclidean distance between the TGRU predicted data and the attack data on the other hand. The distribution difference between normal data and attack data is used to set the threshold to distinguish normal data from attack data.
[0036] After the TGRU model training is completed and the prediction of the normal state is generated, it is necessary to use a small amount of historical attack data to further optimize the model to improve the detection ability of FDIA. To this end, this paper adopts a dual Euclidean distance calculation mechanism to calculate the distance between the TGRU prediction data and the normal data and the attack data respectively, and analyzes the distribution difference of these two distances and sets a suitable threshold to distinguish between normal data and attack data. The following is a detailed description of this process: S31. Simulated attack data generation In smart grids, historical attack data are usually scarce, but they are of great significance to the optimization of detection models. By selecting some known false data to inject attack samples, the TGRU model can better learn the feature differences between normal measurement data and attack data: After the TGRU model is trained, simulated FDIA data needs to be generated to compare the feature distribution of normal data and attack data and set an effective detection threshold. The simulated attack data is obtained by performing specific false data injection operations on normal data, such as injecting deviations on key sensor readings, tampering with specific feature values or system states, to affect the model's judgment of the system state.
[0037] Assume that the sensor data is normally ,in represents the reading of the ith sensor in normal state, and n is the number of sensors.
[0038] In order to generate attack data, the data of key sensors are tampered to generate attack data ,in represents the observation value of the i-th sensor in the attack state. The generation of attack data can be expressed as in, To add to normal data The deviation term on The size and direction of can be set by the attacker. The deviation term can be generated based on different strategies, such as fixed value deviation, random deviation or noise perturbation.
[0039] S32. Calculation of Euclidean distance The TGRU model has formed a prediction of the power grid state based on normal measurement data. After the model training is completed, simulated attack data is introduced and analyzed using a dual Euclidean distance mechanism. Specifically, the Euclidean distance is used to measure the similarity between two vectors. The larger the distance, the greater the difference between the data points.
[0040] The dual Euclidean distance calculation mechanism consists of two parts: Distance calculation for normal measurement data: First, calculate the Euclidean distance between the predicted value of the TGRU model for each time step and the normal measurement data. This distance can reflect the deviation between the prediction of the TGRU model and the normal measurement data under normal conditions. Usually, this distance should be small, indicating that the model's prediction of normal data is accurate.
[0041] The Euclidean distance formula is as follows: (1); In formula (1), Indicates that the TGRU model is The predicted value on the feature represents the model's estimate of the time step and the feature. Indicates the actual value measured by the sensor. The value of a feature represents the true state of the power grid at this time step. Represents the dimensionality of the data, or the number of features of the sensor data.
[0042] Distance calculation of simulated attack data: Secondly, the Euclidean distance between the TGRU prediction value and the simulated attack data is calculated. Since the simulated attack data deviates from the normal grid state, the distance between the prediction result and these attack data is usually large. This can help the model distinguish the attack data from the normal measurement data.
[0043] The Euclidean distance formula for simulated attack data is: (2); In formula (2), It represents the observed value of the i-th feature under the simulated attack state. It is the simulated attack data generated by performing a specific false data injection operation on normal data, which is used to help the model distinguish between normal data and attack data.
[0044] S33, threshold setting The threshold is set based on the distribution graph of the double Euclidean distance. In this distribution graph, the distance distribution of normal measurement data is usually relatively concentrated, indicating that when the system is in a normal state, the difference between the model prediction data and the normal measurement data is small. The distance distribution of attack data is relatively discrete, indicating that the attack will cause a large deviation between the model prediction data and the attack data. By analyzing the distance distribution of these two types of data, the distinction between the two can be determined, so as to find a reasonable threshold. If the Euclidean distance between the predicted data and the measured data of the TGRU model exceeds this set threshold, the system considers that the measurement data at the current moment is under attack, and then triggers the corresponding protection mechanism.
[0045] Through this threshold setting based on distance distribution, the system can accurately identify false data injection attacks and effectively improve the security and reliability of smart grids. During the detection process, the system can monitor the data of each time step in real time and respond promptly based on the difference between it and the model prediction value.
[0046] S34. Detection Mechanism Once the threshold of the Euclidean distance is set, the TGRU model can be used for online detection. When new sensor data enters the system, the TGRU model predicts the measured data at the current moment and calculates the Euclidean distance between the predicted data and the sensor measured data. If the distance is less than the set threshold, the measured data is judged to be normal; if the distance exceeds the threshold, the system will issue an alarm, indicating that there is a false data injection attack.
[0047] By combining simulated attack data and the dual Euclidean distance mechanism, the TGRU model can not only accurately predict normal data but also effectively detect attack data.
[0048] S4. After the attack is detected, the meta-model is trained using the TGRU’s prediction data and the detected attack data to accurately locate the attack location; When the TGRU model successfully detects FDIA, the system enters the attack location location phase. In order to accurately determine the attack location, this paper proposes a meta-model. The meta-model is trained by combining the prediction data of the TGRU model with the attack data to accurately locate the attack location. The following is a detailed description of this process: S41. Data processing and metamodel training Once an FDIA is detected, the prediction data generated by the TGRU model will be integrated with the detected attack data. The purpose of this process is to combine the model's prediction results with the attack data to form a more comprehensive data set. These combined data sets contain the differences between the prediction data and the attack data, reflecting the impact of potential attacks. This difference can help the model better understand which sensors have been attacked. After the data is combined, the system will input the combined data into a simplified positioning model, namely the meta-model. The meta-model uses a fully connected neural network FCL to process the combined data and learn how to locate the location of the attack by observing the difference between the predicted value and the actual value.
[0049] The design of the meta-model not only simplifies the attack location process, but also significantly reduces the computational complexity. Compared with other complex deep learning models, the TGRU meta-model can reduce the consumption of computing resources while ensuring high positioning accuracy by simplifying the architecture and optimizing the data processing process. This optimization enables the meta-model to operate efficiently in the actual smart grid environment with limited resources.
[0050] The core goal of this meta-model is to find the abnormal behavior of specific sensors by analyzing the difference between the prediction data and attack data generated by TGRU, so as to accurately locate the location of the attack. Due to the large number of sensors in the smart grid, the data of each sensor will be treated as an independent label. Through multi-label classification, the meta-model can simultaneously identify whether the data of multiple sensors has been attacked.
[0051] S42. Multi-label classification method The multi-label classification method used by the meta-model is a classification problem that can handle multiple labels at the same time. In the scenario of smart grid, each sensor can be regarded as an independent label. If multiple sensors are attacked at the same time, multi-label classification can effectively identify and locate them.
[0052] Through multi-label classification, the meta-model can detect each sensor one by one to determine whether they are attacked. This method greatly improves the accuracy of attack location and can handle complex multi-point attack scenarios. Especially in large-scale smart grids, locating multiple attack points becomes particularly important.
[0053] S5, repeat steps S2 to S4 to continuously optimize the parameters of the TGRU model and meta-model; After completing the initial training of the TGRU model and attack detection and location, this step further improves the accuracy and robustness of the model through multiple rounds of repeated training and parameter optimization to ensure that efficient performance can be maintained under different power grid operating environments and multiple attack situations. The process is described in detail as follows: S51, iterative training In this step, the TGRU model and meta-model will be optimized through multiple rounds of iterative training. In each round of iterative training, the system will use historical normal measurement data and simulated attack data to train and update model parameters.
[0054] The TGRU model is trained using historical normal measurement data to generate a prediction of the system state at the current moment. The system optimizes the model parameters by comparing the difference between the TGRU model's prediction data and normal measurement data.
[0055] The optimization process calculates the error between the predicted value and the normal measured data through the loss function MSE, and then updates the weight parameters of the model through the gradient descent algorithm: (3); In formula (3), For the TGRU model parameters after round training; For the Model parameters in rounds of training; is the learning rate, which controls the step size of model parameter update; It is The gradient of the loss function during the training round.
[0056] With each round of training, the TGRU model gradually learns the normal operating mode of the smart grid.
[0057] In addition to the training of the TGRU model, in each round of training, the meta-model is trained as a multi-label classification model using the prediction data of the TGRU model and the simulated attack data. The goal of the meta-model is to accurately locate multiple sensors that may be attacked by analyzing the differences between normal prediction data and simulated attack data.
[0058] The input data of the meta-model includes the predicted values of the TGRU model (normal data) and the simulated attack data, and the attack status of the sensor is identified through a multi-label classification method. The loss function of the meta-model adopts the binary cross entropy loss function in the multi-label classification task to calculate the difference between the actual label and the predicted label of each sensor: (4); In formula (4), It is The actual label of each sensor (0 means normal, 1 means attacked), is the meta-model's predicted label for the sensor's attack status.
[0059] The meta-model updates the weight parameters according to the gradient of the loss function through the gradient descent algorithm: (5); In formula (5), For the metamodel in Weight parameters after round training; is the learning rate of the meta-model; is the gradient of the meta-model multi-label classification loss function.
[0060] During the training process, when the loss function of the model tends to be stable after multiple rounds of training, that is, the change range is extremely small, it indicates that the optimization process of the model has been basically completed, and further training will have limited effect on improving model performance. At the same time, in order to prevent the model from falling into overfitting, the system usually sets a maximum training round. Even if the loss function and performance indicators are not completely stable, the system will automatically stop training after reaching the set round.
[0061] S52, obtaining detection threshold After each round of training, the system will dynamically adjust the detection threshold of the Euclidean distance based on the results of the new round of training. By calculating the Euclidean distance distribution between the predicted data of the TGRU model and the normal measurement data and attack data, the system can reset the optimal threshold to ensure that normal measurement data and attack data can be effectively distinguished.
[0062] The core of this process is that the system adaptively adjusts the threshold to adapt to different attack modes and grid operation status, reducing false positives and false negatives. After each round of training, the system calculates a new detection threshold based on the new distance distribution, and determines the final detection threshold after the training is completed. In this way, the model can respond more flexibly to the dynamically changing grid environment.
[0063] Experimental example This application is experimentally compared. Here are some basic settings for the experiment: The performance of the proposed TGRU-based model is evaluated based on multiple experimental results. The simulation results are performed on the IEEE 14-node power grid model. The simulation environment uses the MATPOWER setting and is compared with the Transformer, CNN-Transformer, and CNN models. At the same time, an hourly power grid dataset is used. The attack vector dataset used is generated by the formal model, which aims to avoid the detection of the BDD system by modifying the sensor data, thereby causing significant deviations in the power grid state. In this study, 90% of the dataset is used for training and the remaining 10% is used for testing. The experiments were conducted on a system equipped with an NVIDIA GeForce GTX 1650 graphics card.
[0064] In the experimental part, the performance of the TGRU model in the FDIA detection and positioning tasks in smart grids was comprehensively evaluated, and compared with other models, including CNN, CNN-Transformer and Transformer. The experiment is mainly divided into four parts: prediction accuracy evaluation, attack detection effect analysis and attack positioning experiment, covering the performance and advantages of the model at different stages.
[0065] In the prediction accuracy evaluation part, normal data is used for training and the measurement data of the future time is predicted. In order to evaluate the prediction performance, MSE, RMSE and MAE are used as measurement indicators. Table 1 shows the prediction performance comparison results of the TGRU model and other models including Transformer, CNN-Transformer, and CNN: Table 1 Performance comparison of different models in false data injection attack detection
[0066] The experimental results show that TGRU performs well in all three evaluation indicators. Specifically, the RMSE of TGRU is 1.4662, which is significantly lower than CNN's 11.5126 and Transformer's 12.0760, indicating that it is more accurate in capturing complex data patterns. In addition, the MSE of TGRU is 3.3931, which is significantly better than CNN's 246.7321 and Transformer's 273.0599. These data show that TGRU has obvious advantages in processing large-scale normal power grid measurement data, and although CNN-Transformer has improved in some indicators, its prediction accuracy is still not as good as TGRU. By combining the global dependency extraction capability of Transformer with the temporal processing advantage of GRU, the TGRU model significantly reduces the computational complexity while improving the prediction accuracy. This architectural optimization enables the TGRU model to more effectively deal with the detection and location problems of false data injection attacks in smart grids.
[0067] like Figure 2 As shown, in order to evaluate the detection effect of the TGRU model, 120 simulated false data samples were generated, and 90% of them were injected into normal measurement data. By analyzing the data distribution after the attack injection, it was found that when the threshold was set to 0.4, the TGRU model could effectively distinguish normal data from attack data, thereby achieving accurate detection effect. In the attack detection effect analysis part, the present invention verifies the effectiveness of the found threshold in dealing with unknown attacks. The present invention uses all the generated attack vectors for testing, and evaluates its performance under unknown attacks by adjusting the threshold from 0 to 1 with an interval of 0.1. The experimental results are shown in Figure 3As shown in the figure, when the threshold value of the TGRU model is between 0.4 and 0.6, the precision, recall rate and F1 score are all close to 1.0. In particular, at the threshold value of 0.4, all three indicators reach 0.9964, showing strong robustness and adaptability.
[0068] In the attack location task, this paper compares the performance of each model in the task of locating the attack location, as shown in Table 2. These experiments were conducted after confirming that the data contained attack behaviors: Table 2 Comparison of model performance and training time of different models in attack localization tasks Model Precision Time(s) CNN 0.9971 202.78 CNN-Transformer 0.9967 249.14 Transformer 0.9990 305.15 TGRU Metamodel 0.9982 116.82 The experimental results show that the Transformer model performs best with an accuracy of 0.9990, but its complex architecture leads to higher computing resource requirements and a longer training time of 305.15 seconds. In contrast, the TGRU model also performs well with an accuracy of 0.9982, and its training time is significantly shorter at 116.82 seconds, making it suitable for application in resource-constrained environments.
[0069] The CNN model has an accuracy of 0.9971 in the localization task, but the training time is longer, 202.78 seconds, and the performance is not as good as TGRU and Transformer. The CNN-Transformer model performs the worst.
[0070] The TGRU model shows more balanced advantages in accuracy, training time, and resource consumption, and is suitable for resource-constrained environments, while the Transformer model has a slight advantage in accuracy but requires higher computing resource support.
[0071] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the technical solution of the present invention, and are not intended to limit the specific implementation methods of the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the claims of the present invention shall be included in the protection scope of the claims of the present invention.
Claims
1. A false data injection attack detection and location method based on TGRU, characterized in that: The method comprises: S1, obtain normal measurement data from the historical data of multiple sensors, preprocess the data, and initialize the TGRU model parameters; S2. Use the preprocessed normal measurement data to train the TGRU model: use the Transformer encoder to extract global features, and process the time series data through GRU to generate prediction values; use the Adam optimizer during training; S3. After the TGRU model training is completed, simulated attack data is generated, and a dual Euclidean distance calculation mechanism is used to calculate the Euclidean distance between the TGRU prediction value and the normal measurement data, and the Euclidean distance between the TGRU prediction value and the generated attack data, to form a distribution map based on the dual Euclidean distance. The distribution difference between the normal measurement data and the generated attack data on the distribution map is used to set a threshold to distinguish between normal data and attack data. S4. After the attack is detected, the meta-model is trained using the TGRU’s prediction data and the detected attack data to accurately locate the attack location; S5. Repeat steps S2 to S4 to optimize the TGRU model and meta-model through multiple rounds of iterative training, continuously optimize the parameters of the TGRU model and meta-model, and set the maximum number of training rounds.
2. The false data injection attack detection and location method based on TGRU according to claim 1 is characterized in that: The specific steps in step S1 are as follows: S11. Data Acquisition Extract measurement data within a specific time range from the historical data of the sensor as historical measurement data, and the historical measurement data is the operation data of the automation system in a normal state, that is, normal measurement data; S12. Data preprocessing First, data cleaning is performed to remove outliers and noise caused by sensor failure, external interference, and acquisition errors. Second, missing values are filled. Finally, normalization is performed and Min-Max scaling is used to scale the data to the same range; S13. Model initialization After data preprocessing is completed, the TGRU model for false data injection attack FDIA detection needs to be initialized: First, the Transformer encoder is initialized. The Transformer encoder is used to extract the global features of the input data. The parameters of the Transformer encoder include the attention weight matrix, multi-head attention layer and fully connected layer. Next is the initialization of GRU. GRU is responsible for processing the dependencies of time series data. The parameters of GRU include the input weight matrix, hidden state weight matrix and bias term. Finally, the meta-model is initialized. The meta-model is used to locate attacks. The meta-model is a fully connected neural network used to process the combination of prediction data and attack data generated by TGRU.
3. The false data injection attack detection and location method based on TGRU according to claim 1 is characterized in that: The specific steps in step S2 are as follows: S21, the first part of the TGRU model, the Transformer encoder extracts global features from the input data: in time series data, the Transformer calculates the correlation between each time step and other time steps through a multi-head self-attention mechanism, focusing on the most relevant information; During the training process, the Transformer layer encodes the normal measurement data, extracts the dependencies between sensors and different time steps, and provides a higher-level feature representation for subsequent time series processing; S22. After extracting global features, the second part of the TGRU model, GRU, processes dependencies in the time series: GRU controls the flow of information through update gates and reset gates to decide which historical information to retain or discard; during training, GRU gradually processes the features generated by Transformer to generate predicted values for the sensor data at the current moment.
4. The false data injection attack detection and location method based on TGRU according to claim 1 is characterized in that: The specific steps of step S3 are as follows: S31. Simulated attack data generation Perform specific false data injection operations on normal data to obtain simulated attack data; S32. Calculation of Euclidean distance The double Euclidean distance mechanism is used for analysis to form a distribution graph based on the double Euclidean distance. First, the Euclidean distance between the predicted value of the TGRU model for each time step and the normal data is calculated. The formula is as follows: (1); In formula (1), Indicates that the TGRU model is The predicted value on a feature represents the TGRU model's estimate of the time step and the feature; Indicates the actual value measured by the sensor. The value of a feature represents the real state of the power grid at this time step, that is, normal data; The number of features representing the sensor data; Secondly, the Euclidean distance between the predicted value of the TGRU model for each time step and the simulated attack data is calculated as follows: (2); In formula (2), It represents the value of the i-th feature in the simulated attack state, which is the simulated attack data generated by injecting specific false data into normal data; S33, threshold setting The threshold is set based on a distribution diagram of double Euclidean distance, in which the distance distribution of normal data is relatively concentrated, while the distance distribution of attack data is relatively discrete; Analyze the distance distribution of normal data and attack data, determine the distinction between the two, and set a threshold; S34. Detection Mechanism When new sensor data enters the system, the TGRU model predicts the data at the current moment and calculates the Euclidean distance between the predicted value at the current moment and the actual sensor reading. If the Euclidean distance between the predicted value at the current moment and the actual sensor reading is less than the set threshold, the data is normal data; if the Euclidean distance between the predicted value at the current moment and the actual sensor reading exceeds the set threshold, the system will issue an alarm to indicate the presence of a false data injection attack.
5. The false data injection attack detection and location method based on TGRU according to claim 1 is characterized in that: The specific steps of step S4 are as follows: S41. Data processing and metamodel training Once the false data injection attack FDIA is detected at the current moment, the prediction data generated by the TGRU model at the current moment will be integrated with the detected attack data to form combined data; The system then inputs these combined data into a simplified positioning model, namely the meta-model; the meta-model uses a fully connected neural network FCL to process the combined data, identifies the abnormal behavior of each sensor by analyzing the difference between the TGRU prediction value and the actual attack data, and combines the multi-label classification method to enable the meta-model to simultaneously detect the status of multiple sensors, thereby accurately locating the attacked sensor. S42. Multi-label classification method Each sensor is considered as an independent label, and the meta-model uses a multi-label classification method to identify and locate multiple sensors that are attacked simultaneously.
6. The false data injection attack detection and location method based on TGRU according to claim 3 is characterized in that: In the process of optimizing the TGRU model and the meta-model through multiple rounds of iterative training, the error between the predicted value and the normal measurement data is calculated by the loss function MSE, and then the weight parameters of the model are updated by the gradient descent algorithm. The formula is as follows: (3); In formula (3), For the TGRU model parameters after rounds of iterative training; For the TGRU model parameters in round iterative training; is the learning rate, which controls the step size of model parameter update; It is The gradient of the loss function in the training round; The loss function of the meta-model adopts the binary cross entropy loss function in the multi-label classification task to calculate the difference between the actual label and the predicted label of each sensor: (4); In formula (4), It is The actual label of the sensor, 0 means normal, 1 means attacked, is the metamodel’s predicted label for the sensor’s attack status; The meta-model updates the weight parameters according to the gradient of the loss function through the gradient descent algorithm. The formula is as follows: (5); In formula (5), For the metamodel in Weight parameters after rounds of iterative training; is the learning rate of the meta-model; is the gradient of the meta-model multi-label classification loss function.
Citation Information
Patent Citations
Power grid false data injection detection method and device based on double-branch CNN-LSTM
CN116881714A
Small-sample false data injection attack detection method based on siamese network
CN113612733A
Power grid false data injection attack detection method of artificial intelligence four-layer architecture
CN115834161A
Space-time detection method for power grid false data injection attack
CN116578903A
Unmanned aerial vehicle power system parameter anomaly detection method based on correlation parameter mapping
CN117291094A
Cited By
Multi-label positioning detection-oriented adversarial false data injection disturbance generation method
CN121441639A