Summary of the invention
The object of this invention is to provide a kind of reliable and be easy to the layering network-building method based on master-slave node communication network that realizes.
This layering network-building method based on master-slave node communication network provided by the invention, host node all can monitor the message communication network from node with each, send other networking and ask from node, and be recorded as the neighbor node of oneself around analyzing; The method comprises the steps:
Step 1, host node sends calling i level and to network broadcasting command from node, and initiatively delay time D
iwait for and networking from node application; Wherein i to be initial value be 0 nonnegative integer;
Step 2, all receive calling i level from node networking broadcasting command from node, stand-by period T first separately
di, as stand-by period T
diafter end, networked from node at ensuing stand-by period T
diinterior automated randomized selection time point forwards described broadcasting command; Do not network from node then at ensuing networking application time t
iin, automated randomized selection network entry time point carries Self address and initiatively sends request to communication network the order that networks;
Step 3, host node delay time D
iafter wait terminates, host node successively with in described delay time, host node can listen to and sent apply for networking carry out point-to-point networking from node and confirm, and to being 0 grade of node from peer distribution, what receiving the confirmation that networks carries out confirmation response from node;
Step 4, host node carries out point-to-point communication with the i-1 level to have networked from node, obtain respectively its record the information of neighbor nodes of preservation; If its neighbor node does not network, then host node carries out networking confirmation to this neighbor node, and is assigned as i level node to this neighbor node, and what receiving the confirmation that networks carries out confirmation response from node;
Step 5, host node carries out point-to-point communication with the i level to have networked from node, obtain respectively its record the information of neighbor nodes of preservation; If its neighbor node does not network, then host node carries out networking confirmation to this neighbor node, and is assigned as i level node to this neighbor node, and what receiving the confirmation that networks carries out confirmation response from node;
Step 6, repeats step 1 to step 5, finds i+1 level node, until all neighbor nodes from node all network successfully, show that networking completes by i level node.
Described stand-by period T
diwith described networking application time t
ican set or revise before networking; Described networking application time t
iat described stand-by period T
dijust timing is started after end.
Described host node sends the described delay time D that described broadcasting command is waited at every turn
ibe not less than stand-by period T described in current this broadcasting command of i rank
di(i+1) doubly and described networking application time t
isum; Described delay time D
iwith described stand-by period T
dichange and change.
Described neighbor node is in communication process, if the transmission information of A node can by B nodes listen to, then A node is called the neighbor node of B node.
Described host node is initiator and the end side of a communication process, possesses the function obtained from the information of neighbor nodes of node; Based on information of neighbor nodes, host node can be restrained, optimize communicate path, automatically forms many active communication paths.
Described is the responder of a communication process from node; Control from node by described host node.
Described i level from node be communicate with host node need i via node from node; Wherein i to be initial value be 0 nonnegative integer.
Described calling i level comprises sequence number, stand-by period T from node networking broadcasting command
di, network application time t
i, hop count; Wherein i to be initial value be 0 nonnegative integer.
Described in this of described host node transmission, the sequence number of broadcasting command is different from the sequence number of its last described broadcasting command sent.
Described calling i level is equal with i from the initial value of the hop count of node networking broadcasting command; Described broadcasting command often forwards once, and described hop count subtracts 1, stops forwarding when its value is kept to 0.
After the described networking receiving host node from node confirms order, unless inbound information is lost, otherwise no longer initiatively send the request of networking.
What networked in described step 2 is less than the rank of calling out networking broadcasting command described in this from the rank of node itself, then automatically forward described broadcasting command; Otherwise do not carry out the forwarding of described broadcasting command.
Describedly receive identical calling i level from node and to network broadcasting command from node, then abandon this order and disregard.
Described identical calling i level is the described broadcasting command that sequence number is identical from node networking broadcasting command.
Described information of neighbor nodes comprises the address information of neighbor node.
Compared with prior art, the present invention has following advantage:
1, during communications network deployment, do not need record from node communication address, by host node with cooperatively interact from node and initiatively complete networking, in guarantee network, mailing address accurately and reliably.After networking completes, host node can the feedback communication network information at any time, ensures the accurate and effective, reliable of communication network information.
2, newly-increased communication node or replacing communication node in communication network, the present invention all can initiatively find, does not need manual intervention, significantly improves the intellectuality of communication network.
3, in layering networking process, because node has monitor function, can form the node of a large amount of neighbours each other, in other words, define a large amount of alternate communication paths, therefore one or several communication path interrupts final communication efficiency impact less.
4, host node obtains a large amount of information of neighbor nodes, and this information contributes to the network optimization, is beneficial to the convergence of communication network, reduces communication repeating progression, improves communication efficiency; In addition, this information contributes to forming backbone communication network (the extraordinary network of communication reliability); During communication, backbone network is selected to be conducive to promoting communication success rate.
Embodiment: host node carries out networking to unknown number from node.Each all networking from the neighbor node of node confirms to show completing of networking.
If existing single host node and some from node, these nodes all can monitor the message in communication network, all can analyze and record other information from node sending networking around oneself and ask; Host node also possesses the function obtained from the information of neighbor nodes of node.
Step 1, it is 0 that host node BB transmits Sequence Number, the stand-by period is T
d0, the networking application time is t
0, hop count is 0, calling 0 grade networks from node broadcasting command, and initiatively time delay D
0time wait networks from node application.
Step 2, from node C1, all receives this networking broadcasting command from node C2 with from node C3, find sequence number and the sequence number of last time inconsistent, then three from node respectively renewal sequence number be 0, then wait for T separately
d0time.Because these three all do not receive the networking confirmation of host node, therefore at ensuing t from node
0in time period, carry Self address from node C1 Stochastic choice time point and send request to communication network the order that networks, carry Self address from node C2 Stochastic choice time point and send request to communication network the order that networks, carry Self address from node C3 Stochastic choice time point and send request to communication network the order that networks.
Step 3, at D
0in time, host node BB listens to the networking application sent from node C2, and host node BB listens to the networking application sent from node C1, and host node BB listens to the networking application sent from node C3.
Step 4, host node BB is at stand-by period D
0after end, host node BB confirms to sending from node C2 to network, and is assigned as 0 grade of node from node C2, carries out confirmation response from node C2; Host node BB confirms to sending from node C1 to network again, and is assigned as 0 grade of node from node C1, carries out confirmation response from node C1; Then host node BB confirms to sending from node C3 to network again, and is assigned as 0 grade of node from node C3, carries out confirmation response from node C3.
Step 5, host node BB and the neighbor node obtained from node C2 point-to-point communication from node C2, be from node C1 with from node C3 from the neighbor node of node C2, do not network from node; Host node BB and the neighbor node obtained from node C1 point-to-point communication from node C1, be from node C2 from the neighbor node of node C1, do not network from node; Host node BB and the neighbor node obtained from node C3 point-to-point communication from node C3, be from node C2 from the neighbor node of node C3, do not network from node.
Step 6, it is 1 that host node BB transmits Sequence Number, the stand-by period is T
d1, the networking application time is t
1, hop count is 1, calling 1 grade networks from node broadcasting command, and initiatively time delay D
1time wait networks from node application.
Step 7, from node C1, all receives this networking broadcasting command from node C2 with from node C3, find sequence number and last time inconsistent, then renewal sequence number is 1 respectively, then waits for T separately
d1time.Because these three have received the networking confirmation of host node all from node, and this calling networks larger than self rank from the rank of node, therefore at ensuing T
d1in time period, forward after broadcast networking transferring order number of times is subtracted 1 by node C1 Stochastic choice time point, forward after broadcast networking transferring order number of times is subtracted 1 by node C2 Stochastic choice time point, forward after broadcast networking transferring order number of times is subtracted 1 by node C3 Stochastic choice time point.
If what networked is less than the rank of calling out networking broadcasting command described in this from the rank of node itself, then automatically forward described broadcasting command; Otherwise do not carry out the forwarding of described broadcasting command.Such as from node this as 2 grades of nodes, but current broadcasting command is calling 1 grade networks from node, so these 2 grades of nodes are the forwardings not carrying out this broadcasting command.
Step 8, from node C4, receives networking broadcasting command respectively from node C5, find sequence number and last time inconsistent, then renewal sequence number is 1 respectively, then waits for T separately
d1time.Because these two all do not receive the networking confirmation of host node, therefore at ensuing t from node
1in time period, carry Self address from node C4 Stochastic choice time point and send request to communication network the order that networks, carry Self address from node C5 Stochastic choice time point and send request to communication network the order that networks.
Step 9, host node BB and the neighbor node obtained from node C2 point-to-point communication from node C2, be from node C1 from the neighbor node of node C2, from node C3, from node C4, from node C5, do not network from node C4 with from node C5.Host node BB then with from node C2 for relaying respectively to from node C4 and from node C5 carry out networking confirm, and give be assigned as 1 grade from node C4 with from node C5, from node C4 and from node C5 carry out respectively confirmations reply.Host node BB and the neighbor node obtained from node C1 point-to-point communication from node C1, be from node C2 with from node C4 from the neighbor node of node C1, do not network from node.Host node BB and the neighbor node obtained from node C3 point-to-point communication from node C3, be from node C2 with from node C5 from the neighbor node of node C3, do not network from node.
Step 10, host node BB, to obtain the neighbor node from node C4 from node C2 for relaying and from node C4 point-to-point communication, is from node C1 with from node C2 from the neighbor node of node C4, does not network from node; Host node BB, to obtain the neighbor node from node C5 from node C2 for relaying and from node C5 point-to-point communication, is from node C2 with from node C3 from the neighbor node of node C5, does not network from node.
Step 11, it is 2 that host node BB transmits Sequence Number, the stand-by period is T
d2, the networking application time is t
2, hop count is 2, calling 2 grades networks from node broadcasting commands, and initiatively time delay D
2time wait networks from node application.
Step 12, from node C1, all receives this networking broadcasting command from node C2 with from node C3, find sequence number and last time inconsistent, then renewal sequence number is 2 respectively, then waits for T separately
d2time.Because these three have received the networking confirmation of host node all from node, and this calling networks larger than self rank from the rank of node, therefore at ensuing T
d2in time period, forward after broadcast networking transferring order number of times is subtracted 1 by node C1 Stochastic choice time point, forward after broadcast networking transferring order number of times is subtracted 1 by node C2 Stochastic choice time point, forward after broadcast networking transferring order number of times is subtracted 1 by node C3 Stochastic choice time point.
Step 13, from node C4, from node C5 receive respectively from node C1, from node C2, from node C3 forward networking broadcasting command, find sequence number and last time inconsistent, then renewal sequence number is 2 respectively, then waits for T separately
d2time.Because these two have received the networking confirmation of host node all from node, and this calling networks larger than self rank from the rank of node, therefore at ensuing T
d2in time period, forward after broadcast networking transferring order number of times is subtracted 1 by node C4 Stochastic choice time point, forward after broadcast networking transferring order number of times is subtracted 1 by node C5 Stochastic choice time point.
Step 14, from node C1, from node C2, from node C3 receive respectively from node C4, from node C5 forward networking broadcasting command, find sequence number consistent with last time, then dropping packets is disregarded.
Step 15, from node C6 receive from node C5 forward networking broadcasting command, find sequence number and last time inconsistent, then renewal sequence number is 2, then waits for T
d2time.Because the networking not receiving host node from node C6 confirms, therefore at ensuing t
2in time period, carry Self address from node C6 Stochastic choice time point and send request to communication network the order that networks.
Step 16, host node BB, to obtain the neighbor node from node C4 from node C2 for relaying and from node C4 point-to-point communication, is from node C1 with from node C2 from the neighbor node of node C4, does not network from node; Host node BB, to obtain the neighbor node from node C5 from node C2 for relaying and from node C5 point-to-point communication, is from node C2 from the neighbor node of node C5, from node C3 with from node C6, does not network from node C6.Host node BB then with from node C2, from node C5 for relaying to carry out from node C6 networking confirm, and give be assigned as 2 grades from node C6, from node C6 carry out confirmations reply.
Step 17, host node BB, with from node C2, obtains neighbor node from node C6 for relaying with from node C6 point-to-point communication from node C5, is from node C5 from the neighbor node of node C6, less than non-network access node.
So far, 3 grades of network organizings as shown in Figure 3 complete.
All nodes all only monitor the information in network, hear, save as the neighbor node of oneself, do not forward the information heard.
When carrying out networking and confirming, host node can be carried out level allocation from node, such as is assigned as 0 grade of node (can record the rank belonging to oneself from node).Such as, broadcasting command, when calling 1 grade of node networks, is in fact sent to communication network by host node, and all 0 grade of nodal test networked to being that calling 1 grade of node networks, then having networked from node and automatically forwarded.If therefore there is no the class information belonging to oneself from node, just this broadcasting command should cannot be forwarded from node.Host node finds 1 grade of node by 0 grade of node in this way, finds 2 grades of nodes, by that analogy by 0 grade of node and 1 grade of node.In this way, host node rapidly and efficiently complete networking, realize the convergence to network and optimization.
According to sequential as shown in Figure 2, the present invention adopts following formula can calculate networking deadline ideally.
(1)
(2)
In formula,
t i represent the
ilayer network networking completes the required time,
t di represent in message the stand-by period (the of specifying
i-1the all node of layer forwards networking message required time),
t i represent the
ithe time span section that layer network application networks.
t s for completing the time required for the whole process of networking,
nfor the macroscopic view topology number of plies of whole network,
tbe a communication cycle time used,
c i represent network the
ilayer from number of nodes.
The present invention is at a kind of ideal situation and under the prerequisite set up of some hypothesis, adopts formula (1) and formula (2) calculating networking deadline, embody networking efficiency of the present invention.
Several hypothesis that the present invention adopts are as follows:
1, each only receiving from node networks confirmation once, and only obtains its neighbor node of secondary from this from node.
2, no matter how many communication data is, and its communication process time is fixed value.
3, the situation of Communications failure is not had.
For the network of 4 grades, under supposing current state, can with host node direct communication from number of nodes be 512, what need 1 via node could communicate with host node has 256 from node, what need 2 via nodes could communicate with host node has 128 from node, what need 3 via nodes could communicate with host node has 64 from node, then have
c 0=512,
c 1=256,
c 2=128,
c 3=64;
n=4-1=3.If
t di be 5 minutes,
t i be 5 minutes,
tbe 1 second (supposing that a communication cycle is 1 second), then
(1)
;
;
;
;
(2)
Show that the present invention is about 149 minutes at the networking deadline to above-mentioned network thus.