Setting strategy of delay-optimization-oriented SMAC contention window size

Some frame components, such as SYNC (frame synchronization) and RTS/CTS (Ready to Send/Clear to Send), are not taken into consideration when the traditional setting strategies conduct the optimization of SMAC (Sensor MAC) contention window size. This paper proposes mathematical models that allow the analysis of data packets forwarding delay within one SMAC virtual cluster. Simulation results in OMNeT++ show good agreements with the proposed mathematical models, validating the models’ correctness. The curve analyses of the models confirm the existence of delay-optimization-oriented contention window size that is closely related to the number of simultaneously contending nodes. Afterwards, it is shown that SYNC, RTS/CTS and EIFS (Extended InterFrame Space) have impacts on the optimal contention window size and expected delivery delay to various degrees, as well as throughput and energy efficiency. One ideal setting strategy of delay-optimization-oriented SMAC contention window size requires the combination of the network scale, SYNC, RTS/CTS and EIFS. Additionally, it is demonstrated that the proposed setting strategy makes contributions to the improvement in the existing SMAC extensions when they are integrated with each other, in terms of the end-to-end delay, throughput and energy consumption.


Introduction
As an important underlying network, wireless sensor networks (WSNs) are composed of a large number of sensor nodes deployed in the monitoring areas [1,2]. Sensor nodes deliver data packets to the Sink by constructing multi-hop self-organizing network system. These nodes are usually battery-powered with limited energy capacity. As a result, how to reduce the energy consumption and prolong the network lifetime is of great challenge for WSNs, which great efforts have been made thus far to deal with. However, existing research mainly concentrates on improving network reliability, reducing the hardware cost, optimizing the network protocol, etc [3][4][5][6]. As we know, the medium access control (MAC) layer always plays an important foundation for data transmission since it controls the allocation of wireless channel resources. The optimization of MAC protocols is one of important ways for achieving energy savings. As one typical MAC layer protocol for WSNs, SMAC (Sensor MAC) protocol is a modification version of the distributed coordination model in IEEE 802.11 MAC protocol, by a1111111111 a1111111111 a1111111111 a1111111111 a1111111111 introducing sleeping mechanism. In SMAC, the nodes switch their status between active/sleep in order to save energy [7]. It is worth mentioning that a data packet can only be forwarded by one hop in per SMAC cycle. For the purpose of improving SMAC, the adaptive listening mechanism is later introduced into SMAC to increase forwarding distance to 2 hops per operational cycle. However, the improvement is rather limited. As a consequence, the long end-toend delay makes SMAC inappropriate for applications that require strict timing constraints [8].
In recent years, with the rapid development of sensor technology, SMAC is expected to be improved in order to meet the requirement of many applications, such as, fire monitoring, target tracking, and precision agriculture [9][10][11][12]. These applications demand high reliability, less packet loss rate and strict real-time QoS (quality of service) support [13]. To this end, much research attention has been paid to throughput and delay instead of the energy saving. In the past years, comprehensive study on the performance characteristics and disadvantages of SMAC protocol has been conducted to find ways of improving the network performance. It is encouraging that there are great progresses with respect to improving the reliability and timeliness of data transmission [14][15][16][17][18]. More specifically, there have been a variety of extensions of SMAC protocol available, where different network performance parameters are taken into consideration to guarantee different QoS. However, it comes to our attention that almost all of these SMAC extensions, such as T-MAC, RMAC, DMAC and SCP-MAC, focus on improving the multi-hop delay and throughput by trying to notify as many nodes as possible on active routes of incoming data packets as soon as possible [8,19]. Nevertheless, these extensions of SMAC protocol might still suffer from rather poor performance when employed in the bursty and dynamic workload application.
In the network with SMAC-like employed, the channel contention process is an essential procedure when the node initiates data transmission in most occasions except that the channels are already reserved in advance. As a result, the channel contention delay influences the end-to-end delay to a great extent. As we know, the contention window size plays a very important role during the whole contention process [20,21]. Some work has been done to design dynamic contention window mechanism so far. In [22], ASMAC is developed based on the canonical SMAC protocol, and it dynamically adjusts contention window size according to the traffic load in order to achieve the delay reduction and the improvement of the energy efficiency. Unfortunately, the proposed parameterization method is not convincing enough due to the lack of theoretical analysis. The authors in [23] present the analysis about the impact of contention window size on the energy consumption and packet delay under various network scales. They confirm the existence and determination of the optimal contention window size. Whereas, the proposed optimal contention window is still questionable because of not taking into consideration the frame synchronous (SYNC) phase, RTS/CTS (Request to Send/Clear to Send) and EIFS (Extended InterFrame Space) duration. Additionally, the influence of dynamic contention window size on the multi-hop data transmission is not covered yet.
As a remedy, this study is to evaluate the effect of SYNC, RTS/CTS and EIFS on the delayoptimization contention window size for guiding the setting strategy of delay-optimizationoriented contention window size. First of all, the delivery delay within one SMAC virtual cluster is mathematically derived from the perspectives of both single node and the whole network. Second, the correctness of the proposed mathematical models is evaluated by means of simulations. Third, the possible factors that influence the delay-optimization contention window size is thoroughly investigated based on the proposed models for providing one reference for further appropriately adjusting contention window size. Fourth, we evaluate the network performance gain offered by the delay-optimization-oriented dynamic contention window size under two scenarios of one virtual cluster and multi-hop sensor network. Finally, some interesting conclusions are drawn for guiding the setting strategy of delay-optimization-oriented dynamic contention window size.

