## 5 Cyber-Physical Inverter-Based Microgrid Implementation and Experimental Results
### Examining the MG's Frequency Performance under the DDoS Attack  
The communication surface between the central controller and the physical system is vulnerable to cyber risks. In this test, the communication surface represented by the ns3-based communication model was exposed to an emulated DDoS attack to assess the sustainable operation and stability of the MG. Based on Algorithm 2 in Section 3, the DDoS attack was modeled considering that the number of the attacker bots is ten, and the centralized secondary controller node is exposed to an emulated UDP flooding DDoS attack. The operation of the MG under the DDoS attack within the communication surface is as follows:  
* At = 0 s, the physical system typically starts in OPAL-RT without the secondary control. * At = 36.5 s, the centralized secondary controller connects to the physical system via the proposed communication model. * At = 40 s, the emulated attacker starts sending excessive UDP flooding messages, as presented in Figure 18, from the attacker's nodes to the centralized control node in LAN-2 within the ns3-based communication model, demonstrated graphically in Figure 19.  
Figure 17: Impact of communication delay on percentage maximum peak value during different transient changes. Figure 18: Wireshark capture at a bot node during the DDoS attack using UDP flooding. While increasing the contingency resulting from UPD flooding through the communication channels, the centralized controller faces interruptions and cannot send or receive any packets. This results in a loss of connectivity between the primary and secondary control layers, as presented in Figure 20. Reducing the number of attacker bots in the proposed DDoS attack model results in the system acting similarly to its operation under communication delay, where the central controller can send delayed control signals to the local controllers. Figure 21 depicts the frequency performance during this test and divides it into the following four zones:  
* Zone A (0-36.5 s): The MG worked based on primary control only; thus, the frequency was stable but deviated from its nominal value. * Phase B (36.5-45 s): The established communication model connected the secondary control layer to the physical layer, eliminating the frequency deviation. At \(t_{attack}\) = 40 s, the DDoS attack commenced; however, it did not impact the system, as it was in a steady state. * Zone C (45-70 s): The emulated attack hacked the communication surface, leading to central controller corruption, as described in Figure 20. However, the absence of secondary control signals within this zone did not affect the system, as no operating conditions change needed a control action. * Zone D (70-100 s): A step-up change occurred at t = 70 s, while the central controller cannot sense this variation as it is under attack. Consequently, the frequency cannot remain constant at 60 Hz, and there is a frequency deviation. The system remains stable but with a frequency deviation value depending on the load change amount, the same as operation with droop control only. It is pertinent to mention that the rate at which the DDoS attack affects the MG stability depends on the system's status when the attack occurs. Therefore, if the DDoS attack arises while the MG still has not reached its steady state, it may lead to severe conditions, jeopardizing the system's stability. Figure 22 depicts the MG under a DDoS attack at t = 37 s; meanwhile, the centralized secondary controller connection occurred at t = 36.5 s, meaning the MG did not reach its steady state. Accordingly, the system loses its stability due to the mismatch between the value of the control command from the secondary control layer and the current behavior of the MG's response in the physical layer. Figure 19: Graphical representation for DDoS attack within the ns3-based communication model. Figure 21: The MG’s frequency response with/without the DDoS attack (\(t_{attack}\) = 40 s).