Communication system and method of Wi-Fi soft scheduling system based on TSF synchronization token bucket, computer equipment and medium
By using a Wi-Fi soft scheduling system based on TSF synchronous token bucket, the limitations of Wi-Fi networks in terms of time determinism and traffic scheduling are solved. It achieves microsecond-level time determinism and low-latency transmission, adapts to burst traffic and dynamic network changes, and improves bandwidth utilization and traffic level guarantees.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 深圳开鸿数字产业发展有限公司
- Filing Date
- 2025-12-25
- Publication Date
- 2026-05-05
AI Technical Summary
Existing Wi-Fi networks have limitations in terms of time determinism and traffic scheduling. Especially under high load or network congestion, the collisions and random backoffs caused by the CSMA/CA protocol introduce unpredictable delays, which cannot meet the requirements of industrial applications for sub-millisecond latency and low jitter.
A Wi-Fi soft scheduling system based on TSF synchronization token bucket is adopted. A unified time base is provided by a high-precision TSF synchronization module. Pseudo-TDMA time-slotted scheduling is achieved by combining a TSF synchronization token bucket gating module and conflict protection is implemented at the driver layer to ensure low-latency transmission and deterministic scheduling of data packets.
Without modifying the IEEE 802.11 MAC layer, microsecond-level time determinism and low-latency transmission are achieved, simulating deterministic TDMA effects, adapting to burst traffic and dynamic network changes, and improving bandwidth utilization and traffic level guarantees.
Smart Images