SMAC mechanism with adaptive listening mechanism
In SMAC, the frame is divided into two stages: active and sleeping stages, and the duration in the active stage include synchronous and contention periods. In the synchronization period, nodes exchange their schedules by periodically broadcasting a SYNC packet to their immediate neighbors. In the listening period, if a node needs to transmit data, it has to compete with other contending nodes for medium access. When it turns into active stage, the node starts channel listening procedure. After receiving packets, it takes some actions as follows. If the packet contains SYNC information from other nodes, the node sets its own scheduling information according to the SYNC packet. If the packet contains different scheduling information from other nodes, the node would pick up the first arrival packet and record scheduling information. If no scheduling information is received from other nodes, the node generates its own scheduling information and broadcast towards the network. Usually, the virtual cluster is formed by the nodes with the same scheduling, and the boundary nodes within the same cluster need to maintain multiple scheduling information. In order to ensure that the new cluster member node and existing nodes follow the same scheduling information, each node periodically broadcast its own scheduling information at the beginning of the synchronization phase.
After the synchronous phase, the nodes enter into the contention stage. Nodes randomly select their own time slots from the contention window at the beginning of contention phase. Fig 1 shows the three possible contention results of node slot selection. Assume that there are three contending nodes in the considered network. The following analysis takes Node 1 as an example. Note that Node 1 would go to sleep and remain asleep until the end of transmission once it loses the chance to access channel. 1) Node 1 detects collision and restarts contention after staying asleep for about a period of EIFS (Extended InterFrame Space). 2) Node 1 goes to sleep. In contrast, one of other nodes successfully wins the right of accessing channel, and afterwards starts data transmission. 3) Node 1 wins the contention and starts the data transmission. It is worth noting that the three possible contention results are independent on example node and the total number of nodes.
SMAC uses RTS / CTS mechanism to guarantee the successful transmission. In the case of no collision, the node with the smallest idle listening duration wins the right of accessing channel, then broadcasts RTS packet into the network. The RTS packet contains the time required for the node completing one round of data transmission. Other contending nodes detect RTS packet sent by the winner node and set their sleeping time according to the received NAV(Network Allocation Vector, NAV) value. Moreover, these nodes continue monitoring the channel to detect the collision events by identifying whether CTS packet is received. The sending node starts data transmission after receiving CTS packet. The destination node replies an ACK after receiving the data. If the conflict occurs, all nodes are not able to detect CTS from the destination. Subsequently, the node goes to sleep and remain asleep for a period of EIFS. Afterwards, all nodes join one new round of contention at the end of sleeping. Setting strategy of delay-optimization-oriented SMAC contention window size SMAC adopts self-adaptive listening mechanism to reduce the data delivery delay. The neighbors of active node, instead of remaining asleep until the whole frame duration elapses, immediately joins one new round of contention after the data transmission. The frame structure of SMAC with self-adaptive listening mechanism is illustrated in Fig 2. Taking the two consecutive contentions of Node 1 as example, it describes one typical network contention process. To be more specific, Node 1 suffers from going to sleep several times between its two consecutive contentions since either other nodes win the contention or collision occurs.
Assume that there are N contending nodes participating in each round of contention, the contention window size is W, the nodes randomly pick up a time slot from the contention window to determine their idle listening duration. Let T sync represent the duration of SMAC synchronization phase, T listen denote the sum of the idle listening and RTS/CTS durations. Duty cycle is the ratio of the active duration (T active ) and one SMAC frame duration (T frame ). Therefore, the SMAC frame length can be determined as follows: Where t slot is the single slot duration of contention window. t RTS and t CTS represent the transmission duration of the RTS and CTS packet in the channel, respectively.

