Improvement strategy of S-MAC protocol for wireless sensors in IoT based on data and energy priorities

ABSTRACT Wireless sensors are widely used in the Internet of things. In this paper, the S-MAC protocol is enhanced by extending IEEE802.11 data frame and combining data and energy priority, so as to solve the portability problem of priority data. The improved strategy enables the wireless sensor nodes to transmit data and energy according to the priority and network load in the process of data transmission competition window to reduce unnecessary conflicts. The improved protocol simulation test using NS2 simulation platform shows that the improved S-MAC protocol reduces the data transmission delay of sending different levels of priority information, achieves balanced network load, and prolongs the network life time.


Introduction
In the Internet of Things, the research of communication protocols between wireless sensors is of great significance. In wireless sensor networks (WSN), the MAC protocol is at the bottom of the WSN protocol, which is responsible for managing and coordinating the shared channel resources of users. Therefore, the MAC protocol has a great influence on the MAC protocol for sensor networks. According to certain mechanism, network data in the source node is divided into different priorities. In the data frame, the priority information and data are encapsulated together, realizing the transmission between the network nodes, and eventually ensuring to achieve the quick transmission between the forwarding nodes or source nodes. By extending the data frame, we can improve the S-MAC protocol, combining data priority and energy priority. When sending the data, we should adjust the contention window according to the data and energy priority level and the network load. In this way, the high priority data of the network will be sended preferentially and the low priority data will be delayed to send to achieve the purpose of dispersing the pressure of competition and reducing the number of collision (Ting, Yongtian, & Lihong, 2006;Yong, Mingtian, & Xin, 2006).

S -MAC protocol
Pure ALOHA, Slotted ALOHA and CSMA adopt the traditional random access method, and its characteristics CONTACT Xiaoyue Zheng 21864111@qq.com are the high rate collision and the small throughput, which most of the wireless sensor network cannot be used. For the wireless sensor network, the energy efficiency, fairness, throughput and delay are the important performance index when designing the MAC protocol.
In allusion to the energy demand of the wireless sensor network (WSN) protocol, W.Y e S -proposed the S-MAC (sensor MAC) protocol base on IEEE802.11, which has the advantages of energy saving and strong extensibility (IEEE Computer Society LAN MAN Standards Committee, 1999;Noury et al., 2000;Wei, Heidemann, & Estrin, 2002). The S -MAC has established the strategies to reduce the collision probability and the messaging mechanism as for the four big energy consumption problems-the information data conflict, too much cost, idle monitoring and signal interference. This article has effectively improved to send the senior resources preferentially, to reduce the number of collision, the network transmission delay, and the energy consumption, etc.

Data priority level
Data transmission in the network can be divided into three categories: the important information including the emergency situation; the general data with the biggest content; and the invalid information without any content. According to the priority principle, the network data can also be divided into three categories: the highest priority level data, equal to the key data that contain important information; the secondary priority data equal to the general data that have the biggest content of information, and the last priority data equal to the invalid data without any content (Kim, Choi, Whang, & Youn, 2009;Van Dam & Langendoen, 2003).
(1) The Priority Levels of Portability Through carrying the data frames of priority level, it is easier to determine the data priorities and one or more re-transmission of data. The method to realize the data priority level is to extend the format of the 802.11 MAC Data Frame, mark the data priority level, and put the 3 bytes of DP (Data Priority tag) inserted into the Duration/ID field and the Frame Control field. If there is two bytes before DP mark, we use 0 xc000 to represent. In the MAC protocol data transmission nodes, if the result of the Duration/ID field behind the Frame Control is tested to be 0xc000 then it proves that this frame carries with the data priority level, or it is standard MAC data frame.
The data DP of priority level are 00,01,10, and 11. When the DP value is 00, it is on behalf of the highest priority level; When 10, it represents the frames containing the general data; When the DP value is X1 (01 or 11), it represents that it is the lowest priority level data, which is delaying or giving up the transmission.
(2) The Delivery of the Priority Level In the S -MAC protocol, the nodes transmit the data in accordance with the principle of priority level, which highlights the prior transmission of the important data. It can be determined by improving the back-off time and the CW value of the transmission in the MAC protocol. During the transmission of the network nodes, if the channel is idle, we should choose an appropriate time to implement retreat; After the retreat, if the channel is still free, it can send data. To transmit the data for the first time, the CW value should be set at the minimum value.
Once the conflict appears, the node which transmits the data will retreat and appears its contention window twice its original size. Finally, it will expand to CW max . After the data are completely transmitted, the CW value will come back to its original state.
The modified S-MAC competition and back-off structures increase the priority level of the data. According to the priority level, the data node adjusts the size of contention window CW, which guarantees that the data with the same priority level have the same CW value, and can smoothly have its back-off time. The data with the different priority level should set the CW value according to the DP value. When the DP is 00, 10, or X1, the corresponding CW value should be CW00, CW10, or CWX1. After the modification, the network node selects the corresponding contention window for back off, according to the priority level of the data transmission. For example, the network node will transmit the data when its DP is 00, its original CW value is CW00 min, and its value is CW00; when the data conflict, the CW will increase exponentially, and it will stop when reaching CW max . When the node ranges [0,CW00], it can choose any time to retreat. In this way, it can shorten the back-off time and connect the important transmission channel earlier than any other data. When the DP is X1, the original CW value is CWx1 min, and the value is CWx1. If the information conflicts, the value will increase till CW max . When the node ranges [0,CWX1], it can choose any time to retreat. The backoff time is shorter relative to other data, so the time of connecting with the transmission channel is a little later (Guoming, Lingge, & Chen, 2007).
To adjust the contention window of the data frame can shorten the back-off time in the contention channel of the higher priority level, which can improve the probability of the data frame connecting with the channel. By adjusting the back-off time length of the data frame in contention channel, it can alleviate the pressure of competition, and reduce the probability of information collision, so as to optimize the performance of the WSN.

