1 Introduction

WSNs are networks that consist a large number of tiny and low energy sensor nodes. These nodes are randomly or manually spread in a given target area or region. The sensor node contains data aggregation unit, sensing unit, the communication component and also an energy unit. Each sensor node may have Global Position System (GPS) to progress within the given target area or region. WSNs have promising applications in different areas such as disaster warning systems, air pollution monitoring, health care, environmental monitoring, and agriculture and in crucial areas such as surveillance, intruder detection, defense reconnaissance etc [1, 21]. Sensor networks are used to gather data from the environment and build inferences about the monitored object. These sensor nodes are normally characterized by limited communication capabilities due to power and bandwidth constraints. So, minimizing energy conservation of sensor nodes and Cluster Heads (CHs) in the network is challenging task in WSNs. Many clustering algorithms are studied more in this regard [6, 14, 15]. In cluster based WSNs, sensor nodes are divided into several groups called clusters. Each cluster has a CH, which gathers data from nearby sensor nodes and processes that data then send to sink directly or via other CHs. In cluster based WSNs, CHs have more workload compared to other sensor nodes [7, 20]. So, many researches [16, 17] deployed high energy level devices as CHs, also known as gateways in WSNs. This entire process is depicted in Fig. 1.

Fig. 1
figure 1

Cluster based WSN with gateways

In a clustered WSNs, CHs need to do some additional activities such as, data collection from sensor nodes within the respective cluster, processing etc. apart from handling its own data. CHs use data fusion to detect duplicate and unwanted data sent by sensor nodes in the respective cluster. These Gateways or CHs are operated with battery power. So, we need to develop an algorithm that maximizes network lifetime and minimizes power consumption in sensor nodes as well as gateways. Sensor nodes and gateways usually run on low powered batteries, so they need a better way to utilize its battery power in an efficient way. Gateways may send data to another gateway or directly to the sink depending on the network structure and availability of devices. Data processing capability of a gateway is directly proportional to its power. If any gateway fails due to lack of energy, it effects dependent devices in the network. If any intermediate node fails, the nodes using this intermediate node have to search for other alternative nodes to send the data and causes more load on newly identified alternative nodes. In the literature various definitions defined for network lifetime, such as the time until the first node dies or time until the last node dies or time until the desired number of nodes dies in the network [3, 24]. In some WSN scenarios, network lifetime is considered as the time taken to cover entire region. In [25, 26] authors have defined network lifetime in terms of node lifetime, coverage, connectivity and transmission.

With the evolution of soft computing, bio-inspired algorithms have gained more attention in recent years. Many researchers designed algorithms to solve WSNs problems. For example, Genetic Algorithm (GA ) [19], which is used to enhance WSNs lifetime in large-scale surveillance applications. Artificial fish schooling algorithm [27], which has been used to solve traffic monitoring system and fruit fly optimization algorithm [29] is applied in sensor deployment. In this paper, to address the WSNs energy problem, SCE-PSO based energy efficient clustering algorithm is proposed. The rest of the paper is organized as follows: works related to clustering in WSNs are discussed in Sect. 2. The required terminology, energy model for WSNs is discussed in Sect. 3 to understand the proposed method clearly. The problem statement for load balancing is discussed in Sect. 4. The SCE-PSO for load balancing problem in WSNs is discussed in Sect. 5. The proposed SCE-PSO based energy efficient clustering algorithm is discussed in Sect. 6. The experimental results and its analysis are presented in Sect. 7. Finally, in Sect. 8, the paper is concluded based on experimental observations.

2 Related work

Many clustering algorithms have been proposed for WSNs. We review some of the clustering algorithms in this section. Low-Energy Adaptive Clustering Hierarchy (LEACH) is well-known clusteing algorithm used for WSNs. In LEACH algorithm, one of the sensor node in the network selected as a CH for the cluster. This algorithm dynamically changes the CHs in the network which is good for load balancing. Suppose low energy node selected as a CH that may die rapidly. The main problem in this algorithm is low energy level CHs die fast inside the network [9]. For solving this problem many improved LEACH algorithms have been proposed for selecting optimal CHs. In [18] authors have proposed Improved LEACH (I-LEACH) by considering residual energy to select the CH instead of probability as used in the LEACH. In [2] authors have selected energy efficient CH by considering the energy and distance parameters.

