Online Expansion Technology for Dynamic Topology Changing ZigBee Wireless Sensor Networks

In ZigBee, the router capable devices have restriction to accept a number of devices as children devices. A router capable device can not allow any new device to join as a child device if it reaches to the maximum capacity of children or depth limit. According to ZigBee specification each device has a permanent 64-bit MAC address. If a device joins a ZigBee network, it receives a short 16-bit MAC address from the parent device. If a device can not join a network, it isolates from the network and becomes an orphan node even though address spaces are available in the network. The orphan problem becomes worse when the topology of the network changes dynamically. In this paper we propose an online expansion technology to connect the maximum number of devices specially for dynamic topology changing ZigBee wireless sensor networks. The proposed technology shares available address spaces of the router devices to reduce the number of orphan nodes in the network.


Introduction
Wireless Sensor Networks (WSNs) are recent form of decentralized computing where a large number of low power, low cost sensors are deployed in the environment to collect data about the physical phenomena.These sensor networks have a wide range of applications from indoor to hostile environment, such as target tracking and surveillance [1], [2], environmental monitoring [3], [4], navigation [5], [6], and so on.Recently, ZigBee alliance specified a new standard [7] for home and building automation, industrial control, medical sensor application, etc.
ZigBee technology is relatively simple and less expensive than other wireless personal area networks (WPANs) such as UWB, Bluetooth etc.As a result most of the platforms adopt ZigBee for interoperability purpose [8].ZigBee uses IEEE 802.15.4 standard [9] for its physical and MAC layer protocols.The IEEE 802.15.4 standard specifies physical layer (PHY) and medium access control (MAC) layer protocols and compatible interconnection among devices for low-rate personal area networks.
In ZigBee, devices can be classified as mainly two types: full function devices (FFD) and reduced function devices (RFD).These two types of devices form three kinds of nodes in ZigBee network namely: PAN coordinator, router and end device.A FFD can operate as a PAN coordinator or a router device on the other hand a RFD can operate only as an end device.The coordinator performs the initialization, maintenance and controlling of the network.The ZigBee network supports three kinds of network topologies: star, tree and mesh.In star topology all devices directly communicate with PAN coordinator.In tree and mesh networks the devices communicate with each other as the multi-hop fashion.The star network consists of two layers: the layer of coordinator and end devices.In addition to that, the tree and mesh networks have another extra layer of router devices.
At the network initialization time the coordinator defines three parameters: the maximum number of children (Cm), the maximum number of children routers (Rm) of each router; and the maximum depth of the network (Lm).ZigBee uses these parameters to assign a short address for each device using its distributed address allocation scheme [7].
Haque et al.

2
According to ZigBee specification each device has a 64-bit permanent MAC address.The address allocation algorithm assigns a short 16-bit MAC address for each device to reduce the communication overhead.A device receives the short address from its parent device (coordinator or router), if the parent has a free address space for the device.
In ZigBee each device maintains a table that contains the list of potential parents.A device can connect with any one of the potential parents if the parent has a free address space for the device.If the device fails to receive the 16-bit short address from one of the potential parents, then it tries with another one and so on.If the device fails to receive the short address from all of the potential parents then it will be isolated from the network and become an orphan node [8].

Figure 1. An example of ZigBee network
Suppose a new end device E 6 wants to join the network only under the communication range of R 5 as shown in Fig. 1.For Cm=3, Rm=2 and Lm=3 the end device E 6 is an orphan node because the potential parent R 5 does not have free address space.Although the address spaces are available in the network, router R 5 cannot allow device E 6 to join with it, because it already reaches to its maximum boundary of children limit (i.e., Cm = 3).The device can join the network if router R 5 can switch one of its connected devices to another router after some cooperation among local router devices.For example, if router R 4 switches its end device E 3 to R 3 , router R 5 switches its router device R 7 to R 4 then R 5 becomes an address available router and then the end device E 6 can join with it as shown in Fig. 2.
In this paper we propose an online expansion technology to connect the maximum number of nodes or to reduce the number of orphan nodes in dynamic topology changing ZigBee wireless sensor networks.In the technology if a device can not join to any one of its potential parents then it sends a space request message to the parents one by one until it gets the connectivity.A router initiates the expansion technology when it receives the space request message from a device.The router shares information with local routers for the online expansion.The information sharing helps a full router (if a router already connects maximum number of children devices, we call the router as full router) to find and switch a device to another free router (if a router is not full then it is a free router).The proposed online expansion technology is applicable both for network initialization stage and the network operational stage.Note that after switching a connected device a router becomes an address space available router or free router and then the router can allow joining an unconnected device.

