Disclosure of Invention
The invention aims to provide an MAC protocol method applied to a transformer substation wireless sensor network and an implementation system thereof, so as to solve one or more technical problems. The invention can effectively increase the transmission efficiency of the wireless sensor network.
In order to achieve the purpose, the invention adopts the following technical scheme:
the invention discloses an MAC protocol method applied to a transformer substation wireless sensor network, which comprises the following steps:
step 1, starting a synchronization link at each hierarchy network node; judging whether a frame to be transmitted is a first frame of wireless sensor network communication; if so, skipping to execute the step 2, otherwise skipping to execute the step 3;
step 2, setting a threshold value of the number of transmission units, a threshold value of synchronization imbalance, an upper threshold value of channel conflict times, a lower threshold value of channel conflict times, an initial value of a scheduling table of a transmission unit, a time scheduling table and a frame length threshold value by each hierarchy network node, and skipping to execute step 4;
step 3, judging whether the synchronous offset of each hierarchy network node is smaller than the synchronous offset threshold or not according to the transmission unit number threshold, the synchronous offset threshold, the channel conflict upper limit threshold, the channel conflict lower limit threshold, the transmission unit scheduling table initial value, the time scheduling table and the frame length threshold set in the first frame; if the synchronous offset of each hierarchy network node is smaller than the synchronous offset threshold, keeping the transmission unit group number threshold unchanged, if the synchronous offset of each hierarchy network node is larger than or equal to the synchronous offset threshold, reducing the transmission unit group number threshold by a preset percentage, rounding, modifying the time scheduling table, resetting the frame length threshold, obtaining the modified transmission unit group number threshold, the time scheduling table and the frame length threshold, and skipping to execute the step 4;
step 4, modifying the time scheduling table according to the transmission unit scheduling table, starting a transmission time timer by each hierarchy network node, and transmitting and receiving data according to the time scheduling table corresponding to each hierarchy network node and the transmission unit scheduling table; and entering the next frame transmission work when the value of the transmission time timer of each hierarchy network node is larger than the frame length threshold value.
The invention further improves the method and also comprises the following steps: and 5, repeatedly executing the steps 1 to 4 to finish all frame transmission.
A further improvement of the present invention is that step 3 further comprises:
reading a channel collision frequency counter of each hierarchy network node; if the value of the channel collision frequency counter of each hierarchy network node is larger than the upper limit threshold value of the channel collision frequency, all units with the stored values of 0 in the transmission unit scheduling table are found, and the stored values of the units with the stored values of 0 in the transmission unit scheduling table with the preset percentage are changed into 1; if the value of the channel collision frequency counter of each hierarchy network node is smaller than the lower limit threshold of the channel collision frequency, all units with the stored values of 1 in the transmission unit scheduling table are found, and the stored values of the units with the stored values of 1 in the transmission unit scheduling table with the preset percentage are changed into 0;
and if the channel collision times counter of each hierarchy network node is greater than or equal to the lower limit threshold of the channel collision times and less than or equal to the upper limit threshold of the channel collision times, the scheduling table of the transmission unit is not changed.
The invention has the further improvement that the topological structure of the transformer substation wireless sensor network is a tree structure; the root node of the tree is a server side, and the leaf nodes of the tree are various wireless sensors in the transformer substation.
A further improvement of the present invention is that the transmission unit schedule takes such a form that the transmission periods of the child nodes and the reception periods of the parent nodes coincide in alignment.
A further development of the invention is that in the transmission unit schedule, groups of transmission units are in a pipelined relationship with each other.
The invention discloses a system for realizing an MAC protocol method applied to a wireless sensor network of a transformer substation, which comprises the following steps:
the first frame distinguishing module is used for starting a synchronization link of each hierarchy of network nodes; judging whether a frame to be transmitted is a first frame of wireless sensor network communication; if so, skipping to execute the step 2, otherwise skipping to execute the step 3;
a threshold setting module, configured to set a transmission unit number threshold, set a synchronization imbalance threshold, set a channel collision number upper threshold, set a channel collision number lower threshold, set a transmission unit scheduling table initial value, set a time scheduling table, set a frame length threshold, and jump to the data transceiver module by each layer of network nodes;
the correction and modification module is used for judging whether the synchronous offset of each hierarchy network node is smaller than the synchronous offset threshold or not according to the transmission unit number threshold, the synchronous offset threshold, the channel conflict upper limit threshold, the channel conflict lower limit threshold, the transmission unit scheduling table initial value, the time scheduling table and the frame length threshold set in the first frame; if the synchronous offset of each hierarchy network node is smaller than the synchronous offset threshold, keeping the transmission unit group number threshold unchanged, if the synchronous offset of each hierarchy network node is larger than or equal to the synchronous offset threshold, reducing the transmission unit group number threshold by a preset percentage, rounding, modifying the time scheduling table, resetting the frame length threshold, obtaining the modified transmission unit group number threshold, the time scheduling table and the frame length threshold, and skipping to execute the step data transceiver module;
the data transceiving module is used for modifying the time scheduling table according to the transmission unit scheduling table, starting a transmission time timer by each hierarchy network node, and transceiving data according to the time scheduling table corresponding to each hierarchy network node and the transmission unit scheduling table; and when the value of the transmission time timer of each hierarchy network node is greater than the frame length threshold value, finishing the transmission of the current frame.
The invention further improves the method and also comprises the following steps: and the execution control module is used for controlling the repeated execution of the first frame judging module, the threshold setting module, the correction and modification module and the data receiving and transmitting module to finish the transmission of all frames.
The invention has the further improvement that the correction modification module is also used for reading the channel conflict times counter of each hierarchy network node; if the value of the channel collision frequency counter of each hierarchy network node is larger than the upper limit threshold value of the channel collision frequency, all units with the stored values of 0 in the transmission unit scheduling table are found, and the stored values of the units with the stored values of 0 in the transmission unit scheduling table with the preset percentage are changed into 1; if the value of the channel collision frequency counter of each hierarchy network node is smaller than the lower limit threshold of the channel collision frequency, all units with the stored values of 1 in the transmission unit scheduling table are found, and the stored values of the units with the stored values of 1 in the transmission unit scheduling table with the preset percentage are changed into 0;
and if the channel collision times counter of each hierarchy network node is greater than or equal to the lower limit threshold of the channel collision times and less than or equal to the upper limit threshold of the channel collision times, the scheduling table of the transmission unit is not changed.
Compared with the prior art, the invention has the following beneficial effects:
the invention provides an MAC protocol improvement method applied to a transformer substation wireless sensor network, which can effectively balance network energy consumption and network transmission performance by dynamically adjusting the number of transmission unit groups in a dormant state in an MAC frame of the wireless sensor network according to the requirement of network transmission flow; the improved protocol adopts a pipeline structure, and the transmission efficiency of the wireless sensor network can be effectively increased. The transmission unit number adopted by the invention is in a self-adaptive mode according to the communication flow requirement of the network, so that the wireless sensor network can work at a balance point between high performance and energy saving according to the actual transmission requirement of the wireless sensor, the power consumption of the wireless sensor network under light load work can be reduced under the condition of not influencing the maximum transmission efficiency of the wireless sensor network, and the power consumption is reduced because the wireless sensor network is mostly powered by a battery, so that the service life of the wireless sensor network can be prolonged. Specifically, in the invention, the number of the transmission units can be automatically changed according to the change of the communication flow requirement of the network, and the working mode of each transmission unit is controlled by modifying the transmission scheduling table; when the network is required to be in a high-performance working mode, more transmission units can be set to be in a working state through the transmission scheduling table, and when the network is required to be in an energy-saving working mode, more transmission units can be set to be in a dormant state through the transmission scheduling table, so that the transmission requirement of the wireless sensor is met according to the actual transmission requirement of the wireless sensor, and the wireless sensor network can work at a balance point between high performance and energy saving.
According to the MAC protocol method applied to the transformer substation wireless sensor network, the mode that the sending time periods of the child nodes and the receiving time periods of the father nodes are aligned and overlapped is adopted, under the use environment of a transformer substation, the data structure of the digitalized analog information acquired by various sensors is simple and basically fixed, the working mode can effectively and completely transmit the data acquired by the wireless sensors in the transformer substation monitoring field, information retention caused by the fact that a certain node is in a dormant state is prevented, the transmission protocol can be simplified, the control energy expenditure in the transmission protocol is reduced, and the purpose of saving energy is achieved.
The transmission unit groups adopted by the invention are in a pipeline structure relationship, so that the transmission throughput of the wireless sensor network can be enhanced, the delay of the network is reduced, and the method has great advantages for real-time monitoring.
Detailed Description
In order to make the purpose, technical effect and technical solution of the embodiments of the present invention clearer, the following clearly and completely describes the technical solution of the embodiments of the present invention with reference to the drawings in the embodiments of the present invention; it is to be understood that the described embodiments are only some of the embodiments of the present invention. Other embodiments, which can be derived by one of ordinary skill in the art from the disclosed embodiments without inventive faculty, are intended to be within the scope of the invention.
The MAC protocol method applied to the wireless sensor network of the transformer substation comprises the following steps:
the method comprises the following steps: each level of network nodes starts a synchronization link.
In the first step, when the network nodes of each layer start a synchronization link, the method further comprises the following steps:
step two: and judging whether the frame to be transmitted is the first frame of the wireless sensor network communication, if so, executing the third step, and if not, skipping the third step and directly executing the fourth step.
Step three: setting a threshold value of the number of transmission units, a threshold value of synchronization imbalance, an upper threshold value of channel collision times, a lower threshold value of the channel collision times, an initial value of a scheduling table of the transmission units, a time scheduling table and a frame length threshold value by each layer of network nodes, skipping the fourth step and directly executing the sixth step.
Step four: and judging whether the synchronous offset of each hierarchy network node is smaller than a synchronous offset threshold, if so, keeping the threshold of the transmission unit group number unchanged, and if not, reducing the threshold of the transmission unit group number by 10%, rounding, modifying a time scheduling table, and resetting the frame length threshold.
Step six: and modifying the time scheduling table according to the transmission unit scheduling table, starting a transmission time timer by each hierarchy network node, and transmitting and receiving data according to the time scheduling table corresponding to each hierarchy network node and the transmission unit scheduling table. And when the value of the transmission time timer of each hierarchy network node is larger than the frame length threshold value, each hierarchy network node starts a synchronization link, namely the frame transmission work of each hierarchy network node is finished, the next frame transmission work is started, and the step I is executed.
In the fourth step of the embodiment of the present invention, when determining whether the synchronization offset of each hierarchy network node is smaller than the synchronization misalignment threshold, the method further includes the following steps:
step five: reading counters of channel collision times of each hierarchy of network nodes, if the value of the counter of the channel collision times of each hierarchy of network nodes is larger than an upper threshold of the channel collision times, finding all units with the stored value of 0 in a scheduling table of a transmission unit, changing the stored value of the unit with the stored value of 0 in the first 10% of the scheduling table of the transmission unit into 1, if the value of the counter of the channel collision times of each hierarchy of network nodes is smaller than a lower threshold of the channel collision times, finding all units with the stored value of 1 in the scheduling table of the transmission unit, changing the stored value of the unit with the stored value of 1 in the first 10% of the scheduling table of the transmission unit into 0, and if the counter of the channel collision times of each hierarchy of network nodes is larger than or equal to the lower threshold of the channel collision times and smaller than or equal to the upper threshold of the channel collision times, not changing the scheduling table of the transmission unit.
In the embodiment of the invention, the method further comprises the following steps: and step seven, repeatedly executing the step one to the step six to finish the transmission of all frame data.
In the embodiment of the invention, the protocol adopts a mode that the sending time period of the child node is aligned and superposed with the receiving time period of the father node, and the mode can effectively maintain the transmission of information flow, prevent information from generating information stagnation due to the fact that a certain node is in a dormant state, and simplify the transmission protocol.
In the embodiment of the invention, the transmission unit groups are in a pipeline structure relationship with the groups, namely when the transmission of the previous transmission unit is not finished, the transmission of the next transmission unit is started, and the pipeline structure can exchange time by space, thereby enhancing the transmission throughput of the wireless sensor network and reducing the delay of the network.
In the embodiment of the invention, the number of the transmission units can be automatically changed according to the change of the communication flow requirement of the network, the working mode of each transmission unit is controlled by modifying the transmission scheduling table, when the network is required to be in a high-performance working mode, more transmission units can be set to be in a working state through the transmission scheduling table, and when the network is required to be in an energy-saving working mode, more transmission units can be set to be in a dormant state through the transmission scheduling table, so that the wireless sensor network can work at a balance point between high performance and energy saving according to the actual transmission requirement of the wireless sensor.
DETAILED DESCRIPTION OF EMBODIMENT (S) OF INVENTION
Referring to fig. 1 to 5, fig. 1 is a general structure, and fig. 2 to 5 are specific examples; in the embodiment of the present invention, the number k of layers of the tree network is 4, the layer with the uppermost layer number 1 is a server side of the wireless sensor network, the layer with the lowermost layer number 4 is a wireless sensor side of the wireless sensor network, and the layers with the middle numbers 2 and 3 are aggregation relay layers of the wireless sensor network. The number n of transmission unit groups of the wireless sensor network represented by the schematic structural diagram is 3.
In the embodiment of the invention, the tree-shaped wireless sensor network with the layer number of 4 comprises the following working steps:
the method comprises the following steps: the 4-layer tree-shaped wireless sensor network node shown in fig. 3 starts a synchronization link.
Step two: setting a transmission unit group number threshold n of each layer of network nodes to be 3, setting a synchronization imbalance threshold, setting a channel collision number upper limit threshold, setting a channel collision number lower limit threshold, and setting a transmission unit scheduling table initial value, wherein the transmission unit scheduling table initial value can be set to be a frame length threshold as shown in fig. 4: w is aFrame length=12(TRX+nonR)* fTransmission time timer。
Step three: the transmission shown in FIG. 4Under the action of the unit scheduling table, a real time sequence structure diagram of a specific example of the time sequence structure diagram shown in fig. 3 is shown in fig. 5, each node of the wireless sensor network establishes a time scheduling table according to the real time sequence structure diagram shown in fig. 5, 4 layers of tree-shaped wireless sensor network nodes start a transmission time timer, data are transmitted and received according to the time scheduling tables corresponding to the network nodes of each layer, and when the value of the transmission time timer of each layer of network nodes is greater than a frame length threshold wFrame lengthAnd when the transmission work of the frame is finished, entering the transmission work of the next frame. A
Step four: the 4-layer tree-shaped wireless sensor network node shown in fig. 3 starts a synchronization link.
Step five: judging whether the synchronous offset of each hierarchy network node is smaller than a synchronous offset threshold, if the synchronous offset of each hierarchy network node is smaller than the synchronous offset threshold, keeping the threshold of the number of transmission unit groups unchanged, if the synchronous offset of each hierarchy network node is larger than or equal to the synchronous offset threshold, reducing the threshold of the number of transmission unit groups by 10%, rounding, and calculating according to wFrame length=(3n+k- 1)(TRX+nonR)*fTransmission time timerAnd resetting the frame length threshold.
In the fifth step, when judging whether the synchronous offset of each hierarchy network node is smaller than the synchronous offset threshold, the method also comprises the following steps:
step six: reading counters of channel collision times of each hierarchy of network nodes, if the value of the counter of the channel collision times of each hierarchy of network nodes is larger than an upper threshold of the channel collision times, finding all units with the stored value of 0 in a scheduling table of a transmission unit, changing the stored value of the unit with the stored value of 0 in the first 10% of the scheduling table of the transmission unit into 1, if the value of the counter of the channel collision times of each hierarchy of network nodes is smaller than a lower threshold of the channel collision times, finding all units with the stored value of 1 in the scheduling table of the transmission unit, changing the stored value of the unit with the stored value of 1 in the first 10% of the scheduling table of the transmission unit into 0, and if the counter of the channel collision times of each hierarchy of network nodes is larger than or equal to the lower threshold of the channel collision times and smaller than or equal to the upper threshold of the channel collision times, not changing the scheduling table of the transmission unit.
Step seven: and modifying the time scheduling table according to the transmission unit scheduling table, starting a transmission time timer by each hierarchy network node, and transmitting and receiving data according to the time scheduling table corresponding to each hierarchy network node and the transmission unit scheduling table. And when the value of the transmission time timer of each hierarchy network node is larger than the frame length threshold value, completing the transmission work of the frame, entering the next frame transmission work, and executing the step four. The length of each sleep unit time slice in each frame is TTX+nonTThe total length of time per frame is:
Ttotal=Tsyn+Tsum of transmission and reception+TDormancy
=Tsyn+n(TRX+nonR+TTX+nonT+TRX+nonR)+(k-1)(TRX+nonR)
=Tsyn+(3n+k-1)(TRX+non_R)
TRXIndicating the time duration, T, required for the reception process of each data transmission unit in the frameTXRepresents the time length required by the sending process of each data transmission unit in the frame, non _ R represents the receiving interval time length of each data transmission unit, non _ T represents the transmitting interval time length of each data transmission unit, TsynIndicating the duration of the synchronization signal block. In which TRX=TTX,nonRNon _ T. n is the group number of the data transmission units in a frame, k is the layer number of the tree network, n can be set to be the maximum value artificially under the condition of ensuring synchronization, and k is different according to different distribution of different sensor network nodes. T isSum of transmission and receptionIs the total length of time, T, that the x-th layer (1, 2, 3 … … k) network transmits and receives within a frame timeDormancyIs the total length of time that the x-th (1, 2, 3 … … k) layer network sleeps within a frame time.
It is apparent that when the child node of the x-th layer is in the transmitting state, the parent node of the x + 1-th layer must be in the receiving state, and vice versa. So that the total length of time that the child nodes of the x-th layer are in the transmission state within one frame period is equal to the parent of the x + 1-th layerThe total length of time the node is in the receiving state. And as shown in the frame format shown in fig. 5, the total length of time that the xth layer is in the transmitting state is equal to the total length of time that the xth layer is in the receiving state. The total receiving time length of the x-th layer (x ═ 1, 2, 3 … … k) is equal to the total transmitting time length of the x-th layer (x ═ 1, 2, 3 … … k) is equal to the total receiving time length of the x + 1-th layer (x ═ 1, 2, 3 … … k) is equal to the total transmitting time length of the x + 1-th layer. By analogy, it is clear that the total length of time for transmission and the total length of time for reception of each layer are equal and equal to a fixed value independent of the sequence number of the layer. The sum of the total length of transmission time of each layer and the total length of reception time of the layer is also a fixed value independent of the sequence number of the layer, and the fixed value is denoted as TSum of transmission and reception。
Therefore, the total length of time in the sleep state in the xth layer (x ═ 1, 2, and 3 … … k) within one frame time is a constant value regardless of the layer number, and is denoted as TDormancy。
Setting a frame length threshold: w is aFrame length=(TSum of transmission and reception+TDormancy)*fTransmission time timer
=(3n+k-1)(TRx+nonR)*fTransmission time timer
In the above formula fTransmission time timerFor accumulating the count frequency, w, of the transmission time timerFrame lengthIs a frame length threshold.
The system for implementing the MAC protocol method applied to the wireless sensor network of the transformer substation comprises the following steps:
the first frame distinguishing module is used for starting a synchronization link of each hierarchy of network nodes; judging whether a frame to be transmitted is a first frame of wireless sensor network communication; if so, skipping to execute the step 2, otherwise skipping to execute the step 3;
a threshold setting module, configured to set a transmission unit number threshold, set a synchronization imbalance threshold, set a channel collision number upper threshold, set a channel collision number lower threshold, set a transmission unit scheduling table initial value, set a time scheduling table, set a frame length threshold, and jump to the data transceiver module by each layer of network nodes;
the correction and modification module is used for judging whether the synchronous offset of each hierarchy network node is smaller than the synchronous offset threshold or not according to the transmission unit number threshold, the synchronous offset threshold, the channel conflict upper limit threshold, the channel conflict lower limit threshold, the transmission unit scheduling table initial value, the time scheduling table and the frame length threshold set in the first frame; if the synchronous offset of each hierarchy network node is smaller than the synchronous offset threshold, keeping the transmission unit group number threshold unchanged, if the synchronous offset of each hierarchy network node is larger than or equal to the synchronous offset threshold, reducing the transmission unit group number threshold by a preset percentage, rounding, modifying the time scheduling table, resetting the frame length threshold, obtaining the modified transmission unit group number threshold, the time scheduling table and the frame length threshold, and skipping to execute the step data transceiver module;
the data transceiving module is used for modifying the time scheduling table according to the transmission unit scheduling table, starting a transmission time timer by each hierarchy network node, and transceiving data according to the time scheduling table corresponding to each hierarchy network node and the transmission unit scheduling table; and when the value of the transmission time timer of each hierarchy network node is greater than the frame length threshold value, finishing the transmission of the current frame.
In the embodiment of the invention, the method further comprises the following steps: and the execution control module is used for controlling the repeated execution of the first frame judging module, the threshold setting module, the correction and modification module and the data receiving and transmitting module to finish the transmission of all frames.
In the embodiment of the present invention, the correction modification module is further configured to read a counter of channel collision times of each hierarchy network node; if the value of the channel collision frequency counter of each hierarchy network node is larger than the upper limit threshold value of the channel collision frequency, all units with the stored values of 0 in the transmission unit scheduling table are found, and the stored values of the units with the stored values of 0 in the transmission unit scheduling table with the preset percentage are changed into 1; if the value of the channel collision frequency counter of each hierarchy network node is smaller than the lower limit threshold of the channel collision frequency, all units with the stored values of 1 in the transmission unit scheduling table are found, and the stored values of the units with the stored values of 1 in the transmission unit scheduling table with the preset percentage are changed into 0;
and if the channel collision times counter of each hierarchy network node is greater than or equal to the lower limit threshold of the channel collision times and less than or equal to the upper limit threshold of the channel collision times, the scheduling table of the transmission unit is not changed.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art can make modifications and equivalents to the embodiments of the present invention without departing from the spirit and scope of the present invention, which is set forth in the claims of the present application.