1 Introduction

As 5G has been commercially deployed and the intelligent devices are widely used, more and more devices are connected to wireless networks. It is applied to Internet of vehicles, smart home, intelligent reflecting surface (IRS) [1], vehicle-to-vehicle (V2V) [2, 3] and other scenarios. The upcoming 6G wireless communication networks [4] will be designed to provide global coverage like massive Internet of things (IoT), smart cities, unmanned aerial vehicles and other applications. It can enhance energy efficiency, intelligence level and security. In the era of 6G, driven by the exponentially increasing network infrastructures and the number of connected terminals, green communication researches face new challenges such as the statistical properties, data transmission efficiency, mobility, channel modeling and power consumption. [5, 6] study channel modeling and analyze characteristics for next-generation communication systems. In particular, power consumption has become critical in many emerging wireless devices and has prompted researchers to reconsider the design of green networks based on energy efficiency. Therefore, green communication has become the hot research topics [7,8,9,10]. [8] provides the survey on base stations energy saving and discusses the energy problem on heterogeneous system and gives a research vision on cognitive radio and cooperative relaying system. The EH-based heterogeneous network (HetNet) in 5G is studied in [9], it gives a survey on resource allocation algorithms for different networks, and the EH technology can be used in HetNets considering energy efficiency. Two new resource allocation algorithms are provided for 6G communications. [10] gives the survey on AI-based green communications in 6G, using AI technique to manage networks and improve energy efficiency. Using wireless multi-hop relay architecture can extend the range of wireless communication [11], but the power consumption is an important problem if sufficient power supply is not available [12]. Traditional energy-harvesting media are greatly affected by nature. Now wireless networks are spreading from ground to air, and it is extremely difficult to use traditional medium to harvest energy for these wireless networks.

Considering that wireless signal can carry and transmit energy and information at the same time, energy harvesting can prolong the service life of relay devices. [13] first introduces the concept of simultaneous wireless information and power transfer (SWIPT). [14] introduces two methods for energy harvesting, PS and time switching (TS). Particularly in TS method, the receiver node separates time to process information and harvest energy, and the TS factor is the ratio; in PS method, the receiver node splits the received signal partly for information processing and partly for the energy harvesting, and the PS factor is the ratio. Many traditional wireless technologies have been applied to EH relay networks such as multi-input multi-output (MIMO) relaying. In [15], EH in AF, DF and hybrid relaying networks with PS and TS methods over fading channel is studied, through maximizing throughput to derive the optimal ratios. Now, EH is also used for IRS wireless network [16], an IRS NOMA IoT network is studied which combines reflected energy with reflected information, and the sum throughput maximization is formulated considering phase shifts and time allocation.

Beamforming in EH relay networks can effectively increase capacity and improve the system performance. It has attracted the attention of researchers (See a survey in [17]). However, most researches focus on a relay with multi-antenna network, and the research on a relay with single antenna is relatively small. Considering the limitations of devices, it is inconvenient to work with multiple antennas on a single relay. [18] proposes beamforming networks with and without directly connection from source to destination with the perfect channel state information (CSI), and the power control problem is solved with beamforming weight optimization. In [19], multi-group multicasting SWIPT relay networks are proposed. [20] analyzes the distributed antennas SWIPT system, and beamforming and PS factors are obtained under the max–min SINR constraint, using iterative algorithm by reformulating the non-convex problem into two convex problems. The robust beamforming SWIPT problem is studied using the worst-case deterministic model in [21]. [22] studies the application of distributed beamforming technology for a dual-hop cooperative MIMO DF relay network, which minimizes the probability of pairing errors and keeps the SNR above the threshold of a given relay node. The robust beamforming design in [23] is proposed in an reconfigurable intelligent surfaces-aided HetNet system; using iterative method to maximize energy efficiency, the beamforming vectors and phase shifts are jointly optimized.

A two-way wireless network can improve spectrum efficiency and reduce half-duplex loss and loop interference loss in full duplex [24,25,26,27,28,29,30,31,32]. Two-way communication is also used in backscatter communication [24]. In [25], optimal beamforming vectors are attained in two-way beamforming relay network with reciprocal channels and non-reciprocal channels. [26] designs a MIMO two-way EH AF relay network; in order to minimize total mean-square-error, the optimal problem is divided into sub-problems and the iterative algorithm is used, and the results demonstrate the system performance. In [27], a joint two-way beamforming and EH relay selection network is proposed, changing the relay selection problem with convex algorithm. [28] considers a SWIPT two-way relaying network with DF protocol by PS and TS method, and the PS and TS ratios are investigated through minimizing the outage probability. [29] develops beamforming SWIPT scheme in the two-way relay channel and obtains the optimal transceiver design considering maximal achievable sum rate. [30] designs the SWIPT beamforming system in the two-way relaying channel; considering AF and DF relaying protocol, the non-convex problem is formulated, decoupling the problem into two sub-problems to solve the problem. A novel harvest-use-store PS relaying strategy is proposed for multi-relay cooperative networks considering energy accumulation problem in [31]. [32] proposes the physical-layer network coding (PNC) based on two-way DF protocol. Compared with the digital coding arithmetic, PNC scheme can improve throughput.