Figure 2. Connection of the unconnected device after node switching
To the best of our knowledge, we identify the online expansion problem for the first time.The goal of this paper is to define the online expansion problem and propose a solution for the problem.
The rest of this paper is organized as follows.We present the related works in Section 2. Section 3 states the problem formulation.Section 4 describes the proposed online expansion technology.Section 5 presents the simulation of the proposed technology.We conclude this paper in Section 6.

M. S. Pan et al. first introduced the orphan problem of
ZigBee wireless network in [8], [10].They proposed novel algorithms to solve the orphan problem.In [8], the authors first defined the orphan problem then proposed two algorithms.The first algorithm associates the router devices and the second associates the end devices.In both cases they provided centralized and distributed algorithms.The algorithms show very good performance for static network.But for dynamic topology changing networks there is no solution.
Sung et al. in [11] propose an adaptive joining procedure to extend the ZigBee wireless sensor network.In their proposed work they consider one-hop child shifting by parent router without utilizing all nearby neighbour routers capacity of the network.Yen et al. in [12] propose three methods to allocate address during node association.The first one is a centralized method with extra memory, communication cost; the second one is the combination of centralized method and traditional ZigBee method; and in the last one each router blocks some address space for future use.
Yang et al. in [13] propose a method to expand the network by changing the boundary end device to router device.Kim et al. in [14] propose a method where a router device chooses the maximum distanced node as router to increase the coverage area, i.e., a router device chooses a full function device as a router device that is far from the coordinator than itself.

ZigBee Address Assignment Scheme
In ZigBee, 16-bit MAC addresses are assigned to the devices by a distributed address assignment scheme.For a given Cm, Rm and Lm each router computes a function, Cskip(d), the size of the address sub-block being distributed by each parent at the depth for its router capable child devices.A router of depth d computes the function as follows: Depth of the coordinator and its children are 0 and 1, respectively.Coordinator first starts the address allocation by assigning address 0 to itself.The coordinator and each router device assign an address to its n th child router device as follows: The coordinator and each router device assign an address to its n th child end device as follows: For Cm = 3, Rm = 2 and Lm = 3 the coordinator's The addresses of child routers R 1 and R 2 are 0 + (1-1)10 + 1 = 1 and 0 + (2-1)  10 + 1 = 11, respectively.Similarly, the address of child end devices E 1 is 0 + 102 + 1 = 21, and so on.Fig. 1 shows an example of the address assignment.

ZigBee and DBS Network Formation
According to ZigBee standard the network is formed with a coordinator, and multiple router and end devices.The network is established according to the following procedures.A full function device that wants to become a PAN coordinator scans all the channels to find a suitable one.After the scanning the coordinator sends a beacon frame containing a PAN identifier to initialize the PAN.The ZigBee uses its PAN conflict resolution procedure if more than one device wants to become the PAN coordinator.The devices that hear the beacon join the network as router or end devices by using the ZigBee association procedure.After finishing the association a router device again sends the beacon frame to complete the network.A device that hears the multiple beacons selects the one with lowest hop distance from the coordinator.During the association the coordinator and the routers use the ZigBee address allocation scheme to assign addresses for the devices.

Figure 3. ZigBee associated network
In [8], two distributed address assignment algorithms are presented: the Depth-then-Breadth-Search (DBS) algorithm for router devices association and Distributed Matching (Dis-Match) algorithm for end devices association.Both algorithms are used to associate the devices during network initialization time to establish the network.The authors also presented centralized algorithms for both cases.In DBS algorithm, a thin backbone is constructed that possibly passes through high node density areas of the network.Then they span the network as breadth-first-like manner using the backbone.In Dis-Match algorithm, a bipartite graph is constructed from the ZigBee network, and then the end devices association problem is converted to maximum matching problem.Finally they proposed the Dist-Match algorithm to solve the maximum matching problem to associate the end devices.