Zhang et al. [28] have defined Node Local Density Load Balancing (NLDLB) with clustering in WSN. In this algorithm, initially they assigned the sensor node which is in range of R with only one gateway. The remaining sensor nodes are assigned in two steps: first they have assigned the sensor nodes to the gateways which are in R/2 range, then remaining sensor nodes are assigned to the gateways which are in range and having less number of sensor nodes. Vaishali et al. [6] have proposed Score Based Load Balancing (SBLB) algorithm in WSNs. They have considered score parameter to select intermediate nodes in the path. The node which has minimum distance and maximum energy becomes the best score node in that path. The two best score nodes are chosen for data transmission in this algorithm. These scores are estimated based on ratio of distance between each node to CH, and energy of the each node. After forming the clusters, the CH is selected. The sensor node which has maximum energy becomes the CH.

In WSNs, For energy efficiency and load balancing Jana et al. [15] have defined two types of sensor nodes which depends on range of communication between gateways and sensor nodes which are restricted node and open node. The sensor nodes which are in range of one and only one gateway i.e., they can communicate with only one gateway are referred as restricted nodes whereas sensor nodes which can communicate with at least two or more than two gateways are referred as open nodes. Initially all restricted nodes are allocated to their assigned gateways. For allocation of open nodes min heap is build. The nearest gateway is assigned to the sensor node and rearrangement of min heap takes place. Kuila et al. [14] have come up with a Novel Genetic Algorithm (NGA) and Hussain et al. [10] have proposed Simple GA (SGA) based on clustering of sensor nodes for load balancing in WSNs. It usually starts with a set of randomly generated number of solutions known as initial population. Every solution is denoted by an array of genes or as a string, which is known as chromosome. To judge the performance of each solution, a fitness function is evaluated. Damodar et al. [5] have improved shuffled frog leap algorithm for gateways load balancing in WSNs. Kuila et al.[16] have used PSO-based clustering algorithm to enhance the lifetime of WSNs.In this method,clustering takes place based on the average cluster distance and lifetime of the gateway. Fitness value of each particle in the swarm is computed using fitness function and this fitness value judges the quality of the network. A particle with better fitness function value gives better network structure. Xiang et al. [22] have been proposed PSO-based energy efficient routing algorithm by considering residual energy of nodes and transmission distance. Zhou et al. [30] have been proposed improved PSO-based clustering algorithm by considering energy efficiency, transmission distance and relay nodes residual energy.

3 Preliminaries and terminologies

3.1 Energy model

We have used similar energy model used in [8]. Energy consumption of sensor nodes and gateways effect the WSNs lifetime. Hence, it is important to design an efficient clustering technique where every gateway and sensor node energy is mitigated in order to prolong network lifetime. In WSNs, radio signals are used for communication between nodes and the energy consumed for data transmission and reception is evaluated using energy model. There are two channels in energy model namely free space channel and multi-path fading channel. If the distance (d) between sender and receiver is less than a threshold \(d_0\), then free space channel is used; otherwise, multi-path fading channel is used. The following equation shows the energy required by the model to send a l-bit message over a distance d.