Energy priority level
Although we can improve the transmission priority level of the data by the back-off time, as the node energy is not limitless, if we want to prolong the cycle of the WSN network, we must improve the data transmission as the main target. In the process of using the network data transmission, data collision, the jamming signal, the input control message and idle listening will cause unnecessary energy loss and energy consumption (Hongjuan, 2008;Xu, 2006).
When the WSN is in the process of using the S -MAC data protocol, it will divide the order of the data transmission according to the energy of the sensor node. The purpose is to make the nodes with less energy, and can transmit currently and minimize the energy loss.
(1) The Definition of Energy Priority Level The power contained in the sensor node is limited. The node will be change constantly with the energy left after the data transmission, according to the remaining energy after each complete data transmission divided the priority level. If the remaining power in the nodes are given into high priority level, the sensor node power will run out soon. On the contrary, if the remaining power in the nodes are sufficient, and given into high priority, the sensor node will transmit the data successfully.
Using the S-MAC protocol in the network, we can optimize and ameliorate the channel contention window together with the priority principle so that the nodes which storage lesser energy can be prior for the data transmission. Through this, the WSN network can be balanced, reduce the stability of the ineffective monitor and prolong the use cycle.
(2) To improve the S-MAC protocol based on the data energy priority The contention channel of the network sensor node can be improved based on the data priority and the joint of energy priority. When the priorities of many data are the same, according to the data sending level determined by electricity priority level, the calculation formula of the contention window value is as following: When the DP are 00, 10 and X1, and the initial number of sensor node is 1, Energy equals to the number of sensor node that contains the electrical energy. The contention window CW max is not a fixed value, but a numerical interval. Such as in the case of DP = 00, the CW ∈ (1/2 CW00, CW00), the back-off time is selected in [0, the CW]; In the case of DP = 10, the contention window CW ∈ (1/2 CW10, CW10); In the case of DP = X1, the CW ∈ (1/2 CWX1, CWX1).
When the sensor nodes compete and then retreat, first of all, the contention window should be determined by the data priority in the corresponding areas, and the calculate the CW value according to the energy saved in the sensor node. In the process of the power in the sensor node becoming less and less, the CW values will also continue to decline.
As for the data with no difference in the priority level, the contention back-off time and the probability of connecting the channel can be determined according to the energy priority level. Energy priority level is proportional to the connection probability of channel, and inversely proportional to the contention back-off time.

The simulation and the results
When NS2 simulation experiment was carried out, the lifetime of the network, the loss number of nodes, the pointto-point time delay, the reception and sending data-all these criteria can be the judging standard. Through the analysis of S -MAC protocol before and after the improvement, we can conclude the difference in information collision, the death node in the data transmission under different priority level. PHY_MIB(Mac802_11 *parent); inline u_int32_t getCW min () { return(CW min ); } inline u_int32_t getCW max () { return(CW max ); } /*when the contention window is at the lowest value, the CW Min1 is 2 *CW min */ inline u_int32_t getCW min1 () { return(2*CW min ); } /*when the contention window is at the lowest value, the CW min2 is 4 *CW min */ inline u_int32_t getCW min2 () { return(4*CW min ); } inline double get Slot Time() { return(Slot Time); } . . . . . . /*When the information data transmitted in the network are the highest priority level, the contention window must be set anew. In the case that DP = 00, the lowest value of the contention window is CWmin; In the case that DP = 01, the lowest value of the contention window is 2*CW Min ; In the case that DP = 10, the lowest value of the contention window is 4*CWmin.*/ (continued).

