技术领域technical field
本发明属于电子与通信领域,具体涉及一种分布式网络时钟同步系统。The invention belongs to the field of electronics and communication, and in particular relates to a distributed network clock synchronization system.
背景技术Background technique
随着信息技术的发展,分布式网络系统的应用也越来越多元化,依托于分布式网络系统的应用设备也丰富多样,分布式网络系统的时钟同步能够使该系统中的各个网络节点完成精准对时,以提供给该系统中各节点所在的控制设备应用,随着设备的改进,时钟同步的精度要求也愈来愈高。With the development of information technology, the application of the distributed network system is becoming more and more diversified, and the application equipment relying on the distributed network system is also rich and diverse. The clock synchronization of the distributed network system can make each network node in the system complete Accurate time synchronization is provided to the control equipment applications where each node in the system is located. With the improvement of equipment, the accuracy requirements of clock synchronization are getting higher and higher.
目前,分布式网络系统大多采用IEEE1588(网络测量和控制系统的精密时钟同步协议标准)协议完成系统的时钟同步,即通过硬件和软件将网络设备(客户机)的内时钟与主控机的主时钟实现同步。采用IEEE1588协议完成分布式网络系统中各终端节点的设备的时钟同步,其精度可以达到ms级。At present, most distributed network systems use the IEEE1588 (precise clock synchronization protocol standard for network measurement and control systems) protocol to complete the clock synchronization of the system, that is, the internal clock of the network device (client) and the host computer of the master computer are synchronized through hardware and software. The clocks are synchronized. The IEEE1588 protocol is used to complete the clock synchronization of the equipment of each terminal node in the distributed network system, and its precision can reach ms level.
然而,采用IEEE1588协议完成系统的时钟同步,其时间信号通过该系统信道传送到终端节点需要延时,而且不同终端节点所需要的延时也不同,所以,采用这种授时方式只能满足中等精度时间用户的要求,即只能满足ms级别的时间同步精度需求,一些对时间同步精度要求十分严格的分布式网络系统,就不能达到所需要的时钟同步精度。However, the IEEE1588 protocol is used to complete the clock synchronization of the system, and the time signal is transmitted to the terminal node through the system channel, which requires a delay, and the delay required by different terminal nodes is also different. Therefore, this timing method can only meet the requirements of medium precision. The requirements of time users can only meet the requirements of time synchronization accuracy at the ms level, and some distributed network systems that have very strict requirements on time synchronization accuracy cannot achieve the required clock synchronization accuracy.
发明内容Contents of the invention
为了解决现有技术中存在的上述问题,本发明提供了一种分布式网络时钟同步系统。本发明要解决的技术问题通过以下技术方案实现:In order to solve the above problems in the prior art, the present invention provides a distributed network clock synchronization system. The technical problem to be solved in the present invention is realized through the following technical solutions:
本发明实施例提供了一种分布式网络时钟同步系统,包括:An embodiment of the present invention provides a distributed network clock synchronization system, including:
时钟源,用于发送时钟同步信息;Clock source, used to send clock synchronization information;
至少一级从设备,逐级连接至所述时钟源,用于逐级接收所述时钟同步信息并完成时钟同步;其中,At least one level of slave equipment is connected to the clock source step by step, and is used to receive the clock synchronization information step by step and complete clock synchronization; wherein,
所述时钟源以及所述至少一级从设备均为分布式网络时钟同步系统中的节点。Both the clock source and the at least one slave device are nodes in a distributed network clock synchronization system.
在本发明的一个实施例中,所述从设备包括:接口模块、链路延时模块、时间差模块以及同步模块;其中,所述链路延时模块连接至所述接口模块,所述时间差模块连接至所述链路延时模块以及所示接口模块,所述同步模块连接至所述时间差模块以及所述接口模块。In one embodiment of the present invention, the slave device includes: an interface module, a link delay module, a time difference module, and a synchronization module; wherein the link delay module is connected to the interface module, and the time difference module It is connected to the link delay module and the interface module shown, and the synchronization module is connected to the time difference module and the interface module.
在本发明的一个实施例中,所述从设备通过所述接口模块连接所述时钟源或所述从设备。In an embodiment of the present invention, the slave device is connected to the clock source or the slave device through the interface module.
在本发明的一个实施例中,所述链路延时模块用于测量本级节点至上一级节点的链路延时,所述时间差模块用于根据所述链路延时计算所述本级节点至所述上一级节点的时间差,所述同步模块用于接收所述时间差和所述时钟同步信息完成所述本级节点的同步。In an embodiment of the present invention, the link delay module is used to measure the link delay from the node at the current level to the node at the upper level, and the time difference module is used to calculate the delay at the current level according to the link delay. The time difference between the node and the upper-level node, the synchronization module is used to receive the time difference and the clock synchronization information to complete the synchronization of the current-level node.
在本发明的一个实施例中,所述链路延时模块具体用于:In one embodiment of the present invention, the link delay module is specifically used for:
通过本级节点向上一级节点发送延迟请求报文,并记录第一时间戳,其中,所述第一时间戳为所述延迟请求报文发送时间点;Sending a delay request message to an upper-level node through the current-level node, and recording a first timestamp, wherein the first timestamp is the sending time point of the delay request message;
通过所述上一级节点接收所述延迟请求报文,并记录第二时间戳,其中,所述第二时间戳为所述延迟请求报文接收时间点;receiving the delay request message through the upper-level node, and recording a second time stamp, wherein the second time stamp is the receiving time point of the delay request message;
所述上一级节点向所述本级节点发送延迟响应报文,并记录发送时间的第三间戳,其中,所述延迟响应报文包含所述第二时间戳;The upper-level node sends a delayed response message to the current-level node, and records a third time stamp of sending time, wherein the delayed response message includes the second time stamp;
所述本级节点接收所述延迟响应报文,获取所述第二时间戳,并记录接收时间的第四时间戳;The current node receives the delayed response message, acquires the second timestamp, and records the fourth timestamp of the receiving time;
所述上一级节点向所述本级节点发送延迟响应跟随报文,其中所述延迟响应跟随报文包含有所述第三时间戳;The upper-level node sends a delayed response follow-up message to the current-level node, wherein the delayed response follow-up message includes the third timestamp;
所述本级节点接收所述延迟响应跟随报文,获取所述第三时间戳;The current-level node receives the delayed response following message, and acquires the third timestamp;
通过公式计算所述上一级节点到所述本级节点的链路延时。Calculate the link delay from the upper-level node to the current-level node by using a formula.
在本发明的一个实施例中,所述链路延时满足:In one embodiment of the present invention, the link delay satisfies:
其中,link_delay为所述上一级节点从设备到所述本级节点从设备的链路延时,t1为所述第一时间戳,t2为所述第二时间戳,t3为所述第三时间戳,t4为所述第四时间戳。Wherein, link_delay is the link delay from the upper-level node slave device to the current-level node slave device, t1 is the first timestamp, t2 is the second timestamp, and t3 is the third timestamp Timestamp, t4 is the fourth timestamp.
在本发明的一个实施例中,所述时间差模块具体用于:In one embodiment of the present invention, the time difference module is specifically used for:
通过所述上一级节点向所述本级节点发送同步报文,并记录第五时间戳;其中,所述第五时间戳为所述同步报文的发送时间点;sending a synchronization message to the current node through the upper-level node, and recording a fifth timestamp; wherein, the fifth timestamp is the sending time point of the synchronization message;
通过所述上一级节点向所述本级节点发送跟随报文,其中所述跟随报文包含所述第五时间戳;sending a follow-up message to the current-level node through the upper-level node, where the follow-up message includes the fifth timestamp;
通过所述本级节点接收所述同步报文,并记录第六时间戳;其中,所述第六时间戳为所述同步报文接收时间点;receiving the synchronization message through the node at the current level, and recording a sixth timestamp; wherein the sixth timestamp is a time point in which the synchronization message is received;
通过所述本级节点接收所述跟随报文;receiving the following message through the current node;
根据所述第五时间戳和所述第六时间戳计算所述上一级节点到所述本级节点的时间差。Calculate a time difference from the upper-level node to the current-level node according to the fifth time stamp and the sixth time stamp.
在本发明的一个实施例中,所述时间差满足:In an embodiment of the present invention, the time difference satisfies:
D=link_delay+t6-t5D=link_delay+t6-t5
其中,link_delay为所述上一级节点到所述本级节点的链路延时,D为所述上一级节点到所述本级节点的时间差,t5为第五时间戳,t6为第六时间戳。Wherein, link_delay is the link delay from the upper-level node to the current-level node, D is the time difference from the upper-level node to the current-level node, t5 is the fifth timestamp, and t6 is the sixth timestamp.
在本发明的一个实施例中,所述分布式网络时钟同步系统的时钟同步为周期性运行。In an embodiment of the present invention, the clock synchronization of the distributed network clock synchronization system runs periodically.
与现有技术相比,本发明的有益效果:Compared with prior art, the beneficial effect of the present invention:
1)本发明提供的时钟同步系统提供了更为可靠的时间同步方案,使得该系统时间同步精度达到纳秒级别,可以满足一些对时钟同步要求十分严格的分布式网络的需求;1) The clock synchronization system provided by the present invention provides a more reliable time synchronization solution, so that the time synchronization accuracy of the system reaches the nanosecond level, which can meet the requirements of some distributed networks with strict clock synchronization requirements;
2)本发明提供的时钟同步系统使分布式网络具有较强的鲁棒性,当网络中的时钟源或其他节点设备出现异常时,该系统能够在很短时间内自适应调整网络结构,重新选择合适的时钟源并完成时钟同步任务。2) The clock synchronization system provided by the present invention makes the distributed network have strong robustness. When the clock source or other node devices in the network are abnormal, the system can self-adaptively adjust the network structure in a short time, and re- Select an appropriate clock source and complete clock synchronization tasks.
附图说明Description of drawings
图1为本发明实施例提供的一种分布式网络时钟同步系统的结构示意图;FIG. 1 is a schematic structural diagram of a distributed network clock synchronization system provided by an embodiment of the present invention;
图2为本发明实施例提供的一种分布式网络时钟同步系统从设备的结构示意图;FIG. 2 is a schematic structural diagram of a slave device of a distributed network clock synchronization system provided by an embodiment of the present invention;
图3为本发明实施例提供的一种分布式网络时钟同步系统的延时测量原理示意图;FIG. 3 is a schematic diagram of a delay measurement principle of a distributed network clock synchronization system provided by an embodiment of the present invention;
图4为本发明实施例提供的一种分布式网络时钟同步系统的时间差原理示意图。FIG. 4 is a schematic diagram of a time difference principle of a distributed network clock synchronization system provided by an embodiment of the present invention.
具体实施方式Detailed ways
下面结合具体实施例对本发明做进一步详细的描述,但本发明的实施方式不限于此。The present invention will be described in further detail below in conjunction with specific examples, but the embodiments of the present invention are not limited thereto.
实施例一Embodiment one
请参见图1和图2,图1为本发明实施例提供的一种分布式网络时钟同步系统的结构示意图;图2为本发明实施例提供的一种分布式网络时钟同步系统从设备的结构示意图。一种分布式网络时钟同步系统,包括:Please refer to Figure 1 and Figure 2, Figure 1 is a schematic structural diagram of a distributed network clock synchronization system provided by an embodiment of the present invention; Figure 2 is a structure of a slave device of a distributed network clock synchronization system provided by an embodiment of the present invention schematic diagram. A distributed network clock synchronization system, comprising:
时钟源,用于发送时钟同步信息;Clock source, used to send clock synchronization information;
至少一级从设备,逐级连接至所述时钟源,用于逐级接收所述时钟同步信息并完成时钟同步;其中,At least one level of slave equipment is connected to the clock source step by step, and is used to receive the clock synchronization information step by step and complete clock synchronization; wherein,
所述时钟源以及所述至少一级从设备均为分布式网络时钟同步系统中的节点。Both the clock source and the at least one slave device are nodes in a distributed network clock synchronization system.
优选地,所述从设备包括:接口模块、链路延时模块、时间差模块以及同步模块;其中,所述链路延时模块连接至所述接口模块,所述时间差模块连接至所述链路延时模块以及所示接口模块,所述同步模块连接至所述时间差模块以及所述接口模块。Preferably, the slave device includes: an interface module, a link delay module, a time difference module, and a synchronization module; wherein the link delay module is connected to the interface module, and the time difference module is connected to the link The delay module and the interface module shown, the synchronization module is connected to the time difference module and the interface module.
优选地,所述从设备通过所述接口模块连接所述时钟源或所述从设备。Preferably, the slave device is connected to the clock source or the slave device through the interface module.
优选地,所述链路延时模块用于测量本级节点至上一级节点的链路延时,所述时间差模块用于根据所述链路延时计算所述本级节点至所述上一级节点的时间差,所述同步模块用于接收所述时间差和所述时钟同步信息完成所述本级节点的同步。Preferably, the link delay module is used to measure the link delay from the current node to the upper node, and the time difference module is used to calculate the link delay from the current node to the upper node according to the link delay. The time difference of the first-level nodes, the synchronization module is used to receive the time difference and the clock synchronization information to complete the synchronization of the current-level nodes.
优选地,所述链路延时模块具体用于:Preferably, the link delay module is specifically used for:
通过本级节点向上一级节点发送延迟请求报文,并记录第一时间戳,其中,所述第一时间戳为所述延迟请求报文发送时间点;Sending a delay request message to an upper-level node through the current-level node, and recording a first timestamp, wherein the first timestamp is the sending time point of the delay request message;
通过所述上一级节点接收所述延迟请求报文,并记录第二时间戳,其中,所述第二时间戳为所述延迟请求报文接收时间点;receiving the delay request message through the upper-level node, and recording a second time stamp, wherein the second time stamp is the receiving time point of the delay request message;
所述上一级节点向所述本级节点发送延迟响应报文,并记录发送时间的第三间戳,其中,所述延迟响应报文包含所述第二时间戳;The upper-level node sends a delayed response message to the current-level node, and records a third time stamp of sending time, wherein the delayed response message includes the second time stamp;
所述本级节点接收所述延迟响应报文,获取所述第二时间戳,并记录接收时间的第四时间戳;The current node receives the delayed response message, acquires the second timestamp, and records the fourth timestamp of the receiving time;
所述上一级节点向所述本级节点发送延迟响应跟随报文,其中所述延迟响应跟随报文包含有所述第三时间戳;The upper-level node sends a delayed response follow-up message to the current-level node, wherein the delayed response follow-up message includes the third timestamp;
所述本级节点接收所述延迟响应跟随报文,获取所述第三时间戳;The current-level node receives the delayed response following message, and acquires the third timestamp;
通过公式计算所述上一级节点到所述本级节点的链路延时。Calculate the link delay from the upper-level node to the current-level node by using a formula.
优选地,所述链路延时满足:Preferably, the link delay satisfies:
其中,link_delay为所述上一级节点从设备到所述本级节点从设备的链路延时,t1为所述第一时间戳,t2为所述第二时间戳,t3为所述第三时间戳,t4为所述第四时间戳。 Wherein, link_delay is the link delay from the upper-level node slave device to the current-level node slave device, t1 is the first timestamp, t2 is the second timestamp, and t3 is the third timestamp Timestamp, t4 is the fourth timestamp.
优选地,所述时间差模块具体用于:Preferably, the time difference module is specifically used for:
通过所述上一级节点向所述本级节点发送同步报文,并记录第五时间戳;其中,所述第五时间戳为所述同步报文的发送时间点;sending a synchronization message to the current node through the upper-level node, and recording a fifth timestamp; wherein, the fifth timestamp is the sending time point of the synchronization message;
通过所述上一级节点向所述本级节点发送跟随报文,其中所述跟随报文包含所述第五时间戳;sending a follow-up message to the current-level node through the upper-level node, where the follow-up message includes the fifth timestamp;
通过所述本级节点接收所述同步报文,并记录第六时间戳;其中,所述第六时间戳为所述同步报文接收时间点;receiving the synchronization message through the node at the current level, and recording a sixth timestamp; wherein the sixth timestamp is a time point in which the synchronization message is received;
通过所述本级节点接收所述跟随报文;receiving the following message through the current node;
根据所述第五时间戳和所述第六时间戳计算所述上一级节点到所述本级节点的时间差。Calculate a time difference from the upper-level node to the current-level node according to the fifth time stamp and the sixth time stamp.
优选地,所述时间差满足:Preferably, the time difference satisfies:
D=link_delay+t6-t5其中,link_delay为所述上一级节点到所述本级节点的链路延时,D为所述上一级节点到所述本级节点的时间差,t5为第五时间戳,t6为第六时间戳。D=link_delay+t6-t5 where link_delay is the link delay from the upper node to the current node, D is the time difference from the upper node to the current node, and t5 is the fifth Timestamp, t6 is the sixth timestamp.
优选地,所述分布式网络时钟同步系统的时钟同步为周期性运行。Preferably, the clock synchronization of the distributed network clock synchronization system runs periodically.
在本实施例中,通过时钟算法算法确定超主时钟,并测量链路延时,和时间差,并在时钟同步的基础上通过链路延时和时间差来精准校正该节点的同步时钟,使的该系统的时钟同步精度更高。In this embodiment, the supermaster clock is determined by the clock algorithm, and the link delay and time difference are measured, and the synchronous clock of the node is precisely corrected through the link delay and time difference on the basis of clock synchronization, so that The clock synchronization accuracy of the system is higher.
实施例二Embodiment two
请继续参见图1和图2,图1为本发明实施例提供的一种分布式网络时钟同步系统的结构示意图;图2为本发明实施例提供的一种分布式网络时钟同步系统从设备的结构示意图。本实施例在上述实施例的基础上,进一步对该时钟同步系统进行详细描述。分布式网络是由分布在不同地点且具有多个终端的节点互连而成的,具有较高的可靠性,同时,网络易于扩充。一种分布式网络时钟同步系统,如图1所示,N为大于等于1的自然数,该分布式网络时钟同步系统包括时钟源和至少一级从设备,其中,时钟源用于发送时钟同步信息;分布式网络中的从设备逐级连接至所述时钟源,用于逐级接收所述时钟同步信息并完成时钟同步,且所述时钟源以及所述至少一级从设备均为分布式网络时钟同步系统中的节点。Please continue to refer to Figure 1 and Figure 2, Figure 1 is a schematic structural diagram of a distributed network clock synchronization system provided by an embodiment of the present invention; Figure 2 is a slave device of a distributed network clock synchronization system provided by an embodiment of the present invention Schematic. This embodiment further describes the clock synchronization system in detail on the basis of the foregoing embodiments. The distributed network is formed by the interconnection of nodes distributed in different locations with multiple terminals, which has high reliability and is easy to expand. A distributed network clock synchronization system, as shown in Figure 1, N is a natural number greater than or equal to 1, the distributed network clock synchronization system includes a clock source and at least one level of slave equipment, wherein the clock source is used to send clock synchronization information ; The slave devices in the distributed network are connected to the clock source step by step, and are used to receive the clock synchronization information step by step and complete clock synchronization, and the clock source and the at least one level of slave devices are all distributed networks Clocks synchronize the nodes in the system.
优选地,如图2所示,该系统的从设备包括了接口模块、链路延时模块、时间差模块以及同步模块;其中,所述链路延时模块连接至所述接口模块,所述时间差模块连接至所述链路延时模块,所述同步模块连接至所述时间差模块以及所述接口模块。Preferably, as shown in Figure 2, the slave device of the system includes an interface module, a link delay module, a time difference module and a synchronization module; wherein, the link delay module is connected to the interface module, and the time difference The module is connected to the link delay module, and the synchronization module is connected to the time difference module and the interface module.
优选地,在该系统中,时钟源与从设备之间通过接口模块连接,从设备与从设备之间也通过接口模块连接;该系统在时钟同步过程中,从设备与时钟源之间以及从设备与从设备之间通过接口模块收发相关报文,且接口模块所在从设备所接收的报文,通过接口模块发送给该从设备内各模块,同时,各模块通过接口模块发送报文。Preferably, in the system, the clock source and the slave device are connected through an interface module, and the slave device is also connected through an interface module; during the clock synchronization process of the system, between the slave device and the clock source and the slave device The device and the slave device send and receive related messages through the interface module, and the message received by the slave device where the interface module is located is sent to each module in the slave device through the interface module, and at the same time, each module sends a message through the interface module.
优选地,链路延时模块用于测量本级节点至上一级节点的链路延时,时间差模块用于根据链路延时计算本级节点至上一级节点的时间差,同步模块用于接收时间差和时钟同步信息完成本级节点的时钟同步。Preferably, the link delay module is used to measure the link delay from the current node to the upper node, the time difference module is used to calculate the time difference from the current node to the upper node according to the link delay, and the synchronization module is used to receive the time difference and clock synchronization information to complete the clock synchronization of the node at this level.
优选地,在该系统时钟同步过程中,链路延时模块具体用于:通过本级节点向上一级节点发送延迟请求报文,并记录第一时间戳,其中,第一时间戳为延迟请求报文发送时间点;通过上一级节点接收延迟请求报文,并记录第二时间戳,其中,第二时间戳为延迟请求报文接收时间点;上一级节点向本级节点发送延迟响应报文,并记录发送时间的第三间戳,其中,延迟响应报文包含第二时间戳;本级节点接收延迟响应报文,获取第二时间戳,并记录接收时间的第四时间戳;上一级节点向本级节点发送延迟响应跟随报文,其中延迟响应跟随报文包含有第三时间戳;本级节点接收延迟响应跟随报文,获取第三时间戳;通过公式计算上一级节点到本级节点的链路延时,计算公式为:Preferably, during the system clock synchronization process, the link delay module is specifically configured to: send a delay request message to the upper-level node through the current-level node, and record the first timestamp, wherein the first timestamp is the delay request The time point when the message is sent; the delay request message is received by the upper-level node, and the second timestamp is recorded, where the second time stamp is the time point when the delay request message is received; the upper-level node sends a delayed response to the current-level node message, and record the third time stamp of the sending time, wherein the delayed response message contains the second time stamp; the node at this level receives the delayed response message, obtains the second time stamp, and records the fourth time stamp of the receiving time; The upper-level node sends a delayed response follow-up message to the current-level node, wherein the delayed response follow-up message contains the third timestamp; the current-level node receives the delayed response follow-up message and obtains the third timestamp; the upper-level node is calculated by the formula The calculation formula for the link delay from a node to its own node is:
其中,link_delay为所述上一级节点从设备到所述本级节点从设备的链路延时,t1为所述第一时间戳,t2为所述第二时间戳,t3为所述第三时间戳,t4为所述第四时间戳。 Wherein, link_delay is the link delay from the upper-level node slave device to the current-level node slave device, t1 is the first timestamp, t2 is the second timestamp, and t3 is the third timestamp Timestamp, t4 is the fourth timestamp.
优选地,所述时间差模块具体用于:通过所述上一级节点向所述本级节点发送同步报文,并记录第五时间戳;其中,所述第五时间戳为所述同步报文的发送时间点;通过所述上一级节点向所述本级节点发送跟随报文,其中所述跟随报文包含所述第五时间戳;通过所述本级节点接收所述同步报文,并记录第六时间戳;其中,所述第六时间戳为所述同步报文接收时间点;通过所述本级节点接收所述跟随报文;根据所述第五时间戳和所述第六时间戳计算所述上一级节点到所述本级节点的时间差。时间差的计算公式为:Preferably, the time difference module is specifically configured to: send a synchronization message to the current node through the upper-level node, and record a fifth timestamp; wherein, the fifth timestamp is the synchronization message the sending time point; sending a follow-up message to the current node through the upper-level node, wherein the follow-up message includes the fifth timestamp; receiving the synchronization message through the current-level node, And record the sixth time stamp; wherein, the sixth time stamp is the receiving time point of the synchronization message; the follow-up message is received by the current node; according to the fifth time stamp and the sixth The time stamp calculates the time difference between the upper-level node and the current-level node. The formula for calculating the time difference is:
D=link_delay+t6-t5,其中,link_delay为所述上一级节点到所述本级节点的链路延时,D为所述上一级节点到所述本级节点的时间差,t5为第五时间戳,t6为第六时间戳。D=link_delay+t6-t5, wherein link_delay is the link delay from the upper node to the current node, D is the time difference from the upper node to the current node, and t5 is the first Five timestamps, t6 is the sixth timestamp.
优选地,该分布式网络时钟同步系统的时钟选择算法为周期性计算,即每隔一个固定时间进行运算时钟选择算法,并根据时钟选择算法选取时钟源和从设备,并确定时钟同步路径,同时,该系统的时钟同步也为周期性运行,即每隔一个固定时间该系会进行一次时钟同步,确保该系统的时钟精度保持较高状态。Preferably, the clock selection algorithm of the distributed network clock synchronization system is periodic calculation, that is, the clock selection algorithm is operated every fixed time, and the clock source and slave device are selected according to the clock selection algorithm, and the clock synchronization path is determined, and at the same time , the clock synchronization of the system is also a periodic operation, that is, the system will perform clock synchronization every fixed time to ensure that the clock accuracy of the system remains high.
本发明实施例通过测量链路延时并根据链路延时计算时间差,然后实现时钟同步,使得分布式网络时钟同步系统的时钟同步精度到达纳秒级别,并且使该系统具有较强的稳定性,即当分布式网络中的设备出现异常时,该分布式网络能够在很短时间内自适应调整网络结构,重新选择合适的主时钟并完成时钟同步。The embodiments of the present invention measure the link delay and calculate the time difference according to the link delay, and then realize clock synchronization, so that the clock synchronization accuracy of the distributed network clock synchronization system reaches the nanosecond level, and the system has strong stability , that is, when a device in the distributed network is abnormal, the distributed network can adaptively adjust the network structure in a short time, reselect the appropriate master clock and complete clock synchronization.
实施例三Embodiment Three
请继续参见图3和图4,图3为本发明实施例提供的一种分布式网络时钟同步系统的延时测量原理示意图;图4为本发明实施例提供的一种分布式网络时钟同步系统的时间差原理示意图。本实施例在上述实施例的基础上对该时间感知模块及其时间同步系统进行了详细的描述。Please continue to refer to Figure 3 and Figure 4, Figure 3 is a schematic diagram of the delay measurement principle of a distributed network clock synchronization system provided by an embodiment of the present invention; Figure 4 is a distributed network clock synchronization system provided by an embodiment of the present invention Schematic diagram of the time difference principle. This embodiment describes the time awareness module and its time synchronization system in detail on the basis of the above embodiments.
分布式网络是由分布在不同地点且具有多个终端的节点机互连而成的。网中任一点均至少与两条线路相连,当任意一条线路发生故障时,通信可转经其他链路完成,具有较高的可靠性,同时,网络易于扩充。A distributed network is formed by the interconnection of node machines distributed in different locations and having multiple terminals. Any point in the network is connected to at least two lines. When any line fails, the communication can be completed through other links, which has high reliability. At the same time, the network is easy to expand.
优选地,分布式网络中的全部节点构成了一个时钟同步系统,域中的所有节点分别包括时钟源,桥和端站,其中,时钟源的数量为一个,端站的数量为至少一个,桥的数量为至少一个。分布式网络中的每一个节点为一个时间感知模块,即时钟源、桥和端站都为时间感知模块。Preferably, all nodes in the distributed network constitute a clock synchronization system, and all nodes in the domain include clock sources, bridges and end stations respectively, wherein the number of clock sources is one, the number of end stations is at least one, and the number of bridges The number of is at least one. Each node in the distributed network is a time-aware module, that is, clock sources, bridges, and end stations are all time-aware modules.
优选地,时间感知模块包括:同步站点单元(Site sync)、第一端口(port sync1)、第二端口(port sync 2)、数据中转单元(Md)、主时钟单元(Clock Master)和从时钟单元(Clock Slave),其中,同步站点单元是根据时钟选择算法选取的结果,来确定该时间感知模块为主时钟或从时钟,来确定数据流向,并调用相关的功能单元;第一端口,用于将所述同步站点单元发送的时间信息填充报文,并发出所述报文;第二端口,是用于接收数据中转单元发送的报文并解析报文,并将报文包含的时间信息发送给所述同步站点单元;数据中转单元,是与外部其他时间感知模块连接,获取报文和报文中的时间戳信息,并完成报文的转发;主时钟单元,跟时钟源连接,当该时间感知模块为主时钟时,用于提供标准时间信息,并将所述标准时间信息发送给所述同步站点单元;从时钟单元,接收和发送时间信息给所述同步站点单元,并通过时间信息计算链路延时,根据所述链路延时计算与上一级时间感知模块的时间差,并通过所述时间差校正本地时钟。Preferably, the time awareness module includes: a synchronous site unit (Site sync), a first port (port sync1), a second port (port sync 2), a data transfer unit (Md), a master clock unit (Clock Master) and a slave clock Unit (Clock Slave), wherein, the synchronous station unit is the result selected according to the clock selection algorithm to determine the master clock or slave clock of the time perception module to determine the data flow direction and call the relevant functional unit; the first port uses Filling the message with the time information sent by the synchronization site unit and sending the message; the second port is used to receive the message sent by the data transfer unit and analyze the message, and send the time information contained in the message sent to the synchronous site unit; the data transfer unit is connected with other external time perception modules, obtains the message and the timestamp information in the message, and completes the forwarding of the message; the main clock unit is connected with the clock source, when When the time perception module is the master clock, it is used to provide standard time information, and send the standard time information to the synchronization station unit; the slave clock unit receives and sends time information to the synchronization station unit, and passes the time The information calculates the link delay, calculates the time difference with the upper-level time perception module according to the link delay, and corrects the local clock through the time difference.
优选地,时钟选择算法是通过该时间感知模块所在的分布式网络的各节点之间发送Announce报文,其中,各节点接收并处理其他节点的报文信息,并通过Announce报文进行交互,比较各时钟信息,并选出主时钟,和分布式网络的时钟同步路径,其中,主时钟所在节点为主节点,与主节点相连的节点为从节点,并确定主节点与分布式网络中其他节点的同步路径。Preferably, the clock selection algorithm is to send Announce messages between the nodes of the distributed network where the time-aware module is located, wherein each node receives and processes the message information of other nodes, and interacts through the Announce messages, comparing Each clock information, and select the master clock, and the clock synchronization path of the distributed network, where the node where the master clock is located is the master node, and the node connected to the master node is the slave node, and determine the master node and other nodes in the distributed network synchronization path.
优选地,当该时间感知模块通过时钟选择算法选择为主时钟时,则该时间感知模块所在节点为主节点,与其相连接的其他节点为从节点,同步站点单元根据时钟选择算法调用主时钟单元,第一端口和数据中转单元,其中,主时钟单元与时钟源相连,提供标时间信息,主时钟单元将时间信息发送至同步站点单元,同步站点单元将时间信息发送至第一端口,第一端口对时间信息进行报文填充后获得第一报文信息,并将第一报文信息发送至数据中转单元。Preferably, when the time perception module is selected as the master clock by the clock selection algorithm, the node where the time perception module is located is the master node, and other nodes connected to it are slave nodes, and the synchronization station unit calls the master clock unit according to the clock selection algorithm , the first port and the data transfer unit, wherein the main clock unit is connected to the clock source to provide time information, the main clock unit sends the time information to the synchronization station unit, and the synchronization station unit sends the time information to the first port, the first The port obtains the first packet information after packet filling the time information, and sends the first packet information to the data transfer unit.
优选地,当该时间感知模块为从时钟时,则该时间感知模块所在节点为从节点,同步站点单元根据时钟选择算法调用数据中转单元、第二端口和从时钟单元,其中,数据中转单元通过第二报文信息发送至第二端口,第二端口解析第二报文信息获得时间信息,并将时间信息发送给同步站点单元,同步站点单元将时间信息发送至从时钟单元,从时钟单元计算出获得的时间信息与本地时钟的时间差,并校正本地时钟。当该从节点还存在下一级节点时,同步站点单元还调用第一端口,通过同步站点将校正后的时间信息发送至第一端口,并通过第一端口将校正后的时间信息进行报文填充获得第一报文信息,然后发送给数据中转单元,并通过数据中转单元发送给下一级节点。Preferably, when the time-aware module is a slave clock, the node where the time-aware module is located is a slave node, and the synchronization station unit calls the data transfer unit, the second port and the slave clock unit according to the clock selection algorithm, wherein the data transfer unit passes The second message information is sent to the second port, and the second port parses the second message information to obtain time information, and sends the time information to the synchronization station unit, and the synchronization station unit sends the time information to the slave clock unit, and the slave clock unit calculates Calculate the time difference between the obtained time information and the local clock, and correct the local clock. When the slave node still has a next-level node, the synchronization station unit also calls the first port, sends the corrected time information to the first port through the synchronization station, and sends the corrected time information to the first port through the first port. The information of the first message is obtained by filling, and then sent to the data transfer unit, and then sent to the next-level node through the data transfer unit.
优选地,当两个存在时钟同步主从关系的相连的时间感知模块要完成时钟同步时,首相需要测量链路延时,如图3所示,测量链路延时包括:Preferably, when two connected time-aware modules with a clock synchronization master-slave relationship are to complete clock synchronization, the prime minister needs to measure link delay, as shown in Figure 3, the measurement link delay includes:
通过分布式网络节点向上游相连节点发送延迟请求报文,并记录第一时间戳,其中,第一时间戳为延迟请求报文发送时间点;通过上游相连时钟节点接收延迟请求报文,并记录第二时间戳,其中,第二时间戳为延迟请求报文接收时间点;上游相连时钟节点向本节点发送延迟响应报文,并记录发送时间的第三间戳,其中,延迟响应报文包含第二时间戳;本节点接收延迟响应报文,获取第二时间戳,并记录接收时间的第四时间戳;上游相连时钟节点向本节点发送延迟响应跟随报文,其中延迟响应跟随报文包含有第三时间戳;本节点接收延迟响应跟随报文,获取第三时间戳;最后,通过公式计算链路延时,计算链路延时的公式为:Send the delay request message to the upstream connected node through the distributed network node, and record the first timestamp, where the first timestamp is the time point when the delay request message is sent; receive the delay request message through the upstream connected clock node, and record The second time stamp, wherein the second time stamp is the receiving time point of the delayed request message; the upstream connected clock node sends the delayed response message to the node, and records the third time stamp of the sending time, wherein the delayed response message contains The second timestamp; the node receives the delayed response message, obtains the second timestamp, and records the fourth timestamp of the receiving time; the clock node connected to the upstream sends a delayed response follow message to the node, wherein the delayed response follow message contains There is a third timestamp; the node receives the delayed response follow-up message and obtains the third timestamp; finally, the link delay is calculated by the formula, and the formula for calculating the link delay is:
其中,link_delay为链路延时,t1为第一时间戳,t2为第二时间戳,t3为第三时间戳,t4为第四时间戳。Wherein, link_delay is a link delay, t1 is a first timestamp, t2 is a second timestamp, t3 is a third timestamp, and t4 is a fourth timestamp.
优选地,如图4所示,测量时间差包括:通过上游相连节点向本节点发送同步报文,并记录第五时间戳;其中,第五时间戳为同步报文的发送时间点;通过上游相连节点向本节点发送跟随报文,其中跟随报文包含第五时间戳;通过本节点接收同步报文,并记录第六时间戳;其中,第六时间戳为同步报文接收时间点;通过本节点接收跟随报文;根据第五时间戳和第六时间戳计算上游相连节点与本节点的时间差,计算时间差的公式为:Preferably, as shown in Figure 4, measuring the time difference includes: sending a synchronization message to this node through an upstream connected node, and recording the fifth timestamp; wherein, the fifth timestamp is the sending time point of the synchronization message; The node sends a following message to the node, wherein the following message contains the fifth timestamp; the synchronization message is received by the node, and the sixth timestamp is recorded; the sixth timestamp is the receiving time point of the synchronization message; The node receives the following message; calculates the time difference between the upstream connected node and the current node according to the fifth timestamp and the sixth timestamp. The formula for calculating the time difference is:
D=link_delay+t6-t5D=link_delay+t6-t5
其中,link_delay为链路延时,D为时间差,t5为第五时间戳,t6为第六时间戳。Wherein, link_delay is the link delay, D is the time difference, t5 is the fifth timestamp, and t6 is the sixth timestamp.
优选地,本节点完成时钟同步后,同理,向与相连的下一级设备依次完成测量链路延时和时间差,完成时间同步,其中链路延时为本节点到其所连接的下一级设备的链路延时,并与本节点时钟同步。以此类推,直到完成分布式网络的时钟同步。Preferably, after this node completes the clock synchronization, similarly, it sequentially completes the measurement of link delay and time difference to the next-level equipment connected to it, and completes time synchronization, wherein the link delay is from the node to the next connected device. The link delay of the upper-level equipment is synchronized with the local node clock. And so on, until the clock synchronization of the distributed network is completed.
优选地,delay_Req报文、delay_Resp报文、Sync报文为事件报文;Pdelay_Resp_Follow_Up报文、Follow_Up报文为通用报文,其中,事件报文需要在发送和接收的时候记录精确的时间戳,通用报文不用记录时间戳。Preferably, the delay_Req message, the delay_Resp message, and the Sync message are event messages; the Pdelay_Resp_Follow_Up message and the Follow_Up message are general messages, wherein the event message needs to record accurate timestamps when sending and receiving, and the general Messages do not need to record timestamps.
优选地,从时钟在计算出与主时钟的时间差后,通过时钟源接口函数,调用时钟调节函数,修正与主时钟之间的时间差,从而完成与主时钟的时钟同步。Preferably, after calculating the time difference with the master clock, the slave clock calls the clock adjustment function through the clock source interface function to correct the time difference with the master clock, thereby completing the clock synchronization with the master clock.
优选地,时钟选择算法为周期性运行,分布是网络时钟同步也为周期性运行,其中,时钟选择算法和时钟同步的时间周期通过Signaling报文(信令报文)获取,Signaling报文通过设备的Signal配置接口设置。Preferably, the clock selection algorithm is a periodic operation, and the distribution is that the network clock synchronization is also a periodic operation, wherein the clock selection algorithm and the time period of clock synchronization are obtained through a Signaling message (signaling message), and the Signaling message is passed through the device The Signal configuration interface settings.
在本实施例中,通过测量相连设备之间的链路延时进一步计算时间差,并通过时间差校正同步时钟,逐级完成分布式网络的时钟同步,采用该方式可以使分布式网络达到纳秒级别的时钟同步精度,而且该分布式网络时钟同步的稳定性较强,能更满足更多设备的需求。In this embodiment, the time difference is further calculated by measuring the link delay between connected devices, and the synchronous clock is corrected by the time difference, and the clock synchronization of the distributed network is completed step by step. Using this method, the distributed network can reach the nanosecond level The clock synchronization accuracy is high, and the distributed network clock synchronization is more stable, which can better meet the needs of more devices.
以上内容是结合具体的优选实施方式对本发明所作的进一步详细说明,不能认定本发明的具体实施只局限于这些说明。对于本发明所属技术领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干简单推演或替换,都应当视为属于本发明的保护范围。The above content is a further detailed description of the present invention in conjunction with specific preferred embodiments, and it cannot be assumed that the specific implementation of the present invention is limited to these descriptions. For those of ordinary skill in the technical field of the present invention, without departing from the concept of the present invention, some simple deduction or replacement can be made, which should be regarded as belonging to the protection scope of the present invention.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201810439743.7ACN108599888A (en) | 2018-05-09 | 2018-05-09 | A kind of distributed network clock synchronizing system |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201810439743.7ACN108599888A (en) | 2018-05-09 | 2018-05-09 | A kind of distributed network clock synchronizing system |
| Publication Number | Publication Date |
|---|---|
| CN108599888Atrue CN108599888A (en) | 2018-09-28 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201810439743.7APendingCN108599888A (en) | 2018-05-09 | 2018-05-09 | A kind of distributed network clock synchronizing system |
| Country | Link |
|---|---|
| CN (1) | CN108599888A (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109451521A (en)* | 2018-12-27 | 2019-03-08 | 广东超讯通信技术股份有限公司 | A kind of GPS synchronous method of base station intensive distributed networking |
| CN109921871A (en)* | 2018-12-20 | 2019-06-21 | 清华大学 | A kind of method for synchronizing time, device and network system |
| CN111107622A (en)* | 2019-10-25 | 2020-05-05 | 湖南国科防务电子科技有限公司 | A time synchronization system and method for adaptive networking based on ultra-wideband wireless communication |
| CN111638749A (en)* | 2020-06-02 | 2020-09-08 | 北京润科通用技术有限公司 | Simulation system synchronization method, simulation device and system |
| CN112152744A (en)* | 2019-06-28 | 2020-12-29 | 比亚迪股份有限公司 | Clock synchronization method and device, FPGA chip and optical fiber communication network |
| CN113055114A (en)* | 2021-03-08 | 2021-06-29 | 东北大学 | Oil transportation pipe network time synchronization method based on dynamic compensation and hierarchical transmission |
| CN113783650A (en)* | 2021-08-25 | 2021-12-10 | 浙江万胜智能科技股份有限公司 | Method for accurate time synchronization between smart meter and smart terminal based on characteristic current |
| CN114039692A (en)* | 2021-11-04 | 2022-02-11 | 西安数道航空技术有限公司 | Hard clock synchronization method |
| CN114362866A (en)* | 2021-11-25 | 2022-04-15 | 北京卓越信通电子股份有限公司 | A TSN Network Time Synchronization Master Clock Hot Standby System |
| CN114584247A (en)* | 2022-03-04 | 2022-06-03 | 北京小马睿行科技有限公司 | Time synchronization method, detection device and system |
| WO2023029669A1 (en)* | 2021-09-02 | 2023-03-09 | 华为技术有限公司 | Time synchronization monitoring method |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102176317A (en)* | 2011-01-14 | 2011-09-07 | 东软集团股份有限公司 | Method and system for realizing multi-screen playing frame level synchronization of passenger guidance system |
| CN102468898A (en)* | 2010-11-19 | 2012-05-23 | 中兴通讯股份有限公司 | Method, equipment and system for realizing time synchronization in time division multiplexing network |
| CN103442312A (en)* | 2013-09-06 | 2013-12-11 | 国家电网公司 | Intelligent power distribution network time synchronization system and method based on PTN+EPON communication system |
| CN203423769U (en)* | 2013-09-06 | 2014-02-05 | 国家电网公司 | Time synchronization system for intelligent power distribution network based on PTN+EPON communication system |
| CN104113386A (en)* | 2014-07-09 | 2014-10-22 | 北京东土科技股份有限公司 | Method and device for monitoring Ethernet clock synchronization |
| CN106130681A (en)* | 2016-07-25 | 2016-11-16 | 广州市国飞信息科技有限公司 | High-accuracy clock synchronization method, module, equipment and system for time dissemination system |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102468898A (en)* | 2010-11-19 | 2012-05-23 | 中兴通讯股份有限公司 | Method, equipment and system for realizing time synchronization in time division multiplexing network |
| CN102176317A (en)* | 2011-01-14 | 2011-09-07 | 东软集团股份有限公司 | Method and system for realizing multi-screen playing frame level synchronization of passenger guidance system |
| CN103442312A (en)* | 2013-09-06 | 2013-12-11 | 国家电网公司 | Intelligent power distribution network time synchronization system and method based on PTN+EPON communication system |
| CN203423769U (en)* | 2013-09-06 | 2014-02-05 | 国家电网公司 | Time synchronization system for intelligent power distribution network based on PTN+EPON communication system |
| CN104113386A (en)* | 2014-07-09 | 2014-10-22 | 北京东土科技股份有限公司 | Method and device for monitoring Ethernet clock synchronization |
| CN106130681A (en)* | 2016-07-25 | 2016-11-16 | 广州市国飞信息科技有限公司 | High-accuracy clock synchronization method, module, equipment and system for time dissemination system |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109921871A (en)* | 2018-12-20 | 2019-06-21 | 清华大学 | A kind of method for synchronizing time, device and network system |
| CN109451521A (en)* | 2018-12-27 | 2019-03-08 | 广东超讯通信技术股份有限公司 | A kind of GPS synchronous method of base station intensive distributed networking |
| CN109451521B (en)* | 2018-12-27 | 2022-06-03 | 超讯通信股份有限公司 | GPS synchronization method for base station intensive distributed networking |
| CN112152744A (en)* | 2019-06-28 | 2020-12-29 | 比亚迪股份有限公司 | Clock synchronization method and device, FPGA chip and optical fiber communication network |
| CN111107622A (en)* | 2019-10-25 | 2020-05-05 | 湖南国科防务电子科技有限公司 | A time synchronization system and method for adaptive networking based on ultra-wideband wireless communication |
| CN111107622B (en)* | 2019-10-25 | 2023-08-11 | 长沙北斗产业安全技术研究院股份有限公司 | A time synchronization system and method for adaptive networking based on ultra-wideband wireless communication |
| CN111638749A (en)* | 2020-06-02 | 2020-09-08 | 北京润科通用技术有限公司 | Simulation system synchronization method, simulation device and system |
| CN113055114B (en)* | 2021-03-08 | 2022-06-03 | 东北大学 | A Time Synchronization Method of Oil Pipeline Network Based on Dynamic Compensation and Staged Transfer |
| CN113055114A (en)* | 2021-03-08 | 2021-06-29 | 东北大学 | Oil transportation pipe network time synchronization method based on dynamic compensation and hierarchical transmission |
| CN113783650A (en)* | 2021-08-25 | 2021-12-10 | 浙江万胜智能科技股份有限公司 | Method for accurate time synchronization between smart meter and smart terminal based on characteristic current |
| WO2023029669A1 (en)* | 2021-09-02 | 2023-03-09 | 华为技术有限公司 | Time synchronization monitoring method |
| CN114039692A (en)* | 2021-11-04 | 2022-02-11 | 西安数道航空技术有限公司 | Hard clock synchronization method |
| CN114039692B (en)* | 2021-11-04 | 2022-09-30 | 西安数道航空技术有限公司 | Hard clock synchronization method |
| CN114362866A (en)* | 2021-11-25 | 2022-04-15 | 北京卓越信通电子股份有限公司 | A TSN Network Time Synchronization Master Clock Hot Standby System |
| CN114584247A (en)* | 2022-03-04 | 2022-06-03 | 北京小马睿行科技有限公司 | Time synchronization method, detection device and system |
| Publication | Publication Date | Title |
|---|---|---|
| CN108599888A (en) | A kind of distributed network clock synchronizing system | |
| CN108650050A (en) | A kind of distributed network clock synchronous method | |
| US9923656B2 (en) | Methods, systems, and computer readable media for testing recovered clock quality | |
| CN102394715B (en) | Clock synchronizing method and device | |
| WO2018006686A1 (en) | Method, apparatus and device for optimizing time synchronization between communication network devices | |
| CN103929293A (en) | Asymmetric delay time synchronization method and system | |
| CN106899370A (en) | A kind of clock chain circuit changing method, device and base station | |
| CN104333426B (en) | Pulse per second synchronization method based on merging unit SV message sampling sequence number learning | |
| CN103166792B (en) | Line asymmetrical compensation method, equipment and system | |
| CN111385050A (en) | Clock synchronization method, device and storage medium | |
| CN110492965A (en) | The method and apparatus of serial message clock synchronization in a kind of master-slave system | |
| CN105376043B (en) | A kind of method for synchronizing time of double board systems | |
| CN104378193A (en) | Time synchronization system and method, exchanger and embedded interface board | |
| CN103168440B (en) | Time path compensation method and device | |
| CN102202386B (en) | Clock synchronization method, device and system | |
| CN111385051A (en) | Clock synchronization method, device and storage medium | |
| CN108134644B (en) | Synchronization method, device, synchronization device and system | |
| WO2017032113A1 (en) | Method and apparatus for measuring time synchronization deviation | |
| CN108683472A (en) | A kind of clock synchronizing method based on Time delay measurement | |
| CN109921871A (en) | A kind of method for synchronizing time, device and network system | |
| US10334539B2 (en) | Metered interface | |
| CN107786293A (en) | Method for synchronizing time, clock equipment, from clockwork and clock synchronization system | |
| CN101247169A (en) | A method, system and device for realizing time synchronization in a communication network | |
| CN109996325A (en) | A kind of clock system and method for wireless sensor network | |
| CN111711506A (en) | A communication system and timing method thereof |
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| RJ01 | Rejection of invention patent application after publication | ||
| RJ01 | Rejection of invention patent application after publication | Application publication date:20180928 |