Figure CN121985404A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of wireless communication protocol optimization technology, and in particular to a communication system, method, computer equipment, and medium based on a TSF synchronized token bucket Wi-Fi soft scheduling system. Background Technology
[0002] Current Wi-Fi networks rely on Carrier Sense Multiple Access / Collision Avoidance (CSMA / CA) protocols for media access. This protocol avoids collisions through random backoff and Distributed Coordination Function (DCF). To improve Quality of Service (QoS), the IEEE 802.11e standard introduced the Wireless Multimedia (WMM / EDCA) mechanism, which prioritizes traffic by adjusting contention window parameters.
[0003] In existing technologies, Wi-Fi networks rely on Carrier Sense Multiple Access / Collision Avoidance (CSMA / CA) protocols for media access. CSMA / CA is a contention mechanism that avoids collisions and ensures fair access through Random Backoff and Distributed Coordination Function (DCF). However, this distributed, random design leads to inherent and insurmountable limitations in terms of temporal determinism.
[0004] Time Division Multiple Access (TDMA) protocols fundamentally eliminate contention by pre-allocating time slices, providing extremely high determinism and predictable low latency. Studies have shown that TDMA outperforms CSMA / CA in terms of energy efficiency, bandwidth utilization, and guaranteed traffic levels. However, pure TDMA requires all nodes to share a high-precision (typically microseconds or higher) time coordinate and demands that the MAC layer (Media Access Control sublayer) begin transmission precisely within the allocated time slots. This necessitates large-scale modifications to the MAC layer of the 802.11 protocol, which is impractical for deployment on commercial COTS Wi-Fi hardware. Furthermore, an inherent drawback of TDMA is its lack of adaptability to bursty traffic and dynamic network changes.
[0005] Therefore, existing technologies still need improvement. Summary of the Invention
[0006] To address the aforementioned deficiencies in existing technologies, this invention provides a communication system, method, computer equipment, and medium for a Wi-Fi soft scheduling system based on TSF synchronized token buckets. The technical solution adopted by this invention is as follows: In a first aspect, the present invention provides a communication system based on a TSF (Telegraphic Token Bucket) synchronized token bucket Wi-Fi soft scheduling system, the system comprising: A high-precision TSF synchronization module is used to provide a unified time base with microsecond-level accuracy and to handle system-level errors in time synchronization of Wi-Fi devices; The TSF synchronous token bucket gating module is used to implement time-slotted scheduling of pseudo-TDMA through dual constraints of time and capacity, and to control the permission of data packets to enter the MAC layer. The driver layer scheduling injection and conflict protection module is used to implement low-latency transmission injection of authorized data packets and to handle the disruption of scheduling determinism caused by MAC layer contention conflicts through a time slot conflict isolation mechanism.
[0007] In one implementation, the high-precision TSF synchronization module includes: The TSF reading unit is used to read the hardware timer through the low-jitter interface of the driver layer and perform preliminary calibration based on the TSF time in the beacon frames periodically broadcast by the AP. The delay calibration unit is used to handle system-level errors in time synchronization of Wi-Fi devices.
[0008] In one implementation, the delay calibration unit includes: The fixed delay compensation unit is used to measure and store the fixed offset of the current WNIC hardware when offline or during system startup, and to calculate the accurate physical time to eliminate the nondeterministic errors introduced by the interaction between the protocol stack and the hardware. The clock drift management unit is used to continuously monitor the TSF time in the beacon frames periodically broadcast by the AP and dynamically compensate for the accumulated error caused by local crystal oscillator drift.
[0009] In one implementation, the formula for calculating accurate physical time in the fixed delay compensation unit is: T TSF,true =T HOST,read T offset,fixed T jitter,residual ; Among them, T HOST,read For TSF hardware readings, T offset,fixed For systematic delay, T jitter,residual This is residual jitter.
[0010] In one implementation, the TSF synchronization token bucket gating module includes: The time slot allocation table parsing unit is used to receive the time slot allocation table broadcast by the AP as the central scheduler, and parse the scheduling period and the scheduled transmission time slot of the current STA. The token generation unit is used to bind the state of the token bucket counter with the accurate physical time provided by the high-precision TSF synchronization module to achieve authorization of the time window; The scheduling gating logic unit is used to authorize data packets to enter the MAC layer's transmission queue based on two judgment conditions.
[0011] In one implementation, the dual judgment conditions include: a time judgment condition and a capacity judgment condition; wherein, the time judgment condition is used to determine whether the current calibrated time is within the predetermined transmission time slot allocated by the AP to the STA; and the capacity judgment condition is used to determine whether the number of tokens in the token bucket counter is greater than or equal to the size of the data packet to be transmitted.
[0012] In one implementation, the driver-layer scheduling injection and conflict protection module includes: The MAC queue injector is used to push data packets authorized by the TSF synchronization token bucket gating module into the MAC layer transmission queue of the WNIC hardware driver with low latency. The time slot protection unit is used to customize the retransmission logic of data packets. The retransmission logic includes: retransmission timing constraints, timeout forced pull-back mechanism, and buffer retry.
[0013] In one implementation, the retransmission timing constraint is used to limit the number of retransmission attempts and the backoff time when a data packet needs to be retransmitted due to a collision at the MAC layer, ensuring that all retransmission operations are completed within the duration of the current time slot.
[0014] In one implementation, the timeout forced pull-back mechanism is used to forcibly remove the data packet from the MAC queue when the current time slot ends and the data packet has not yet been successfully transmitted.
[0015] In one implementation, the buffered retry is used to buffer the forcibly pulled-back data packet and wait for the next transmission slot belonging to the STA to resubmit the transmission request.
[0016] Secondly, embodiments of the present invention also provide a communication method for a Wi-Fi soft scheduling system based on a TSF synchronous token bucket as described in any of the above claims, the method comprising: When real-time data packets arrive at the driver layer, the high-precision TSF synchronization module is invoked to obtain the calibrated, high-precision current TSF time. The time slot allocation table is checked based on the TSF synchronous token bucket gating module, and the relationship between the token bucket counter and the data packet is checked to obtain the check results. The data packet is then processed based on the check results. Once the data packet is authorized, the driver layer scheduling injection and conflict protection module injects the data packet into the MAC layer transmission queue, and processes the data packet based on preset retransmission logic when a conflict occurs and retransmission is required.
[0017] In one implementation, the time slot allocation table is checked based on the TSF synchronization token bucket gating module, and the relationship between the token bucket counter and the data packets is checked to obtain the check results, including: The time slot allocation table is checked based on the TSF synchronization token bucket gating module to determine whether the current TSF time is in the predetermined transmission time slot allocated to the STA, and the first check result is obtained. The second check result is obtained by checking whether the token bucket counter can accommodate the data packets based on the TSF synchronous token bucket gating module.
[0018] In one implementation, a second check result is obtained by checking whether the token bucket counter can accommodate the data packets based on the TSF synchronization token bucket gating module, including: The second check result is obtained by comparing the number of tokens in the token bucket counter with the size of the data packet.
[0019] In one implementation, processing the data packet based on the inspection result includes: If the first check result indicates that the current TSF time is not within the predetermined transmission time slot, then the data packet is discarded; If the first check result indicates that the current TSF time is within the predetermined transmission time slot, then the data packet transmission continues.
[0020] In one implementation, processing the data packet based on the inspection result includes: If the second check result is that the number of tokens in the token bucket counter is less than the size of the data packet, then the data packet is considered non-compliant; If the second check result indicates that the number of tokens in the token bucket counter is greater than or equal to the size of the data packet, then the data packet transmission continues.
[0021] In one implementation, when a conflict occurs and retransmission is required, the data packet is processed based on preset retransmission logic, including: When a collision occurs and retransmission is required, the time slot protection unit determines whether the current retransmission time is within the duration of the predetermined transmission time slot. If the data packet fails to be transmitted successfully at the end of the current time slot, the data packet will be forcibly pulled back and retried in the next time slot.
[0022] Thirdly, embodiments of the present invention also provide a computer device, wherein the computer device includes a memory, a processor, and a communication program for a Wi-Fi soft scheduling system based on a TSF synchronization token bucket stored in the memory and executable on the processor. When the processor executes the communication program for the Wi-Fi soft scheduling system based on a TSF synchronization token bucket, it implements the steps of the communication method for the Wi-Fi soft scheduling system based on a TSF synchronization token bucket according to any of the above-mentioned schemes.
[0023] Fourthly, embodiments of the present invention also provide a computer-readable storage medium, wherein the computer-readable storage medium stores a communication program for a Wi-Fi soft scheduling system based on a TSF synchronization token bucket, and the communication program for the Wi-Fi soft scheduling system based on a TSF synchronization token bucket implements the steps of the communication method for the Wi-Fi soft scheduling system based on a TSF synchronization token bucket as described in any of the above schemes on the computer-readable storage medium.
[0024] Beneficial Effects: Compared with existing technologies, this invention provides a communication system based on a TSF (Trust Token Bucket) synchronization token system for Wi-Fi soft scheduling. The system includes: a high-precision TSF synchronization module, a TSF synchronization token bucket gating module, and a driver-layer scheduling injection and conflict protection module. The high-precision TSF synchronization module provides a unified time base with microsecond-level accuracy and handles system-level errors in Wi-Fi device time synchronization. The TSF synchronization token bucket gating module implements time-slotted scheduling of pseudo-TDMA through dual constraints of time and capacity, controlling the access rights of data packets to the MAC layer. The driver-layer scheduling injection and conflict protection module implements low-latency transmission injection of authorized data packets and handles the disruption of scheduling determinism caused by MAC layer contention conflicts through a time-slot conflict isolation mechanism.
[0025] This invention utilizes Wi-Fi's inherent high-precision time synchronization function (TSF) without modifying the IEEE 802.11 MAC layer, combined with a token bucket gating mechanism that is strictly bound to TSF time, to achieve precise soft control over the timing of data packet transmission at the operating system kernel driver layer, thereby simulating the deterministic time division multiple access (TDMA) effect on a contention-based channel. Attached Figure Description
[0026] Figure 1 This is a system block diagram of a Wi-Fi soft scheduling system based on TSF synchronization token bucket, provided in an embodiment of the present invention.
[0027] Figure 2 This is a schematic diagram of the Wi-Fi soft scheduling system based on TSF synchronous token bucket provided in an embodiment of the present invention.
[0028] Figure 3 This diagram illustrates the application environment of the communication method for a Wi-Fi soft scheduling system based on a TSF synchronous token bucket, as provided in an embodiment of the present invention.
[0029] Figure 4 This is a flowchart of a preferred embodiment of the communication method of the Wi-Fi soft scheduling system based on TSF synchronous token bucket provided in this invention.
[0030] Figure 5The execution flowchart of the TSF synchronous token bucket gating module in the communication method of the Wi-Fi soft scheduling system based on TSF synchronous token bucket provided in the embodiment of the present invention.
[0031] Figure 6 The flowchart illustrates the execution of the driver layer scheduling injection and conflict protection module in the communication method of the Wi-Fi soft scheduling system based on TSF synchronous token bucket provided in this embodiment of the invention.
[0032] Figure 7 This diagram illustrates a specific application of the communication method of the Wi-Fi soft scheduling system based on the TSF synchronous token bucket provided in this embodiment of the invention.
[0033] Figure 8 A schematic block diagram of a computer device provided for an embodiment of the present invention. Detailed Implementation
[0034] To make the objectives, technical solutions, and effects of this invention clearer and more explicit, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0035] The flowchart shown in the attached diagram is for illustrative purposes only and does not necessarily include all content, operations, or steps, nor does it require execution in the described order. For example, some operations or steps can be broken down, combined, or partially merged, so the actual execution order may change depending on the actual situation.
[0036] It should be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise. It should be understood that, in order to clearly describe the technical solutions of the embodiments of the present invention, the terms "first" and "second" are used in the embodiments of the present invention to distinguish identical or similar items with essentially the same function and effect. For example, the first control information and the second control information are only used to distinguish different control information and do not limit their order. Those skilled in the art will understand that the words "first" and "second" do not limit the quantity or the order of execution, and that the words "first" and "second" do not necessarily imply that they are different. It should also be understood that the terms "and / or" as used in this specification and the appended claims refer to any combination of one or more of the associated listed items and all possible combinations, and include such combinations.
[0037] Existing Wi-Fi networks rely on Carrier Sense Multiple Access / Collision Avoidance (CSMA / CA) protocols for media access. Under high load or network congestion, frequent collisions and subsequent random backoff mechanisms introduce significant and highly unstable queuing delays, making end-to-end packet delays unpredictable. This irregularity in delay is known as jitter. For applications that rely on synchronization and real-time control, such as robotic collaboration or motion control, communication must have sub-millisecond or even hundreds of microsecond delay upper bounds and extremely low jitter. Traditional Wi-Fi network jitter is typically in the millisecond range or higher, far from meeting the time-constrained requirements of industrial applications such as Time-Sensitive Networking (TSN). Although the IEEE 802.11e standard introduced traffic prioritization and transmission opportunity (TXOP) through Wireless Multimedia (WMM / EDCA), these mechanisms are still contention-based enhancements. EDCA only provides priority and bandwidth guarantees by adjusting contention window parameters; it cannot provide hard time gating or a deterministic delay upper bound. For example, even with Admission Control attempting to limit traffic, its performance remains susceptible to external interference (OBSS, Overlapping BSS), making microsecond-level deterministic scheduling impossible. Therefore, the existing 802.11 QoS mechanism and T2B (Time Synchronization Token Bucket) aim to achieve time determinism and time slot isolation, representing two fundamentally different QoS (Quality of Service) dimensions.
[0038] To address the deterministic nature of Wi-Fi, several proprietary or semi-proprietary pseudo-TDMA solutions, such as Soft-TDMAC or Det-WiFi, have emerged. However, these implementations often rely on specific chipsets, firmware modifications, or non-standard driver interfaces, resulting in extremely poor interoperability across vendors and hindering the formation of a unified standard on general-purpose Wi-Fi hardware. To overcome the shortcomings of existing technologies, this embodiment provides a communication system based on a TSF-synchronized token bucket Wi-Fi soft scheduling system. The core idea of this embodiment is to fully utilize the inherent high-precision TSF time synchronization function of Wi-Fi devices without modifying the IEEE 802.11 MAC layer protocol. Combined with an innovative token bucket gating mechanism strictly bound to TSF time, precise soft control of data packet transmission timing is achieved at the operating system kernel driver layer, thereby simulating deterministic TDMA communication effects on a competitive wireless channel. The core design logic of its overall technical architecture is reflected in three dimensions: (1) Time reference dimension: Through system-level error calibration and drift compensation, the theoretical microsecond-level accuracy of Wi-Fi native TSF is transformed into 50 microsecond-level accuracy in practical applications. A relative alignment accuracy of 200 μs between STAs provides a reliable time reference for deterministic scheduling; (2) Scheduling and control dimension: The traditional token bucket rate limiting function is transformed into a time and capacity dual gating function. The generation and consumption of tokens are strictly bound to the pre-allocated time slots to realize time slot scheduling of real-time traffic. (3) Conflict isolation dimension: Customize retransmission logic in the driver layer, and avoid polluting subsequent time slots by conflict transmission through limited retransmission + timeout pull-back mechanism, so as to ensure that scheduling determinism is not destroyed by the competition characteristics of the underlying CSMA / CA.
[0039] Based on the above logic, the system in this embodiment consists of three core modules, such as... Figure 1 As shown, the high-precision TSF synchronization module, the TSF synchronization token bucket gating module, and the driver-layer scheduling injection and conflict protection module work together to solve three key problems: time synchronization accuracy, scheduling permission control, and conflict isolation guarantee, thus achieving high deterministic communication. Specifically, TSF stands for Timing Synchronization Function, a core function defined in the IEEE 802.11 (Wi-Fi) standard, and a key hardware support for the T2B (TSF synchronization token bucket) soft scheduling system to achieve microsecond-level deterministic transmission. Specifically, the high-precision TSF synchronization module provides a unified time base with microsecond-level accuracy and handles system-level errors in Wi-Fi device time synchronization. The TSF synchronization token bucket gating module implements time-slotted scheduling of pseudo-TDMA through dual constraints of time and capacity, controlling the permission for data packets to enter the MAC layer; the driver-layer scheduling injection and conflict protection module implements low-latency transmission injection of authorized data packets and handles the disruption of scheduling determinism caused by MAC layer contention conflicts through a time-slot conflict isolation mechanism.
[0040] The TSF in this embodiment is a 64-bit high-precision timer that all Wi-Fi devices (including APs (access points) and STAs (terminal devices)) need to maintain. Its core characteristics are: (1) the timing granularity is fixed at 1μs (i.e., it increments by 1 every 1 microsecond), providing a natural microsecond-level precision basis for time synchronization; (2) it is the reference clock for time alignment between Wi-Fi devices, and realizes time synchronization between APs and STAs, and between STAs through a standardization mechanism. The core working mechanism of TSF includes: time broadcasting and calibration: APs will periodically broadcast their own TSF time through beacon frames; after receiving the beacon frame, STAs will use the TSF time published by APs to calibrate their local TSF timers to ensure that the local time is consistent with the AP's authoritative time. Synchronization accuracy guarantee: theoretically, a basic synchronization accuracy of less than 25μs can be achieved through the native TSF mechanism; with the subsequent combination of the error calibration mechanism of the T2B system, the relative alignment accuracy between STAs can be further improved to 50~200μs.
[0041] In one implementation, the high-precision TSF synchronization module of this embodiment serves as the time base generator for the entire system. Its core function is to provide a unified time base with microsecond-level accuracy and to handle system-level errors generated during Wi-Fi device time synchronization, ensuring that the time alignment accuracy between multiple STAs meets 50%. The design target is 200μs. This high-precision TSF synchronization module consists of a TSF reading unit and a delay calibration unit (including a fixed delay compensation unit and a clock drift management unit).
[0042] The TSF readout unit is used to read the hardware timer through the low-jitter interface of the driver layer and perform preliminary calibration based on the TSF time in the beacon frames periodically broadcast by the AP. Specifically, all Wi-Fi devices (including APs and STAs) compliant with the IEEE 802.11 protocol have a built-in 64-bit TSF timer, which increments at a fixed granularity of 1μs and forms the hardware basis for Wi-Fi's native time synchronization. The core task of the TSF readout unit is to obtain the accurate value of the TSF timer and perform preliminary calibration. The specific implementation process includes: (1) Low-latency interface selection and implementation: To avoid the non-deterministic latency introduced by the operating system application layer and network stack layer, the TSF readout unit is deployed in the HOST kernel driver layer, and directly accesses the WNIC's TSF hardware registers through the cfg80211 (Wi-Fi configuration interface under Linux system) or IOCTL (input / output control) interface. After optimization, this interface can reduce the instantaneous fluctuation of the readout latency (denoted as T). jitterThe time is controlled within 20μs, which is far better than the software time of 10. The jitter level is 50μs.
[0043] (2) Preliminary calibration logic: The AP broadcasts beacon frames at fixed intervals (usually 100ms). The beacon frame contains the AP's current TSF time (denoted as TSF_AP). After receiving the beacon frame, the STA's TSF reading unit immediately reads the value of the local TSF timer (denoted as TSF_STA_local) and performs preliminary calibration based on TSF_AP. The calibration formula is: TSF_STA_calib_initial = TSF_STA_local + (TSF_AP - TSF_STA_local_prev), where TSF_STA_local_prev is the local TSF reading when the beacon was last received. Through this preliminary calibration, the time deviation between the STA and the AP can be controlled within 25μs (compliant with the commercial accuracy standards of Wi-Fi devices).
[0044] (3) Reading frequency and timing control: To ensure the real-time performance of the time reference, the reading frequency of the TSF reading unit is set to 10kHz (i.e., read once every 100μs). This frequency can capture changes in TSF in a timely manner without consuming too many system resources due to excessively frequent hardware access. At the same time, the reading operation is synchronized with the Beacon frame reception timing, and the local TSF reading and preliminary calibration are completed within 10μs after the Beacon frame is received, reducing calibration delay.
[0045] The initial calibration of Wi-Fi's native TSF can only solve the basic synchronization problem between AP and STA. However, in practical applications, factors such as hardware interaction between HOST and WNIC and STA local crystal oscillator drift can introduce system-level errors. Without compensation, the time alignment accuracy between STAs will fail to meet design requirements. The delay calibration unit, through two sub-units—fixed delay compensation and clock drift management—can handle system-level errors in Wi-Fi device time synchronization, including eliminating static system errors and dynamic accumulated errors.
[0046] When the host operating system reads the TSF value of the WNIC hardware, a fixed, asymmetric systemic delay (denoted as T) is generated. offset,fixed This delay primarily stems from two parts: firstly, bus transmission delay (such as the data transmission time of SDIO or PCIe buses), and secondly, driver stack processing delay (the time it takes for the driver to return the reading result from receiving the reading command). offset,fixedIt has two key characteristics: (1) Asymmetry, that is, the delay of the host reading the TSF value of the WNIC is inconsistent with the delay of the WNIC sending the TSF value to the host. (2) Model dependence, the TSF value of WNICs from different manufacturers and different models is inconsistent. offset,fixed The numerical values vary considerably, typically on the order of 10 μs (ranging from 5 μs). (Between 20μs). Without compensation, this delay will cause a fixed deviation between the TSF value read by the STA and the actual physical time, severely affecting synchronization accuracy.
[0047] Specifically, the delay calibration unit in this embodiment includes a fixed delay compensation unit and a clock drift management unit. The fixed delay compensation unit measures and stores the fixed offset of the current WNIC hardware, and calculates accurate physical time, either offline or during system startup, to eliminate the nondeterministic errors introduced by the interaction between the protocol stack and the hardware. In practical applications, the specific implementation steps of the fixed delay compensation unit include the following: Step 1: Offline calibration phase (performed when the device is shipped from the factory or when the system is first started) Step 1.1: Set up the calibration test environment: Connect the WNIC device to be calibrated to a high-precision time synchronization source (such as GPS discipline doscillator, GPSDO, accuracy ≤1μs) to ensure that the time of the time synchronization source is consistent with the physical time; Step 1.2: Trigger TSF reading and time recording: Send a TSF reading command to WNIC through the reading interface of the HOST kernel driver layer, and simultaneously record the current physical time of the time synchronization source (denoted as T). phy,true ); Step 1.3: Obtain the raw TSF value from the WNIC: Receive the raw TSF reading returned by the WNIC (denoted as T). HOST,read ); Step 1.4: Calculate the fixed delay Toffset, fixed: Since the time synchronization source time is consistent with the physical time, and the transmission delay of the reading command is negligible (the test environment is a wired connection), therefore Toffset is fixed. offset,fixed =T HOST,read -T phy,true ; Step 1.4: Store the calibration results: Store the calculated T offset,fixed It is associated with the hardware model and firmware version of the WNIC and stored in the host's non-volatile memory (such as EEPROM) for use in the real-time compensation phase.
[0048] Step 2: Real-time compensation phase (executed in real-time during system operation) Each time the TSF reading unit acquires T HOST,readAfter (the TSF reading after initial calibration), the fixed delay compensation unit reads the TSF corresponding to the current WNIC from the memory. offset,fixed And combined with residual jitter T jitter,residual (Instantaneous jitter that is not completely eliminated during the reading process, typically ≤5μs), the accurate physical time base is calculated using the following formula: T TSF,true =T HOST,read T offset,fixed T jitter,residual ; in, jitter,residual The standard deviation of the reading delay was obtained through statistical methods: during system operation, the standard deviation of the reading delay was calculated every 1000 readings, and half of this standard deviation was taken as the mean. jitter,residual The dynamic value ensures the real-time nature and accuracy of the compensation.
[0049] Through offline calibration and real-time compensation, the system-level fixed error of the HOST reading TSF value can be reduced from the order of 10μs to less than 1μs, laying the foundation for high-precision alignment between STAs in the future.
[0050] The STA's local TSF timer is driven by a built-in crystal oscillator, which inherently exhibits drift characteristics (typical drift rate ±10ppm, or ±10 seconds per megasecond). Even with fixed delay compensation, accumulated errors will still develop between the STA's local TSF and the AP's TSF after long-term operation. Without compensation, this error will increase over time, eventually causing the time alignment accuracy between STAs to exceed 50%. The 200μs design range disrupts scheduling determinism. Therefore, the clock drift management unit in this embodiment continuously monitors the TSF time in the beacon frames periodically broadcast by the AP and dynamically compensates for the accumulated error caused by local crystal oscillator drift. This embodiment's clock drift management unit implements a rate and offset correction algorithm (similar to a PTP+PI controller). By periodically monitoring the TSF time in the AP Beacon frames, it dynamically compensates for the accumulated error caused by local crystal oscillator drift. Experiments have shown that by using a TSF hardware counter to simulate the PTP clock, an average error and standard deviation of less than 1μs can be achieved. The error compensation mechanism is shown in Table 1 below.
[0051] Table 1
[0052] To ensure reading delay fluctuation T jitterFor latency less than 20μs, the high-precision TSF synchronization module in this embodiment must be located in the kernel driver layer and access the TSF hardware registers with low latency through the cfg80211 or IOCT interface to minimize the nondeterministic jitter introduced by the operating system and application layer.
[0053] The specific implementation process is as follows: Step 1: Drift monitoring period setting. Considering the cumulative characteristics of crystal oscillator drift and the broadcast period of Beacon frames, the drift monitoring period is set to be consistent with the Beacon frame broadcast period (100ms). This ensures that drift detection and compensation are performed every time a Beacon frame is received, which can capture drift trends in a timely manner without increasing system overhead.
[0054] Step 2: Drift Calculation. Let the AP's TSF time be TSF_AP(k) when the k-th Beacon frame is received, and the STA's local physical time after fixed delay compensation be TTSF,true(k). Then the drift ΔT(k) detected in the k-th frame is: ΔT(k) = T TSF,true(k) -TSF_AP(k) where ΔT(k) is positive, indicating that the STA local time is ahead of the AP time; ΔT(k) is negative, indicating that the STA local time is behind the AP time.
[0055] Step 3: PI Controller Parameter Design and Correction Logic. This embodiment uses a proportional-integral (PI) controller to correct the drift. The output of the PI controller is the rate correction coefficient K(k) of the TSF timer, used to adjust the increment rate of the local TSF timer (the native rate is 1 μs / cycle). The specific formula is as follows: K(k) = Kp × ΔT(k) + Ki × ∫ΔT(τ)dτ (τ ranges from 0 to k), where Kp is the proportional coefficient, with a value range of 0.1. 0.3 is used for rapid response to the current drift amount, reducing instantaneous errors; Ki is the integral coefficient, with a value range of 0.01. 0.05 is used to eliminate long-term accumulated errors and ensure steady-state accuracy.
[0056] The correction logic is as follows: adjust the increment rate of the local TSF timer to 1μs / time × K(k), and gradually compensate for the drift by changing the rate. For example, when ΔT(k) = 50 μs (STA leads by 50 μs), Kp = 0.2, Ki = 0.02, and the integral sum of the first k drifts is 200 μs, K(k) = 0.2 × 50 + 0.02 × 200 = 10 + 4 = 14. At this time, the increment rate of the local TSF timer is adjusted to 1 μs / time × (1 - 0.0014) = 0.9986 μs / time (the lead error is gradually eliminated by reducing the rate); when ΔT(k) = -30 μs (STA lags by 30 μs), K(k) = 0.2 × (-30) + 0.02 × (-150) = -6 - 3 = -9. At this time, the increment rate of the local TSF timer is adjusted to 1 μs / time × (1 + 0.0009) = 1.0009 μs / time (the lag error is gradually eliminated by increasing the rate).
[0057] Step 4: Drift Compensation Stability Control. To avoid overshoot or oscillation during the calibration process, a limit is set for the rate calibration coefficient: 0.999≤K(k)≤1.001, meaning the rate adjustment amplitude of the local TSF timer does not exceed ±0.1%. Simultaneously, when the absolute value of the drift ΔT(k) is less than 5μs, the PI controller calibration operation is paused, and only drift monitoring is performed to avoid time jitter caused by overcalibration.
[0058] Furthermore, the TSF Synchronization Token Bucket (T2B) gating module in this embodiment serves as the scheduling authority controller for the entire system. Its core function is to achieve time-slotted scheduling of pseudo-TDMA through dual constraints of time and capacity, strictly controlling the access rights of data packets to the MAC layer, and ensuring that only real-time data packets that conform to the scheduling rules can participate in channel contention. This module consists of a Slot Allocation Table (SAM) parsing unit, a token generation unit bound to the TSF, and a scheduling gating logic unit.
[0059] Specifically, the AP, acting as the central scheduler, is responsible for calculating and broadcasting the Slot Allocation Map (SAM) based on factors such as the number of STAs in the network, real-time traffic demand, and channel bandwidth. The SAM forms the basis of the scheduling rules for the entire system. The core task of the Slot Allocation Map parsing unit is to receive and parse the SAM, extract scheduling parameters related to the current STA, and provide a basis for subsequent gating logic. The SAM is broadcast as an extended field of the Beacon frame (without affecting the format of the standard Beacon frame, ensuring compatibility).
[0060] The time slot allocation table parsing unit in this embodiment is used to receive the time slot allocation table broadcast by the AP as the central scheduler, and parse the scheduling period and the current STA's scheduled transmission time slot. The specific implementation process is as follows: Step 1: The SAM receiving and filtering time slot allocation table parsing unit listens to the Beacon frames broadcast by the AP, identifies SAM data by parsing the extended fields of the Beacon frames (filtered by version number 0x01), and ignores standard Beacon frames that do not contain SAM.
[0061] Step 2: Integrity verification uses the CRC16 algorithm to verify the received SAM data. If the verification fails, the SAM is discarded and the previously successfully parsed SAM is reused (to ensure scheduling continuity); if the verification succeeds, the next parsing step is performed.
[0062] Step 3: Parameter Extraction and Storage - Parsing the Scheduling Period T in SAM cycle The number of STAs is N, and then the scheduled transmission time slot T is determined based on the identifier of the current STA (pre-stored locally). slot,i Next, extract the corresponding time slot start time T. start,i and time slot duration T duration,i And calculate the time slot end time T. end,i =T start,i +T duration,i These parameters are stored in the driver layer's cache (access latency ≤ 1μs) for real-time access by the scheduling gating logic unit.
[0063] Step 4: SAM Update Mechanism. The AP rebroadcasts the SAM every 10 Beacon frame cycles (i.e., 1 second), supporting dynamic adjustment of time slot parameters based on network traffic changes. After receiving and successfully resolving the new SAM, the time slot allocation table parsing unit will update it in the next scheduling cycle T. cycle New timeslot parameters are enabled at the beginning to avoid packet loss caused by parameter mutations during scheduling.
[0064] The core of the traditional token bucket algorithm is rate limiting, where tokens are generated at a fixed rate to control the transmission rate of data packets. The core innovation of the token generation unit in this invention lies in the fact that token consumption authorization is strictly limited to the HP-TSF time. The T2B gating logic in this embodiment ensures that only tokens that meet the time condition (T...) are allowed to be consumed. start,i ≤T current <T start,i +T duration,i Only when traffic is within the specified range (e.g., T) can it be considered "conformant" and consume tokens. start,i Otherwise, TBC remains stationary or operates at a very low rate. In T... start,i At the start, TBC is instantly replenished to the preset bucket depth B, thereby authorizing STA to perform burst transmissions within its exclusive time slot.
[0065] The design and implementation of the token generation unit in this embodiment are as follows: Step 1: Design of Token Bucket Core Parameters The core parameters of the token bucket include the token bucket depth B and the token consumption rule, and their design must be closely matched with the time slot parameters and channel bandwidth. Token bucket depth B: Represents the maximum amount of data (in bytes) allowed to be transmitted within a single time slot. Its design formula is B≈Rmax×T duration,i Where Rmax is the maximum transmission rate of the wireless channel (unit: bytes / μs), T duration,i This is the current time slot duration (in μs) for the STA. For example, if the maximum channel transmission rate Rmax = 1 MB / s = 1 byte / μs (8 Mbps), the time slot duration T... duration,i =2000μs, then the token bucket depth B≈1×2000=2000 bytes, ensuring that the maximum burst traffic can be transmitted in a single time slot.
[0066] Token unit: 1 token corresponds to 1 byte of data. The number of tokens consumed is equal to the size of the data packet (unit: bytes), ensuring the accuracy of capacity checks.
[0067] Step 2: Token Generation and Reset Logic The core feature of the token generation unit is "slot-triggered token replenishment," rather than traditional fixed-rate generation. The specific logic is as follows: Token Bucket Initialization: When the system starts, the token bucket counter (TBC) is initially set to 0, indicating a "no token" state. Time slot start trigger supplementation: When the current physical time T provided by the high-precision TSF synchronization module... current Reaching the current STA's slot start time T start,i At that time, the token generation unit immediately replenishes the TBC to the preset token bucket depth B, authorizing burst transmission within that time slot; Token consumption within a time slot: in time slot T start,i (T) start,i ≤T current <T start,i +T duration,i Within the time slot, for each data packet transmitted, the TBC is reduced by the size of that data packet (number of bytes) until the TBC is 0 or the time slot ends; Slot end token reset: When Tcurrent reaches the slot end time Tend,i, regardless of whether there are any remaining tokens in TBC, TBC will be reset to 0, prohibiting token consumption outside of this slot and ensuring that tokens are only valid within the pre-allocated slot.
[0068] Step 3: Time synchronization guarantee for token generation To ensure strict synchronization between token replenishment and time slot start time, the token generation unit and the high-precision TSF synchronization module employ an interrupt-triggered mechanism: when T... current Reaching T start,i At this time, the high-precision TSF synchronization module sends an interrupt signal to the token generation unit. The token generation unit completes the TBC supplementation operation in the interrupt response. The interrupt response delay is ≤1μs, ensuring that the time deviation between token supplementation and the start of the time slot is less than 1μs, thus avoiding scheduling errors caused by synchronization deviation.
[0069] Furthermore, the scheduling gating logic unit in this embodiment is used to authorize data packets to enter the MAC layer's transmission queue through dual judgment conditions. Specifically, the scheduling gating logic unit is the core execution unit of the TSF synchronization token bucket gating module. Its function is to perform dual condition checks on real-time data packets arriving at the driver layer. Only data packets that simultaneously meet both judgment conditions are allowed to enter the MAC layer's transmission queue. Specifically, the dual judgment conditions include: a time judgment condition and a capacity judgment condition; wherein, the time judgment condition is used to determine whether the current calibrated time is within the predetermined transmission time slot allocated by the AP to the STA; the capacity judgment condition is used to determine whether the number of tokens in the token bucket counter is greater than or equal to the size of the data packet to be transmitted. This is represented as follows: 1. Time condition: The current high-precision TSF synchronization module calibration time T. current In the scheduled T slot,i Inside the window.
[0070] 2. Capacity requirement: Token Bucket Counter (TBC) ≥ Packet Size (there are enough tokens for transmission).
[0071] The specific implementation includes the following steps: Step 1: Time condition check - retrieve the current physical time T provided by the high-precision TSF synchronization module. current And the current STA time slot parameters (T) extracted by the SAM parsing unit. start,i T end,i ), determine T current Does it satisfy: T start,i ≤ T current <T end,i .
[0072] If not satisfied: The data packet is cached to the temporary cache queue in the driver layer (the cache queue capacity is 100 data packets, and the excess is discarded), and wait for the next time slot belonging to this STA to check again; If satisfied: Proceed to the second step of capacity condition check.
[0073] Second step: Capacity condition check Retrieve the value of the token bucket counter TBC of the token generation unit, and determine whether TBC is greater than or equal to the size of the current data packet (Packet Size).
[0074] If not satisfied (TBC < Packet Size): The data packet is marked as "non-compliant data packet" and processed according to the configuration policy (the default policy is to discard, and it can be configured to cache to the next time slot); If satisfied (TBC ≥ Packet Size): The data packet obtains transmission authorization, TBC subtracts Packet Size (update the remaining number of tokens), and pass the data packet to the driver layer scheduling injection and collision protection module.
[0075] To ensure that the double check does not introduce additional latency, the scheduling gating logic unit uses hardware-assisted acceleration: Store parameters such as T current , T start,i , T end,i , TBC, Packet Size, etc. in the dedicated registers of the WNIC, perform comparison operations through hardware logic, and the latency of the entire check process ≤ 2μs, which is much less than the time slot duration (usually in the ms level) and will not affect the real-time nature of scheduling.
[0076] The token bucket depth B of this embodiment must be precisely designed to accommodate the maximum burst volume within a single T slot , so as to ensure that the transmission of the STA does not exceed its time boundary. Precise setting of the B value is the key to preventing competition in adjacent time slots. The B value determines the tolerance of the T2B system to instantaneous burst traffic and the tolerance to the underlying TSF time jitter. Considering the TSF alignment accuracy ΔT sync (such as 200μs) between STAs, the allocated T slot ]] must include sufficient protection time margin to absorb synchronization errors and ensure the reliability of time slot isolation. The key scheduling parameters and calculations of the T2B in this embodiment are shown in Table 2.
[0077] Table 2
[0078] Specifically, refer to Figure 2As shown in the figure, this embodiment corresponds to the Wi-Fi soft scheduling system based on TSF synchronization token bucket. Figure 2 The T2B soft scheduling module in the middle. Figure 2 This illustration demonstrates the location of the Wi-Fi soft scheduling system based on TSF synchronization token buckets within the host kernel, and its interactions with the network stack, TSF synchronization module, driver interface, and MAC layer. The TSF synchronization token bucket gating module must be deployed at the host system's kernel driver layer, for example, between the Linux network stack and the WNIC driver. This location ensures low-latency access to the TSF count and direct control over the MAC layer contention queue. T2B utilizes the cfg80211 or IOCTL interface to intercept and control the transmission queue, injecting packets into the MAC layer when time and capacity conditions are met.
[0079] Furthermore, the driver-layer scheduling injection and conflict protection module in this embodiment is the "execution and guarantee unit" of the entire system. Its core function is to inject data packets authorized by the T2B gating module into the MAC layer transmission queue with low latency, and to isolate the impact of conflicts on scheduling determinism through a customized conflict handling mechanism, ensuring that the contention characteristics of the underlying CSMA / CA do not disrupt the time-slotted scheduling of the upper layer. This module consists of a MAC queue injector and a time-slot protection unit.
[0080] The MAC queue injector is used to push data packets authorized by the TSF synchronization token bucket gating module into the MAC layer transmission queue driven by the WNIC hardware with low latency, reducing latency loss in intermediate links and ensuring that data packets can participate in channel contention within pre-allocated time slots. Its implementation details are as follows: 1. Queue selection and priority configuration The MAC layer of a WNIC typically contains multiple transmit queues (such as EDCA queues: VO, VI, BE, BK). To ensure the transmission priority of real-time data packets, the MAC queue injector pushes authorized real-time data packets into the highest priority VO (Voice) queue. This queue has the shortest queue scheduling delay and the highest channel access priority, avoiding competition for queue resources with non-real-time data packets.
[0081] 2. Low-latency injection mechanism To reduce injection latency, the MAC queue injector employs Direct Memory Access (DMA) technology to achieve direct data transfer between the driver layer cache and the MAC layer transmission queue, bypassing CPU intervention. The specific process is as follows: Step 1: Authorization packet buffer: Data packets transmitted through the TSF synchronization token bucket gating module are stored in the DMA buffer of the driver layer (contiguous addresses, 4KB in size). Step 2: DMA Channel Configuration: Configure the DMA channel of WNIC using the MAC queue injector and establish the mapping relationship between the DMA buffer and the MAC layer VO queue; Step 3: Direct Injection Trigger: When the data packet meets the transmission authorization conditions, the MAC queue injector sends a DMA transmission command. The WNIC directly writes the data packet from the driver layer buffer to the MAC layer VO queue through the DMA channel. The delay of the entire injection process is ≤5μs.
[0082] 3. Optimization of injection timing The injection timing of the MAC queue injector is synchronized with the check results of the TSF synchronous token bucket gating module: Once a data packet passes the double-condition check, the DMA injection operation is triggered immediately to avoid delays caused by the data packet remaining in the driver layer buffer. Simultaneously, the injection operation is coordinated with the time slot start time: for data packets arriving at the start of the time slot, the injection operation is performed at T... start,i Completed within +1μs, ensuring that data packets can participate in channel contention in a timely manner.
[0083] Although real-time data packets are injected into the highest priority queue at the MAC layer, they may still collide with other devices (such as Wi-Fi devices not participating in T2B scheduling) due to the shared nature of wireless channels. The exponential backoff retransmission strategy of traditional CSMA / CA mechanisms can cause data packets to continuously occupy the channel after a collision, polluting subsequent time slots and disrupting scheduling determinism. A time slot protection unit is used for data packet retransmission logic to achieve "collision isolation," ensuring that conflicted transmission does not affect the scheduling of subsequent time slots. The retransmission logic in this embodiment includes: retransmission timing constraints, a timeout forced pull-back mechanism, and buffered retry. Specifically, the retransmission timing constraints limit the number of retransmission attempts and the backoff time when a data packet needs to be retransmitted due to a MAC layer collision, ensuring that all retransmission operations are completed within the duration of the current time slot. The timeout forced pull-back mechanism forcibly removes the data packet from the MAC queue when the current time slot ends and the data packet has not yet been successfully transmitted. The buffered retry buffers the forcibly pulled-back data packet and waits for the next transmission time slot belonging to the STA to resubmit the transmission request.
[0084] In its specific implementation, this embodiment employs triple customization when defining retransmission timing constraints, strictly limiting retransmission operations to the current time slot. Specifically, this includes the following: Customization 1: Retransmission Limit. The standard CSMA / CA mechanism typically allows 7 retransmissions (802.11n protocol), while the time slot protection unit limits the maximum number of retransmissions for real-time data packets to 3, preventing excessive retransmissions from consuming time slot resources. The retransmission counter is initialized to 0 when the data packet is first injected into the MAC layer transmission queue. The counter increments by 1 for each retransmission, and stops retransmission when the counter reaches 3.
[0085] Customization 2: Backoff Time Constraint. The standard CSMA / CA mechanism uses the Binary Exponential Backoff Algorithm (BEB), where the backoff time increases exponentially with the number of retransmissions (e.g., the backoff time for the first retransmission is 0). 1 time slot, second time 0 (3 time slots, and so on), which may cause the backoff time to exceed the current time slot. The time slot protection unit imposes dual constraints on the backoff time, including: Maximum backoff time limit: The maximum backoff time is half of the remaining time in the current time slot, i.e., backoff time ≤ (T end,i -T current ) / 2, to ensure that the retransmission operation has enough time to complete; Backoff time step adjustment: The backoff time step value is fixed at 10μs, instead of the standard time slot time (usually 9μs), which simplifies the calculation and ensures the controllability of the backoff time.
[0086] Customization 3: Retransmission Initiation Timing Restriction. Retransmission can only be initiated if the remaining time in the current time slot is greater than the minimum retransmission time required. The minimum retransmission time = data packet transmission time + minimum backoff time (10μs). If the remaining time in the current time slot is less than this minimum, retransmission is abandoned to prevent the time slot from ending during the retransmission process.
[0087] In this embodiment, the timeout forced pull-back mechanism works by the time slot protection unit continuously monitoring the current physical time T during the retransmission of real-time data packets. current With time slot end time T end,i The relationship is as follows: If T current <T end,i And the retransmission limit has not been reached: continue retransmission is allowed; If T current ≥ T end,i (Time slot ends) or the retransmission count reaches the limit: immediately execute the "force pull back" operation, remove the data packet from the VO queue through the queue control interface of the MAC layer, and cache it in the retransmission queue of the driver layer, waiting for the next time slot belonging to the STA to resubmit the transmission request.
[0088] The forced pullback operation has a delay of ≤3μs to ensure that data packets do not continue to occupy the channel after the time slot ends. For example, if a data packet in STA-1 collides at 11950μs, the backoff time required for retransmission is 60μs, while the time slot ends at 12000μs. At this time, T... current + Retreat time = 12010μs > T end,i The time slot protection unit immediately forces the data packet back to avoid it occupying the 13000μs initial time slot of STA-2.
[0089] To quickly detect conflicts and trigger the protection mechanism, the time slot protection unit in this embodiment adopts a "dual conflict detection" strategy: Hardware collision detection: Utilizing the physical layer collision detection function of WNIC, when a busy channel is detected, the time slot protection unit is immediately notified; ACK timeout detection: If an ACK frame is not received from the receiver within the preset ACK timeout period (usually 100μs) after a real-time data packet is sent, it is determined to be a collision.
[0090] The two detection methods are executed in parallel, with a collision detection delay of ≤10μs, ensuring that the time slot protection unit can respond to collisions in a timely manner and perform retransmission or forced pull-back operations.
[0091] This embodiment provides a Wi-Fi soft scheduling system based on TSF (Telegraphic Token Bucket) synchronization, aiming to solve the core problems of standard Wi-Fi's inherent CSMA / CA (Carrier Sense Multiple Access / Collision Avoidance) contention mechanism, which cannot provide time determinism guarantees, and existing deterministic communication schemes, such as strong hardware dependence, poor interoperability, and high deployment costs. This invention constructs a hybrid mechanism of high-precision time alignment and time-gated scheduling on top of the standard IEEE 802.11 protocol stack. Without modifying the underlying MAC layer protocol and maintaining CSMA / CA compatibility, it achieves 50° / 10 ... With 200μs-level time alignment, this invention provides time-slice reservation services for real-time traffic, ultimately achieving bounded latency and low jitter communication effects similar to TDMA (Time Division Multiple Access). It is suitable for scenarios with stringent requirements for communication determinism, such as Industrial IoT, IoV (Internet of Vehicles), high-performance multimedia transmission, and distributed control. In practical applications, such as IoV communication, the reliability and determinism of real-time safety information are crucial. This invention, through precise time gating, ensures that critical safety messages are sent within predetermined, conflict-free time slots, significantly improving communication reliability and efficiency in congested environments and contributing to traffic efficiency and road safety goals. For applications requiring multi-device collaboration and data fusion, such as 3D view synthesis based on multiple synchronized cameras or UAV swarm control, the microsecond-level time synchronization provided by this invention is key to achieving precise coordination. Time-slice reservation also provides guaranteed quality of service for demanding real-time multimedia traffic, ensuring low latency and low jitter, and improving user experience.
[0092] The Wi-Fi soft scheduling system based on TSF synchronized token bucket in this embodiment can be applied to various Wi-Fi communication devices, including access points (APs) as central schedulers and stations (STAs) as terminal nodes, such as industrial robot controllers, vehicle communication modules, high-definition cameras, drone control terminals, and smart sensors.
[0093] The Wi-Fi soft scheduling system based on TSF synchronization token bucket in this embodiment cleverly utilizes the hardware timing capabilities of IEEE 802.11TSF to implement the core functions of TDMA at the software level, while maintaining full compatibility with standard Wi-Fi protocols, and includes at least the following advantages: (1) Time-gated token bucket mechanism: The core innovation of this embodiment lies in creatively transforming the traditional token bucket algorithm used for traffic rate limiting into a transmission authorization gating driven by microsecond-level TSF time. The token consumption permission is strictly bound to a precise time window, realizing soft control over the transmission timing of the underlying hardware at the software layer, achieving time slot isolation effect, which is a deterministic guarantee that traditional Token Bucket cannot achieve.
[0094] (2) System-level TSF accuracy enhancement and calibration model: This embodiment solves the fundamental problem that COTS WiFi hardware cannot directly obtain high-precision alignment time in actual systems by accurately modeling and offline calibrating the fixed systematic delay and clock drift generated during HOST-WLAN TSF interaction, and compensating for them with online rate correction. This enhancement technology enables 50-second TSF accuracy enhancement between multiple STAs. A key breakthrough in 200μs-level time alignment.
[0095] (3) Standard-compatible time slot conflict protection mechanism: This embodiment designs a limited retransmission and forced pull-back mechanism implemented in the driver layer and bound to the current time slot, which cleverly solves the conflict handling problem under the premise of maintaining CSMA / CA compatibility and effectively protects the determinism of pseudo-TDMA scheduling.
[0096] This invention is fully compatible with existing 802.11 protocols and COTS Wi-Fi chipsets, avoiding interoperability issues and high hardware customization costs associated with modifications to the proprietary MAC layer. It provides a low-cost, scalable solution for applications with stringent deterministic requirements, as shown in Table 3, which compares the traditional CSMA / CA mechanism with the pseudo-TDMA mechanism of this invention.
[0097] Table 3
[0098] The modules in the communication system of the aforementioned Wi-Fi soft scheduling system based on TSF synchronization token bucket can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of the terminal in hardware form or independent of it, or stored in the memory of the terminal in software form, so that the processor can call and execute the corresponding operations of each module.
[0099] Based on the above embodiments, the present invention also provides a communication method for a Wi-Fi soft scheduling system based on a TSF synchronization token bucket. This communication method for a Wi-Fi soft scheduling system based on a TSF synchronization token bucket can be applied to, for example... Figure 3 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104, or it can be located in the cloud or on other network servers. The communication method of the Wi-Fi soft scheduling system based on TSF synchronized token bucket can be executed by terminal 102 or server 104, or it can be executed collaboratively by terminal 102 and server 104.
[0100] The terminal 102 can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, IoT device, or portable wearable device. IoT devices can include smart speakers, smart TVs, smart air conditioners, and smart in-vehicle devices, etc. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted devices, etc.
[0101] Server 104 can be an independent physical server, a cloud server, or a service node in a blockchain system, where the service nodes in the blockchain system form a peer-to-peer network.
[0102] In addition, server 104 can also be a server cluster consisting of multiple physical servers, which can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0103] Terminal 102 and server 104 can be connected via Bluetooth, USB (Universal Serial Bus) or network, etc., and this application does not impose any restrictions.
[0104] In some embodiments, such as Figure 4 As shown, a communication method for a Wi-Fi soft scheduling system based on TSF (Telegram Token Bucket) synchronization is provided. This method can be applied to a terminal, such as a computer or other intelligent product terminal. Specifically, the method includes the following steps: Step S100: When the real-time data packet arrives at the driver layer, the high-precision TSF synchronization module is called to obtain the calibrated, high-precision current TSF time. Step S200: Based on the TSF synchronization token bucket gating module, check the time slot allocation table and check the relationship between the token bucket counter and the data packet to obtain the check result, and process the data packet based on the check result; Step S300: After the data packet is authorized, the driver layer scheduling injection and conflict protection module injects the data packet into the MAC layer transmission queue, and processes the data packet based on the preset retransmission logic when a conflict occurs and retransmission is required.
[0105] In practical applications, after all STAs boot, the high-precision TSF synchronization module in their kernel driver begins operation. The module first performs an offline calibration, measuring the system latency T of this WNIC model. offset,fixed The time is approximately 10 μs and stored. Subsequently, the module continuously performs TSF synchronization based on the AP's Beacon and uses a rate correction algorithm to adjust the relative time alignment accuracy ΔT between all STAs. sync The time stabilizes within 50μs. Next, the AP calculates and broadcasts the SAM based on service requirements, allocating a predetermined transmission time slot (duration T) with a TSF time tail in the micrometer range to STA-1 (representing the terminal device identified as STA-1). slot =2ms), allocating a micrometer-level time slot to STA-2 (representing the terminal device identified as STA-2). Furthermore, when STA-1 has a data packet to send, its T2B module obtains the currently calibrated TSF time.
[0106] Next, this embodiment can check the time slot allocation table and the relationship between the token bucket counter and data packets based on the TSF synchronization token bucket gating module to obtain the check results. Specifically, as follows... Figure 5 The steps shown are as follows: Step S201: Based on the TSF synchronization token bucket gating module, check the time slot allocation table to determine whether the current TSF time is in the predetermined transmission time slot allocated to the STA, and obtain the first check result; Step S202: Based on the TSF synchronization token bucket gating module, check whether the token bucket counter can accommodate the data packet to obtain the second check result.
[0107] In other words, the check results in this embodiment include a first check result and a second check result. The first check result is obtained by checking the time slot allocation table based on the TSF synchronization token bucket gating module to determine whether the current TSF time is within the predetermined transmission time slot allocated to the STA. If the first check result indicates that the current TSF time is not within the predetermined transmission time slot, the data packet is discarded. If the first check result indicates that the current TSF time is within the predetermined transmission time slot, the data packet continues to be transmitted. The second check result in this embodiment is obtained by comparing the number of tokens in the token bucket counter with the size of the data packet. If the second check result indicates that the number of tokens in the token bucket counter is less than the size of the data packet, the data packet is considered non-compliant; if the second check result indicates that the number of tokens in the token bucket counter is greater than or equal to the size of the data packet, it means that there are sufficient tokens, and the data packet continues to be transmitted.
[0108] Furthermore, once the data packet is authorized, the driver-layer scheduling injection and conflict protection module can inject the data packet into the MAC layer transmission queue, and when a conflict occurs and retransmission is required, the data packet is processed based on preset retransmission logic. In specific applications, such as... Figure 6 The steps shown are as follows: Step S301: When a collision occurs and retransmission is required, determine whether the current retransmission time is within the duration of the predetermined transmission time slot based on the time slot protection unit. Step S302: If the data packet is not successfully transmitted when the current time slot ends, the data packet is forcibly pulled back and waited for the next time slot to retry.
[0109] Combination Figure 7 As shown, when a data packet arrives, the calibrated TSF time is read, followed by a time check to determine if the calibrated TSF time is within the scheduled transmission time slot. If not, the data packet is delayed or dropped. If it is within the scheduled transmission time slot, a token capacity check is performed to determine if the number of tokens is greater than or equal to the data packet size. If not, the data packet is delayed or dropped. If yes, the data packet is injected into the MAC layer transmission queue, consuming the corresponding tokens. Then, CSMA / CA contention transmission is initiated. If an ACK is successfully received, the transmission is successful. If a collision occurs, time slot protection is performed, checking if the current retransmission time is within the duration of the scheduled transmission time slot. If not, the data packet is forcibly pulled back or dropped. If it is, the data packet is retransmitted.
[0110] In practical applications, after all STAs boot, the high-precision TSF synchronization module in their kernel driver begins operation. The module first performs an offline calibration, measuring the system latency T of this WNIC model. offset,fixedThe time is approximately 10 μs and stored. Subsequently, the module continuously performs TSF synchronization based on the AP's Beacon and uses a rate correction algorithm to adjust the relative time alignment accuracy ΔT between all STAs. sync The time stabilizes within 50μs. Next, the AP calculates and broadcasts the SAM based on service requirements, allocating a predetermined transmission time slot (duration T) with a TSF time tail in the micrometer range to STA-1 (representing the terminal device identified as STA-1). slot =2ms), and a micrometer-level time slot is allocated to STA-2 (representing the terminal device identified as STA-2). For example, when STA-1 has a data packet to send, its T2B module obtains the current calibrated TSF time as 9950μs. If the calibrated time is not within the scheduled transmission time slot, it is discarded. If the calibrated TSF time reaches 10000μs, then the calibrated time is within the scheduled transmission time slot. At the same time, the token bucket is instantly replenished with enough tokens to send the maximum amount of data within 2ms. At this time, the number of tokens is greater than the size of the data packet, so the data packet can be injected into the MAC layer transmission queue. Assuming a collision occurs at 10500μs, the time slot protection module of the driver layer initiates retransmission. Since the current time is far from the end of the 12000μs time slot, retransmission is allowed. Assuming another data packet collides at 11950μs, a longer backoff time is required. The time slot protection module detects that the time after the backoff ends will exceed 12000μs, meaning that the data packet has not been successfully transmitted by the end of the current time slot. In this case, it immediately stops the transmission of the data packet and pulls it back into the queue. This avoids the transmission behavior of STA-1 "dragging out," thus protecting STA-2 from interference in the time slot starting at 13000μs, ultimately achieving the invention's objective of achieving time slot isolation and deterministic guarantees on a contentious network.
[0111] In some embodiments, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 8As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a communication method for a Wi-Fi soft scheduling system based on a TSF synchronized token bucket. The display unit of the computer device is used to form a visually visible image. It can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.
[0112] Those skilled in the art will understand that Figure 8 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0113] In some embodiments, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps: When real-time data packets arrive at the driver layer, the high-precision TSF synchronization module is invoked to obtain the calibrated, high-precision current TSF time. The time slot allocation table is checked based on the TSF synchronous token bucket gating module, and the relationship between the token bucket counter and the data packet is checked to obtain the check results. The data packet is then processed based on the check results. Once the data packet is authorized, the driver layer scheduling injection and conflict protection module injects the data packet into the MAC layer transmission queue, and processes the data packet based on preset retransmission logic when a conflict occurs and retransmission is required.
[0114] It should be noted that the user information (including but not limited to user device function information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0115] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0116] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0117] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
[0118] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A Wi-Fi soft scheduling system based on TSF synchronized token bucket, characterized in that, The system includes: A high-precision TSF synchronization module is used to provide a unified time base with microsecond-level accuracy and to handle system-level errors in time synchronization of Wi-Fi devices; The TSF synchronous token bucket gating module is used to implement time-slotted scheduling of pseudo-TDMA through dual constraints of time and capacity, and to control the permission of data packets to enter the MAC layer. The driver layer scheduling injection and conflict protection module is used to implement low-latency transmission injection of authorized data packets and to handle the disruption of scheduling determinism caused by MAC layer contention conflicts through a time slot conflict isolation mechanism.
2. The Wi-Fi soft scheduling system based on TSF synchronization token bucket according to claim 1, characterized in that, The high-precision TSF synchronization module includes: The TSF reading unit is used to read the hardware timer through the low-jitter interface of the driver layer and perform preliminary calibration based on the TSF time in the beacon frames periodically broadcast by the AP. The delay calibration unit is used to handle system-level errors in time synchronization of Wi-Fi devices.
3. The Wi-Fi soft scheduling system based on TSF synchronization token bucket according to claim 2, characterized in that, The delay calibration unit includes: The fixed delay compensation unit is used to measure and store the fixed offset of the current WNIC hardware when offline or during system startup, and to calculate the accurate physical time to eliminate the nondeterministic errors introduced by the interaction between the protocol stack and the hardware. The clock drift management unit is used to continuously monitor the TSF time in the beacon frames periodically broadcast by the AP and dynamically compensate for the accumulated error caused by local crystal oscillator drift.
4. The Wi-Fi soft scheduling system based on TSF synchronization token bucket according to claim 3, characterized in that, The formula for calculating accurate physical time in the fixed delay compensation unit is: T TSF,true =T HOST,read T offset,fixed T jitter,residual ; Among them, T HOST,read For TSF hardware readings, T offset,fixed For systematic delay, T jitter,residual This is residual jitter.
5. The Wi-Fi soft scheduling system based on TSF synchronization token bucket according to claim 1, characterized in that, The TSF synchronization token bucket gating module includes: The time slot allocation table parsing unit is used to receive the time slot allocation table broadcast by the AP as the central scheduler, and parse the scheduling period and the scheduled transmission time slot of the current STA. The token generation unit is used to bind the state of the token bucket counter with the accurate physical time provided by the high-precision TSF synchronization module to achieve authorization of the time window; The scheduling gating logic unit is used to authorize data packets to enter the MAC layer's transmission queue based on two judgment conditions.
6. The Wi-Fi soft scheduling system based on TSF synchronization token bucket according to claim 5, characterized in that, The dual judgment conditions include: a time judgment condition and a capacity judgment condition; wherein, the time judgment condition is used to determine whether the current calibrated time is within the predetermined transmission time slot allocated by the AP to the STA; the capacity judgment condition is used to determine whether the number of tokens in the token bucket counter is greater than or equal to the size of the data packet to be transmitted.
7. The Wi-Fi soft scheduling system based on TSF synchronization token bucket according to claim 1, characterized in that, The driver-layer scheduling injection and conflict protection module includes: The MAC queue injector is used to push data packets authorized by the TSF synchronization token bucket gating module into the MAC layer transmission queue of the WNIC hardware driver with low latency. The time slot protection unit is used to customize the retransmission logic of data packets. The retransmission logic includes: retransmission timing constraints, timeout forced pull-back mechanism, and buffer retry.
8. The Wi-Fi soft scheduling system based on TSF synchronization token bucket according to claim 7, characterized in that, The retransmission timing constraint is used to limit the number of retransmission attempts and the backoff time when a data packet needs to be retransmitted due to a collision at the MAC layer, ensuring that all retransmission operations are completed within the duration of the current time slot.
9. The Wi-Fi soft scheduling system based on TSF synchronization token bucket according to claim 7, characterized in that, The timeout forced pull-back mechanism is used to forcibly remove data packets from the MAC layer transmission queue when the current time slot ends and the data packet has not been successfully transmitted.
10. The Wi-Fi soft scheduling system based on TSF synchronization token bucket according to claim 7, characterized in that, The buffered retry is used to buffer the forcibly pulled-back data packets and wait for the next transmission slot belonging to the STA to resubmit the transmission request.
11. A communication method for a Wi-Fi soft scheduling system based on a TSF synchronous token bucket as described in any one of claims 1-10, characterized in that, The method includes: When real-time data packets arrive at the driver layer, the high-precision TSF synchronization module is invoked to obtain the calibrated, high-precision current TSF time. The time slot allocation table is checked based on the TSF synchronous token bucket gating module, and the relationship between the token bucket counter and the data packet is checked to obtain the check results. The data packet is then processed based on the check results. Once the data packet is authorized, the driver layer scheduling injection and conflict protection module pushes the data packet into the MAC layer transmission queue, and when a conflict occurs and retransmission is required, the data packet is processed based on preset retransmission logic.
12. The communication method of the Wi-Fi soft scheduling system based on TSF synchronization token bucket according to claim 11, characterized in that, Based on the TSF synchronization token bucket gating module, the time slot allocation table is checked, and the relationship between the token bucket counter and data packets is examined to obtain the following results: The time slot allocation table is checked based on the TSF synchronization token bucket gating module to determine whether the current TSF time is in the predetermined transmission time slot allocated to the STA, and the first check result is obtained. The second check result is obtained by checking whether the token bucket counter can accommodate the data packets based on the TSF synchronous token bucket gating module.
13. The communication method of the Wi-Fi soft scheduling system based on TSF synchronization token bucket according to claim 12, characterized in that, The second check result is obtained by checking whether the token bucket counter can hold the data packets based on the TSF synchronization token bucket gating module, including: The second check result is obtained by comparing the number of tokens in the token bucket counter with the size of the data packet.
14. The communication method of the Wi-Fi soft scheduling system based on TSF synchronization token bucket according to claim 12, characterized in that, The data packet is processed based on the inspection results, including: If the first check result indicates that the current TSF time is not within the predetermined transmission time slot, then the data packet is discarded; If the first check result indicates that the current TSF time is within the predetermined transmission time slot, then the data packet transmission continues.
15. The communication method of the Wi-Fi soft scheduling system based on TSF synchronization token bucket according to claim 13, characterized in that, The data packet is processed based on the inspection results, including: If the second check result is that the number of tokens in the token bucket counter is less than the size of the data packet, then the data packet is considered non-compliant; If the second check result indicates that the number of tokens in the token bucket counter is greater than or equal to the size of the data packet, then the data packet transmission continues.
16. The communication method of the Wi-Fi soft scheduling system based on TSF synchronization token bucket according to claim 11, characterized in that, When a conflict occurs and retransmission is required, the data packet is processed based on preset retransmission logic, including: When a collision occurs and retransmission is required, the time slot protection unit determines whether the current retransmission time is within the duration of the predetermined transmission time slot. If the data packet fails to be transmitted successfully at the end of the current time slot, the data packet will be forcibly pulled back and retried in the next time slot.
17. A computer device, characterized in that, The computer device includes a memory, a processor, and a communication program for a Wi-Fi soft scheduling system based on a TSF synchronization token bucket, which is stored in the memory and can run on the processor. When the processor executes the communication program for the Wi-Fi soft scheduling system based on a TSF synchronization token bucket, it implements the steps of the communication method for the Wi-Fi soft scheduling system based on a TSF synchronization token bucket as described in any one of claims 11-16.
18. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a communication program for a Wi-Fi soft scheduling system based on a TSF synchronization token bucket. The communication program for the Wi-Fi soft scheduling system based on a TSF synchronization token bucket implements the steps of the communication method for the Wi-Fi soft scheduling system based on a TSF synchronization token bucket as described in any one of claims 11-16 on the computer-readable storage medium.