1 Introduction

Thanks to the rapid development of the networks of video sensors in recent years, there are increasing demands in multimedia wireless sensor networks (WMSNs) such as multimedia observation, traffic observation and real-time object tracking systems. WMSNs can be described as a group of connected wireless sensors which can gather multimedia data along with numerical data from environment and transmit them to the base station. Accessing high-quality video at the base stations is one significant objective in WMSNs where the traffic resulted from it can result in network congestion.

A notable number of research studies have been carried out with regard to the congestion issue of wireless networks. In a general, the related research studies and methods can be classified into four major groups: 1. Queue-help protocols, 2. Priority-aware protocols, 3. Topology detection protocols and 4. Resource control protocols. Indeed, queue-help protocols focus more on queue length and nodes and use a rate regulating method such as additive increase/multiple decrease (AIMD). Priority-aware protocols consider different priorities of nodes under congestion conditions and try to provide equal services for nodes within the same priority class. Topology forming protocols are adjusted and regulated with regard to the input rate of nodes; this process is usually carried out through activating or deactivating nodes near the congestion area. However, changing network topology is not always practical and it might have lower efficiency for intermittent networks. Furthermore, resource control protocols control the degree of energy consumption of resources in nodes near the congestion area.

In general, with regard to the limitations of resources in these networks and the number of distributed sensor nodes for covering operational environment, congestion and density of information will occur in intermediate nodes because sensor nodes compete with neighboring sensor nodes for transmitting their information so as to access a wireless communication channel. Also, due to the large number of nodes and the limitation of their resources, the transmission of information through a common and shared channel will lead to congestion and density. Information congestion in WSNs has a negative impact on the efficiency of these networks such as reduced throughput, increased energy consumption for each transmission packet, increased delay and increased number of lost packets. On the other hand, the centralized traffic pattern in WSNs leads to the creation of congestion in these networks because all the information is transmitted towards one sink.

In case the injected load on network is greater than its capacity or in case communication bandwidth is reduced due to the problems of wireless channels, congestion will occur. Hence, for reducing the number of lost packets due to the congestion of buffer nodes and for timely and energy-efficient transmission of information and preventing network deadlock, it is essential to propose a protocol for controlling congestion for WMSNs. Accordingly, in this paper, an attempt was made to control congestion by using significant parameters such as the energy of nodes, accessible bandwidth and load density.

2 Related Works

In WSNs, congestion detection mechanism usually depends on the followings: measuring packet service time, ratio between packet service time and packet input time [1, 2] or queue length in an intermediate node [3, 4]. There are a number of congestion control protocols for WSNs and the main difference between these protocols is related to the manner of detecting congestion, the manner of diffusing congestion-related information, rate adjusting and regulating method when congestion occurs.

Despite the merits of end-to-end congestion control, transmitting congestion-related information between first and last nodes leads to system dullness. Congestion control is rapidly carried out hop-by-hop for reducing the number of lost packets which is appropriate for WSNs. In general, congestion in WSNs can occur at the level of nodes or at communication links. Congestion at the node level is attributed to node overflow which leads to the loss of packets or an increase in delay. On the other hand, congestion at communication links is attributed to the feature of wireless channels and the competitive feature of sensor nodes for accessing a communication channel.

Congestion Detection and Avoidance (CODA) protocol is regarded as one of the early protocols for detecting congestion avoidance for WSNs. In this protocol, congestion detection is carried out through sampling wireless media and observing queue of nodes. In case congestion is detected by one node, that node transmits a congestion detection message to the previous nodes. Consequently, previous nodes begin to reduce their own data transmission for preventing congestion. This protocol uses mass increase and multiple decrease. Due to the partial reduction in data transmission for avoiding congestion in CODA protocol, packets are still retransmitted because of their loss during the occurrence of congestion in the network [5].

FUSION protocol use the following three techniques for controlling congestion: 1. Hop-by-hop control of the flow of data transmission, 2. Limiting the transmission rate of the source node and 3. Controlling the priority of accessing the transmission media. By limiting the data transmission rate of the intermediate and the source nodes, this protocol reduces congestion. However, for constant limitation of the data transmission rate of nodes, parent nodes observe themselves which leads to the consumption of more energy [6].

Congestion Control and Fairness (CCF) protocol uses the parameters of packet service time and the available service rate for detecting congestion in the intermediate node. Congestion information is negatively reported. This protocol controls congestion via the hop-by-hop method and each of the nodes uses a precise rate regulating approach which is based on its own available service rate and the number of child nodes. CCF provides simple neutrality and impartiality in such a way that each of the nodes can obtain equal operational power. In this protocol, the rate regulating approach only considers the parameter of packet service time which results in the reduction of network efficiency [7].

