# An Energy Balance Clustering Routing Protocol for Intra-Body Wireless Nanosensor Networks
## 3 Clustering Routing Framework
### Clustering and Cluster Head Updating
Specifically, the link cost of the candidate path between the cluster head node \(h_{i}\) and any of its candidate next hop nodes \(h_{j}\) can be calculated by:

\[S_{k}=w(m)\frac{E_{res\_k}}{E_{max}}+\left[1-w(m)\times\frac{d_{\sum}\ -d(v_{k},h(v_{k}))}{d_{\sum}}\right] \tag{14}\]1

where \(d\Big{(}h_{j},NC\Big{)}\) represents the distance between the candidate node \(h_{j}\) and the nano control node NC. \(C_{s}\Big{(}h_{i},h_{j}\Big{)}\) is the terahertz channel capacity of the candidate path \(e\Big{(}h_{i},h_{j}\Big{)}\) between the cluster head node \(h_{i}\) and the candidate node \(h_{j}\), which can be obtained by the Formula (8). \(\vec{f}()\) represents the result after normalization for each formula, \(\lambda\) represents the cost factor, and satisfies \(\lambda\in(0,1)\). Smaller cost value indicates that the candidate path is better, and the candidate node is more likely to be selected as the next hop. ```
Data:\(LL\) Result:A Cycle of data transmission foreach\(LL\)do  NC sends wake-up preamble while intra-cluster period do  ADTNs send data to respective CH using \(T_{p,c,b}^{L}\) time slots:  CH aggregates data;  end while while inter-cluster-inter-layer period do if\(L=16\&CH_{c}^{L}\) receives multiple links then  CH\({}_{c}^{L}\) performs fusion;  CH\({}_{c}^{L}\) transmits fused data to NC; else  CH\({}_{c}^{L}\) transmit data to lower layer \(CH_{c}^{L-1}\) selected by the next hop selection algorithm;  end while  New CH is elected using round robin fashions;  New CH multicasts update to other CMs;  Previous CH transfers its information list to new CH;  All ADTNs and previous CH go to harvesting data except the new CH until another wake-up preamble reaches;  end while
```

**Algorithm 4**DTP (Data Transmission Process) Algorithm

The DTP between clusters and between layers is shown in Algorithm 4. The CH fuses the data and selects the appropriate adjacent lower layer CH according to the link cost function and forwardsthe data. After forwarding the data, the CH uses the cluster head update algorithm to initiate a new CH election. The new CH then multicasts its new state to other CMs. The previous CH provides its information list to the new CH and enters the data collection mode. All nodes except the new CH start collecting data and suspending the data transfer mode until another wake-up message arrives. The EBCR algorithm process is shown in \[S_{k}=w(m)\frac{E_{res\_k}}{E_{max}}+\left[1-w(m)\times\frac{d_{\sum}\ -d(v_{k},h(v_{k}))}{d_{\sum}}\right] \tag{14}\]2

## 4 Simulation Scenario and Evaluation Index

This paper uses NS-3 to simulate the performance of the designed routing protocol. In order to verify the correctness and superiority of the EBCR protocol, we analyze the EBCR protocol, the classical clustering protocol Low Energy Adaptive Clustering Hierarchy (LEACH), MH-LEACH protocol which makes further development in LEACH to select the cluster-heads and cluster formation [22] and Selective Flooding Routing (SFR). LEACH [23] is a classic clustering algorithm in the traditional wireless sensor network. The protocol randomly selects the cluster heads in a round-robin manner, so it can distribute the energy load of the entire network evenly to each sensor node, thereby achieving the purpose of reducing network energy consumption and improving the overall lifetime of the network. Based on the LEACH protocol, MH-LEACH [24] establishes multi-hop communication between sensor nodes in a network with the main goal of saving energy. In MH-LEACH protocol, the cluster heads send the aggregated data to the base station through multi-hop forwarding. In this process, the routing is mainly based on RSSI. SFR [12] is an optimization of the flooding routing, which optimizes the flooding direction and ensures the trend of data packets forwarding to destination nodes, thereby reducing the number of messages in the network. Like the EBCR, the SFR protocol is a multi-hop routing protocol.