Method and system for defending FDI attack based on aggregator double-layer game

By using the bidirectional generative adversarial network model of weighted Manhattan distance and weighted Euclidean distance screening in smart grids, the problem of false data injection attacks by aggregators is solved, efficient detection and defense effects are achieved, and detection performance and defense capabilities are significantly improved.

CN118862093APending Publication Date: 2024-10-29NORTHEASTERN UNIV CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411109330.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-13
Publication Date
2024-10-29

Smart Images

  • Figure CN118862093A_ABST
    Figure CN118862093A_ABST
Patent Text Reader

Abstract

The invention provides a defense method and system based on an aggregator double-layer game (FDI) attack, and belongs to the field of smart power grid security, and the method comprises the steps: obtaining test data of a state quantity at a t moment when false data based on the aggregator double-layer game is injected to attack a smart power grid; the test data of the state quantity at the moment t are input into a pre-trained bidirectional generative adversarial network model with a gating circulation unit, a defense judgment result is obtained, and the pre-trained bidirectional generative adversarial network model with the gating circulation unit is obtained. The method comprises the following steps: training sample data screened by a weighted Manhattan distance and a weighted Euclidean distance; calculating a difference value between the defense judgment result and the actual electricity price; and if the difference value is greater than or equal to a threshold value, determining that the smart grid is attacked by false data injection at the t moment, outputting a corrected electricity price, and importing the corrected electricity price into a historical database. According to the invention, the electricity price can be effectively predicted and attacks to aggregators can be effectively defended.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of smart grid security, and in particular relates to a defense method and system for FDI attacks based on aggregator double-layer game. Background Art

[0002] As the number of users and types of loads participating in demand-side response increases year by year, aggregators, as the middle link between the demand side and power companies, play a key role in aggregating and guiding demand response. Frequent interactions make aggregators increasingly dependent on information communications, but their information defense is relatively lacking, which allows attackers to attack aggregators at a lower cost and cause serious economic losses.

[0003] The interaction process of aggregators generally involves three parties: users, aggregators, and power companies. It is necessary to establish a two-layer game model to analyze the interaction process. The false data injection attack method for the interaction process of aggregators is a multi-layer model. The outer layer simulates the attacker's behavior, tampers with the cost function of the power company's unit and the cost function parameters of the aggregator to mislead the power company and the aggregator's electricity price setting and cause users to respond incorrectly. The inner layer is a two-layer game model between the aggregator, the user, and the power company. The leader of the upper game model is the power company, and the follower is the aggregator; the leader of the lower game model is the aggregator, and the follower is the user. The three follow their respective optimal strategies to achieve game equilibrium.

[0004] Typically, attackers expect to achieve the maximum attack effect with limited attack costs. The false data injection attack method for the cyber-physical system in the aggregator interaction process may include the following considerations:

[0005] (1) Consider the impact of user satisfaction. Users participate in the response based on the electricity price, but they will lose a certain degree of satisfaction during the response process.

[0006] (2) Consider the attacker’s cost. The attacker steals the cost function data and tampers with it through the loopholes in the power company-aggregator-user communication system. The cost of the attack is positively correlated with the difficulty of exploiting the loophole.

[0007] (3) Consider the attacker’s profit function. Attacks on aggregator interactions can cause damage to the interests of power companies and users, including aggregators, and even cause the power flow of the distribution network to exceed the limit.

[0008] Since the above attack method is to cause abnormal load response and line overload by tampering with the cost function parameters, it is difficult to be detected by traditional state estimation. And this attack can cause adverse effects over a long time scale. Therefore, a machine learning detection method is proposed based on this attack model. The basic idea of ​​this method is to take the load, electricity price and influencing factors of the distribution network area on a typical day as a benchmark, and train the GAN neural network through a large amount of relevant data to detect the abnormal electricity price and load response caused by FDI attacks, but this method takes a long time to train.

[0009] In the prior art, there is no method that can defend against the above-mentioned attacks. Summary of the invention

[0010] In view of the deficiencies of the prior art, this application proposes a defense method and system for FDI attacks based on aggregator double-layer game.

[0011] In the first aspect, the present application proposes a defense method against FDI attacks based on aggregator two-layer game, including:

[0012] When the smart grid is attacked by false data injection based on the aggregator's two-layer game, the test data of the state quantity at time t is obtained;

[0013] Inputting the test data of the state quantity at time t into a pre-trained bidirectional generative adversarial network model with a gated recurrent unit to obtain a defense judgment result, wherein the pre-trained bidirectional generative adversarial network model with a gated recurrent unit has a training process comprising: using weighted Manhattan distance and weighted Euclidean distance to screen sample data, using the screened sample data to train the bidirectional generative adversarial network model with a gated recurrent unit, and obtaining a pre-trained bidirectional generative adversarial network model with a gated recurrent unit;

[0014] Calculate the difference between the defense judgment result and the actual electricity price;

[0015] Comparing the difference with a threshold value;

[0016] If the difference is less than the threshold, the smart grid is not attacked by false data injection at time t;

[0017] If the difference is greater than or equal to the threshold, the smart grid has been attacked by false data injection at time t, and the corrected electricity price at time t is output and imported into the historical database.

[0018] The pre-trained bidirectional generative adversarial network model with gated recurrent units includes: a generator, an encoder, and a discriminator;

[0019] The generator includes a first gated recurrent unit, which is used to take the filtered sample data as input and generate first mapping data after transformation;

[0020] The encoder comprises: three neural network layers, a hidden layer and an output layer, wherein the hidden layer adopts a ReLU activation function; the encoder is used to take the filtered sample data as input, and map the filtered sample data to a low-dimensional vector in the latent space of the bidirectional generative adversarial network model to obtain second mapping data; the first mapping data and the second mapping data are inverse mappings to each other;

[0021] The discriminator includes a second gated cycle unit, which is used to connect the first mapping data with the second mapping data, perform authenticity judgment on the connection result, and output a defense judgment result.

