# Design and Analysis of a Low Latency Deterministic Network MAC for Wireless Sensor Networks
## 4 Proposed MAC for LLDN
### Proposed CSMA/CA Mechanism for Shared Slots  
The nodes in the network following the IEEE 802.15.4e CSMA/CA mechanism get equal chances to access the channel. For data transmission during dedicated slots \((SLOT_{D})\) in the LLDN superframe, the slot owner \((SLOT_{O})\) transmits data directly, whereas in the case of shared slots \((SLOT_{S})\), nodes compete to send data by following CSMA/CA mechanism. Let the time duration of one slot, performing CCA and data transmission be \(SLOT_{duration}\), \(T_{CCA}\) and \(T_{L}\), respectively. The nodes during the shared slots have to adopt the CSMA/CA procedure according to the recent standard. All nodes have to perform CCA two times to avoid collisions due to the transmission of acknowledgment. However, the acknowledgment for all nodes in the LLDN superframe is aggregated through one common GACK, and the use of two CCAs is not required. Hence, we suggest to modify the current channel access mechanism in order to reduce the energy consumption and latency by restricting the number of CCAs to one. As per the current IEEE 802.15.4e standard, the node with to-be-transmitted data initializes the variables CW, NB and BE: CW represents the contention window, which depends on the random backoff value; NB represents the number of times the node has been delayed before the current transmission and is initialized to zero for each new transmission; BE represents the backoff exponent whose value increases on each channel access failure. Before transmission, the node chooses a random number in the range of \([0,2^{BE-1}]\) as backoff time periods. When this backoff period reaches zero, the node in the shared slot performs CCAs twice and starts transmission if the channel is found idle during these CCAs. Due to the smaller slot size of the LLDN superframe, we propose here only one time random backoff before the channel access. As described in Algorithm 2, consider a node that tries to transmit data in a shared slot of the LLDN superframe. If the slot owner of the shared slot has no data to transmit, associated nodes can assess the slot through the CSMA/CA procedure. In our proposed mechanism, associated nodes have to delay for the duration of the random backoff period \((R_{backoff})\) in the range of \([0,W_{S}-1]\) units, where \(W_{S}\) is the size of the contention window for the shared slots. Let \(N_{S}\) be the number of nodes having data arrival rate \(\lambda\) associated with the shared slot. Hence, the expected number of active nodes could be \(\lambda N_{S}\). To avoid choosing the same random backoff value by the nodes, we consider \(W_{S}=\lambda N_{S}\). After the random backoff period is over, the tagged node accesses the channel in the case that the transmission is possible with the current remaining time of the shared slot. Otherwise, nodes have to store their remaining backoff time at the end of the shared slot and resume the same procedure in the next shared slot. If a channel is found idle during the CCA, a node can transmit data and waits for the ACK. The received corresponding ACK is considered as a successful transmission. However, if the node fails to receive the ACK due to collision or channel error and a retransmission slot (SLOTR) is available, it can retransmit the data. Otherwise, the packet will be discarded due to the retry failure. The retransmission slots are not assigned exclusively by the coordinator. The total numbers of retransmission slots available in the current superframe are broadcast in the beacon and the number of failed nodes through GACK by the coordinator. The node that fails first during the transmission can use the first retransmission slot. Our proposed model can reduce the number of CCAs to minimize the amount of control packet overhead. ```
0: Number of sensor \(N_{S}\) attached to the shared slot. 0: Transmission success/failure.