## 4 The Digital-Twin-Based Detection and Protection Framework
### The Detection and Protection Method in the Framework
#### 4.3.2 SH Detection and Protection Method  
Based on the SH generation mechanism proposed in Section 3.2, we design and implement a SH detection algorithm for the satellite network based on the Walker constellation and a routing mechanism based on link delay, as shown in Algorithm 1. After the satellite network generates an RIB, the ground station analyzes the adjacency of satellite nodes in the satellite network topology and the digital twin data \(PosDT\), \(LSADT\), and \(RIB_{DT}\) to detect whether there is a false link that can trigger a SH. The proposed algorithm is as follows:  
Step 1. (Line 1-2) Based on the data structure shown in Equations (3) and (4), for each piece of data \(<ID^{i}_{orb}\parallel ID^{i}_{sat}\), \(ID^{j}_{orb}\parallel ID^{j}_{sat},DLY^{ij}>\) in \(RIB_{DT}\), the algorithm firstly judges whether both satellites of the communication link are in the same orbit. If they are in the same orbit, jump to Step 2; If they are not in the same orbit, jump to Step 4. Step 2. (Line 3-4) If the two satellites are in the same orbit, the algorithm further determines whether the two satellites are adjacent. If they are adjacent, this means there is an actual direct link. If they are not adjacent, this indicates that there is a false link in the satellite network, and it is necessary to further judge whether the false link is adopted, and jump to Step 3. Step 3. (Line 5-9) Calculate the minimum number of hops \(L_{n}\) in the orbit between two satellites, and judge whether \(DLY^{ij}\) less than \(L_{n}\times\) average delay \(\overline{DLY_{iol}}\) of inter-orbital links (IOLs). If the condition is satisfied, this means that the false link is adopted and there is a SH node. If the condition is not satisfied, this means that the false link has not been adopted, and the SH node has not been generated. Continue to the next data. Step 4. (Line 10) If the two satellites are not in the same orbit, the algorithm further determines whether the two satellites are in adjacent orbits and adjacent to each other. If they are adjacent, jump to Step 5; if they are not adjacent, jump to Step 7. Step 5. (Line 11,15) Judge whether \(LAT^{i}\) or \(LAT^{i}\) is bigger than the polar region boundary latitude. If the condition is satisfied, this means that there is a false link, and jump to Step 6 to further judge whether the false link is adopted. If the condition is not satisfied, this means that there is an actual direct link, and this piece of data will not cause a SH node. Continue to the next piece of data. Step 6. (Line 12-14) Judge whether \(DLY^{ij}\) is less than \(2\times\) average delay \(\overline{DLY_{iol}}\) of IOLs + average delay \(\overline{DLY_{iol}}\) of intra-orbital links (AOLs). If the condition is satisfied, this means that the false link is adopted and a SH node exists. If the condition is not satisfied, this means that the false link has not been generated. Continue to the next piece of data. Step 7. (Line 16-19) If the two satellites are not adjacent, this means that the link is a false link. The algorithm further judges whether the false link can be adopted. First, the algorithm calculates the minimum number of hops \(L_{n}\) in the orbit and the minimum number of hops \(L_{o}\) between orbits. Then the algorithm judges whether \(LAT^{i}\)_or_\(LAT^{j}\) is bigger than the polar region boundary latitude. If the condition is satisfied, \(L_{n}=\left|ID_{sat}^{i}-ID_{sat}^{j}\right|+2\) and \(L_{o}=\left|ID_{orb}^{i}-ID_{orb}^{j}\right|\); If the condition is not satisfied, \(L_{n}=\left|ID_{sat}^{i}-ID_{sat}^{j}\right|\) and \(L_{o}=\left|ID_{orb}^{i}-ID_{orb}^{j}\right|\). Jump to Step 8. Step 8. (Line 20-22) The algorithm also judges whether \(DLY^{ij}\) is less than \(L_{n}\times\overline{DLY_{iol}}\) + \(L_{o}\times\overline{DLY_{anol}}\). If the condition is satisfied, this means that the false link is adopted and a SH node exists. If the condition is not satisfied, this means that the false link has not been adopted, and the SH node has not been generated.