Fuzzy Logic and Bio-Inspired Firefly Algorithm Based Routing Scheme in Intrabody Nanonetworks

An intrabody nanonetwork (IBNN) is composed of nanoscale (NS) devices, implanted inside the human body for collecting diverse physiological information for diagnostic and treatment purposes. The unique constraints of these NS devices in terms of energy, storage and computational resources are the primary challenges in the effective designing of routing protocols in IBNNs. Our proposed work explicitly considers these limitations and introduces a novel energy-efficient routing scheme based on a fuzzy logic and bio-inspired firefly algorithm. Our proposed fuzzy logic-based correlation region selection and bio-inspired firefly algorithm based nano biosensors (NBSs) nomination jointly contribute to energy conservation by minimizing transmission of correlated spatial data. Our proposed fuzzy logic-based correlation region selection mechanism aims at selecting those correlated regions for data aggregation that are enriched in terms of energy and detected information. While, for the selection of NBSs, we proposed a new bio-inspired firefly algorithm fitness function. The fitness function considers the transmission history and residual energy of NBSs to avoid exhaustion of NBSs in transmitting invaluable information. We conduct extensive simulations using the Nano-SIM tool to validate the in-depth impact of our proposed scheme in saving energy resources, reducing end-to-end delay and improving packet delivery ratio. The detailed comparison of our proposed scheme with different scenarios and flooding scheme confirms the significance of the optimized selection of correlated regions and NBSs in improving network lifetime and packet delivery ratio while reducing the average end-to-end delay.


Introduction
The introduction of wireless technology in the healthcare environment is an effort to provide significant convenience and accessibility. Wireless medical technology in medicine, such as body area networks, has already made a significant impact on hospital systems, where placement of sophisticated wireless devices around the body provides ambient assisted living, remote health monitoring and telemedicine services [1,2]. Nanotechnology is further boasting the potential of Intrabody Nanonetworks (IBNNs) for a wide range of medical applications such as healing spinal cord injuries [3], detection of cancer bio-markers [4][5][6], drug delivery [7] and improved diagnosis [8]. IBNNs are composed of miniature size Nano Biosensors (NBSs) that are capable of obtaining fine-grained data with unprecedented accuracy from specific anatomical areas for monitoring and 1. In this work, we proposed a new FLBDS selection mechanism for correlated region selection.
Our proposed FLBDS technique ensures the selection of those correlation regions for data aggregation that has updated information and maximum residual energy. The proposed FLBDS selection resulted in improved information accuracy and stabilized energy consumption in the event area.
2. We proposed a novel bio-inspired firefly algorithm selection mechanism for evading spatial correlation in the reported data. Our proposed bio-inspired firefly algorithm regulates the nomination of NBSs based on their fitness value. The proposed fitness criteria prevent exhaustion of individual NBSs and consume maximum energy resources of NBSs in transmitting crucial information while preventing the transmission of redundant information. 3. Our proposed work is evaluated by carrying out extensive simulations using the Nano-SIM tool that is an emerging tool integrated into NS3 for simulating electromagnetic-based nanonetworks in the THz band [19]. The detailed simulations investigate the performance of our proposed scheme in comparison with different scenarios and the flooding scheme [19]. The different scenarios opted for comparison are briefly explained as; in the first scenario, we involved all the correlated regions (i.e., without employing FLBDS correlated region selection) and only selected optimum number of NBSs using bio-inspired firefly algorithm. Whereas in the second scenario, we selected only information and energy enriched correlated region with the involvement of all the NBSs in response message generation.
We have organized the rest of the paper as follows: Section 2 discusses FLBDS, bio-inspired and existing routing schemes for IBNNs in detail. In Section 3, we thoroughly demonstrate the proposed fuzzy logic and bio-inspired firefly algorithm based routing scheme. Section 4 deals with the performance evaluation, simulation results and provide an extensive comparison with different scenarios and flooding scheme. In Section 5, we finally draw up the conclusion.

Related Work
Over the past decade, the need for realizing IBNNs has gained considerable attention. The existing work emphasized on the development of novel low-complexity communication protocols for IBNNs. In this section, we briefly discuss the feasibility and scope of FLBDS and bio-inspired firefly algorithms for IBNNs as our proposed protocol combines these concepts for realizing low-complexity routing protocol. Further, we have discussed the advantages and limitations of existing routing protocols in the rest of this section.