Mathematical modeling of the delivery delay
As shown in Fig 2, after completing data transmission, Node 1 is likely to suffer from many collision events or failing in the contention. In these two aforementioned cases, Node 1 has to implement back-off, that is to say, going to sleep and remaining asleep till the beginning of the next round of contention. In this section, Node 1 is selected as an example to investigate the expected time interval between two consecutive successful data transmission for a specific node. The expected time interval, denoted as D ts , is called as the delivery delay derived from perspective of the single node. Afterwards, the delivery delay from the perspective of network is further derived. In order to analyze the effect of each component of SMAC frame on optimal delay contention window, we suppose that the queue of the nodes is always full, and all nodes immediately participate in the next round of contention after the completion of data transmission. Table 1 lists of some important notations and their meanings to be used in our analysis.

Expected idle listening duration
Firstly, we focus on the mathematical modeling of the expected idle listening delay that any given node (say Node 1 in the Fig 2) takes to get the right of accessing medium, D wc , during one round of contention. The derivation of D wc is based on the expected probability that the Node 1 succeeds in winning one round of contention. Let P[ψ = φ, U = success] represent the probability that the first occupied slot is only selected by the Node 1. There are W N different slot assignments among which the following assignment results in non-collision transmission: φ is chosen by the Node 1 and the slots φ + 1 to W, i.e., Wφ slots, are chosen randomly by other N − 1 nodes. As a result, And the expected probability of Node 1 winning the contention can be calculated as follows, Hence, the expected idle listening duration that the Node 1 takes to win one round of contention, D wc , is Where by the definition of the conditional probability, Similarly, the expected idle listening duration that Node 1 has to suffer from the contention failure, D fc , is Where P[ψ = φ| U = lose] represents the probability that the first occupied slot index, φ, is selected by other nodes and there is no collision occurrence, and it can be derived in the same way as P[ψ = φ, U = success].
Next, we focus on the case of collision occurrence during the contention process. Since each contention is independent and random, the contention can be modeled as a Bernoulli trial with non-collision and collision probabilities of p nc and p c [23]. The expected times of collision occurrence between two consecutive non-collision events during the continuous contentions, β are found to be, Where, the probability of non-collision occurrence, p nc , is calculated as, If there is no collision occurrence in the network with N contention nodes, the contention times are N between two consecutive channel access events of any specific node. Hence, the expected times of collision occurrence between two consecutive channel access events are calculated as μ = Nβ. The expected idle listening duration that Node 1 suffers from the collision contention is Where P[ψ = φ| U = collision] represents the probability in which the first occupied slot is φ in the case of collision occurrence. Assume that there are m nodes that select φ as their occupied slot, the remained W-φ slots, between φ+1 to W, are chosen by N-m nodes. Hence, Finally, the expected idle listening duration between two consecutive data transmissions can be calculated as the sum of the three components mentioned above.
Expected back-off duration Node has to go to sleep if there is a collision occurrence or it fails in winning the contention. Similar to the derivation of D fc and D cc , it is easy to obtain the expected sleeping duration that Node 1 spends after its contention failure, Similarly, the expected sleeping duration that Node 1 spends after the collision occurrence is, Then, the expected sleeping duration that Node 1 spends between two consecutive data transmissions, Expected delivery delay of data packet The times of the successful data transmission within one entire SMAC frame (V) is calculated as the difference of T frame and T sync divided by the sum of the expected data transmission and collision durations. Hence, the value of V is calculated as follows, The delivery delay for Node 1 is the sum of its idle listening duration, sleeping duration, synchronization duration, and data transmission duration. As a result, the expected delivery delay of Node 1 is equal to, Different from the delivery delay derived from the perspective of single node, the delivery delay derived from the perspective of the whole network does not take into consideration the delay from the contention failure. Combining the Eqs (6), (7) and (9), it can be found that the delivery from the perspective of the whole network is, In conclusion, the two formulas above are exactly the mathematical models of the delivery delay from the perspectives of single node and the whole network, respectively. According to the derived models, the main factors that influence the delivery delay involve the number of contending nodes, the contention window size, SYNC duration, RTS/CTS duration, EIFS, the durations of data transmission and ACK. Such phenomenon indicates that the SMAC frame components, including SYNC, RTS/CTS and EIFS, have impacts on the delivery delay as well as contention window size. However, as shown in formulas (17) and (18), it is difficult to quantify the relationships among the delivery delay, contention window size and SMAC frame components by performing the mathematical analysis due to the models' complexity.
Particularly, as shown in Fig 3 below, each curve of expected delivery delay, when regarding the contention window size as only independent variable, has only one minimum point. Therefore, based on the theory of advanced mathematics, it is theoretically feasible to quantify the delay optimization by performing mathematical analysis of the formulas (17) and (18). The procedure goes as follows. We take the partial derivative of the formulas (17) and (18) with respect to the number of contention window size. Afterwards, by setting the right of the derived formulas equal to zero, and solving equations, the optimal contention window size could be obtained, and it is determined by other variables, such as, the number of contending nodes, SYNC and RTS/CTS durations. Finally, we get the expression of the optimized delivery delay by plugging the optimal contention window size into the formulas (17) and (18). However, it is found out that the derived equations about the optimal contention window size are hard to solve due to the equation complexity. In addition, even if the equations were solved, the equations of the optimized delivery delay would be too complicated to explicitly demonstrate the optimization results.
Therefore, similar in [20,23], in the following section, the combination of simulations and curve analyses is implemented to explore the interrelationships among the delivery delay, contention window size and SMAC frame components. More specifically, the verification of the mathematical delay models in Eqs (17) and (18) is implemented by means of simulation conductions. Afterwards, based on the curve analyses of the models, we investigate the existence of the delay-optimization-oriented contention window size, and further evaluate the influence of the aforementioned SMAC frame components on the delay-optimization-oriented contention window size and expected delivery delay. Finally, through simulations, the throughput and energy consumption are inspected considering the dynamic contending nodes along with corresponding optimal contention window size. Additionally, we thoroughly evaluate the network performance gains offered by the dynamic contention window strategy over the existing SMAC extensions.