In ambient backscatter communication, the system capacity can be improved by using the joint beamforming weight vector design in MIMO system with multiple antennas. But in many application scenarios, it is not easy to install multiple antennas on the device because of the work environment, volume, and the cost of frequent battery update or maintenance. Many single-antenna relays form a distributed beamforming network, which can improve the spectrum efficiency. Since the joint optimization of beamforming and PS ratio of relays is a non-convex quadratic constrained optimization problem, most researches decouple it into two sub-problems and optimize the beamforming vector and PS ratio, respectively. However, considering the complexity of the problem in real world, these methods are not suitable using multiple single-antenna EH relays in two-way beamforming system, which is still a problem that needs to be studied.

In this paper, an EH relay beamforming in AF and DF two-way mode with single-antenna relays is studied. Different from the one-way EH relaying network, the power of relays is obtained entirely by energy harvesting, and the transmit power is not limited by the total quota or the personal quota. The contributions of this paper are summarized as follows:

  • We propose a two-way beamforming system with EH relays. It has two transceiver nodes and many relay nodes. The transceivers are not direct linked. All the relays are single antenna. The EH relays use PS method to harvest energy and process information.

  • Using PS-based EH relays, we derive the formula of sum rate. It is controlled by PS factor, and optimization PS factor becomes an important issue.

  • A joint optimization problem is established under the sum rate maximization. The problem is non-convex and complex. In order to get the optimal value, the gradient descent algorithm is used in AF mode, and the minimal PS factor is used under the SNR outage threshold constraint in DF mode. Based on our previous work [33] which researches on EH two-way relay network in AF mode, we further in this paper analyze the convergence results of the gradient descent algorithm, and the EH relay beamforming in DF mode is also studied.

  • We analyze performance by the simulation examples, and two-way beamforming scheme is better than one-way scheme both in AF and DF mode.

The remainder of the paper is organized as follows: In Sect. 2, the system is described in detail. In Sect. 3, the joint optimization PS factor is built. In Sect. 5, the simulation examples and the discussion are presented, and Sect. 6 is the conclusion.

2 System model

The two-way beamforming system is considered including two transceiver nodes and multiple relay nodes. All transceiver nodes and relay nodes are equipped with a single antenna, as shown in Fig. 1, and two transceiver nodes are not directly connected. The relay works under the AF or DF protocol with half duplex over fading channels. We assume that there are no links between relays. There are also no external interference links to relays. We assume that channel coefficients of all nodes are known, and the channel between the transceiver and the relay nodes is reciprocal. The channel gain is constant over one send-receive block with independent and identically distributed. The mutual interference between relays can be suppressed by interference suppression which increases the system complexity. Thus, we ignore the mutual interference and assume that each relay only receives signal from two transceiver nodes. Let \(f_i\) and \(h_i\) be the channel gain between transceiver nodes to relay i. \(f_i\) and \(h_i\) is known to the transceiver and relay nodes. All the relays have no their own power supply. Their power is totally coming from energy harvesting. \(g_i\) denotes the received signal at relay i from two transceivers, and \(y_i\) is the signal sent to transceivers. \(R_{\mathrm{th}}\) is the outage threshold. The signal received at relay i from two transceivers can be written as

$$\begin{aligned} g_i=\sqrt{P_0}f_i s_1+\sqrt{P_0}h_i s_2+v_{i}, \end{aligned}$$
(1)

where \(P_0\) and \(s_i\) are the fixed transmit power and the transmit signal from two transceivers, respectively. We assume that \({\mathbb {E}}[|s_1|^2]=1\), \({\mathbb {E}}[|s_2|^2]=1\), \(v_{i}\sim CN(0,\sigma _{A}^2)\) is the additive noise introduced by relay i. \(\alpha _i\) is the PS factor which splits the received signal in two parts, information processing part is \(\alpha _i,\) and energy harvesting is \(1-\alpha _i\), \(\alpha _i\in (0,1)\). The signal \(d_{in}\) is for information processing.

$$\begin{aligned} d_{in}=\sqrt{\alpha _i}g_i+v_{ip}, \end{aligned}$$
(2)

where \(v_{ip}\sim CN(0,\sigma _{P}^2)\) is the information processing additive noise, and the signal for energy harvesting is

$$\begin{aligned} e_i = \sqrt{1-\alpha _i}g_i. \end{aligned}$$
(3)

