# An Efficient SS-MAC Protocol for IEEE 802.15.4-Based WSNs of Cluster Tree Topology
## 4 Modeling Analysis
### Average Packet Waiting Time Analysis  
The behavior of the tree nodes and their member nodes at any two adjacent levels in a session is shown in Figure 7.  
Each member node goes through four periods: vacation, CP, CAP and DCP. The duration of each period is fixed and cycled sequentially. It sends data packets to its CH only in DCP (a small segment of DCP). The packet of a member node can be generated at any period; if we define packet generation as packet arrival, the packet arrival process can be divided into the following two cases:  
1. Packet arrives during CP. CP consists of control slots allocated to member nodes to reserve data slots. If packet \(l\) of member node \(i\) arrives before the start of its slot in CP, packet \(l\) can complete the reservation in this CP and complete transmission in the upcoming DCP, as moment 1, shown in Figure 8--the packet waiting time is \(T_{cp1}\); if packet \(l\) arrives after the start of its slot in CP, as moment 2, the node \(i\) will complete reservation in the next CP, and the packet waiting time will increase significantly to \(T_{cp2}\). 2. Packet arrives outside CP. Node \(i\) needs to reserve slot for sending packet \(l\) in the next CP and sends it in the subsequent DCP. Figure 9 shows the scenarios when packet \(l\) arrives at CAP, DCP and vacation. The packet waiting times are \(T_{c2}\), \(T_{d2}\) and \(T_{v2}\), respectively.  
Figure 8: Packet arrives during CP.  
Figure 7: Behavior of nodes in adjacent levels.  
The probability of packet arrival in one of four periods is related to the duration proportion of the period. The conditional probability that packet \(l\) of node \(i\) arrives before (or after) its control slot in CP is approximately 0.5. For a packet \(l\) of any member node \(i\), the average waiting time can be calculated as:  
\[\bar{W}=E[w]=\sum_{k=1}^{5}\bar{w}_{k}P_{k}\]  
where \(E[w]\) is the expectation of the waiting time of packet \(l\), \(\bar{w}_{k}\) is the mean of the waiting time when packet \(l\) arrives in period \(k\), \(P_{k}\) is the probability that packet \(l\) arrives in period \(k\). \(k=1\) (or 2) indicates that packet \(l\) arrives before (or after) its control slot in CP; \(k=3\), 4 and 5 indicate that packet \(l\) arrives in CAP, DCP and vacation, respectively. \(E[w]\) can be further expressed as:  
\[\bar{W}=E[w]=\sum_{k=1}^{5}\bar{w}_{k}P_{k}.\]  
\[=\bar{w}_{1}P\{\text{Packet $l$ arrives in CP}\}\cdot P\{\text{Arrives before its control slot $|$ Packet $l$ arrives in CP}\}\]  
\[+\bar{w}_{2}P\{\text{Packet $l$ arrives in CP}\}\cdot P\{\text{Arrives after its control slot $|$ Packet $l$ arrives in CP}\}\]  
\[+\bar{w}_{3}P\{\text{Packet $l$ arrives in CAP}\}+\bar{w}_{4}P\{\text{Packet $l$ arrives in DCP}\}\]  
\[+\bar{w}_{5}P\{\text{Packet $l$ arrives in Vacation}\}\]  
\[=\frac{T_{cp}T_{cp1}}{2W_{s}}+\frac{T_{cp}T_{cp2}}{2W_{s}}+\frac{T_{ cap}T_{c2}}{W_{s}}+\frac{T_{dep}T_{d2}}{W_{s}}+\frac{T_{p}T_{v2}}{W_{s}} \tag{6}\] \[=\frac{T_{cp}}{2W_{s}}(\frac{T_{cp}}{2}+T_{cap}+\frac{T_{dep}}{2 }+\frac{3T_{cp}}{2}+2T_{cap}+\frac{3T_{dep}}{2}+T_{v})+\frac{T_{cap}}{W_{s}}( \frac{3T_{cap}}{2}+\frac{3T_{dep}}{2}+T_{v}+T_{cp})\]  
\[+\frac{T_{dep}}{W_{s}}(T_{dcp}+T_{v}+T_{cp}+T_{cap})+\frac{T_{v}}{W_{s}}( \frac{T_{v}}{2}+T_{cp}+T_{cap}+\frac{T_{dep}}{2})\]  
\[=W_{s}+\frac{W_{s}-T_{2}}{W_{s}}(\frac{T_{cap}}{2}-\frac{T_{v}}{2})+\frac{T_{ cap}}{W_{s}}(\frac{T_{2}}{2}-\frac{T_{v}}{2})-\frac{T_{v}}{W_{s}}(\frac{T_{2}}{2}- \frac{T_{cap}}{2})=W_{s}+\frac{T_{cap}}{2}-\frac{T_{v}}{2}\]  
The result of expression (6) shows that the average packet waiting time of the member nodes is related to the session duration \(W_{s}\) and the proportion of each period. Generally, \(T_{cap}\ll T_{v}\), so \(\bar{W}\approx W_{s}-\frac{T_{v}}{2}<W_{s}\); that is, the average packet waiting time is less than the session duration. It also suggests that methods to reduce the average packet waiting time are shortening the session duration, and reducing the proportion of CP, CAP and DCP to increase the proportion of vacation (low duty-cycle technique).