Figure 4. DBS associated network
In DBS algorithm a backbone is constructed at first.To construct the backbone a probe message is flooded by the coordinator.The coordinator initiates the backbone formation process by setting its depth as zero.All router devices that receive the probe message increase the depth by one and forward the message.A router device with the maximum allowable depth (Lm) on the contrary sends a report message to its parent.The parent also sends the report to its parent inserting its information in the message and so on.The report message contains the subtree size, the height of the subtree and the tallest child rooted by the node.Note that the report message of a router with depth Lm contains the subtree size as 1 and height of the subtree as 0. Finally the coordinator receives the report messages from its neighbours and selects Rm nodes with largest subtree size as the backbone nodes.The coordinator sends a backbone formation message to the Rm children routers.A router device that receives the message invites its tallest child to join the backbone and so on.After finishing the backbone formation the coordinator starts the complete association process by sending a beacon frame.In DBS, the backbone routers must associate in the network.After that other router and end devices associate according to the association priority (which is defined by subtree size).

Online Expansion Problem
After the network formation using ZigBee association procedure or DBS algorithms, a full router can not switch any child device to another router in the network.The ZigBee routers are having the problem due to lack of information about the local routers.As a result the full router can not receive any new device as a child device.If a new device wants to join the network in a location where a free router is available then the device can join the network.Otherwise the device can not join the network.For example E 6 in Fig. 1 can not join the network for ZigBee or DBS algorithm because device switching is not possible during network operation time for the algorithms.
In ZigBee association procedure device switching is not allowed at any time.Only the end device switching is possible in DBS algorithm during network initialization stage.The router device switching is not possible for any of the algorithms.So, whenever new devices want to join an existing network many of them become isolated nodes.In this paper we call the problem as an online expansion problem of the network.In the rest of this section we state with examples how and when the online expansion problem arises.
To see the behaviours of ZigBee and DBS algorithms we simulate different networks.Consider a network with 350 routers randomly distributed in a 200m200m square area, where coordinator position is at the centre of the square.Routers' communication range are 35m, Cm = Rm = 3 (i.e., only router devices) and Lm = 5.We associate the devices both for ZigBee and DBS association algorithms separately.Fig. 3 and Fig. 4 show the associated networks for ZigBee and DBS algorithms, respectively.The small blue circles in the figures indicate the orphan router devices that receive at least a beacon frame from a router device which has a free router within 2-hop distance.We find the number of orphan routers that have at least a potential parent which has at least an address space available router within 2-hop distance.Table 1 shows the statistics before and after the addition of new 100 router devices.Note that the DBS algorithm associates more routers than the ZigBee network.But in both cases address space available routers are exist within 2-hop.To see more behaviours of the algorithms we simulate a complete network with 600 routers and 5000 end devices in a 400m400m area with Cm = 16, Rm = 4 and Lm = 6.Router and end devices' communication ranges are 45m and 30m, respectively.We place the coordinator at the centre of the area.We associate the network both for ZigBee and DBS association algorithms separately.Table 2 shows the total association statistics before and after the addition of 100 new routers and 1000 new end devices.The last column of the table indicates the total number of router and end devices that have potential parents with free routers within 2-hops.From the tables we find that when we insert new devices in an existing network then the ratio of orphan devices increase more.Suppose a tree with depth L and each node has N children.Maximum number of nodes in the tree is For N = 4 and L = 6 the total number of nodes in the tree is 1365.According to this calculation there might be many free address space available routers exist for orphan routers in the network of the previous setup.From the above simulations we conclude that many orphan nodes create in the network due to unavailability of free address space available routers in that locations of the network.But, in many cases the address space available routers exist within 2-hop distance.The number of orphan devices can be reduced if we can switch some devices from the routers that have orphan devices to the address space available routers.

