Collision Free Communication for Energy Saving in Wireless Sensor Networks

A Wireless Sensor Network (WSN) distinguishes from other wireless or wired networks through its capability of interaction with the environment. Such networks have been proposed for various applications including search and rescue, disaster relief, smart environments, and localization systems. These applications require a large amount of battery-powered wireless sensors, and are generally designed for long-term deployments with no human intervention. Consequently, energy efficiency is one of the main design objectives for these sensor networks.


Introduction
A Wireless Sensor Network (WSN) distinguishes from other wireless or wired networks through its capability of interaction with the environment. Such networks have been proposed for various applications including search and rescue, disaster relief, smart environments, and localization systems. These applications require a large amount of battery-powered wireless sensors, and are generally designed for long-term deployments with no human intervention. Consequently, energy efficiency is one of the main design objectives for these sensor networks. The main causes of the energy wastage are: • Collision: occurs when two or more nodes attempt to transmit a packet across the network at the same time. The transmitted packets must be discarded and then retransmitted, thus the retransmission of those packets increases the energy consumption and the latency.
• Overhearing: occurs when a node receives a packet destined to other nodes. Overhearing can be a major reason of energy waste mainly with a high node density causing a heavy traffic load.
• Packet Overhead: sending and receiving control packets consumes energy too and less useful data packets can be transmitted, since control messages does not contain any useful application data.
• Idle listening: it occurs when a sensor node listens to an idle channel to receive possible traffic. Usually a node in a WSN doesn't know when to wake up to receive a packet, thus it must keep its radio ON which consumes most of the energy.
Therefore, researchers give a growing interest on optimizing WSN MAC (Medium Access Control) to reduce the energy consumption of the sensors in order to extend the network lifetime. The main challenge of any MAC protocol is to avoid collision as it represents the most important issue of energy saving. Usually in WSNs several nodes share the same channel, thereby the probability of packet collision increases. Developing a MAC protocol to coordinate the channel access of these nodes decreases the risk of packet collision and specially DATA packet collision which decreases the channel utilization as DATA packets are longer than control packets.
In this paper, we provide a state-of-the-art study of WSN MAC protocols, and we will discuss the advantages as well as the drawbacks of the main existing solutions. We classify the MAC protocols according to the technique being used and to the problems they try to solve. In contrast to previous surveys, we will give more interest to the solutions treating the mobility of the sensor nodes and the real time constraints. Generally, MAC protocols are classified into two categories: contention based and schedule based protocols.
Contention based protocols allow many users to use the same radio channel without pre-coordination. The main idea of these protocols is to listen the channel before sending the packet, IEEE 802.11, ALOHA and CSMA (Carrier Sense Multiple Access) are the most well known contention-based protocols. Compared to the schedule based protocols, the contention one are simple, because they don't require global synchronization, or topology knowledge which allows some nodes to join or to left the network few years after deployment. Message collisions, overhearing and idle listening are the main drawbacks of this approach. Thereafter we will present these basic protocols (IEEE 802.11, ALOHA and CSMA), and in the next sections other contention based approaches more suitable for WSNs will be discussed.
• IEEE 802.11: to avoid collisions of data packets, IEEE 802.11 [1] uses carrier sensing and randomized back-offs. Likewise, the Power Save Mode (PSM) of the IEEE 802.11 MAC protocol is used to reduce the idle listening. PSM power management decisions are made periodically to allow the sensor nodes to switch to the sleep state. IEEE 802.11 PSM may not be suitable for multi-hop networks because of the problems of clock synchronization, neighbour discovery and network partitioning.
• CSMA: a node verifies the absence of other traffic on the shared transmission medium, and then if the channel is clear it starts transmitting the packet, otherwise the node waits for the transmission in progress to finish. CSMA is a robust method to nodes mobility and no central node is required, but it suffers from the hidden terminal problem which occurs when two transmitters are not able to sense each other because they are out of range of each other, so their messages might collide at the receiver node which is in range of both transmitters.
• ALOHA: the first version of the protocol was quite simple: if you have data to send, send it, then if the message collides with another transmission, try re-sending "later". The main drawbacks of this protocol is its poor use of the channel capacity; the maximum throughput of the ALOHA protocol is only 18% [2]. The channel utilization can be increased with slotted ALOHA (35%), by dividing time into slots and nodes may only start transmitting at the beginning of a slot. This method decreases the probability of packet collision. These protocols (ALOHA and slotted ALOHA) are not a suitable solution for multi-hop networks, and they do not solve the problem of hidden nodes which increases the problem of collision, and hence increases energy consumption.
In schedule based protocols, a schedule is established to allow each node to access the channel and communicate with other nodes. The main goals of this schedule based approach is to reduce collision and ensure fairness among the different nodes of the network, except that the network topology must be known in advance, and synchronization is required between nodes, thus the better the synchronization the shorter the idle listening. TDMA (Time Division Multiple Access) is a representative example for such a schedule based approach. It allows nodes to share the same frequency channel by dividing time into frames and each frame is divided into slots. The nodes transmit in rapid succession, one after the other, each using its own time slot; consequently transmissions do not suffer from collision. TDMA guarantees fairness among nodes as each node is assigned a unique slot in each frame, and increases the overall throughput in highly loaded networks.
In the next sections, we present the different contention based protocols suitable for WSNs, then we discuss schedule based protocols. We keep the last two sections to the protocols dealing with the mobility of the nodes and the applications with real time constraints.

Contention based MAC protocols for WSNs
As mentioned before contention based protocols require no coordination among the nodes accessing the channel, these protocols are mainly based on CSMA or CSMA/CA. To avoid the hidden terminal problem discussed above, RTS (Request To Send)/CTS (Clear To Send)/ACK (Acknowledgement) control messages are used. In general these protocols allow nodes to enter periodically into sleep periods. In the following, we describe the main contention based protocols proposed for WSNs and Table 1 summarizes them.

