# Wireless Energy Harvesting with Cooperative Relaying under the Best Relay Selection Scheme
## 4 Performance Analysis
### Energy Consumption (EC) for EH Relaying  
The relay that has minimum EC will be selected as the best relay, so the total energy consumption will be the energy from the direct path and the energy of the \(i\)-th relay. On the other hand, a threshold SNR \(\Gamma^{th}\) will be defined to ensure that the rate is above a specific rate with function \(\Gamma^{th}\). According to (5) with the help of (6), the total average SNR can be written as:  
\[\gamma_{T}=\frac{E_{s}\left|h_{sd}\right|^{2}}{d_{3}^{n}  
where \(E_{s}^{max}\) and \(E_{i}^{max}\) are the maximum energy at the source and the maximum energy at the selected relay respectively. It can be seen from (23) that \(\gamma_{T}\) is a monotonically increasing with two variables \(E_{s}\) and \(E_{i}\). Thus, the optimized solution of the problem is occurred when \(\gamma_{T}=\Gamma^{th}\). According to this, \(E_{i}\) can be written as a function of \(E_{s}\).  
\[E_{i}=\frac{\Gamma^{th}(E_{s}\overline{\rho}v_{i}+\overline{\rho}+v_{i})-v_{o} (E_{s}^{2}\overline{\rho}v_{i}+\overline{\rho}E_{s}+E_{s})}{\zeta_{i}(\overline {\rho}E_{s}v_{o}+E_{s}\overline{\rho}v_{i}+E_{s}v_{o}-\Gamma^{th}\overline{ \rho}-\Gamma^{th})} \tag{25}\]  
where  
\[\Gamma^{th}(\overline{\rho}-1)\
eq E_{s}(\overline{\rho}v_{o}+\overline{\rho} v_{i}+v_{0}).\]  
we can write \(E_{i}\) as  
\[E_{i}=\frac{-a_{1}E_{s}^{2}+a_{2}E_{s}+a_{3}}{a_{4}E_{s}-a_{5}} \tag{26}\]  
where  
\[a_{1}=v_{0}\overline{\rho}v_{i}\qquad\qquad\qquad, \tag{27a}\] \[a_{2}=(\Gamma^{th}\overline{\rho}v_{i}-\overline{\rho}v_{o}-v_{o})\quad,\] (27b) \[a_{3}=\Gamma^{th}(\overline{\rho}+v_{i})\qquad,\] (27c) \[a_{4}=\zeta_{i}(\overline{\rho}v_{o}+\overline{\rho}v_{i}+v_{o})\quad,\] (27d) \[a_{5}=\zeta_{i}\Gamma^{th}(\overline{\rho}-1)\qquad, \tag{27e}\]  
The total consumed energy can be written as:  
\[E_{T}=\frac{-a_{1}E_{s}^{2}+a_{2}E_{s}+a_{3}}{a_{4}E_{s}-a_{5}}+E_{s}, \tag{28}\]  
To find the optimized value of the total energy, the first derivative is applied. To check the convexity of the proposed model, the second derivative is applied as shown in the following equations.  
\[\frac{\partial E_{T}}{\partial E_{s}}=\frac{-a_{1}a_{4}E_{s}^{2}+2a_{5}a_{1}E_ {s}-a_{5}a_{2}-a_{3}a_{4}}{(a_{5}-a_{4}E_{s})^{2}}-1, \tag{29}\]  
\[\frac{\partial^{2}E_{T}}{\partial E_{s}^{2}}=\frac{2(a_{5}^{2}a_{1}+a_{5}a_{2} a_{4}+a_{3}a_{4}^{2})}{(a_{4}E_{s}-a_{5})^{3}}. \tag{30}\]  
Hence, solving the equation  
\[\frac{\partial E_{T}}{\partial E_{s}}=0, \tag{31}\]  
will yield two solutions for \(E_{s}\) and \(E_{i}\)  
To be \(E_{T}\) convex, the optimal solution is the positive term for (32) and (33)  
\[E_{s}=\frac{a_{5}}{a_{4}}\pm\frac{\sqrt{a_{5}^{2}(a_{1}^{2}+a_{1}a_{4})-a_{5}a _{2}(a_{1}a_{4}+a_{4}^{2})-a_{3}a_{4}(a_{1}a_{4}-a_{4}^{2})}}{a_{1}a_{4}+a_{4}^ {2}} \tag{32}\]  
If we let \(\Omega=\sqrt{a_{5}^{2}(a_{1}^{2}+a_{1}a_{4})-a_{5}a_{2}(a_{1}a_{4}+a_{4}^{2}) -a_{3}a_{4}(a_{1}a_{4}-a_{4}^{2})}\), then we can find \(E_{i}\) from (26)  
\[E_{i}=-\frac{a_{1}a_{5}(a_{4}-1)}{a_{4}^{2}}-\frac{a_{5}(a_{1}+a_{4})(a_{1}+a_ {2}a_{4})}{a_{4}^{2}\Omega}+\frac{\pm a_{1}\Omega}{a_{4}^{2}(a_{1}+a_{4})}+ \frac{a_{3}(a_{1}+a_{4})}{\pm\Omega} \tag{33}\]