Node Switching Concept
In our proposed technology router devices share address spaces by switching devices.For example, suppose a router R i has no free space i.e., full but an end device wants to join with it and another h-hop neighbour router R k has free space.Suppose an end device E i is connected with R i and under the communication range of R i+1 , end device E i+1 is connected with R i+1 and under the communication range of R i+2 , and so on.Note that two devices are under the communication range of each other if they can communicate with each other.To make a free address space in R i for the new end device a sequence of end devices switching can be arranged.
and so on.Finally, R i switches E i to R i+1 and makes a free space.Fig. 2 shows a node switching example, where router R 4 switches E 3 to R 3 and R 5 switches R 7 to R 4 .In this way a router can share the address space of another router.
In ZigBee, an unassociated device sends association request to the suitable potential parents of its neighbour table [7] one by one until it gets the connectivity.A device fails to join the network if all the potential parents have no available address space due to depth limit or capacity constraints.In this case we call the device as an orphan candidate.In our technology, for an orphan candidate we add another phase after finishing the normal association phase that we call as node switching phase.In the node switching phase the unassociated device sends a space request message to the potential parents one by one until it gets the connectivity.The space request receiver router shares information among local routers to switch a device to another router.This switching is possible at the network initialization time and the operation time.
Switching a router device is different from the switching of an end device.To switch an end device we need to consider the capacity, but for switching a router device in addition, we have to consider the depth of the routers.A router with higher depth can always switch a child router to a router of lower depth.But the converse is not always possible.In case of switching from lower depth to higher depth router we need to consider the height of the subtree rooted by the switched router.For more clarification, suppose a router R i with depth D i wants to switch a child router R r of subtree height H r to a router R i+1 with depth D i+1 .Then for any of the following three conditions (C 1 to C 3 ) load switching is possible for DBS algorithm.Note that in DBS algorithm each node has the subtree height information from the depth probing phase.But, in Zigbee protocol, routers don't have this information; as a result the switching is possible for any one of the first two conditions (C 1 and C 2 ).

  1
The first and second conditions indicate that a router can switch a child router to another router of same depth and lower depth, respectively.The third condition indicates that a router can switch a child router to another router of higher depth if the summation of subtree height (H r ) routed by the child router and depth of the other router D i+1 is within the depth limit (i.e., less than Lm).
The switching path consists of either end devices switching or router devices switching.But in many cases on the path both routers switching and end devices switching are possible.Suppose a full router with Rm children routers receives a space request message from an orphan candidate router.In this case the router sends the information sharing request message to switch a router device.But, if the router has less than Rm children routers, it can send the request message to switch either a router or an end device.For example a new router device R 10 wants to join the network under R 2 as shown in Fig. 5. R 2 has no free address space so it sends the request message to switch either router or end device, since it has only one child router R 3 .R 4 is a full router so, it forwards the request message to switch its either router or end device.

Node Switching Technology
To switch a device a router needs information from local routers.The router starts information sharing process to collect the information.A router which receives a space request message from an orphan candidate starts the sharing by sending an h-hop request message to its neighbour routers.For example a router R i send the request message as InfoShare (R i ; P Ri ; NC Ri ; NR Ri ; SC Ri ; SR Ri ; SW i ; h), where NC Ri is the list of connected routers, NR Ri is the list of routers under the communication range, SC Ri is the list of connected end devices and SR Ri is the list of end devices under the communication range of R i , SW i is the type of the switching candidate and P Ri is the parent of R i .SW i = 1 means the router switching, SW i = 2 means the end device switching and SW i = 3 means either router or end device switching.For example R 2 in Fig. 5 sends the information sharing request message as InfoShare (R 2 ; R 1 ; R 3 ; R 4 ; E 1 , E 2 ; _; 3; 2) when a new router R 10 wants to join with it.In the example when R 4 forwards the message it also sets SW 4 as 3.
A neighbour full router forwards the message if there is a device under its communication range that is connected with the request sender.If the neighbour has a free address space for the device, it sends a reply message to the request sender.The information sharing request message can be forwarded up to any hop distance from the initiator, if on the path all routers fulfill the condition.The complete algorithm for the information sharing is presented below.

Algorithm Information Sharing
If a free address space available router and the switching path exist within h-hop then the router receives a reply message.From the reply message the initiator router finds the destination router and the switching path.The initiator then sends a switching request message to all the routers on the path to start the switching of devices.The initiator attaches the received reply message with the switching message.From the message all the routers find which device is necessary to switch and where to switch.If the initiator receives multiple replies, it selects the nearest one.After switching a device the initiator router becomes a free router to connect the new device.The switching technique used in Dis-Match algorithm is a special case of our node switching technology, where the list of neighbours contains only the connected end devices with a specific h and no neighbour router inserts its information to the initial list.Note that a full router in the ZigBee protocol or DBS algorithm along with Dis-Match can not allow joining any new device during the network operation time.
The proposed technology can be easily implemented as an overlay network in the ZigBee network because in ZigBee network any router and end device can leave and join the network at any time.A router in ZigBee network can also send message to another router.So, the proposed node switching technology is applicable both for during network initialization time and operation time.Haque et al.

