1 Introduction

Nowadays, Internet of Things (IoT) is playing a significant role in achieving various real-world applications, such as agricultural monitoring, intelligent transportation, disaster prediction and smart cities [1]. Within IoT framework, wireless sensor networks (WSNs) act as a bridge that connects the “things” in the physical world to the virtual digital world. In a WSN, a group of tiny sensors or actuators are wirelessly connected with each other, capable of collecting, computing and transmitting sensory data to the Internet [2, 3]. However, owing to open characteristics like large-scale, self-organizing, dynamic topology and battery-constrained, WSNs are very vulnerable to congestion problem, resulting in unsatisfactory situations such as higher packet loss ratio, longer delay and lower throughput [4]. Generally speaking, there are two representative reasons for congestion problem in WSNs [5]: (1) buffer overflow and (2) link collision. As shown in Fig. 1a, buffer overflow (node-level congestion) occurs when the number of transmitted packets exceeds the packet handling capacity of a particular node (node A), leading to packets drops and a waste of nodes’ energy. On the other hand, link collision (link-level congestion) occurs when many active nodes attempt to communicate with a particular node (node B) simultaneously, causing packet loss due to competition and interference, as shown in Fig. 1b.

Fig. 1
figure 1

Typical congestion occurrence scenarios in WSNs

In recent years, many researches have been carried out on the congestion control of WSNs and are mainly divided into two categories [6]: (1) traffic-based control and (2) resource-based control. In traffic-based congestion control schemes, the data rate of incoming flows from the downstream nodes is adjusted against the forwarding capacity of the upstream node(s). For instance, Javaid et al. [7] proposed a traffic-aware congestion control protocol (TACC) that operates on the end-to-end principle at the transport layer of wireless multimedia sensor networks (WMSNs). TACC uses burst loss information to detect congestion at the destination and directs source nodes to adjust reporting rate accordingly. However, TACC should be further improved to support prioritized event transport to multiple flows. Alipio and Tiglao [8] developed a new reliable transport protocol with a cache-aware congestion control mechanism called RT-CaCC. RT-CaCC utilizes cache management policies such as cache insertion, cache elimination and cache size allocation to mitigate packet losses in WSNs while maximizing cache utilization and bandwidth allocation. Nevertheless, the analysis of energy consumption, another significant metric of WSNs, is ignored. Zhuang et al. [9] analyzed the impact of congestion control on the data accuracy and proposed a Congestion-Adaptive Data Collection scheme (CADC) to efficiently resolve the congestion under the guarantee of data accuracy. CADC mitigates congestion by adaptive lossy compression while ensuring a given overall data estimation error bound in a distributed manner. Sonmez et al. [10] proposed a sensor fuzzy-based image transmission (SUIT) for wireless multimedia sensor networks (WMSNs). SUIT decreases the image quality on the fly to an acceptable level and thus improves the continuity of the video streaming. But SUIT does not use any ACK/NACK, resulting in receiver can only know about the loss of packets through packet sequence numbers. By combining standard particle swarm optimization (PSO) with single neuron PID control, Yang et al. [11] designed a standard PSO-neural PID congestion controller (PNPID), which outperformed the traditional PID controller in terms of convergence and accuracy. However, the performance of PNPID in different scenarios needs to be verified.

Resource-based congestion control, on the other hand, exploits the idle network resources to balance the traffic load whenever congestion arises [12]. For example, Nikokheslat and Ghaffari [13] used a hierarchical tree and grid structure to produce an initial topology and then utilized Prim’s algorithm to find appropriate neighbors. In their proposed method, a hierarchical tree structure was used to produce network topologies and a resource control algorithm was used as a factor to control congestion in WSNs. However, more convincing experiments should be performed to further justify their method. Kafi et al. [14] designed an efficient congestion control-based schedule algorithm, dubbed REFIACC (Reliable, Efficient, Fair and Interference-Aware Congestion Control) protocol. REFIACC prevents the interferences and ensures high fairness of bandwidth utilization among sensor nodes by scheduling the communications. The congestion and the interference in inter- and intra-paths hot spots are mitigated through taking into account the dissimilarity between links’ capacities at the scheduling process. Li et al. [15] proposed a discrete quasi-sliding mode control strategy (SMC) for link-level congestion in WSNs. By giving packets with minimum data a higher priority to be transmitted, queuing time can be decreased and congestion can be alleviated. Although MATLAB simulation results demonstrate the effectiveness of SMC, network characteristics of SMC should be comprehensively evaluated by using a dedicated WSNs simulation tool like NS-2.