Fuzzy Logic-Based Decision Systems (FLBDS)
After FLBDS was proposed in 1965 [20], researchers adapted them in various directions, including expert systems and artificial intelligence. FLBDS are based on simple concepts, consisting of an input stage, a processing stage and an output stage. The input stage maps inputs to the suitable membership functions. The processing stage invokes a set of rules, which generates a result for each input and combines the results of the rules. Finally, the output stage converts the combined result back into a specific control output value [21]. The most common membership functions used in the literature are triangular, trapezoidal and bell curves [22]. FLBDSs attributes such as low complexity, high flexibility and applicability for an uncertain environment raise its support in Wireless Sensor Networks (WSNs). In WSNs, FLBDSs have been used to improve forwarding decisions and quality of service. In the state of the art literature, the use of FLDBS in developing a clustering-based routing algorithm handles more effectively the challenge of routing associated with an uncertain environment. Besides, it also optimizes the selection of routing metric used by enabling the combination and evaluation of diverse parameters in an efficient manner [23][24][25].
In Table 1, we further shed more light on the contribution of the FLBDS on strengthening the performance of WSNs. From Table 1, we comprehend that the low complexity decision process of FLBDS advocates it as a perfect choice for improving the decision process in IBNNs. Improving on LEACH Protocol of WSNs Using Fuzzy Logic [29].
Sink calculates the chance of each node to become a cluster head.
Make a better selection of cluster head for energy saving.
Optimize cluster head selection based on the residual energy and local distance.
Improved cluster head selection on the basis of its residual energy and expected energy for the next round.

Energy efficiency
Energy Efficient Cross-Layer Routing Protocol in WSNs Based on Fuzzy Logic [32].
Fuzzy logic-based next-hop routing decision.
Maximize network lifetime A clustering routing protocol for WSNs based on type-2 fuzzy logic and ACO [33].
Fuzzy logic-based cluster head selection based on residual energy, neighbor nodes density and distance.

Improved load balancing and network lifetime
An energy-aware fuzzy approach to unequal clustering in WSNs [34].
Using fuzzy logic approach to handle uncertainties in cluster-head radius estimation. Energy-efficient data aggregation MOFCA: Multi-objective fuzzy clustering algorithm for WSNs [35].
Energy-based fuzzy competition is carried out for cluster head nomination . Prolonged network lifetime

Bio-Inspired Based Schemes
The adaptation of nature-inspired solutions in science and engineering has brought great communication benefits. Swarm intelligence based algorithms such as ant colony optimization [36], artificial bee colony [37], firefly algorithm [38] have the capabilities of handling complex problems with simple rules or methods. In WSNs, swarm intelligence based routing protocols utilizes the forging behavior of small insects for solving complex routing problems [39].
In ad-hoc networks, exploitation of self-organizing capabilities of natural species provides scalability, robustness and effectiveness [40]. The last few years also witnessed the scope of bio-inspired approaches in vehicular ad-hoc networks due to their close communication similarity with the natural species. Bio-inspired vehicular ad-hoc networks routing protocols provide better scalability, robustness, low computational complexity and adaptability as compared to traditional vehicular ad-hoc networks routing protocols [41]. Similarly, in the context of the internet of things, bio-inspired routing techniques are nominated as a suitable choice for handling the routing challenge of frequent changing topology and network object diversity [42].
Firefly algorithm low complexity among other metaheuristic algorithms has attracted much attention in the last decade [43]. The minimum computation cost of the firefly algorithm in terms of time has led to its adaptation in various applications, including digital image compression [44], antenna design [45], traveling salesman problem [46], security [47][48][49] and multi-modal optimization [50].
In the WSNs, firefly algorithm has also been adapted for handling different problems such as node localization [51,52], energy-efficient data collection [53] and cluster head selection [54][55][56]. From the contributions brought by the firefly algorithm in WSNs, we comprehend that the incorporation of a bio-inspired firefly algorithm in IBNNs ensures a higher probability of achieving low-complexity energy-efficient data routing. In Figure 1, we have further emphasized the impact of the firefly algorithm in improved WSNs performance that is further paving the way for its adaptation in IBNNs.