S-MAC [3]
: is specially designed for wireless sensor networks and is derived from IEEE 802.11. A time frame in S-MAC is divided into two parts: one for a listening session and the other for a sleeping session, thus a sensor has a periodic listen/sleep period (S-MAC assumes that the duration of the listen and sleep periods is known by all nodes). Therefore, the nodes turn off their power-consuming transceiver and application packets are backlogged during their sleep period while the communication with other nodes is allowed during the listening period. A SYNC control packet is exchanged between nodes  [3] during the listening period to establish synchronization among the neighboring nodes, i.e. schedule exchanges are accomplished by periodic SYNC packet broadcasts to immediate neighbors. SYNC messages are sent during synchronization period as shown in Figure 1. S-MAC divides the listening period into two parts (Figure1: (1) the first part is reserved to the exchange of SYNC messages and (2) the second part allows the exchange handshaking 71 Collision Free Communication for Energy Saving in Wireless Sensor Networks mechanism (RTS/CTS) and DATA packets. To avoid packet collisions, S-MAC uses RTS/CTS mechanism similarly to IEEE 802.11. Moreover, it performs virtual and physical carrier sense before transmission. S-MAC tries to avoid overhearing by letting interfering nodes go to sleep after they hear an RTS or CTS packet. A node having a NAV value not equal to zero should go to sleep to avoid overhearing (note that NAV is the network allocation vector used to indicate the activity of every neighbor of a given node. When a node receives a packet destined to other nodes, it updates its NAV by the duration field in the packet). The main advantages of S-MAC are: • the energy waste caused by idle listening is reduced by sleep schedules. • simplicity of implementation.
• time synchronization overhead may be prevented by sleep schedule announcements. Apart from the above advantages, S-MAC suffers from some drawbacks such as: • Sleep and listen periods are predefined and constant which decreases the efficiency of the algorithm under variable traffic load. • Broadcast data packets do not use RTS/CTS, which increases collision probability. • high latency and low throughput.

T-MAC [5]
: is based on S-MAC [3], the main difference between the two protocols is that the active period in T-MAC is preempted if no activation event has occurred for a time TA, thus a sensor node could spend more time on sleeping mode compared to S-MAC. Figure 2 shows the overall operation of T-MAC and its difference compared to S-MAC. The interval TA > C + R + T where C is the length of the contention interval, R is the length of an RTS packet and T is the turn-around time (the short time between the end of the RTS packet and the beginning of the CTS packet). The major problem of T-MAC [5] is Figure 2. T-MAC and S-MAC active period operation [5] the early sleeping problem, which occurs when a node goes to sleep while a neighbor still has messages. To overcome this problem the protocol uses Future Request-To-Send (FRTS) as a solution. An FRTS is sent to the neighbor node before its TA timer expires to force it to stay in active mode, thus it can receive the transmission at the same active period rather than receiving it in the next active period. The FRTS solution is illustrated in Figure 3.

E2MAC [6]:
unlike T-MAC, it adds packets in a node's buffer until it reaches a maximum predefined size, then the node transmits data in a burst. This protocol increases energy saving, but it also increases latency and is not suitable for delay-critical applications. . Future request-to-send scenario [5] it wakes up to receive data. Apart from that, the protocol follows the same rules as S-MAC [3], thus SWMAC suffers from the same drawbacks as S-MAC.

Adaptive Listening [8]
: it aims to minimize the sleep delays by the use of overhearing. In this protocol the node that hears another transmission could go immediately to the sleep state once it is informed about the transmission end of its neighbor. Note that the sleep delay means: end-to-end delay that increases latency in multi-hop networks, as intermediate nodes on a route do not necessarily share a common schedule.
6. B-MAC [9]: is highly configurable and can be implemented with a small code and memory size. To save energy, radios on B-MAC periodically wake up to sample the medium. B-MAC consists of four main parts: channel assessment (CCA) and packet backoffs for channel arbitration, link layer acknowledgments for reliability, and low power listening (LPL) for low power communication. B-MAC is based on preamble sampling like ALOHA protocol [2], the preamble length is configurable which gives optimal trade-off between energy savings and latency or throughput.
The experimental results of [9] show that B-MAC has better performance in terms of latency, throughput and often energy consumption compared to S-MAC [3]. With B-MAC, all nodes are in sleep mode when there is no traffic which represent the main advantage of this protocol, thus they just wake up only for preamble sampling and go back to sleep. However B-MAC is an efficient protocol only in low network traffic conditions since nodes will spend most of the time sleeping, otherwise, when traffic condition increases, B-MAC loses efficiency because nodes remain awake for a longer time waiting for the entire packet transmission.

DSMAC (Dynamic S-MAC) [10]
: as the previous protocol, it aims to reduce the sleep delay by dynamically changing its duty-cycle depending on the application demands. When an application requires less latency or when there is an increasing traffic load, a node increases its duty cycle by adding extra active periods. In this case, the concerned node sends a SYNC packet to its neighbors to inform them about its additional active schedule, then each neighbor decides to increase its duty-cycle or not. At any time, the sensor node can decrease its duty cycle by removing the added active periods.
8. U-MAC [11]: is based on S-MAC [3] and provides three main improvements on this protocol: various duty-cycles, utilization based tuning of duty-cycles and selective sleeping after transmission. Each node of the network has a different periodically listen and sleep schedules with different duty cycles. Like S-MAC, nodes have to exchange their schedules and be synchronized. However they do not adopt the same schedules as their neighbors. Additionally, the ACK packet contains always the time of the next sleep of a node. Utilization based tuning of duty-cycles reflects different traffic loads of every node in a network. Such variation corresponds to the diversity of performed tasks by a particular node and its location. Selective sleeping after transmission avoids the above energy wastage. After the transmission of a packet, a node goes to the sleep state if it finds a scheduled sleep time. It does not introduce additional delays, since no traffic is expected to this node. U-MAC [11] improves energy efficiency as well as end-to-end latency compared to the previous protocols. As shown in Figure 4 and Figure 5, U-MAC saves about 32% energy and 45% latency from S-MAC. Contention based protocols are known also as random access protocols. The main drawbacks of such protocols are the performance degradation when traffic is frequent and these protocols suffer from stability problems.

Schedule based MAC protocols for WSNs
These protocols are based on a schedule to carry out communication. They are also called TDMA based protocols. Using this approach, we achieve a good energy efficiency and throughput [12]. Although, schedule based protocols require synchronization between nodes to guarantee a shorter idle listening.
In the following we will present the main schedule based protocols proposed for WSNs and we summarize these protocols in Table 2.  MMF-TDMA approach considers the network as a tree-like network organization where the parent nodes coordinate the assigning process of their siblings. To guarantee collision-free, [13] propose a distributed max-min fair scheduling mechanism suited for continuous traffic on a data gathering tree and incorporate it with a time-slot based bandwidth allocation scheme. For max-min fair resource allocation, if the source nodes of the network are not constrained, they increase their allocation by a small value for every iteration of the algorithm. When the combination of incoming data, generated data, and interfering data traffic is within the total bandwidth, we said that those nodes are constrained. Note that all nodes having an output traffic interfere at a constrained node and nodes that are in the subtree below a constrained node, become constrained. The algorithm ends when all nodes on the routing tree become constrained and the rate available to all sources is the allocated rate. A TDMA based scheduling algorithm is used to provide enough number of time slots for the data originating at each source for each frame. The time slot allocation algorithm must avoid the hidden terminal problem, by ensuring that a time slot allocated to a node does not collide with that allocated to a node that is 2 hops away and that might interfere at the recipient of this node's communication. First, the root node allocates the required number of time slots to each of its children. Then, the time slot allocation algorithm runs in an iterative manner in a BFS-order (breadth first search). At each iteration, only one node allocates time slots to its children. Simulations show that MMF-TDMA outperforms an overhearing avoidance MAC (similar to S-MAC) and pruned 802.11 (without ACK's) in terms of energy consumption, fairness, and delay. Although, this approach is not suitable for mobile nodes.
2. D-MAC: the data-gathering MAC (D-MAC) [14] aims to achieve a very low latency and still be energy efficient, for converge cast communication. It is designed for tree based data gathering. This approach is based on TDMA where time is divided into small slots. Within each of these slots, to transmit or to receive packet, CSMA is executed with acknowledgement. D-MAC guarantees a delay of approximately tens of milliseconds: A packet sent from 76 Wireless Sensor Networks -Technology and Applications a source node at a depth k can reach the sink node with a delay of just k time slots as shown in Figure 6. With D-MAC, a node has 3 states: sending, receiving, and sleeping. Figure 6. Data gathering tree in the D-MAC scheme [14] During the first state a node sends a packet to the next hope on the route and awaits an acknowledgment. When the next hope node receives the packet (it is in the receiving state at the same time when the first node is in the sending state), it immediately switches to the sending state and sends the packet to the next hope. The sleep state of the node is the time interval between two successive sending and receiving periods as shown in Figure 6.
To reduce packet collision which occurs when two nodes in the same depth in the tree have synchronized schedules, D-MAC uses a back-off period plus a random time within a contention window.
The main problem of this approach is packet collision which occurs because many nodes in the tree could share the same schedule and D-MAC employs restricted collision avoidance methods. D-MAC works better for networks in which the transmission paths and rates are well known and do not change over time.
3. TRAMA [15]: the main goals of TRAMA (Traffic-Adaptive Medium Access) are the energy efficiency and network throughput. To achieve the first goal, the protocol aims to ensure collision free transmission and switching the nodes to idle state when they are not transmitting or receiving. There are three main parts in this protocol: the neighbor protocol (NP), the schedule exchange protocol (SEP) and the Adaptive election algorithm (AEP).
• Neighbor protocol: is used to exchange one-hop neighbor information. This algorithm guarantees that the slots are long enough to allow all nodes to get consistent two-hop neighbor information. • Schedule exchange protocol: this part of the protocol is used to two-hop neighbor information and their schedule. Each node of the network computes a duration named SCHEDULE − INTERVAL (the number of slots for which the node can announce its schedule to its neighbors). At time t the sensor node announces the slots where it has the highest priority among its two-hop neighbors. The selected slots must be in the following time interval [t, t + SCHEDULE − INTERVAL]. • Adaptive election algorithm: ensures that there is a unique ordering of node priorities within any two-hop region at each time, thus a node transmits its packet only when it has the highest priority among the two hop neighbors.

