## 3 Self-Triggered Control for Islanded Microgrids under DoS Attacks
### Improved Ternary Self-Triggered Control Law Under DoS Attacks  
To achieve the agent's consensus while reducing communication requirements in the secondary control level, we improve the ternary control approach previously applied in [31; 32]. The ternary variables of agent \(i\) is defined as \(\left(x_{i}^{AVE},u^{ij},\theta^{ij}\right)\), where \(x_{i}^{AVE}\) is the state variable, \(u^{ij}\) is the local control input, and \(\theta^{ij}\) is the clock variable. The piecewise-constant control input \(u^{ij}\) belongs to the set \(\{-Y,0,Y\}\), where \(\Upsilon\) is a positive scalar. The evolution of the ternary variables of agent \(i\) can be described as  
\[\left\{ \begin{array}{l}\dot{x}_{i}^{AVE}=u_{i}=\sum_{j\in N_{i}}u^{ij}\\ \dot{u}^{ij}=0\\ \dot{\theta}^{ij}=-1\end{array} \right. \tag{9}\]  
where \(x_{i}^{AVE}=\left\{V_{i}^{AVE},\ Q_{i}^{AVE}\right\}\) denotes the average estimate of voltage and reactive power in \(DG_{i}\). \(u^{ij}\) denotes the control action caused by the relative state difference between neighboring agents \(i\) and \(j\), and the control action is fully distributed since the evolution of \(x_{i}^{AVE}\) only depends on \(x_{j}^{AVE}\) with \(j\in N_{i}\). \(\theta^{ij}\) denotes the clock variable on the communication link \((i,\ j)\in\Xi\). When \(\theta^{ij}\) reaches 0, agent \(i\) asks for the state of agent \(j\), then updates the control input \(u^{ij}\) and resets the value of \(\theta^{ij}\). Since the following update time is determined by \(\theta^{ij}\) and precomputed at the update time, the system described as Equation (9) can realize self-triggered communication [31]. The detection function for DoS attacks on the communication link \((i,\ j)\in\Xi\) is defined as \(\delta^{ij}(t)\in\{0,1\}\), and an assumption is proposed as follows. **Assumption 1:**_The detection function \(\delta^{ij}(t)\in\{0,1\}\) indicates whether the communication link \((i,j)\in\Xi\) is in the presence of DoS attacks and only changes its value at the triggering time instants. Specifically, at triggering time instants, if an agent attempts to communicate with its neighbors and cannot receive the information, it implies that the communication link is suffering from the DoS attacks. Then, the detection function \(\delta^{ij}(t)\) changes value from 1 to 0, denoted as \(\delta^{ij}(t):1\to 0\). When the attack shifts to a sleep period, an ACK-based  
Figure 3: Communication topology and DoS attack sequence. monitoring mechanism is able to detect that the communication link returns to normal and there will be a successful information exchange between agents immediately. Then, the detection function \(\delta^{ij}(t)\) changes value from 0 to 1, denoted as \(\delta^{ij}(t):0\to 1\)._  
**ACK-based monitoring mechanism**: At triggering time instants, if the communication attempts are denied by the attack, an ACK-based monitoring mechanism is activated to check whether the attack shifts to a sleep period. Specifically, when the communication attempt of \(DG_{i}\) is blocked due to the jamming period of DoS attack, \(DG_{i}\) continuously sends test data packets to \(DG_{j}\). When the attack shifts to a sleep period, \(DG_{j}\) will receive the test packets and send an acknowledgment (ACK) message back to \(DG_{i}\). It is assumed that the ACK message can be transmitted successfully and the transmission time is negligible, the proposed mechanism can detect the sleep period immediately. Such implementation is practical and also applied in the cybersecurity framework for power grids [33]. The ACK-based monitoring mechanism requires no extra calculation process. Thus, the computation burden of the microcontroller is not increased and the real-time performance of the control scheme is not affected. From the above analysis, it can be seen that Assumption 1 is reasonable and feasible in practical engineering.