1 Introduction

Wireless sensor networks (WSNs) have emerged as an attractive technology for wide range of applications. Recent technological advances in micro electro-mechanical systems (MEMS), wireless communication and digital electronics have provided low-cost, low-power, multi-functional sensors with capabilities of sensing, data processing and wireless communication within short range. For reliable and efficient observation of a region of interest, sensors are specially designed to sense physical parameters of the phenomenon within the region. Furthermore, data sinks are interested in general description of the environment rather than all raw information collected by individual sensors. These sensors are capable of essential computation on sensed data and transmit only the required partially processed data to the sink by multi-hop communication between sensors. Although wireless sensor networks have many similarities with traditional ad hoc networks but they have limitations in terms of available energy resources. In WSNs, sensors have smaller batteries, less computational power, limited storage and communication capabilities. Hence, these networks require more effective and energy efficient schemes for routing of data and processing. The basic idea behind WSNs is that, even though the individual sensors have limited capability, the aggregate power of the entire network is sufficient for the required application.

In recent years, numerous routing protocols have been proposed for WSNs where energy consideration is taken as an important constraint in order to achieve optimum energy usage to prolong the network lifetime (Pantazis et al. 2013; Goyal and Tripathy 2012; Huang et al. 2012; Zheng and Jamalipour 2009). The main objective of designing routing protocols is to achieve higher energy conservation for transmission of data packets towards the sink in order to extend the network lifetime. Since energy consumption due to data forwarding from one sensor to another is directly proportional to the square of the transmission distance between the transmitter and the receiver (Heinzelman et al. 2002), most routing protocols prefer multihop transmission rather than direct transmission. In multihop routing protocols, when a sensor has a data packet to be delivered to the sink, it checks whether the sink is in the transmission range or not. If it is, data packet is delivered directly, otherwise it looks for the available options of neighboring sensors directly connected to it and selects any one of them as a relay and forwards the data packet to it. This process continues till data reaches to the sink. The data packets received from neighboring sensors can also be aggregated to avoid redundant transmission. Location based routing protocols are the kinds of routing protocols, which uses sensor’s geographic location information instead of links’ information for routing (Soni and Mallick 2014; Popescu et al. 2012; Akyildiz and Vuran 2010). These routing protocols are also referred to as geographic routing protocols as the sensors are addressed by means of their geographic locations for data routing towards the sink. The distance between sensors can be calculated on the basis of incoming signal strengths. Geographic location information of sensors can be determined by applying localization mechanisms or GPS devices equipped with them. Sensors can use their geographic positions (coordinate values) to determine the distance from other neighboring sensors that helps choose another sensor as a relay to forward the packet towards the sink (Bhuiyan et al. 2015; Xu et al. 2013; Cheng et al. 2012; Vempaty et al. 2013; Niewiadomska-Szynkiewicz 2012).

GAF (Xu et al. 2001) is one of the well-known topology management multihop location based routing protocols. It utilizes geographic location information to identify equivalence between sensors and then keeping only required sensors in active state and others in sleep state to prolong the network lifetime while maintaining network fidelity. Nevertheless, it still cannot achieve the optimum utilization of the available sensors, since it needs more hop count during data routing. As a result, it also leads to inefficient energy consumption and higher packet delay to transmit data packets towards the sink. In this work, we propose a fuzzy logic based topology management geographic routing protocol based on honeycomb architecture called FTGAF-HEX (Fuzzy Logic based Two-Level GAF-HEX) for better utilization of all possible neighboring sensors to transmit data packets towards the sink. FTGAF-HEX is a fuzzy logic based energy-aware forwarding scheme, where a sensor makes fuzzy logic based decision to identify sensors in neighbors of adjacent grid cells if they are in the transmission range and forward data directly to it rather than forwarding to the sensors of adjacent grid cells to minimize the hop. It combines both the energy efficiency and energy balance through fuzzy logic that leads to higher network lifetime. The simulation results show the superiority of the proposed work over traditional GAF-HEX in terms of total hop count, energy consumption and total distance covered by the data packet before reaching the sink while maintaining comparably high data delivery ratio.

The rest of the paper is organized as follows: In section II, the related works are introduced with their advantages and limitations. In section III, we present the proposed work and the specific steps of the algorithm. Section IV reveals the simulation results to evaluate the performance of the proposed protocol and comparison with other routing protocols. Finally, section V concludes the paper.

2 Related work

