Architecture and Routing Protocols for Smart Wireless Home Sensor Networks

As an important application domain of wireless sensor networks (WSN), wireless home sensor network (WHSN) can be built as a traditional WSN. However, when we consider its own character that plug-in sensors are fixed with AC power supply while mobile sensors are battery powered, traditional WSN techniques do not match well. In this paper, we propose a smart wireless home sensor network architecture with improved routing protocols. It is a hierarchical architecture in which AC-powered sensors act as backbone nodes for data retransmission, while battery-powered sensors act as leaves that only transmit data relevant to themselves. Each sensor is assigned with a prime number as its location identifier. For our routing algorithm, the LID is used as routing address and is decomposed to a sequence of prime numbers that indicates the route towards its destination. In addition, we improve existing routing algorithms such as SPIN, LEACH, and DD to incorporate traditional WSN routing algorithms into our smart WHSN architecture, and comparable efficiencies are made between them. Moreover, we propose a network path recovery algorithm for failures that are caused by node mobility or backbone node failures. All our algorithms have been provided with faithful simulations to verify the feasibility and efficiency.


Introduction
Wireless home sensor networks (WHSNs) that connect household appliances to the Internet become important application domains of wireless sensor network (WSN) [1,2]. e objective is to use kinds of wireless techniques to interconnect household electrical devices and the sensors to form a uni�ed platform so that all smart household devices can communicate and be controlled cooperatively, securely, and robustly. ere have been extensive studies made in this �eld to build an autoadaptive and green wireless home sensor network. Azim and Islam [3] proposed a hybrid LEACH [3,4] algorithm to build a relay node in its hierarchical clusters so that an energy-saving WHSN can be realized. Park and Corson [5] proposed a highly adaptive distributed routing algorithm for WHSN by using the SPIN [5] protocol. Zhang et al. [6] proposed an energy efficient approach called directed diffusion (DD) [6] protocol based on passive clustering. Although these solutions have been proven to be more efficient than traditional WSN protocols when applied in home sensor networks, they only took partial advantages of the WHSN features and made unnecessary assumptions such as full mobility of WHSN nodes. erefore, based on the state of the art analysis, a comprehensive approach that matches the needs of smart wireless home sensor network is still on the way.
In this paper, we investigated the key features of WHSN that distinguish it from traditional WSNs and proposed a novel algorithm to make a full use of those features. First of all, some nodes of WHSN are embedded in household appliances and connect AC as power supply, which are not similar with typical battery-powered WSN nodes. Hence, energy consumption is no longer a constraint for AC-powered nodes, and they might be able to make more contribution on packet transmissions than those energy-constrained mobile nodes. Secondly, the deployment of WHSN is partially �xed other than traditional WSNs where most nodes are randomly scattered. For example, temperature sensors in WHSN are adhered on the wall or embedded into the household appliances that are permanently immovable. erefore, we can model the WHSN architecture as a semistructured layout rather than a typical mobile ad hoc network. irdly, sensor nodes in WHSNs [7,8] typically range from 100 to 1000 in a household, which is categorized as a middle size WSN. erefore, scalability is not a major bottleneck in network design for WHSNs.
By making a good use of these key features to build a �exible and efficient wireless home sensor network, we proposed a hierarchical architecture for WHSN. In this architecture, sensor nodes are categorized into two classes: plug-in nodes that are energy restriction free but localization �xed and energyrestricted nodes that are modeled with mobilities. According to our design, nodes are organized as a tree structure where the gateway acts as the root. To take the advantage of plugin nodes, we deployed them as backbones of the tree for data retransmissions, and their immovability is helpful to keep the tree structure stable. As energy-restricted nodes are normally movable, such as sensors in a robot, they are more suitable to be connected as leaf nodes in the network.
Based on the architecture design, we are able to customize simple and �exible routing protocols for WHSN. e key innovation is that we excluded the traditional routing table, by assigning each node with a prime-numbered address, and each routing path is identi�ed with a location identi�er (LID) which is the production of the prime addresses of all the relay nodes. e key advantage of this design is that when a node chooses the next relay node, it can easily adopt a decomposing operation that only the next transmitter can be divided. When the package is transmitted, the LID is replaced with the quotient to identify the remaining path, and when the LID is a prime number, it denotes that it is the address of the destination node. erefore, the path can be easily discovered by the relay nodes without routing table.
In addition to our new algorithm design, we incorporated traditional WSN protocols into our smart home sensor networks architecture by improving some popular routing algorithms such as SPIN, LEACH, and DD [6,9]. e key is to take the advantage of both the hierarchical architecture and energy restriction free plug-in nodes. In the end, we introduced our network maintenance algorithm. Bene�ted by the WHSN features, our protocols can improve the routing efficiency and effectively reduce the cost for network reorganization caused by the movement of mobile nodes or sensor node failures.

