# Improving Route Selections in ZigBee Wireless Sensor Networks
## 5 Motivating Examples
### Analyzing the LS-Based and LQI-Based Estimation Procedures  
There are two main conclusions from Examples 1 and 2:  
* The LS-based procedure produces estimates with higher variance than the LQI-based procedure. * The LQI-based procedure is blind to hidden node instances. The main reason why the LS-based cost estimates \(\hat{c}_{3,1,0}^{(LS)}(t)\) and \(\hat{c}_{3,2,0}^{(LS)}(t)\) had a high variance in Example 1 is because of hidden node instances. Recall that LS-based cost estimates are obtained from the ratio of received LS messages, which are sent in MAC broadcast mode, without acknowledgments or retransmissions. In Example 1, nodes 4 and 5 are hidden from node 3, which means that if node 4 or 5 transmits to node 1 or 2 while node 3 transmits its LS message, then node 1 or 2 might not be able to receive the LS message, causing a drop in the estimated \(\hat{p}_{3,1}^{(LS)}(t)\) or \(\hat{p}_{3,2}^{(LS)}(t)\) and an increase in the corresponding cost estimates. It is also possible to justify the high variance of LS-based cost estimates as follows: recall that \(N_{3,1}^{(LS),rx}(t)\) is the number of LS messages sent by node 3 and received by node 1; and, assuming that LS transmissions are independent, \(N_{3,1}^{(LS),rx}(t)\) is a binomial random variable with parameters \(N_{3}^{(LS),tx}\) and \(p_{3,1}\). For the example that produced Figure 2a, the averaging window is \(T_{avg}=81\) s and LS messages are sent at 1-second intervals with a random delay, which means \(N_{3}^{(LS),tx}=80\). The actual \(p_{3,1}\) for this example was measured as \(p_{3,1}\approx 0.79\). With such a \(p_{3,1}\), \(N_{3,1}^{(LS),rx}(t)\) varies significantly around its mean (63.2), which means that the estimated \(\hat{p}_{3,1}^{(LS)}(t)\) varies around 0.79, causing the estimated cost to also vary. More precisely, if node 1 receives \(N_{3,1}^{(LS),rx}(t)\in(72,80]\) LS messages from node 3 during the averaging window, it estimates \(\hat{p}_{3,1}^{(LS)}(t)\in(0.9,1.0]\), which maps into a link cost estimate of \(\hat{c}_{3,1}^{(LS)}(t)=1\). Likewise, if \(N_{3,1}^{(LS),rx}(t)\in(64,72]\), then \(\hat{c}_{3,1}^{(LS)}(t)=2\); if \(N_{3,1}^{(LS),rx}(t)\in(60,64]\), then \(\hat{c}_{3,1}^{(LS)}(t)=3\); and if \(N_{3,1}^{  
which means that variations of \(\hat{c}_{3,1}^{(LS)}(t)\), and therefore, the variations of \(\hat{c}_{3,1,0}^{(LS)}(t)\) observed in Figure 2a,b are fairly common. Variations in LS-based estimates could certainly be reduced if one increases the averaging window \(T_{avg}\); however, a designer cannot increase \(T_{avg}\) too much; otherwise, nodes would not able to adapt to changes in the environment. For instance, consider a WiFi device that consumes a data stream for five minutes. Such a WiFi device would cause interference in nearby ZigBee nodes and it is desirable that ZigBee nodes detect the presence of the additional interference and adjust their routes as soon as possible. If \(T_{avg}\) is increased, then ZigBee nodes would take longer times to adjust their routes. In contrast to LS-based estimates, LQI-based estimates vary much less, even in scenarios with hidden nodes. The main reason for this is the higher number of available samples in the LQI-based procedure. For instance, the LQI-based procedure at node 1 extracts a LQI sample used to estimate the \(\hat{c}_{3,1}^{(LS)}(t)\) on every packet received from node 3, not only from LS messages. Consider Example 1: node 3 transmits an average of 20 packets/s; and, considering the averaging window of \(T_{avg}=81\) s, node 1 has at least 1600 LQI samples to average, which is much more than the number of LS messages (80) transmitted in the same averaging window. Although the LQI-based procedure performed well in Example 1, it was not able to differentiate between routes 3-1-0 and 3-2-0 in Example 2 because it is blind to hidden node problems. To understand this, recall that the LQI-based procedure estimates the cost of a link based on the average of the LQI in _received_ packets. If a packet is not received, then it is not considered in the LQI average.