Summary of the invention
Goal of the invention: technical problem to be solved by this invention is the deficiency to prior art, the route implementing system that provides a kind of wireless sensor network to communicate by letter with IPv6 network all-IP.
Technical scheme: the invention discloses the route implementing system that a kind of wireless sensor network is communicated by letter with IPv6 network all-IP, in the said system, the IP full wireless sensor network route realizes that at link layer wireless sensor network is the terminal network of IPv6 network; Each sensor node in the said wireless sensor network has globally unique IPv6 address, and the IPv6 node is realized communicating by letter with the all-IP of sensor node through the IPv6 address of wireless sensor node;
Said system is provided with three category nodes: gateway node, bunch first node and bunch interior nodes; Said gateway node is the node that the global function node promptly has route forwarding function with a bunch first node; Gateway node is a tree with the topological structure of bunch first node; Gateway node is the root node of tree; Bunch first node is the intermediate node and the leaf node of tree, and gateway node is a stationary nodes with a bunch first node; The route of said wireless sensor network realizes through a gateway node and bunch tree that first node makes up; Said bunch of interior nodes is the node that the partial function node does not promptly have route forwarding function, is used for data acquisition and data processing, and bunch interior nodes is a stationary nodes; Wherein, gateway node is used to connect wireless sensor network and IPv6 network; Said wireless sensor network is connected with the IPv6 network through n gateway node, and n >=1, when n >=2, carries out multi-casting communication through the IPv6 network between the gateway node; Said wireless sensor network is divided into n tree by n gateway node; There is and has only a gateway node in each tree; And said gateway node is the root node of tree; Each gateway node has an ID, and this ID is marked net artis and be the tree of root node with this gateway node uniquely;
Said wireless sensor network is formed by a plurality of bunches, and each bunch comprises a bunch of first node and a plurality of bunches of interior nodes, and bunch interior nodes is in a jumping scope of bunch first node, and topological structure is a star.
When communicating by letter between the sensor node of the present invention, through each other next time the channel time of intercept send the dormancy time that data increase sensor node.
In the system according to the invention, the IPv6 address of said gateway node, bunch first node and bunch interior nodes is made up of two parts, and first is overall route prefix, and the overall route prefix of the IPv6 address of all the sensors node is all identical in sensor network; Second portion is a sensor node ID; Sensor node ID is divided into gateway node ID, bunch first node ID and three parts of bunch interior nodes ID; Wherein to identify uniquely with this gateway node be the tree of root node to gateway node ID, and the first node of all bunches is all identical with bunch gateway node ID of interior nodes IPv6 address in the tree; Bunch first node ID identifies one bunch uniquely, and bunch first node ID of all bunches interior nodes in bunch is all identical; Bunch interior nodes ID identifies a bunch of interior nodes uniquely; Bunch first node ID of said gateway node IPv6 address and a bunch interior nodes ID are 0, and bunch interior nodes ID of said bunch of first node IP v6 address is 0; Said gateway node ID, bunch first node ID and bunch interior nodes ID number are made up of the sensor node primary ID, and in a wireless sensor network, the primary ID of sensor node is number unique.
In the system according to the invention; Bunch first node realizes that through the tree that adds the gateway node place nearest apart from the first node of this bunch the sensor node ID of IPv6 address disposes automatically; Bunch first node ID of noting the father node of place tree simultaneously reaches channel time of intercept next time, and the linear module of distance is a jumping figure; After obtaining sensor node ID, the partial function node that bunch first node and one of which are jumped in the scope is built into one bunch jointly; Bunch interior nodes directly is sent to a bunch first node with data, and bunch first node is realized the route to data through the place tree.
In the system according to the invention, said route realizes that at link layer link layer address is set to the sensor node ID of sensor node IPv6 address; Gateway node in the said tree is preserved an interim routing table with a bunch first node, and route table items comprises four territories: purpose bunch territory, next jump bunch first nodes domains, next time channel time of intercept territory with and the life span territory; The sensor node ID of purpose bunch territory record purpose bunch interior nodes place bunch bunch first node; Next jump that bunch first nodes domains record arrives purpose bunch next jump the sensor node ID of bunch first node; The time of intercept of channel next time that next jumps bunch first node is write down in channel time of intercept territory next time; The life span of life span territory this route table items of record; It is along with machine clock is decayed automatically, and when life span was 0, a bunch first node was deleted this list item from routing table; The every use of route table items once; Its life span will be set to the initial life span of list item, and the set point of initial life span is confirmed according to the memory space of sensor node and the quantity of sensor node, generally is set at 60 seconds among the present invention~60000 seconds.
In the system according to the invention; Said gateway node is safeguarded a bunch of first nodes records table; The relevant information that is used for the first node of minute book tree intra-cluster comprises bunch first node ID of bunch first node and the distance of bunch first nodal distance place tree tree root node (being gateway node).
In the system according to the invention; Said gateway node is set up the routed path that arrives purpose bunch through routing inquiry frame and route response frame; Routing inquiry frame load content comprises bunch first node ID of purpose bunch bunch first node and the distance of purpose bunch bunch first nodal distance place tree tree root node, and route response frame load content comprises bunch first node ID of purpose bunch bunch first node.
In the system according to the invention; Said gateway node set up to arrive the routed path of purpose bunch through the routing inquiry frame; After a bunch first node in routing inquiry frame coverage is received this frame; Bunch first node judges that through the source address of checking the routing inquiry frame whether this routing inquiry frame is sent by the father node of bunch first node; If not, then abandon this frame, otherwise bunch first node continues to judge oneself magnitude relationship apart from the distance value of distance value that belongs to the tree root node and purpose bunch first nodal distance place tree root node; If the distance value of bunch first nodal distance place tree root node is greater than the distance value of purpose bunch first nodal distance place tree root node; Bunch first node then abandons this frame; If less than; Bunch first node then continues to broadcast this frame, if equal, bunch first node returns a route response frame to a place bunch tree tree root node; The return path of the route response frame that purpose bunch first node returns is: purpose bunch first node at first sends to the route response frame father node of its place tree; Said father node is received the operation of setting up route behind the route response frame, comprises the steps: at first to check the route table items that whether has had purpose bunch in the routing table, if exist; Then the life span of route epiphase is set to initial life span, if do not exist, then sets up a route table items; Purpose bunch territory is the sensor node ID of purpose bunch bunch first node; Next jumps a bunch first nodes domains is the sensor node ID of route response frame source address field, and channel time of intercept territory is set to 0 next time, and life span is set to initial life span; Continue this frame is sent to the father node of father node then; After the father node of father node is received this frame, repeat above-mentioned operation of setting up route, the final route response frame arrives the root node of purpose bunch bunch first node place tree.
In the system according to the invention, said bunch of first node/gateway node periodic broadcasting Beacon frame, the load content of frame is channel time of intercept next time; Bunch first node is received the Beacon frame of father node; It then upgrades the time of intercept of channel next time of father node with the time of intercept of channel next time in the frame; Bunch first node receives that next jumps the Beacon frame of bunch first node in the route table items, and it is then with the value in the time of intercept of the channel next time territory in the renewal of the time of intercept of channel next time in the frame route table items; Bunch interior nodes is received the Beacon frame of place bunch bunch first node, and it is then with the time of intercept of channel next time of the renewal of the time of intercept of channel next time in the frame bunch first node.
In the system according to the invention, said gateway node carries out fragment process to the IPv6 packet according to the data flow mode, promptly has only first burst to comprise the IPv6 head construction, and other bursts only comprise the IPv6 load; Then each data fragmentation is encapsulated as Frame with adaptation layer head, Mesh delivery header and frame head; At next time of intercept of channel next time of jumping bunch first node Frame is sent.
In the system according to the invention, bunch first node periodic broadcasting Beacon frame, the frame load comprises that it is apart from the distance of place tree root node, the gateway node ID of channel time of intercept and its place tree root node next time.If bunch first node does not receive the Beacon frame of father node at the appointed time; Judge that so father node (for example is in abnormal operating state; Situation such as the power consumption of father node is intact); And to choose the minimum bunch first node of the Beacon frame load middle distance parameter value that receives be father node, obtains new sensor node ID, and carry out registration operation to initiate tree root node.
Beneficial effect: the invention provides the route implementing system that a kind of wireless sensor network is communicated by letter with IPv6 network all-IP; In said system; Wireless sensor network exists as the terminal network of IPv6 network; Each sensor node in the wireless sensor network has globally unique IPv6 address, and the IPv6 network node is realized all-IP communication each other through the IPv6 address of wireless sensor node, obtains the data message that sensor node is gathered.The present invention proposes the automatic allocation plan in wireless sensor network node IPv6 address and reach route implementing method based on the IPv6 address.The present invention can be applied to numerous areas such as agricultural modernization, seismic monitoring, medical treatment & health, military and national defense, for example, and in the agricultural modernization field; Can apply the present invention to modern installations Agricultural Environmental Monitoring control, like this, the agricultural laborer does not receive geographic restriction; Can visit the sensor node in the farmland at any time through the Internet; Obtain environmental parameters such as farmland temperature, humidity, luminous intensity, in time grasp the growing environment of crops, guarantee that crops grow up healthy and sound.Since sensor node have volume little, cheap, be easy to arrange, be easy to characteristics such as maintenances, and the Internet have the geographical position cover extensive, easy to use, characteristics such as friendly interface, cost, therefore, present technique has very high promotional value.
Embodiment:
The invention provides the route implementing system that wireless sensor network is communicated by letter with IPv6 network all-IP; In said system; Wireless sensor network exists as the terminal network of IPv6 network; Each sensor node in the wireless sensor network has globally unique IPv6 address, and the IPv6 network node is realized all-IP communication each other through the IPv6 address of wireless sensor node, obtains the data message that sensor node is gathered.
Shown in Figure 1 is wireless sensor network and the IPv6 network all-IP network topology structure sketch map of route of communicating by letter; Divide from functional perspective, the present invention comprises two category nodes: node (being called the global function node) and the node (being called the partial function node) that does not have route forwarding function with route forwarding function.Divide from system configuration; The present invention is provided with three category nodes: gateway node 1, bunch first node 2 and bunch interior nodes 3, and wherein, gateway node 1 is the global function node with a bunch first node 2; Their topological structure is a tree; This tree is accomplished the routing function of wireless sensor network, and bunch interior nodes 3 is the partial function node, is mainly used in data acquisition and data processing; Gateway node 1, a bunch first node 2 are stationary nodes with bunch interior nodes 3, and gateway node 1 connects wireless sensor network and IPv6 network.Wireless sensor network is formed by a plurality of bunches, and each bunch comprises a bunch of first node 2 and a plurality of bunches of interior nodes 3, and bunch interior nodes is in a jumping scope of bunch first node, and topological structure is a star.Said route realizes that at link layer when gateway node was received from the IPv6 output packet, it carried out fragment process to packet; Be encapsulated as a Frame to each data fragmentation; And in this tree, set up the routed path that arrives packet rs destination bunch interior nodes, in the process of route data frame, gateway node/bunch first node always sends Frame at the time of intercept of channel next time that next jumps bunch first node; To increase dormancy time, reduce power consumption.
Shown in Figure 2 is sensor node IPv6 of the present invention address sketch map; The IPv6 address of gateway node, bunch first node and bunch interior nodes is made up of two parts; First is the overall route prefix of 80 bits, and the overall route prefix of the IPv6 address of all the sensors node is all identical in IP full wireless sensor network; Second portion is the sensor node ID of 48 bits; It is divided into the gateway node ID of 16 bits, bunch first node ID of 16 bits and three parts of bunch interior nodes ID of 16 bits again; Wherein to identify uniquely with this gateway node be the tree of root node to gateway node ID, and the gateway node ID of the first node of all bunches (comprising a bunch interior nodes) is identical in tree; Bunch first node ID identifies one bunch uniquely, and bunch first node ID of all bunches interior nodes of one bunch is all identical; Bunch interior nodes ID identifies a bunch of interior nodes uniquely.Bunch first node of gateway node IPv6 address is 0 with bunch interior nodes; Bunch interior nodes ID in bunch first node IP v6 address is 0.Gateway node ID, bunch first node ID and bunch interior nodes ID number are made up of the sensor node primary ID, and in a wireless sensor network, the primary ID of sensor node number has uniqueness.
Shown in Figure 3 is the schematic flow sheet that bunch first node obtains sensor node ID, and bunch first node is preserved a record, and it arrives distance (parasang the is a jumping figure) parameter of tree root node in the tree of place, and the distance parameter value of gateway node is 0.The flow process that bunch first node obtains sensor node ID is described below:
Step 301: the command frame of sensor node ID is obtained in global function node H (promptly both be not labeled as a bunch first node, and also the be not marked as gateway node) broadcasting that is in isolated state, and the load content is empty, sets a clock simultaneously;
Step 302: after the neighbours' bunch first node in the command frame coverage is received this frame; Return a response frame to a bunch first node H, the load content of response frame is that bunch first node of neighbours arrives the distance value of place tree root node, the gateway node ID of channel time of intercept and place tree root node next time;
Step 303: clock is to after date; The global function node H that is in isolated state selects to return the minimum bunch first node of response frame middle distance parameter value as father node F and bunch first node ID, father node F of noting father node F channel time of intercept and the own distance value that belongs to the tree root node that arrives next time; The distance value that is father node F adds 1; From response frame, obtain gateway node ID simultaneously, combine, form sensor node ID with the primary ID of self; With oneself being labeled as a bunch first node, carry out registration operation then to the root node that belongs to tree;
Step 304: a bunch first node H successfully adds tree, and has obtained sensor node ID, and process finishes.
Said command frame and response frame are to realize through the command frame type in the IEEE Standard 802.15.4 standard of expansion IEEE issue, and promptly Command Frame Identifier realizes in the command frame through expanding.
Shown in Figure 4 is the schematic flow sheet that bunch interior nodes is obtained sensor node ID, and the flow process that bunch interior nodes is obtained sensor node ID is described below:
Step 401: after a bunch first node H obtains sensor node ID; It can periodic broadcasting Beacon frame showing oneself exist, the content of Beacon frame be that bunch first node H arrives the distance value that belongs to the tree root node, channel time of intercept and belong to the gateway node ID of tree root node next time;
Step 402: after the global function node in the frame coverage is received frame, carry out step 404; After partial function node in the frame coverage is received frame, carry out step 403;
Step 403: if the partial function node has been labeled as a bunch interior nodes, carry out step 405 so, otherwise carry out step 409;
Step 404:, forward step 406 to, otherwise carry out step 408 if the global function node has been labeled as a bunch first node/gateway node;
Step 405: judge that whether bunch first node H is the own bunch first node that belongs to bunch, if forward step 410 to, otherwise carry out step 408;
Step 406: judge whether bunch first node H is whether own father node or bunch first node H is next jumping bunch first node of route table items in the routing table, if carry out step 407, otherwise carry out step 408;
Step 407: perhaps next jumps the time of intercept of channel next time of bunch first node to upgrade father node with the time of intercept of channel next time in the frame, forwards step 412 to;
Step 408: abandon handling this frame, forward step 412 to;
Step 409: with the distance value, bunch first node that oneself are labeled as bunch interior nodes and the note bunch first nodal distance place tree root node gateway node ID of channel time of intercept and bunch first node place tree root node next time; Obtain bunch first node ID of bunch first node then from the source address of frame; The gateway node ID that obtains and bunch first node ID number are combined with the primary ID of self; Obtain sensor node ID, forward step 411 to;
Step 410: upgrade the time of intercept of channel next time that belongs to bunch bunch first node with the time of intercept of channel next time in the frame, forward step 412 to;
Step 411: so far, a bunch interior nodes has been obtained sensor node ID;
Step 412: process finishes.
Said Beacon frame is to realize through the command frame type in the IEEE Standard 802.15.4 standard of expansion IEEE issue, and promptly Command Frame Identifier realizes in the command frame through expanding.
Shown in Figure 5 is a bunch first node register flow path sketch map; Gateway node is preserved a bunch of first nodes records table; Bunch first node relevant information that is used for the minute book tree, these information comprise that bunch first node ID and bunch first node of bunch first node are to the distance value between the gateway node.Bunch first node need carry out new address registration to place tree tree root node/gateway node after obtaining new sensor node ID, and register flow path is:
Step 501: a bunch first node H has obtained new sensor node ID;
Step 502: bunch first node H sends the registration frame to place tree root node, and frame load content is the distance value of bunch sensor node ID of first node H and its arrival place tree root node;
Step 503: gateway node checks in bunch first nodes records table whether had bunch record of first node H, if exist, forwards step 505 to, otherwise forwards step 504 to;
Step 504: gateway node increases a record in bunch first nodes records table, and the sensor node ID of recorded and stored bunch first node H and bunch first node H arrive the distance value of place tree root node, forward step 506 to;
Step 505: the distance value that gateway node arrives place tree root node with in the frame load bunch of first node H is the distance value in the new record more;
Step 506: registration process finishes.
Said registration frame is to realize through the command frame type in the IEEE Standard 802.15.4 standard of expansion IEEE issue, and promptly Command Frame Identifier realizes in the command frame through expanding.
Shown in Figure 6 is route table items form sketch map, and the present invention adopts link layer to realize route, and link layer address is set to the sensor node ID of sensor node IPv6 address.Gateway node in the tree is preserved an interim routing table with a bunch first node; Route table items comprises four territories, and purpose bunch territory, next jumps bunch first nodes domains, channel time of intercept territory and life span territory next time, wherein; The sensor node ID of purpose bunch territory record purpose bunch interior nodes place bunch bunch first node; Next jump that bunch first nodes domains record arrives purpose bunch next jump the sensor node ID of bunch first node, next time channel time of intercept territory record next jump bunch first node channel time of intercepting next time, the life span of life span territory this route table items of record; This time decays according to machine clock automatically; When life span was 0, a bunch first node was deleted this list item from routing table, and route table items whenever is used once; Its life span all can be set to initial life span, and the set point of initial life span is confirmed according to the memory space of sensor node and the quantity of sensor node
Shown in Figure 7 is Frame encapsulation format sketch map, and when gateway node was received from the IPv6 output packet, it carried out fragment process with the IPv6 packet as data flow, promptly had only packet first burst to comprise the IPv6 head construction.Data fragmentation encapsulates the formation Frame through adaptation layer head, Mesh delivery head and frame header successively; Wherein the adaptation layer head writes down the burst information of IPv6 packet; The sensor node ID of the purpose bunch interior nodes of Mesh delivery head record data frame, next jumps the sensor node ID of bunch first node/purpose bunch interior nodes frame head information record.The structure of relevant adaptation layer head, Mesh delivery head and frame header can be with reference to the rfc4944 standard of IETF issue and the IEEE Standard 802.15.4 of IEEE issue.
Fig. 8 a and Fig. 8 b are IP full wireless sensor network route schematic flow sheet of the present invention, and concrete route flow process is following:
Step 801:IPv6 node sends one and obtains bunch requests of packets of data of interior nodes X image data, and the destination address of this packet is the IPv6 address of bunch interior nodes X;
Step 802: this packet is route in the IPv6 network; Arrive at last and bunch gateway node that interior nodes X place wireless sensor network is connected; The gateway node ID of gateway node through the IPv6 address of inspection bunch interior nodes X judges that bunch interior nodes X is whether in this tree; If do not exist, then carry out multicast, this request data package arrives the root node/gateway node G of bunch interior nodes X place bunch bunch first node place tree at last;
Step 803: gateway node G checks that whether routing table exists the route table items that arrives bunch interior nodes X place bunch, if having, forwards step 805 to, otherwise carry out step 804;
Step 804: gateway node G searches the purpose bunch bunch pairing record of first node H to obtain the distance value that bunch first node H arrives the tree root node from bunch first nodes records table; Utilize this distance value to make up to arrive the routing inquiry frame at bunch interior nodes X place bunch, and in tree this frame of broadcasting
Step 805: forward step 817 to
Step 806: after bunch first node of the neighbours in routing inquiry frame coverage is received this frame; Neighbours' bunch first node judges through the source address of checking the routing inquiry frame whether this routing inquiry frame is sent by its father node; If carry out step 807, otherwise carry out step 811;
Step 807: neighbours' bunch first node judges that whether the distance value of its distance webs artis equals the distance value in the frame, if equal, carry out step 808, otherwise carry out step 809;
Step 808: neighbours' bunch first node makes up a route response frame; The source address of frame is the sensor node ID of neighbours' bunch first node; Destination address is the sensor node ID of the father node F of neighbours' bunch first node; Then its father node F next time the channel time of intercept this frame is sent, forward step 812 to;
Step 809: whether neighbours' bunch first node judges the distance value of its distance webs artis greater than the distance value in the frame, if greater than, forward step 811 to, else if less than, forward step 810 to;
Step 810: neighbours' bunch first node upgrades the source address field in the inquiry frame with the sensor node ID of oneself, in tree, continues this routing inquiry frame of broadcasting then, forwards step 806 to;
Step 811: abandon this frame, processing procedure finishes
Step 812: father node checks whether there has been the route table items that arrives bunch interior nodes X place bunch in the routing table, if exist, forward step 813 to, otherwise forward step 814 to;
Step 813: it is initial life span that father node is reset bunch life span of interior nodes X place bunch route table items, forwards step 815 to;
Step 814: father node is set up a route table items, and purpose bunch territory is bunch sensor node ID of interior nodes X place bunch bunch first node, and next jumps the sensor node ID of bunch first node for bunch first node of transmission route response frame;
Step 815: whether father node is gateway node G, if carry out step 817, otherwise carry out step 816;
Step 816: father node sends to its father node according to the time of intercept of channel next time of its father node with this route response frame, forwards step 812 to;
Step 817: gateway node G carries out fragment process with the IPv6 packet; And each data fragmentation is encapsulated as Frame; At next time of intercept of channel next time of jumping bunch first node Frame is sent to next according to the route table items at bunch interior nodes X place bunch and jump bunch first node; And the like, the final data frame arrives purpose bunch interior nodes X;
Step 818: a bunch interior nodes X recombinates to the data burst; Handle packet is packaged into response IPv6 packet with response data, and it is carried out fragment process; Each data fragmentation is encapsulated as Frame; Its father node next time the channel time of intercept Frame is sent to father node, and the like, the final data frame arrives gateway node G;
Step 819: gateway node G becomes the IPv6 response data packet with the data fragmentation reorganization, and packet is sent in the IPv6 network, and this packet finally arrives source IPv6 node according to the IPv6 routing mode;
Step 820: processing procedure finishes.
Said routing inquiry frame and route response frame are to realize through the command frame type in the IEEE Standard 802.15.4 standard of expansion IEEE issue, and promptly Command Frame Identifier realizes in the command frame through expanding.Data frame structure can be with reference to the IEEE Standard 802.15.4 of IEEE issue.
In sum, the present invention has realized that wireless senser communicates by letter interconnectedly with IPv6 network all-IP, and this technology can be applied to numerous areas such as agricultural modernization, medical treatment & health, military and national defense; For example, in the agricultural modernization field, can the wireless senser and the IPv6 network all-IP communication technology be applied to modern installations Agricultural Environmental Monitoring control; Like this; The agricultural laborer does not receive geographic restriction, can visit the sensor node in the farmland at any time through the Internet, obtains environmental parameters such as farmland temperature, humidity, luminous intensity; In time grasp the growing environment of crops, guarantee that crops grow up healthy and sound.Since sensor node have volume little, cheap, be easy to arrange, be easy to characteristics such as maintenances, and the Internet have the geographical position cover extensive, easy to use, characteristics such as friendly interface, cost, therefore, present technique has very high promotional value.
The invention provides the thinking and the method for the route implementing system that a kind of wireless sensor network communicates by letter with IPv6 network all-IP; The method and the approach of concrete this technical scheme of realization are a lot, and the above only is a preferred implementation of the present invention, should be understood that; For those skilled in the art; Under the prerequisite that does not break away from the principle of the invention, can also make some improvement and retouching, these improvement and retouching also should be regarded as protection scope of the present invention.The all available prior art of each component part not clear and definite in the present embodiment realizes.