2.1 AF relaying

In AF relaying mode, the relay receives signal from two transceivers; after information processing and energy harvesting, it amplifies and forwards the signal. The relay i amplifies the signal with factor \(\beta _i,\) and then sends it to two transceivers as shown in Fig. 2. The relay i sends the signal amplified by the factor \(\beta _i\) to two transceivers with phase adjusted by \(\theta _i\)

$$\begin{aligned} y_i=\beta _ie^{j\theta _i}d_{in}. \end{aligned}$$
(4)

The average transmit power is

$$\begin{aligned} {\mathbb {E}}[|y_i|^2]=\beta _i^2(\alpha _i P_0 |f_i|^2+\alpha _i P_0 |h_i|^2+\alpha _i \sigma _A^2+\sigma _P^2), \end{aligned}$$
(5)

and according to the PS method, the average power harvesting is

$$\begin{aligned} {\mathbb {E}}[|e_i|^2]=(1-\alpha _i)P_0(|f_i|^2+ |h_i|^2+\frac{\sigma _A^2}{P_0}). \end{aligned}$$
(6)

Because the relay i has no its own power supply, the harvested energy for relay at least is equal to its transmit power

$$\begin{aligned} {\mathbb {E}}[|y_i|^2]=\xi {\mathbb {E}}[|e_i|^2], \end{aligned}$$
(7)

where \(\xi\) is the energy conversion efficiency. Therefore,

$$\begin{aligned} \beta _i=\sqrt{\frac{\xi (1-\alpha _i)(P_0 |f_i|^2+P_0 |h_i|^2+\sigma _A^2)}{\alpha _i(P_0 |f_i|^2+P_0 |h_i|^2+\sigma _A^2)+\sigma _P^2}} \end{aligned}$$
(8)

We assume that \(\alpha _i P_0 |f_i|^2+\alpha _i P_0 |h_i|^2 + \alpha _i \sigma _A^2 \gg \sigma _P^2\), so \(\beta _i\) be written as

$$\begin{aligned} \beta _i \approx \sqrt{\dfrac{\xi (1-\alpha _i)}{\alpha _i}}. \end{aligned}$$
(9)

The signal received at transceivers s1 and s2 from multiple relays by maximal ratio combination (MRC) is:

$$\begin{aligned} s_1^\mathrm{AF}=\sum _{i=1}^M f_i y_i+ w_1, \end{aligned}$$
(10)
$$\begin{aligned} s_2^\mathrm{AF} = \sum _{i=1}^M h_i y_i + w_2, \end{aligned}$$
(11)

where \(w_1\sim CN(0,\sigma _{D1}^2)\) and \(w_2\sim CN(0,\sigma _{D2}^2)\) are the additive noise introduced by the antenna at transceivers s1 and s2. M is the number of relay nodes. Considering the self-interference constraint (SIC), by eliminating the self-interference component, \(s_1^\mathrm{AF}\) and \(s_2^\mathrm{AF}\) are further transformed as

$$\begin{aligned} s_1^\mathrm{AF} &={\varvec{f}}^\top {\varvec{t}} + w_1 \\ &=\sqrt{\xi P_0}\left( \sum _{i=1}^M\sqrt{1-\alpha _i} f_i h_i e^{j\theta _i}\right) s_2 \\ &\quad+ \sqrt{\xi }\sum _{i=1}^M\sqrt{1-\alpha _i} f_i e^{j\theta _i} \left( v_{i}+\dfrac{v_{ip}}{\sqrt{\alpha _i}}\right) +w_1, \end{aligned}$$
(12)
$$\begin{aligned} s_2^\mathrm{AF} &={\varvec{g}}^\top {\varvec{t}} + w_2 \\ &=\sqrt{\xi P_0}\left( \sum _{i=1}^M\sqrt{1-\alpha _i} f_i h_i e^{j\theta _i}\right) s_1 \\&\quad+ \sqrt{\xi }\sum _{i=1}^M\sqrt{1-\alpha _i} h_i e^{j\theta _i} \left( v_{i}+\dfrac{v_{ip}}{\sqrt{\alpha _i}}\right) +w_2, \end{aligned}$$
(13)

Therefore, the SNR in AF mode at transceivers s1 and s2 is given by

$$\begin{aligned} \gamma _1^\mathrm{AF}=\dfrac{P_0|\sum _{i=1}^M\sqrt{1-\alpha _i} f_i h_i e^{j\theta _i}|^2}{\sum _{i=1}^M(1-\alpha _i)\left( \sigma _A^2+\dfrac{\sigma _P^2}{\alpha _i}\right) |f_i|^2+\dfrac{\sigma _{D1}^2}{\xi }}, \end{aligned}$$
(14)
$$\begin{aligned} \gamma _2^\mathrm{AF}=\dfrac{P_0|\sum _{i=1}^M\sqrt{1-\alpha _i} f_i h_i e^{j\theta _i}|^2}{\sum _{i=1}^M(1-\alpha _i)\left( \sigma _A^2+\dfrac{\sigma _P^2}{\alpha _i}\right) |h_i|^2+\dfrac{\sigma _{D2}^2}{\xi }}, \end{aligned}$$
(15)