Results and discussion
Two groups of investigations are conducted in order to verify the mathematical delay models and the existence of the delay-optimization-oriented contention window size, as well as thoroughly to evaluate the influence of dynamic contention window strategy on network performance within one virtual cluster and multi-hop sensor network. Subsequently, the discussion made to conclude the setting strategy of delay-optimization-oriented contention window size.
The first group focuses on the scenario within one virtual cluster. For the purpose of verifying the correctness of the mathematical delay models in previous section, several simulations are carried out in OMNeT++ [24], in an square area of 30 m by 30 m. The Sink is located at the center of area. All nodes set the Sink as their only destination. The events are logged from the start of simulation till its end. The simulations are run for 30 times, and the duration of each simulation is 1000 seconds. The main simulation parameters are listed in Table 2. Afterwards, using MATLAB, the curve analyses of the models are implemented to investigate the existence of the optimal contention window size, and to evaluate the influence of the SMAC frame components on the delay-optimization-oriented contention window size and expected delivery delay. Last but not the least, through simulations, the influence of SMAC frame components on the throughput and energy consumption are explored considering the dynamic contending nodes along with corresponding optimal contention window size.
The other group is devoted to comparing the dynamic contention window strategy against the existing SMAC extensions. More specifically, the simulations are implemented in order to evaluate the network performance gains offered by the dynamic contention window strategy over the SMAC extensions designed for the multi-hop data transmission. During our simulations, the parameters in Table 2 are employed except the number of contending nodes. In our case, the realistic 200-node network in [19] is used, where 200 sensor nodes are uniform randomly deployed in a square area of 2000 m by 2000 m, the Sink is located at the center of the square. The maximum path length from a sensor to the Sink is 15 hops. In comparison with the pretty light traffic in [19], more realistic traffic model is employed. Traffic loads are generated by constant bit rate (CBR) flows. 140 of 200 nodes generate one data packet every 50 seconds. The rest nodes generate data every 10 seconds to mimic the bursty traffic. As a consequence, a light traffic load is injected into the target sensor network. Each performance metric is averaged from the results of 30 random runs. Note that the same energy consumption models of sensor node in [19] are employed in the two groups of investigations above.