Smart WHSN Architecture
In this section, we introduce our semistructured WHSN architecture. Our design is based on the key features on where and how sensors are deployed in a household. e application domain can be speci�cally illustrated as follows: (1) there is a home gateway acting as the sink node to the internet; (2) some nodes are embedded in household appliances and directly connected with AC adapter. Due to its cable connection, it is hardly movable; (3) the other nodes are most likely moveable, such as sensors in a robot. Due to their mobilities, they are battery powered, and energy consumption is a bottleneck for data transmission; (4) wireless home sensor networks are typically with hundreds of sensors.

Plug-In Nodes and Mobile
Nodes. In a household, plugin nodes are normally location �xed and integrated into household appliances with AC supply. For example, in Figure  1, the refrigerator contains temperature sensors and radio frequency (RF) sensors and they are all AC powered, which means they have no energy consumption limitations and can keep awake all the time. In WHSN, energy consumption is key factor to affect the lifetime of the network. If we can make use of plug-in nodes as backbone for data transmission, we can signi�cantly reduce energy consumption of mobile nodes and extend the WHSN lifetime. In addition, plug-in nodes with power supply are normally more stable than mobile nodes. If they are used as backbone nodes, it will help improve the stability of WHSN from power-off failures.
Other than plug-in nodes, there are plenty of sensors that are movable and powered with battery. Typical mobile sensors include video cameras in robots and localization sensors in vacuum cleaners. e mobility feature of mobile sensors will make necessary changes on network topology, and as they are always battery powered, energy constraint is a key bottleneck for them involving data retransmissions. For example, as shown in Figure 2, modules of the mobile node such as the data acquisition, control, movement, and data transmission are all powered with battery.

WHSN Network Design.
e key of our WHSN architecture design is to make the advantage of features that discriminates WHSNs from traditional WSNs. As explained previously, plug-in nodes are more suitable as backbone nodes to take more responsibility of data transmission according to their robustness and battery free features. Moreover, the immovability feature of the plug-in nodes help to keep the backbone stable. On the other hand, mobile nodes powered by battery should connect with the network loosely so that the network will not be signi�cantly changed when they swi their positions, and most importantly, less data retransmissions via mobile nodes will extend their battery lifetime.
According to WHSN features, we proposed a hierarchical architecture for wireless home sensor networks as shown in Figure 3. In our design, nodes are organized as a tree, and the gateway is set as the root of the tree. In this tree, upper layers are most likely to be composed of �xed plug-in sensor nodes, while battery-powered nodes or mobile nodes are more likely to be set as the leaf nodes. Staring with an existing root, the network construction process can be brie�y described in Algorithm 1. In this algorithm, nodes are recursively joined to the tree. Firstly, the pending node evaluates its own capability according to its energy constraint, bandwidth, and so forth (line 2). Next, it enumerates its neighbors, queries the capabilities of the neighbors, and reorders its neighbors by their capabilities (lines 3 and 4). With the ordered neighbor list, a node which is of the least capability than the pending one and does not reach its maximum children number can be found (lines 5-9). As the last step, the pending node will be allocated with a prime-numbered address (line 10) and its LID (line 11). e addressing process will be described in the next section.
Following our network architecture design, we will describe our system design. Although WHSN is a typical WSN where popular WSN protocols can be applied straightforward, we can make necessary revisions to enhance its efficiency. As shown in Figure 4, there are four layers. Based on our hierarchical architecture in the lowest layer, we proposed a prime-numbered addressing protocol and setup for all sensors to form a logical WHSN. In routing protocol layer, we can either modify the traditional routing protocols such as SPIN, LEACH, and DD to match the feature of WHSN or build our new routing protocol as D-HiPr. As the top layer, network maintenance is key protocol to keep the mobile feature of WHSN.