Obviously, when \(\theta _i=-\arg f_i-\arg h_i\), the maximal SNR is obtained. By substituting \(\theta _i\) in (14) and (15), we have

$$\begin{aligned} \gamma _1^\mathrm{AF} = \dfrac{P_0(\sum _{i=1}^M\sqrt{1-\alpha _i} |f_i h_i|)^2}{\sum _{i=1}^M(1-\alpha _i)\left( \sigma _A^2+\dfrac{\sigma _P^2}{\alpha _i}\right) |f_i|^2 + \dfrac{\sigma _{D1}^2}{\xi }}, \end{aligned}$$
(16)
$$\begin{aligned} \gamma _2^\mathrm{AF} = \dfrac{P_0(\sum _{i=1}^M\sqrt{1-\alpha _i} |f_i h_i|)^2}{\sum _{i=1}^M(1-\alpha _i)\left( \sigma _A^2+\dfrac{\sigma _P^2}{\alpha _i}\right) |h_i|^2 + \dfrac{\sigma _{D2}^2}{\xi }}. \end{aligned}$$
(17)

Then, the achievable rate from s1 to s2 and from s2 to s1 is given, respectively.

$$\begin{aligned} R_1^\mathrm{AF}=\dfrac{1}{2}\log _2(1+\gamma _1^\mathrm{AF}), \end{aligned}$$
(18)
$$\begin{aligned} R_2^\mathrm{AF}=\dfrac{1}{2}\log _2(1+\gamma _2^\mathrm{AF}). \end{aligned}$$
(19)

The sum rate for AF relaying protocol is defined as

$$\begin{aligned} R^\mathrm{AF}=R_1^\mathrm{AF} +R_2^\mathrm{AF}. \end{aligned}$$
(20)

The outage probability at node s1 and s2 is

$$\begin{aligned} Pout_{si}^\mathrm{AF}=Pr\{R_i^\mathrm{AF} < R_{\mathrm{th}}\}, i=1,2 \end{aligned}$$
(21)

Both links from s1 to relays to s2 and from s2 to relays to s1 should keep communication by the relayed path. To keep the two-way communication well, the outage probability is the sum of outage probability at s1 and s2.

$$\begin{aligned} P_{\mathrm{out}}^\mathrm{AF}= Pr\left\{ \dfrac{1}{2}\log _2(1+\gamma _1^\mathrm{AF})<R_{\mathrm{th}}\right\} + Pr\left\{ \dfrac{1}{2}\log _2(1+\gamma _2^\mathrm{AF}) <R_{\mathrm{th}}\right\} . \end{aligned}$$
(22)

2.2 DF relaying

When the relay i works in DF mode, as shown in Fig. 3, after information processing and energy harvesting, the relay forwards information to transceivers. The relay node i receives signal from two transceivers with physical-layer network coding (PNC) scheme [34]. We have

$$\begin{aligned} S_{1i}^\mathrm{DF} =\sqrt{P_0}f_i s_1+v_{1i}, \end{aligned}$$
(23)
$$\begin{aligned} S_{2i}^\mathrm{DF} =\sqrt{P_0}h_i s_2+v_{2i}, \end{aligned}$$
(24)
$$\begin{aligned} s_{ri}^\mathrm{DF} =\sqrt{P_0}f_i s_1+\sqrt{P_0}h_i s_2+v_{i}, \end{aligned}$$
(25)

\(v_{1i}\sim CN(0,N_0)\) and \(v_{2i}\sim CN(0,N_0)\) is the additive noise introduced by the relay i antenna. \(v_{i}\sim CN(0,N_0)\) is the additive noise introduced by the relay i antenna. Using the power splitting technique, the energy that the relay i harvests from s1 and s2 is given as

$$\begin{aligned} E_{ri}^\mathrm{DF} =(1-\alpha _i)P_0(|f_i|^2+ |h_i|^2), \end{aligned}$$
(26)

The relay i uses its power \(E_{ri}^\mathrm{DF}\) to send information. Here, we assume the relay i can successfully decode and encode signal without error. In this way, the SNR at the relay node i from s1 is

$$\begin{aligned} \gamma _{r_{s1}}^\mathrm{DF}=\dfrac{P_0\alpha _i(|f_i|^2)}{N_0}. \end{aligned}$$
(27)

the SNR at the relay node i from s2 is