Collision Free Communication for Energy Saving in Wireless Sensor Networks
The main problem of this protocol is its long delay compared to the other protocols, which make it suitable only for applications that are not delay sensitive but require higher energy efficiency and throughput. Figures 8 (a) and 8 (b) show respectively the percentage of energy savings and the percentage of sleep time achieved by TRAMA and S-MAC in three networking scenarios illustrated in Figure 7. We can see that TRAMA has better performance than S-MAC especially in the edge initiators scenario [15].  [15] 4. Energy Aware TDMA Based MAC (EATDMA) [16]: the network is divided into clusters, where each one of them is managed by a gateway. The main functions of the gateway are: collects information from the other sensor nodes within its cluster, performs data fusion, communicates with the other gateways and sends data to the control center, assigns time slots to the sensor nodes within its cluster and informs the other nodes about the time slot when they should listen to other nodes and the time slot when they can transmit own data. This approach has four phases: (a) Data transfer: sensors send and relay data in the allocated time slots. (b) Refresh phase: each node informs the gateway about its energy level, state, position, etc... (c) Event-triggered rerouting: a gateway runs the routing algorithm based on the information sent by the nodes during the previous phase. (d) Refresh-based rerouting: the gateway performs this action periodically after the refresh phase. With EATDMA [16], the node, that only senses, receives one time slot, while it receives as many time slots as nodes send information through it, if the node relays data. The Node that senses and relays receives one time slot for itself and as many time slots as the nodes that send information through it. There are two approaches for slot assignment: Breadth First Search (BFS) and Depth First Search (DFS). The former assigns the time slot numbers starting from outer most sensor nodes and giving them contiguous slots. While the latter assigns contiguous time slots for the nodes on the route from outermost sensor nodes to the gateway. Simulation shows that BFS technique gives better results with respect to DFS in terms of node lifetime. However, DFS has low latency and high throughput as compared to BFS.