In order to achieve higher energy conservation, most routing protocols use a subset of sensors deployed within the target region. GAF is a topology management multihop routing protocol based on virtual grids (Xu et al. 2001) which self-configures redundant sensors into small groups and uses localized, distributed algorithms to control sensor duty cycle to extend network operational lifetime. It conserves energy by keeping unnecessary sensors in sleep state, while maintaining higher connectivity. GAF algorithm classifies sensors into small groups based on their locations which are determined using various localization techniques or GPS like other localization systems equipped with sensors (Bhuiyan et al. 2015; Xu et al. 2013; Cheng et al. 2012; Vempaty et al. 2013; Niewiadomska-Szynkiewicz 2012). Even with geographic location information of sensors, it is not attainable to determine equivalent sensors for transmission between sensors. Sensors those are equivalent to communicate for some sensors may not be equivalent for others. To resolve this problem, GAF uses the concept of virtual grid. For which, the sensor region is divided into several small square grids, where any sensor of one grid can communicate to any sensor in the adjacent grid. Thus all sensors in each grid are equivalent for communicating with the adjacent grids. In each grid, sensors are equivalent from the routing point of view, so only one sensor needs to be active at any given time. In traditional GAF, the size of the grid squares is defined such that any two farthest sensors in any two adjacent grids can communicate with each other. For example, as illustrated in Fig. 1, sensors forward packets to a sensor placed in the adjacent grid towards the sink. In each grid, only one sensor is active at a time and the rest of them are in sleep mode to extend the overall lifetime of the network.

Fig. 1
figure 1

Example of routing data using virtual grids in GAF

There is a limitation with traditional GAF, i.e., data can be forwarded only in two possible directions: horizontal and vertical. By considering diagonal grid cells in the calculation, some of the sensors in adjacent diagonal grid cells would not be able to reach to each other. For example, as illustrated in Fig. 2, sensor P1 (0, 0) would not be able to reach any sensor in the shaded area in grid cell D. We can calculate the unreachable probability (i.e., probability of unreachability between two adjacent diagonal grid cells) and analyse its impact on data delivery using an analysis model (Liu et al. 2006). However, to eliminate this limitation we use a generalized version of GAF called Diagonal GAF (DGAF) where two diagonal grid cells are fully reachable (Shang and Liu 2012). In DGAF, a virtual grid is defined such that any two farthest sensors in any adjacent grid cells can communicate with each other. However, DGAF still cannot utilize the information of other possible sensors exist at unreachable corner in the virtual grid architecture. In this work, we propose to use another generalized version of GAF based on honeycomb architecture called Hexagonal GAF (GAF-HEX) to replace the square grids with hexagonal grids to impose two dimensional hexagonal grid structure (Liu et al. 2006; Erman et al. 2012; Chen and Xu 2005; Sharieh et al. 2008). Now, each grid has 6 neighbors covering surroundings from all directions.

Fig. 2
figure 2

Example of unreachability in GAF

Definition: In GAF, a virtual grid is defined such that any two farthest sensors in any adjacent grids can communicate with each other.

As illustrated in Fig. 2, virtual grid is defined such that for two adjacent grid cells A and B, all sensors of grid cell A can communicate with all sensors of grid cell B and vice versa. In Fig. 3, n0 and n1 are two farthest sensors in two adjacent grid cells. In order to meet the definition of virtual grid, distance between any two sensors in adjacent grid cells must not be larger than transmission range R. Thus maximum grid side r can be defined as:

$$ {\text{Traditional}}\;{\text{GAF}}:\quad {\text{r}}^{ 2} + ( 2 {\text{r}})^{ 2} \le {\text{R}}^{ 2} \Leftrightarrow {\text{r}}_{ \hbox{max} } \le {\text{R}}/\surd 5 , $$
(1)
$$ {\text{Diagonal}}\;{\text{GAF}}\; ( {\text{DGAF)}}:\quad ( 2 {\text{r)}}^{ 2} + ( 2 {\text{r}})^{ 2} \le {\text{R}}^{ 2} \Leftrightarrow {\text{r}}_{ \hbox{max} } \le {\text{R}}/ 2\surd 2 , $$
(2)
$$ {\text{GAF - HEX}}:\quad \surd 1 3\times {\text{r}} \le {\text{R}}^{ 2} \Leftrightarrow {\text{r}}_{ \hbox{max} } \le {\text{R}}/\surd 1 3. $$
(3)
Fig. 3
figure 3

Example of virtual grid. a GAF b DGAF c GAF-HEX

3 Two-level GAF (T-GAF)

3.1 Basic idea