Priority-based Congestion Control Protocol (PCCP) protocol takes into account a new variable called the degree of congestion which is equal to the ratio of average packet service time to the average packet entrance time in each sensor node. The degree of congestion indicates current congestion level for each of the sensors. Considering congestion degree, this protocol uses a hop-by-hop rate regulating method, referred to as rate regulation, based on priority. This algorithm is only able to regulate and adjust the transmission rate of the nodes in a WSN which uses one-way routing algorithm. Hence, it cannot be efficiently used in a network which uses multi-path routing algorithm. It should be noted that neither Congestion Control and Fairness (CCF) nor PCCP considers the efficiency of current queue resulting delay increase. The main limitation and shortcoming of PCCP is related to not restoring lost packets [8].

Cross-layer protocol (XLP) protocol detects congestion in a node through comparing packet input rate of a node and their outputs. Then, this protocol reduces congestion by decreasing packet transmission rate through intermediate nodes and the source node [9].

Predictive congestion control (DPCC) protocol dynamically predicts the presence of congestion in network nodes and distributes traffic in the entire network so as to prevent congestion in the network. Indeed, this protocol is intended to prevent congestion in WMSNs by considering the parameter of variable priority. DPCC supports three different types of traffic: first, urgent and essential traffic type which is both important and real-time; secondly, fast traffic type which is real-time but not important; thirdly, ordinary traffic type. At first, each of these traffic types, by default, has different priorities which can vary by being placed in different phases. This algorithm uses a parameter, namely congestion index, only for balancing the traffic rate of available nodes near the base station [10].

Queue based Congestion Control Protocol with Priority Support (QCCP-PS) protocol is considered to be a congestion control protocol based on priority queue in which queue length is regarded as the index of density degree. This protocol controls congestion based on the priorities of sensor nodes; in other words, it can be argued that it controls congestion according to the priorities of the packets related to each node. This protocol improves the efficiency of the PCCP protocol by precisely controlling queue. However, it should be noted that it does not have any mechanisms for considering heterogenous traffic prioritization in network. In QCCP-PS, the transmission rate of each traffic source increases or decreases based on its density degree and priority index [11].

Fairness-aware congestion control (FACC) protocol is regarded as a fair congestion control protocol based on rate which divides all intermediate nodes into two adjacent categories: intermediate nodes adjacent to the source and intermediate nodes adjacent to the base station. This protocol detects congestion with regard to the rate of packet loss in the sink node. When a packet is lost in the neighboring node of base station, that node transmits a WM message to the neighboring node of the source. When this node receives WM message, it transmits the CM message in response for informing it to update its transmission rate. These messages lead to an increase in the network overload. Also, in case a message is lost, it results in the breakdown of the path. Consequently, a problem will be caused with regard to reporting congestion and regulating transmission rate [12].

Enhanced congestion detection and avoidance (ECODA) protocol uses buffer threshold and buffer weight difference for detecting congestion. This method is considered to be a different traditional threshold control method. This method can distinguish congestion level and the manner of treating and handling this issue. In general, ECODA consists of three mechanisms: 1. using buffer threshold and buffer weight difference for detecting congestion, 2. using a flexible queue scheduler based on packet priority, 3. sending transmission rate control scheme by the bottleneck source node when congestion continues. Also, this protocol uses hop-by-hop congestion control method for transient congestions [13].

Control of Sensor Queues (CONSEQ) protocol detects the available congestion in sensor nodes with regard to the length of the queue and by observing the status of the single-hop neighboring nodes’ channels. Based on the measurement of the congestion level, each node dynamically regulates its own packet transmission rate and balances its load level on neighboring sensor nodes so as to prevent congestion occurrence to some extent and the conversion of a node into a bottleneck in the network. CONSEQ protocol does not need end-to-end or multi-hop feedback on the part of the sink nodes and since this method locally detects the presence of congestion and is executed hop-by-hop, it rapidly reacts to the covert congestion of nodes [14].

Event-to-sink reliable transport protocol (ESRT) protocol observes the reliable event transmission to the sink node to the local buffer level in the intermediate node. When buffer overflows, it puts the congestion declaration bit in the packet. If the base station receives a packet in which the congestion declaration bit is put, this protocol diffuses a control signal for informing all the nodes so that they can reduce their transmission rate according to a specific ratio. Regardless of the placement location of nodes in the network, this protocol reduces the transmission rate of all the nodes when it updates the congestion [15].

