Disclosure of Invention
In order to solve the technical problems, the invention provides a method for repairing the cut point fault through the network connectivity of a mobile sensor.
The technical scheme adopted by the invention is as follows: the method for repairing the cut point fault by the mobile sensor network connection comprises the following steps:
s1, the cut point node calculates the selection set of each one-hop neighbor node according to the two-hop neighbor table;
s2, determining the execution nodes in each selection set, specifically: if the selection set comprises one hop neighbor node, the one hop neighbor node is an execution node of the selection set; if the selection set comprises at least two one-hop neighbor nodes, determining an execution node of the selection set based on the distance between each one-hop neighbor node and a point of a cut point and the maximum non-cascade moving distance;
and S3, when the cut point node is in fault, the execution node of each selection set automatically moves to the position of the cut point node, and finally the repair is completed.
Step S1 specifically includes:
s11, acquiring a two-hop neighbor table of the cut point node through a route;
s12, taking the one-hop neighbor node and the two-hop neighbor node corresponding to the one-hop neighbor node as a row, and numbering the rows from small to large;
s13, if the same neighbor nodes exist in a certain two rows, modifying the row with the larger number into the row with the smaller number;
s14, repeating the step S13 until all the neighbor nodes of the rows are traversed; and obtaining a selection set to which each one-hop neighbor node belongs.
In step S2, the elected set includes at least two one-hop neighbor nodes, and the process of determining the executing node is:
according to the distance between the one-hop neighbor node and the cut node and the maximum non-cascade moving distance of the neighbor node, determining a selection function expression of the one-hop neighbor node as follows:
wherein, Q (D)*,dm) (ii) election function representing one-hop neighbor node, D*Represents the distance between the one-hop neighbor node and the cut point node, dmRepresenting the maximum non-cascaded moving distance of the one-hop neighbor node;
and selecting the one-hop neighbor node with the maximum election function in the election set as an execution node of the election set.
Step S2, after selecting the execution node of each selection set, further includes notifying an initial connection progress of each execution node, where the connection progress specifically is: and the selection set where the execution node is located is a proportion of one-hop neighbor nodes in all one-hop neighbor nodes of the cut node.
Step S3 specifically includes:
s31, the executing node periodically detects the working state of the corresponding node, when finding that the node of the cutting point has a fault, the step S32 is executed, otherwise, the step S31 is repeated;
s32, setting the initial cascade mobile index of each execution node as 1, wherein the initial cascade mobile group comprises corresponding execution nodes;
s33, the moving speed and direction of the nodes in the same cascade moving group are consistent, and cascade moving is initiated;
s34, in the process of cascade movement, if the movement distance of the node in the cascade movement group when the next period arrives exceeds the limit distance, adding 1 to the cascade index of the execution node of the cascade movement group, and adding the next hop neighbor node of the corresponding node into the current cascade movement group;
s35, when new connection is found, the two execution nodes interact mutual communication progress, the sum of the respective communication progress of the two execution nodes is used as the new communication progress of the two execution nodes, whether the new communication progress reaches 1 or not is judged, if yes, repair is completed, and movement is stopped; otherwise, executing step S35;
s36, calculating a culling function according to the cascade movement index and the selecting function of the execution node, continuously moving the execution node with the smaller culling function, and returning to the step S33.
The moving speed calculation formula in step S34 is:
where λ represents a correction factor, v represents an initial velocity of the node, and I represents a cascade movement index of the executing node. In step S36, the elimination function calculation formula is:
Id=IR-Q
wherein, R represents the maximum communication radius between nodes, and Q represents the selection function value of the executive node.
The invention has the beneficial effects that: in the invention, the cut point node calculates a selection set where each one-hop neighbor node is located according to a two-hop neighbor table, then selects an execution node for executing a mobile repair task when a fault occurs in each selection set, and then the execution node can periodically detect whether the cut point has a fault or not, and automatically initiates mobile repair when the cut point has a fault so as to realize network reconnection; the method of the invention comprises the following advantages:
1. the selection set is separated by adopting a concurrent set searching mode, so that the time complexity of the program is reduced to a certain degree;
2. accurately participating in the node combination of mobile restoration in advance through a selecting function, and simultaneously ensuring that the number of the node combination is the minimum under the known condition and the restoration effect is the best expected group;
3. in the whole mobile repair process, partial node movement is stopped in advance through the elimination index, so that the total movement expense can be reduced, and the final repair effect cannot be influenced
4. Through the cascade speed reduction algorithm, the total moving distance can be reduced by increasing a certain repairing time under the more extreme condition.
Detailed Description
In order to facilitate the understanding of the technical contents of the present invention by those skilled in the art, the present invention will be further explained with reference to the accompanying drawings.
Referring to fig. 1, the present invention provides a method for repairing connectivity of a mobile sensor network for a cut point fault, and the implementation steps of the present invention are specifically described below with reference to the accompanying drawings.
The cut point node calculates a selection set where each one-hop neighbor node is located according to the two-hop neighbor table, then selects an execution node for executing a mobile repair task when a fault occurs in each selection set, and then the execution node periodically detects whether the cut point has a fault or not, and automatically initiates mobile repair when the cut point has a fault, so that the network is communicated again.
A1, as shown in FIG. 2, is a flow chart of cut point node determination selection set, first obtaining a local two-hop neighbor table through routing, then traversing the table by a parallel-searching method, and determining the selection set for each one-hop neighbor. The specific method comprises the following steps: firstly setting the number of the selection set of the one-hop neighbor of the ith row in the table as Si ═ i, then starting a double-layer cycle, wherein the outer layer cycle is from top to bottom, the inner layer cycle is from bottom to top, the cycle content is whether two rows traversed currently have common elements, if so, changing the selection set number with a large row number into the corresponding selection set number with a small row number, then jumping out of the inner layer cycle, otherwise, continuing the inner layer cycle. And after the circulation is finished, the one-hop neighbors with the same number of the selection set are positioned in the selection set.
The invention adopts the idea of parallel searching sets, traverses the two-hop neighbor table of the self, and assumes that each one-hop neighbor node in the initial state is a selection set, the number of the selection set is the corresponding row number, and the selection set number is changed into the corresponding selection set number with small row number when the two rows with the same elements exist and the row number is large. And the selection set is separated by adopting a concurrent set searching mode, so that the time complexity of the program is reduced to a certain degree.
Taking the topology shown in fig. 3 as an example, it is known that the node 4 is one of the cut points of the network, and its two-hop neighbor table is shown in fig. 4, the one-hop neighbor of the node 4 has nodes 2,3,5,6,7, the two-hop neighbor of the node 4 has the two-hop neighbor 1 corresponding to the one-hop neighbor 2, the two-hop neighbor 1 corresponding to the one-hop neighbor 3, the two-hop neighbor 8 corresponding to the one-hop neighbor 5, the two- hop neighbor 7,9 corresponding to the one-hop neighbor 6, and the two-hop neighbor 6 corresponding to the one-hop neighbor 7. Then, traversing the neighbor table, it can find: lines 1 and 2 have common element 1, lines 4 and 5 have common elements 6,7, and no common element exists between any two of the other lines. So the cull number for lines 1,2 is finally 1, line 3 holds the original cull number 3, and the cull number for lines 4,5 is 4. The final result of the selection set is shown in fig. 5, where nodes 2 and 3 are located in a selection set, nodes 6 and 7 are located in a selection set, and node 5 is located in a selection set alone.
A2, as shown in FIG. 6, it shows a step diagram of selecting and extracting executing nodes, where a cut point first determines a selection set of one-hop neighbors, then these one-hop neighbors obtain coordinate information of their own neighbors, calculate selection function values according to the coordinate information, then summarize the selection function values to the cut point node, and then the cut point node selects a proper executing node according to the selection set and informs its related information.
The election function value of the invention is negatively correlated with the distance from the one-hop neighbor node to the cut point and positively correlated with the maximum non-cascade moving distance in the direction of the cut point, and the distance refers to the distance traveled by the node when the node moves to the cut point to reach the maximum communication distance limit with some other neighbor for the first time. The former can be calculated by acquiring the coordinates of the cutting point and the coordinates of the cutting point, and the latter can be calculated by combining the coordinates of the neighbor nodes and the maximum communication distance limit. The node combination participating in mobile repair is accurately selected in advance through a selecting function, and meanwhile, the combination is guaranteed to be a group which has the minimum number under the known condition and the best repair effect expectation.
A21, the calculation method of the election function is as follows: firstly, calculating the travel distance when the maximum communication distance is reached between the node and other neighbor nodes (except the node in the selection set) in the process of moving to the cutting point position, namely the travel distance is called as the limit displacement for short, and assuming that the initial coordinate of the node is (x)
0,y
0) The coordinate of the cutting point is (x)
*,y
*) Neighbor node N
iHas the coordinates of (nx)
i,ny
i) The distance between the node and the cutting point can be calculated
The node and the neighbor node N
iIs a distance of
Neighbor node N
iDistance from cutting point
According to the cosine theorem, the cosine value of an included angle with the node as an intersection point is
Let the maximum communication radius between nodes be R and the ultimate displacement be d
iFrom a quadratic equation of unity
Can be solved to d
i. Maximum available non-cascaded travel distance d
mMin { di,0 < i < N }, wherein N is a neighbor node N needing to be calculated
iThe number of (2). For the convenience of calculation, only considering the distance from the cutting point and the influence of the maximum non-cascade moving distance, the selection function is set as
Specially, if the selection set only has one member, it can be directly selectedAll the neighbor nodes of all the nodes in the set are within one-hop range of the cut point, and Q is equal to D
*。
A22, cut point selection execution node flow: all one-hop neighbor nodes of the cut points send own election function values as the cut points, the cut points pick out the node with the highest election function value in each election set to serve as the execution node of the election set, and the node reports the initial communication progress F to the nodesinitThe number of elements in the selected set is the proportion of the total number.
Explaining the significance of determining the selection set: from the topological relationship of the two-hop neighbor table reaction, one can conclude that: in the network partition formed by the fault of the cut point, the nodes in a selected set are necessarily in the same partition, because the nodes in the selected set originally have a path which does not pass through the original cut point. Theoretically, in order to connect the network again, only one node is dispatched to the fault position to move by each partition, the connection relation is kept consistent with that of the original partition, and then the mobile nodes finally form a one-hop path to complete the repair task.
The election function reflects that the priority element for selecting the partition execution node is the distance between the priority element and the cut point and the maximum non-cascade moving distance, the smaller the priority element is, the closer the priority element is to the cut point, and on the premise of the same moving speed, new connection is more easily established in advance with other nodes in probability, because the position of final repair completion is necessarily the position closer to the cut point. The latter being larger means that the movable distance before triggering the cascade move is larger, and if the repair is done just within this distance, the cascade move is not used, possibly serving to reduce the total move overhead. The selection function only selects the better execution node in probability, the possibly selected execution node is not optimal, but the practical situation can be very complicated to consider, so that a more feasible reference is given.
Because the calculation process is complex, only the example topology is combined to give a possible selection result, that is, the nodes 2,5,7 are selected as executing nodes, the distribution situation of which is shown in fig. 7, it is easy to see that these nodes can respectively represent three network partitions formed after the node 4 fails: partition 1 is a connected branch consisting of nodes 1,2,3, partition 2 is a connected branch consisting of nodes 5,8, and partition 3 is a connected branch consisting of nodes 6,7, 9. It should be noted that, because the traversal range is only within the two-hop neighbor range of the cut point, in some complex topology situations, some network partitions may actually belong to the same connection branch, and should correspond to the same selection set, considering that the traversal complexity is greatly increased, in the embodiment of the present invention, only simple processing within two hops is performed.
A3, as shown in fig. 8, which is a basic flow of the mobile repair algorithm, an executing node will periodically detect the working state of a corresponding cut point, and once a fault occurs at the cut point is found, the executing node starts to move to the position of the cut point, the initial speed is v, and the hello probing period of a route is reduced to T, because the time delay from the two mobile nodes moving to a communicable distance to the two mobile nodes establishing a connection on the route depends on the hello probing period, and the smaller the period is, the smaller the corresponding time delay is. As shown in fig. 9, after the node 4 at the cut point fails, the executing nodes 2,5,7 periodically detect the failure of the node 4, and then automatically initiate the movement to the position of the node 4 and reduce the period of hello probe so as to rapidly discover each other in the middle.
And detecting whether a new node is found once every period T in the moving process, wherein T is more than 2T and less than 3T, because at least two hello periods are needed for establishing connection, if no new connection is found, comparing the current moving distance with the limit displacement of the neighbor of the node, which is reserved when the selecting function is calculated before, determining a new cascade index, and further determining whether to carry out new cascade movement. As shown in fig. 10, after the node 5 moves for a certain period of time, it is detected that the distance from the neighboring node 8 when the next period arrives will exceed the maximum communication distance, the cascade index is updated to 2, and then the node 8 is notified to move in a cascade manner together, the two nodes form a cascade movement group, the speed of the cascade movement group is the initial speed of the executing node in the group divided by the cascade index 2, and the direction is consistent with the initial speed.
If a new connection is found, interacting mutual communication progress with the other side, then updating the self communication progress into the sum of the two sides, and then judging whether the communication progress reaches 1: if so, indicating that the repair is completed, and then directly stopping moving and recovering to a normal hello period; otherwise, the current cascade index is calculated and interacted with the opposite side, then the elimination index is calculated according to the cascade index and the previous selection function, and then whether the elimination index is smaller than the opposite side is judged: if so, continuing to move and determining whether to initiate a new cascade movement according to whether the cascade index is increased; otherwise, the other party executes the next repair task, and the other party can directly stop moving and recover to the normal hello period. As shown in fig. 11, after a period of movement, the node 2 and the node 5 are connected with each other, and the two communicate with each other at first, where the original communication progress of the node 2 is 40%, the original communication progress of the node 5 is 20%, and the communication progress of the updated node and the updated node is 60%. Since the updated communication progress is less than 1, the two start to calculate the elimination indexes of the two and interact with each other, since the cascade index of the node 5 is 2 and the cascade index of the node 2 is 1, it is obvious that the elimination index of the node 5 is greater than that of the node 2, the node 2 continues to execute the task of mobile restoration, the node 5 is eliminated, the movement of the whole cascade mobile group in which the node 5 is located is stopped immediately, and the normal hello period of the node is recovered.
Once the mobile node establishes connection with some other mobile node, the mobile node in the invention mutually exchanges and selects the function value and the cascade index, and then calculates the elimination indexes of the two parties: the elimination index is determined by the cascade index, the higher the cascade index is, the higher the elimination index is, if the cascade index is the same as the elimination index, the smaller the elimination function value is, the higher the elimination index is. One party with a high elimination index stops moving, and the other party judges whether to continue moving repair or not by judging the currently completed communication progress. In the whole moving repair process, partial node moving can be stopped in advance, the total moving expense can be reduced, and the final repair effect cannot be influenced.
When a certain mobile node reaches the maximum non-cascade moving distance of the mobile node and the communication progress completed by the mobile node is less than 100 percent, the invention can trigger the speed-reducing cascade moving, and is characterized in that: the cascade index is increased by 1, and then the adjacent nodes which reach the maximum communication distance limit are informed to move together, the speeds in the moving directions are consistent, the speed is the original speed multiplied by a certain attenuation factor, and the factor is inversely proportional to the cascade index. And meanwhile, a cascade mobile group is formed, members in the group can still trigger new cascade mobile, and the processing algorithm is executed circularly. Through the cascade speed reduction algorithm, the total moving distance can be reduced by increasing a certain repairing time under the more extreme condition.
1. As shown in fig. 12, which is a flow of calculating a cascade index, first, when a node calculates a culling function, the node retains limit displacements corresponding to all neighboring nodes, and then, a moving distance when a next period arrives is predicted, that is, the current moving distance plus a current velocity v times a detection period t. Then judging whether the distance just exceeds a certain limit distance: if so, increasing the cascade index by 1, and simultaneously adding the corresponding neighbor node into the current cascade mobile group.
2. The cascade movement is characterized in that the moving speed and the moving direction of the nodes in the same cascade group are consistent, and the speed is
And simultaneously, all members in the cascade group determine whether to expand the cascade group and correct the moving speed according to whether to reach the maximum communication distance with other neighbors in the moving process. The reason for adopting the reduced speed cascade movement is explained here: the final repair is determined by establishing paths among all executing nodes, the executing node keeps the connection relationship with the non-moving neighbor node in the moving process, and in order to avoid the disconnection of a new link caused by the moving repair, a method of cascade moving is adopted under the critical condition, so that the node reaching the maximum communication distance moves along with the moving. But the cascade movement will increase the number of mobile nodes and the total moving distance will increase correspondingly, but the speed can be reduced, so the cascade moving group with low cascade index will move relatively more distance to complete the final full connection, the final repair time will be prolonged, but the total moving distance will be reduced, by adjusting the speed correction factor,an optimal trade-off may be achieved.
3. The elimination index calculation method comprises the following steps: setting the elimination index as IdThen, IdThe default is that Q is less than R, I is more than or equal to 1, which shows that the elimination index is mainly determined by the cascade index, the higher the cascade index is, the more easily the elimination index is stopped in advance, and the larger the cascade index is, the lower the moving efficiency is. Secondly, the selection function determines that the final moving distance in probability is longer as the selection function value is smaller. The calculation method may not be rigorous enough, but has high feasibility in most cases, and at least achieves the effect of reducing the number of current mobile nodes, and finally reduces the total moving distance to a certain extent.
4. The basis for judging whether the network is completely connected or not through interaction of the connection progress is that the connection progress of each execution node in the initial stage is the proportion of the number of the nodes in the selected set to the total number of the one-hop neighbors of the cut point, so the initial connection progress is 1 in total, and the connection progress cannot be reduced because the execution nodes cannot be disconnected with the network partitions in the moving process. Once the connection is established between the two executing nodes, the two network partitions are communicated, so that the current communication progress of the mobile nodes which are not eliminated is the sum of the two executing nodes, and the current communication progress can be determined according to the geometric relationship, the maximum communication distance between the mobile nodes and the eliminated nodes cannot be exceeded before the mobile nodes move to the final repair position, and the reliability based on the communication progress is also explained. The end result is necessarily that when the last several execution nodes meet at the same time, the sum of their connectivity is 1, indicating a complete connectivity.
As shown in fig. 13, after a period of time has elapsed, the nodes 2 and 7 establish connection, and the two nodes interact with each other at first, the current connection progress of the node 2 is 60%, the node 7 is 40%, and the updated connection progress is 1, so that the repair task is completed, and the entire network resumes the fully connected state.
It will be appreciated by those of ordinary skill in the art that the embodiments described herein are intended to assist the reader in understanding the principles of the invention and are to be construed as being without limitation to such specifically recited embodiments and examples. Various modifications and alterations to this invention will become apparent to those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.