PEDAMACS [17]: in Power Efficient and Delay Aware Medium Access Control protocol
for Sensor networks of [17], the schedule is calculated and sent to the entire network by Figure 8. Energy savings and average sleep interval for sensor scenarios [15] the sink node based on the information about the network topology and traffic load. That information are sent by the other nodes of the network. At the end of the topology learning phase a spanning tree is constructed and the sink node has an entire knowledge of the topology. This phase is done by the topology-learning packets flooded in the network by the sink node. The main drawback of this protocol is that the traffic pattern is always converge cast. In addition the protocol assumes that the sink is powerful enough so that it can reach all nodes when it transmits which is not always true, thus, nodes that do not receive the schedule transmitted by the sink, must wait for the next topology-learning.
6. G-MAC [18]: divides the message frame into two periods: the collection period, and the distribution period. During the first period, the gateway sensor node (the cluster coordinator), collects information sent by the other nodes of the cluster expressing their future upload traffic. In the distribution period, the gateway sensor node sends a GTIM message (gateway traffic indication message) to the other nodes. GTIM maintains synchronization among nodes and sets up slot owners among nodes having data to be sent to the gateway. G-MAC periodically elects a new gateway node to equally distribute the energy requirements among all of the sensors. Compared to S-MAC by [3], and T-MAC by [5], G-MAC protocol provides the best network lifetime, but it still has a large overhead.
7. µMAC: this protocol proposed by [19] uses a similar idea as TRAMA [15]. It has two periods: the contention period for two-hop topology construction, and a contention free period for data exchange. Other forms of communication take place in special reserved time slots for broadcasting (not contention-free) communication. Compared to TRAMA described by [15], µMAC uses a different time slot reservation mechanism.
Schedule-based protocols are energy efficient, as the schedule forces nodes to switch on only during a specific time slot, for the rest of the time they are in sleep mode. With respect to the contention based protocols, scheduled protocols solve the problem of interference and reduce packet collision. However, this family of protocols suffer from several drawbacks, as the limited scalability and flexibility due to the frequent topology change in WSN, and they perform worse than contention based protocols in low traffic condition. To overcome the drawbacks of the above protocols researchers propose hybrid solutions to combine the strengths of both scheduled and contention based protocols.

Hybrid solutions
These protocols take advantages of the above discussed protocols by exploiting the scalability and low control overhead of contention-based protocols and the high channel utilization efficiency of scheduled protocols.
Data communication occurs in both contention-based and scheduled fashion to achieve high performance under variable traffic load, thus, the former guarantees high performance when a small number of nodes transmit data in the network. However the latter achieves high performance when a large number of nodes transmit. The different protocols discussed in this section are summarized in Table 3. The first one is based on the super-frame shown in Figure 9, it contains an active and an inactive period. Although the active period contains 16 time slots and it is divided into a contention access period (CAP) and an optional contention-free period (CFP). The divides the message frame into two periods: the collection period, and the distribution period compared to S-MAC [3], and T-MAC [5], G-MAC provides the best network lifetime still has a large overhead Table 2. Summary of schedule based protocols in WSNs super-frame reserves a maximum of 7 time slots of the 16 time slots to the CFP TDMA communication.
The CSMA/CA protocol is used during the CAP period to access the channel and the beacon message of the coordinator specifies at which time slot the contention access period ends.
The CFP contains a special time slot assigned by the coordinator. Therefore, a sensor node can communicate with the coordinator. The standard specifies that the guaranteed time 81 Collision Free Communication for Energy Saving in Wireless Sensor Networks slots (GTS) can only be assigned by the PAN coordinator. In the following we will describe how data is transmitted from and to the coordinator.
• Data transfer to a coordinator: to transfer data to the coordinator a device can use the contention free period if it has a GTS, or it has to compete with other devices to access the channel during the contention access period. In the latter case, each device uses CSMA/CA procedure, then, if no collision occurrs, the coordinator sends an acknowledgement message to the device without using CSMA/CA protocol.
The main problem of this approach is that the coordinator must be in listen mode during the contention period, to overcome this problem the IEEE 802.15.4 standard introduces a battery lifetime extension mode that limits the interval in which the coordinator listens to the channel after it has transmitted a beacon message. The standard specifies that in this energy-conserving mode, the coordinator stops listening to the channel after 6 back-off periods. However, it will still serves the GTSs as specified in the beacon message. • Data transfer from a coordinator: in this case, using a beacon message, the coordinator informs the end devices that it has data pending. The concerned sensor node has to request for the data by sending a request message. If no collision occurs, the coordinator sends an acknowledgement and the data are transmitted using the slotted CSMA/CA mechanism. The end-device remains in receive mode until the data is received.
2. Zebra MAC (Z-MAC) [21]: uses CSMA in low traffic and switches to TDMA in high traffic conditions. Once the network is deployed, Z-MAC starts with a discovery phase of two-hop neighborhood followed by a slot assignment to nodes using DRAND (Distributed Randomized TDMA Scheduling For Wireless Adhoc Networks) by [22]. DRAND is a distributed protocol used to guarantee that a time slot is not assigned to two nodes located within three hops from each other. The algorithm takes care to distribute slots in a way that avoids hidden node collisions which may happen when a node and its two-hop neighborhood share the same time slot.
To access the medium, if the node owns the current slot, it waits a random time smaller than a value T o , called the owner contention window size, then performs a CCA (Clear Channel Assessment). If the channel is free, it emits. Otherwise, it waits until the channel becomes free again and resumes the same approach. If the current slot belongs to a two-hop neighbor and if the node has received an indication of strong contention from one of its two-hop neighbors, the node has no right to use this slot. Otherwise, it waits for a random time between T o and T no (the non owner contention window size) before performing a CCA.
To evaluate the performance of Z-MAC, the authors of [21] compared Z-MAC and B-MAC [9] with T o = 8 and T no = 32. The default initial and congestion backoff window sizes of B-MAC are 32 and 16 slots respectively (each slot is 400 µs). The simulation results show that the power consumption of Z-MAC is slightly worse than that of B-MAC due to clock synchronization messages and the wake up period (see Figure 10). [23]: takes into account the bottleneck faced by most of sensor network applications. This phenomenon occurs when a station in the network acts as a sink of data, to which a set of sensors direct their traffic. Funneling-MAC adopts an access method based on CSMA/CA in the entire network during a time interval followed by a time interval during which a TDMA access method is used for high-load zone only to  Figure 10. Power efficiency of Z-MAC in low-data rate applications with low duty cycle [21] offer more access time to the nodes near the sink. These two time intervals constitute a superframe. This division is shown in Figure 11. Area at high load is sized by a beacon message broadcast by the sink node. The nodes that do not receive the beacon apply the CSMA/CA procedure. Based on the path of the received frames, the sink node determines the sequencing and the design of TDMA slots allocated to nodes in the area with a high load. Only the nodes belonging to the area with a high load update the path taken by a frame.

