## 5 WSN Application Design
### End-to-End Latency
In this work a 1% duty cycle is used, which does not jeopardize power consumption, and having a sleep time for the radio of 0.99 seconds, the maximum delay is not excessive. On the other hand, the drawback of using CSMA is that packet collisions among nodes trying to transmit may occur. This makes the delay unpredictable since competition for accessing the medium in case of collisions would prevent from forwarding all packets within a single active period, thus prolonging the waiting time during additional sleep periods. A possible solution to this problem would be limiting the number of nodes capable of transmitting packets, _i.e._, imposing that within a certain area only one node is able to generate new packets to transmit, while the remaining nodes are devoted to packet forwarding, thus avoiding collisions. In this context there are proposals such as [65], where only a master node is allowed to generate queries to subsequent nodes. In that work, the master node makes successive queries directed to each of the nodes arranged in a string pattern and then waits for a response. It is however more reasonable, for most applications, to query all nodes at once by forwarding a single query packet since it achieves much smaller delays. In opposition to CSMA, TDMA-based MAC protocols guarantee that only one node can access to the channel at a time. In them, time is divided into periodic frames, and frames, in turn, into time slots. During the duration of a time slot only one of the nodes that share the medium is allowed to transmit. Similarly, destination nodes must be in the reception mode only during that slot. Planning the slot assignment among nodes is one of the issues when deploying TDMA networks. However, in the case of road-oriented ITS applications, this task is simplified, given the small number of neighbors per node. On the other hand, because TDMA-based protocols are collision-free, their use leads to more predictable delays than CSMA since the access to the medium is guaranteed (the only uncertainty is due to transmission errors which may imply retransmissions or result in information losses). The expected delay, despite the fact that it can be calculated a priori, depends on the final assignment of slots to nodes, and it may lead to longer delays than CSMA if it is not properly done. A simple method of assigning time slots which optimizes information delivery time in one direction is presented in [12], which allocates consecutive transmission slots to neighbor nodes. In this way, whenever a query packet is transmitted by a node, its subsequent neighbor will forward it in the next time slot of the same frame, thus achieving very fast data dissemination. This technique has however no effects on applications with two-way communication delay. In these the replies may suffer a long delay, corresponding to the length of a whole frame minus one time slot, since any packet to be retransmitted should wait for the time slot assigned to the neighbor node in the next frame; therefore all the time savings done in the forward direction are lost in the backward direction. As a consequence, the authors propose the use of VANETs when possible for the dissemination of warning messages in the backward direction. An additional concern related to TDMA MAC in applications with two-way communications is that nodes are required to stay in the reception mode twice as much as with one-way propagation, thus increasing power consumption. This is due to the fact that nodes need to receive messages from preceding nodes in both directions. It should be noted that in CSMA, for the same situation, while the active time of the nodes does not increase, the probability of collisions does. Nevertheless, if nodes increase the duration of the active state after receiving query packets as proposed in [11], the system can handle more easily this problem.