• 沒有找到結果。

Overview of IEEE 802.15.4 and ZigBee Standards

2.2 ZigBee Network Layer

2.2.3 Routing Protocols

In a ZigBee network, the coordinator and routers can directly transmit packets along the tree without using any route discovery. When a router receives a packet, it first checks if it is the destination or one of its child end devices is the destination. If so, this router will accept the packet or forward this packet to the designated child end device. Otherwise, it will relay packet along the tree. Assume that the depth of this router is d and its address is A. This packet

C

Figure 2.7: An address assignment example in a ZigBee network.

is for one of its descendant devices if the destination address Adest satisfies A < Adest <

A+ Cskip(d − 1), and this packet will be relayed to the child router with address

Ar = A + 1 +

Adest− (A + 1) Cskip(d)



× Cskip(d).

If the destination is not a descendant of this device, this packet will be forwarded to its parent.

In a mesh network, ZigBee coordinators and routers are said to have routing capacity if they have routing table capacities and route discovery table capacities. Devices that are routing-capable can initiate routing discovery procedures and directly transmit packets to relay nodes. Otherwise, they can only transmit packets through tree links. In the latter case, when receiving a packet, a device will perform the same routing operations as described in tree networks. When a node needs to relay a received packet, it will first check whether it is routing-capable. If it is routing-capable, the packet will be unicast to the next hop. Otherwise, the packet will be relayed along the tree.

A device that has routing capacity will initiate route discovery if there is no proper route

entry to the requested destination in its routing table. The route discovery in a ZigBee network is similar to the AODV routing protocol [56] . Links with lower cost will be chosen into the routing path. The cost of link l is defined based on the packet delivery probability on link l.

However, how to calculate the packet delivery probability is not explicitly stated in the ZigBee specification.

At the beginning of a route discovery, the source broadcasts a route request packet. A ZigBee router that receives a route request packet first computes the link cost. If this device has routing capacity, it will rebroadcast this request if it does not receive this request before or the link cost recorded in route request plus the cost it just computed is lower than the former received request. Otherwise, it will discard this request. For the case that a ZigBee router that is not routing capable receives a route request, it also determines whether to resend this request based on the same comparison. If this device determines to resend this route request, it will check the destination address and unicast this route request to its parent or to one of its children (in the tree network). An example is shown in Fig. 2.8. In Fig. 2.8, device S broadcasts a route request for destination T and devices A and D receive this packet. Since device A has no routing capacity, it will check the address of destination T and unicast this request to device C. Since device D has routing capacity, it will rebroadcast this request. A device that has resent a route request packet will record the request sender in its route discovery table. This information will be discarded if this device does not receive a route reply within a time interval.

When the destination receives route request packets from multiple paths, it will choose the routing path with the lowest cost and send a route reply packet to the source. The route reply packet will be sent by unicast. An intermediate node that receives the route reply packet checks its route discovery table and sends the route reply to the request sender. After the source node successfully receives the route reply, it can send data packets to the destination node along the discovered route.

The ZigBee network layer also specifies route maintenance mechanisms for mesh and tree networks. In a mesh network, route failure is detected by a failure counter. If the counter of a

S

a

C

T

D Discard route

request B

Unicast Broadcast

Without routing capacity route reply

route req.

route req.

route req.

route req.

route req.

Figure 2.8: An example of route request dissemination in a ZigBee network.

ZigBee router exceeds a threshold, the router can start the route maintenance procedure. For those routers that have routing capacity, they can flood route request packets to find destina-tions. For routers that do not have routing capacity, they will unicast route request packets to their parents or children according to the destination addresses. However, in a tree network, a router does not broadcast route request packets when it loses its parent. Instead, it disasso-ciates with its parent and tries to re-associate with a new parent. After re-association, it will receive a new short 16-bit network address and can transmit packets to its new parent. Note that a device that re-associates to a new parent will disconnect all its children. Those children that lose their parents will also try to find new parents. On the other hand, when a router cannot send packets to a child, it will directly drop this packet and send a route error mes-sage to the packet originator. Then this router will send a disassociation notification command to the child. The disassociated child may reconnect to the same parent or find a new parent depending on its new scan result.