Funneling-MAC (FMAC)
To avoid the interference between nodes beyond the high load area, the time slicing of TDMA, and the beacon transmitted by the sink node; nodes in the area with a high load periodically generate a frame containing information about the CSMA/CA period, the duration of the TDMA period, and the number of superframes until the next beacon.
Hybrid protocols try to combine the strengths of two protocols family (contention based and scheduled based). However these solutions are complex in terms of deployment.

MAC protocols for mobile sensors in WSNs
Most of the previous protocols deal with stationary sensors, whereas the new WSN applications use mobile nodes as they become essential for various areas such as: supply chain management, patient or children monitoring, and mobility platform in battlefield surveillance.  Any MAC protocol developed to handle node mobility must deal with topology changes Therefore, it should adapt neighbor table and route maintenance to the mobility in the network. Eventually, the MAC protocol needs mobility information, and must determines the neighborhood of each node to eliminate the inconsistency caused by the mobile node when they enter or leave the neighborhood.
In the following we introduce the main protocols that handle node mobility in WSNs and Table 4 summarizes them.

SMACS and EAR algorithm [24] SMACS(Self-organizing Medium Access Control for
Sensor networks) is a distributed infrastructure-building protocol that allows sensor nodes to discover their neighbors and to establish the schedule of transmission and reception based on TDMA scheduling with no need of a master node. SMACS assumes that the network is connected, thus there exists at least one multihop path between any two distinct nodes. The Eavesdrop -And-Register (EAR) algorithm is based on SMACS. The EAR algorithm can realize the reliable communication between a mobile node and a fixed node. This communication is realized by the control head packets, which must be as low as possible. The main problem of this algorithm is related to the number of mobile nodes in the network; when this number is high it leads to packet collision with a high probability rate. It also does not guarantee high rate of coverage in the monitoring area. Note that the EAR algorithm is transparent to the SMACS protocol. In the EAR algorithm there are four types of frames to build a link between mobile nodes and stationary nodes: Broadcast Invite (BI), Mobile Invite (MI), Mobile Response (MR) and Mobile Disconnect (MD). A BI frame is used by a stationary node to invite a mobile node to join a communication, thus a mobile node starts its connection protocol when it receives the BI frame. This frame is mainly used to register a stationary node depending on the connection status of the mobile node and the link quality between the mobile node and the stationary node. The mobile device will continue the registration procedure until its registry becomes full (any new stationary node will enter the register only if its link quality is better than the inferior registered link quality).
An MI frame is used as a response to a BI frame and a request to build up a connection. When the stationary node receives the MI frame, it decides whether the connection is possible or not. In the former case, slots are selected along the TDMA frame for communication, and a reply is sent to the mobile node accepting the connection. the mobile node sends an MD frame to inform a stationary node to interrupt linkage. This case happens when the received SNR (signal to noise ratio) degrades and becomes lower than a given threshold. After a stationary node receives this frame, it deletes information of the mobile node from the registration form. EAR algorithm can be used only in WSNs based on TDMA technology, which represent the main drawback of this algorithm. Furthermore, the network topology could only be cluster-based. Because of the important number of BI frames sent by the stationary nodes, energy efficiency of these nodes is low. [25]: is based on S-MAC [3]; it varies the sleeping time dynamically according to the velocity of the mobile node. The first phase of this algorithm aims to build up virtual clusters by sending SYNC frame like in S-MAC. This phase of the algorithm is executed at the beginning at every scheduling mechanism.