$$\begin{aligned} \gamma _{r_{s2}}^\mathrm{DF}=\dfrac{P_0\alpha _i(|h_i|^2)}{N_0}. \end{aligned}$$
(28)

the SNR at the relay node i from s1 and s2 is

$$\begin{aligned} \gamma _{i}^\mathrm{DF}=\dfrac{P_0\alpha _i(|f_i|^2+|h_i|^2)}{N_0}. \end{aligned}$$
(29)

because we assume the relay i can successfully decode and encode signal without error, so the signal-to-noise ratio is greater than outage threshold of node s1 and s2. Then,

$$\begin{aligned} \gamma _{r_{s1}}^\mathrm{DF}\ge r_{\mathrm{th}}, \end{aligned}$$
(30)
$$\begin{aligned} \gamma _{r_{s2}}^\mathrm{DF}\ge r_{\mathrm{th}}, \end{aligned}$$
(31)

where \(r_{\mathrm{th}}\) is the SNR outage threshold, and we can get that

$$\begin{aligned} \alpha _i \ge \dfrac{r_{\mathrm{th}} N_0}{|f_i|^2 P_0}. \end{aligned}$$
(32)
$$\begin{aligned} \alpha _i \ge \dfrac{r_{\mathrm{th}} N_0}{|h_i|^2 P_0}. \end{aligned}$$
(33)

Obviously,

$$\begin{aligned} \alpha _i \ge \dfrac{r_{\mathrm{th}} N_0}{(|f_i|^2+|h_i|^2)P_0}. \end{aligned}$$
(34)

Since \(\alpha _i\) is known to be smaller than 1, we have

$$\begin{aligned} max\left\{ \dfrac{r_{\mathrm{th}} N_0}{|f_i|^2 P_0}, \dfrac{r_{\mathrm{th}} N_0}{|h_i|^2 P_0}\right\} \leqslant \alpha _i <1. \end{aligned}$$
(35)

Therefore, the signal sent by relay i is given by

$$\begin{aligned} y_i^\mathrm{DF}=\sqrt{P_{r_i}^\mathrm{DF}}(s_{ri}), \end{aligned}$$
(36)

where \(P_{r_i}^\mathrm{DF}\) is the transmit power of relay node i. To let the relay work in normal state, the power harvested should be equal to its transmit power, i.e.,

$$\begin{aligned} P_{r_i}^\mathrm{DF}=\xi E_{ri}^\mathrm{DF}. \end{aligned}$$
(37)

Therefore,

$$\begin{aligned} P_{r_i}^\mathrm{DF}=\xi (1-\alpha _i)P_0(|f_i|^2+|h_i|^2 ). \end{aligned}$$
(38)

Then, the relays forward information to destinations using harvested energy. Again, considering SIC, after eliminating the self-interference component, the received signal at destination \(s_1\) and destination \(s_2\) is given by

$$\begin{aligned} z_1^\mathrm{DF}&=\sum _{i=1}^M f_iy_i^\mathrm{DF}+ w_{z1} \\ &=\sum _{i=1}^M\sqrt{\xi P_0}\sqrt{1-\alpha _i}\sqrt{|f_i|^2+|h_i|^2 }f_i s_2+w_{z1}, \end{aligned}$$
(39)
$$\begin{aligned} z_2^\mathrm{DF} &=\sum _{i=1}^M h_iy_i^\mathrm{DF}+ w_{z2} \\ &=\sum _{i=1}^M\sqrt{\xi P_0}\sqrt{1-\alpha _i}\sqrt{|f_i|^2+|h_i|^2}h_i s_1+w_{z2}. \end{aligned}$$
(40)

where \(w_{z1}\sim CN(0,N_0)\) and \(w_{z2}\sim CN(0,N_0)\) are the additive noise introduced by the transceiver antenna. Therefore, the SNR at destination node is

$$\begin{aligned} \gamma _{s1}^\mathrm{DF} = \dfrac{P_0(\sum _{i=1}^M\sqrt{1-\alpha _i}\sqrt{|f_i|^2+|h_i|^2}|f_i|)^2 }{\dfrac{N_0}{\xi }}, \end{aligned}$$
(41)
$$\begin{aligned} \gamma _{s2}^\mathrm{DF}=\dfrac{P_0(\sum _{i=1}^M\sqrt{1-\alpha _i}\sqrt{|f_i|^2+|h_i|^2}|h_i|)^2 }{\dfrac{N_0}{\xi }}, \end{aligned}$$
(42)

the achievable rate of node s1 is

$$\begin{aligned} R_{s1}^\mathrm{DF}=\dfrac{1}{2}\log _2(1+\gamma _{s1}^\mathrm{DF}), \end{aligned}$$
(43)

the achievable rate of node s2 is