Model verification and optimal contention window size
The number of contending nodes and contention window size are taken as variables to verify the delay models and to confirm the existence of the optimal contention window size. Fig 3 shows the analysis and simulation results about the data delivery delay from the perspectives of single node and the whole network. As can be seen in Fig 3, the results of analyses and simulations highly match with each other. The difference between the two aforementioned delivery delays can be explained that the delivery delay derived from the perspective of the whole network does not take into account the delay caused by the contention failure.
It is worthwhile to mention that there are similar changing trends between the delivery delays from the perspectives of single node and the network. Apparently, both of them tend to rise steadily after a sharp decline with the increase of contention window size. As a matter of fact, the data delivery delay is affected by both contention window size and collision probability for any fixed network scales. In addition, the change trends of both contention window size and collision probability are opposite. When the contention window size is small, the collision probability is relatively large, which can be reduced by increasing the contention window size. With the increase of the contention window size, the collision probability becomes less and less whereas the idle listening duration would increase. Before the delivery delay reaches the minimum, the collision probability starts to play a dominant role in the expected delivery delay. Afterwards, the idle listening duration takes control of the change in the delivery delay. The optimal compromise between idle listening duration and collision probability exactly corresponds to the minimum delivery delay in Fig 3.  Fig 4 illustrates the optimal delay contention window size corresponding to the minimum delay points under the condition of various contending nodes, as well as traditional fixed contention window size in SMAC. W NODE , W NET are optimal contention window sizes obtained from the perspective of single node and the whole network, respectively. W F represents the Setting strategy of delay-optimization-oriented SMAC contention window size fixed contention window size of 63 offered by the canonical SMAC. Both W NODE and W NET tend to rise rapidly with the increase of contending node, which is significantly different from the traditional SMAC. According to Eqs (17) and (18), D ts is N times of D net , therefore, the lowest points are approximate with regards to two curves of delivery delay for the same number of contending nodes, which matches the results presented in Fig 4. Apparently, the correctness of the delivery delay models is verified. As depicted in Fig 3, the change trend of D net is much sharper compared with D ts . This should be ascribed to the differences in y-axis interval granularity and in the ranges of D ts and D net . To better illustrate the analytical results, D net is employed to evaluate the effect of SMAC frame components on the optimal contention window size, expected delivery delay, throughput and energy efficiency in the following section.