[0022] The pre-trained bidirectional generative adversarial network model with gated recurrent units uses weighted Manhattan distance and weighted Euclidean distance to generate sample data, including:

[0023] In the historical database, obtain sample data of historical state quantities;

[0024] Calculate the weighted Manhattan distance between the sample data of all historical state quantities and the state quantity data that needs to be matched;

[0025] Select the sample data whose weighted Manhattan distance is less than the set distance value as the sample data after the first screening;

[0026] The sample data after the first screening is used as the similar day data, and the typical data is used as the past day data, and the Euclidean distance similarity value between the similar day data and the past day data is calculated;

[0027] Select the sample data whose Euclidean distance similarity value is greater than the similarity value set value as the sample data after the second screening.

[0028] The weighted Manhattan distance between all acquired historical state quantities and the state quantities to be matched is calculated as follows:

[0029]

[0030] Among them, D i is the weighted Manhattan distance between the sample data of the i-th historical state quantity and the state quantity data to be matched, Y is the state quantity data to be matched, X i is the sample data of the i-th historical state quantity, x k is the kth eigenvalue corresponding to the historical state quantity, y k is the kth eigenvalue corresponding to the state quantity to be matched, n is the number of eigenvalues ​​corresponding to the historical state quantity, θk is the weight coefficient of the kth eigenvalue corresponding to the i-th state quantity, δ k is the standard deviation of the kth eigenvalue corresponding to the i-th state quantity.

[0031] In the historical state quantity, weighted Euclidean distance is used to select similar days, and the calculation formula is as follows:

[0032]

[0033] Among them, WED τ,f is the weighted Euclidean distance, τ is the similar day index, f is the past day index, ΔD is the date distance between the similar day and the past day, ΔT is the temperature Euclidean distance difference between the similar day and the past day, ΔSI is the solar radiation Euclidean distance difference between the similar day and the past day, ΔR is the rainfall Euclidean distance difference between the similar day and the past day, ΔW is the wind speed Euclidean distance difference between the similar day and the past day, is the weight factor of date distance, is the weight factor of the temperature Euclidean distance difference, is the weight factor of the Euclidean distance difference of solar radiation, is the weight factor of rainfall Euclidean distance difference, is the weight factor of the wind speed Euclidean distance difference, which is obtained from past training and is calculated as follows:

[0034]

[0035] Among them, y τ.f is the dependent variable, representing the difference between the state quantity data of the similar day and the past day, α and β are independent variables, α represents the slope, β represents the intercept, K represents the past day data used to calculate the weight factor, and the difference between the state quantity data of the similar day and the past day y τ.f , the calculation formula is as follows:

[0036]

[0037] in, is the similar day data at time t, It is the past day data at time t.

[0038] The state quantity or historical state quantity at time t includes: the measured value of the AMI device, the state quantity of the energy storage device, the real-time electricity price, the date, the user load and the environmental factors, and the environmental factors include: dry-bulb temperature, dew point temperature, wet-bulb temperature, humidity, solar radiation, date, rainfall and wind speed.

[0039] The method uses the screened sample data to train a bidirectional generative adversarial network model with a gated recurrent unit to obtain a pre-trained bidirectional generative adversarial network model with a gated recurrent unit, including:

[0040] Step S100: using the sample data after the second screening to train the discriminator so as to maximize the objective function of the bidirectional generative adversarial network model with gated recurrent units;

[0041] Step S200: Use the sample data after the second screening to simultaneously train the generator and the encoder to minimize the objective function associated with the discriminator.

[0042] The objective function of the bidirectional generative adversarial network model with gated recurrent units is calculated as follows:

[0043]

[0044] in, is the objective function of the bidirectional generative adversarial network model with gated recurrent units, D(x,z) represents the discriminator with inputs x and z, and E z~pE(·|x) Indicates that z is the result of the encoder encoding the sample data x, E x~pG(·|z) Indicates that x is the result of the generator generating the input random vector z, E x~pX is the expected value of all sample data x, E z~pZ is the expected value of all random vectors z of the generator;

[0045] The loss function of the discriminator of the bidirectional generative adversarial network model with gated recurrent units is calculated as follows:

[0046]

[0047] Among them, loss D is the loss function of the discriminator, sigmoid() is the sigmoid function, D(z,G(z)) represents the discriminator with inputs z and G(z), and D(E(x),x) represents the discriminator with inputs E(x) and x;

[0048] The loss function of the generator and encoder network is calculated as follows:

[0049]

[0050] Among them, n is the total number of sample data.

[0051] When the false data injection based on the aggregator two-layer game attacks the smart grid, a new attack model constructed by the attacker is adopted. The new attack model includes an inner layer and an outer layer. The inner layer is the aggregator two-layer game model, and the outer layer is the attack planning model. The goal of the attacker in the new attack model is to obtain the maximum attack benefit with limited attack cost.

[0052] In the second aspect, the present application proposes a defense system for FDI attacks based on aggregator two-layer game, including:

[0053] The state quantity acquisition module is used to obtain the test data of the state quantity at time t when the false data injection based on the aggregator double-layer game attacks the smart grid;

[0054] The model defense module inputs the test data of the state quantity at time t into a pre-trained bidirectional generative adversarial network model with a gated recurrent unit to obtain a defense judgment result, wherein the training process of the pre-trained bidirectional generative adversarial network model with a gated recurrent unit includes: using weighted Manhattan distance and weighted Euclidean distance to screen sample data, using the screened sample data to train the bidirectional generative adversarial network model with a gated recurrent unit, and obtaining a pre-trained bidirectional generative adversarial network model with a gated recurrent unit;

[0055] The difference calculation module is used to calculate the difference between the defense judgment result and the actual electricity price;

