1 Introduction

Recent technological advancements pave the way for the emergence of wireless sensor networks (WSNs) [1] that are envisaged to become the fabric of our environment and society through enormous range of applications. The example range of applications include military (e.g., homeland security, battlefield reconnaissance, landmine detection, and deactivation), health care (e.g., patient health and behavior monitoring) [2], critical infrastructure protection (e.g., oil and gas pipeline monitoring and maintenance) [3, 4], and civilian (e.g., disaster management). Most of these applications employ stringent resource-constrained sensors that report data to the base stations (BS) either directly or indirectly through cluster heads (CHs). However, due to random deployment of these nodes, network connectivity and network coverage are the two major issues [5]. Moreover, it is also not possible to recharge or replace the battery of already deployed nodes [1]. Therefore, most applications of WSN necessitates energy-efficient network operation to stay functional for a long time.

Communication is the major energy guzzler, and nodes dissipate most of their energy in routing information from sensor nodes to the BS. Instead of direct transmission, sensor nodes prefer to use multi-hop communication because of limited energy and range. Existing routing algorithms can either be categorized into centralized and distributed. The former requires entire network state information and thus is not feasible due to high communication cost. The latter only requires a very limited network information and is more practical [6, 7]. In fact, the distributed algorithms use the concept of per node/group/cluster knowledge sharing in a systematic order.

In contrast to conventional networks, sensor networks show a unique set of asymmetric traffic patterns. This is at large due to the functions of WSN, i.e., nodes persistently send sensed data to the BS, and BS occasionally sends control messages to nodes. In addition, a wide range of applications cause asymmetry in traffic as well. In this context, the traffic of WSNs fall to one of the two categories: single hop and multi-hop. Where the multi-hop category can be further divided on the basis of the number of transmit/receive nodes [2].

Routing protocols, specially cluster-based techniques, play an important role while achieving energy efficiency. According to this technique, members of the same cluster select a CH [8, 9] and nodes belonging to that cluster send sensed data to the CH which forwards the aggregated data to the BS [1012]. Energy-efficient, lifetime balancing data collection techniques like [13] can be utilized here. Clustering can be implemented either in homogeneous or heterogeneous WSNs; in homogeneous networks, nodes are equipped with the same energy level, and in heterogeneous networks, these levels differ. Low-energy adaptive clustering hierarchy (LEACH) [11] is designed for homogenous WSNs; however, this algorithm performs poor in heterogeneous networks because the low-energy nodes die more quickly than the high-energy ones due to the fact that the clustering algorithm does not have in built discrimination in terms of energy levels. Stable election protocol (SEP) [14], distributed energy-efficient clustering (DEEC) [15], developed DEEC (DDEEC) [16], and enhanced DEEC (EDEEC) [17] are examples of heterogenous WSN protocols.

This paper presents three major contributions for WSNs. The first is a heterogeneous network model, the second is an energy consumption model, and the last is an EDDEEC routing protocol. The newly proposed routing protocol, EDDEEC, is evaluated using three types of nodes (three-level heterogeneous network model): normal, advanced, and super. The proposed protocol selects CHs on the basis of nodes’ residual energy. Super and advanced nodes have more energy than the normal ones. So, the super and advanced nodes are largely preferred to be selected as CHs for the initial transmission rounds, and when their energy decreases to the same level as that of the normal ones, these nodes will have the same CH election probability like the normal nodes. Therefore, energy is efficiently distributed over the network. EDDEEC prolongs the network lifetime, especially the stability period, by heterogeneity-aware clustering algorithm. Simulation results show that EDDEEC achieves longer stability period, network lifetime, and throughput than the other classical clustering algorithms in three-level and multi-level heterogeneous environments.

The remainder of the paper is organized in the following manner. Section 2 includes the related work, section 3 deals with motivation, section 4 presents our proposed work, section 5 discusses the simulation results, and section 6 concludes the paper.

2 Related Work

