# Energy-Efficient UAVs Deployment for QoS-Guaranteed VoWiFi Service
## 5 Solving a Pseudo-Static Scenario
### Checking the Fitness of Individuals: Check Function
#### 5.2.2 Quality of Service Evaluation (QoS_eval Function)  
After establishing the association between users and APs (i.e., drones), which enables the verification of the coverage constraint, the second step consists of assessing the speech quality level (and hence, allow for the verification of the second constraint in Equation (9)) by computing the \(R\) factor (as introduced in Section 3). To do so, we evaluate the network performance on each set of users plus its corresponding UAV (i.e., \(\mathcal{C}(j)+\text{AP}\) at drone \(j\)). This evaluation is based on a model of the IEEE 802.11 MAC sub-layer and provides delay and packet loss in the WiFi network, which allows one to calculate the \(R\) factor for each drone. The IEEE 802.11 MAC sub-layer features a distributed access mechanism called DCF (i.e., Distributed Coordination Function), whose performance has been largely studied in literature [55; 56; 57; 58]. In a nutshell, each contending station senses the medium during a period (DIFS) before transmitting in order to avoid collisions. If the channel is busy, the station waits for a random backoff interval before trying again (up to \(M\) attempts). The backoff procedure is also triggered between two consecutive transmissions. During the backoff process, a random number of discretizedtime slots (\(T_{\text{slot}}\)) between 0 and \(2^{i}W_{o}\) is selected, where \(W_{o}\) accounts for the minimum contention window value, and \(i\) increases by one with each failed attempt up to reaching an upper bound \(m\). In this paper we have adapted some existing models of the DCF behaviour [59; 60; 61; 62] to fit our context of heterogeneous traffic sources, non-saturated stations and a non-ideal channel. The central variable in DCF models is \(\tau\), which stands for the probability that an observed station attempts to transmit during a randomly chosen time slot. We use the expression proposed in [59]:  
\[\tau=\frac{1}{\eta}\frac{1}{1-q}\left(\frac{r^{2}W_{o}}{(1-p)(1-(1-r)^{W_{o}}}- qr(1-p)\right) \tag{21}\]  
\[\eta=(1-r)+\frac{r^{2}W_{o}(W_{o}+1)}{2(1-(1-r)^{W_{o}})}+\frac{W_ {o}+1}{2(1-q)}\left(\frac{r^{2}qW_{o}}{1-(1-r)^{W_{o}}}+rp(1-q)-rq(1-p)^{2}\right)\] \[+\frac{p}{2(1-q)(1-p)}\left(\frac{r^{2}W_{o}}{1-(1-r)^{W_{o}}}+ qr(1-p)^{2}\right)\left(2W_{o}\frac{1-p-p(2p)^{m-1}}{1-2p}+1\right) \tag{22}\]  
where \(\eta\) is defined in Equation (22) and \(p\) is the probability that a packet suffers transmission errors due to collisions and/or noise. The VoIP traffic is modelled (we assume Poisson packet arrivals and the small queue assumption as discussed in [58]). through two variables, \(r\) and \(q\), which account for the probability that at least one packet arrives during an idle state, and the probability that the MAC queue is not empty, respectively. \[r=1-e^{-\lambda E[T]} \tag{23}\] \[q=1-e^{-\lambda E[T]E[B]} \tag{24}\]  
where \(E[B]\) is the expected number of back-off slots that a packet waits before transmission. This can be expressed as proposed in [62]:  
\[E[B]=\frac{W_{o}}{2(1-p)}\left(\frac{1-p-(2p)^{m}}{(1-2p)}-2^{m}p^{M+1}\right), \tag{25}\]  
and \(E[T]\) is the average slot duration, which represents the expected length of any state of the Markov chain. \(E[T]\) can be calculated by averaging the duration of each type of event with its probability (i.e., success, collision, corruption or idle) as proposed in [12; 61]. Recall that each station in the system composed of drone \(i+\mathcal{C}(i)\) (from now on termed set \(\mathcal{S}\)) has it own \(\tau\) since we consider heterogeneous sources. So let us tag each station as \(i\in\{1,\ldots,S\}\) and let the superscript \((i)\) relate each variable to the \(i\)-_th_ station.