# Fuzzy Logic and Bio-Inspired Firefly Algorithm Based Routing Scheme in Intrabody Nanonetworks
## 3 Fuzzy Logic and Bio-Inspired Firefly Algorithm Based Routing Scheme
### Bio-Inspired Firefly Algorithm Based NBSs Selection
Following the above given information, the energy harvested by the \(i\)th NBS in the \(r\)th round is obtained by determining the number of cycles \(\alpha\) required for charging the ultra-nanocapacitor, as expressed in Equation (17):

\[d(\widehat{FF}_{i},\widehat{FF}_{j})=\sqrt{(\widehat{FF}_{j}(x)-\widehat{FF}_{ i}(x))^{2}+(\widehat{FF}_{j}(y)-\widehat{FF}_{i}(y))^{2}+(\widehat{FF}_{j}(z)- \widehat{FF}_{j}(z))^{2}}, \tag{6}\]3

where \(cycles_{\alpha}\) refers to number of cycles given in Equation (16) and \(cycles_{r}\) represents number of cycles in the \(r\)th interval. Considering the amount of energy harvested and consumed in packet transmission and reception, the lifetime of the \(i\)th NBS is obtained using Equation (18):

\[d(\widehat{FF}_{i},\widehat{FF}_{j})=\sqrt{(\widehat{FF}_{j}(x)-\widehat{FF}_{ i}(x))^{2}+(\widehat{FF}_{j}(y)-\widehat{FF}_{i}(y))^{2}+(\widehat{FF}_{j}(z)- \widehat{FF}_{j}(z))^{2}}, \tag{6}\]4

where \(E_{o}^{i}\) is the initial energy of the NBS and \(RE(NBS_{i}^{r})\) is the remaining energy of the NBS. Consequently, the lifetime of an IBNN is defined using Equation (19):

\[d(\widehat{FF}_{i},\widehat{FF}_{j})=\sqrt{(\widehat{FF}_{j}(x)-\widehat{FF}_{ i}(x))^{2}+(\widehat{FF}_{j}(y)-\widehat{FF}_{i}(y))^{2}+(\widehat{FF}_{j}(z)- \widehat{FF}_{j}(z))^{2}}, \tag{6}\]5

## 4 Performance Evaluation

This section aims at evaluating the proposed protocol for validating the practical utility of the proposed protocol in the biomedical field, by studying a health-monitoring system based on IBNN. The evaluation is performed based on the residual energy, network lifetime, average end-to-end delay and packet delivery ratio. We have compared our proposed scheme with the selective flooding scheme, which is considered as the benchmark for evaluating electromagnetic-based IBNNs [19]. Moreover, intending to prove an in-depth evaluation of our proposed scheme, we have also compared our scheme with different scenarios. In the first scenario, all the correlated regions are involved in the data aggregation process (i.e., without employing fuzzy logic-based correlated region selection) and only NBSs are optimally selected using bio-inspired firefly algorithm. While in the second scenario, only the correlated regions are selected and all the NBSs located in the selected correlated regions generate response messages \((P_{RM})\). We referred to both scenarios as scenarios A and B in the result section for simplicity. The simulations are run ten times to obtain the results demonstrated in the result sections. The detailed comparison assists in investigating the potential of proposed work and forecasts future research. ### Nano-SIM Simulation

The proposed protocol is simulated using the Nano-SIM tool, Nano-SIM tool is an emerging tool integrated into NS3 for simulating the performance of electromagnetic-based nanonetworks. In line with Reference [17], the area of the considered IBNN is a 10 mm radius. The considered IBNN consists of (100 and 200) NBSs and one nanorouter, where NBSs are moving using constant mobility model and nanorouter maintains a fixed position at the center of the network area. All NBSs are equipped with a sensing unit and are able to sense the surrounding environment and to collect information about chemical particles and biological functions. Nanorov outer periodically collects data from NBSs to update the external healthcare system about the health condition. The requests are generated in intervals in the range of [0.2-0.5] requests/s. The physical layer is set up according to Reference [60]. The size of request messages and feedback messages is 48 bits, while the size of response messages flowing in the network is 176 bits, respectively. To provide a fair comparison, we have used the same simulation parameter settings for flooding scheme and other comparison scenarios.