Keywords

1 Introduction

Since 2000, WSNs [1] are majorly incorporated into the field of military applications as well as civilian applications. The major usage of WSNs is in biomedical applications, target tracking, habit monitoring, building management systems, surveillance and disaster management [2]. WSNs have minimum storage capacity and limited battery power and it is not possible to replace the battery in the WSNs. Hence, the utilization of energy in the WSNs is very crucial and decides the network performance. Therefore, energy is concerned as the major issue in WSNs. There designing energy efficient protocol is more important in WSNs [3]. In general, the working procedure of WSNs is to collect the information from the sensor nodes and sending it to the base station. Figure 1 shows the complete hierarchy of working procedure of WSNs.

Fig. 1
figure 1

Wireless sensor networks

In WSNs, for optimizing the nodes energy, some CH nodes are selected and these CH nodes aggregate data from the neighbouring nodes. The CH node sends the aggregated data to the BS, which reduces the network overhead and leads to the reduction of energy consumption.

LEACH is one of the efficient protocols which randomize the selection of CH nodes among the neighbouring sensor nodes. The basic principle of LEACH protocol is selection of CH node periodically. The CH node is organized with two stages. One is selection of cluster nodes and another one is data communication between the cluster nodes. The cluster head formation is done based on the remaining energy in the nodes. At the cluster formation, each node is assigned with a random number and is compared with the threshold value μ(n). If the number is less than the threshold value μ(n), then the node is selected as CH node, otherwise it is selected as the normal sensor node in the cluster. The threshold value for the cluster is given in (1)