$$\begin{aligned} R_{s2}^\mathrm{DF}=\dfrac{1}{2}\log _2(1+\gamma _{s2}^\mathrm{DF}), \end{aligned}$$
(44)

and the sum rate at destination nodes is

$$\begin{aligned} R_{d}^\mathrm{DF}&=R_{s1}^\mathrm{DF} + R_{s2}^\mathrm{DF} \\ &=\dfrac{1}{2}(\log _2(1+\gamma _{s1}^\mathrm{DF}+\gamma _{s2}^\mathrm{DF}+\gamma _{s1}^\mathrm{DF}\gamma _{s2}^\mathrm{DF})). \end{aligned}$$
(45)

The outage probability at node s1 and s2 is given by

$$\begin{aligned} Pout_{si}^\mathrm{DF}= Pr\{R_{si}^\mathrm{DF} < R_{\mathrm{th}}\},i=1,2 \end{aligned}$$
(46)

The sum outage probability is

$$\begin{aligned} P_{\mathrm{out}}^\mathrm{DF}= Pout_{s1}^\mathrm{DF}+ Pout_{s2}^\mathrm{DF}, \end{aligned}$$
(47)

From (45), we can observe that maximizing \(R_{d}^\mathrm{DF}\) under constraint (35) can be achieved by simply optimizing the variable \(\alpha _i\).

3 Joint PS factor optimization

In this paper, we consider the sum-rate maximization for the PS factor optimization problem.

3.1 AF relaying

By substituting \(R_1^\mathrm{AF}\) and \(R_2^\mathrm{AF}\) in (18) and (19), we have

$$\begin{aligned} R^\mathrm{AF}&=\dfrac{1}{2}(\log _2(1+\dfrac{P_0(\sum _{i=1}^M\sqrt{1-\alpha _i} |f_i h_i|)^2}{\sum _{i=1}^M(1-\alpha _i)\left( \sigma _A^2+\dfrac{\sigma _P^2}{\alpha _i}\right) |f_i|^2 + \dfrac{\sigma _{D1}^2}{\xi }})) \\&\quad+\dfrac{1}{2}\left(\log _2\left(1+\dfrac{P_0(\sum _{i=1}^M\sqrt{1-\alpha _i} |f_i h_i|)^2}{\sum _{i=1}^M(1-\alpha _i)\left( \sigma _A^2+\dfrac{\sigma _P^2}{\alpha _i}\right) |h_i|^2 + \dfrac{\sigma _{D2}^2}{\xi }}\right)\right). \end{aligned}$$
(48)

Our objective is to maximize \(R^\mathrm{AF}\) given by

$$\begin{aligned} \underset{\varvec{\alpha _i}}{\text {maximize}} \quad&R^\mathrm{AF} \\ \text {subject to} \quad&0<\alpha _{i} <1, \\&i=1, 2,\cdots , M, \end{aligned}$$
(49)

However, we cannot derive the closed form of \(R^\mathrm{AF}\). Because \(\log _2()\) is the monotonic increasing function, the gradient descent algorithm can be used to solve the optimization problem. We need to change the maximal problem to the minimal problem and change the constrained problem to an unconstrained problem. Our objective can be reformulated as

$$\begin{aligned} \underset{\varvec{\alpha _i}}{\text {minimize}} \quad&R_{\mathrm{min}}^\mathrm{AF} \\ \text {subject to} \quad&0<\alpha _{i} <1, \\&i=1, 2,\cdots , M, \end{aligned}$$
(50)

where \(R_{\mathrm{min}}^\mathrm{AF}\) is the minus of \(R^\mathrm{AF}\).

$$\begin{aligned} R_{\mathrm{min}}^\mathrm{AF}&=-\dfrac{1}{2}(\log _2(1+\dfrac{P_0(\sum _{i=1}^M\sqrt{1-\alpha _i} |f_i h_i|)^2}{\sum _{i=1}^M(1-\alpha _i)|f_i|^2\left( \sigma _A^2+\dfrac{\sigma _P^2}{\alpha _i}\right) + \dfrac{\sigma _{D1}^2}{\xi }})) \\&\quad-\dfrac{1}{2}(\log _2(1+\dfrac{P_0(\sum _{i=1}^M \sqrt{1-\alpha _i} |f_i h_i|)^2}{\sum _{i=1}^M(1-\alpha _i)|h_i|^2\left( \sigma _A^2+\dfrac{\sigma _P^2}{\alpha _i}\right) + \dfrac{\sigma _{D2}^2}{\xi }})). \end{aligned}$$
(51)

where \(\alpha _{i} \in (0,1)\). As well known, gradient descent method is one of the efficient methods to solve unconstrained optimization problem, and we can transform the constrained problem into an unconstrained problem. \(\alpha _{i}\) is the only constrained condition. In order to solve the optimization problem easily, we use the following variable substitution to transform constrained problem about \(\alpha _{i}\) into an unconstrained problem.