In this paper, a congestion control algorithm was proposed by means of fuzzy logic. In this section, we described and elaborated the proposed method. Finally, the results of simulating the proposed method were compared with those of IEEE802.15.4 standard protocol.

High-volume transmission of video streams in sensor networks has many challenges. One challenge is related to the high probability of congestion occurrence which is attributed to high rate and the explosive feature of stream videos and also limited resources in sensor networks. Indeed, in this paper, a novel congestion control method has been introduced for these networks.

According to the given inputs (the remaining energy level of the node, load density and accessible bandwidth), fuzzy system considers an output mode for each node so that it can determine the priority of each node for being selected to transmit data based on the predicted congestion rate. Hence, a threshold for congestion is specified. The closer the deviation from threshold to zero, the better it is in terms of quality index. Thus, such a node is regarded as a high priority for being selected.

3 The Proposed Method

In this paper, we proposed a fuzzy system with three inputs for controlling congestion. That is, the information of the input parameters of each video sensor is available for the sink node. There is a smart system on the sink node which can smartly make decisions with regard to the information of nodes and the transmission of video information. The smart system on the sink node is responsible for detecting congestion and transmitting video information (Fig. 1).

Fig. 1
figure 1

The proposed general diagram block

3.1 Fuzzification

In this stage, fuzzy sets are defined for the fuzzy input and output variables. The conversion of real inputs to appropriate fuzzy sets so as to be applied in the inference engine is referred to as fuzzification. In other words, it can be maintained that fuzzification is an interface between the real inputs and the inference engine. In the proposed method, the input of the fuzzy system considers three parameters: degree of load density, energy level of the battery and the bandwidth of the node (Fig. 2).

Fig. 2
figure 2

The proposed fuzzy system

For each of the input variables, three fuzzy sets with trapezoidal membership functions are defined (H indicates the upper limit and L denotes the lower limit) which are illustrated in Figs. 3, 4 and 5. The reason for using trapezoidal membership functions is that it is precise. Also, for the output, five fuzzy sets with triangular membership functions (VH indicating very high limit, H indicating high limit, M denoting intermediate limit, L denoting low limit and VL indicating very low limit) were used which are illustrated in Fig. 6.

Fig. 3
figure 3

Energy of first input in the fuzzy system

Fig. 4
figure 4

Load density of the second input of the fuzzy system

Fig. 5
figure 5

Bandwidth of the third input of the fuzzy system

Fig. 6
figure 6

Membership function of the output of fuzzy system

3.2 Fuzzy Inference Engine

In the inference stage, using fuzzy rules, we considered 4 congestion rates with regard to the values of the parameters, i.e. the distributed load density in the sensor, battery level energy and bandwidth. Rach fuzzy rule includes three parts. The introductory part is: “if the distributed load density in the sensor is high and the battery level energy and bandwidth are low” and the result section is: “then, the congestion rate will be high”. In the proposed method, Mamdani minimum was regarded as the fuzzy inference engine. Two fuzzy sets were defined for each of the three input parameters; hence, eight fuzzy rules are obtained which are given in Tables 1 and 2.

Table 1 Rules of fuzzy system
Table 2 Database of fuzzy rules

3.3 Non-fuzzification Stage

Non-fuzzification was aimed at translating fuzzy input into numerical value. In the proposed method, the non-fuzzification of the average of centers was used which is measured using Eq. 1.

$${\text{Fitness Rate}}\; = \;\frac{{\sum\nolimits_{l = 1}^{m} {y^{ - l} \prod\nolimits_{i = 1}^{n} {\mu A_{{_{i} }}^{l} (X_{i} )} } }}{{\sum\nolimits_{l = 1}^{m} {\prod\nolimits_{i = 1}^{n} {\mu A_{{_{i} }}^{l} (X_{i} )} } }}$$
(1)

The parameters of this equation are: i which denotes path index; m refers to the number of fuzzy rules (here it is 8); n indicates the number of membership functions of input variables (here, it is 3) \(\mu A_{{_{i} }}^{l} (X_{i} )\). Refers to the fuzzy value of membership functions and \(y^{ - l}\) denotes the output centers (Table 3).

Table 3 Parameters and initial values for simulating

3.3.1 Designing a Smart Decision-Maker System for Detecting Congestion

