## 4 Algorithm Description
### Dynamic Addressing  
In the application scenario of urban rail transit, when the channel quality gradually deteriorates, and the packet loss rate gradually increases, a certain segment of the link is no longer suitable as a communication link. For traditional AODV routing protocols, the routing discovery algorithm is only initiated when the communication link breaks. But due to the real-time nature of urban rail transit, on the one hand, replacing a link when it fails causes significant losses. On the other hand, restarting the routing discovery algorithm due to path interruption also has a certain impact on the overall performance of the network. Therefore, a dynamic addressing algorithm is proposed to monitor link status and dynamically update routes to minimize the losses and avoid the overhead of initiating route discovery, ensuring the communication reliability of the urban rail Ad Hoc network. In the dynamic addressing section, the source node of each path periodically sends detection packets to calculate the packet loss rate of each link segment. We define a packet loss threshold that determines whether the link needs to be replaced at this time. Each cluster head dynamically monitors whether the packet loss rate of each link segment in the path is lower than the threshold. When the packet loss rate of a certain link segment is bigger than the threshold, the link segment needs to be replaced. Each cluster head maintains the links of its member nodes and executes the dynamic addressing algorithm. Finally, the algorithm selects different updated paths according to different types of communication services. The algorithm proposes the following six schemes for replacing links and calculates the path state weights for each scheme based on the traffic types of communication services. Then, it selects a new path corresponding to different service types based on the weights. Later, through simulation verification, the algorithm in this paper is compared with traditional AODV routing protocols. Let us assume that a statically configured path \(\mathrm{A}\rightarrow\mathrm{B}\rightarrow\mathrm{C}\rightarrow\mathrm{D} \rightarrow...\) is found. When it is found that link \(\mathrm{A}\rightarrow\mathrm{B}\) needs to be replaced, this link will not be selected again in the next dynamic addressing of this cycle. Routing discovery will be enabled to select a new path according to the scheme shown in Table 1.  
If only to find the paths between nodes A and B, there may be too many hops between the two nodes, resulting in excessive hops between the two nodes and increasing data forwarding delay. Therefore, based on Scheme 1, Scheme 2 and Scheme 3 are proposed, Scheme 4, Scheme 5, and Scheme 6, which combine the above three schemes, are further proposed. The reason why Schemes 4-6 are proposed is to fully consider the combination of various options and then select the best update path. Then, detection packets are sent to calculate the packet loss rate of the newly found path and compare it with the original. The better path is selected, and all bad links in the statically configured path from the source node to the destination node are sequentially replaced. Different new paths are obtained using Schemes 1 to 6. Due to the different types of communication services having different requirements for packet loss rate and delay, the update paths in Schemes 1 to 6 also have different \begin{table}
\begin{tabular}{c c c} \hline \hline \multirow{2}{*}{**Schemes**} & **Source Node for Routing** & **Destination Node for Route** \\  & **Discovery** & **Discovery** \\ \hline Scheme 1 & A & B \\ Scheme 2 & A & C \\ Scheme 3 & A & D \\ Scheme 4 & Consider both Scheme 1 and Scheme 2 and select a link with a low packet & loss rate \\ Scheme 4 & Consider both Scheme 1 and Scheme 3 and select a link with a low packet & loss rate \\ Scheme 5 & Consider Scheme 1, Scheme 2, and Scheme 3 and select a link with a low packet & packet loss rate \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Dynamic addressing scheme.