Addressing and Routing Algorithms
When sensors in WHSN can be organized as a hierarchical architecture as we have proposed, the key is how we can design the addressing and routing protocols that take the merits of tree-like organization as the features of plug-in and mobile nodes. In this section, we present our novel algorithm of dynamical hierarchical routing protocol with prime numbers (D-HiPr) addressing.

Prime-Numbered Addressing
Protocol. In our approach, each node in WHSN is assigned with a prime number as its short address, and any path can be identi�ed by the location identi�er (LID), which is the production of the prime addresses of all nodes in the path. e advantage of D-HiPr with prime number addressing lies on the following de�nition.

Lemma 1. e product of all prime numbers in set can only be divided by the product of prime numbers which are the subset of .
erefore, each LID can be decomposed to a sequence of prime numbers that identi�es a unique path in the WHSN tree from the root, if all the intermediate nodes in this path have different prime-numbered addresses. When a node checks who is the next relayer, it can simply adopt a decomposing operation with its children that only the address of the next transmitter could be divided. In our D-HiPr protocol, two parameters are required for a given node: a prime numbered 16-bit address and LID which is the product of nodes in the path linking it from the root. For example, if the path from a node to the root is e location of a node can be identi�ed by its parent node, and the node can get its path from its own LID. If the LID of its parent node is , the LID of node is calculated as = ⋅ . For example, as shown in Figure 5, LID 1955 = 1 × 5 × 17 × 23 explicitly identi�es the path from the root to node 23. When node 5 gains the LID, it will only �nd node 17 as its next relayer since only 17 can divide the LID.
In order to avoid address con�icts, the gateway responses of all the address assignment. e allocation process is brie�y shown as Figure 6. ere are three major phases. e �rst is the neighbor discovery (ND) process �10], which includes router solicitation (RS) and router advertisement (RA). e second phase is for node registrations including two new ICMPv6 messages: node registration (NR) and node con�rmation (NC) �11]. Unlike the traditional multi-hop registration, NC includes a location option to contains the LID of its parent node so that its children can calculate their own LID by producing its prime-numbered address with their parent's LID. e third phase is for location registration. e node will use location registration (LR) and location con�rmation (LC) messages to inform its LID to the parent node as well as the gateway. Each node in our design uses "hello" message to check whether the neighbors keep the positions. When a node is moved, it will ask the gateway to rejoin the network with a new address. If a node detects that its parent node is gone or a child is moved, network maintenance will start and we will describe that in Section 5.

