In this section, in terms of analyzing the system performance, we are going to examine the proposed HTPS relaying protocol in mode A, and closed-form expressions for the successful transmission probability (STP), average energy efficiency (EE), and average spectral efficiency (SE) are derived. More importantly, we achieve the optimal values of TS and PS ratios.

### Energy harvesting and information transmission under the impact of HWIs

#### Mode A: multi-hop cognitive D2D wireless communication

In this section, we investigate the impact of HWIs based on the architecture of HTPS relaying protocol.

##### Phase 1

At first, the amount of energy harvested at R can be expressed as

$$ {E_{h}} = \eta {E_{D}}{\left| {X} \right|^{2}}P{L_{X}}\left({{\alpha_{1}} + {\alpha_{2}}\beta} \right)T, $$

(2)

where *η* is the energy conversion efficiency and *η*∈(0,1].

Hence, the transmit power of R can be computed by

$$ {E_{R}} = \frac{{{E_{h}}}}{{\left({1 - {\alpha_{1}} - {\alpha_{2}}} \right)T}} = \frac{{\eta \left({{\alpha_{1}} + {\alpha_{2}}\beta} \right){E_{D}}P{L_{X}}{{\left| {X} \right|}^{2}}}}{{1 - {\alpha_{1}} - {\alpha_{2}}}}. $$

(3)

The received information at R can be depicted as

$$ {y_{1}} = \sqrt {{\left({1 - \beta} \right){E_{D}}}} {h_{X}}{x_{1}} + {n_{0}} + {HI_{1}}, $$

(4)

where the normalized data signal from UE1 is *x*
_{1}, which satisfies \(\mathbb {E}\left \{ {{{\left | {{x_1}} \right |}^{2}}} \right \} = 1\).

Due to the wireless broadcast nature, the harvested power at R is split into two streams, *λ*
*E*
_{
R
} is utilized for forwarding signals to the primary node, UE2 while (1−*λ*)*E*
_{
R
} is for transferring signals to the secondary node, UE3. It is worth noting that we are going to consider both AF and DF transmission scheme.

Therefore, let us start with DF scheme, where the the transmitted signal at R, *x*
_{
R
} can be expressed by

$$ {x_{R}} = \left({\sqrt {\lambda {E_{R}}} {x_{2}} + \sqrt {\left({1 - \lambda} \right){E_{R}}} {x_{3}}} \right), $$

(5)

where *x*
_{2} and *x*
_{3} are the unit power of the transmitted information intended for UE2 and UE3, respectively, which satisfies \(\mathbb {E}\left \{ {{{\left | {{x_2}} \right |}^{2}}} \right \} = 1\), and \(\mathbb {E}\left \{ {{{\left | {{x_3}} \right |}^{2}}} \right \} = 1\).

Regarding the transmitted signal at R in AF scheme, *x*
_{
R
} can be expressed as

$$ {x_{R}} = G\sqrt {\lambda {E_{R}}} {y_{1}} + \sqrt {\left({1 - \lambda} \right){E_{R}}} {x_{3}}, $$

(6)

where the amplification factor at R [26] is calculated as

\(G = \sqrt {{{\left ({\left ({1 - \beta } \right){E_D}{{\left | {X} \right |}^{2}}P{L_X} + {\Omega _0} + {\kappa E_D {{\left | {X} \right |}^{2}}P{L_X}}} \right)}^{- 1}}} \approx \sqrt {{{\left ({\left ({1 - \beta + \kappa } \right){E_D}{{\left | {X} \right |}^{2}}P{L_X}} \right)}^{- 1}}}\).

###
**Remark 1**

It is worth noting that choosing the power allocation, *λ* is the main point because it is essential to balance the received information at UE2 and UE3. Hence, in order to maintain the quality of UE2 at an acceptable condition, as *λ* increases, the amount of signal received at UE3 falls. Later on in this paper, we are going to explain this scenario in details in Remark 2.

##### Phase 2

In terms of the IT process between R and UE2, the corresponding received signal at UE2 can be shown by

$$ {y_{2}} = {h_{Y}}{x_{R}} + {n_{0}} + {HI_{2}}, $$

(7)

and the received signal at UE3 can be written as

$$ y_{3} = {h_{Z}}{x_{R}} + {n_{0}}+ {HI_{3}}. $$

(8)

#### Mode B: P2P wireless communication

In this mode, the P2P communication between UE2 and UE3 is carried out in two time slots. We assume the same signal is received at UE2 and UE3, which can be expressed by

$$ {y_{4}} = \sqrt {{E_{D}}} h_{W}{x_{4}} + {n_{0}}+ HI_{4}, $$

(9)

