## 4 Proposed Scheme
### Cluster Size Calculation Based on Maximum IDRs and QoS Requirements  
Table 1 shows the upper bound of normalized IDR with respect to cluster bandwidth. This normalized IDR is also known as the spectrum utilization factor (SUF). The maximization of SUF is presented in Table 1 for all lower CG users. If we multiply the SUF with \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline \multicolumn{2}{c}{**IDR Theoretical Analysis in Bits per Second per Hertz for GP-Based Optimal Power**} \\ \multicolumn{2}{c}{**Allocation in Downlink RIS-NOMA Clusters**} \\ \hline
**Cluster Size** & **User 1** & **User 2** & **User 3** & **User 4** & **User 5** & **User 6** \\ \hline n = 3 & variable & 1.585 & 1.222 & - & - & - \\ \hline n = 4 & variable & 1.585 & 1.222 & 1.099 & - & - \\ \hline n = 5 & variable & 1.585 & 1.222 & 1.099 & 1.047 & - \\ \hline n = 6 & variable & 1.585 & 1.222 & 1.099 & 1.047 & 1.023 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Normalized IDR theoretical analysis in bits per second per Hertz for GP-based power allocation inside the RIS-assisted NOMA Downlink cluster. bandwidth allocated to one NOMA cluster we find the IDR for user. This IDR must be greater than or equal to QoS requirements  
\[QoS_{min}\leq B\times SUF_{max} \tag{29}\]  
We can use (29) to determine the maximum cluster size for any application. The values of \(SUF_{max}\) are taken from Table 1 for different cluster members. For example, narrow band IoT (NB-IoT) devices' bandwidth and minimum data rate requirement is less, as described in [15; 21]. For downlink NB-IoT devices, \(B=180\) kHz and if \(QoS_{min}=215\) kbps for an application, then \(SUF_{max}\) values obtained ensure that we can take the cluster size as 2 or 3, only because when \(n\geq 4\), then (29) is not satisfied for the lowest CG user. Proposed Algorithm for Cluster Formation, RIS Allocation, Power Allocation and IDR Maximization in Downlink TDMA-RIS-NOMA System  
_Channel Saturation-Based Algorithm for RIS and Power Allocation for Maximizing IDR_  
In Algorithm 1, steps 1 and 2 define the input and output parameters, respectively. Steps 3 to 8 are used for cluster formation as shown in Figure 4. Here, the time slot scheduling of the user devices is done according to their QoS requirements. Steps 9 to 13 describe the meta-atom allocation (\(N_{il_{min}}\)) for channel saturation. Then power coefficients for maximum IDR are calculated using step 14. Finally, Step 16 terminates the algorithm, when resource allocation is complete for all the clusters. The advantages of the proposed algorithm are as follows:  
* Control over channel gain becomes very easy and straight forward because of the point-to-point communication model. * Clustering and decoding order may be changed instantly according to QoS requirements. * TDMA-RIS-NOMA point-to-point downlink environment is the ideal situation to exploit the maximum controllability over IDRs of a NOMA downlink cluster. * Upper bound of IDRs is achieved. ```
1:Inputs:\(M,n,N,\{q_{1},q_{2},\ldots,q_{M}\},h_{irl},g_{irl}\)
2:Outputs:\(N_{il_{min}},a_{il},R_{il_{max}}\)\(\forall\)\(i\in[1,n]\) and \(l\in[1,m]\)
3:Arrange all User Devices in descending order according to their QoS requirements: \(q_{1}>q_{2}>...>q_{M}\)
4:Decide cluster size with the help of (29). 5:Create clusters such that max and min QoS devices are included in the same group. 6:for\(l=1:1:m\)do
7:\(CLUSTER(l)=\{q_{1l},q_{2l},\ldots,q_{(n-1)l},q_{nl}\}=\)\(\{q_{(l)},q_{(l+m)},q_{(l+2m)},\ldots,\)\(q_{(M-l-2m)^{\prime}}q_{(M-l-m)},q_{(M-l+1)}\}\)
8:endfor
9:if\(\frac{P_{Til}}{P_{Til}|k_{q_{l}}|^{2}}\geq\frac{1}{2^{m}}andN_{ilmin}\leq N\)then
10:\(N_{il_{min}}=N_{il_{min}}+1\). 11:Allocate one more meta atom with max channel gain and calculate new effective channel gain \(h_{eq_{li}}\) from (2). 12:endif
13:To saturate the effective channel gain \(h_{eq_{li}}\), allocate all the meta-atoms (\(N\)) of a RIS to the user device to ensure \(\frac{P_{Til}}{P_{Til}|k_{eq_{li}}|^{2}}<\frac{1}{2^{m}}\) condition is achieved.