1 Introduction

Wireless sensor networks (WSNs) have increased overall consideration lately, especially with the expansion of micro-electro-mechanical systems (MEMS) innovation, which has energized the improvement of smart sensors. WSNs are utilized as a part of various applications, for example, environmental monitoring, medical monitoring, and so forth [1, 2]. Sensor nodes expend energy while gathering, processing and transmitting information. In the greater part of the cases, these sensor nodes are equipped with batteries which are not rechargeable. Subsequently, the power of the sensor nodes is to be utilized productively to prolong the lifetime of the network.

Cluster based design is one of the ways to deal with to save the energy of the sensor devices. Clustering in WSNs ensures essential execution accomplishment with a substantial number of sensor nodes. It also improves the scalability of WSNs. In a cluster based design, the sensor nodes are grouped together progressively in clusters. Each cluster has a cluster head (CH) which is allowed to communicate with the base station (BS) or sink. All the sensor nodes forward their detected information to the cluster head, which processes the information and sent them to a specific node called the sink [3, 4]. The greater part of the clustering convention uses two strategies for selecting cluster heads with more residual energy and for rotating cluster-heads periodically to balance energy consumption of the sensor nodes over the network [5]. But in these algorithms, they do not consider the distance to the BS which tends to die quickly because they are located relatively far from the base station. With a specific end goal to avoid this issue, some unequal clustering algorithms have been proposed in the literature [6, 7]. In unequal clustering, the network is partitioned into clusters of different sizes. The clusters near to the base station are smaller in size than the clusters far away from the base station. There are several unequal clustering algorithms are in the literature [68].

In this paper, we propose an unequal clustering algorithm based on fuzzy logic called fuzzy based unequal clustering (FBUC), which is an improvement of fuzzy energy-aware unequal clustering algorithm (EAUCF) [7]. In this work, improvement is shown by introducing one more variable called node degree in the competitive radius computation where the competition radius determines the size of the cluster. Moreover, the ordinary nodes join with the final cluster head to form the cluster by employing fuzzy logic with two variables, namely the distance to the cluster head and the degree of the cluster head.

In EAUCF, the competitive range of the tentative cluster heads is computed using fuzzy logic using residual energy and the distance to the base station of the sensor nodes. The final cluster head is selected based on the residual energy of the nodes within the same competition range. In FBUC, three fuzzy variables, namely residual energy, distance to the base station and the node degree are used for the computation of competition range. It is very important to consider the degree of the node since it improves the performance of the algorithm which in turn prolongs the network lifetime.

Once the final cluster heads are elected, the non cluster head nodes join with the cluster head, which is closest to them in EAUCF. There are many other algorithms, in which the non cluster head nodes join with the cluster heads only based on the distance. But in the unequal clustering, cluster size near the base station is the small and cluster size far from the base station is big. So if more number of nodes are close to the cluster near the base station, then the energy of the cluster head depletes very quickly since many nodes close to the cluster head join in the cluster.

To overcome this issue, we propose a novel approach in the joining of non cluster head nodes with the cluster head. In this work, once the final cluster head is elected, using fuzzy logic the non cluster head nodes join the cluster head to form the cluster based on the distance to the cluster head and cluster head degree. Here, the cluster head degree is the ratio of the number of nodes within its competition range of the total number of nodes. The major advantages of the proposed system are reduction in transmission delay, an enhanced life time of node and reduced power consumption.

The rest of this paper is organized as follows: In the next section, the research work carried out related to the proposed approach is briefly explained. In Sects. 3 and 4, our proposed work is explained in detail. In Sect. 5, evaluation of the proposed work and the detailed evaluation results and discussions are given. Finally, we conclude the paper with the some future work in Sect. 6.

2 Related works

Many works on the wireless networks and wireless sensor networks are found in the literature [919]. Other areas in the wireless networks includes MAC protocols in WSN and underwater sensor networks [20], routing and scheduling for green vehicular delay tolerant networks [21], service configuration and traffic distribution in composite radio environments [22] and trust management for internet of things [23]. In designing the WSN, the energy is the most imperative resource since the lifetime of the sensor node is restricted by its battery life. Cluster based design is one of the ways to deal with to save the energy of the sensor devices. Many clustering algorithms are in the literature [2429]. LEACH [26] is the most important and standard protocol amongst the most well known clustering systems. It elects a cluster head based on probability model. Most of the algorithms consider the conservation of the energy only by the cluster head election. But, they do not consider the pattern of members joining the cluster.

