# Adaptive Polling Medium Access Control Protocol for Optic Wireless Networks
## 4 The Adaptive Polling Medium Access Control (APMAC) Protocol
### Association Phase  
In the APMAC protocol, the connection between VLNs and VLAP can be initiated by any of the two devices. When the VLAP initiates communication, it sends the DTF directly to the VLN; this is a point to point communication; therefore there is no collision. However, when the VLNs initiate communication, collision of ARFs from different VLNs at the receiver of the VLAP may occur. Initially, the VLAP broadcasts ADF to all VLNs falling within its angle of irradiance. ADF contains several parameters such as channel frequency, the physical address of the VLAP. The buffer size and destination physical address are optional parameters that are included in the ADF in case the VLAP has some data to transmit to a particular VLN. Otherwise, it is turned off during the ADF broadcasting. After receiving the ADF, VLNs within the angle of irradiance of the VLAP respond by transmitting the ARF to the VLAP wherein it requests access to use the shared channel for data transmission. Within the ARF, several parameters are included such as the physical address of the VLN and buffer size. Note that VLNs issue ARF at random time, therefore collision of ARF may occur. We define the control frame collision avoidance algorithm (CFCA) that mitigates collision of ARF during association phase as follows:  
* Let \(\eta\) represent the theoretical maximum number of VLAN per VLAP. * Let \(\alpha_{t}\) represent the mean maximum round trip time (RTT) between VLAP and VLN. * Let collision avoidance slot (CAS), that is the maximum contention time be denoted by  
Figure 4: The visible light nodes (VLN) finite state machine in the APMAC. Figure 3: The visible light access point (VLAP) finite state machine in the adaptive polling medium access control (APMAC). * At the beginning of the \(CAS\) slot, the VLAP broadcasts the ADF. * Upon receiving the ADF, VLNs that wish to associate with the VLAP select a random time \(z|\alpha_{t}<z<\eta\alpha_{t}|\). At time \(z\) if a VLN senses an idle channel, it sends ARF to VLAP then it waits for AGF. If no AGF arrives within \(z+2\alpha_{t}\) time unit, the VLN checks if \(z+2\alpha_{t}<\eta\alpha_{t}-\alpha_{t}\). * If \(z+2\alpha_{t}<\eta\alpha_{t}-\alpha_{t}\), the VLN selects another random time \(z_{i}|z+2\alpha_{t}<z_{i}<\eta\alpha_{t}-\alpha_{t}|\). At time \(z_{i}\), VLN sends ARF to the VLAP if the channel is idle, otherwise it checks again if the condition \(z+2\alpha_{t}<\eta\alpha_{t}-\alpha_{t}\) is satisfied then it selects another random time \(z_{i}\), otherwise it waits another ADF from the VLAP. * At \(\dfrac{\eta\alpha_{t}}{2}\), the VLAP checks if there is no any ARF that arrived from 0 to \(\dfrac{\eta\alpha_{t}}{2}\) then it resets its timer and broadcasts another ADF. This is done to improve system utilization by avoiding idle waiting because VLNs may not receive the ADF from the VLAP, hence no ARF will be transmitted thereby causing idle waiting. After broadcasting ADF, the VLAP creates the polling table that contains the physical addresses, buffer size and RTT of each VLN that issued ARF. The estimation of RTT is done by considering the time taken from broadcasting ADF until when the ARF is received at the VLAP. Following this, the VLAP transmits to each node the AGF. The AGF specifies several parameters such as the transmission slot, maximum transmission unit (MTU), and the direction of data transfer. i.e., transmission or reception. If the direction parameter implies transmission, then the VLN should transmit, otherwise it should receive. The mechanism used to determine the MTU in this study considers the dynamic future knowledge maximum transmission unit (DFK-MTU) algorithm studied in [27]. The DFK-MTU allows the VLAP to dynamically adjust the size of the MTU depending on the current content of the polling table. Moreover, for each particular instance of the polling table, the MTU is the average size; this enhances achieving optimal MTU. It is important to note that the process of MTU for each particular polling table instance serves as the upper bound.