Routing Protocol of D-HiPr.
In this section, we represent the details of D-HiPr and how the prime-numbered address works. For example, when a packet is required to be sent from node C to the destination node D, the D-HiPr routing protocol is explicitly described as Algorithm 2. In this case, the parent node of C is P and its children are ( = 1, 2, 3, … , ) where is the number of its children. e LIDs of node C and node D are and , and those of node P and their children node are and , respectively. To route the packet in node C, the difference between the LID of the destination and its source node is obtained �rst   (line 2). If the LID of the destination is larger than that of the source, the packet is passed down to the children of node C (line 3). According to the construction of the tree and the creation of LID, the node of which the LID can divide that of the destination is on the path leading the packet directly to its destination. us, the right child for the next hop can be chosen (lines 4-7). If there is no child that can pass the packet to its destination, the packet is discarded (line 9). When node C is exactly the destination of the packet, it just holds this packet. If the LID of the destination is smaller than that of the source, the packet is passed to the ancestors of node C and it is directly sent to the parent of C (line 15). D-HiPr is a novel routing technique by using prime numbers as the sensor nodes' 16-bit local address. Its key advantages meet the requirements of the smart wireless home sensor networks well.
(i) Nontable-Driven. By taking the advantage of prime number, D-HiPr uses a single LID for packet routing other than traditional routing table. is mechanism helps to save memory of the transmission nodes as well as reduce traffic delays.
(ii) Energy Saving. D-HiPr uses a very simple way to compute routing path and packets in smart WHSN can arrive at the receiver faster and more computation saving to save energy of the relay nodes even it is battery powered.
(iii) Mobility. D-HiPr needs no routing table, and the nature of the prime numbers makes the address allocation more �exible. erefore, D-HiPr can support the mobility of nodes better than traditional routing table.
(iv) End-to-end Communication. In smart WHSN with D-HiPr, not all the packets need to be sent via the gateway. In real domain, most packets are directly passed between sensor nodes, and it improves the efficiency of smart WHSN to reduce the traffic of the gateway.
(v) Medium Scalability. Although the scalability of primenumbered addressing is normally hundreds, however, it matches the scalability of WHSN well as it is always composed of hundreds of sensors as well.

Incorporating WSN Protocols into WHSN
Based on our hierarchical architecture, in the routing protocol layer, we can use D-HiPr or modify existing WSN routing algorithms in WHSN. Our architecture is compatible with different routing protocols. In this section, we modify three typical WSN routing protocols, LEACH, SPIN, and DD. e key of our improvement is to take the advantage of WHSN hierarchical design by mainly using the �xed plugin nodes instead of mobile nodes to the response for data transportation so that energy consumption bottleneck of mobile nodes can be avoided and the lifetime of the network can be improved. The gateway Parent node Current node F 6: Address allocation process.

LEACH-Pi.
Low energy adaptive clustering hierarchy (LEACH) is a low power consumption adaptive clustering routing protocol designed for wireless sensor network. It is based on monolayer clusters and is a data-centric protocol. e key ideal of LAECH is to choose a cluster head randomly in cycle and evenly distribute the global network load to each sensor node. In this way, network energy consumption and the overall survival time of the network can be improved. LEACH routing protocol is composed of two phases, setup phase and ready phase, and each round includes two phases. To reduce protocol overhead, ready phase should be extended longer than setup phase. In the setup phase, each node randomly generates a random value between (0, 1). If it is less than the threshold ( ) based on the next formula, the node will be selected as a cluster head: As shown in (1), is the percentage of a node to be selected as the cluster head. is the round number. is the group of nodes which are not selected as cluster head in the last 1/ round. When the cluster head has been chosen, it broadcasts the message to inform its cluster head position. Nodes decide to join the cluster or not based on the strength of the received message. Aer a cluster head is chosen, the cluster head will continue to build its cluster. In WHSN, as we explained, node distribution is uneven, and it is unlikely for each node to have an equal chance to be the cluster head. Meanwhile, the WHSN plug-in nodes are more suitable to be a cluster head than randomly chosen node, that is, mobile nodes. It is the key that LEACH protocol should be revised to �t the features of WHSN. �y bringing the concept of �xed plug-in nodes in the LEACH protocol, we build the LEACH-Pi where cluster heads are always assigned to plugin nodes. e process of LEACH-Pi is shown in Algorithm 3.
In the classic LEACH protocol, the most part of energy consumption is to communicate with the cluster heads. In LEACH-Pi, since the plug-in nodes are energy constrained free, their energy consumptions for sending a packet can be neglected. Its energy consumption for communication with cluster heads can be signi�cantly reduced, and the energy consumption of WHSN is merely to communicate between the battery-consumed nodes and cluster heads. Comparing with LEACH, our improved protocol by incorporating the WHSN feature can notably enhance the lifetime of the sensor network bottlenecked by power.