To the best of our knowledge, this paper makes the following contributions: (1) We propose a cross-layer congestion control mathematical model between transmission layer and MAC layer by applying the signal-to-noise ratio (SNR) of wireless channel to transmission control protocol (TCP) model. (2) We design a fuzzy sliding mode control algorithm (FSMC) by combining fuzzy control with sliding mode control. FSMC not only adaptively regulates the queue length of buffer in congested nodes, but also effectively reduces the impact of uncertain disturbance and thus weakens the chattering phenomenon of queue length.

The rest of this paper is organized as follows: Sect. 2 introduces the mathematical model of cross-layer congestion control in WSNs. Section 3 describes the design of fuzzy sliding mode controller. Section 4 evaluates the simulation results in MATLAB/Simulink and NS-2.35, respectively. Finally, Sect. 5 concludes the paper and presents our future work.

2 Mathematical model

2.1 A SNR-based cross-layer congestion control model

Reference [16] proposed a dynamical model of TCP behavior by using fluid flow and stochastic differential equation analysis, while, in this paper, we present a novel cross-layer version of that model that uses the signal-to-noise ratio instead of packet-marking probability, as shown in Fig. 2. It can be seen that based on the received SNR from the wireless channel, the fuzzy sliding mode controller can adjust the queue length of buffer in MAC layer by dropping packets. Therefore, the proposed cross-layer model can be described by the following nonlinear differential equations:

