High-precision time synchronization method, system, device and medium for wireless environment
By using hardware timestamps and broadcast frame technology in wireless networks, the problem of wireless channel occupancy in multi-node environments of the FTM protocol is solved, achieving efficient and high-precision time synchronization, which is suitable for scenarios such as industrial control, wireless sensor networks and the Internet of Things.
Patent Information
- Application Number
- CN202411593183.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-08
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2044-11-08
AI Technical Summary
In wireless networks, FTM-based time synchronization schemes lead to increased wireless channel occupancy, reduced communication efficiency and data transmission rate when the number of nodes is large, failing to meet the high-precision time synchronization requirements of large-scale networks.
By combining hardware timestamp technology and broadcast frames with the IEEE 802.11 protocol, timestamp data is broadcast to all slave nodes through the AP, reducing the number of message exchanges, calculating link delay and clock skew, and achieving high-precision time synchronization.
It significantly reduces the number of messages required for time synchronization, improves communication efficiency and time synchronization accuracy, and shortens clock convergence time, making it suitable for scenarios such as industrial control, wireless sensor networks, and the Internet of Things.
Smart Images

Figure CN119521368B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of wireless communication technology, and in particular to a high-precision time synchronization method, system, device, and medium for wireless environments. Background Technology
[0002] With the increasing demands for time synchronization accuracy in specific fields such as finance, industrial automation, and the military, the accuracy of Network Time Protocol (NTP), which typically only reaches the millisecond level, can no longer meet the high-precision requirements of these fields. Therefore, the Precision Time Protocol (PTP) was proposed to provide nanosecond-level synchronization accuracy for devices in the network, and it is standardized by the IEEE 1588 standard. Furthermore, the IEEE 802.1AS standard further optimizes PTP, particularly for wireless network environments, proposing a time synchronization scheme based on the Fine Time Measurement (FTM) technology in the IEEE 802.11-2016 standard. IEEE 802.1AS-2020, based on the FTM technology proposed in the IEEE 802.11-2016 standard, standardizes the time synchronization protocol in wireless networks and releases a time synchronization scheme based on the FTM protocol for node location in IEEE 802.11 wireless networks. This technology uses measurement frames to calculate transmission delay and uses this to correct the local clock, improving time synchronization accuracy. After sending a delay measurement request, the STA exchanges measurement messages with the responding node and calculates the link delay using the message sending and receiving timestamps, thereby improving time synchronization accuracy. Furthermore, multiple measurements can be taken and the average value calculated to reduce the impact of random errors on time synchronization accuracy.
[0003] The aforementioned FTM-based time synchronization scheme achieves one-to-one high-precision time synchronization from the clock to the master clock. However, when there are a large number of nodes in the network, the master node needs to establish synchronization relationships with each slave node one by one. This results in a large number of time synchronization request messages, affecting the network's communication efficiency and data transmission rate. It is not suitable for large-scale network deployments where a large number of slave nodes need to be synchronized. Summary of the Invention
[0004] This invention provides a high-precision time synchronization method, system, device, and medium for wireless environments, which solves the problem of reduced communication efficiency and data transmission rate caused by wireless channel occupancy in FTM-based time synchronization schemes in large network environments.
[0005] To achieve the above objectives, this application adopts the following technical solution:
[0006] Firstly, a high-precision time synchronization method for wireless environments is provided, comprising:
[0007] The slave node searches for and connects to the AP, sends a Sync_Request message to the AP to request to join the time synchronization domain; the AP responds with an ACK message to confirm, and the slave node joins the time synchronization domain;
[0008] The slave node sends an FTM_Request delay measurement request message to the AP, and at the same time uses hardware timestamp technology to record the message sending time t1 and records the corresponding timestamp on the slave node;
[0009] The AP receives the FTM_Request delay measurement request message and uses hardware timestamp technology to obtain the time t2 when the message is received, marks the timestamp with the message ID and updates it in memory;
[0010] The AP loads the timestamp data in its memory into a broadcast frame and periodically broadcasts the frame to all STAs in the BSS. At the same time, the AP obtains the time t3 when the broadcast frame is sent and sends it along with the broadcast frame.
[0011] The slave node, which is in the same time synchronization domain as the AP, receives the broadcast frame, records the reception time t4, and obtains the delivery time t2 corresponding to the delay measurement request message ID sent by itself from the broadcast frame;
[0012] Based on timestamp data t1, t2, t3, and t4, the link delay and clock offset between the AP and the slave node are calculated, and the adjacent rate ratio is calculated to correct the time synchronization error.
[0013] In a first possible implementation of the first aspect, the FTM_Request delay measurement request message consists of a header field and a message ID.
[0014] In a second possible implementation of the first aspect, the broadcast frame carries the current master clock timestamp and timestamp data of all delay measurement messages sent by slave nodes;
[0015] The broadcast frame includes a timestamp field and a timestamp data table field, and the required timestamp information can be obtained by querying the fields.
[0016] The timestamp field is the master clock time when the broadcast message is sent from the AP's sending port, used for time synchronization with slave nodes and for link delay measurement; the timestamp data table field contains the frame ID information of the delay measurement request frames sent by each slave node and the corresponding timestamp data of their arrival at the AP, which are recorded in the master node's memory.
[0017] In a third possible implementation of the first aspect, the hardware timestamp technology includes:
[0018] The MLME is used to obtain and record the timestamp of message transmission at the MAC layer; the MLME is a MAC layer management entity.
[0019] Each time a message arrives at and leaves the MAC layer, the MLME records the timestamp and returns the data to the upper layer.
[0020] Based on the third possible implementation of the first aspect, in the fourth possible implementation of the first aspect, at a certain moment, the clocks of AP and slave node are respectively T AP T STA ,
[0021] The expression for the link delay and clock offset between the slave node and the master clock is as follows:
[0022]
[0023] The corrected local clock of the slave node is:
[0024] T′=T STA -t offset .
[0025] Based on the fourth possible implementation of the first aspect, in the fifth possible implementation of the first aspect, the adjacent rate ratio is calculated to correct the time synchronization error, including:
[0026] Taking the transmission time t1, t3 of a certain message and the transmission time t'1, t'3 of the previous round, the adjacent rate ratio between the AP and the slave node is calculated as follows:
[0027]
[0028] The corrected link delay is:
[0029] t delay =[(t4-t1)+neighborRateRatio×(t2-t3)] / 2
[0030] The corrected clock offset value is:
[0031] t' offset =[-t1+neighborRateRatio×(t2-t3)+2t3-t4] / 2
[0032] The corrected local clock of the slave node is:
[0033] T′=T STA -t′ offset .
[0034] Secondly, a high-precision time synchronization system for wireless environments is provided, comprising:
[0035] The network connection management module is used to search for and connect to the AP from the slave node, send a Sync_Request message to the AP to request to join the time synchronization domain; the AP responds with an ACK message to confirm, and the slave node joins the time synchronization domain;
[0036] The delay measurement request module is used to send an FTM_Request delay measurement request message from the slave node to the AP, and at the same time, use hardware timestamp technology to record the message sending time t1 and record the corresponding timestamp on the slave node;
[0037] The timestamp processing and recording module is used for the AP to receive the FTM_Request delay measurement request message and use hardware timestamp technology to obtain the time t2 of receiving the message, mark the timestamp with the message ID and update it in memory;
[0038] The broadcast frame construction and transmission module is used by the AP to load the timestamp data in its memory into a broadcast frame and periodically broadcast the frame to all STAs in the BSS. At the same time, the AP obtains the time t3 of the broadcast frame transmission and sends it along with the broadcast frame.
[0039] The timestamp parsing module is used to record the reception time t4 when the slave node, which is in the same time synchronization domain as the AP, receives the broadcast frame, and obtains the delivery time t2 corresponding to the delay measurement request message ID sent by itself from the broadcast frame.
[0040] The synchronization calculation and error correction module is used to calculate the link delay and clock offset between the AP and the slave node based on timestamp data t1, t2, t3, and t4, and to calculate the adjacent rate ratio to correct the time synchronization error.
[0041] In a first possible implementation of the second aspect, the FTM_Request delay measurement request message consists of a header field and a message ID.
[0042] Thirdly, an electronic device is provided, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the high-precision time synchronization method for a wireless environment as described in the first aspect.
[0043] Fourthly, a readable storage medium is provided, on which a program or instructions are stored, which, when executed by a processor, implement the steps of the high-precision time synchronization method for a wireless environment as described in the first aspect.
[0044] This application measures the propagation delay between the AP and STA by sending delay measurement messages, accurately estimates the master-slave clock error based on the propagation delay, and then corrects the slave clock, achieving high-precision time synchronization between master and slave nodes. This significantly enhances the overall performance and reliability of the wireless network. Compared to broadcast time synchronization techniques, this application offers higher time synchronization accuracy. Compared to time synchronization methods based on the FTM protocol proposed in related technologies, this application significantly reduces the number of messages required for time synchronization and shortens the time required for clock convergence. Simultaneously, this application improves communication efficiency by reducing channel occupancy. This method achieves better results when the number of slave nodes is large. Attached Figure Description
[0045] Figure 1 A schematic flowchart illustrating a wireless time synchronization method based on an IEEE 802.11 link as defined in IEEE 802.1AS-2020, provided for embodiments of this application;
[0046] Figure 2 This application provides a schematic diagram of a two-layer single-AP wireless network structure.
[0047] Figure 3 A schematic flowchart illustrating high-precision time synchronization in a wireless environment, provided as an embodiment of this application;
[0048] Figure 4 A schematic flowchart illustrating message exchange between master and slave nodes provided for embodiments of this application;
[0049] Figure 5 A schematic flowchart illustrating the process of obtaining a hardware timestamp using the MAC layer in IEEE 802.11-2016, provided for an embodiment of this application;
[0050] Figure 6 A structural block diagram of a high-precision time synchronization system for a wireless environment provided in an embodiment of this application;
[0051] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0052] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the technical solutions in the embodiments of this application are clearly described. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art are within the scope of protection of this application.
[0053] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0054] The steps described in the specification and the flowcharts in the accompanying drawings of this invention are not necessarily strictly executed according to the step numbers; the execution order of the method steps can be changed. Furthermore, certain steps can be omitted, multiple steps can be combined into one step, and / or one step can be broken down into multiple steps.
[0055] The following detailed description, in conjunction with the accompanying drawings and preferred embodiments, describes the high-precision time synchronization method, system, device, and medium for wireless environments provided in this application.
[0056] First, the application scenarios of the high-precision time synchronization method for wireless environments in the embodiments of this application will be described in detail.
[0057] Currently, the Network Time Protocol (NTP) is widely used for network time synchronization. Computers in the network calculate and adjust their time by sending and receiving data packets containing timestamps. This protocol is an application layer protocol in the TCP / IP protocol suite, employing a layered structure. It uses a reliable clock source to provide accurate clocks, and each layer of devices can synchronize to a clock source at a higher layer than itself. NTP can provide millisecond-level time synchronization accuracy, meeting the needs of most network applications. However, with the increasing demands for Quality of Service (QoS) in network services, NTP can no longer meet the time synchronization accuracy requirements of some scenarios, such as finance, industry, and the military.
[0058] In the time synchronization method based on the PTP protocol, the nodes in the network need to run the Best Master Clock Algorithm (BMCA) to select the node with the highest clock quality as the master clock. All nodes in the same time synchronization domain will synchronize their local clocks to that clock.
[0059] FTM (Frequency Time Measurement) technology allows stations (STAs) in a wireless network to accurately measure their round-trip time (RTT) with other STAs. It achieves STA trajectory tracking by periodically transmitting FTM measurement frames to receive changes in the relative position of the STA with other STAs in the network. This protocol operates at the MAC layer, using hardware timestamping to obtain the transmission and reception timestamps of data frames. The timestamp is carried in the messages sent during the next measurement. By measuring the transmission delay between STAs, the distance between stations is estimated, and their relative positions are calculated. Building upon this, the IEEE 802.1AS-2020 standard, for wireless networks based on IEEE 802.11 links, also uses measurement frames to calculate transmission delay and uses this to correct the local clock, improving time synchronization accuracy. For details, see [link to IEEE 802.1AS-2020 standard]. Figure 1 According to the wireless time synchronization scheme for IEEE 802.11 links defined in IEEE 802.1AS-2020, the delay measurement process between two nodes includes the following steps:
[0060] 1. The initial node sends an FTM initialization message to the response node. After receiving the initialization message, the response node replies with an ACK message to the initial node.
[0061] 2. The responding node sends an FTM message to the initial node and records the message sending time t1_1.
[0062] 3. After receiving the message, the initial node records the reception time t2_1 and replies with an ACK message to the responding node, while also recording the transmission time t3_1.
[0063] 4. After receiving the ACK message, the responding node records the message reception time t4_1;
[0064] 5. Repeat step 2, and include the timestamps t1_1 and t4_1 of the last measurement message sent in subsequent FTM messages.
[0065] After obtaining the transmission delay using the above methods, the local clock of the slave node can be corrected.
[0066] In the FTM protocol, the time window allocated to an FTM session is unique. Within an FTM session, a STA cannot respond to FTM messages from other STAs. Therefore, during wireless network synchronization, the master node can only respond to time synchronization requests from a single slave node at a time. In the time synchronization methods used in the background technology, the master clock needs to establish synchronization relationships with each slave clock and send measurement messages to calculate propagation delays to establish network-wide time synchronization. Therefore, while the wireless time synchronization scheme for IEEE 802.11 links can meet the need for high-precision wireless time synchronization, as the number of wireless nodes in the network increases, slave nodes need to sequentially send FTM messages to the master node for time synchronization. Concurrent requests from multiple nodes consume a significant amount of time originally intended for data transmission, leading to a decrease in communication speed. Furthermore, the time synchronization method where slave nodes and master nodes sequentially estimate delays is inefficient, resulting in slow network-wide time synchronization and high communication overhead, making it unsuitable for situations where a large number of slave nodes need synchronization.
[0067] To address the aforementioned issues, in many wireless network environments, such as wireless sensor networks, wireless end nodes, acting as the network's terminal branches, only need to be coordinated by the access point (AP) to synchronize their local clocks to the AP's clock. Therefore, in these networks, the AP can be directly configured as the master node without needing to run BMCA (Bulletin Board Control Array). This configuration method simplifies the synchronization process and improves synchronization efficiency.
[0068] Based on this, this application proposes a high-precision wireless time synchronization protocol based on broadcast and FTM protocols for wireless LANs with a single AP structure, such as industrial control networks, wireless sensor networks, and IoT environments. These types of services have higher QoS requirements for network communication and need to provide more accurate time synchronization. Furthermore, a large number of terminal nodes in these networks need to synchronize with the central AP. Therefore, this protocol uses hardware timestamps to improve timestamp quality, calculates link delay by measuring messages to correct clock errors, and reduces the number of messages required for time synchronization through broadcast technology, thereby achieving efficient and high-precision wireless time synchronization.
[0069] Specifically, in wireless communication, since all communication devices share the transmission medium, it is essential to minimize wireless channel occupancy to reduce communication overhead and improve communication efficiency. Therefore, addressing the issue of a surge in time synchronization request messages caused by multiple network nodes synchronizing when the number of nodes in the network increases, this application proposes introducing broadcast technology into the wireless time synchronization protocol. It utilizes the existing management frames in the IEEE 802.11 protocol to carry timestamp information, fully leveraging their functionality to improve the communication efficiency of the wireless time synchronization protocol, reduce wireless channel occupancy, enhance time synchronization efficiency, and reduce the time required to establish network-wide clock synchronization.
[0070] Meanwhile, to achieve accurate transmission of delay measurement messages and higher precision wireless time synchronization, this application also proposes using Time Sensitive Network (TSN) technology from the IEEE 802.1 standard to improve the QoS of wireless communication and enhance time synchronization accuracy. TSN technology is a set of network protocol standards defined by the IEEE 802.1 standard, which can achieve deterministic minimum latency in non-deterministic Ethernet. This protocol family provides a general time-sensitive mechanism for the data link layer of the Ethernet protocol to ensure real-time, deterministic, and reliable data transmission, improve data transmission efficiency, and provide determinism and reliability to the network. For real-time communication, end-to-end transmission delay has time limits that are difficult to negotiate; therefore, the clock plays a crucial role in TSN. All devices in TSN need to have a common time reference model, thus creating a requirement for high-precision time synchronization between nodes. Furthermore, Time Sensitive Network can set the priority of network messages to ensure reliable transmission of critical data. By dividing time slots and assigning higher priorities to time synchronization messages, the transmission reliability of time synchronization messages can be improved, ensuring the normal operation of the time synchronization function. This application can provide the necessary time synchronization function for wireless TSN, and at the same time ensure the priority transmission of delay measurement frames in the network through wireless TSN technology, thereby improving the accuracy and reliability of wireless time synchronization.
[0071] Please see Figure 2 This application applies to single-AP wireless networks with a Layer 2 architecture, such as... Figure 2 As shown, the network is based on the IEEE 802.11 protocol and includes one AP and several STAs. All STAs are within the hotspot coverage of the router and connect to the AP via wireless links to establish wireless network connections. In this environment, the router and the terminals constitute a Basic Service Set (BSS).
[0072] In this environment, all network terminals and switching devices support network protocols defined in TSN, such as IEEE 802.1Qav, IEEE 802.1Qbv, and IEEE 802.1Qbu. These devices, when networked together, form a wireless TSN system and can use priority ordering and frame preemption mechanisms provided in the TSN standard to ensure priority transmission of packets involved in time synchronization technology. In this network, all nodes reside in the same time synchronization domain, with the router acting as the master clock and the terminals acting as slave clocks, employing the wireless precise time synchronization technology proposed in this invention to achieve precise time synchronization with the master clock.
[0073] The time synchronization protocol scheme of this application is described in detail below:
[0074] Please see Figure 3-4 This application provides a high-precision time synchronization method for wireless environments, such as... Figure 3-4 As shown, the time synchronization method in this application embodiment includes the following steps:
[0075] Step S1: The slave node searches for and connects to the AP, and sends a Sync_Request message to the AP to request to join the time synchronization domain; the AP responds with an ACK message to confirm, and the slave node joins the time synchronization domain.
[0076] The slave node searches for wireless network signals, establishes a wireless network link with the AP, and sends a Sync_Request message to the AP to request to join the time synchronization domain. After receiving the time synchronization request from the slave node, the AP replies with an ACK message to the slave node, and the slave node joins the time synchronization domain.
[0077] Step S2: The slave node sends an FTM_Request delay measurement request message to the AP, and at the same time uses hardware timestamp technology to record the message sending time t1 and records the corresponding timestamp in the slave node.
[0078] After receiving the ACK message and joining the time synchronization domain, the slave node sends a delay measurement request message FTM_Request to the AP. At the same time, it uses hardware timestamp technology to capture the high-precision timestamp t1 sent from the sending port and records the timestamp in the slave node.
[0079] Step S3: The AP receives the FTM_Request delay measurement request message and uses hardware timestamp technology to obtain the time t2 when the message was received. The AP marks the timestamp with the message ID and updates it in memory.
[0080] After receiving the delay measurement request message FTM_Request from the slave node, the AP also uses hardware timestamp technology to obtain the timestamp t2 of receiving the delay measurement request message, and marks the timestamp using the message ID carried in the message. Then the AP updates the data table in its memory and records the marked timestamp data in the AP's memory.
[0081] In step S4, the AP loads the timestamp data in its memory into a broadcast frame and periodically broadcasts the frame to all STAs in the BSS. At the same time, the AP obtains the time t3 when the broadcast frame is sent and sends it along with the broadcast frame.
[0082] The AP loads the timestamp data recorded in its memory into the broadcast frame of the Beacon message and periodically broadcasts the frame to all STAs in the BSS. All slave nodes under this wireless network will receive the broadcast frame from the AP. At the same time, the AP obtains the time t3 of this broadcast frame transmission, records it in the broadcast frame and sends it with the frame.
[0083] Step S5: The slave node in the same time synchronization domain as the AP receives the broadcast frame, records the reception time t4, and obtains the delivery time t2 corresponding to the delay measurement request message ID sent by itself from the broadcast frame.
[0084] After receiving a broadcast frame sent by the AP, the slave node in the same time synchronization domain as the AP obtains and records the timestamp t4 of receiving the broadcast frame, and at the same time finds the delivery timestamp t2 in the timestamp data carried by the broadcast frame that corresponds to the delay measurement request message ID sent by itself.
[0085] Step S6: Based on timestamp data t1, t2, t3, t4, calculate the link delay and clock offset between the AP and the slave node, and calculate the adjacent rate ratio to correct the time synchronization error.
[0086] Based on the above four sets of timestamp data, the link delay and clock offset between the AP and the slave node are calculated, and the adjacent rate ratio is calculated to correct the time synchronization error, so as to achieve high-precision time synchronization.
[0087] This application employs a one-step method for link delay measurement, where the timestamp data of the message transmission time is sent along with the message. Compared to the two-step method, the one-step method significantly reduces the time required for link delay measurement. Specifically, the AP allocates appropriate time slots for delay measurement messages based on the gating mechanism provided by IEEE 802.1Qbv in the TSN standard, and records the gate opening time in the message in advance as the transmission timestamp. When the gate time is reached, the node sends the delay measurement message with the timestamp. This method avoids the shortcomings of the two-step method used in the original IEEE 802.1AS and FTM protocols for transmitting transmission timestamps, thus improving time synchronization efficiency.
[0088] To meet the requirements of high-precision time synchronization, this application adopts a 96-bit high-precision timestamp defined by the IEEE 1588v2 standard. The timestamp message defined by this standard uses 96 bits to store time information, which has higher precision than a 64-bit timestamp, reaching the nanosecond level. According to the IEEE standard, the timestamp consists of three fields with lengths of 48 bits, 32 bits, and 16 bits respectively. Bits [95:48] represent seconds, Bits [47:16] represent nanoseconds, and Bits [15:0] represent the decimal part of the nanosecond.
[0089] In some possible implementations, the FTM_Request delay measurement request message consists of a header field and a message ID.
[0090] The delay measurement request message involved in step 2 is described as follows:
[0091] The link delay measurement technology used in this application is based on the IEEE 802.11 FTM protocol. Therefore, this application modifies the delay measurement request message based on the delay measurement request message specified by this protocol. Since the AP acts as the master clock in this application, and all data processing is completed on the slave node, the delay measurement request message does not need to carry timestamp information; it only needs to send the request to the master node. Besides the header fields of the WiFi protocol, this message only needs to contain a message ID for the AP and slave nodes to identify the message. Compared to the FTM message, the delay measurement request message used in this application omits the timestamp information for sending and receiving, simplifying the message structure and saving communication overhead in the time synchronization process.
[0092] In some possible implementations, hardware timestamp technologies include:
[0093] The MLME is used to obtain and record the timestamp of message transmission at the MAC layer; the MLME is the management entity of the MAC layer.
[0094] Each time a message arrives at and leaves the MAC layer, the MLME records the timestamp and returns the data to the upper layer.
[0095] The hardware timestamp technology involved in step 3 is explained as follows:
[0096] The specific method employed in this application utilizes a MAC Sublayer Management Entity (MLME) to obtain and record the timestamp of message transmission at the MAC layer, and provides the timestamp information using service primitives defined in the IEEE 802.11 FTM protocol. Its specific operation is as follows: Figure 5 As shown in Table 1, three sets of service primitives are defined in IEEE 802.11-2016.
[0097]
[0098] Table 1. Service primitives of the FTM protocol defined in IEEE 802.11-2016
[0099] Each time a message arrives at and leaves the MAC layer, the MLME records a timestamp and returns the data to the upper layer. Since the FTM protocol operates at the MAC layer, it can obtain the hardware timestamp. This method avoids the random errors introduced by messages passing through multiple protocol stacks, and it has better accuracy than software timestamps.
[0100] In some possible implementations, the broadcast frame carries the current master clock timestamp and timestamp data of all delay measurement messages sent by slave nodes;
[0101] The broadcast frame includes a timestamp field and a timestamp data table field. The required timestamp information can be obtained by querying the fields.
[0102] The timestamp field is the master clock time when the broadcast message is sent from the AP's sending port, used for time synchronization with slave nodes and for link delay measurement; the timestamp data table field contains the frame ID information of the delay measurement request frames sent by each slave node and the corresponding timestamp data of their arrival at the AP, which are recorded in the master node's memory.
[0103] Specifically, the broadcast frames involved in step 4 are explained as follows:
[0104] This broadcast frame is a modified version of the Beacon frame defined in the IEEE 802.11 standard. The Beacon frame is a management frame subtype defined in the IEEE 802.11 standard, broadcast periodically by the AP. This management frame carries information such as the service set identifier, network mode, and timestamp, and is periodically sent by the AP at regular intervals to announce the existence of the wireless network and provide relevant information. It plays a crucial role in maintaining communication between the AP and STA.
[0105] The rewritten broadcast frame body carries the current master clock timestamp and the timestamp data of all delay measurement messages sent by slave nodes. The broadcast frame body includes a timestamp field, which is the master clock time when the broadcast message was sent from the AP's transmitting port, and can be used for time synchronization with slave nodes and for link delay measurement. The beacon frame used in this application adds a timestamp data table field to the body. This field contains the frame ID information of the delay measurement request frames sent by each slave node and the corresponding timestamp data of their arrival at the AP, recorded in the master node's memory. STAs supporting the wireless time synchronization protocol proposed in this application can query this field to obtain the required timestamp information after receiving a broadcast frame from the AP.
[0106] The link delay calculation method and clock synchronization method involved in step 6 are explained below:
[0107] At a certain moment, the clocks of AP and slave node are T respectively.AP T STA The clock offset between the AP and the slave node is t. offset T STA =T AP +t offset In a single delay measurement, the path transmission delay from the AP to the slave node is t. MS The path transmission delay from the node to the AP is t. SM After obtaining the four timestamps captured during the synchronization process from the node, they can be represented as:
[0108]
[0109] Because this technology uses hardware timestamps to capture the transmission and arrival times of measurement messages at the MAC layer via MLME, and because the transmission interval between delayed measurement messages and broadcast frames is extremely short (milliseconds) during time synchronization, the uplink and downlink transmission delays of the messages can be considered approximately equal, i.e., t MS =t SM Based on the above formula, the link delay for message transmission between the AP and the slave node can be calculated, and the clock offset of the slave node can be obtained. The specific expression is as follows:
[0110]
[0111] After calculating the link delay and clock offset between the slave node and the master clock, the slave node can correct the time base.
[0112] The local clock correction method involved in step 6 is explained as follows:
[0113] Since this application can directly estimate and calculate the clock offset t offset Therefore, after measuring the clock offset between the slave node and the master clock, the local clock is corrected by adding the offset value to achieve high-precision time synchronization in a wireless network environment. The corrected local clock of the slave node is:
[0114] T′=T STA -t offset
[0115] The error correction calculation method involved in step 6 is explained as follows:
[0116] During time synchronization, due to the hardware differences between the AP and STA, the clock frequencies of the master clock and slave clock differ, and their periods are not perfectly matched, leading to clock drift. To reduce the impact of clock drift on time synchronization accuracy, the clock frequency of the slave clock needs to be corrected. Specifically, this is done by calculating the adjacent rate ratio between the master clock and slave clock using the clock deviation values obtained from two consecutive measurements, and then correcting the time synchronization error of the slave clock accordingly.
[0117] Since the AP and slave nodes send Beacon frames and delay measurement request frames at constant rates respectively, the time interval between each transmission should theoretically be equal. Therefore, by taking the transmission time t1,t3 of a certain message and the transmission time t'1,t'3 of the previous round, the adjacent rate ratio between the AP and the slave node can be calculated as follows:
[0118]
[0119] After correction, the new link delay can be calculated as follows:
[0120] t delay =[(t4-t1)+neighborRateRatio×(t2-t3)] / 2
[0121] The corrected clock offset value is:
[0122] t' offset =[-t1+neighborRateRatio×(t2-t3)+2t3-t4] / 2
[0123] Based on the above steps, and considering the errors caused by link delay and clock skew, high-precision time synchronization between the slave and master nodes can be achieved. The corrected local clock of the slave node is:
[0124] T′=T STA -t′ offset .
[0125] Based on the above technical solution, this application measures the propagation delay between the AP and STA by sending delay measurement messages, accurately estimates the master-slave clock error based on the propagation delay, and then corrects the slave clock, achieving high-precision time synchronization between master and slave nodes. This significantly enhances the overall performance and reliability of the wireless network. First, this method effectively reduces delay errors in time synchronization, ensuring high-precision synchronization of clocks across all network nodes, thereby improving data transmission accuracy. Second, accurate time synchronization is crucial for real-time applications, supporting the efficient operation of critical tasks such as industrial automation, intelligent transportation, and video surveillance. Furthermore, the improved time synchronization accuracy can also be used to implement deterministic wireless networks, reducing packet loss rate and retransmission frequency, thereby optimizing bandwidth utilization and increasing network throughput.
[0126] The technical solution proposed in this application employs a broadcast method to send timestamp information to all nodes in the same synchronization domain via Beacon frames. By broadcasting delay measurement request messages to all STAs at once, the number of interactions between nodes and the number of data frames required to be sent are reduced, wireless channel occupancy is decreased, clock convergence is accelerated, and the overall network time synchronization efficiency is significantly improved. Furthermore, this method can be widely applied to different types of wireless networks, adapting to various application scenarios and possessing strong flexibility. Compared to network devices using methods such as satellite time synchronization, wireless networks using the IEEE 802.11 FTM protocol for time synchronization do not require additional hardware for nodes to receive satellite signals, reducing the overall system construction and maintenance costs.
[0127] In a wireless network, consider a BSS containing one AP and n slave nodes. When the BSS performs time synchronization, all slave nodes need to sequentially initiate delay measurement requests to the master clock. For wireless networks using the prior art, at least 2^n messages need to be sent in each round of measurement to enable all nodes to complete one delay measurement. However, for the wireless network using the scheme proposed in this application, since the broadcast frame simultaneously functions as a Beacon frame and a data frame, only a single message needs to be sent to send the timestamp to all slave nodes in the BSS. Furthermore, regardless of whether time synchronization is performed, the AP needs to broadcast the Beacon frame, so only n messages are actually needed for time synchronization. Compared to the prior art, the number of messages required for time synchronization in this application is significantly reduced, only 50% of the number of messages required by the prior art.
[0128] Assume that during the time synchronization process, the time required for each node to process and send a single data frame is t. trans In this BSS, when using related techniques for time synchronization, without considering guard intervals and waiting times, the time required for each round of delay measurement is 2nt.trans When using this application for time synchronization, the number of messages to be sent is significantly reduced, and the communication time is also significantly reduced to (n+1)t. trans In comparison, the time required for each round of delay measurement using this application is reduced by (n-1)t. trans The clock convergence speed is significantly improved, and the efficiency improvement becomes even more pronounced as the number of slave nodes in the network increases. Furthermore, by reducing the number of transmitted messages, this application significantly reduces the time that management frames occupy the wireless channel, thereby improving the communication efficiency of the wireless network.
[0129] In summary, the high-precision time synchronization technology for wireless networks proposed in this application enables high-precision time synchronization of wireless networks, improves their stability, and provides more reliable technical support for complex application scenarios. Compared to broadcast time synchronization techniques, this application offers higher time synchronization accuracy. Compared to time synchronization methods based on the FTM protocol proposed in related technologies, this application significantly reduces the number of messages required for time synchronization and shortens the time required for clock convergence. Simultaneously, this application improves communication efficiency by reducing channel occupancy. This method achieves better results when the number of slave nodes is large.
[0130] See Figure 6 Corresponding to the above embodiments of high-precision time synchronization methods for wireless environments, this application provides a high-precision time synchronization system for wireless environments, the time synchronization system comprising:
[0131] Network connection management module 1001 is used to search for and connect to the AP from a slave node, send a Sync_Request message to the AP to request to join the time synchronization domain; the AP responds with an ACK message to confirm, and the slave node joins the time synchronization domain;
[0132] The delay measurement request module 1002 is used to send an FTM_Request delay measurement request message from the slave node to the AP, and at the same time, it uses hardware timestamp technology to record the message sending time t1 and records the corresponding timestamp in the slave node.
[0133] The timestamp processing and recording module 1003 is used for the AP to receive the FTM_Request delay measurement request message and obtain the time t2 of receiving the message using hardware timestamp technology, mark the timestamp with the message ID and update it in memory;
[0134] The broadcast frame construction and transmission module 1004 is used for the AP to load the timestamp data in its memory into a broadcast frame and periodically broadcast the frame to all STAs in the BSS. At the same time, the AP obtains the time t3 of the broadcast frame transmission and sends it along with the broadcast frame.
[0135] The timestamp parsing module 1005 is used to record the reception time t4 when the slave node, which is in the same time synchronization domain as the AP, receives the broadcast frame, and obtains the delivery time t2 corresponding to the delay measurement request message ID sent by itself from the broadcast frame.
[0136] The synchronization calculation and error correction module 1006 is used to calculate the link delay and clock offset between the AP and the slave node based on timestamp data t1, t2, t3, and t4, and to calculate the adjacent rate ratio to correct the time synchronization error.
[0137] Furthermore, the FTM_Request delay measurement request message consists of a header field and a message ID.
[0138] The high-precision time synchronization system for wireless environments described above implements the steps and processes of the embodiments of the high-precision time synchronization method for wireless environments described above, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0139] See Figure 7 Corresponding to the above embodiments of the high-precision time synchronization method for wireless environments, this application provides an electronic device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the steps and processes of the above embodiments of the high-precision time synchronization method for wireless environments and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0140] The memory 1009 can be used to store software programs and various data. The memory 1009 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback function, image playback function, etc.). Furthermore, the memory 1009 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 1009 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.
[0141] The processor 1010 may include one or more processing units; optionally, the processor 1010 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into the processor 1010.
[0142] Corresponding to the above embodiments of the high-precision time synchronization method for wireless environments, this application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the steps and processes of the above embodiments of the high-precision time synchronization method for wireless environments, and achieve the same technical effect. To avoid repetition, these will not be described again here.
[0143] The processor is the processor in the electronic device described in the above embodiments of this application. The readable storage medium includes a computer-readable storage medium, such as a computer read-only memory (ROM), random access memory (RAM), a magnetic disk, or an optical disk.
[0144] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0145] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0146] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A high-precision time synchronization method for wireless environments, characterized in that, include: The node searches for and connects to the AP, and sends a Sync_Request message to the AP to request to join the time synchronization domain; The AP responds with an ACK message to confirm, and the slave node joins the time synchronization domain; The slave node sends an FTM_Request delay measurement request message to the AP, and at the same time uses hardware timestamp technology to record the message sending time t1 and records the corresponding timestamp on the slave node; The AP receives the FTM_Request delay measurement request message and uses hardware timestamp technology to obtain the time t2 when the message is received, marks the timestamp with the message ID and updates it in memory; The AP loads the timestamp data in its memory into a broadcast frame and periodically broadcasts the broadcast frame to all STAs in the BSS. At the same time, the AP obtains the time t3 when the broadcast frame is sent and sends it along with the broadcast frame. The slave node, which is in the same time synchronization domain as the AP, receives the broadcast frame, records the reception time t4, and obtains the delivery time t2 corresponding to the delay measurement request message ID sent by itself from the broadcast frame; Based on timestamp data t1, t2, t3, and t4, the link delay and clock offset between the AP and the slave node are calculated, and the adjacent rate ratio is calculated to correct the time synchronization error. At a certain moment, the clocks of AP and slave node are respectively T. AP T STA , The expression for the link delay and clock offset between the slave node and the master clock is as follows: The corrected local clock of the slave node is: T′=T STA -t offset ; Calculate the adjacent rate ratio to correct for time synchronization errors, including: Take the sending time t1, t3 of a certain message and the sending time t of the previous round. ' 1,t ' 3. The adjacent rate ratio between the AP and the slave node is calculated as follows: The corrected link delay is: t delay =[(t4-t1)+neighborRateRatio×(t2-t3)] / 2 The corrected clock offset value is: t' offset =[-t1+neighborRateRatio×(t2-t3)+2t3-t4] / 2 The corrected local clock of the slave node is: T′=T STA -t′ offset 。 2. The high-precision time synchronization method for wireless environments according to claim 1, characterized in that, The FTM_Request delay measurement request message consists of a header field and a message ID.
3. The high-precision time synchronization method for wireless environments according to claim 1, characterized in that, The broadcast frame carries the current master clock timestamp and the timestamp data of all delay measurement messages sent by slave nodes; The broadcast frame includes a timestamp field and a timestamp data table field, and the required timestamp information can be obtained by querying the fields. The timestamp field is the master clock time when the broadcast message is sent from the AP's sending port, used for time synchronization with slave nodes and for link delay measurement; the timestamp data table field contains the frame ID information of the delay measurement request frames sent by each slave node and the corresponding timestamp data of their arrival at the AP, which are recorded in the master node's memory.
4. The high-precision time synchronization method for wireless environments according to claim 1, characterized in that, The hardware timestamp technology includes: The MLME is used to obtain and record the timestamp of message transmission at the MAC layer; the MLME is a MAC layer management entity. Each time a message arrives at and leaves the MAC layer, the MLME records the timestamp and returns the data to the upper layer.
5. A high-precision time synchronization system for wireless environments, characterized in that, include: The network connection management module is used to search for and connect to the AP from the node, and send a Sync_Request message to the AP to request to join the time synchronization domain; The AP responds with an ACK message to confirm, and the slave node joins the time synchronization domain; The delay measurement request module is used to send an FTM_Request delay measurement request message from the slave node to the AP, and at the same time, use hardware timestamp technology to record the message sending time t1 and record the corresponding timestamp on the slave node; The timestamp processing and recording module is used for the AP to receive the FTM_Request delay measurement request message and use hardware timestamp technology to obtain the time t2 of receiving the message, mark the timestamp with the message ID and update it in memory; The broadcast frame construction and transmission module is used by the AP to load the timestamp data in its memory into a broadcast frame and periodically broadcast the broadcast frame to all STAs in the BSS. At the same time, the AP obtains the time t3 of the broadcast frame transmission and sends it along with the broadcast frame. The timestamp parsing module is used to record the reception time t4 when the slave node, which is in the same time synchronization domain as the AP, receives the broadcast frame, and obtains the delivery time t2 corresponding to the delay measurement request message ID sent by itself from the broadcast frame. The synchronization calculation and error correction module is used to calculate the link delay and clock offset between the AP and the slave node based on timestamp data t1, t2, t3, and t4, and to calculate the adjacent rate ratio to correct the time synchronization error. At a certain moment, the clocks of AP and slave node are respectively T. AP T STA , The expression for the link delay and clock offset between the slave node and the master clock is as follows: The corrected local clock of the slave node is: T′=T STA -t offset ; Calculate the adjacent rate ratio to correct for time synchronization errors, including: Take the sending time t1, t3 of a certain message and the sending time t of the previous round. ' 1,t ' 3. The adjacent rate ratio between the AP and the slave node is calculated as follows: The corrected link delay is: t delay =[(t4-t1)+neighborRateRatio×(t2-t3)] / 2 The corrected clock offset value is: t′ offset =[-t1+neighborRateRatio×(t2-t3)+2t3-t4] / 2 The corrected local clock of the slave node is: T′=T STA -t′ offset 。 6. The high-precision time synchronization system for wireless environments according to claim 5, characterized in that, The FTM_Request delay measurement request message consists of a header field and a message ID.
7. An electronic device, characterized in that, The electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the high-precision time synchronization method for a wireless environment as described in any one of claims 1 to 4.
8. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the high-precision time synchronization method for a wireless environment as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Time synchronization method and device, equipment and storage medium
CN115694704A
Clock synchronization in half-duplex communication systems
US11552775B1