## 2 System Model and Analysis
### BSCI Algorithm  
Assuming that \(N=\big{\{}N\in\mathbb{N}^{+}\big{|}\underline{N}\leq N\leq\overline{N}\big{\}}\) (\(\mathbb{N}^{+}\) is the set of positive integers). Equations (42c) to (42f) can be used to obtain the range of \(N\). When \(R(N)\geq R_{min}\), we have  
\[\frac{1}{2}B\ \log_{2}\Bigg{(}1+\delta\Bigg{(}\sum_{n=1}^{N}H_{n}\Bigg{)}^{2} \Bigg{)}\geq R_{min}. \tag{43}\]  
It holds  
\[NH_{1}\geq\sum_{n=1}^{N}H_{n}\geq\sqrt{\frac{\left(2^{\frac{2R_{min}}{B}}-1 \right)}{\delta}},\]  
and  
\[N\geq\sqrt{\frac{\left(2^{\frac{2R_{min}}{B}}-1\right)}{\delta H_{1}^{2}}}. \tag{44}\]  
When \(\delta\Big{(}\sum_{n=1}^{N}H_{n}\Big{)}^{2}\geq 1\), it holds  
\[NH_{1}\geq\sum_{n=1}^{N}H_{n}\geq\frac{1}{\sqrt{\delta}},\]  
and  
\[N\geq\frac{1}{H_{1}\sqrt{\delta}}. \tag{45}\]  
when \(BER\leq BER_{t}\), according to (15), we set \(BER_{t}\)= \(Q\big{(}\sqrt{\gamma_{t}}\big{)}\). So,  
\[\frac{\eta^{2}P_{i}\Big{(}\sum_{n=1}^{N}H_{n}\Big{)}^{2}}{\sigma^{2}}\geq\gamma _{t}, \tag{46}\]it holds \[NH_{1}\geq\sum_{n=1}^{N}H_{n}\geq\sigma\sqrt{\gamma_{t}}/_{q}\sqrt{\gamma_{t}},\] and \[N\geq\frac{\sigma\sqrt{\gamma_{t}}}{\eta H_{1}\sqrt{P_{i}}}.\] (47) According to the above conditions, we have \[\underline{N}=\left\{\underline{N}\in\mathbb{N}^{+}\Bigg{|}\underline{N}\geq max \left\{\sqrt{\frac{\left(2^{\frac{2R_{min}}{B}}-1\right)}{\delta H_{1}^{2}}}, \frac{1}{H_{1}\sqrt{\delta}},\frac{\sigma\sqrt{\gamma_{t}}}{\eta H_{1}\sqrt{P_ {i}}}\right\}\Bigg{\}}.\] (48) According to the constraints of Equation (42e), we have \[\overline{N}=\left\{\overline{N}\in\mathbb{N}^{+}\Big{|}\overline{N}\leq min \left\{N_{max},\frac{1}{\eta H_{1}}\right\}\right\}.\] (49) Under the constraints, \(EE(N)\) is divided into three cases to find the maximum value: 1. If \(EE(\underline{N})\geq EE(\underline{N}+1)\geq EE(\underline{N}+2)\), \(EE(N)\) decreases monotonically with \(\textbf{N}\). \(EE(\underline{N})\) is the maximum value of \(EE(N)\) and the optimal value of \(\textbf{N}\) is \(\underline{N}\): 2. If \(EE(\overline{N})\geq EE(\overline{N}-1)\geq EE(\overline{N}-2)\), \(EE(N)\) increases monotonically with \(\textbf{N}\). The peak value of EE does not appear within this range and the optimal value of \(\textbf{N}\) does not exist; 3. If it is not the case of (1) and (2), \(EE(N)\) increases first and then decreases with \(\textbf{N}\). To reduce the amount of computation, the binary search (Algorithm 1) method is used to find the maximum value of \(EE(N)\) as follows. **Step 1:** set the iterative range. The starting point is \(u=\underline{N}\) and the ending point is \(v=\overline{N}\). **Step 2:** set \(b=\frac{(u+v)}{2}\). If \(b\) is not an integer, the largest integer less than \(b\) is used to conclusion. **Step 3:** if \(EE(b)\geq EE(b+1)\), \(v=b\). Otherwise, \(u=b\). **Step 4:** repeat steps 2-3 until \((v-u)\leq 1\). Return \(EE(v)\) which is the maximum value of \(EE(N)\) and \(v\) which is the optimal value of \(\textbf{N}\). ```
Given \(\underline{N}\), \(\bar{N}\), \(P_{m}\), \(P_{else}\), and \(\delta\) Calculate \(R(N)\) in the range of \(N=\left\{N\in\mathbb{N}^{+}|\underline{N}\leq N\leq\overline{N}\right\}\) using the Formula (19) set \(u=\underline{N}\) and \(v=\overline{N}\) while \(((v-u)>1)\)\(b=floor\left(\frac{(u+v)}{2}\right)\) if \(EE(b)\geq EE(b+1)\)\(v=b\) else \(u=b\) end Return \(EE(v),v\)
```  
**Algorithm 1**The Binary Search Method  
Based on the above analysis, the BSCI algorithm (Algorithm 2) is proposed to find the \(N_{opt}\), which is the optimal value of \(N\), and \(EE_{max}(N)\) which is the maximum value of \(EE(N)\). The specific steps are as follows. **Step 1:** input the parameters of LED, PD, and IRS. **Step 2:** calculate the iterative range \(N=\left\{N\in\mathbb{N}^{+}|\underline{N}\leq N\leq\overline{N}\right\}\) according to Formulas (48) and (49). **Step 3:** calculate \(R(N)\) with the iterative range of \(N\) according to Formula (19). **Step 4:** conditional iteration.