False data injection attack detection and positioning method based on physical constraint and adaptive threshold
通过在虚假数据注入攻击检测中引入物理约束和自适应阈值生成机制,结合WGAN、LSTM和CNN-Transformer模型,解决了现有技术中检测精度和定位能力不足的问题,实现了更高效和准确的FDIA检测与定位。
Patent Information
- Application Number
- CN202510360779.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-26
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2045-03-26
AI Technical Summary
The existing False Data Injection Attack (FDIA) detection methods have shortcomings in detection accuracy, robustness and positioning capabilities, especially in the face of dynamic changes in the system and complex spatiotemporal correlations, it is difficult to generate high-quality data that meets physical constraints, and it is difficult to accurately locate the attack source.
Using detection methods based on physical constraints and adaptive thresholds, synthetic data that conforms to physical laws is generated by generating adversarial networks (WGANs), and the long and short-term characteristics of the time series are captured in combination with LSTM. The CNN-Transformer model is used to perform global feature extraction and dynamic threshold generation, and combined with the dynamic detection mechanism of quantiles, the distribution of normal data is analyzed and the potential attack sources are accurately located.
It significantly improves the detection and positioning capabilities of false data injection attacks, improves the accuracy and robustness of detection, and can efficiently identify and locate FDIA in complex environments, reducing the risk of false alarms and underreports.
Smart Images