As mentioned earlier, clustering techniques could be implemented in homogeneous as well as heterogeneous networks. This section provides the related research work in detail.

Heinzelman et al. [11] introduce a clustering algorithm for homogeneous WSNs known as LEACH in which nodes randomly select themselves as CHs such that the criteria remains the same throughout the network lifetime.

Smaragdakis et al. [14] proposed a two-level hierarchical heterogeneous network model in which every node independently elect itself a CH based on the initial energy relative to other nodes.

DEEC protocol is proposed in [15]. In this protocol, CH selection is based on probability which depends upon the residual energy of nodes and average energy of the network.

DDEEC selects CHs on the basis of nodes’ residual energy [16]. This protocol, dynamically changes the CH selection criteria for nodes according to their residual energy.

Saini and Sharma [17] proposed EDEEC protocol which extended to three-level heterogeneity by adding an extra energy level as compared to SEP, DEEC, and DDEEC. The nodes are categorized as normal, advanced, and super. However, the CHs selection probabilities are not adjusted according to nodes’ energy levels.

In [18], authors propose stochastic distributed energy-efficient clustering (SDEEC) routing protocol for heterogeneous WSNs. This protocol introduces a balanced CHs selection method. Since this protocol uses stochastic detection technique, thereby, it is more efficient in terms of energy efficiency as compared to the mentioned previous protocols.

Link-aware clustering mechanism (LCM) has been proposed in [19]. This technique determines a reliable and energy-efficient routing path. Based on the link condition and node status, the LCM uses a clustering metric known as predicted transmission count (PTX). The PTX holds a key role in the formation of clusters.

Authors in [20] propose a k-connected overlapping approach for clustering in WSNs. This energy-aware approach selects CHs on the basis of energy availability status of the nodes.

Yang et al. [21] aims to maximize the network lifetime by utilizing the concept of a two-layer WSN architecture. The algorithm builds routes on the basis of geographic deployment knowledge. Linear programming-based mathematical formulation is carried out to min-max communication energy and max-min residual energy consumption of nodes. Simulation results show that the proposed protocol achieves energy efficiency to some extent.

Zytoune et al. in [22] propose a routing protocol for WSNs. This protocol is based on the consideration of residual energy of nodes and the required transmission energy of the path from source to destination. These two considerations ensure almost even distribution of load among the nodes. As per their simulation results, the proposed protocol is more energy efficient in comparison to the existing MLER protocol.

Authors in [23] propose self-organized and smart adaptive clustering (SOSAC) protocol for WSNs. The proposed algorithm is composed of three submechanisms. These three sub-mechanisms are used to change fitness value with respect to time. From fitness value, back up routing information for any potential breakdown in the network can be easily extracted. The proposed SOSAC routing protocol, as per simulation results, is more energy efficient as compared to selected existing routing protocols.

In [24], authors propose an energy-efficient cluster formation-based algorithm for WSNs. The authors claim that this algorithm can respond quickly to unexpected event(s) without compromising on the energy efficiency of nodes. Moreover, the proposed algorithm is based on a regional competition scheme, where nodes individually detect events and then create clusters. These claims have been justified via simulation results.

In [25], the basic assumption state that the residual energy of nodes follow a random distribution. Based on this assumption, clustering is performed by the algorithm while ensuring balanced load on the nodes. Unlike the other existing works, this algorithm takes into consideration the relative distance between nodes and their density subject to CHs selection. Simulation results of this paper show that the algorithm is fruitful in terms of network lifetime extension.

3 Motivation

In DEEC, CHs selection probability for advanced nodes is higher than that of the normal ones, and in EDEEC, CHs selection probability for super and advanced nodes is higher than that of the normal nodes. DEEC continues to punish just advanced nodes, and EDEEC continues to punish super and advanced nodes even when these have the same energy level as the normal nodes. Therefore, in EDEEC, both super and advanced nodes die more quickly as compared to the normal ones. This is not the optimal way for energy distribution throughout the network. Therefore, EDDEEC (our proposed protocol) suggests some changes in the probability function for the selection of CHs.

