## 2 Proposed Routing Scheme
### The Routing Scheme
#### 2.2.1 Setup Phase  
This session is similar to the setup phase suggested by the authors in [34]. The authors here divided the homogeneous sensor nodes into four logical regions on the basis of their location in the sensing field. The base station is installed outside the sensing area and the gateway node is placed at the centre of the network. The nodes whose distance from either the Base station or the gateway node is less than the predefined distance threshold transmit their data using direct communication techniques. The nodes whose distance is beyond the threshold distance are divided into equal regions. Elections of heads are conducted in these regions using the probability approach. These heads aggregate the data and transmit their report directly to the gateway node then to the Base station.  
The proposed scheme modified the election probabilities to take into account the residual energy of the nodes. The selection probabilities for the respective heterogeneous nodes in Region 3 and 4 are given by Equations (2) and (3).  
Figure 1: Proposed network model.  
\[P_{het1}=\left(\frac{P_{opt}(1+b)}{1+am}\right)\frac{E_{i}}{E_{0}} \tag{2}\]  
\[P_{het2}=\left(\frac{P_{opt}(1+a)}{1+am}\right)\frac{E_{i}}{E_{0}} \tag{3}\]  
where \(E_{i}\) is the residual energy of the node, \(E_{0}\) is the initial energy of the node, \(m\) is the percentage of sensor nodes equipped with a and b times more energy resources than the homogeneous sensor nodes in the network and \(P_{opt}\) is the probability by which each node can become a CH. However, \(b=\frac{a}{2}\).  
Their respective thresholds are also given in Equations (4) and (5).  
\[T_{het1}=\begin{cases}\frac{P_{het1}}{1-P_{het2}\left(mmd\left(\frac{1}{P_{het 2}}\right)\right)}&\text{ if }n\in He\\ 0&\text{ otherwise}\end{cases} \tag{4}\]  
where \(He\) is the set of heterogeneous nodes that has not become a CH in the past \(\frac{1}{P_{het1}}\) round \(r\) in Region 3.  
\[T_{het2}=\begin{cases}\frac{P_{het2}}{1-P_{het2}\left(mmd\left(\frac{1}{P_{het 2}}\right)\right)}&\text{ if }n\in Ho\\ 0&\text{ otherwise}\end{cases} \tag{5}\]  
where \(Ho\) is the set of heterogeneous nodes that has not become cluster head in the past \(\frac{1}{P_{het2}}\) round \(r\) in Region 4.  
As shown by Algorithm 1, the proposed protocol assumes a network as specified in Section 2.1. As shown by the algorithm, Line 4-6, the homogeneous nodes which are closer to the BS and therefore communicate directly to BS are put in Region 1. Region 2 is considered to be where the gateway node is located, and it contains the homogeneous nodes. Once these nodes are also closer to the gateway node, they are considered to be in the region (see Lines 7-8). Regions 3 and 4 contain heterogeneous nodes. These nodes have higher energy than the homogeneous nodes placed in Regions 1 and 2 and therefore can sustain the energy of the network for a longer period of time despite their distance from the gateway nodes. Nodes are allocated to these two regions in Lines 9-14.  
```
1 for all the nodes in \(N\), \(BS\)do
2\(\triangleright\)\(N\) is the number of nodes in the network
3 Calculate D \(\triangleright\)\(D\) is the distance of nodes from \(BS\)
4 if\(D<D_{max}\) and closer to \(BS\)then
5\(\triangleright\)\(D_{max}\) is the maximum distance
6 Put nodes in Region 1
7 elseif\(D<D_{max}\) and closer to Gateway(\(GW\))then
8 Put nodes in Region2
9 elseif\(D\geq D_{max}\)then
10 BS divide the nodes into 2 regions
11 elseif\(D\geq D_{max}\) and closer to Gateway(\(GW\))then
12 Put nodes in Region3
13 else
14 put the nodes in Region 4
```  
**Algorithm 1**The set up algorithm.