Influence of SMAC frame components
In this section, we focus on demonstrating the effect of the optimal contention window size and SMAC frame components on the three key performance metrics: delivery delay, energy consumption and throughput. To make our description clear, E, R and S are used to represent Setting strategy of delay-optimization-oriented SMAC contention window size EIFS, RTS/CTS and SYNC durations. As tabulated in Table 3, W E , W SE , W RE and W SRE represent the cases of EIFS only considered, EIFS and SYNC durations considered, RTS/CTS and EIFS considered, RTS/CTS and SYNC durations considered, all three components considered.
First of all, we focus on the change characteristics in D net in the case of the different combinations of the three components to evaluate the effect of SYNC duration, RTS/CTS and EIFS on optimal contention window size. Fig 5 presents the effect of frame components on optimal window size under six combinations of three SMAC frame components. With the increase of contending nodes, the contention window size keeps increasing except W F . It should be emphasized that W SRE has the greatest rising rate, and the rest follow the declining order, W SE > W RE >W SR >W E , which demonstrates that three components of SMAC frame have influence on the optimal contention window size. Particularly, the impact significance of RTS/ CTS, SYNC and EIFS sequentially increases.
Our next objective is to show the influence of the optimal contention window size and SMAC frame components on the following three critical performance metrics for wireless sensor networks: expected delivery delay, throughput and energy consumption. It should be pointed out that the energy consumption is from the average amount of energy that all nodes consume within the same virtual cluster after completing each round of simulation.
As depicted in Figs 6-8, the results reveal that the three considered performance metrics are closely associated with the densities of contending nodes, which directly demonstrates that the canonical SMAC has drawbacks in dealing with the medium contention under the condition of various node densities. Compared with the fixed contention window size, the dynamic contention window strategy has imposed obviously significant optimization in the expected delivery delay, throughput and energy consumption, especially under the condition of high node densities. Additionally, Figs 6-8 show that among the SMAC frame components, RTS/ CTS, SYNC and EIFS sequentially follow an increasing order with respect to the degree of their impacting the expected delivery delay, throughput and energy consumption, which is consistent with the impact significance of RTS/CTS, SYNC and EIFS on the contention window size.
More specifically, it is interesting, from Fig 6, to observe that the curve of expected delivery delay behaves nearly like an upward parabola. This should be ascribed to the fact that the canonical SMAC suffers the less collision events and greater idle listening durations when there are fewer contending nodes. As the contending nodes increase, the collision events tend to occur more and more frequently, meanwhile, the idle listening durations tend to become shorter and shorter. The delivery delay exhibits a continuous decrease until the lowest point, afterwards, turns into an increasing trend as a result of the mutual interaction of the collision occurrence and idle listening duration. It should be noticed that Fig 7 shows that the curve of expected throughput behaves nearly like a downward parabola, which is exactly opposite to the delivery delay in Fig 6. It is definitely reasonable that one greater delay leads to the less amount of throughput.
It should be emphasized that the curves in Figs 6 and 7 clearly show that the dynamic contention window strategy does help in achieving an improvement in the expected delivery delay and throughput. The two figures strongly demonstrate that it is beneficial to integrate the dynamic contention window strategy, instead of the fixed contention window size, with the canonical SMAC. The dynamic contention window strategy reduces idle listening duration by automatically narrowing the contention window size to when there are fewer contending nodes. In the meantime, the increase in contention window size effectively reduces the delay caused by the collision events. It is discovered that the dynamic strategy obtains far less collision probability than the canonical SMAC in the case of high node densities. As a result, the dynamic strategy achieves one relatively steady tradeoff between the collision probability and idle listening duration resulting from the simultaneously appropriate increase in the contention window size with the contending nodes.
As can be seen in Fig 8, the dynamic contention window strategy continuously brings gains in the energy efficiency with the increase in the densities of contending nodes. Intuitively, it is witnessed from Fig 8 that the dynamic strategy consumes more energy than the canonical SMAC in the case of high node densities. This can be explained by investigating the determining factors of the energy consumption. As we know, the energy consumption is positively proportional to the idle listening duration in addition to the amount of transmission data. In our case, the dynamic strategy brings the increase in throughput as well as in energy consumption. As shown in Fig 5, the dynamic contention window strategy uses greater contention window size than the canonical SMAC under the condition of high node densities, which causes the increase in idle listening duration, consequently contributes to the increase in the energy consumption. Thus, it can reasonably be concluded that the improvement in the delivery delay and throughput over the canonical SMAC is achieved at the expense of more energy consumption. Nevertheless, it should be pointed out that the dynamic strategy offers higher energy utilization rate (calculated as energy consumption divided by throughput) compared with the fixed window size.