Network Communication Protocols for IBNNs
Due to the severe constraints of IBNNs regarding energy, transmission range, storage and computational capabilities, the general routing protocols for nanonetworks are not directly applicable in IBNNs. Therefore, in this section, we specifically discuss the existing routing protocol proposed for IBNNs. The selective flooding scheme presented in Reference [19] conserve the limited resources of IBNNs by controlling the direction of forwarded packets for reducing energy consumption and saving bandwidth. In another effort to save energy consumption, a protocol stack for IBNNs is proposed in Reference [15]. The proposed protocol stack introduces two different protocols at the network layer for prolonging the network lifetime. In the greedy scheme, the node with the maximum energy is selected for responding to the request message received from the healthcare monitoring system. The low complexity of the greedy scheme points it as the most suitable approach for conserving energy resources in IBNNs. Another energy conservation scheme presented in Reference [17] introduces nanocluster controllers for performing data aggregation. NBSs transmit data to the closed positioned nanocluster controller that helps in reducing energy consumption. The work presented in Reference [57] thoroughly investigated IBNN and studied the energy harvesting options available for prolonging the life span of NBSs. In the view of the characteristics of the existing energy conservation scheme, we conclude that our proposed scheme differentiates from the state of the art schemes in the following ways: 1. In our proposed work, we select information and energy enriched spatially correlated region for data transmission. While Afsana et al. [17] elects nanocontrollers for aggregating data from their respective layers, which increases the complexity of resource constraint IBNNs. Our proposed FLBDS selection is a low complexity solution for correlated region selection. Moreover, it also reduces the transmission of redundant and invaluable information. 2. In our proposed scheme, we limit the number of transmission of forwarding packets by selecting those NBSs for generating response messages, located at a minimal distance from nanorouter. This selection criterion decreases the possibility of multi-hop communication. 3. Our proposed scheme selects the optimum number of NBSs based on different fitness parameters, the selection of the optimal number of NBSs ensures that data is collected from enough number of NBSs to achieve data accuracy. Whereas the greedy scheme selects only one node for transmitting answer messages based on remaining energy. The selection based on solely differentiates energy while ignoring the distance from the nanorouter results in an increased number of forwarded packets. In addition, data transmission from only one node for energy consumption can also significantly compromise the data accuracy.

Fuzzy Logic and Bio-Inspired Firefly Algorithm Based Routing Scheme
In this section, we proposed a fuzzy logic and bio-inspired firefly algorithm based routing scheme. The main objective of our proposed scheme is to increase the probability of enriched information transmission while maximizing the lifetime of implanted NBSs. Our proposed scheme realizes the goal of energy-efficient data routing by dividing the data transmission process from NBSs to nanorouter into three different phases, briefly explained in this section. Furthermore, Figure 2 also elaborates on the complete working of our proposed scheme.

•
First Phase: In the first phase, nanorouter nominates information and energy enriched regions from the accumulated number of correlated regions-configured during network setup time.
The Fuzzy logic-based decision ensures the selection of only those regions that have maximum enrichment values for energy and information. The selection of correlated regions supports in achieving the ultimate goal of important information retrieval with balanced energy consumption. After the selection of participating correlated regions for data reporting, nanorouter broadcast request messages (P RqM ) only for selected correlated regions. Those correlated regions that are excluded from data reporting cannot generate feedback message (P FB ) and response message (P RM ). Avoiding data aggregation from correlated regions that have not valuable information results in evading unnecessary data transmission and saving of energy resources.

•
Second Phase: In the second phase, NBSs selection is carried out using the firefly algorithm to support further the objective of reduced redundant data transmission, increased probability of retrieving crucial information and prolonged lifetime of NBSs. Since NBSs located in the correlated regions are assumed to be spatially correlated, which transmit similar types of information. Therefore, the selection of NBSs using the proposed firefly algorithm from selected correlated regions minimize aggregation of the same information. For selecting NBSs, nanorouter determines the fitness of NBSs using the information transmitted by the NBSs in the feedback messages (P FB ). The feedback message (P FB ) contains the information about the priority bit (i.e., the value set to 1 or 0 according to the criticality of the last transmitted message) and residual energy of the NBS. The proposed fitness function ensures the selection of those NBSs for data reporting that have maximum residual energy, minimum distance from the nanorouter and have valuable information. These fitness criteria lead to improved network lifetime of NBSs and increase the probability of receiving important information.
• Third Phase: After selecting NBSs, nanorouter broadcasts announcement message (P AM ) to notify selected NBSs to generate response messages (P RM ). Finally, in the third phase, selected NBSs transmit response messages (P RM ) to the nanorouter.

System Architecture
A possible healthcare monitoring system is composed of an IBNN and an external healthcare system. IBNN consists of two kinds of nanodevices, namely, NBSs and nanorouters implanted inside the human body. NBSs have severe constraints in terms of energy, transmission range, storage and computational resources. While nanorouters have more resources than NBSs and they are responsible for handling more complex operations such as collecting data from NBSs, performing complex computational operations and transmitting collected information to the external healthcare system using nanointerface. Nanointerface is connected to the external healthcare system through the internet for remote data transmission. The communication is carried out until the IBNN is dead.