SPIN-Pi. Sensor protocol for information via negotiation (SPIN) is an adaptive data-centric communication protocol.
Its goal is to solve the "implosion" and "overlap" in �ooding by using the consultation system and the resource adaptive mechanism between nodes. ere are three kinds of data packets in SPIN: ADV, REQ, and DATA. Node uses the ADV to announce that it has data to send, use the REQ to request expects to receive data, and use the DATA to package data [12].
In SPIN routing protocol, as Figure 8 indicates, when a SPIN node obtains new data to share, it broadcasts an ADV request message to clarify its demand. If a neighbor is interested in routing this data, it sends an REQ message as a response, and the DATA is sent to this neighbor node. e SPIN protocol does not take the plug-in nodes into consideration and works well with battery-powered nodes. But in WHSN, there are many plug-in nodes which cannot be ignored and SPIN protocol works with low efficiency.
To improve the routing efficiency and extend the network life, we propose the SPIN-Pi routing protocol based on the original SPIN protocol. As shown in Figure 8, the SPIN-Pi protocol mainly takes advantage of the plug-in node and puts most of the routing tasks on them. In SPIN-Pi routing protocol, for the node that has a packet routing request, the routing process is shown in Algorithm 4. When a SPIN node  (1) for each node in WHSN do (2) if node ⋅ getDATA() ≠ ∅ then (3) node ⋅ broadcast(ADV); (4) REQs ← receiveREQs(); (5) if REQs ≠ ∅ then (6) node ⋅ send(REQs ⋅ getSend(), DATA); (7) else (8) node ⋅ broadcast(ADV); (9) REQs ← receiveREQs(); (10) if REQs ≠ ∅ then (11) node ⋅ send(REQs ⋅ getSend(), DATA); (12) end if (13) end if (14) end if (15) end for A 4: Packet routing request process. has data to share (line 2), it broadcasts an ADV request message to clarify its desire (line 3). When it receives REQ responses from neighbors (line 4), the packet routing request could be satis�ed by these neighbors, and the packet is sent to them (line 6). If there is no one that is willing to route this data, the SPIN node will broadcast an ADV request at the second time (lines 9-11).
For the node that can potentially serve packet routing request, the process in SPIN protocol is shown in Algorithm 5. As the algorithm shows, the plug-in node will serve any ADV request while the non-plug-in node will only route the packet when there is no one willing to serve it in the �rst request round (lines 5 and 6). Comparing with original SPIN protocol, the energy consumption over the entire network has been signi�cantly reduced by using the plug-in nodes as REQ sender while avoiding mobile nodes involving unnecessary communication.

DD-Pi.
Directed diffusion (DD) is a data-centric routing protocol. e routing process is initiated by the information collection node (the gateway of the WHSN). e information collection node broadcasts interests packets to the WSN periodically to tell the network what kind of information it wants to collect. And each node which has received interests packet will create a gradient for this kind of information. us, the gradients for all the information in which the gateway is interested are built in this network. When a piece of information is generated in this network, it will be passed to the gateway according to its gradients. (1) for each node in WHSN do (2) ADVs ← node ⋅ receiveADVs(); (3) if ADVs ≠ ∅ then (4) for ADV ∈ ADVs do (5) if (node ⋅ feature = plug-in and isFirstRecv(ADV)) or isSecondRecv(ADV) then (6) node ⋅ send(ADVs ⋅ getSend(), REQ); (7) end if (8) end for (9) end if (10) end for A 5: Packet routing response process. DD protocol is efficient in gathering information for the gateway. To apply this method in WHSN, we propose a modi�ed version of DD protocol called DD-Pi. In this protocol, we de�ne the gradient as the current capability of this node, and the node with a higher capability such as plugin node has a higher gradient as Figure 9 shows. In this way, most of the communication load can be moved to those plugin nodes, free of energy consumption bottleneck. erefore, the network life can be extended.
e DD-Pi routing process is described in Algorithm 6. For each node in WHSN, when an interest message arrives (line 2), the node builds the gradient for this kind of message according to the current capability of the node (line 3). If the current node is a plug-in node (line 4), it will broadcast the interest messages it receives to its neighbors (lines 5 and 6).