$$\begin{aligned} E_T(l,d)={\left\{ \begin{array}{ll} l *E_{elec}+l*{\epsilon _{fs}} *d^2,\quad d<d_0\\ l *E_{elec}+l *{\epsilon _{mp}} *d^4,\quad d \ge d_0\\ \end{array}\right. } \end{aligned}$$
(1)

where \( d_0 \) is a threshold, \( E_{elec} \) is the energy required by electronic circuit, \( \varepsilon _{fs} \) is the energy required by the free space and \( \varepsilon _{mp} \) is the energy required by multi-path channel.

The energy required to receive l-bit of data is given as:

$$\begin{aligned} E_R(l)=l *E_{elec} \end{aligned}$$
(2)

The energy consumed by an electronic circuit (\( E_{elec} \)) depends on various factors, such as the digital coding, modulation, filtering and spreading of the signal etc. The energy consumed by the amplifier in free space (\( \varepsilon _{fs} *d^2 \)) or multi-path (\(\varepsilon _{mp} *d^4 \)) depends on the distance between the sender and receiver and the bit error rate.

3.2 Terminologies

We have used the below terminologies in the proposed fitness function and proposed algorithm.

  1. 1.

    The set of sensor nodes is indicated by \( S = \{s_{1}, s_{2}, \ldots, s_{m}\} \).

  2. 2.

    The set of gateways is indicated by \( G = \{g_{1}, g_{2}, \ldots, g_{n}\} \).

  3. 3.

    \(Dist( s_{i}, g_{j})\) The distance between the sensor node \( s_{i} \) and the gateway \( g_{j} \).

  4. 4.

    \(Range(s_{i}) \) The number of gateways within communication range of \( s_{i} \).

  5. 5.

    \(Load (g_{i})\) depends on amount of energy required for gateway \(g_{i}\) in order to receiving and transmitting the l number of bits (E(l)) and remaining energy of gateway.

    $$\begin{aligned} {\begin{matrix} {\hbox {Load}} (g_i) = E(l)/{\hbox {remaining energy in}}\,g_i \end{matrix}} \end{aligned}$$
    (3)

    where, E(l) is calculated according to energy model and is given below.

    $$\begin{aligned} {\begin{matrix} E(l)= E_T(l,d) + E_R(l) \end{matrix}} \end{aligned}$$
  6. 6.

    Load Factor(\(g_{i}\)) The ratio between the \(Load (g_{i})\) and maximum load of the gateway in the network.

    $$\begin{aligned} {\hbox {Load Factor}}\,(g_i) = \frac{{\hbox {Load}}\,(g_i)}{\max \{{\hbox {Load}}\,(g_i), \forall i=1, 2, \ldots n\}} \end{aligned}$$
    (4)
  7. 7.

    Expected Gateway Factor is the ratio between the sum of load factors of all gateways and total number of gateways in the network.

    $$\begin{aligned} {\hbox {Expected Gateway Factor}} = \left[ \frac{ \sum \nolimits _{i=1}^{n} {\hbox {Load\,Factor}}\,(g_i)}{\hbox {Total number of gateways}} \right] \end{aligned}$$
    (5)
  8. 8.

    \(M(g_{j})\): Average euclidean distance from each sensor node to gateway in that particular cluster.

    $$ {\text{M}}(g_{j} ) = \left[ {\frac{{\sum\nolimits_{{i = 1}}^{m} {{\text{Dist}}} (s_{i},g_{j} )}}{{K_{j} }}} \right]{\text{ }} $$
    (6)

    where \(K_{j}\) = Total number of sensor nodes connected to gateway \(g_{j}\)

4 Problem formulation

We have assumed a WSN scenario, in that scenario the sensor nodes and gateways are deployed randomly in given target area. Any sensor node in the network can connect any gateway in the network if the sensor node in the communication range of that gateway. Figure 2 shows that the load balancing problem in WSNs. According to the Fig. 2\(g_{1}\), \(g_{2}\), \(g_{3}\) are three gateways in the network and \(K_{1}\), \(K_{2}\), \(K_{3}\) are three clusters. \(g_{1}\), \(g_{2}\), \(g_{3}\) are CHs for \(K_{1}\), \(K_{2}\), \(K_{3}\) clusters respectively. \(K_{1}\) is over loaded cluster, so this load has been distributed to \(g_{2}\) and \(g_{3}\) with proper assignment of sensor nodes.

Fig. 2
figure 2

Load balancing problem in WSN

5 Adopting SCE-PSO for load balancing problem in WSNs

5.1 Overview of SCE-PSO

The SCE-PSO is an evolutionary algorithm and introduced by [23]. In SCE-PSO approach the SCE approach combined with the PSO. In the SCE-PSO, a population of points sampled randomly from the feasible space. After initialization of particles velocity and position, the population is divided into a predefined number of complexes N. the complex division is based on fitness value of the particle. Now each complex evaluating using PSO algorithm.The detail explanation of SCE-PSO algorithm is given below and flowchart of SCE-PSO algorithm is shown in Fig. 3 [11, 12].

Fig. 3
figure 3

Flowchart of SCE-PSO algorithm

  1. Step 1

    Particles Initialization Let N ≥, M ≥ 1 two numbers, where N is the number of complexes, M is the number of particle in each complex. Calculate the sample size S = NM. P1, P2,…, PS are S sample points (particles). Initialize all particles in sample and calculate fitness value fi at each particle Pi

  2. Step 2

    Particles Ranking Store the particles in an array A according to descending order of fitness value.

    $$A = {\text{ }}\left\{ {P_{i},{\text{ }}f_{i},{\text{ }}i = 1,{\text{ }}2,{\text{ }}3, \ldots,{\text{ }}S} \right\} $$
  3. Step 3

    Particles Partitioning Partition an array A in to N number of complexesC1, C2,…,CN. Each complex containing M particles in such a way that the particle P1 allotted to complex C1, the particle P2 allotted to complex C2, the particle N is allotted to the CN complex, and the particle N + 1 allotted to the C1 complex, and so on.

    $$ C_{k} = \left\{ {{\text{ }}P_{j} {\text{ }},{\text{ }}f_{j} {\text{ }},{\text{ }}j = 1,{\text{ }}2, \ldots,{\text{ }}M} \right\} $$
  4. Step 4

    Complex Evaluation Each complex Ck is being evaluated, where k = 1, 2,…N according to PSO algorithm. PSO algorithm is described further.

  5. Step 5

    Complex Shuffing Replace C1, C2,…CN into an array A. Sort an array A with descending order according to their fitness value.

  6. Step 6

    Convergence Checking Check for convergence criteria is satisfied or not. If it is satisfied, stop; else go to step 3. Here convergence criteria means number of evaluations or fitness value limitation.

5.2 Adopting PSO for complex evolution

PSO is inspired from the nature based on fish schooling and bird flocking [4, 13]. These birds regularly travel together in a group without any colliding for searching food or shelter. Each member or bird in a group follows the group information by adjusting its velocity and position. Each bird or member individual effort searching for food and shelter reduces in a group because of sharing group information. each particle in complex gives solution to a specified instance of the problem. Each particle is going to be evaluated by a fitness function. All particles have same dimension. Each particle \( P_{i} \) has a position (\(X_{i,d}\)) and velocity (\( V_{i,d} \)) in \(d{\rm th} \) dimension of the hyperspace. So, at any point in time, particle \(P_{i} \) is represented as

\( P_{i} = \{ X_{i,1}, X_{i,2}, X_{i,3}, \ldots, X_{i,d} \}\)

To reach global best position, each particle \(P_i\) follows its own best (\( Lbest_{i} \)) and global best (Gbest) to update its position and velocity recursively. Using the following equations, we perform the recursive position (\( X_{i} \)) and velocity (\( V_{i} \)) updates [16].

$$\begin{aligned} {\begin{matrix} V_{i,d}(t+1)&= W *V_{i,d}(t)+ a_{1}*r_{1}*(Lbest_{i,d}-X_{i,d}(t))\\&\quad +a_{2}*r_{2}*(Gbest_{d}-X_{i,d}(t)) \end{matrix}} \end{aligned}$$
(7)
$$\begin{aligned} X_{i,d}(t+1)=X_{i,d}(t)+V_{i,d}(t) \end{aligned}$$
(8)

where W is the inertial weight, \(a_{1}\) and \(a_{2}\) are the acceleration constants which are non-negative real numbers. \(r_{1}\) and \(r_{2}\) are two random numbers in the range [0, 1] which are uniformly distributed. This update process is repeated until we find global best or we reach maximum iterations count. This whole process is shown in Fig. 4. In every iteration, the position and velocity of each particle are updated using Eqs. 7 and 8. While updating velocity and positions of particles we may get new position because of algebraic addition and subtraction. New position values may be less than or equal to zero, or greater than one. However, according to Eq. 9, the particles position must follow in the range of (0, 1]. In order to get correct range values, we have to do the following changes in our algorithm:

  1. 1.

    If updated position value is less than or equal to zero, then modify the value with a newly generated random number whose value tends to zero.

  2. 2.

    If updated position value is above one, then modify the value to one.

After obtaining the modified positions, the particle \(P_{i}\) is evaluated using fitness function. Each particle best fitness value (\(Lbest_{i}\)) is modified by itself, only if its present fitness value better than \(Lbest_{i}\) fitness value. Until the termination condition is satisfied, the velocity and the position values are modified recursively.

Fig. 4
figure 4

Flowchart of PSO algorithm

6 Proposed clustering algorithm

To solve the problem of balancing the load of gateways in wireless sensor network, an optimization algorithm, SCE-PSO strategy is applied. The proposed algorithm contain particle generation, formulation of fitness function, sorting of particles with respect to their fitness value, partitioning into complexes, Evaluation of complex using PSO in the sections as follows.

6.1 Particle generation

Each particle is encoded as clustered network (contains connection from each sensor node to gateway). The dimension of each particle P is D (number of sensor nodes in the network). We initialize each gateway \((X_{i,d} | 1 \le i \le M, 1 \le d \le D) \) with randomly generated number from a uniform distribution in the range (0, 1]. The value of \(d{\rm th}\) sensor node (i.e., \(X_{i,d}\)) assigns a gateway (say \(g_k\)) to \(s_d\). That is, \(s_d\) sends data to \(g_k\) and this can be formulated as follows:

$$\begin{aligned} n = ceil(| X_{i,d} * Range(s_{d})|) \end{aligned}$$
(9)

i.e., \(g_k\) is the \(n{\rm th}\) gateway in \(Range(s_{d})\).

The particle initialization process is explained using following Example 1.

Example 1

Consider a WSN scenario with 4 gateways and 10 sensor nodes, i.e., G = \(g_{1}\), \(g_{2}\), \(g_{3}\), \(g_{4}\) and S = \(s_{1}\), \(s_{2}\), \(s_{3}\),..., \(s_{10}\). As number of sensor nodes are 10 therefore the dimension of particle is 10. The Fig. 5 shows that the sensor nodes communication range and the edge between \(s_{i}\), \(g_{j}\) represents sensor node \(s_{i}\) can send data to the gateway \(g_{j}\). The same is represented using Table 1 in terms of sensor nodes, gateways in the range of sensor nodes.

Fig. 5
figure 5

WSN before clustering

During initialization, each dimension (sensor node) \(X_{i,d}\) of particle \(P_i\) is initialized with a random number in (0, 1] range. For a random particle \(P_{i}\) the values assigned are shown in Table 2. This random initialization of sensor nodes position values constitute a particle or solution. This solution is generated as follows:

Table 1 Sensor nodes and their communication range
Table 2 Particle generation

Let us consider sensor node \(s_2\) and its assigned random value of 0.65. According to the Eq. 9, \(ceil (0.65, 2) = 2\), i.e., second gateway (\(g_3\)) from the \(Range(s_{2})\) is selected for data sending. This process is repeated for all sensor nodes to construct entire network (particle). Table 2 shows the final result of network construction, and the same is visualized using Fig. 6.

Fig. 6
figure 6

WSN after clustering

6.2 Initial sample representation

Initial sample is a set of particles which are randomly generated. Every particle represents the solution to the load balancing problem. All particles are considered to be valid if sensor node is allocated to one of the gateway which is in the range of corresponding sensor node.This initial sample generation is explained with an example given below:

Example 2

Consider a WSN Scenario with 4 gateways and 10 sensor nodes. i.e., G = \(g_1\), \(g_2\), \(g_3\), \(g_4\) and \( S=\{s_1,s_2,\ldots, s_{10}\} \). As there are 10 sensors, the dimension of each particle is 10. Table 1, shows gateways in range of each sensor node. A sensor node can be allocated to the any of the gateways in their range. According to Table 2, sensor node \(s_1\) is assigned to either gateway \( g_2 \) or \( g_3 \) and so on.

From the Example 2, sensor node \(s_1\) has selected gateway \(g_2\) among \(g_2\) and \(g_3\), likewise \(s_2\) selects gateway \(g_3\) among \(g_2\), \(g_3\). \(s_7\) selects \(g_2\) among \(g_1\), \(g_2\), \(g_4\), and so on. This forms the initial sample generation, which is shown in Table 2.

6.3 Proposed fitness function

An efficient fitness function is designed to evaluate each particle. This is given in Eq. 10. For efficient clustering we considered a metrics called expected gateway factor and mean cluster distance and number of heavy loaded gateways in the fitness function. The considered metrics measures the quality of the network.

$$\begin{aligned} Fitness = {\hbox {Expected Gateway Factor}} *\frac{{\hbox {Total\,number\,of\,gateways}}}{\hbox{Number\,of\,heavily\,loaded\,gateways}} *\frac{1}{\sigma _{c}} \end{aligned}$$
(10)

In order to check the number of heavily loaded gateways in the network, every gateway is checked for whether the gateway is heavily loaded or not. To check the status of gateway threshold load is defined in Eq. 11. The gateway which load is more than the threshold value called heavily loaded gateway in the network.

$$\begin{aligned} Threshold= \frac{\sum _{i=1}^n {\hbox {{Load}}}\,(g_i)}{n}\end{aligned}$$
(11)
$$\begin{aligned} Standard\,Deviation(\sigma _{c}) = \sqrt{\frac{\sum \nolimits _{i=1}^n (\mu -M(g_i))^2}{n}} \end{aligned}$$
(12)
$$\begin{aligned} \mu = \frac{\sum \nolimits _{i=1}^n {{M}}(g_i)}{n} \end{aligned}$$
(13)

It is clear from Eq. 10 that proposed fitness function considers load of the gateways, mean cluster distance and number of heavily loaded gateways to judge the quality of the particle. In Clustered WSN, The sensor nodes sends data to the CHs or Gateway. The number of connected sensor nodes increases for gateway load increases. i.e., the number of sensor nodes to be assigned are proportional to the gateway load. This helps in reducing the gateway energy consumption and maximizing the network lifetime. Hence, proposed fitness function is good for load balancing as well as energy efficiency. Particle which is having higher fitness value that is well balanced clustering network.

6.4 Particles sorting and partitioning

Every particle in the sample is evaluated by the fitness function to get a fitness value. Then store the particles in an array A according to descending order of fitness value, where \( A=\{ P_i, f_i | i=1,\ldots,S \}\), Here first element in an array A represents a solution to the problem with highest fitness value. after this process, Partition an array A into N number of complexes \(C_{1}, C_{2},\ldots, C_{N}\). each complex containing M particles in such a way that the first particle \(P_{1}\) allotted to complex \(C_{1}\), the particle \(P_{2}\) allotted to complex \(C_{2}\), the particle M is allotted to the \(C_{N}\) complex, and the particle \(M+1\) allotted to the \(C_{1}\) complex, and so on.

Example 3

Let us Consider 9 particles, 3 complexes in our approach and each complex contains 2 particles. There are 9 particles taken randomly for initial sample generation. Let us consider set of particles in sample S = \( \{P_1, P_2, \ldots, P_{9}\} \). These 9 particles are evaluated and sorted in an array A such that \( P_1 \) has highest fitness value and \( P_{9} \) has lowest fitness value. Then an array is partitioned into 3 complexes. This process is shown in Table 3.

Table 3 Partitioning of particles into 3 complexes

6.5 Complex evolution using PSO

Each complex in the sample is evaluated using PSO algorithm. From Example 2, consider complex \(C_1\) contains \(P_{1}, P_{4}, P_{7}\) particles. We have to evaluate all particles in the complex \(C_{1}\) upto maximum number of iterations T. In complex evaluation, First update each particle velocity and positions in the complex using Eqs. 7 and 8. After updating velocity and positions in D dimension of particle we may get better particle. The process of evaluating each complex using PSO shown in Fig. 4.

6.6 Complexes shuffling

The fitness value of newly generated particles has to calculate then replace complexes \(C_{1}, C_{2},\ldots, C_{N}\) into an array A. Sort an array A with descending order of their fitness value along with their position information. this process repeats until the convergence criteria satisfies (convergence criteria may be the number of evaluations or expected fitness value of the particle).

This entire process in proposed algorithm including all these steps is explained in Algorithm 1.

figure d

7 Results and discussion

7.1 Experimental setup

The experiments are performed using MATLAB 2015a on an Intel(R) Core(TM) i3 processor, 3.40 GHz CPU and 4 GB RAM running on the platform Microsoft Windows 8. The experiments are performed by assuming a WSN scenario with number of sensor nodes and gateways positioned in \(50\times 50\) m2 area with the sensing range of sensor node is 10 m. The simulation parameters for WSN and PSO-SCE algoritham are shown in Table 4.

Table 4 Simulation parameters

7.2 Performance analysis

The proposed SCE-PSO algorithm compared with state-of-the-art load balancing techniques namely, Score Based Load Balancing (SBLB), Node Local Density Load balancing (NLDLB), Simple Genetic Algorithm (SGA), Novel Genetic Algorithm (NGA). The performance of proposed load balancing algorithm is evaluated in terms of network lifetime, energy consumption, execution time, number of sensor nodes die and number of gateways die.

7.2.1 Number of sensor nodes versus network lifetime

Network lifetime is the total number of rounds from the start of the operation of a WSN until the death of the last alive gateway or sensor node. It is measured in terms of number of rounds. Experiments are performed using number of sensor nodes 50, 100 and 150 with equal and unequal load on sensor nodes. For comparison purpose we have carried out experiments using SGA, NGA, SBLB, and NLDLB and proposed algorithm. The simulation results are shown in Fig. 7(a), (b) for equal and unequal load respectively.

Fig. 7
figure 7

Comparison of the proposed SCE-PSO with SGA, NGA, SBLB, and NLDLB algorithms in terms of number of sensor nodes and network lifetime for: a Equal load and b Unequal load

It is clear from the figure that the proposed SCE-PSO has more network life as compared to SGA, NGA, SBLB, and NLDLB algorithms.. It is due to consideration of mean cluster distance, expected gateway load, heavily loaded gateways in proposed fitness function.

7.2.2 Number of sensor nodes versus execution time

Experiments are performed using number of sensor nodes 50, 100 and 150 with equal and unequal load on sensor nodes. For comparison purpose we have carried out experiments using SGA, NGA, SBLB, NLDLB and proposed algorithm. For each algorithm we calculated time required to terminate the algorithm. These comparison results are shown in Fig. 8. Figure 8(a), (b) shows the results for equal and unequal load respectively.

Fig. 8
figure 8

Comparison of the proposed algorithm with SGA, NGA, SBLB, and NLDLB algorithms in terms of number of sensor nodes and execution time for: a Equal load and b Unequal load

It is clear from figure results that for both equal and unequal loads, the proposed algorithm requires takes less time as compared to SGA, NGA, SBLB, and NLDLB algorithms. It is the fact that PSO velocity and position equations gives best particle position in less time.

7.2.3 Number of sensor nodes versus energy consumption

Energy consumption is a metric to measure the consumed energy (in Joules) per round by an algorithm. For comparison purpose SGA, NGA, SBLB, NLDLB and proposed SCE-PSO are experimented for number of sensor nodes 50, 100 and 150 with equal and unequal loads. These comparison results are shown in Fig. 9. Results for equal and unequal load are shown in Fig. 9(a), (b) respectively.

Fig. 9
figure 9

Comparison of the proposed algorithm with SGA, NGA, SBLB, and NLDLB algorithms in terms of number of sensor nodes and energy consumption for: a Equal load and b Unequal load

It is observed from the figure results that proposed SCE-PSO algorithm gives better results as compared to SGA, NGA, SBLB, and NLDLB algorithms for both equal and unequal loads. It is due to proposed fitness function considers remaining energy of gateways and expected gateway load while assigning the sensors. Hence, the solution produced by proposed algorithm is energy efficient.

7.2.4 First gateway die and half the gateways die

First gateway die is a metric measures the life span of first gateway in the network. It means number of rounds when the first gateway dies. The highest first gateway die value indicates the longer stability period of network. For comparison purpose SGA, NGA, SBLB, NLDLB and proposed SCE-PSO are experimented with 50, 100 and 150 sensor nodes and 15 maximum gateways. These experimental results are shown in Fig. 10. After how many rounds the first gateway dies and half the gateways die in the network are shown in Fig. 10(a), (b) respectively.

Fig. 10
figure 10

Comparison of network life time in terms of number of rounds using SGA, NGA, SBLB, NLDLB and proposed SCE-PSO algorithms for: a First gateway die, b half the gateways die

It is observed from the figures results that proposed SCE-PSO algorithm have highest first gateway die and half the gateways die values (in terms of number of rounds) as compared to SGA, NGA, SBLB, and NLDLB algorithms. It indicates that the proposed SCE-PSO algorithm does proper load balancing. This in turn prolongs the network lifetime.

7.2.5 First node die and half the nodes die

First node die is a metric measures the life span of first sensor node in the network. It means number of rounds when the first sensor dies. The highest first node die value indicates the longer stability period of network. For comparison purpose SGA, NGA, SBLB, NLDLB and proposed SCE-PSO are experimented with 50, 100 and 150 sensor nodes. These experimental results are shown in Fig. 11. After how many rounds the first node dies and half the nodes die in the network are shown in Fig. 11(a), (b) respectively.

Fig. 11
figure 11

Comparison of network life time in terms of number of rounds using SGA, NGA, SBLB, NLDLB and proposed SCE-PSO algorithms for: a First node die, b Half the nodes die

It is observed from the figures results that proposed SCE-PSO algorithm gives have highest first node die and half the nodes die values (in terms of number of rounds) as compared to SGA, NGA, SBLB, and NLDLB algorithms. It indicates that the proposed SCE-PSO algorithm does proper load balancing. This in turn prolongs the network lifetime.

7.3 Comparative study

A comparison of state-of-the-art load balancing algorithms and proposed algorithm is shown in Table 5. This study considers the six features related to load balancing in WSNs. It clear from the table that the proposed approach has more distinct features as compared to other state-of-the-art algorithms in the literature.

Table 5 Comparison of proposed and state-of-the-art algorithms

8 Conclusion

In this paper, SCE-PSO based clustering approach is proposed for effective gateways load balancing in WSNs. A novel fitness function is also proposed by considering load of the gateways, mean cluster distance and number of heavily loaded gateways. The proposed load balancing algorithm has been compared with state-of-the-art SGA, NGA, NLDLB and SBLB algorithms. The experimental results proved that proposed approach outperformed in terms of network lifetime, execution time, energy consumption, first gateway die, half the gateways die, first node die and half the nodes die as compared to state-of-the-art algorithms.