[0056] The defense result judgment module is used to compare the size between the difference and the threshold; if the difference is less than the threshold, the smart grid has not been attacked by false data injection at time t; if the difference is greater than or equal to the threshold, the smart grid has been attacked by false data injection at time t, output the corrected electricity price at time t, and import the corrected electricity price at time t into the historical database.

[0057] Beneficial effects:

[0058] This application proposes a defense method and system for FDI attacks based on the two-layer game of aggregators. This application adopts a corresponding defense method for the false data injection attack on the smart grid by the two-layer game of aggregators. When constructing sample data, the weighted Manhattan distance is added to achieve accurate matching of state quantities; the weighted Euclidean distance is added to greatly improve the effectiveness of similar day sample extraction. The improved generative adversarial network can learn the inverse mapping from real data to latent space to better generate prediction data sets. The generator (G) and discriminator (D) with gated recurrent units (GRU) can ensure the temporal consistency of the generated samples, thereby improving the detection performance, and can effectively predict the load and electricity price at future times and effectively defend against attacks launched against aggregators. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] Figure 1 Flowchart of the defense method based on the aggregator double-layer game FDI attack in the embodiment of the present application;

[0060] Figure 2 Interaction mode diagram of the aggregator in the embodiment of the present application;

[0061] Figure 3Schematic diagram of a new attack model in an embodiment of the present application;

[0062] Figure 4 The distribution network connection diagram of the embodiment of the present application;

[0063] Figure 5 Load response curves of nodes 9 and 11 in the embodiment of the present application;

[0064] Figure 6 Schematic diagram of the training and defense process of the embodiment of the present application;

[0065] Figure 7 A bidirectional generative adversarial network model with a gated recurrent unit according to an embodiment of the present application;

[0066] Figure 8 ROC performance comparison of the embodiments of the present application;

[0067] Fig. 9 A schematic diagram of the defense system against FDI attacks based on the aggregator's two-tier game in an embodiment of the present application. DETAILED DESCRIPTION

[0068] The specific implementation of the present application is further described in detail below in conjunction with the drawings and examples.

[0069] In view of a new attack model, this application proposes a defense method and system for FDI attacks based on aggregators' double-layer game, and establishes a data preprocessing generative adversarial network method based on weighted Manhattan distance and weighted Euclidean distance. The approximate matching of state quantities is completed by weighted Manhattan distance, and then the precise matching of state quantities and the selection of similar days are completed by weighted Euclidean distance. The training speed is greatly improved by the preprocessed GAN method, and it has a high accuracy. At the same time, the original GAN ​​network is improved, and a bidirectional GRU-GAN model (a bidirectional generative adversarial network model with a gated recurrent unit, including: a bidirectional gated recurrent unit (Bidirectional Gated Recurrent Unit, BiGRU) and a generative adversarial network (Generative Adversarial Networks, GAN)) is proposed. The proposed bidirectional GAN ​​enables GAN to generate more prediction data sets by adding an encoder to the GAN model. At the same time, the gated recurrent unit is used to ensure the temporal consistency of the generated samples, thereby improving the detection performance.

[0070] Embodiment 1:

[0071] On the first hand, this application proposes a defense method for FDI attacks based on the two-tier game of aggregators, such as Figure 1 As shown, including:

[0072] Step S1: When the false data injection based on the aggregator two-layer game attacks the smart grid, the test data of the state quantity at time t is obtained;

[0073] Step S2: inputting the test data of the state quantity at time t into a pre-trained bidirectional generative adversarial network model with a gated recurrent unit to obtain a defense judgment result, wherein the training process of the pre-trained bidirectional generative adversarial network model with a gated recurrent unit includes: using weighted Manhattan distance and weighted Euclidean distance to screen sample data, using the screened sample data to train the bidirectional generative adversarial network model with a gated recurrent unit, and obtaining a pre-trained bidirectional generative adversarial network model with a gated recurrent unit;

[0074] Step S3: Calculate the difference between the defense determination result and the actual electricity price;

[0075] Step S4: comparing the difference with a threshold value;

[0076] Step S5: If the difference is less than the threshold, the smart grid is not attacked by false data injection at time t;

[0077] Step S6: If the difference is greater than or equal to the threshold, the smart grid has been attacked by false data injection at time t, and the corrected electricity price at time t is output and imported into the historical database.

[0078] In step S1, when the smart grid is attacked by false data injection based on the aggregator's two-layer game, a new attack model constructed by the attacker is used. The new attack model includes an inner layer and an outer layer. The inner layer is the aggregator's two-layer game model, and the outer layer is the attack planning model. The goal of the attacker in the new attack model is to obtain the maximum attack benefit with limited attack cost.

[0079] In this embodiment, it can be understood that: when false data is injected to attack the smart grid, it is necessary to effectively defend against the injected false data, but different false data makes the corresponding defense methods different. When the attacker adopts a new attack model, the existing defense method is ineffective. Through the analysis of the new attack model, it can be seen that: the new attack model includes an inner layer and an outer layer. The inner layer is a two-layer game model of an aggregator, and the outer layer is an attack planning model. The attacker's goal is to obtain the maximum attack benefit with limited attack costs.

[0080] Among them, the aggregator's interaction objects include two entities: power companies and users. Figure 2As shown in the figure, the aggregator plays a game with the power company and the user at the same time. As energy sellers, the power company and the aggregator pursue their own interests. At the same time, as energy consumers, the user will reduce his electricity expenditure through demand response. Therefore, the power company and the aggregator, the aggregator and the user respectively constitute the upper and lower attackers of the two-layer game model, attacking the weak links in the dynamic interaction process of the aggregator. The dynamic interaction process includes demand response interaction and power company interaction, such as Figure 2 shown.

[0081] At the same time, considering the worst attack by the attacker, it is necessary to analyze the impact of users on energy consumption and electricity price satisfaction, and express the user electricity price satisfaction function under a certain aggregator as: P = ρ n (ΔQ n,t p t -Q n,ideal p t ), user energy satisfaction is expressed as: R = ρ n |ΔQ n,t -Q n,ideal |, where ρ n is the dissatisfaction coefficient of user n, reflecting the user's current energy consumption experience; p t is the electricity price, ΔQ n,t is the stimulus response of user n in period t, Q n,ideal is the ideal response power consumption of user n, then the user satisfaction function is expressed as:

