## 3 System Model
### Optimal Relay Selection
#### 3.2.2 Delay Model  
During the packet transmission, a time delay is generated. In this section, we build a delay model to calculate the transmission delay between each node. We define the total delay \(D_{i,j}\) of packet transmission between wayside nodes \(i,j\) into two main components, which are the transmission delay \(T_{n}\) caused by the node sending the packet and the queuing delay \(T_{q}\) due to node congestion. In this subsection, the time delay calculation is the same for both T2T transmission and T2W transmission; thus, both are expressed as the transmission between nodes \(a\) and \(b\). When the node sends data packets, the transmission delay can be represented as  
\[T_{c}=\frac{L}{C_{a,b}}, \tag{13}\]  
where \(L\) is the number of bits in the packet, and \(C_{a,b}\) is the transmission rate of the channel between node \(a\) and node \(b\). Queuing delay [27] is unavoidable in the transmission of large amounts of data. Therefore, it is crucial to build a node queuing model. The queue follows the first-in first-out (FIFO) rule. When the CBTC system is stable, we assume that each wayside node can receive multiple data streams simultaneously to eliminate any scheduling effects, and that the average arriving rate and queuing situation are basically fixed. In order to calculate the queuing delay, we use [PERSON]'s formula. In [PERSON]'s law, the average waiting time of a queue can be calculated as the queue length divided by the effective throughput. Since the buffer length of our designed model is limited, we calculate the effective throughput by considering the packet loss rate and the packet error rate. According to [PERSON]'s law [31; 32], the packet delay at next-hop node \(b\) can be expressed as  
\[T_{q}=\frac{Q_{b}}{Th_{b}}, \tag{14}\]  
where \(Q_{b}\) is the average number of packets queued at node \(b\), and \(Th_{b}\) is the effective throughput of node \(b\). The effective throughput of node \(b\) is indicated as  
\[Th_{b}=\lambda_{b}\Delta t\times\ (1-p_{f}), \tag{15}\]  
where \(\lambda_{b}\) is the average arriving rate of node \(b\), \(\lambda_{b}\Delta t\) is the total number of packets arriving in a time slot \(\Delta t\), and \(p_{f}\) is the link \(a\to b\) unsuccessful transmission rate. There are many factors that affect the transmission unsuccessful rate, such as the packet error rate \(p_{fe}\) and the packet loss rate \(p_{fl}\). If a packet is lost or transmission error occurs, this will cause this packet to be unusable; hence, the probability of unsuccessful transmission rate can be expressed as  
\[p_{f}=1-(1-p_{fl})(1-p_{fe}). \tag{16}\]  
As for the calculation of the packet error rate, we can assume that the channel is modulated using the quadrature phase shift keying (QPSK) coding method. Therefore, the bit error rate (BER) [2] is  
\[p_{be}=\frac{1}{2}\left(1-\sqrt{\frac{\gamma_{a,b}}{1+\gamma_{a,b}}}\right), \tag{17}\]  
where \(\gamma_{a,b}\) is the SNR between the node \(a\) and node \(b\); when the SNR between two nodes is large enough, \(p_{be}\cong\frac{1}{4\gamma_{a,b}}\). Meanwhile, as the length of the packet is \(L\), the BER of the whole packet can be represented as  
\[p_{fe}=1-(1-p_{be})^{L}. \tag{18}\]For packet loss rate \(p_{fl}\), we build a node queuing model to solve this problem [33; 34]. Packet loss is due to the limited buffer length of the node. Therefore, if the total packet length exceeds the buffer length, the packet will not be received by the node, causing an increment in packet loss rate. We define \(M\) as the maximum number of packets that the buffer can hold, while \(Q_{l-1}\) is denoted as the number of packets left in the previous time slot, and \(A_{t}\) is the average number of packets arriving at the node in time slot \(t\). We can derive the average number of arriving packets per time slot as \(A_{t}=\lambda_{b}\Delta t\), where \(\lambda_{b}\) is the arrival rate of node \(b\), and \(L\) is the length of the packet.