4 Energy-efficient distributed clustering algorithm

In this section, we discuss our proposed work in detail. We begin with the proposition of three level heterogeneous WSN model, followed by our proposed energy consumption model, and finally, the newly proposed EDDEEC routing protocol.

4.1 Heterogeneous network model

Heterogeneous WSNs may contain two, three, or multi-types of nodes with respect to their energy levels and termed as two, three, or multi-level heterogeneous WSNs, respectively.

EDDEEC considers three-level heterogeneous network that contains three different energy levels of nodes: normal, advanced, and super. Normal nodes have E 0 energy. Advanced nodes of fraction m have a times more energy than normal nodes, i.e., E 0(1+a). Whereas, super nodes of fraction m 0 have b times more energy than the normal ones, i.e., E 0(1+b). As N is the number of nodes in the network, then N m m 0, N m(1−m 0), and N(1−m) are the numbers of super, advanced, and normal nodes in the network, respectively.

The total initial energy of super nodes in WSN is as follows:

$$\begin{array}{@{}rcl@{}} E_{\text{super}}=N m m_{0}E_{0}(1+b) \end{array} $$
((1))

The total initial energy of advanced nodes is as follows:

$$\begin{array}{@{}rcl@{}} E_{\text{advanced}}=Nm(1-m_{0})E_{0}(1+a) \end{array} $$
((2))

Similarly, the total initial energy of normal nodes in the network is calculated as follows:

$$\begin{array}{@{}rcl@{}} E_{\text{normal}}=N(1-m)E_{0} \end{array} $$
((3))

The total initial energy of three-level heterogeneous WSNs is therefore calculated as:

$$\begin{array}{@{}rcl@{}} E_{\text{total}} = E_{\text{super}}+E_{\text{advanced}}+E_{\text{normal}} \end{array} $$
((4))
$$ \begin{aligned} E_{\text{total}} &= N m m_{0}E_{0} (1+b)+Nm(1-m_{o})E_{0}(1+a)\\ &\quad+N(1-m)E_{0} \end{aligned} $$
((5))
$$\begin{array}{@{}rcl@{}} E_{\text{total}} = {NE}_{0}(1+m(a+m_{0}b)) \end{array} $$
((6))

The three-level heterogeneous WSN has m(a+m 0 b) times more energy as compared to the homogeneous WSN.

A homogeneous WSN also turns into heterogeneous after some rounds due to unequal energy consumption of nodes. CH nodes consume more energy, as compared to member nodes. After some rounds, the energy level of all nodes becomes different, as compared to each other. Therefore, a protocol which handles heterogeneity is more important than the homogenous protocol.

4.2 Energy consumption model

In the literature, many attempts have been made for the proposition of energy consumption model. Most of the existing proposed models either discuss node power consumption or impact of external radio environment. This lack of one-sided consideration introduces the gap between theoretical and practical results to increase. Thus, we focus on the consideration of both factors and present an energy consumption model as integration of the models in [11] and [26].

The energy consumption of a node depends on its components (modules) for special purposes like sensing, processing, and wireless communication (refer to Fig. 1). Based on this assumption, the total energy consumption of a node “ E T ” is given by the following equation.

$$ E_{T}=E_{S}+E_{P}+E_{W} $$
((7))

where E S is the energy consumed by the sensing module, E P is the energy consumption cost of a processing module, and E W is the energy consumption cost of a wireless communication module. The sensing module typically performs three tasks: signal sampling, analog to digital conversion of the signal, and signal modulation. By considering switching energy, we can write E S in a mathematical equation form as follows:

$$ E_{S}=E_{10}+E_{01}+E_{11} $$
((8))

where E 10 is the energy consumption cost while going from the ON state to the OFF state (switching OFF), E 01 is the energy consumption cost while going from the OFF state to the ON state (switching ON), and E 11 is the energy consumption cost of the sensing operation (note: E 00=0). If the working voltage V is multiplied with the current drawn by a sensor I and time interval of the sensing operation T S , then it yields E 11, i.e.,