[0082] U=W1P+W2R=W1(ρ n (ΔQ n,t p t -Q n,ideal p t ))+W2(ρ n |ΔQ n,t -Q n,ideal |)

[0083] Among them, P is the user electricity price satisfaction function under the aggregator, R is the user energy consumption satisfaction, W1 is the weight of the user electricity price satisfaction, W2 is the weight of the user energy consumption satisfaction, and U is the user satisfaction function.

[0084] After the load aggregator issues the time period price, the user will formulate his own response strategy based on the principle of minimizing his own electricity expenditure, but he will inevitably lose a certain degree of satisfaction while responding to the electricity price. Therefore, the objective function of user n under aggregator i at time t is:

[0085]

[0086] in, is the objective function of user n under aggregator i at time t, p i,tThe response price set for the i-th aggregator.

[0087] (1) Inner-layer aggregator two-layer game model:

[0088] In the dynamic interaction process, the strategies of power companies, aggregators and users will affect each other. Therefore, the aggregator two-layer game model constructed by the attacker includes: the upper model and the lower model, such as Figure 3 shown.

[0089] The upper model consists of a master-slave game process between the power company and M aggregators. The power company generates service prices based on the false unit cost function with the goal of maximizing its own revenue. Taking the attack on the jth unit as an example, it is expressed as:

[0090]

[0091] in, is the service price, F elec is the revenue expression of the power company, is the total demand response after the attack, p t ′ is the electricity price sold by the power company, W t ′ is the total unit operating cost, a t is the cost coefficient of the first unit, b t is the cost coefficient of the second unit, c t is the cost coefficient of the third unit, is the lower limit of electricity price, The lower limit of electricity price.

[0092] Among them, the aggregator in the lower model generates compensation and electricity prices based on the false service prices of the power company and the tampered aggregator cost function with the goal of maximizing its own profits, and obtains the power consumption response of the user's electricity consumption behavior. Taking the i-th aggregator as an example, it is expressed as:

[0093]

[0094] 0≤σ i,t

[0095] in, is the compensation and electricity price of the i-th aggregator, is the revenue expression of the i-th aggregator in period t, p i,t The electricity price sold by the i-th aggregator in period t is W i,t is the maintenance and operation cost of the i-th aggregator in period t, α i,t The first cost coefficient of the i-th node, β i,t The second cost coefficient of the i-th node, γ i,t is the third cost coefficient of the i-th node.

[0096] The revenue expression of n users under aggregator i is:

[0097]

[0098] in, is the revenue of n users under aggregator i, Q n is the total transferable load of the nth user in a day, is the upper limit of the change in the single-period response of the shiftable load, ΔQ n,t is the translatable load of the nth user at time t, is the objective function of user n under aggregator i at time t.

[0099] (2) Outer attack planning model:

[0100] In this embodiment, the outer attack planning model includes: total tampering cost, attack benefit, and economic loss function of the power company and the aggregator;

[0101] The total tampering cost includes: the attack cost of tampering with the i-th aggregator data and the attack cost of tampering with the j-th power company unit data. The attack cost is described as follows: the attacker steals the key cost function information of the power company unit and the aggregator through the communication link vulnerability at the same time, and tampering with the data. The attack cost of the attacker using the vulnerability to invade and tamper with the i-th aggregator data is expressed as:

[0102]

[0103] Among them, g i It represents the difficulty score of the i-th aggregator data, and N is the number of aggregation quotients;

[0104] The attack cost of tampering the data of the jth unit is expressed as:

[0105]

[0106] Among them, k j It represents the difficulty score of the j-th unit data, and M is the number of units.

[0107] According to the attack cost of tampering the i-th aggregator data and the attack cost of tampering the j-th power company unit data, the total tampering cost is obtained, and the calculation formula is as follows:

[0108]

[0109] The attack benefits are described as follows: On the one hand, the attacker tampers with the cost function information to cause the power company and the aggregator to misprice, thereby causing the load to be mis-dispatched, and the attacker will gain benefits from it. In this embodiment, the total line active power flow fluctuation rate λ tThe change in busbar injected power is taken as the attacker’s gain from the power system during this period. The attack gain is calculated as follows:

[0110]

[0111] Among them, λ l is the active power flow fluctuation of power network branch l, p lb is the active power flow of l branches during normal operation, is the active power flow difference, λ t is the total active power flow fluctuation of the power network at time t, λ l,t is the active power flow fluctuation of the lth branch at time t.

[0112] The economic loss function of the power company and the aggregator is described as follows: Due to the modification of the cost function of the unit, the power company's misjudgment of the unit cost will lead to its own pricing being too low, resulting in certain economic losses. When the aggregator cannot provide the response load required by the contract due to the modification of the cost function, the power company will claim compensation from the aggregator. The economic loss function L of the power company and the aggregator is expressed as:

[0113]

[0114] in, is the load response value after attack, N t is the number of aggregators attacked in period t, p pen is the unit price of breach of contract compensation cost, Q i,s is the difference between the actual response of the i-th aggregator and the response threshold, Δp′ is the mispricing difference of the power company after the attack, ΔW′ is the cost difference of the generator after the attack, K′ is the linear coefficient, and p0 is the benchmark breach compensation price.

[0115] (3) The attacker’s goal.

[0116] In this embodiment, the attacker's goal is to obtain the maximum attack benefit under limited attack costs, and the attacker's benefit function is defined as:

[0117]

[0118] The attack constraints are:

[0119]

