Summary of the invention
Goal of the invention: technical problem to be solved by this invention is for the deficiencies in the prior art, the implementation method that provides a kind of wireless sensor network of future generation to build.
Technical scheme: the invention discloses the implementation method that a kind of wireless sensor network of future generation builds, it is characterized in that, described wireless sensor network of future generation comprises three kinds of nodes: cluster head node, bunch interior nodes and new node; The cluster head node is the global function node with route forwarding function, is the part of routed backbone; Bunch interior nodes is for not having the partial function node of route forwarding function, for data acquisition; New node is not for being labeled as global function node or the partial function node that the cluster head node is not labeled as bunch interior nodes yet; The partial function node does not have route forwarding function;
Described wireless sensor network is divided into plural bunch, and each bunch is comprised of a cluster head node and more than one bunch of interior nodes, and in wireless sensor network, all cluster head nodes are built into a tree;
The wireless sensor network building process comprises two parts: initialization procedure and maintenance process; When starting, use wireless sensor network initialization procedure to be built network, the initialization procedure Exactly-once; After initialization procedure finishes, wireless sensor network enters maintenance process, for the treatment of adding of movement, inefficacy and the new node of cluster head node;
Node periodic broadcasting beacon frame in wireless sensor network, the load contents of first three bit identification frame of beacon frame load is as follows:
First three bit value | Load contents | |
000 |
Routing table |
001 |
Arrive the node ID of the path minimum of all cluster head nodes, and the path value |
010 |
Arrive the path value of root node |
011 |
The path list item newly increased |
100 |
The node ID of the node ID of new root node and original father node |
101 |
The path list item upgraded |
110 |
The node ID of inefficacy cluster head node |
,
The the 4th and the 5th bit of beacon frame load is used for the type of identification nodes: 00 means new node, and 01 means bunch interior nodes, and 11 mean the cluster head nodes;
Each cluster head node is preserved a routing table, and for recording the length that arrives other cluster head nodes, list item comprises node ID and two territories of path.
Above-mentioned wireless sensor network architecture of future generation has following advantage:
1) path of cluster head node arrival root node minimizes, and therefore can effectively shorten path, thereby reduces route cost and delay;
2), because route length minimizes, therefore will reduce delay and the cost that moves the routing update caused due to the route intermediate node;
3) bunch interior nodes only communicates with this bunch of cluster head node, does not participate in routing forwarding work, has therefore reduced network traffic data, has avoided network to flood, and has also saved the energy of bunch interior nodes simultaneously;
4) quantity of cluster head node, much smaller than the quantity of bunch interior nodes, is carried out route by the cluster head node, and routing delay is less, and the route power consumption is lower.
In the method for the invention, after wireless sensor network starts, all global function node and partial function nodes all are set to new node; Then, all global function nodes all are designated oneself the cluster head node, and the beacon frame of going on the air, and first three bit value of the load of beacon frame is 000, and the partial function node in cluster head node one jumping scope will oneself be designated a bunch interior nodes;
The process that cluster head node H obtains the path that arrives other cluster head nodes comprises the following steps:
Step 101: start;
Step 102: after cluster head node H receives the beacon frame of neighbours' cluster head node, the list item of routing table in the routing table list item of comparison cluster head node H and beacon frame load;
Step 103: but judge that whether the routing table of cluster head node H exists the different list item in the identical path of node ID territory from routing table in beacon frame, if so, carry out step 104, otherwise carry out step 106;
Step 104: if in the routing table of cluster head node H, the length thresholding of the identical list item of node ID is L1, in beacon frame, the path territory of this list item is L2, and cluster head node H judges that whether L1 is greater than L2+1, if so, carry out step 105, otherwise carry out step 106;
Step 105: cluster head node H is L2+1 by the path area update of this list item in beacon frame;
Step 106: judge non-existent list item in the routing table whether cluster head node H is arranged in the routing table in beacon frame, if so, carry out step 107, otherwise carry out step 108;
Step 107: if the path of this list item of beacon frame is L3, cluster head node H adds this list item in routing table, and the path area update is L3+1;
Step 108: cluster head node H judges whether to meet following two conditions simultaneously, if so, carry out step 109, otherwise returns to step 102;
Condition 1: the routing table of all neighbours' cluster head nodes is identical with the list item quantity of the routing table of oneself,
Condition 2: the routing table of the routing table of all neighbours' cluster head nodes and cluster head node H has in the list item of same node point ID, and the path that the path value of the list item of cluster head node H is not more than in the corresponding list item of neighbours' cluster head node adds 1;
Step 109: the routing table of cluster head node H has been set up;
Step 110: finish;
After cluster head node H acquisition approach table, broadcast beacon frame, first three bit value of the load of beacon frame is 001, the path summation of all list items in the node ID that initial value is oneself and routing table; After cluster head node H receives the beacon frame of neighbours' cluster head node, if the path summation in the beacon frame of receiving is less than the path summation of oneself, the beacon frame load of cluster head node H is updated to the load of the beacon frame of receiving; If the path summation in the beacon frame of receiving is greater than the path summation of cluster head node H, the beacon frame load of cluster head node H is constant so; If the path summation in the beacon frame of receiving equals the path summation of cluster head node H, the beacon frame load of cluster head node H is updated to the union of the beacon frame load of receiving and own original beacon frame load so;
If it is all identical that cluster head node H detects the beacon frame load of all neighbours' cluster head node broadcasts, it checks the load of the beacon frame of receiving so; If the beacon frame that cluster head node H receives only comprises node ID and path summation that a node ID and path summation and they equal respectively cluster head node H oneself, cluster head node H will oneself be labeled as root node and initiate a bunch tree process of establishing so; If cluster head node H detects in the beacon frame of all neighbours' cluster head node broadcasts, node ID and the path summation that comprises oneself arranged more than two, and the node ID of oneself is all node ID intermediate value minimums in beacon frame, cluster head node H will oneself be labeled as root node and initiate a bunch tree process of establishing so.
The root node of said process election can realize that the networking average path minimizes, thereby reduces route cost and delay.Because route length minimizes, therefore will reduce delay and the cost that moves the routing update caused due to the route intermediate node.
In the method for the invention, after the cluster head node R is labeled as root node by oneself, send beacon frame, first three bit value of the load of beacon frame is 010, and load contents is for arriving the path of root node;
The process of establishing of bunch tree is initiated by the cluster head node R, comprises the following steps:
Step 201: start;
Step 202: the cluster head node is received the beacon frame that first three bit value of the load contents that root node or neighbours' cluster head node send is 010;
Step 203: the cluster head node judges whether the beacon frame load value minimum of two above neighbours' cluster head nodes, if so, carry out step 204, otherwise carry out step 205;
Step 204: the cluster head node, from the neighbours' cluster head node that has the minimum load value more than two, selects cluster head node that signal is the strongest as father node, carry out step 206;
Step 205: the root node of cluster head node selection load value minimum or cluster head node are as father node;
Step 206: the route length value that the path of cluster head node oneself arrival root node is set to father node arrival root node adds 1;
Step 207: after the cluster head node obtains father node, the beacon frame of going on the air, first three of a load bit value is 010, load contents is the path that oneself arrives root node;
Step 208: father node bunch is set and obtain to repeating step 202 to step 207 until all cluster head nodes add;
Step 209: finish.
Bunch tree that said process is set up can realize that the networking average path minimizes, and therefore can reduce route cost and delay.Because route length minimizes, therefore will reduce delay and the cost that moves the routing update caused due to the route intermediate node.
In the method for the invention, after new global function nodes X joins wireless sensor network, if receive at the appointed time the beacon frame that first three bit value of the load of neighbours' cluster head node broadcasts is 010, select the father node of neighbours' cluster head node of load value minimum as oneself, then the path that oneself arrives root node is set to the route length value that father node arrives root node and adds 1, the cluster head nodes X will oneself be labeled as, and the beacon frame of going on the air, first three of a load bit is 010, and oneself arrives the path of root node;
After the cluster head nodes X adds bunch tree, original other cluster head nodes in wireless sensor network upgrade the routing table of oneself according to following steps:
Step 301: start;
Step 302: after neighbours' cluster head node of cluster head nodes X is received the beacon frame of cluster head nodes X broadcast, increase the list item of cluster head nodes X in routing table, the length value of list item is 1, then broadcast beacon frame, first three of a load bit value is 011, i.e. the path list item that beacon frame load is the cluster head nodes X;
Step 303: after neighbours' cluster head node of neighbours' cluster head node is received the beacon frame that load is 011, check in routing table the list item that whether has node ID to equal the node ID of cluster head nodes X, if so, carry out step 304, otherwise carry out step 306;
Step 304: if the route length of list item that in neighbours' cluster head node of neighbours' cluster head node, node ID equals the node ID of cluster head nodes X is L
x1, in beacon frame, the route length of the list item of cluster head nodes X is L
x2, the cluster head node judges L
x1whether be greater than L
x2+ 1, if so, carry out step 305, otherwise carry out step 307;
Step 305: neighbours' cluster head node of neighbours' cluster head node is updated to L by the path of the list item of cluster head nodes X
x2+ 1, carry out step 307;
Step 306: neighbours' cluster head node of neighbours' cluster head node increases the list item of cluster head nodes X in routing table, the node ID that wherein node ID is the cluster head nodes X, and the path of the path list item that path is cluster head nodes X in beacon frame adds 1;
Step 307: neighbours' cluster head node broadcasts beacon frame of neighbours' cluster head node, first three of a load bit value is 011, i.e. the path list item that beacon frame load is cluster head nodes X in own routing table;
Step 308: repeating step 303 is to step 307, until in wireless sensor network, original cluster head node receives that from all neighbours' cluster head nodes first three bit value of load is 011 is the beacon frame of the path list item of cluster head nodes X, and the path value that in original cluster head node path table, the path value of the path list item of cluster head nodes X is not more than the path list item of cluster head nodes X in beacon frame adds 1;
Step 309: finish;
After all cluster head node updates routing tables, the beacon frame that neighbours' cluster head node broadcasts type of cluster head nodes X is 000; After the cluster head nodes X is received the beacon frame that first three bit value of load of neighbours' cluster head node is 000, set up the path list item of all neighbours' cluster head nodes in routing table, then contrast the routing table list item of all neighbours' cluster head nodes, the list item information of selecting paths length value minimum is set up the routing table of oneself, and the minimum path length value that the path value of own corresponding list item is set to corresponding list item in all neighbours' cluster head nodes adds 1;
Broadcast beacon frame after all cluster head node updates routing table processes finish, first three bit value of beacon frame load is 001, for determining new root node; If it is not minimum value that root node detects its path total length in wireless sensor network, oneself is labeled as to the cluster head node, and the cluster head node of path total length minimum will oneself be labeled as new root node;
New root node sends to original father node the beacon frame that first three bit value is 100, and initiates a bunch tree and upgrade, and comprises the following steps:
Step 401: start;
Step 402: after the original father node of new root node is received the beacon frame that first three bit value of new root node is 100, new root node is labeled as to father node, judge whether oneself is original root node simultaneously, if, carry out step 404, otherwise send the beacon frame that first three bit value is 100 and carry out step 403 to original father node;
Step 403: after father node is originally received the beacon frame that first three bit value is 100, the child node that sends the beacon frame that first three bit value is 100 is labeled as to father node, judge whether oneself is original root node simultaneously, if, carry out step 404, otherwise send the beacon frame that first three bit value is 100 and perform step again 403 to original father node; ;
Step 404: finish.
Said process has been guaranteed after the cluster head node joins network, still keeps minimizing of networking average path by a bunch tree renewal process, thereby reduces route cost and delay.Because route length minimizes, therefore reduced delay and the cost that moves the routing update caused due to the route intermediate node.
In the method for the invention, if the cluster head nodes X moves to new position, the nearest neighbours' cluster head node of its chosen distance root node is as new father node so; After neighbours' cluster head node is received the beacon frame of cluster head nodes X, the path value of the corresponding list item of cluster head nodes X in routing table is updated to 1, and sends the beacon frame that first three bit value is 101, i.e. the path list item that beacon frame load is the cluster head nodes X;
In wireless sensor network other cluster head nodes receive first three bit value be 101 and the beacon frame of the load contents path list item that is the cluster head nodes X after, according to following process, the cluster head nodes X list item in routing table is upgraded:
Step 501: start;
Step 502: judge whether other cluster head nodes receive that load is the beacon frame that cluster head nodes X list item and first three bit value are 101, if so, carry out step 503, otherwise carry out step 504 for the first time;
Step 503: the length that other cluster head nodes are updated to the path of cluster head nodes X list item in beacon frame adds 1, carry out step 506;
Step 504: the path whether path of the cluster head nodes X list item of other cluster head node judgements oneself is greater than cluster head nodes X list item in beacon frame adds 1, if so, carry out step 505, otherwise carry out step 506;
Step 505: the route length that other cluster head nodes are updated to the path of the cluster head nodes X list item of oneself in beacon frame adds 1;
Step 506: the beacon frame that other first three bit values of cluster head node broadcasts load are 101, the path list item that the beacon frame load is cluster head nodes X in own routing table;
Step 507: repeating step 502 is to step 506, until all cluster head nodes are received first three bit value of all neighbours' cluster head node broadcasts, be 101 and the load beacon frame that is the cluster head nodes X, and the path value that in all cluster head node path tables, the length value of the list item of cluster head nodes X is not more than the cluster head nodes X list item of all neighbours' cluster head nodes add 1;
Step 508: finish;
After all cluster head node updates routing tables, the beacon frame that first three bit value of neighbours' cluster head node broadcasts of cluster head nodes X is 000; After the cluster head nodes X is received the beacon frame that first three bit value of neighbours' cluster head node is 000, set up the path list item of all neighbours' cluster head nodes in routing table, then contrast the routing table list item of all neighbours' cluster head nodes, the list item of selecting paths length value minimum is set up the routing table of oneself, and the minimum path length value that the path value of own corresponding list item is set to corresponding list item in all neighbours' cluster head nodes adds 1;
All cluster head node updates routing table processes are broadcasted the beacon frame that first three bit value is 001 type, to determine new root node after finishing; If new root node is different from original root node, carries out a bunch tree and upgrade.
In the cluster head node motion, behind new position, said process has been guaranteed minimizing of networking average path, thereby reduces route cost and delay.Because route length minimizes, therefore reduced delay and the cost that moves the routing update caused due to the route intermediate node.
In the method for the invention, if the original neighbours' cluster head node of cluster head nodes X is not received at the appointed time the beacon frame of cluster head nodes X and is not received the beacon frame that first three bit value that load is cluster head nodes X list item is 101, the original neighbours' cluster head node of cluster head nodes X thinks that the cluster head nodes X lost efficacy, delete the list item of cluster head nodes X from routing table, and send the beacon frame that first three bit value is 110, the node ID that load contents is the cluster head nodes X; The described stipulated time is generally 2 times that send beacon frame interval.
Step 601: start;
Step 602: after in wireless sensor network, the cluster head node is received the beacon frame that first three bit value is the 110 loads node ID that is the cluster head nodes X, delete the list item of cluster head nodes X from routing table;
Step 603: the beacon frame that first three bit value of cluster head node broadcasts load is the 110 contents node ID that is the cluster head nodes X;
Step 604: repeating step 602 is to step 603 until all cluster head nodes have all been deleted the list item of cluster head nodes X;
Step 605: finish;
All cluster head node updates routing table processes are broadcasted the beacon frame that first three bit value is 001 after finishing, for determining new root node; If new root node is different from original root node, carries out a bunch tree and upgrade operation.
After the cluster head node failure, said process has been guaranteed minimizing of networking average path, thereby reduces route cost and delay.Because route length minimizes, therefore reduced delay and the cost that moves the routing update caused due to the route intermediate node.
Beneficial effect: the invention provides the implementation method that a kind of wireless sensor network of future generation builds, this implementation method can be widely used in Internet of Things and In-vehicle networking, for example, in the Internet of Things field, can be by wireless sensor network of future generation for detection of the environmental pollution in some zones, by implementation method provided by the invention, sensor node can be passed to the testing staff by airborne parameter, to detect in time air quality.In addition, the present invention also can be used for In-vehicle networking, by the present invention, can make the devices such as various ECU (Electrical Control Unit), intelligent instrument interconnect, collaborative work.
Embodiment:
The invention provides the implementation method that a kind of wireless sensor network of future generation builds, described wireless sensor network of future generation adopts the tree topology structure, shortened the address configuration delay, reduced the address configuration power consumption, simultaneously, realize route by tree, reduced the route power consumption, shortened routing delay.
Fig. 1 is network topology structure of wireless sensor schematic diagram of future generation of the present invention.Described wireless sensor network of future generation comprises three kinds of nodes: cluster head node 1, bunch interior nodes 2 and new node 3; Cluster head node 1, for having the global function node of route forwarding function, is the part of routed backbone; Bunch interior nodes 2 is for not having the partial function node of route forwarding function, for data acquisition; New node 3 is not for being labeled as global function node or the partial function node that cluster head node 1 is not labeled as bunch interior nodes 2 yet; The partial function node does not have route forwarding function.
Described wireless sensor network is divided into plural bunch 4, and each bunch 4 is comprised of a cluster head node 1 and more than one bunch of interior nodes 2, and in wireless sensor network, all cluster head nodes are built into a tree.
Fig. 2 is beacon frame type schematic diagram of the present invention.The wireless sensor network building process comprises two parts: initialization procedure and maintenance process; When starting, use wireless sensor network initialization procedure to be built network, the initialization procedure Exactly-once; After initialization procedure finishes, wireless sensor network enters maintenance process, for the treatment of adding of movement, inefficacy and the new node of cluster head node.
Node periodic broadcasting beacon frame in wireless sensor network, the load contents of first three bit identification frame of beacon frame load is form as shown in Figure 2.The the 4th and the 5th bit of beacon frame load is used for the type of identification nodes: 00 means new node, and 01 means bunch interior nodes, and 11 mean the cluster head nodes.
Fig. 3 is routing table structural representation of the present invention.Each cluster head node is preserved a routing table, and for recording the length that arrives other cluster head nodes, list item comprises node ID and two territories of path.
Wireless sensor network architecture of future generation in the present invention has following advantage:
1) path of cluster head node arrival root node minimizes, and therefore can effectively shorten path, thereby reduces route cost and delay;
2), because route length minimizes, therefore will reduce delay and the cost that moves the routing update caused due to the route intermediate node;
3) bunch interior nodes only communicates with this bunch of cluster head node, does not participate in routing forwarding work, has therefore reduced network traffic data, has avoided network to flood, and has also saved the energy of bunch interior nodes simultaneously;
4) quantity of cluster head node, much smaller than the quantity of bunch interior nodes, is carried out route by the cluster head node, and routing delay is less, and the route power consumption is lower.
The schematic flow sheet that Fig. 4 is cluster head node acquisition approach length of the present invention.After wireless sensor network starts, all global function node and partial function nodes all are set to new node; Then, all global function nodes all are designated oneself the cluster head node, and the beacon frame of going on the air, and first three bit value of the load of beacon frame is 000, and the partial function node in cluster head node one jumping scope will oneself be designated a bunch interior nodes;
The process that cluster head node H obtains the path that arrives other cluster head nodes comprises the following steps:
Step 101: start;
Step 102: after cluster head node H receives the beacon frame of neighbours' cluster head node, the list item of routing table in the routing table list item of comparison cluster head node H and beacon frame load;
Step 103: but judge that whether the routing table of cluster head node H exists the different list item in the identical path of node ID territory from routing table in beacon frame, if so, carry out step 104, otherwise carry out step 106;
Step 104: if in the routing table of cluster head node H, the length thresholding of the identical list item of node ID is L1, in beacon frame, the path territory of this list item is L2, and cluster head node H judges that whether L1 is greater than L2+1, if so, carry out step 105, otherwise carry out step 106;
Step 105: cluster head node H is L2+1 by the path area update of this list item in beacon frame, carry out step 106;
Step 106: judge non-existent list item in the routing table whether cluster head node H is arranged in the routing table in beacon frame, if so, carry out step 107, otherwise carry out step 108;
Step 107: if the path of this list item of beacon frame is L3, cluster head node H adds this list item in routing table, and the path area update is L3+1;
Step 108: cluster head node H judges whether to meet following two conditions simultaneously, if so, carry out step 109, otherwise returns to step 102;
Condition 1: the routing table of all neighbours' cluster head nodes is identical with the list item quantity of the routing table of oneself,
Condition 2: the routing table of the routing table of all neighbours' cluster head nodes and cluster head node H has in the list item of same node point ID, and the path that the path value of the list item of cluster head node H is not more than in the corresponding list item of neighbours' cluster head node adds 1;
Step 109: the routing table of cluster head node H has been set up;
Step 110: finish.
After cluster head node H acquisition approach table, broadcast beacon frame, first three bit value of the load of beacon frame is 001, the path summation of all list items in the node ID that initial value is oneself and routing table; After cluster head node H receives the beacon frame of neighbours' cluster head node, if the path summation in the beacon frame of receiving is less than the path summation of oneself, the beacon frame load of cluster head node H is updated to the load of the beacon frame of receiving; If the path summation in the beacon frame of receiving is greater than the path summation of cluster head node H, the beacon frame load of cluster head node H is constant so; If the path summation in the beacon frame of receiving equals the path summation of cluster head node H, the beacon frame load of cluster head node H is updated to the union of the beacon frame load of receiving and own original beacon frame load so.
If it is all identical that cluster head node H detects the beacon frame load of all neighbours' cluster head node broadcasts, it checks the load of the beacon frame of receiving so; If the beacon frame that cluster head node H receives only comprises node ID and path summation that a node ID and path summation and they equal respectively cluster head node H oneself, cluster head node H will oneself be labeled as root node and initiate a bunch tree process of establishing so; If cluster head node H detects in the beacon frame of all neighbours' cluster head node broadcasts, node ID and the path summation that comprises oneself arranged more than two, and the node ID of oneself is all node ID intermediate value minimums in beacon frame, cluster head node H will oneself be labeled as root node and initiate a bunch tree process of establishing so.
The root node of said process election can realize that the networking average path minimizes, thereby reduces route cost and delay.Because route length minimizes, therefore will reduce delay and the cost that moves the routing update caused due to the route intermediate node.
Fig. 5 is of the present invention bunch of tree process of establishing schematic flow sheet.After the cluster head node R is labeled as root node by oneself, send beacon frame, first three bit value of the load of beacon frame is 010, and load contents is for arriving the path of root node;
The process of establishing of bunch tree is initiated by the cluster head node R, comprises the following steps:
Step 201: start;
Step 202: the cluster head node is received the beacon frame that first three bit value of the load contents that root node or neighbours' cluster head node send is 010;
Step 203: the cluster head node judges whether the beacon frame load value minimum of two above neighbours' cluster head nodes, if so, carry out step 204, otherwise carry out step 205;
Step 204: the cluster head node, from the neighbours' cluster head node that has the minimum load value more than two, selects cluster head node that signal is the strongest as father node, carry out step 206;
Step 205: the root node of cluster head node selection load value minimum or cluster head node are as father node;
Step 206: the route length value that the path of cluster head node oneself arrival root node is set to father node arrival root node adds 1;
Step 207: after the cluster head node obtains father node, the beacon frame of going on the air, first three of a load bit value is 010, load contents is the path that oneself arrives root node;
Step 208: father node bunch is set and obtain to repeating step 202 to step 207 until all cluster head nodes add;
Step 209: finish.
Bunch tree that said process is set up can realize that the networking average path minimizes, and therefore can reduce route cost and delay.Because route length minimizes, therefore will reduce delay and the cost that moves the routing update caused due to the route intermediate node.
Fig. 6 a and Fig. 6 b are that cluster head node of the present invention adds a bunch tree schematic flow sheet.In Fig. 6 a, after new global function nodes X joins wireless sensor network, if receive at the appointed time the beacon frame that first three bit value of the load of neighbours' cluster head node broadcasts is 010, select the father node of neighbours' cluster head node of load value minimum as oneself, then the path that oneself arrives root node is set to the route length value that father node arrives root node and adds 1, the cluster head nodes X will oneself be labeled as, and the beacon frame of going on the air, first three of a load bit is 010, and oneself arrives the path of root node.
After the cluster head nodes X adds bunch tree, original other cluster head nodes in wireless sensor network upgrade the routing table of oneself according to following steps:
Step 301: start;
Step 302: after neighbours' cluster head node of cluster head nodes X is received the beacon frame of cluster head nodes X broadcast, increase the list item of cluster head nodes X in routing table, the length value of list item is 1, then broadcast beacon frame, first three of a load bit value is 011, i.e. the path list item that beacon frame load is the cluster head nodes X;
Step 303: after neighbours' cluster head node of neighbours' cluster head node is received the beacon frame that load is 011, check in routing table the list item that whether has node ID to equal the node ID of cluster head nodes X, if so, carry out step 304, otherwise carry out step 306;
Step 304: if the route length of list item that in neighbours' cluster head node of neighbours' cluster head node, node ID equals the node ID of cluster head nodes X is L
x1, in beacon frame, the route length of the list item of cluster head nodes X is L
x2, the cluster head node judges L
x1whether be greater than L
x2+ 1, if so, carry out step 305, otherwise carry out step 307;
Step 305: neighbours' cluster head node of neighbours' cluster head node is updated to L by the path of the list item of cluster head nodes X
x2+ 1, carry out step 307;
Step 306: neighbours' cluster head node of neighbours' cluster head node increases the list item of cluster head nodes X in routing table, the node ID that wherein node ID is the cluster head nodes X, and the path of the path list item that path is cluster head nodes X in beacon frame adds 1;
Step 307: neighbours' cluster head node broadcasts beacon frame of neighbours' cluster head node, first three of a load bit value is 011, i.e. the path list item that beacon frame load is cluster head nodes X in own routing table;
Step 308: repeating step 303 is to step 307, until in wireless sensor network, original cluster head node receives that from all neighbours' cluster head nodes first three bit value of load is 011 is the beacon frame of the path list item of cluster head nodes X, and the path value that in original cluster head node path table, the path value of the path list item of cluster head nodes X is not more than the path list item of cluster head nodes X in beacon frame adds 1;
Step 309: finish;
Upgrade the embodiment of routing table as shown in Figure 6 b, if the node ID of cluster head nodes X is 9, so in the cluster head nodes X joins network, according to step 302, after neighbours' cluster head node N8 of cluster head nodes X receives the beacon frame of cluster head nodes X broadcast, increase the list item of cluster head nodes X in routing table, the length value of list item is 1, broadcast beacon frame then, and first three of a load bit value is 011, be the path list item that the beacon frame load is the cluster head nodes X, 1; According to step 303, after neighbours' cluster head node N1 of neighbours' cluster head node N8 and N2 receive the beacon frame that load is 011, because do not have node ID to equal the list item of the node ID of cluster head nodes X in routing table, therefore increase the list item of cluster head nodes X in routing table, the node ID that wherein node ID is the cluster head nodes X, the path of the path list item that path is cluster head nodes X in beacon frame adds 1,2, then broadcast beacon frame, first three of a load bit value is 011, i.e. the path list item that beacon frame load is cluster head nodes X in own routing table; Neighbours' cluster head node N3 of N2, after N4 and N5 receive the beacon frame that load is 011, because do not have node ID to equal the list item of the node ID of cluster head nodes X in routing table, therefore increase the list item of cluster head nodes X in routing table, the node ID that wherein node ID is the cluster head nodes X, the path of the path list item that path is cluster head nodes X in beacon frame adds 1,3, then broadcast beacon frame, first three of a load bit value is 011, i.e. the path list item that beacon frame load is cluster head nodes X in own routing table; After neighbours' cluster head node N6 of N4 and N7 receive the beacon frame that load is 011, because do not have node ID to equal the list item of the node ID of cluster head nodes X in routing table, therefore increase the list item of cluster head nodes X in routing table, the node ID that wherein node ID is the cluster head nodes X, the path of the path list item that path is cluster head nodes X in beacon frame adds 1,4, then broadcast beacon frame, first three of a load bit value is 011, be the path list item that the beacon frame load is cluster head nodes X in own routing table, the routing table process of establishing finishes.
After all cluster head node updates routing tables, the beacon frame that neighbours' cluster head node broadcasts type of cluster head nodes X is 000; After the cluster head nodes X is received the beacon frame that first three bit value of load of neighbours' cluster head node is 000, set up the path list item of all neighbours' cluster head nodes in routing table, then contrast the routing table list item of all neighbours' cluster head nodes, the list item information of selecting paths length value minimum is set up the routing table of oneself, and the minimum path length value that the path value of own corresponding list item is set to corresponding list item in all neighbours' cluster head nodes adds 1.
Broadcast beacon frame after all cluster head node updates routing table processes finish, first three bit value of beacon frame load is 001, for determining new root node; If it is not minimum value that root node detects its path total length in wireless sensor network, oneself is labeled as to the cluster head node, and the cluster head node of path total length minimum will oneself be labeled as new root node.
Fig. 7 a and Fig. 7 b are that of the present invention bunch of tree upgrades schematic flow sheet.In Fig. 7 a, new root node sends to original father node the beacon frame that first three bit value is 100, and initiates a bunch tree and upgrade, and comprises the following steps:
Step 401: start;
Step 402: after the original father node of new root node is received the beacon frame that first three bit value of new root node is 100, new root node is labeled as to father node, judge whether oneself is original root node simultaneously, if, carry out step 404, otherwise send the beacon frame that first three bit value is 100 and carry out step 403 to original father node;
Step 403: after father node is originally received the beacon frame that first three bit value is 100, the child node that sends the beacon frame that first three bit value is 100 is labeled as to father node, judge whether oneself is original root node simultaneously, if, carry out step 404, otherwise send the beacon frame that first three bit value is 100 and carry out step 403 to original father node;
Step 404: finish.
Shown in following Fig. 7 b, after the cluster head nodes X adds bunch tree, cluster head node N2 becomes new root node, after the original father node N4 of new root node N2 receives the beacon frame that first three bit value of new root node is 100, new root node N2 is labeled as to father node, because cluster head node N4 is original root node, therefore a bunch tree renewal process finishes.
Said process has been guaranteed after the cluster head node joins network, still keeps minimizing of networking average path by a bunch tree renewal process, thereby reduces route cost and delay.Because route length minimizes, therefore reduced delay and the cost that moves the routing update caused due to the route intermediate node.
Fig. 8 a and Fig. 8 b are cluster head node motion schematic flow sheet of the present invention.In Fig. 8 a, if the cluster head nodes X moves to new position, the nearest neighbours' cluster head node of its chosen distance root node is as new father node so; After neighbours' cluster head node is received the beacon frame of cluster head nodes X, the path value of the corresponding list item of cluster head nodes X in routing table is updated to 1, and sends the beacon frame that first three bit value is 101, i.e. the path list item that beacon frame load is the cluster head nodes X.
In wireless sensor network other cluster head nodes receive first three bit value be 101 and the beacon frame of the load contents path list item that is the cluster head nodes X after, according to following process, the cluster head nodes X list item in routing table is upgraded:
Step 501: start.
Step 502: judge whether other cluster head nodes receive that load is the beacon frame that cluster head nodes X list item and first three bit value are 101, if so, carry out step 503, otherwise carry out step 504 for the first time.
Step 503: the length that other cluster head nodes are updated to the path of cluster head nodes X list item in beacon frame adds 1, carry out step 506.
Step 504: the path whether path of the cluster head nodes X list item of other cluster head node judgements oneself is greater than cluster head nodes X list item in beacon frame adds 1, if so, carry out step 505, otherwise carry out step 506.
Step 505: the route length that other cluster head nodes are updated to the path of the cluster head nodes X list item of oneself in beacon frame adds 1, carry out step 506.
Step 506: the beacon frame that other first three bit values of cluster head node broadcasts load are 101, the path list item that the beacon frame load is cluster head nodes X in own routing table.
Step 507: repeating step 502 is to step 506, until all cluster head nodes are received first three bit value of all neighbours' cluster head node broadcasts, be 101 and the load beacon frame that is the cluster head nodes X, and the path value that in all cluster head node path tables, the length value of the list item of cluster head nodes X is not more than the cluster head nodes X list item of all neighbours' cluster head nodes add 1.
Step 508: finish.
Shown in following Fig. 8 b, the cluster head nodes X moves to new position, and neighbours' cluster head node N3 of cluster head nodes X, after N4 and N7 receive the beacon frame of cluster head nodes X, the path value of the corresponding list item of cluster head nodes X in routing table is updated to 1, and sends the beacon frame that first three bit value is 101, after neighbours' cluster head node N2 of cluster head node N4 and N6 receive that load is cluster head nodes X list item and first three bit value beacon frame that is 101, the length that the path of cluster head nodes X list item is updated in beacon frame adds 1,2, then broadcast the beacon frame that first three bit value of load is 101, the path list item that the beacon frame load is cluster head nodes X in own routing table, after neighbours' cluster head node N1 of cluster head node N2 and N8 receive that load is cluster head nodes X list item and first three bit value beacon frame that is 101, the length that the path of cluster head nodes X list item is updated in beacon frame adds 1,3, then broadcast the beacon frame that first three bit value of load is 101, the path list item that the beacon frame load is cluster head nodes X in own routing table, after neighbours' cluster head node N5 of cluster head node N6 receives that load is cluster head nodes X list item and first three bit value beacon frame that is 101, the length that the path of cluster head nodes X list item is updated in beacon frame adds 1, 3, then broadcast the beacon frame that first three bit value of load is 101, the path list item that the beacon frame load is cluster head nodes X in own routing table, like this, all cluster head nodes have received that first three bit value of all neighbours' cluster head node broadcasts is 101 and the load beacon frame that is the cluster head nodes X, and the path value that in all cluster head node path tables, the length value of the list item of cluster head nodes X is not more than the cluster head nodes X list item of all neighbours' cluster head nodes adds 1, the routing table renewal process finishes.
After all cluster head node updates routing tables, the beacon frame that first three bit value of neighbours' cluster head node broadcasts of cluster head nodes X is 000; After the cluster head nodes X is received the beacon frame that first three bit value of neighbours' cluster head node is 000, set up the path list item of all neighbours' cluster head nodes in routing table, then contrast the routing table list item of all neighbours' cluster head nodes, the list item of selecting paths length value minimum is set up the routing table of oneself, and the minimum path length value that the path value of own corresponding list item is set to corresponding list item in all neighbours' cluster head nodes adds 1.
All cluster head node updates routing table processes are broadcasted the beacon frame that first three bit value is 001 type, to determine new root node after finishing; If new root node is different from original root node, carries out a bunch tree and upgrade.
In the cluster head node motion, behind new position, said process has been guaranteed minimizing of networking average path, thereby reduces route cost and delay.Because route length minimizes, therefore reduced delay and the cost that moves the routing update caused due to the route intermediate node.
Fig. 9 a and Fig. 9 b are cluster head node failure schematic flow sheet of the present invention.In Fig. 9 a, if the original neighbours' cluster head node of cluster head nodes X is not received at the appointed time the beacon frame of cluster head nodes X and is not received the beacon frame that first three bit value that load is cluster head nodes X list item is 101, the original neighbours' cluster head node of cluster head nodes X thinks that the cluster head nodes X lost efficacy, delete the list item of cluster head nodes X from routing table, and send the beacon frame that first three bit value is 110, the node ID that load contents is the cluster head nodes X;
Step 601: start;
Step 602: after in wireless sensor network, the cluster head node is received the beacon frame that first three bit value is the 110 loads node ID that is the cluster head nodes X, delete the list item of cluster head nodes X from routing table;
Step 603: the beacon frame that first three bit value of cluster head node broadcasts load is the 110 contents node ID that is the cluster head nodes X;
Step 604: repeating step 602 is to step 603 until all cluster head nodes have all been deleted the list item of cluster head nodes X;
Step 605: finish;
Shown in following Fig. 9 b, the original neighbours' cluster head node N8 of cluster head nodes X does not receive at the appointed time the beacon frame of cluster head nodes X and does not receive the beacon frame that first three bit value that load is cluster head nodes X list item is 101, the original neighbours' cluster head node N8 of cluster head nodes X thinks that the cluster head nodes X lost efficacy, delete the list item of cluster head nodes X and send the beacon frame that first three bit value is 110, the node ID that load contents is the cluster head nodes X from routing table; After neighbours' cluster head node N1 of cluster head node N8 and N2 receive the beacon frame that first three bit value is the 110 loads node ID that is the cluster head nodes X, delete the list item of cluster head nodes X from routing table, and first three bit value of broadcast load beacon frame that is the 110 contents node ID that is the cluster head nodes X; Neighbours' cluster head node N3 of cluster head node N2, after N4 and N5 receive the beacon frame that load is 011, after receiving the beacon frame that first three bit value is the 110 loads node ID that is the cluster head nodes X, delete the list item of cluster head nodes X from routing table, and first three bit value of broadcast load beacon frame that is the 110 contents node ID that is the cluster head nodes X; After neighbours' cluster head node N6 of N4 and N7 receive the beacon frame that load is 011, after receiving the beacon frame that first three bit value is the 110 loads node ID that is the cluster head nodes X, delete the list item of cluster head nodes X from routing table, so far, all cluster head nodes have all been deleted the list item of cluster head nodes X, and process finishes.
All cluster head node updates routing table processes are broadcasted the beacon frame that first three bit value is 001 after finishing, for determining new root node; If new root node is different from original root node, carries out a bunch tree and upgrade operation.
After the cluster head node failure, said process has been guaranteed minimizing of networking average path, thereby reduces route cost and delay.Because route length minimizes, therefore reduced delay and the cost that moves the routing update caused due to the route intermediate node.
In sum, the invention provides the implementation method that a kind of wireless sensor network of future generation builds, technique can be applied to agricultural modernization, medical treatment & health, the numerous areas such as military and national defense, for example, in the agricultural modernization field, network communication of wireless sensor technology of future generation can be applied to the modern installations Agricultural Environmental Monitoring controls, like this, the agricultural laborer is not subject to geographic restriction, can access at any time the sensor node in farmland by the Internet, obtain farmland temperature, humidity, the environmental parameters such as luminous intensity, grasp in time the growing environment of crops, guarantee that crops grow up healthy and sound.Due to sensor node have volume little, cheap, be easy to arrange, be easy to the characteristics such as maintenances, and the Internet have geographical position cover extensive, easy to use, the characteristics such as friendly interface, expense are cheap, therefore, present technique has very high promotional value.
Embodiment 1
Simulation parameter based on table 1, the present embodiment has been simulated method in the present invention, and performance evaluation is as follows: along with the increase of transmission range, routing table is set up cost and is decreased, therefore, the cost of cluster head node by obtaining optimal path in initialization procedure is along with the increase of transmission range reduces.When the cluster head node adds network, by the beacon frame of accepting neighbours' cluster head node, set up routing table, because the increase of transmission range causes the increase of neighbours' cluster head number of nodes, and network diameter can decrease, and the cost of therefore setting up routing table is tending towards constant.In wireless sensor network building process of future generation, the average cost of each cluster head node is 10, average retardation 30ms.
Table 1 simulation parameter