$$ E_{11}={VIT}_{S}. $$
((9))
Fig. 1
figure 1

Architecture of a node

The state transition values with their description are listed in Table 1.

Table 1 Description of states

In subject to the second contributor of Eq. 7E P ”, we assume that the processing module performs three major tasks: sensor controlling, protocol-based communications, and data processing. Based on these assumptions, there are three possible states of the processing module (sleep, idle, and running).

$$ E_{P}=E_{P}^{\text{Stat}}+E_{P}^{\text{Xion}} $$
((10))

where \(E_{P}^{\text {Stat}}\) and \(E_{P}^{\text {Xion}}\) denote the state energy consumption and state transition energy consumption, respectively. Eq. 10 can be rewritten in a more descriptive form as:

$$ E_{P}=\sum_{i=1}^{m}P_{P}^{\text{Stat}}(i)T_{P}^{\text{Stat}}(i)+\sum_{j=1}^{n}\chi_{P}^{\text{Xion}}(j)E_{P}^{\text{Xion}}(j) $$
((11))

where i=1,2,...,m is the processor operation state and j=1,2,...,n is the type of state transition. Further in the ith processor operation state: \(P_{P}^{\text {Stat}}\) is the power consumption cost, \(T_{P}^{\text {Stat}}\) is the time interval, \(\chi _{P}^{\text {Xion}}\) is the frequency of state transition, and \(E_{P}^{\text {Xion}}\) is the energy consumption cost of one state transition.

Now, for the third contributor of Eq. 7, E W =E Tx or E W =E Rx , we adopt the radio model used in [11]. If l bit message is transmitted/received over a distance d, then the energy expense is given as follows:

