# Congestion Control and Traffic Differentiation for Heterogeneous 6 TiSCH Networks in IIoT
## 4 Multi-Queue Model and Priority-Based Transmission
### Mathematical Analysis
#### 4.2.1 Average Queue Waiting Time in Q\({}_{1}\)  
Based on the aforementioned considerations, since the transmission priority of a T\({}_{1}\) packet within Q\({}_{1}\) is determined based on the absolute deadline, out of the packets already in Q\({}_{1}\), there are \(N_{1}^{B}\) packets whose absolute deadlines are earlier than that of the tagged packet and scheduled for transmission before it. Figure 6: Packet arrivals in the proposed multi-queue model: (**a**) scenario of \(N_{1}^{B}\); (**b**) scenario of \(N_{1}^{A}\). This scenario is illustrated by Figure 6a, where we have a packet \(\text{Pk}_{1}\) with a relative deadline \(d_{1}\) and our tagged packet \(\text{Pk}_{2}\) with a relative deadline \(d_{2}\). According to the EDF policy, the transmission priority of each packet within \(\text{Q}_{1}\) is assigned upon its arrival based on its absolute deadline (\(t+d_{i}\)). Although \(d_{2}<d_{1}\), \(\text{Pk}_{1}\) has a higher transmission priority than \(\text{Pk}_{2}\), since the former has an earlier absolute deadline. This applies to the packets arriving at least (\(d_{1}-d_{2}\)) before the arrival of \(\text{Pk}_{2}\) and has been waiting for at least (\(d_{1}-d_{2}\)) given that \((d_{1}-d_{2})>0\). Therefore, we have:  
\[\overline{N_{1}^{B}}=\max\left\{0,\overline{\alpha_{1}}\left(\overline{W_{Q_{1 }}}-D_{\text{Q}_{1}}\right)\right\}, \tag{13}\]  
where \(\overline{\alpha_{1}}\) is the effective arrival rate (we will derive the formula of \(\overline{\alpha_{1}}\) later in this section), and \(D_{Q_{1}}=d_{1}-d_{2}\), which can be deterministic for constant values of \(d_{1}\) and \(d_{2}\). In addition, there are a number of \(N_{1}^{A}\) packets that arrive after the tagged packet with an earlier absolute deadline, hence are transmitted first. This case is depicted in Figure 6b, where packet \(\text{Pk}_{2}\) arrives after the tagged packet \(\text{Pk}_{1}\), with an earlier absolute deadline. This applies to all packets that arrive after the tagged packet no later than \(D_{\text{Q}_{1}}\). However, the tagged packet may stay in \(\text{Q}_{1}\) for a period less than \(D_{\text{Q}_{1}}\), given that \(\overline{W_{Q_{1}}}<D_{\text{Q}_{1}}\). Thus, \(\overline{N_{1}^{A}}\) is given as:  
\[\overline{N_{1}^{A}}=\overline{\alpha_{1}}\text{min}\left\{\overline{W_{Q_{1} }},D_{Q_{1}}\right\}. \tag{14}\]  
When those (\(N_{1}^{B}+N_{1}^{A}\)) packets are transmitted and the tagged packet becomes the one with the highest priority in \(\text{Q}_{1}\), it will wait for additional time until the beginning of its assigned slot, which is on average \(\frac{1}{2}T_{c}\)[38]. Therefore, \(\overline{W_{Q_{1}}}\) can be calculated as:  
\[\overline{W_{Q_{1}}} =\left(T_{c}+\frac{1}{2}T_{c}\right)\left(\overline{N_{1}^{B}}+ \overline{N_{1}^{A}}\right)+\frac{1}{2}T_{c} \tag{15}\] \[=\frac{T_{c}}{2}\left(3\left(\overline{N_{1}^{B}}+\overline{N_{1 }^{A}}\right)+1\right).\]  
The next step is to estimate the value of \(\overline{\alpha_{1}}\). Since \(\text{Q}_{1}\) can hold at most \(K\) packets, \(\text{T}_{1}\)'s packets will continue to be generated according to a Poisson process with parameter \(\alpha_{1}\); however, only the packets that find \(\text{Q}_{1}\) with strictly less than \(K\) packets will be allowed to join. This is illustrated by Figure 7, which depicts the state-transition diagram for the finite Markov chain of \(\text{Q}_{1}\), where \(\mu=(1/T_{c})\) denotes the service rate. The system can be modeled as a birth-death process [39] where the Poisson input is turned off as soon as \(\text{Q}_{1}\) is filled up. Therefore, we have:  
\[\alpha_{1k}= \begin{cases}\alpha_{1}&k<K\\ 0&k\geq K,\end{cases}  \tag{16}\]  
where \(\alpha_{1k}\) is the birth rate at \(\text{Q}_{1}\) when it includes \(k\) packets. It is worth mentioning that the system in Figure 7 and the following derivations are also valid for \(\text{Q}_{2}\) and \(\text{Q}_{3}\).