Mobile sensor MAC (MS-MAC)
The main problem of this algorithm occurs when nodes move from one cluster to another, and it takes two minutes for a mobile node to get connected to a new cluster. To overcome this problem, border nodes should follow synchronous periods of the two virtual clusters, and set a value v 0 if the velocity of the mobile node is higher than 1/4 v 0 , make scheduling cycle as 1 minute if the velocity of the mobile node is higher than 1/2 v 0 , then make scheduling cycle as 30 seconds, etc. This mechanism of synchronization period is shown in Figure 12 From the above algorithm discussion, we could conclude that MS-MAC cannot ensure reliable communication between stationary nodes and mobile nodes; meanwhile, this kind of sleeping mechanism also does not ensure a high rate of coverage and connection of the whole network. Figure 12. Frequency of synchronization period in MS-MAC depends on mobile speed [25] 3. Mobility adaptive MAC (MMAC) [26]: handles weak and strong mobility. The former means concurrent node joins and failures, and physical mobility either because of mobility in the medium (e.g. water or air) or by means of special motion hardware. While the latter means topology changes (node joins, and node failures). MMAC is dynamically adapted to changes in mobility patterns by introducing a mobility-adaptive frame time and the protocol builds a collision-free schedule based on estimates of traffic flow, mobility and dynamic patterns. The frame time is shown in Figure  13. To predict the mobility behaviour of sensor nodes and to adjust the frame time, MMAC uses the location information of the sensors. In Figure 13 we note that the frame time is dynamic and different from one node to another differently from the previously discussed TRAMA protocol of [15]. The basic idea of the Mobility-Adaptive algorithm is to reduce  [26] or to raise the frame time depending on the number of nodes that are expected to enter or leave the two-hop neighborhood of a given node. Moreover, the algorithm builds two sets: incoming nodes (IN) and outgoing nodes (ON) for a given node β, then if a node A is a member of either IN or ON do not consider A in the 2-hop neighborhood of β. To reduce the frame time the number of members in the previous two sets must be greater than a threshold value. Finally according to the frame time the algorithm adjusts the Scheduled-Access time and the Random-Access time shown in Figure 13. The main issues of this protocol are: mobility information (each node requires future mobility states of all current and potential two-hop neighbors) and Synchronization (each node has its own frame time which causes synchronization problems). To handle these problems MMAC proposes the following solutions: • Mobility Information: the signal and the data header are modified to include predicted mobility-state information, thus at the start of each frame, each node β independently calculates the expected mean (x,y) position of β in the next frame, then this information is sent in the header of every signal and data packet generated by β. The last scheduled access slot of the frame time is reserved for BROADCAST from head node for sending all received mobility information to the member nodes, therefore, each node β has best-effort knowledge of the predicted mobility states of its current and potential two-hop neighbors. • Synchronization problem: to solve the synchronization problem, [26] introduces the concept of "Global Synchronization Period" (GSP) where the frame times would change only during this period. GSP occurs before each LEACH-style round (a mechanism to select cluster heads in MMAC) when cluster-heads are re-elected. During a round (i.e. k frames), some changes may happens in the mobility rate, thus MMAC alters the division between scheduled access and random access slots after each frame. Therefore, the frame time in the network remains the same but the random access period of each cluster members would increase or decrease reflecting the mobility pattern. If all two-hop members of a node α belongs to a cluster c, then their random access time and scheduled access time would be the same. The main disadvantage of this protocol is the requirement on the knowledge of the position, which is often either not feasible or too energy consuming. Figure 14 shows that MMAC performs slightly better than TRAMA [15], while it outperforms S-MAC [3] and CSMA. In Figure 15, we can see that when the mobility of nodes is minimal all the protocols (apart from CSMA) are energy efficient. However, when the mobility becomes important only MMAC adapts to the mobility of the nodes.  [26] 4. FlexiMAC [27]: copes with some network dynamics and node mobility. The first phase of the protocol aims to build a data gathering tree and nodes'schedules which is maintained throughout their lifetime in the network. CSMA/CA is used during this phase for nodes transmission. After this phase of the protocol, nodes perform regular data gathering tasks using their TDMA schedules. They also can modify their schedules when the network topology changes. FlexiMAC ensures the following functionalities: • Data Gathering Tree Construction: for routing data from a source node to the base station through a tree-path and to collect node s first-level neighbor IDs. To minimize energy consumption, nodes select the closest node within a default transmission radius of their parents and using the minimum transmission power needed to reach their parents. The data gathering tree helps the sensor nodes to know the local network topology, thus each node knows its parent, children, descendants, and first-level neighbors. • Time slot assignment: the slot distribution follows a depth first search (DFS) which allows data sent by a source node to be forwarded by routers to the base station in an 87 Collision Free Communication for Energy Saving in Wireless Sensor Networks Figure 15. Average energy consumed per node (increasing mobility) [26] interleaving manner. The slot numbering starts with number 2 because slot number 1 is reserved for management of network dynamics; hence the name (FTS: Fault Tolerant Slot). During this short FTS period, all nodes in the network are in the listen mode. The FTS is a large slot in which access is based on a CSMA mechanism. The main objective of the FTS period is to handle the mobility of the nodes and topology changes (orphan nodes or new nodes use this slot to ask for communication slots). Each node in the network has three modes; Transmission mode, reception mode and the sleep mode. Nodes switch to the transmission mode for scheduled Transmit Slot List (TSL), and receive mode for their scheduled Receive Slot List (RSL). Apart of these three specific slots, each node uses two other slots. The first one is used for local time synchronization and local repair and is called Multi-Function Slot (MFS). The second slot is called the Conflict Slot List (CSL) and is used to record slots that are used by a node s first-level and second-level neighbors. A node selects a slot only if it does not belongs to its RSL, TSL, and CSL. Once the slot is selected, the node propagates it to its first-level neighbors. Each of these nodes propagates the selected slot to its direct neighbors (second-level neighbors). This approach avoids the multiple slot selection by different nodes, thus FlexiMAC guarantees a collision-free traffic. The main issue of FlexiMAC is time synchronization. To solve this problem the protocol performs time synchronization locally, thus each node broadcasts its clock and the current global highest slot number known to that node to its children. Furthermore, robustness and optimality of the tree structure represent the main drawback of this protocol. In fact, when a link fails, a tree reconstruction even localized is necessary. Finally, the first phase where data gathering tree and nodes'schedules are built, consumes a large amount of energy.

