# A Power-Optimized Cooperative MAC Protocol for Lifetime Extension in Wireless Sensor Networks
## 5 Power-Optimized Cooperative MAC Protocol
### Cooperative Node Selection Phase
#### 5.2.1 Contention Access Delay of HTS Packet Transmission
The energy consumption of each data packet transmission cooperated by a single cooperative node \(\text{R}_{\text{i}}\) can be expressed as:  
\[E_{\text{PKT-R}_{\text{i}}}=\left(P_{\text{SR}_{\text{i}}}+P_{\text{R}_{\text{ i}}\text{D}}\right)\frac{L}{2 RB}, \tag{18}\]  
where \(P_{\text{SR}_{\text{i}}}\) need to satisfy Equation (3), and the transmission power \(P_{\text{R}\text{i}}\) of the cooperative node \(R_{\text{i}}\) needs to satisfy the following condition:  
\[R\leq\frac{1}{2}\text{log}_{2}\left(1+\frac{P_{\text{SR}_{\text{i}}}\parallel h _{\text{SD}}\parallel^{2}+P_{\text{R}_{\text{i}}\text{D}}\parallel h_{\text{ R}_{\text{i}}\text{D}}\parallel^{2}}{N_{0}}\right). \tag{19}\]  
Considering the constraint conditions of the channel gain \(h_{\text{SR}_{\text{i}}}\) and \(h_{\text{R}\text{i}\text{D}}\) in Equations (12), (13) and (16), to minimize \(E_{\text{PKT-Ri}}\) in Equation (18), \(P_{\text{SR}_{\text{i}}}\) and \(P_{\text{R}\text{i}\text{D}}\) should be set to the following value:  
\[P_{\text{SR}_{\text{i}}}=\frac{\left(2^{2R}-1\right)N_{0}}{\parallel h_{\text{ SR}_{\text{i}}}\parallel^{2}}, \tag{20}\]  
\[P_{\text{R}_{\text{i}}\text{D}}=\left(2^{2R}-1\right)N_{0}\frac{\parallel h_{ \text{SR}_{\text{i}}}\parallel^{2}-\parallel h_{\text{SD}}\parallel^{2}}{ \parallel h_{\text{R}_{\text{i}}\text{D}}\parallel^{2}\parallel h_{\text{ SR}_{\text{i}}}\parallel^{2}}. \tag{21}\]  
Substituting Equations (20) and (21) into Equation (18), we get:  
\[E_{\text{PKT-R}_{\text{i}}}=\left(2^{2R}-1\right)N_{0}\frac{(\parallel h_{ \text{SR}_{\text{i}}}\parallel^{2}+\parallel h_{\text{R}_{\text{i}}\text{D}} \parallel^{2}-\parallel h_{\text{SD}}\parallel^{2})L}{2\parallel h_{\text{R} _{\text{i}}\text{D}}\parallel^{2}\parallel h_{\text{SR}_{\text{i}}}\parallel^ {2}RB}. \tag{22}\]  
The above equation shows the minimum energy consumption of one data packet transmission cooperated by single cooperative node \(\text{R}_{\text{i}}\) through its cooperative link is \(E_{\text{PKT-R}_{\text{i}}}\). Its value is related to the channel gain between the cooperative node \(\text{R}_{\text{i}}\) and the corresponding sender/recipient. Namely, \(E_{\text{PKT-R}_{\text{i}}}\) represents the comprehensive channel quality of cooperative link. The smaller it is, the more energy efficientthis cooperative link is, i.e., the higher cooperative gain this cooperative node has to participate in the cooperative transmission, and thus the sooner the cooperative node should transmit its HTS packet to the sender to contend for cooperative transmission. For this reason, in the cooperative node selection phase, each node needs to wait a certain access delay \(t_{\text{Ri}}\) as follows:  
\[t_{\text{R}_{\text{i}}}=\frac{E_{\text{PKT-R}_{\text{i}}}}{2P_{\text{max}} \frac{L}{2 RB}}T_{\text{W}}, \tag{23}\]  
where \(T_{\text{W}}\) is the maximum waiting time allowed for cooperative nodes to contend to access the channel. Each cooperative node calculates its access delay \(t_{\text{R}_{\text{i}}}\) at the beginning of the contention and start to wait an interval of \(t_{\text{R}_{\text{i}}}\). At the same time, each cooperative node senses the channel. When it senses the HTS packet transmission from other nodes, it stops counting the access delay and continues as soon as the HTS packet transmission ends. When the counting of a node's access delay ends and the contention phase does not finish, the node transmits its HTS packet to the sender. As shown in Figure 2, if the access delays of all potential cooperative nodes in an order from small to large are \(t_{1}\), \(t_{2}\),..., \(t_{\text{i}}\),..., and \(t_{\text{M}}\), the first HTS packet is transmitted at \(t_{1}\) after the beginning of contention phase, and the second HTS packet is transmitted at \(t_{2}-t_{1}\) after the end of the first HTS packet transmission. In the same way, the \(M\)-th HTS packet is transmitted at \(t_{\text{M}}-t_{\text{M-1}}\) after the end of the \((M-1)\)-th HTS packet. This method can avoid the HTS packet collisions from different cooperative nodes.