$$\begin{aligned} \dot{W}(t) & = \frac{1}{R(t)} - \frac{W(t)}{2}\frac{W(t - R(t))}{R(t - R(t))}S_{nr} (t - R(t)) \\ S_{nr} (t) & = 1 - \frac{{{\text{SNR}}(t)}}{20} \\ \dot{q}(t) & = \left\{ {\begin{array}{*{20}l} { - C(t) + \frac{N(t)}{R(t)}W(t),} \hfill & {q > 0} \hfill \\ {\hbox{max} \left\{ {0, \, - C(t) + \frac{N(t)}{R(t)}W(t)} \right\},} \hfill & {q = 0} \hfill \\ \end{array} } \right. \\ \end{aligned}$$
(1)

where \(W(t)\) is the average TCP window size, \(C(t)\) is the link capacity, \(N(t)\) is the load factor, \(S_{nr} (t)\) is the corresponding value of the \({\text{SNR}}(t) \in \left( {0,{ 20}} \right]\), \(R(t)\) is the round-trip time and \(R(t) = T_{p} + \frac{q(t)}{C(t)}\), \(q(t)\) is the average queue length and \(T_{p}\) is the propagation delay.

Fig. 2
figure 2

Cross-layer congestion control model

The first differential equation in (1) describes the TCP window control dynamic. To linearize (1), we assume that \(N(t)\), \(C(t)\) and \(R(t)\) are constants, i.e., \(N(t) \equiv N\), \(C(t) \equiv C\) and \(R(t) \equiv R\). Consider \((W, \, q)\) as the state and \(S_{nr}\) as the input, the operating point \((W_{0} , \, q_{0} , \, S_{nr0} )\) is then defined by \(\dot{W} = 0\) and \(\dot{q} = 0\). Hence, we have

$$\left\{ \begin{array}{l} \dot{W} = 0 \Rightarrow W_{0}^{2} S_{nr0} = 2 \hfill \\ \dot{q} = 0 \Rightarrow W_{0} = \frac{{R_{0} C}}{N};R_{0} = \frac{{q_{0} }}{C} + T_{p} \hfill \\ \end{array} \right.$$
(2)

By linearizing (1) about the operating point \((W_{0} , \, q_{0} , \, S_{nr0} )\), it yields

$$\left\{ \begin{array}{l} \delta \dot{W}(t) = - \frac{2N}{{R_{0}^{2} C}}\delta W(t) - \frac{{R_{0} C^{2} }}{{2N^{2} }}\delta S_{nr} (t{ - }R_{0} ) \hfill \\ \delta \dot{q}(t) = \frac{N}{{R_{0} }}\delta W(t) - \frac{1}{{R_{0} }}\delta q(t) \hfill \\ \end{array} \right.$$
(3)

where \(\delta W(t) = W(t) - W_{0}\), \(\delta q(t) = q(t) - q_{0}\), and \(\delta S_{nr} (t) = S_{nr} (t) - S_{nr0}\).

Let \(x_{1} (t) = \delta q(t)\), \(x_{2} (t) = \delta \dot{q}(t)\) and \(u(t) = \delta S_{nr} (t)\) (\(S_{nr0} \le u(t) \le 1 - S_{nr0}\)); then, the system state equation can be written as:

$$\dot{x}(t) = Ax(t) + Bu(t{ - }\tau ),$$
(4)

where \(x(t){ = }\left( {\begin{array}{c} {x_{1} (t)} \\ {x_{2} (t)} \\ \end{array} } \right)\), \(A{ = }\left( {\begin{array}{cc} 0 & 1 \\ { - \frac{2N}{{R_{0}^{3} C}}} & { - \left( {\frac{1}{{R_{0} }} + \frac{2N}{{R_{0}^{2} C}}} \right)} \\ \end{array} } \right)\), \(B{ = }\left( {\begin{array}{c} 0 \\ { - \frac{{C^{2} }}{2N}} \\ \end{array} } \right)\) and \(\tau = R_{0}\).

Assume that \(R_{0} \gg \frac{N}{C}\), and then, the transfer function of cross-layer congestion model can be described as:

$$G(s) = \frac{\delta q(t)}{{\delta S_{nr} (t)}} = \frac{{\frac{{C^{2} }}{2N}}}{{\left( {s + \frac{2N}{{R_{0}^{2} C}}} \right)\left( {s + \frac{1}{{R_{0} }}} \right)}} .$$
(5)

2.2 Dynamics of the proposed model

In this section, the objective is to analyze the dynamics of the proposed model described in (5), which shows that \({\text{SNR}}(t)\) dynamically affects the queue length.

For (5), we consider the case when \(T_{p} = 0.05{\text{s}}\), \(C = 650\;{\text{packets}}/{\text{s}}\) and \(N = 25\). If \({\text{SNR}}(t) = 18\;{\text{dB}}\), then we have \(W_{0} = 2\sqrt 5\) and \(R_{0} = 0.1720\), so (5) becomes

$$G(s) = \frac{8450}{(s + 2.6002)(s + 5.8138)} = \frac{8450}{{s^{2} + 8.414s + 15.117}}.$$
(6)

If \({\text{SNR}}(t) = 12\;{\text{dB}}\), then we have \(W_{0} = \sqrt 5\) and \(R_{0} = 0.0860\), so (5) becomes

$$G(s) = \frac{8450}{(s + 10.4006)(s + 11.6276)} = \frac{8450}{{s^{2} + 22.0282s + 120.934}}.$$
(7)

The magnitude and phase Bode plots for (6) and (7) are shown in Figs. 3 and 4, respectively. It can be seen that phase margin of Fig. 3 is \(5.25^\circ\) and that of Fig. 4 is \(13.8^\circ\). According to the Nyquist theorem, systems (6) and (7) are stable because their phase margin is positive value. Furthermore, if \({\text{SNR}}(t)\) decreases, then \(S_{nr}\) will increase, and the value range of u(t) will also change accordingly, which contributes to achieving the proper queue length. SNR has a great influence on the performance of WSNs, because unreasonable SNR will cause longer delay, higher packet loss ratio and even serious network congestion. Hence, the proposed SNR-based cross-layer congestion model is innovative and feasible.

Fig. 3
figure 3

Bode plots when \({\text{SNR}}(t) = 18\;{\text{dB}}\)

Fig. 4
figure 4

Bode plots when \({\text{SNR}}(t) = 12\;{\text{dB}}\)

3 Design of fuzzy sliding mode controller

WSN is a complicated distributed system with features like nonlinearity, time variance and uncertainty [17, 18]. In order to overcome the drawbacks such as chattering action and sensitive to disturbance of the traditional sliding mode controller, a fuzzy sliding mode controller (FSMC) is designed by combining fuzzy controller [19, 20] with the sliding mode controller, as shown in Fig. 5. It can be seen from Fig. 5 that the sliding mode controller first uses the error between the desired and actual queue lengths to figure out \(s\dot{s}\), then gives \(s\dot{s}\) to fuzzy controller to produce a reasonable \(\hat{K}(t)\), finally utilizes \(\hat{K}(t)\) to self-adjust and outputs a control \(u\) that can reduce the impact of uncertain disturbance \(d(t)\). Thanks to its rapid response, simplicity and robustness, insensitivity to parameter variations, and rejection of disturbances and chattering, FSMC is very applicable to solving congestion problem of WSN systems.

Fig. 5
figure 5

Architecture of fuzzy sliding mode controller

3.1 System description

Consider a second-order uncertain system:

$$G(s) = \frac{k}{{s^{2} + as + b}},$$
(8)

and system (8) can also be written as:

$$\ddot{\theta } = - a\dot{\theta } - b\theta + ku(t) + d(t),$$
(9)

where \(\theta\) is the queue length signal, \(u(t)\) is the control input, \(d(t)\) is the unknown disturbance, \(a = \frac{1}{{R_{0} }} + \frac{2N}{{R_{0}^{2} C}}, \, b = \frac{2N}{{R_{0}^{3} C}}\) and \(k = \frac{{C^{2} }}{2N}\) are known parameters.

3.2 Design and analysis of sliding mode controller

Define sliding mode function as:

$$s = ce + \dot{e},$$
(10)

where \(c > 0\), \(e\) is tracking error and \(e = \theta_{d} - \theta\), \(\theta_{d}\) and \(\theta\) are the desired and actual queue length, respectively.

The sliding mode controller is designed as:

$$u(t) = \frac{1}{k}\left( {a\dot{\theta } + b\theta + \ddot{\theta }_{d} + c\dot{e} + K(t)\text{sgn} (s)} \right),$$
(11)

where \(K(t) = \hbox{max} \left| {d(t)} \right| + \eta\), \(\eta > 0\).

Stability analysis is given as follows:

Let the Lyapunov function be

$$V = \frac{1}{2}s^{2} ,$$

and hence, we have

$$\begin{aligned} \dot{V} & = s\dot{s} = s(c\dot{e} + \ddot{e}) = s(c\dot{e} + \ddot{\theta }_{d} - \ddot{\theta }) \\ & = s\left( {c\dot{e} + \ddot{\theta }_{d} + a\dot{\theta } + b\theta - ku(t) - d(t)} \right). \\ \end{aligned}$$
(12)

Substitute control law (11) into (12), we can get

$$\dot{V} = s\dot{s} = s( - K(t)\text{sgn} (s) - d(t)) = - K(t)\left| s \right| - sd(t) \le - \eta \left| s \right| \le 0.$$
(13)

In (11), \(K(t)\) is used to compensate the uncertain disturbance \(d(t)\) and satisfy the existence condition of sliding mode plane. If \(d(t)\) is a time-varying disturbance, \(K(t)\) should also be designed as time-varying in order to weaken the chattering phenomenon. Hence, fuzzy logic rules are introduced to realize the estimation of \(K(t)\).

3.3 Design of fuzzy logic rules

According to the existing condition of the sliding mode

$$s\dot{s} < 0,$$
(14)

\(K(t)\) must effectively eliminate the influence of uncertain disturbance \(d(t)\) and satisfy (14), which guarantees system state converge to the sliding mode surface. Therefore, \(K(t)\) needs to be adjusted adaptively according to the value of \(s\dot{s}\), and the basic fuzzy logic is described as:

  • If \(s\dot{s} < 0\), then \(K(t)\) should be reduced;

  • If \(s\dot{s} > 0\), then \(K(t)\) should be increased.

Based on the above idea, fuzzy control rules between input \(s\dot{s}\) and output \(\Delta K(t)\) are designed. Fuzzy languages to describe \(s\dot{s}\) and \(\Delta K(t)\) are defined as {negative big, negative medium, negative small, zero, positive small, positive medium, positive big}, that is \(\left\{ {{\text{NB}},{\text{NM}},{\text{NS}},{\text{ZO}},{\text{PS}},{\text{PM}},{\text{PB}}} \right\}\), and their membership functions (MFs) and universe are shown in Figs. 6 and 7, respectively.

Fig. 6
figure 6

Membership functions and universes of \(s\dot{s}\)

Fig. 7
figure 7

Membership functions and universes of \(\Delta K(t)\)

According to experts’ knowledge and practical experience in [21, 22], seven fuzzy logic rules describing the relationship between \(s\dot{s}\) and \(\Delta K(t)\) are established as follows:

  • Rule 1: If \(s\dot{s}\) is \({\text{PB}}\), then \(\Delta K(t)\) is \({\text{PB}}\);

  • Rule 2: If \(s\dot{s}\) is \({\text{PM}}\), then \(\Delta K(t)\) is \({\text{PM}}\);

  • Rule 3: If \(s\dot{s}\) is \({\text{PS}}\), then \(\Delta K(t)\) is \({\text{PS}}\);

  • Rule 4: If \(s\dot{s}\) is \({\text{ZO}}\), then \(\Delta K(t)\) is \({\text{ZO}}\);

  • Rule 5: If \(s\dot{s}\) is \({\text{NS}}\), then \(\Delta K(t)\) is \({\text{NS}}\);

  • Rule 6: If \(s\dot{s}\) is \({\text{NM}}\), then \(\Delta K(t)\) is \({\text{NM}}\);

  • Rule 7: If \(s\dot{s}\) is \({\text{NB}}\), then \(\Delta K(t)\) is \({\text{NB}}\).

By using the integration method, the top limit of \(\hat{K}(t)\) can be estimated as:

$$\hat{K}(t) = G_{k} \int_{0}^{t} {\Delta Kdt} ,$$
(15)

where \(G_{k}\) is integral coefficient and depends on experts’ experience.

Replace \(K(t)\) in (11) with \(\hat{K}(t)\) in (15); then, the fuzzy sliding mode controller is designed as:

$$u(t) = \frac{1}{k}\left( {a\dot{\theta } + b\theta + \ddot{\theta }_{d} + c\dot{e} + \hat{K}(t)\text{sgn} (s)} \right).$$
(16)

When the queue buffer is full, all arrival packets will be dropped. Otherwise, controller (16) will control the queue length to reach the expected value by dropping packets according to the signal-to-noise ratio \(S_{nr} (t)\) (\(S_{nr} (t) \in [0, \, 1]\)). As a result, we have:

$$S_{nr} (t) = \left\{ {\begin{array}{ll} 1 & \hbox{if}\quad S_{nr} (t) > 1, \\ {u(t)} & \hbox{if}\quad 0 \le S_{nr} (t) \le 1, \\ 0 & \hbox{if}\quad S_{nr} (t) < 0. \end{array} } \right.$$

The pseudo-code of the proposed FSMC algorithm for WSNs is shown as follows.

figure a

4 Simulation results and analysis

In this section, the performance of the proposed FSMC and other traditional methods (RED [23], DropTail [24], fuzzy [10], PID [11] and SMC [15]) is assessed using MATLAB/Simulink [25] and NS-2.35 [26], respectively. During simulation, the control parameters of traditional algorithms are repeatedly adjusted to make sure that their performance is as good as possible.

4.1 Simulation in MATLAB/Simulink

In this subsection, the proper parameters are set as follows: \(T_{p} = 0.05\;{\text{s}}\), \(T = 0.001\;{\text{s}}\), \(C = 650\;{\text{packets}}/{\text{s}}\), \(N = 25\) and \({\text{SNR}}(t) = 18\;{\text{dB}}\), that is, (6) is considered as the transfer function of WSNs’ congestion model. Therefore, (9) can be written as:

$$\ddot{\theta } = - 8.414\dot{\theta } - 15.117\theta + 8450u(t) + d(t),$$
(17)

where \(d(t) = 300\exp \left( { - \frac{{(t - c_{i} )^{2} }}{{2b_{i}^{2} }}} \right)\).

Let \(b_{i} = 0.8\), \(c_{i} = 5.0\), \(\eta = 1.0\). Then, \(\hat{K}(t) = \hbox{max} \left| {d(t)} \right| + \eta = 300 + 1 = 301\).

Define the desired queue length signal \(\theta_{d} = \sin (\pi t) + 1\) and the initial queue length \(\theta_{\text{init}} = 0.75\). Fuzzy sliding mode controller is constructed by combining the sliding mode controller with fuzzy logic controller, as shown in Fig. 8.

Fig. 8
figure 8

Detailed structure of FSMC in Simulink

When the FSMC (16) with parameters \(c = 150\), \(a = 8.414\), \(b = 15.117\), \(k = 8450\) and \(G_{k} = 300\) is implemented for system (17), then the estimation of \(d(t)\), control input \(u\) and change of reaching law \(s\) is shown in Figs. 9, 10 and 11, respectively.

Fig. 9
figure 9

Estimation of uncertain disturbance \(d(t)\)

Fig. 10
figure 10

Control input \(u\) of FSMC

Fig. 11
figure 11

Change of reaching law \(s\)

Figure 12 shows the performance comparison of traditional algorithms and the proposed FSMC when the desired queue length is a sine signal. It can be seen that all these methods perform similarly in the initial stage of simulation. However, when uncertain disturbance occurs, traditional approaches show poor anti-jamming performance, while FSMC still performs well. The performance metrics of these control methods when uncertain disturbance occurs are summarized in Table 1.

Fig. 12
figure 12

Performance comparison of traditional algorithms and the proposed FSMC when the desired queue length is a sine signal

Table 1 The performance metrics of four control methods when uncertain disturbance occurs

As can be seen from Table 1, compared with classic fuzzy, PID and SMC approaches, FSMC can reduce overshoot to 1.24%, adjustment time to 2.33 s and maximum error to 0.0248 and has zero steady-state error. Hence, FSMC is more robust to tolerate the influence of disturbance and more adaptive to the dynamical queue length and converges more rapidly, which can effectively avoid and alleviate WSNs’ congestion problem.

4.2 Simulation in NS-2.35

In order to thoroughly evaluate the characteristics of FSMC in a dedicated WSN simulation tool, NS-2.35 simulation experiments are performed under two different scenarios: 100 × 100 m2 and 200 × 200 m2. The detailed NS-2.35 simulation parameters are summarized in Table 2.

Table 2 Detailed NS-2.35 simulation parameters

4.2.1 Case 1: simulation in a 100 × 100 m2 monitoring area

In this NS-2.35 simulation, there are 20 nodes randomly deployed in a 100 × 100 m2 area, as shown in Fig. 13. Sensor nodes are sending CBR (constant bit rate) packets to sink node (node 9) through intermediate nodes 1, 4, 6, 14 and 15 by using AODV routing protocol and different queuing methods. And the experiments are performed repeatedly by increasing the data rate from 0 to 200 kbps, while keeping all other parameters fixed. The performance metrics of traditional queuing methods and the proposed FSMC mainly include four aspects [27, 28]: average delay, loss ratio, throughput and queue length.

Fig. 13
figure 13

Distribution of 20 nodes in a 100 × 100 m2 area

4.2.1.1 Average delay in 100 × 100 m2

As shown in Fig. 14, average delay (AD) for traditional methods and FSMC in 100 × 100 m2 increases dramatically when the data rate reaches 90 kbps. However, AD of the proposed FSMC increases more humbly than that of other traditional methods. After 130 kbps, AD of these methods all tends to become stable, but that of FSMC is the lowest (around 0.9 s) and reduced by 0.4 s.

Fig. 14
figure 14

Comparison of average delay for FSMC and traditional approaches in 100 × 100 m2

4.2.1.2 Loss ratio in 100 × 100 m2

Figure 15 shows the comparison of packet loss ratio for traditional methods and FSMC in 100 × 100 m2. It can be seen that they begin to lose packets when the data rate exceeds 90 kbps. Although loss ratio of them raises significantly after 90 kbps, FSMC climbs the most slowly. And when the data rate is 200 kbps, loss ratio of fuzzy control is almost 68%, while that of FSMC is much lower (almost 48%) and reduced by around 20%.

Fig. 15
figure 15

Comparison of loss ratio for FSMC and traditional approaches in 100 × 100 m2

4.2.1.3 Throughput in 100 × 100 m2

Figure 16 shows the comparison of throughput for traditional methods and FSMC in 100 × 100 m2. Obviously, throughput of these six algorithms all increases in positive proportion when the data rate is less than 100 kbps. However, when the data rate exceeds 100 kbps, throughput of them all converges. This is because when the data rate exceeds the maximum packets that a WSN node can transmit, the redundant packets will be dropped, and throughput will no longer increase. Furthermore, FSMC wins the “champion” in the comparison due to its biggest throughput (around 525 kbps and increased by 125 kbps).

Fig. 16
figure 16

Comparison of throughput for FSMC and traditional approaches in 100 × 100 m2

4.2.1.4 Queue length in 100 × 100 m2

Figure 17 shows the comparison of instantaneous queue length of node 1 using FSMC and traditional approaches when the data rate is 100 kbps and the monitoring area is 100 × 100 m2. It can be seen from Fig. 16 that queue length of these algorithms increases gradually over time. However, traditional control methods can easily fill the queue buffer and result in dropping packets, because queue length of them always fluctuates around the top limit (70 packets). It can also be seen from Fig. 16 that FSMC outperforms traditional methods, because it stays in “full-queue” state for only a short time (during 17–19 s) and its queue length finally stabilizes around 45.

Fig. 17
figure 17

Comparison of instantaneous queue length of node 1 using FSMC and traditional approaches when the data rate is 100 kbps and the monitoring area is 100 × 100 m2

Figure 18 shows the comparison of average queue length of five sensor nodes (nodes 1, 4, 6, 14 and 15) under different queuing methods when the data rate is 100 kbps and the monitoring area is 100 × 100 m2. As expected, in whichever node, average queue length of FSMC is relatively shorter than that of traditional approaches, which can effectively avoid packet loss, reduce end-to-end delay and increase the total amount of data.

Fig. 18
figure 18

Comparison of average queue length of five sensor nodes using FSMC and traditional approaches when the data rate is 100 kbps and the monitoring area is 100 × 100 m2

4.2.2 Case 2: simulation in a 200 × 200 m2 monitoring area

This subsection aims at evaluating the performance of FSMC in a larger network topology. Hence, similar experiments are performed again by enlarging the area from 100 × 100 m2 to 200 × 200 m2 (Fig. 19), while maintaining all other network parameters unchanged.

Fig. 19
figure 19

Distribution of 20 nodes in a 200 × 200 m2 area

Similarly, after 20 nodes are randomly deployed, they keep sending CBR packets to sink node (node 3) through intermediate nodes 2, 10, 11, 14 and 15. Meanwhile, the performance metrics also include four aspects: average delay, loss ratio, throughput and queue length.

4.2.2.1 Average delay in 200 × 200 m2

Figure 20 shows the comparison of average delay (AD) for FSMC and traditional approaches in 200 × 200 m2. Similar to Fig. 13, AD of them increases significantly at 70 kbps and becomes stable at 150 kbps. Although the stabilized AD of FSMC is the lowest (around 1.1 s) among all methods involved in this study, it is still 0.2 s bigger than AD of FSMC in case 1. This is because when region of interest (ROI) becomes broader, the distance from source node to destination node also gets longer. Hence, transmitting the same number of packets will consume more time, which leads to higher delay.

Fig. 20
figure 20

Comparison of average delay for FSMC and traditional approaches in 200 × 200 m2

4.2.2.2 Loss ratio in 200 × 200 m2

Figure 21 shows the comparison of packet loss ratio for traditional methods and FSMC in 200 × 200 m2. Similar to Fig. 14, loss ratio of these approaches starts to climb at 70 kbps. Compared with traditional approaches, FSMC has the lowest loss ratio (around 54%) at 200 kbps, but it is 6% higher than loss ratio of FSMC in case 1. This is because longer transmission distance will increase the risk of losing packets.

Fig. 21
figure 21

Comparison of loss ratio for FSMC and traditional approaches in 200 × 200 m2

4.2.2.3 Throughput in 200 × 200 m2

Figure 22 shows the comparison of throughput for traditional methods and FSMC in 200 × 200 m2. Similar to Fig. 15, throughput of these strategies increases proportionally at the beginning and stabilizes when the data rate is 80 kbps. Among them, FSMC possesses the largest throughput (around 450 kbps). Nevertheless, compared with the throughput of FSMC in case 1, that of FSMC in this case reduces 75 kbps since ROI is enlarged from 100 × 100 m2 to 200 × 200 m2.

Fig. 22
figure 22

Comparison of throughput for FSMC and traditional approaches in 200 × 200 m2

4.2.2.4 Queue length in 200 × 200 m2

Figure 23 shows the comparison of instantaneous queue length of node 14 using FSMC and traditional approaches when the data rate is 100 kbps and the monitoring area is 200 × 200 m2. Different from Fig. 16, the queue length of these methods increases sharply during the first 5 s and then fluctuates around the boundary (70 packets). In contrast, FSMC achieves better performance owing to its temporary “full-queue” state (during 9–15 s) and lower convergent queue length (around 45). However, the stability of FSMC in this case is worse than that of FSMC in case 1 due to its bigger steady-state error.

Fig. 23
figure 23

Comparison of instantaneous queue length of node 14 using FSMC and traditional approaches when the data rate is 100 kbps and the monitoring area is 200 × 200 m2

Figure 24 shows the comparison of average queue length of five sensor nodes (nodes 2, 10, 11, 14 and 15) under different queuing methods when the data rate is 100 kbps and the monitoring area is 200 × 200 m2. Similar to Fig. 17, whether in nodes 2, 10, 11, 14 or 15, the average queue length of FSMC is smaller than that of other traditional methods, which contributes to reducing loss rate and improving throughput of WSN systems. Please note that longer transmission distance can easily lead to congested wireless channel and increased queue size. As a result, the average queue length of FSMC in this case is bigger than that of FSMC in case 1.

Fig. 24
figure 24

Comparison of average queue length of five sensor nodes using FSMC and traditional approaches when the data rate is 100 kbps and the monitoring area is 200 × 200 m2

5 Conclusion

By applying the received SNR of wireless channel to dynamic TCP model, this paper proposes a cross-layer congestion control model between transmission layer and MAC layer as well as a fuzzy sliding mode control algorithm for WSNs. Simulation results show that the proposed algorithm not only adaptively regulates the queue length of buffer in intermediate nodes and effectively avoids the occurrence of congestion, but also significantly reduces the queuing time and increases the speed and stability of convergence and thus improves WSNs’ performance in terms of average delay, packet loss ratio and throughput, whether ROI is 100 × 100 m2 or 200 × 200 m2.

In the future, physical experiments will be performed to verify the effectiveness and prominence of the proposed congestion control scheme in realistic WSN-based IoT applications such as smart home and agriculture automation. And the impact of algorithm parameters on network performance will be taken into account to optimize FSMC, so as to provide a more stable and reliable WSNs’ cross-layer congestion control.