[0120] Among them, N(·) is the normalization function; ω is the specific gravity coefficient, N a is the number of aggregators attacked, M a is the number of attacked units, A is the set of attacked units, B is the set of attacked aggregators, a ij,t is the cost parameter tampering amount, α A,jis the empirical estimate of the first attacker, α B,i is the empirical estimate of the second attacker, β A,j is the empirical estimate of the third attacker, β B,i is the empirical estimate of the third attacker; C A,j is the attack cost of the j-th unit, C B,i is the attack cost of the i-th aggregator, δ A,j is the first binary variable, δ B,i It is the second binary variable. When the value is 1, this unit and aggregator are invaded. RE is the maximum attack cost of the attacker.

[0121] In this example, we set the 5th period as the attack period, set the number of attack nodes to 2, set the maximum attack resource to 0.4, and obtain the best attack aggregator as [5,7], and the injected tampering vector is [0.7805,0.6343]×10 -3 ,Depend on Figure 4 It can be seen that aggregators 5 and 7 control distribution nodes 11 and 9 respectively. Under the influence of tampered data, their response change curves are as follows: Figure 5 As shown, during the target period, aggregator No. 5 guided load users to reduce load usage by 1,235 kW, and load aggregator No. 7 guided load users to reduce load usage by 943 kW.

[0122] In step S2, the pre-trained bidirectional generative adversarial network model with gated recurrent units uses weighted Manhattan distance and weighted Euclidean distance to generate sample data, such as Figure 6 As shown, including:

[0123] Step S2.1: Obtain sample data of historical state quantities in the historical database;

[0124] Step S2.2: Calculate the weighted Manhattan distance between the sample data of all historical state quantities and the state quantity data to be matched;

[0125] Step S2.3: Select the sample data whose weighted Manhattan distance is less than the set distance value as the sample data after the first screening;

[0126] Step S2.4: Using the sample data after the first screening as similar day data and the typical data as past day data, calculate the Euclidean distance similarity value between the similar day data and the past day data;

[0127] Step S2.5: Select sample data corresponding to the Euclidean distance similarity value greater than the similarity value set value as the sample data after the second screening.

[0128] In step S2.3, the weighted Manhattan distance between all the acquired historical state quantity sample data and the state quantity data to be matched is calculated, which is described as follows: Assume that the historical state quantity sample data set X constructed by the system is X = [X1, X2, ..., X i ,…X L ] contains sample data of L state quantities, each state quantity X i =[x1,x2,x3,…x n ] contains n eigenvalues, assuming that D i is the Manhattan distance between the sample data Y of the state quantity to be matched and the sample data X of the historical state quantity:

[0129] Y=[y1,y2,y3,…y n ]

[0130]

[0131] In the above Manhattan distance, standardization is performed. In the historical database, the state quantity is composed of multi-dimensional features, in which the size of each feature is different. In order to make all dimensional variables play the same role in distance measurement, standardization must be performed. Therefore, the sample data Y of the state quantity that needs to be matched is the sample data X of the historical state quantity. i The Manhattan distance between them is improved to:

[0132]

[0133] Among them, δ k It is the standard deviation of the kth state feature of the i-th state quantity in the feature library. This value can be obtained when the feature library is established.

[0134] After standardization, the state quantity characteristics of all sizes can be measured at the same level. However, from a practical point of view, it is necessary to take into account the impact of different characteristics on matching, so a weighting coefficient should be assigned to each feature quantity in state quantity matching. The above formula can be modified as follows:

[0135]

[0136] Among them, D i is the weighted Manhattan distance between the sample data of the i-th historical state quantity and the state quantity data to be matched, Y is the state quantity data to be matched, X i is the sample data of the i-th historical state quantity, x k is the kth eigenvalue corresponding to the historical state quantity, y k is the kth eigenvalue corresponding to the state quantity to be matched, n is the number of eigenvalues ​​corresponding to the historical state quantity, θ k is the weight coefficient of the kth eigenvalue corresponding to the i-th state quantity, δk is the standard deviation of the kth eigenvalue corresponding to the i-th state quantity.

[0137] In the historical state quantity, weighted Euclidean distance is used to select similar days, and the calculation formula is as follows:

[0138]

[0139] Among them, WED τ,f is the weighted Euclidean distance, τ is the similar day index, f is the past day index, ΔD is the date distance between the similar day and the past day, ΔT is the temperature Euclidean distance difference between the similar day and the past day, ΔSI is the solar radiation Euclidean distance difference between the similar day and the past day, ΔR is the rainfall Euclidean distance difference between the similar day and the past day, ΔW is the wind speed Euclidean distance difference between the similar day and the past day, is the weight factor of date distance, is the weight factor of the temperature Euclidean distance difference, is the weight factor of the Euclidean distance difference of solar radiation, is the weight factor of rainfall Euclidean distance difference, is the weight factor of the wind speed Euclidean distance difference, which is obtained from past training and is calculated as follows:

[0140]

[0141] Among them, y τ.f is the dependent variable, representing the difference between the state quantity data of the similar day and the past day, α and β are independent variables, α represents the slope, β represents the intercept, K represents the past day data used to calculate the weight factor, and the difference between the state quantity data of the similar day and the past day y τ.f , the calculation formula is as follows:

[0142]

[0143] in, is the similar day data at time t, It is the past day data at time t.

[0144] In this embodiment, if the weighted Euclidean distance is less than the distance setting value, it is a similar day. Then, based on the state quantity of the similar day and the state quantity of the past day, the Euclidean distance similarity value is calculated; the similarity between the state quantity of the similar day and the state quantity of the past day is judged based on the Euclidean distance similarity value. In this embodiment, the Euclidean distance similarity (EDS) between the state quantity of the similar day and the state quantity of the past day is defined to evaluate the quality of the selection result. When EDS is close to 1, the state quantity of the selected day is closer to the state quantity of the similar day. As EDS approaches zero, the gap between the state quantity of the selected day and the state quantity of the similar day increases. The calculation formula of Euclidean distance similarity is as follows:

[0145]