where *x*
_{4} is the transmitted data from UE2 to UE3 and vice versa, which satisfies \(\mathbb {E}\left \{ {{{\left | {{x_4}} \right |}^{2}}} \right \} = 1\), and the distortion noise caused by HWIs at UE2 and UE3 are denoted as *H*
*I*
_{4}, where *Ω*
_{4}∼*C*
*N*(0,*κ*
*E*
_{
D
}|*W*|^{2}
*P*
*L*
_{
W
}). Note that \(P{L_W} = {\left ({\phi r_{W}^{m}} \right)^{- 1}}\).

### The end-to-end signal-to-noise-plus-distortion ratio (SNDR)

In this part, we investigate the end-to-end signal-to-noise-plus-distortion ratio (SNDR), *γ*, where \(\gamma ={\mathbb {E}\left \{ {{\left |signal\right |}^{2}} \right \}}/{\mathbb {E}\left \{ {{\left |\textrm {overall noise}\right |}^{2}} \right \}}\) for AF and DF scheme under the impact of HWIs. Let us start with AF scheme.

#### AF case

By substituting (3), (4) into (6), then we combine with (7), the end-to-end SNDR at UE2 can be expressed when UE2 considers *x*
_{3} as interference and then decodes the primary information, *x*
_{1} as

$$ \gamma_{1}^{AF} = \frac{{{{\tau}_{1,a}}{{\left| {X} \right|}^{2}}{{\left| {Y} \right|}^{2}}}}{{{{\tau}_{1,b}}{{\left| {X} \right|}^{2}}{{\left| {Y} \right|}^{2}} + {{\tau}_{1,c}}{{\left| {Y} \right|}^{2}} + {{\tau}_{0}}}}, $$

(10)

