The link layer has two functionalities: channel scheduling and packet scheduling. The former is to control which channel the transceiver should stay on, and the latter is to schedule when a packet can be sent. The MAC part follows the IEEE 802.11 standard.
Our design will avoid the deafness problem [26] and the multi-channel hidden-terminal problem [27].
4.2.1 Superframe Structure
The time axis is divided into slots of a fixed length l. Slots are organized into super-frames. A slot may designated as a transmitting slot or a receiving slot. We will
deter-Figure 7: The superframe structure.
mine the channels to be used in slots of a superframe. Our channel assignment strategy is receiver-based. The structure of a superframe is shown in Figure 7. Superframes are loosely synchronized in time. Each superframe comprises 4t+1 slots, marked as s0, s1, ..., s4t, where t is an integer. Slot s0is a broadcast slot in which only beacons and broad-cast messages can be sent. Each broadbroad-cast slot is led by a beacon window, followed by a data window. Beacons also serve to synchronize stations’ clocks. To ensure network connectivity, all nodes should stay on a pre-defined common channel in slot s0. The remaining 4t slots are unicast slots, whose channels will be decided dynamically.
The receiver-based channel assignment helps two nodes to switch to the same channel for communication. Unicast slots are designnated as transmitting/receiving slots (refer to Section 4.2.2). A node will select a receiving channel for its receiving slots (refer to Section 4.3.1). Nearby nodes will try to avoid using the same receiving channel. During a receiving slot, a node will stay on its receiving channel. During a transmitting slot, a node can switch to its receiver’s receiving channel and stay on that channel until the end of the slot. Hence, two nodes can communicate only if one is in a transmitting slot and the other is in a receiving slot. After switching to a new channel, a node first remains silent for a duration equals to the maximum packet transmission time so as to avoid the multi-channel hidden terminal problem which is resulted by loose time synchronization. Therefore, JMM does not require very precise clock synchronization.
An example is in Figure 8. In s0, all nodes stay on the common channel 1. In s1, node B wants to send packets to C, so B switches to C’s receiving channel 3. Suppose that
Figure 8: An example of channel schedule.
node A also wants to send packets to B. Since s1and s2of node A are receiving slots, it has to wait until s3to transmit. Note that since both A and C want to send packets to B in s3, they will use 802.11’s CSMA/CA mechanism to contend for the medium.
4.2.2 Transmitting and Receiving Patterns
Unicast slots of a superframe are designated as transmitting/receiving slots. However, since traffics on mesh networks are quite stable, slot assignment will not be changed too frequently. In each superframe, unicast slots s1to s4t are evenly divided into two parts, the fist part from s1 to s2t and the second part from s2t+1 to s4t. One part is designated as the upstream part for communication with the node’s upstream nodes (with respect to the node’s gateway), and the other part is called downstream part for communication with its downstream nodes. These two parts are of the same length because for a relay node, the amount of traffics to and from upstream nodes is likely to be equal to that to and from downstream nodes.
Each part can follow a Transmitting-First (TF) pattern or a Receiving-First (RF) pattern as shown in Figure 9. In a TF pattern, the first half is all transmitting slots, and the second half is all receiving slots. Contrarily, in a RF pattern, the first half is all receiving slots, and the second half is all transmitting slots. As a result, there are four types of superframe patterns, namely TF-TF, RF-RF, TF-RF, and RF-TF types, as shown in Figure
Figure 9: The TF and RF patterns.
Figure 10: Four types of superframe patterns.
10. The ratio of the number of transmitting slots to the number of receiving slots can be adjusted dynamically (refer to Section 4.2.3).
Transmitting and receiving patterns of a node will be determined by the routing layer.
In Figure 11, we show a chain and the superframe patterns of nodes. On the chain, packets are alternated between the first and the second halves of superframe. Also on each link, one side if RF pattern and the side is TF pattern. However, with dual paths, slot schedule is more complex than this example (refer to Section 4.3.4).
4.2.3 Dynamic Adjustment of the T/R Ratio
Recall that each superframe has an upstream part and a downstream part. The ratio of the number T of transmitting slots to the number R of receiving slots in each up-stream part, call T/R ratio, can be dynamically adjusted in a per node basis. Since in a relay node the amount of traffics from upstream nodes is likely to be equal to that to downstream nodes, the number of receiving slots in the upstream part should equal
Figure 11: A simple slot assignment in a chain of nodes.
the number of transmitting slots in the downstream part. Similarly, the transmitting slots in the upstream part should equal the number of receiving slots in the down-stream part. We thus let T to be the number of receiving slots and R to be the number of transmitting slots in the downstream part.
The T/R ratio of each node is adjusted dynamically during runtime. Initially, we set T = R = t. A node should monitor the actual traffic through itself. Assume that the actual transmitting and receiving traffics on the upstream part are Tactual and Ractual, respectively. We then compute new weighted averages Tsmooth and Rsmoothas follows:
Tsmooth ←α∗Tactual+ (1−α) ∗Tsmooth; (1) Rsmooth ←α∗Ractual+ (1−α) ∗Rsmooth. (2)
The values of T and R will be changed slowly by the following rules:
Figure 12: An example reordering slots by the permutation {1, 5, 9, 13, 10, 6, 14, 2, 7, 15, 3, 11, 16, 4, 12, 8}.
if (Tsmooth/T)/(Rsmooth/R) > Thresholdh and R>1 then T ← T+1;
R←R−1;
endif
if (Tsmooth/T)/(Rsmooth/R) < Thresholdl and T>1 then T ← T−1;
R←R+1;
endif
Tsmooth/T and Rsmooth/R are the utilizations of transmitting and receiving slots, respec-tively. If the utilization ratio of transmitting to receiving is higher than a thresholds Thresholdh, we increase T and decrease R by one. If the utilization ratio is lower than a threshold Thresholdl, a reverse process is preformed.
4.2.4 Permutation of Slots
In the above discussion, transmitting and receiving slots are clustered togeter. In prac-tice, we can permute the slot sequence of a superframe to obtain some degree of ran-domness among these slots. The same permutation which can reorder a sequence of 4t elements should be used by all nodes. An example is shown in Figure 12.
Figure 13: The broadcast and unicast queues at the link layer.
4.2.5 Packet Queues
When packets arrive, we need to allocate them to transmitting slots for transmission.
JMM dispatches packets into a broadcast queue and two groups of unicast queues as shown in Figure 13, where we assume that there are three non-overlap channels.
Broadcast packets are enqueued in the broadcast queue, while unicast packets are clas-sified as the first part or the second part and then are enqueued in the corresponding queues based on the receiving channels of receivers (refer to Section 4.3.5).
The broadcast queue is served in broadcast slots. The first part unicast queues are served by transmitting slots of slots s1to s2t in a round-robin manner. Each transmit-ting slot will serve one queue by switching to the channel of that queue, until the queue is empty or the slot expires. The second part unicast queues are served by transmitting slots of slots s2t+1to s4tin a similar way.