[0146] in, is the state quantity of similar days at time t, It is the state quantity of the past day f at time t, and EDS is the Euclidean distance similarity value.

[0147] The state quantity or historical state quantity at time t includes: the measured value of the AMI device, the state quantity of the energy storage device, the real-time electricity price, the date, the user load and the environmental factors, and the environmental factors include: dry bulb temperature, dew point temperature, wet bulb temperature, humidity, solar radiation, date, rainfall and wind speed. Among them, the AMI device refers to the Advanced Metering Infrastructure (AMI), which is an automatic two-way flow architecture implemented between smart meters and load aggregators.

[0148] In step 2, this embodiment adds an encoder to the bidirectional GAN ​​model so that the GAN can learn the inverse mapping from real data to the latent space to better generate more prediction data sets. At the same time, the generator (G) and discriminator (D) of the gated recurrent unit (GRU) are used to capture the temporal dependency in the time series data to ensure the temporal consistency of the generated samples, thereby improving the detection performance.

[0149] The pre-trained bidirectional generative adversarial network model with gated recurrent units, such as Figure 7 As shown, it includes: generator, encoder and discriminator;

[0150] The generator includes a first gated cycle unit, which is used to take the filtered sample data as input and generate first mapping data G(x) after transformation;

[0151] The encoder comprises: three neural network layers, a hidden layer and an output layer, wherein the hidden layer adopts a ReLU activation function; the encoder is used to take the filtered sample data as input, and map the filtered sample data to a low-dimensional vector in the latent space of the bidirectional generative adversarial network model to obtain the second mapping data E(z); the first mapping data G(x) and the second mapping data E(z) are inverse mappings to each other;

[0152] The discriminator includes a second gated cycle unit, which is used to connect the first mapping data G(x) with the second mapping data E(z), perform authenticity judgment on the connection result, and output a defense judgment result.

[0153] Among them, GRU contains a gating unit to regulate the information flow, and GRU has a more streamlined structure and calculation process. Its core structure can be expressed as follows:

[0154] z t =σ(W (z) x t +U (z) h t-1 )

[0155] r t =σ(W (r) x t +U (r) h t-1 )

[0156]

[0157] Among them, x t Update gate z for the current input information t and reset gate r t The function is used as an intermediate entity in this framework; σ is the sigmoid activation function, and the sum of the input and the past hidden layer state is used Indicates that h t-1 represents the past hidden layer state, W (z) is the trainable parameter matrix of the update gate, U (z) is the trainable weight matrix of the update gate, W (r) is the trainable parameter matrix of the reset gate, U (r) is the trainable weight matrix of the reset gate, U is the trainable weight matrix of the state sum, W is the trainable parameter matrix of the state sum, is the Hadamard product, and tanh is the tanh activation function.

[0158] GRU is used as the generator and discriminator of GAN, which effectively increases the number of samples within a specific category and improves the accuracy of the evaluation of the quality of the generated samples, thereby improving the effectiveness of the data set. At the same time, a linear layer is introduced to facilitate the generator to convert the generated hidden state into the dimension of the generated result, thereby generating specific data. And the discriminator distinguishes between actual samples and generated samples. During the forward propagation process, the input sequence is initially processed by the GRU layer to produce the output and the final hidden state. Subsequently, the last step in the output sequence is selected and guided to the linear layer for transformation, producing the generated result. Finally, the generated result is passed as the output. This design helps to improve the effectiveness of the GAN model.

[0159] The overall structure of bidirectional GRU-GAN is as follows Figure 7As shown. The encoder is a neural network with three dense layers and ReLU as the activation function for the hidden and output layers. It takes real samples as input and maps them to a low-dimensional vector in the latent space. In this structural design, the generator (and the corresponding encoder) and the discriminator are trained separately and updated indirectly through the discriminator. A connection part is added to the discriminator to associate the data x (or G (z)) with its latent space E (x) (or z), and then the two connected data are input into the discriminator. When optimized, G and E are inverse mappings of each other, which can be shown as x = G (E (x)) and z = E (G (z)). Bidirectional GRU-GAN training is also divided into two steps. The first step is to train the discriminator (D) to maximize the objective function described by the following formula without updating the generator (G) or the encoder (E). The second step involves training the generator and encoder simultaneously to minimize the same objective function associated with the discriminator (D).

[0160] The method of using the sample data to train a bidirectional generative adversarial network model with a gated recurrent unit to obtain a pre-trained bidirectional generative adversarial network model with a gated recurrent unit includes:

[0161] Step S100: using the sample data after the second screening to train the discriminator so as to maximize the objective function of the bidirectional generative adversarial network model with gated recurrent units;

[0162] Step S200: Use the sample data after the second screening to simultaneously train the generator and the encoder to minimize the same objective function associated with the discriminator.

[0163] The objective function of the bidirectional generative adversarial network model with gated recurrent units is calculated as follows:

[0164]

[0165] in, is the objective function of the bidirectional generative adversarial network model with gated recurrent units, D(x,z) is the discriminator, and E z~pE(·|x) Indicates that z is the result of the encoder encoding the sample data x, E x~pG(·|z) Indicates that x is the result of the generator generating the input random vector z, E x~pX is the expected value of all sample data x, E z~pZ is the expected value of all random vectors z of the generator;

[0166] The loss function of the discriminator of the bidirectional generative adversarial network model with gated recurrent units is calculated as follows:

[0167]

[0168] Among them, loss D is the loss function of the discriminator, sigmoid() is the sigmoid function, D(z,G(z)) represents the discriminator with inputs z and G(z), and D(E(x),x) represents the discriminator with inputs E(x) and x;

[0169] The loss function of the generator and encoder network is calculated as follows:

[0170]

[0171] Where n is the total number of training samples.

[0172] To describe the above training process more clearly, an example is given below:

[0173] Step S100: A small batch of samples x of X is used as input to the generator G.

