# A Hybrid Unequal Clustering Based on Density with Energy Conservation in Wireless Nodes
## 3 The Proposed HCD Algorithm
### Protocol Performance
#### 3.2.1 Cluster Initialization
\(T_{2}\) refers to the second phase time and \(V_{r}\) is a random number within the range of 0.9 to 1. Therefore, some variation occurs. In this paper, the neighbor of the node \(i\) refers to a node located in a distance smaller than the radius of the node which is calculated according to Equation (4). Since CH node consumes more energy, the chance of becoming a CH by those nodes that have undesirable status is prevented and, therefore, network stability increases. In the second phase, each node must wait until the end of the delay time. If a node does not receive CH message from its neighbors during the delay time, it then announces being a CH after the delay time ends. It is evident that the node which has less delay time achieve a higher probability to become a CH. On the other hand, if a node receives a CH message, it stops its own timer and, thus, cannot be selected as a CH. Since CH node consumes more energy, the chance of being CH by the nodes having no desirable status is prevented; therefore, network stability increases. After selecting a CH, next phase is cluster formation. Each node selected as a CH, broadcast head message in the network. After receiving the head messages by non-CH nodes, they join to the closest CH and transmit their joining message involving energy level and distance to the CH. The presented protocol applies an assistance node to CH mechanism that allows a CH to use member nodes to share traffic load. Each CH has intraclustering layering. Nodes having a distance less than the threshold (average distance) are placed in the first layer and nodes having distance more than the threshold are placed in the second layer. Then CH identifies nodes that their energies are more than half of the average energy and have been located in layer 1 as assistance to the CH (ACH). In contrast, if a node has been located in layer 2, CH will choose the closest ACH to the CM node and will send the packet to this node. Otherwise, if the distance between a node and CH is less than the threshold distance and is located in layer 1, it would start direct transmission. As mentioned, CH schedules clusters in a way that the farther node transmits earlier; therefore, within a cluster, when an ACH to a CH receives a packet from its neighbor it aggregates and integrates the packet into its packet and send it to the CH. If there is no assistance node to the CH node between the source node and the CH, the source node will send data directly to the CH. Subsequently, CH performs scheduling of the nodes according to the time division multiple access (TDMA) schedules and sends scheduling information to the members. Figure 4 shows the flowchart of routing intraclustering in HCD. Figure 4: Routing flowchart of intraclustering in HCD. The fourth phase is constructing a data transmission path to the BS. We use two messages involving route request and route reply to construct the route. Other member nodes will be inactive in this part. According to their distance from the BS, each CH broadcasts a route request with identification content, energy level, the count of cluster member nodes, and the distance to the BS in the network. CH receives the message and updates its routing table. The CH transmits the data packet to the BS either directly or through a multi-hop method. Following computing transmission cost to the BS and middle CH, they select the middle CH with minimum cost for multi-hop transmission. CH in layer 1 is involved in direct transmission to the BS. The value of the evaluation parameter is computed according to the following Equation (8). \[relay(i)=\left\{ \begin{array}{ll}E_{TX}(i,l,d_{i,j})+E_{TX}(j,l,d_{j,memb})+ E_{TX}(j,l)&\quad\text{if}&E_{rem}(i,r)\geq E_{TX}(i,l,d_{i,j})\quad\text{and}\\ E_{rem}(j,r)\geq E_{TX}(j,l,d_{j,memb})+(E_{RX}(j,l)\times(M(j)+R(j)+1))\\ Inf&\quad\text{Otherwise}\end{array} \right. \tag{8}\]  
where \(E_{TX}(i,l,d_{i,j})\) is the required energy for transmitting data from CH \(i\) to CH \(j\).