## 4 Resource Allocation for Downlink and Uplink
### Downlink  
In this section, ACO-OFDM, which is the resource allocation scheme used in the downlink section, is discussed. The LEDs installed on the ceiling are given a unique identification (ID) number (LEDID). Since OFDM is used, each LEDID is divided into subcarriers, which are further divided into different resource blocks (RBs). The users can send their data on the RBs allocated to them. Every RB within a specific LEDID is unique; however, the same RB can be used by different LEDIDs. This can result in co-channel interference. The signal-to-interference ratio (SNIR) of a user who has been allocated an RB of an LEDID can be expressed as follows:  
\[\gamma_{u,LEDID}^{RB}=\frac{R_{PD}H_{u,\ LEDID}^{RBS}P_{u,LEDID}^{RBS}}{\sum_{u =1,LEDID}^{U}H_{u,LEDID}P_{u,LEDID}^{RB}+noise} \tag{7}\]  
where \(R_{PD}\) is the responsivity of the PD, \(H_{u,\ LEDID}\) is the channel gain between the user \(u\) and the LEDID, \(P_{u,LEDID}^{RB}\) is the transmission power of the LEDID for a given RB, and \(noise\) is the cumulative noise power. The cumulative noise power is given by:  
\[noise=2 qR_{PD}I_{amb}B_{noise}+\frac{4 kTB}{R_{L}} \tag{8}\]  
Figure 3: Block diagram of the uplink section. LED: light emitting diode; and OOK: on-off keying.  
where \(q=1.6\times 10^{-19}\) C, \(I_{amb}\) is the ambient light intensity, \(B_{noise}\) is the noise bandwidth, \(k\) is Boltzmann's constant, \(T\) is the absolute temperature, and \(R_{L}\) is the amplifier gain.  
The utility function is constructed based on the user and what type of transmission is required. Since there are two types of users present in this system, the quality of service (QoS) differs based on the type of device trying to access the system. The utility function should primarily reduce the transmission power required and cater to the needs of the user or smart device. Secondarily, it should try to extend the battery life of the associated mobile device(s), provide high data rates, and reduce interference in the multi-user environment. Each user or device has their own independent utility function based on their QoS requirements and the value of the aforementioned parameters. The utility function that accounts for the above parameters is given by:  
\[U_{u,LEDID}^{RB}=\frac{W\cdot f_{u}\Big{(}\gamma_{u,LEDID}^{RB}\Big{)}}{N_{t} \cdot P_{u,LEDID}^{RB}} \tag{9}\]  
where \(N_{t}\) is the number of users served by the LED, \(W\) is the bandwidth available, and \(f_{u}(\cdot)\) is the efficiency function. The efficiency function represents the probability of a successful packet transmission.  
The proposed algorithm is called non-cooperative resource allocation (NRA) and is defined in Table 1. It is decentralized and determines the user or device LEDID selection and resource allocation in a distributed manner. It is iterative and has a low complexity. It consists of two parts. The first part is the selection of the LEDID. This is based on the maximum gain selection (MGS) policy. The second part is the resource allocation where the RBs are allocated depending on their QoS requirements. The second part is iterative and it will keep repeating the algorithm until it converges to a unique solution. The user is assumed to have perfect knowledge of the channel matrix \(H(u,LEDID)\), i.e., the channel between the user/device and the LED.