Comparisons with existing SMAC extensions
It should be noticed that most of the existing SMAC extensions, such as T-MAC and RMAC, aims at improving the multi-hop data transmission delay and energy consumption by trying to notify as many nodes as possible on active routes of incoming data packets as soon as possible. Most of them follow the fixed contention window size in the canonical SMAC, instead of taking into consideration the influence of contention window size on the delivery delay. Consequently, the existing SMAC extensions follow almost the same performance as the canonical SMAC, which is presented as W F in Figs 4-8 during the channel contention within one virtual cluster. Some existing SMAC extensions are claimed to improve the multi-hop data transmission for the scenarios with temporary bursty traffic. As a matter of fact, in such cases, the contending nodes and traffic load are inevitably dynamic. From this perspective, the dynamic contention window strategy provides one useful complement to the existing SMAC extensions. In our case, RMAC (Routing enhanced MAC protocol) [19] is chosen since it is one typical SMAC extension designed for efficient multi-hop transmission of the bursty traffic. To simplify our evaluations, we assume that there is a routing protocol deployed to provide the shortest path between any two nodes [19]. The node immediately participates in the next round of contention after the completion of data transmission only if there are packets in the Setting strategy of delay-optimization-oriented SMAC contention window size queues. Note that the realistic traffic model is employed during our simulation in comparison with the pretty light traffic in [19].
As shown in Figs 9 and 10, the dynamic contention window setting strategy definitely helps in further improving them when it is integrated with the existing SMAC extensions. SMAC-DOW and RMAC-DOW represent SMAC and RMAC enhanced by the dynamic optimal contention window strategy, respectively. Note that RMAC follows the similar calculation method of optimal contention window size to SMAC although there are slight differences in their frame structure. Hence, during our simulations, RMAC employs the similar calculation method of optimal contention window size to SMAC considering all frame components. It is witnessed from Fig 9 that RMAC is inferior to SMAC in the case of fewer hops. This should be ascribed to the fact that RMAC fails in effectively offering multi-hop data transmission within one single cycle in the case of the moderate traffic load. More specifically, the traffic load always tends to be relatively heavy in the regions closer to the Sink, consequently, where the collision events occur. Thus, the capability of multi-hop forwarding per operational cycle is heavily constrained. The simulations show that RMAC has to deal with medium contention on an average of 1.7 hops in the regions closer to the Sink, which is much fewer compared with the results within the extremely light traffic scenario in [19]. Additionally, it should be pointed out that the number of contending nodes within the same virtual cluster falls in the range from 2 to 7. Most virtual clusters have about 3 or 4 contending nodes. As shown in Figs 6-8, it is apparent that the dynamic contention window strategy naturally has advantages over the fixed contention window size with regards to the network performance. Therefore, this situation provides more opportunities for the dynamic contention window strategy bringing more gains to network performance. It is worthwhile to emphasize that the gain will increase at a faster rate with the increasing fluctuation in the scale of contending nodes within the same virtual cluster.
In particular, it is observed from Fig 9 that the dynamic contention window strategy offers further improvement in the end-to-end delay for RMAC than SMAC. As the hop count increases, RMAC outperforms SMAC after about nine hops, which indicates that the multihop data transmission mechanism in RMAC does not work well until several hops away from the Sink. The reason underneath the phenomenon is that the traffic load becomes much lighter in the regions on average several hops away from the Sink. Moreover, during the simulations, it is witnessed that there is a monotonic increase in the hop count of data transmission within one operational cycle with the increase of the distance from the Sink. From Fig 10, it is not surprised to observe that the dynamic contention window strategy effectively improves RMAC in terms of energy consumption. Additionally, the energy gains keep constantly increasing along with the increasing hop count due to the accumulation of energy savings. Based on the discussion above, it is natural to draw such conclusion: the dynamic contention window strategy is Setting strategy of delay-optimization-oriented SMAC contention window size able to offer such capability of effectively improving the existing SMAC extensions, and the increasing gains will be achieved in terms of delay, throughput and energy consumption with the increase of the traffic load injected into network. Accordingly, it could reasonably be ascertained that the dynamic contention window strategy would bring more gains for the existing SMAC extensions if the routing mechanisms were taken into consideration. This is because the routing mechanisms could incur the routing information maintenance overhead. In conclusion, the dynamic contention window strategy helps in improving the effectiveness and flexibility of SMAC-like protocols by enhancing their capabilities of adaptively handling the medium contention under various traffic models and contending nodes.

