Summary of the invention
In view of this, main purpose of the present invention is to provide a kind of system and method for realizing generalized routing protocol of wireless sensor network, the present invention can solve flexibility, the compatibility issue of Routing Protocol in the wireless sensor network, sets up service-oriented, the adaptive generalized routing protocol of user's request.
The invention provides a kind of system that realizes generalized routing protocol of wireless sensor network, this system comprises Subscriber Interface Module SIM and Routing Protocol module, wherein,
Described Subscriber Interface Module SIM is used for user's request is mapped as user instruction, sends to described Routing Protocol module;
Described Routing Protocol module is used for according to the described user instruction that receives topology information in the network being handled.
Wherein, described Subscriber Interface Module SIM comprises route criterion map unit and user interface section, wherein,
Described route criterion map unit is used for described user's request is mapped as described user instruction;
Described user interface section is used for described user instruction is sent to described Routing Protocol module.
Wherein, described route criterion map unit comprises tolerance processing subelement and relationship map subelement, wherein,
Described tolerance is handled subelement and is used for the path metric information of described user's request is handled, and sends to described relationship map subelement;
Described relationship map subelement is used for the described user's request after handling is converted into described user instruction.
Wherein, described tolerance is handled subelement and is comprised path metric information bank, routing criteria information storehouse and path metric processing, wherein,
Described path metric information bank is used to deposit standardized path metric information, and various path metrics are carried out binary coding;
Described routing criteria information storehouse is used to deposit the binary coding of routing criterion;
Described path metric is handled and is used for according to described path metric information bank and described routing criteria information storehouse the path metric information of described user's request being unified to handle.
Wherein, described path metric is handled and is specifically comprised: a plurality of path metrics are carried out normalized, and be weighted summation according to weight separately, obtain unified path metric.
Wherein, described path metric is handled and is specifically comprised: when existing a plurality of path metric information and at least one path metric to have threshold value to require, all satisfy at described path metric under the prerequisite of threshold value requirement, path metric is carried out normalized, and be weighted summation according to weight separately, obtain unified path metric.
Wherein, described Routing Protocol module comprises user instruction interface unit, core function unit and expanded function unit, wherein,
Described user instruction interface unit is used to receive the described user instruction that described Subscriber Interface Module SIM sends;
Described core function unit is used for described user instruction is resolved to described routing criterion, sends to described expanded function unit, and according to the local information of returning, and from the route control information of other nodes, sets up corresponding route;
Described expanded function unit is used for finishing described local information according to described routing criterion to be collected, and returns to described core function unit.
Wherein, described core function unit comprises that user's request resolves subelement and route and set up and safeguard subelement, wherein,
Described user's request is resolved subelement and is used for described user instruction is resolved, and described user instruction is mapped as described routing criterion, and sends to described extended function module;
Described route is set up with safeguarding subelement and is used for the described local information of returning according to described routing criterion and described extended function module, and from the route control information of other nodes, sets up corresponding route.
The present invention also provides a kind of method that realizes generalized routing protocol of wireless sensor network, and this method may further comprise the steps:
Steps A: generate user instruction according to user's request;
Step B: described user instruction is mapped as the routing criterion;
Step C: topology information in the network is handled according to described routing criterion.
Wherein, described step C comprises:
The Sink node starts the local information collecting function according to described routing criterion, constructs corresponding RREQ message, propagates in network.
Wherein, this method further comprises after described step C:
Step D: the node that receives described RREQ message is mapped as described routing criterion with the described user instruction in the message, and starts the local information collecting function;
Step e: node judges whether the criterion territory in the described routing criterion has the threshold-type requirement, if having, checks whether the tolerance of this node meets the demands, if, forward step F to, if not, described RREQ message abandoned;
Step F: second sequence number that first sequence number that comprises in the more described RREQ message and described node are preserved, upgrade described RREQ message;
Step G: behind the timer expired, in the RREQ message after described renewal, take out the pairing RREQ message of optimal path, carry out information updating once more;
Step H: the RREQ information broadcast after the described renewal is gone out, and write down the path of described node to the sink node.
Wherein, start the local information collecting function among described step C and the step D and comprise judging whether described routing criterion need carry out the topology information collection in neighbor domain of node, if start nodal information collection and neighborhood information and collect, if not, only starting nodal information collects.
Wherein, described step F comprises:
Step F 1: second sequence number that described first sequence number that comprises in the more described RREQ message and described node are preserved, when described first sequence number during greater than described second sequence number, enter step F 2, when described first sequence number equals described second sequence number, enter step F 3, when described first sequence number during, enter step F 4 less than described second sequence number;
Step F 2: make second sequence number equal first sequence number, start timer, the path metric accumulated value after a last hop node and the renewal is saved in described RREQ message buffering tabulation, enter step G;
Step F 3: check whether described timer lost efficacy, if not, will go up a hop node and part path metric accumulated value and be saved in described RREQ message buffering tabulation, enter step G; If enter step F 4;
Step F 4: abandon this grouping.
Wherein, information updating described in the step G is that to make the cumulative metric that contains in the described RREQ message be described node path tolerance, and the ID of described node is a last hop node ID.
Wherein, this method further comprises after H:
Step I: upwards a hop node sends response message.
It is characterized in that wherein this method further comprises after H:
When user's request changes, generate new user instruction according to new demand and send to the sink node, the sink node is constructed new RREQ message according to described new user instruction and is issued.
The present invention has following beneficial effect:
In generalized routing protocol of wireless sensor network system and method provided by the present invention, in Subscriber Interface Module SIM, increased route criterion mapping function newly, according to certain rule user's request is mapped as specific user instruction, be delivered to the Routing Protocol module, by core function unit user instruction is mapped as corresponding routing criterion, and, finish local information and collect by the corresponding sub-function module in the interacting message interface startup extended function module.Realize the User-Defined Routing criterion thus, strengthened the flexibility and the versatility of network routing protocol.
The replacement of route criterion in the network enabled running flexibly of the present invention simultaneously realizes the steady switching in path in the route criterion replacement process.
Embodiment
The present invention is further detailed explanation below in conjunction with the drawings and specific embodiments.
Referring to shown in Figure 1, be system configuration schematic diagram provided by the present invention.This system comprises Subscriber Interface Module SIM 101 and Routing Protocol module 102, wherein, Subscriber Interface Module SIM 101 is used for user's request is converted into specific user instruction by certain mapping ruler, and sending to Routing Protocol module 102, Routing Protocol module 102 is used for topology information in the network being collected, being managed and calculate based on this route according to the user instruction that receives.
Referring to shown in Figure 2, be the Subscriber Interface Module SIM illustrative view of functional configuration.Subscriber Interface Module SIM 101 comprises route criterion map unit 201 and user interface section 202.
Route criterion map unit 201 is used for user's request is converted into specific user instruction according to certain mapping ruler.Referring to shown in Figure 3, be the illustrative view of functional configuration of route criterion map unit 201.This unit comprises tolerance processing subelement 301 and relationship map subelement 302.
Wherein, tolerance is handled subelement 301 and is used for the processing that unitizes of path metric information that user's request is comprised and route criteria information, sends to relationship map subelement 302.
Tolerance is handled subelement 301 and is comprised path metric information bank (SRML:Standard Route MetricLib), routing criteria information storehouse (RSRL:Route Select ion Rule Lib) and path metric processing.
1) the path metric information bank is used to deposit standardized path metric information.
Path metric is that computing obtains from the basis of link or node tolerance.Link metric is the description to link attribute.Typical link metric has the reliability (rate is submitted in Fen Zu success just), packet transfer delay, the available bandwidth of link, the energy consumption in the packet transmission of transmitted in packets etc.Node tolerance is the description to the attribute of the node that participates in route.Typical node tolerance has residue energy of node, node life-span etc.
Difference according to link or node metric property can be divided into it: additivity tolerance, concavity tolerance, the property taken advantage of tolerance.
If the path is made of k bar link or k node series connection, the link of i section or the tolerance of i node are ci, and for three kinds of tolerance of different nature, path metric p is described as:
Additivity is measured:
To the property taken advantage of tolerance:
Concavity is measured: p=minc
i
Comprised typical path metric in the path metric information bank, each path metric has been carried out binary coding.Table 1 has been represented 7 kinds of modal path metrics and corresponding codes thereof.SRML just defines when design agreement, and the user therefrom selects one or several according to the routing criterion of own needs.Simultaneously, SRML is with good expansibility, and can above-mentioned code table be expanded according to practical application.
| Path metric |
Coding |
| The error rate |
1 |
| The path jumping figure |
2 |
| Available bandwidth |
3 |
| Energy consumption: residue energy of node |
4 |
| Energy consumption: path consumed energy |
5 |
| Energy consumption: local balancing energy |
6 |
| Time delay |
7 |
Table 1: path metric coding schedule
2) routing criteria information storehouse is used to deposit the routing criterion.
In wireless sensor network, the path from a node to the another one node has many, and its tolerance of different paths is different.Routing Protocol must be selected one or some according to user's demand from these possible paths.The standard of selecting is the routing criterion.
The route criterion may be at single tolerance, also may be at many tolerance.
Typical single tolerance route criterion has: maximum, minimum, threshold value etc.Such as, be tolerance with the residue energy of node that participates in route, the route criterion may be the path of selecting tolerance maximum so, promptly selects the path of energy maximum of the node of dump energy minimum on the path from mulitpath.
Defining the route criterion in the present invention is: maximum, minimum, threshold value, coding is respectively 01,10,11.
3) path metric is handled and is used for according to described path metric information bank and routing criteria information storehouse a plurality of path metrics that user's request comprised being unified to handle.
Be concerned about a plurality of tolerance simultaneously for the user, homometric(al) is not adopted the situation of different criterions, such as, require transmission reliability and consumed energy all to reach minimum, or, it is the shortest that the time delay in path under the prerequisite of lowest-bandwidth requirement is satisfied in requirement, need unify to handle to a plurality of tolerance, provides two kinds of multipaths tolerance processing methods among the present invention:
A, the computing of normalization linear weighted function: a plurality of tolerance are carried out after the normalization, obtain a tolerance according to certain weight weighted sum.This is applicable to that a plurality of tolerance are that property associated with each other is weak, the user measures the different situation of attention degree to each.Normalized purpose is to eliminate different influence on the different index values.If the criterion that a plurality of tolerance are required has get maximum, have get minimum, then one of them can be got inverse, compute weighted again.
Such as: the energy that the path transmission that customer requirements is set up consumes when dividing into groups is minimum and time delay is minimum, then:
Wherein: k is the total path number; e
jAnd e
MinBe respectively the energy consumption of j paths and the lowest energy consumption in the k paths; t
jAnd t
MinBe respectively the time delay of j paths and prolonging the most in short-term of k paths; α represents the degree of valuing to energy metric.
Get optimum under B, the threshold filtering condition: when some path metric in a plurality of path metric information has threshold value to require, at first these path metrics are judged whether to satisfy the threshold value requirement, filter out and not meet the demands, again remaining all path metrics are carried out normalized, and be weighted summation according to weight separately, obtain unified path metric.
Relationship map subelement 302 is used for according to certain mapping ruler normalized path metric information being converted into specific user instruction.
By mapping ruler the binary code of path metric and route criterion is combined, generated user instruction, just can describe the route criterion of meeting consumers' demand.As will representing the route criterion for investigating the energy that consumes on the path, select the energy minimum, then be expressed as;
SRM=00001000,RSR=01。
User interface section 202 is used to the user that the path metric and the criterion interface of standard are provided, and user instruction is sent to Routing Protocol module 102.In order to realize that the user carries out flexible configuration as required, adopt specific interface message form, specifically as shown in table 2.
| Metric field |
The criterion territory |
Coefficient domain |
| 1byte |
2byte |
4*k?byte |
Table 2: user interface message format
Metric field is used for putting in order, represent the tolerance that the user is concerned about in the mode of bit diagram by each tolerance of SRML.If corresponding positions is 1, then be illustrated in this route and set up this tolerance of consideration in the process, otherwise, do not consider this tolerance.
The criterion territory is used for the routing criterion that puts in order, represents in the mode of bit diagram single tolerance by each tolerance of SRML.Two corresponding tolerance of bit: maximum is got in " 01 " expression, and minimum is got in " 10 " expression, " 11 " expression threshold-type, and " 00 " represents that this tolerance is invalid.
Coefficient domain is used for describing each tolerance corresponding coefficient or threshold value by putting in order of each tolerance of SRML.Wherein k represents the quantity of the tolerance that the user is concerned about.Because each tolerance is wanted a corresponding corresponding numerical value (coefficient or threshold value), each numerical value takies 4byte.
Each length of field shown in the user interface message format that present embodiment provided is to comprise under the situation of 7 tolerance to provide in SRML, and in other embodiments of the invention, SRML can also further expand, and its length is according to the expansion respective change.
Referring to shown in Figure 4, be Routing Protocol functions of modules structural representation.
Routing Protocol module 102 is used for topology information in the network being collected, being managed and calculate based on this route according to user's demand.The topology information here is the topology information on the complete trails that comprises from the source to the purpose.The Routing Protocol module comprises user instruction interface unit 401, core function unit 402, expanded function unit 403 and media interviews control interface unit 404.
User instruction interface unit 401 is used for the user instruction that Subscriber Interface Module SIM 101 sends is delivered to core function unit 402.
The function that Routing Protocol will be finished comprises collection to topology information, management and calculates based on the route of these information.From the angle of information gathering, can come out the content extraction that has general character in all Routing Protocol runnings as the basic function of route, and handle and the closely-related part of user and basic function are peeled away, as expanded function.Routing Protocol can carry out self adaptation identification to different user demands like this, and corresponding route service is provided.
Based on this, in the Routing Protocol module 102 in the present invention the route function is divided, be divided into core function unit 402 and expanded function unit 403.
Referring to Fig. 5, be the illustrative view of functional configuration of core function unit.Core function unit 402 is used for described user instruction is resolved to the routing criterion, sends to expanded function unit 403, and the local information that obtains returning, and sets up corresponding route.Core function unit 402 comprises that subelement (URM:UserRequest Mapping) 501 resolved in user's request and subelement (RSM:Route Setup andMaitenance) 502 is set up and safeguarded to route.Wherein, user's request is resolved subelement 501 and is used for user instruction is resolved, and user instruction is mapped as local information collects instruction and routing criterion, and send to expanded function unit 403; Route is set up with safeguarding subelement 502 and is used for resolving according to user's request the analysis result of subelement 501, transmission comprises the route control grouping (comprising route requests grouping RREQ, route replies grouping RREP and route repair grouping Repair) of user's request, collect the complete trails topology information, in this process, finish path computing, and carry out in good time route maintenance in distributed mode.
Expanded function unit 403 is used for mutual hello message in the defeated scope of a jump set, collects and the management local information, specifically comprises functions such as local neighbours' discovery, link-quality detection, the collection of neighbor node energy information.This unit comprises that nodal information is collected and neighborhood information is collected, it is available information that the nodal information collection is used to leave in node self, these information can directly obtain, do not need to carry out information interaction with other nodes, neighborhood information collect be used to deposit need with the mutual information of other nodes, need in the neighborhood of node, carry out the topology information collection and just can obtain.Nodal information is collected and the neighborhood information collection is referred to as the local information collection, by starting the local information collecting function, obtain local information, and return to core function unit 402, set up and safeguard subelement 502 uses for route, comprising information such as neighbours' link-quality, neighbor node energy, its concrete message format is as shown in table 3.
| Type of message |
Metric field |
Sequence number |
Timestamp |
| 1byte |
1byte |
2byte |
2byte |
Table 3: local information is collected message
Type of message, the type of local information collection message is 4 among the present invention.
Metric field is used for putting in order of the tolerance that defines according to SRML, and corresponding bit is that 1 expression needs to collect such metric, is that 0 expression is invalid.
Whether sequence number is used to describe this message is up-to-date.Sequence number is big more, and expression message is new more.
Timestamp is used to time of representing that this is message initiated.
Media interviews control (MAC) interface unit 404 is used to finish the information interaction between route and the MAC layer.The MAC interface comprises data-interface and control interface.Data-interface is used for the data-message that Routing Protocol is to be sent and agreement and is used to set up, safeguard route and carries out the route control messages that local information collects be sent to the MAC layer; Control interface is used for carrying out information sharing between route and MAC layer, comprises the information such as change in link quality of collecting with the MAC layer of sharing of neighbor list.
Utilize said system, referring to Fig. 6, the method flow diagram that first embodiment of the invention provided, this method may further comprise the steps:
Step S601: generate specific user instruction according to user's request according to certain mapping criterion, send to convergence (sink) node;
Step S602:sink node is converted into corresponding routing criterion with the user instruction that receives according to mapping ruler;
Step S603:sink node is handled network topological information according to the routing criterion, is specially to start the local information collecting function, constructs corresponding RREQ message, propagates in network.
Referring to Fig. 7, be the method flow diagram that second embodiment of the invention provided, this method may further comprise the steps:
Step S701: generate specific user instruction according to user's request according to certain mapping ruler, and send to convergence (sink) node;
Step S702:sink node is converted into the routing criterion with the user instruction that receives according to the mapping criterion;
Step S703:sink node starts the local information collecting function according to the routing criterion, construct corresponding RREQ message, this message comprises information such as sequence number, user instruction, part path metric accumulated value and a last hop node, propagates in wireless sensor network with the forms of broadcasting;
In this step, when starting the local information collecting function, judge, whether needs carry out the topology information collection in the neighborhood of node according to the routing criterion of user's request in judgement, when if the information that the user paid close attention to can directly obtain and not need node and other nodes to carry out information interaction at node, then only start nodal information and collect, do not start neighborhood information and collect, otherwise all start;
Step S704: the node that receives the RREQ message that sink sends is converted into corresponding routing criterion according to the user instruction in the message according to the mapping criterion, starts the local information collecting function;
Equally, whether needs carry out the topology information collection in the neighborhood of node according to the routing criterion of user's request in judgement, when if the information that the user paid close attention to can directly obtain and not need node and other nodes to carry out information interaction at node, then only starting nodal information collects, do not start neighborhood information and collect, otherwise all start;
Step S705: node checks whether the criterion territory in the routing criterion has " threshold-type " requirement, if having, checks whether the tolerance of this node meets the demands, if, forward step S706 to, if not, directly abandon the RREQ message that receives;
Step S706: node compares sequence number SQ and the local sequence number SQlocal that preserves that carries in the RREQ message, works as SQ〉SQlocal, expression receives this RREQ message for the first time, enters step S707; Work as SQ=SQlocal, expression was received before this with a route and was set up the RREQ message that process sends, entered step S708; As SQ<SQlocal, represent this message with pre-treatment, then directly abandon this RREQ message;
Step S707: use the sequence number SQ that newly receives to upgrade local SQlocal,, the path metric accumulated value after a last hop node and the renewal is saved in the RREQ information cache, enter step S710 even SQ=SQlocal starts timer T;
Step S708: check whether timer T is still effective,, enter step S710 if effectively, then in RREQ message, be saved in a hop node and part path metric accumulated value; Otherwise, enter step S709;
Step S709: timer T is overtime to mean that the time of a plurality of RREQ message of local wait finishes, then from the buffer memory of RREQ message, find optimal path, promptly satisfy the path of routing criterion, if exist mulitpath to have identical tolerance, then therefrom select one at random, enter step S710;
Step S710: take out the RREQ message of selected optimal path correspondence, carry out information updating, making the cumulative metric that contains in the message is this node path metric, and a last hop node ID is the ID of this node;
Step S711: the RREQ information broadcast after will upgrading is gone out, and the minute book node is to the path of sink;
Step S712: upwards a hop node sends response message.
More than the idiographic flow of setting up for route after setting up route, starts the route maintenance function immediately, and the effective time of setting route maintenance is for slightly being longer than the life span of route entry, stops after overtime.User's demand was collected relevant local topology information during route maintenance was set up according to this route, and with timer control the carrying out collection in cycle, after the grouping of having used this routing forwarding, the life span of route entry automatically prolongs.
Simultaneously, the replacement of route criterion in the network enabled running flexibly of the system and method for realization generalized routing protocol of wireless sensor network provided by the present invention is implemented in and carries out the path in the route criterion replacement process stably and switch.
Realize that the replacement of route criterion can trigger under two kinds of occasions: the user triggers and particular service triggers.
(1) user triggers
In real network, the user is in certain and considers, may need the requirement of modification information transmission, adopts the user to trigger this moment to realize the replacement of route criterion.In this case, the user utilizes the new route criterion of standard interface definition to send to the sink node, and the sink node has the RREQ message of new sequence number by transmission, replaces original criterion with new route criterion, and it is the same that this process is set up with route.
In order to keep the continuity of message transmission, reduce the route criterion and substitute the influence that brings to message transmission, before new route was not successfully set up, node still used original route to carry out message transmission, and new route is deleted original path after setting up.
(2) particular service triggers
Node may collect some special information in the network, and the route criterion that adopts for this category information transmission is different with common information.Processing to specific information is an embodiment of agreement versatility.Such as, for the sensor network that carries out environment measuring, the route of setting up when normally the temperature of gathering, humidity information are according to networking is transmitted, if node has collected abnormal temperature information, this means that emergencies such as fire may appear in network, require this category information to be fed back to the user timely.
Information type with special transmission requirement can be good by user's predefined in procotol, and the problem that Routing Protocol will solve is how to switch on the new path according to business need as early as possible when these professional generations.
Processing procedure is that Routing Protocol is transmitted grouping along main path, broadcasts the RREQ grouping simultaneously, has wherein comprised the demand of particular service.Node starts corresponding local information collection module after receiving RREQ message.After the Sink node receives RREQ message, reply RREP message, new route switches on the new route after setting up.
More than a kind of System and method for of generalized routing protocol of wireless sensor network of realizing provided by the present invention is described in detail, used specific case herein principle of the present invention and execution mode are set forth, the explanation of above embodiment just is used for helping to understand method of the present invention and core concept thereof; Simultaneously, for one of ordinary skill in the art, according to thought of the present invention, the part that all can change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.