# Energy Efficient Determinism in WSN through Reverse Packet Elimination
## 4 Reverse Packet Elimination
### Selecting Delays  
This section discusses delaying the replicated data packet. Clearly, this depends on the requirements imposed on the network by the system. For example, a WSN in a control loop must supply the controller with data within a time frame in order to keep the process stable. Assume the maximum permitted delay imposed on the network is \(T_{crit}\), where we have reduced the number to safeguard the system. The maximum delay \(T_{crit}\) is a design criterion for the delay between the source and the sink, \(T_{onepath}\). If the delay from source to sink meets the design criteria (\(T_{crit}\)), but with limited margin, the advantage of RPE is as described above. However, if there is a margin, for example, that the delay between source and sink permits that the replicated packet is delayed a time, \(\tau\), before it is transmitted then the second advantage of RPE comes to play. RPE provides energy savings and preserves the robustness when the replicated packet can be delayed a time \(\tau\) before it is transmitted. This means that if the first packet is lost, the replicated packet meets the deadline as it reaches the sink. In order to reduce the traffic, RPE enables the sink to cancel unnecessary transmission of the replication packets by sending RPE-cancelling packets. As pointed out earlier, this reduces the energy consumption in the WSN. In addition, it reduces the funneling effect caused by added data traffic imposed on the nodes close to the sink (the topic is presented in the following text). Next, we discuss the time delay, \(\tau\). Selected replication delays \(\tau\) are as follows: 1, 8, 816, 1624. As mentioned earlier \(\tau\) is always given in slots, and it is the delay from the time the first copy was sent. Our assessment of delaying the replication packet is based on three scenarios. Firstly, we assess the situation where both packets are transmitted without waiting for the cancelling packet. Secondly, we assess the situation where the delay is larger than the round-trip time from the source to the sink. This means that the replication packet is delayed so much that the first packet reaches the sink and the cancelling packet reaches back to the source. In our example, this equals eight slots. However, if the first packet experiences delay caused by retransmission, the second packet is transmitted. Delaying the replication packet further takes retransmission into account. Thirdly, we assess the situation where the replication packet is delayed to the extent that both the path A packet and the RPE-cancelling packet have exhausted all their retransmission attempts. When \(\tau=1\) slot, the source always sends two copies. This delay has the lowest latency (for both packets) since both packets have the shortest scheduled delay. Moreover, both packets traverse Path A and Path B towards the sink with a time difference of a slot as illustrated in Figure 6. As can be seen in the figure, the RPE-cancelling packet, from the sink towards the source, must wait for one slot. The reason is that according to the scheduler, the sink must first listen for incoming packets in the \(2\to 0\)-cell (Path B). If the replicated packet did not arrive, the next cell, marked as \(0\to 2\), is allocated to the RPE-cancelling packet. Clearly, switching these two cells is an option, saving one transmission from node 2, at the expense of increasing the delay along path B by one slot. The next delay is \(\tau=8\), Figure 7 depicts the scheduler. \(\tau=8\) slots are selected based on the number of hops between source and sink, since there are 4 hops to sink and 4 hops in return to the source. As can be seen, the Path B packet will not be sent if the Path A packet arrives successfully according to the scheduler, and the reverse path back to the source do likewise. When \(\tau=8\) slots, the Path A packet has enough time to reach the sink and trigger a message to stop the source from transmitting the replicated packet. If \(\tau>101\), the replicated packet is scheduled with a delay of at least one slotframe later.