The grid layout of GAF guarantees the connectivity between all sensors in two adjacent grid cells. In traditional GAF, each sensor has knowledge of sensors of its immediate grid cells only. Hence, a sensor of one grid cell can communicate with only sensors of adjacent grid cells (AG). However, there is a possibility when a sensor of one grid cell can directly communicate with some sensors of neighbors of adjacent grid cells (NAG), if the sensors of those grid cells are in the transmission range of the source sensor. In (Soni and Mallick 2015), authors proposed a topology management protocol based on GAF to minimize hop count for data routing, called Two-level GAF (TGAF). Its main objective is to identify sensors in neighbors of adjacent grid cells if they are in the transmission range and forward data directly to it rather than forwarding to the sensors of adjacent grid cells. TGAF is based on greedy energy-aware forwarding scheme where a sensor makes local greedy decision to select a sensor as a relay, and has no focus on energy balance. In this work, we propose a fuzzy logic based routing protocol based on honeycomb architecture to minimize the total hop count so that a sensor of one grid cell can directly forward the data packet to sensors of neighbors of its adjacent grid cells (NAG), if they are in the transmission range. The proposed work also considers the residual energy levels of neighboring grid cells while making routing decision, which combines the energy efficiency and energy balance together through fuzzy logic that leads to higher network lifetime. We use the honeycomb virtual grid architecture to replace to the square grid with hexagonal one. As a result, it also leads to less packet delay due to better next hop selection possibility in 6 different directions. We apply the above mentioned concept to GAF-HEX to make efficient utilization of available resources. As shown in Fig. 4, orange color grid cells, pink color grid cells and brown color grid cells represent the source grid cell, adjacent grid cells (AG) and neighbors of adjacent grid cells (NAG) respectively.

Fig. 4
figure 4

Example of two-level neighbor sharing scheme. a TGAF b TGAF-HEX

FTGAF-HEX is a geographic routing protocol which uses fuzzy logic based energy-aware forwarding scheme for transmission of data towards the sink. In this work, fuzzy logic based routing is proposed to determine the energy optimized routing based on various energy optimized parameters such that the network lifetime can be extended (Lee and Cheng 2012; Chiang and Wang 2008; Shah et al. 2015). In order to achieve uniform load distribution, it divides the sensor region into several hexagonal-shaped virtual grid cells and performs cluster-head selection among sensors in each grid cell so that no sensor will be overloaded. The total active sensors participate in routing depend on the total virtual grid cells formed after virtual grid division. Hence, GAF works efficiently for any number of sensors deployed in the region.

Fuzzy logic is used in this work to improve decision-making in routing and increase the overall performance. A general fuzzy logic system consists of three parts: fuzzifier, fuzzy interference system (FIS) and defuzzifier. The fuzzifier converts the crisp input values to the corresponding fuzzy sets by applying membership functions, and thus assign it a truth value or degree of membership for each fuzzy set. The fuzzified values are processed by the inference engine, which consists of a rule base and various methods for inferring the rules. A rule-base consists of a set of linguistic statements, called rules. These rules are simply a series of IF–THEN rules that relate the input fuzzy variables connected by logical functions (e.g., AND, OR, NOT) with the output fuzzy variables using linguistic variables, each of which is described by a fuzzy set. The defuzzifier performs defuzzification on the fuzzy solution space. That is, it finds a single crisp output value from the solution fuzzy space. The Mamdani algorithm is used to design fuzzy logic inference. Mamdani’s fuzzy inference method is the most commonly seen fuzzy methodology (Sivanandam et al. 2007). It was proposed by Mamdani and Assilian (1975) as an attempt to control a steam engine and boiler combination by synthesizing a set of linguistic control rules obtained from experienced human operators. It uses fuzzy sets as rule consequent, in which the fuzzy sets from the consequent of each rule are combined through the aggregation operator and the resulting fuzzy set is defuzzified to yield the output of the system.

3.2 Energy consumption model

The energy consumption of each sensor mainly depends on three operations: sensing, communication and data processing. Since energy consumption due to sensing and data processing operations depend on the type of sensors used based on applications, this work only considers energy consumption during communication between sensors. According to Heinzelma et al. (2002), we use the following energy model to calculate the energy consumption of sensors due to transmission and reception of data, in which transmission (E Tx ) and reception (E Rx ) power of data of size k bits over a distance d are given by:

