Secondary frequency control method and device against false data injection and storage medium
By using a pre-trained neural network to detect and replace frequency compensation quantities, the problem of frequency deviation and power imbalance caused by spurious data injection in distributed microgrids was solved, enabling rapid recovery of frequency control and power balance, and improving the system's resistance to attacks.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- DONGHUA UNIV
- Filing Date
- 2026-04-29
- Publication Date
- 2026-05-29
AI Technical Summary
In distributed microgrids, existing secondary frequency control methods are unable to quickly identify and recover from spurious data injections, leading to frequency deviations and power distribution imbalances, which in severe cases can cause abnormal system oscillations or shutdowns.
A pre-trained neural network is used to detect whether spurious data injection occurs in the target unit by utilizing the local frequency compensation amount of other distributed generation units. When injection is detected, the local frequency compensation amount is replaced, and the frequency compensation amount is predicted by a long short-term memory neural network. The difference degree and absolute difference threshold are dynamically adjusted to improve the detection accuracy.
It can quickly identify spurious data injection, effectively restore frequency and power balance, avoid system instability, and improve the anti-attack capability of distributed microgrids.
Smart Images

Figure CN122118789A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of microgrid control technology, specifically relating to a secondary frequency control method, device, and storage medium for resisting spurious data injection. Background Technology
[0002] In a distributed microgrid, primary frequency control of distributed generation units (DRGs), also known as frequency droop control, relies solely on the measured values of frequency and active power of each DRG to achieve local control, power distribution, and stable operation. However, this can cause the actual frequency of the DRGs to deviate from the rated frequency of the distributed microgrid. Secondary frequency control, on the other hand, communicates with neighboring DRGs to achieve distributed collaborative control, thereby ensuring that the active power output of each DRG is evenly distributed, compensating for the frequency deviation caused by droop control, and restoring the preset rated frequency of the distributed microgrid.
[0003] However, because distributed microgrids typically rely on communication networks for information exchange, they are vulnerable to cyberattacks. False data injection (FDI) attacks, in particular, tamper with the local measurement signals or status data of distributed generation units (DRGs), causing the controllers of each DRG to receive false local feedback signals or neighbor communication signals, thus misleading the generation of local control commands. Existing secondary frequency control methods struggle to quickly and effectively identify FDI, and the time required to restore the original steady state after identification is long. Once FDI is injected into the secondary control loop, it disrupts the original frequency recovery and power sharing functions of the secondary frequency control, leading to an imbalance in the distribution of active power output from each DRG, deviations of the frequency of each DRG from its preset rated value, and loss of frequency synchronization among the DRGs. In severe cases, this can cause abnormal oscillations or shutdowns in the distributed microgrid system. Summary of the Invention
[0004] The purpose of this invention is to overcome the shortcomings of the prior art and provide a secondary frequency control method, apparatus and storage medium to resist false data injection, thereby solving the problem of false data injection damaging the secondary frequency control function.
[0005] To solve the above-mentioned technical problems, the present invention is implemented using the following technical solution:
[0006] In a first aspect, the present invention provides a secondary frequency control method for resisting spoofed data injection, comprising:
[0007] Obtain the local frequency compensation amount of each distributed generation unit in the distributed microgrid;
[0008] The local frequency compensation amount of the distributed generation units other than the target distributed generation unit to be controlled is input into the pre-trained neural network, and the predicted frequency compensation amount of the target distributed generation unit is output.
[0009] Based on the local frequency compensation amount and the predicted frequency compensation amount of the target distributed generation unit, detect whether the target distributed generation unit has experienced false data injection.
[0010] When false data injection is detected in the target distributed generation unit, the predicted frequency compensation amount of the target distributed generation unit is replaced with the local frequency compensation amount to compensate for the frequency deviation caused by the droop control of the target distributed generation unit.
[0011] The aforementioned secondary frequency control method for resisting false data injection also includes: when no false data injection is detected in the target distributed generation unit, re-acquiring the local frequency compensation amount of each distributed generation unit in the distributed microgrid.
[0012] The aforementioned secondary frequency control method for resisting spurious data injection, wherein obtaining the local frequency compensation amount of each distributed generation unit within the distributed microgrid includes:
[0013] Under the communication topology of the distributed microgrid, the measured frequency and active power of each distributed generation unit are obtained, and the local frequency compensation of each distributed generation unit is calculated.
[0014] No. Local frequency compensation amount of distributed generation units in Taiwan The calculation formula is:
[0015] ,
[0016] In the formula, The preset frequency control gain coefficient; For the first The set of neighboring distributed generation units of a distributed generation unit; Indicates the first The serial number of the neighboring distributed generation units of the distributed generation unit; Let be the communication characterization coefficient, when the th Taiwan Distributed Generation Unit and the First When communicating with neighboring distributed generation units, When the first Taiwan's distributed generation units are not related to the first When communicating with neighboring distributed generation units, ; For the first The frequency output of the neighboring distributed generation unit; For the first The frequency output by the distributed generation unit; The nominal value characterization coefficient is used when the first... When the distributed generation unit receives the preset rated frequency of the distributed microgrid, When the first When the distributed generation unit does not receive the preset rated frequency of the distributed microgrid, ; This is the preset rated frequency; This is the preset power control gain coefficient; For the preset first Active power droop factor of neighboring distributed generation units; For the first The active power output of the neighboring distributed generation unit; For the preset first Active power droop factor of distributed generation unit; For the first The active power output of the distributed generation unit.
[0017] The aforementioned secondary frequency control method for resisting spoofed data injection includes the following steps in the dataset construction process before neural network training:
[0018] In a pre-built distributed microgrid simulation model, various operating conditions are simulated. The local frequency compensation of all distributed generation units at the same time is used as a set of data and an independent label is added. Multiple sets of data under different operating conditions are collected. The different operating conditions include four types of operating states: distributed microgrid startup process, steady-state operation, operating condition switching and operation recovery, as well as three types of disturbances: load amplitude variation, output variation of each distributed generation unit, and communication delay. The independent label is used to identify data under different operating conditions and at different times. For each set of data, each distributed generation unit is used as the target distributed generation unit, the local frequency compensation of the other distributed generation units is used as the input feature of the neural network, and the local frequency compensation of the target distributed generation unit is used as the output label to construct a dataset for neural network training.
[0019] In the aforementioned secondary frequency control method for resisting the injection of false data, the pre-trained neural network is a long short-term memory neural network, or a backpropagation neural network, or a recurrent neural network.
[0020] The process of constructing the dataset before training a Long Short-Term Memory (LSTM) neural network includes:
[0021] For each sample in the dataset used for neural network training, the samples are reorganized chronologically according to their independent labels to obtain time series of local frequency compensation amounts for each distributed generation unit under different operating conditions. For the time series of local frequency compensation amounts for each distributed generation unit under each operating condition, multiple sets of time series data are extracted sequentially from the start time according to a time window of preset length and time step size. Each set of time series data includes the local frequency compensation amounts of each distributed generation unit in the same time period. For each set of time series data, each distributed generation unit is used as the target distributed generation unit, and the local frequency compensation amounts of the other distributed generation units in the same time period are used as the input features of the long short-term memory neural network. The local frequency compensation amount of the target distributed generation unit at the last moment in the same time period is used as the output label to construct samples for training the long short-term memory neural network. The sample set under different operating conditions is the dataset used for training the long short-term memory neural network.
[0022] The aforementioned secondary frequency control method for resisting spoofed data injection, when Less than the preset total When, the step of detecting whether spurious data injection has occurred in the target distributed generation unit based on the local frequency compensation amount and the predicted frequency compensation amount of the target distributed generation unit includes:
[0023] Calculate the difference between the local frequency compensation amount and the predicted frequency compensation amount of the target distributed generation unit. When the difference is greater than the difference threshold, it indicates that the target distributed generation unit has experienced false data injection.
[0024] The target distributed generation unit is the first When using distributed generation units, the first Taiwan distributed generation unit in Difference in time The calculation formula is:
[0025] ,
[0026] In the formula, For the first Taiwan distributed generation unit in Local frequency compensation amount at any given time; For the first Taiwan distributed generation unit in The predicted frequency compensation amount at any given time; For the first Taiwan distributed generation unit in The standard deviation of the predicted frequency compensation at time. , From the initial time to The cumulative output at time step The number of predicted frequency compensation quantities for distributed generation units in Taiwan. For the first Taiwan distributed generation unit in The predicted frequency compensation amount at time. For the first Taiwan distributed generation unit in The mean of the predicted frequency compensation amount at time 1. The difference threshold is a preset fixed value.
[0027] The aforementioned secondary frequency control method for resisting spoofed data injection, when Greater than or equal to the preset total number When detecting whether spurious data injection has occurred in the target distributed generation unit based on the local frequency compensation amount and the predicted frequency compensation amount, the method further includes:
[0028] The absolute difference threshold is calculated based on the absolute difference between the local frequency compensation amount and the predicted frequency compensation amount of the target distributed generation unit. When the absolute difference is greater than the absolute difference threshold, it indicates that false data injection has occurred in the target distributed generation unit.
[0029] The calculation process of the absolute difference threshold includes:
[0030] Calculate the absolute difference between the local frequency compensation amount and the predicted frequency compensation amount of the target distributed generation unit and store it in an absolute difference set; the absolute difference set includes the previous... From time to the present time The absolute difference; the target distributed generation unit is the _th _th _th__. When using distributed generation units, the first The absolute difference of the distributed generation units at time t The calculation formula is: ,exist The set of absolute differences at time points The expression is: ;
[0031] Calculate the mean and standard deviation of the absolute differences within the set of absolute differences; mean of the absolute differences at time points The calculation formula is: ; In order to be in The absolute difference in time; in Standard deviation of the absolute difference at time The calculation formula is: ;
[0032] The absolute difference threshold is calculated based on the mean and standard deviation of the absolute differences; absolute difference threshold at time The calculation formula is: , These are preset coefficients.
[0033] In the aforementioned secondary frequency control method for resisting false data injection, the neural network and the distributed generation units in the distributed microgrid adopt a one-to-many configuration. For multiple distributed generation units in the distributed microgrid, only one is designated as the target distributed generation unit. The neural network only predicts the frequency compensation amount for the designated target distributed generation unit each time.
[0034] or,
[0035] The neural network and the distributed generation units in the distributed microgrid are configured in a many-to-many manner, with multiple neural networks predicting the frequency compensation amount for their respective distributed generation units.
[0036] Secondly, the present invention provides a secondary frequency control device for resisting the injection of false data, comprising: a data acquisition module, a neural network module, an attack detection module, and a frequency compensation module;
[0037] The data acquisition module is used to acquire the local frequency compensation amount of each distributed generation unit in the distributed microgrid.
[0038] The neural network module is used to input the local frequency compensation amount of the other distributed generation units besides the target distributed generation unit into the pre-trained neural network and output the predicted frequency compensation amount of the target distributed generation unit.
[0039] The attack detection module is used to detect whether the target distributed generation unit has experienced false data injection based on the local frequency compensation amount and the predicted frequency compensation amount of the target distributed generation unit.
[0040] The frequency compensation module is used to replace the local frequency compensation with the predicted frequency compensation of the target distributed generation unit when it detects false data injection in the target distributed generation unit, thereby compensating for the frequency deviation caused by the droop control of the target distributed generation unit.
[0041] Thirdly, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described in the first aspect.
[0042] Compared with the prior art, the beneficial effects achieved by the present invention are as follows:
[0043] The present invention provides a secondary frequency control method for resisting false data injection, used to perform secondary frequency control on a target distributed generation unit within a distributed microgrid. This method involves inputting the local frequency compensation values of other distributed generation units (excluding the target unit) into a pre-trained neural network, which outputs a predicted frequency compensation value for the target distributed generation unit. Based on the predicted frequency compensation value and the local frequency compensation value, the method detects whether false data injection has occurred. When false data injection occurs, the predicted frequency compensation value replaces the local frequency compensation value to compensate for the frequency deviation caused by droop control. This method for detecting and quickly responding to false data injection utilizes data from other distributed generation units to output the predicted frequency compensation value of the target generation unit, avoiding interference from false data injection on local data. It can quickly and effectively identify false data injection and solve the problem of false data injection disrupting the secondary frequency control function.
[0044] When detecting whether false data injection has occurred, this invention calculates the difference between the local and predicted frequency compensation amounts by dividing the difference by the standard deviation of the predicted frequency compensation amount. The calculated difference can adaptively distinguish between real anomalies and normal fluctuations. Simultaneously, when the number of predicted frequency compensation amounts accumulates to a preset total, a dynamic difference threshold calculation method is used to calculate the difference threshold based on the mean and standard deviation of the absolute differences. This automatically adjusts the difference threshold according to changes in operating conditions, improving the accuracy and compatibility of the difference threshold setting. Ultimately, the comparison between the difference and the difference threshold can effectively distinguish between normal fluctuations and real anomalies, thus improving the accuracy of false data injection detection. Attached Figure Description
[0045] Figure 1 This is a flowchart illustrating the secondary frequency control method for resisting false data injection according to Embodiment 1 of the present invention.
[0046] Figure 2 This is a flowchart illustrating the secondary frequency control method for resisting false data injection according to Embodiment 2 of the present invention.
[0047] Figure 3 This is a schematic diagram of the control flow of the secondary frequency control device for resisting false data injection according to Embodiment 3 of the present invention;
[0048] Figure 4 This is a schematic diagram showing the frequency changes of each distributed generation unit when the third distributed generation unit of Embodiment 1 of the present invention is subjected to a network attack.
[0049] Figure 5 This is a schematic diagram showing the changes in active power of each distributed generation unit when the third distributed generation unit in Embodiment 1 of the present invention is subjected to a network attack.
[0050] Figure 6This is a schematic diagram of the frequency change of the secondary frequency control method used to resist the injection of false data when the third distributed generation unit of the present invention is subjected to a network attack in Embodiment 1 of the present invention.
[0051] Figure 7 This is a schematic diagram of the active power change when the third distributed generation unit of Embodiment 1 of the present invention is subjected to a network attack and a secondary frequency control method to resist the injection of false data is used for secondary frequency control. Detailed Implementation
[0052] The technical solution of the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the embodiments and specific features in the embodiments are detailed descriptions of the technical solution of the present application, rather than limitations thereof. In the absence of conflict, the embodiments and technical features in the embodiments can be combined with each other.
[0053] The present invention will be further illustrated below with reference to the accompanying drawings and specific embodiments. It should be understood that these embodiments are for illustrative purposes only and are not intended to limit the scope of the invention. After reading this invention, any modifications of the invention in various equivalent forms by those skilled in the art will fall within the scope defined by the appended claims.
[0054] Example 1:
[0055] This embodiment introduces a secondary frequency control method to resist spoofed data injection, such as... Figure 1 As shown, secondary frequency control for a target distributed generation unit within a distributed microgrid includes:
[0056] S1: Obtain the local frequency compensation amount of each distributed generation (DG) unit in the distributed microgrid;
[0057] S2: Input the local frequency compensation amount of the other distributed generation units besides the target distributed generation unit to be controlled into the pre-trained neural network, and output the predicted frequency compensation amount of the target distributed generation unit.
[0058] S3: Based on the local frequency compensation amount and the predicted frequency compensation amount of the target distributed generation unit, detect whether false data injection has occurred in the target distributed generation unit;
[0059] S4: When false data injection is detected in the target distributed generation unit, the predicted frequency compensation amount of the target distributed generation unit is replaced with the local frequency compensation amount to compensate for the frequency deviation caused by the droop control of the target distributed generation unit.
[0060] like Figure 1As shown, the secondary frequency control method for resisting false data injection in this embodiment is a cyclic calculation process. When no false data injection is detected in the target distributed generation unit, the local frequency compensation amount of each distributed generation unit in the distributed microgrid is re-acquired, and steps S1 to S3 are executed cyclically.
[0061] The reason for the secondary frequency control will be explained below:
[0062] The frequency droop characteristic equation of the i-th distributed generation unit is:
[0063] ,
[0064] In the formula, For the first The frequency output by the distributed generation unit; The rated frequency is the no-load frequency at which the microgrid system is expected to operate; the standard value for the power grid is 314.16 rad / s. It is the preset number The active power droop factor of a distributed generation unit is the frequency change caused by a unit power change. Indicates the first The active power output by the distributed generation unit is the active power measured and calculated from the output of the LC filter of the distributed generation unit. For the first The active power setpoint of the distributed generation unit is the first In this embodiment, the active power reference value of the distributed generation unit is... It is 0.
[0065] By the The frequency droop characteristic equation of the distributed generation unit shows that the first The distributed generation unit outputs active power to supply power to the load, which will lead to the first The frequency output of the distributed generation unit Deviation from rated frequency To compensate for this frequency deviation, secondary frequency control is required. After secondary frequency control, the... The frequency droop control equation of the distributed generation unit is transformed into:
[0066] ,
[0067] In the formula, For the first The local frequency compensation amount of the distributed generation unit.
[0068] The following is a further detailed description of the specific implementation steps of the secondary frequency control method for resisting spoofed data injection in this embodiment:
[0069] Step S1 includes:
[0070] Under the communication topology of the distributed microgrid, the measured frequency and active power of each distributed generation unit are obtained, and the local frequency compensation of each distributed generation unit is calculated.
[0071] No. Local frequency compensation amount of distributed generation units in Taiwan The calculation formula is:
[0072] ,
[0073] In the formula, This is a preset frequency control gain coefficient, which is a positive coefficient used to control the convergence speed of frequency synchronization and recovery. For the first The set of neighboring distributed generation units of a distributed generation unit refers to the set of distributed generation units that are related to the first distributed generation unit. A distributed generation unit is a collection of other distributed generation units that have communication connections with it. Indicates the first The serial number of the neighboring distributed generation units of the distributed generation unit; Indicates the first Each neighboring distributed generation unit of the distributed generation unit is calculated separately and then summed; Let be the communication characterization coefficient, when the th Taiwan Distributed Generation Unit and the First When communicating with neighboring distributed generation units, When the first Taiwan's distributed generation units are not related to the first When communicating with neighboring distributed generation units, ; For the first The frequency output of the neighboring distributed generation unit; The nominal value characterization coefficient is used when the first... When the distributed generation unit receives the preset rated frequency of the distributed microgrid, When the first When the distributed generation unit does not receive the preset rated frequency of the distributed microgrid, ; The preset power control gain coefficient is a positive coefficient used to control the convergence speed of the proportional distribution of active power. For the preset first Active power droop factor of distributed generation units in Taiwan With the Rated active power of distributed generation units Inversely proportional, , As a preset uniform constant, each distributed generation unit adopts the same ; For the first The active power output of the distributed generation unit; For the preset first Active power droop factor of neighboring distributed generation units in Taiwan. With the Rated active power of neighboring distributed generation units Inversely proportional, ; For the first The active power output of the neighboring distributed generation unit.
[0074] For frequency recovery, Used to drive the The frequency of the distributed generation unit in Taiwan tends to be consistent with that of its neighbors; This is used to pull the system frequency towards the rated value; ultimately, it causes the frequency of each distributed generation unit to converge to the rated frequency. To achieve frequency recovery for each distributed generation unit, negative feedback is used, specifically: when... or At that time, the frequency recovery term is positive. Increase, improve ;when or At that time, the frequency recovery term is negative. Decrease, reduce .
[0075] To achieve an equal distribution of active power output from each distributed generation unit (DGU), that is, to distribute the power proportionally to the rated active power, the load rate of each DGU needs to be equal. This equal distribution of active power is achieved through negative feedback. This is a positive coefficient; when the local load factor is higher than that of its neighbors, the local output needs to be reduced. The specific logic is: power sharing term... Used to compare the load rate difference between the local area and its neighbors, when the first... When the local load factor of a distributed generation unit is higher than that of its neighbors, it is necessary to reduce the load factor of the first unit. The local load factor of Taiwan's distributed generation units, i.e. At that time, the power component If it is positive, it will increase the first... Local frequency compensation amount of distributed generation units in Taiwan , making the first The frequency output of the distributed generation unit Increase, according to the frequency droop characteristic equation, at this time the first Active power output of the distributed generation unit It will decrease, thereby reducing the number of... The purpose of the local load factor of the distributed generation unit. Similarly, when At that time, the power component If it is negative, it will decrease. , making Decrease, according to the frequency droop characteristic equation, at this time It will increase, reaching the increase of the first The purpose of this study is to measure the local load factor of distributed generation units in Taiwan.
[0076] Step S2, the process of constructing the dataset before training the neural network, includes:
[0077] In a pre-built distributed microgrid simulation model, various operating conditions are simulated. The local frequency compensation of all distributed generation units at the same moment is used as a set of data and an independent label is added. Multiple sets of data under different operating conditions are collected. The different operating conditions include four types of operating states: distributed microgrid startup process, steady-state operation, operating condition switching and operation recovery, as well as three types of disturbances: load amplitude variation, output variation of each distributed generation unit, and communication delay. The independent label is used to identify data under different operating conditions and at different times.
[0078] For each set of data, each distributed generation unit is taken as the target distributed generation unit, the local frequency compensation amount of the other distributed generation units is taken as the input feature of the neural network, and the local frequency compensation amount of the target distributed generation unit is taken as the output label to construct a dataset for neural network training.
[0079] The pre-trained neural network is a long short-term memory neural network, or a backpropagation neural network, or a recurrent neural network.
[0080] This embodiment uses a long short-term memory neural network as an example to introduce the training of the neural network required by this application:
[0081] Long Short-Term Memory (LSTM) neural networks are a type of neural network based on Recurrent Neural Networks (RNNs). Compared to traditional neural network models such as Back Propagation Neural Networks (BP) and Recurrent Neural Networks (RNNs), LSTMs effectively address the long-term dependency vanishing and gradient vanishing problems of traditional RNNs by introducing gating mechanisms and cell states, thus better capturing long-range dependencies in time series data.
[0082] The specific calculation formulas for LSTM gating mechanism and cell state are as follows:
[0083] The forget gate determines how much information is discarded from the cell's state at the previous moment. Forget Gate Output of Moments The calculation formula is:
[0084] ,
[0085] In the formula, It is a Sigmoid activation function, with an output range of 0 to 1; Here is the weight matrix for the forget gate; This means concatenating the first and last ends of two vectors into a new vector. for The hidden state at any given moment; for The input vector at time step; This is the bias term for the forget gate; the closer the output value of the forget gate is to 0, the more it should be forgotten, and the closer it is to 1, the more it should be retained.
[0086] The input gate determines which new information is stored in the cell state at the current moment. Input gate output at time The calculation formula is:
[0087] ,
[0088] In the formula, This is the weight matrix of the input gate; The input gate's bias term; the input gate's output controls the proportion of new information stored.
[0089] exist Candidate cell state at time 1 The calculation formula is:
[0090] ,
[0091] In the formula, This is the hyperbolic tangent activation function, with an output range of -1 to 1; This is the weight matrix for cell states; This is a bias term for the cell state; candidate cell states represent new information at the current moment.
[0092] The cell state is updated by combining the old information retained by the forget gate with the new information added by the input gate. Cell state update at any time The calculation formula is:
[0093] ,
[0094] In the formula, This is a dot product operation; cell state updates carry long-term memory information;
[0095] The output gate determines how much information is output regarding the hidden state at the current moment. Output gate at any time The calculation formula is:
[0096] ,
[0097] In the formula, This is the weight matrix of the output gate; This is the bias term for the output gate; the output gate outputs the control information output ratio.
[0098] The hidden state at the current moment is also the output of the LSTM. The formula for calculating the hidden state at time t is:
[0099] .
[0100] To obtain a dedicated dataset for LSTM training:
[0101] Each sample in the dataset used for neural network training is reassembled in chronological order according to its independent label to obtain the time series of local frequency compensation amount of each distributed generation unit under different operating conditions.
[0102] For the time series of local frequency compensation amounts of each distributed generation unit under each operating condition, multiple sets of time series data are extracted sequentially from the start time according to a time window of preset length and time step. Each set of time series data includes the local frequency compensation amount of each distributed generation unit in the same time period. The length of the time window refers to how many moments the time window includes, and the time step of the time window refers to how many moments the time window slides to the right each time. In this embodiment, the preset length is 5 and the time step is 1.
[0103] For each set of time-series data, each distributed generation unit is sequentially used as the target distributed generation unit. The local frequency compensation amount of the other distributed generation units in the same time period is used as the input feature of the long short-term memory neural network, and the local frequency compensation amount of the target distributed generation unit at the last moment in the same time period is used as the output label to construct samples for training the long short-term memory neural network. In a specific embodiment, during steady-state operation... The samples at each time point include: Time to The local frequency compensation of the remaining distributed generation units at time 5 is the input characteristic, and The local frequency compensation amount of the target distributed generation unit at a given time is the output label; this step also includes standardizing each sample to convert the sample data into standard normal distribution data with a mean of 0 and a standard deviation of 1.
[0104] The sample sets under different working conditions are used as datasets for training long short-term memory neural networks.
[0105] Through the above transformation, the dataset that originally only reflected the static relationship at the same moment is reconstructed into a time series dataset used to capture the dynamic evolution law of the system, thereby meeting the training requirements of LSTM model and realizing the function of predicting the frequency compensation amount at the current moment based on historical information at multiple moments.
[0106] At the start of training, samples are randomly drawn from the dataset to obtain the input sequence for training. The LSTM network processes the input sequence step by step through its unique gating mechanism: the forget gate determines how much historical state is retained, the input gate controls the storage of new information, and the candidate cell state is... The activation function generates a nonlinear transformation of the current state, and finally the memory cell updates and outputs the hidden state. Throughout the forward propagation process, the Long Short-Term Memory (LSTM) neural network progressively extracts temporal-dependent features through multiple layers of LSTM units, finally mapping them to the predicted frequency compensation amount of the target distributed generation unit via a fully connected layer. Training is optimized using the gradient descent algorithm. By calculating the mean squared error loss between the predicted frequency compensation amount and the output label, the gradient is calculated using the backpropagation algorithm over time, and the data is backpropagated layer by layer along the recursive path, while simultaneously updating the parameters of each LSTM gate, including the weight matrix and bias terms. To prevent overfitting, dropout regularization and early stopping mechanisms are introduced during training, and a validation set is used to monitor the generalization performance of the LSM neural network. After multiple iterations, the LSM neural network gradually learns the complex temporal mapping relationship between the local frequency compensation values of other distributed generation units and the frequency compensation amount of the target distributed generation unit, ultimately obtaining a well-trained LSM neural network.
[0107] In this embodiment, the local frequency compensation amounts of the remaining distributed generation units from the previous four time points to the current time point are input into a pre-trained long short-term memory neural network for the target distributed generation unit, which can output the predicted frequency compensation amount of the target distributed generation unit at the current time point.
[0108] Step S3 includes:
[0109] Calculate the difference between the local frequency compensation amount and the predicted frequency compensation amount of the target distributed generation unit. When the difference is greater than the difference threshold, it indicates that the target distributed generation unit has experienced false data injection.
[0110] The target distributed generation unit is the first When using distributed generation units, the first The degree of difference of the distributed generation units at time t The calculation formula is:
[0111] ,
[0112] In the formula, For the first Taiwan distributed generation unit in Local frequency compensation amount at any given time; For the first Taiwan distributed generation unit in The predicted frequency compensation amount at any given time; For the first Taiwan distributed generation unit in The standard deviation of the predicted frequency compensation at time. , From the initial time to The cumulative output at time step The number of predicted frequency compensation quantities for distributed generation units in Taiwan. For the first Taiwan distributed generation unit in The predicted frequency compensation amount at time. For the first Taiwan distributed generation unit in The mean of the predicted frequency compensation amount at time 1. The difference threshold is a preset fixed value. In this embodiment, the difference threshold is 0.2.
[0113] Compared to directly using the difference between the local and predicted frequency compensation amounts as the absolute error calculation, this embodiment introduces historical statistical distribution as a dynamic measure, transforming the absolute error calculation into a normalized fluctuation calculation. The difference calculation in this embodiment can characterize the multiple of the current deviation relative to the normal fluctuation level, reflecting how low the probability is that the current situation belongs to normal fluctuation. Directly comparing the difference between the local and predicted frequency compensation amounts with a threshold is easily affected by changes in system operating conditions; however, the difference calculation in this embodiment, divided by the standard deviation, can adaptively distinguish between true anomalies and normal fluctuations.
[0114] To better adapt to normal fluctuations under different operating conditions, this embodiment also proposes a method for dynamically updating the detection boundary, replacing the above-mentioned method of using the difference threshold as a fixed detection boundary:
[0115] when Greater than or equal to the preset total number When switching to detect whether the target distributed generation unit has experienced false data injection, the method is as follows: calculate the absolute difference threshold based on the absolute difference between the local frequency compensation amount and the predicted frequency compensation amount of the target distributed generation unit. When the absolute difference is greater than the absolute difference threshold, it indicates that the target distributed generation unit has experienced false data injection.
[0116] The calculation process of the absolute difference threshold includes:
[0117] Calculate the absolute difference between the local frequency compensation amount and the predicted frequency compensation amount of the target distributed generation unit and store it in an absolute difference set; the absolute difference set includes, in sequence, the previous... From time to the present time The absolute difference; the target distributed generation unit is the _th _th _th__. When using distributed generation units, the first Taiwan distributed generation unit in absolute difference in time The calculation formula is: ,exist The set of absolute differences at time points The expression is: In this embodiment, The value is 50.
[0118] Calculate the mean and standard deviation of the absolute differences within the set of absolute differences; mean of the absolute differences at time points The calculation formula is: ; In order to be in The absolute difference in time; in Standard deviation of the absolute difference at time The calculation formula is: ;
[0119] The absolute difference threshold is calculated based on the mean and standard deviation of the absolute differences; absolute difference threshold at time The calculation formula is: , For preset coefficients, Greater than 1, in this embodiment, The value is 3.
[0120] This embodiment tracks the statistical distribution of historical system data in real time, and the absolute difference threshold can be automatically adjusted according to changes in operating conditions. It automatically raises the threshold during periods of high volatility, such as startup and disturbances, to avoid false alarms, and automatically lowers it during steady-state operation to maintain sensitivity to minor anomalies. Simultaneously... The value of is determined so that only low-probability events that exceed the historical normal fluctuation range are judged as attacks, thus enabling the detection of whether the absolute difference threshold is exceeded to effectively distinguish between normal fluctuations and real anomalies, and improving the accuracy and compatibility of the absolute difference threshold setting.
[0121] in front In the initial stage of prediction, due to insufficient historical data, directly and dynamically calculating the absolute difference threshold would lead to inaccurate estimations of the mean and standard deviation. Therefore, a comparison is made between the difference degree and a fixed difference degree threshold. An empirically preset, reliable, and clearly defined fixed value is used as the detection benchmark to avoid false alarms or false negatives caused by small samples. Once sufficient data is accumulated, that is... After the first prediction, the mean and standard deviation tend to stabilize. At this point, the comparison is switched to the absolute difference threshold, allowing the detection benchmark to track changes in system operating conditions in real time. This phased detection method, combining fixed and dynamic thresholds, solves the statistical reliability problem in the initial stage while fully leveraging the adaptive advantages of dynamic thresholds under different operating conditions.
[0122] To verify the effectiveness of the secondary frequency control method for resisting false data injection in this embodiment, a distributed microgrid consisting of the first, second, and third distributed generation units connected in parallel was constructed for simulation testing.
[0123] The simulation conditions are as follows: the distributed microgrid operates in islanded mode. The initial state of the system's secondary frequency control is from 0 to 0.6 seconds; the stable operating state of the system is from 0.6 to 1.0 seconds; at 1.0 seconds, the third distributed generation unit suffers a network attack. The network attack signal is a sine wave with an amplitude of 5 and a frequency of 10 rad / s, used to simulate the injection of false data.
[0124] Figure 4 and Figure 5 These are schematic diagrams illustrating the changes in frequency and active power of each distributed generation unit when a secondary frequency control method to resist spurious data injection is not used. f1, f2, and f3 represent the output frequencies of the first, second, and third distributed generation units, respectively. The units for f1, f2, and f3 are Hz; the units for f3 are rad / s. With frequency in Hz The conversion formula is: P1, P2, and P3 represent the active power output of the first, second, and third distributed generation units, respectively. The network attack caused instability in the frequency and active power control of the third distributed generation unit, which, through coupling, led to continuous oscillations in the frequency and power of the first and second distributed generation units. Figure 6 and Figure 7These are schematic diagrams showing the changes in frequency and active power of each distributed generation unit when using a secondary frequency control method to resist false data injection. Figures 4 to 7 The comparison shows that the secondary frequency control method for resisting spoofed data injection in this embodiment can quickly detect attacks and immediately take defensive measures, replacing the spoofed local frequency compensation of the third distributed generation unit. This allows the frequency and active power, which would otherwise cause severe oscillations and divergence, to quickly converge to the normal range and gradually stabilize at the preset state (frequency 50Hz = 314.16 rad / s, active power 15kW). Simulation tests demonstrate that, compared to traditional methods, the secondary frequency control method for resisting spoofed data injection in this embodiment can identify attacks faster and restore system state variables more quickly in resisting network attacks.
[0125] Example 2:
[0126] Based on the same inventive concept as Embodiment 1, this embodiment introduces a secondary frequency control method to resist false data injection. The neural network and the distributed generation units in the distributed microgrid adopt a one-to-many configuration, that is, only one neural network is configured. For multiple distributed generation units in the distributed microgrid, only one is designated as the target distributed generation unit each time. During prediction, the neural network only predicts the frequency compensation amount for the designated target distributed generation unit each time.
[0127] As a variation of this embodiment, the neural network can also be configured in multiple ways according to the number of distributed generation units in the distributed microgrid. That is, the neural network and the distributed generation units in the distributed microgrid adopt a many-to-many configuration, and multiple neural networks respectively predict the frequency compensation amount for their respective distributed generation units.
[0128] When using a many-to-many configuration, such as Figure 2 As shown, a method for detecting distributed generation units that have experienced spurious data injection and performing secondary frequency control on them includes:
[0129] A pre-trained neural network is set up for each distributed generation unit in the distributed microgrid. Each distributed generation unit is used as the target distributed generation unit of the corresponding neural network. Based on the local frequency compensation amount of each distributed generation unit and the predicted frequency compensation amount output by the corresponding neural network, it is used to detect whether false data injection occurs in each distributed generation unit.
[0130] When a distributed generation unit that has experienced false data injection is detected, the predicted frequency compensation amount of the distributed generation unit that experienced false data injection is replaced with the local frequency compensation amount to compensate for the frequency deviation caused by the droop control of the distributed generation unit that experienced false data injection.
[0131] This embodiment employs the same false data injection detection method as Embodiment 1. Building upon this, the secondary frequency control method in this embodiment for resisting false data injection detects in parallel whether false data injection has occurred in each distributed generation unit. Figure 2 This is a flowchart illustrating the secondary frequency control process for a distributed microgrid composed of x distributed generation units. Each distributed generation unit independently performs the detection of false data injection as described in Example 1. This detection process is carried out in real time and cyclically until a distributed generation unit is detected to have received false data injection. At that time, the data of the unit that received false data injection is immediately replaced to prevent the false injection from further amplifying its impact.
[0132] Example 3:
[0133] Based on the same inventive concept as Embodiment 1, this embodiment provides a secondary frequency control device for resisting spoofed data injection. The secondary frequency control method for resisting spoofed data injection described in Embodiment 1 can be used for secondary frequency control, such as... Figure 3 As shown, it includes: a data acquisition module, a neural network module, an attack detection module, and a frequency compensation module;
[0134] The data acquisition module is used to acquire the local frequency compensation amount of each distributed generation unit in the distributed microgrid.
[0135] The neural network module is used to input the local frequency compensation amount of the distributed generation units other than the target distributed generation unit to be controlled into the pre-trained neural network, and output the predicted frequency compensation amount of the target distributed generation unit.
[0136] The attack detection module is used to detect whether the target distributed generation unit has experienced false data injection based on the local frequency compensation amount and the predicted frequency compensation amount of the target distributed generation unit.
[0137] The frequency compensation module is used to replace the local frequency compensation with the predicted frequency compensation of the target distributed generation unit when it detects false data injection in the target distributed generation unit, thereby compensating for the frequency deviation caused by the droop control of the target distributed generation unit.
[0138] Example 4:
[0139] This invention also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the method described in Embodiment 1.
[0140] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0141] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0142] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0143] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0144] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A secondary frequency control method for resisting spoofed data injection, characterized in that, include: Obtain the local frequency compensation amount of each distributed generation unit in the distributed microgrid; The local frequency compensation amount of the distributed generation units other than the target distributed generation unit to be controlled is input into the pre-trained neural network, and the predicted frequency compensation amount of the target distributed generation unit is output. Based on the local frequency compensation amount and the predicted frequency compensation amount of the target distributed generation unit, detect whether the target distributed generation unit has experienced false data injection. When false data injection is detected in the target distributed generation unit, the predicted frequency compensation amount of the target distributed generation unit is replaced with the local frequency compensation amount to compensate for the frequency deviation caused by the droop control of the target distributed generation unit.
2. The secondary frequency control method for resisting spoofed data injection according to claim 1, characterized in that, Also includes: When no false data injection is detected in the target distributed generation unit, the local frequency compensation amount of each distributed generation unit in the distributed microgrid is reacquired.
3. The secondary frequency control method for resisting spoofed data injection according to claim 1, characterized in that, The acquisition of the local frequency compensation amount for each distributed generation unit within the distributed microgrid includes: Obtain the measured frequency and active power of each distributed generation unit under the communication topology of the distributed microgrid, and calculate the local frequency compensation of each distributed generation unit. No. Local frequency compensation amount of distributed generation units in Taiwan The calculation formula is: , In the formula, The preset frequency control gain coefficient; For the first The set of neighboring distributed generation units of a distributed generation unit; Indicates the first The serial number of the neighboring distributed generation units of the distributed generation unit; Let be the communication characterization coefficient, when the th Taiwan Distributed Generation Unit and the First When communicating with neighboring distributed generation units, When the first Taiwan's distributed generation units are not related to the first When communicating with neighboring distributed generation units, ; For the first The frequency output of the neighboring distributed generation unit; For the first The frequency output by the distributed generation unit; The nominal value characterization coefficient is used when the first... When the distributed generation unit receives the preset rated frequency of the distributed microgrid, When the first When the distributed generation unit does not receive the preset rated frequency of the distributed microgrid, ; This is the preset rated frequency; This is the preset power control gain coefficient; For the preset first Active power droop factor of neighboring distributed generation units; For the first The active power output of the neighboring distributed generation unit; For the preset first Active power droop factor of distributed generation unit; For the first The active power output of the distributed generation unit.
4. The secondary frequency control method for resisting spoofed data injection according to claim 1, characterized in that, The process of constructing the dataset before training the neural network includes: In a pre-built distributed microgrid simulation model, various operating conditions are simulated. The local frequency compensation of all distributed generation units at the same moment is used as a set of data and an independent label is added. Multiple sets of data under different operating conditions are collected. The different operating conditions include four types of operating states: distributed microgrid startup process, steady-state operation, operating condition switching and operation recovery, as well as three types of disturbances: load amplitude variation, output variation of each distributed generation unit, and communication delay. The independent label is used to identify data under different operating conditions and at different times. For each set of data, each distributed generation unit is taken as the target distributed generation unit, the local frequency compensation amount of the other distributed generation units is taken as the input feature of the neural network, and the local frequency compensation amount of the target distributed generation unit is taken as the output label to construct a dataset for neural network training.
5. The secondary frequency control method for resisting spoofed data injection according to claim 4, characterized in that, The pre-trained neural network is a long short-term memory neural network, or a backpropagation neural network, or a recurrent neural network; The process of constructing the dataset before training a Long Short-Term Memory (LSTM) neural network includes: Each sample in the dataset used for neural network training is reassembled in chronological order according to its independent label to obtain the time series of local frequency compensation amount of each distributed generation unit under different operating conditions. For the time series of local frequency compensation of each distributed generation unit under each operating condition, multiple sets of time series data are extracted sequentially from the start time according to the time window of preset length and time step. Each set of time series data includes the local frequency compensation of each distributed generation unit in the same period. For each set of time series data, each distributed generation unit is taken as the target distributed generation unit in turn. The local frequency compensation amount of the other distributed generation units in the same time period is used as the input feature of the long short-term memory neural network. The local frequency compensation amount of the target distributed generation unit at the last moment in the same time period is used as the output label to construct a sample for training the long short-term memory neural network. The sample sets under different working conditions are used as datasets for training long short-term memory neural networks.
6. The secondary frequency control method for resisting spoofed data injection according to claim 1, characterized in that, when Less than the preset total When, the step of detecting whether spurious data injection has occurred in the target distributed generation unit based on the local frequency compensation amount and the predicted frequency compensation amount of the target distributed generation unit includes: Calculate the difference between the local frequency compensation amount and the predicted frequency compensation amount of the target distributed generation unit. When the difference is greater than the difference threshold, it indicates that the target distributed generation unit has experienced false data injection. The target distributed generation unit is the first When using distributed generation units, the first Taiwan distributed generation unit in Difference in time The calculation formula is: , In the formula, For the first Taiwan distributed generation unit in Local frequency compensation amount at any given time; For the first Taiwan distributed generation unit in The predicted frequency compensation amount at any given time; For the first Taiwan distributed generation unit in The standard deviation of the predicted frequency compensation at time. , From the initial time to The cumulative output at time step The number of predicted frequency compensation quantities for distributed generation units in Taiwan. For the first Taiwan distributed generation unit in The predicted frequency compensation amount at time. For the first Taiwan distributed generation unit in The mean of the predicted frequency compensation amount at time 10:
00. ; The difference threshold is a preset fixed value.
7. The secondary frequency control method for resisting spoofed data injection according to claim 6, characterized in that, when Greater than or equal to the preset total number When, the step of detecting whether spurious data injection has occurred in the target distributed generation unit based on the local frequency compensation amount and the predicted frequency compensation amount of the target distributed generation unit includes: The absolute difference threshold is calculated based on the absolute difference between the local frequency compensation amount and the predicted frequency compensation amount of the target distributed generation unit. When the absolute difference is greater than the absolute difference threshold, it indicates that false data injection has occurred in the target distributed generation unit; The calculation process of the absolute difference threshold includes: Calculate the absolute difference between the local frequency compensation amount and the predicted frequency compensation amount of the target distributed generation unit and store it in an absolute difference set; the absolute difference set includes the previous... From time to the present time The absolute difference; the target distributed generation unit is the _th _th _th__. When using distributed generation units, the first Taiwan distributed generation unit in absolute difference in time The calculation formula is: ,exist The set of absolute differences at time points The expression is: ; Calculate the mean and standard deviation of the absolute differences within the set of absolute differences; mean of the absolute differences at time points The calculation formula is: ; In order to be in The absolute difference in time; in Standard deviation of the absolute difference at time The calculation formula is: ; The absolute difference threshold is calculated based on the mean and standard deviation of the absolute differences; absolute difference threshold at time The calculation formula is: , These are preset coefficients.
8. The secondary frequency control method for resisting spoofed data injection according to claim 1, characterized in that, The neural network and the distributed generation units in the distributed microgrid adopt a one-to-many configuration. For multiple distributed generation units in the distributed microgrid, only one is designated as the target distributed generation unit. The neural network only predicts the frequency compensation amount for the designated target distributed generation unit each time. or, The neural network and the distributed generation units in the distributed microgrid are configured in a many-to-many manner, with multiple neural networks predicting the frequency compensation amount for their respective distributed generation units.
9. A secondary frequency control device for resisting spoofed data injection, characterized in that, include: Data acquisition module, neural network module, attack detection module, and frequency compensation module; The data acquisition module is used to acquire the local frequency compensation amount of each distributed generation unit in the distributed microgrid. The neural network module is used to input the local frequency compensation amount of the distributed generation units other than the target distributed generation unit to be controlled into the pre-trained neural network, and output the predicted frequency compensation amount of the target distributed generation unit. The attack detection module is used to detect whether the target distributed generation unit has experienced false data injection based on the local frequency compensation amount and the predicted frequency compensation amount of the target distributed generation unit. The frequency compensation module is used to replace the local frequency compensation with the predicted frequency compensation of the target distributed generation unit when it detects false data injection in the target distributed generation unit, thereby compensating for the frequency deviation caused by the droop control of the target distributed generation unit.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the steps of the method according to any one of claims 1 to 8.