Time synchronization method, device, equipment, system, medium and product
By adopting dynamic time calibration and signal quality selection methods in the time synchronization system, the accuracy and robustness of time synchronization under environmental changes are solved, and higher adaptability and accuracy are achieved.
Patent Information
- Application Number
- CN202510122663.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-26
- Publication Date
- 2025-04-29
AI Technical Summary
The existing time synchronization scheme is difficult to ensure the accuracy and robustness of time synchronization when the node's environment is constantly changing.
In the time synchronization system, the node receives the time synchronization signals sent by the master node and the relay node as the slave node. Through preliminary time calibration and dynamic time calibration, the target synchronization signal is selected in combination with signal quality, and intelligent selection of multiple synchronization methods is realized.
By dynamically adjusting the synchronization strategy, the accuracy, robustness, adaptability and accuracy of time synchronization are improved, especially suitable for environments with unstable signal or complex networks.
Smart Images

Figure CN119906516A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a time synchronization method, device, equipment, storage medium and product. Background Art
[0002] Time synchronization usually refers to synchronizing time between computer systems or network devices to ensure that multiple systems or devices can operate based on a unified time standard. For many application scenarios, the accuracy of time synchronization is very important.
[0003] Currently, in time synchronization schemes, each node to be synchronized usually performs time synchronization based on a time synchronization signal sent by a master node. However, the environment in which the node is located may be constantly changing, making it difficult to ensure the accuracy and robustness of time synchronization. Summary of the invention
[0004] The present invention provides a time synchronization method, device, equipment, storage medium and product, which can solve the problem of poor accuracy and robustness of time synchronization.
[0005] According to one aspect of the present invention, a time synchronization method is provided, which is applied to a first node in a time synchronization system, wherein the time synchronization system includes a plurality of nodes, and the method includes:
[0006] In response to the first node being a slave node, receiving a first original time synchronization signal sent by a second node, wherein the second node is currently a master node;
[0007] Performing preliminary time calibration on the first node according to the first original time synchronization signal;
[0008] Receiving a second original time synchronization signal sent by the second node and a relay time synchronization signal sent by a third node, wherein the third node is currently a relay slave node;
[0009] Determine the one with higher signal quality between the second original time synchronization signal and the relay time synchronization signal as the target synchronization signal;
[0010] Dynamically time calibrate the first node according to the target synchronization signal.
[0011] According to another aspect of the present invention, a time synchronization device is provided, characterized in that it is configured in a first node of a time synchronization system, the time synchronization system includes a plurality of nodes, and the device includes:
[0012] A first receiving module, configured to receive a first original time synchronization signal sent by a second node in response to the first node being a slave node, wherein the second node is currently a master node;
[0013] A preliminary calibration module, configured to perform preliminary time calibration on the first node according to the first original time synchronization signal;
[0014] A second receiving module, configured to receive a second original time synchronization signal sent by the second node and a relay time synchronization signal sent by a third node, wherein the third node is currently a relay slave node;
[0015] A target synchronization signal determination module, configured to determine the one with higher signal quality between the second original time synchronization signal and the relay time synchronization signal as the target synchronization signal;
[0016] A dynamic calibration module is used to perform dynamic time calibration on the first node according to the target synchronization signal.
[0017] According to another aspect of the present invention, an electronic device is provided, wherein the electronic device is configured as a first node in a time synchronization system; the electronic device comprises:
[0018] at least one processor; and
[0019] a memory communicatively connected to the at least one processor; wherein,
[0020] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the time synchronization method described in any embodiment of the present invention.
[0021] According to another aspect of the present invention, a time synchronization system is provided, comprising a plurality of nodes, wherein any node among the plurality of nodes is configured in an electronic device as described in any embodiment of the present invention.
[0022] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the time synchronization method described in any embodiment of the present invention when executed.
[0023] According to another aspect of the present invention, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the time synchronization method according to any embodiment of the present invention is implemented.
[0024] The technical solution of the embodiment of the present invention, in response to the first node being a slave node, receiving the first original time synchronization signal sent by the second node, wherein the second node is currently a master node, performing preliminary time calibration on the first node according to the first original time synchronization signal, receiving the second original time synchronization signal sent by the second node and the relay time synchronization signal sent by the third node, wherein the third node is currently a relay slave node, determining the one with higher signal quality between the second original time synchronization signal and the relay time synchronization signal as the target synchronization signal, and performing dynamic time calibration on the first node according to the target synchronization signal. By adopting the above technical solution, a slave node as a relay is provided in the time synchronization system. After preliminary time calibration, if a slave node can simultaneously receive the original time synchronization signal sent by the master node and the relay time synchronization signal forwarded by the relay slave node, then further determining the synchronization signal for dynamic time synchronization according to the signal quality, realizing intelligent selection of multiple synchronization methods, thereby being able to dynamically adjust the synchronization strategy according to changes in the network environment, ensuring the accuracy and robustness of time synchronization, and improving the adaptability and precision of time synchronization, especially suitable for environments with unstable signals or complex networks.
[0025] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0027] Figure 1 is a flow chart of a time synchronization method provided according to an embodiment of the present invention;
[0028] Figure 2 is a flowchart of another time synchronization method provided according to an embodiment of the present invention;
[0029] Figure 3 is a node distribution schematic diagram provided according to an embodiment of the present invention;
[0030] Figure 4 is a schematic diagram of the structure of a time synchronization device provided according to an embodiment of the present invention;
[0031] Figure 5 It is a structural schematic diagram of an electronic device for implementing the time synchronization method of an embodiment of the present invention. DETAILED DESCRIPTION
[0032] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0033] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0034] Figure 1 It is a flowchart of a time synchronization method provided according to an embodiment of the present invention. This embodiment can be applicable to the situation of time synchronization between network nodes, and is particularly suitable for the situation of time synchronization between movable network nodes, for example, it can be applicable to the time synchronization scenario based on time division multiple access (Time Division Multiple Access, TDMA). The method can be executed by a time synchronization device, and the time synchronization device can be implemented in the form of hardware and / or software. The time synchronization device can be configured in an electronic device, and the electronic device can be a wireless access point or a base station, etc. The electronic device can be configured as a first node in a time synchronization system, and the time synchronization system includes multiple nodes, and the multiple nodes include the first node. The multiple nodes can use a preset strategy to determine the node with the master node identity, which is recorded as the master node, and the nodes other than the master node are nodes with the slave node identity, which can be recorded as slave nodes. For a certain electronic device, it can become a master node or a slave node, which can be dynamically determined.
[0035] like Figure 1 As shown, the method includes:
[0036] Step 101: In response to a first node being a slave node, receiving a first original time synchronization signal sent by a second node, wherein the second node is currently a master node.
[0037] Exemplarily, a time synchronization event can be triggered at a preset frequency, and the preset frequency is set according to actual needs. In response to the time synchronization event being triggered, the first node determines its own node identity. If the first node determines that its current identity is a slave node, it can receive a time synchronization signal sent by a node with a master node identity. In an embodiment of the present invention, the node that currently has the master node identity is recorded as the second node, and the time synchronization signal sent by the master node is recorded as the original time synchronization signal. After this time synchronization event is triggered, the original time synchronization signal received for initial time calibration can be recorded as the first original time synchronization signal. The number of first original time synchronization signals is generally multiple.
[0038] Step 102: Perform preliminary time calibration on the first node according to the first original time synchronization signal.
[0039] Exemplarily, the original time synchronization signal includes a time mark, such as a timestamp, which is recorded as a first time mark. When the second node generates the original time synchronization signal, it determines the first time mark according to the current local time of the second node and writes it into the original time synchronization signal, and broadcasts the original time synchronization signal to the outside, so that each slave node can receive the original time synchronization signal. After the first node receives the first first original time synchronization signal, the first time mark in the first first original time synchronization signal is extracted, and the current local time of the first node is adjusted to the time corresponding to the first time mark to achieve the first initial time calibration. Next, the first node can continue to receive subsequent first original time synchronization signals, and the first original time synchronization signal is periodically broadcast at a preset time interval. Each slave node can know the preset time interval in advance. Therefore, after receiving each first original time synchronization signal, the arrival time of the next first original time synchronization signal can be estimated. Exemplarily, each time the first node receives a first original time synchronization signal, it records a second time mark, and the second time mark is used to indicate the time when the first original time synchronization signal arrives at the first node. A time deviation is determined according to an estimated arrival time of a next first original time synchronization signal and an actual arrival time of the next first original time synchronization signal, and a crystal oscillator of the first node is adjusted based on one or more time deviations to complete a preliminary time calibration.
[0040] Step 103: Receive a second original time synchronization signal sent by the second node and a relay time synchronization signal sent by a third node, wherein the third node is currently a relay slave node.
[0041] For example, after preliminary time calibration, the local time of the first node can be basically consistent with that of the second node, but it is not accurate enough. In addition, as the wireless environment in which the time synchronization system is located changes and the nodes may move, further dynamic time calibration is required to improve the time synchronization accuracy.
[0042] Exemplarily, after performing preliminary time calibration, if the first node can still receive the original time synchronization signal sent by the second node, the received original time synchronization signal is recorded as the second original time synchronization signal. The slave nodes in the time synchronization system may include ordinary slave nodes and relay slave nodes. The relay slave nodes are relay slave nodes. After receiving the original time synchronization signal sent by the master node, the relay slave node can forward the original time synchronization signal, or process the original time synchronization signal and broadcast it, so that other slave nodes can receive the time synchronization signal sent by the relay slave node. The time synchronization signal is recorded as the relay time synchronization signal.
[0043] Step 104: Determine the one with higher signal quality between the second original time synchronization signal and the relay time synchronization signal as the target synchronization signal.
[0044] Exemplarily, if the first node can receive both the second original time synchronization signal and the relay time synchronization signal, the signal quality of the second original time synchronization signal and the signal quality of the relay time synchronization signal can be determined by analysis. Optionally, the signal quality of the time synchronization signal is determined based on at least one of signal strength, signal-to-noise ratio, and delay change. The signal quality of the time synchronization signal can reflect the quality of time synchronization. Therefore, a suitable synchronization strategy can be automatically selected based on the signal quality, that is, the one with higher signal quality between the second original time synchronization signal and the relay time synchronization signal is determined as the target synchronization signal, and then the first node is dynamically time calibrated according to the target synchronization signal in subsequent steps.
[0045] Optionally, if the first node can only receive the second original time synchronization signal, the second original time synchronization signal can be directly determined as the target synchronization signal; if the first node can only receive the relay time synchronization signal, the relay time synchronization signal can be directly determined as the target synchronization signal.
[0046] Step 105: Dynamically time calibrate the first node according to the target synchronization signal.
[0047] Exemplarily, the number of target synchronization signals may be one or more, and the specific dynamic time calibration method is not limited.
[0048] Optionally, the target frequency may be used to trigger the step of determining the target synchronization signal, so that the source of the target synchronization signal can be dynamically determined, further improving the accuracy of dynamic time calibration.
[0049] The time synchronization method of the embodiment of the present invention, in response to the first node being a slave node, receives the first original time synchronization signal sent by the second node, wherein the second node is currently a master node, performs preliminary time calibration on the first node according to the first original time synchronization signal, receives the second original time synchronization signal sent by the second node and the relay time synchronization signal sent by the third node, wherein the third node is currently a relay slave node, determines the one with higher signal quality between the second original time synchronization signal and the relay time synchronization signal as the target synchronization signal, and performs dynamic time calibration on the first node according to the target synchronization signal. By adopting the above technical solution, a slave node as a relay is provided in the time synchronization system. After preliminary time calibration, if a slave node can simultaneously receive the original time synchronization signal sent by the master node and the relay time synchronization signal forwarded by the relay slave node, then further determines the synchronization signal for dynamic time synchronization according to the signal quality, and realizes intelligent selection of multiple synchronization methods, so that the synchronization strategy can be dynamically adjusted according to changes in the network environment, the accuracy and robustness of time synchronization are guaranteed, and the adaptability and precision of time synchronization are improved, which is particularly suitable for environments with unstable signals or complex networks.
[0050] Figure 2 1 is a flow chart of another time synchronization method provided according to an embodiment of the present invention. This embodiment is optimized based on the above optional embodiments. For the case where there are multiple target synchronization signals, the dynamic time calibration process is refined to improve the accuracy of dynamic time calibration. Figure 2 As shown, the method includes:
[0051] Step 201: In response to a first node being a slave node, receiving a first original time synchronization signal sent by a second node, wherein the second node is currently a master node.
[0052] Step 202: Perform preliminary time calibration on the first node according to the first original time synchronization signal.
[0053] Step 203: Receive a second original time synchronization signal sent by the second node and a relay time synchronization signal sent by a third node, wherein the third node is currently a relay slave node.
[0054] Step 204: Determine the one with higher signal quality between the second original time synchronization signal and the relay time synchronization signal as the target synchronization signal.
[0055] Step 205: Determine the transmission delay times respectively corresponding to the plurality of target synchronization signals.
[0056] Exemplarily, the target synchronization signal includes a time stamp, recorded as a second time stamp. When the target synchronization signal is received, the reception time of the target synchronization signal is recorded, and the difference between the reception time and the time corresponding to the second time stamp is calculated to obtain the corresponding transmission delay time.
[0057] Step 206 , determine whether there is an abnormal transmission time in the transmission delay time, if so, execute step 207 ; otherwise, execute step 208 .
[0058] Exemplarily, during the transmission process, the target synchronization signal may be received by the first node only after being reflected by an object, such as being reflected by a small hill. Therefore, the propagation time in the air becomes longer, and both the first node and the sending node of the target synchronization signal may be in motion. Therefore, some target synchronization signals are reflected, while others are not. For multiple target synchronization signals, after calculating the transmission delay time corresponding to each target synchronization signal respectively, the transmission delay time that differs greatly from other transmission delay times is determined as an abnormal transmission time. For example, the average value of multiple transmission delay times is calculated, and then the difference between each transmission delay time and the average value is calculated, and the transmission delay time whose difference is greater than a preset threshold is determined as an abnormal transmission time. The preset threshold can be determined, for example, based on a multiple of the standard deviation of the multiple transmission delay times.
[0059] Step 207: Determine the target synchronization signals other than the target synchronization signal corresponding to the abnormal transmission time among the multiple target synchronization signals as signals to be synchronized.
[0060] For example, if there is an abnormal transmission time, it can be considered that the target synchronization signal corresponding to the abnormal transmission time is not accurate enough. Therefore, the target synchronization signal corresponding to the abnormal transmission time can be eliminated, and the target synchronization signal among multiple target synchronization signals except the target synchronization signal corresponding to the abnormal transmission time can be determined as the signal to be synchronized for subsequent dynamic time calibration.
[0061] Step 208: Determine the plurality of target synchronization signals as signals to be synchronized.
[0062] Exemplarily, if there is no abnormal transmission time, there may be two situations, such as multiple target synchronization signals are accurate enough, for example, they are not reflected by an object, or multiple target synchronization signals may all be reflected by an object, but the errors caused are basically the same. Therefore, multiple target synchronization signals can all be determined as signals to be synchronized for subsequent dynamic time calibration.
[0063] Step 209: Dynamically time calibrate the first node according to the signal to be synchronized.
[0064] The time synchronization method of the embodiment of the present invention performs preliminary time calibration from the node identity, determines multiple target synchronization signals from the second original time synchronization signal and the relay time synchronization signal according to the signal quality, further screens the target synchronization signals according to the transmission delay times corresponding to the target synchronization signals, removes the target synchronization signals corresponding to the abnormal transmission time, and then uses the remaining target synchronization signals as the signals to be synchronized to perform dynamic time calibration on the first node. By adopting the above technical solution, the low delay compensation algorithm is combined with the synchronization solution based on the quality of the wireless signal to form a dynamic and adaptive time synchronization solution, which reduces the delay problem caused by wireless transmission and further improves the synchronization accuracy and real-time performance of the system.
[0065] In some embodiments, the slave node identity includes the relay slave node identity and the common slave node identity. After the transmission delay time corresponding to the plurality of target synchronization signals is determined, it also includes: in response to the first node being a relay slave node identity, and the plurality of target synchronization signals are from the third node, the transmission distance between the first node and the third node is determined according to the transmission delay time; in response to the transmission distance being less than a preset distance threshold, if it is determined that the node sequence number of the first node is greater than the node sequence number of the third node, the first node is switched from the relay slave node identity to the common slave node identity. Thus, in the case where the first node is a relay slave node, the signal transmission distance between the first node and other relay slave nodes can be determined according to the transmission delay time, so as to dynamically adjust its own slave node type. For the entire time synchronization system, the relay slave nodes can be dynamically and reasonably set to avoid the increase of signal interference and waste of resources caused by the excessive density of the relay slave nodes, so as to realize the intelligent adjustment of the time synchronization strategy, which is particularly suitable for the case where there are movable nodes in the time synchronization system, and further improves the robustness and accuracy of time synchronization.
[0066] Exemplarily, the transmission distance can be calculated based on the product of the transmission delay time and the electromagnetic wave transmission speed. In order to improve the accuracy of the transmission distance calculation, the transmission delay time corresponding to the signal to be synchronized can be used to determine the transmission distance. For example, for each signal to be synchronized, the product of the signal to be synchronized and the electromagnetic wave transmission speed is calculated to obtain a first distance; the average value of the first transmission distances corresponding to each signal to be synchronized is calculated to obtain a second distance, and the second distance is determined as the transmission distance between the first node and the third node. The preset distance threshold can be set according to actual needs. If the transmission distance between the first node and the third node is less than the preset distance threshold, it can be considered that the first node and the third node are relatively close, that is, there are relay slave nodes with a relatively close distance, and one of them needs to be selected to cancel the relay slave node identity. Exemplarily, when constructing a time synchronization system, a fixed node serial number may be assigned to each node. When it is necessary to cancel the relay slave node identity of one of the two relay slave nodes, the relay slave node identity of which specific relay slave node is to be canceled may be determined based on the comparison result of the node serial numbers. For example, the relay slave node identity of the relay slave node with the larger serial number is canceled. If it is determined that the node serial number of the first node is greater than the node serial number of the third node, the first node is switched from the relay slave node identity to the common slave node identity. If it is determined that the node serial number of the first node is less than the node serial number of the third node, the relay slave node identity of the first node is maintained.
[0067] In some embodiments, in the process of dynamically calibrating the first node according to the target synchronization signal, it also includes: when the first node cannot receive the original time synchronization signal sent by the second node, if data packets sent by multiple nodes are received, the first node is coordinated according to the time information in the multiple data packets, wherein the multiple nodes are slave nodes. Thus, a multi-node coordination mechanism is introduced, and the clock deviation between nodes is reduced through clock synchronization mutual assistance between adjacent nodes, thereby improving the global synchronization accuracy of the system and improving the global synchronization effect.
[0068] Optionally, if the first node cannot receive the original time synchronization signal sent by the second node, the time information in the data packets sent by multiple other nodes (including ordinary slave nodes and / or relay slave nodes) that can be received (such as the data packet sending time in the data packet, recorded as the third time mark) can be integrated to perform collaborative time calibration. Among them, the specific processing method of collaborative time calibration is not limited. For example, the first node can be time-calibrated according to the time information in multiple data packets using algorithms such as least squares method or Kalman filtering, which is beneficial to the time synchronization of the entire network in the time synchronization system.
[0069] For example, Figure 3 is a node distribution diagram provided according to an embodiment of the present invention. Figure 3The nodes shown in can be all or part of the nodes in the time synchronization system. Assuming that node A is the second node (master node), node E is the first node (ordinary slave node), node B and node C are relay slave nodes, and node D is an ordinary slave node, node E is currently unable to receive the original time synchronization signal sent by node A, but can receive data packets sent by node B, node C and node D. Therefore, mutual verification can be performed based on the time information in the data packets sent by node B, node C and node D, and node E can be coordinated for time calibration to improve the accuracy of time calibration.
[0070] In some embodiments, in the process of dynamically calibrating the first node according to the target synchronization signal, it also includes: when the first node cannot receive the time synchronization signal, determining the target environment information of the environment in which the first node is located, wherein the time synchronization signal includes the original time synchronization signal and the relay time synchronization signal; determining the target deviation information corresponding to the target environment information by querying the preset mapping relationship, wherein the preset mapping relationship includes deviation information corresponding to different environment information respectively; calibrating the crystal oscillator in the first node according to the target deviation information. Thus, when the time synchronization signal cannot be received, the preset mapping relationship can be used to perform autonomous time calibration.
[0071] Exemplarily, the frequency of the crystal oscillator is mainly related to environmental factors such as temperature and humidity. Environmental information may include the temperature and / or humidity at the current sampling time, and the temperature and / or humidity at the previous sampling time, etc. In the case where the original time synchronization signal and the relay time synchronization signal cannot be received, the time is usually relatively short. Therefore, the autonomous crystal oscillator calibration can be performed according to the correspondence relationship between the deviation information corresponding to the different environmental information respectively set in advance. After the time synchronization signal is received again, the time synchronization signal can be continued to be used for time calibration to ensure the timeliness of the time synchronization of each node in the time synchronization system.
[0072] The time synchronization method provided by the embodiment of the present invention can adapt to changes in network topology or wireless environment in a complex wireless environment, ensuring that the system can maintain high synchronization accuracy, robustness and efficiency under different conditions. It is particularly suitable for scenarios such as the Internet of Things, 5G and 6G, and provides a more efficient and intelligent time synchronization solution.
[0073] Figure 4 1 is a schematic diagram of the structure of a time synchronization device provided according to an embodiment of the present invention. The device is configured in a first node of a time synchronization system, and the time synchronization system includes multiple nodes. Figure 4 As shown, the device comprises:
[0074] A first receiving module 401 is configured to receive a first original time synchronization signal sent by a second node in response to the first node being a slave node, wherein the second node is currently a master node;
[0075] A preliminary calibration module 402, configured to perform preliminary time calibration on the first node according to the first original time synchronization signal;
[0076] The second receiving module 403 is used to receive the second original time synchronization signal sent by the second node and the relay time synchronization signal sent by the third node, wherein the third node is currently a relay slave node;
[0077] A target synchronization signal determination module 404, configured to determine the one with higher signal quality between the second original time synchronization signal and the relay time synchronization signal as the target synchronization signal;
[0078] The dynamic calibration module 405 is configured to perform dynamic time calibration on the first node according to the target synchronization signal.
[0079] The time synchronization device of the embodiment of the present invention is provided with a slave node as a relay in the time synchronization system. After preliminary time calibration, if a slave node can simultaneously receive the original time synchronization signal sent by the master node and the relay time synchronization signal forwarded by the relay slave node, the synchronization signal used for dynamic time synchronization is further determined according to the signal quality, thereby realizing intelligent selection of multiple synchronization methods, so that the synchronization strategy can be dynamically adjusted according to changes in the network environment, ensuring the accuracy and robustness of time synchronization, improving the adaptability and precision of time synchronization, and being particularly suitable for environments with unstable signals or complex networks.
[0080] Optionally, the number of the target synchronization signals is multiple; wherein the dynamic calibration module includes:
[0081] A delay time determining unit, used to determine the transmission delay times respectively corresponding to the plurality of target synchronization signals;
[0082] an abnormal time determination unit, used to determine whether there is an abnormal transmission time in the transmission delay time;
[0083] a signal-to-be-synchronized determination unit, configured to determine, if there is an abnormal transmission time, a target synchronization signal other than the target synchronization signal corresponding to the abnormal transmission time among the plurality of target synchronization signals as a signal to be synchronized; if there is no abnormal transmission time, determine the plurality of target synchronization signals as a signal to be synchronized;
[0084] A dynamic calibration unit is used to perform dynamic time calibration on the first node according to the signal to be synchronized.
[0085] Optionally, the slave node identity includes the relay slave node identity and the common slave node identity; the device may further include:
[0086] a transmission distance determination module, configured to, after determining the transmission delay times respectively corresponding to the plurality of target synchronization signals, determine the transmission distance between the first node and the third node according to the transmission delay time in response to the first node being a relay slave node and the plurality of target synchronization signals coming from the third node;
[0087] The identity switching module is used to switch the first node from a relay slave node identity to a common slave node identity in response to the transmission distance being less than a preset distance threshold and if it is determined that the node sequence number of the first node is greater than the node sequence number of the third node.
[0088] Optionally, the device may further include:
[0089] A collaborative calibration module is used to, during the process of dynamically time calibrating the first node according to the target synchronization signal, when the first node cannot receive the original time synchronization signal sent by the second node, if data packets sent by multiple nodes are received, collaborative time calibration is performed on the first node according to the time information in the multiple data packets, wherein the multiple nodes are slave nodes.
[0090] Optionally, the device may further include:
[0091] a target environment information determination module, configured to determine target environment information of an environment in which the first node is located when the first node is unable to receive a time synchronization signal during the process of dynamically calibrating the first node according to the target synchronization signal, wherein the time synchronization signal includes an original time synchronization signal and a relay time synchronization signal;
[0092] A target deviation information determination module, used to determine the target deviation information corresponding to the target environment information by querying a preset mapping relationship, wherein the preset mapping relationship includes deviation information corresponding to different environment information respectively;
[0093] A deviation calibration module is used to calibrate the crystal oscillator in the first node according to the target deviation information.
[0094] The time synchronization device provided in the embodiment of the present invention can execute the time synchronization method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0095] Figure 5A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0096] like Figure 5 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0097] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0098] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as a time synchronization method.
[0099] In some embodiments, the time synchronization method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the time synchronization method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the time synchronization method in any other appropriate manner (e.g., by means of firmware).
[0100] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0101] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0102] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0103] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0104] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0105] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0106] An embodiment of the present invention provides a computer program product, including a computer program, which implements the time synchronization method provided by the above embodiment when executed by a processor.
[0107] An embodiment of the present invention provides a time synchronization system, including a plurality of nodes, wherein any node among the plurality of nodes is configured in an electronic device as described in any embodiment of the present invention.
[0108] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0109] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A time synchronization method, characterized in that: Applied to a first node in a time synchronization system, the time synchronization system comprising a plurality of nodes, the method comprising: In response to the first node being a slave node, receiving a first original time synchronization signal sent by a second node, wherein the second node is currently a master node; Performing preliminary time calibration on the first node according to the first original time synchronization signal; Receiving a second original time synchronization signal sent by the second node and a relay time synchronization signal sent by a third node, wherein the third node is currently a relay slave node; Determine the one with higher signal quality between the second original time synchronization signal and the relay time synchronization signal as the target synchronization signal; Dynamically time calibrate the first node according to the target synchronization signal.
2. The method according to claim 1, characterized in that The number of the target synchronization signals is multiple; The dynamically time calibrating the first node according to the target synchronization signal includes: Determine the transmission delay times respectively corresponding to the plurality of target synchronization signals; Determining whether there is an abnormal transmission time in the transmission delay time; If it exists, the target synchronization signals other than the target synchronization signal corresponding to the abnormal transmission time among the multiple target synchronization signals are determined as signals to be synchronized; if it does not exist, the multiple target synchronization signals are determined as signals to be synchronized; Dynamically time calibrate the first node according to the signal to be synchronized.
3. The method according to claim 2, characterized in that The slave node identity includes the relay slave node identity and the common slave node identity; After determining the transmission delay times respectively corresponding to the plurality of target synchronization signals, the method further includes: In response to the first node being a relay slave node and the plurality of target synchronization signals coming from the third node, determining a transmission distance between the first node and the third node according to the transmission delay time; In response to the transmission distance being less than a preset distance threshold, if it is determined that the node sequence number of the first node is greater than the node sequence number of the third node, the first node is switched from a relay slave node identity to a common slave node identity.
4. The method according to claim 1, characterized in that In the process of dynamically calibrating the first node according to the target synchronization signal, the process further includes: In the case where the first node cannot receive the original time synchronization signal sent by the second node, if data packets sent by multiple nodes are received, collaborative time calibration is performed on the first node based on the time information in the multiple data packets, wherein the multiple nodes are slave nodes.
5. The method according to claim 1, characterized in that In the process of dynamically calibrating the first node according to the target synchronization signal, the process further includes: In the case where the first node cannot receive a time synchronization signal, determining target environment information of an environment in which the first node is located, wherein the time synchronization signal includes an original time synchronization signal and a relay time synchronization signal; Determine the target deviation information corresponding to the target environment information by querying a preset mapping relationship, wherein the preset mapping relationship includes deviation information corresponding to different environment information respectively; The crystal oscillator in the first node is calibrated according to the target deviation information.
6. A time synchronization device, characterized in that: A first node configured in a time synchronization system, wherein the time synchronization system includes a plurality of nodes, and the device includes: A first receiving module, configured to receive a first original time synchronization signal sent by a second node in response to the first node being a slave node, wherein the second node is currently a master node; A preliminary calibration module, configured to perform preliminary time calibration on the first node according to the first original time synchronization signal; A second receiving module, configured to receive a second original time synchronization signal sent by the second node and a relay time synchronization signal sent by a third node, wherein the third node is currently a relay slave node; A target synchronization signal determination module, configured to determine the one with higher signal quality between the second original time synchronization signal and the relay time synchronization signal as the target synchronization signal; A dynamic calibration module is used to perform dynamic time calibration on the first node according to the target synchronization signal.
7. An electronic device, characterized in that: The electronic device is configured as a first node in a time synchronization system; the electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the time synchronization method according to any one of claims 1 to 5.
8. A time synchronization system, characterized in that: It comprises a plurality of nodes, and any node among the plurality of nodes is configured in the electronic device as claimed in claim 7.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the time synchronization method according to any one of claims 1 to 5 when executed.
10. A computer program product, characterized in that The computer program product comprises a computer program, which, when executed by a processor, implements the time synchronization method according to any one of claims 1 to 5.