$$\mu (n) = \left\{ {\begin{array}{*{20}c} {\frac{\alpha }{1 - \alpha \times (L\,\bmod (1/\alpha )}} & {if\,n \in N} \\ 0 & {if\,n \notin N} \\ \end{array} } \right.$$
(1)

Here, n is the current node, N is the set of nodes in the cluster, α is the ratio of CH nodes in the cluster, L represents the number of rounds.

The LEACH protocol completely depends on the probability model for selecting the CH nodes. If the CH nodes are nearer to each other, it leads to high energy consumption, so this LEACH protocol is failed to address this issue. To overcome the discussed issue, many heuristic algorithms were proposed such as particle swarm optimization (PSO), genetic algorithm (GA) and ant colony optimization algorithm (ACO). In this paper we are addressing the energy minimization problem by the firefly algorithm. The firefly algorithm works with principle of intensity of light produced by the fireflies. The major advantage of this algorithm is the avoidance of multiple CH nodes.

2 Related Work

In WSNs, Energy consumption is treated as the major issue. To overcome this problem, many studies have been represented by the researchers. In [4], the authors proposed energy aware cluster based optimization mechanism. This mechanism is concentrated on reducing the cluster heads and it achieved 16.3% reduction in overall energy consumption of the network. They managed to reduce the delay between the sensor nodes. In [5], the authors presented the survey on energy consumption factors and the existing approach to deal with the energy consumption in WSNs. They made the comparative analysis on all existing algorithms and presented the pros and cons of all algorithms with respect to different parameters. The authors in [6] proposed the prediction based energy efficient clustering algorithm for minimizing the energy consumption at the broadcasting the information from the cluster head. They made an attempt to improve the overall performance by considering the factors such as delay and throughput. In [7], Beacan et al., presented the model for minimizing energy consumption based on the distance of the nodes form the base station. The bio inspired approaches for CH selection and cluster development in the WSNs had gained popularity in recent years. The approaches such as particle swarm optimization genetic algorithm and ant colony optimization algorithms are extremely popular in this category. In [8], kuila et al., proposed the CH selection mechanism by using the multi-objective function. The mechanism identifies the CH node energy consumption and end to end delay between nodes for forwarding the packets. In the proposed model, each node is assigned as particle in the algorithm. In [9], the author combined both LEACH and PSO algorithm for finding the suitable CHs and sensor nodes with in the cluster. So, this paper is concentrated on employing the firefly algorithm as the optimization technique for finding the CH node within the cluster.

3 Problem Formulation

The problem formulation for the WSNs are carried out using the graph G = (V, E), where V is the vertices and E is the edges and each edge is associated with some weight W that are associated with some parameters. The objective function for the firefly algorithm is given in Eq. 2.

$${\text{Problem:}}\,\hbox{min} \,F(x) = \sum\limits_{i = 1}^{N} {W_{i} x_{i} }$$
$${\text{Subjected}}\,{\text{to}}\,x_{i} = \left\{ {\begin{array}{*{20}l} 1 \hfill & {if\,edge\,E_{i} \,is\,selected} \hfill \\ 0 \hfill & {otherwise} \hfill \\ \end{array} } \right.$$
(2)

The objective function f(x) is organized with three parameters, end to end delay, packet delivery ratio and energy consumption. The objective function is to minimize the stated parameters.

4 Energy Consumption Model for WSNs

The energy consumption of the two nodes which are in the communication is shown in Fig. 2.

Fig. 2
figure 2

Energy consumption model for two nodes

The transmission energy for Q bit packet for a distance of d between two nodes is given by Eq. 3.

$$E_{T} (Q,d) = \left\{ {\begin{array}{*{20}l} {QE_{e} + Q\varepsilon_{f} d^{2} ,} \hfill & {where\;d < d_{0} } \hfill \\ {QE_{e} + Q\varepsilon_{a} d^{4} ,} \hfill & {where\;d > d_{0} } \hfill \\ \end{array} } \right.$$
(3)
$$d_{0} = \sqrt {\frac{{\varepsilon_{f} }}{{\varepsilon_{a} }}}$$
(4)

The receiving energy for Q bit packet is given by Eq. 5.

$$E_{R} (Q) = QE_{e}$$
(5)

where Q is the number of bits ET is the transmission energy and ER is the receiving energy and d is the distance between the nodes. Ee, Ef, Ea are the coefficients of the energy consumption model.

5 Firefly Algorithm for CH Selection

Due to the interesting behaviour of the fireflies, in late 2007 and 2008, Cambridge University developed firefly algorithm. The firefly algorithm has the following properties

  • Fireflies attracted to each other without considering the gender, as all the fireflies are unisex.

  • The firefly can be attracted by the other firefly based on the intensity of the light. The value of the intensity of light is high means there is a chance of attracted by the other firefly.

  • The objective function defines the light intensity of the firefly.

The fitness function for the WSN based on the energy calculation, packet loss ratio and end to end delay is given by (6)

$$f(x) = \{ (\rho_{drop} /\rho_{total} ) \times (E_{rem} (i)/E_{initial} )\} /(\exp^{{ - e_{delay} /e_{allow} }} )$$
(6)

where, \(\rho_{drop}\) denotes the number of packets and \(\rho_{total}\) indicates the total number of packets assigned. Erem(i) indicates the remaining energy at node i and Einitial indicates the initial energy assigned to the node i, edelay is current end to end delay and eallow is the allowable end to end delay.

The attractiveness of the firefly δ is based on the distance ‘d’ as given in (7).

$$\delta = \delta_{0} e^{{ - \vartheta d^{2} }}$$
(7)

The firefly i attracted towards j, then the moment of the firefly is given in Eq. 8.

$$\kappa_{i} = \kappa_{i} + \delta_{0} e^{{ - \vartheta d^{2} }} (\kappa_{i} - \kappa_{j} ) + r\omega$$
(8)

where, K is the moment of the fireflies and r is the randomized variable and ω is the uniform distribution or Gaussian distribution of the time. The algorithm for cluster head selection based on the firefly algorithm is given in Algorithm 1.

Algorithm 1: CH selection algorithm (FFCHSA)

Begin

Step 1: Initialize the nodes with the parameters /*Initial population of fireflies*/

Step 2: Evaluate the fitness function of each node within the cluster based on the Eq.  6 .

Step 3: Sort the nodes based on the fitness function and find the current best

Step 4: Compare the fitness values of the nodes

If \((\mathtt{\updelta}_{\texttt{j}} > \mathtt{\updelta}_{\texttt{i}})\)

Make the \(\mathtt{\updelta}_{\texttt{j}}\) as the current best node

Step 5: Assign all the nodes to the \(\mathtt{\updelta}_{\texttt{j}}\)

Step 6: Evaluate the distance d and update the attractiveness

Step 7: Go to step 2 and repeat the process until all the nodes in the cluster completes its fitness function

Step 8: Select the best node as the cluster head

End

6 Simulation Environment

To evaluate the proposed FFCHSA algorithm, we consider the other existing algorithms such as Genetic Algorithm [10] and Particle Swarm Optimization algorithm [11]. The experimental setup is carried by using the NS2 simulator. To illustrate the mechanism of proposed algorithm, we consider the network of size 1250 m × 1250 m with 100 nodes randomly distributed. If the energy of the node is down, then that node is treated as the dead node. The average node degree is taken as 3–5 nodes and the traffic type for the network is taken constant bit rate (CBR) with 256 byte data packet. The mobility rate of the node is considered as 0–15 m/s. The complete simulation parameters are given in Table 1.

Table 1 Simulation parameters

6.1 Results Evaluation

The simulation is carried out with NS-2 Simulator. The performance of the proposed algorithm is compared with other existing algorithms. The parameters used for the performance evaluation are packet loss, energy consumption, end to end delay and the frequency of change in cluster head. Figure 3 shows the packet loss of the proposed FFCHSA algorithm with the other existing algorithms. The proposed algorithm recorded the less packet loss ratio by 8.32% when compared to the GA and PSO algorithms. Figure 4 represents the energy consumption of three algorithms. The energy consumption of proposed algorithm is recorded as 20% less while comparing with the other two algorithms. This is due to the effective utilization of nodes and reduction of number of CH nodes in the FFCHSA algorithm. The plot in the Fig. 5 represents the end to end delay between the sensor nodes of the proposed FFCHSA, GA and PSO algorithm. It is identified that the proposed FFCHSA algorithm recorded the minimum end to end delay and it improves the performance of the overall network.

Fig. 3
figure 3

Packet loss versus transmission time

Fig. 4
figure 4

Comparison of energy consumption

Fig. 5
figure 5

Comparison of end to end delay

Figure 6 shows the comparison results of changing frequency of cluster heads. If the cluster head is stable, the energy consumption of the network is minimal otherwise, the energy consumption drastically increases with the change of cluster heads. In Fig. 6, it is observed that the proposed FFCHSA algorithm recorded the minimal value for the frequency of changing the cluster heads when compared to the GA and PSO algorithms.

Fig. 6
figure 6

Comparison of changing frequency of cluster heads

7 Conclusion

In this paper, we are concentrated on developing the bio-inspired approach for the selection of CH node within the cluster. The cluster head selection is carried out using the firefly algorithms (FFCHSA). The algorithm collects the parameters of energy consumption, packet drop ratio and end to end delay of the nodes which are participating in the cluster and calculates the fitness function of each and every node. The fitness function decides the cluster head selection within the cluster and finally groups all the nodes with the cluster head. The proposed algorithm proved its efficiency under different criteria’s such as reduction in packet drop ratio, reduction in energy consumption of the network and minimization in end to end delay. The overall performance of the network is improved using the proposed algorithm.