8
To find the complexity of the information sharing algorithm we see that the request message passes maximum h-hop.So, the time complexity of the algorithm is O(h).The maximum number of nodes that forwards the information sharing request message are , where h is the maximum depth limit used by the initiator.So the maximum number of additional messages in the network is O(Rm h-2 ).Note that Lm is not very large for the ZigBee network because the maximum number of nodes in the network is 65536 and so h is not large as well.

Address Modification
The address of a child device depends on the address, Cskip value and n of the parent as stated in Section 3.1.When a full router switches a node to another router (after the information sharing) to connect a new node, it assigns a new address to the node.In this case assigning the address is a problem for the router because the router already assigned all of the permissible addresses to the children devices.If the router assigns the same address of the device that it switches to the other router, then an address conflict happens in the network.
A simple solution of the problem is to assign the address with the address of the device that it switches to the other router.If any conflict happens then the ZigBee address conflict resolution technique resolves the conflict.This solution is suitable to resolve the conflict of an end device.But not suitable for a router device that contains many other children devices because, in that case many conflicts happen in the network.The conflict resolution technology will need a lot of time and create a lot of messages in the network.
In this paper we solve the problem by modifying the addresses of the devices after the switching.If a full router switches an end device to another free router then the free router assigns a new address to the end device.The full router then becomes a free router and assigns its free address to the new device.On a switching path a full router disconnects a device and makes a free space, the router then connects another device and assigns its free space to the device.For example R 4 in Fig. 5 switches a router device R 5 to R 6 and becomes a free router.The router R 4 then assigns its free address to the device R 3 .Similarly R 2 initiates the same steps and R 6 assigns a new address to R 5 when it receives from R 4 .
If a router device switches a child router to another router then the second router assigns address similarly to the previous case.But in this case the switched router also modifies the addresses of all of its children devices.The router recalculates its Cskip value and then modifies its children devices' addresses.Similarly, the children router nodes modify their children devices' addresses and so on.

Simulation Results
We use Visual C++ to simulate the proposed technology.We take the first network that is described in Problem Formulation section as shown in Fig. 3 and apply the proposed node switching technology.Fig. 6(a) shows the newly associated router devices with the node switching technology for ZigBee network.For all the simulation with our proposed node switching technology we use h = 2.The routers with red circles in the figure indicate the newly associated devices.To see the effect of the node switching technology on a dynamic network we add 100 new routers to the initial network.We associate the network using ZigBee technology only and with the node switching technology separately.Fig. 6(b) and 6(c) show the associated network without and with the node switching technology, respectively.Similarly, we take the DBS associated network as shown in Fig. 4 and apply the same steps.Fig. 6(d), 6(e) and 6(f) show the corresponding associated networks.Note that all orphan nodes as shown in Fig. 3 and Fig. 4 with red circles do not join the network because all the potential parents do not have the node switching paths for switching the devices.Moreover more than one orphan node might receive beacon frames from a same parent node.However, the figures show that a number of new nodes associate with the technology that are orphan nodes for ZigBee and DBS algorithms.We simulate a complete network with 700 routers and 7000 end devices in a 400m400m area with Cm = 16, Rm = 4 and Lm = 8.Routers' communication range is 45m, end devices' communication range is 30m and coordinator is at the centre of the square.We associate the network both for ZigBee and DBS association algorithms separately.Table 3 shows the numbers of newly associated router and end devices before and after the addition of new 100 routers and 1000 end devices in the network with the node switching.
For more detail behaviour of node switching technology we simulate the network varying Rm.We take the previous setup with 700 router devices except the end devices.We apply this restriction by setting Cm = Rm.We simulate the network with ZigBee and DBS algorithms separately.In both cases we apply the node switching technology.Fig. 7 shows the associated router devices for different Rm (the number of children routers of each router).To see the effect of the technology on router devices in a dynamic network we add 100 routers in the previous network of 700 routers at each time and associate the new devices.We associate the network for ZigBee and DBS algorithms separately.Then we apply the node switching in each of the cases.In these cases we fix Rm = 5.Fig. 8 shows the number of associated router devices after each addition without and with the node switching technology.Similarly, to see the effect of the technology on end devices we take the previous network of 700 routers and 7000 end devices.Now we add 100 router and 500 end devices at each time and associate the network without and with the node switching technology.We associate the network for ZigBee and DBS algorithm separately.The simulation results are shown in Fig. 9. From the simulation results we see that in all cases the proposed online expansion technology associates more router or end devices.Specially, for dynamic network our online expansion technology connects more nodes in the network.
We also simulate the network varying the transmission range of both router and end devices separately.To see the effect of the node switching technology for router devices over transmission range we increase the transmission range of routers from 30m to 55m.In this case we use the network with 600 routers, Cm = Rm = 4, area 400m400m and coordinator is at the centre of the square.Fig. 10 shows the associated router devices with and without the node switching technology both for ZigBee and DBS association algorithms.To see the effects of the node switching for end devices over transmission range we use a complete network with 700 routers and 7000 end devices in the 400m400m area, Cm = 16, Rm = 4, Lm = 8, routers' communication range is 45m, end devices' communication range varies from 15m to 35m and coordinator is at the centre of the area.Fig. 11 shows the number of associated end devices in the network over the transmission range.
The simulation results show that in all cases the proposed expansion technology associates more devices in the network than the ZigBee and DBS with Dis-Match algorithms.