MAC protocols in real-time wireless sensor networks
In real-time systems, correctness of the computations depends on their logical correctness and on the time at which the result is produced. Real-time applications become a very Protocol Name Scheme Used Advantages Disadvantages MS-MAC [25] it varies the sleeping time dynamically according to the velocity of the mobile node performs better than S-MAC [3], has adaptive sleep period and overcomes the problem of mobility of nodes from one cluster to another cannot ensure reliable communication between stationary nodes and mobile nodes MMAC [26] dynamically adapts to changes in mobility patterns by introducing a mobility-adaptive frame time handles weak and strong mobility requires the knowledge of node position Flexi MAC [27] defines a contention period in which nodes exchange packets to build a data-gathering tree rooted at the sink able to cope with some network dynamics and node mobility robustness and optimality of the tree structure represent the main drawback Table 4. Summary of MAC protocols in mobile WSNs important field of research as it covers an important domain of application including ABS, aircraft control, ticket reservation system at airport, over-temperature monitor in nuclear power station, mobile phone, etc. For many WSN applications like medical care and fire monitoring, real-time constraints must be considered as an important factor.
Real-time in WSNs can be divided into soft real-time (SRT) where just a portion of messages can arrive late, and hard real-time (HRT) where every message must arrive before its deadline and any deadline miss is considered as a failure of the system. As discussed in the previous sections there are three main categories of MAC protocols in WSNs, but till now we didn't discuss how much they can be adapted to the real-time application requirements in WSNs.
The schedule based protocols are not well adapted to real-time applications, because they are not good for event driven reporting, even if it is easier to define delay deadline at MAC layer with deterministic scheduling protocols. In general, compared to the contention based protocols, the delay is higher in TDMA based approaches. However, most of the discussed contention based protocols in the previous sections are not suitable for real-time applications. S-MAC [3] is a reference of contention based protocols, however it cannot be used for real-time application because a given node in the network has the possibility to win consecutively the contention many times while other nodes in the network are awaiting for the contention, consequently they risk a message delay and probably they miss their deadlines. Similarly to S-MAC, T-MAC proposed [5] is not suitable for real-time applications as well. because the first packet sent may reach the sink node with a very high delay.
During the last years, some researchers focused on developing protocols for real-time WSNs based on S-MAC. In the following, we will discuss some of these protocols and we summarize them in Table 5 at the end of this section.
1. Virtual TDMA for Sensors (VTS) [28]: this protocol is designed for soft real-time WSN applications and it is based on S-MAC [3]. However, unlike S-MAC, only one node can transmit in every listen/sleep cycle as shown in Figure 16, thus at each TDMA slot (a frame in S-MAC), a given packet travels strictly one hop. The number of slots is equal to the number of nodes in a cell (cluster) and the nodes in a cluster will transmit in different time slots. VTS uses a special packet called control (CTL) packet for synchronization, Figure 16. Structure of VTS TDMA frame [28] schedule discovery, keep-alive beacon, new node discovery and channel reservation. The first phase of the protocol aims to setup the network exactly as the S-MAC synchronization mechanism. In the end of this phase, a virtual superframe of N c timeslots is formed when all the nodes have sent their first CTL packet. To overcome the problem of topology change when some nodes join or leave the network, the nodes adjust the length of the superframe. At the beginning of each time slot, all the nodes wake up and listen. The owner of the timeslot performs a carrier sense and broadcasts the CTL. To transmit data, VTS uses CSMA/CA mechanism, and there are three kind of transmission: unicast packet transmission, broadcast packet transmission and no data transmission. In unicast packet transmission, the owner of the time slot sends a CTL RTS and the other nodes go to the sleep state. When the sequence of DATA/ACK are received, the transmission is finished and both nodes go to sleep mode. In broadcast packet transmission, the owner of the time slot sends a CTL BCAST . Unlike unicast packet transmission, the node keeps listening because the destination is a broadcast address. Without waiting for any CTS reply, a sender can send the broadcast packet. After receiving the packet, nodes go to sleep without sending an ACK. In no data transmission, a CTL BCAST is sent. Nodes adjust the clock reference, clear sender inactivity counter and go to sleep. With respect to S-MAC [3], VTS decreases energy consumption and the latency of packet transmission only when there are a few nodes, but the energy consumption increases when the number of nodes becomes important.
2. Novel real-time MAC layer protocol [29]: this protocol is also based on S-MAC [3] and it is designed for soft real-time applications in WSNs. The novel real-time MAC protocol is intended for single stream communication. It means that there is only one source and one sink during the lifetime of a communication stream in a randomly deployed WSN. Similarly to VTS [28], the novel real-time MAC layer protocol uses a control packet called Clear Channel (CC) to assign an appropriate value to the Clear Channel Flag (CCF) of every sensor node.
The node that has a CCF value equal to '1' (the initialized value of all nodes) can transmit as well as receive data packets, while it can only receive if its CCF value is '0'. CC control packet has a Clear Channel Counter (CCC) from '0' to '3'. This value decreases by one with one hop transmission of CC, thus it is equal to '3' at the originating node. Furthermore, when the control packet CC has a value equal to '2' or '3' in a node, then CCF of that node will remain '0', otherwise CCF of that node will become '1', which means that it can now initiate a data packet transmission. The novel real-time MAC layer protocol reduces the latency with respect to S-MAC. However, the overhead is higher due to CC control packet. In addition, the novel protocol is not suitable to multi-streams communication.
3. Low-power real-time protocol (LPRT) [30]: is a hybrid solution designed for soft real-time applications in WSNs. The network is considered as a star topology where all the sensors communicate with the base station (the coordinator). In this case, the only way to extend the network range is to add other base stations. Figure 17 shows the superframe of LPRT where the communication starts from the base station and the frame is divided into several mini-slots (the number of mini-slots is known in advance). The beacon frame noted B in Figure 17 is followed by a contention Figure 17. Superframe structure for the LPRT protocol [30] period (CP) where any station can transmit its packets using CSMA/CA. The contention free period (CFP) is placed after the CP period and it is divided into two parts: an optional retransmission period (RP) and a normal transmission period (NTP). During the CFP period, it is possible to transmit non-real-time asynchronous traffic if it cannot be completed before the beginning of the CFP. The transmission during CFP is scheduled by the base station based on a resource grant (RG) field of the beacon frame . The structure of the beacon frame is shown in Figure 18. The superframe duration field gives the duration of the current superframe in multiples of a minimum superframe duration time. The RG list field starts with an RG list length RGLL which specifies the quantity of allowed resource grant (RG). Each resource grant in the RG list field is expressed by a transmission direction (TD) bit to identify either the transmission is an uplink or a downlink to/from a device identified by the association ID (AID) field and the initial transmission slot (ITS) field used to indicate the end of the RG and the begin of the next RG in the RG list. The ACK list is composed by an ACK length (AL) field and an ACK bitmap field containing one bit for each uplink RG of the previous superframe. A successful transmission is indicated by a 1 in the respective bitmap position, while a lost or corrupted transmission is indicated by a 0.
The main drawback of this protocol is the difficulty to handle a large multi-hop wireless sensor network and other network topologies.

