1.3 Thesis Structure
2.2.1 D ESYNC TDMA Algorithm and Implementation Description
Similarly to the case of the SYNC algorithm, our description is separated into two
parts, before and after convergence to TDMA is achieved. Before convergence to TDMA is achieved, each node adjusts its phase and also updates its fire time. After convergence is obtained, every node in the network transmits fire messages periodically, i.e. in the steady state. During this stage, nodes can transmit data messages.
2.2.1.1
Operation of D
ESYNC-TDMA during the convergence period
In DESYNC, each node ݊(1 ≤ ݅≤ ܹ ) picks a particular time instant ݐin which tobroadcast its fire message based on the broadcasts of ݊ିଵand ݊ାଵ(where we set
݊ିଵ≡ ݊ௐ , ݐିଵ≡ ݐௐ and ݊ௐ ାଵ≡ ݊ଵ, ݐௐ ାଵ≡ ݐଵ). The determination of this time
instant is performed immediately after the node detects the fire message of ݊ାଵ, as
shown in Figure 2.13. Hence, ݊listens to all other nodes’ fire message broadcasts
and for the ݇th iteration (period) is set to fire according to the reactive listening primitive:
ݐ() = ܶ + (1 − ߙ)ݐ(ିଵ)+ ߙ௧షభ(ೖషభ)ା௧శభ(ೖషభ)
where ܶ is the desired TDMA period (in s) and ߙ ∈ (0,1) a parameter that scales how far ݊moves from its current fire time (at ݐ(ିଵ)) toward the desired midpoint.
As mentioned at the beginning of this chapter, ݐ()and ݐ(ିଵ) comprise the times when node ݊transmitted its fire message within the (݇)th and (݇− 1)th period
(respectively), while ݐିଵ(ିଵ) and ݐାଵ(ିଵ) comprise the times when node ݊received
fire messages from nodes ݊ିଵand ݊ାଵ(respectively) within the (݇ − 1)th period.
Previous work [8][15] showed that the reactive listening primitive of (2.1) leads to near-optimal TDMA behavior in SS for 1-hop networks after ݇ୱୱperiods, which
is expressed mathematically by: ቚݐ(౩౩)− ݐ
(౩౩ିଵ)− ܶቚ< ܾ୲୦୰ୣୱܶ (2.2)
Figure 2.13: Scheduling of the fire-message broadcast for node ݅.
with ܾ୲୦୰ୣୱܶ;ܾ୲୦୰ୣୱ߳[0.001,0.020] a preset threshold. In the steady-state, each
node transmits data packets for
ೈs immediately following its fire-message
broadcast. If a node joins or leaves the network, thereby leading to ܹ ᇱ≠ ܹ fire-
message broadcasts, the remaining nodes reconfigure their fire-message broadcasts to converge to a new TDMA state and then continue data transmission once (2.2) is satisfied. Once TDMA behavior is achieved, the only overhead stems from the fire-message broadcasts, which include the number of the broadcasting node. Assuming negligible propagation delay and error-free transmission of broadcasts, ݇ୱୱcan be found by iterating the system’s linear mapping matrix [8]
until (2.2) is satisfied. We provide further details on this issue in our contribution in the next chapter of this thesis.
The format of the fire message consists of the node ID and sequence number of the fire message as shown in Figure 2.14.
i t time to calculate reactive listening Period = T primitive of (2.1) Time (s) ti-1(k-1) ti(k-1)ti+1(k-1) (k)
...
Figure 2.14: Format of a fire message for DESYNCalgorithm.
Concerning implementation, as shown in Figure C.4 in Appendix C, the process begins with the node broadcasting its fire message every period via the event AlarmFired. When the node receives a fire message (FireMessage.Received), it will classify that fire time to be the next node (ݐାଵሺିଵሻ) or the last node before its own firing (ݐିଵሺିଵሻ) based on thejust_Fired status. If it is in the case of the next node’s fire time, the task CalculatedNextFireTime will be called and then the node will compute its own next fire time.
2.2.1.2
Operation of D
ESYNC-TDMA after the convergence is
achieved
Each node will start sending data after checking for convergence. While a node receives ݐାଵሺିଵሻ, it will check the time difference between ݐሺሻand ݐሺିଵሻas shown in Figure 2.15. If this difference is less than ܾ୲୦୰ୣୱ, the node will assume that DESYNC
has converged. After this point, the node will transmit data messages to a receiver node immediately after broadcasting its fire message. Those data messages are from the data in the flash memory of the TinyOS-based mote. When the node sends a data packet, it checks the remaining time of its TDMA slot. If the remaining time is less than the time_SendData_onePack, the node will stop sending data. Besides transmitting and receiving data, each node has to write the received data in flash memory. While the node is receiving data messages, it will keep them in received buffer. Once this node acquires a fire message from another node, it will write the buffered data to the flash memory immediately.
Figure 2.15: Local view of ݊ଵduring DESYNC-TDMA and including data transmission.
Node ID Fire Sequence No
2 bytes 2 bytes
ݐ1(݇−1) ݐଵ()
݊ଵ’s slot time ݊ଶ’s slot time ݊ଷ’s slot time
݊ଶ ݊ଷ
Data message
Time_SendData_OnePack Fire message
Figure 2.16: Format of a data message for DESYNCalgorithm.
Concerning the format of the data message (Figure 2.16), we changed the size of the data length for iMote2 to 28 bytes. This data message includes the mote ID, the message sequence number and the data, which were read from the flash memory of the sender node.
We check the state of convergence at the time of the calculation of ݐሺሻ. The check consists of examining the time difference between the node’s ݐሺሻand ݐሺିଵሻ. This time difference is compared to the period (ܶ s). Under TDMA, the time difference between consecutive firings should be nearly equal to the period; we set the acceptable difference threshold between the two to be ͲǤͲͳܶ in (2.2).
As shown in Figure C.5 in Appendix C, when the eventFireMessage.SendDone of a fire message happens, the node will check theset_converged status. If the node is in the converged state, it will establish the receiver ID and then send data to that node. Similar to the SYNCcase, the data is taken from the flash memory, starting at
address 0x0030 0000. Transmitting will continue by checking the time_SendData_onePack within a few milliseconds after the event DataMessage.SendDone of a data message. If the current time approaches the expected NextNode FireTime, ሺݐାଵሺିଵሻ ܶሻ, the node will stop sending data immediately.
Afterwards, when the event DataMessage.Received occurs, the node will start buffering the incoming data packets in the “received” buffer and, as mentioned, it will write the received buffer in the flash memory once the next fire message is received. We define the received buffer size to be 20 KB.