Wireless channel access control method based on virtual tokenTechnical field
The present invention relates to wireless communication field, be specifically related to a kind of wireless channel access control method based on virtual token.
Background technology
In wireless network, generally adopt CSMA/CA(Carrier Sense Multiple Access/collision detection) by monitoring wireless channel and keeping out of the way one random period, realize the access control to wireless channel.Because the mode of this random back makes wireless channel access delay have certain uncertainty, cannot guarantee maximum network time delay, network load is larger, and the randomness of transmission delay is larger, is therefore only applicable to the application not high to requirement of real-time.
In token-ring network, by token, realize the access control to transmission medium.Token is a kind of special Frame, only receives that the node of token can send data.Because token transmits successively in order in network, each node is enjoyed fair channel access power, not only can estimate maximum channel access delay, and network delay has certain certainty, is therefore applicable to the application higher to requirement of real-time.
With wire message way, compare, wireless channel has opening and multipath effect, is easy to be subject to the interference of other communication system and the impact of barrier, and the stack of a plurality of signals of out of phase easily causes the sharply variation that receives signal amplitude, transmission conditions are complicated, severe, are therefore subject to the impact of environment larger.
In token-ring network, the maintenance of token is very crucial, comprises token generation, token transmission, a plurality of token and token lost detection etc.On the one hand, token safeguard more complicated, expense is larger; On the other hand, wireless channel transmission quality is poor, further aggravates the expense that token is safeguarded, thereby causes wireless token loop network hydraulic performance decline.
Summary of the invention
The technical problem to be solved in the present invention is, for existing wireless channel token-ring network above shortcomings, a kind of wireless channel access control method based on virtual token is provided, by a kind of method that is similar to token ring, realizes the access control to sensor network wireless channel.
The present invention solves the problems of the technologies described above adopted technical scheme to be:
Wireless channel access control method based on virtual token, is characterized in that, comprises the following steps:
A, in certain area selected several nodes, specify node centered by a node, other nodes are called radio node, and the address of each radio node is distributed unitedly in order by Centroid and kept the address of each radio node and Centroid continuous;
B, setting Centroid address are 0, and first Centroid produces token, then broadcasts a Frame and specifies certain radio node to hold token, and monitor network;
C, within a certain period of time, is being used token if Centroid can listen to the radio node of certain address, represents token transmission success; If the radio node of this address does not have Frame to need to send, broadcast the token frame of finishing using; If the radio node of this address has Frame to need to send, the sign that adds token to finish using in last Frame sending, the radio node of next address starts to prepare to hold token;
D, radio node or Centroid, after having sent or specified the node of holding token, start to monitor network; If due to signals transmission make mistakes monitor less than, retransmit predetermined number of times; If next node is because depleted of energy or fault lost efficacy, a upper node is monitored less than there being node using channel, broadcasts a Frame, specifies another to hold token by node;
Whether E, Centroid are periodically monitored has new node to add, when listening to new node, add, for this node distributes address, its information broadcasting, to other node in network, and is upgraded to the number (complete and be appended to virtual token ring) of nodes;
If F radio node listens at the appointed time in network, do not have Frame to send, represent token lost, then Centroid regenerates a token;
If G radio node listens in network, have a plurality of nodes to send Frame, there are a plurality of tokens in representative simultaneously, and now all nodes abandon holding token, then by Centroid, regenerate a token;
H, repeat above steps A ~ G, realize the wireless channel access control method based on virtual token.
Press such scheme, in described steps A, node centered by the node of assigned address minimum, token is produced by Centroid (node that address is 0) all the time.
Press such scheme, in described step C, upper radio node is used token complete, by the mark position of Frame, is 1, and next radio node starts to hold token by monitored data frame and when flag bit 1 being detected.
Press such scheme, in described step C, radio node also according to etc. the priority (general, important and urgent) of message to be sent dynamically change the priority of holding token, introduce secondary race condition, by the priority promotion of the node that has urgent message to send to high state.
Press such scheme, in described step D, along with node adds or deviated from network, each address of node and number dynamically update, and the node that is greater than this address also will upgrade address separately, guarantees the continuity of each node address in whole network.
Press such scheme, in described step e, the mode (token frame does not occur separately, and Frame is distinguished with the form of flag bit) that new node adopts Frame to merge, appends token in Frame and transmits with the form of flag bit.
Press such scheme, in described certain area, selected node forms by seven states, respectively: initialization, networking, free time, etc. to be sent, secondary competition, send data and wait for and replying, initialization is first state of node, for completing the initialization of software and hardware resources and the assignment of each parameter; Networking is that node is elected Centroid in some way, and according to the state of size order distribution node address; Free time is the default conditions that enter after networking completes; Etc. to be sent be that node is received the Frame of need replying, or have and need the Frame initiatively sending and the state at place while not holding token; Secondary competition is to use token at a upper node, before next node prepares to hold token, for preventing that higher priority message (urgent message) from needing the node sending because waiting for the overtime state of token; Send data and be node and hold token at the appointed time, and do not have priority node to participate in token competition (not receiving the secondary competition frame of other node), can initiatively use token to send the state of data; Wait for that replying is that node has sent the Frame that needs reply, enters the state of replying place of waiting for after sending.
Press such scheme, seven state control procedures of above-mentioned each node specifically comprise the steps:
A, node initializing, complete the initialization of software and hardware resources and the assignment of each parameter;
B, enter networking state, node is elected Centroid in some way, and according to size order distribution node address; If receive the Frame of non-node, or erroneous frame, abandon this Frame, and remain on networking state;
C, enter idle condition, if receive and do not need the Frame of replying, data processing is remained on to this state later; If receive secondary competition frame, non-node data frame or erroneous frame, abandon and remain on this state;
If D receives the Frame of need replying, or need to initiatively send Frame, the state to be sent such as enter and wait for token;
If E monitors a node, (than the node of this node address little 1) uses token, and next node is prepared to hold token, for preventing the nodes to be sent such as higher priority message, enters secondary race condition;
If F does not receive the secondary competition frame of other node at the appointed time, use token to send data; If had, pass token to higher priority node;
If G node has sent the Frame that needs reply, after sending, enter wait recoil state, otherwise get back to idle condition;
H, enter and wait for that after recoil state, if receive the Frame of reply in official hour, or wait timeout is got back to idle condition.
Compared with prior art, tool has the following advantages and beneficial effect in the present invention:
(1) compare with CSMA/CA, wireless channel access delay has certainty, can guarantee maximum network time delay; Especially when network load is larger, there is good real-time;
(2) compare with token-ring network, reduced the difficulty of token maintenance and the risk of loss, can adapt to better the feature of wireless channel and sensor node;
(3) compare with wireless token loop network, effectively improved because node location changes the token transmission failure cause, and the token pass order frequent updating causing thus and the network performance degradation that causes;
(4) by introducing secondary competition mechanism, and in conjunction with the priority policy of node, can meet to greatest extent the transmission demand of urgent message, thereby guarantee high reliability and the hard real-time of network;
(5) mode merging by Frame, has reduced the number of network management message and the number of times of wireless data frame transmitting-receiving, has improved network effective rate of utilization.
Accompanying drawing explanation
Fig. 1 is the state of each node and control flow chart in embodiment in the present invention.
Embodiment
Below in conjunction with drawings and Examples, the present invention is described in detail.
Wireless channel access control method based on virtual token of the present invention, comprises the following steps:
A, in certain area selected several nodes, node centered by the node of assigned address minimum (token is produced by Centroid all the time), other nodes are called radio node, and the address of each radio node is distributed unitedly in order by Centroid and kept the address of each radio node and Centroid continuous;
B, setting Centroid address are 0, and first Centroid produces token, then broadcasts a Frame and specifies certain radio node to hold token, and monitor network;
C, within a certain period of time, is being used token if Centroid can listen to the radio node of certain address, represents token transmission success; If the radio node of this address does not have Frame to need to send, broadcast the token frame of finishing using; If the radio node of this address has Frame to need to send, the sign that adds token to finish using in last Frame sending, the radio node of next address starts to prepare to hold token, and (a upper radio node is used token complete, by the mark position of Frame, be 1, next radio node starts to hold token by monitored data frame and when flag bit 1 being detected); Radio node also according to etc. the priority (general, important and urgent) of message to be sent dynamically change the priority of holding token, introduce secondary race condition, by the priority promotion of the node that has urgent message to send to high state;
D, radio node or Centroid, after having sent or specified the node of holding token, start to monitor network; If due to signals transmission make mistakes monitor less than, retransmit predetermined number of times; If next node is because depleted of energy or fault lost efficacy, a upper node is monitored less than there being node using channel, broadcasts a Frame, specifies another to hold token by node; Along with node adds or deviated from network, each address of node and number dynamically update, and the node that is greater than this address also will upgrade address separately, guarantees the continuity of each node address in whole network;
Whether E, Centroid are periodically monitored has new node to add, when listening to new node, add, for this node distributes address, its information broadcasting, to other node in network, and is upgraded to the number (complete and be appended to virtual token ring) of nodes; The mode that new node adopts Frame to merge, appends token in Frame and transmits with the form of flag bit;
If F radio node listens at the appointed time in network, do not have Frame to send, represent token lost, then Centroid regenerates a token;
If G radio node listens in network, have a plurality of nodes to send Frame, there are a plurality of tokens in representative simultaneously, and now all nodes abandon holding token, then by Centroid, regenerate a token;
H, repeat above steps A ~ G, realize the wireless channel access control method based on virtual token.
Shown in Fig. 1, the selected node of the present invention is comprised of seven states, respectively: initialization, networking, free time, etc. to be sent, secondary competition, send data and wait for and replying, initialization is first state of radio node, for completing the initialization of software and hardware resources and the assignment of each parameter; Networking is that radio node is elected Centroid in some way, and according to the state of size order distribution node address; Free time is the default conditions that enter after networking completes; Etc. to be sent be that radio node is received the Frame of need replying, or have and need the Frame initiatively sending and the state at place while not holding token; Secondary competition is to use token at a upper node, before next node prepares to hold token, for preventing that higher priority message (urgent message) from needing the node sending because waiting for the overtime state of token; Send data and be radio node and hold token at the appointed time, and do not have priority node to participate in token competition (not receiving the secondary competition frame of other node), can initiatively use token to send the state of data; Wait for that replying is that radio node has sent the Frame that needs reply, enters the state of replying place of waiting for after sending.
Seven state control procedures of above-mentioned each node specifically comprise the steps:
A, node initializing, complete the initialization of software and hardware resources and the assignment of each parameter;
B, enter networking state, node is elected Centroid in some way, and according to size order distribution node address; If receive the Frame of non-node, or erroneous frame, abandon this Frame, and remain on networking state;
C, enter idle condition, if receive and do not need the Frame of replying, data processing is remained on to this state later; If receive secondary competition frame, non-node data frame or erroneous frame, abandon and remain on this state;
If D receives the Frame of need replying, or need to initiatively send Frame, the state to be sent such as enter and wait for token;
If E monitors a node, (than the node of this node address little 1) uses token, and next node is prepared to hold token, for preventing the nodes to be sent such as higher priority message, enters secondary race condition;
If F does not receive the secondary competition frame of other node at the appointed time, use token to send data; If had, pass token to higher priority node;
If G node has sent the Frame that needs reply, after sending, enter wait recoil state, otherwise get back to idle condition;
H, enter and wait for that after recoil state, if receive the Frame of reply in official hour, or wait timeout is got back to idle condition.
Realized a kind of virtual token looped network for above seven in good shapely.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, all any modifications of doing within the spirit and principles in the present invention, be equal to and replace and improvement etc., within all should being included in protection scope of the present invention.