In the proposed protocol, a node is selected based on fuzzy system. Indeed, in designing a decision-making and congestion detecting system, a fuzzy system was used which is responsible for detecting congestion and transmitting video information. The designed system is a fuzzy system with three inputs in which Mamdani fuzzy system was used. The mechanism of fuzzy logic for controlling congestion in a node was designed according to the inputs of load density, node energy and accessible bandwidth in sensor networks. This mechanism is considered to be a smart congestion controlling system based on fuzzy logic and it was assumed to be an adaptive fuzzy control.

3.3.2 Inputs of Fuzzy System

The first input of the fuzzy system is the energy of the nodes. Since video data has large size, a lot of energy is required for processing and transmitting video data. In this mode, the energy of wireless sensor nodes is remarkably of high significance. The priority of transmitting information is for the node which has more energy than other nodes.

This criterion is determined according to the fact that what size and volume of information is fed into the nodes. At the time of congestion occurrence in a node, the energy of the node is dramatically reduced. In this mode, when the amount of energy is less than half of the energy stored in the battery, it is assumed that the energy level is low; however, when the energy amount is more than half of the stored energy in the battery, it is assumed that the energy amount is high.

The second index which is of high significance for determining a node for data transmission is load density. The lower load density, the more appropriate it is for transmitting video.

The third input for the fuzzy system is bandwidth. The higher bandwidth in a node, the more appropriate is this index.

Also, the rules of fuzzy system obtained by these three inputs have been regulated in five modes, namely VL–L–M–H–VH. The output of congestion rate depends on these criteria.

Output membership function was also investigated. In this stage, the fuzzy system was assumed to consider a criterion or state for each node based on the entered inputs so that the status of each node to be selected for transmitting video images is determined. The threshold value was assumed to be 0.5 or M. The more output value from the threshold is near zero, it is assumed to be more appropriate in terms of the quality index of congestion rate. Hence, it is the priority for being selected.

3.3.3 Simulation Environment

In this paper, for simulating the proposed protocol and comparing it with IEEE 802.15.4, the OPNETModeler simulating software was used.

In the proposed method, network topology was assumed to be 45. Two scenarios were simulated and investigated in this study. The first one was based on IEEE 802.15.4 in WSNs which is considered to be a standard protocol with low data rate, low energy consumption and low costs and the second one is based on fuzzy logic algorithm. Indeed, IEEE 802.15.4 is highly flexible and is appropriate for real-time applications in WSNs. An identical topology was considered for both scenarios. Results of simulating the proposed protocol is given below.

As illustrated in Fig. 7, the topology includes 45 nodes which were distributed on 100 × 100 m area. Also, Fig. 8 depicts a view of node editor for the simulated model which concretely displays the constituting components of a sensor node.

Fig. 7
figure 7

A view of network editor for the simulated model

Fig. 8
figure 8

A view of node editor for the simulated model

4 Simulation Results

As shown in Fig. 9, the average network energy consumption for the fuzzy algorithm scenario and IEEE 802.15.4 scenario were compared with another. The vertical axis indicates the energy consumption and the horizontal axis denotes time. As it is expected, IEEE 802.15.4 has the highest energy consumption. It should be noted that sub-nodes of network do not operate knowingly; hence, regardless of the energy level of a node, they directly transmit data to the sink node. In contrast, in the proposed methods, those nodes are used for transmitting data which have had the minimum congestion rate. Inasmuch as the best nodes are selected according to the criteria of load density, bandwidth and nodes’ energy, hence, it consumes less energy than the standard IEEE 802.15.4 protocol.

Fig. 9
figure 9

Energy consumption of network

Furthermore, Fig. 10 depicts a comparison of the end-to-end delay for both scenarios, i.e. fuzzy logic algorithm and standard IEEE 802.15.4 protocol. The vertical axis denotes end-to-end delay and the horizontal axis refers to time. It is noted that delay increases in the IEEE 802.15.4 protocol because some nodes of the network might transmit some part of the data but do not have enough energy for transmitting the remaining part of data. Hence, they may not be able to complete information transmission. Nevertheless, in the proposed protocol, since there is the lowest congestion in the selected node with regard to the output value, delay is reduced. Also, nodes with the highest energy level were selected for transmitting data. Thus, the energy of such nodes are comparably higher and their congestion rates are less than other available nodes.

Fig. 10
figure 10

End-to-end delay for data frames

Consequently, it is expected that transmission delay is reduced as far as information transmission is not turned off.

