# Enhanced Integrated Satellite-Terrestrial NOMA with Cooperative Device-to-Device Communication
## 3 Satellite-Aided NOMA with Cooperative D2D Communication
### SANOCO-D2D Operation  
At the start of each transmission phase, UE\({}_{i}\) reports its CSI to the satellite that estimates the channel coefficient \(\left|h_{i}^{s}\right|^{2}\) and calculates the channel gain \(\Gamma_{i}\) using (5). Moreover, the channel gain for the D2D link \(\Lambda_{i,j}\) is calculated between each UE\({}_{i}\), UE\({}_{j}\) pair, using the reported channel coefficient \(\left|h_{i,j}^{d}\right|^{2}\) via (9). Next, the satellite applies NOMA based on user pairing and calculates the power allocation factors for each pair by solving the following maximization problem:  
\[ \begin{split}\underset{\alpha_{j}}{\text{max}}& R_{i}^{NOMA_{(i,j)}}+R_{j}^{NOMA_{(i,j)}},\\ \text{s.t.}& R_{i}^{NOMA_{(i,j)}}\geq R_{i}^{OMA},\\ & R_{j}^{NOMA_{(i,j)}}\geq R_{j}^{OMA},\\ & 0\leq\alpha_{j}\leq 1.\end{split}  \tag{11}\]  
Essentially, the solution to the maximization problem (11) is the optimal power allocation factor \(a_{j}\) for the strong user UE\({}_{j}\) that maximizes the sum rate and guarantees that the achievable rate of users through NOMA will not be less than the achievable rate of OMA. Since \(\Gamma_{i}\leq\Gamma_{j}\), the optimal power allocation factor \(\alpha_{j}\) of the strong user UE\({}_{j}\) is given as in [6]:  
\[\alpha_{j}=\frac{\sqrt{1+\Gamma_{i}P_{s}}-1}{\Gamma_{i}P_{s}}. \tag{12}\]  
It is important to note that the achievable rate of the weak satellite user \(R_{i}^{NOMA_{(i,j)}}\) under optimal power allocation is equal to the \(R_{i}^{OMA}\). Thus, the power allocation factor for the weak satellite user should satisfy the rate constraint for this user, while allocating all the remaining power to the strong satellite user to maximize the achievable sum rate. An important element of SANOCO-D2D is the possibility of D2D communication when the weak user is not able to decode its message through NOMA. In this case, the strong satellite user UE\({}_{j}\) is responsible for transmitting the received signal from the satellite to the weak satellite user UE\({}_{i}\). Due to the use of NOMA at the satellite, UE\({}_{j}\) decodes the signal of weak user UE\({}_{i}\) and acts as a relay to forward it to its destination. Therefore, the weak satellite user UE\({}_{i}\) will have two copies of its own signal and selects the best one in order to maximize its achievable rate. For the strong user, the achievable rate of the weak user's signal is equal to:  
\[R_{i}^{DECODED_{(i,j)}}=B_{c}^{NOMA}\log_{2}\left(1+\frac{(1-\alpha_{j})P_{\rm S }\Gamma_{j}}{\alpha_{j}P_{\rm S}\Gamma_{j}+1}\right)\,. \tag{13}\]  
The achievable rate of \(\text{UE}_{i}\) that will be served via D2D cooperation with \(\text{UE}_{j}\) is given by:  
\[R_{i}^{NOMA-D2D_{(i,j)}}=\min\left(R_{i}^{D2D_{(i,j)}},R_{i}^{DECODED_{(i,j)}} \right). \tag{14}\]  
The total sum rate of the \(\text{UE}_{i}\) and \(\text{UE}_{j}\) pair is calculated as:  
\[R_{i,j}=R_{j}^{NOMA_{(i,j)}}+\max\left(R_{i}^{OMA},R_{i}^{NOMA-D2D_{(i,j)}} \right), \tag{15}\]  
where \(\max\left(R_{i}^{OMA},R_{i}^{NOMA-D2D_{(i,j)}}\right)\) is the rate that the weak user \(\text{UE}_{i}\) is able to achieve using the proposed cooperative technique. **Remark 1**. : _It is noteworthy that in the worst case in which the D2D channel between the two users is not profitable, i.e., \(R_{i}^{D2D_{(i,j)}}\leq R_{i}^{OMA}\), the weak user will select to retrieve its data from the received satellite signal, maintaining the rate of each user and the total sum rate as in [6]. On the contrary, if \(R_{i}^{D2D_{(i,j)}}>R_{i}^{OMA}\), the weak user will retrieve its data from the received signal through the D2D link, achieving a higher rate than \(R_{i}^{OMA}\), significantly benefiting the total sum rate compared to the result in [6]._  
**Remark 2**. : _In cases where D2D communication is highly profitable, i.e., \(R_{i}^{D2D_{(i,j)}}\geq R_{i}^{DECODED_{(i,j)}}\), the weak user is able to achieve the maximum rate of \(R_{i}^{DECODED_{(i,j)}}\).