Setting strategy of contention window size
Through the simulations and curve analyses, it is revealed that there is no difference between the delay-optimization-oriented contention window sizes derived from the perspectives of single node and the whole network. As for the SMAC frame components, RTS/CTS, SYNC and EIFS sequentially follow an increasing order when it comes to the degree of their impacting the expected delivery delay, throughput and energy consumption. Compared with the traditional contention window setting strategies, the dynamic setting methods offer one better opportunity for improving the expected delivery delay, throughput and energy efficiency Setting strategy of delay-optimization-oriented SMAC contention window size resulting from its inherently attempting to achieve good balance between the collision probability and idle listening duration. It is demonstrated that the ideal contention window size, aiming at optimizing the delivery delay, is dependent on the network scale, RTS/CTS, SYNC and EIFS. Therefore, one ideal setting strategy of delay-optimization-oriented SMAC contention window size requires the combination of the network scale, SYNC, RTS/CTS and EIFS. In particular, for the purpose of optimizing the key network performance, all of the aforementioned factors should be taken into consideration when one tries to develop the setting strategies of the delay-optimization contention window size.
It is discovered that the multi-hop data transmission strategies in most existing SMAC extensions, such as T-MAC and RMAC is constrained a lot due to frequent collision events in the case of bursty and dynamic traffic load, although their goal is to improve the multi-hop delay, throughput and energy consumption by trying to reserve channel along as many hops as possible. Thus, for SMAC-like protocols, the channel contention is essential for data transmission in most occasions except that the channels are already reserved in advance. As a matter of fact, the channel reservation has to suffer low success ratio for the scenarios with bursty or heavy traffic load. However, most of them follow the fixed contention window size in the canonical SMAC, instead of taking into consideration the influence of contention window size on the delivery delay. As a result, our research fills in the gaps, and is capable of providing one useful complement to these SMAC extensions. Moreover, the additional gains are confirmed in this paper through a serial of integration simulations and discussions. Overall, the dynamic contention window setting strategy definitely improves the effectiveness and flexibility of the existing SMAC extensions under various conditions of traffic models and contending nodes, resulting from the enhancement of adaptively handling the medium contention.

Conclusions
The delivery delay is derived within the network running SMAC, from the perspectives of single node and the whole network, respectively. Through the combination of simulations and curve analyses, it is revealed that one ideal setting strategy of delay-optimization-oriented SMAC contention window size requires the combination of the network scale, SYNC, RTS/ CTS and EIFS. Moreover, the dynamic setting methods offer one potentially good option for improving the expected delivery delay, throughput and energy efficiency. In order to optimize the network performance, all of the aforementioned factors should be taken into consideration when one tries to develop the setting strategies of the delay-optimization contention window. This research fills in the gaps neglected by most existing SMAC extensions. As one complementary research, the proposed setting strategy is proved to help in further improving them with respect to the end-to-end delay, throughput and energy consumption when it is integrated with the existing SMAC extensions. For energy-constraint wireless sensor networks, the energy-optimization-oriented contention window strategy is essential for improving energy efficiency and prolonging the network lifetime. In future, to further explore contention window setting methods, we will implement more research on energy-optimization-oriented contention window size and the joint-optimization of delay-and energy-oriented contention window size, although the presented results show the energy efficiency is simultaneously improved when focusing on minimizing the delivery delay.