$$\begin{aligned} \alpha _{i}=\frac{e^{x_i}}{1+e^{x_i}}, \end{aligned}$$
(52)

where \(x \in [-\infty ,\infty ]\). Gradient descent method is one of the efficient methods to solve unconstrained optimization problem, which always converges to a local minimum point. By multiple random initialization, an optimal value from several local minimum point can be chosen and can be considered as global minimum point. Since it is difficult to get the gradient of \(R_{\min }^{A F}(x)\), the secant method is used as the approximate of gradient.

$$\begin{aligned} <\nabla R_{\min }^{A F}(x),\delta >=\frac{\left. R_{\min }^{A F}(x+\delta )\right) -R_{\min }^{A F}(x)}{\delta }, \end{aligned}$$
(53)

where \(\delta\) is a vector with a very small norm. We can choose \(\delta = 10^{-8}e_i\) to get \(\frac{\partial R_{\min }^{A F}(x)}{\partial x_i}\), where \(e_i\) is a vector whose i-th element is 1 and the others are all 0. For the required step size of each iteration, the initial step size is set as \(\lambda = 100\), which will be adjusted in each iteration.

figure a

3.2 DF relaying

Different from the AF relaying protocol, transmit signal under the DF relaying protocol will not suffer from the problem of noise propagation. For the DF mode, the sum rate of destination nodes can be evaluated and defined as

$$\begin{aligned} R^\mathrm{DF}=R_{d}^\mathrm{DF}, \end{aligned}$$
(54)

By substituting \(R_{d}^\mathrm{DF}\) in (45), \(R^\mathrm{DF}\) can be rewritten as

$$\begin{aligned} R^\mathrm{DF}&=\dfrac{1}{2}\log _2(1+\dfrac{P_0(\sum _{i=1}^M\sqrt{1-\alpha _i}|f_i|\sqrt{|f_i|^2+|h_i|^2})^2}{\dfrac{N_0}{\xi }})\\ &\quad+\dfrac{1}{2}\log _2(1+\dfrac{P_0(\sum _{i=1}^M\sqrt{1-\alpha _i}|h_i|\sqrt{|f_i|^2+|h_i|^2})^2}{\dfrac{N_0}{\xi }}). \end{aligned}$$
(55)

Our goal is to find the PS factor to maximize the sum rate, which is obviously equivalent to maximizing \(R^\mathrm{DF}\). We find that the \(\log _2()\) is a monotonic increasing function, the term on the right-hand of (55) is quasi-convex, and when the value of \(\alpha _i\) is small, we can get the maximum \(R^\mathrm{DF}\). Based on (35), the optimal PS ratios and the sum rate can be determined when \(\alpha _i =\dfrac{r_{\mathrm{th}} N_0}{P_0}max\left\{ \dfrac{1}{|f_i|^2},\dfrac{1}{|h_i|^2}\right\} .\)

4 Results and discussion

We present numerical simulations to verify the performance of our proposed two-way relaying beamforming scheme. The number of relay nodes is 2–8, and the channel coefficients are assumed to be independent and reciprocal variables. The additive noise is assumed to be unit variance and power spectral density to be − 174 dbm/Hz. The bandwidth is assumed as 10 mHz, the energy efficiency is 80%, and the SNR outage threshold is 5 db.

4.1 Sum-rate maximization

The results are presented in Fig. 4. We first consider the AF relaying network with 2, 4, 6, 8 relay nodes and compare the sum rate, and the transmit SNR is 5–25 db. It is obvious that the sum rate is higher when more relays are used. As the number of relay nodes increases, two-way beamforming systems harvest more energy and extend the relay lifetime and improve the performance.

The convergence results of the gradient descent algorithm for AF mode are depicted in Figs. 5 and 6. With enough iteration steps, even if the initial points are different, the sum rate always converges to the same stationary point, and the norm of gradient always converges to zero. Therefore, the local minimum point obtained by the gradient descent algorithm can almost surely be regarded as the global minimum point.

Then, we consider the DF relaying network also with 2, 4, 6, 8 relay nodes and compare the sum rate at destinations with our proposed PS factor optimization method. The results are shown in Fig. 7. As can be observed, with more transmit power and relay nodes, the sum rate will increase.

Then, we compare the sum rate of different cooperative schemes with varying SNR at sources, while the number of relay nodes is set 6. As shown in Fig. 8, it includes greedy general relay selection (SW-GRS) [33], one-way AF relaying (SW-AF) [33], one-way DF relaying (SW-DF) and our proposed two-way AF relaying (TWB-AF) and two-way DF relaying (TWB-DF). It is seen that our proposed two-way relaying network scheme is better than one-way scheme both in AF and DF mode. Working in two-way DF mode can get higher rate than working in AF mode.