Delay comparison of multimedia files in fuzzy logic algorithm and IEEE 802.15.4 scenarios is depicted in Fig. 11. The vertical axis denotes the delay of multimedia files and the horizontal axis refers to time. It is observed that delay in multimedia files increases in IEEE 802.15.4 protocol because congestion occurrence increases due to high data production rate in video transmission and the explosive feature. However, in the proposed protocol, since the node with the minimum congestion is selected with regard to the fuzzy output value, multimedia delay is reduced.

Fig. 11
figure 11

Medium access delay

Also, Fig. 12 compares the probability of successful data transmission to the sink node for both scenarios. It is observed that the percentage of successful transmission in the IEEE 802.15.4 protocol is low because some nodes of the network might turn off while they are transmitting the information; accordingly, information transmission operation might not be completed. Nevertheless, in the proposed method, since a node is selected which has low congestion rate, high energy, low load density and high bandwidth, the probability of data transmission to sink increases.

Fig. 12
figure 12

Sink success probability

Moreover, Fig. 13 depicts the ratio of signal to the produced noise. In other words, it indicates the degree of main signal power to noise power. The higher this ratio, the higher the quality of sound and video. As shown in Fig. 13, IEEE 802.15.4 protocol has lower signal to noise ratio than the proposed protocol; this is attributed to the fact that the transmitted information signal by IEEE 802.15.4 protocol might be lost due to the congestion and confusion; accordingly, noise probability increases. As a result, the quality of transmitted data (both multimedia and text data) decreases. In contrast, in the proposed protocol, we tried to control congestion via fuzzy logic. Hence, signal to noise ratio increases and the noise probability decreases.

Fig. 13
figure 13

The radio receiver signal/noise ratio

Moreover, Fig. 14 shows error rate in the received data bits in the sink node’s receiving radio. The horizontal axis refers to time and the vertical axis indicates error rate in the received data bits. As depicted in Fig. 14, IEEE 802.15.4 protocol has more error bits than the proposed protocol because the signal of the data transmitted by IEEE 802.15.4 protocol might get noise due to congestion; hence, it may be received with errors. However, in the proposed protocol, thanks to fuzzy logic, congestion is controlled. Consequently, the proposed protocol has the minimum bit error which is near zero.

Fig. 14
figure 14

Bit error rate in the receiving radio

Also, Fig. 15 illustrates the error rate in the received data packets in the sink node’s receiving radio. The horizontal axis denotes time and the vertical axis stands for error rate in the received data packet in the receiving radio. As illustrated in Fig. 15, it is noticed that IEEE 802.15.4 protocol has more error rate within the data packets than the proposed protocol. Again, it is attributed to the fact that the signal of the transmitted information by IEEE 802.15.4 gets noises due to the congestion; hence, data is received with error. In contrast, in the proposed method, fuzzy logic is used to control congestion. Consequently, the proposed protocol was able to have the lowest error rate near zero.

Fig. 15
figure 15

Bit error rate per packet

In addition, Fig. 16 depicts throughput rate in the sink node’s receiving radio. The horizontal axis denotes time and the vertical axis indicates throughput rate in the sink node’s receiving radio. According to this figure, it can be argued that the number of successfully delivered packets to the sink node is less than the total number of transmitted data packets by the sensor nodes which is attributed to congestion occurrence. Hence, IEEE 802.15.4 protocol has less throughput than the proposed protocol. This result can be justified and explained by the fact that the information signal transmitted by IEEE 802.14.5 protocol might be lost due to congestion. Hence, they cannot be delivered to the sink node. Nevertheless, in the proposed method, congestion is controlled by fuzzy logic. Hence, throughput is enhanced.

Fig. 16
figure 16

Throughput in the network

Also, Fig. 17 depicts the rate of data packet loss. The horizontal axis refers to time and the vertical axis denotes the rate of data packet loss. As shown in this figure, in IEEE 802.15.4 protocol, the number of delivered packets to the sink node is less than the total number of transmitted data which is attributed to congestion. Indeed, when compared with the proposed protocol, IEEE 802.15.4 has higher data packet loss rate because the signal of the transmitted information by IEEE 802.15.4 protocol is lost as a result of congestion. Hence, it is not delivered to the sink. However, capitalizing on fuzzy logic, the proposed protocol was able to control the rate of data packet loss.

Fig. 17
figure 17

Packet loss ratio

5 Conclusion

As observed and discussed in this paper, using fuzzy system in the proposed algorithm for selecting a node to transmit video can lead to the improvement of sensor network in terms of congestion control. It should be reiterated that the selected nodes used less energy, more bandwidth and less load density. the proposed protocol was able to reduce the rate of packet transmission; hence, the total congestion rate was reduced. Consequently, video transmission can be carried out with less energy consumption.