# A Preemptive-Resume Priority MAC Protocol for Efficient BSM Transmission in UAV-Assisted VANETs
## 4 Problem Formulation and Performance Metrics
### UAV Communication Latency
#### 4.1.2 UAV MAC Layer Service Delay
The collision probability P and current state are used to determine the transition to the next state. This approach allows us to analyze and derive performance metrics for the system. The modified generalized Markov chain model is shown in the Figure 6.  
The transition probabilities of the generalized Markov chain are as follows:  
\[\left\{ \begin{array}{ll}P\{i,k|i,k+1\}=1&k\in[0,W_{i}-2]\quad i\in[0,m]\\ P\{i,k|i-1,0\}=\
icefrac{{p}}{{W_{i}}}&k\in[0,W_{i}-1]\quad i\in[1,m]\\ P\{m,k|m,0\}=\
icefrac{{p}}{{W_{m}}}&k\in[0,W_{m}-1]\quad i\in[0,m]\\ P\{-1,0|i,0\}=(1-p)(1-q)&i\in[0,m]\\ P\{0,k|-1,0\}=\
icefrac{{q}}{{W_{0}}}&k\in[0,W_{0}-1]\quad i\in[0,m]\\ P\{0,k|i,0\}=\frac{(1-p)q}{W_{0}}&k\in[0,W_{0}-1]\quad i\in[0,m]\end{array}  \right.. \tag{14}\]  
Let \(\text{b}_{1,k}=\lim\limits_{t\to\infty}\text{P}\{\text{s}(t)\text{i},\text{b}(t )=\text{k}\}\) denote the stationary distribution of the chain. According to the regularity of the chain, we can express it as follows:  
\[b_{i,k}= \begin{cases}\frac{W_{i}-k}{W_{i}}b_{i,0}&i\in[0,m]\;\;k\in[0,W_{0}-1] \\ \frac{1-q}{q}b_{0,0}&i=-1\;\;k=0\end{cases} . \tag{15}\]  
By imposing the normalization condition, we can obtain:  
\[b_{0,0}=\frac{2(1-2p)(1-p)q}{(1-2p)(W+1)q+pqW\big{[}1-\left(2p\right)^{m} \big{]}+2(1-2p)(1-p)(1-q)}. \tag{16}\]  
Figure 6: Markov Chain Model. Then, the transmission probability of the user in a random time slot is defined as \(\tau\), and transmission starts when the backoff counter is 0. \(\tau\) can be obtained by the following formula:  
\[ \begin{array}{l}\tau=\sum\limits_{j=0}^{m}b_{j,0}=\frac{h_{0,0}}{1-p}\\ =\frac{2(1-2p)q}{(1-2p)(W+1)q+pqW\big{[}1-(2p)^{n}\big{]}+2(1-2p)(1-p)(1-q)}. \end{array}  \tag{17}\]  
The actual time slot interval for a station is determined by the algorithm and specific parameters in different priority scenarios. \[E(Slot)=P_{s}T_{s}+P_{idle}\sigma+(1-P_{s}-P_{idle})T_{c}. \tag{18}\]  
\(P_{s}\) represents the probability of detecting a busy channel due to successful transmissions from other stations, and \(P_{idle}\) represents the probability of the channel being idle. \(P_{s}\) and \(P_{idle}\) can be calculated using the following equation. \[P_{s}=(r-1)\times\tau\times(1-\tau)^{r-2}, \tag{19}\]  
\[P_{idle}=(1-\tau)^{r-1}. \tag{20}\]  
\(T_{s}\) represents the duration of a successful transmission, \(T_{c}\) represents the duration of detecting channel busyness due to collisions, and \(\sigma\) represents the duration of an idle system time slot. \(T_{s}\) and \(T_{c}\) can be obtained using the following equation:  
\[T_{s}=\frac{H_{PHY}}{CR}+\frac{H_{MAC}}{R_{ku}}+T_{ku}+SIFS+\delta+\frac{ACK}{ CR}+\delta+DIFS, \tag{21}\]  
\[T_{c}=\frac{H_{PHY}}{CR}+\frac{H_{MAC}}{R_{ku}}+T_{ku}+SIFS+\delta+EIFS. \tag{22}\]  
Note that in this article, different priority levels have different Distributed inter-frame space (DIFS) values (HDIFS, MDIFS, and LDIFS), which means that the time slot duration (\(T_{s}\)) for each priority level is also different. Additionally, \(R_{ku}\) is the transmission rate obtained in the previous section, and we define \(\text{CR}=\text{R}_{ku}/10\). This article takes the average values of variables \(T_{ku}\) and \(R_{ku}\) for all vehicles in each priority level. In practice, the duration of a station's collision (\(T_{c}\)) depends on whether the station participated in the collision or observed it. However, since the 802.11 standard does not have an ACK timeout specification, this article assumes that \(T_{s}=T_{c}\).