Disclosure of Invention
The invention aims to provide a low-power consumption wireless sensor network static node routing method aiming at the routing problem of a wireless sensor network under the condition that the energy resources of sensor nodes are limited, so that the energy can be saved, and the service life of the network can be prolonged.
In order to achieve the purpose, the invention provides the following technical scheme:
a low power consumption wireless sensor network static node routing method, the wireless sensor network comprising at least one sensor node, the method comprising the steps of:
s101: initializing and setting the wireless sensor network, wherein unique id is assigned to a sensor node;
s102: acquiring topological structure information of the wireless sensor network, and sending the topological structure information to a base station corresponding to the wireless sensor network;
s103: calculating optimal paths from the base station to all sensor nodes based on the topological structure information to form an optimal path set;
s104: selecting one optimal path in the optimal path set as a working path according to a set screening rule, and sending the information of the working path to all sensor nodes on the working path;
s105: the starting sensor node on the working path forwards the sensed data and the residual energy to the next hop sensor node on the working path along the working path; fusing the sensing data and the residual energy of the next-hop sensor node, and then forwarding to the next-hop sensor node, and so on until the base station receives the data of all the sensor nodes on the working path;
s106: responding to the sensing data and the residual energy of all the sensor nodes on the working path received by the base station, and updating the residual energy of the corresponding sensor nodes in the topological structure information of the base station;
s107: based on the updated topological structure information, recalculating the optimal path from the sensor node without collected data to the base station, and updating an optimal path set;
s108: and repeating S104 to S107 until the sensing data and the residual energy of all the sensor nodes are collected.
In a further embodiment, in step S101, initializing the wireless sensor network further includes: setting the initial energy of the sensor node, and setting the maximum bit number K of data transmission of the sensor node.
In a further embodiment, in step S104, selecting one of the optimal paths in the optimal path set as the working path according to the set filtering rule means,
and selecting the optimal path which meets the conditions that the node data in the path is not collected and the path hop count is the maximum as the working path.
In a further embodiment, in step S102, the method for acquiring the topology information of the wireless sensor network and sending the topology information to the base station corresponding to the wireless sensor network includes the following steps:
s201: in a set period of broadcasting HELLO messages, each sensor node in the wireless sensor network periodically broadcasts HELLO message information, wherein the HELLO message information comprises the id of the sensor node and a 'HELLO' text;
s202: the sensor node which receives the HELLO message information of other sensor nodes feeds back response message RESP information which comprises the id and position information of the sensor node;
s203: responding to the end of the period of broadcasting the HELLO message, each sensor node respectively generates a one-hop adjacency list of the sensor node, wherein the one-hop adjacency list comprises the ids of all neighbor nodes and the distance d between the neighbor nodes;
s204: all the sensor nodes transmit the one-hop adjacency list and the residual energy information of the sensor nodes to a base station;
s205: and the base station fuses all the received one-hop adjacency lists to obtain topological structure information of the whole wireless sensor network and generate a network topological graph.
In a further embodiment, the network topology is a weighted undirected graph, which is defined as TG ═ V, E, W. Where V is the set of nodes in the graph,
is the set of edges in the graph, and W is the set of weights for the edges.
In a further embodiment, the format of the weighted undirected graph is shown in table 1:
TABLE 1 format of network topology map generated by base station
Wherein v is(i)Denotes a sensor node number, e(i)Representing a sensor node v(i)Represents no ring of the topology itself, d(ij)Representing a sensor node v(i)And v(j)Distance between, w(ij)Representing a sensor node v(i)And v(j)I ═ 1,2 … n; j is 1,2 … n.
In a further embodiment, the node v is based on a sensor(i)And v(j)Using Euclidean distance formula to calculate d(ij)。
In a further embodiment, in step S103, the method for calculating the optimal paths from the base station to all the sensor nodes includes the following steps:
s301: initializing a calculation flow: setting the base station number to v(0)Initial time S ═ V(0)And f, the value of the edge weight formed by the sensor nodes in the T satisfies the following conditions:
if v is(0)And v(i)Is an adjoining edge, w(0i)For data from base station v(0)To the sensor node v(i)If the energy consumption value is larger than the residual energy of the node, then w(0i)Is infinite;
if v is(0)And v(i)Not adjoining edges, w(0i)Is infinite;
s302: selecting a sensor node v with the minimum weight value from T(min)Adding the residual energy into the S, and updating the residual energy of all the transit sensor nodes;
s303: and updating the weight values of the rest sensor nodes in the T: if v is added(min)To make an intermediateAfter the node, from v(0)To v(i)If the edge weight value is reduced, modifying the edge weight value;
s304: the above-described S302 to S303 are repeated, and the present calculation flow is stopped until S includes all the sensor nodes, that is, V equals S.
In a further embodiment, the edge weights in the network topology map are calculated according to the following formula:
wherein E isstartTo initiate energy consumption of the sensor node, EohtersFor energy consumption of sensor nodes other than the originating sensor node, ER(k) Energy consumption for receiving data, ET(k) Energy consumption for transmitting data.
In a further embodiment, E is calculated according to the following formulaR(k) And ET(k):
ER(k)=Eelec*k
ET(k)=Eelec*k+eamp*k*d2
Wherein E iselec=50nJ/bit,eapm=100pJ/bit/m2K is the number of bits for data transmission, and d is the distance between the sensor nodes.
The invention has the beneficial effects that:
(1) based on the plane routing, the topological structure is simple, and the management and maintenance are convenient.
(2) And the centralized routing algorithm avoids the data transmission conflict of the sensor nodes.
(3) The routing method comprehensively considers the node residual energy and the distance information between nodes, and improves the accuracy of energy consumption calculation of the routing path.
(4) The routing algorithm selects the path with the lowest energy consumption to transmit data, so that the energy consumption of the whole network is saved, and the life cycle of the network is prolonged.
The foregoing description is only an overview of the technical solutions of the present invention, and in order to make the technical solutions of the present invention more clearly understood and to implement them in accordance with the contents of the description, the following detailed description is given with reference to the preferred embodiments of the present invention and the accompanying drawings.
Detailed Description
The following detailed description of embodiments of the present invention is provided in connection with the accompanying drawings and examples. The following examples are intended to illustrate the invention but are not intended to limit the scope of the invention.
The invention provides a static node routing method of a low-power wireless sensor network.
Example one
With reference to fig. 2, the wireless sensor network includes at least one sensor node, and a base station, a network, a server, and the like are correspondingly disposed on the sensor node, so that the server receives data acquired by the sensor node, and further, the server applies and manages the data acquired by all the sensor nodes.
On the basis of the wireless sensor network proposed by fig. 2, with reference to fig. 1 and fig. 3, the static node routing method for the low-power wireless sensor network includes the following steps:
initializing and setting the wireless sensor network
S101: initializing and setting the wireless sensor network, wherein at least the unique id is assigned to the sensor node, for example, the number v is set for the sensor node(i)、viOr Vi, etc., as its unique id, where i is 1,2 … n, the choice of what type of number is decided by the user.
Preferably, in step S101, initializing the wireless sensor network further includes: setting initial energy of the sensor nodes, setting the maximum bit number K of data transmission of the sensor nodes, and laying a cushion for subsequently selecting the optimal path of data transmission.
(II) acquiring topological structure information of the wireless sensor network
S102: acquiring topological structure information of the wireless sensor network, and sending the topological structure information to a base station corresponding to the wireless sensor network, wherein the base station can be expressed as base or select a number which can be more closely corresponding to the sensor node as an id thereof, such as v(0)、v0Or V0, etc.
The base station receives the topology structure information, arranges the topology structure information into a network topology map for subsequent use, and fig. 4 is an example of the network topology map generated according to the topology structure information, in this example, the network topology map includes 5 sensor nodes V1-V5, V0 is a base station, V2, V4, V5 are adjacent to the base station V0, and can directly implement data transmission, while V1 and V3 respectively need to transit through V2, V4 or V5 to implement data transmission with the base station V0.
The invention also refers to a method of generating a network topology as mentioned in fig. 4, the method comprising the steps of:
s201: each sensor node in the wireless sensor network periodically broadcasts a HELLO message in a set HELLO message broadcasting time period, wherein the HELLO message information comprises the id and the HELLO text of the sensor node.
S202: and the sensor node which receives the HELLO message information of other sensor nodes feeds back response message RESP information, wherein the response message RESP information comprises the id and the position information of the sensor node.
S203: and responding to the end of the period of broadcasting the HELLO message, each sensor node respectively generates a one-hop adjacency list of the sensor node, wherein the one-hop adjacency list comprises the ids of all the neighbor nodes and the distance d between the neighbor nodes.
S204: all the sensor nodes transmit the one-hop adjacency list and the residual energy information of the sensor nodes to a base station;
s205: and the base station fuses all the received one-hop adjacency lists to obtain topological structure information of the whole wireless sensor network and generate a network topological graph.
The network topological graph generated by the method can intuitively and clearly express the relationship and the distance between the nodes and the base station, and is prepared for the next step of the low-power consumption wireless sensor network static node routing method.
(III) calculating to obtain the optimal paths from the base station to all the sensor nodes, and generating an optimal path set
S103: and calculating the optimal paths from the base station to all the sensor nodes based on the topological structure information to form an optimal path set.
For convenience of use, the optimal Path set is recorded as Path by the inventionopt={P1,P2,P3,…,Pn}。
In order to calculate the optimal paths from the base station to all the sensor nodes, the network topology needs to be further quantized, and the invention provides one of the quantization modes.
In the base station, the network topology is a weighted undirected graph, which is defined as TG ═ V, E, W. Where V is the set of nodes in the graph,
is the set of edges in the graph, and W is the set of weights for the edges.
The format of the weighted undirected graph is shown in table 1:
TABLE 1 format of network topology map generated by base station
Wherein v is(i)Denotes a sensor node number, e(i)Representing a sensor node v(i)Represents no ring of the topology itself, d(ij)Representing a sensor node v(i)And v(j)Distance between, w(ij)Representing a sensor node v(i)And v(j)I ═ 1,2 … n; j is 1,2 … n.
According to sensor node v(i)And v(j)D can be calculated by using the Euclidean distance formula(ij)。
As for the edge weights in the network topology graph, let P ═ { v ═ v1→v2→v3→…→vm→ base is the sensor node v1One-hop path to base station with energy consumption of data transmission as edge weight, except for node v1Other nodes v than only having to receive and transmit data once2,v3,…,vmIt is necessary to receive data twice and transmit data twice.
Therefore, the edge weight in the network topology can be calculated by the following formula:
wherein E isstartTo initiate energy consumption of the sensor node, EohtersFor energy consumption of sensor nodes other than the originating sensor node, ER(k) Energy consumption for receiving data, ET(k) Energy consumption for transmitting data.
According to the following formula to calculate ER(k) And ET(k):
ER(k)=Eelec*k
ET(k)=Eelec*k+eamp*k*d2
Wherein E iselec=50nJ/bit,eapm=100pJ/bit/m2K is the number of bits for data transmission, and d is the distance between the sensor nodes.
On the basis, the method for calculating the optimal paths from the base station to all the sensor nodes comprises the following steps:
s301: initialization meterCalculating a flow: setting the base station number to v(0)Initial time S ═ V(0)And f, the value of the edge weight formed by the sensor nodes in the T satisfies the following conditions:
if v is(0)And v(i)Is an adjoining edge, w(0i)For data from base station v(0)To the sensor node v(i)If the energy consumption value is larger than the residual energy of the node, then w(0i)Is infinite.
If v is(0)And v(i)Not adjoining edges, w(0i)Is infinite.
S302: selecting a sensor node v with the minimum weight value from T(min)And adding the residual energy into S, and updating the residual energy of all the transit sensor nodes.
S303: and updating the weight values of the rest sensor nodes in the T: if v is added(min)After making intermediate nodes, from v(0)To v(i)If the edge weight value of (2) is decreased, the edge weight value is modified.
S304: the above-described S302 to S303 are repeated, and the present calculation flow is stopped until S includes all the sensor nodes, that is, V equals S.
(IV) selecting a working path, and sending the information of the working path to all the sensor nodes on the working path
S104: and selecting one optimal path in the optimal path set as a working path according to a set screening rule, and sending the information of the working path to all the sensor nodes on the working path.
The optimal path in the optimal path set is selected as the working path, which is determined by actual requirements, wherein various factors such as the number of sensor nodes included in the working path, the remaining energy of the sensor nodes, the data acquisition priority of the sensor nodes and the like need to be comprehensively considered.
In some examples, the optimal path which satisfies the condition that the nodes in the path are not collected and the path hop count is the largest is selected as the working path, so that the maximum amount of sensor node data is obtained at one time.
(V) collecting all sensor node data on the working path
S105: the starting sensor node on the working path forwards the sensed data and the residual energy to the next hop sensor node on the working path along the working path; and fusing the sensing data and the residual energy of the next-hop sensor node, and forwarding to the next-hop sensor node, and so on until the base station receives the data of all the sensor nodes on the working path.
Assume that the working path in step S104 is
Popt={v(1)→v(2)→v(3)→…→v(m)→base}
Will work the path PoptTo all sensor nodes on the working path, i.e. v(1),v(2),v(3),…,v(m)Starting sensor node v appearing on the path(1)Forwarding self-perceived data and residual energy to a next-hop sensor node v on the path along an optimal path(2)(ii) a Next hop sensor node v(2)Fusing self perception data and residual energy, and forwarding to the next hop sensor node v(3)And so on until the base station receives the working path PoptAll sensor node data on.
Sixthly, residual energy of corresponding sensor nodes in topological structure information of the base station is updated
S106: and updating the residual energy of the corresponding sensor node in the topological structure information of the base station in response to the base station receiving the sensing data and the residual energy of all the sensor nodes on the working path.
Seventhly, the steps from the third step to the sixth step are referred to collect the data of other sensor nodes which are not collected
S107: and based on the updated topological structure information, recalculating the optimal path from the sensor node without collected data to the base station, and updating the optimal path set.
S108: and repeating S104 to S107 until the sensing data and the residual energy of all the sensor nodes are collected.
Example two
In order to more clearly illustrate the implementation of the present invention, the present embodiment further illustrates the foregoing method with a smaller network size. Take the wireless sensor network in fig. 4 as an example, that is, there are 1 base station and 5 sensor nodes in the wireless sensor network.
First, initializing a wireless sensor network. Let the base station number be 0, the id of other 5 sensor nodes be 1,2, 3, 4,5, respectively, the initial energy of the sensor node is 150 μ J, and the maximum bit number K of data transmission is 100 bits. The energy consumption E of the received data can be obtained according to an energy consumption calculation formulaR5 muj, energy consumption E for transmitting dataT=5+d2/100μJ。
Secondly, in a certain time period, each sensor node in the wireless sensor network periodically broadcasts HELLO message information, wherein the HELLO message information comprises the id of the sensor node and a 'HELLO' text; the sensor node which receives the HELLO message information of other sensor nodes gives a response message RESP, and the response message RESP information comprises the id and the position information (x, y) of the sensor node; after the HELLO message broadcasting stage is finished, each sensor node can obtain a one-hop adjacency list of the sensor node, and the adjacency list information comprises the ids of all neighbor nodes and the distance d between the neighbor nodes; for example, for node 3, the adjacency list information is (2,40), (4,50), (5, 20). Then, all the sensor nodes transmit the adjacent list and the residual energy to the base station; the base station fuses all the received adjacency lists to finally obtain the topological structure information of the whole wireless sensor network, and the generated network topological graph is shown in the following table in fig. 4.
And thirdly, calculating the optimal paths from the base station to all the sensor nodes based on the topological structure information obtained in the second step. The number of the base station node is V0, and the rest sensor nodes are V1-V5 in sequence. Since the base station is powered by a wired power supply, the energy of the base station is considered infinite. For the sake of calculation, it is assumed that the residual energy of all sensor nodes starts to be 100 μ J.
And fourthly, the base station selects an optimal path which meets the conditions that the node data in the path is not collected and the path hop number is the maximum, namely {0,2,1 }.
Fifthly, the base station sends paths of V0, V2 and V1 to nodes V2 and V1, V1 sends the self-perceived data and the residual energy of V1 to node V2 along an inverse path {1-2-0} of the paths, and V2 sends the self-perceived data and the residual energy of V2 to the base station together with the data of V1. Thus, the data collection of the sensor nodes V1 and V2 is finished.
And sixthly, next, updating the residual energy of each sensor node in the topological structure information, wherein the energy is not consumed by other nodes because only the nodes V1 and V2 exist in the first selected optimal path, so that the residual energy of V3, V4 and V5 is still 100. And performing second optimal path calculation after the residual energy updating is completed.
Since the last remaining energy of the sensor node V2 is negative, the 0,2,1 path is unsuccessful. And the data of the sensor nodes V1 and V2 are collected, so that the {0,5,3} path is selected as the second optimal path. The base station sends paths of V0, V5 and V3 to nodes V5 and V3, V3 sends self-perceived data and residual energy of V3 to node V5 along an inverse path {3-5-0} of the paths, and V5 sends the self-perceived data and residual energy of V5 to the base station together with data of V3. Thus, the data collection of the sensor nodes V5 and V3 is finished. And next, the residual energy of each sensor node in the topological structure information is updated, and since only the nodes V5 and V3 exist in the optimal path selected for the second time, other nodes do not consume energy, so that the residual energy of V1 and V2 is still the residual energy of the first time, and the residual energy of V4 is still 100. And performing third optimal path calculation after the residual energy updating is completed.
Since only data for sensor nodes V4 and V are left uncollected, after the first pass to pick out V4, the algorithm ends with the {0,4} path being the third best path. The base station sends the paths of V0 and V4 to the node V4, and the V4 sends the self-perceived data and the residual energy of V4 to the base station V0 along the reverse path {4-0} of the paths. Next, the residual energy of each sensor node in the topology information is updated, and since only the node V4 exists in the optimal path selected for the third time, other nodes do not consume energy, so the residual energy of V1 and V2 is still the first residual energy, the residual energy of V3 and V5 is still the second residual energy, and the residual energy of V4 is the third residual energy. After the residual energy update is completed, all the sensor nodes in the network are collected, and then a second round of routing process can be performed. I.e. the above-mentioned algorithmic process is repeated and continued.
After the data acquisition of one round of sensor nodes is finished, the energy consumption of each sensor node and the whole network is as follows:
because the selection of the routing path takes the lowest energy consumption as the selection standard, the path obtained according to the method of the invention carries out data transmission, the consumed energy is minimum, and the service life of the network is further prolonged.
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.