# Power Control and Channel Allocation Algorithm for Energy Harvesting D2D Communications
## 2 System Model  
As shown in Figure 1, we consider a single cell scenario, where a BS locates in the center of the cell and \(M\) cellular users coexist with \(N\) D2D pairs, we use \(CU=\{1,2,\ldots,i,\ldots,M\}\) and \(D=\{1,2,\ldots,j,\ldots,N\}\) to indicate the sets of cellular users and D2D users, each pair of D2D user includes one D2D transmitter and one D2D receiver. Each cellular user occupies one uplink orthogonal channel to communicate with the BS; D2D users reuse the channels assigned to the cellular users, and each channel can be occupied by more than one D2D users but one D2D user just can reuse one channel of cellular user. Therefore, interference exists in cellular user and D2D users, D2D users also impose interference to each other that sharing the same channel.  
Assuming that BS supplies power to D2D transmitters by means of wireless energy transmission, the D2D user completes the energy harvesting and information transmission during the time period \(T\). In the time period of \(\theta T\), the D2D transmitter harvests energy broadcast by the BS, and in the later \((1-\theta)T\) time period, the D2D transmitter employs the harvested energy to communicate with D2D receiver. The harvested energy at the D2D transmitter \(j\) is given by:  
\[E_{j}=\xi_{j}\theta_{j}TP_{BS}h_{Bj} \tag{1}\]  
where \(P_{BS}\) is the transmit power of BS, \(h_{Bj}\) is the channel gain between BS and D2D transmitter \(j\), \(\xi_{j}\in(0,1)\) denotes the energy harvesting efficiency of the D2D transmitter, which can be expressed as [14]:  
\[\xi_{j}=\xi_{m,j}\cdot\xi_{p,j}\cdot\xi_{o,j}\cdot\xi_{det,j} \tag{2}\]  
where \(\xi_{m,j}\) is matching efficiency, and it is related to the impedance of the rectifier antenna and the input impedance of the direct current (dc) converter. \(\xi_{p,j}\) is the efficiency associated with parasitic losses. \(\xi_{o,j}\) is the efficiency of conversion that is mainly related to the non-linear rectifier diode. \(\xi_{det,j}\) is the efficiency of dc power transfer from the non-linear device to the dc load.  
Figure 1: System model of device-to-device (D2D) communication underlaying cellular network.  
Suppose the number of D2D users share the channel of cellular user \(i\) is \(K\), thus, the signal to inference plus noise ratio (SINR) of cellular user \(i\) and D2D receiver \(j\) can be expressed as:  
\[SINR_{i}^{B}=\frac{p_{i}^{c}h_{iB}}{\sum\limits_{k=1}^{K}P_{k,j}^{d}h_{kB}+N_{0}} \tag{3}\]  
\[SINR_{j,i}^{d}=\frac{p_{j,i}^{d}h_{j}}{p_{i}^{c}h_{ij}+\sum\limits_{k\
eq j}P_{ k,j}^{d}h_{kj}+N_{0}} \tag{4}\]  
The capacity of D2D user \(j\) can be written as  
\[C_{j,i}^{d}=(1-\theta_{j,i})T\log(1+SINR_{j,i}^{d}) \tag{5}\]  
where \(P_{i}^{c}\) and \(P_{j,i}^{d}\) are the transmission power of the cellular user \(i\) and the D2D transmitter \(j\), \(h_{iB}\) is the channel gain between the cellular user \(i\) and the BS, \(h_{kB}\) is the channel gain between the D2D transmitter \(k\) and the BS, \(h_{j}\) is the channel gain between the D2D pair \(j\), \(h_{ij}\) is the channel gain between the cellular user \(i\) and D the 2D receiver \(j\) sharing the same channel, \(h_{kj}\) is the channel gain between the D2D transmitter \(k\) and the D2D receiver \(j\) reusing the same channel, \(N_{0}\) represents the spectral density of additive white Gaussian noise (AWGN) for the BS and the D2D receivers.