Method for collision prediction and avoidance of csma data and tdma data in an asynchronous network
By creating and updating the neighboring master node information table in the asynchronous network, coordinating the transmission of beacon frames, predicting and avoiding collisions, the collision problem between TDMA and CSMA data frames is resolved, achieving stable network operation and energy saving.
Patent Information
- Application Number
- CN202510241666.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-03
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2045-03-03
AI Technical Summary
In asynchronous networks, conflicts between TDMA and CSMA data lead to frequent collisions between beacon frames and data frames, affecting the normal operation of the network and the stability of the beacon cycle. This is especially true when multiple star networks are adjacent, as the time asynchrony between the networks causes frequent collisions between beacon frames and data frames.
By creating or updating adjacent master node information tables through master nodes and child nodes, the transmission of beacon frames is coordinated, and collisions are predicted and avoided. When the master node detects a data frame to be transmitted, it performs collision prediction and avoidance in the form of CSMA frames and TDMA frames. The child nodes also perform collision prediction and avoidance in the form of CSMA frames and TDMA frames to ensure that the transmission time of the data frame does not conflict with the beacon frame.
In asynchronous networks, TDMA frames between different networks do not interfere with each other, ensuring the normal operation of the beacon cycle, reducing useless transmissions, saving energy consumption in the network, and ensuring the orderly operation of asynchronous networks and the normal transmission of data frames.
Smart Images

