# A Cross-Layer Media Access Control Protocol for WBANs
## 4 The Proposed Cross-Layer MAC Protocol
### Point-to-Point Cooperative Relay  
Through transmission power adjustment, sensors can select appropriate powers to upload packets instead of using a fixed maximum power, thereby effectively prolonging their lifetime. However, it can be observed that different sensors choose different transmission powers based on their requirements, resulting in varying rates of energy consumption. Over time, this leads to an uneven distribution of energy in the network, with nodes that have high energy consumption rates dying first, which severely impacts network functionality. Meanwhile, nodes with low energy consumption may still have sufficient energy reserves. Therefore, a potential solution is to utilize sensors with sufficient energy as relays for other nodes, reducing the energy consumption rates of nodes with low battery levels and further extending the overall network lifetime. Taking Figure 4 as an example, let us consider three deployed sensors responsible for collecting health data. Initially, all sensors are fully charged, as shown in Figure 4a. However, due to its relatively farther distance from the coordinator compared to \(n_{2}\) and \(n_{3}\), sensor \(n_{1}\) requires a higher base transmission power \(P_{1}^{*}\) to ensure energy efficiency and data reliability, resulting in a higher energy consumption rate. Consequently, the residual energy of \(n_{1}\) will decrease faster over time compared to the other sensors. To prolong the lifetime of \(n_{1}\), the coordinator continuously evaluates the network and assigns a point-to-point relay to assist \(n_{1}\)'s transmissions. In Figure 4b, \(n_{2}\) is designated as the partner relay for \(n_{1}\). This enables \(n_{1}\) to transmit its data to \(n_{2}\) using a lower transmission power. The updated base transmission power for \(n_{1}\) is calculated similarly as described in Section 4.1. The coordinator adjusts the slot assignment strategy to ensure that \(n_{1}\) uploads its packet before \(n_{2}\) during the CFP. Consequently, during the assigned time slot, \(n_{2}\) transitions to a listening state to receive the data sent by \(n_{1}\). However, as \(n_{2}\) also acts as a relay for \(n_{1}\) in addition to uploading its own data, it consumes more energy. If there are additional potential relay nodes available, the coordinator can dynamically adjust the cooperation strategy based on the network conditions. As depicted in Figure 4c, sensor \(n_{3}\) is assigned as a new relay for \(n_{1}\), effectively utilizing the residual energy of \(n_{3}\) to further prolong the lifetime of \(n_{1}\). This cooperative relay approach contributes to an extended network lifetime overall. To evaluate the network condition, the coordinator needs to monitor the lifetimes of all the sensors. Since the amount of periodic data is much greater than that of other data categories, the lifetime is primarily calculated based on the energy consumed by sending periodic data. The lifetime of a remote sensor \(n_{i}\) without relay assistance can be calculated as follows:  
\[T_{i}=\frac{E_{i}R}{P_{i}^{*}L_{i}}. \tag{11}\]  
where \(E_{i}\) denotes the residual energy of sensor \(n_{i}\), \(L_{i}\) means the length of packets uploaded by \(n_{i}\), and \(R\) is the transmission rate. Considering the situation when a relay \(n_{j}\) is assigned to assist \(n_{i}\), lifetime of \(n_{j}\) will be  
\[T_{j}=\frac{E_{j}R}{P_{j}^{*}(L_{i}+L_{j}+\sum_{k\in H}L_{k})+P_{r}(L_{i}+\sum_ {k\in H}L_{k})}, \tag{12}\]  
where \(P_{r}\) means the receiving power and \(H\) is the set of sensors already assigned to \(n_{j}\) as the relay node. The updated lifetime of \(n_{i}\) when sending data to \(n_{j}\) using power \(P_{ij}\) is  
\[T_{ij}=\frac{E_{i}R}{P_{ij}^{*}L_{i}}. \tag{13}\]  
If both \(T_{ij}\) and \(T_{j}\) are bigger than \(T_{i}\), sensor \(n_{j}\) will be a potential relay for \(n_{i}\). Assume that the set of potential relays of \(n_{i}\) is \(G_{i}\), and the number of these potential relays is \(u_{i}\). Then, the coordinator will not assign a relay for \(n_{i}\) if \(u_{i}=0\).