1 Introduction

As a product of the development and combination of the sensor technology, embedded computer technology, wireless communication technology and distributed information processing technology, wireless sensor networks (WSNs) provide a kind of brand-new information acquisition and processing method, and have broad application prospects in military, environmental protection, agriculture and health and other fields [1, 2]. WSN is commonly composed of tiny, cheap, low power consumption sensor nodes which are deployed in monitoring area with wide coverage. The nodes are generally tiny embedded systems, which have relatively weak processing capacity, storage capacity and communication ability, carry energy limited battery and not easy to replace or recharge. Therefore, the main challenge for WSN is balance the network load and reduce the overall energy consumption, and consequently prolong the network lifetime.

To solve this problem, researchers have proposed many routing protocol to extend the life cycle of WSN. In presence, clustering routing protocol is commonly used, in which each cluster is formed by a number of adjacent nodes, consists of a cluster head (CH) and many cluster members, CHs can be further divided into clusters [3]. Clustering routing protocols have a variety of advantages, such as more scalability, less load, less energy consumption and more robustness [4]. The CHs of low level network is the cluster members of a high level network, and the CHs of the top level network communicate with the base station (BS). It is low energy adaptive clustering hierarchy (LEACH) protocol [5] which first suggested clustering routing protocol, the main way of LEACH is to prolong the lifetime of network by balancing the energy consumption of the sensor nodes.

Since the CHs randomly form in LEACH, it easily causes CHs gathering and unevenly distribution etc. To deal with these problem, many scholars have put forward various kinds of improved algorithm to improve the distribution of the CHs, among them many algorithms employ fuzzy logic to handle uncertainties in WSN, such as CHEF [6], CEFL [79], etc. However, the above protocols use type-1 fuzzy logic systems (FLSs) which cannot easily handle and model the uncertainties presents in WSN as they employ crisp and precise type-1 fuzzy sets (i.e., their membership functions (MFs) are supposedly known perfectly) which does not allow for any uncertainties about membership values.

As an extension of the concept of an ordinary fuzzy set (i.e., a type-1 fuzzy set), the concept of a type-2 fuzzy set was introduced by Zadeh [10]. A type-2 fuzzy set (T2 FS) is characterized by a fuzzy MF, i.e., the membership value for each element of this set is itself a fuzzy set. The MFs of T2 FSs are three-dimensional and include a footprint of uncertainty (FOU) which provide additional degrees of freedom that make it possible to directly model and handle the faced uncertainties in WSNs. In addition, T2 FSs can also handle linguistic uncertainties, just as “Words can mean different things to different people.” The type-2 fuzzy logic system (T2FLS) was first proposed by Karnik and Mendel in [11] to deal with rule uncertainties, the detail of the system method was developed in [12]. Since then, type-2 FLSs have been widely used in communication, finance, medicine, control etc [1315]. More recently, type-2 FLSs also have been used for lifetime analysis of WSN in [16] or other applications, e.g. [17]. In 2013, the authors employed a type-2 Takagi–Sugeno–Kang (TSK) FLS for clustering routing protocol design [18] of WSN, which greatly prolonged the lifetime of WSN and balanced the network load better.

On the other hand, some scholars adopt multi-hop routing to reduce the data transmission energy consumption, such as EEUC [19], EAUCF [20], IFUC [21]. There are some other improved routing protocols that are based on chain, see PEGASIS [22], PEGASIS-ACO [23], etc.

Since a type-2 Mamdani FLS (T2MFLS) can handle not only the rule uncertainties, but also the uncertainties result from imprecise measurements or inputs, we believe that using a T2MFLS for CHs selection in the clustering routing protocol will be good as well. So, as a continuation of the idea in [18] and inspired by [19, 21] and [22], this paper would like to present another clustering routing protocol called CRT2FLACO based on the type-2 fuzzy logic and ant colony optimization (ACO), in which a T2MFLS is employed to select the CHs, and ACO is for multi-hop routing. Specifically, in the first set-up phase, the three important factors—residual energy, the number of neighbor nodes and the distance to BS are taken into consideration as inputs of our T2MFLS to compute the probability of a node to be a candidate CH and the size of CH competition radius, and then select the final CHs; in the second data-transmission phase, the ACO algorithm is introduced to build a chain to link all the CHs, each CH communicates only with a close neighbor and takes turns transmitting packets to the BS like Power-Efficient GAthering in Sensor Information Systems (PEGASIS) [22]. This method cut the total transmission distance and balance the network load effectively.

The rest of this paper is organized as follows: Sect. 2 gives an overview of related work. The third section describes the system model adopted in the protocol; Sect. 4 introduces the proposed clustering algorithm based on type-2 fuzzy logic (T2FLCA) and multi-hop routing mechanism based on ACO in detail. In the fifth section, we conduct the simulation experiments to evaluate our clustering routing protocol compared with LEACH, PEGASIS and EEUC and present the simulation results. In the last section of this paper, we make a summary and put forward some proposals of our future work.

2 Related Work

In recent years, many clustering protocols and algorithms have been proposed for WSN, and many of them are based on LEACH. In this section, we briefly introduce some of them that are relevant to our algorithm.

