A Consensus-Based Distributed Two-Layer Control Strategy with Predictive Compensation for Islanded Microgrid CPS against DoS Attack

Aiming at the problems of insufficient scalability and slow response speed of the traditional three-layer control structure based on the time scale, this study proposes a distributed two-layer control structure. (e primary control uses traditional powerfrequency droop control, and the second-level control adopts a consensus protocol to simultaneously achieve the goals of frequency synchronization, frequency non-difference, and power optimization in a distributed manner, which can effectively improve the performance of microgrid frequency adjustment and power optimization.(e cyber layer of the ACmicrogrid cyberphysical system (CPS) is extremely vulnerable to denial-of-service (DoS) attacks, resulting in the inability to achieve control objectives. For this reason, this paper designs a consensus algorithm based on event-triggered and a predictive compensation control link that combines empirical mode decomposition (EMD) and extreme learning machine (ELM) on the basis of the twolayer control structure. Finally, a 4-node islanded microgrid simulation example is used to verify the effectiveness of the proposed strategy. (e simulation results show that the two-layer control strategy can achieve microgrid frequency recovery and power optimization while effectively responding to different degrees of DoS attacks.


Introduction
e microgrid is one of the most important ways to connect distributed energy to the grid, and it usually works in two modes: islanded and grid-connected mode. In view of the complexity of the microgrid structure and the diversity of control objectives, hierarchical control is usually used to achieve stable and optimized operation of the microgrid. At present, the most widely used is the three-layer control structure based on time scale. [1,2] Among them, the first level of control directly acts on distributed generators (DGs), its action time is at the level of seconds. e second layer is the secondary adjustment layer, which focuses on the dynamic operation control of the microgrid, its action time has risen from the second level to the minute level. e third layer is the optimization management layer, which has the longest role time and is mainly used to realize power flow control and optimal scheduling. However, due to the long control time and slow response speed of the third layer, before the arrival of the third layer control command, the actual operation of the system may deviate from the expected optimal state due to the inevitable power disturbance in the microgrid, resulting in the reduction of the execution efficiency of power optimization and the deterioration of the economy of the microgrid. [3] erefore, if the control structure is reduced to two layers, it will improve the operation efficiency of the microgrid. e flexibility, reliability, and scalability of the distributed control mode are stronger than those of the centralized control mode. erefore, the distributed control mode [4,5] is generally used in microgrid. In particular, the multi-agent control method [6,7] based on the consensus protocol is widely used to solve the problems of voltage regulation, frequency regulation, and optimization [8][9][10][11] in hierarchical control due to its simple structure, flexible control, and only sparse communication. With the continuous development of the intelligent construction of the power grid, the microgrid gradually has the relevant characteristics of the cyber-physical system (CPS). [6,12] e information layer in the microgrid CPS structure usually involves more control decisions and communication processes, and the use of communication data inevitably leads to communication problems such as delays, packet loss, and communication failures [13,14]. e traditional three-layer control structure can no longer meet the security requirements of the equipment, and the network security of the microgrid CPS is worth further exploration.
In References [15,16], a smart energy dispatching method based on distributed economic cooperative predictive control is proposed. In References [17][18][19], a pilot distributed follower decentralized control strategy for islanded microgrids is proposed, which realizes economic dispatch while ensuring voltage quality and frequency synchronization. However, the above literature are only based on the structure of the physical layer and do not consider the security of the information layer, which is extremely vulnerable to malicious attacks on the network. [20][21][22] References [6,12] construct an information-physical collaborative hierarchical control structure and solves random communication problems by designing corresponding observers, controllers, and predictive compensators. In References [23,24], aiming at the insufficient tolerance of MG to DoS attacks when edge routers in microgrid suffer from DoS attacks, a consensus-based secondary frequency controller with dynamic P-f droop control is proposed and its stability is analyzed. References [25,26] study the realization of cyber-physical system security and stability control issues in complex networks under non-periodic DoS attacks. However, the above-mentioned literature only studies the network attack on the secondary control level, but does not propose an effective solution to the network attack for a microgrid with third control targets. A fully distributed microgrid frequency recovery and power optimization structure capable of responding to network attacks have not yet appeared. erefore this paper proposes a distributed two-layer control structure that combines droop control and consensus algorithm in order to improve the performance of microgrid frequency adjustment and power optimization under the consideration of the network being attacked by DoS. e main contributions are as follows: (1) e distributed control structure designed in this study can overcome the shortcomings of centralized control and transfer the power optimization control to the second layer. While the frequency is restored to the nominal value, the incremental cost(IC) can be consistent, which can effectively improve the optimization operation efficiency of the microgrid. (2) Aiming at the DoS attacks that occur on the communication link of the cyber layer, the improved consensus algorithm based on event-triggered and predictive compensation that combines EMD and ELM can effectively respond to different degrees of DoS attacks.

Multi-Agents Distributed Model.
For a MG containing n DGs, DGs are regarded as nodes in the agent communication network, and the communication topology can be represented by an undirected graph G. In graph G, the adjacency matrix A � (a ij ) n×n is usually used to describe the relationship between nodes, wherea ij represents the connection weight between node i and node j, and n is the number of nodes. If the j-th node has an edge pointing to the i-th node, thena ij > 0, i ≠ j, otherwise a ij � 0, the diagonal element a ii � 0. For a distributed multi-agents control system with n agents, due to the use of distributed control laws, the change of each agent's state depends on its own current state and the current state of its neighboring agents, which can be expressed for (1) Written in matrix form as Assuming that the multi-agents systems are undirected and connected, then its corresponding Laplacian matrix must be a real symmetric matrix, the aforementioned protocol can achieve the average consistency of the system, namely [23],

Cost Function
Model. e operating cost of the i-th DGs can be described as follows: e goal of economic dispatch of the islanded microgrid is to minimize the operating cost, namely, e generated power of each distributed power source must meet the power balance constraint conditions: e DG generation power should also meet the following constraints: Based on the Lagrangian multiplier method and the equal incremental rate theory, the target formula of 2 International Transactions on Electrical Energy Systems economic dispatch is transformed into an incremental factor synchronization control target, which includes Eq.(8) explains that if P i is within the allowable output range, when the IC of all DG is equal to the optimal IC, the total power generation cost of the system is minimum. When P i reaches the upper or lower limit of capacity, DGi should run on its bounded value, and the rest of the DGs should continue to run according to the above economic dispatch rules. e optimal IC can be calculated as:

Control Structure and Control
Objectives. On the basis of P-f droop control, a consistent control strategy based on droop control is proposed to solve the problem of fully distributed data collection. Because there is no leader DG, dependence on the central controller under the centralized control structure is avoided. In this paper, a two-way communication network is adopted. Regarding each DG as an agent, the local controller of each agent exchanges IC information with the local controllers of its neighboring agents. Based on the transmission of IC information, the proposed consistency control strategy can simultaneously achieve frequency adjustment and optimal economic operation. e hierarchical control structure constructed in this article is different from the traditional three-layer structure.
is article only needs to establish a two-layer structure. At the second layer, both power optimization and frequency recovery are realized, aiming to greatly shorten the optimization operation time, and significantly improve the stability and optimization operation efficiency of the microgrid. Taking the i-th DG as an example, the hierarchical control architecture with CPS characteristics is shown in Figure 1.
e control objectives of this microgrid system can be summarized as follows: Goal 1: Frequency synchronization.
In addition, the system also needs to meet the power balance constraints and the upper and lower limits of DG generation power, which have been explained in the previous section and will not be explained here.

Primary Control Strategy.
e primary control considers the use of traditional droop control to achieve frequency stability, which is given as follows: For a microgrid composed of multiple DGs in parallel, the frequency of each DG is equal, that is, f i is equal. However, droop control is a differential control. erefore, to make the frequency of each DG equal to the system frequency, a common method is to add frequency compensation to restoref i to f ref MG .

Secondary Frequency Modulation and Power Optimization Control Strategy.
e primary control only acts on the controllable DG unit of the physical layer, and the second layer control has been upgraded from the physical layer to the cyber layer, and requires sparse communication between DGs to achieve information exchange and coordinated control. Since the control scheme adopts a ring communication network to transmit the IC information of DGs, it can eliminate the requirement of Leader DG, reduce the information exchange between DGs, and improve efficiency. Since reactive power does not incur any costs, there is no need to discuss reactive power sharing schemes.
For the goal of frequency error-free control, it is realized by adding a PI controller, and the compensation amount is calculated according to the following formula: Aiming at the realization of the power optimization goal, without considering the DG capacity constraints, the control equation is designed as follows [21]: e IC information is selected as the consistency variable, and the local controller of DGi updates the reference power P ref i according to (15). In addition, the system frequency is stabilized based on (16). at is to say, the proposed method can update the output power reference value according to the neighboring IC information, and realize economic operation and frequency recovery, which is convenient to implement and simplifies the control loop.
International Transactions on Electrical Energy Systems e process of equations (15) and (16) to achieve frequency recovery and power optimization is as follows.
e matrix form of (15) and (16) is expressed as follows: where dt. e design of the adjacency matrix in this paper is as follows: According to (17) and (18), (20) can be obtained as follows: where e Laplacian matrix of the communication graph has the following form: According to (20), (22) can be obtained as follows: where e left side of (22) denotes the consistency control, which can be defined as follows: Taking the IC as a consistency variable, the state of each variable will eventually be consistent under the control of the consistency algorithm, that is: λ i � λ j . us,  From the expressions of κ i andζ i , we can see that both κ i andζ i are negative constants. erefore, if (24) holds,Δf i � 0. So under the consensus algorithm and PI controller-based secondary frequency control, the frequency error will be eliminated. at is, when t ⟶ ∞, Δf i ⟶ 0. According to (22), it can be concluded that when the IC of each DG is equal, there is f ref MG − f i � 0, that is, the frequency recovery of DGi is realized. It is concluded that the proposed control scheme can achieve power optimization and secondary frequency control on the same time scale. Compared with the three-layer control structure, it can effectively shorten the operating time of the system and improve the operating efficiency of the microgrid.

DoS Attack Modeling.
e communication between DGs in MG is implemented based on the UDP protocol, which is a universal and easily affected protocol. In the process of communication, the data packets containing the IC information are transmitted through the channel, received by the data receiver of the DGs, written into the data buffer, and processed by the consistency controller in the DGs. Due to the openness of the communication network, the secondary control layer is easily attacked by attackers. e data path from the cyber layer DGi to DGj is shown in Figure 2.
e goal of DoS attack is to try to destroy the availability of data transmission and block the information transmission between DGs, thus making the secondary control strategy of microgrid invalid. Due to the attacker's limited energy, DoS attacks are distributed in sequence in time. Define the attack start time on the communication link. i Assuming that data packets are transmitted through channels, routers provided by service providers, and other network equipment. Due to the openness and sharing of wireless media, sensor nodes are vulnerable to different network attacks. In this paper, it is assumed that the attacker launches DoS attacks on the router of the service provider, and the most direct impact of DoS attacks is the loss of data packets.
Define α i andα j as the packet loss rate of transmitted data after DGi and DGj are attacked respectively. e Equation is as follows: When a DG in the microgrid suffers DoS attacks, the impact of the attack will gradually propagate throughout the network, which will seriously affect the authenticity of the data. Since DG can only judge the existence of attacks by λ i , λ j and the tracking error. However, the tracking error will also converge to 0 in the presence of DoS attacks. erefore, the DG itself can not directly use the above information to judge whether there is an attack or not, nor can it eliminate the influence of attacks.

DoS Attack
Detection. Intrusion detection, as an important means to ensure network security, can monitor network activities in real-time, judge the state of equipment, find the attacked equipment in time, and then take corresponding countermeasures. Traditional intrusion detection methods are to identify behaviors that are significantly different from normal traffic as abnormal behaviors. is method does not require prior knowledge of abnormal network behaviors and can achieve better detection accuracy.
Under the CPS architecture, it is known that the attack will cause the data packets sent by the router to be abnormal, so the change of the data packets can be used as the basis for detection.
Define the detection function for DoS attacks on communication link i, j ∈ Ω asθ ij (t), θ ij (t) ∈ 0, 1 { }. When DoS attacks occur on the communication link i, j ∈ Ω, the detection function θ ij (t) can detect that the attack has occurred, and its value is set to 1 and kept, denoted asθ ij (t) : ⟶ 1. When there are no DoS attacks, the value of θ ij (t) is set to 0 and kept, which is recorded asθ ij (t) : ⟶ 0. All θ ij (t) are independent. e mathematical probability formula combined with the previous DoS attack model can be expressed as follows: where c ij ∈ [0, 1] is a known constant and is related toα i andα j .

Event-Triggered Control.
Taking into account the limited communication bandwidth between the agents in the microgrid, this paper uses event-triggered control to reduce the amount of communication between the agents. Due to the different degrees of DoS attacks, the defined packet loss rate α is a constant between[0, 1]. When the packet loss rate is within the controllable range, an improved consistency formula based on event-triggered is proposed, and the influence of DoS attacks on the consistency control process is overcome by setting the gain coefficient k λi and the correction amountζ. However, when the packet loss rate is too high, that is, the extreme case of DoS attacks, the above methods can no longer meet the control requirements of the system. erefore, it is considered to replace the real data with the data obtained by prediction compensation to complete the IC consistency control process. e improved consistency formula based on eventtriggered is as follows: International Transactions on Electrical Energy Systems 5 is paper takes DG1 and DG2 as examples to give a brief proof process to illustrate the conditions that (27) must meet to complete the consistency control process. It is known that the incremental costs λ 1 andλ 2 satisfy the firstorder equation. _ Laplace transformation on the above formulas can be obtained: In the formulas, λ 1 (s) and λ 2 (s) are the state quantities of the IC after Laplace transformation, and λ 1 (t)| t�0 andλ 2 (t)| t�0 are the initial values of the IC of DG1 and DG2, respectively. Define the IC state deviation obtained by DG1 and DG2 as follows: At this time, when k λi andζ meet the following condition, the system can meet the consistency requirements.
Set the triggered functions to S 1 (t), S 2 (t) andS 3 (t), which are defined as follows according to the previous description: When the triggered condition of (34) is met, DGi will send a request to the DGj to obtain its state information and update the control parameters. Among them, triggered condition S 1 (t) means that when the detection functionθ ij (t) � 0 on the communication link i, j ∈ Ω, that is, when the link is not subjected to DoS attacks, the control process is directly completed by (23). S 2 (t) means that whenθ ij (t) � 1 on the communication link i, j ∈ Ω, that is, when the link is under DoS attacks and the packet loss rate is within the controllable range, the control process is completed by (27). S 3 (t) means that whenθ ij (t) � 1 on the communication link i, j ∈ Ω, that is, when the link is under DoS attacks and the packet loss rate is 1, the control process is completed by the predictive compensation control.

Predictive Compensation Control.
e inability of agent i to receive the data of agent j will result in the inability to achieve the IC consistency, and thus fail to complete the restoration of the system frequency on the same time scale. In order to avoid the coupling problem between agents caused by directly predicting the data of agents, this paper uses the historical power data of agents at a moment in time, and calculates the IC through the predicted power, so as to obtain the corresponding control parameters.
In order to better analyze the consistent dynamic characteristics, Equation (23) is discretized. Let the sampling  International Transactions on Electrical Energy Systems period be T s , t � t 0 + kT s , abbreviated as t � k. λ(k) is sent every sampling period, and the corresponding discrete consistency algorithm can be written as follows: (35) e corresponding matrix form is In order to ensure the consistency of the system and still converge to the average value, W(k) is constructed according to the Metropolis method.
According to whether the agent is attacked by DoS, set the control parameter λ Ai to indicate the latest update signal obtained by the agent i based on the event-triggered. When the triggered conditionS 3 (t) is met, λ Ai can be expressed as Predictive compensation control is designed according to the following steps: (1) EMD is used to preprocess the historical data, and multiple intrinsic mode functions(IMFs) are obtained from the historical data. e IMF component must meet the following two conditions: (i) During the entire period, the number of extreme points and zero crossing points are equal, or the difference does not exceed 1 (ii) At any moment, the average value of the upper envelope and the lower envelope is zero (2) For this series of IMFs, a sliding window is used to intercept historical time series to obtain data samples. Intercept the data sample of length D as an input sample, then the data at the next moment is the expected value output by the ELM model. [12]. EMD is carried out in accordance with the flow chart given in Figure 3. e structure of the entire ELM network is shown in Figure 4. Suppose that the input layer of the network has n neurons, the output layer has m neurons, and the hidden layer has L neurons. e activation function is G(·). Input sample X � [IMF 1 , IMF 2 , · · · , IMF n ] T , output sample Y � [p ELM1 , p ELM2 , · · · , p ELMm ] T . e output function of the ELM model can be expressed as Where: w j � [w j1 , w j2 , · · · w jn ] T , β j � [β j1 , β j2 , · · · β jm ] T are the input and output connection weight of the j-th hidden layer neuron.
(3) In order to make the model with the smallest prediction error have a larger weight, the outputs of m ELMs are weighted as follows. e weighted result is en when the agent is attacked, the IC obtained after the predictive compensation control is as follows:

Simulation Model.
In this section, the simulation topology is a four-node microgrid system, as shown in Figure 5. e MATLAB/SIMULINK to verify the two-layer control strategy proposed above. e microgrid system consists of 4 DGs, the impedance of the power supply is taken as e simulation parameters and cost coefficients of each DG are shown in Table 1.

Performance Test and Comparison under Two-Layer
Control Structure

Comparison with Traditional ree-Layer Control.
In order to verify the advanced nature of the proposed control strategy, the two-layer control method in this study is compared with the distributed three-layer control method designed in Reference [27]. Set the simulation environment as: 0 ∼ 1s, only droop control is used, and at t � 1s, the upper control is activated. e simulation results under the two control strategies are shown in Figure 6.
Figures 6(a)-6(c) are the simulation results of the traditional three-layer control method, and Figures 6(d)-6(f) are the simulation results of the two-layer control method proposed in this paper. It can be seen that after the upper-layer control is activated, both methods can achieve the goals of frequency regulation and power optimization, but compared with the three-layer control method corresponding to Figures 6(a)-6(c), the method proposed in this paper has a faster power optimization speed. e traditional three-layer control needs 0.5 s to achieve incremental factor synchronization, while the control proposed in this paper only needs 0.2 s, which shows that the performance of the two-layer control strategy is better than the traditional three-layer control.

System Performance during Load Fluctuations.
is part tests the frequency recovery and power optimization effects when the load fluctuates. e system is connected to the control strategy proposed in this study for power International Transactions on Electrical Energy Systems optimization and frequency recovery at t � 1s, and disconnected at t � 6s.Set the simulation environment as: (1) At t � 2s, Load 1 increases to 70 kw. (2) At t � 3s, Load 2 increases to 100 kw. (3) At t � 4s, Load 3 is reduced to 70 kw. (4) At t � 5s, Load 4 is reduced to 60 kw. e simulation results are shown in Figure 7.
Figures 7(a)-7(c) show the changes in the output active power, incremental cost, and frequency of these four DGs, respectively. As can be seen from Figure 7(b), the initial values of ICs are 0.30750.24840.2865, 0.2306. After starting the control strategy at t � 1s, the IC of each DG tends to be consistent and finally stabilizes at 0.2651. After the load demand changes, the IC can still be consistent. It can be concluded that no matter how the load is changed, the IC of each DG can be driven to the same level under the control strategy designed in this study, so the control objectives are well met. As can be seen from Figure 7(c), the frequency of the microgrid can be stabilized at the nominal value of 50 Hz, and the frequency changes little. erefore, the proposed control scheme can effectively realize the economic operation and frequency adjustment of the islanded microgrid without considering the DG capacity constraints.

System Plug and Play Performance.
e distributed control method requires the system to be able to meet the change of topology, so in order to verify the plug-and-play performance of the method in this paper, the simulation process is as follows: e islanded microgrid runs under the condition of total constant load demand of 280 kW, the specific load requirements are shown in Table 2. e system accesses the second-layer control strategy for power optimization and frequency recovery at t � 1s, and disconnects Calculate the upper envelope e down (t)

IMF n (t)=q (t),u (t)=p (t)-IMF n (t),n=n+1
Whether q (t) satisfies the IMF component condition Whether u (t) is a monotonic function    International Transactions on Electrical Energy Systems    International Transactions on Electrical Energy Systems at t � 6s. Set the simulation environment as: (1) At t � 2s, DG1 is cut off from system. (2) When t � 4s, DG1 is put into the system, and the connection with the system is restored. Figure 8 shows the change in communication topology. e other control parameters and cost coefficients of DG are the same as above and remain unchanged. e simulation results are shown in Figure 9.
As can be seen from Figures 9(a)-9(c), the system can operate stably during the DG input and removal process. Figure 9(a) shows that due to DG1 exiting operation at t � 2s, the output power of DG1 is reduced to zero, and DG2, DG3, and DG4 share the total load of the system. At t � 4s, DG1 reconnects to the microgrid, and its output power increases from 0 to 7.237 kW. Figure 9(b) shows that in the whole process, although the DGs have changed, the ICs of DGs participating in the power supply are always consistent, so the control requirements can be well met. In addition, Figure 9(c) shows that when the DGs change, the frequency fluctuation can be restored to the nominal value in a short time. erefore, the proposed control method can well meet the plug-and-play requirement of the microgrid system.

DoS Attack Impact Analysis.
As mentioned earlier, the impact of DoS attacks is modeled as data loss that occurs on the communication link i, j ∈ Ω, the size of the packet loss rate directly affects the speed and the effect of the consistency convergence process. In order to analyze the impact of different packet loss rates on system control objectives, the simulation process is set as follows: e studied islanded microgrid runs under the simulation parameters of Table 1, and accesses the second-layer control strategy at t � 4s, and disconnects at t � 6s. In the communication system, the data transmitted by DG1 to other DGs during the period t 1 � 2s to t 2 � 4s is under attack, and the packet loss rate isα 1 . e results of the system frequency and the IC of each DG in the period t 1 ∼ t 2 under different packet loss rates are shown in Figure 10.   As can be seen from Figures 10(a) and 10(b), when the packet loss rate is small, the impact of the attack on DG1 is mainly causes the IC curve of DG1 to produce a large overshoot during this period, which deviates from the consistent value reached by the system except for DG1. e system frequency fluctuates during the attack period and deviates from the nominal frequency of 50 Hz. As can be seen from Figures 10(c) and 10(d), when the packet loss rate is large, the consistency control of the IC in the period t 1 ∼ t 2 fails, and the change of DG1 is the largest. e system frequency has a great overshoot at the moment of the attack and greatly deviates from the nominal frequency.
erefore it can be concluded that the main impact is the consistency control process of the IC, and the secondary control method is still effective in the rest of the time.

Verify the Effect of Improving Consistency Strategy.
In order to verify the effectiveness of the improved consistency strategy based on event-triggered in the case of weaker DoS attacks for frequency restoration and power optimization of the microgrid, use the same simulation process. Select the time period t 1 ∼ t 2 during which DoS attacks occur, and the simulation time is 2s. Assuming that at t 1 � 1s, the system detects DoS attacks, and then initiates the improved consistency strategy based on event-triggered. e results of changes in the IC and frequency are shown in Figure 11.
As can be seen from Figures 11(a) and 11(b), starting the improved consistency strategy can restore the destroyed IC consistency.
e recovery time is about 0.05s. e system frequency can achieve stability after fluctuations. When the packet loss rate is large, as can be seen from Figures 11(c) and 11(d), the improved consistency strategy is still effective, but the consistency recovery time of the IC is prolonged, about 0.35s. e system frequency has a large overshoot during the recovery process, but it can still be stabilized at 50 Hz. It can be concluded that in the case of weaker DoS attacks, the improved consistency strategy based on event-triggered can achieve our control goals, which proves the effectiveness of the proposed strategy.

Verify the Effect of Predictive Compensation Control.
As mentioned above, when an extreme situation occurs in DoS attacks, consider using the data obtained by predictive compensation control instead of the real data to complete the IC consistency control process. Select time period t 1 ∼ t 2 when the DoS attack occurs. e changes in IC and system frequency are shown in Figure 12. When a DG suffers DoS    attacks to completely drop its packets, the attacks will gradually spread throughout the network, which will seriously affect the fidelity of the information. After t 1 � 1s, because the event-triggered mechanism calculates the impact of packet loss on the secondary control, the predicted data obtained from the output of the predictive compensation is used to replace the real data to complete the subsequent consistency control process. As can be seen from Figures 12(a) and 12(b), the IC and frequency of each DG can be restored to be consistent at about 0.3 s. According to the above analysis, for extreme DoS attacks, the secondary control strategy based on eventtriggered can well use the predictive compensation data to suppress the overshoot and complete the IC consistency control process, while stabilizing the system frequency at the nominal value.

Conclusion
is paper proposes a distributed two-layer control structure for the islanded microgrid system with CPS characteristics. e control structure can realize the distributed frequency adjustment and power optimization of the microgrid at the same time, effectively shortening the operating time of the system, and significantly improving the power optimization distribution capability of the microgrid. Aiming at the possible network attacks at the cyber layer, in order to reduce the impact of different degrees of DoS attacks on the system, this paper designs an improved consensus algorithm based on event-triggered and predictive compensation control that combines EMD and ELM. Finally, the 4-node MG system is simulated and analyzed, and the experimental results show that this method can effectively eliminate the influence of DoS attacks on consistency control, keep the system frequency at 50 Hz, and keep the IC consistency of all DGs. e results show that this method can meet the control requirements of frequency synchronization, frequency errorfree, and optimal operation cost.

Data Availability
Data sharing not applicable to this article as no datasets were generated or analyzed during the current study.

Conflicts of Interest
Submission of this study does not involve any conflict of interest.