# End to End Delay and Energy Consumption in a Two Tier Cluster Hierarchical Wireless Sensor Networks
## 4 Communication
### Slot Assignment for Intra-Cell and Inter-Cell Communications  
Perfect synchronization between all nodes of the WSN is assumed, although we discuss this assumption in Section 4.5. It means that each CH and its members are aware which sub-frame, CONT or TDMA, is really in progress. We identify the first (second) case as mode \(\mathcal{CONT}\) (mode \(\mathcal{TDMA}\)). Furthermore, all nodes must been able to identify the time slot that is currently running for contention -when a CH member is transmitting to its CH-, reception, sleeping or transmission, respectively denoted as mode \(\mathcal{C}\), and modes \(\mathcal{R}\), \(\mathcal{S}\) and \(\mathcal{T}\). For example, all nodes must be in mode \(\mathcal{R}\) during synchronization phase to receive external synchronization signals, not shown in Figure 3.  
Based on its cell coordinates \(\langle x,y\rangle_{*=h,p}\) and the cluster size \(N_{z}\) (\(z=Intra,Inter\)), each node is able to unambiguously derive the time slot \(T(x_{h},y_{h})\) it may use in the mode \(\mathcal{CONT}\) or in the mode \(\mathcal{TDMA}\), see Table 3. It is worth mentioning that for a given value pair \(\langle x,y\rangle_{*}\) several solutions can be envisaged. For example, for the pair \(\langle x,y\rangle_{h}=\langle 2,1\rangle_{h}\), in addition to the expression \([2x_{h}+1y_{h}]\) mod 7 shown in the table, we can also use \([5x_{h}+3y_{h}]\) mod 7, one assignment that turns out to be a rotation of the previous one. Then, during the TDMA sub-frame, all nodes are in mode \(\mathcal{TDMA}\) and for a given time slot all CHs will be in one of the three modes, \(\mathcal{R}\), \(\mathcal{S}\) or \(\mathcal{T}\) while all non-head nodes switch to mode \(\mathcal{S}\). In mode \(\mathcal{T}\), a CH located at ring \(r_{p}\) can transmit data packets to some other neighbor CHs located in the inner ring \(r_{p}-1\) while in mode \(\mathcal{R}\), the same CH can receive data packets from some other neighbor CHs located in the outer ring \(r_{p}+1\) (this is part of the routing algorithm that is described in the next section). In addition, vice versa, in the TDMA sub-frame, a CH cannot receive packets from other nodes while it is in mode \(\mathcal{T}\) neither transmit packets to other nodes while it is in mode \(\mathcal{R}\). See Figure 4 the details of which are explained later.  
During the CONT sub-frame, all nodes are in mode \(\mathcal{CONT}\). When a cluster receives the assignment of one time slot, all nodes except the CH will be in mode \(\mathcal{T}\) if they have sensed data to deliver or in mode \(\mathcal{S}\) otherwise, while the CH will be in mode \(\mathcal{R}\) to receive data from its CH members. CH members will send sensed information to its own CH according to the implemented RAP, FSA in our case. During the other time slots of the CONT sub-frame, all nodes of that cluster, including the CH, will remain in mode \(\mathcal{S}\). As for CH, when we consider the mode \(\mathcal{R}\) in the CONT sub-frame, i.e., receiving information from the members of its group, we will use the mode \(\mathcal{C}\) notation instead; just to avoid possible confusion with the mode \(\mathcal{R}\) in the TDMA sub-frame. In addition, we mention that any sensor could collect data from its own sensor panel at any time, regardless of which sub-frame is actually in progress and regardless of the mode, \(\mathcal{C}\), \(\mathcal{R}\), \(\mathcal{S}\) or \(\mathcal{T}\) functioning.  
Figure 4: Routing Probabilities for Load Balancing from Ring 4 to Ring 1 in Sector \(S_{1}\).