A clock synchronization method and device of a distributed device network, a terminal and a medium
By using a local clock model and hierarchical density clustering algorithm in a distributed device network, the problem of crystal oscillator frequency drift is solved, synchronization accuracy and stability are improved, communication overhead is reduced, and synchronization frequency allocation can be adapted to different environments.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN POLYTECHNIC
- Filing Date
- 2026-03-18
- Publication Date
- 2026-06-05
AI Technical Summary
In existing distributed device networks, the frequency drift of ordinary crystal oscillators is easily affected by temperature changes and device aging. The clock node clustering process does not take temperature changes and device aging factors into account, resulting in abnormal clustering results and affecting the allocation of synchronization frequencies.
A local clock model is used for initial synchronization. A spatial clustering algorithm is applied to cluster nodes using hierarchical density noise, and different synchronization frequencies are assigned to overcome the influence of temperature noise and improve synchronization accuracy and stability.
It improves time synchronization accuracy, enhances the security and robustness of network node synchronization processes, and reduces communication overhead in large-scale, heterogeneous, and dynamic industrial IoT systems.
Smart Images

Figure CN122159995A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of distributed synchronization technology, and more particularly to a clock synchronization method, apparatus, terminal, and medium for distributed device networks. Background Technology
[0002] With the development of IoT technology, the interconnectivity between various devices is constantly increasing, and the collaborative work between sensors, controllers, and actuators has become a crucial foundation for many industrial applications. In scenarios such as industrial control, distributed drone network collaboration, and multi-actuator collaborative driving, control nodes and execution nodes typically operate in a distributed manner and need to complete control tasks under strict timing constraints. To ensure the determinism and real-time performance of the system, all nodes in the network need to share a unified time reference. Without high-precision time synchronization, timestamps of sensed data may become inconsistent, affecting data fusion and control decisions, and potentially leading to asynchronous control execution, thus impacting system stability and device collaboration. Therefore, high-precision time synchronization has become a key fundamental capability in industrial control networks and industrial IoT systems. It is a basic service for coordinating distributed clock nodes and a prerequisite for realizing core functions such as collaborative communication, event sequencing, and data fusion.
[0003] However, in large-scale industrial IoT or control systems, the number of network nodes typically reaches hundreds or even tens of thousands. Node devices generally use low-cost crystal oscillators as their local clock source; that is, the device clock is determined by the crystal oscillator configured on it. Although using high-precision oscillators (such as temperature-compensated crystal oscillators or oven-controlled crystal oscillators) can reduce clock drift to some extent, configuring high-precision clocks for all nodes in a large-scale system significantly increases system cost and still struggles to eliminate time errors caused by network transmission delays. The frequency drift of ordinary crystal oscillators is easily affected by factors such as temperature changes and device aging, causing clock drift to accumulate over time and thus reducing the system's synchronization accuracy. Furthermore, in existing clock synchronization processes based on distributed device networks, clock node clustering is required based on the time-varying clock drift of different devices relative to the master device. However, the clustering process generally does not consider the influence of temperature and is also highly sensitive to environmental noise. This noise sensitivity can easily lead to abnormal clustering results, such as generating unnecessary redundant clusters or causing the entire cluster to malfunction, thus affecting the cluster's synchronization frequency allocation. Incorrect synchronization frequency allocation will cause unnecessary communication overhead and a decrease in clock synchronization accuracy.
[0004] Therefore, in large-scale, heterogeneous, dynamic, and security-sensitive industrial IoT systems, such as distributed drone network collaboration, distributed robot network collaboration, and distributed base station network communication, how to suppress clock drift, improve time synchronization accuracy, and enhance the security of network node synchronization processes while controlling communication and computing overhead is a problem that needs to be solved in this field. Summary of the Invention
[0005] The technical problem to be solved by the present invention is to provide a clock synchronization method, device, terminal and medium for distributed device networks, which addresses the above-mentioned defects of the prior art. The invention aims to solve the problem that in the existing clock synchronization technology based on distributed device networks, the frequency drift of ordinary crystal oscillators is easily affected by factors such as temperature changes and device aging, and the impact of temperature changes and device aging is generally not considered in the clock node clustering process, which leads to abnormal clustering results and thus affects the allocation of synchronization frequency.
[0006] The technical solution adopted by the invention to solve the technical problem is as follows: In a first aspect, the present invention discloses a clock synchronization method for a distributed device network, wherein the method includes: Determine the coordination center node in the current distributed device network, and construct an initial cluster network containing multiple clusters using the other nodes in the current distributed device network excluding the coordination center node; the coordination center node is the clock node with the smallest time-varying clock drift rate in the current distributed device network. Clock modeling is performed on each node in the initial cluster network to establish a corresponding virtual clock for each node based on the local clock model obtained from the modeling, and the local clock model is used to initialize and synchronize all clusters in the initial cluster network with the coordination center node. Determine the relative clock drift between all nodes in the initial cluster network and the coordination center node; A target cluster network is obtained by using a preset hierarchical density-based noise spatial clustering algorithm and clustering all nodes in the initial cluster network according to the relative clock drift. Different synchronization frequencies are assigned to each target cluster in the target cluster network to control the clock synchronization of each target cluster based on the synchronization frequencies.
[0007] Optionally, the local clock model is: ; in, Let i be the clock value of node i. Let i be the initial drift of node i. time, The rate of change of clock drift. Let be the constant clock offset for node i.
[0008] Optionally, the step of constructing an initial cluster network containing multiple clusters using nodes other than the coordination center node in the current distributed device network includes: Utilizing the nodes in the current distributed device network other than the coordination center node, an initial cluster network containing multiple clusters is constructed according to a random network topology; wherein each cluster contains a cluster center node and multiple cluster members.
[0009] Optionally, the step of using the local clock model to initialize and synchronize all clusters in the initial cluster network with the coordination center node includes: In the initial cluster network, the cluster center nodes of all clusters and the coordination center node are synchronized by using the local clock model to calculate the corresponding time-varying clock drift and constant clock offset by transmitting a pair of data packets in the same direction and transmitting a pair of data packets symmetrically, respectively. The time-varying clock drift and constant clock offset are then corrected so that the cluster center nodes of all clusters and the coordination center node can be synchronized. After all cluster center nodes have synchronized with the coordination center node, the steps of calculating the corresponding time-varying clock drift and constant clock offset by transmitting a pair of data packets in the same direction and symmetrically transmitting a pair of data packets using the local clock model, and correcting the time-varying clock drift and constant clock offset, are repeated among all cluster center nodes and their corresponding cluster members until all nodes in the initial cluster network have synchronized with the coordination center node.
[0010] Optionally, the step of using a preset hierarchical density-based noise-based spatial clustering algorithm and clustering all nodes in the initial cluster network according to the relative clock drift to obtain the target cluster network includes: The reachability distance between nodes is calculated based on the relative clock drift. A minimum spanning tree is constructed based on the mutual reachability distance between nodes, and the edges in the minimum spanning tree are sorted according to the mutual reachability distance to obtain the corresponding sorting result; Each node in the initial cluster network is initially set as an independent cluster, and a cluster merging operation is performed based on the sorting result until all nodes in the initial cluster network are merged into a cluster, resulting in the corresponding hierarchical tree; The clusters in the hierarchical tree are compressed to obtain a compressed hierarchical tree; Extract target clusters that meet preset stability conditions from the compressed hierarchical tree, and determine the cluster center node of each target cluster to obtain the target cluster network.
[0011] Optionally, determining the cluster center node of each target cluster includes: The stability and node parameters of the nodes in each target cluster are evaluated to determine the cluster center node of each target cluster based on the evaluation results.
[0012] Optionally, each device acting as a node in the current distributed device network has a pre-trained target Hidden Markov model built in. In the current distributed device network operation, environmental observation values are collected in real time by sensors installed on the device and input into the target hidden Markov model. The target hidden Markov model performs probability calculation and state inference based on the environmental observation values to obtain the state prediction result of the device. The device automatically triggers a request for local clock fine-tuning or clock synchronization based on the state prediction result. Furthermore, the target Hidden Markov Model is a model obtained by offline training of the initial Hidden Markov Model using pre-collected historical environmental data and clock parameters, based on unsupervised or semi-supervised methods.
[0013] Secondly, the present invention also discloses a clock synchronization device for a distributed device network, wherein the device comprises: The central node determination module is used to determine the coordination center node in the current distributed device network; The network construction module is used to construct an initial cluster network containing multiple clusters using nodes other than the coordination center node in the current distributed device network; The clock modeling module is used to perform clock modeling on each node in the initial cluster network, so as to establish a corresponding virtual clock for each node based on the local clock model obtained from the modeling. The synchronization initialization module is used to initialize and synchronize all clusters in the initial cluster network with the coordination center node using the local clock model; A relative clock drift determination module is used to determine the relative clock drift between all nodes in the initial cluster network and the coordination center node. The node clustering module is used to apply a spatial clustering algorithm based on a preset hierarchical density noise and to cluster all nodes in the initial cluster network according to the relative clock drift to obtain the target cluster network. A clock frequency allocation module is used to allocate different synchronization frequencies to each target cluster in the target cluster network in order to control the clock synchronization of each target cluster based on the synchronization frequency.
[0014] Thirdly, the present invention discloses a terminal, comprising: a memory, a processor, and a clock synchronization program for a distributed device network stored in the memory and executable on the processor, wherein the clock synchronization program for the distributed device network, when executed by the processor, implements the steps of the clock synchronization method for the distributed device network as described above.
[0015] Fourthly, the present invention discloses a computer-readable storage medium storing a computer program that can be executed to implement the steps of the clock synchronization method for a distributed device network as described above.
[0016] This invention provides a clock synchronization method, apparatus, terminal, and medium for a distributed device network. The clock synchronization method for the distributed device network includes: determining a coordination center node in the current distributed device network, and constructing an initial cluster network containing multiple clusters using other nodes in the current distributed device network excluding the coordination center node; the coordination center node is the clock node with the smallest time-varying clock drift rate in the current distributed device network; performing clock modeling on each node in the initial cluster network to establish a corresponding virtual clock for each node based on the local clock model obtained from the modeling, and using the local clock model to initialize and synchronize all clusters in the initial cluster network with the coordination center node; determining the relative clock drift between all nodes in the initial cluster network and the coordination center node; applying a preset hierarchical density-based noise spatial clustering algorithm and clustering all nodes in the initial cluster network according to the relative clock drift to obtain a target cluster network; and assigning different synchronization frequencies to each target cluster in the target cluster network to control the clock synchronization of each target cluster based on the synchronization frequencies. Therefore, in the distributed clock synchronization process, this invention first initializes and synchronizes all clusters in the initial cluster network with the coordination center node. After initial synchronization, to overcome the problem that the inherent characteristics of the clock cannot be corrected and affect the clock synchronization accuracy, a hierarchical density-based noise application space clustering algorithm is used for intelligent clustering. Different synchronization frequencies are assigned to different target clusters in the clustered target cluster network. This clustering algorithm has hyperparameter robustness, and small changes in its parameters will not affect the overall clustering effect. It can overcome the influence of environmental noise such as temperature on clustering, so that the synchronization frequency allocation of the clusters is not affected by environmental noise such as temperature, ensuring the stability of the synchronization frequency allocation. It can also avoid relying on fixed threshold parameters, making the entire clustering process more intelligent and automated, better adaptable to different cluster network environments, and achieving strong robustness. Attached Figure Description
[0017] Figure 1This is a flowchart of a preferred embodiment of the clock synchronization method for distributed device networks in this invention; Figure 2 This is a schematic diagram of a specific initial cluster network disclosed in this invention; Figure 3 This is a schematic diagram of a specific data packet packet transmission disclosed in this invention; Figure 4 This is a schematic diagram of the state parameters of each cluster under a specific random topological state disclosed in this invention; Figure 5 This is a schematic diagram of the simulation results after node initialization and synchronization in a specific initial cluster network disclosed in this invention; Figure 6 This is a schematic diagram of a specific grouping situation and the drift change rate of the cluster center node disclosed in this invention; Figure 7 This is a schematic diagram illustrating the effect of a specific synchronization frequency on the normalized mean square error of each cluster, as disclosed in this invention. Figure 8 This is a schematic diagram of the state parameters of each cluster node after specific clustering, as disclosed in this invention; Figure 9 This is a functional principle block diagram of a preferred embodiment of the clock synchronization device for a distributed device network in this invention; Figure 10 This is a functional principle block diagram of a preferred embodiment of the terminal in this invention. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages 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.
[0019] Please see Figure 1 , Figure 1 This is a flowchart of the clock synchronization method for a distributed device network in this invention. For example... Figure 1 As shown, the clock synchronization method for a distributed device network according to an embodiment of the present invention includes: Step S11: Determine the coordination center node in the current distributed device network, and construct an initial cluster network containing multiple clusters using the other nodes in the current distributed device network excluding the coordination center node; the coordination center node is the clock node with the smallest time-varying clock drift rate in the current distributed device network.
[0020] In this context, a distributed device network refers to a collaborative network of devices formed by interconnecting multiple physical devices (such as sensors, terminals, controllers, etc.) through a communication network. The central coordinating node, such as the GMC (Grand Master Clock), is the clock node with the smallest time-varying clock drift rate in the current distributed device network. As the most stable clock node in the current distributed device network, it can use the optimal master clock algorithm to dynamically select the best clock source in the current distributed device network as the system master clock from multiple available GMCs. This master clock is generally a GNSS receiving module (such as GPS, Beidou, Galileo), a local timekeeping module (such as a rubidium clock), or a national-level terrestrial longwave time signal receiving module installed in the device.
[0021] It should be noted that the current distributed device network can be a distributed drone network or a distributed 5G base station network. That is, the actual application scenario of the technical solution of this invention can be a distributed drone network or a distributed 5G base station network. For example, 100 5G small base stations deployed in a dense urban area in the center of a city can jointly form a heterogeneous distributed network of a 5G base station.
[0022] For example, in the practical application scenario of a distributed drone network, a reference drone, i.e., a coordination center node, is first selected as the reference clock. The selection of this reference clock can be dynamically adjusted based on factors such as drone communication stability and clock accuracy. The reference clock is responsible for coordinating the synchronization of all drone clocks within the network and serves as a reference for all clock synchronization. The selection of the reference clock can be carried out through a mechanism based on an optimal master clock algorithm, ensuring accurate and reliable clock synchronization within the network.
[0023] In this embodiment, an initial cluster network containing multiple clusters is constructed using nodes other than the coordination center node in the current distributed device network. Specifically, this may include: using nodes other than the coordination center node in the current distributed device network and constructing an initial cluster network containing multiple clusters according to a random network topology; wherein each cluster contains one cluster head node (CH) and multiple cluster members (CM). It is understood that the current distributed device network contains N independent devices (nodes), all nodes are within mutual communication range, and data transmission does not exceed a single hop distance. First, the structure of the entire cluster needs to be initialized, see [link to relevant documentation]. Figure 2As shown, the most stable clock node is selected from all network nodes as the coordination center node (i.e., the main cluster center node). This node remains largely unchanged throughout the network operation. Then, the remaining N-1 nodes are used to construct the network using a random network topology, that is, the remaining N-1 nodes are randomly divided into M clusters, and each cluster elects a cluster center node, achieving automatic and robust cluster partitioning and cluster center node election. For example, the remaining N-1 drone nodes in a drone network are randomly divided into M clusters, and each cluster elects a cluster center node.
[0024] Step S12: Perform clock modeling on each node in the initial cluster network, so as to establish a corresponding virtual clock for each node according to the local clock model obtained by modeling, and use the local clock model to initialize and synchronize all clusters in the initial cluster network with the coordination center node.
[0025] The local clock model is as follows: ; in, Let i be the clock value of node i. Let i be the initial drift of node i. time, The rate of change of clock drift. Let be the constant clock offset for node i.
[0026] Therefore, the main parameters affecting clock offset include initial drift, clock drift rate of change, and constant clock offset.
[0027] It should be noted that the initial local clock model for each node is as follows: ; in, For the first Time-varying clock drift of each node. The ideal value is 1. The ideal value is 0; ideally, the clock value of each node is 0. .
[0028] Furthermore, the time-varying clock drift of the node is: ; because Since the noise is extremely small and can be ignored, the time-varying clock drift formula for the node can be obtained as follows: ; Substituting the calculation expression for time-varying clock drift into the initial local clock model, we can obtain the final local clock model calculation expression, i.e.: .
[0029] In this embodiment, during the initialization synchronization phase, a local clock model is used to initialize and synchronize all clusters in the initial cluster network with the coordination center node. Specifically, between the cluster center nodes of all clusters in the initial cluster network and the coordination center node, the local clock model is used to calculate the corresponding time-varying clock drift and constant clock offset by transmitting a pair of data packets in the same direction and by transmitting a pair of data packets symmetrically, respectively. The time-varying clock drift and constant clock offset are then corrected so that the cluster center nodes of all clusters are synchronized with the coordination center node. After the cluster center nodes of all clusters are synchronized with the coordination center node, the steps of calculating the corresponding time-varying clock drift and constant clock offset using the local clock model by transmitting a pair of data packets in the same direction and by transmitting a pair of data packets symmetrically, and correcting the time-varying clock drift and constant clock offset are repeated between the cluster center nodes of all clusters and their corresponding cluster members, until all nodes in the initial cluster network are synchronized with the coordination center node.
[0030] Understandably, the GMC is responsible for time synchronization of all CH nodes. Once clock synchronization between the CH and GMC is complete, the CM will immediately perform local clock correction by referring to the CH of its cluster. Through this layer-by-layer synchronization mechanism, global clock synchronization is ultimately achieved from the CM to the CH and then to the GMC.
[0031] For example, to achieve clock synchronization, the GMC and CM transmit data packets in groups. The specific process is as follows: First, the GMC and CH recursively transmit a pair of data packets in the same direction using PTP (Precision Time Protocol). These packets are used to calculate and correct the time-varying clock drift between the GMC and CH, improving synchronization accuracy. Then, the GMC and CH symmetrically transmit another pair of data packets to calculate and correct the constant clock offset between them. Once clock synchronization between the CH and GMC is complete, this process is repeated between the CH and CM in the same manner as between the GMC and CH, ensuring that all nodes in the initial cluster network can synchronize with the most stable node, ultimately guaranteeing that all nodes have the same time-varying clock drift characteristics. It should be noted that due to the heterogeneity of clock nodes during manufacturing, the varying rates of change of time-varying clock drift (VRS) will differ between different nodes; therefore, the time-varying clock drift characteristics of each node will also vary.
[0032] See Figure 3As shown, the master clock (GMC) periodically sends PTP synchronization (Sync) and follow-up messages to the communication gate (CH). Network switching devices supporting transparent clocks record the dwell time of these messages on their device and add it to the message's correction field when forwarding them. The base station, acting as a slave clock, receives these messages and, using the delay request-response mechanism and the correction field information, accurately calculates the time drift and path transmission delay between itself and the master clock. Initial synchronization is based on the enhanced PTP mechanism, which uses timestamp exchange between the master and slave clocks to achieve synchronization by calculating time-varying clock drift and constant clock offset. During initial synchronization, the master clock (GMC) periodically sends PTP synchronization and follow-up messages to the synchronization network. With each data packet transmission, the slave clock obtains a corresponding clock stamp, used to calculate the drift and offset between the slave and master clocks. "Obtained" indicates the clock stamp obtained by the node. For details, see the above. Figure 3 As shown, firstly, the reference clock records timestamp t1 when sending a Sync data packet; the slave clock records timestamp t2 when receiving the data packet. Subsequently, the slave clock sends a Follow-up data packet after a random delay and records the sending time t3; the master clock records its receiving time t4. Specifically, timestamps t1 and t4 are transmitted to the slave clock via the Sync and Follow-up data packets, respectively. The slave clock uses the four timestamps t1 to t4 to calculate the time-varying clock drift (Skew). Then, the slave clock sends a Delay Request and records clock timestamp t5. Timestamps t5 and t8 are transmitted to the slave clock via the Delay Request and Delay Follow-up data packets, respectively. The slave clock uses t5 to t8 to calculate the clock offset (Offset) and adjusts its local clock accordingly.
[0033] Among them, t1, t n Send Sync timestamps to the master clock, t2, t n+1 To receive the Sync timestamp from the clock, t3, t n+2 Send a follow-up timestamp to the master clock, t4, t n+3 To receive the Follow-up timestamp from the clock, t5, t n+4 To send the Delay_Req timestamp from the clock, t6, t n+5 The master clock receives the Delay_Req timestamp, t7, t n+6 Send Delay_Resp timestamps from the master clock, t8, t n+7 To receive the Delay_Resp timestamp from the clock.
[0034] The relative clock drift between nodes is as follows: ; Represents a node Clock drift (at the reference node), Represents a node Clock drift (of the synchronization node), For nodes At any moment Local clock stamp, For nodes At any moment Local clock stamp, For nodes At any moment Local clock stamp, For nodes At any moment Local clock stamp.
[0035] The drift correction between nodes is as follows: ; ; For nodes constant clock offset, For nodes Time-varying clock drift, For nodes Based on relative clock drift Corrected offset estimate.
[0036] The relative clock offset between nodes is: ; The node can be achieved by adding the drift correction expression between nodes to the relative clock offset expression between nodes. With nodes Synchronization between them. For nodes At any moment Local clock stamp, For nodes At any moment Local clock stamp, For nodes At any moment Local clock stamp, For nodes At any moment Local clock stamp.
[0037] During the initialization and synchronization phase, the cluster central node uses the master clock as a reference, while cluster members use the central node of their respective cluster as a reference.
[0038] After the offset is updated, the offset can be compensated for through the interaction of the Delay_Req and Delay_Resp messages, that is: ; During data packet transmission, this mechanism can be used to dynamically compensate and correct clock drift and offset between node i and node j.
[0039] For example, when the current distributed device network has 150 clock nodes, under the initial random topology state, the state parameters of each cluster are as follows: Figure 4 As shown, the VRS of each clock node are respectively , , , , Initial time-varying clock drift In 2 to -2 Between, the initial constant clock offset exist to- Between, the VRS of noise points is For the offset evolution during the initial synchronization process of 150 clock nodes, see [link / reference]. Figure 5 As shown, Step 1 represents the offset during the initial cluster network initialization process, Step 2 represents the offset after CH and GMC are synchronized, Step 3 represents the offset after CM and CH are synchronized, and Step 4 represents the offset of the synchronized nodes 10 seconds later due to VRS. The evolution of the offsets between all 150 clock nodes and the master node GMC during initialization shows that after synchronization in Step 2, the offsets between CH nodes and GMC are eliminated. After synchronization in Step 3, the offsets between CM and GMC are also eliminated if minor noise is not considered. In Step 4, no operation is performed, and the clock runs freely. Due to inherent clock defects, such as the time-varying clock drift rate, the offsets between all nodes and GMC increase after 10 seconds. Therefore, all nodes still need periodic synchronization to maintain accuracy requirements.
[0040] Step S13: Determine the relative clock drift between all nodes in the initial cluster network and the coordination center node.
[0041] It should be pointed out that, in and Under the condition that the calibration has been completed, the residual impact of the inherent defects of the clock caused by environmental factors such as aging and temperature fluctuations on its actual drift can be estimated by the relative clock drift between the node and the GMC.
[0042] Furthermore, the relative clock drift between GMC and other nodes is as follows: ; in, For time-varying clock drift of GMC nodes, For GMC nodes at time Local clock stamp, For GMC nodes at time Local clock stamp.
[0043] In this embodiment, after initial synchronization from CM to CH and then to GMC, the distributed synchronization phase begins. By calculating the relative clock drift between each node in the initial cluster network and the GMC, and considering the drift differences caused by varying time-varying clock drift rates, continuous synchronization between nodes is still necessary to ensure clock accuracy, further improving clock synchronization efficiency, accuracy, and reliability. When sudden temperature changes cause drift deterioration, automatic warnings and adjustments to the cluster structure can be made to prevent synchronization failure.
[0044] It should be noted that the time-varying clock drift caused by different temperatures is as follows: ; The formula for the time-varying clock drift of a node: ; in, For the clock drift of node i at different temperatures T, This is the reversal temperature.
[0045] Furthermore, combining the time-varying clock drift formula caused by different temperatures with the time-varying clock drift formula for nodes, the final temperature-dependent time-varying clock drift formula can be: .
[0046] For time-varying temperature, Drift is caused by all non-temperature factors (such as other environmental effects and device aging).
[0047] Step S14: Using a preset hierarchical density-based noise application spatial clustering algorithm, and clustering all nodes in the initial cluster network according to the relative clock drift to obtain the target cluster network.
[0048] In this embodiment, a hierarchical density-based noise-applied spatial clustering algorithm is used to cluster all nodes in the initial cluster network. Clustering is achieved through hierarchical density analysis, and noise points are automatically processed to obtain the target cluster network. For example, drones with similar clock drift characteristics are grouped into one cluster. Compared with random clustering topology, using HDBSCAN can reduce the total communication resource consumption during synchronization. Specifically, based on relative clock drift, the entire network is re-clustered using a hierarchical density-based noise-applied spatial clustering algorithm, so that node clusters with larger VRS will be synchronized more frequently, while the synchronization interval for nodes with insignificant VRS will be larger to avoid unnecessary message transmission.
[0049] Among them, the Hierarchical Density-Based Spatial Clustering (HDBSCAN) algorithm constructs a density hierarchy tree to represent the density distribution of data points and achieves clustering by extracting the most stable clusters in the density hierarchy tree. It can adaptively adjust the shape of the clusters and effectively handle noise. Based on HDBSCAN, the cluster structure of the network not only has dynamism and adaptability, but also maintains high stability. Furthermore, considering that the energy consumed by wireless communication usually far exceeds the energy consumption of sensor nodes in signal processing, adopting HDBSCAN can reduce unnecessary overhead in the communication process and improve the fault tolerance and intelligence of the system.
[0050] Specifically, the reachability distance between nodes is calculated based on relative clock drift; a minimum spanning tree is constructed based on the reachability distance, and the edges in the minimum spanning tree are sorted according to the reachability distance to obtain the corresponding sorting result; each node in the initial cluster network is initially set as an independent cluster, and a cluster merging operation is performed based on the sorting result until all nodes in the initial cluster network are merged into a cluster, resulting in the corresponding hierarchical tree; the clusters in the hierarchical tree are compressed to obtain a compressed hierarchical tree; target clusters that meet the preset stability conditions are extracted from the compressed hierarchical tree, and the cluster center node of each target cluster is determined to obtain the target cluster network. In essence, the HDBSCAN algorithm is used to cluster the nodes in the network, and cluster merging and noise labeling are performed through cluster stability calculations (e.g., evaluating the stability of all nodes and labeling nodes or clusters with weak stability as noise to identify unstable clusters or small-scale clusters in advance) to obtain each target cluster. The cluster center node of each target cluster is elected by comprehensively evaluating the stability of each node and its own node parameters during the clustering process.
[0051] During the cluster merging operation to construct the hierarchical tree, clusters are merged progressively from largest to smallest. Each time, an edge is added, and the two clusters connected by the edge are merged into a new cluster. This process continues until all points are merged into a single cluster. This merging process forms a tree structure, where the root of the tree is the last cluster containing all points, the leaves are individual nodes, and the height of the tree is the reachability distance between nodes at the time of merging. Furthermore, clusters in the hierarchical tree can be compressed based on a preset minimum number of clusters.
[0052] In this embodiment, the process of determining the cluster center node of each target cluster may specifically include: performing stability assessment and node parameter assessment on the nodes in each target cluster to determine the cluster center node of each target cluster based on the assessment results. It is understood that by analyzing the process of each node from being initialized into a cluster to merging into another cluster, the node with the longest lifespan and the most stable performance is selected as the cluster head node, i.e., the cluster center node. For example, within each clock synchronization cluster, a cluster center node is elected as the dominant node of the cluster based on indicators such as the estimated clock parameters of the nodes and stability in HDBSCAN clustering. This dominant node is responsible for synchronization with the reference clock and coordination of clocks within the cluster. For example, in cluster C, the node with the smallest clock drift and the closest node to the cluster center in HDBSCAN clustering is elected as the cluster center node. The cluster center node is responsible for collecting clock data from members within the cluster and performing higher-precision synchronization with the reference clock or the center node of other clusters. The cluster center node is elected based on its low clock deviation and strong communication capabilities. The cluster center node acts as a bridge within the cluster, synchronizing clocks with other UAVs and coordinating the time synchronization accuracy within the cluster.
[0053] In this embodiment, target clusters that meet preset stability conditions are extracted from the compressed hierarchical tree. The specific process can be as follows: traverse each cluster in the compressed hierarchical tree and calculate the stability of each cluster. If the stability of a sub-cluster in the entire tree is better than that of the parent cluster, the sub-cluster is retained; otherwise, it is merged into the parent cluster. Points not assigned to any final cluster will be labeled with noise.
[0054] Each cluster The lifecycle is described by a pair of parameters, such as each cluster stability for: ; in, At the level of extinction, At the birth level.
[0055] The HDBSCAN algorithm will determine the core distance. Convert to density level parameters ,Right now: ; when When it was very big, Very small, indicating that the VRS can separate clusters at very low densities, when When I was very young, A large value indicates that VRS requires a very high density to separate clusters. That is, by along... By dynamically tracking the merging and splitting of clusters from high to low along the axis, the "birth" and "death" of each cluster at a specific density level can be determined.
[0056] For example, see the distribution of the five distinct clusters obtained by clustering using the HDBSCAN algorithm and the time-varying clock drift rate of the nodes in the clusters. Figure 6 As shown, 150 nodes are divided into 5 clusters with different inherent defects. Unstable nodes are marked as noise. By allocating different synchronization frequencies to stable clusters based on the impact of inherent defects, communication overhead is reduced and synchronization accuracy is improved, achieving adaptive response to abnormal environments (sudden temperature changes). Figure 7 As shown, increasing the synchronization frequency will be more advantageous for clusters with higher VRS. In contrast, the NMSE (Normalized Mean Squared Error) of high-quality clock nodes will not decrease as significantly as other nodes. Therefore, increasing the synchronization frequency for nodes with larger VRS will result in a greater gain in average NMSE.
[0057] In the distributed synchronization process, 150 nodes with different relative clock drifts were deployed in an ideal temperature environment. The parameters after HDBSCAN clustering are shown in [link to HDBSCAN clustering parameters]. Figure 8 As shown, after initial synchronization, the constant clock offset and time-varying clock drift of nodes in different clusters are concentrated near the GMC. However, due to differences in the manufacturing process, each node has a different VRS, and some noisy nodes are also identified. Specifically, the VRS is 1×10 7 3×10 7 5×10 7 7×10 7 9×10 7 Nearby, the synchronized drift skew is at 1.84××10 6 Up to 1.86×10 6Between these points, the offset after synchronization is 1.39 × 10⁻⁶. 5 Up to 1.41×10 5 Between these points, it can be seen that HDBSCAN clustering is performed after initial synchronization, at which point the offsets and drifts of all nodes have been corrected.
[0058] For example, in a practical application scenario of a distributed drone network, each drone is equipped with a local clock to record its flight status and timestamps of sensor data collection. During synchronization, the drift and delay of each drone's local time-varying clock are first calculated. Due to variations in the flight environment and the hardware characteristics of each drone, clock drift and delay differ. Each drone calculates the deviation between its local clock and other drone clocks by exchanging time information with a reference clock or other nearby drones. The drift calculation is based on the drone's clock rate, while the delay calculation considers the transmission delay of communication signals during flight. After calculating the local time-varying clock drift and delay, each drone corrects its local clock based on the calculated time-varying clock drift and constant clock offset through appropriate corrections (such as adjusting the voltage of the crystal oscillator XO to adjust the frequency of the XO). This correction method can be implemented using the enhanced clock synchronization protocol PTP to ensure that the clock synchronization accuracy between drones meets the requirements. Then, by analyzing the relative clock drift between the reference drone and other drones in the distributed drone network, which reflects the deviation characteristics of the drone's clock from the reference drone's clock, the inherent deviation factor of the base station clock can be estimated to effectively reduce the clock difference between the drone and the reference drone, providing a reference for subsequent clock synchronization.
[0059] Step S15: Assign different synchronization frequencies to each target cluster in the target cluster network to control the clock synchronization of each target cluster based on the synchronization frequency.
[0060] In this embodiment, different synchronization frequencies can be assigned to each target cluster in the target cluster network according to preset clock accuracy requirements to control the clock synchronization of each target cluster based on the synchronization frequency. It is understood that differentiated synchronization frequencies are configured for different clusters based on the accuracy of clock synchronization and communication latency within each cluster. For clusters less affected by inherent clock defects, i.e., clusters with smaller clock drift relative to time-varying clocks, a lower synchronization frequency can be used. Conversely, for clusters more affected by inherent clock defects, i.e., clusters with larger clock drift relative to time-varying clocks, a higher synchronization frequency can be used to reduce the computational and communication burden caused by frequent global simultaneous synchronization. For example, for cluster A (high-performance group): the lowest synchronization frequency (e.g., once every 10 minutes). Because they are inherently stable, frequent calibration is not required. For cluster B (standard group): a standard synchronization frequency (e.g., once every 1 minute). For cluster C (high-sensitivity group): the highest synchronization frequency (e.g., once every 10 seconds). Through frequent synchronization, drastic clock changes caused by environmental factors are quickly corrected.
[0061] It should be noted that the synchronization frequency of a node should be determined based on the rate of change of its clock. In other words, a node with a highly unstable clock should synchronize more frequently than a node with a high-quality clock. This allows for the allocation of synchronization frequencies based on the differences in node stability, achieving high-precision, low-overhead distributed synchronization. Furthermore, the differentiated synchronization frequency reduces the number of synchronizations for stable nodes, significantly reducing the amount of data packets transmitted and thus significantly reducing communication overhead.
[0062] For example, after initial synchronization, all nodes in the initial cluster network are synchronized with the central GMC node; however, due to VRS, the clock will vary to varying degrees, depending on the clock precision within any cluster. To estimate, the accuracy is determined by calculating the average of the clock difference over a period of time, such as clock accuracy being described by the normalized mean square error (NMSE) of the cluster network over the time difference, i.e.: ; in, Let node i be at time i Local clock, For node j at time... Local clock, This can be a GMC node, where n is the number of nodes in the selected cluster. For at any time The clock accuracy is important. Due to inherent limitations of clocks, synchronization accuracy gradually decreases over time, leading to increasingly larger time errors over time. To limit this time difference within the desired range, different synchronization frequencies should be appropriately allocated so that the overall synchronization accuracy can be less than the preset clock accuracy requirement. ,Right now ( )≤ρ. Next synchronization time It can be: ; The synchronization frequency of each cluster depends on its network size, synchronization accuracy requirements, cluster VRS expectation, and initial offset difference.
[0063] In this distributed clock synchronization scheme, each device acting as a node in the distributed device network can have a pre-trained target Hidden Markov Model (HMM) built-in. During the operation of the distributed device network, sensors installed on the devices collect environmental observations in real time and input them into the target HMM. The target HMM performs probability calculations and state inferences based on the environmental observations to obtain the device's state prediction results. Based on these state prediction results, the devices automatically trigger requests for local clock fine-tuning or clock synchronization. The target HMM is a model obtained by offline training of an initial HMM using pre-collected historical environmental data and clock parameters, using unsupervised or semi-supervised methods. It is understood that when clock faults cannot be directly observed, using an HMM can accurately identify node anomalies, reducing false positives and false negatives. This model can distinguish between faulty nodes, environmental anomalies, and malicious nodes. For example, it can classify node states into five categories: normal, abnormal communication behavior, thermal faults, degradation due to aging, faults, and explicit faults, achieving multimodal, interpretable fault detection and node state identification. Meanwhile, the environmental awareness fault detection mechanism of this application can improve synchronization security in networks with potential node failures and malicious attacks. Specifically, the cluster's central node is first used to determine whether any node within the cluster is malicious.
[0064] For example, during training, each node periodically collects clock stamps, temperature, battery status, and relevant traffic transmission data, such as the number of data packets or bytes sent or received, and the number of unique ports. This observational data is then used to perform unsupervised or semi-supervised training on the initial Hidden Markov Model (HMM). By training with historical observational data, the HMM can analyze the state transition matrix, observation probability matrix, and initial state probability distribution. These parameters collectively constitute the model's statistical description of a specific time series process, enabling the model to perform probability calculations and state inferences, thus allowing its application in various sequence data analysis tasks. By dynamically collecting environmental observations, such as constant clock offset, temperature, battery capacity, and aging status, through various sensors installed on the nodes, the clock nodes can perceive environmental conditions. These environmental observations are then analyzed by the target HMM. The target HMM uses real-time collection of environmental observations from sensors as an observation sequence to achieve dynamic monitoring of the node's own state.
[0065] For example, the Baum-Welch algorithm can be used to train the model on historical sensor observation data from the cluster center. Simultaneously, the drift influence factors calculated by nodes within the cluster during each synchronization process can be analyzed to accurately estimate the core parameters of the Hidden Markov Model (HMM), such as the initial state distribution, state transition matrix, and observation probability matrix, thus constructing the HMM model. Through forward and backward iterative calculations, the model parameters are gradually updated while ensuring the likelihood function is monotonically increasing, thereby obtaining complete HMM model parameters that can characterize the transition patterns of node operating modes.
[0066] The initial state distribution is as follows: ; State transition matrix: ; Observation probability model: ; The observation sequence output by the sensor is acquired in real time, and the observation probability density is modeled based on a multivariate Gaussian distribution to describe the statistical characteristics of the observation vector in a given hidden state. Its observation vector The probability density is: ; in, For a moment The observation vector consists of continuous sensor readings such as clock offset and temperature. Represents hidden state The corresponding observed mean vector, Let be the covariance matrix under this state; The dimension of the observation vector; Furthermore, state inference can be achieved through the Viterbi decoding algorithm. This algorithm combines a trained Hidden Markov Model with real-time observation sequences to dynamically derive the most probable state sequence of the entire cluster network, thereby enabling real-time evaluation and monitoring of hidden states. If a cluster is inferred to be abnormal but the cluster center remains in a normal state, the central node continues to act as the trusted decision-maker. At this time, each member node actively collects extended observations (such as temperature disturbances, link delay characteristics, drift rate of change, etc.) and reports them to the central node. The central node identifies potential faulty or abnormal nodes through the fusion analysis of multi-source observation data and member states. Once an abnormal member is confirmed, its information is immediately reported, and it is isolated or its weight is reduced during synchronization to ensure overall cluster clock consistency. If the cluster center itself is inferred to be abnormal, the abnormal event is directly reported, and synchronization paths dependent on the central node are immediately suspended to cut off the propagation of erroneous clocks. Subsequently, emergency measures such as center replacement or temperature compensation are triggered according to a preset mechanism.
[0067] It is important to note that in wireless communication systems, clock synchronization often faces interference from faulty and malicious nodes. Some malicious nodes evade detection by eavesdropping on the clock stamp information of other devices and sending incorrect information to the cluster head, introducing synchronization errors and wasting communication resources. Furthermore, existing synchronization mechanisms are mostly designed based on ideal temperature assumptions, while in actual deployments, temperature is one of the key factors causing clock skew and failures. Dynamic and unpredictable temperature changes directly affect the clock rate of nodes, potentially leading to more significant out-of-synchronization phenomena than under stable conditions. In traditional distributed clock synchronization schemes, faulty nodes are often equated with malicious nodes; however, in real-world scenarios, faulty nodes can manifest in various ways. For example, a faulty, dirty-state node refers to a node that appears normal on the surface but has internally failed, resulting in invalid or erroneous data output. This can easily be misjudged as a normal node, affecting fault detection and, in severe cases, impacting the synchronization accuracy and security of the entire network. However, the distributed clock synchronization scheme of this application constructs an environment-aware fault detection mechanism, dynamically determining whether a node is faulty based on the environmental state. This leverages the powerful capabilities of Hidden Markov Model (HMM) time-series data analysis, using environmental parameters collected by the node's own observation sensors to build an HMM, thereby dynamically detecting faulty and malicious nodes. This solves the problem of traditional distributed clock synchronization schemes failing when malicious nodes eavesdrop on neighboring nodes, allowing them to evade malicious detection algorithms and thus rendering them ineffective. To a certain extent, it can resist attacks from fake master nodes attempting to steal information from neighboring nodes and influence the election process, improving the robustness and security of distributed clock synchronization. In other words, the distributed clock synchronization scheme of this invention, through the combination of hierarchical density-based noise spatial clustering algorithm and HMM, can promptly detect and handle faulty nodes, avoiding initial cluster network security risks. Specifically, hierarchical density clustering algorithm is used to improve the robustness of cluster-based network structures. Specifically, based on the estimation of the inherent defects of each node, and by accurately identifying and eliminating noisy nodes through a hidden Markov model, stable clusters are divided, and stable nodes are elected as cluster centers. At the same time, the synchronization frequency is dynamically adjusted according to the cluster stability to improve accuracy and efficiency and reduce synchronization overhead. For example, in the practical application scenario of distributed drone networks, machine learning methods can be used to predict and optimize clock synchronization by combining environmental data and clock parameters from the drones. This involves training a predictive model using historical environmental data and clock parameters collected by sensors. Drone sensors (such as barometers, temperature sensors, and accelerometers) collect environmental data in real time and combine it with time-varying clock drift and latency parameters to train a Hidden Markov Model (HMM). Subsequently, this model is used to decode subsequently collected data, thereby predicting clock synchronization errors. Furthermore, historical data is used to optimize the model during training, enabling more accurate synchronization predictions in future tasks. Before deployment and during trial operation, a large amount of data is collected for offline training of a HMM. This training data includes environmental data such as readings from the base station's built-in temperature sensor, humidity, and power supply voltage, as well as corresponding measured time-varying clock drift and latency.
[0068] Then, based on the trained model, sensor observations are acquired in real time and predictions are performed. For example, during actual mission execution, each drone continuously collects its own sensor observation data (such as temperature, vibration, power supply noise, etc.) based on an offline-trained Hidden Markov Model (HMM), and combines this with local clock parameters to perform real-time drift state prediction. The prediction results are used to dynamically update the local clock correction strategy, thereby ensuring that the entire distributed drone network maintains high-precision, low-error time synchronization during the mission. Through real-time monitoring and online inference, it can respond at the earliest stage when abnormal signs appear. The following describes three typical operating scenarios: Scenario 1: Predictive Clock Anomaly Warning. If an abnormal upward trend in the temperature data of a drone is detected, the Hidden Markov Model (HMM) predicts in multiple future time steps that its time-varying clock drift will rapidly increase, potentially leading to synchronization failure. Without waiting for the drift to actually worsen, a warning is proactively sent to the network administrator: "A drone has been detected with a potential risk of synchronization failure; it is recommended to check its cooling module." Simultaneously, its clock synchronization period is automatically adjusted from the normal value to an accelerated synchronization mode of 50ms to increase the correction frequency and slow down drift deterioration. This ensures that potential synchronization risks are suppressed early, reducing the impact of unexpected events on the overall cluster stability.
[0069] Scenario 2: Automatic Isolation and Replacement of Faulty Nodes. If a drone experiences a severe hardware failure, causing its clock synchronization to completely fail, automatic isolation measures are implemented based on a pre-defined failure detection strategy to prevent the drone from affecting the synchronization of surrounding clusters. First, the fault detection model confirms that the drone's synchronization error is unrecoverable, resulting in excessive time-varying clock drift. The drone is automatically marked as "faulty" and isolated from the cluster, prohibiting it from participating in any cooperative communication or synchronization operations. Simultaneously, based on the current cluster load, the best-performing backup drone is selected for replacement and temporarily promoted to the new cluster center node (CH). A maintenance work order is automatically generated, reminding maintenance personnel to repair the faulty drone, thus ensuring rapid response and handling of the cluster in the event of a hardware failure and preventing the faulty drone from adversely affecting the overall mission.
[0070] Scenario 3: Self-Recovery Strategy After Communication Link Interruption. In a complex collaborative task, a drone's wireless communication link might be interrupted due to low battery or signal interference, causing it to lose time synchronization with other cluster members. Based on real-time monitoring detecting the drone's synchronization error and initiating a self-recovery mode, the drone can be temporarily placed in "passive mode," ceasing its clock synchronization operation. Alternatively, neighboring drones can be activated to transmit synchronization signals to the drone via multi-point synchronization technology. Furthermore, once communication is restored, the normal synchronization cycle can be immediately resumed. This effectively addresses time-varying clock drift caused by communication interruptions, preventing communication disruptions from impacting the entire cluster's task.
[0071] As can be seen, in the distributed clock synchronization process of this invention, all clusters in the initial cluster network and the coordination center node are first initialized and synchronized. After the initial synchronization is completed, in order to overcome the problem that the inherent characteristics of the clock cannot be corrected and affect the clock synchronization accuracy, a hierarchical density-based noise application space clustering algorithm is used for intelligent clustering. Different synchronization frequencies are assigned to different target clusters in the target cluster network obtained by clustering. This clustering algorithm has hyperparameter robustness, and small changes in its parameters will not affect the overall clustering effect. It can overcome the influence of environmental noise such as temperature on clustering, so that the synchronization frequency allocation of the cluster is not affected by environmental noise such as temperature, ensuring the stability of the synchronization frequency allocation. It can also avoid relying on fixed threshold parameters, making the entire clustering process more intelligent and automated, better adaptable to different cluster network environments, and achieving strong robustness.
[0072] In one embodiment, such as Figure 9 As shown, based on the above-described clock synchronization method for distributed device networks, the present invention also provides a clock synchronization device for distributed device networks, comprising: The central node determination module 11 is used to determine the coordination center node in the current distributed device network; the coordination center node is the clock node with the smallest time-varying clock drift rate in the current distributed device network. Network construction module 12 is used to construct an initial cluster network containing multiple clusters using nodes other than the coordination center node in the current distributed device network; The clock modeling module 13 is used to perform clock modeling on each node in the initial cluster network, so as to establish a corresponding virtual clock for each node according to the local clock model obtained by modeling. The synchronization initialization module 14 is used to initialize and synchronize all clusters in the initial cluster network with the coordination center node using the local clock model. The relative clock drift determination module 15 is used to determine the relative clock drift between all nodes in the initial cluster network and the coordination center node. The node clustering module 16 is used to apply a preset hierarchical density-based noise spatial clustering algorithm and cluster all nodes in the initial cluster network according to the relative clock drift to obtain the target cluster network. The clock frequency allocation module 17 is used to allocate different synchronization frequencies to each target cluster in the target cluster network so as to control the clock synchronization of each target cluster based on the synchronization frequency.
[0073] Furthermore, it is worth noting that the working process of the clock synchronization device for a distributed device network provided in this embodiment is the same as the working process of the clock synchronization method for a distributed device network described above, and will not be repeated here. For details, please refer to the working process of the clock synchronization method for a distributed device network described above.
[0074] Figure 10 A schematic diagram of the structure of a terminal provided in an embodiment of this application. The terminal may include: The memory 501, the processor 502, and the computer program stored on the memory 501 and capable of running on the processor 502.
[0075] When the processor 502 executes the program, it implements the clock synchronization method for the distributed device network provided in the above embodiments.
[0076] Furthermore, the terminal also includes: Communication interface 503 is used for communication between memory 501 and processor 502.
[0077] The memory 501 is used to store computer programs that can run on the processor 502.
[0078] Memory 501 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.
[0079] If the memory 501, processor 502, and communication interface 503 are implemented independently, they can be interconnected via a bus to communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of representation, only one line is used in the diagram, but this does not imply that there is only one bus or one type of bus.
[0080] Optionally, in a specific implementation, if the memory 501, processor 502, and communication interface 503 are integrated on a single chip, then the memory 501, processor 502, and communication interface 503 can communicate with each other through an internal interface.
[0081] Processor 502 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application.
[0082] This embodiment also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the clock synchronization method for a distributed device network as described above.
[0083] Other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the claims.
[0084] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0085] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus or device (such as a computer-based system, a processor-included system or other system that can read and execute instructions from and from an instruction execution system, apparatus or device).
[0086] It should be understood that the various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, the N steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. If implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0087] It should be understood that the application of the present invention is not limited to the examples above. Those skilled in the art can make improvements or modifications based on the above description, and all such improvements and modifications should fall within the protection scope of the appended claims.
Claims
1. A clock synchronization method for a distributed device network, characterized in that, The method includes: Determine the coordination center node in the current distributed device network, and construct an initial cluster network containing multiple clusters using the other nodes in the current distributed device network excluding the coordination center node; the coordination center node is the clock node with the smallest time-varying clock drift rate in the current distributed device network. Clock modeling is performed on each node in the initial cluster network to establish a corresponding virtual clock for each node based on the local clock model obtained from the modeling, and the local clock model is used to initialize and synchronize all clusters in the initial cluster network with the coordination center node. Determine the relative clock drift between all nodes in the initial cluster network and the coordination center node; A target cluster network is obtained by using a preset hierarchical density-based noise spatial clustering algorithm and clustering all nodes in the initial cluster network according to the relative clock drift. Different synchronization frequencies are assigned to each target cluster in the target cluster network to control the clock synchronization of each target cluster based on the synchronization frequencies.
2. The clock synchronization method for a distributed device network according to claim 1, characterized in that, The local clock model is as follows: ; in, Let i be the clock value of node i. Let i be the initial drift of node i. time, The rate of change of clock drift. Let be the constant clock offset for node i.
3. The clock synchronization method for a distributed device network according to claim 1, characterized in that, The step of constructing an initial cluster network containing multiple clusters using nodes other than the coordination center node in the current distributed device network includes: Utilizing the nodes in the current distributed device network other than the coordination center node, an initial cluster network containing multiple clusters is constructed according to a random network topology; wherein each cluster contains a cluster center node and multiple cluster members.
4. The clock synchronization method for a distributed device network according to claim 3, characterized in that, The step of initializing and synchronizing all clusters in the initial cluster network with the coordination center node using the local clock model includes: In the initial cluster network, the cluster center nodes of all clusters and the coordination center node are synchronized by using the local clock model to calculate the corresponding time-varying clock drift and constant clock offset by transmitting a pair of data packets in the same direction and transmitting a pair of data packets symmetrically, respectively. The time-varying clock drift and constant clock offset are then corrected so that the cluster center nodes of all clusters and the coordination center node can be synchronized. After all cluster center nodes have synchronized with the coordination center node, the steps of calculating the corresponding time-varying clock drift and constant clock offset by transmitting a pair of data packets in the same direction and symmetrically transmitting a pair of data packets using the local clock model, and correcting the time-varying clock drift and constant clock offset, are repeated among all cluster center nodes and their corresponding cluster members until all nodes in the initial cluster network have synchronized with the coordination center node.
5. The clock synchronization method for a distributed device network according to claim 1, characterized in that, The step of using a preset hierarchical density-based noise-based spatial clustering algorithm and clustering all nodes in the initial cluster network according to the relative clock drift to obtain the target cluster network includes: The reachability distance between nodes is calculated based on the relative clock drift. A minimum spanning tree is constructed based on the mutual reachability distance between nodes, and the edges in the minimum spanning tree are sorted according to the mutual reachability distance to obtain the corresponding sorting result; Each node in the initial cluster network is initially set as an independent cluster, and a cluster merging operation is performed based on the sorting result until all nodes in the initial cluster network are merged into a cluster, resulting in the corresponding hierarchical tree; The clusters in the hierarchical tree are compressed to obtain a compressed hierarchical tree; Extract target clusters that meet preset stability conditions from the compressed hierarchical tree, and determine the cluster center node of each target cluster to obtain the target cluster network.
6. The clock synchronization method for a distributed device network according to claim 5, characterized in that, The determination of the cluster center node of each target cluster includes: The stability and node parameters of the nodes in each target cluster are evaluated to determine the cluster center node of each target cluster based on the evaluation results.
7. The clock synchronization method for a distributed device network according to any one of claims 1 to 6, characterized in that, In current distributed device networks, each device that acts as a node has a pre-trained target Hidden Markov Model built in. In the current distributed device network operation, environmental observation values are collected in real time by sensors installed on the device and input into the target hidden Markov model. The target hidden Markov model performs probability calculation and state inference based on the environmental observation values to obtain the state prediction result of the device. The device automatically triggers a request for local clock fine-tuning or clock synchronization based on the state prediction result. Furthermore, the target Hidden Markov Model is a model obtained by offline training of the initial Hidden Markov Model using pre-collected historical environmental data and clock parameters, based on unsupervised or semi-supervised methods.
8. A clock synchronization device for a distributed device network, characterized in that, The device includes: The central node determination module is used to determine the coordination center node in the current distributed device network; the coordination center node is the clock node with the smallest time-varying clock drift rate in the current distributed device network. The network construction module is used to construct an initial cluster network containing multiple clusters using nodes other than the coordination center node in the current distributed device network; The clock modeling module is used to perform clock modeling on each node in the initial cluster network, so as to establish a corresponding virtual clock for each node based on the local clock model obtained from the modeling. The synchronization initialization module is used to initialize and synchronize all clusters in the initial cluster network with the coordination center node using the local clock model; A relative clock drift determination module is used to determine the relative clock drift between all nodes in the initial cluster network and the coordination center node. The node clustering module is used to apply a spatial clustering algorithm based on a preset hierarchical density noise and to cluster all nodes in the initial cluster network according to the relative clock drift to obtain the target cluster network. A clock frequency allocation module is used to allocate different synchronization frequencies to each target cluster in the target cluster network in order to control the clock synchronization of each target cluster based on the synchronization frequency.
9. A terminal, characterized in that, include: A memory, a processor, and a clock synchronization program for a distributed device network stored on the memory and executable on the processor, wherein the clock synchronization program for the distributed device network, when executed by the processor, implements the steps of the clock synchronization method for a distributed device network as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that can be executed to implement the steps of the clock synchronization method for a distributed device network as described in any one of claims 1 to 7.