We also compare the sum rate of different cooperative schemes with varying number of relays with the same source transmit SNR 25 db. The results are shown in Fig. 9. With the same transmit SNR, the performance between TWB-AF and TWB-DF is different. The sum rate of TWB-DF scheme is higher than that of TWB-AF scheme. As we assume that the relays can decode the received signal without error in DF mode, we only need to harvest more energy in DF mode, and the sum rate at destinations is just considered.

4.2 Outage probability performance

The sum outage probability performance among different transmit SNRs and relays in TWB-AF scheme is presented in Fig. 10. It is obtained by Monte Carlo simulation. We can see that the outage probability is lower when the number of relays is more and transmit power is higher, and it is consistent with the sum-rate curve.

In Fig. 11, the sum outage probability performance among different SNRs with different relays is presented for TWB-DF scheme by Monte Carlo simulation. When the number of relay nodes is more than 6, and SNR is more than 15 db, it is close to 0. We can see that the outage probability is lower when the number of relays and transmit power increase, and it is in accordance with the sum-rate curve of TWB-DF.

4.3 Optimal PS factor

According to the results as shown in Table 1, we find that in AF mode the optimal PS factor is about 0.68. It means more of the received signal at relay nodes is used to information processing. In DF mode as shown in Table 2, the optimal PS factor is small. It means that the received signal at relay side is mainly used for energy harvesting. That is because we assume that the relay nodes can decode and encode signal without error and can only maximize the sum rate at destinations.

5 Conclusions

In this paper, we investigate the AF and DF two-way network beamforming EH relaying networks. For effective network beamforming by the EH relays, we propose to use the gradient descent algorithm in AF mode and use the smallest PS factor at relays under the SNR threshold for DF mode to enable an efficient solution. It is seen that the performance gain is significant with more relays and higher transmit SNR.

6 Methods

Our system includes two transceiver nodes and multiple relay nodes. All nodes are equipped with a single antenna. Two transceiver nodes are not directly connected. It works under the AF or DF protocol with half duplex over fading channels. The power of all the relays is totally coming from energy harvesting. Two to eight relay nodes are analyzed, and the channel coefficients are independent and reciprocal variables. The bandwidth is assumed as 10 mHz, the energy efficiency is 80%, and the SNR outage threshold is 5 db. The performance analysis is shown in the form of sum-rate maximization and outage probability performance.

6.1 Sum-rate maximization

The sum-rate maximization is used for joint PS factor optimization problem. Because we cannot derive the closed form of the sum rate, we use the gradient descent algorithm to solve the problem in AF mode and obtain the optimal PS factor when the PS factor is the smallest at relays under the SNR threshold in DF mode.

6.2 Outage probability performance

The sum outage probability performance among different SNRs with different relays is presented for TWB-AF and TWB-DF scheme by Monte Carlo simulation.

Fig. 1
figure 1

The EH relaying beamforming system. It is our system structure diagram

Fig. 2
figure 2

Relay working in AF mode. It is our proposed PS-based energy-harvesting relaying scheme in AF mode

Fig. 3
figure 3

The DF relaying mode. It is our proposed PS-based energy-harvesting relaying scheme in DF mode

Fig. 4
figure 4

Sum-rate curves in two-way AF mode. It is the sum-rate curve with different number of relays, and the transmit SNR is from 5 to 25 db in AF mode

Fig. 5
figure 5

Convergence curves in AF mode. It is the sum-rate convergence curves curve when the relay nodes are 8 and the transmit SNR is 25 db in AF mode

Fig. 6
figure 6

Norm of sum-rate gradient in AF mode. It is the sum-rate norm curves curve when the relay nodes are 8 and the transmit SNR is 25 db in AF mode

Fig. 7
figure 7

Sum-rate curves in DF relaying. It is the sum-rate curve with different number of relays, and the transmit SNR is from 5 to 25 db in DF mode

Fig. 8
figure 8

Sum-rate curves among schemes. It is the sum-rate curve with 6 relays, and the transmit SNR is 5–25 db, including SW-GRS, SW-AF, SW-DF, TWB-AF and TWB-DF

Fig. 9
figure 9

Sum-rate curves with transmit power 25 db. It compares the sum rate of different cooperative schemes with different number of relays, and source transmit SNR is 25 db

Fig. 10
figure 10

Sum outage probability curve in AF relaying. It depicts the sum outage probability curve among different transmit SNRs and relays in two-way AF mode

Fig. 11
figure 11

Sum outage probability curve in DF relaying. It depicts the sum outage probability curve among different transmit SNRs and relays in two-way DF mode

Table 1 The optimal PS factor in AF mode with 8 relays
Table 2 The optimal PS factor in DF mode with 4 relays