Network Maintenance
Based on our hierarchical architecture, the path connecting a node to the gateway is unique without any alternative route. erefore, when any node or link is removed or failed, the network is no longer connected and a fast network maintenance schema responding to node mobilities and failures is imperative to build stable and well-performance wireless home sensor network. Although there have been some path recovery mechanisms used in WSN [13,14], they may be inefficient and costly according to WHSN architecture and routing protocols. In this section, we introduce mobile node maintenance and path recovery algorithm based on our WHSN architecture.

Responding to WHSN Mobility.
In our wireless home sensor network design, each node is assigned with a primenumbered address and a unique LID to denote the path to the root. Moreover, the node with mobility is most likely to be connected as a leaf in the tree. When a leaf is moved, we can very easily deal with its motion according to Algorithm 1 that the moved node is deemed as a newly joined node. e only difference is that it has its prime-numbered address other than being assigned with a new one. For example, in a WHSN shown in Figure 10, when a dashed 19 is moved to 19 , it will broadcast and rejoin the network with a new parent as root C. Its address will stay as 19 while only its LID changes from 399 to 19 according to its parent's LID. Aer registering its new LID, it is ready to work at its new position.

5.2.
Responding to Backbone Node Failure. Energy exhaustion, hardware problem, or unpredictable moving of backbone nodes can cause network failure and routing paths broken. What is worse, with the hierarchical architecture of the WHSN, all descendant nodes of the failed backbone (1) for each node in WHSN do (2) Msgs ← node ⋅ receiveInterestMsgs(); (3) node ⋅ buildGradient(node ⋅ Cap, Msgs) (4) if node ⋅ feature = plug-in then (5) for Msg ∈ Msgs do (6) node ⋅ broadcast(Msg); (7) end for (8)  node are disconnected from the network. e cost will be relatively high for all descendant nodes rejoining the network. We propose a mechanism for network restructure that all descendant nodes that are disconnected to their parent node are formed into descendant trees, with the direct child nodes of failed parent node acting as their roots (lines 1-5). Each root of new descendant trees will scan for available parent nodes and select an optimal one from its neighbors (lines 2), while all its descendant nodes keep their associations. Each descendant node gains a new LID from its original parent without sending rejoining messages (lines 7). e gateway will be noti�ed to modify the LIDs for all changes (lines 8). e process for parent node of the descendant trees recovering from failures is described in Algorithm 7. As presented in Figure 11, each node has a prime address and LID separated by a colon. For instance, 2   recovery mechanism only involves two procedures. One is that descendant tree root nodes scan for a new parent and the other is that all descendant nodes regain new LID. In contrast with the method that all descendant nodes rejoin the network, it simpli�es the network maintenance to avoid all descendant nodes scanning for their parent nodes.