[0174] Step S101: Sample data x corresponds to mapping z as input of encoder E.

[0175] Step S102: Connect the sample data [G(x), x] with its latent space [z, E(z)].

[0176] Step S103: Update the discriminator by maximizing the objective function.

[0177] Step S200: A small batch of samples of X is used as input to the generator G.

[0178] Step S201: Sample data x corresponds to mapping z as input of encoder E.

[0179] Step S202: Connect the sample data [G(x), x] with its latent space [z, E(z)].

[0180] Step S203: Update the generator and encoder (without updating the discriminator) by minimizing the objective function.

[0181] Simulation results:

[0182] In this embodiment, the evaluation indicators such as root mean square error (RMSE), mean absolute error (MAE), mean absolute percentage error (MAPE) and goodness of fit R are used. 2 Demonstrating the predictive performance of pretrained GANs.

[0183] Table RMSE, MAE, MAPE and goodness of fit R 2

[0184] MAE RMSE MAPE <![CDATA[R 2 ]]> The method of this embodiment 0.00655 0.0064 0.01564 0.98226 DA-RNN 0.00945 0.0154 0.02357 0.97897 BPNN 0.01689 0.0212 0.03782 0.94659 GRU 0.01608 0.0208 0.04136 0.96415 MLR 0.02151 0.0265 0.05109 0.92526

[0185] Among them, DA-RNN is a dual-stage attention-based recurrent neural network, BPNN is a back propagation neural network, GRU is a gated recurrent unit, and MLR is a multiple linear regression. The random false data injection attack is selected as the attack model for this part of the simulation. 1000 simulated attacks are carried out to verify the detection effect by comparing the missed detection rates of different detection methods under the same false alarm rate. Figure 8 As shown, from Figure 8 It can be seen that as the false alarm rate increases, the detection method of this embodiment shows a lower missed detection rate and a better detection effect.

[0186] Embodiment 2:

[0187] This embodiment proposes a defense system for FDI attacks based on the aggregator's two-layer game, such as Fig. 9 As shown, it includes: a state quantity acquisition module, a model defense module, a difference calculation module, and a defense result determination module, and the state quantity acquisition module, the model defense module, the difference calculation module, and the defense result determination module are connected in sequence;

[0188] The state quantity acquisition module is used to obtain the test data of the state quantity at time t when the false data injection based on the aggregator double-layer game attacks the smart grid;

[0189] A model defense module is used to input the test data of the state quantity at time t into a pre-trained bidirectional generative adversarial network model with a gated recurrent unit to obtain a defense judgment result, wherein the training process of the pre-trained bidirectional generative adversarial network model with a gated recurrent unit includes: using weighted Manhattan distance and weighted Euclidean distance to screen sample data, using the screened sample data to train the bidirectional generative adversarial network model with a gated recurrent unit, and obtaining a pre-trained bidirectional generative adversarial network model with a gated recurrent unit;

[0190] The difference calculation module is used to calculate the difference between the defense judgment result and the actual electricity price;

[0191] The defense result judgment module is used to compare the size between the difference and the threshold; if the difference is less than the threshold, the smart grid has not been attacked by false data injection at time t; if the difference is greater than or equal to the threshold, the smart grid has been attacked by false data injection at time t, output the corrected electricity price at time t, and import the corrected electricity price at time t into the historical database.

[0192] The various embodiments in the present application are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.

[0193] The protection scope of the present application is not limited to the above-mentioned embodiments. Obviously, those skilled in the art can make various changes and modifications to the present disclosure without departing from the scope and spirit of the present disclosure. If these changes and modifications fall within the scope of the claims of the present disclosure and their equivalents, the intention of the present disclosure also includes these changes and modifications.

Claims

1. A defense method against FDI attacks based on aggregator two-tier game, characterized by: include: When the smart grid is attacked by false data injection based on the aggregator's two-layer game, the test data of the state quantity at time t is obtained; Inputting the test data of the state quantity at time t into a pre-trained bidirectional generative adversarial network model with a gated recurrent unit to obtain a defense judgment result, wherein the training process of the pre-trained bidirectional generative adversarial network model with a gated recurrent unit includes: using weighted Manhattan distance and weighted Euclidean distance to filter sample data, and using the filtered sample data to train the bidirectional generative adversarial network model with a gated recurrent unit to obtain a pre-trained bidirectional generative adversarial network model with a gated recurrent unit; Calculate the difference between the defense judgment result and the actual electricity price; Comparing the difference with a threshold value; If the difference is less than the threshold, the smart grid is not attacked by false data injection at time t; If the difference is greater than or equal to the threshold, the smart grid has been attacked by false data injection at time t, and the corrected electricity price at time t is output and imported into the historical database.

2. The defense method for FDI attacks based on the aggregator's double-layer game according to claim 1 is characterized in that: The pre-trained bidirectional generative adversarial network model with gated recurrent units includes: a generator, an encoder, and a discriminator; The generator includes a first gated recurrent unit, configured to take the filtered sample data as input and generate first mapping data after transformation; The encoder comprises: three neural network layers, a hidden layer, and an output layer, wherein the hidden layer uses a ReLU activation function; the encoder is configured to take the filtered sample data as input and map the filtered sample data to a low-dimensional vector in the latent space of a bidirectional generative adversarial network model to obtain second mapped data; the first mapped data and the second mapped data are inversely mapped to each other; The discriminator includes a second gated recurrent unit, which is used to connect the first mapping data and the second mapping data, perform authenticity judgment on the connection result, and output a defense judgment result.

3. The defense method for FDI attacks based on the aggregator's double-layer game according to claim 1 is characterized in that: The pre-trained bidirectional generative adversarial network model with gated recurrent units uses weighted Manhattan distance and weighted Euclidean distance to generate sample data, including: In the historical database, obtain sample data of historical state quantities; Calculate the weighted Manhattan distance between the sample data of all historical state quantities and the state quantity data that needs to be matched; Select the sample data whose weighted Manhattan distance is less than the set distance value as the sample data after the first screening; The sample data after the first screening is used as the similar day data, and the typical data is used as the past day data. The Euclidean distance similarity value between the similar day data and the past day data is calculated. The sample data whose Euclidean distance similarity value is greater than the similarity value set value is selected as the sample data after the second screening.