In [30], the network is divided into primary and secondary tiers and it selects the primary cluster heads in the primary tier at the nearest distance of the BS for transmission. It minimizes the energy depletion in the cluster heads by considering the transmission distance between cluster head nodes and the BS. It also calculates the number of cluster heads dynamically as indicated by the quantity of alive nodes in the system. In [31], by using fuzzy logic for computing the chance of being clustered head, the algorithm prolongs the network lifetime. They used energy and local distance as fuzzy sets. In [32] cluster head election is made by using fuzzy logic to overcome the defects of LEACH. In their work, three fuzzy variables, namely concentration, energy and centrality are used for the cluster head election.

Normally, most of the clustering approaches use the selection of the cluster head with more residual energy. But in [5], the authors employed fuzzy logic for the cluster head selection by considering the expected residual energy for being selected as a cluster head.

In [8], tentative cluster head is elected based on the residual energy of the nodes. A fuzzy logic is employed by the authors for electing a final cluster head and non-CH also use this fuzzy cost to connect with the cluster head. Fuzzy cost is computed based on the node degree and node centrality. A stability analysis of the simplest Takagi–Sugeno fuzzy control system using circle criterion is also studied in [33]. In FLCFP [34] also, the fuzzy logic inference system is used for the cluster formation process. Each non cluster head node uses a fuzzy system with three variables, namely residual energy, distance to the BS and distance to the cluster head for selection of cluster head to join with it as a cluster member. These two algorithms are used in the normal cluster formation, but not for the unequal clustering process.

In [6], clustering gives a successful approach for dragging out the lifetime of a WSN. It partitions the nodes into clusters of unequal size and the cluster closer to the BS has smaller size than those farther away from the BS. Hence, cluster head closer to the BS can protect some power of the inter-cluster information sending. The node’s competition range diminishes as its separation to the base station diminishes. So, the outcome is that clusters closer to the base station are relied upon to have a little cluster sizes, therefore they will devour lower power during the intra-cluster information preparing and can protect some more power for the inter-cluster transfer. Inappropriate cluster development may bring about a few CHs over-burden. Such over-burden may build latency in correspondence, devours high power of the cluster head and degrade the general execution of the WSN. Consequently, load adjusting of the CHs is the most imperative issue for clustering sensor nodes. So, in [3], the authors proposed a genetic algorithm based load balanced clustering algorithm for WSN.

In [7], the authors proposed an algorithm for unequal clustering. In their work, they used fuzzy logic to compute the competition range by considering the distance to the BS and residual energy. The final cluster head is elected by selecting a node with the highest residual energy within the competition radius. Once the cluster head is elected, the non-cluster head nodes join with the cluster head nearest to them. The main problem here is the energy depletion at the cluster head.

To overcome this issue, we have proposed an algorithm called fuzzy based unequal clustering (FBUC) in which the non-cluster head nodes join with the cluster head based on the distance to the cluster head and the cluster head’s competition range. In this work, fuzzy logic is employed for the nodes to join with the cluster head. This algorithm conserves more energy in the intra-cluster as well as in the inter-cluster data forwarding process.

3 System model

The basic system model of this work consists of sensor nodes, which are deployed to monitor an environment. The assumptions that are made in our work are:

  1. 1.

    WSN comprises of homogeneous sensor nodes and have same initial energy.

  2. 2.

    Sensor nodes are deployed arbitrarily.

  3. 3.

    All the sensor nodes and base station are kept stationary once they are deployed.

  4. 4.

    Nodes are energy constrained and are left unattended after deployment. In this way, battery recharge is impractical.

  5. 5.

    The distance between nodes is computed based on the received signal strength.

  6. 6.

    The base station is situated inside of the WSN.

