Wired and wireless combined time synchronization system and method
By using the PTP protocol for synchronization between gateway devices and access devices, and utilizing hardware timestamp technology to transmit timestamps in the wireless network, the problem of synchronization accuracy gaps in hybrid networks is solved, achieving end-to-end nanosecond-level time synchronization from the gateway to field devices, thus improving the system's time consistency and resource utilization efficiency.
Patent Information
- Application Number
- CN202511796057.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-02
- Publication Date
- 2026-02-24
AI Technical Summary
In hybrid networks, existing technologies cannot achieve unified time synchronization between wired and wireless networks, resulting in gaps in synchronization accuracy and resource consumption, which cannot meet the requirements of industrial control for microsecond or nanosecond-level synchronization.
The gateway device is used as the master clock source. It is synchronized with the access device via the wired PTP protocol and with the field device via the wireless synchronization frame carrying the hardware timestamp. By combining the hardware timestamp technology of the physical layer and MAC layer, the path delay and clock offset are calculated to achieve end-to-end nanosecond-level time synchronization.
It achieves nanosecond-level unified time synchronization for all network devices, eliminates synchronization accuracy gaps, reduces software processing latency jitter, and ensures efficient utilization of system resources.
Smart Images

Figure CN121567255A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication network technology, and specifically to a wired and wireless joint time synchronization system and method. Background Technology
[0002] In modern industrial automation, the Internet of Things (IoT), and intelligent control systems, precise time synchronization is crucial for ensuring collaborative system operation and achieving accurate control and data acquisition. System performance, such as the stability of control loops, the temporal correlation of data records, and the accurate analysis of event sequences, all directly depend on the time synchronization accuracy between devices within the network.
[0003] In existing technologies, different time synchronization protocols are typically used for different network media. In wired networks (such as Ethernet), the IEEE 1588 Precision Time Protocol (PTP) is widely used to achieve high-precision time synchronization. The PTP protocol, through message exchange between master and slave clocks combined with hardware timestamp technology, can effectively compensate for network transmission delays and achieve sub-microsecond or even nanosecond synchronization between slave and master clocks.
[0004] However, the situation is quite different in wireless network environments. Wireless networks typically employ Network Time Protocol (NTP) or simple broadcast-based synchronization mechanisms. NTP primarily operates at the application layer, and its synchronization accuracy is usually on the order of milliseconds, making it difficult to meet the stringent microsecond or nanosecond synchronization requirements of scenarios such as industrial control. Although some proprietary industrial wireless protocols have attempted to improve synchronization accuracy, their accuracy and stability still lag significantly behind wired PTP.
[0005] With the development of the Industrial Internet, numerous hybrid network topologies have emerged. A typical topology involves a central gateway device connecting multiple access devices (ADs) via wired connections (such as Ethernet). These access devices then wirelessly connect to a large number of field devices (FDs), such as sensors and actuators. In such heterogeneous networks, existing solutions face significant challenges:
[0006] Synchronization scheme incompatibility: Wired networks use the high-precision PTP protocol, while wireless networks use low-precision NTP or broadcast synchronization. These two schemes are independent of each other and lack a unified end-to-end time base. High-precision synchronization can be achieved between the gateway and access devices, but the synchronization accuracy between the access devices and field devices becomes the bottleneck of the entire system, resulting in unsatisfactory end-to-end synchronization accuracy.
[0007] Low wireless synchronization accuracy: Wireless synchronization mechanisms are usually limited by factors such as the uncertainty of software timestamps, operating system scheduling delays, and random backoff of the Media Access Control (MAC) layer, which introduce large delay jitter and cause the synchronization accuracy to remain at the millisecond level.
[0008] Synchronization accuracy gap: At the boundary between wired and wireless networks (i.e., access devices), there is a "gap" in synchronization accuracy. As the slave clock of the wired network and the master clock of the wireless network, the access device's internal time processing and forwarding introduce new errors, making it impossible to seamlessly and with low loss transmit the high-precision time from the wired side to the field devices on the wireless side.
[0009] System resource consumption: High-frequency software time synchronization message processing will consume the central processing unit resources of access devices and field devices, which may affect the core control functions of the devices.
[0010] Therefore, there is an urgent need in this field for a solution that can integrate the advantages of wired and wireless networks, eliminate synchronization accuracy gaps, and achieve end-to-end high-precision time synchronization from the gateway to the final field device. Summary of the Invention
[0011] The purpose of this invention is to overcome the shortcomings of the prior art and provide a wired and wireless joint time synchronization system and method to solve problems such as incompatibility of time synchronization schemes, low wireless synchronization accuracy, and synchronization accuracy gaps in hybrid networks, and ultimately achieve nanosecond-level unified time synchronization of all network devices.
[0012] To solve the above-mentioned technical problems, embodiments of the present invention provide the following technical solution: a wired and wireless joint time synchronization system, comprising: a gateway device, at least one access device, and at least one field device;
[0013] The gateway device is connected to the access device via a wired network, and the access device is connected to the field device via a wireless network;
[0014] The gateway device is configured as the master clock source for the entire system;
[0015] The access device is configured to: act as a slave clock of the gateway device on the wired side, and synchronize time with the gateway device via Precision Time Protocol (PTP); and act as a master clock of the field device on the wireless side, and synchronize time with the field device via a wireless synchronization frame carrying a hardware timestamp.
[0016] The field device is configured as a slave clock on the wireless side, receives wireless synchronization frames from the access device, and calculates the time deviation with the access device based on the hardware timestamp and air interface transmission time calculation model in the frame, thereby correcting the local clock.
[0017] The network interfaces of the gateway device, access device, and field device all support the generation and parsing of hardware timestamps at the physical layer or the Media Access Control (MAC) layer.
[0018] Furthermore, the access device's time synchronization with the gateway device via PTP specifically includes:
[0019] The gateway device sends a Sync message and records the sending time t1, and the access device receives the Sync message and records the receiving time t2;
[0020] The gateway device sends t1 to the access device by following the Follow_Up message;
[0021] The access device sends a Delay_Req message and records the sending time t3; the gateway device receives the Delay_Req message and records the receiving time t4.
[0022] The gateway device sends t4 to the access device via a delayed response Delay_Resp message;
[0023] The access device calculates the path delay and clock offset based on t1, t2, t3, and t4, and adjusts its local clock based on the clock offset.
[0024] Furthermore, the path delay is calculated using the following formula: Path delay = (t2-t1) + (t4-t3)(t2-t1)+(t4-t3) / 2;
[0025] The formula for calculating the clock offset is: Clock offset = (t2-t1)-(t4-t3)(t2-t1)-(t4-t3) / 2.
[0026] Furthermore, the access device synchronizes its time with the field device via a wireless synchronization frame carrying a hardware timestamp, specifically including:
[0027] When the access device sends a wireless synchronization frame at the physical layer, the hardware automatically fills in the precise transmission timestamp T1 to a specific field of the wireless synchronization frame.
[0028] When the field device receives the wireless synchronization frame at the physical layer, the hardware automatically records the precise reception timestamp T2.
[0029] The field device calculates the air interface transmission time T_air based on the parameters of the wireless synchronization frame;
[0030] The field equipment calculates the time deviation Δt = T2-T_air-T1 based on T1, T2, and T_air.
[0031] The field device corrects its local clock based on the time deviation Δt.
[0032] Furthermore, the formula for calculating the air interface transmission time T_air is as follows:
[0033] T_air = L_preamble / R_base + L_header / R_data + L_payload / R_data;
[0034] Where L_preamble is the preamble length, R_base is the baseband transmission rate, L_header is the MAC header length, L_payload is the payload length, and R_data is the data transmission rate.
[0035] Furthermore, the specific steps for the field device to correct its local clock based on the time deviation Δt are as follows:
[0036] Get the current system time T_current;
[0037] Calculate the corrected synchronization time T_sync = T_current - Δt;
[0038] Set the local clock to T_sync via a system call.
[0039] A wired and wireless joint time synchronization method applied to the above-described system includes the following steps:
[0040] Wired network time synchronization steps: The gateway device and the access device perform high-precision time synchronization based on the PTP protocol to align the local clock of the access device with the local clock of the gateway device;
[0041] Wireless network time synchronization steps: The access device and the field device that have completed synchronization perform wireless time synchronization based on hardware timestamps to align the local clock of the field device with the local clock of the access device.
[0042] In both the wired network time synchronization step and the wireless network time synchronization step, the recording of all timestamps is completed by hardware at the physical layer or MAC layer.
[0043] Furthermore, the wired network time synchronization step specifically includes:
[0044] Time synchronization message exchange sub-steps: The gateway device sends a Sync message and records the sending time t1; the access device receives the Sync message and records the receiving time t2; the gateway device sends t1 to the access device via a Follow_Up message;
[0045] Delay measurement message exchange sub-step: The access device sends a Delay_Req message and records the sending time t3; the gateway device receives the Delay_Req message and records the receiving time t4; the gateway device sends t4 to the access device via a Delay_Resp message;
[0046] Synchronization parameter calculation sub-step: The access device calculates the path delay and clock offset based on t1, t2, t3, and t4;
[0047] Clock correction sub-step: The access device adjusts its local clock according to the clock offset.
[0048] Furthermore, the wireless network time synchronization step specifically includes:
[0049] Synchronization frame transmission sub-step: When the access device prepares the wireless synchronization frame and transmits the frame at the physical layer, the hardware automatically fills in the precise transmission timestamp T1;
[0050] Synchronization frame reception sub-step: The field device receives the wireless synchronization frame at the physical layer, and the hardware automatically records the precise reception timestamp T2;
[0051] Air interface time calculation sub-step: The field device calculates the air interface transmission time T_air based on the parameters of the wireless synchronization frame;
[0052] Time deviation calculation sub-step: Calculate the time deviation Δt = T2 - T_air - T1 for the field equipment;
[0053] System clock correction sub-step: Field devices correct their local system time according to the time deviation Δt.
[0054] Furthermore, in the air interface time calculation sub-step, the formula for calculating T_air is: T_air = L_preamble / R_base + L_header / R_data + L_payload / R_data;
[0055] Where L_preamble is the preamble length, R_base is the baseband transmission rate; L_header is the MAC header length, L_payload is the payload length, and R_data is the data transmission rate;
[0056] The system clock correction sub-step specifically includes: the field device acquiring the current system time T_current, calculating T_sync = T_current - Δt, and setting the local clock to T_sync.
[0057] The beneficial effects of the above-described technical solution of the present invention are as follows:
[0058] This invention achieves high-precision time synchronization across the entire network by organically combining wired PTP synchronization with hardware timestamp synchronization carried in wireless beacon frames. Specific effects include: nanosecond-level synchronization between the gateway and access devices via the PTP protocol; nanosecond-level synchronization between access devices and field devices via hardware timestamps and air interface time compensation; accurate calculation of air interface occupancy time by calculating parameters such as data packet length, preamble, and transmission rate, eliminating wireless transmission delay errors; hardware-level timestamp padding to avoid delay jitter introduced by software processing; and the establishment of a unified time synchronization system to ensure time consistency across all network devices. Attached Figure Description
[0059] Figure 1 This is a network topology diagram of the wired and wireless joint time synchronization system described in an embodiment of the present invention.
[0060] Figure 2 This is a flowchart of wired network time synchronization (between gateway device and access device) in an embodiment of the present invention.
[0061] Figure 3 This is a flowchart of wireless network time synchronization (between access device and field device) in an embodiment of the present invention. Detailed Implementation
[0062] To make the technical problems, technical solutions and advantages of the present invention clearer, a detailed description will be given below in conjunction with the accompanying drawings and specific embodiments.
[0063] This invention provides a wired and wireless combined time synchronization system, comprising:
[0064] A gateway device, at least one access device, and at least one field device;
[0065] The gateway device connects to the access device via a wired network, and the access device connects to the field device via a wireless network;
[0066] The gateway device is configured as the master clock source for the entire system;
[0067] The access device is configured to: act as a slave clock of the gateway device on the wired side, and synchronize time with the gateway device via the PTP protocol; and act as a master clock of the field devices on the wireless side, and synchronize time with the field devices via wireless synchronization frames carrying hardware timestamps.
[0068] The field device is configured as a slave clock on the wireless side, receives wireless synchronization frames from the access device, and calculates the time deviation with the access device based on the hardware timestamp in the frame and the air interface transmission time calculation model, thereby correcting the local clock.
[0069] The network interfaces of gateway devices, access devices, and field devices all support the generation and parsing of hardware timestamps at the physical layer or MAC layer.
[0070] The present invention also provides a wired and wireless joint time synchronization method for the above-mentioned system, comprising the following steps:
[0071] S1: Wired network time synchronization stage
[0072] The gateway device and the access device perform high-precision time synchronization based on the PTP protocol, specifically including:
[0073] S11: Time synchronization message exchange and hardware timestamp recording: The gateway device, acting as the master clock, sends Sync messages and records the precise sending time t1 in the physical layer hardware; the access device, acting as the slave clock, receives Sync messages and records the precise receiving time t2 in the physical layer hardware; the gateway device sends t1 to the access device via Follow_Up messages;
[0074] S12: Delay Request Message Exchange and Hardware Timestamp Recording: The access device sends a Delay_Req message and records the precise sending time t3 in the physical layer hardware; the gateway device receives the Delay_Req message and records the precise receiving time t4 in the physical layer hardware; the gateway device sends t4 to the access device through a Delay_Resp message;
[0075] S13: Synchronization parameter calculation: The access device calculates the path delay and clock offset with the gateway device based on timestamps t1, t2, t3, t4;
[0076] Path delay = (t2-t1) + (t4-t3)(t2-t1)+(t4-t3) / 2
[0077] Clock offset = (t2-t1)-(t4-t3)(t2-t1)-(t4-t3) / 2
[0078] S14: Clock Correction: The access device adjusts its local clock according to the calculated clock offset to achieve nanosecond-level synchronization with the gateway device.
[0079] S2: Wireless Network Time Synchronization Phase
[0080] Wireless time synchronization based on hardware timestamps is performed between access devices that have completed wired synchronization and field devices, specifically including:
[0081] S21: Wireless synchronization frame transmission: The access device prepares a wireless synchronization frame. When transmitting the frame at the physical layer, the hardware automatically fills in the precise transmission timestamp T1 to specific fields of the frame.
[0082] S22: Wireless synchronization frame reception and timestamp recording: The field device receives the wireless synchronization frame at the physical layer and the hardware automatically records the precise reception timestamp T2;
[0083] S23: Air interface transmission time calculation: The field device calculates the transmission time T_air of the wireless synchronization frame over the air interface based on the parameters of the wireless synchronization frame;
[0084] The specific calculation formula is: T_air = L_preamble / R_base + L_header / R_data + L_payload / R_data
[0085] Where L_preamble is the preamble length, R_base is the baseband transmission rate, L_header is the MAC header length, L_payload is the payload length, and R_data is the data transmission rate.
[0086] S24: Time Deviation Calculation: Time deviation Δt between field equipment calculation and connected equipment:
[0087] Δt = T2 - T_air - T1
[0088] S25: System clock correction: The field device obtains the current system time T_current and calculates the corrected synchronization time T_sync = T_current-Δt. Then, it sets the local clock to T_sync through a system call to achieve nanosecond-level synchronization with the access device, thereby maintaining time synchronization with the entire network through the access device.
[0089] Combination Figure 1 This diagram illustrates a typical network topology of the system of this invention. The central element is a gateway device, which acts as the master clock for the entire network. The gateway device connects to multiple access devices via a wired network (e.g., Ethernet). Each access device connects to several field devices via a wireless network. The diagram shows the flow of time: high-precision time originates from the gateway device, is accurately transmitted to the access devices via wired PTP synchronization, and then accurately transmitted to each field device via wireless hardware timestamp synchronization, ultimately achieving end-to-end time unification. This topology is a star structure, but this invention is also applicable to more complex topologies such as tree structures or multi-hop relays.
[0090] Combination Figure 2 It describes in detail the process of time synchronization in a wired network, which is performed between the gateway device (master clock) and the access device (slave clock).
[0091] The process begins with the time synchronization phase: the gateway device sends a Sync message and records the transmission time t1 in the physical layer hardware. The access device receives the Sync message and records the reception time t2 in the physical layer hardware. Subsequently, the gateway device transmits t1 to the access device via a Follow_Up message.
[0092] Next, the delay measurement phase begins: the access device sends a Delay_Req message and records the transmission time t3 in the physical layer hardware. The gateway device receives the Delay_Req message and records the reception time t4 in the physical layer hardware. Subsequently, the gateway device transmits t4 to the access device via a Delay_Resp message.
[0093] Finally, in the calculation and correction phase: After obtaining all four timestamps t1, t2, t3, and t4, the access device calculates the path delay and clock skew. The calculation formulas are: Path delay = (t2-t1) + (t4-t3)(t2-t1)+(t4-t3) / 2; Clock skew = (t2-t1)-(t4-t3)(t2-t1)-(t4-t3) / 2. The access device ultimately adjusts its local clock based on the calculated clock skew to complete synchronization with the gateway device.
[0094] Combination Figure 3 It describes in detail the process of wireless network time synchronization, which is performed between access devices (senders) that have been synchronized with the gateway and field devices (receivers).
[0095] The process begins with synchronization frame transmission preparation: the access device prepares a special wireless synchronization frame, the structure of which contains fields for filling in the transmission timestamp.
[0096] Next comes the synchronization frame transmission and timestamp recording: the access device sends the synchronization frame at the physical layer, and the hardware at the transmitting end automatically fills the precise transmission timestamp T1 into the specified position in the frame at the last moment before the signal actually leaves the antenna.
[0097] Then comes the synchronization frame reception and timestamp recording: the field device receives the synchronization frame at the physical layer, and the receiver hardware automatically records the precise reception timestamp T2 the moment the signal arrives at the antenna.
[0098] The next step is the air interface time calculation: the field device parses the received synchronization frame, obtains its frame structure parameters (preamble length, MAC header length, payload length, etc.), and combines them with the known transmission rate (baseband rate, data rate) to accurately calculate the transmission time of the frame in the air using the formula T_air = L_preamble / R_base + L_header / R_data + L_payload / R_data.
[0099] Next is the time deviation calculation: the field equipment uses T1, T2 and T_air to calculate the time deviation Δt = T2-T_air-T1 with the access equipment.
[0100] Finally, system clock calibration: the field device reads the current system time T_current, calculates the target time to be calibrated to T_sync = T_current-Δt, and sets the local clock to T_sync through the operating system call, thereby completing high-precision time synchronization.
[0101] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments. This embodiment uses an industrial Internet of Things (IoT) scenario as an example, but the application of the present invention is not limited thereto.
[0102] The system in this embodiment includes a gateway device, three access devices (AD1, AD2, AD3), and multiple field devices (FDs) connected to each access device. The gateway device is a high-performance industrial computer equipped with an Ethernet interface supporting the IEEE 1588PTP protocol and configured as a PTP master clock. The access devices are embedded devices integrating wired Ethernet interfaces and industrial wireless communication modules; both their wired and wireless interfaces support hardware timestamp functionality. The field devices are intelligent sensors and actuators integrating WIA-FA communication modules; their wireless communication interfaces also support hardware timestamp functionality.
[0103] 1. System initialization and topology establishment:
[0104] The gateway device, all access devices, and field devices power on and start. The gateway device obtains an IP address via DHCP or static configuration and declares itself as the best master clock in the PTP domain. Access devices discover and connect to the gateway via the wired network, acting as PTP slave clocks. Field devices scan for and associate with their respective access devices via the wireless network.
[0105] 2. Wired network time synchronization implementation (gateway and access devices):
[0106] The gateway device (master clock) periodically initiates the PTP synchronization process.
[0107] Step S11: The gateway's Ethernet controller sends a Sync message at the physical layer, and records the precise transmission time t1 by hardware the instant the message leaves. When the access device AD1's Ethernet controller receives the Sync message at the physical layer, it records the precise reception time t2 by hardware. Subsequently, the gateway transmits this crucial information, t1, to AD1 via a separate Follow_Up message.
[0108] Step S12: To measure the symmetric delay of the network path, AD1 initiates a delay measurement. AD1's Ethernet controller sends a Delay_Req message at the physical layer, and the transmission time t3 is recorded by hardware. The gateway receives the Delay_Req message and records the reception time t4 by hardware. Subsequently, the gateway transmits t4 to AD1 via a Delay_Resp message.
[0109] Step S13: At this point, AD1 has all four timestamps (t1, t2, t3, t4). AD1's PTP protocol stack calculates the path delay and clock offset:
[0110] Path delay = (t2-t1) + (t4-t3) / 2 = (Receive Sync time - Send Sync time) + (Receive Delay_Req time - Send Delay_Req time) / 2
[0111] Clock offset = (t2-t1)-(t4-t3) / 2 = (Receive Sync time - Send Sync time)-(Receive Delay_Req time - Send Delay_Req time) / 2
[0112] in:
[0113] t1: The precise time (send Sync time) when the gateway device (master clock) sends the Sync message.
[0114] t2: The precise time at which the access device (from the clock) receives the Sync message (receive Sync time).
[0115] t3: The precise time when the access device sends the Delay_Req message (the time when the Delay_Req message was sent).
[0116] t4: The precise time when the gateway device received the Delay_Req message (the time of receiving the Delay_Req message).
[0117] Step S14: Based on the calculated clock offset value, AD1 gradually aligns its time with the gateway device by adjusting the phase and frequency of its local clock, achieving nanosecond-level synchronization. AD2 and AD3 follow the exact same process to synchronize with the gateway.
[0118] 3. Implementation of wireless network time synchronization (access devices and field devices):
[0119] Assume that AD1 has already maintained high-precision synchronization with the gateway through the above wired synchronization process. Now, it is necessary to transmit the current synchronization accuracy to its downstream field device FD1.
[0120] Step S21: The AD1 protocol stack prepares a wireless synchronization frame in a specific format. Besides containing necessary control information, this frame reserves a field to store the transmission timestamp T1. When the AD1 wireless communication module begins transmitting the preamble of this frame at the physical layer (PHY), its hardware logic automatically fills the reserved field with the high-precision hardware clock count value (i.e., T1) at the last moment before the payload portion of the frame (or the specific timestamp field) is actually transmitted. This T1 time base is consistent with the system clock after AD1 is synchronized via wired PTP.
[0121] Step S22: The wireless communication module of field device FD1 detects and begins receiving the preamble of the synchronization frame at the physical layer. After successfully completing frame delimitation and confirming that it is a valid frame, the hardware records the hardware clock count value at the moment of receiving the last symbol of the frame as the reception timestamp T2.
[0122] Step S23: FD1 parses the received synchronization frame. It learns from the frame structure the preamble length (L_preamble, e.g., 128 bits), MAC header length (L_header, e.g., 240 bits), and payload length (L_payload, e.g., the length of the field containing the timestamp). Simultaneously, FD1 knows the parameters used for communication: the baseband transmission rate (R_base, e.g., 1 Mbps) and the data transmission rate (R_data, e.g., 2 Mbps). Based on these parameters, FD1 calculates the air interface transmission time T_air:
[0123] T_air = (128 bits / 1 Mbps) + ( (240 bits + L_payload) / 2 Mbps )
[0124] The calculated T_air is a deterministic physical transmission time that is related to the frame length and rate.
[0125] Step S24: FD1 extracts the transmission timestamp T1 filled in by AD1 from the synchronization frame, and calculates the time deviation by combining it with its own recorded reception timestamp T2 and the calculated T_air:
[0126] Δt = T2 - T_air - T1
[0127] This Δt is the deviation of the FD1 local clock relative to the AD1 clock.
[0128] Step S25: FD1 reads the current system time T_current. Then it calculates the target synchronization time: T_sync = T_current - Δt. Finally, FD1 adjusts its system clock to T_sync in one go by calling the operating system's underlying time setting function (such as Linux's clock_settime). In this way, FD1 achieves nanosecond-level time synchronization with AD1. Since AD1 is already synchronized with the gateway, FD1 is indirectly synchronized with the network's master clock.
[0129] It should be noted that:
[0130] Hardware timestamps: All timestamps (t1, t2, t3, t4, T1, T2) must be generated in the hardware of the physical layer (PHY) or MAC layer of the network interface to ensure the accuracy and low jitter of time recording.
[0131] Clock quality: Gateway devices should use a highly stable clock source, such as a temperature-controlled crystal oscillator or an atomic clock.
[0132] Synchronization period: The transmission period of wired PTP synchronization and wireless synchronization frames can be configured according to network load and accuracy requirements, with typical values ranging from 1 second to 100 milliseconds.
[0133] Air Interface Time Model: The air interface time calculation model is crucial for improving wireless synchronization accuracy. Implementation requires precise knowledge of the wireless chip's modulation and coding scheme, as well as its corresponding transmission rate.
[0134] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A wired and wireless combined time synchronization system, characterized in that, include: A gateway device, at least one access device, and at least one field device; The gateway device is connected to the access device via a wired network, and the access device is connected to the field device via a wireless network; The gateway device is configured as the master clock source for the entire system; The access device is configured to: act as a slave clock of the gateway device on the wired side, and synchronize time with the gateway device via Precision Time Protocol (PTP); and act as a master clock of the field device on the wireless side, and synchronize time with the field device via a wireless synchronization frame carrying a hardware timestamp. The field device is configured as a slave clock on the wireless side, receives wireless synchronization frames from the access device, and calculates the time deviation with the access device based on the hardware timestamp and air interface transmission time calculation model in the frame, thereby correcting the local clock. The network interfaces of the gateway device, access device, and field device all support the generation and parsing of hardware timestamps at the physical layer or the Media Access Control (MAC) layer.
2. The system according to claim 1, characterized in that, The access device synchronizes its time with the gateway device via PTP, specifically including: The gateway device sends a Sync message and records the sending time t1, and the access device receives the Sync message and records the receiving time t2; The gateway device sends t1 to the access device by following the Follow_Up message; The access device sends a Delay_Req message and records the sending time t3; the gateway device receives the Delay_Req message and records the receiving time t4. The gateway device sends t4 to the access device via a delayed response Delay_Resp message; The access device calculates the path delay and clock offset based on t1, t2, t3, and t4, and adjusts its local clock based on the clock offset.
3. The system according to claim 2, characterized in that, The formula for calculating the path delay is: Path delay = (t2-t1) + (t4-t3)(t2-t1)+(t4-t3) / 2; The formula for calculating the clock offset is: Clock offset = (t2-t1)-(t4-t3)(t2-t1)-(t4-t3) / 2.
4. The system according to claim 1, characterized in that, The access device synchronizes its time with the field device via a wireless synchronization frame carrying a hardware timestamp, specifically including: When the access device sends a wireless synchronization frame at the physical layer, the hardware automatically fills in the precise transmission timestamp T1 to a specific field of the wireless synchronization frame. When the field device receives the wireless synchronization frame at the physical layer, the hardware automatically records the precise reception timestamp T2. The field device calculates the air interface transmission time T_air based on the parameters of the wireless synchronization frame; The field equipment calculates the time deviation Δt = T2-T_air-T1 based on T1, T2, and T_air. The field device corrects its local clock based on the time deviation Δt.
5. The system according to claim 4, characterized in that, The formula for calculating the air interface transmission time T_air is: T_air = L_preamble / R_base + L_header / R_data + L_payload / R_data; Where L_preamble is the preamble length, R_base is the baseband transmission rate, L_header is the MAC header length, L_payload is the payload length, and R_data is the data transmission rate.
6. The system according to claim 4, characterized in that, The specific steps for the field device to correct its local clock based on the time deviation Δt are as follows: Get the current system time T_current; Calculate the corrected synchronization time T_sync = T_current - Δt; Set the local clock to T_sync via a system call.
7. A wired and wireless joint time synchronization method applied to the system according to any one of claims 1 to 6, characterized in that, Includes the following steps: Wired network time synchronization steps: The gateway device and the access device perform high-precision time synchronization based on the PTP protocol to align the local clock of the access device with the local clock of the gateway device; Wireless network time synchronization steps: The access device and the field device that have completed synchronization perform wireless time synchronization based on hardware timestamps to align the local clock of the field device with the local clock of the access device. In both the wired network time synchronization step and the wireless network time synchronization step, the recording of all timestamps is completed by hardware at the physical layer or MAC layer.
8. The method according to claim 7, characterized in that, The wired network time synchronization steps specifically include: Time synchronization message exchange sub-steps: The gateway device sends a Sync message and records the sending time t1; the access device receives the Sync message and records the receiving time t2; the gateway device sends t1 to the access device via a Follow_Up message; Delay measurement message exchange sub-step: The access device sends a Delay_Req message and records the sending time t3; the gateway device receives the Delay_Req message and records the receiving time t4; the gateway device sends t4 to the access device via a Delay_Resp message; Synchronization parameter calculation sub-step: The access device calculates the path delay and clock offset based on t1, t2, t3, and t4; Clock correction sub-step: The access device adjusts its local clock according to the clock offset.
9. The method according to claim 7, characterized in that, The wireless network time synchronization steps specifically include: Synchronization frame transmission sub-step: When the access device prepares the wireless synchronization frame and transmits the frame at the physical layer, the hardware automatically fills in the precise transmission timestamp T1; Synchronization frame reception sub-step: The field device receives the wireless synchronization frame at the physical layer, and the hardware automatically records the precise reception timestamp T2; Air interface time calculation sub-step: The field device calculates the air interface transmission time T_air based on the parameters of the wireless synchronization frame; Time deviation calculation sub-step: Calculate the time deviation Δt = T2 - T_air - T1 for the field equipment; System clock correction sub-step: Field devices correct their local system time according to the time deviation Δt.
10. The method according to claim 9, characterized in that, In the air interface time calculation sub-step, the formula for calculating T_air is: T_air = L_preamble / R_base + L_header / R_data + L_payload / R_data; Where L_preamble is the preamble length, R_base is the baseband transmission rate; L_header is the MAC header length, L_payload is the payload length, and R_data is the data transmission rate; The system clock correction sub-step specifically includes: the field device obtains the current system time T_current, calculates T_sync = T_current-Δt, and sets the local clock to T_sync.
Citation Information
Patent Citations
Systems and methods for distributing GPS clock to communications devices
CN101971557A
Method and system for accurate clock synchronization for communication networks
US20110299521A1