Network Model Assumption and Definitions
We describe our network model as a undirected graph G = (V, E), where V denotes set of NBSs and nanorouter (vertices), represented as V ∈ (nr, nbs) and E is the set of edges connecting vertices. In a scenario where an edge is directly connecting nr and nbs i to each other, they are said to be neighbors. The neighbors of router nr are defined as N(nr) = {nr|nr(nr, nbs i ) ∈ E}. The one-hop neighbor set of nr is a symmetric graph G = (V, E), where given any two pairs of adjacent vertices nr-nbs 1 and nr-nbs 2 of V, bidirectional edge E exist. Definition 1. When several NBSs are located in the transmission range of a nanorouter (r i ), a cluster is formed that is expressed as: where TR(nr) is the transmission radius of the nanorouter nr. Nanorouter nr is responsible for collecting detected information from its cluster members and transmitting it to the external healthcare system.

Definition 2.
The transmission radius of a nanorouter (nr) is divided into small correlated region, such that the value observed by the NBSs in that spatially correlated region are considered similar (for the application).
The correlated region of nanorouter nr are expressed as {cr 1 , cr 2 , cr 3 , cr n } ∈ nr. Instead of collecting data from all deployed NBSs, data is aggregated from the optimal number of NBSs, which is sufficient to represent the correlated region CR i . The size of the correlation region varies according to the type of application and event characteristics. For those applications that demand a high level of accuracy, the size of the correlation region can be decreased. While for the event characteristics that do not change significantly at a small range, the size of the correlation region can be increased. In this work, the size of the correlated region is defined during the simulation setup time.
Definition 3. Participating correlated regions are selected before the data collection process based on the output of the fuzzy logic decision, the detailed selection process is given in the Section 3.2.

Definition 4.
NBSs selection from participating correlated regions is performed based on the bio-inspired firefly algorithm fitness value. The complete process is demonstrated in the Section 3.3.

Definition 5.
The lifetime of IBNN is evaluated based on the number of alive NBSs (m-in-k-of-n nodes) [58].
The total number of NBSs are divided into two groups; directed − neighbors − to − nanorouter and non − directed − neighbors − to − nanorouter denoted as NBS D and NBS ND , respectively. According to the (m-in-k-of-n nodes) approach, the group of NBS ND are characterized as non-critical NBSs, which means death of k NBSs is allowed from NBS ND . While no failure of NBSs from the group of NBS D is tolerable. Accordingly, the network lifetime is elaborated as following: The total number of NBSs available in the network are denoted as NBS = {nbs 1 , nbs 2 , . . . nbs n }, the set of all the NBSs that are alive at the certain time t, expressed as U(t).
where u i is a NBS that belongs to the set of NBS, expressed as (u i ∈ NBS), whose energy is not depleted. Now set of NBSs that are part of the NBS D and NBS ND are defined using Equation (3) and (4): where (v i ∈ NBS ND ) is a NBS that is a part of NBS ND , while v(t) it is also a subset of U(t). Among all the NBSs that are part of NBS ND , only k number of NBSs can be dead.
where (w i ) is a part of NBS D group denoted as (w i ∈ NBS D ) and w(t) is also a subset of U(t), death of any NBS from the group NBS D results in the death of the network.