4. The defense method for FDI attacks based on the aggregator's double-layer game according to claim 3 is characterized in that: The weighted Manhattan distance between all acquired historical state quantities and the state quantities to be matched is calculated as follows: Among them, D i is the weighted Manhattan distance between the sample data of the i-th historical state quantity and the state quantity data to be matched, Y is the state quantity data to be matched, X i is the sample data of the i-th historical state quantity, x k is the kth eigenvalue corresponding to the historical state quantity, y k is the kth eigenvalue corresponding to the state quantity to be matched, n is the number of eigenvalues ​​corresponding to the historical state quantity, θ k is the weight coefficient of the kth eigenvalue corresponding to the i-th state quantity, δ k is the standard deviation of the kth eigenvalue corresponding to the i-th state quantity.

5. The method for defending against FDI attacks based on the aggregator's double-layer game according to claim 3 is characterized in that: In the historical state quantity, weighted Euclidean distance is used to select similar days, and the calculation formula is as follows: Among them, WED τ,f is the weighted Euclidean distance, τ is the similar day index, f is the past day index, ΔD is the date distance between the similar day and the past day, ΔT is the temperature Euclidean distance difference between the similar day and the past day, ΔSI is the solar radiation Euclidean distance difference between the similar day and the past day, ΔR is the rainfall Euclidean distance difference between the similar day and the past day, ΔW is the wind speed Euclidean distance difference between the similar day and the past day, is the weight factor of date distance, is the weight factor of the temperature Euclidean distance difference, is the weight factor of the Euclidean distance difference of solar radiation, is the weight factor of rainfall Euclidean distance difference, is the weight factor of the wind speed Euclidean distance difference, which is obtained from past daily training and is calculated as follows: Among them, y τ.f is the dependent variable, representing the difference between the state quantity data of the similar day and the past day, α and β are independent variables, α represents the slope, β represents the intercept, K represents the past day data used to calculate the weight factor, and the difference between the state quantity data of the similar day and the past day, y τ.f , the calculation formula is as follows: in, is the similar day data at time t, It is the past day data at time t.

6. The method for defending against FDI attacks based on the aggregator's double-layer game according to claim 3 is characterized in that: The state quantity or historical state quantity at time t includes: the measured value of the AMI device, the state quantity of the energy storage device, the real-time electricity price, the date, the user load and the environmental factors, and the environmental factors include: dry-bulb temperature, dew point temperature, wet-bulb temperature, humidity, solar radiation, date, rainfall and wind speed.

7. The method for defending against FDI attacks based on the aggregator's double-layer game according to claim 3 is characterized in that: The method uses the filtered sample data to train a bidirectional generative adversarial network model with a gated recurrent unit to obtain a pre-trained bidirectional generative adversarial network model with a gated recurrent unit, including: Step S100: using the sample data after the second screening to train the discriminator so as to maximize the objective function of the bidirectional generative adversarial network model with a gated recurrent unit; Step S200: Use the sample data after the second screening to train the generator and encoder simultaneously to minimize the objective function associated with the discriminator.

8. The method for defending against FDI attacks based on the aggregator's double-layer game according to claim 7 is characterized in that: The objective function of the bidirectional generative adversarial network model with gated recurrent units is calculated as follows: in, is the objective function of the bidirectional generative adversarial network model with gated recurrent units, D(x,z) represents the discriminator with inputs x and z, and E z~pE(·|x) Indicates that z is the result of the encoder encoding the sample data x, E x~pG(·|z) Indicates that x is the result of the generator generating the input random vector z, E x~pX is the expected value of all sample data x, E z~pZ is the expected value of all random vectors z of the generator; The loss function of the discriminator of the bidirectional generative adversarial network model with gated recurrent units is calculated as follows: Among them, loss D is the loss function of the discriminator, sigmoid() is the sigmoid function, D(z,G(z)) represents the discriminator with input z and G(z), and D(E(x),x) represents the discriminator with input E(x) and x; The loss function of the generator and encoder network is calculated as follows: Where n is the total number of sample data.

9. The method for defending against FDI attacks based on the aggregator's double-layer game according to claim 1 is characterized in that: When the false data injection based on the aggregator two-layer game attacks the smart grid, a new attack model constructed by the attacker is adopted. The new attack model includes an inner layer and an outer layer. The inner layer is the aggregator two-layer game model, and the outer layer is the attack planning model. The goal of the attacker in the new attack model is to obtain the maximum attack benefit under limited attack costs.

10. A defense system against FDI attacks based on aggregator two-tier game, characterized by: include: The state quantity acquisition module is used to obtain the test data of the state quantity at time t when the false data injection based on the aggregator two-layer game attacks the smart grid; A model defense module is configured to input the test data of the state quantity at time t into a pre-trained bidirectional generative adversarial network model with a gated recurrent unit to obtain a defense judgment result, wherein the training process of the pre-trained bidirectional generative adversarial network model with a gated recurrent unit includes: using weighted Manhattan distance and weighted Euclidean distance to filter sample data, and using the filtered sample data to train the bidirectional generative adversarial network model with a gated recurrent unit to obtain a pre-trained bidirectional generative adversarial network model with a gated recurrent unit; The difference calculation module is used to calculate the difference between the defense judgment result and the actual electricity price; The defense result judgment module is used to compare the size between the difference and the threshold; if the difference is less than the threshold, the smart grid has not been attacked by false data injection at time t; if the difference is greater than or equal to the threshold, the smart grid has been attacked by false data injection at time t, output the corrected electricity price at time t, and import the corrected electricity price at time t into the historical database.