Figure CN120090763B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the field of communication technology, and relates to a method for predicting and avoiding collision of CSMA data and TDMA data in an asynchronous network. BACKGROUND
[0002] In a communication network, both TDMA and CSMA access methods are commonly used to meet the needs of different types of data transmission in the network. The TDMA mechanism enables multiple nodes to share time resources and transmit data in an orderly manner. The CSMA mechanism can effectively avoid collision between CSMA data.
[0003] Most networks can be decomposed into a combination of star networks. A star network structure includes a central node and multiple sub-nodes, with the sub-nodes connected to the central node, such as Figure 1 .
[0004] When both TDMA and CSMA access methods exist in a star network, in order to support the power saving mechanism of the nodes and reliable transmission of data, the master node periodically transmits a beacon frame in the TDMA manner, and the beacon frame carries information such as the master node address, beacon transmission time, and beacon period. The sub-nodes are normally in a sleep mode, and when the sub-nodes determine that a beacon frame is about to be transmitted according to their own time or the sub-nodes have data to be transmitted, the sub-nodes will exit the sleep mode. After the sub-nodes receive the beacon frame, they synchronize their time according to the time information carried in the beacon frame, so that their time is consistent with that of the master node, calculate the beacon transmission time according to the length of the beacon frame, and know that the beacon period has started. When there is a data frame to be transmitted in the beacon period, the sub-nodes transmit the data frame in the CSMA manner, such as Figure 2 . In this network, there is a problem that if the beacon frame transmission time arrives during the transmission of the data frame, a collision will occur between the data frame and the beacon frame in the network.
[0005] When multiple star networks described above are adjacent, the times of multiple networks are not synchronized, which is referred to as an asynchronous network.
[0006] In an asynchronous network, each network transmits a beacon frame according to its own network time, and transmits its own data frame in the CSMA manner in its own beacon period. When multiple star networks exist, there are two problems, a. Due to the different times of the asynchronous networks, there is a collision between the transmission of the beacon frames of different networks. b. When the transmission of a data frame of a network is in progress, the transmission time of a beacon frame of another network arrives, which will cause a collision between the data frame and the beacon frame between the networks.
[0007] In summary, in the star network, there is a conflict between CSMA data and TDMA data. In the star network, there is a conflict between TDMA data, and a conflict between CSMA data and TDMA data. The following three problems are described in detail:
[0008] (1) Conflict between CSMA frame and TDMA frame in a single network:
[0009] a. Conflict between master node CSMA frame and TDMA frame:
[0010] For the master node itself conflict, when the beacon period of the master node is about to end, the master node has a data frame to send, and the master node detects that the current channel is idle, and directly sends the data frame. However, due to the length of the data frame, the second half of the data transmission is not within the current beacon period, and a time collision occurs with the beacon frame of the next beacon period, as shown in Figure 3 .
[0011] b. Conflict between child node CSMA frame and TDMA frame:
[0012] When the beacon period is about to end, the child node has a data frame to send, and the child node detects that the current channel is idle, and directly sends the data frame. Due to the length of the data frame, the second half of the data transmission is not within the current beacon period, resulting in a collision between the data frame of the child node and the beacon frame of the master node, as shown in Figure 4 .
[0013] (2) Conflict between TDMA data in networks
[0014] Each network has its own beacon frame, but due to the asynchronous nature of the networks, when there are multiple networks, collisions of beacon frames often occur, as shown in Figure 5 .
[0015] As shown in Figure 5 , when the beacon frames between networks collide, the child nodes of multiple networks cannot normally receive the beacon frames, and thus cannot normally carry out business.
[0016] (3) Conflict between TDMA frame and CSMA frame in networks
[0017] a. Conflict between master node CSMA frame and TDMA frame:
[0018] When the master node has a data frame to send in its own beacon period, it will directly send when detecting that the channel is idle. However, other network master nodes may send beacon frames during the data frame transmission, resulting in a conflict between data frame and beacon frame transmission, as shown in Figure 6 .
[0019] b.CSMA frame and TDMA frame conflict:
[0020] When multiple asynchronous networks coexist, there are multiple master nodes, and the conflict generated by data transmission is more frequent, not only the conflict between networks, but also the conflict between networks. When the data frame is transmitted, it will not only conflict with the beacon frame of its own network, but also conflict with the beacon frame of the surrounding network. For example Figure 7 .
[0021] By Figure 7 It can be seen that the child nodes of network 2 transmit data frames in the beacon period of their own network, and directly transmit data frames after detecting that the channel is idle. However, when the beacon time slot of network 1 arrives, the beacon frame is directly transmitted. At this time, the data frame of the child node of network 2 has not been transmitted, so that the data frame of the child node of network 2 and the beacon frame of network 1 collide.
[0022] In the network, if the transmission of the beacon frame conflicts, the child node cannot correctly receive the beacon frame, which may cause the child node to lose the information in the beacon frame, lose the control of the beacon period, and cannot normally execute the business function. SUMMARY
[0023] Therefore, the purpose of the present application is to provide a conflict prediction and avoidance method for CSMA data and TDMA data in an asynchronous network.
[0024] Some variables in the method are defined and explained as follows:
[0025] T total : the sum of the maximum time of the business frame CSMA and the transmission time of the business frame.
[0026] T slot : the minimum time interval between adjacent two beacon frames, which can support the transmission of the business frame and the response of the master node to the business frame.
[0027] T period : the beacon period.
[0028] T: the guard interval between frames.
[0029] To achieve the above purpose, the present application provides the following technical scheme:
[0030] A conflict prediction and avoidance method for CSMA data and TDMA data in an asynchronous network, the method comprising the following steps:
[0031] The master node creates or updates the adjacent master node information table according to the received beacon frame of other networks;
[0032] The master node coordinates transmission of initial beacon frames or subsequent beacon frames between networks according to the adjacent master node information table;
[0033] The master node adds the adjacent master node information table to the beacon frame and assembles the beacon frame;
[0034] The child node creates or updates the adjacent master node information table according to the received beacon frame;
[0035] When the master node detects a data frame to be transmitted, the master node transmits the data frame to other nodes in a manner of conflict prediction and avoidance of the CSMA frame and the TDMA frame of the master node; when the child node detects a data frame to be transmitted, the child node transmits the data frame to other nodes in a manner of conflict prediction and avoidance of the CSMA frame and the TDMA frame of the child node.
[0036] Further, the process of creating the adjacent master node information table by the master node is as follows:
[0037] S111, the master node receives a beacon frame of another master node, calculates a transmission time T1 of the beacon frame according to a length of the beacon frame, and calculates a transmission time T3 of the beacon frame according to a receiving time T2, T3 = T2-T1; and the master node parses the beacon frame to obtain an address of the master node and a beacon period T period , and calculates a next transmission time T4 of the beacon frame of the master node, T4 = T3+T period ;
[0038] S112, a new space is created to save the obtained address of the master node, the transmission time T1, the transmission time T4, and the beacon period T period in the adjacent master node information table, and is marked as a direct master node;
[0039] S113, the master node parses the beacon frame to obtain information in the adjacent master node information table carried in the beacon frame, the information in the adjacent master node information table includes an address of a master node, a beacon period, a transmission time difference T5, and a transmission time, and the master node calculates a transmission time T6 of the beacon frame of the master node in the adjacent master node information table, T6 = T3+T5;
[0040] S114, a new space is created to save the obtained address of the master node, the transmission time, the transmission time T6, and the beacon period in the adjacent master node information table, and is marked as an indirect master node; if all the master node information carried in the beacon frame is saved, the process jumps to S115, otherwise, the process jumps to S113;
[0041] S115, the master node sorts the node information in the adjacent node information table according to the transmission time of the beacon frame.
[0042] Further, the process of updating the adjacent master node information table by the master node is as follows:
[0043] S121, the master node receives the beacon frame of other master node, calculates the transmission time T7 according to the length of the beacon frame, and calculates the sending time T9=T8-T7 of the beacon frame according to the receiving time T8; and analyzes the beacon frame to obtain the address of the master node and the beacon period T period , calculates the next beacon sending time T 10 =T9+T period of the master node.
[0044] S122, compares the obtained master node address with the address stored in the adjacent master node information table, if the master node address has been saved, updates the beacon sending time of the master node, if the beacon period and the transmission time change, updates; if the master node address is not saved, creates a new space to save the obtained master node address, transmission time T7, beacon sending time T 10 , beacon period T period in the adjacent master node information table, and marks it as a direct master node.
[0045] S123, analyzes the beacon frame to obtain the information in the adjacent master node information table carried in the beacon frame, the information in the adjacent master node information table includes the master node address, the beacon period T 11 , the sending time difference T 12 and the transmission time, and calculates the beacon sending time T 13 =T9+T 12 of the master node in the adjacent master node information table.
[0046] S124, compares the obtained master node address with the address stored in the adjacent master node information table, if the master node address has been saved, updates the beacon sending time of the master node, if the beacon period and the transmission time change, updates; if the master node address is not saved, creates a new space to save the obtained master node address, transmission time, beacon sending time T 12 , and the beacon period in the adjacent master node information table, and marks it as an indirect master node; if the master node information carried in the beacon frame is all saved, jumps to S125, otherwise jumps to S123.
[0047] S125, sorts the node information in the adjacent node information table according to the beacon sending time in sequence.
[0048] Further, the process of the master node for initial TDMA frame coordination is:
[0049] S211, the master node calculates the beacon transmission time T1, according to the node information stored in the adjacent master node information table, calculates the interval of all adjacent beacon sending time and the interval between the last sent beacon frame in the adjacent master node information table and the end of the beacon period, compares the intervals calculated and takes the maximum interval as T2; if T2<2*T slot +T1, the result is fed back to the master node, and the master node adjusts its beacon period; if T2>2*T slot +T1, jump to S212;
[0050] S212, design two times of T1 interval as T4, T5, T4
[0051] The process of the master node for subsequent TDMA frame coordination is:
[0052] S221, in the subsequent beacon frame sending process, check the adjacent master node information table before each sending, calculate the interval between the sending time of itself and the sending time of the previous beacon recorded in the table, and record it as T6; if T6>T slot , do not make any treatment, if T6 slot , jump to S222;
[0053] S222, adjust the sending of the beacon frame, set the original sending time as T7, and set the sending time of the beacon frame as T7+(T slot -T6).
[0054] Further, the process of adding the adjacent master node information table to the beacon frame is:
[0055] S31, the master node checks whether the adjacent master node information table has a direct master node; if it is empty, jump to S34, otherwise jump to step S32;
[0056] S32, poll the next beacon frame sending time T1 of the direct master node recorded in the adjacent master node information table, get the beacon frame sending time T2 of itself, and calculate the difference T3=T1-T2;
[0057] S33, add the time difference T3, node address, beacon period and transmission time to the beacon frame; if there is still a direct master node not calculated in the table, jump to S32, otherwise jump to S34;
[0058] S34, assemble the beacon frame, and send the beacon frame when the beacon frame sending time arrives.
[0059] Further, the process of creating the adjacent master node information table by the sub-node is:
[0060] S411, receiving the beacon frame of the self network, obtaining the master node address, beacon sending time T1, beacon period T period , calculating the beacon transmission time according to the beacon length, and calculating the next sending time T2 of the beacon T1+T period ;
[0061] S412, creating a new space to save the master node address, transmission time, next beacon sending time and beacon period obtained in S411 in the adjacent master node information table;
[0062] S413, obtaining the information of the adjacent master node information table from the beacon frame, obtaining the master node address, transmission time, beacon period T3, and the difference T4 between the beacons, and calculating the sending time T5 of the beacon frame T1+T4;
[0063] S414, creating a new space to save the master node address, transmission time, beacon sending time and beacon period obtained in S412 in the adjacent master node information table; if the master node information carried by the beacon frame has been saved completely, jumping to S415, otherwise jumping to S413;
[0064] S415, sorting the node information in the adjacent node information table according to the beacon sending time.
[0065] Further, the process of updating the adjacent master node information table by the sub node is as follows:
[0066] S421, receiving the beacon frame of the self network, obtaining the master node address, beacon sending time T7, beacon period T period , calculating the beacon transmission time T8 according to the beacon length, and calculating the sending time T9 of the beacon T7+T period ;
[0067] S422, comparing the master node address obtained in S421 with the address stored in the adjacent master node information table; if the master node address has been saved, updating the beacon sending time of the master node, and if the beacon period and transmission time change, updating; if the master node address is not saved, creating a new space to save the master node address, transmission time T8, beacon sending time T9 and beacon period T period obtained in S421 in the adjacent master node information table;
[0068] S423, obtaining the information of the adjacent master node information table from the beacon frame, obtaining the master node address, transmission time T 10 , beacon period T 11 , the difference T 12 between the beacons, and calculating the sending time T 13 of the beacon frame T7+T 12;
[0069] S424. Compare the master node address obtained in S423 with the addresses stored in the adjacent master node information table. If the master node address has been saved, update the beacon transmission time of the master node. If the beacon period or transmission time has changed, update them. If the master node address has not been saved, create a new space to store the master node address, transmission time T 10 , beacon transmission time T 13 , beacon period T 11 , in the adjacent master node information table. If all the master node information carried in the beacon frame has been saved, jump to S425; otherwise, jump to S423;
[0070] S425. Sort the node information in the adjacent node information table according to the sequence of beacon transmission times.
[0071] Furthermore, the process of collision prediction and avoidance for the CSMA frame and TDMA frame of the master node is as follows:
[0072] S511. When the master node has a data frame to send, call the data frame sending process;
[0073] S512. The master node records the current time of calling the sending, denoted as T1;
[0074] S513. The master node calculates the interval between T1 and the earliest direct master node beacon transmission time T2 in the adjacent master node information table, denoted as T3;
[0075] S514. The master node calculates whether the current data frame sending will collide with the beacon frame. If T3 < T total +T, that is, the time interval does not meet the requirement for sending the data frame, jump to S515; if T3 ≥ T total +T, then jump to S517;
[0076] S515. The master node calculates the intervals between the adjacent beacon transmission times of the direct master nodes in the adjacent master node information table in sequence according to the sending time. Denote the intervals as T3. Assume two adjacent beacon transmission times are T4 and T5, where T4 < T5. Obtain the transmission time of T4, denoted as T beacon , calculate T3 = T5 - T4 - T beacon . If the beacon transmission times in the adjacent master node information table have all been calculated, jump to S516; if T3 < T total +T, that is, the time interval does not meet the requirement for sending the data frame, jump to S515; if T3 ≥ T total +T, then set the sending time of the data frame to T4 + T beacon +T. After the sending time arrives, jump to S517;
[0077] S516, calculate the interval between the latest beacon sending time T6 and the end of the beacon period T in the adjacent master node information table, denoted as T3, and obtain the transmission time of the latest beacon denoted as T end beacon end beacon total If T3 < T total +T, the time interval does not satisfy the sending of the data frame, jump to S518; if T3 ≥ T beacon +T, set the sending time of the data frame as T6+T total +T, and jump to S517 after the sending time arrives;
[0078] S517, the master node detects whether the channel is idle, if yes, directly send, if no, randomly back off for a period of time, and execute S517 again;
[0079] S518, feed back the result of sending the data frame without sufficient interval between the beacon frames to the master node, and the master node adjusts the beacon period.
[0080] Further, the conflict prediction and avoidance process of the CSMA frame and the TDMA frame of the child node is as follows:
[0081] S521, the child node has a data frame to send, exits from the sleep mode, and calls the data frame sending process;
[0082] S522, the child node records the calling sending time as T1, and obtains the earliest beacon sending time T2 of the direct master node greater than T1 in the adjacent master node information table;
[0083] S523, the child node calculates the interval between T1 and T2 as T3;
[0084] S524, the child node calculates whether the current data frame sending will collide with the beacon frame, if T3 < T total +T, the time interval does not satisfy the sending of the data frame, jump to S525; if T3 ≥ T total +T, jump to S527;
[0085] S525, the child node calculates the interval between the adjacent beacon sending time of the direct master node in the adjacent master node information table according to the sending time, denoted as T3, sets the two adjacent beacon sending times as T4 and T5, T4 < T5, and obtains the transmission time of the beacon with the sending time T4 as T beacon , i.e. T3 = T5-T4-T beacon . If the beacon sending time in the adjacent master node information table has been calculated, jump to S526; if T3 < T total If +T, meaning the time interval does not meet the requirement for data frame transmission, then jump to S525; if T3≥T total +T sets the data frame transmission time to T4+T. beacon +T, after the transmission time arrives, jump to S527;
[0086] S526. Calculate the latest beacon transmission time T6 in the adjacent master node information table and the end of the beacon period T. end The interval is denoted as T3, and the transmission time of the latest beacon is denoted as T. beacon That is, T3 = T end -T6-T beacon If T3 <T total If +T, meaning the time interval does not meet the requirement for data frame transmission, then jump to S528; if T3≥T total +T sets the data frame transmission time to T6+T. beacon +T, after the transmission time arrives, jump to S527;
[0087] S527. The child node checks whether the channel is idle. If it is idle, it sends directly. If the channel is busy, it backs off randomly for a period of time and executes S527 again.
[0088] S528, the child node reports back to the master node that there is not enough interval between beacon frames to send data frames, and the master node adjusts the beacon period.
[0089] The beneficial effects of this invention are as follows:
[0090] First, the present invention coordinates the transmission of TDMA frames between different networks. In asynchronous networks, the TDMA frames between different networks do not interfere with each other, thus ensuring the normal operation of the network.
[0091] Secondly, by avoiding the conflict between CSMA and TDMA in the network, this invention ensures that data frames do not disrupt the normal transmission of beacon frames in the network, guarantees the normal operation of the beacon cycle, and saves time resources in the network.
[0092] Third, by avoiding the interference between CSMA and TDMA between networks, this invention ensures that asynchronous networks will not interfere with each other, and that data frames from other networks will not interfere with the transmission of beacon frames in this network. This guarantees the coexistence of asynchronous networks and enables them to operate in an orderly manner.
[0093] Fourth, by avoiding the conflict between CSMA and TDMA, this invention reduces a lot of useless transmissions and saves energy consumption in the network.
[0094] Additional advantages, objects, and features of the application will be apparent to those skilled in the art upon examination of the following specification. It is intended to BRIEF DESCRIPTION OF DRAWINGS
[0095] In order to make the objects, technical solutions and advantages of the present application clearer, the preferred embodiments of the present application will be described in detail below with reference to the drawings, in which:
[0096] Figure 1 for star network structure;
[0097] Figure 2 for single network information transceiving schematic diagram;
[0098] Figure 3 for network main node CMSA data and TDMA data collision schematic diagram;
[0099] Figure 4 for network sub node CMSA data and TDMA data collision schematic diagram;
[0100] Figure 5 for network main node TDMA data collision schematic diagram between networks;
[0101] Figure 6 for network main node CMSA data and TDMA data collision schematic diagram between networks;
[0102] Figure 7 for network sub node CMSA data and main node TDMA data collision schematic diagram between networks;
[0103] Figure 8 for the whole flow chart of the CSMA data and TDMA data conflict prediction and avoidance method in the asynchronous network of the present application;
[0104] Figure 9 for the asynchronous network structure schematic diagram under the embodiment;
[0105] Figure 10 for the data frame structure schematic diagram of the present application;
[0106] Figure 11 for the process schematic diagram of the main node creating adjacent main node information table of the present application;
[0107] Figure 12 for the process schematic diagram of the initial TDMA frame coordination of the main node of the present application;
[0108] Figure 13Flowchart for creating adjacent master node information table for child node of the present application;
[0109] Figure 14 Flowchart for conflict prediction and avoidance of CSMA frame and TDMA frame for master node of the present application;
[0110] Figure 15 Flowchart for conflict prediction and avoidance of CSMA frame and TDMA frame for child node of the present application;
[0111] Figure 16 Flowchart for updating adjacent master node information table for master node of the present application;
[0112] Figure 17 Flowchart for coordination of subsequent TDMA frame for master node of the present application;
[0113] Figure 18 Flowchart for updating adjacent master node information table for child node of the present application. DETAILED DESCRIPTION
[0114] The present application is described herein with reference to particular embodiments for a purpose of clarity and
[0115] Wherein, the drawings are only for illustrative explanation, the representation is only schematic diagram, not real object drawing, and cannot be understood as limitation to the present application; in order to better explain the embodiments of the present application, some components of the drawings are omitted, enlarged or reduced, and do not represent the size of the actual product; for those skilled in the art, it is understandable that some well-known structures and their descriptions in the drawings can be omitted.
[0116] The same or similar reference numerals in the drawings of the embodiments of the present application correspond to the same or similar components; in the description of the present application, it should be understood that if the orientations or positional relationships indicated by the terms “upper”, “lower”, “left”, “right”, “front”, “back” and the like are based on the orientations or positional relationships shown in the drawings, they are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a particular orientation, be constructed and operated in a particular orientation, therefore the terms describing the positional relationships in the drawings are only used for exemplary illustration, and cannot be understood as a limitation on the present application, for those skilled in the art, the specific meanings of the above terms can be understood according to the specific circumstances.
[0117] Please refer to Figures 8 to 18 , a conflict prediction and avoidance method for CSMA data and TDMA data in an asynchronous network.
[0118] Figure 8 The overall flowchart of the conflict prediction and avoidance method for CSMA data and TDMA data in an asynchronous network of the present application is shown, and the steps mainly include:
[0119] The master node creates or updates the adjacent master node information table according to the received beacon frame of other networks;
[0120] The master node coordinates the transmission of the initial beacon frame or the subsequent beacon frame between networks according to the adjacent master node information table;
[0121] The master node adds the adjacent master node information table to the beacon frame and assembles the beacon frame;
[0122] The slave node creates or updates the adjacent master node information table according to the received beacon frame;
[0123] When the master node detects a data frame to be sent, it sends the beacon frame to other nodes in the conflict prediction and avoidance manner of the CSMA frame and the TDMA frame of the master node; when the slave node detects a data frame to be sent, it sends the beacon frame to other nodes in the conflict prediction and avoidance manner of the CSMA frame and the TDMA frame of the slave node.
[0124] Embodiment
[0125] This embodiment assumes that there are three networks in the asynchronous network, and the schematic diagram is as shown in Figure 9 Network 2 is the direct master node of network 1, and network 3 is the indirect master node of network 1, and network 3 is the direct master node of network 2. It is assumed that the master nodes of network 2 and network 3 have been running for a period of time, and the master node of network 3 has stored information in the adjacent master node information table. It is assumed that the master node in network 1 has just been started, at this time the master node of network 1 needs to listen to the surrounding network beacon table, obtain information from it, and create an adjacent master node information table.
[0126] The structure of the beacon frame is as shown in Table 1 Figure 10 which comprises a PHY frame header, a MAC control field, a destination address, a source address, a payload field, and an ORC, wherein the PHY frame header occupies 4 bytes, the MAC control field occupies 2 bytes, the destination address occupies 4 bytes, the source address occupies 4 bytes, the ORC occupies 4 bytes, the payload field occupies 14 to 34 bytes, and the information of the beacon frame and the information in the neighboring master node information table are in the payload field, wherein the information of the beacon frame includes a beacon sending time, a beacon period, and a neighboring master node information table. The destination master node address represents the target address of sending, usually FFFF, indicating a broadcast address; the source master node address represents the address of the master node sending the beacon frame; the sending time of the beacon is used for time synchronization; and the beacon period is the time interval of sending the beacon frame.
[0127] The neighboring master node information table includes a direct master node address, a beacon period, a difference value between the master node beacon sending time in the table and the beacon frame sending time (obtained by calculation), and a beacon transmission time. Among them, the source master node address identifies a unique master node, which is obtained from the beacon frame. The sending time of the beacon is calculated according to the receiving time of the node itself and the transmission time of the beacon frame, and the calculation formula is: receiving time-transmission time. The beacon period is the time interval of sending the beacon frame, which is obtained from the beacon frame. The transmission time is the time of transmitting the beacon frame in the channel, which is obtained by calculation.
[0128] The neighboring master node information table of the master node as shown in Table 1 and the star spirit master node information table of the sub-node as shown in Table 2:
[0129] Table 1
[0130] Master Node Address 4 bytes Direct / Indirect Flag 1 byte Time of Transmission 7 bytes Beacon Period 1 byte Beacon Transmission Time 1 byte
[0131] Table 2
[0132] Master Node Address 4 bytes Time of Transmission 7 bytes Beacon Period 1 byte Beacon Transmission Time 1 byte
[0133] The difference between the neighboring master node information tables of the master node and the sub-node is that the neighboring master node information table of the master node contains a direct / indirect flag, which is used to mark whether the master node is a direct master node or an indirect master node, which is obtained through the information carried in the beacon frame.
[0134] The master node stores the received beacon frame information in the neighboring master node information table in order according to the beacon sending time, and divides it into direct master nodes and indirect master nodes. The direct master node is a master node that can receive the beacon frame itself, and the indirect master node is a master node that cannot receive the corresponding beacon frame itself, but the direct master node can directly receive the beacon frame. In the subsequent running process, only the time information of the recorded master node is updated, and the sending time is sorted in order, so that the search is more convenient.
[0135] With the network connection case described above as an example, an example of data interaction of the method of the application is described, and the steps are as follows:
[0136] (1) The network 1 master node creates a neighboring master node information table, and the main process is as shown in the following figure: Figure 11
[0137] Step 1a: The master node receives a beacon frame of another master node, calculates the transmission time T1 according to the length of the beacon frame, and calculates the sending time T3 of the beacon frame according to the receiving time T2, i.e. T3 = T2-T1. Then the beacon frame is parsed to obtain the address of the master node and the beacon period T period , and the next sending time T4 of the beacon of the master node is calculated, i.e. T4 = T3+T period ;
[0138] Step 1b: A new space is created to save the master node address, transmission time T1, beacon sending time T4, and beacon period T period obtained in step 1a in the neighboring master node information table, and is marked as a direct master node;
[0139] Step 1c: The beacon frame is parsed to obtain the information in the neighboring master node information table carried in the beacon frame, including the master node address, the beacon period, the sending time difference T5, and the transmission time, and the sending time T6 of the master node in the neighboring master node information table is calculated, i.e. T6 = T3+T5;
[0140] Step 1d: A new space is created to save the master node address, transmission time, beacon sending time T6, and beacon period obtained in step 1c in the neighboring master node information table, and is marked as an indirect master node. If all the master node information carried in the beacon frame is saved, go to step 1e, otherwise go to step 1c;
[0141] Step 1e: The node information in the neighboring node information table is sorted according to the sending time of the beacon.
[0142] In this embodiment, the specific process of creating the neighboring master node information table by the network 1 master node is as follows:
[0143] Step 11: The network 1 master node is powered on and listens for a beacon period plus a random time of 0-10s;
[0144] Step 12: The network 1 master node receives a beacon frame of the network 2 master node;
[0145] Step 13: The transmission time T1 of the beacon frame is calculated according to the length of the beacon frame, and the sending time T3 of the beacon frame is calculated according to the receiving time T2, i.e. T3 = T2-T1. Then the beacon frame is parsed to obtain the address of the network 2 master node and the beacon period T period and the next beacon sending time T4 of the network 2 master node is calculated as T4 = T3 + T period ;
[0146] Step 14, a new space is opened to save the network 2 master node address, beacon sending time, beacon period and transmission time in the adjacent master node information table in step 3, and the master node is marked as a direct master node;
[0147] Step 15, the beacon frame of the network 2 is parsed to obtain the information in the adjacent master node information table carried in the beacon frame, including the network 3 master node address, beacon period T5, sending time difference T6 and transmission time, and the sending time T7 of the master node in the adjacent master node information table is calculated as T7 = T3 + T6;
[0148] Step 16, the network 3 master node address, beacon sending time, beacon period and transmission time information obtained in step 5 are saved in the adjacent master node information table, and the master node is marked as an indirect master node;
[0149] Step 17, the node information in the adjacent master node information table is sorted according to the beacon sending time.
[0150] After the network 1 master node creates its own adjacent master node information table, the sending time of its beacon is selected according to the content in the table. It is assumed that the beacon sending time of the network 2 master node is T 网2 , the beacon sending time of the network 3 master node is T 网3 , and T 网2 <T 网3 , there should be a minimum interval T slot between the beacon frames, which is enough to support the normal operation of node services, and it is assumed that the transmission time of the beacon frame is T beacon .
[0151] When the master node is just started and has not sent a beacon frame, a suitable sending time is selected according to the ordered information in the adjacent master node information table, by calculating the interval between the beacon frames and the interval between the sending time of the last beacon frame in the table and the end of the beacon period. Since the beacon period is a time for a network to send service frames, if the number of adjacent master nodes is too large, there will be many sending of beacon frames in the beacon period, which will prevent the service frames from being unfolded, therefore, in order to ensure the normal operation of the service frames, it is suggested that there should be a minimum interval T slot between the beacon frames, which is enough to support the normal operation of node services.
[0152] When the master node has sent a beacon frame, since the sending time of the beacon frame will have a certain left and right deviation, the interval between the beacons will change, therefore, the interval between the beacon sending times needs to be dynamically adjusted to ensure that the interval between the beacon frames is greater than or equal to Tslot Thus, the next step is:
[0153] (2) coordinating the initial TDMA frame of the network 1 master node, the main process is as shown in Figure 12
[0154] Step 2a, the master node calculates the beacon transmission time T1, according to the node information stored in the adjacent master node information table, calculates the interval of all adjacent beacon sending time and the interval between the last sent beacon frame in the adjacent master node information table and the end of the beacon period, compares the calculated interval, and takes the maximum interval as T2. If T2 < 2*T slot +T1, the result is fed back to the master node, so that the master node adjusts its beacon period; if T2 > 2*T slot +T1, jump to step 2b;
[0155] Step 2b, assuming that the two times of T1 interval are T4 and T5 (T4 < T5), the beacon sending time is set to T3 = (T4 + T5) / 2.
[0156] In this embodiment, the initial TDMA frame coordination process of the network 1 master node is as follows:
[0157] Step 21, the network 1 master node calculates the sending interval between the beacon frames of the surrounding master nodes according to the adjacent master node information table, and the adjacent master node information table only saves the beacon sending time of network 2 and network 3, which are respectively recorded as T 网2 、T 网3, , and the beacon transmission time in network 2 is obtained as T beacon2 , the interval T1 between them is calculated as T 网3 -T 网2 -T beacon , and the beacon transmission time in network 2 is obtained as T beacon3 , and the interval T2 between T 网3 and the end of the beacon T end is calculated as T end -T 网3- T beacon3 ;
[0158] Step 22, compare the size between T1 and T2, T1 > T2;
[0159] Step 23, T1 > 2*T slot +T, the beacon sending time T3 of itself is set to (T 网2 +T 网3 ) / 2.
[0160] When the beacon frame of network 1 is sent, in addition to carrying the information of the beacon frame of network 1, the information of the direct master node in the adjacent master node information table also needs to be carried, so that the sub-nodes in the same network can obtain the beacon sending information of the surrounding network, and the next step is:
[0161] (3) The master node of network 1 adds the adjacent master node information table to the beacon frame, assembles the beacon frame, and the main process is as follows:
[0162] Step 3a, the master node checks whether the adjacent master node information table contains the direct master node, if not, jump to step 3d; if yes, jump to step 3b;
[0163] Step 3b, poll the next beacon sending time T1 of the direct master node recorded in the adjacent master node information table, obtain the beacon sending time T2 of itself, and calculate the difference T3=T1-T2 between the two;
[0164] Step 3c, add the time difference T3, node address, beacon period, and transmission time to the beacon frame, if there are still direct master nodes in the table that have not been calculated, jump to step 3b, otherwise jump to step 3d;
[0165] Step 3d, assemble the beacon frame, and when the beacon frame sending time arrives, send the beacon frame.
[0166] In this embodiment, the network 1 master node carries the adjacent master node information table in the beacon frame, and the process is as follows:
[0167] Step 31, the network 1 master node polls the adjacent master node information table, checks that the network 2 master node is a direct master node, calculates the difference between the next beacon sending time T1 of the network 2 master node stored in the table and the next beacon sending time T2 of the network 1 master node, i.e. T3=T1-T2, and then loads the network 2 master node address, time difference T3, and network 2 beacon period in the beacon frame;
[0168] Step 32, the network 1 master node checks the next node in the adjacent master node information table, and the network 3 master node is an indirect master node, so it is skipped;
[0169] Step 33, the network 1 master node checks that there is no master node information after the adjacent master node information table, and then completes the assembly of the beacon, and waits for the arrival of the beacon sending time.
[0170] When the sub-nodes avoid the beacon frame of the surrounding network, the adjacent master node information table also needs to be created, but the adjacent master node information table of the sub-node only contains the direct master node, and the following steps are executed:
[0171] (4) The sub-node of network 1 creates the adjacent master node information table, and the main process is as shown in Figure 13
[0172] Step 4a, receiving the beacon frame of the own network, obtaining the master node address, beacon sending time T1, beacon period T period , calculating the beacon transmission time according to the beacon length, and calculating the next sending time T2=T1+T period of the beacon;
[0173] Step 4b, creating a new space to save the obtained master node address, transmission time, next beacon sending time, and beacon period in the adjacent master node information table;
[0174] Step 4c, obtaining the information of the adjacent master node information table from the beacon frame, obtaining the master node address, transmission time, beacon period T3, and the difference T4 between beacons, and calculating the sending time T5=T1+T4 of the beacon frame;
[0175] Step 4d, creating a new space to save the obtained master node address, transmission time, beacon sending time, and beacon period in the adjacent master node information table. If the master node information carried by the beacon frame has been saved completely, jump to step 4e, otherwise jump to step 4c;
[0176] Step 4e, sorting the node information in the adjacent node information table according to the beacon sending time.
[0177] In the embodiment, the network 1 sub-node creates the adjacent master node information table:
[0178] Step 41, the network 1 sub-node receives the beacon frame of the own network, obtains the master node address, beacon sending time T1, and beacon period T period , calculates the beacon transmission time according to the beacon length, and calculates the next sending time T2=T1+T period of the beacon;
[0179] Step 42, obtaining the information of the adjacent master node information table from the beacon frame, obtaining the network 2 master node address, transmission time, beacon period T3, and the difference T4 between beacons, and calculating the sending time T5=T1+T4 of the beacon frame, and calculating the next beacon sending time T6=T5+T3;
[0180] Step 43, saving the master node address, beacon sending time, beacon period, and transmission time of network 1 and network 2 in the adjacent master node information table.
[0181] When the network 1 master node has data frames to send, it will predict whether there is a collision with the beacon frame according to the direct master node information recorded in the adjacent master node information table. The adjacent master node information table of the network 1 master node only has one direct master node, i.e. the master node of network 2. The minimum time of the service frame is T total , and the guard interval between frames is T. Thus, the following steps are performed:
[0182] (5) The master node of network 1 sends a beacon frame to other nodes in a manner of collision prediction and avoidance of the master node's CSMA frame and TDMA frame. Assuming that the sum of the maximum time of the service frame CSMA and the service frame transmission time is T total , and the guard interval between frames is T. The minimum interval T slot between beacon frames is T total + T. When there is a service frame to send, the interval between the current time and the adjacent beacon sending time is calculated. If the interval is greater than or equal to T total + T, the CSMA process is immediately performed. When the channel is idle, the service frame is sent. If the interval is less than T total + T, the interval between the end time of the beacon frame sending and the beacon sending is calculated in the order of the adjacent master node information table. If there is an interval greater than or equal to T total + T, the sending of the service frame is placed in the interval. If there is not enough interval between adjacent beacons, the interval between the latest beacon end time in the table and the end of the beacon period is calculated. If the interval is greater than or equal to T total + T, the sending of the data frame is placed in the interval. Otherwise, the result is fed back to the master node, so that the master node increases the length of the beacon period. Since there is a dynamic coordination mechanism between the beacon frames, there will always be enough interval between the beacon frames to allow the service frame to proceed. The main process is shown in Figure 14 :
[0183] Step 5a, the master node has data frames to send, and calls the data frame sending process;
[0184] Step 5b, the master node records the time of the current call sending, denoted as T1;
[0185] Step 5c, the master node calculates the interval T3 between T1 and the sending time T2 of the earliest direct master node in the adjacent master node information table;
[0186] Step 5d, the master node calculates whether the current data frame sending will collide with the beacon frame. If T3 < T total + T, the time interval does not meet the sending of the data frame. Go to step 5e; if T3 ≥ T total + T, go to step 5g;
[0187] Step 5e. The master node calculates, in sequence of the sending time, the interval between the adjacent beacon sending times of the direct master nodes in the adjacent master node information table, denoted as T3. Assume the adjacent beacon sending times are T4 and T5, where T4 < T5, and obtain the beacon transmission time T of the sending time T4 beacon , that is, T3 = T5 - T4 - T beacon If the beacon sending times in the adjacent master node information table have all been calculated, jump to Step 5f; if T3 < T total + T, that is, the time interval does not meet the sending of the data frame, jump to Step 5e; if T3 ≥ T total + T, set the sending time of the data frame to T4 + T beacon + T, after the time arrives, jump to Step 5g;
[0188] Step 5f. Calculate the interval T between the latest beacon sending time T6 in the adjacent master node information table and the end of the beacon period end , denoted as T3, and obtain the latest beacon transmission time as T beacon , that is, T3 = T end - T6 - T beacon , if T3 < T total + T, that is, the time interval does not meet the sending of the data frame, jump to Step 5h; if T3 ≥ T total + T, set the sending time of the data frame to T6 + T beacon + T, after the time arrives, jump to Step 5g;
[0189] Step 5g. The master node detects whether the channel is idle. If it is idle, send directly; if the channel is busy, randomly back off for a period of time and then execute Step 5g again;
[0190] Step 5h. Feed back the result that there is not enough interval between beacon frames to send the data frame to the master node, so that the master node adjusts the beacon period.
[0191] In this embodiment, the CSMA frame and TDMA frame conflict prediction and avoidance process of the master node of Network 1 is as follows:
[0192] Step 51. When the master node of Network 1 has a data frame to send, call the data frame sending process;
[0193] Step 52. The master node of Network 1 records the current calling sending time, denoted as Tl;
[0194] Step 53. The master node of Network 1 calculates the interval between Tl and the beacon sending time T2 of the master node of Network 2, denoted as T3;
[0195] Step 54. By judgment, T2 ≥ T total + T;
[0196] Step 55, the network 1 master node detects that the channel is idle;
[0197] Step 56, the data frame is sent.
[0198] The network 1 sub-node is known to have only one direct master node in the adjacent master node information table, i.e. the master node of network 2. The minimum time required for the service frame is T total , and the guard interval between frames is T. When the network 1 sub-node calls for sending of the data frame, the beacon frame of the network 2 master node has not yet been sent, and thus:
[0199] (6) The network 1 sub-node sends the beacon frame to other nodes in the manner of collision prediction and avoidance of the sub-node's CSMA frame and TDMA frame, assuming that the minimum time required for the service frame is T total , and the guard interval between frames is T. The minimum interval T slot between beacon frames = T total + T. When the sub-node has a service frame to send, it is calculated whether the interval between beacon frames meets the sending condition, and if so, the data is sent, and if not, it is reported to the master node of the network, so that the master node prolongs the beacon period.
[0200] Since the update of the adjacent master node beacon frame of the sub-node can only be through the beacon frame in the same network, when the data frame is to be sent, some beacon frames in the adjacent master node information table have already been sent, and when the sub-node avoids, the sending time of the beacon in the table should be screened; the main steps are as shown in Figure 15 :
[0201] Step 6a, the sub-node has a data frame to send, exits from the sleep mode, and calls the data frame sending process;
[0202] Step 6b, the sub-node records the time when the sending is called currently, denoted as T1, and obtains the earliest beacon sending time T2 of the direct master node greater than T1 in the adjacent master node information table;
[0203] Step 6c, the sub-node calculates the interval T1 and T2 as T3;
[0204] Step 6d, the sub-node calculates whether the current data frame sending will collide with the beacon frame, if T3 < T total + T, i.e. the time interval does not meet the sending of the data frame, jump to step 6e; if T3 ≥ T total + T, jump to step 6g;
[0205] Step 6e, the master node sequentially calculates the interval T3 of the adjacent beacon of the direct master node in the adjacent master node information table, assuming that the adjacent beacon sending time is T4, T5, T4 < T5, and obtains the beacon transmission time T beaconT3 = T5 - T4 - T beacon If the beacon transmission time in the adjacent master node information table has been calculated, go to step 6f; if T3 < T total + T, that is, the time interval does not satisfy the transmission of the data frame, go to step 6h; if T3 ≥ T total + T, set the transmission time of the data frame as T4 + T beacon + T, and go to step 6g after the time is up.
[0206] Step 6f, calculate the interval between the latest beacon transmission time T6 in the adjacent master node information table and the end of the beacon period T end , and record it as T3, and obtain the latest beacon transmission time T beacon , that is, T3 = T end - T6 - T beacon . If T3 < T total + T, that is, the time interval does not satisfy the transmission of the data frame, go to step 6h; if T3 ≥ T total + T, set the transmission time of the data frame as T6 + T beacon + T, and go to step 6g after the time is up.
[0207] Step 6g, the master node detects whether the channel is idle, and if it is idle, directly transmits; if the channel is busy, randomly back off for a period of time, and then execute step 6g again.
[0208] Step 6h, feed back the result that there is not enough interval between the beacon frames to transmit the data frame to the master node, so that the master node adjusts the beacon period.
[0209] In this embodiment, the CSMA frame and TDMA frame conflict prediction and avoidance process of the network 1 sub-node is as follows:
[0210] Step 61, the network 1 sub-node has a data frame to be transmitted, and calls the data frame transmission process.
[0211] Step 62, the network 1 sub-node records the time when the current transmission is called as T1, and screens the beacon transmission time in the adjacent master node information table, and finds that the beacon transmission time of the network 2 master node is greater than T1, which meets the requirement.
[0212] Step 63, the network 1 sub-node calculates the interval between T1 and the beacon transmission time T2 of the network 2 master node as T3.
[0213] Step 64, through judgment, T2 < T total + T, that is, the interval is not enough to transmit the data frame.
[0214] Step 65, calculate the interval between T2 and the time T3 at the end of the beacon period, and obtain the network 2 beacon transmission time Tbeacon Then interval T4 = T3 - T2 - T beacon ;
[0215] Step 66, T4 > T total + T, the interval meets the requirement;
[0216] Step 67, set the data frame sending time to T2 + T beacon + T;
[0217] Step 68, the sending time arrives, and the channel is detected to be idle;
[0218] Step 69, the data frame is sent.
[0219] In the subsequent beacon period, the network 1 master node has stored the master node beacon information of the network 2 and the network 3, and whenever the network 1 master node receives the beacon frame of the network 2 master node, the beacon information of the network 2 and the network 3 is obtained from the beacon frame, and the beacon sending time in the adjacent master node information table is updated; then the execution step is:
[0220] (7) The network 1 master node updates the adjacent master node information table, and the main process is as shown in Figure 16 :
[0221] Step 7a, the master node receives the beacon frame of other master nodes, calculates the transmission time T7 according to the length of the beacon frame, and calculates the sending time T9 = T8 - T7 of the beacon frame according to the receiving time T8. Then the beacon frame is parsed to obtain the address of the master node and the beacon period T, and the next beacon sending time T 10 of the master node is calculated = T9 + T.
[0222] Step 7b, compare the master node address obtained in step 7a with the address stored in the adjacent master node information table, if the master node address has been saved, update the beacon sending time of the master node, and if the beacon period and the transmission time change through comparison with the adjacent master node information table, update. If the master node address is not saved, create a new space to save the master node address, transmission time T7, beacon sending time T 10 , beacon period T period obtained in step 7a in the adjacent master node information table, and mark it as a direct master node;
[0223] Step 7c, parse the beacon frame to obtain the information in the adjacent master node information table carried in the beacon frame, including the master node address, the beacon period T 11 , the sending time difference T 12 and the transmission time, and the beacon sending time T 13= T9+T 12 ;
[0224] Step 7d, compare the master node address obtained in step 7c with the address stored in the adjacent master node information table, if the master node address has been saved, update the beacon sending time of the master node, through comparison with the adjacent master node information table, if the beacon period and transmission time change, update; if the master node address is not saved, create a new space to save the master node address, transmission time, beacon sending time T 12 , beacon period obtained in step 7c in the adjacent master node information table, and mark it as an indirect master node. If all the master node information carried by the beacon frame is saved, jump to step 7e, otherwise jump to step 7c;
[0225] Step 7e, sort the node information in the adjacent node information table according to the beacon sending time in order.
[0226] In this embodiment, the network 1 master node updates the adjacent master node information table:
[0227] Step 71, the network 1 master node receives the network 2 master node beacon frame;
[0228] Step 72, calculate the transmission time T1 of the beacon frame according to the length of the beacon frame, and calculate the sending time T3 of the beacon frame according to the receiving time T2. Then parse the beacon frame to obtain the address of the network 2 master node and the beacon period T period , and calculate the next beacon sending time T4 of the network 2 master node T period ;
[0229] Step 73, parse the beacon frame of network 2 to obtain the information in the adjacent master node information table carried in the beacon frame, including the network 2 master node address, beacon period T5, sending time difference T6 and transmission time, according to the calculation, the sending time T7 of the master node in the adjacent master node information table can be obtained T7 = T3+T6;
[0230] Step 74, compare the obtained network 2 master node address with the address stored in the adjacent master node information table, find that the address already exists in the adjacent master node information table, so update the beacon sending time of the network 2 master node in the table. Then compare the obtained network 3 master node address with the address in the table, find that the address has been saved, so update the beacon sending time of the network 3 master node in the table.
[0231] Since the transmission time of beacon frame has left and right offset, it can cause the interval between beacon frames not to meet the requirement. In order to ensure the interval between beacon frames to meet the sum of the time of an uplink service frame and a downlink response frame and the guard interval time, the coordination between beacon frames is needed in the process of beacon transmission, and the minimum interval between beacon frames is T slot .
[0232] (8) The master node of network 1 performs coordination of subsequent TDMA frames, and the main process is as shown in Figure 17
[0233] Step 8a, in the subsequent beacon frame transmission process, the adjacent master node information table is checked before each transmission, the interval between the transmission time of itself and the end time of the previous beacon recorded in the table is calculated, and is recorded as T 6, If T6>T slot , no processing is made, and if T6<T slot , it jumps to step 8b;
[0234] Step 8b, the transmission of the beacon frame is adjusted, and it is assumed that the original transmission time is T7, the transmission time of the beacon frame is set as T7+(T slot -T6).
[0235] In the embodiment, the coordination process of the subsequent TDMA frame of the master node of network 1 is as follows:
[0236] Step 81, the master node of network 1 checks the adjacent master node information table before transmission, calculates the interval between the transmission time of itself and the end time of the beacon of the master node of network 2, and records it as T1. It is assumed that the sum of the time of an uplink service frame and a downlink response frame is T2, and the guard interval between the service frame and the beacon frame is T;
[0237] Step 82, T1<T slot is obtained by comparison, then the transmission time of the beacon frame of the master node of network 1 is adjusted, and it is assumed that the original transmission time is T3, the transmission time of the beacon frame of the master node of network 1 is set as T3+(T slot -T1).
[0238] (9) The master node of network 1 updates the adjacent master node information table, and the main process is as shown in Figure 18
[0239] Step 9a, the beacon frame of the network of itself is received, the master node address, the beacon transmission time T7, the beacon period T period , the beacon transmission time T8 is calculated according to the length of the beacon, and the beacon transmission time T9=T7+T period is calculated;
[0240] Step 9b, compare the obtained master node address with the address stored in the adjacent master node information table, if the master node address has been saved, update the beacon sending time of the master node, if the beacon period and the transmission time change, update them; if the master node address is not saved, create a new space to save the obtained master node address, transmission time T8, beacon sending time T9, and beacon period T period , in the adjacent master node information table;
[0241] Step 9c, obtain the information of the adjacent master node information table from the beacon frame, obtain the master node address, transmission time T 10 , beacon period T 11 , and the difference between beacons T 12 , and calculate the sending time T 13 of the beacon frame = T7+T 12 ;
[0242] Step 9d, compare the master node address obtained in step 9c with the address stored in the adjacent master node information table, if the master node address has been saved, update the beacon sending time of the master node, if the beacon period and the transmission time change, update them; if the master node address is not saved, create a new space to save the master node address obtained in step 9c, transmission time T 10 , beacon sending time T 13 , and beacon period T 11 , in the adjacent master node information table. If all the master node information carried by the beacon frame is saved, jump to step 9e, otherwise jump to step 9c;
[0243] Step 9e, sort the node information in the adjacent node information table according to the beacon sending time.
[0244] In this embodiment, the network 1 sub-node updates the adjacent master node information table:
[0245] Step 91, the network 1 sub-node receives the beacon frame of its own network, obtains the network 1 master node address, beacon sending time T1, and beacon period T period , calculates the beacon transmission time according to the beacon length, and calculates the next sending time T2 = T1+T period of the beacon;
[0246] Step 92, obtain the information of the adjacent master node information table from the beacon frame, obtain the network 2 master node address, transmission time, beacon period T3, and the difference between beacons T4, and calculate the sending time T5 = T1+T4 of the beacon frame, and calculate the next beacon sending time T6 = T5+T3;
[0247] Step 93, compare the obtained network 1 master node address with the addresses in the adjacent master node information table, find that the network 1 master node information already exists, update the time information of the network 1 master node;
[0248] Step 94, compare the obtained network 2 master node address with the addresses in the adjacent master node information table, find that the network 2 master node information already exists, update the time information of the network 2 master node.
[0249] Finally, it should be pointed out that the above embodiments are only used to illustrate the technical solutions of the present application and are not limiting. Although the present application has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that the technical solutions of the present application can be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions, which should be covered in the scope of the claims of the present application.
Claims
1. A method for collision prediction and avoidance of CSMA data and TDMA data in an asynchronous network, characterized by: The method comprises the following steps: The master node creates or updates the adjacent master node information table according to the received beacon frame of the other network; The master node coordinates the transmission of the initial beacon frame or the subsequent beacon frame between networks according to the adjacent master node information table; The master node adds the adjacent master node information table to the beacon frame, and assembles the beacon frame; The child node creates or updates the adjacent master node information table according to the received beacon frame; When the master node detects a data frame to be sent, the data frame is sent to other nodes in the manner of conflict prediction and avoidance of the CSMA frame and the TDMA frame of the master node, and the process of conflict prediction and avoidance of the CSMA frame and the TDMA frame of the master node is as follows: S511, the master node has a data frame to be sent, and calls the data frame sending process; S512, the master node records the time of the current call sending, denoted as ; S513, the master node calculates the interval T3 between T1 and the earliest direct master node beacon sending time T2 in the adjacent master node information table; S514, the master node calculates whether the current data frame transmission will collide with the beacon frame, if T3 total +T, that is, the time interval does not satisfy the data frame transmission, and jumps to S515; if T3 T total +T, jumps to S517; S515, the master node calculates the interval of the adjacent beacon sending time of the direct master node in the adjacent master node information table according to the sending time, denoted as T3, assuming that the two adjacent beacon sending times are T4 and T5, T4 < T5, the transmission time of T4 is obtained, denoted as T beacon , T3 = T5-T4-T beacon is calculated; if T3 < T total +T, that is, the time interval does not satisfy the sending of the data frame, jump to S515 to calculate the time interval of the next beacon frame; if T3 T total +T, the sending time of the data frame is set as T4+T beacon +T, and after the sending time arrives, jump to S517; if the beacon sending time in the adjacent master node information table has been calculated, jump to S516; S516, calculate the interval between the latest beacon sending time T6 in the adjacent master node information table and the end of the beacon period T end , recorded as T3, and obtain the transmission time of the latest beacon, recorded as T beacon ; T3 = T end -T6-T beacon ; if T3 < T total +T, the time interval does not satisfy the sending of the data frame, jump to S518; if T3 T total +T, set the sending time of the data frame as T6+T beacon +T, and jump to S517 after the sending time arrives; S517, the master node detects whether the channel is idle, and if the channel is idle, the data frame is directly sent, and if the channel is busy, the master node randomly backs off for a period of time and executes S517 again; S518, the master node adjusts the beacon period according to the result that the data frame is not sent between the beacon frames with sufficient intervals; When the child node detects a data frame to be sent, the data frame is sent to other nodes in the manner of conflict prediction and avoidance of the CSMA frame and the TDMA frame of the child node, and the process of conflict prediction and avoidance of the CSMA frame and the TDMA frame of the child node is as follows: S521, the child node has a data frame to be sent, exits from the sleep mode, and calls the data frame sending process; S522, the child node records the time of the current call sending, denoted as , obtaining the earliest beacon sending time T2 of the direct master node greater than T1 in the adjacent master node information table; S523, the child node calculates the interval T3 between T1 and T2; S524, the child node calculates whether the current data frame transmission will collide with the beacon frame, if T3 total +T, i.e. the time interval does not satisfy the data frame transmission, then jump to S525; if T3 T total +T, then jump to S527; S525, the child node calculates the interval of the direct master node adjacent beacon sending time in the adjacent master node information table according to the sending time in turn, and the interval is denoted as T3, assuming that the two adjacent beacon sending times are T4 and T5, T4 beacon , T3 = T5-T4-T beacon ; if T3 total +T, the time interval does not satisfy the sending of the data frame, then jump to S525 to calculate the time interval of the next beacon frame; if T3 T total +T, the sending time of the data frame is set as T4+T beacon +T, and jump to S527 after the sending time arrives; if the beacon sending times in the adjacent master node information table have all been calculated, then jump to S526; S526, calculate the interval between the latest beacon sending time T6 in the adjacent master node information table and the end of the beacon period T, recorded as T3, and obtain the transmission time of the latest beacon recorded as T end beacon end ; if T3 beacon total +T, then skip to S528; if T3 total +T, set the sending time of the data frame as T6+T beacon +T, and jump to S527 after the sending time arrives; S527, the child node detects whether the channel is idle, and if the channel is idle, the data frame is directly sent, and if the channel is busy, the child node randomly backs off for a period of time and executes S527 again; S528, the child node feeds back the result that the data frame is not sent between the beacon frames with sufficient intervals to the master node, and the master node adjusts the beacon period.
2. The method of claim 1, wherein: The process that the master node creates the adjacent master node information table is as follows: S111, the master node receives the beacon frame of other master node, calculates the transmission time T1 according to the length of the beacon frame, and calculates the sending time T3=T2-T1 of the beacon frame according to the receiving time T2; and parses the beacon frame to obtain the address of the master node and the beacon period T period , and calculates the next beacon sending time T4=T3+T period of the master node. S112, create a new space will get the master node address, transmission time T1, beacon time T4, beacon period T period Save in adjacent master node information table, and marked as direct master node; S113, the beacon frame is parsed to obtain the information in the adjacent master node information table carried in the beacon frame, the information in the adjacent master node information table includes the master node address, the beacon period, the transmission time difference value T5 and the transmission time, and the master node beacon sending time T6 in the adjacent master node information table is calculated as T6=T3+T5; S114, a new space is created to save the obtained master node address, transmission time, beacon sending time T6 and beacon period in the adjacent master node information table, and is marked as an indirect master node; if the master node information carried in the beacon frame is all saved, the process jumps to S115, otherwise, the process jumps to S113; S115, the node information in the adjacent node information table is sorted according to the beacon sending time.
3. The method of claim 1, wherein: The process that the master node updates the adjacent master node information table is as follows: S121, the master node receives the beacon frame of other master node, calculates the transmission time T7 according to the length of the beacon frame, and calculates the sending time T9=T8-T7 of the beacon frame according to the receiving time T8; and parses the beacon frame to obtain the address of the master node and the beacon period T period , and calculates the next beacon sending time T 10 =T9+T period of the master node. S122, compare the obtained master node address with the address stored in the adjacent master node information table, if the master node address has been saved, update the beacon sending time of the master node, if the beacon period and transmission time change, update; if the master node address is not saved, create a new space to obtain the master node address, transmission time T7, beacon sending time T 10 , beacon period T period saved in the adjacent master node information table, and marked as a direct master node; S123, parse the beacon frame to obtain information in the adjacent master node information table carried in the beacon frame, the information in the adjacent master node information table including master node address, beacon period T 11 , transmission time difference T 12 , and transmission time, according to the calculation, the master node beacon transmission time T 13 =T9+T 12 in the adjacent master node information table is obtained. S124, compare the obtained master node address with the address stored in the adjacent master node information table, if the master node address has been saved, update the beacon sending time of the master node, if the beacon period and transmission time change, update; if the master node address is not saved, create a new space to obtain the master node address, transmission time, beacon sending time T 12 , the beacon period is saved in the adjacent master node information table and is marked as an indirect master node; if all the master node information carried by the beacon frame is saved, jump to S125, otherwise jump to S123; S125, the node information in the adjacent node information table is sorted according to the beacon sending time.
4. The method of claim 1, wherein: The process that the master node coordinates the initial TDMA frame is as follows: S211, the master node calculates the beacon transmission time T1, according to the node information stored in the adjacent master node information table, calculates the interval of all adjacent beacon sending time and the interval between the last sent beacon frame in the adjacent master node information table and the end of the beacon period, compares the intervals calculated, and takes the maximum interval as T2; if T2<2*T slot +T1, the result is fed back to the master node, and the master node adjusts its beacon period; if T2>2*T slot +T1, then jump to S212; S212, two time intervals of T1 are designed as T4 and T5, T4 The process of the master node in step S2 to coordinate the subsequent TDMA frame is: S221, in the subsequent beacon frame sending process, check the adjacent master node information table before each sending, calculate the interval between the sending time of itself and the previous beacon sending time recorded in the table, recorded as T6; if T6>T slot , do not make any treatment, if T6 slot , jump to S222; S222, adjust the sending of the beacon frame, set the original sending time as T7, set the sending time of the beacon frame as T7+(T slot -T6).
5. The method of claim 1, wherein: The process of adding the adjacent master node information table to the beacon frame is: S31, the master node checks whether the adjacent master node information table has a direct master node; if empty, jump to S34, otherwise jump to step S32; S32, poll the next beacon frame sending time T1 of the direct master node recorded in the adjacent master node information table, get the beacon frame sending time T2 of itself, and calculate the difference T3=T1-T2; S33, add the time difference T3, node address, beacon period, transmission time to the beacon frame; if there are still direct master nodes in the table that have not been calculated, jump to S32, otherwise jump to S34; S34, assemble the beacon frame, and when the beacon frame sending time arrives, send the beacon frame.
6. The method of claim 1, wherein: The process of the sub-node creating the adjacent master node information table is: S411. Upon receiving a beacon frame from its own network, obtain the master node address, beacon transmission time T1, and beacon period T. period The beacon transmission time is calculated based on the beacon length, and the next beacon transmission time T2 = T1 + T is then calculated. period ; S412, create a new space to save the master node address, transmission time, next beacon sending time, and beacon period obtained in S411 in the adjacent master node information table; S413, obtain the information of the adjacent master node information table from the beacon frame to get the master node address, transmission time, beacon period T3, and the difference T4 between beacons, and calculate the sending time T5=T1+T4 of the beacon frame; S414, create a new space to save the master node address, transmission time, beacon sending time, and beacon period obtained in S412 in the adjacent master node information table; If the master node information carried by the beacon frame has been saved completely, jump to S415, otherwise jump to S413; S415, sort the node information in the adjacent node information table according to the beacon sending time.
7. The method of claim 1, wherein: The process of the sub-node updating the adjacent master node information table is: S421. Upon receiving a beacon frame from its own network, the system obtains the master node address, beacon transmission time T7, and beacon period T. period The beacon transmission time T8 is calculated based on the beacon length, and the beacon transmission time T9 is calculated as T7 + T. period ; S422, compare the master node address obtained in S421 with the address stored in the adjacent master node information table, if the master node address has been saved, update the beacon sending time of the master node, if the beacon period and transmission time change, update; if the master node address is not saved, create a new space to save the master node address, transmission time T8, beacon sending time T9 and beacon period T10 obtained in S421 in the adjacent master node information table; period . S423、acquire the information of the neighboring master node information table from the beacon frame, obtain the master node address, transmission time T 10 , beacon period T 11 , difference between beacons T 12 , and calculate the transmission time T 13 carrying the beacon frame = T7+T 12 ; S424, compare the master node address obtained in S423 with the address stored in the adjacent master node information table, if the master node address has been saved, update the beacon sending time of the master node, if the beacon period and transmission time change, update; if the master node address is not saved, create a new space to save the master node address and transmission time T 10 , beacon sending time T 13 , beacon period T 11 in the adjacent master node information table; If the master node information carried by the beacon frame has been saved completely, jump to S425, otherwise jump to S423; S425, sort the node information in the adjacent node information table according to the beacon sending time.
Citation Information
Patent Citations
Sending method for avoiding beacon frame collision in enhanced wireless local area network
CN104853375A
Segmented competitive beacon sending method based on wireless mesh network
CN112153747A