Fuzzy Logic-Based Correlated Region Selection
In our proposed work, different correlated regions are selected for data reporting; the selection decision of the participating region is performed using FLBDS, as demonstrated in Algorithm 1. Our proposed FLBDS significantly overcomes the complexity overhead of the selection decision of correlated regions in resource constraint IBNNs. The fuzzy logic-based decision is made after completion of three main parts of the FLBDS, namely fuzzification, fuzzy inference system and defuzzification. Our proposed fuzzy logic-based decision model uses three input parameters (i.e., messages, density and energy) for generating one output parameter. The first input parameter gives knowledge about the number of messages that are received from a correlated region during the last interval. The second input parameter density shows the NBSs density at the one-hop distance from nanorouter and the last input parameter is energy that represents the remaining energy of the correlated region. Based on these three input parameters, the output parameter determines the enrichment value of a correlated region.
1. Fuzzification: In our proposed fuzzy logic-based decision model, the input and output parameters are described using the linguistic variables. The expressions used for input parameters, density, messages and energy are 'high, 'medium' and 'low,' respectively. While the output parameter represents the enrichment value using the linguistic variables 'very high', 'high,' 'medium,' 'low' and 'very low.' In the fuzzification process, these variables are represented by triangular membership functions, which are used to associate a grade to each input linguistic variable.
The selection of the number of membership functions and their initial values is based on process knowledge and intuition. The membership function has a value between 0 and 1 over an interval of the crisp variable. 2. Fuzzy Inference System: After the fuzzification process, the fuzzified values are processed by the fuzzy inference engine to inference the fuzzy rules for driving decisions. The fuzzy rules used in our proposed fuzzy logic-based decision model are elaborated using Figure 3. The fuzzy rules are the sets of 'IF' and 'THEN' statements, for instance, the first rule is read as IF (Density is high) and (number of messages received are also high) and (energy is high) THEN (The enrichment of the correlated region is very high). The number of rules depends on the number of input membership functions, which grow exponentially with the increase in the number of input membership functions.  The characteristics of the defined rules are imprecise; the value generated from the rules are fuzzy instead of crisp values. The input parameters are fuzzified according to the membership value to obtain crisp values. The attained crisp values are then used to determine the enrichment of the correlated-region. 3. Defuzzification: The obtained result is processed in the defuzzification process to achieve a quantifiable output (i.e., the enrichment of a correlated region). In this process, the membership degree of the fuzzy set is interpreted into some specific values (crisp value). In this work, the centroid (COG) method is used for defuzzification to obtain a crisp output value.
Example: To further explain the fuzzy-based selection, we consider an example with three crisp inputs values; x = 16, y = 19 and z= 55 for density, messages and energy in the correlated regions, respectively as shown in Figure 4.
After the fuzzification process, the fuzzified inputs are evaluated according to certain appropriate rules as shown in Figure 5. Based on the rules, each crisp value has a membership grade that is used for generating output. According to the rule, for the crisp input values (medium, medium and high), the output is medium. While for crisp input values (medium, high and medium), the output is high.  After completion of the Mamdani rule evaluation process, the defuzzification process is performed. In the defuzzification process, the attained aggregated fuzzy set is converted to a number through the COG technique as demonstrated in Figure 6.

Bio-Inspired Firefly Algorithm Based NBSs Selection
The firefly algorithm is inspired by the flashing pattern and behavior of fireflies. The low-complexity and self-adaptability of this metaheuristic approach make it the most suitable approach for adaptation in IBNNs for designing low-complexity routing schemes. Fireflies use their flashlight for attracting other fireflies for communication and mating; the flashing pattern, rhythm and the rate influence the attractiveness of a firefly. The firefly algorithm is based on the three main assumptions; first, all the fireflies are unisex. Second, the attractiveness of a firefly is proportional to its intensity, as the distance increases both the attractiveness and intensity decreases. If no brighter firefly is found then the particular firefly moves randomly. Third, the objective function determines and influences the intensity of the firefly. The attractiveness of firefly is determined using Equation (5): where ζ(d) expresses the attractiveness of a firefly at a distance d. The attractiveness of a firefly at a distance d = 0 is represented as ζ o . β and d denotes light absorption coefficient and distance between two fireflies respectively. The distance between two fireflies FF i and FF j is calculated using Equation (6): where d( FF i , FF j ) is the distance from the coordinates of firefly FF i given by ( FF i (x), FF i (y), FF i (z)) to the coordinates of firefly FF j denoted as ( FF j (x), FF j (y), FF j (z)). Since all the spatially correlated NBSs are assumed to detect similar types of information, therefore, limiting the participation of NBSs in the data reporting process increases the network lifetime by conserving network resources that are consumed in redundant data transmission. The proposed firefly algorithm optimizes NBSs selection for reducing redundant data transmission, balancing energy consumption and increasing the probability of retrieving more valuable information from NBSs. The proposed firefly algorithm for the optimal selection of NBSs is further provided in Algorithm 2. The detailed demonstration of the main steps of our proposed firefly algorithm is given below: 1. Solution Initialization: In the firefly algorithm, the potential solution of a problem is represented by each firefly. Similarly, in NBSs selection, each firefly symbolizes as the solution of NBSs selection problem. The proposed algorithm first initializes the initial solution. The initial solution structure is generated randomly (i.e., 0 or 1) depending on the number of NBSs.