The sensor nodes in the WSN form a cluster of different sizes. Each cluster has a cluster head. The information sensed by the sensor nodes is transmitted to the sink through the cluster head. Each sensor node can operate in sensing mode or relay mode. The cluster head in the relay mode gathers the data from its cluster members, compresses and forwards the compressed data to the base station. Since most of the energy of the sensor nodes are wasted in transmission, we have concentrated much on the energy optimization of the sensor node. The energy model used in our work is similar to the works presented in [34, 35]. Moreover, its behavior are based on the Eqs. (1) and (2). The Eelec, εfs and εmp are the electronics energy and the amplifier energy in free space and multipath respectively.

The transmission energy needed for an l-bit message more than a separation d is as per the separation d is as per the following:

$${\text{E}}_{\text{T}} \left( {{\text{l}},{\text{d}}} \right) = \left\{ {\begin{array}{l} {{\text{l E}}_{\text{elec}} + {\text{l}} \upvarepsilon_{\text{fs}} {\text{d}}^{2} \quad {\text{for}}\quad {\text{d}} < {\text{d}}_{0} } \\ {{\text{l E}}_{\text{elec}} + {\text{l}} \upvarepsilon_{\text{mp}} {\text{d}}^{4} \quad {\text{for}}\quad {\text{d}} \ge {\text{d}}_{0} } \\ \end{array} } \right.$$
(1)

where \(d_{0} = \sqrt {\varepsilon_{fs} /\varepsilon_{mp} }\).

The reception energy required for an l-bit message is as follows:

$${\text{E}}_{\text{R}} (1) = {\text{l E}}_{\text{elec}} .$$
(2)

4 Unequal clustering using fuzzy logic

In this section, the unequal clustering algorithm using fuzzy logic is described. It is an improved version of fuzzy energy-aware unequal clustering algorithm (EAUCF) [7]. We improved the performance of the EAUCF algorithm in three ways. First, by using the probabilistic threshold value instead of predefined threshold value. Second, in the cluster head election, we used three fuzzy variables instead of two variables. Third in the non-cluster head, nodes joining with the cluster head nodes are also considered and we used fuzzy logic with two variables.

FBUC is a distributive unequal clustering algorithm. It works in rounds as LEACH. The main flow of the algorithm is given in Algorithm 1. In every round, initial tentative cluster heads are chosen by creating an arbitrary number for each node. If the generated arbitrary number is less than the probability value (TH) of the nodes given in Eq. (3), then it becomes a tentative cluster head.

Algorithm 1 Fuzzy based unequal clustering algorithm
$${\text{TH}} = {\text{P}}/(1 - {\text{P}}*({\text{r}}\,\bmod \,1/{\text{P}}))$$
(3)

where r is current round number, P is desired percentage of cluster head (e.g. P = 0.05).

Like EAUCF, the fuzzy logic approach is used for calculating the competition radius of each tentative cluster head node. To calculate competition radius, EAUCF uses two linguistic variables, namely separation to the base station and current energy level of the node. However, in this work we used three linguistic variables, two as in EAUCF and the third variable tentative cluster head node degree.

In EAUCF, they concentrated only on the energy of a node for computing competition radius. But, it is necessary to decrease the service area of a cluster head when the battery power is low and the number of neighbors are high. So in this work, we used degree of the node also as one factor for computing the competition radius. The main advantage of using this variable is when the node degree increases, it decreases the competition radius. The three fuzzy variables used in this work are distant to the BS, residual energy of the tentative cluster head and node degree of the tentative cluster head.

The fuzzy input variables and its linguistic variables used for competition radius computation are given below. The third variable Node degree is newly proposed in this work.

  • Distance_BS—(close, medium, far)

  • Residual energy—(low, medium, high)

  • Node degree—(low, medium, high)

The trapezoidal membership function is used for boundary variables and triangular membership function is used for intermediate variables.

The fuzzy output variable is competition radius of the tentative cluster head. The nine linguistic variables used for output variable are very small, small, rather small, medium small, medium, medium large, rather large, large and very large given in Fig. 4. The trapezoidal function is used for very small and very large. The other linguistic variables use triangular membership function. Fuzzy if–then rules to compute competition radius are given in Table 1.

Table 1 Fuzzy rules (competition radius)

The triangular membership function and trapezoidal membership function used in our fuzzy inference system are given in Eqs. (4) and (5).

$$\mu_{A1 } (x) = \left\{ {\begin{array}{*{20}l} 0 \hfill & {x \le a1} \hfill \\ {\frac{x - a1}{b1 - a1}} \hfill & {a1 \le x \le b1} \hfill \\ {\frac{c1 - x}{c1 - b1}} \hfill & { b1 \le x \le c1} \hfill \\ 0 \hfill & {c1 \le x} \hfill \\ \end{array} } \right.$$
(4)
$$\mu_{A1 } \left( x \right) = \left\{ {\begin{array}{*{20}l} {0,} \hfill & {x \le a2} \hfill \\ {\frac{x - a2}{b2 - a2},} \hfill & {a2 \le x \le b2} \hfill \\ {1,} \hfill & { b2 \le x \le c2} \hfill \\ {\frac{d2 - x}{d2 - c2},} \hfill & {c2 \le x \le d2} \hfill \\ {0,} \hfill & { d2 \le x} \hfill \\ \end{array} } \right.$$
(5)

Two rules are given below for the extreme cases:

  • If the tentative cluster head is far from the BS and high residual energy and low node degree, then it has very large competition radius.

  • If the tentative cluster head is close to the BS and residual energy is low and node degree is high, then it has very small competition radius.

After the competition radius for each tentative cluster head is computed, the final cluster head is elected within the maximum competition radius with high residual energy. Once the final cluster head is elected, the non cluster head nodes should join with the cluster head for data transmission. In [7] and in other works [6, 26, 31, 34], the sensor nodes join with the closest cluster head. But in unequal clustering, if more number of nodes is near to the cluster head, which has small competition radius, then the cluster head will depletes its energy more quickly, because it has low energy and it is very near to the base station.

In this work, once the final cluster head has been elected, the non-CH members join the cluster head not only based on the distance to the cluster head but also on the CH-degree, the ratio of the number of nodes within the competition radius to the total number of nodes. Here, once again the fuzzy logic is employed for uncertainty. The main advantage is it extends the lifetime of the cluster head nodes near the base station.

The fuzzy input variables and its linguistic variables used for determining cluster head are given below:

  • Distance—(close, medium, far)

  • CH_Node_Degree—(low, medium, high)

The trapezoidal member function is used for the boundary variables and the triangular function is used for the intermediate variables.

The linguistic variables used for the output variable cluster head choice are very large, large, rather large, medium large, medium, medium small, rather small, small and very small. The trapezoidal function is used for very small and very large. The other linguistic variables use triangular membership function. The fuzzy IF–THEN rules for cluster head choice are given in Table 2.

Table 2 Fuzzy rules (CH_Choice)

Some of the rules of determining the cluster head choice are

  • If the distance to the cluster head is close and cluster head degree is low, then the choice is very large

  • If the distance to the cluster head is far and cluster head degree is high then choice is very small.

For both the fuzzy logic we used Mamdani inference system [7, 31, 32, 34] which is very simple and most commonly used method and for defuzzification the center of area (COA) method is used which is given in Eq. (6).

$$COA = \frac{{\smallint \mu_{A } \left( x \right).x dx}}{{\smallint \mu_{A } \left( x \right)dx}}$$
(6)

4.1 Illustration

Consider the minimum and maximum value given in Table 3 for the input variables of fuzzy logic control for the computation of competition radius.

Table 3 Fuzzy input variables and their minimum and maximum values for competition radius

Now consider the input range for each input variable of fuzzy logic control as shown in Table 4. Its corresponding fuzzy sets are given in Figs. 1, 2 and 3.

Table 4 Fuzzy variable ranges for different inputs
Fig. 1
figure 1

Fuzzy set for fuzzy input variable distance to the BS

Fig. 2
figure 2

Fuzzy set for fuzzy input variable residual energy

Fig. 3
figure 3

Fuzzy set for fuzzy input variable node degree

For example, consider Distance_BS = 161, residual energy = 0.7 and node degree = 0.5

The linguistic values are (far) for Distance_BS, (medium, high) for residual energy and (medium, high) for node degree.

Fuzzy rules from Table 1 are:

  • Rule 1: If Distance_BS is far and residual energy is medium and node degree is medium then competition radius is large.

  • Rule 2: If Distance_BS is far and residual energy is medium and node degree is high then competition radius is rather large.

  • Rule 3: If Distance_BS is far and residual energy is high and node degree is medium then competition radius is large.

  • Rule 4: If Distance_BS is far and residual energy is high and node degree is high then competition radius is rather large.

Apply trapezoidal member function to the linguistic value far.

X = 161

$$\begin{aligned} f\left( {x;a,b,c,d} \right) & = { \hbox{max} }\left( {\hbox{min} \left( {\frac{x - a}{{b {-}a}}, 1,\frac{d - x}{d - c}} \right), 0} \right) \\ f\left( {x;a,b,c,d} \right) & = { \hbox{max} }\left( {\hbox{min} \left( {\frac{161 - 70}{{130 {-}70}}, 1,\frac{163 - 161}{163 - 160}} \right), 0} \right) \\ & = { \hbox{max} }\left( {{ \hbox{min} }\left( {1.52, \, 1, \, 0.67} \right),0} \right) \\ & = { \hbox{max} }\left( {0.67, \, 0} \right) \\ & = 0.67 \\ \end{aligned}$$

Apply triangular member function to the linguistic value medium and high of residual energy.

X = 0.7 (medium)

$$\begin{aligned} f\left( {x;a,b,c} \right) & = { \hbox{max} }\left( {\hbox{min} \left( {\frac{x - a}{{b {-}a}}, \frac{c - x}{c - b}} \right), 0} \right) \\ f\left( {x;a,b,c} \right) & = { \hbox{max} }\left( {\hbox{min} \left( {\frac{0.7 - 0.1}{{0.5 {-}0.1}},\frac{0.8 - 0.7}{0.8 - 0.5}} \right), 0} \right) \\ & = { \hbox{max} }\left( {{ \hbox{min} }\left( {1.5, \, 0.33} \right),0} \right) \\ & = 0.33 \\ \end{aligned}$$

X = 0.7 (high)

$$\begin{aligned} f\left( {x;a,b,c,d} \right) & = { \hbox{max} }\left( {\hbox{min} \left( {\frac{x - a}{{b {-}a}}, 1,\frac{d - x}{d - c}} \right), 0} \right) \\ f\left( {x;a,b,c,d} \right) & = { \hbox{max} }\left( {\hbox{min} \left( {\frac{0.7 - 0.5}{0.9 - 0.5}, 1,\frac{1.1 - 0.7}{1.1 - 1}} \right), 0} \right) \\ & = { \hbox{max} }\left( {{ \hbox{min} }\left( {0.5, \, 1, \, 4} \right),0} \right) \\ & = { \hbox{max} }\left( {0.5, \, 0} \right) \\ & = 0.5 \\ \end{aligned}$$

Similarly, apply triangular member function to the linguistic value medium and high of node degree.

X = 0.5 (medium)

$$\begin{aligned} f\left( {x;a,b,c} \right) & = { \hbox{max} }\left( {\hbox{min} \left( {\frac{x - a}{{b {-}a}}, \frac{c - x}{c - b}} \right), 0} \right) \\ f\left( {x;a,b,c} \right) & = { \hbox{max} }\left( {\hbox{min} \left( {\frac{0.5 - 0.15}{{0.35 {-}0.15}},\frac{0.55 - 0.5}{0.55 - 0.35}} \right), 0} \right) \\ & = { \hbox{max} }\left( {{ \hbox{min} }\left( {1.75,0.25} \right),0} \right) \\ & = \, 0.25 \\ \end{aligned}$$

X = 0.5 (high)

$$\begin{aligned} f\left( {x;a,b,c,d} \right) & = { \hbox{max} }\left( {\hbox{min} \left( {\frac{x - a}{{b {-}a}}, 1,\frac{d - x}{d - c}} \right), 0} \right) \\ f\left( {x;a,b,c,d} \right) & = { \hbox{max} }\left( {\hbox{min} \left( {\frac{0.5 - 0.35}{0.55 - 0.35}, 1,\frac{1.1 - 0.5}{1.1 - 1}} \right), 0} \right) \\ & = { \hbox{max} }\left( {{ \hbox{min} }\left( {0.75, \, 1, \, 6} \right),0} \right) \\ & = { \hbox{max} }\left( {0.75, \, 0} \right) \\ & = 0.75 \\ \end{aligned}$$

Applying values in the fuzzy rules:

  • Rule 1: min(0.67, 0.33, 0.25) = 0.25

  • Rule 2: min(0.67, 0.33, 0.75) = 0.33

  • Rule 3: min(0.67, 05, 0.25) = 0.25

  • Rule 4: min(0.67, 0.5, 0.75) = 0.5

Maximum of Rule 1 to Rule 4 is 0.5 which is rather large which crisp value lies between 60 and 80 (Fig. 4).

Fig. 4
figure 4

Fuzzy set for fuzzy output variable competition radius

For defuzzification the fuzzy output is given as input to COA.

Therefore, competition radius = 73.84.

Similarly, consider the minimum and maximum value given in Table 5 for the input variables of fuzzy logic control for the determining CH. Now, consider the input range for each input variable of fuzzy logic control as shown in Table 6 and its corresponding fuzzy sets are given in Figs. 5 and 6.

Table 5 Fuzzy input variables and their minimum and maximum values for competition radius
Table 6 Fuzzy variable ranges for different inputs
Fig. 5
figure 5

Fuzzy set for fuzzy input variable distance to the CH

Fig. 6
figure 6

Fuzzy set for fuzzy input variable cluster head node degree

Consider the following example, distance = 92, CH_Node_degree = 0.2

The linguistic values are (medium, far) for distance, (low, medium) for CH_Node_degree.

Fuzzy rules from Table 2 are:

  • Rule 1: If distance is medium and CH_Node_Degree is low then CH_Choice is medium large

  • Rule 2: If distance is medium and CH_Node_Degree is medium then CH_Choice is medium

  • Rule 3: If distance is far and CH_Node_Degree is low then CH_Choice is rather small

  • Rule 4: If distance is far and CH_Node_Degree is medium then CH_Choice is small

Apply triangular member function to the linguistic value medium for distance.

X = 92

$$\begin{aligned} f\left( {x;a,b,c} \right) & = { \hbox{max} }\left( {\hbox{min} \left( {\frac{x - a}{{b {-}a}}, \frac{c - x}{c - b}} \right), 0} \right) \\ f\left( {x;a,b,c} \right) & = { \hbox{max} }\left( {\hbox{min} \left( {\frac{92 - 40}{{80 {-}40}},\frac{120 - 92}{120 - 80}} \right), 0} \right) \\ & = { \hbox{max} }\left( {{ \hbox{min} }\left( {1.3,0.7} \right),0} \right) \\ & = 0.7 \\ \end{aligned}$$

Now, we apply trapezoidal member function to the linguistic value far for distance

X = 92

$$\begin{aligned} f\left( {x;a,b,c,d} \right) & = { \hbox{max} }\left( {\hbox{min} \left( {\frac{x - a}{{b {-}a}}, 1,\frac{d - x}{d - c}} \right), 0} \right) \\ f\left( {x;a,b,c,d} \right) & = { \hbox{max} }\left( {\hbox{min} \left( {\frac{92 - 80}{{120 {-}80}}, 1,\frac{253 - 92}{253 - 250}} \right), 0} \right) \\ & = { \hbox{max} }\left( {{ \hbox{min} }\left( {0.3, \, 1, \, 53.67} \right),0} \right) \\ & = 0.3 \\ \end{aligned}$$

Similarly, we apply triangular member function to the linguistic value medium and trapezoidal for low for the variable CH_degree.

X = 0.2 (low)

$$\begin{aligned} f\left( {x;a,b,c,d} \right) & = { \hbox{max} }\left( {\hbox{min} \left( {\frac{x - a}{{b {-}a}}, 1,\frac{d - x}{d - c}} \right), 0} \right) \\ f\left( {x;a,b,c,d} \right) & = { \hbox{max} }\left( {\hbox{min} \left( {\frac{0.2 + 1}{0 + 1}, 1,\frac{0.35 - 0.2}{0.35 - 0.15}} \right), 0} \right) \\ & = { \hbox{max} }\left( {{ \hbox{min} }\left( {1.2, \, 1, \, 0.75} \right),0} \right) \\ & = 0.75 \\ \end{aligned}$$

X = 0.2 (medium)

$$\begin{aligned} f\left( {x;a,b,c} \right) & = { \hbox{max} }\left( {\hbox{min} \left( {\frac{x - a}{{b {-}a}}, \frac{c - x}{c - b}} \right), 0} \right) \\ f\left( {x;a,b,c} \right) & = { \hbox{max} }\left( {\hbox{min} \left( {\frac{0.2 - 0.15}{{0.35 {-}0.15}},\frac{0.55 - 0.2}{0.55 - 0.35}} \right), 0} \right) \\ & = { \hbox{max} }\left( {{ \hbox{min} }\left( {0.25, \, 1.75} \right),0} \right) \\ & = 0.25 \\ \end{aligned}$$

Applying values in the fuzzy rules:

  • Rule 1: min(0.7, 0.75) = 0.7

  • Rule 2: min(0.7, 0.25) = 0.25

  • Rule 3: min(0.3, 0.75) = 0.3

  • Rule 4: min(0.3, 0.25) = 0.25

Maximum of Rule 1 to Rule 4 is 0.7 which is medium large which crisp value lies between 35 and 65 (Fig. 7).

Fig. 7
figure 7

Fuzzy set for fuzzy output variable cluster head choice

For defuzzification the fuzzy output is given as input to the COA.

Therefore CH_choice = 37.5.

5 Simulation results and discussions

The proposed fuzzy based unequal clustering algorithm has been evaluated using MATLAB since the MATLAB Fuzzy Tool box considers all types of fuzzy membership functions and hence is more suitable for implementation. We considered 100 sensor nodes deployed over an area of (200 × 200) m2. We assumed the initial energy of each sensor node as 0.5 J. The simulation parameters used in our system are given in Table 7.

Table 7 Simulation parameters

We have tested the proposed algorithm extensively and the experimental results are presented. We considered two different network scenarios WSN#1 and WSN#2. Both the scenarios have the same sensing field as mentioned above. For the WSN#1, the position of the sink was taken at (100, 100) and for the WSN#2, the position of the sink was taken at (100, 250). FBUC is compared with LEACH and EAUCF algorithms. Experimental results show that the proposed algorithm performs better than LEACH and EAUCF in both the scenarios.

Figure 8 is presents with the number of alive nodes for different number of rounds. From the figure, we can observe that our proposed algorithm performs better than the other two algorithms. Among these three algorithms LEACH has less performance in both the scenarios. In WSN#1, for 1000 rounds in LEACH only 24 nodes are alive, and in EAUCF only 43 nodes are alive but in our proposed algorithm 84 nodes are alive and similarly for WSN#2, in LEACH the nodes starts to drain out their energy in 200 rounds itself. But in EAUCF at 600 rounds, the nodes start to die. For 1000 rounds, in LEACH only 14 nodes remain alive; in EAUCF 54 nodes are alive and in our proposed work 72 nodes alive. The reason for this is in LEACH, it does not consider the residual energy of the nodes, in EAUCF it considers the residual energy level of the nodes in the computation of competition radius. But in FBUC, in addition to the residual energy, it also considers the node degree in the competition radius computation. So if the tentative cluster head has more energy and lower degree then it has a greater cluster range. It can balance the load within the region. In LEACH and EAUCF, the ordinary nodes join the cluster head, which is closest to them. But in FBUC, non cluster head nodes join the cluster head based on cluster head degree and distance to the cluster head. Here in this work, since we are considering the cluster head degree, not more number of nodes join with the same cluster head. So the energy of cluster head is conserved, which prolongs the time of first node to die.

Fig. 8
figure 8

Distribution of alive sensor nodes in a WSN#1 and b WSN#2

Figure 9(a) and (b) shows the maximum number of clusters formed with respect to the number of rounds for both scenarios WSN#1 and WSN#2, respectively. In both the scenarios, again LEACH shows less performance than the other two algorithms. The number of clusters generated by EAUCF and LEACH is less than FBUC. This is because the competition radius is based on the node degree and energy level of the node. Here, even though the energy level is directly proportional to the competition radius, the node degree is inversely proportional to the competition radius. If the node degree is high, it increases the number of clusters to be formed.

Fig. 9
figure 9

Maximum number of clusters formed in a WSN#1 and b WSN#2

The network lifetime, the time duration until the first node dies is analyzed for both the scenarios WSN#1 and WSN#2 and the results are presented in the Fig. 10(a) and (b), respectively. It is clear from the figure that our proposed algorithm performs better than the other two algorithms. In all the three algorithms, as the number of nodes increases, the network lifetime decreases. But when compared to LEACH and EAUCF our proposed work performs better than LEACH and EAUCF. The justification behind this it conserves more energy during the computation of competition radius consideration of energy level and node degree. When the node has a higher energy level then the competition radius of it is high, but to balance the energy the node degree also considered.

Fig. 10
figure 10

Network lifetime (in rounds) in a WSN#1 and b WSN#2

In the cluster formation, the distance to the cluster head and also the cluster head degree are considered. When the energy level of the cluster head is very low, then small cluster will be formed. So based on the cluster head degree, the members join with the cluster head to balance the energy of the cluster head. This results in prolonged network lifetime in our work than in LEACH and EAUCF.

In Fig. 11(a) and (b), the average residual energy with respect to the number of rounds is presented. It can be observed from the figure that our proposed algorithm has more residual energy than the other two algorithms. This is because LEACH does not consider the energy level of the nodes, EAUCF considers the energy level, but it is not balanced among the clusters.

Fig. 11
figure 11

Average residual energy in a WSN#1 and b WSN#2

But in FBUC, in addition to the energy level, the cluster head degree, is also considered in the cluster formation. This results in the distribution of energy evenly among the cluster head and has high residual energy in FBUC. In FBUC only 68.04 % of energy is used for 1000 rounds, but in EAUCF and LEACH 89.36 and 97.14 % used respectively.

Two metrics, namely first node dies (FND), which is the period from the start of the network operation until the first node dies and the last node dies (LND), which is the time interval from the start of the network operation until the last node dies [36] are analyzed. Table 8 shows the performance of LEACH, EAUCF and FBUC algorithm considering the FND and LND metrics in both the scenarios. Figure 12(a) and (b) shows the rounds graphically in which the FND and LND for each algorithm in both the scenarios WSN#1 and WSN#2. From the figure, it can be observed that FBUC outperforms LEACH and EAUCF. According to FND metric in WSN#1, FBUC is more efficient than LEACH about 55.7 % and EAUCF about 9.2 %. On the other hand, if LND metric in WSN#1 is considered, the performance of FBUC is greater than LEACH about 42.06 % and EAUCF about 7.3 %. Similarly, Fig. 12(b) shows that FBUC outperforms LEACH and EAUCF. This is because, if the smaller cluster radius are assigned to the cluster head closer to the base station and the number of members join with the cluster head to balance the load on the cluster head, delayed the death of the first sensor node and last sensor node.

Table 8 Values of FND and LND for WSN#1 and WSN#2
Fig. 12
figure 12

FND and LND in a WSN#1 and b WSN#2

In both the scenarios EAUCF perform better than LEACH. This is because the power of the sensor nodes near the base station depletes faster. In EAUCF and FBUC handled this situation by assigning smaller cluster sizes near the base station. Since FBUC considers the energy level and node degree of the tentative cluster head for the competition radius calculation and in the members joining process it considers the distance as well as the cluster head degree, the performance of FBUC is quite better than EAUCF. The values of FND and LND metrics for each algorithm in WSN#2 decrease with respect to WSN#1 because the base station is located outside of the WSN. Thus, the cluster heads consume much more energy to transmit their packets to the base station.

6 Conclusion

In WSN design, conservation of energy is a major issue. In this paper, we propose a fuzzy logic based unequal clustering algorithm in which final cluster is elected considering the energy level of the tentative cluster head within the cluster radius computed based on residual energy and node degree of the tentative cluster heads. The members join the cluster head based on distance and cluster head degree to utilize the energy efficiently and to extend the network lifetime. Through simulations using MATLAB, the proposed algorithm is evaluated. From the simulation results, the performance of the proposed algorithm is examined with LEACH and EAUCF. The results show that the proposed algorithm performs better than the other algorithms in terms of energy consumption and system lifetime.