Conclusions
In this paper we propose an online expansion technology for ZigBee wireless sensor networks to reduce the number of orphan router and end devices in the network.To connect a new device a full router (i.e., a router without having available address space) coordinates with local routers by sharing information.The information sharing helps the full router to find a free router (i.e., a router with available address space) to switch a connected device.After finding a free router the full router switches the connected device and then becomes a free router or address available router to connect the new device.A full router can switch both router and end devices using the technology.
The proposed online expansion technology is useful for during network initialization time and network operation time.Specially, the online expansion technology is very effective for the dynamic topology changing network where network expansion is necessary over time.Our online expansion technology significantly reduces the number of orphan devices in the network as shown in simulation results.
R 6 can receive the end device E 3 or Haque et al. 6 router device R 5 but R 7 can not receive router device R 8 because 7+1 8.If R 10 wants to join the network in a location where only R 4 is in its communication range then R 4 must switch a router device to connect R 10 .

Figure 5 .
Figure 5.A part of a ZigBee network

Figure 6 .
Figure 6.ZigBee and DBS associated routers networks for different setup

Figure 7 .Figure 8 .
Figure 7. Number of associated routers for different Rm

Figure 9 .Figure 10 .
Figure 9. Number of associated end devices for dynamic network

Figure 11 .
Figure 11.Number of associated end devices over transmission range

Table 1
Number of associated, orphan and free routers within 2-hop for routers network

Table 2
Table of associated, orphan and free routers within 2-hop for complete network In both cases the router has to satisfy any of the three conditions for DBS algorithm as in (C 1 ~ C 3 ) and any of the two conditions for ZigBee protocol as in (C 1 ~ C 2 ).The reply message contains all information of the received request message and R j .
1.A router R i sends a h-hop information sharing request message as InfoShare (R i ; P Ri ; NC Ri ; NR Ri ; SC Ri ; SR Ri ; SW i ; h) to its neighbours.2. A neighbour router R j sends a reply message to R i , if it has a free address space for a router device R r which is under its communication range and in  i R i NC for SW i = 1 or SW i = 3; or it has a free address space for an end device which is under its communication range and in  i R i SC for SW i = 2 or SW i = 3. 3.If R j has no free address space but a router device under its communication range that is in  i R i NC for SW i = 1 or SW i = 3; or it has an end device under its communication range that is in  i R i SC for SW i = 2 or SW i = 3 that satisfies the condition as stated in step 2, it forwards the request message.R j forwards the message by piggybacking its information in the message as InfoShare (R i ; P Ri ; NC Ri ; NR Ri ; SC Ri ; SR Ri ; SW i ; h; R j ; P Rj ; NC Rj ; NR Rj ; SC Rj ; SR Rj ; SW j

Table 3
Table of associated router and end devices