Fitness function calculation:
In the view of the influence of the light intensity on the brightness of a firefly, in this work, the attractiveness of the firefly devise its fitness. The fitness value is based on the three main characteristics; remaining energy of the NBSs, distance from the nanorouter and the priority bit.
(a) Residual Energy: Selecting NBSs with more residual energy assist in prolonging the network lifetime. Therefore, selecting NBSs with more energy available is a more preferable choice. (b) Distance: Data transmission at less distance requires low energy consumption and ultimately increased network lifetime. Therefore, NBSs that is located at the minimum distance from nanorouter has better fitness value. (c) Priority Bit: The priority bit depends on the content of the last transmitted data, if the NBS has transmitted critical messages in the last interval then priority bit is set to 1 otherwise it is 0.
Based on the fitness parameters, the overall fitness value of a NBS is determined using Equation (7): where weights α are used to balance the weight of three parameters expressed as α i ∈ (0, 1) and α 1 + α 2 + α 3 = 1. 3. New Solution Updating: After determining the light intensity of each solution, the firefly with less brightens moves to the next firefly with more brightness. The position of the next firefly is updated using the Equation (8): where FF i and FF j are two fireflies, α denoted the randomization parameter and random function is used to generate random value between [0,1].

Algorithm 2:
Firefly algorithm based NBSs selection 1: Initialize population nbs = (nbs 1 , nbs 2 , . . . nbs i )T 2: Perform the generation of initial firefly population, (1,2,. . . i) 3: Calculate the light intensity I at nbs i using Equation (7) and obtain the I best . 4: While t<MAXGeneration 5: For every i 6: For every j 7: update fitness function and find light intensity. 8: For n f = 1 : N f lies 9: If max(I n f > I best ) then 10: Replace with updated firefly. 11: Else Randomly change function and generate new intensity. 12

Data Transmission
Once the selected NBSs receive announcement message P AM , NPSs transmit the response messages according to the assigned transmission status. The status is allocated to the NSBs according to the following Equation (9): where EV CR(r) is the enrichment value of the correlated region indexed r and FV NBS(i) is the fitness value of the NBS indexed i.

