## 5 Simulation
### Comparisons of Random Access Schemes  
Note that there are many ways to assign priorities of channel access to nodes. In this subsection we compare several schemes for priority assignment based on previous work on multi-hop networks [18, 20]. These works also adopt a two-phase time slotted model for channel access. The contention window is similarly defined as consisting of a fixed number of minislots. The key difference is the algorithms for choosing a minislot for transmission. We apply these algorithms to our problem and compare the performance with the proposed scheme. We first need the following definition. Let us denote the set of the child nodes of Sensor \(i\) by \(\mathcal{C}(i)\) and the parent node by \(\mathcal{P}(i)\) in the aggregation tree. Note the nodes in \(\mathcal{C}(i)\) and \(\mathcal{P}(i)\) are the interferers to Sensor \(i\). Let us define  
\[q_{i}=\frac{y_{i}}{y_{i}+\max\left(y_{\mathcal{P}(i)},\sum_{k\in\mathcal{C}(i) }y_{k}\right)} \tag{10}\]  
Roughly speaking \(q_{i}\) can be viewed as a 'normalized' score of Sensor \(i\) with respect to its interferers. The first algorithm we consider is policy \(V\) proposed in [18]. In policy \(V\) a node attempt a transmission at every minislot with the following probability:  
\[\left(\frac{\sqrt{m}-1}{2m}\right)\cdot q_{i} \tag{11}\]  
The second algorithm is Q-SCHED [20]. In the algorithm a discrete RV \(M\) is defined which takes a value from \(\{1,2,\ldots,m+1\}\) and has the following distribution: for \(k=1\ldots,m\),  
\[\mathbb{P}(M=k)=\exp\left(-\frac{g(m)q_{i}}{m}(k-1)\right)-\exp\left(-\frac{g (m)q_{i}}{m}k\right) \tag{12}\] \begin{table}
\begin{tabular}{|l||c|c||c|c|} \hline  & \multicolumn{2}{c||}{\(m=10\)} & \multicolumn{2}{c|}{\(m=30\)} \\ \hline  & Baseline & Proposed & Baseline & Proposed \\ \hline \(n=127,b=1\) & 7.41 & 6.25 & 6.92 & 5.89 \\ \hline \(n=511,b=1\) & 10.57 & 8.67 & 9.70 & 8.24 \\ \hline \(n=127,b=3\) & 24.32 & 16.80 & 21.24 & 14.81 \\ \hline \(n=511,b=3\) & 33.20 & 21.82 & 28.84 & 19.15 \\ \hline \end{tabular}
\end{table} 
Table 1: Comparison of mean latency. where \(g(m)=\text{log}(2m)/2\). \(\mathbb{P}(M=k)\) is the probability that the minislot \(k\) is selected. Also \(\mathbb{P}(M=m+1)=1-\sum_{k=1}^{m}\mathbb{P}(M=k)\) is defined to be the probability that the node will not attempt transmission in the frame. Note the algorithms above are modified to fit our model: in the original definition of \(q_{i}\), instead of scores, a ratio of queue lengths normalized by link capacity is used. The analysis of [18, 20] shows that with the above algorithm, the probability of Sensor \(i\) becoming the winner is guaranteed up to an amount that is proportional to \(q_{i}\). Specifically the probability is at least \(q_{i}(0.5-f(m))\) where \(f(m)\to 0\) as \(m\rightarrow\infty\). Roughly speaking, the priority of channel access is assigned to Sensor \(i\) such that the channel access is guaranteed with a probability close to \(0.5q_{i}\). We compare the performances of different algorithms for channel access. Figure 9 shows the mean latency associated with the channel access schemes. The selective forwarding and overhearing are used with varying medium access schemes. 'Mod. \(V\)' (resp 'Mod. Q-SCHED') represents the modified policy \(V\) (resp. Q-SCHED algorithm). We observe that the proposed scheme incurs the lowest mean latency both for \(m=10\) and 30. Somewhat surprisingly, UNIFORM scheme performs better than modified policy \(V\) and Q-SCHED. The result can be explained as follows. Figure 10 shows the statistics on the number of collision and the amount of traffic generated at the first frame. The first frame is defined to be the frame at which the data gathering is initiated. Note the generated traffic is potentially the heaviest at the first frame. On the left of Figure 10 is the mean number of collisions in the first frame. We see that the number of collision of the proposed scheme is higher than UNIFORM scheme, while Q-SCHED and policy \(V\) have considerably lower number of collisions.