LEACH [5] is a self-organized clustering protocol, in which the operation is divided into rounds. Each round begins with a set-up phase when the clusters are formed, followed by a steady-phase when data are transmitted from the nodes to the CHs and then on to the BS. In the first set-up phase, each node generates a random number between 0 and 1, if this random number is smaller than a threshold \(T(n)\), given in (1), the node becomes a CH in the current round. Other ordinary nodes determine their cluster by choosing the CH that requires the minimum communication energy. In the second steady-phase, the CHs use time division multiple access (TDMA) to communicate with the nodes in their clusters and fuse the data packet, then transmit the packet to the BS.

$$\begin{aligned} T(n)= {\left\{ \begin{array}{ll} \frac{P}{1-P\times \left(r\; mod \frac{1}{P}\right)} &\quad \text {if\,n} \in \text {G} \\ 0 &\quad \text {otherwise} \end{array}\right. } \end{aligned}$$
(1)

where, \(P\) is the CH probability, \(r\) is the number of the current round and G is the set of nodes that have not been CHs in the last \(1/P\) rounds.

LEACH-C [24] is centralized algorithm, which means that all the CHs are selected by the BS. In LEACH-C protocol, according to current energy and the location of each node received by the BS, the BS calculates the average energy, and chooses the nodes which are higher than the average energy to be candidate CHs, then determines the optimal number and the location of CHs from the rest of the candidates by the simulated annealing method.

Fuzzy logic systems (FLSs), which can manipulate the linguistic rules in a natural way, are suitable in respects that the environment or system is not accurate [14, 15, 25]. Due to this, researchers have proposed many protocols based on FLSs [69, 20, 21]. CEFL [7] is an improved protocol based on LEACH, in which the BS uses a FLS to select CHs based on three descriptors—energy, concentration and centrality. Whereas, [8] uses a FLS to select CHs based on three descriptors—distance to BS, node density and battery level. Kim et al. [6] and Singh et al. [9] are another two algorithms using FLS, and residual energy and local distance are considered in [6] to build a FLS for CH selection, while in [9], residual energy and centrality of the nodes are used to build the FLS.

So far, the clustering protocols that we mentioned above are all single-hop algorithms, that is, the CHs transmit their data packet to the BS directly. However, there are also many multi-hop algorithms developed in the literatures, such as [1921], in which CHs cooperate with each other to forward their data to the BS, the CHs closer to the BS play the role of relay stations at the same time. EEUC [19] is a distributed competitive unequal clustering algorithm where the CHs are elected by local competition. To address the hot spot problem in multi-hop wireless sensor networks, it wisely organizes the network via unequal clustering and multi-hop routing. In EEUC, every node has a preassigned competitive radius which decreases as its distance to the BS decreases. So the CHs closer to the BS support smaller cluster sizes. EAUCF [20] adjusts the CH radius considering residual energy and the distance to the BS of sensor nodes. IFUC [21] develops another unequal clustering scheme based on fuzzy logic, they also design the inter-cluster routing based on ACO, which makes the hot spot problem alleviated effectively.

Unlike multi-cluster structure, the main idea of PEGASIS [22] is to form a chain linked all the nodes. Based on the chain topology architecture, each node transmits data packet to the neighbor node which is nearer to leader, then the neighbor node fuses the received data and its own data and send the fusion data to its neighbor node. Data moves node by node along the chain, get fused, and eventually arrive in the leader that will transmit it to the BS. Compared with LEACH, PEGASIS extends the network lifetime approximately twice. The success of PEGASIS has brought out many researchers of routing optimization to shorten chain of PEGASIS. Among them, [23] presents an improved algorithm based on ACO, balances the network load effectively.

Many of these proposals consider the improvement on the process of CHs election through a FLS that allows a better estimate of the imprecise knowledge by means of multiple criteria. However, most of them use type-1 FLSs, for which the ability to deal with uncertainty model is relatively limited. Very recently, the authors have proposed a clustering routing protocol named ICT2TSK [18], in which a type-2 TSK FLS is employed to handle rule uncertainties, and a fixed competition radius for each CH is introduced to balance the network, it can prolong the lifetime of WSN greatly and balance the network loads better.

Since a T2MFLS can handle uncertainties result from imprecise inputs and complex rules, we believe that using a T2MFLS for CHs election in the clustering routing protocol will be good as well. Moreover, as shown in [19, 21], preassigning a unequal competitive radius for each CH will address the hot spot problem effectively. Consequently, in this paper we would like to employ a type-2 Mamdani FLS to deal with uncertainties existed in WSN better and use the unequal competition radius for each CH to balance the network load. Furthermore, we will adopt the idea of PEGASIS to build a single-chain using ACO algorithm to link all the CHs, then transmit the fusion data CH by CH via multi-hop routing.

3 System Model

3.1 Network Model

First, we make a simple introduction about the system model used in our implementations. The assumptions about the network are:

  • Sensor nodes are randomly distributed in the network.

  • Sensor nodes and the BS are stationary after deployment phase.

  • Sensor nodes are homogeneous, energy constrained and have the same initial energy.

  • Communication channel is symmetric.

  • Nodes have their own information such as remaining energy and location, so that they send to the BS with respective energy levels during set up phase.

3.2 Energy Consumption Model

In LEACH, the first order radio model is utilized for calculating hardware energy dissipation. For comparative purposes, this paper uses the same model. In this model, the energy consumption of radio dissipation of sending data and receiving data are both expressed as \(E_{elec}\); the free space (\(d^2\) power loss) and the multi-path fading (\(d^4\) power loss) channel models with amplifying index \(\varepsilon _{fs}\) and \(\varepsilon _{amp}\) are used respectively; the energy consumption of data fusion is denoted by \(E_{DA}\).

The energy spent of a node that transmits \(l\)-bits packet over distance \(d\) is:

$$\begin{aligned} \begin{aligned} E_{Tx}(l,d)=E_{Tx{-}elec}(l)+E_{Tx{-}amp}(l,d) =\left\{ \begin{array}{ll}E_{elec}*l+\varepsilon _{fs}d^2*l &\quad d<d_{0}\\ E_{elec}*l+\varepsilon _{amp}d^4*l &\quad d\ge d_{0} \end{array}\right. \end{aligned} \end{aligned}$$
(2)

and the energy consumption of receiving this message is:

$$E_{Rx}(l)=E_{elec}*l $$
(3)

where, \(d_{0}=\sqrt{\frac{\varepsilon _{fs}}{\varepsilon _{amp}}}\).

4 The Proposed Clustering Routing Protocol CRT2FLACO

In this paper, CHs are selected by the BS in each round using our T2FLCA clustering algorithm. In our opinion, a central control algorithm in the BS will produce better CHs since the BS has a global knowledge about the network. Moreover, the BS usually are many times more powerful than the sensor nodes, and have sufficient memory, power and storage [6].

Strictly speaking, residual energy, location, neighbor nodes density, computing power and mobility of sensor nodes are all factors that we should consider when we choose the CHs. Moreover, the influence of these various factors on CH selection is not the same, so overall consideration and adding some weights are helpful for choosing better CHs. In this paper, we take a compromise between important factors and computation simplicity, and just consider three factors—residual energy, the number of neighbor nodes and the distance to BS of each node—for CHs election. First, residual energy represents the remaining power of a node, it is the most important factor that we should consider, because the early exhaustion of energy for some nodes maybe cause the disconnection of a WSN, and consequently could not complete a task. One should select the nodes with more energy to be CHs. Second, the node density should also be considered, since if we choose a node with large number of neighbor nodes to be a CH, this node will consume more energy for data fusion with its cluster and data transmission to BS, and then die fast. At last, the nodes far from BS will also consume more energy for data transmission to BS, and then die fast. In view of the above, we take into consideration residual energy, the number of neighbor nodes and the distance to BS of each node for CHs election. And in order to avoid CHs gathering, we also introduce a strategy of unequal competition radius.

Before the sensor network begins to collect data, the BS broadcasts a control signal of fixed power level to all sensor nodes. According to the strength of the received signal, sensor nodes can calculate the distance to BS, then send the distance and residual energy information to BS. Similarly, at the beginning of each round, each node reports its residual energy to BS. Based on the received information the BS simulates sensor network and applies the proposed T2FLCA algorithm to calculate the CHs list, then generates and sends control package to each sensor node, and each ordinary node determines which cluster it can join in based on the distance factor, and sends control package and data packet to their CHs. Finally all the CHs are linked into a chain using ACO algorithm, each CH send fusion data packet to the leader along link, and the leader transmits eventually packets to BS.

4.1 Architecture of a Type-2 Fuzzy Logic System

In this paper, a type-2 Mamdani FLS (T2MFLS) is established by T2FLCA algorithm, including four parts [14]: Fuzzifier, Rules, Inference Engine, Output processing (Type-reducer and Defuzzifier), as shown in Fig. 1.

Fig. 1
figure 1

The structure of a type-2 Mamdani fuzzy logic system

In the algorithm, the input variables include the residual energy, the number of neighbor nodes and the distance to BS of each node; two output variables are the probability of a node becoming the candidate CH and the competition radius of each candidate CH.

4.1.1 Fuzzifier and Division of Fuzzy Variables

The role of fuzzifier is mapping each crisp input value to a fuzzy set. For a T2MFLS, the fuzzifier maps each crisp input vector \(\mathbf{x^{\prime }}=(x_1^{\prime },\ldots ,x_p^{\prime })\) to a type-2 fuzzy set \(\widetilde{A}_{\bf x'}\). In order to simplify the calculation, we use singleton fuzzifier, that is, for \(\forall i=1,\ldots ,p\), the membership function of the fuzzified input set \(\widetilde{X}_{i}\) is defined as [14]:

$$\begin{aligned} \mu _{\tilde{X}_{i}}(x_{i})= \left\{ \begin{array}{ll} 1/1 &\quad x_{i}=x_{i}^{\prime }\\ 1/0 &\quad x_{i}\ne x_{i}^{\prime } \end{array}\right. \end{aligned}$$
(4)

and \(\mu_{\widetilde{A}_{\bf x'}}(\mathbf{x})=\sqcap _{i=1}^p \mu _{\tilde{X}_{i}}(x_{i})\), where \(\mathbf{x}=(x_1,\ldots ,x_p)\), and the notation \(\sqcap \) denotes the operation of intersection of type-2 fuzzy sets.

For convenience, the domains of three inputs are all taken to be the unit interval [0,1]. We get the input values of the residual energy, the number of neighbor nodes and the distance to BS by using the corresponding real values divided by the initial energy, maximum number of neighbor nodes and maximum distance, respectively. To reduce the computation complexity, we divide all the three inputs into three levels, that is, the residual energy (denoted by Energy): low, medium, high; the number of neighbor nodes (denoted by Density): sparse, medium, dense; the distance to BS (denoted by Distance): near, medium, far. All secondary membership functions (MFs) are taken to be interval sets (this means our FLS are interval type-2), and the primary memberships are triangular or trapezoid (see [14] for the concepts of secondary MFs and primary memberships). Figures 2, 3 and 4 show the three inputs and their membership functions.

Fig. 2
figure 2

T2 and T1 membership functions of input variable ‘Energy’. a T2 MFs, b T1 MFs

Fig. 3
figure 3

T2 and T1 membership functions of input variable ‘Density’. a T2 MFs, b T1 Mfs

Fig. 4
figure 4

T2 and T1 membership functions of input variable ‘Distance’. a T2 MFs, b T1 MFs

The two output variables are the probability of the node becoming the candidate CH (denoted by Probability) and the competition radius of each candidate CH (denoted by Radius). Their domains are the real values. They are divided into nine levels: very weak, weak, little weak, lower medium, medium, higher medium, little strong, strong, very strong and five levels: small, little small, medium, little large, large, respectively. We also take triangular or trapezoid primary membership for the two outputs. Figures 5 and 6 show the membership functions of two outputs.

Fig. 5
figure 5

T2 and T1 membership functions of output variable ‘Probability’. a T2 MFs, b T1 MFs

Fig. 6
figure 6

T2 and T1 membership functions of output variable ‘Radius’. a T2 MFs, b T1 MFs

4.1.2 Rules

In our T2MFLS, we establish 27 IF-THEN rules. Let us denote three input variables (Energy, Density and Distance) as \(x_1\), \(x_2\) and \(x_3\), respectively, and denote two output variables (Probability and Radius) as \(y_1\) and \(y_2\), respectively. The basic form of the \(l\hbox {th}\, (l=1,\ldots ,27)\) rule can be described as follows:

$$\begin{aligned} \begin{array}{ll} R^l:\; {\text {IF}}\;x_{1}\;{\text {is}}\; \widetilde{F}_{1}^{l}\;{\text {and}}\;\cdots \; {\text {and}}\;x_{n}\;{\text {is}}\;\widetilde{F}_{n}^{l}{\text {THEN}}\;y_1\;{\text {is}}\; \widetilde{G}_{1}^{l}\;{\text {and}}\;y_2\; {\text {is}}\;\widetilde{G}_{2}^{l}\;. \end{array} \end{aligned}$$
(5)

where \(\widetilde{F}_{i}^{l}\ (i=1,2,3)\) are the type-2 antecedent fuzzy sets, \(\widetilde{G}_{j}^{l}\ (j=1,2)\) are the type-2 consequent fuzzy sets. The rule base is showed in the Table 1, inspired from paradigm where the higher the residual energy of a node and the sparser the neighbor nodes and the near the distance to BS are, the higher the probability of the node to be CH and the larger the competition radius of the node are.

Table 1 Rules

4.1.3 Inference and Output Processing

In this paper, we would like to use the center of sets (COS) type-reducer [14], which combines the process of inference and type-reducing. Specifically, for the \(j\hbox {th} \,(j=1,2)\) type-2 fuzzy output set, the COS type-reducer replaces each type-2 consequent set, \(\widetilde{G}_j^l\), by its centroid, \(C_{\widetilde{G}_j^l}\) (which itself is a type-1 set), and finds a weighted average of these centroids. The weight associated with the \(l\hbox {th}\, (l=1,\dots ,27)\) centroid is the degree of firing corresponding to the \(l\hbox {th}\) rule, namely the firing interval \([\underline{f}^l(\mathbf{x}),\overline{f}^l(\mathbf{x})]\), in which the left endpoint \(\underline{f}^l(\mathbf{x})\) and the right endpoint \(\overline{f}^l(\mathbf{x})\) are computed by lower membership functions \(\underline{\mu }_{\widetilde{F}_{i}^{l}}(x_i)\) and upper membership functions \(\underline{\mu }_{\widetilde{F}_i^l}(x_i)\) of antecedent type-2 fuzzy sets \(\widetilde{F}_i^l, i=1,\ldots ,p\), respectively, as follows [14]: \(\forall \mathbf{x}=(x_1,\ldots ,x_p)\),

$$\begin{aligned} \underline{f}^l(\mathbf{x})&=&\underline{\mu }_{\widetilde{F}_1^l}(x_1)*\ldots *\underline{\mu }_{\widetilde{F}_p^l}(x_p),\nonumber \\ \overline{f}^l(\mathbf{x})&=&\overline{\mu }_{\widetilde{F}_1^l}(x_1)*\ldots *\overline{\mu }_{\widetilde{F}_p^l}(x_p). \end{aligned}$$
(6)

The \(j\hbox {th} \,(j=1,2)\) extend output \(Y_{\mathrm{cos}}^j(\mathbf{x})\) of our T2MFLS is expressed as [14]:

$$\begin{aligned} Y_{\mathrm{cos}}^j(\mathbf{x})&=\left[ y_{jl}(\mathbf{x}),y_{jr}(\mathbf{x})\right] \nonumber \\&=\int _{y_j^1\in [y_{jl}^1,y_{jr}^1]} \cdots \int _{y_j^M\in [y_{jl}^M,y_{jr}^M]} \int _{f^l\in [\underline{f}^1,\overline{f}^1]}\cdots \int _{f^M\in [\underline{f}^M,\overline{f}^M]} 1/\frac{\Sigma _{i=1}^{M}f^{l}y_j^{l}}{\Sigma _{l=1}^{M}f^{l}} \end{aligned}$$
(7)

where \(Y_{\mathrm{cos}}^j(\mathbf{x}) \,(j=1,2)\) is an interval type-1 set determined by its two endpoints, \(y_{jl}(\mathbf{x})\) and \(y_{jr}(\mathbf{x})\), and \([y_{jl}^l,y_{jr}^l] \,(l=1,\dots ,27)\) corresponds to the centroid of the type-2 interval consequent set \(\widetilde{G}_j^l\), moreover, we omit \(\mathbf{x}\) in firing intervals \([\underline{f}^l(\mathbf{x}),\overline{f}^l(\mathbf{x})]\) for denotation simplicity. This extend output can be computed by KM algorithm [14] and it reveals the uncertainty at the output of a T2FLS due to rule uncertainties. See [14] for the detail of COS type-reducer.

Finally, we defuzzify the \(j\hbox {th}\) extend output \(Y_{\mathrm{cos}}^j(\mathbf{x})\) using the average of \(y_{jl}(\mathbf{x})\) and \(y_{jr}(\mathbf{x})\), that is, the \(j\hbox {th}\) defuzzified output of our interval T2MFLS is

$$ y_j(\mathbf{x})=\frac{y_{jl}(\mathbf{x})+y_{jr}(\mathbf{x})}{2}$$
(8)

4.2 Cluster Head Selection Algorithm

After T2MFLS operation, every node alive has its probability \(s_{i}\cdot probability\) to be a candidate CH. The node with highest probability is determined to be a CH. If a node become a CH, then the nodes within its competition radius will not be selected as CHs. With the death of the nodes, the number of nodes alive is changing, and the optimal cluster number is changing as well. In this paper, we choose \(k_{opt}\) CHs in turn, in which \(k_{opt}\) is the optimal cluster number for each round, it is calculated as follows:

$$k_{opt}=\left\lfloor n *P *\left( \frac{n-\hbox {dead}}{n}\right) + 0.5\right\rfloor$$
(9)

where \(n\) is the number of nodes, and dead is the the number of energy-exhausted nodes, \(P\) is the CH probability as in (1).

The pseudocode of CH selection is given in Algorithm 1.

figure e

4.3 Multi-hop Routing Mechanism Using ACO

After clusters have been formed, the intra-cluster data transmission will begin. In this paper, we adopt the idea of PAGESIS [22], link all the CHs into a chain, however, we do not use the greedy algorithm but the ant colony optimization (ACO) algorithm [26] to form the link, because ACO algorithm has good performance on multi-path optimization problem. Then, each CH send data packet along chain to the leader, which is a CH that eventually transmit packets to the BS.

4.3.1 Chain Building Using ACO

At first, for each CH i and each CH j, call \(path_{ij}\) the shortest path between CHs i and j. Let \(\tau _{ij}(t)\) be the intensity of pheromone trail on \(path_{ij}\) at time \(t\). At the beginning (when \(t=0\)), \(\tau _{ij}(t)\) is set to be the same for each CH i and each CH j, we set it to be \(1\). We use ANT-cycle algorithm introduced in [26] to update \(\tau _{ij}(t)\), that is, \(\Delta \tau _{ij}^{k}\) is not computed at every step, but after a complete tour (\(nC\) steps, and \(nC\) is the number of CHs).

The value of \(\Delta \tau _{ij}^{k}(t,t+nC)\) is given by:

$$\begin{aligned} \Delta \tau _{ij}^{k}(t,t+nC)=\left\{ \begin{array}{ll} \frac{1-\frac{L_{k}}{Q}}{1+5\frac{L_{k}}{Q}}, &\quad \text { if\,the\,}k{-}\text {th\,ant\,uses}\,path_{ij}\\ 0, &\quad \text { otherwise} \end{array}\right. \end{aligned}$$
(10)

where \(L_{k}\) is the tour length of the \(k\)-th ant, and \(Q\) is the maximum of \(L_{k}\). It worths to mention that the value of the first line in equation (10) in the original ANT-cycle algorithm [26] is defined as \(\frac{Q}{L_k}\), where \(Q\) is a constant. We modify this value by the Sugeno fuzzy complement operator \(\frac{1-\frac{L_{k}}{Q}}{1+5\frac{L_{k}}{Q}}\), in which the coefficient 5 is chosen by trial and error. The value of the trail intensity is also updated every \(nC\) steps according to the following formula

$$\tau _{ij}(t+nC)=(1-\rho )\cdot \tau _{ij}(t)+\Delta \tau _{ij}(t,t+nC)$$
(11)

in which \(\Delta \tau _{ij}(t,t+nC)= \sum _{k=1}^{m}\Delta \tau _{ij}^{k}(t,t+nC)\), and \(\rho \) is the evaporation rate, we set it to be 0.7 in this paper. Because [26] has verified that values below 0.5 slow down convergence, such as values above 0.8. There seems to be an optimum around 0.7.

The visibility function \(\eta _{ij}\) is also defined by the same Sugeno fuzzy complement operator:

$$\eta _{ij}=(1-d_{ij})/(1+5d_{ij})$$
(12)

where \(d_{ij}\) is the ratio of the distance between CHs \(i\) and \(j\) to the maximum distance.

Secondly, there are \(h\) ants going to start their travel (we set \(h=50\) in this paper, more than twice the number of CHs, so that the ants can keep a certain randomness). At the beginning, each ant is randomly placed in a CH as the starting node to visit other CHs. To take the tour of ant \(k\) as an example. When ant \(k\) arrives at CH \(i\), we need to calculate the transition probability \(P_{ij}\) of CH \(i\) to CH \(j\) in the set \(N_{i}\) of the nodes that not visited by ant \(k\) as follows:

$$P_{ij}=\frac{[\tau _{ij}(t)]^\alpha [\eta _{ij}]^\beta }{\sum _{s \in N_{i}}[\tau _{ij}(t)]^\alpha [\eta _{ij}]^\beta }$$
(13)

In this paper, we select a CH as the next visiting CH randomly from the set \(N_{select}\) which is defined as

$$N_{select}=\{c_{j}\mid P_{ij} >= \zeta *max(P_{ij})\}.$$
(14)

\(\zeta \) is a parameter that dominates the randomness, in this paper we set \(\zeta =0.3\). It sounds that taking \(\zeta \) to be between 0.3 and 0.5 is good.

Finally, when all the ants finish their journey exactly as ant \(k\) does, we have recorded the path of all the ants in “Route[]”, calculating the length of all the routes, then memorize the shortest path in \(path_{ij}\). After \(t = NC_{max}\) iterations as above, we can obtain the final route from \(path_{ij}\). In this paper, we set \(NC_{max}=8\). Theoretically, the higher the value of \(NC_{max}\), the better the result is, but the higher the computing complexity. So we take \(NC_{max}=8\) for compromise.

4.3.2 Leader Selection and Data Transmission

Unlike PEGASIS, we select a CH nearest to BS as the leader because that CHs have been chosen according to the factor of energy. Under the leader control as PEGASIS, starting from the end CH of the chain, each CH fuses the received data packet (if it has) with its own and transmits its data packet to the next CH along the chain. Ultimately, the BS will receive the final fusion data packet from the leader.

Algorithm 2 shows the pseudocode of multi-hop routing.

figure f

5 Simulation Results

In this section, we conduct simulation experiments in MATLAB environment, and present the experiment results that we have done to evaluate our protocol CRT2FLACO. We make a comparative analysis with other three protocols named LEACH [5], EEUC [19] and PEGASIS [22]. In order to justify the usage of “type-2 fuzzy logic”, we also compare the performance with the type-1 fuzzy counterpart named CRT1FLACO, the only differences between CRT2FLACO and CRT1FLACO are the MFs, which are shown in Figs. 2, 3, 4, 5, 6.

In [27], Handy et al. use the metrics First Node Dies (FND), Half of the Nodes Alive (HNA) and Last Node Dies (LND) to evaluate the lifetime of WSNs. FND denotes an estimated value for the round in which the first node dies. For some sparsely deployed WSNs, data of every sensor node may be of great importance, so the metric FND plays a significant role. However, the death of one node is not an important issue in densely deployed WSNs. Therefore, the metric HNA which denotes an estimated value for the round in which half of the nodes alive is proposed to estimate the WSN lifetime. Additionally, the metric LND denotes an estimated value for the overall lifetime of the network.

In order to evaluate our proposed protocol CRT2FLACO, we consider three different scenarios. We fix the network dimensions with \(200\,\hbox {m}\times 200\,\hbox {m}\). In the first scenario, the BS is located at the center (100 m, 100 m) of the WSN. In the second scenario, the BS is outside of the WSN, but nor very far from the monitored area, namely it is located at (100 m, 250 m). In the third scenario, the BS is located at far from the WSN, that is, at (100 m, 400 m). In each scenario, we also consider the influence of nodes density on the lifetime of the WSN, the number of nodes were varied as 100, 200, and 400 to test for sparse, moderate and dense networks, respectively. The parameters of the network model are illustrated in Table 2.

Table 2 Parameters of the network model

5.1 Scenario I

In this scenario, the BS is located at the center of the WSN. In order to optimize the result of EEUC, in the scenario the maximum competition radius is set to be 90, 80 and 70 m for the network with 100, 200 and 400 nodes, respectively, and the distance threshold TD-MAX are set to be 60m. LEACH uses a probability of 0.05 and the other related parameters of EEUC and PEGASIS are the same as that in [19] and [22], respectively. Simulation results are as follows.

Fig. 7
figure 7

Values of FND, HNA and LND for each algorithm for BS (100 m, 100 m). a 100 nodes, b 200 nodes, c 400 nodes

Fig. 8
figure 8

The number of alive nodes over 1200 rounds for BS (100 m, 100 m). a 100 nodes, b 200 nodes, c 400 nodes

Figure 7 shows histograms of FND, HNA and LND graphicly and numerically for the five protocols considering different deployment with 100, 200 and 400 nodes. As shown in the graph, our proposed CRT2FLACO protocol outperforms LEACH, EEUC and PEGASIS for almost all metrics FND, HNA and LND, also outperforms CRT1FLACO protocol.

Fig. 9
figure 9

The amount of ECPR for BS (100 m, 100 m). a 100 nodes, b 200 nodes, c 400 nodes

Figure 8 shows the alive nodes distributions with respect to the rounds for the five algorithms. Figure 9 compares the energy consumption per round (ECPR) of five algorithms. From them we see that the energy consumption of our CRT2FLACO protocol are all the lowest one for networks with 100, 200, 400 nodes.

Fig. 10
figure 10

Values of FND, HNA and LND for each algorithm for BS (100 m, 250 m). a 100 nodes, b 200 nodes, c 400 nodes

5.2 Scenario II

In this scenario, the BS is located at (100 m, 250 m), outside of the WSN, but not very far from it. The only difference from scenario I is that the distance threshold TD-MAX in EEUC are set to be 150 m. Simulation results are as follows.

Fig. 11
figure 11

The number of alive nodes over 1200 rounds for BS (100 m, 250 m). a 100 nodes, b 200 nodes, c 400 nodes

Figure 10 shows histograms of FND, HNA and LND graphicly and numerically for the four protocols considering different deployment with 100, 200 and 400 nodes. As shown in the graph, our proposed CRT2FLACO protocol outperforms LEACH, EEUC and PEGASIS for almost all metrics FND, HNA and LND, also outperforms CRT1FLACO protocol.

Figure 11 shows the alive nodes distributions with respect to the rounds for the four protocols. Figure 12 compares the energy consumption per round (ECPR) of four algorithms. From them we see that the energy consumption of our CRT2FLACO protocol are also the lowest one for networks with 100, 200, 400 nodes.

Fig. 12
figure 12

The amount of ECPR for BS (100 m, 250 m). a 100 nodes, b 200 nodes, c 400 nodes

Fig. 13
figure 13

Values of FND, HNA and LND for each algorithm for BS (100 m, 400 m). a 100 nodes, b 200 nodes, c 400 nodes

5.3 Scenario III

In this scenario, the BS is located at (100 m, 400 m), far from the WSN. The only difference from scenario I and II is that the distance threshold TD-MAX in EEUC are set to be 250 m. Simulation results are as follows.

Fig. 14
figure 14

The number of alive nodes over 900 rounds for BS (100 m, 400 m). a 100 nodes, b 200 nodes, c 400 nodes

Figure 13 shows histograms of FND, HNA and LND graphicly and numerically for the four protocols considering different deployment with 100, 200 and 400 nodes. As shown in the graph, our proposed CRT2FLACO protocol outperforms LEACH, EEUC and PEGASIS for all metrics FND, HNA and LND, also outperforms CRT1FLACO protocol.

Figure 14 shows the alive nodes distributions with respect to the rounds for the five protocols. Figure 15 compares the energy consumption per round (ECPR) of five algorithms. From them we see that the energy consumption of our CRT2FLACO protocol are still the lowest one for networks with 100, 200, 400 nodes.

Fig. 15
figure 15

The amount of ECPR for BS (100 m, 400 m). a 100 nodes, b 200 nodes, c 400 nodes

5.4 Result Analysis

From the above three scenarios of our simulations, we obtain the following observations:

  1. 1.

    From Figs. 7, 8, 10, 11, 13 and 14, we observe that our proposed CRT2FLACO protocol outperforms LEACH, EEUC, PEGASIS and CRT1FLACO protocols for almost all metrics FND, HNA and LND in each scenario and each deployed network. CRT1FLACO outperforms LEACH, EEUC and PEGASIS in moderate and dense network, but worse than EEUC and PEGASIS in sparse network, which implies CRT1FLACO is not so good for sparse network. This also justifies the usage of “type-2 fuzzy logic”, which is more robust than “type-1 fuzzy logic”. Moreover, the introduction of the idea of “sending data by a single chain ” in PEGASIS greatly reduce the energy consumption in the process of data transmission.

  2. 2.

    Nodes density has only a little influence on FND, HNA and LND of LEACH, EEUC and PEGASIS, has almost no influence on FND, HNA and LND of our CRT2FLACO protocol in the case that BS is located at the center of or not very far from WSN. However nodes density has some influence on the lifetime of WSN for five protocols in the case that the BS is located far from WSN, this maybe because that a sparse network has fewer CHs, the distance between each node and its CH are relatively far, which causes each node consuming more energy than the nodes in a dense network. In addition, the distance between two CHs in a sparse network are also relatively far, which also causes each CH consuming more energy in the process of transmitting data. We believe that the influence can be ignored by taking appropriate number of CHs.

  3. 3.

    In Scenario III, because of multi-cluster structure and all the CHs sending data package to BS that is placed far away from WSN, some CHs consume so much energy that die prematurely for LEACH and EEUC, while only one node is needed to transfer data to the BS for PEGASIS, CRT1FLACO and CRT2FLACO. Thus we can see that the FND, HNA and LND for LEACH and EEUC are very low, but they are moderate for PEGASIS, CRT1FLACO and CRT2FLACO.

  4. 4.

    In Scenario I and II, the FND of PEGASIS is the minimum one, because in the process of chain construction the inevitability of long link leads to the premature death of some nodes which consume more energy than other nodes. Figure 16a shows a long link in the process of chain construction of PEGASIS. Although PEGASIS is poorest one for FND, it outperforms LEACH and EEUC for HNA and LND. However, for the three scenarios, LEACH’s performance is almost the poorest one, because the method of CHs selection of LEACH is totally random, which causes the CHs distribution is unreasonable, some CHs may bear the heavier load and consume more energy lead to uneven energy consumption of WSN. In addition, the number of CHs per round is not stable, generating the instability of network. Figure 16b gives the nodes and CHs distribution of LEACH protocol for some round, one can see that some CHs are gathering, and some CHs are on the edge of the area of WSN.

  5. 5.

    From the shapes of the curve in Figs. 8, 11 and 14, we observe that the remain nodes of our CRT2FLACO protocol will die very fast when the first node dies, which means all the nodes’ energy were consumed very averagely. This also shows that our proposed algorithm is more balanced comparing with the other algorithms. From Figs. 9, 12 and 15 we see that the ECPR of our proposed CRT2FLACO protocol is lower and more even than any other algorithms, and LEACH is the poorest one.

Fig. 16
figure 16

a A long link in the process of chain construction of PEGASIS, b The nodes and CHs distribution of LEACH protocol for some round, c The CHs distribution and the chain for data transmission of CRT2FLACO protocol for some round

To sum up, no matter what kind of the three scenarios, our proposed algorithm outperforms other four algorithms with the more lasting lifetime and best load balancing. Analyzing the reasons, on the one hand, CRT2FLACO comprehensively considers the three important factors of the residual energy, neighbor nodes and the distance to the BS of a node to calculate the probability of the node to be the candidate CH. It does not only eliminate the randomness of CHs selection, but also deals with better the uncertainty existed in WSN by using type-2 fuzzy logic; On the other hand, bring in fuzzy competition radius mechanism, CRT2FLACO rules out other candidates CHs in the competition radius of the selected CH, making the final CH distribution more uniform, more reasonable. Moreover, inspired by PEGASIS, all the CHs are linked into a chain using ACO algorithm, that not only reduces the energy consumption of CHs transmitting data package to BS, but also balances the energy consumption of CHs. Fig. 16c shows the CHs distribution and the chain of transmitting data of CRT2FLACO algorithm in one round.

5.5 Comparisons Between CRT2FLACO and ICT2TSK Protocols

According to the reviewer’s comments, we conduct a comparison between our CRT2FLACO protocol and the ICT2TSK protocol proposed in [18] in this section. We fix the number of nodes as 200, and consider three different cases that the BS is located at (100 m, 100 m), (100 m, 250 m) and (100 m, 400 m), respectively. Simulation results are as follows.

Table 3 provides the values of FND and HNA for CRT2FLACO and ICT2TSK protocols. It often happens that ICT2TSK couldn’t choose CHs in the end of rounds, and then there is no energy consumption at last. So we cann’t get the real LND value.

Table 3 The values of FND and HNA for CRT2FLACO and ICT2TSK

Figure 17 shows the alive nodes distributions with respect to the rounds for the six protocols. Figure 18 compares the energy consumption per round (ECPR) of six algorithms. From them we see that the energy consumption of our CRT2FLACO protocol is lower than ICT2TSK in case that BS is located very far from the monitored area, but a little higher than ICT2TSK in the other two cases. However, we can find the energy consumption of CRT2FLACO is very balanced from the ECPR graph.

Fig. 17
figure 17

The number of alive nodes over some rounds for 200 nodes. a BS (100 m, 100 m), b BS (100 m, 250 m), c BS (100 m, 400 m)

Fig. 18
figure 18

The amount of ECPR for 200 nodes. a BS (100 m, 100 m), b BS (100 m, 250 m), c BS (100 m, 400 m)

In summary, CRT2FLACO outperforms ICT2TSK in load balancing and robustness, however ICT2TSK outperforms CRT2FLACO in the network lifetime. And the performance of CRT2FLACO is good as a whole.

6 Conclusion and Future Work

In order to improve the life cycle and balance the network load of the WSN , this paper proposes a novel routing protocol CRT2FLACO based on type-2 fuzzy logic. CRT2FLACO protocol comprehensively considers the three important factors of residual energy, neighbor nodes and the distance to the BS as T2MFLS input to calculate the probability of a node becoming the candidate CH and competition radius. The usage of type-2 fuzzy logic can handle uncertainties existing in WSN better than type-1 fuzzy logic, the introduction of fuzzy competition radius and using multi-hop routing mechanism for data transmission can balance the network load better and cut the energy consumption greatly.

Good performance of our proposed algorithm has been demonstrated by the simulation experiments. CRT2FLACO protocol can effectively balance the network load and save energy, so as to prolong the network lifetime. However, the rules in our T2FLS are fixed and defined by experience. In our future research work, we would like to design the adaptive algorithm to optimize the rules and parameters of our T2FLS so that our CRT2FLACO protocol can be applied to more network.