Keywords

1 Introduction

Sensor nodes in WSNs are deployed to gather information from the monitoring area and the same is forwarded to the sink for further processing with the help of forwarding nodes as shown in Fig. 1. Sensor nodes that are deployed in the sensing environment are powered by batteries and are not replaceable. Forwarding the collected data by the deployed sensor nodes may cause congestion at the junction nodes due to high rate of traffic flowing toward the sink. Congestion in the network occurs due to an increase in the traffic load than the allowed traffic load by the network at any instance. Delay in packet arrival, raise in packet loss, re-transmissions leads to excess consumption of energy, degrade in channel quality are some of the impacts of congestion in the sensor network. Therefore, congestion has to be detected and mitigated for smooth operation of the network. Many protocols have been proposed for dealing with congestion and they are categorized based on traditional congestion control protocols and soft computing-based congestion control protocols.

Fig. 1
figure 1

Network scenario of WSN

The current work proposes a fuzzy mechanism for detecting, estimating and mitigating congestion. The contribution to this work is as follows:

  • Active Queue Management (AQM) is used for detecting and estimating the level of congestion using Fuzzy Logic System (FLS).

  • Information about the congestion is informed to child nodes using Implicit Congestion Notification (ICN).

  • Congestion is mitigated using rate adaptation method.

The flow of paper is as follows: Investigation on existing congestion control protocols in WSNs is done in Sect. 2. Section 3 highlights the preliminary of the proposed protocol. The proposed congestion control method is described in Sect. 4. Results are discussed in Sect. 5, and Sect. 6 concludes the work.

2 Related Works

Extensive studies are made on congestion control protocols since recent years. These studies are made on different layers of WSNs. Some of the studies are as follows:

The modified version of priority-based congestion control protocol (PCCP) is Queue-based Congestion Control Protocol with Priority Support (QCCP-PS) [1]. PCCP is enhanced by including queue management function. To measure the degree of congestion, queue length is used as an index. Each source node’s traffic rate depending on the congestion degree will either increase or decrease. To minimize the packet drop in WSNs, buffer of each sensor is regulated matching the transmitting rate of the downstream sensor nodes. An algorithm assigns a data forwarding rate to the nodes to avoid packet drops, which is caused by congestion. The algorithm equally allocates the bandwidth to the sources and solves the fairness problem. Detecting congestion and adjusting the transmission rates of the nodes for the purpose of mitigating congestion with minimum loss is presented in ref. [2]. Queue Management-Based Congestion Control (QMCC) [3] reduces the packet loss by efficiently managing the queue. Congestion is detected by assessing length of node’s queue and its parent’s queue. Based on the buffer occupancy of a node and its parent’s, the transmission rate is adjusted. Packets are of various types and are of different importance. Packets having higher priority have to be handled in different ways than the packets having lower priority. Congestion control protocols based on priority mentioned are as follows: In priority-based congestion control protocol (PCCP) [4], computing the degree of congestion is done using the ratio between the arrival of packets and service time of packet. Various levels of priority indices are taken into account considering the requirement of higher bandwidth by a node for generating high traffic. According to the degree of congestion and priority index of a node, rate adjustment is undertaken. Prioritized Heterogeneous Traffic-oriented Congestion Control Protocol (PHTCCP) [5] ensures an efficient rate control for prioritized heterogeneous traffic. When a packet enters a node, it is classified based on the priority and is placed in specific traffic class. A packet generated by a node will be assigned a lower priority than a packet, which is forwarded by neighboring node. Congestion notification is implicit and controlling the congestion is implemented using hop-by-hop manner. Dynamic predictive congestion control protocol DPCC [6] is designed to predict congestion and dynamically distribute the traffic over the network in a fairly manner. DPCC has three parts, viz., dynamic rate adjustment using priority, predictive congestion detection technique and node selection based on backward and forward mechanism. DPCC detects the congestion by integrating the unused buffer of a node along with the traffic rate at MAC layer. Considering the queue length, a congestion control mechanism based on priority is proposed in Wireless Body Area Network [7]. Having two modules, quick start module begins with large number of packets but packet forwarding rate to sink is low. Congestion detection, congestion notification and congestion avoidance are three different phases present in congestion control module. Fuzzy-Based Adaptive Congestion Control (FBACC) [8] detects and manages congestion by providing a fuzzy logic controller for the purpose of predicting the congestion, and traffic rate is adjusted. Traffic rate, occupancy of buffer and the number of participating nodes are the inputs for fuzzy logic controller by the algorithm, and rate of transmission is used as output. A node upon identifying congestion, it sends congestion notification to its neighboring nodes for adjusting the transmission rate. Zone-based routing protocol in association with balancing the energy in the network approach is proposed in ref. [9]. The work in ref. [10] has proposed an energy efficient-based hierarchical multi-path routing protocol with an intension of clearing the congestion and balancing the energy consumption in the network.

