# Power Grid Reliability Evaluation Considering Wind Farm Cyber Security and Ramping Events
## 5 Power System Reliability Assessment
### Bi-Level Modeling of the Worst-Case Attack  
After the sampling of wind power and cyber security, the direct-current OPF model was used to quantify the load shedding caused by cyber-attacks. The objective function is shown in Equation (19), which is a max-min problem, as the attacker tries to trip the WTs at a minimum point of active power margin \(V_{a}\) while the system operator aims to minimize the load curtailment. The power flow of branches are shown in Equation (20) considering the physical failure \(\delta_{I}\) of branch \(l\). The power balance at each bus is described in Equation (21). The constraints of time to attack, power generation, power flow of branch, and load curtailment at bus are shown in Equations (22)-(26), respectively.  
\[\eta=\underset{t}{\max}\frac{1}{V_{a}(t)}\underset{\{\delta_{I},P^{R},\mu^{P},P^{I},\Delta p^{I}\}}{\min}\left(w\sum_{n\in N}C_{n}^{d}\cdot\Delta P_{n}^{d} +\sum_{j\in J}C_{j}^{g}\cdot P^{g}\right) \tag{19}\]  
\[s.t.\hskip 14.226378 ptP_{l}^{f}x_{l}=\delta_{I}\left(\delta_{o(l)}-\delta_{d(l )}\right),\forall l\in L \tag{20}\]  
\[\sum_{j\in Jn}P_{j}^{g}+\sum_{i\in In}P_{i}^{W}-\sum_{l\in J(l)=n}P_{l}^{f}+ \sum_{l\in J(l)=n}P_{l}^{f}+\Delta P_{n}^{d}=P_{n}^{d},\forall n\in N \tag{21}\]  
\[t_{0}\leq t\leq t_{0}+\overline{t_{a}},\hskip 5.690551 pt\forall t\in T \tag{22}\]  
\[0\leq P_{j}^{w}\leq Z_{j}\overline{P}_{j}^{g},\hskip 5.690551 pt\forall i\in I \tag{23}\]  
\[0\leq P_{j}^{g}\leq Z_{j}\overline{P}_{j}^{g},\hskip 5.690551 pt\forall j\in J \tag{24}\]\[-\overline{P}_{l}^{f}\leq P_{l}^{f}\leq\overline{P}_{l}^{f},\ \ \forall l\in L \tag{25}\]  
\[0\leq\Delta P_{n}^{d}\leq P_{n}^{d},\ \ \forall n\in N \tag{26}\]  
where \(\eta\) is the objective function, \(V_{a}(t)\) is the index of active power margin at time \(t\), as shown in Equation (5). \(\Delta P_{n}^{d}\) and \(P_{j}^{S}\) are the vectors of the load curtailment and the output of a conventional generator. \(C_{n}^{d}\) and \(C_{j}^{S}\) are the corresponding costs of load curtailment and generation cost, respectively. \(w\) is a big number which guarantees a higher priority for the minimum objective of load shedding. \(t\) is the time to attack, \(\delta\) is a vector of phase angles. \(P_{i}^{w}\) is the vectors of WT outputs. \(P_{l}^{f}\) is the vector of the power flows. n and \(l\) are the indices of buses and branches. \(i\) and \(j\) are the indices of WTs and conventional generators, respectively. \(N,L,I,J\) and \(T\) are the sets of buses, branches, WTs, generators, and time, respectively. \(x_{l}\) is the impedance of branch \(l\). \(t_{0}\) is the time for attacker intrude the system successfully. \(\overline{t_{a}}\) is the maximum hidden time for attack. \(\overline{P}_{i}^{w}\) is the power capacity of a WT \(i\). \(\overline{P}_{j}^{S}\) is the available capacity of generator \(j\) according to Equation (13), and \(\overline{P}_{l}^{f}\) is the transmission capacity of branch \(l\). \(\delta_{l}\) and \(Z_{i}\) are the binary variables (0/1) which indicate the physical statuses of the branch \(l\) and generator \(i\), respectively. When \(\delta_{l}\) or \(Z_{i}\) is 0, it means the physical status of the component is out of service. \(o(l)\) is the origin bus of branch \(l\), and \(d(l)\) is the destination bus.