## 4 Node Activity Scheduling
### Cross Layering Optimization
#### 4.4.1 Cross-layering with the Application Layer  
The knowledge provided by the application layer can help SERENA to determine when the node can sleep. Indeed, we have designed a specific functioning mode for SERENA which targets data gathering applications. The idea is to determine a color assignment order such that no child is scheduled after its  
Figure 11: Average number of messages sent per node. Figure 10: Number of rounds used by SERENA for different network configurations. parent in an upstream communication. Thus, a node can aggregate data received from its children before transmitting them to its parent. Consequently, the delay needed by the sink to collect data from all sensor nodes is minimized. As mentioned in Section 4.2, a node selects the smallest color available in \(\mathcal{N}(N)\) higher than the color of its parent. Consequently:  
1. the first node to color itself is the root of the tree. 2. each node has a color strictly higher than the color of its parent in the tree. The choice of the color in a tree is such that all children of any node \(N\) transmit before \(N\) in case of data gathering, or after \(N\) in case of data dissemination. This contributes to considerably reduce the end-to-end delays. Indeed, in a single cycle, all data can be collected from the sensors and delivered to the sink, assuming data aggregation. Similarly, in a single cycle, data broadcast by the sink reach all network nodes. To achieve that, it suffices to schedule node transmission in the decreasing order of colors for data gathering and in the increasing order of colors for data dissemination. That is the role of the MAC layer. The MAC cycle illustrated in Figure 12 comprises an activity period followed by an inactivity period during which all nodes sleep. The activity period consists in the synchronization period and color slots. During a color slot, only nodes having this color are allowed to transmit data. We can also observe that with SERENA tree-coloring, there are two types of cycle: one favoring the downstream traffic (_i.e._ starting with color 0 of the sink) and the other favoring the upstream traffic (_i.e._ starting with the maximum color used in the network). The frequency of each cycle is determined by the application traffic. Figure 13 allows us to compare SERENA with TDMA-ASAP [36], when communications are done according to a tree. Hence, with SERENA the color of a node is higher than the color of its children. We consider various configurations: the node number ranges from 50 to 200 with a network density of 10. We evaluate three variants of SERENA depending on application requirements:  
* with immediate acknowledgement and without broadcast,
* with immediate acknowledgement and with broadcast. Figure 12: MAC cycle. This allows us to quantify the cost in additional colors induced by the immediate acknowledgement and the broadcast. The cost of the immediate acknowledgement is higher than the cost of broadcast. For example, in a network with 100 nodes and a density of 10, 8 additional colors are needed for the immediate acknowledgement and only 3 for the broadcast. It follows that for a density 10, the support of immediate acknowledgement costs about 35% of additional colors, whereas the support of broadcast costs less than 10% of additional colors; this is true for 100 nodes as well as 200 nodes. TDMA-ASAP colors the tree, level by level, starting with the farthest level from the sink (_i.e._, the reverse of SERENA). A node receives a color strictly higher than the color of its parent. Two nodes having the same parent do not share the same color. Moreover, a node that is neighbor of the parent of another node does not share its color. With these coloring rules, TDMA-ASAP uses a number of colors smaller than the two variants of SERENA with immediate acknowledgement. That is because TDMA-ASAP does not support immediate acknowledgement.