3 Preliminaries of the Proposed AQM Model

3.1 Active Queue Management

The basic idea behind active queue management scheme is to proactively drop all the incoming packets by a node much earlier the node’s buffer gets overflow. It provides different Quality-of-Service (QoS) for different traffic and priorities.

AQM scheme has the performance advantage of two thresholds over single threshold. The two threshold values can be adjusted for a lesser delay for the same throughput.

3.1.1 Random Early Detection (RED)

RED is a frequently used technique for AQM in WSNs. Congestion probability is identified by this algorithm and if congestion is detected, the arriving packet will be marked or dropped. Figure 2 depicts the working of RED algorithm.

Fig. 2
figure 2

Operation of RED

The decision for marking or dropping a packet is based on average weighted queue length (Qlenavg). Suppose a packet enters a node and the weighted average queue is less than MinTh, the minimum threshold, then the incoming packet is kept in queue and if (Qlenavg) is higher than MaxTh, a maximum threshold, then the arriving packet is marked or dropped. But if (Qlenavg) is between MinTh and MaxTh, packets are marked Pa, which is the packet drop probability. Maxp is default value of maximum packet drop probability. Probability for dropping or marking a packet is expressed as in Eq. (1):

$$P\left( a \right) = \left\{ {\begin{array}{*{20}c} 0 & {Q_{{len_{avg} }} < MinTh} \\ {\frac{{Q_{{len_{avg} }} - MinTh}}{MaxTh - MinTh} \times Max_{p} } & {MinTh \le Q_{{len_{avg} }} < MaxTh} \\ 1 & {MaxTh < Q_{{len_{avg} }} } \\ \end{array} } \right.$$
(1)

If Maxp is at higher probability, than an incoming packet is dropped by RED algorithm and shows the presence of congestion at higher level in the network. If Maxp is at lower level, then the packet is allowed to enter the queue and is further processed.

4 System Model

Nodes that are deployed in the network are autonomous and perform computation and dos the communication job with each other by exchanging and forwarding messages.

4.1 Problem Statement and Objectives

The objective of this work lies in identifying congestion level and mitigating it using fuzzy system. Fuzzy system takes two variables as inputs and generates the output using the inference mechanism. Output of the fuzzy system informs the presence of congestion and its level in the network. Based on the level of congestion identified by the fuzzy system, notification for the presence of congestion is sent to the child nodes and congestion is mitigated using the rate adaptation method.

4.2 System Architecture

System architecture consists of three different models, viz. congestion detection module, congestion notification module and congestion mitigation module. System architecture for the proposed work is as shown in Fig. 3.

Fig. 3
figure 3

System architecture

4.2.1 Congestion Detection Module

Incoming and outgoing ratio of packets, average queue size, number of competitors nodes waiting to send the data packets and the average delay of packets are some of the indicators that can used as metrics by fuzzy logic system to estimate the congestion. Numbers of contending nodes are the neighboring nodes having packets in their buffer and waiting to send them into the MAC layer region instead on transmission path. The count of contender nodes can be calculated with the help of RTS/CTS packets, which are originated by neighboring nodes. If the number of contenders is high, probability of packet collision is also high. Hence, the number of contenders can play a vital role in congestion indicator. The hop count value is inserted into the header of the packet and initialized with the value zero when generated by a source node. At each hop, as soon as a packet arrives at a node, it increases the current hop count value by one. This indicates how many hops a packet has traveled to reach a node from the source node. The total delay faced by a packet is also inserted in the header part of packet. Just before transmitting a packet, a sensor node calculates the time duration between the time a packet is received by the node and the time a packet is about to be forwarded by a node. The average delay is computed by dividing the total delay by hop count current value. Average delay is divided into four intervals, viz. d1, d2 and d3 where d1\(<\)d2\(<\) d3. The weight of the average delay of packets (Wd) is computed as follows:

$$P\left( a \right) = \left\{ {\begin{array}{*{20}c} 0 & {{\text{if average delay}} \le d_{1} } \\ 1 & {{\text{if d}}_{1} < {\text{average delay}} \le d_{2} } \\ 2 & {{\text{if d}}_{2} < {\text{average delay}} \le d_{3} } \\ 3 & {{\text{if d}}_{{3}} < {\text{average delay}}} \\ \end{array} } \right.$$
(2)

Fuzzy logic system uses average delay and the number of contender nodes as metrics and hence, fuzzy set has two fuzzy variables as shown in Fig. 4.

Fig. 4
figure 4

Congestion Detection Module

$$F = \left( {C,D} \right)$$
(3)

where C denotes the number of competitor nodes and D represents the average delay of packet.

Fuzzy Logic System embeds average delay and number of contender nodes into a single value for estimating the congestion level. The membership function for the inputs is denoted using three linguistic variables Low(l), Medium(m) and High(h). Output membership function is having four linguistic variables Zero(Ze), Lower(Lo), Medium(Md) and High(Hg). The resources available in sensor networks are not abundant and hence triangular shape membership.

Function is used considering it as an easier one for computation. Membership function for the fuzzy variables C and D is as shown in Fig. 5.

Fig. 5
figure 5

Membership function for fuzzy variables (a) C and (b) D a number of competitor nodes b average delay of packets

Fuzzification and defuzzification steps use the membership functions and there are two membership function set, each has a separate function for l, m and h variables. The three different fuzzy classes for fuzzifier are l, m and h for each fuzzy variable:

$$F:\left( {\alpha ,\beta } \right) \to \left( {\alpha^{f} ,\beta^{f} } \right)$$
(4)
$$X^{f} = \left[ {\mu_{X}^{l} ,\mu_{X}^{m} ,\mu_{X}^{h} } \right]$$
(5)

where X is the representation for the variable α and β membership function is used to calculate the fuzzy values. In the second step inference, combining the fuzzy rules which are taken from the fuzzy rule base is used for generating the output variable. Fuzzy rules are made up of simple ifthen condition with a conclusion. Having two fuzzy variables with three different fuzzy classes for each variable, rule base has 32 \(=\) 9 rules. The outcome of each rule is computed using rule evaluation method (REM). The weights of the fuzzy classes for α and β are assigned as l \(=\) 1, m \(=\) 2 and h \(=\) 3. The output of a fuzzy rule θr is calculated by adding the weight of r and r. Rule base of the proposed fuzzy inference system is shown in Table 1, where θ corresponds to the output calculated using REM.

Table 1 Fuzzy rules

Product inference rule is used in the proposed FIS as it allows mathematical simplification in the defuzzification. Therefore,

$$\mu_{r} = \mu_{\alpha }^{{f_{\alpha }^{r} }} \left( \alpha \right) \times \mu_{\beta }^{{f_{\beta }^{r} }} \left( \beta \right) \times \mu_{c}^{r} \left( {\theta_{r} } \right)$$
(6)

where r and r are fuzzy classes l, m or h Defuzzification is the final step and is a process of converting fuzzy output obtained from FIS to a crisp value. The output of the defuzzifier can be calculated as follows:

$$\omega = \frac{{\sum\nolimits_{n = 0}^{9} {\theta_{r} \mu_{r} } }}{{\sum\nolimits_{n = 0}^{9} {\mu_{r} } }}$$
(7)

where θr is the output of the rule and µr is the output of the product inference system. The output of the FLS, w becomes a crisp value.

4.2.2 Congestion Notification Module

Upon detecting the congestion in the network, intermediate nodes are sent a signal regarding the congestion using Implicit Congestion Notification (ICN) method. It piggybacks the congestion message to intermediate nodes using header part of data packet and thus an extra control message is avoided.

4.2.3 Congestion Mitigation Module

Our proposed model classifies w into three different classes like No Congestion (NC), Medium Congestion (MC) and High Congestion (HC). At NC level, congestion mitigation module does not take any action as sensor nodes are able to handle the traffic load. If the congestion level is at (MC) or (HC), congestion mitigation is activated using rate adaptation method. Rate adaptation presented using a generic function is given as follows:

$$r = \left\{ {\begin{array}{*{20}c} {r_{1} } & {\text{if CL = NC}} \\ {r_{2} } & {\text{if CL = MC}} \\ {r_{3} } & {\text{if CL = HC}} \\ \end{array} } \right.$$
(8)

CL indicates the congestion level and r is the rate of data packet of the application. The data rates defined by the application are as follows: r1 r2 and r3. Transmission rates of data packets are adjusted by the sensor nodes based on the r value in the congestion mitigation module. Algorithm for mitigating congestion is presented in Algorithm 1.

5 Experimental Results and Discussions

In this work, for simulating the results of the proposed work, Matlab is used. The proposed work is compared with PCCP and PHTCCP protocols. Matlab is used to

figure a

implement fuzzy systems and simulation. To find the packet loss rate, the following equation is used:

$${\text{Loss Rate = Packet loss/Time}}$$
(9)

Figure 6 shows the packet loss ratio. Packet loss ratio is the count of packets lost per unit time normalized between [0.0 and 1.0]. During the early stages of simulation, congestion is not observed, and rate adjustment also does not get initiated, and hence, high packet loss rate is observed. In the next stages, as the rate is adjusted, decreased packet loss can be seen. End-to-End delay is defined as the sum of delays at a source node and delay on a path. The total number of packets stored in a queue is termed as length of the queue. Length of the queue increases during the inter-arrival time of the packet is higher than the servicing time spent for a packet. Shorter queue length is the result of the better congestion control algorithm. If congestion control algorithm fails, it leads to an increase in queue length at intermediate nodes in the network. Fuzzy rate adjustment unit allocates the forwarding rate for each sensor node such that the rate of output will always be equal to or higher than the input rate. Figure 7 depicts the average length of the queue of a node positioned near the sink node. The proposed protocol has resulted in shorter queue length than PCCP and PHTCCP approaches. The Proposed approach well suits for the applications which are not delay tolerant. Packet loss probability tells about the frequency of packet drops by a node in the network. In case of packet drop, source node has to retransmit the dropped packet. Figure 8 shows the increase in packet loss probability at initial stage and after some time, the same is controlled by the proposed methodology.

Fig. 6
figure 6

Packet loss ratio

Fig. 7
figure 7

Average queue length

Fig. 8
figure 8

Packet loss probability

6 Conclusion

A congestion control mechanism based on FLS is proposed in this paper. The number of contender nodes waiting to send packets to their parent nodes and average delay of packets are the two variables considered as input to the FLS. The output of the FLS determines the level of congestion at a node. The rate adjustment scheme is applied to mitigate congestion and avoid packet drops. Results obtained through simulation depict that the parameters like packet loss ratio, End-to-End delay and average queue length perform better than PCCP and PHTCCP schemes.