Figure CN119892499A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of data analysis and network security, and specifically relates to a false data injection attack (FDIA) detection and positioning method based on physical constraints and adaptive thresholds, which is particularly suitable for a variety of sensor-based network systems. Background Art
[0002] With the widespread application of various intelligent monitoring and control systems (ICS, Industrial Control Systems) based on information and communication technology (ICT) in critical infrastructure, the real-time performance and automation level of these systems have been significantly improved. However, this highly integrated system also brings new security threats, especially false data injection attacks (FDIA, False Data Injection Attack). FDIA tampers with the measurement data in the system, misleading the state estimation, thereby affecting the normal operation and decision-making scheduling of the system.
[0003] Traditional residual-based Bad Data Detection (BDD) methods identify abnormal data by detecting the difference between measured data and predicted values in system state estimation. However, FDIA can bypass traditional residual detection mechanisms by carefully designing attack vectors so that the injected false data is almost indistinguishable from normal data. These attacks are called "covert FDIA" because they can adjust the structure of the attack data so that the residual of the state estimate remains within the normal range, making the attack undetectable. Therefore, various sensor-based critical infrastructure systems are in urgent need of more advanced detection and defense mechanisms.
[0004] Existing FDIA detection methods are mainly divided into two categories: model-based methods and data-driven methods. Model-based methods rely on the physical and mathematical models of the system and detect false data injection by comparing the deviation between the actual measured values and the predicted values. However, the effectiveness of such methods is limited by the accuracy and completeness of the system model. Once the model parameters change or are incomplete, the accuracy of the detection results will drop significantly. In contrast, data-driven methods use machine learning and deep learning techniques, especially generative adversarial networks (GANs), autoencoders (AEs), etc., to detect abnormal data by learning from historical data. These methods can automatically extract features from data and do not rely on the precise model of the system. Therefore, they have stronger adaptability and robustness when facing complex and dynamically changing systems.
[0005] For example, Chinese patent document CN113094702A discloses a false data injection attack detection method and device based on LSTM network, which specifically discloses: obtaining the state value of each node in the distribution network in real time to generate historical state value data; using the trained LSTM state prediction model to process the historical state value data to obtain the state prediction value of each node at the next moment; obtaining the actual state value of each node at the next moment, comparing the state prediction value and the state measured value according to a preset mean square error, and obtaining the false data injection attack detection result.
[0006] Chinese patent document CN116886351A discloses a false data injection attack simulation and detection method, device, equipment and medium, which specifically discloses: collecting original time series data monitored by sensors of aircraft engines; screening the data length of the collected original time series data to obtain preliminary screening time series data that meets preset requirements, and preprocessing the preliminary screening time series data to obtain target time series data; simulating continuous false data injection attacks and interval false data injection attacks for each target time series data respectively, to obtain continuous false data and interval false data corresponding to the target time series data; setting type labels for each target time series data, continuous false data and interval false data respectively, and then dividing them into training sets and test sets; constructing an LSTM network, using the training set to train the LSTM network to obtain a trained LSTM network; inputting the test set into the trained LSTM network, outputting the predicted category label, and evaluating the predicted effect.
[0007] However, existing anomaly detection methods still have some shortcomings when dealing with FDIA, especially in terms of detection accuracy, robustness, and positioning capabilities. Traditional methods often rely on fixed thresholds or static models, which show great limitations when faced with dynamic changes in the system and complex spatiotemporal correlations. First, it is difficult for existing methods to generate high-quality data that meets physical constraints, resulting in the inability to effectively reflect the actual operating status of the system during model training. Secondly, many detection algorithms fail to fully utilize the temporal characteristics of the data and lack the capture of long-term dependencies, resulting in insufficient response speed and accuracy to sudden attacks. In addition, when dealing with complex system structures and dynamic changes, existing methods are often unable to accurately locate the source of the attack, resulting in high false positive and false negative rates.
[0008] Based on this, there is an urgent need for a detection method that can generate data that conforms to the physical laws of the system and dynamically adjust the detection threshold to meet the above challenges. Summary of the invention
[0009] The present invention aims to overcome several defects in the prior art and provide a FDIA detection and positioning method based on physical constraints and adaptive thresholds, which is particularly suitable for the detection and positioning of FDIA in various critical infrastructure systems based on sensor data; the method combines physical constraints with timing characteristics, utilizes adaptive threshold generation and dynamic detection mechanisms, and can effectively identify false data and accurately locate the source of attack, thereby improving the accuracy and robustness of anomaly detection.
[0010] The detailed technical scheme of the present invention is as follows: A false data injection attack detection and location method based on physical constraints and adaptive thresholds. First, the measurement data of multiple sensors is preprocessed and input into the WGAN framework embedded based on physical constraints and time conditions for training. WGAN generates high-quality synthetic data that conforms to physical laws and combines LSTM to capture the long-term and short-term characteristics of time series. Subsequently, the CNN-Transformer model is used for global feature extraction and dynamic threshold generation, and the distribution of normal data is analyzed in combination with a dynamic detection mechanism based on quantiles to accurately locate potential attack sources. Finally, the accuracy and efficiency of detection and location are improved by cyclically optimizing the model architecture and parameters.
[0011] The method specifically comprises: S1. Acquire historical measurement data from multiple sensors, and preprocess the historical measurement data to obtain normal data samples; S2, initializing the parameters of the generator and the discriminator of the generative adversarial network WGAN, and performing model training on the generative adversarial network WGAN in combination with the time condition embedding and the physical constraint loss function, so that the generator generates synthetic data samples that conform to the physical laws of the system based on the normal data samples; S3, initializing the parameters of the LSTM model, first pre-training the LSTM model using the synthetic data sample, then optimizing the parameters of the pre-trained LSTM model in combination with actual data, and extracting the time series features of the normal data sample using the optimized LSTM model; S4, initializing the parameters of the CNN-Transformer model, inputting the time series features extracted by the LSTM model and the normal data sample as a data combination into the CNN-Transformer model, extracting the local time series features of the input data combination through the CNN model, and capturing the global time series evolution characteristics of the input data combination through the Transformer model, so as to generate a dynamic threshold; S5. Optimize the interval range of the dynamic threshold based on the quantile loss function, monitor the measurement data of the sensor to be detected based on the optimized dynamic threshold, compare the preprocessed measurement data of the sensor to be detected with the interval range of the dynamic threshold, and if it exceeds the interval range of the dynamic threshold, it is determined that an attack exists.
[0012] Preferably, according to the present invention, in S1, preprocessing the historical measurement data specifically includes: Performing data cleaning on the historical measurement data to remove abnormal values therein; Performing time alignment on the cleaned historical measurement data to make the time mark of each data point consistent; The aligned historical measurement data are processed by Z-score standardization to adjust all data to the same scale range; Among them, the formula for Z-score standardization is: (1); In formula (1): represents the data before normalization; represents the mean of the data; represents the standard deviation of the data, Represents the normalized data.
[0013] Preferably, according to the present invention, in S2, a weight initialization method based on prior knowledge is used to initialize the generator and the discriminator of the generative adversarial network WGAN; And when training the model, physical constraints are introduced: (2); In formula (2): Indicates the total generated power in MW; Indicates the total load power generated in MW; represents the generated transmission loss in MW; Define the physical constraint loss function for: (3); In formula (3): It represents the physical constraint loss and uses the L2 norm to measure the deviation from power conservation to ensure power conservation; The intermediate loss function of the generator considers the combination of physical constraints and WGAN loss, namely: (4); In formula (4): Represents the intermediate loss function of the generator; represents the WGAN loss of the generator, which is used to constrain the data distribution; is a hyperparameter used to adjust the weight of the physical constraint loss in the generator optimization process; The total loss function of the generator adds the temporal consistency loss to its intermediate loss function, namely: (5); In formula (5): represents the total loss function of the generator; Represents the time consistency loss, which is used to ensure the time dynamic consistency; is a hyperparameter; The temporal consistency loss for: (6); In formula (6): Indicates the generation of data; Indicates the real data at this time point The mean of makes GAN closer to the real data in the time dimension. , Represents a time condition, which is a discrete time point in a 24-hour day.
[0014] Preferably, in S2, the time condition embedding uses one-hot encoding to convert the time information of 24 hours a day into a 24-dimensional vector; in the model structure, the time condition embedding is used as the input of the generator and the discriminator in the generative adversarial network WGAN, wherein the input of the generator By random noise ηand time embedding composition: (7); Input to the discriminator From normal data samples and time embedding composition: (8).
[0015] Preferably, in S3, the weight of the LSTM model is initialized by uniform distribution, and its bias is initialized to zero; when the LSTM model is pre-trained, its input is a synthetic data sample, and its output is a time series value of the next time step; the pre-training objective function of the LSTM model is for: (9); In formula (9): Represents the true time series value corresponding to the next time step in the synthetic data sample; Represents the time series value of the next time step predicted by the LSTM model.
[0016] Preferably, in S4, the parameters of the CNN-Transformer model are initialized using Kaiming initialization and Xavier initialization; the time series features extracted by the LSTM model and the normal data samples are input into the CNN-Transformer model as a data combination, that is: (10); In formula (10): Represents the input of the CNN-Transformer model; Represents the time series features extracted by the LSTM model; represents a normal data sample.
[0017] Preferably, in S4, the local temporal features of the input data combination are extracted through the convolution layer of the CNN model, and the convolution operation is expressed as: (11); In formula (11): Represents the convolution operation; Represents the local temporal features extracted by the CNN model; represents the activation function; Represents the convolution kernel of the convolution layer.
[0018] Preferably, in S4, the Transformer model captures the global temporal evolution characteristics of the input data combination through a self-attention mechanism, and the self-attention mechanism is expressed as: (12); In formula (12): Represents a query, which is used to query the correlation between time steps; Represents the key, used to calculate similarity; Represents the value matrix, containing the original feature information; Represents the output of the self-attention mechanism, which is a weighted representation of the global temporal features, capturing the long-term dependencies between time steps in the time series.
[0019] Preferably, in S5, two independent CNN-Transformer models are used to adjust the upper limit and lower limit of the dynamic threshold respectively, wherein the upper limit of the prediction is adjusted by minimizing the quantile loss function, and the lower limit of the prediction is optimized by the quantile loss function; the quantile loss function is: (13); In formula (13): represents the quantile loss function; Represents the predicted value of the CNN-Transformer model; represents the true value; is the set quantile; Represents the number of training samples, that is, the total number of eigenvalues of normal data samples.
[0020] Preferably, in S5, the formula for determining whether an attack exists is: (14); In formula (14): Represents the pre-processed measurement data of the sensor to be detected; Indicates the upper limit of the dynamic threshold; Indicates the lower limit of the dynamic threshold.
[0021] Compared with the prior art, the present invention has the following beneficial effects: (1) The present invention provides a method for detecting and locating false data injection attacks based on physical constraints and adaptive thresholds. It combines the advantages of WGAN and CNN-Transformer architectures, and utilizes the generated data and timing characteristics to effectively enhance the detection and positioning capabilities of false data injection attacks. The timing data generated by WGAN can highly simulate the operating characteristics, while CNN-Transformer can capture complex spatiotemporal correlations, thereby improving the accuracy and robustness of detection. Compared with traditional methods, the present invention can more efficiently identify and locate FDIA in complex environments.
[0022] (2) The present invention improves the accuracy and reliability of FDIA detection by introducing physical constraints and adaptive threshold generation mechanisms. Physical constraints help ensure that the generated data conforms to the actual operating rules and avoids the generated false data from deviating from the actual situation; while the adaptive threshold generation mechanism dynamically adjusts the threshold according to real-time data, effectively responding to changes in different attack scenarios and reducing the risk of false positives and negative negatives.
[0023] (3) The present invention adopts an anomaly detection strategy based on the LSTM pre-training mechanism, which enables the model to quickly adapt and make accurate judgments when facing unknown attack patterns. When processing time series data, the pre-training mechanism helps the model effectively capture long-term dependencies in the data, thereby improving the timeliness and accuracy of detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 It is a flow chart of the false data injection attack detection and positioning method based on physical constraints and adaptive thresholds described in the present invention.
[0025] Figure 2 It is a power conservation comparison analysis diagram of different data generation methods in the embodiment of the present invention.
[0026] Figure 3 3 is a moving average comparison chart of different data generation methods in the embodiments of the present invention. DETAILED DESCRIPTION
[0027] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0028] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs.
[0029] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprising" and / or "including" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.
[0030] In the absence of conflict, the embodiments of the present invention and the features of the embodiments may be combined with each other.
[0031] When dealing with complex dynamic changes in the system, the existing technology often relies on large-scale historical data for training, lacks physical constraints, and the generated data may violate the physical laws of the system, thereby affecting the reliability of detection. In addition, the existing technology relies on static thresholds or models, which makes it difficult to effectively deal with the concealment and timing characteristics of FDIA. To this end, the present invention significantly improves the detection accuracy and positioning efficiency of FDIA through an innovative generative adversarial network architecture and a dynamic threshold generation mechanism.
[0032] The false data injection attack detection and location method based on physical constraints and adaptive thresholds of the present invention is further described below in conjunction with specific embodiments.
[0033] Example Ginseng Figure 1 This embodiment provides a false data injection attack detection and positioning method based on physical constraints and adaptive thresholds. First, by preprocessing the measurement data of multiple sensors, the data is input into the WGAN framework embedded based on physical constraints and time conditions for training; WGAN generates high-quality synthetic data that conforms to physical laws, and combines LSTM to capture the long-term and short-term characteristics of time series. Subsequently, the CNN-Transformer model is used for global feature extraction and dynamic threshold generation, and the distribution of normal data is analyzed in combination with a dynamic detection mechanism based on quantiles to accurately locate potential attack sources. Finally, the accuracy and efficiency of detection and positioning are improved by cyclically optimizing the model architecture and parameters.
[0034] The method specifically comprises: S1. Acquire historical measurement data from multiple sensors, and preprocess the historical measurement data to obtain normal data samples.
[0035] In this embodiment, in order to accurately detect FDIA (false data injection attack) in the system, it is necessary to obtain historical measurement data from multiple sensors and preprocess these data. The preprocessing process includes operations such as outlier filtering, time alignment and standardization, aiming to ensure the quality and consistency of the data and provide a reliable foundation for subsequent model training and anomaly detection.
[0036] Specifically, after acquiring the historical measurement data of multiple sensors, data cleaning and preprocessing are first performed to ensure the quality and consistency of the data.
[0037] The first step in data cleaning is outlier filtering, which is a process of identifying and removing unreasonable or extreme outliers by statistically analyzing the input data. Outliers may be caused by sensor failure, data transmission errors, or external environmental interference. If they are not eliminated, they will have a negative impact on the accuracy of model training.
[0038] Next, if there are differences in the acquisition frequency or timestamps of different sensors, the data of each sensor must be time-aligned. Time alignment ensures that the time stamp of each data point is consistent, thereby ensuring that the model can correctly process the timing characteristics of the data.
[0039] In addition, since the measurement data of different sensors often have different dimensions, this may cause interference during model training. Therefore, when performing data normalization, all input data are adjusted to the same scale range to avoid the negative impact of dimension differences on model training.
[0040] Commonly used normalization methods include Z-score normalization or Min-Max normalization. In order to ensure the consistency of the scale of each feature and avoid deviations in the training process caused by features of different dimensions, this method uses Z-score normalization.
[0041] The formula for Z-score standardization is: (1); In formula (1): represents the data before normalization; represents the mean of the data; represents the standard deviation of the data, Represents the normalized data.
[0042] Through this series of data preprocessing steps, the quality and consistency of the data can be effectively improved, laying a solid foundation for the subsequent deep learning model training.
[0043] S2. Initialize the parameters of the generator and discriminator of the generative adversarial network WGAN, and perform model training on the generative adversarial network WGAN in combination with the time condition embedding and physical constraint loss function, so that its generator generates synthetic data samples that conform to the physical laws of the system based on the normal data samples.
[0044] In this embodiment, the normal data samples represent the actual operating state of the system without being interfered by FDIA.
[0045] In this embodiment, the generator and discriminator of the generative adversarial network WGAN need to be initialized first to ensure that the generated synthetic data conforms to the laws of physics. During initialization, a weight initialization method based on prior knowledge is used to ensure that the model can run stably in the early stage of training. In addition, optimizing the generator in combination with the physical constraint loss function helps to reduce the error of the generated data, making the generated synthetic data closer to the actual operating state.
[0046] Furthermore, high-quality synthetic data that conforms to physical laws and temporal dynamics is generated through the generative adversarial network WGAN, and these generated data are used for pre-training of the LSTM model. The goal of the generator is to learn physical laws from normal data to ensure that the generated data can effectively reflect the operating status. The key to this process is to introduce physical constraint loss functions and temporal condition embedding to improve the quality and authenticity of the generated data.
[0047] Specifically, the goal of the generator is to generate data that conforms to the laws of physics, with the power conservation principle being the key constraint. The power conservation principle requires a strict balance between the generated power, the load power, and the transmission loss, that is, at any point in time, the generated power must be equal to the sum of the load power and the transmission loss.
[0048] In this method, in order to enforce this physical constraint in the data generation process, a physical constraint loss function is introduced , which is used to measure the degree to which the generated data deviates from the laws of physics and incorporate it into the generator optimization objective.
[0049] The power conservation principle can be expressed as: (2); In formula (2): Indicates the total generated power in MW; Indicates the total load power generated in MW; Represents the resulting transmission loss in MW.
[0050] However, in the actual data generation process, the generated data may violate this physical constraint. Therefore, the physical constraint loss function is defined as: (3); In formula (3): Represents the physical constraint loss, and uses the L2 norm to measure the degree of deviation from power conservation; by minimizing this loss, the generator can gradually reduce the deviation of the generated data from the physical laws.
[0051] During GAN training, the intermediate loss function of the generator considers the combination of physical constraints and WGAN loss, which is specifically expressed as: (4); In formula (4): is the intermediate loss function of the generator, which only considers physical constraints; is the WGAN loss of the generator, which is used to constrain the data distribution; is a hyperparameter used to adjust the weight of the physical constraint loss in the generator optimization process.
[0052] Furthermore, the data has obvious temporal dynamic characteristics, and there are periodic changes in load, power generation and transmission loss in different time periods. For example, the daily load curve usually shows peaks in the morning and evening, and lower loads at night, while seasonal changes also affect electricity demand. Traditional GAN does not consider time information, which may lead to irrationality in the time dimension of generated data, such as abnormally high loads at night or abnormally low loads during the day. Therefore, in this method, a temporal condition embedding mechanism is introduced to enable GAN to learn time change patterns and ensure the temporal consistency of data generation.
[0053] In order to ensure that the generated data conforms to the temporal characteristics, the temporal consistency loss is added to the optimization objective function of GAN, and the total loss function of the generator is modified as follows: (5); In formula (5): Represents the total loss function of the generator Represents the time consistency loss, which is used to ensure the time dynamic consistency; is a hyperparameter.
[0054] The temporal consistency loss for: (6); In formula (6): Indicates the generation of data; Indicates the real data at this time point The mean of makes GAN closer to the real data in the time dimension. , Represents a time condition, which is a discrete time point in a 24-hour day.
[0055] It should be understood that the above time condition embedding uses one-hot encoding to convert the time information of 24 hours a day into a 24-dimensional vector. For example: 00:00→[1,0,0,...,0]; 12:00→[0,0,0,...,1,0,0]; 18:00→[0,0,0,...,0,1,0].
[0056] This encoding method ensures that information at different time points can be learned by the model, guiding the generator to generate data that conforms to the characteristics of the time period. For example, during the daytime peak period, the generator can generate higher load data, and during the nighttime trough period, it can generate lower load data, ensuring the time consistency of the data.
[0057] In terms of the model structure, the temporal conditional embedding is not only used as the generator input, but also added to the discriminator input. By random noise and time embedding composition: (7); Input to the discriminator By data and time embedding composition: (8).
[0058] In this way, the discriminator not only determines the authenticity of the data, but also determines whether it conforms to the characteristics of the time period. If GAN generates high-load data late at night, the discriminator will more easily identify it as fake data, thereby optimizing the learning direction of GAN.
[0059] S3. Initialize the parameters of the LSTM model, first pre-train the LSTM model using the synthetic data sample, then optimize the pre-trained LSTM model parameters in combination with actual data, and use the optimized LSTM model to extract the time series features of the normal data sample.
[0060] In this embodiment, the initialization of the LSTM model is also critical, especially when capturing long-term and short-term dependencies. The LSTM model initializes its weights through uniform distribution and initializes the bias to zero to ensure that it can efficiently learn time series patterns. The initialized LSTM model is trained on non-attack data to provide accurate time series predictions in the subsequent detection stage.
[0061] The use of high-quality data generated by WGAN for pre-training of the LSTM model aims to enable the LSTM model to converge quickly and internalize the physical laws in the early stages of training, ensuring that the parameters of the LSTM model have certain physical information and completing the initial training of the model.
[0062] The LSTM model is good at capturing long-term dependencies in time series and can keep the memory of past information and use it for future predictions when processing complex data. Therefore, using the data generated by WGAN to pre-train the LSTM model can not only enable the LSTM model to better learn the time series characteristics in the data, but also effectively reduce the model's dependence on real data.
[0063] The input of the LSTM model is the synthetic time series data generated by WGAN, and the output is the state prediction value of the next time step. The generated time series data covers the characteristics of load changes and power consumption in different time periods. By training the LSTM model with these synthetic data, the model can learn long-term time dependencies and dynamic characteristics. In the pre-training process, LSTM can converge faster in the training of actual data and improve the prediction accuracy by learning the time series information in these synthetic data.
[0064] The pre-training objective function of the LSTM model for: (9); In formula (9): represents the real time series value of the next time step, that is, the real state value corresponding to the next time step in the synthetic data sample, such as load or power; Represents the time series value of the next time step predicted by the LSTM model.
[0065] By minimizing this loss function, the LSTM model is able to gradually adjust its internal parameters to make the generated data predictions more accurate.
[0066] Furthermore, after pre-training, the LSTM model will be combined with the pre-processed data, and by further optimizing the parameters, it can accurately extract the time series features in the data, thereby providing efficient time series information for subsequent anomaly detection tasks. By combining real and synthetic data, the LSTM model not only accelerates the convergence process, but also improves the detection accuracy of FDIA.
[0067] Specifically, after the LSTM model is pre-trained with synthetic data generated by WGAN, the next step is to combine the model with actual normal data to further optimize its parameters so that it can better capture timing characteristics and long-term dependencies and provide accurate timing features for anomaly detection. At this stage, the LSTM model fully learns the timing characteristics, volatility, and potential long-term dependencies by inputting historical actual normal measurement data. Real data provides the LSTM model with more complex and diverse dynamic features, allowing the model to more accurately capture the actual operating mode and fluctuation trend. By combining with real data, the LSTM model can effectively adjust its internal state, better fit the timing characteristics, and improve the model's predictive ability and adaptability.
[0068] After the LSTM model is combined with actual normal data, the model will be further trained to optimize its parameters. By analyzing the time series characteristics of the data during normal operation, the LSTM model can better learn and extract the long-term dependencies and time series patterns in the data. This process can help the model better distinguish between normal operation modes and abnormal behaviors that may occur in the future.
[0069] The parameter optimization of the LSTM model can enable the model to more accurately predict the timing characteristics of normal operation through algorithms such as back propagation and gradient descent. In this way, the LSTM model can provide efficient timing information for subsequent anomaly detection tasks, thereby improving the detection accuracy of FDIA.
[0070] S4. Initialize the parameters of the CNN-Transformer model, input the time series features extracted by the LSTM model and the normal data samples as a data combination into the CNN-Transformer model, extract the local time series features of the input data combination through the CNN model, and capture the global time series evolution characteristics of the input data combination through the Transformer model to generate a dynamic threshold.
[0071] In this embodiment, the initialization of the CNN-Transformer model aims to extract global and local features from historical data. In order to improve the convergence speed, Kaiming initialization (convolutional layer) and Xavier initialization (fully connected layer) are used to initialize the model parameters. The CNN part is used to extract local time series features, while the Transformer captures global time series information, thereby helping the model learn spatiotemporal correlation and accelerate training.
[0072] Furthermore, in order to accurately detect FDIA, after the LSTM model training is completed, the CNN-Transformer model will be used to perform global feature extraction and dynamic threshold generation on normal data samples.
[0073] First, the features generated by the LSTM model through time series modeling are input into the CNN-Transformer model together with normal data samples. The CNN model extracts the local time series features of the input data, and then the Transformer captures the global time series evolution characteristics of the input data.
[0074] Specifically, after the LSTM model is trained and the time series features are generated, these features are then input into the CNN-Transformer model together with the normal data samples, namely: (10); In formula (10): Represents the input of the CNN-Transformer model; Represents the time series features extracted by the LSTM model; represents a normal data sample.
[0075] Time series features generated by LSTM model Contains dynamic changes and long-term dependencies, and the preprocessed data The actual measurement information provided. By combining the two, the CNN-Transformer model can more comprehensively capture the temporal evolution characteristics of the data and learn more complex features.
[0076] The CNN model is used to extract local time series features of the input data. Specifically, the input time series data will be processed by the CNN model through its convolution layer to extract local time series features. The convolution layer can effectively capture local fluctuations and short-term changes in the data, such as instantaneous load fluctuations and other rapidly changing patterns. Each convolution layer uses a convolution kernel The data is filtered to extract local feature information at different scales.
[0077] The convolution operation is expressed as: (11); In formula (11): Represents the convolution operation; Represents the local temporal features extracted by the CNN model; represents the activation function; Represents the convolution kernel of the convolution layer.
[0078] Through this process, CNN can effectively capture local fluctuations in the network, such as short-term anomalies such as load fluctuations.
[0079] After CNN extracts local features, the data is passed to the Transformer model. Transformer captures long-term temporal dependencies in the data through the self-attention mechanism. It learns the global temporal evolution pattern by weighted summation of the features of each time step with the features of other time steps, thereby helping the model understand global trends and complex temporal characteristics.
[0080] The self-attention mechanism is expressed as: (12); In formula (12): Represents a query, which is used to query the correlation between time steps; Represents the key, used to calculate similarity; Represents the value matrix, containing the original feature information; Represents the output of the self-attention mechanism, which is a weighted representation of the global temporal features, capturing the long-term dependencies between time steps in the time series.
[0081] Through this mechanism, Transformer can capture global temporal relationships and generate global features.
[0082] Ultimately, the model generates dynamic upper and lower thresholds based on the temporal evolution of the data, which can be automatically adjusted based on the distribution of the actual data.
[0083] S5. Optimize the interval range of the dynamic threshold based on the quantile loss function, monitor the measurement data of the sensor to be detected based on the optimized dynamic threshold, compare the preprocessed measurement data of the sensor to be detected with the interval range of the dynamic threshold, and if it exceeds the interval range of the dynamic threshold, it is determined that an attack exists.
[0084] That is, based on the distribution characteristics of the data, the quantile loss function is used to dynamically adjust the threshold interval to ensure accurate detection of abnormal data.
[0085] In the process of generating dynamic thresholds, the model introduces the quantile loss function To achieve this goal, two independent CNN-Transformer models are used in this method: one model is used to predict the upper limit, and the other model is used to predict the lower limit. Through these models, the generated dynamic threshold can adapt to the distribution characteristics of the data.
[0086] The quantile loss function is: (13); In formula (13): represents the quantile loss function; Represents the predicted value of the CNN-Transformer model; represents the true value; is the set quantile, for example, 0.95 represents the 95% quantile of the upper limit of the prediction, and 0.05 represents the 5% quantile of the lower limit of the prediction; Represents the number of training samples, that is, the total number of eigenvalues of normal data samples.
[0087] By minimizing this loss function, the model dynamically adjusts the upper and lower bounds of the prediction, thereby generating dynamic thresholds that adapt to the data distribution.
[0088] The upper limit CNN-Transformer model adjusts the upper limit of the prediction by minimizing the quantile loss function, so that the normal data can be better adapted within the high quantile range (such as the 95% quantile), ensuring that the normal data does not exceed the upper limit.
[0089] The lower bound CNN-Transformer model optimizes the lower bound prediction through the quantile loss function, so that normal data can be accurately adapted within the low quantile range (such as the 5% quantile) and will not be predicted as abnormal. Abnormal data (such as FDIA) usually deviates from the normal data distribution, so they are likely to break the lower bound and be identified as abnormal.
[0090] In this way, the model can automatically generate more accurate dynamic thresholds based on the distribution characteristics of the data and effectively detect abnormal data or potential FDIA.
[0091] After the thresholds are generated, the model will monitor the sensor data to be detected based on these dynamic thresholds. First, the sensor data to be detected is preprocessed by outlier filtering, time alignment, and standardization. Then, the preprocessed sensor data is Compared with the threshold range, when a sensor to be detected monitors data Exceeded the dynamically generated threshold interval When the abnormal data is detected, it will be marked as abnormal data. These abnormal data may be caused by FDIA. The location of the attack can be completed by the detected abnormal features and their corresponding time range.
[0092] During the monitoring process, this method determines whether there is an attack by calculating whether each data sample exceeds the threshold range. The specific judgment formula is: (14); In formula (14): Represents the pre-processed monitoring data of the sensor to be detected; Indicates the upper limit of the dynamic threshold; Indicates the lower limit of the dynamic threshold.
[0093] Finally, repeat the above steps S2~S5 to continuously optimize the parameters of the WGAN, LSTM, and CNN-Transformer models to ensure the robustness and efficiency of the detection and localization models in dynamic environments.
[0094] In order to ensure the robustness and efficiency of the detection and positioning model in a dynamic environment, it is necessary to continuously optimize the parameters of the WGAN, LSTM, and CNN-Transformer models. During the training process, the generator and discriminator parameters of WGAN are the focus of optimization. By continuously adjusting their weights, the generated data is closer to the real data. This process can improve the model's ability to detect FDIA. At the same time, the use of appropriate loss functions and regularization techniques can help avoid training problems such as mode collapse.
[0095] The LSTM model focuses on processing the time series characteristics in the data. By optimizing the LSTM's hidden layer, learning rate, gating mechanism and other hyperparameters, the model's ability to capture time series data can be improved, thereby improving the accuracy and stability of detection.
[0096] The CNN-Transformer model combines the advantages of convolutional neural networks and transformers, and can simultaneously extract spatial and temporal features of data. Optimizing the convolutional layer, attention mechanism, and the encoder and decoder structure of the transformer helps to enhance the capabilities of feature extraction and temporal modeling, thereby improving the detection and positioning of FDIA.
[0097] After multiple rounds of training and parameter adjustment, the model can gradually improve the accuracy and stability in data processing. After each round of iterative training, the model adjusts parameters according to the performance of the validation set, gradually learns more data features, and enhances the detection ability of FDIA. The learning step size and regularization parameters are adjusted by optimizing the algorithm to ensure training stability and avoid overfitting.
[0098] Overfitting is a key issue in optimization, which may cause the model to be unable to generalize to new data. To this end, regularization methods (such as L2 regularization, Dropout, etc.) can be used to prevent overfitting, while adjusting the model complexity and increasing the number of training rounds to solve the underfitting problem and ensure that the model fully learns the data features.
[0099] To improve stability, techniques such as learning rate decay and gradient clipping can be used to avoid gradient explosion or disappearance. Methods such as adjusting batch size and introducing early stopping mechanism can help maintain stability during training.
[0100] As training progresses, the model gradually improves its accuracy in detecting false data injection attacks, and ensures its generalization ability in different scenarios through methods such as cross-validation. Through these optimization strategies, WGAN, LSTM, and CNN-Transformer models can provide efficient, accurate, and robust detection and localization capabilities in dynamic data.
[0101] 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.
[0102] The method comprises the following steps: S1. Data acquisition and preprocessing: First, historical measurement data are obtained from multiple sensors in the smart grid. These data include multi-dimensional characteristics of the grid (such as voltage, current, active power, reactive power, etc.) and are used to detect FDIA. The collected sensor data is preprocessed, including data cleaning, outlier filtering, time alignment, and normalization, to ensure data consistency and high quality. The preprocessed data is used to initialize model training.
[0103] S2. WGAN model initialization and data generation: Initialize the parameters of the WGAN generator and discriminator; Through the WGAN generator, combined with the physical constraint loss function and the time condition embedding mechanism, regular synthetic data is generated using only normal operating data.
[0104] S3, LSTM model initialization and pre-training: Initialize the weight matrix of the LSTM model; The LSTM model is pre-trained using synthetic data generated by the WGAN generator to capture the timing characteristics and long-term dependencies.
[0105] S4, CNN-Transformer model initialization, feature extraction and dynamic threshold generation: Initialize the convolution kernel and attention weights of the CNN-Transformer model; After the LSTM model is pre-trained, the CNN-Transformer model is used to extract global and local features of normal data and generate dynamic detection thresholds. The CNN model is used to extract local temporal features, while the Transformer model captures global features through the self-attention mechanism.
[0106] S5. Dynamic threshold optimization and attack detection and location based on dynamic threshold: Combined with the quantile loss function, dynamic upper and lower thresholds are generated to accurately distinguish normal data from abnormal data; The input data is tested using dynamic thresholds. When the data exceeds the set dynamic threshold range, the attack detection mechanism is triggered. The classification network model is used to accurately locate the attacked sensor position based on the difference between the features extracted by CNN-Transformer and the actual observed data.
[0107] Based on the above, after completing attack detection and location, the parameters of the WGAN, LSTM, and CNN-Transformer models are continuously optimized through multiple rounds of iterative training. The parameters are updated and performance evaluation is performed to ensure that the detection accuracy and robustness of the model in a dynamic power grid environment are gradually improved.
[0108] For experimental comparison, here are some basic settings for the experiment: The performance of the FDIA detection and positioning method based on WGAN and CNN-Transformer is verified through multiple experiments. The simulation experiment is based on the IEEE14-node power grid model and uses the MATPOWER simulation environment. The experimental dataset includes hourly power grid data and attack vector datasets generated by formal models. These attack vectors are designed to tamper with sensor data to evade BDD system detection and affect power grid state estimation. In the experimental setting, 50% of the data is used for training and 50% for testing. The experiment is conducted in a high-performance computing environment equipped with an NVIDIA GeForce RTX 3090 graphics card.
[0109] Figure 2 The comparison between the generated data and the real data in terms of power conservation is shown. The data generated by the method of the present invention is significantly better than the traditional WGAN method in terms of power conservation deviation and is closer to the real data distribution. The average power deviation of the data generated by the method of the present invention is 11.97MW, which is lower than the 20.01MW of the traditional WGAN method, showing the important role of the physical constraint loss function in power conservation during the generation process. This shows that the data generated by the method of the present invention can better reflect the actual operating characteristics of the power grid and provide high-quality training samples for subsequent anomaly detection.
[0110] Figure 3 The moving average trend of different data generation methods is shown, and the moving window size is 5. The experimental results show that the moving average (red solid line) generated by the method of the present invention is highly consistent with the real data (blue solid line), while the traditional generation method based on simple noise (green solid line) shows obvious deviation. This shows that the method of the present invention has significant advantages in time dynamic consistency and can better capture the timing characteristics of running data.
[0111] Table 1 shows the performance comparison of our method (Our) and other baseline methods in the false data injection attack detection task. The evaluation indicators include precision, recall / TPR, F1-Score, false positive rate (FPR) and area under the curve (AUC). The comparison methods include traditional CNN, EE-PMQ, MMLD and SSA-CNN.
[0112] Table 1
[0113] As can be seen from Table 1, the method of the present invention performs well in comprehensive performance. The method of the present invention shows high detection ability in F1 score and Recall, while maintaining a low FPR, which significantly improves the detection accuracy compared with traditional CNN. Although the Precision of EE-PMQ and MMLD reaches 1.0000, the Recall is low, indicating that their false negative rate is high and a large number of covert attacks may be missed. SSA-CNN performs well in AUC and F1 score, but is slightly inferior to this method in Recall, indicating that its coverage ability for certain attacks is slightly weaker. This method effectively improves the detection performance of false data injection attacks by introducing physical constraints, temporal condition embedding and dynamic threshold generation mechanism, especially in balancing false positives and false negatives.
[0114] Table 2 further shows the performance comparison between our method (Our) and other baseline methods in the task of false data injection attack detection and location. The evaluation indicators include row accuracy (RACC, Random Adjusted Concordance Coefficient) and detection accuracy (Detection Accuracy). RACC measures the overall prediction accuracy of the model for all measurement point labels in multi-label classification tasks, that is, the probability that all undamaged locations are correctly labeled as undamaged and all damaged locations are correctly labeled as damaged. Row accuracy measures the ability to detect the presence of attacks. The comparison methods are consistent with Table 1, including traditional CNN, EE-PMQ, MMLD and SSA-CNN.
[0115] Table 2
[0116] As can be seen from Table 2, the proposed method is significantly better than other baseline methods in terms of both RACC and Detection Accuracy, reflecting its excellent performance in detecting and locating false data injection attacks. The specific analysis is as follows: The RACC of this method is 0.9013, which is significantly higher than CNN (0.5118), EE-PMQ (0.6492), MMLD (0.6563), and slightly higher than SSA-CNN (0.8725). RACC measures the classification consistency of the model for all measurement point states after excluding random guesses. A high value indicates that this method can accurately locate the source of the attack. The low RACC (0.5118) of CNN shows that its positioning ability is close to the random level, while the improvement of EE-PMQ and MMLD is limited and the positioning is still insufficient.
[0117] The proposed method achieves a row detection accuracy of 0.9903, which is close to perfect and far exceeds CNN (0.7033), EE-PMQ (0.6672), MMLD (0.6690), and SSA-CNN (0.9229). We take a step back and investigate how effective the proposed mechanism is in detecting the presence of an attack. In particular, we consider the power system as unattacked or attack-existent if for all Otherwise, we regard the power system as under attack or an attack exists. This indicator reflects the model's ability to distinguish between attacks and normal states. The excellent performance of this method verifies its detection reliability, especially for covert attacks.
[0118] 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 physical constraints and adaptive thresholds, characterized in that: The method comprises: S1. Acquire historical measurement data from multiple sensors, and preprocess the historical measurement data to obtain normal data samples; S2, initializing the parameters of the generator and the discriminator of the generative adversarial network WGAN, and performing model training on the generative adversarial network WGAN in combination with the time condition embedding and the physical constraint loss function, so that the generator generates synthetic data samples that conform to the physical laws of the system based on the normal data samples; S3, initializing the parameters of the LSTM model, first pre-training the LSTM model using the synthetic data sample, then optimizing the parameters of the pre-trained LSTM model in combination with actual data, and extracting the time series features of the normal data sample using the optimized LSTM model; S4, initializing the parameters of the CNN-Transformer model, inputting the time series features extracted by the LSTM model and the normal data sample as a data combination into the CNN-Transformer model, extracting the local time series features of the input data combination through the CNN model, and capturing the global time series evolution characteristics of the input data combination through the Transformer model, so as to generate a dynamic threshold; S5. Optimize the interval range of the dynamic threshold based on the quantile loss function, monitor the measurement data of the sensor to be detected based on the optimized dynamic threshold, compare the preprocessed measurement data of the sensor to be detected with the interval range of the dynamic threshold, and if it exceeds the interval range of the dynamic threshold, it is determined that an attack exists.
2. The false data injection attack detection and location method based on physical constraints and adaptive thresholds according to claim 1 is characterized in that: In S1, preprocessing the historical measurement data specifically includes: Performing data cleaning on the historical measurement data to remove abnormal values therein; Performing time alignment on the cleaned historical measurement data to make the time mark of each data point consistent; The aligned historical measurement data are processed by Z-score standardization to adjust all data to the same scale range; Among them, the formula for Z-score standardization is: (1); In formula (1): represents the data before normalization; represents the mean of the data; represents the standard deviation of the data, Represents the normalized data.
3. The false data injection attack detection and location method based on physical constraints and adaptive thresholds according to claim 1 is characterized in that: In S2, the generator and the discriminator of the generative adversarial network WGAN are initialized by using a weight initialization method based on prior knowledge; And when training the model, physical constraints are introduced: (2); In formula (2): Indicates the total generated power in MW; Indicates the total load power generated in MW; represents the generated transmission loss in MW; Define the physical constraint loss function for: (3); In formula (3): It represents the physical constraint loss and uses the L2 norm to measure the deviation from power conservation to ensure power conservation; The intermediate loss function of the generator considers the combination of physical constraints and WGAN loss, namely: (4); In formula (4): Represents the intermediate loss function of the generator; represents the WGAN loss of the generator, which is used to constrain the data distribution; is a hyperparameter used to adjust the weight of the physical constraint loss in the generator optimization process; The total loss function of the generator adds the temporal consistency loss to its intermediate loss function, namely: (5); In formula (5): represents the total loss function of the generator; Represents the time consistency loss, which is used to ensure the time dynamic consistency; is a hyperparameter; The temporal consistency loss for: (6); In formula (6): Indicates the generation of data; Indicates the real data at this time point The mean of makes GAN closer to the real data in the time dimension. , Represents a time condition, which is a discrete time point in a 24-hour day.
4. The false data injection attack detection and location method based on physical constraints and adaptive thresholds according to claim 3 is characterized in that: In S2, the time condition embedding uses one-hot encoding to convert the time information of 24 hours a day into a 24-dimensional vector; in the model structure, the time condition embedding is used as the input of the generator and the discriminator in the generative adversarial network WGAN, where the input of the generator By random noise η and time embedding composition: (7); Input to the discriminator From normal data samples and time embedding composition: (8)。 5. The false data injection attack detection and location method based on physical constraints and adaptive thresholds according to claim 1 is characterized in that: In S3, the weight of the LSTM model is initialized by uniform distribution, and its bias is initialized to zero; when the LSTM model is pre-trained, its input is a synthetic data sample, and its output is a time series value of the next time step; the pre-training objective function of the LSTM model is for: (9); In formula (9): Represents the true time series value corresponding to the next time step in the synthetic data sample; Represents the time series value of the next time step predicted by the LSTM model.
6. The false data injection attack detection and location method based on physical constraints and adaptive thresholds according to claim 1 is characterized in that: In S4, the parameters of the CNN-Transformer model are initialized using Kaiming initialization and Xavier initialization. The time series features extracted by the LSTM model and the normal data samples are input into the CNN-Transformer model as a data combination, that is: (10); In formula (10): Represents the input of the CNN-Transformer model; Represents the time series features extracted by the LSTM model; represents a normal data sample.
7. The false data injection attack detection and location method based on physical constraints and adaptive thresholds according to claim 6 is characterized in that: In S4, the local temporal features of the input data combination are extracted through the convolution layer of the CNN model, and the convolution operation is expressed as: (11); In formula (11): Represents the convolution operation; Represents the local temporal features extracted by the CNN model; represents the activation function; Represents the convolution kernel of the convolution layer.
8. The false data injection attack detection and location method based on physical constraints and adaptive thresholds according to claim 7 is characterized in that: In S4, the Transformer model captures the global temporal evolution characteristics of the input data combination through the self-attention mechanism, and the self-attention mechanism is expressed as: (12); In formula (12): Represents a query, which is used to query the correlation between time steps; Represents the key, used to calculate similarity; Represents the value matrix, containing the original feature information; Represents the output of the self-attention mechanism, which is a weighted representation of the global temporal features, capturing the long-term dependencies between time steps in the time series.
9. The false data injection attack detection and location method based on physical constraints and adaptive thresholds according to claim 1 is characterized in that: In S5, two independent CNN-Transformer models are used to adjust the upper limit and lower limit of the dynamic threshold respectively, wherein the upper limit of the prediction is adjusted by minimizing the quantile loss function, and the lower limit of the prediction is optimized by the quantile loss function; the quantile loss function is: (13); In formula (13): represents the quantile loss function; Represents the predicted value of the CNN-Transformer model; represents the true value; is the set quantile; Represents the number of training samples, that is, the total number of eigenvalues of normal data samples.
10. The false data injection attack detection and location method based on physical constraints and adaptive thresholds according to claim 1 is characterized in that: In S5, the formula for determining whether an attack exists is: (14); In formula (14): Represents the pre-processed measurement data of the sensor to be detected; Indicates the upper limit of the dynamic threshold; Indicates the lower limit of the dynamic threshold.
Citation Information
Patent Citations
False data injection attack detection method and device based on LSTM network
CN113094702A
False data injection attack simulation and detection method and device, equipment and medium
CN116886351A
Smart power grid false data injection attack positioning method based on frequency spectrum domain data driving
CN116304621A
Intrusion detection algorithm based on diffusion generative adversarial network and improved white whale optimization
CN117134969A
SQL (Structured Query Language) attack false alarm elimination method
CN119109678A
Cited By
Deep foundation pit multi-source monitoring data generative adversarial network anomaly diagnosis method
CN121167550A