SPEED-MAC [31]
: the Speedy and Energy Efficient Data Delivery MAC Protocol aims to minimize the message delivery latency and the energy consumption during the Figure 18. Structure of the beacon frame payload [30] idle period. To meet these goals, SPEED-MAC divides the cycle time into an event announcement period (called also the signalling wakeup period), and a data transmission period as shown in Figure 19. During the first period, SPEED-MAC sends a control signal called a SIGNAL packet before sending any data packet to notify the occurrence of an event. This technique is used to detect a collision for multi-source events and also to schedule the wakeup during the data transmission period. In addition, SPEED-MAC uses different wakeup strategies for single-source events and multi-source events. One of these strategies is called Adaptative Wakeup for demand-driven data transmission, thus if there is no traffic, nodes wake up at only event announcement periods, otherwise they additionally wake up for data transmission periods. The SIGNAL packet contains the sender address Figure 19. Cycle time breakdown in SPEED-MAC [31] and a single bit for collision detection. On wakeup, a node receives the SIGNAL packet only if the sender is one of its children. For this purpose, each node needs to maintain its children list during the network initialization phase. The collision bit is used not only for collision detection but to determine the nature of the event as well (single-source event or multi-source event). All the senders overhear the signal transmission from their parents to check whether the data transmission period is for a single-source event or for a multi-source event.
During the Data transmission period, the packet consists of DATA and several flags. For a single-source event, the period consists of DATA and ACK, otherwise, if the event is a multi-source one, then the period consists of RTS/CTS/DATA/ACK with CSMA/CA. Therefore, SPEED-MAC uses contention-based data transmission for multi-source events and fixed scheduled transmission for single-source events. The total number of signal slots (data slots) in the event announcement period is determined by the depth of the routing tree. Note that the number of data slots is the same as the total number of signal slots (see Figure 19). Figure 20 (a) shows that SPEED-MAC has much lower energy consumption than SMAC and DMAC. We can also see in Figure 20 (b) that SPEED-MAC outperforms the other protocols even when the total number of source nodes increase because the protocol reduces the idle listening overhead and removes unnecessary wakeups. 5. TOMAC [32]: the real-Time message Ordering in wireless sensor networks using the MAC layer (TOMAC) of [32] is a hard real-time layer protocol for WSNs. To access the channel, the protocol uses the measure of elapsed waiting time of a message as an input parameter. Therefore, the node having older information to send get the highest priority, thus, it access the channel first. This mechanism guarantees that events are transmitted in the order of their occurrence in the real world. This message ordering is designed for one-hop distance mesh topology. TOMAC assigns a priority to each produced message. On the MAC layer, the generated packet gets the minimum priority value that keeps increasing with a given gradient e.g d ri dt = 1 µ s while the packet is not transmitted (due to a sleep time in a low duty cycle protocol or due to a busy channel) or the maximum priority value ri max is reached (ri is the priority of message i). Figure 21 shows how the message priority increases for the waiting packet of nodes A,B, and C. It is possible to assign a priority value ri before proceeding the Figure 21. Increasing priorities for waiting packets [32] message to the MAC layer. This exception may happen when the notification of sensor events should be transported to a destination in a time-ordered manner. For WSNs, the time resolution is an important aspect, thus the gradient of priority must be relatively high. Therefore, if the maximum possible value of a priority r max is very high, a very high number of priority steps have to be distinguished. The following function is used to determine r max : ∆ t describes the maximum total possible delay until the transmission of a waiting packet. To handle a high number of priority steps (> 10 6 ) like in low duty cycle TDMA protocols, TOMAC uses a non-destructive bit wise arbitration (NDBA). NDBA is implemented in the MAC layer of the Controller Area Network (CAN-bus) [33]. Each message is assigned an ID number, thus the message having the lowest ID accesses the channel. The bits of the message-ID are interpreted as dominant (0) and recessive (1) and are sent into the medium by the attached nodes. If a recessive bit is sent by a sensor node, this one loses the channel access. In a WSN context, the ID is replaced by the binary complement of the priority, then NDBA is used to solve concurrent access for the node with highest priority.

Wireless Sensor Networks -Technology and Applications
Protocol Name Scheme Used Advantages Disadvantages Virtual TDMA for sensors [28] a node can transmit in every listen/sleep cycle for WSNs with few nodes, this protocol decreases energy consumption and the latency of packet transmission the energy consumption increases when the number of nodes becomes important.
Novel real-time MAC layer protocol [29] it uses a control packet called Clear Channel (CC) to assign an appropriate value to Clear Channel Flag (CCF) of every sensor node reduces the latency with respect to S-MAC [3] the overhead is higher due to CC control packet Low-power real-time protocol [30] all the sensors communicate with the base station and a communication starts from the base station. The frame is divided into several mini-slots.
it provides low latency and it is flexible it can not handle a large multi-hop wireless sensor network and other network topologies Speed MAC [31] divides the cycle time into an event announcement period, and a data transmission period minimizes the message delivery latency and the energy consumption and also distinguishes single-source events from multi-source events no guarantee is given as the congestion can not be predicted. Packet loss. Overflow deadline is always possible.
TOMAC [32] to access the channel the protocol uses the measure of elapsed waiting time of a message as an input parameter is a hard real time protocol the protocol is designed only for one-hop distance mesh topology.

Conclusions
Throughout this document, we analyze the main MAC protocols designed for wireless sensor networks. We considered the technique being used and the problem that the protocols try to solve. Up to now, there is no MAC protocol considered as a standard, because MAC protocols are generally application specific.
The first category of MAC protocols treated in this survey is the contention based protocols, which suffer from packet collision. However they guarantee low latency and high throughput.
Unlike contention based protocols, the scheduled protocols have no problems with collision, but the synchronization is critical and these kind of protocols are not adapted to topology change. Some hybrid solutions are presented in this survey, above solutions are combined to achieve high performance under variable traffic patterns.
The second part of this document presents some MAC solutions where mobile nodes are implemented in the network. Finally many solutions are designed to deal with real time applications in WSNs.
In summary WSN MAC protocols are application dependent and focus on energy consumption and transmission latency, thus there is no protocols that consider all of the requirements of sensor networks.

Author details
Besem