# Lifetime Maximization via Hole Alleviation in IoT Enabling Heterogeneous Wireless Sensor Networks
## 3 LiMha
### Traffic Load Estimation  
Data traffic management is a key factor in optimizing the network lifetime. To manage the data traffic, the network is divided in to small regions known as sectors \(S\). Due to the division of network field, now it is easy to estimate the data load at each \(S\) by computing the node \(\rho\). As it is well known that downstream nodes bear high data load while upstream nodes just forward data of their own \(S\). Now, it can be easily estimated that how much data packets are generated from the current \(S\). Let assume \(S_{n}\) be a sector close the sink having distance \(d\) from the sink. The total traffic generated by sector \(S_{n}\) is the sum of traffic generated by previous sector \(S_{n+1}\). The mathematical formulation given as follows [12]:  
\[TF_{j_{S_{n}}}=N_{S_{n}}+N_{S_{n-1}}+N_{S_{n-2}}+.....+N_{S_{1}} \tag{9}\]  
If, the average traffic load on \(S_{n}\) is desired to compute that Equation (9) can be written as:  
\[ATF_{S_{n}}=\frac{TF_{j_{S_{n}}}}{N_{S_{n}}} \tag{10}\]  
\(ATF\) is the average traffic load on a sector close to the sink, thus, we can use \(ATF\) for finding the traffic load on each sector [12].  
\[ATF_{j_{S_{n}}}=\begin{cases}(T_{1}+1)+\frac{T_{1}(1+T_{1})r}{2x},&\text{if }x \geq\xi\\ \frac{1}{2}(T_{2}+2)\xi^{2}\theta\rho+\frac{1}{2}T_{2}r\xi\theta\rho(T_{2}+1),&\text{otherwise}\end{cases} \tag{11}\]  
where \(T_{1}=\frac{(R-d)}{r}\) and \(T_{2}=\frac{(R-\xi)}{r}\)[12]. The traffic load working mechanism is discussed in Algorithm 1. In which it is shown that before the initialization of each round as discussed in Section 3.2 every node acquires its distance from the neighbor node in order to adjust its transmission range. By using Equation (11) load is estimated and then accordingly \(SN\) is selected with in the vicinity of the adjusted transmission range for establishing link with good quality as shown in Figure 2. At each hop, it is calculated that every node measures its data load, if the data is very high that \(NN\) will forwards data to \(SN\) directly else via neighbor nodes. A point here must be noted that nodes within the communication range of sink will transmit the generated data packet directly without the help of any intermediate node.  
Figure 2: Traffic Load Estimation and Data Transmission.  
```
Input: Network range \(R\), transmission range \(r\) between sensor, \(NN\) normal node, \(SN\) super node, node density \(\rho\) etc. Output: for a node \(i\in\{NN\}\) determine the traffic load \(tl_{i}^{r_{o}}\), energy consumption \(e_{i}^{r_{o}}\) at round \(r_{o}\) 1: Initialize Parameters 2: for round \(r_{o}\) 3: for each node \(i\in\{NN\}\) and at each round \(r_{o}\) calculate distance \(d_{(i,j)}\) where node \(i\) is node of sector \(S\) and node \(j\) is node of sector \(S_{n}\) also \(n\) is number of sectors 4: if \(d_{(i,j)}\leq r\) 5: send data of node \(i\) to node \(j\). Calculate the traffic load from Equation (11) and energy consumption for data transmitting and receiving from Equations (7) and (8), respectively. 6: else 7: Find SN in each sector 8: if \(d_{(NN,SN)}\leq r\) 9: send data of \(NN\) to \(SN\) 10: calculate the traffic load and energy consumption for data receiving for \(SN\) and data transmitting for \(NN\) 11: else 12: \(SN\) receive the data by itself 13: calculate the traffic load and energy consumption for data receiving for \(SN\) 14: while sink receive data \(d_{o}\) 15: Calculate the overall energy consumption, lifetime of nodes at round \(r_{o}\)
```  
**Algorithm 1**Calculating Traffic Load and Energy Consumption at each round