## 4 System Model  
In this study, we explore the principle of the D2D communication scheme underlaying cellular networks, which involves spectrum sharing across multiple D2D users. For every D2D pair, we analyze three different modes, which include DM, RM, and LM, as illustrated in Figure 1. The DM enables direct transmission of data from the transmitter to the receiver of each D2D pair. Moreover, the second D2D mode is RM which aims to establish relay communication between two distant devices. An idle user is used as a relay node in this mode to facilitate the creation of a connection between the transmitter and receiver of the D2D pairs. Regarding the LM, it is suggested that auxiliary antennas be installed on the gNB to enhance the connections of the LM [31]. The data are transferred via the gNB instead of entering the core, which means that the gNB acts as a node to support the connections of faraway users to establish a D2D pair. In this study, we examine an environment where \(N\) represents the D2D pairs' number. Furthermore, \(T_{n}\), \(R_{n}\), and \(RUI_{n}\) represent the D2D transmitter, receiver, and relay of the pair \(n\), respectively. Let us suppose W is the total bandwidth in the network which is partitioned to a number of sub-channels indicated as \(K\). Table 1 illustrates the scheme symbols. \begin{table}
\begin{tabular}{c l} \hline \hline
**Symbol** & **Description** \\ \hline \(N\) & D2D pairs’ number \\ \(M\) & CUs number \\ \(T_{n}\) & D2D transmitter \\ \(R_{n}\) & D2D receiver \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Scheme symbols. Figure 1: System model. Let \(P_{n}=\{p_{1},p_{2},\ldots,p_{n},\ldots,p_{N}\}\), \(P_{C}\), \(P_{Z}\) denote the transmission power of the \(T_{n}\), \(CU\), gNB, respectively. The transmitted power for every D2D pair \(P_{n}\) is determined from the available power levels set, ranging from \(p_{min}\) to \(p_{max}\), while the transmission power of CUs is supposed to be fixed. In the proposed scheme, \(\Pi\) is the binary mode sub-channel assignment indicator matrix with \(\Pi\in\{0,1\}\), where \(\Pi_{n,k}^{1}\), \(\Pi_{n,k}^{2}\), and \(\Pi_{n,k}^{3}\) represent the binary mode sub-channel assignment indicators for DM, RM, and LM, respectively. If the \(nth\) D2D pair is utilizing the sub-channel \(k\) of the CU \(m\), then \(\Pi=1\), otherwise, \(\Pi=0\). The SINR of the \(nth\) D2D pair utilizing \(kth\) shared sub-channel of the \(mth\) CU at time slot \(t\) is given as follows:  
\[ \begin{split}\mathrm{Y}_{n,k}(t)=\frac{P_{n}G_{TR}(t)\Pi_{n,k}^{1} +(P_{n}G_{TRU}(t)+P_{n}(t)G_{RUR}(t))\Pi_{n,k}^{2}+(P_{n}G_{TZ}(t)+P_{Z}G_{ZR}( t))\Pi_{n,k}^{3}}{\mathcal{J}_{D2D}+P_{C}(t)G_{mn}+\sigma}\end{split}  \tag{1}\]  
where \(G_{TR}\), \(G_{TRU}\), \(G_{TZ}\), represent the channel gain between \(T_{n}\) to \(R_{n}\), \(RU_{n}\), and gNB, respectively. \(G_{RUR}\) and \(G_{ZR}\) refer to the channel gain between \(RU_{n}\) and gNB to \(R_{n}\). Furthermore, \(G_{mn}\) refers to the channel gain of the D2D pair \(nth\) and the \(mth\) CU. \(\sigma\) denotes the noise power. The expression \(\mathcal{J}_{D2D}\) can be illustrated as follows:  
\[\mathcal{J}_{D2D}=\mathcal{J}_{D}+\mathcal{J}_{R}+\mathcal{J}_{L}, \tag{2}\]