# Joint Power Allocation and Link Selection for Multi-Carrier Buffer Aided Relay Network
## 4 Simulation and Results  
In this section, we validate the performance of our designed algorithms. We consider a BAR communication network with \(N=1024\) number of subcarriers where each one experiences flat fading. Further, multi-path Rayleigh distributed model-based channels are considered for all links. The throughput of the system is achieved as an average over fifty-time slots of equal length i.e., \(T=50\). Next, we assume that MU is 1 kilometer (Km) apart from the BS. We adopt modified Hata urban propagation model [30] to calculate the path loss (P.L. ), such that  
\[P.L.= \begin{cases}38\text{log}(d)+122,&\text{if }d\geq 0.05\text{ km},\\ \\ 38\text{log}(0.05)+122,&\text{otherwise},\end{cases}  \tag{15}\]  
where the distance (i.e., measured in kilometers) between \(BS\) and \(R_{b}\) is indicated by \(d\). The comparison of the following four algorithms is provided in this section:  
* BARNS1: this refers to the scheme proposed in Algorithm 1. * JntS1S2: this corresponds to the solution obtained in Algorithm 2. * BARNS3: similar to [31], a suboptimal link selection scheme where for the case \(\sum_{i=1}^{N}\sum_{t=1}^{T}R_{i,t}^{2*}>\overline{A}\), we put some \(\alpha_{t}=1\) at the time slots \(t^{*}\) such that \(t^{*}=\arg\min\ \sum_{i=1}^{N}R_{i,t}^{2}\). The process will continue until the sum rate of relay to destination link becomes less than or equal to \(\overline{A}\). * NBARS: this shows the non-buffer aided conventional DF relay scheme. The problem can be written as: \[\max_{P_{i,t}^{BS},P_{i,t}^{R_{b}}} \lim_{T\to\infty}\frac{1}{2T}\sum_{t=1}^{T}\sum_{i=1}^{N}R_{i,t}^{2}\] s.t. \[\frac{1}{2}\sum_{i=1}^{N}R_{i,t}^{1}\geq\frac{1}{2}\sum_{i=1}^{N} R_{i,t}^{2}\ \forall\ t\] \[\sum_{i=1}^{N}P_{i,t}^{BS}\leq P_{T}^{BS},\quad\forall t,\] \[\sum_{i=1}^{N}P_{i,t}^{R_{b}}\leq P_{T}^{R_{b}},\quad\forall t,\] \[P_{i,t}^{BS}\geq 0,\quad P_{i,t}^{R_{b}}\geq 0,\quad\forall i,t.\]Solving this problem using similar steps as in Section 3. We get the optimal values to be:  
\[P_{i,t}^{Rb*} = \left(\frac{1}{2T\eta_{t}}-\frac{\mu_{t}}{2\eta_{t}}-\frac{\sigma_{ Rbi,t}^{2}}{|h_{i,t}|^{2}}\right)^{+},\] \[P_{i,t}^{BS*} = \left(\frac{\mu_{t}}{2\tau_{t}}-\frac{\sigma_{BSi,t}^{2}}{|g_{i,t }|^{2}}\right)^{+},\]  
where \(\mu_{t}\), \(\tau_{t}\) and \(\eta_{t}\) are the Lagrangian multipliers associated with the first, second and third constraint of the problem, respectively. The complexity of BARNS1 is given by \(O(3I+C_{P})\), where \(I\) is the number of iterations required in Algorithm 1 and \(C_{P}\) is the complexity of finding the power allocations. In the case of JntS1S2 the complexity of finding the solution increases to \(O(3I+4J+C_{P})\), where the iterations required by step 9 of Algorithm 2 are denoted as \(J\). In the case of BARNS3 and NBARS, the complex part is of finding the power allocations at the source and relay nodes. Thus, the complexity of these algorithms is given by \(O(C_{P})\). This shows that the JntS1S2 is most complex out of all the schemes. The complexity of BARNS3 and NBARS is the least because of the sub-optimality and system limitation, respectively. Figure 2 shows how the end-to-end data rate (\(\text{bps}/\text{Hz}\)) changes by changing the total available power at source and relay nodes. We have compared three different scenarios i.e., fixed value of \(P_{T}^{BS}\) for increasing \(P_{T}^{R_{b}}\), fixed \(P_{T}^{R_{b}}\) for increasing \(P_{T}^{BS}\) and the simultaneous increase in the values of \(P_{T}^{BS}\) and \(P_{T}^{R_{b}}\), in a single plot by keeping \(d=0.5\) Km (i.e., the \(R_{b}\) is at the center of source and destination nodes). For a better understanding, we only display the performance of JntS1S2 and the NBARS in this case. It can be seen that the results are almost the same by either fixing \(P_{T}^{BS}\) for the increasing \(P_{T}^{R_{b}}\) or vice versa. It can also be noted that JntS1S2 scheme beats in all scenarios and the performance gap between both the JntS1S2 and NBARS remain constant at all data points.