## 4 Simulation Evaluation
### Simulation Topology  
We use two types of topologies in our simulations: chain topology and random topology. Figure 6 shows the chain topology. All nodes are equally spaced in a straight line with a 200 meter interval between neighboring nodes. Node 0 sends packets to node \(n\) through a single CBR (constant bit rate) flow. The hop length of the chains varies from 1-24 hops. For S-MAC, RMAC and the basic P-MAC, the routes for data transmission are assigned manually.  
Figure 7 shows an example of the random topology, which consists of 200 sensor nodes and a sink node (not shown in the figure). The 200 sensor nodes are randomly distributed in a 2,000 \(\times\) 2,000 m\({}^{2}\) square area, and the sink node is located at the top-left corner of the square.  
\begin{table}
\begin{tabular}{|c|c|c|c|c|} \hline  & \(\boldsymbol{T_{SYNC}}\) & \(\boldsymbol{T_{DATA}}\) & \(\boldsymbol{T_{SLEEP}}\) & \(\boldsymbol{T_{cycle}}\) \\ \hline
**RMAC** & 55.2 ms & 168.0 ms & 3,520.8 ms & 3,744.0 ms \\ \hline
**S-MAC** & 55.2 ms & 104.0 ms & 2,511.2 ms & 2,670.4 ms \\ \hline  & \(\boldsymbol{T_{S/R}}\) & \(\mathit{sleep\_factor}\) & \(\boldsymbol{T_{SLEEP}}\) & \(\boldsymbol{T_{cycle}}\) \\ \hline
**Basic P-MAC** & 234.0 ms & 21 & 3,465.0 ms & 3,795.0 ms \\ \hline
**Full P-MAC** & 234.0 ms & 14 & 3,276.0 ms & 3,744.0 ms \\ \hline \end{tabular}
\end{table}
Table 3: Cycle Duration Parameters.  
Figure 6: Chain topology.  
Figure 7: Random topology with 200 sensor nodes in 2,000 \(\times\)2,000 m\({}^{2}\) area.  
The full P-MAC integrated with routing needn't consider the routing issue. For fairness, we propose a routing mechanism for S-MAC, RMAC and the basic P-MAC by modifying the _GDSA_ process in P-MAC, since it is not convenient to assign routes manually in the random topology. In the modified _GDSA_ process, each node maintains a routing table containing only one field to record its next-hop nodes' IDs. The process has the following steps:  
1. The sink node with its grade set to zero initiates this process by generating a GRADE message packet. The packet contains two fields denoted by \(G_{m}\) and \(ID_{ph}\). After setting \(ID_{ph}\) to its own ID and \(G_{m}\) to one, the sink node broadcasts this message.
2. Upon receiving a GRADE message, each node decides whether to update its routing table and/or rebroadcast the message, as shown in Algorithm 2. ```  
**Algorithm 2**The modified _GDSA_: processing the received GRADE message.  
Figure 8: The number of nodes in each grade in the random topology network.  
The completion of this process will result in one or more entries in the routing table of each node. During data transmission, the current node randomly chooses one entry and extracts the ID from the entry as the next-hop ID. Also, each node maintains a grade representing the path length from it to the sink. Figure 8 shows the number of nodes in each grade.  
In addition, we make the following assumptions. For S-MAC and RMAC, all nodes have already been synchronized to use a single schedule. There is no synchronization traffic during the simulation, but the SYNC period is still contained in the cycle. The original or modified GDSA process is executed only once during the initial phase and the corresponding overhead is not considered during the comparison among S-MAC, RMAC and P-MAC.