Simulation and Results.
In this section, we present our experiments and results to evaluate our approach. e experiments are based on a simulation testbed of a typical household illustrated in Figure 12. ere are plenty In the �rst simulation, we set up a WHSN with 500 of sensor nodes randomly scattered in the household. Although the WHSN always includes two types of sensors, in our experiments, we vary the ratio of plug-in nodes in the network from 0% to 100% as shown in -axes and testify the average transmission latencies of given 500 packets (shown in -axes). In this simulation, we have made six experiments, and in each experiment, we set different numbers of maximum allowed children for each node as 3, 4, 5, 6, 8, and 10. e experiment results are illustrated in Figure 13. As we expected, no matter what the settings are, our D-HiPr algorithm, by taking the advantages of hierarchical architecture, plug-in nodes as backbone, and prime-numbered addressing, takes the least transmission latency than the other two algorithms, while LEACH-PI takes the advantage of using plug-in nodes as cluster head which works better than LEACH. We can also see another evidence in the �gure that when there are more and more plug-in nodes, D-HiPr and LEACH-PI are bene�ted with lower transmission latency, while LEACH stays the same. From all six graphs, when the number of maximum children increases and the depth of the tree decreases, all the three algorithms are bene�ted with lower transmission latency. e reason is that the average distances between nodes are decreased, but all our previous conclusions hold.
In the second simulation, we setup our WHSN with 100, 400, 700, and 1000 sensor nodes, respectively. By varying the ratio of plug-in nodes in the network from 0% to 100% ( -axes), we testify the average transmission latencies (axes), which is consistent with the �rst simulation. From the experiment results shown in Figure 14, our conclusions from the last simulation that D-HiPr takes the most advantages and LEACH-PI takes the advantage of plug-in nodes hold. Moreover, when WHSN scales up, the advantage of D-HiPr and LEACH-PI becomes more and more prominent.
(1) for node ∈ failedNode ⋅ getChildren() do (2) node ⋅ parent ← FindNewParent(node); (3) node ⋅ updateLIDFromParent(); (4) node ⋅ notifyGateway(); (5) end for (6) for child ∈ node do (7) child ⋅ updateLIDFromParent(); (8) node ⋅ notifyGateway(); (9) end for A 7: Path Recovery Algorithm. In the last simulation, we evaluate our design by comparing the sustain lifetimes of the WHSN when it is applied with different protocols explained in this paper. In this simulation, we set the WHSN with 10 plug-in nodes as shown in the simulation scenario and 90 battery-powered nodes randomly scattered in the house. In each time step, several nodes in the network are chosen to send packets to the gateway. For each packet transmission, if a battery-powered node is involved, it will consume some power for communication. If more battery-powered nodes are involved in packet transmissions, the network will be out of power more quickly. We will record in the simulation how long the battery-powered nodes can keep alive. e experiment results are brie�y shown in Figure 15, and in each graph, we use three different algorithms to be compared. Figure 15(a) shows the sustain lifetime of the network with D-HiPr, LEACH, and LEACH-Pi protocols. As we can see, the LEACH protocol which does not consider the strength of plug-in nodes discharges the battery-powered nodes very quickly and halts the network at about 1300 rounds. In contrast, the LEACH-Pi by taking the advantage of plug-in nodes can survive until more than 2000 rounds, while our D-HiPr protocol by integrating all the features of WHSN works well until more than 2300 rounds.
In Figure 15(b), we use the protocols of D-HiPr, SPIN, and SPIN-Pi to test the network, while in Figure 15(c), we use the D-HiPr, DD, and DD-Pi protocols. Similar to the conclusion drawn from Figure 15(a), because the SPIN and DD do not consider the plug-in nodes, they perform very poorly. SPIN-Pi and DD-Pi by considering the merit of plug-in nodes, they perform better. D-HiPr by taking the advantages of plug-in nodes as backbone and prime-numbered routing algorithm, it performs best, and as Figure 15(c) shows, its sustained lifetime can be triple as that of the DD protocol.

Conclusion and Future Works
In this paper, we have designed a hierarchical architecture for smart WHSN. By classifying sensor nodes into two categories, we can take the advantages of using �xed plugin nodes as backbone nodes for data transportation while the mobile nodes as leaves to keep the �exibility of the network. Based on our architecture design, we have made three major contributions: a novel prime-numbered hierarchical address allocation and routing protocol; an improvement of classic routing protocols for smart WHSN as well as improved network maintenance algorithms to model node mobility and backbone failure. Our simulation results manifest the efficiency and feasibility of our design. However, even if we are capable of dealing with some of the challenges of the domain, we leave many of the others for the future work. Firstly, our design should be integrated with the physical layer controlling protocol such as 802.15.4, but it is not tested. Second, our design should be veri�ed in some real domains applications of WHSN, which will be an imperative work for the next step. irdly, connecting with Internet and matching our design with IPv6 network will be good issue le to the future work.