# Faulty Links' Fast Recovery Method Based on Deep Reinforcement Learning
## 2 Wide-Area Measurement System Communication Network SDN Architecture
### System Modeling  
For the definitions of equation-related terms and abbreviations, please refer to Table 1 in Appendix A. The communication network topology of the WAMS is modelled as a directed graph, where \(V=\{v_{1},v_{2},\cdots v_{n}\}\) represents the set of switches in the network topology, \(E=\left\{e_{1,2},e_{1,3},\cdots e_{i,j}\right\}\) represents the set of links in the network topology, and the link connecting switches \(v_{i}\) and \(v_{j}\) in the network topology is marked \(e_{i,j}\). The link weight of link \(e_{i,j}\) is marked \(weight_{e_{i,j}}\), and the path from source node \(s\) to destination node \(d\) is marked \(p_{s,d}\).  
The network delay of the WAMS communication network consists of two parts, \(delay(v_{i})\) and \(delay_{t}\left(e_{i,j}\right)\), where \(delay(v_{i})\) represents the delay for the PMU device to convert the voltage and current phasor data into data packets and transmit them to the switch connected to the PMU, and \(delay_{t}\left(e_{i,j}\right)\) represents the delay function of the link \(e_{i,j}\) at time \(t\). The calculation process of the data transmission delay \(Delay_{t}(p_{s,d})\) between the phasor data from the source node \(s\) to the destination node \(d\) in the network topology is shown in Equation (1):  
\[Delay_{t}(p_{s,d})=delay(v_{i})+\sum\
olimits_{v_{i,j}\in p_{s,d}}delay_{t} \left(e_{i,j}\right) \tag{1}\]  
Assuming that link \(e_{i,j}\) is interconnected via port \(m\) of switch \(v_{i}\) and port \(n\) of switch \(v_{j}\), the utilized bandwidth \(bandwidth_{e_{i,j}}(t)\) of link \(e_{i,j}\) at time \(t\) is determined by the aggregate number of bytes forwarded through ports \(m\) and \(n\). The computational process for this determination is shown in Equation (2):  
\[\mathit{bandwith}_{e_{i,j}}(t)=\frac{b_{i,m}(t)-b_{i,m}(t-T)+b_{j,n}(t)-b_{j,n}(t -T)}{T} \tag{2}\]  
In Equation (2), \(b_{i,m}(t)\) represents the quantity of bytes transmitted by the \(m\) port of switch \(v_{i}\) at time \(t\), \(b_{i,m}(t-T)\) denotes the number of bytes relayed by the \(m\) port of switch \(v_{i}\) at time \(t-T\), and \(T\) signifies the interval for polling the switch status parameter.  
The maximal attainable bandwidth for link \(e_{i,j}\) is denoted by \(\max\!\left(\mathit{bandwidth}_{e_{i,j}}\right)\), while the utilization rate of link \(e_{i,j}\) at time \(t\) is indicated by \(R_{e_{i,j}}(t)\). The utilization of link \(p_{s,d}\) at time \(t\) is ascertained by the maximum utilization \(\mathit{Bandwidth}_{p_{s,d}}(t)\) among the set of links comprising the path. The utilization \(R_{e_{i,j}}(t)\) of link \(t\) at time \(t\) and the utilization \(\mathit{Bandwidth}_{p_{s,d}}(t)\) of path \(p_{s,d}\) are quantified using Equation (3):  
\[\left\{\begin{array}{c}R_{e_{i,j}}(t)=\frac{\mathit{bandwidth}_{e_{i,j}}(t)}{ \max\!\left(\mathit{bandwidth}_{e_{i,j}}\right)}\\ \mathit{Bandwidth}_{p_{s,d}}(t)=\max\!\left\{R_{e_{i,j}}(t)\right\},e_{i,j} \in p_{s,d}\end{array}\right. \tag{3}\]  
Due to the disparate dimensions of data transmission delay \(Delay_{t}(p_{s,d})\), link utilization \(\mathit{Bandwidth}_{p_{s,d}}(t)\), and packet loss rate \(\mathit{Loss}_{e_{i,j}}(t)\), the link transmission delay \(\mathit{Delay}_{t}(p_{s,d})\) is normalized to establish a uniform metric, thereby transforming the dimensional expression into a scalar value, as delineated in Equation (4):  
\[\mathit{Delay}^{\prime}_{t}(p_{s,d})=\frac{\max\!\left\{\mathit{ Delay}_{t}(p_{s,d})\right\}-\mathit{Delay}_{t}(p_{s,d})}{\max\!\left\{ \mathit{Delay}_{t}(p_{s,d})\right\}} \tag{4}\]  
In Equation (4), \(\mathit{Delay}^{\prime}_{t}(p_{s,d})\) represents the normalized value of the data transmission delay, while \(\max\!\left\{\mathit{Delay}_{t}(p_{s,d})\right\}\) denotes the maximum tolerable transmission delay for data transfer within the WAMS.