$$\begin{array}{@{}rcl@{}} E_{W}=E_{Tx/Rx}(l,d)= \left\{ \begin{array}{lr} l E_{\text{elec}}+l\epsilon_{fs}d^{2},& d<d_{0} \\ l E_{\text{elec}}+l \epsilon_{mp}d^{4},& d\geq d_{0} \\ \end{array} \right. \end{array} $$
((12))

where E elec is the energy dissipated per bit to run transmitter or receiver circuit, and ε f s and ε m p are the radio amplifier types for free space and multi-path, respectively (d 0 is the reference distance; \(d_{0}=\sqrt {\frac {\epsilon _{fs}}{\epsilon _{mp}}}\)).

4.3 The EDDEEC protocol

In this section, we present the details of the proposed EDDEEC protocol. Our protocol implements the idea of probabilities for CHs selection based on initial and residual energy of nodes as well as the average energy of the network. The average energy of rth round from [15] is given as:

$$\begin{array}{@{}rcl@{}} \bar{E}(r)= \frac{1}{N}E_{\text{total}}(1-\frac{r}{R}) \end{array} $$
((13))

where R denotes the total rounds during the network lifetime and is calculated as:

$$\begin{array}{@{}rcl@{}} R= \frac{E_{\text{total}}}{E_{\text{round}}} \end{array} $$
((14))

where E round is the energy dissipated in a network during a single round and is calculated as:

$$\begin{array}{@{}rcl@{}} E_{\text{round}}= K\left(2{NE}_{\text{elec}}+{NE}_{DA}+l\epsilon_{mp}d_{\text{to BS}}^{4} \right.\\ \left.+N\epsilon_{fs}d_{\text{to CH}}^{2}\right) \end{array} $$
((15))

where K is the number of clusters, E DA is the data aggregation energy cost expended by CH, d to BS is the average distance between the CH and the BS, and d to CH is the average distance between cluster members and the CH. Now d to BS and d to CH can be calculated as:

$$\begin{array}{@{}rcl@{}} d_{\text{to CH}}= \frac{M}{\sqrt{2 \pi K}}, d_{\text{to BS}}= 0.765\frac{M}{2} \end{array} $$
((16))

By taking the derivative of E Round with respect to k and equating to zero, we can find the optimal number of clusters k opt and is calculated as:

$$\begin{array}{@{}rcl@{}} k_{\text{opt}}=\frac{\sqrt{N}}{\sqrt{2\pi}}\sqrt{\frac{\epsilon_{fs}}{\epsilon_{mp}}}\frac{M}{d_{\text{toBS}}^{2}} \end{array} $$
((17))

At the start of each round, nodes decide on the basis of threshold whether to become CHs or not. The value of threshold is calculated as:

$$\begin{array}{@{}rcl@{}} \text{Th}(S_{i}) = \left\{ \begin{array}{l l} \frac{p_{i}}{1-p_{i}(\text{mod}(r, \frac{1}{p_{i}}))} & \quad \text{if} S_{i} \in G \\ 0 & \quad \text{Otherwise} \end{array} \right. \end{array} $$
((18))

where G is the set of nodes eligible to become CHs for round r and p is the desired probability of the CH. In real scenarios, WSNs have more than two types of heterogeneity. Therefore, in EDDEEC, we use the concept of three-level heterogeneity and characterize the nodes as: normal, advanced, and super. The probability for three types of nodes given by EDEEC is given below:

$$ \begin{aligned} p_{i}\,=\,\left\{ \begin{array}{ll} \frac{p_{\text{opt}}E_{i}(r)}{(1+m(a+m_{o}b))\bar{E}(r)} & \;\;\;\;if \; s_{i} \;\mathrm{is\; the\; normal \;node}\\ \frac{p_{\text{opt}}(1+a)E_{i}(r)}{(1+m(a+m_{o}b))\bar{E}(r)} & \;\;\;\;if \;s_{i}\; \mathrm{is \;the \;advanced \;node}\\ \frac{p_{\text{opt}}(1+b)E_{i}(r)}{(1+m(a+m_{o}b))\bar{E}(r)} & \;\;\;\;if \;s_{i} \; \ \mathrm{is \;the\; super \;node}\\ \end{array} \right. \end{aligned} $$
((19))

Equation 19 primarily illustrates the difference between DEEC, DDEEC, and EDDEEC by defining probabilities for CH selection. The objective of this expression is to balance the energy consumption between nodes such that the stability period and network lifetime are increased. However, soon after few rounds, super and advanced nodes might have the same residual energy as that of the normals. At this point, DEEC punishes advanced nodes, EDEEC punishes advanced as well as super nodes and DDEEC is only effective for repeatedly selecting the CH. To avoid this unbalanced case in three-level heterogenous network and to save super and advanced nodes from being over penalized, we propose changes in the probability function defined by EDEEC. These changes are based on the absolute residual energy level T absolute, which is the value in which advanced and super nodes have the same energy level as that of normal nodes. The idea specifies that under T absolute, all normal, advanced, and super nodes have the same probability for CH selection. Our proposed probabilities for the CH selection in EDDEEC are given as follows:

$$ {\footnotesize{} {\begin{aligned} {}p_{i}\,=\,\left\{\!\! \begin{array}{ll} \frac{p_{\text{opt}}E_{i}(r)}{(1+m(a+m_{o}b))\bar{E}(r)} & \text{for}\; N_{ml} \; \text{nodes}\;\;\; (if\; E_{i}(r)>T_{\text{absolute}})\\ \frac{p_{\text{opt}}(1+a)E_{i}(r)}{(1+m(a+m_{o}b))\bar{E}(r)} & \;\;\text{for}\; \text{Adv} \;\text{nodes}\;\;\; (if\; E_{i}(r)>T_{\text{absolute}})\\ \frac{p_{\text{opt}}(1+b)E_{i}(r)}{(1+m(a+m_{o}b))\bar{E}(r)} & \;\;\text{for}\; \text{Sup}\; \text{nodes}\;\;\; (if\; E_{i}(r)>T_{\text{absolute}})\\ c\frac{p_{\text{opt}}(1+b)E_{i}(r)}{(1+m(a+m_{o}b))\bar{E}(r)} & \;\;\text{for}\; N_{ml},\; \text{Adv},\; \text{Sup}\; \text{nodes}\; (if \; E_{i}(r)\leq T_{\text{absolute}})\\ \end{array} \right. \end{aligned}}} $$
((20))

The value of absolute residual energy level, T absolute, is written as:

$$\begin{array}{@{}rcl@{}} T_{\text{absolute}}= z E_{o} \end{array} $$
((21))

where z ε(0,1) and z=0 indicates traditional EDEEC. It is possible that the advanced and super nodes may not have been CHs for the last r rounds, and it is also possible that some of these nodes become CHs. Same possibilities are also associated with the normal nodes. So, the exact value of z is not known. However, through many rounds of simulations using random topologies, we try to find the nearest value of z by varying it for best result based on first dead node in the network. Using this random best effort to compute Z, we end up with Z=0.7 as the best value. Therefore, T absolute=(0.7)E o .

The probability function in Eq. 20 defines c as a variable controlling the clusters in number. If c is higher, then there are more CHs transmitting directly to the BS. If c=0, then there is no CH and all nodes are transmitting directly to the BS like direct communication. The network performance decreases for both very high and very low values of c. As a solution, we execute numerous simulations to find the best value of c until we reach the value of c=0.025 for enhanced network efficiency. The detailed flow chart of the proposed and selected protocols is depicted in Fig. 2.

Fig. 2
figure 2

Flowchart of DEEC, EDEEC, DDEEC, and EDDEEC

5 Simulation results

In this section, we present the simulation results for DEEC, DDEEC, EDEEC, and EDDEEC: three-level and multi-level heterogeneous WSNs using MATLAB. WSN consists of N=100 nodes which are randomly deployed in a field of dimension 100 m×100 m with a centrally located BS. For simplicity, we consider that all nodes are either fixed or micro-mobile and ignore the energy loss due to collision and interference between signals of different nodes.

The performance metrics used for the evaluation of the protocols are: stability period, network lifetime, and number of packets sent to the BS.

  • Stability period: By stability period, we mean the round number at which first node dies or the number of rounds from network initialization till the death of first node.

  • Network lifetime: By network lifetime, we mean the round number at which all nodes die or the number of rounds from network initialization till the death of all nodes.

  • Number of packets sent to BS: By this metric, we mean the total number of packets that are directly sent to BS either from CHs or non-CH nodes.

The parameters used in simulations are given in Table 2. Results along with discussions are provided in the following subsections.

Table 2 Simulation parameters

5.1 Case 1: m=0.8, m o =0.6, a=2.0, and b=3.5

In case 1, we consider a network containing 20 normal nodes having E o energy, 32 advanced nodes having 2 times more energy than normal nodes, and 48 super nodes containing 3.5 times more energy than the normal nodes. Figure 3 depicts the number of alive and dead nodes during the network lifetime. The first node for DEEC, DDEEC, EDEEC, and EDDEEC dies at 969, 1355, 1432, and 1717 rounds, respectively, and all nodes die at 5536, 5673, 8638, and 8638 round„ respectively. Figure 4 shows that the data sent to the BS is more for EDDEEC as compared to the rest of the baseline protocols. It is obvious from the results that EDDEEC is the most efficient among the given protocols in terms of stability period, network lifetime, and number of packets sent to the BS even in case of a network containing more super and advanced nodes as compared to normal nodes. As can be seen from Figs. 3 and 4, EDDEEC performs better than the other selected existing protocols in terms of stability period, network lifetime, and throughput. During protocol operations, DEEC considers residual energy of nodes and average energy of the network, DDEEC considers residual energy of nodes, and EDEEC adds another energy level of nodes. All these considerations have no significant impact of the CHs selection criteria. On the other hand, EDDEEC dynamically adjusts the CHs selection probability. Overall, due to the aforementioned reasons, EDDEEC selects the fittest CHs as compared to the other selected protocols. Thus, EDDEEC consumes relatively less energy which leads not to only prolonged stability period but also prolonged network lifetime in comparison to the other protocols. Prolonged stability period and network lifetime means that nodes are able to send packets for time; thereby, the number of packets sent to BS are more in comparison to the other selected protocols.

Fig. 3
figure 3

Network lifetime (case 1)

Fig. 4
figure 4

Number of packets sent to the BS (case 1)

5.2 Case 2: m=0.3, m o =0.2, a=1.2, and b=2.5

In this case, we place 70 normal nodes having E o energy, 24 advanced nodes having 1.2 times more energy than the normal nodes, and 6 super nodes equipped with 2.5 times more energy than the normal nodes. Figure 5 shows alive and dead nodes during the network lifetime. The first node for DEEC, DDEEC, EDEEC, and EDDEEC dies at 1115, 1209, 1400, and 1682 round„ respectively, and all nodes die at 4693, 3726, 5798, and 5789 rounds, respectively. Figure 6 shows that the data sent to the BS is more for EDDEEC than the rest of the protocols. It is obvious from the results that EDDEEC is the most efficient among all protocols in terms of stability period, network lifetime, and number of packets sent to the BS, even in case of network containing less number of super and advanced nodes as compared to normal ones. In this case 2, the number of normal nodes increased as compared to case 1. Similarly, the number of advanced and super nodes decreased as per case 2 in comparison to case 1. Normal nodes have the least energy in comparison to advanced and super nodes; thus, as a whole, the total energy of the network is downscaled in this case as compared to the previous case. All the protocols are the same in this case as were in the previous case; execution of these protocols consumes energy in the similar way but with less initial energy resources. Therefore, as a whole, the stability period, network lifetime, and number of packets sent to BS are relatively on the lower side in this case as compared to the previous case.

Fig. 5
figure 5

Network lifetime (case 2)

Fig. 6
figure 6

Number of packets sent to the BS (case 2)

5.3 Case 3: multi-level heterogenity

For multi-level heterogeneity, we randomly assign [0.5,2]E 0 energy to nodes. Results given in Fig. 7 shows alive and dead nodes during the network lifetime. First node for DEEC, DDEEC, EDEEC, and EDDEEC dies at round 1184, 1307, 1353, and 1448, respectively, and all nodes die at rounds 3940, 3212, 4293, and 5210, respectively. Figure 8 shows that data sent to the BS is more for EDDEEC than DEEC, DDEEC, and EDEEC. It is obvious from the results that EDDEEC is the most efficient among all protocols in terms of stability period, network lifetime, and packets sent to the BS even in case of network containing multi-level heterogeneity. Random energy assignment to all nodes between 0.5 and 2 J means that the number of normal nodes in this case are relatively less in comparison to the earlier two cases. Thus, we can say that the network is initially equipped with relatively more energy as compared to cases 1 and 2. Due to the aforementioned reasons, the stability period, network lifetime, and number of packets sent to BS exhibit the behavior as shown in Figs. 7 and 8.

Fig. 7
figure 7

Network lifetime (case 3)

Fig. 8
figure 8

Number of packets sent to the BS (case 3)

6 Conclusions

This paper has three major contributions. The first one is the proposition of a three-level heterogeneous network model. Another equally important contribution is the proposed energy consumption model. Unlike existing models, the newly proposed energy consumption model give careful consideration to both energy consumption of nodes and impact of radio environment. Besides the two proposed models, we have also proposed the EDDEEC protocol for WSNs. EDDEEC is an adaptive and energy-aware routing protocol which dynamically changes the probabilities of nodes to become CHs in a balanced and efficient manner. We have performed extensive simulations to check the efficiency of the newly proposed protocol. The selected performance metrics for this analysis are stability period, network lifetime, and packets sent to the BS. The simulation results show that the proposed EDDEEC protocol performs better for the selected performance metrics as compared to the existing cluster formation-based protocols.