• 沒有找到結果。

Slot assignment algorithm

在文檔中 在 TinyOS 上實現 TDMA 機制 (頁 32-36)

4. System Architecture to Realize TDMA

4.3 Slot assignment algorithm

4.3.1. Overview

In control phase, each mote can get its own slot number through slot assignment algorithm. We use node ID, request packets and grant packets to do slot assignment.

Every node will maintain one-hop and mixed-hop neighbor link lists which include neighbor’s information such as node ID, node slot number and so on.

The main procedures of slot assignment algorithm as following:

z Mote X will collect its entire one-hop and two-hop neighbor’s information then build up one-hop and mix-hop neighbor link lists.

z According to mixed-hop neighbor link list, mote X will send slot request packets to all of its one-hop and two-hop neighbors.

z When mote Y received slot request packet from mote X.

„ If mote Y does not get its slot number yet and Y.id < X.id then mote Y will reply slot grant packet to mote X.

„ Otherwise, mote Y will do nothing.

z Once mote X receives all grant packets from its one-hop and two-hop neighbors then mote X will select one slot number which is not used by its one-hop and

two-hop neighbors.

z Mote X will send slot number grant packet to its one-hop and two-hop neighbors with selected slot number.

z Mote X will send packet to sink with selected slot number.

z Sink receives all of these packets from system nodes and calculates slot cycle length.

z Finally, sink will broadcast packets with slot cycle length information.

4.3.2. Implementation detail

Each node will maintain one-hop and two-hop neighbor information. Because the numbers of neighbors are uncertain so we create two link lists. One-hop neighbor link list contains node’s one-hop neighbor node id. The link list will be used by other nodes to build up mixed-hop neighbor link list. Mixed-hop neighbor link list contains node’s one hop and two hop neighbor node id and slot number. Slot assignment algorithm will use above information to calculate system nodes slot number. These two link lists are shown in Figure 4-5.

Figure 4-5. (a) One-hop neighbor link list (b) Mixed-hop neighbor link list

In this section, there are several different packet types and we list some packet types as shown in Table 4-1. The following steps show how the slot assignment works.

Packet Type Description

One hop request packet Request for node’s one-hop neighbor.

One hop reply packet

One-hop neighbor replies to request node with node id.

One hop information packet

Node broadcasts all of its one-hop neighbors node id.

Slot request packet Request for one / two-hop grant packet.

Slot grant packet Reply to request node with grant information.

Slot number grant packet

Node informs its one and two hop neighbor with selected slot number.

Slot number sink packet

Node informs sink with selected slot number.

Table 4-1. Several packet types in slot assignment

First, node X will broadcast one hop request packets with node id. All of node X’s one hop neighbor nodes will receive these request packets then send one hop reply packets to node X. Node X will build up one-hop neighbor link list by these one hop reply packets. By the same way, node X’s one-hop neighbors also build up their one-hop neighbor link list.

Second, node X will broadcast one hop information packets which contains all of its one-hop neighbor nodes id and local node id. When node Y received these packets, it will know the entire two hop nodes id. By the same way, node X also knows the entire two hop nodes id. Node X will receive many one hop information packets from its one hop neighbors and it will filter out the redundant packets then build up the mixed hop neighbor link list.

Third, node X refers its mixed hop neighbor link list and sends slot request packets to its one hop and two hop neighbors with local node id. According to slot assignment algorithm (section 4.3.1), node X’s neighbors will send slot grant packets to node X when its nodes id are small than node X’s id.

Fourth, node X received slot grant packets and it will check all of the neighbor’s

grant packets are ready or not. After all of the grant packets are received, node X will select one slot number different than its neighbors. Node X will send slot number grant packets to its entire one hop and two hop neighbors. These nodes will modify their mixed hop neighbor link list.

Fifth, node X will send slot number sink packet to sink. Sink will calculate total slot cycle length and broadcast slot cycle length information.

According to slot assignment algorithm (section 4.3.1), node with largest id will collect the entire one hop and two hop neighbor’s grant packets earlier than the other nodes. So the node with largest id will select its slot number first the smallest id node will select its slot number at the end.

One example is shown in Figure 4-6. This example explains how to build up mixed hop neighbor link list.

z Node 1: One hop neighbor link list: {2, 3, 5}

Node 2: One hop neighbor link list: {1, 3, 4}

z Node 1: Broadcast one hop information packet: {1, 2, 3, 5}

Node 2: Broadcast one hop information packet: {2, 1, 3, 4}

z Node 1: Received one hop information packet from node 2.

Builds up mixed neighbor link list: {2, 3, 4, 5}

Node 2: Received one hop information packet from node 1.

Builds up mixed neighbor link list: {1, 3, 4, 5}

z Node 1: Knows node 4 is two-hop neighbor now. Node 1 will send slot request packet to node 4 later.

Node 2: Knows node 5 is two-hop neighbor now. Node 2 will send slot request packet to node 5 later.

Figure 4-6. Build up mixed hop neighbor link list.

In the real environment, radio interference and packet loss can not be avoided, so something should be noticed:

z When mote X broadcasts one hop request packet and it receives over two one hop reply packets from mote Y. Mote X will add mote Y in one-hop neighbor link list.

z Mote X sends slot request packet to all of its one-hop and two-hop neighbors, when packet timeout happened it will send request packet again.

Reference to Figure 4.2, slot assignment algorithm uses all the components in “Transmit and Receive components”.

在文檔中 在 TinyOS 上實現 TDMA 機制 (頁 32-36)

相關文件