The simulation and the result analysis
NS2 simulation experiment randomly selects 20sensor nodes spreaded in the network. It designs three priority levels data transmission flows with different transport nodes and receiving nodes. Through the AODV protocol of the routing layer, it applies the data transfer rate(Mb/s) to control network data transmission flow, which enables the three set-up transmission flows contend for the channel in the various network transmission. The specific parameters are shown in Table 1.  The simulation test contrasts the previous number of data conflicts with that of the improved S-MAC protocol ( Table 1). The result shows that the number of the data conflicts of the improved MAC protocol is only about 50% of the original (Figure 1). When the traffic data transmission in WSN is greatly increased, the number of conflict significantly reduced. The sensor nodes decide the contention back-off time in accordance with the priority principle, which reduces the pressure of the contention channel and effectively reduced the probability of the data conflict.
In the point-to-point data transmission time delay, the simulation results (Figure 2) before the improved S-MAC protocol finds that the amount of time delay in the various data point-to-point transmission process is not stable, while the improved S-MAC protocol simulation experiment results (Figure 3) shows that with the different priority levels in the transmission of the data, when the traffic soared, the amplitude of the transmission time delay has a different increase, obviously. For example, when DP is 00, time delay of the data transmission volume is significantly lower than the other two data, especially when the WSN data transmission load increases, the growth rate of time delay is the lowest. According to the result, with the improved S-MAC protocol, the higher level of the data, the less time does the contention retreat. It achieves the priority to the data transmission with high priority level. Compared to the data with high priority level, low priority in the transmission of the data delay more time, especially in the WSN network data transmission under the condition of heavy load, this situation is the most obvious.
As shown in Figure 3, the improvement of the S-MAC protocol can not only achieve high priority level data transmission in smaller time delay, but also reduces the conflict probability of the data transmission within the channel. It effectively improves the data throughput  and eventually improves the performance of the network transmission.
In terms of the point-to-point time delay, the simulation experiment results before improvement (Figure 4) shows that the average delay time of the three types of the data transmission lack of regularity. The S-MAC data transmission protocol opens the monitor and the sleep cycle system. In the case of a large amount of data transmission, the data in the sensor nodes are arranged. It waits until the end of the sensor nodes sleep after recovery. Then the data are transmitted through the channel. A lot of unnecessary energy losses appears in this process. As shown in Figure 5, the simulated experiment after the improvement of the protocol, when the nodes are transmitting the data, according to the order sended by the priority rank data, a variety of the data traffic pointto-point present significantly prolongs, when extending the time of the data transmission in DP is 00, which is significantly lower than the other two kinds of the data, especially when the WSN transmits data in the grid load  increases, the increase of the data transmission time delay reaches the minimum. When the DP is X1, the delay time of the data transmission significantly passes the other two data. When the WSN data transmission load increases, the delay time in transmission rises sharply. Seeing from the energy loss level, the number of nodes death in the electrical energy consumed the nodes which can't work. The simulation experiment result before and after the improvement of the protocol shown is Figure 6. After renovation, the number of dead nodes within the WSN is only 70% of that in the original. Seeing from the single node, the energy loss caused by the data conflicts and idle listening significantly reduced. It enables the node for the data transmission work longer hours.
The lifetime of the WSN is the simulation start time to the excessive loss of node to stop time. If the connection is not disconnected, the time span at the end of the simulation is also written as the simulation time. So the simulation time ≥ survival time. Figure 7 is the experimental data of the WSN lifetime. After renovation, the survival   has an upward trend. Figure 8 is the average throughput of the WSN network. The transfer rate of throughput is far bigger than before. Seeing from the global perspective, after the improvement of the network protocol, the network topology is stable, routing change frequency decreases, the network load tends to be balanced very well, and the network obviously prolongs its service life.
Based on the experimental results, it points out that the modification of the S-MAC transmission protocol not only improves the efficiency of the priority level of the data transmission, but also reduces the load of the WSN data transmission.

Conclusions
Using NS2 simulation platform, the performance of the improved S-MAC protocol is tested under different priority data transmission. From the simulation results, the data will be selected according to the priority of different transmission channels. It reduces the delay of important data transmission and effectively improves the transmission speed of high priority data. At the same time, sensor nodes change the competition and backoff time according to the electric energy, which reduces the risk of data conflict and idle monitoring, improves the energy utilization efficiency of wireless sensor nodes, and prolongs the lifetime of nodes. From a global perspective, the topology of wireless sensor networks is more stable, and the routing changes are significantly reduced. Node energy use is more balanced and network is more durable.

Disclosure statement
No potential conflict of interest was reported by the author.

Funding
This paper is supported by Scientific and Technological Project of Henan Province (No.182102210486), Key Scientific Research Project of University in Henan Province (No. 18A520008).