$$ E_{Tx} (k,d) = \left\{ {\begin{array}{*{20}l} {\left( {E_{elec} + \varepsilon_{fs} \times d^{2} } \right) \times k,\quad d\,<\,d_{0} } \\ {} \\ {\left( {E_{elec} + \varepsilon_{amp} \times d^{4} } \right) \times k,\quad d\,\ge\,d_{0} } \\ \end{array} } \right. $$
(4)
$$ E_{Rx} (k,d) = E_{elec} \times k, $$
(5)

where E elec is the energy consumption per bit in the transmitter and receiver circuits. Also ε fs and ε amp are the energy consumption factors in the transmission amplifier. The threshold value d 0 can be obtained by:

$$ d_{0} = \sqrt {\frac{{\varepsilon_{fs} }}{{\varepsilon_{amp} }}} . $$
(6)

3.3 Energy optimized parameters

3.3.1 Closeness of sensor to the shortest path

According to the proposed energy model (4), as the distance between sensors is less than a threshold value d 0, the free space model is used (d 2 power loss), otherwise multipath fading channel model (d 4 power loss) is employed. If all forwarding sensors are close to the line from the source to the sink, the energy consumption would be minimized. Therefore, sensors closer to the line from the source to the sink can be selected as relay sensors to minimize energy consumption for data transmission. The intuition behind the idea is to make the data transmission path as less as deviated from the shortest path between source to the sink. So, the closeness to the shortest path (CSP) is used as one of energy optimized parameters:

$$ {\text{CSP(}}j )= \frac{{\left( {d_{i,j} + d_{j,sink} } \right) - d_{i,sink} }}{2R}, $$
(7)

where i is the source sensor and j is its forwarding sensor, R is the transmission range and d is the Euclidean distance (Krislock and Wolkowicz 2011; Alfakih et al. 2009). The minimum value of CSP (j) on [0, 1] (i.e., CSP (j) = 0) occurs when j lies on the line from i to sink, while the maximum value of CSP (j) on [0, 1] (i.e., CSP (j) = 1) occurs when j lies on the line at opposite direction of the sink and d i, j  = R. Therefore, a sensor lying on the line between the source and the sink will have the maximum chance to be selected as a relay sensor for further forwarding.

As illustrated in Fig. 5, Source wants to send some data towards the sink. It has 3 sensors (P1, P2, P3) within the transmission range. Source calculates CSP for each sensor (i.e., CSP (P1) = 0, CSP (P2) = 1) using Eq. (7) and selects a sensor having the lowest CSP value. Therefore, sensor P1 will have the maximum chance to be selected as a relay sensor for further forwarding.

Fig. 5
figure 5

Example of calculation of CSP and CS

3.3.2 Closeness of sensor to the sink

FTGAF-HEX is a geographic multipath routing protocol which uses fuzzy logic based energy-aware forwarding scheme for forwarding of data towards the sink. According to the proposed energy model, energy consumption for data forwarding is directly proportional to the exponent of distance between sensors. Therefore, it prefers multihop data transmission rather than single hop data transmission to minimize energy consumption. It makes a fuzzy logic based decision to select a sensor as a relay that is closest to the sink. This process continues till the data reaches to the sink. Hence, it always selects the shortest path based on the local available information of the network. The closeness to the sink (CS) is defined as:

$$ {\text{CS(}}j )= \frac{{\left( {d_{j,sink} - d_{i,sink} } \right) + R}}{2R}, $$
(8)

where i is the source sensor and j is its forwarding sensor, R is the transmission range and d is the Euclidean distance (Krislock and Wolkowicz 2011; Alfakih et al. 2009). The minimum value of CS (j) on [0, 1] (i.e., CS (j) = 0) occurs when j lies on the line from i to sink and d i, j  = R, while the maximum value of CS (j) on [0, 1] (i.e., CS (j) = 1) occurs when j lies on the line at opposite direction of the sink and di,j = R. Therefore, a sensor closest to the sink will have the maximum chance to be selected as a relay sensor for further forwarding.

As illustrated in Fig. 5, Source wants to send some data towards the sink. It has 3 sensors (P1, P2, P3) within the transmission range. Source calculates CS for each sensor (i.e., CS (P1) = 0, CS (P2) = 1) using Eq. (8) and selects a sensor having the lowest CS value. Therefore, sensor P1 will have the maximum chance to be selected as a relay sensor for further forwarding.

3.3.3 Residual energy level

Traditional GAF uses a greedy forwarding scheme to select a sensor as a relay that is closest to the sink. However, it is not always efficient to select a sensor closest to the sink if the sensor is depleted with the residual energy. To evaluate the alternative next hop, the source sensor compare the residual energy level of its neighboring sensors and selects a sensors with the highest residual energy. In our work, we also consider the residual energy of sensors when selecting neighboring sensors as next hop. Therefore, our proposed work selects a sensor with the highest residual energy as a relay for data forwarding towards the sink in order to prolong network lifetime. The degree of residual energy level (REL) is defined as:

$$ {\text{REL(}}j )= \frac{{E_{j} - E_{min} }}{{E_{max } - E_{min} }}, $$
(9)

where E j is the residual energy level of sensor j, E min and E max are the sensors with maximum and minimum residual energy level respectively.

3.4 Topology architecture

GAF divides the sensor region to fixed size grids called virtual grids such that for two adjacent grid cells, all sensors of one grid cell can communicate with all sensors of another grid cell and vice versa. In GAF, the maximum grid size is given by Eq. (1). For GAF, where n number of sensors with transmission range of R deployed over a sensor region of size A, the average number of sensors in a grid cell is (Liu et al. 2006):

$$ I_{G} = \frac{1}{5} \times \frac{{nR^{2} }}{A}. $$
(10)

While in DGAF, assuming the fixed transmission range R, the grid size has to be reduced such that all sensors in diagonal grid cells can also communicate with each other. The maximum grid size is given by Eq. (2). Therefore, the average number of sensors in a grid cell is:

$$ I_{DG} = \frac{1}{8} \times \frac{{nR^{2} }}{A}. $$
(11)

Comparing DGAF with traditional GAF from Eqs. (10) and (11), the number of sensors in each grid cell has been decreased by:

$$ \frac{{(I_{G} - I_{DG} )}}{{I_{G} }} = 0.375 = 37.5{{\%}} $$
(12)

By considering the idealised level of energy conservation assumption in GAF, i number of sensors in each grid cell will extend the network lifetime by i times. By making the diagonal grid cell reachable, DGAF reduces the network lifetime by 37.5%. Hence, DGAF does not appear to be a worthwhile solution to make diagonal grid cells under reachability.

In GAF-HEX, assuming the fixed transmission range R, a sensor of one grid cell can communicate with the sensors of adjacent grid cells in all 6 possible directions due to its symmetrical property. The maximum grid size is given by Eq. (3). Therefore, the average number of sensors in a grid cell is:

$$ I_{GH} = \frac{3\surd 3}{26} \times \frac{{nR^{2} }}{A}. $$
(13)

Comparing GAF-HEX with traditional GAF from Eqs. (10) and (13), the number of sensors in each grid has been decreased by:

$$ \frac{{(I_{G} - I_{GH} )}}{{I_{G} }} = 0. 00074 = 0.074\% . $$
(14)

By making the neighbors reachable in all 6 possible direction, GAF-HEX reduces the network lifetime by a negligible amount of 0.074%. Therefore, honeycomb architecture shows significant improvements in the aspects of next hop selection for data routing.

3.5 Algorithm description

In this work, we assume a network model in which sensors are randomly deployed on a two-dimensional plane. The data sensed by sensors are sent to the sink located at the centre of the target region. Before the algorithm discussion, we make several assumptions about the sensors and the underlying networks as follows:

  • All sensors and the sink are stationary after deployment.

  • All sensors are homogeneous in the aspect of functionalities and capabilities and have the same initial energy depending on the batteries they are equipped with while the sink are not limited by power supply.

  • Each sensor knows its own location by using efficient localization techniques or GPS like device equipped with them (Bhuiyan et al. 2015; Xu et al. 2013; Cheng et al. 2012; Vempaty et al. 2013; Niewiadomska-Szynkiewicz 2012), location of the sensors of AGs and the sensors of NAGs if they are in transmission range through simple hello protocol.

  • All sensors know location of the sink.

  • Communication link is bi-directional.

  • Sensors have the capability of controlling the transmission power according to the distance to the receiving sensors.

The implementation of FTGAF-HEX is divided into five stages including virtual grid division, sensor association and grid information collection, cluster-head election, establishment of routing table and fuzzy logic based routing. The first stage executes only once, while the other stages would execute periodically with change of cluster-heads in each grid cell.

3.5.1 Stage 1: virtual grid division

In this stage, FTGAF-HEX divides the sensor region into several hexagonal virtual grid cells. In the honeycomb architectures, grid cell placement and sensor association schemes need to be established. In this scheme, the honeycomb virtual grid centres are positioned according to Fig. 6. Thus: d = \( \frac{3}{2}r _{GH} \) and h = \( \frac{\surd 3}{2} r_{GH} \), where r GH is size of the grid cell side of the hexagonal grid cell. The virtual grid centre is located at (i.d, j.h) where i and j are integers. A virtual grid cell centred at (i.d, j.h) is named as grid [i, j]. Figure 7a shows the grid [i, j] and its neighboring grid cells with their associated names in the XY coordinate system.

Fig. 6
figure 6

Example of virtual grid

Fig. 7
figure 7

Example of virtual grid addressing mapping scheme

Next, we replace grid cell names of the form grid [i, j] into special grid addresses of the form grid [H, I], where H is the shortest grid cell count from the origin grid cell and I is the index of hop-H hexagonal grid cell (Erman et al. 2012). The index starts at the right side of line b as shown in Fig. 7b and increasing in the counter-clockwise direction. The address mapping rules from grid [i, j] naming to grid [H, I] address are defined in Table 1. This special addressing scheme provides simple calculations for packet forwarding towards the sink.

Table 1 Address mapping rules

3.5.2 Stage 2: sensor association and grid information collection

In this stage, information related to sensors and grid cells such as sensor-id, grid-id (the sensor belongs to), residual energy level, location, and distance from sink are collected. Sensor shares their own information with the neighboring sensors through broadcasting HELLO message. When a sensor receives this message, it checks the grid-id field. If the grid-id is the same as its own, it records information of the sensor and responds with a RESPONSE message containing its own information so that the broadcasting sensor can also record the information of all neighboring sensors in the same grid cell. The structure of HELLO/RESPONSE message is shown in Fig. 8.

Fig. 8
figure 8

Example of HELLO/RESPONSE message

In hexagonal grid division, sensor uses its location information to associate itself with a virtual grid cell through some mathematical computation. In honeycomb architecture, for a sensor positioned at point (x, y), let

$$ i = \left\lfloor\frac{x}{h}\right\rfloor $$

and

$$ j = \left\lfloor\frac{y}{d}\right\rfloor. $$

As illustrated in Fig. 6, if i + j is even, sensor (x, y) is either in grid [i, j] or in grid [i + 1, j + 1]; if i + j is odd, sensor (x, y) is either in grid [i + 1, j] or in grid [i, j + 1] depending on whichever centre is closer.

Further, grid related information like total sensors in the grid cell, total residual energy of the grid cell and sensors of adjacent grid cells are used by the cluster-heads which are shared with the new cluster-head after each cluster-head rotation.

3.5.3 Stage 3: cluster-head selection

Selecting cluster-head is the basis for virtual grid division. Sensors are elected as grid cluster-head participate in data routing, while the other sensors turn-off their radios for some defined period of time to save their energy. After completion of stage 2, each sensor has an information list for neighboring sensors in the same grid cell. All sensors use a weight function \( \lambda (i) \) to calculate their own weight values to estimate the possibility of being selected as cluster head. A sensor selects itself as a cluster-head if it has the highest weight value amongst all of its neighboring sensors. Then it sets a random waiting time and broadcasts it to all its neighboring sensors in the same grid cell. If this sensor receives higher weight value from any other sensor then it gives up the cluster head selection competition. Eventually, a sensor with the highest weight value is selected as a cluster head. The total number of cluster-heads is equivalent to the total number of grid cells formed by virtual grid division. The weight function is defined as:

$$ \lambda (i) = \frac{{E_{residual} (i)}}{{\overline{E(r)} }}, $$
(15)

where \( E_{residual} (i) \) is the residual energy of the ith sensor, \( \overline{E(r)} \) is the average energy of the grid cell and r is the current round of cluster-head election.

3.5.4 Stage 4: establishment of routing table

FTGAF-HEX uses two-level sharing scheme of routing tables, where each grid cell updates its routing table including information (active-state, grid-id, residual energy level, location, and distance from sink) related to cluster-head sensors of AGs and cluster-head sensors of NAGs, if they are in the transmission range. The routing table is required to be updated after each rotation of cluster-head election. All cluster-head sensors in each grid cell broadcast HELLO message to their AGs. When cluster-head sensors of AGs receive this message, they respond with a RESPONSE message containing their residual energy, locations and grid-ids (the sensors belong to) along with entries in their own routing tables. The structure of HELLO/RESPONSE message is shown in Fig. 9. The source sensor updates its routing table with the sensors of AGs and the sensors of NAGs, if they are in the transmission range. Figure 3 illustrates the total required entries in the routing tables. In FTGAF-HEX, however it needs 12 more entries (i.e., total 18) instead of 6, since some of the sensors of NAGs will be beyond the transmission range of the source sensor. For average case it does not need more than 14 as total entries, since some of the sensors of NAGs will be beyond the transmission range of the source sensor. For example, in two neighboring grid cells G1 and G2, G1 as a source will have the sensors of all of its adjacent grid cells in the routing table with the sensors of the adjacent grid cells of G2, if they are in the transmission range of G1.

Fig. 9
figure 9

Example of HELLO/RESPONSE message for routing table

3.5.5 Stage 5: fuzzy logic based routing

FTGAF-HEX is a geographic routing protocol which uses fuzzy logic based energy-aware forwarding scheme for transmission of data towards the sink. It makes a fuzzy logic based decision to select a sensor as next hop based on various energy optimized parameters such that the network lifetime can be extended. Once a sensor has a data packet sent to the sink, first, it checks whether it can be directly sent to the sink or not. If the sink is in the transmission range, the data packet will be sent directly. Otherwise, it looks for routing table and selects a sensor as next hop and forwards the data packet to the sensor which becomes the new source. This process continues till data reaches to the sink. Figure 10 shows an example of the data routing from the source to the sink, where the source is located at the first grid, and the sink is at the last grid cell.

Fig. 10
figure 10

Simulation topology showing data transmission from the source to the sink. a GAF-HEX b FTGAF-HEX

To determine the energy-aware routing decision, this work uses fuzzy logic for the chance computation of each sensor to be selected as next hop for data forwarding towards the sink. The fuzzy rule base has been set so as to not only minimize the energy consumption but also to balance the routing load among sensors uniformly to maximize residual energy of each grid cell such that network lifetime can be extended.

The interference system design and fuzzy system model is illustrated in Fig. 11. The Mamdani algorithm is used to design fuzzy logic inference. The input fuzzy variables are: closeness of sensor to the shortest path (CSP), closeness of sensor to the sink (CS), residual energy level (REL). The variables CSP and CS show the measure energy efficiency and hop count for selecting a sensor as next hop, and REL shows the energy balance for routing decision. The rule base consists of 27 (33) mapping rules. The only fuzzy output variable the chance of a sensor, defuzzified value of which determines the chance for one sensor to be selected as next hop. The chance calculation is accomplished by using predefined fuzzy if–then mapping rules. Based on the three fuzzy input variables, 27 fuzzy mapping rules are defined in Table 2.

Fig. 11
figure 11

Proposed fuzzy system model

Table 2 Fuzzy mapping rules

The membership functions for the defined energy optimized parameters and the output fuzzy variable are shown in Fig. 12. The linguistic variables, used to represent CSP and CS, are divided into three levels: far, medium and close, respectively. The linguistic variable used to represent REL are divided into three levels: High, medium and low. The output fuzzy variable i.e., chance is divided into seven levels: very high, high, rather high, medium, rather low, low, and very low.

Fig. 12
figure 12

Membership functions for the input linguistic variables. a CS b CSP c REL d Chance

The fuzzy rule base includes rules like the following: if REL is high, CSP is close, and CS is close, the chance of the sensor to be selected as next hop is very high. The forwarding neighbors of the source sensor or a current forwarder are compared on the basis of chances, and the sensor with the maximum chance is then selected as the next hop. Mathematically, the crisp output domain value chance, from solution fuzzy region A, is given by:

$$ Chance = \frac{{\mathop \sum \nolimits_{i = 1}^{n} W_{i} \mu_{A} \left( {W_{i} } \right)}}{{\mathop \sum \nolimits_{i = 1}^{n} \mu_{A} \left( {W_{i} } \right)}}, $$
(16)

where W i is the domain value corresponding to rule i, n (i.e., n = 27) is the number of rules triggered in the fuzzy inference engine and µ A (W i ) is the predicate truth for that domain value.

4 Performance evaluation

In this section, we evaluate the effectiveness of the proposed work in MATLAB. Moreover, we compare the performance of TGAF-HEX with three different routing algorithms, namely GAF (Xu et al. 2001), DGAF (Shang and Liu 2012) and GAF-HEX (Liu et al. 2006). Simulations results show that the proposed work performs better compared to above works in terms of total hop count, energy consumption and total distance. We also evaluate the performance of the proposed work in terms of network lifetime and connectivity over time under different parameters. Further, we conduct simulation-based experiments of these protocols with varying number of sensors and mobile sinks.

4.1 Simulation environment

In our first simulation, as the number of active sensors (cluster-heads) depends on the number of grid cells formed by virtual grid division, at first, we perform simulation-based experiments for different sizes of target regions. The varied sizes of target regions help to get varied number of grid cells formed by virtual grid division. In the experiment, 1000 sensors with a 100 m transmission range are randomly distributed on 400 × 400, 600 × 600, 800 × 800, 1000 × 1000 and 1200 × 1200 m2 two-dimensional planes. The sink, which is not energy limited, is located at the centre. Grid side is calculated by using Eq. (1) (i.e., 27.74 m). For the energy model, the parameters are set as follows: E elec  = 50 nJ/bit, εfs = 10 pJ/bit/m2, and ε amp  = 0.0013 pJ/bit/m4. Energy consumption is calculated during data routing for each grid cell. A sensor can change the transmit power for different transmission distance from the destination that can be calculated by using Eq. (4), while the reception power is fixed as shown in Eq. (5). Each sensor generates 1000 bit data.

We use the following metrics to evaluate the performance of the proposed work at each round and compare the results with other routing protocols: hop count, energy consumption and distance covered during routing data.

Hop count: It is defined as the total number of hops for routing data packets from the source to the sink. In fact, less hop count represents lesser number of participating sensors in routing data for efficient energy usage. Figure 13a shows the comparison for the proposed work with other similar routing schemes in terms of hop count with different sizes of target regions. As illustrated in Fig. 13a, FTGAF-HEX needs from 37 to 44% less hop count compared to GAF-HEX.

Fig. 13
figure 13

Comparison the performance of FTGAF-HEX with other protocols with different sizes of target regions. a Hop count. b Distance. c Energy consumption

Distance: It is defined as the total distance covered by the data packet before reaching the sink. Figure 13b shows the comparison of the total distance covered by the data packet for the proposed work with other similar routing schemes with different sizes of target regions. As illustrated in Fig. 13b, in FTGAF-HEX, data packets cover from 7 to 12% less distance compared to GAF-HEX.

Energy consumption: Fig. 13c shows the comparison of energy consumption for the proposed work with other similar routing schemes. As illustrated in Fig. 13c, FTGAF-HEX consumes 17 to 24% less energy comparing to GAF-HEX. The result shows that the proposed work is capable of achieving significant improvement in terms of optimum energy usage to extend the network lifetime.

Analysis and simulation results show that by involving the idea of two-level neighbor sharing scheme, FTGAF-HEX achieves significant improvements in minimizing total hop count, distance and energy consumption compared to other schemes.

In the second simulation, 700 sensors are deployed in a 600 × 600 m2 target region. We compared the performance of FTGAF-HEX with GAF-HEX and non-fuzzy TGAF-HEX in terms of network lifetime, remaining energy balance and network connectivity. In our case, the network lifetime is the time corresponding to the last data packet received by the sink. In other words, the network is called dead when the sink is no longer capable of receiving any data packets from the sensors and the network is not operational anymore. The network connectivity is defined as the number of active grid cells connected to each other. Figure 14 shows the network lifetime over time. Traditional GAF-HEX makes greedy based routing decisions based on the distance from the sink, and has no focus on energy balance. The proposed work also considers the residual energy levels of neighboring grid cells while making routing decision. It combines both the energy efficiency and energy balance through fuzzy logic that leads to higher network lifetime. Figure 14a shows the number of alive sensors over time. Result shows that FTGAF-HEX is capable of maintaining high network connectivity, and maintaining same percentage of connected sensors even after several rounds, thereby achieving improved network lifetime. Figure 14b shows the number of active grid cells over time. Result shows that the proposed work maintains same percentage of active grid cells to maximize network connectivity over time. As network scalability depends on the number of alive sensors and active grid cells, the proposed work shows a significant improvements in terms of overall network connectivity.

Fig. 14
figure 14

Comparison of network lifetime. a Number of alive sensors v/s number of rounds. b Number of active grids v/s number of rounds

Figure 15 shows the network lifetime with different number of sensors. The simulation shows that FTGAF-HEX extends the network lifetime with increasing number of sensors. The difference in network lifetime between FTGAF-HEX and TGAF-HEX is also improved with increasing number of sensors. This is because the FTGAF-HEX achieves a better combination of distributed local energy balance and energy efficiency with increasing number of sensors.

Fig. 15
figure 15

Network lifetime over varying number of sensors

Figure 16 shows impact of number of mobile sinks throughout the network lifetime. Simulation shows that FTGAF-HEX has significant improvement on network lifetime even with increasing number of sinks. It is seen that the lifetime difference between FTGAF-HEX and TGAF-HEX reduces with increasing number of sinks. This is because larger number of sinks reduces the total hop count between sensors due to less participation of sensors.

Fig. 16
figure 16

Network lifetime over varying number of mobile sinks

5 Conclusion

In this work, we propose a fuzzy logic based energy-aware geographic routing protocol named FTGAF-HEX, which bases on GAF. Furthermore, we use a generalized version of GAF based on honeycomb virtual grid architecture called Hexagonal GAF (GAF-HEX) to replace the square grid with hexagonal one. Though GAF extends the network lifetime by exploiting redundancy to conserve energy while maintaining application fidelity, it cannot achieve the optimum energy usage, because it needs more hop count during routing. In this work, we extend the idea to make it more efficient in the aspect of the hop count and energy consumption. This work considers the fuzzy logic based routing, which combines the energy efficiency and energy balance together through fuzzy logic that leads to higher network lifetime. The primary objective of FTGAF-HEX is to keep the hop count as low as possible. This, in turn, minimizes the number of participating sensors in data transmission while maintaining energy balance by evenly distributing the workload. The simulation results show that FTGAF-HEX performs better compared to other similar protocols in terms of various metrics.