The Lifetime of an IBNN
Network lifetime is the fundamental characteristic of an IBNN for evaluating its potential in specific applications. In the existing literature, various factors are considered, such as the alive number of nodes, sensor coverage and connectivity for defining the lifetime of a WSN [59]. Similarly, the lifetime of IBNN is also associated with the number of alive NBSs, defined as the time when NBSs exhaust themselves and have no energy left for carrying out primary operations. The definition provides information that when NBSs do not have enough energy to transmit data packets, the network can no longer provide useful information to the external healthcare system. Therefore, the IBNN should be considered dead. The evaluation of IBNN lifetime based on the alive number of NBSs is briefly discussed in this section.
The detailed comprehension of IBNN lifetime is possible by briefly explaining the life cycle of an NBS. The life span of an NBS depends on the number of messages transmitted and received by the nano-transceivers. Nano-transceivers use TS-OOK modulation scheme for communication in the THz band as THz band transceivers are not able to handle the shape or phase complexity of the transmitted signal [60]. At the physical layer, TS-OOK modulation scheme is used with pulse duration, pulse time interval and transmission range equal to 100 fs, 100 ps and 10 mm, respectively. According to TS-OOK modulation scheme the energy consumed by a NBS for transmitting a pulse is 1 pJ (i.e., E tx = 1 pJ) and the amount of energy needs for a pulse reception is 0.1 pJ (i.e., E rx = 1 pJ). Thus, the energy consumed by the ith NBS in the transmission and reception of x number of bits is given as Equations (10) and (11): where weight α is used in Equation (10) to denote the probability of transmitting the symbol 1 in the x streams of bits. Since the symbols 0 and 1 are equiprobable, therefore, the value of α is generally set to 0.5. While in the case of energy consumption during the reception, the entire x stream of bits is considered. Accordingly, the total energy consumed by the ith NBS in the rth round expressed as Equation (12): where P RM , P FB , P RqM and P AM shows the total number of transmitted and received packets respectively. While E tx and E rx represents the amount of energy consumed in packet transmission and reception, respectively. Consequently, the amount of energy left in the NBS after completion of rth round is determined using Equation (13): where E(NBS r i ) is the energy consumption of the ith NBS and E r h is the amount of energy harvested in the rth round.
In the context of energy harvesting mechanisms in nanonetworks, conventional mechanisms such as solar energy, wind power, or underwater turbulence are inapplicable due to the technical limitations of these schemes at NS level. In the last few years, novel schemes are introduced for recharging NS devices. Piezoelectric nano-generator, which is composed of an array of ZnO nanowires, a reflecting circuit and an ultra nanocapacitor, has gained significant attention for recharging NS devices. The compression of nano-wires generates an electric current between the ends of nanowires that are used for recharging the ultra nanocapacitor. The mechanical vibration methods (such as air conditioning and heartbeat) provides the compressed release cycle. The frequency of the compressed release cycles f provides the time for recharging ultra nano-capacitor [61]. In IBNNs, NBSs are integrated inside the human body and the only possible source of mechanical vibration inside the human body is a heartbeat, therefore, f = 1 Hz.
According to the energy harvesting model, after α compressed cycles, the voltage of the charging capacitor is calculated using Equation (14): where C cap is the total capacitance of the ultra-nanocapacitor, ∆Q represents the harvested charge per cycle and V g is the generator voltage. However, due to technical limitation of NBSs, the typical values of quantities C cap , ∆Q and V g are 9 cF, 6 pc and 0.42 V respectively. The energy E cap stored in ultra-nanocapacitor after α cycles is re-written as [61] using Equation (15): where C cap corresponds to entire capacitance of ultra-nanocapacitor, V g signifies the voltage of the generator and α cycles demonstrates the number of cycles necessary to reach the energy level given by Equation (16): where V g is the generator voltage, C cap is the capacitance of ultra-nanocapacitor and ∆Q represents the harvested charge per cycle. Following the above given information, the energy harvested by the ith NBS in the rth round is obtained by determining the number of cycles α required for charging the ultra-nanocapacitor, as expressed in Equation (17): where cycles α refers to number of cycles given in Equation (16) and cycles r represents number of cycles in the rth interval.
Considering the amount of energy harvested and consumed in packet transmission and reception, the lifetime of the ith NBS is obtained using Equation (18): where E i o is the initial energy of the NBS and RE(NBS r i ) is the remaining energy of the NBS. Consequently, the lifetime of an IBNN is defined using Equation (19):

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. Nanorouter 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. The simulation settings are further highlighted in the Table 2. Residual energy is defined as the energy left in the network at the end of the simulation. We have evaluated remaining energy with respect to different request intervals to comprehend the influences of request rate on the energy resources of the network. In this work, we evaluate residual energy with different request rate intervals and increasing densities of NBSs.
Residual Energy in the Network with the Density of 100 NBSs and Increasing Request Rate Intervals Figure 7 demonstrates that the increasing rate of request generation leads to a fast depletion of energy resources. For the request rate interval 0.2, the maximum number of requests are generated in the network and to satisfy a large number of requests, a large number of answer messages are generated that cause high energy consumption. The detailed comparison in Figure 7a-d depict that employing a fuzzy logic and bio-inspired firefly algorithm in our proposed scheme maximum amount of energy is left at all intervals (i.e., 0.2,0.3,0.4 and 0.5). The reason behind the highest residual energy is due to data aggregation prevention from low enrichment value correlated region and optimum selection of NBSs with the highest fitness value that supports decreased energy consumption. While in scenarios A and B, the remaining energy is almost the same due to the selection of the optimal number of NBSs and information and energy enriched correlated regions. Both scenarios provide better remaining energy than the flooding scheme as in the flooding scheme, increased the number of packet generation and forwarding rate results in consuming all the energy in the network before the simulation ends.

Residual Energy in the Network with the Density of 200 NBSs and Increasing Request Rate Intervals
The increase in the number of NBSs increases the probability of having active NBSs in the network. However, the rise in the request rate interval increases the number of packet transmission and reception rate. The Figure 8 shows that flooding scheme consumes its available energy resources at the highest rate at all intervals (see Figure 8a-d ). While our proposed scheme achieves the best result for an increasing number of NBSs due to the optimum selection of correlated region and NBSs. The scenario A and B, both witness high energy consumption as compared to our proposed scheme as selecting only the correlated region or only selection of optimum NBSs cannot solely overcome the vast consumption of energy resources.

Network Lifetime
Network lifetime is defined based on the number of alive NBSs (m-ink-of-n nodes) at the end of simulations. The number of alive NBSs are evaluated with respect to different request rate intervals and with increasing density of NBSs in the cluster. Network Lifetime with the Density of 100 NBSs and Increasing Request Rate Intervals Figure 9 clearly depicts that the maximum number of alive NBSs are obtained for the 0.5 request rate interval. Since at interval 0.5, requests are generated at the minimum number. Our proposed scheme achieves the maximum network lifetime due to our selection strategy that balances the message generation load among all the NBSs. In addition, the selection of NBSs based on the their fitness value also supports in preventing energy consumption in those NBSs that have low remaining energy. While Flooding scheme results in a minimum network lifetime for all the intervals due to the involvement of all the NBSs. From Figure 9a-d, it is evident that scenarios A and B do not provide improved network lifetime alone, without combining them to achieve the goal of maximum network lifetime. From Figure 10, it is evident that increasing the density of NBSs improves network lifetime. However, the increasing density also influences the rate of packet generation. In our proposed scheme, the network lifetime remains almost the same for increasing the density of NBSs due to our proposed selection scheme. While in both scenarios A and B, the number of dead NBSs increases with the increase in the request rate interval. Similarly, the flooding scheme experienced the minimum network lifetime for all the intervals.