where *δ*
_{1}=*κ*
*λ*+*κ*
*λ*(1−*β*+*κ*)+(1−*λ*)(1−*β*+*κ*), \({{\tau }_{0}} = \frac {{\left ({1 - \beta +\kappa } \right)\left ({1 - {\alpha _1} - {\alpha _2}} \right)}}{{\eta \left ({{\alpha _1} + {\alpha _2}\beta } \right)}}\), and \(\left \{ \begin {array}{l} {{\tau }_{1,a}} = \frac {{{E_D}}}{{\Omega _0}}\left ({1 - \beta } \right)\lambda P{L_X}P{L_Y}\\ {{\tau }_{1,b}} = \frac {{{E_D}}}{{\Omega _0}}\delta _1P{L_X}P{L_Y}\\ {{\tau }_{1,c}} = \lambda P{L_Y}. \end {array} \right.\)

Likewise, replacing (3), (4), and (6) into (8), we derive the end-to-end SNDR at UE3 in case UE3 treats *x*
_{1} as interference and then decodes the secondary information, *x*
_{3} as follows

$$ \gamma_{2}^{AF} = \frac{{{{\tau}_{2,a}}{{\left| {X} \right|}^{2}}{{\left| {Z} \right|}^{2}}}}{{{{\tau}_{2,b}}{{\left| {X} \right|}^{2}}{{\left| {Z} \right|}^{2}} + {{\tau}_{2,c}}{{\left| {Z} \right|}^{2}} + {{\tau}_{0}}}}, $$

(11)

where *δ*
_{2}=*κ*
*λ*+*κ*(1−*λ*)(1−*β*+*κ*)+*λ*(1−*β*−*κ*)+*κ*, *τ*
_{0} is mentioned in the above expression, and \(\left \{ \begin {array}{l} {{\tau }_{2,a}} = \frac {{{E_D}}}{{\Omega _0}}\left ({1 - \beta } \right)\left ({1 - \lambda } \right) P{L_X}P{L_Z}\\ {{\tau }_{2,b}} = \frac {{{E_D}}}{{\Omega _0}}{\delta _2} {L_X}P{L_Z}\\ {{\tau }_{2,c}} = \lambda P{L_Z}. \end {array} \right.\)

As a result, the data rate achieved at UE2 and UE3 can be given by

$$ r_{i}^{AF}\mathop = \limits_{i \in \left\{ {1,2} \right\}} \frac{B}{2}{\log_{2}}\left({1 + \gamma_{i}^{AF}} \right), $$

(12)

where *B* denotes the channel bandwidth.

###
**Remark 2**

In order to clarify and expand Remark 1, since the end-to-end SNDR at UE2 is expressed to satisfy the quality of service. In particular, when secondary signals are treated as interference, it is straightforward to obtain from (10) that if *E*
_{
D
}→*∞* in case all parameters are fixed, \({{\lim }_{{E_{D \to \infty }}}}\gamma _{1}^{AF} = \lambda /\left ({1 - \lambda } \right)\). In contrast, since the end-to-end SNDR at UE3 (11) is computed, primary signals are considered as interference, where if *E*
_{
D
}→*∞*, \({{\lim }_{{E_{D \to \infty }}}}\gamma _{2}^{AF} =\left ({1 - \lambda } \right) /\lambda \). These phenomena are going to be examined by simulations.

#### DF case

Similarly, regarding DF scheme, the end-to-end SNDR at both UE2 and UE3 can be written as

$$ \gamma_{i}^{DF} \mathop = \limits_{i \in \left\{ {1,2} \right\}} \min \left\{\gamma_{i,a}^{DF},\gamma_{i,b}^{DF} \right\}, $$

(13)

where the instantaneous SNDR at R, UE2, and UE3 can be computed, respectively, based on (4), (7), and (8) as follows \(\left \{ \begin {array}{l} \gamma _{1,a}^{DF} = \gamma _{2,a}^{DF} = \frac {{\left ({1 - \beta } \right)\frac {{{E_D}}}{{\Omega _0}}P{L_X}{{\left | {X} \right |}^{2}}}}{{1 + \kappa \frac {{{E_D}}}{{\Omega _0}}P{L_X}{{\left | {X} \right |}^{2}}}}\\ \gamma _{1,b}^{DF} = \frac {{{{\psi }_{1,a}}{{\left | {X} \right |}^{2}}{{\left | {Y} \right |}^{2}}}}{{{{\psi }_{1,b}}{{\left | {X} \right |}^{2}}{{\left | {Y} \right |}^{2}} + {{\psi }_0}}}\\ \gamma _{2,b}^{DF} = \frac {{{{\psi }_{2,a}}{{\left | {X} \right |}^{2}}{{\left | {Z} \right |}^{2}}}}{{{{\psi }_{2,b}}{{\left | {X} \right |}^{2}}{{\left | {Z} \right |}^{2}} + {{\psi }_0}}} \end {array} \right.\), and \({{\psi }_0} = \frac {{\left ({1 - {\alpha _1} - {\alpha _2}} \right)}}{{\eta \left ({{\alpha _1} + {\alpha _2}\beta } \right)}}\), \({{\psi }_{1,a}} = \frac {{{E_D}}}{{\Omega _0}}\lambda P{L_X}P{L_Y}\), \({{\psi }_{2,a}} = \frac {{{E_D}}}{{\Omega _0}}\left ({1 - \lambda } \right)P{L_X}P{L_Z}\), \({{\psi }_{1,b}} = \frac {{{E_D}}}{{\Omega _0}}\left ({\kappa \lambda + 1 - \lambda } \right)P{L_X}P{L_Y}\), \({{\psi }_{2,b}} = \frac {{{E_D}}}{{\Omega _0}}\left (\kappa {\left ({1 - \lambda } \right) + \lambda } \right)P{L_X}P{L_Z}\).

Therefore, the transmission rate for DF protocol is given by

$$ r_{i}^{DF} \mathop {{\rm{ }} = }\limits_{i \in \left\{ {1,2} \right\}} \frac{B}{2}{\log_{2}}\left({1 + \gamma_{i}^{DF}} \right). $$

(14)

#### Peer-to-peer case

In this part, we are going to study the SNDR under the impact of HWIs in P2P communication as follows

$$ \gamma_{3}^{PP} = \frac{{\frac{{{E_{D}}}}{{\Omega_{0}}}P{L_{W}}{{\left| {W} \right|}^{2}}}}{{1 + \kappa \frac{{{E_{D}}}}{{\Omega_{0}}}P{L_{W}}{{\left| {W} \right|}^{2}}}}. $$

(15)

### Analysis on successful transmission probability, average energy efficiency, and average spectral efficiency

In this section, we are going to study on the successful transmission probability (STP), the average energy efficiency (EE), and the average spectral efficiency (SE) in the presence HWIs based on SNDR. Besides that, comparisons between AF and DF schemes are evaluated in multi-hop D2D communication and P2P communication, and we also provide closed-form expressions for each factor. Most importantly, the optimization problem regarding TS and PS ratios are solved.

#### Successful transmission probability

It is noted that the STP based on SNDR represents the probability that a receiver could receive successfully packets in the up-link from the transmitter in a time slot. Considering the STP in the one-hop P2P communication, packets are successfully received if the SNDR is greater than the SNDR threshold, *Γ*
_{
D
}, Pr(*γ*≥*Γ*
_{
D
}). Otherwise, UE2 and UE3 will receive a negative feedback and the packets are still put first in the queue for being retransmitted. Therefore, the STP in P2P communication can be derived as follows

$$ \begin{array}{l} {}\Pr \left({\gamma_{3}^{PP} \ge {\Gamma_{D}}}\right)= \Pr \left({\frac{{\frac{{{E_{D}}}}{{\Omega_{0}}}P{L_{W}}{{\left| {W} \right|}^{2}}}}{{1 + \kappa \frac{{{E_{D}}}}{{\Omega_{0}}}P{L_{W}}{{\left| {W} \right|}^{2}}}} \ge {\Gamma_{D}}} \right)\\ \qquad\qquad \qquad {= 1 - \Pr \left({\frac{{\frac{{{E_{D}}}}{{\Omega_{0}}}P{L_{W}}{{\left| {W} \right|}^{2}}}}{{1 + \kappa \frac{{{E_{D}}}}{{\Omega_{0}}}P{L_{W}}{{\left| {W} \right|}^{2}}}} < {\Gamma_{D}}} \right)}\\ \qquad\qquad \qquad { = {e^{- \frac{{\Omega_{0}{\Gamma_{D}}}}{{{\Omega_{W}}{E_{D}}P{L_{W}}\left({1 -\kappa {\Gamma_{D}}} \right)}}}}} \end{array}. $$

(16)

In terms of multi-hop D2D communication in the presence of HWIs with the help of the secondary relay, we are going to obtain the STP which undergoes large-scale path loss and small-scale Rayleigh fading at UE2 and UE3 in AF and DF scheme in Propositions 1 and 2, respectively.

###
**Proposition 1**

Therefore, the STP at UE2 and UE3 in AF scheme in case *Γ*
_{
D
}≥*τ*
_{
i,a
}/*τ*
_{
i,b
} is given by

$$ \Pr \left({\gamma_{i}^{AF} \ge {\Gamma_{D}}} \right)\mathop {{\rm{ }} = }\limits_{i \in \left\{ {1,2} \right\}}1 $$

(17)

Otherwise, in case *Γ*
_{
D
}<*τ*
_{
i,a
}/*τ*
_{
i,b
}, we derive the STP at UE2 and UE3 as

$$ \Pr \left({\gamma_{i}^{AF} \ge {\Gamma_{D}}} \right)\mathop {{\rm{ }} = }\limits_{i \in \left\{ {1,2} \right\}} {2e^{- \omega_{i}^{AF}}}\sqrt {\vartheta_{i}^{AF}} {K_{1}}\left({2\sqrt {\vartheta_{i}^{AF}}} \right), $$

(18)

where \(\omega _{i}^{AF} = \frac {{{\Gamma _D}{{\tau }_{i,c}}}}{{{\Omega _X}\left ({{{\tau }_{i,a}} - {\Gamma _D}{{\tau }_{i,b}}} \right)}}\), and \(\vartheta _{i}^{AF} = \frac {{{{\Gamma _D}{\tau }_{0}}}}{{{\Omega _X}{\Omega _Y}\left ({{{\tau }_{i,a}} - {\Gamma _D}{{\tau }_{i,b}}} \right)}}\).

###
*Proof*

Let us start with AF scheme, where the general SNDR for both UE2 and UE3 can be written as

$$ \gamma_{i}^{AF} = \frac{{aXY}}{{bXY + cY + d}}, $$

(19)

where *a*,*b*,*c*, and *d* are constant values, and the exponential random variables, i.e., *X* and *Y* are independent with means, *Ω*
_{
X
} and *Ω*
_{
Y
}, respectively.

Based on (19), the CDF of SNDR can be written as

$${} \begin{array}{l} \Pr \left({\gamma_{i}^{AF} < {\Gamma_{D}}} \right)\\ = \Pr \left({X < \frac{{{\Gamma_{D}}\left({cY + d} \right)}}{{Y\left({a - {\Gamma_{D}}b} \right)}}} \right) \\ {= \frac{1}{{{\Omega_{Y}}}}\int_{y = 0}^{\infty} {\left(1-{{e^{- \frac{{{\Gamma_{D}}\left({cy + d} \right)}}{{{\Omega_{X}}y\left({a - {\Gamma_{D}}b} \right)}}}}} \right)} {e^{- \frac{y}{{{\Omega_{Y}}}}}}dy}\\ { = 1- 2{e^{- \frac{{{\Gamma_{D}}c}}{{{\Omega_{X}}\left({a - {\Gamma_{D}}b} \right)}}}}\sqrt {\frac{{{\Gamma_{D}}d}}{{{\Omega_{X}}{\Omega_{Y}}\left({a - {\Gamma_{D}}b} \right)}}}}{{K_{1}}\left({2\sqrt {\frac{{{\Gamma_{D}}d}}{{{\Omega_{X}}{\Omega_{Y}}\left({a - {\Gamma_{D}}b} \right)}}}} \right)} \end{array}, $$

(20)

where we take advantage of the formula [[32], 3.324.1], under the condition, *Γ*
_{
D
}<*τ*
_{
i,a
}/*τ*
_{
i,b
}. In contrast, if *Γ*
_{
D
}≥*τ*
_{
i,a
}/*τ*
_{
i,b
}, \(\Pr \left ({X < \frac {{{\Gamma _D}\left ({cY + d} \right)}}{{Y\left ({a - {\Gamma _D}b} \right)}}} \right) = 1\), due to the fact that the probability will be greater than negative values and equal to 1.

To this point, the STP at UE2 can be expressed as

$${} \begin{array}{ll} {\Pr \left({\gamma_{i}^{AF} \ge {\Gamma_{D}}} \right)} &= 2{e^{- \frac{{{\Gamma_{D}}c}}{{{\Omega_{X}}\left({a - {\Gamma_{D}}b} \right)}}}}\sqrt {\frac{{{\Gamma_{D}}d}}{{{\Omega_{X}}{\Omega_{Y}}\left({a - {\Gamma_{D}}b} \right)}}}\\ &\quad\times{K_{1}}\left({2\sqrt {\frac{{{\Gamma_{D}}d}}{{{\Omega_{X}}{\Omega_{Y}}\left({a -{\Gamma_{D}}b} \right)}}}} \right) \end{array}. $$

(21)

This ends the proof for Proposition 1. □

###
**Proposition 2**

Similar to AF scheme, the STP in case of DF at UE2 and UE3 is computed by

$$ \Pr \left({\gamma_{i}^{DF} \ge {\Gamma_{D}}} \right)\mathop = \limits_{i \in \left\{ {1,2} \right\}} {2e^{- \omega_{i}^{DF}}}\sqrt {\vartheta_{i}^{DF}} {K_{1}}\left({2\sqrt {\vartheta_{i}^{DF}}} \right), $$

(22)

where \(\omega _{i}^{DF} = {{ \frac {{{\Gamma _D}\Omega _0}}{{{\Omega _X}{E_D}P{L_X}\left ({\left ({1 - \beta } \right) - {\Gamma _D}\kappa } \right)}}}}\), \(\vartheta _{i}^{DF} = \frac {{{\Gamma _D}{{\psi }_0}}}{{{\Omega _X}{\Omega _Z}\left ({{{\psi }_{i,a}} - {\Gamma _D}{{\psi }_{i,b}}} \right)}}\).

###
*Proof*

First, we use (4), so the CDF of the instantaneous SNDR in the first hop from UE1 to R is given by

$$ \begin{array}{l} \Pr \left(\gamma_{ia}^{DF} < {\Gamma_{D}}\right) = \Pr \left({\frac{{\left({1 - \beta} \right)\frac{{{E_{D}}}}{{{\Omega_{0}}}}P{L_{X}}{{\left| X \right|}^{2}}}}{{1 + \kappa \frac{{{E_{D}}}}{{{\Omega_{0}}}}P{L_{X}}{{\left| X \right|}^{2}}}} < {\Gamma_{D}}} \right)\\ \qquad\qquad\quad {= 1 - {e^{- \frac{{{\Gamma_{D}}{\Omega_{0}}}}{{{\Omega_{X}}{E_{D}}P{L_{X}}\left({\left({1 - \beta} \right) - \kappa{\Gamma_{D}}} \right)}}}}} \end{array}. $$

(23)

Following that, based on (23), the STP in the first hop from UE1 to R can be written by

$$ \Pr \left({\gamma_{ia}^{DF} \ge {\Gamma_{D}}} \right) = {e^{- \frac{{{\Gamma_{D}}{\Omega_{0}}}}{{{\Omega_{X}}{E_{D}}P{L_{X}}\left({\left({1 - \beta} \right) - {\Gamma_{D}}\kappa} \right)}}}}. $$

(24)

If *Γ*
_{
D
}<*ψ*
_{
i,a
}/*ψ*
_{
i,b
}, the STP of the instantaneous SNDR from R to UE2, UE3 in the second hop can be computed based on (7), (8) as

$${} {{\begin{aligned} \Pr \left(\gamma_{ib}^{DF} \ge \Gamma_{D}\right)&= {\Pr \left({\frac{{{{\psi}_{i,a}}XY}}{{{{\psi}_{i,b}}XY + {{\psi}_{0}}}} \ge {\Gamma_{D}}} \right)}\\ &=1-{\Pr \left({\frac{{{{\psi}_{i,a}}XY}}{{{{\psi}_{i,b}}XY + {{\psi}_{0}}}} < {\Gamma_{D}}} \right)}\\ &= \frac{1}{{{\Omega_{Y}}}}\int\limits_{y = 0}^{\infty} {\left({{e^{- \frac{1}{y}\left({\frac{{{\Gamma_{D}}{{\psi}_{0}}}}{{{\Omega_{X}}\left({{{\psi}_{i,a}} - {\Gamma_{D}}{{\psi}_{i,b}}} \right)}}} \right)}}} \right)} {e^{- \frac{y}{{{\Omega_{Y}}}}}}dy\\ &= 2\sqrt {\frac{{{\Gamma_{D}}{{\psi}_{0}}}}{{{\Omega_{X}}{\Omega_{Y}}\left({{{\psi}_{i,a}} - {\Gamma_{D}}{{\psi}_{i,b}}} \right)}}}\\ &\quad\times{K_{1}}\left({2\sqrt {\frac{{{\Gamma_{D}}{{\psi}_{0}}}}{{{\Omega_{X}}{\Omega_{Y}}\left({{{\psi}_{i,a}} - {\Gamma_{D}}{{\psi}_{i,b}}} \right)}}}} \right). \end{aligned}}} $$

(25)

Otherwise, if *Γ*
_{
D
}≥*ψ*
_{
i,a
}/*ψ*
_{
i,b
}, then \({\Pr \left ({\frac {{{{\psi }_{i,a}}XY}}{{{{\psi }_{i,b}}XY + {{\psi }_0}}} \ge {\Gamma _D}} \right)} = 0\).

Eventually, by denoting the end-to-end SNDR at UE2, UE3 in DF scheme as \(\gamma _{i}^{DF}=\text {min}\left (\gamma _{ia}^{DF},\gamma _{ib}^{DF}\right)\) with *i*∈{1,2}, the STP of \(\gamma _{i}^{DF}\) can be given by

$$ {{}\begin{aligned} \Pr \left(\gamma_{i}^{DF} \ge \Gamma_{D}\right) = \Pr \left(\gamma_{ia}^{DF} \ge \Gamma_{D}\right)\times\Pr \left(\gamma_{ib}^{DF} \ge \Gamma_{D}\right). \end{aligned}} $$

(26)

Replacing (24), (25) into (26), we can easily end the proof for Proposition 2. □

###
**Remark 3**

Finding the joint optimal values of TS and PS for EH that help maximize the STP is essential. It may be challenging to evaluate the joint optimal values of TS and PS ratios in terms of the STP with Bessel function for the given system parameters, including maximum transmission power, distance, power allocation and HWIs level, etc. Due to the non-convex optimization problem which cannot be solved easily, we are going to analyze in details how we deploy a genetic algorithm (GA)-based optimization algorithm in Section 3.4.

#### Average energy efficiency and average spectral efficiency

In this part, we are going to further obtain average EE and average SE. Note that EE is defined as the average transmission rate under unit-energy consumption. In order to achieve energy-efficient communication, both the transmission power and the circuit power can be examined [5].

###
**Proposition 3**

We derive the expression for the average EE and average SE, respectively, in AF scheme as

$$ \begin{array}{l} {ee_{i}^{AF}}= {\mathbb{E}}\left\{ {\frac{B{{{\log }_{2}}\left({1 + \gamma_{i}^{AF}} \right)}}{{{2E_{sum}}}}} \right\}\\ \qquad {= \frac{{B}}{{{2E_{sum}}}}\int\limits_{x = 0}^{{{\tau}_{i,a}}/{{\tau}_{i,b}}} {\left({M_{i}^{AF} + N_{i}^{AF}} \right)} {\log_{2}}\left({1 + x} \right)dx} \end{array}, $$

(27a)

and

$$ \begin{array}{l} {se_{i}^{AF}}= {\mathbb{E}}\left\{ {\frac{B{{{\log }_{2}}\left({1 + \gamma_{i}^{AF}} \right)}}{{2B}}} \right\}\\ \qquad {= \frac{1}{2}\int\limits_{x = 0}^{{{\tau}_{i,a}}/{{\tau}_{i,b}}} {\left({M_{i}^{AF} + N_{i}^{AF}} \right)} {\log_{2}}\left({1 + x} \right)dx} \end{array}, $$

(27b)

where \({M_{i}^{AF}}=\frac {{2{{\tau }_{i,a}}{e^{- \omega _{i}^{AF}}}\vartheta _{i}^{AF}{K_0}\left ({2\sqrt {\vartheta _{i}^{AF}}} \right)}}{{x\left ({{{\tau }_{i,a}} - x{{\tau }_{i,b}}} \right)}}\), \({N_{i}^{AF}}= \frac {{2{{\tau }_{i,a}}\omega _{i}^{AF}{e^{- \omega _{i}^{AF}}}\sqrt {\vartheta _{i}^{AF}} {K_1}\left ({2\sqrt {\vartheta _{i}^{AF}}} \right)}}{{x\left ({{{\tau }_{i,a}} - x{{\tau }_{i,b}}} \right)}}\), and the total power consumption of mode A is defined as *E*
_{
sum
}=2*E*
_{
D
}+2*E*
_{
C
}+*E*
_{
R
}.

###
*Proof*

Following that, based on Proposition 1, the CDF of SNDR at UE2, UE3 in AF scheme is given by

$$ {F_{\gamma_{i}^{AF}}}(x) = 1 - {2e^{- \omega_{i}^{AF}}}\sqrt {\vartheta_{i}^{AF}} {K_{1}}\left({2\sqrt {\vartheta_{i}^{AF}}} \right), $$

(28)

where \(\vartheta _{i}^{AF} = \frac {{{{\tau }_0}x}}{{{\Omega _X}{\Omega _Y}\left ({{{\tau }_{i,a}} - x{{\tau }_{i,b}}} \right)}}\), \(\omega _{i}^{AF} = \frac {{x{{\tau }_{i,c}}}}{{{\Omega _X}\left ({{{\tau }_{i,a}} - x{{\tau }_{i,b}}} \right)}}\).

By evaluating the derivative of \(F_{\gamma _{i}^{AF}}(x)\) with respect to *x*, the PDF of \({\gamma _{i}^{AF}}\) can be written as

$$ {\begin{aligned} {f_{\gamma_{i}^{AF}}}(x) &= \frac{\partial }{{\partial (x)}}{F_{\gamma_{i}^{AF}}}(x)\\ \qquad &= {M_{i}^{AF}}+{N_{i}^{AF}}, \end{aligned}} $$

(29)

where \({M_{i}^{AF}}=\frac {{2{{\tau }_{i,a}}{e^{- \omega _{i}^{AF}}}\vartheta _{i}^{AF}{K_0}\left ({2\sqrt {\vartheta _{i}^{AF}}} \right)}}{{x\left ({{{\tau }_{i,a}} - x{{\tau }_{i,b}}} \right)}}\), \({N_{i}^{AF}}=\frac {{2{{\tau }_{i,a}}\omega _{i}^{AF}{e^{- \omega _{i}^{AF}}}\sqrt {\vartheta _{i}^{AF}} {K_1}\left ({2\sqrt {\vartheta _{i}^{AF}}} \right)}}{{x\left ({{{\tau }_{i,a}} - x{{\tau }_{i,b}}} \right)}}\), and we derive the expression above by using the property of Bessel function in [[32], 8.486.18].

Thus, the closed-form expression for the average EE over Rayleigh fading channels can be given by

$$ \begin{array}{l} {\mathbb{E}}\left\{{{\log_{2}}\left({1 + \gamma_{i}^{AF}} \right)}\right\} = \int\limits_{x = 0}^{{{\tau}_{i,a}}/{{\tau}_{i,b}}}{f_{\gamma_{i}^{AF}}}(x){\log_{2}}\left({1 + x} \right)dx \\ \qquad\qquad\qquad\qquad {= \int\limits_{x = 0}^{{{\tau}_{i,a}}/{{\tau}_{i,b}}} {\left({M_{i}^{AF} + N_{i}^{AF}} \right)} {\log_{2}}\left({1 + x} \right)dx} \end{array}\!. $$

(30)

This proof is provided to prove Proposition 3. □

Similar to Proposition 3, the analytical average EE and average SE in DF scheme in Mode A can be expressed as

$$ \begin{array}{l} ee_{i}^{DF} = {\mathbb{E}}\left\{ {\frac{{B{{\log }_{2}}\left({1 + \gamma_{i}^{DF}} \right)}}{{2{E_{sum}}}}} \right\}\\ \qquad{= \frac{B}{{2{E_{sum}}}}\int\limits_{x = 0}^{{{\psi}_{i,a}}/{{\psi}_{i,b}}} {\left({M_{i}^{DF} + N_{i}^{DF}} \right)} {\log_{2}}\left({1 + x} \right)dx} \end{array}, $$

(31a)

and

$$ \begin{array}{l} se_{i}^{DF} = {\mathbb{E}}\left\{ {\frac{{B{{\log }_{2}}\left({1 + \gamma_{i}^{DF}} \right)}}{2B}} \right\}\\ \qquad{= \frac{1}{2}\int\limits_{x = 0}^{{{\psi}_{i,a}}/{{\psi}_{i,b}}} {\left({M_{i}^{DF} + N_{i}^{DF}} \right)} {\log_{2}}\left({1 + x} \right)dx} \end{array}, $$

(31b)

where \({M_{i}^{DF}}=\frac {{2{{\psi }_{i,a}}{e^{- \omega _{i}^{AF}}}\vartheta _{i}^{AF}{K_0}\left ({2\sqrt {\vartheta _{i}^{DF}}} \right)}}{{x\left ({{{\psi }_{i,a}} - x{{\psi }_{i,b}}} \right)}}\), \({N_{i}^{DF}}=\frac {{2{\left ({1-\beta }\right)}\omega _{i}^{DF}{e^{- \omega _{i}^{DF}}}\sqrt {\vartheta _{i}^{DF}} {K_1}\left ({2\sqrt {\vartheta _{i}^{DF}}} \right)}}{{x\left ({{{\psi }_{i,a}} - x{{\psi }_{i,b}}} \right)}}\).

Meanwhile, when *Γ*
_{
D
}<1/*κ*, we derive the expression for both average EE and average SE in P2P communication with the transmission power and the circuit power, *P*
_{
sum
}=2*E*
_{
D
}+2*E*
_{
C
} as

$$ \begin{array}{l} ee_{3}^{PP} = 2\times\mathbb{E}\left\{ {\frac{{B{{\log }_{2}}\left({1 + \gamma_{3}^{PP}} \right)}}{{2{P_{sum}}}}} \right\}\\ \qquad{= \frac{B}{{{P_{sum}}\ln 2}}\int\limits_{x = 0}^{1/\kappa} {{e^{- \frac{{{\Omega_{0}}x}}{{{\Omega_{W}}{E_{D}}P{L_{W}}\left({1 - \kappa x} \right)}}}}{{\left({1 + x} \right)}^{- 1}}dx}} \end{array}, $$

(32a)

and

$$ \begin{array}{*{20}{l}} {se_{3}^{PP} = 2\times\mathbb{E}\left\{ {\frac{{B{{\log }_{2}}\left({1 + \gamma_{3}^{PP}} \right)}}{{2B}}} \right\}} \\ {\qquad = \frac{1}{{\ln 2}}\int\limits_{x = 0}^{1/\kappa} {{e^{- \frac{{{\Omega_{0}}x}}{{{\Omega_{W}}{E_{D}}P{L_{W}}\left({1 - \kappa x} \right)}}}}{{\left({1 + x} \right)}^{- 1}}} dx} \\ \end{array}. $$

(32b)

### Optimization problem

Regarding the HTPS relaying protocol, we try to solve the optimization problem of time switching (TS) and power spitting (PS) ratios with the aim to maximizing the STP. Therefore, we have the expression as follows

$$ \mathop {\max }\limits_{{\alpha_{1}},{\alpha_{2}},\beta} \left\{ {2{e^{- \omega_{i}^{j}}}\sqrt {\vartheta_{i}^{j}} {K_{1}}\left({2\sqrt {\vartheta_{i}^{j}}} \right)} \right\}, $$

(33)

where the expression is subject to *α*
_{1},*α*
_{2},*β*∈(0,1], and \({\omega _{i}^{j}}\), \({\vartheta _{i}^{j}}\) are defined in Propositions 1 and 2, respectively, *i*∈{1,2},*j*∈{*A*
*F*,*D*
*F*}.

Due to the fact that the expression (33) is a non-convex function and it is difficult to derive analytic solution of *α*, *β* for HTPS relaying protocol, the achievement of optimal system configuration parameters cannot be done, since exhaustive search is not effective, where multiple parameters need to be optimized. To overcome this complication, we take advantage of a genetic algorithm (GA)-based optimization algorithm to obtain the optimal values of TS and PS to maximize the STP.

###
**Definition 1**

The generation of a random population is what GA begins with, which is defined as a set of chromosomes consisting of a group of genes and it holds values for the optimization variables *[*
33
*]*. Thanks to the evaluation of chromosome against an objective function, the fitness of each one is determined. In order to provide simulations for the natural survival of the fittest process, only best chromosomes can exchange information (via crossover or mutation) to produce offspring chromosomes. If offspring solutions are more feasible solutions than weak population members, they are investigated and used for population evolution. The process is continued for a vast number of generations to find a best-fit (near-optimum) solution. Note that the performance of GAs is affected by primary parameters, including number of generations, population size, crossover rate, and mutation rate *[*
34
*,*
35
*]*.

We regard TS fraction, *α*, and PS fraction, *β* as genes, respectively; we create a chromosome by the combination of *α* and *β*. In order to obtain each chromosome’s fitness, objective function in (33) is used. *H*
_{
max
} denotes the optimal solution of the *t*-th generation, and the predefined precision with constraint tolerance of GA is denoted by *ε*. Therefore, we present some steps of the GA-based optimization Algorithm 1 as follows:

As a result, the use of a genetic algorithm (GA)-based optimization helps us achieve the joint optimal TS and PS ratios to guarantee the best STP.