# Towards Efficient Wireless Body Area Network Using Two-Way Relay Cooperation
## 5 Hybrid Cooperative Scheme for Energy Efficient WBAN
for\(z=1:length(L)\)do for\(i=1:length(d_{in})\)do if\(d_{in}(i)\leq 18\)then  Use direct link for data transmission if\((18<d_{in}(i)<36\) & \(L\leq 500)\) \(\parallel(18<d_{in}(i)<35\) & \(500<L<1500)\) \(\parallel(18<d_{in}(i)<34\) & \(L\geq 1500)\)then  Use two-way relay link for data transmission if\((d_{in}(i)\geq 36\) & \(L\leq 500)\) \(\parallel(d_{in}(i)\geq 35\) & \(500<L<1500)\) \(\parallel(d_{in}(i)\geq 34\) & \(L\geq 1500)\)then  Use one-way relay link for data transmission  end if endfor for\(j=1:length(d_{\text{LOS}})\)do if\((d_{\text{LOS}}(j)\leq 150\) & \(L\leq 500)\) \(\parallel(d_{\text{LOS}}(j)\leq 140\) & \(L>500)\)then  Use direct link for data transmission if\((150<d_{\text{LOS}}(j)\leq 290\) & \(L\leq 500)\) \(\parallel(150<d_{\text{LOS}}(j)\leq 280\) & \(500<L<1500)\) \(\parallel(150<d_{\text{LOS}}(j)\leq 270\) & \(L\geq 1500)\)then  Use two-way relay link for data transmission if\((d_{\text{LOS}}(j)>290\) & \(L\leq 500)\) \(\parallel(d_{\text{LOS}}(j)>280\) & \(500<L<1500)\) \(\parallel(d_{\text{LOS}}(j)>270\) & \(L\geq 1500)\)then  Use one-way relay link for data transmission  end if endfor for\(k=1:length(d_{NL})\)do if\(d_{NL}(k)\leq 25\)then  Use direct link for data transmission if\((25<d_{NL}(k)<51\) & \(L<1500)\) \(\parallel(25<d_{NL}(k)<50\) & \(L\geq 1500)\)then  Use two-way relay link for data transmission  end if end if endfor endfor
```  
**Algorithm 1** Hybrid cooperative scheme  
We use two-way relay link for data transmission if\((d_{\text{LOS}}(j)\leq 290\) & \(L\leq 500)\) \(\parallel(150<d_{\text{LOS}}(j)\leq 280\) & \(500<L<1500)\) \(\parallel(150<d_{\text{LOS}}(j)\leq 270\) & \(L\geq 1500)\)then  Use two-way relay link for data transmission if\((d_{\text{LOS}}(j)>290\) & \(L\leq 500)\) \(\parallel(d_{\text{LOS}}(j)>280\) & \(500<L<1500)\) \(\parallel(d_{\text{LOS}}(j)>270\) & \(L\geq 1500)\)then  Use one-way relay link for data transmission  end if endforThe impact of variable packet sizes over different link lengths is further elaborated by exhibiting energy efficiency against variable packet sizes for different link lengths. The illustration of in-body communication link in Figure 10 shows that if the link length is 17 cm or less, the direct transmission would provide maximum EE for any permissible packet size. For a link length between 18 and 32 cm, two-way relay transmission gives maximum EE for any number of bits in the packet. After 32 cm, the two-way relay link performs better for 2000 bits packet, which decreases to 1100 bits for 34 cm and so on. Packets with a greater number of bits move more efficiently using a one-way relay link. The impact of the proposed scheme on in-body LOS communication is clear from Figure 11a. The direct link provides maximum EE for source-destination length of 142 cm and less, for any number of bits in a packet. If the length between source and destination node is 145 cm, a direct link performs better up to a packet size of 1600 bits, after which two-way relay transmission gives maximum efficiency. Increasing the link distance would decrease the packet size for energy efficient direct transmission until it fully lacks behind two-way relay transmission at 153 cm. From 153 to 265 cm, two-way relay  
Figure 8: Energy efficiency over distance for proposed scheme (in-body communication). Figure 9: Energy efficiency over distance for proposed scheme (on-body communication). (**a**) energy efficiency over distance for proposed scheme (on-body LOS communication); (**b**) energy efficiency over distance for the proposed scheme (on-body NLOS communication). link performs well over a range of packet sizes. At about 266 cm, two-way relay communication starts to perform poorly for larger packets. At about 275 cm, it works well up to 1600 bits packet, which further deteriorates with increased link length and one-way relay performs better for larger packets. The illustration of on-body NLOS link in Figure 11b shows that if the link length is 25 cm or less, the direct transmission would provide maximum EE for any permissible packet size.