Average Remaining Energy Comparison at the End of Simulations with Increasing Request Rate Interval and NBSs Density
The remaining energy at the end of the simulation with different NBSs density is represented in Figure 11. The Figure shows that our proposed scheme outperforms all the other scenarios and flooding scheme for both densities of NBSs. By combing the characteristics of fuzzy logic and bio-inspired firefly algorithm, our proposed scheme results in the highest remaining energy. While in both scenarios A and B, the remaining energy is almost similar due to the optimal selection of correlated regions and NBSs. Flooding scheme has the lowest remaining energy due to the participation of all the NBSs in data reporting, which also significantly increases the overall packet forwarding rate. Therefore, the flooding scheme consumes more energy.

Average End-to-End Delay
Average end-to-end delay is defined as the time a packet takes from its transmission till the reception. The average end-to-end delay is compared for different request rate intervals and increasing NBSs density to provide meaningful insights into our proposed work Figure 12. Figure 12 clearly shows that our proposed scheme experiences the lowest average end-to-end delay at all intervals with NBSs density of 100 and 200 in a cluster. Our proposed scheme of selecting correlated regions and an optimal number of NBSs avoids the transmission of redundant data. Therefore, a lower number of packets awaits in the queue for their turn in the transmission, which ultimately reduces the average end-to-end delay experienced by a packet. Further, NBSs fitness value also considers the distance of NBSs from nanorouter for reducing packet forwarding rate. Avoiding redundant data transmission and controlling packet forwarding rate results in low average end-to-end delay even for increased nanosensor density. While in the flooding scheme, the number of packet transmission and packet forwarding is higher, that significantly increases the average end-to-end delay for both densities of NBSs.

Packet Delivery Ratio
The successful reception of the maximum number of packets leads to increased packet delivery ratio. The packet delivery ratio is assessed with respect to different request rate intervals to highlight the impact of request rate intervals on the packet delivery ratio.
Selecting correlated regions and NBSs also improve the packet delivery ratio, as shown in Figure 13. When the number of packets generated by NBSs are controlled, it also reduces congestion and packet drop ratio. Therefore, our proposed scheme achieves a better packet delivery ratio as compared to the flooding scheme. In the flooding scheme, all the NBSs generate response messages at fixed intervals that increase the rate of packets flowing in the network. Due to the smaller range of NBSs, packets are also forwarded at a higher rate. The higher packet transmission and packet forwarding rate in the flooding scheme, consequently result in lower packet delivery ratio for both densities of NBSs.

Conclusions
In this work, a novel energy-efficient routing protocol is proposed that explicitly considers the constraints of NBSs in providing continuous healthcare, diagnostics and treatments. In our presented work, we have proposed the FLBDS and bio-inspired firefly algorithm for deciding on the selection of correlated regions and NBSs. The proposed routing scheme devises a new scheme that exchanges the burden of generating periodic response among all the members of IBNNs. Furthermore, our proposed scheme also prevents redundant data transmission and increases the transmission of crucial information. The proposed FLBDS ensures the selection of only those correlated regions that have valuable information and enough residual energy resources to handle the data communication load. While the selection of NBSs based on our new fitness function permits only those NBSs participation in data reporting that have maximum residual energy and have already transmitted crucial information in the last interval. Simulation results validate that the proposed scheme outperforms flooding scheme and the diverse scenarios opted for comparison and offer better residual energy, network lifetime, average end-to-end delay and packet delivery ratio. From the results, we conclude that our proposed scheme has a higher potential for realizing energy-efficient routing in IBNNs for more realistic healthcare applications.

Conflicts of Interest:
The authors declare no conflict of interest.

Abbreviations
The following abbreviations are used in this manuscript:

IBNN
Intrabody Nanonetwork NBS Nano Biosensors NS NanoScale FLBDS Fuzzy Logic-Based Decision System WSN Wireless Sensor Network THz Terahertz Band