WO2013029441A1 - 一种时钟同步方法及装置 - Google Patents

一种时钟同步方法及装置 Download PDF

Info

Publication number
WO2013029441A1
WO2013029441A1 PCT/CN2012/078883 CN2012078883W WO2013029441A1 WO 2013029441 A1 WO2013029441 A1 WO 2013029441A1 CN 2012078883 W CN2012078883 W CN 2012078883W WO 2013029441 A1 WO2013029441 A1 WO 2013029441A1
Authority
WO
WIPO (PCT)
Prior art keywords
clock source
candidate
clock
primary
source device
Prior art date
Application number
PCT/CN2012/078883
Other languages
English (en)
French (fr)
Inventor
王斌
夏靓
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Priority to EP12827400.8A priority Critical patent/EP2738971B1/en
Priority to RU2014112233/07A priority patent/RU2583847C2/ru
Priority to BR112014004559A priority patent/BR112014004559A2/pt
Publication of WO2013029441A1 publication Critical patent/WO2013029441A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • H04J3/0658Clock or time synchronisation among packet nodes
    • H04J3/0661Clock or time synchronisation among packet nodes using timestamps
    • H04J3/0667Bidirectional timestamps, e.g. NTP or PTP for compensation of clock drift and for compensation of propagation delays
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • H04J3/0641Change of the master or reference, e.g. take-over or failure of the master

Definitions

  • the present invention relates to a 1588 clock synchronization protocol, and more particularly to a clock synchronization method and apparatus. Background technique
  • Precision Time Protocol (PTP) IEEESTD1588 is one of the most important technologies in the field of time and frequency synchronization control.
  • the 1588 protocol specifies that the slave clock device simultaneously records several valid clock source devices as alternate clock sources. The best one of the preferred clock sources is selected as the primary clock source of the current system by using the best master clock algorithm (BMC).
  • BMC master clock algorithm
  • the slave clock device interacts with the preferred clock source to calculate the time and frequency deviation. Correct the time and frequency of the slave clock device.
  • switch to the secondary priority source calculated by the BMC algorithm in the alternate clock source and then restart the protocol interaction to perform calculation and synchronization.
  • the technical problem to be solved by the embodiments of the present invention is to provide a clock synchronization method and device, which can accurately track a new alternate clock source immediately when the current primary clock source fails.
  • the embodiment of the present invention provides a clock synchronization method, including: the slave clock device simultaneously performs protocol packet interaction with multiple candidate clock source devices, according to the multiple candidate clock source devices. The interaction of the protocol packets, respectively calculating the time and frequency deviation from each of the candidate clock source devices, and performing locking with the plurality of candidate clock source devices;
  • the slave clock device selects a master clock source from the plurality of candidate clock source devices, and corrects its own time and frequency with a time and frequency offset from the master clock source.
  • the selecting, by the slave clock device, the primary clock source from the multiple candidate clock source devices includes:
  • the slave clock device When the slave clock device does not lock any one of the plurality of clock source devices, select the clock source device with the highest priority from the plurality of clock source devices as the primary clock source.
  • the method further includes:
  • the slave clock device When the slave clock device locks a clock source device and finds an alternate clock source device with a higher priority, selects the higher priority candidate clock source device as the primary clock source; or waits After locking with the higher priority clock source device, the higher priority clock source device is used as the primary clock source.
  • the method further includes:
  • the slave clock device locks a clock source device and finds an alternate clock source device having a lower priority than the master clock source, calculating a time and frequency deviation from the found candidate clock source device, Locking with the discovered alternate clock source device.
  • the method further includes:
  • the slave clock device finds that the primary clock source fails, selects a second highest priority candidate clock source device from the plurality of candidate clock source devices, and selects a secondary high priority candidate clock source When the device is locked, the secondary high priority alternate clock source device is used as the primary clock source.
  • the method further includes:
  • the slave clock device finds that the primary clock source fails, selects a second highest priority candidate clock source device from the plurality of candidate clock source devices, and the slave clock device is in the second highest priority
  • an embodiment of the present invention further provides a clock synchronization apparatus, including: a text interaction unit, a deviation calculation unit, a main clock source selection unit, and a time ⁇ positive unit, where:
  • the packet interaction unit is configured to perform protocol packet interaction with a plurality of candidate clock source devices;
  • the deviation calculation unit is configured to be configured according to the packet interaction unit and the plurality of candidate clock source devices Interacting with the protocol packets, respectively calculating a time and frequency deviation from each of the candidate clock source devices, and performing locking with the plurality of candidate clock source devices;
  • the primary clock source selection unit is configured to select an active clock source from the plurality of candidate clock source devices
  • the time correction unit is configured to adopt a time and frequency deviation from the primary clock source, a time and a frequency.
  • the primary clock source selection unit selects the clock source device with the highest priority from the plurality of clock source devices when the deviation calculation unit does not lock any one of the plurality of clock source devices As the primary clock source.
  • the primary clock source selection unit selects the higher priority when the offset calculation unit has locked an candidate clock source device and finds a higher priority candidate clock source device.
  • the alternate clock source device is used as the primary clock source; or after waiting for the higher priority alternate clock source device to be locked, the higher priority alternate clock source device is used as the primary clock source.
  • the primary clock source selection unit calculates and works when the offset calculation unit has locked an alternate clock source device and finds an alternate clock source device having a lower priority than the primary clock source.
  • the time and frequency deviation of the discovered clock source device is locked with the discovered clock source device.
  • the primary clock source selection unit selects a second highest priority candidate clock source device from the plurality of candidate clock source devices when the primary clock source is found to be invalid, When the priority clock source device is not locked, select the highest priority candidate clock source device among the locked candidate clock source devices as the primary clock source; or, the second highest priority candidate clock The source device acts as the primary clock source; when the secondary clock source device with the second highest priority is locked, The second highest priority alternate clock source device acts as the primary clock source.
  • the embodiment of the present invention starts to lock immediately after discovering the candidate clock source device, instead of waiting for the switch to start locking the candidate clock source device, so that the slave clock device simultaneously locks the multiple candidate clock source devices, Correcting the time and frequency of the device by using the time and frequency deviation from the preferred clock source.
  • the clock source device is switched, it is switched to the candidate clock source device that has been locked as much as possible.
  • the embodiment of the present invention not only shortens the switching. Time, and can ensure the synchronization accuracy of time and frequency during the switching to the greatest extent, speed up the switching speed of the clock source device, and improve the switching performance.
  • FIG. 1 is a schematic diagram of synchronization of a master-slave clock device in the prior art
  • FIG. 2 is a schematic diagram of synchronization of a master-slave clock device according to a preferred embodiment of the present invention
  • FIG. 3 is a flow chart showing an alternative clock source joining in a clock synchronization method according to a preferred embodiment of the present invention
  • FIG. 4 is a flowchart of performing a failover of a primary clock source in a clock synchronization method according to a preferred embodiment of the present invention
  • FIG. 5 is a block diagram of a clock synchronizing apparatus in accordance with a preferred embodiment of the present invention. Preferred embodiment of the invention
  • the slave clock device simultaneously performs protocol packet exchange with multiple candidate clock source devices, and simultaneously calculates PDV (network delay jitter) of the link of the multiple candidate clock source devices, and further calculates and selects multiple candidate clocks. Time and frequency deviation of the source device. When a clock source switch occurs, the time and frequency deviation of the new link is used to correct the time and frequency of the slave clock device.
  • PDV network delay jitter
  • Step 1 When a new alternate clock source device is discovered from the clock device, a link with the alternate clock source device is established and maintained from the clock device, protocol communication is performed, the PDV is calculated, and the candidate clock source device is further calculated. Time and frequency offsets to establish linkages with multiple alternate clock source devices and calculate time and frequency offsets for locking with multiple alternate clock sources; Step 2: When the slave clock device does not currently lock any clock source device, the slave clock device selects the candidate clock source device with the highest priority as the primary clock source, and uses the time and frequency deviation from the master clock source. Time and frequency;
  • Step 3 When the slave clock device has locked an alternate clock source device, and the new candidate clock source device is not as high as the current primary clock source, the time and frequency deviation of the new clock source device is also calculated. Without switching;
  • Step 4 When the slave clock device has locked an alternate clock source device, and the new alternate clock source device has a higher priority, the user may choose to switch immediately or temporarily not to switch, waiting for the new higher The priority clock source device is locked and then switched;
  • Step 5 When the current primary clock source device fails, if the secondary high priority candidate clock source is already locked, the slave clock device immediately switches to the preferred clock source device, and uses the time and frequency of the clock source device. The time and frequency of the deviation itself;
  • Step 6 When the current primary clock source device fails, if the secondary high priority candidate clock source is not locked, you can choose to switch to the unlocked second highest priority clock source device or switch to the current one according to user settings. The highest priority of the locked alternate clock source devices;
  • the user can also be allowed to perform the clock source device switching at any time by manual operation or directly specify the main clock source regardless of the lock status.
  • the implementation process of the clock synchronization method of the present embodiment on a network having two backup clock sources will be described below with reference to the accompanying drawings.
  • the 1588 slave clock device discovers 1588 clock source 1, source 2, and source 3.
  • the slave clock device determines which clock source to use as the primary clock source according to the BMC algorithm.
  • Other clock source devices automatically become the alternate clock source. If the priority of 1588 clock source 1 is the highest, the slave clock device selects source 1 as the primary clock. Only source 1 is locked after the source. When source 1 fails, the one with the higher priority among the alternate sources is locked.
  • the process of relocking takes a while and performs poorly in the short term.
  • the messages related to the interaction include protocol (advertise), synchronization (Sync), delay request (Delay_req), delay response (Delay_resp) and other protocol messages.
  • the preferred embodiment of the present invention performs the following steps when adding a new clock source to the network:
  • Step 301 1588 detects the clock source 1 from the clock device, starts to lock the clock source 1, and outputs the time and frequency of the clock source 1;
  • Step 302 1588 discovers the clock source 2 from the clock device, starts to lock the clock source 2, and does not switch the output;
  • Step 303 The clock source device determines whether the priority of the clock source 2 is greater than the priority of the source 1. If the value is less than , step 304 is performed; if not, step 305 is performed;
  • Step 304 Continue to output the time and frequency of the source 1 from the clock device, do not switch, calculate the time and frequency deviation from the clock source 2, and end;
  • Step 305 The clock device determines whether the clock source 1 is locked, if not, executing step 306; if it is locked, executing step 307;
  • Step 306 The time and frequency of switching from the clock device to the output clock source 2 are ended.
  • Step 307 It is determined from the clock device whether the user sets the priority to use the locked clock source. If the user sets the priority to use the locked clock source, step 308 is performed; The user does not set the priority to use the locked clock source, and step 309 is performed;
  • Step 308 The slave clock device does not temporarily switch, waiting for the clock source 2 to lock and then switch to the output clock source 2 time and frequency;
  • Step 309 Immediately switch the time and frequency of the output clock source 2 link from the clock device.
  • the 1588 slave clock device can correctly perform the join switch operation.
  • Step 402 1588, when the clock device finds that the clock source 1 is invalid, it determines whether the clock source 2 is locked.
  • Step 403 If the clock source 2 is locked, switch the time and frequency of the output source 2; Step 404: If the clock source 2 is not locked, determine whether the user sets the priority to use the locked clock source;
  • Step 405 If the user does not set the priority use lock clock source, switch to the time and frequency of the output clock source 2;
  • Step 407 If the clock source 3 is locked, switch the output clock source 3 time and frequency; Step 408: If the clock source 3 is not locked, then there is no other locked clock source, then switch to the highest priority valid clock source, That is, the time and frequency of the clock source 2 are output.
  • the source selection is made.
  • the 1588 slave clock device can correctly perform the failover operation.
  • FIG. 5 is a diagram showing a clock synchronization apparatus according to a preferred embodiment of the present invention, including: a message interaction unit, a deviation calculation unit, a main clock source selection unit, and a time correction unit, wherein:
  • the packet interaction unit is configured to perform protocol packet exchange with multiple candidate clock source devices.
  • the deviation calculation unit is configured to calculate according to the interaction between the packet interaction unit and the protocol packets of the multiple candidate clock source devices. Locking with multiple candidate clock source devices with time and frequency deviation from each alternate clock source device;
  • a primary clock source selection unit configured to select a primary clock source from a plurality of candidate clock source devices
  • a time correction unit configured to use a time and frequency deviation correction time from the primary clock source Frequency.
  • the main clock source selection unit calculates the time and time of the found clock source device when the deviation calculation unit has locked a clock source device and finds an alternative clock source device having a lower priority than the main clock source. Frequency deviation, performing a lock with the discovered clock source device.
  • the primary clock source selection unit selects the second highest priority candidate clock source device from the plurality of candidate clock source devices when the primary clock source fails, and is not locked with the second highest priority candidate clock source device.
  • the candidate clock source device with the highest priority is selected as the primary clock source
  • the second highest priority device is selected when the secondary clock source device with the second highest priority is locked. Select the clock source device as the primary clock source; or use the second highest priority alternate clock source device as the primary clock source.
  • modules or steps of the present invention can be implemented by a general-purpose computing device, which can be concentrated on a single computing device or distributed over a network composed of multiple computing devices. Alternatively, they may be implemented by program code executable by the computing device, such that they may be stored in the storage device by the computing device and, in some cases, may be different from the order herein.
  • the steps shown or described are performed, or they are separately fabricated into individual integrated circuit modules, or a plurality of modules or steps are fabricated as a single integrated circuit module.
  • the invention is not limited to any particular combination of hardware and software.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Synchronisation In Digital Transmission Systems (AREA)

Abstract

本发明实施例公开了一种时钟同步方法及装置,包括:从时钟设备同时与多个时钟源设备进行协议报文的交互,根据与多个时钟源设备的协议报文的交互,分别计算与每个时钟源设备的时间和频率偏差,进行与多个时钟源设备的锁定;从时钟设备从多个时钟源设备中选择主用时钟源,采用与主用时钟源的时间和频率偏差修正自身的时间和频率。本发明实施例在发现时钟源设备后立即开始锁定,而不是等到切换后才开始锁定时钟源设备,使从时钟设备同时锁定多路时钟源设备,当发生时钟源设备切换的时候,切换到当前已经锁定的时钟源设备上,能够最大程度的保证切换期间的时间和频率的同步精度,加快时钟源设备切换速度,提高切换性能。

Description

一种时钟同步方法及装置 技术领域
本发明涉及 1588时钟同步协议, 尤其涉及一种时钟同步方法及装置。 背景技术
精确时钟同步协议 ( Precision Time Protocol, PTP ) IEEESTD1588是在时 间和频率同步控制领域中的重要技术之一。 1588协议规定了从时钟设备同时 记录若干个有效时钟源设备为备选时钟源。 通过最佳时钟算法(Best Master Clock Algorithm, BMC )选出其中最好的一个优选时钟源作为当前系统的主 用时钟源, 从时钟设备与优选时钟源进行协议交互, 计算出时间和频率偏差 并修正从时钟设备的时间和频率。 当优选源失效时, 切换到备选时钟源中按 BMC算法计算得出的次优先源, 再重新开始协议交互, 进行计算和同步。
在实际的网络应用上存在以下问题: 从时钟设备按照协议跟随优选时钟 源时, 需要累积一段时间的 PDV (网络延迟抖动) 变化数据, 才能正确计算 并滤除当前链路的 PDV。 由于链路不同各个备选时钟源与从时钟设备之间的 PDV会有较大的差别。 一旦发生链路切换, 原来累积的 PDV变化数据不能 适用新的链路, 这时计算出的 PDV是不正确的, 需要重新累积 PDV变化数 据计算 PDV。 这就需要消耗较多的时间才能使从时钟设备正确跟随新的时钟 源, 计算出准确的 PDV, 从而计算出时间和频率偏差。 在采用不同的滤波方 式和 PDV的变化情况不同时, 累积 PDV变化数据的时间甚至长达几分钟到 几十分钟。
从发生链路切换到重新锁定时钟源这段时间内, 从时钟设备输出的时间 和频率的抖动都比锁定情况下有较大偏差, 频率和时间同步性能较差。 发明内容
本发明实施例要解决的技术问题是提供一种时钟同步方法及装置, 能够 在当前主用时钟源失效时, 立即准确的跟踪新的备选时钟源。 为解决上述技术问题, 本发明实施例提供了一种时钟同步方法, 包括: 从时钟设备同时与多个备选时钟源设备进行协议报文的交互, 根据与所 述多个备选时钟源设备的协议报文的交互, 分别计算与每个备选时钟源设备 的时间和频率偏差, 进行与所述多个备选时钟源设备的锁定;
所述从时钟设备从所述多个备选时钟源设备中选择主用时钟源, 采用与 所述主用时钟源的时间和频率偏差修正自身的时间和频率。
可选地, 所述从时钟设备从所述多个备选时钟源设备中选择主用时钟源 包括:
所述从时钟设备在未锁定所述多个时钟源设备的任意之一时, 从所述多 个时钟源设备中选择出优先级最高的时钟源设备作为主用时钟源。
可选地, 还包括:
所述从时钟设备在已锁定一时钟源设备, 并且发现有优先级更高的备选 时钟源设备时, 选择将所述优先级更高的备选时钟源设备作为主用时钟源; 或者等待与所述优先级更高的时钟源设备锁定后, 将所述优先级更高的时钟 源设备作为主用时钟源。
可选地, 还包括:
所述从时钟设备在已锁定一时钟源设备, 并且发现优先级比所述主用时 钟源低的备选时钟源设备时, 计算与所发现的备选时钟源设备的时间和频率 偏差, 进行与所发现的备选时钟源设备的锁定。
可选地, 还包括:
所述从时钟设备在发现主用时钟源失效时, 从所述多个备选时钟源设备 中选择次高优先级的备选时钟源设备, 在与所述次高优先级的备选时钟源设 备已锁定时, 将所述次高优先级的备选时钟源设备作为主用时钟源。
可选地, 还包括:
所述从时钟设备在发现主用时钟源失效时, 从所述多个备选时钟源设备 中选择次高优先级的备选时钟源设备, 所述从时钟设备在与所述次高优先级 的备选时钟源设备未锁定时, 选择已锁定的备选时钟源设备中优先级最高的 备选时钟源设备作为主用时钟源; 或者, 将所述次高优先级的备选时钟源设 备作为主用时钟源。
为解决上述技术问题, 本发明实施例的还提供了一种时钟同步装置, 包 括: 文交互单元、 偏差计算单元、 主用时钟源选择单元和时间 ^正单元, 其中:
所述报文交互单元,设置成与多个备选时钟源设备进行协议报文的交互; 所述偏差计算单元, 设置成根据所述报文交互单元与所述多个备选时钟 源设备的协议报文的交互, 分别计算与每个备选时钟源设备的时间和频率偏 差, 进行与所述多个备选时钟源设备的锁定;
所述主用时钟源选择单元, 设置成从所述多个备选时钟源设备中选择主 用时钟源;
所述时间修正单元, 设置成采用与所述主用时钟源的时间和频率偏差爹 正时间和频率。
可选地, 所述主用时钟源选择单元在所述偏差计算单元未锁定所述多个 时钟源设备的任意之一时, 从所述多个时钟源设备中选择出优先级最高的时 钟源设备作为主用时钟源。
可选地, 所述主用时钟源选择单元在所述偏差计算单元已锁定一备选时 钟源设备, 并且发现有优先级更高的备选时钟源设备时, 选择将所述优先级 更高的备选时钟源设备作为主用时钟源; 或者等待与所述优先级更高的备选 时钟源设备锁定后, 将所述优先级更高的备选时钟源设备作为主用时钟源。
可选地, 所述主用时钟源选择单元在所述偏差计算单元已锁定一备选时 钟源设备, 并且发现优先级比所述主用时钟源低的备选时钟源设备时, 计算 与所发现的时钟源设备的时间和频率偏差, 进行与所发现的时钟源设备的锁 定。
可选地, 所述主用时钟源选择单元在发现主用时钟源失效时, 从所述多 个备选时钟源设备中选择次高优先级的备选时钟源设备, 在与所述次高优先 级的备选时钟源设备未锁定时, 选择已锁定的备选时钟源设备中优先级最高 的备选时钟源设备作为主用时钟源; 或者, 将所述次高优先级的备选时钟源 设备作为主用时钟源; 在与所述次高优先级的备选时钟源设备已锁定时, 将 所述次高优先级的备选时钟源设备作为主用时钟源。
综上所述, 本发明实施例在发现备选时钟源设备后立即开始锁定, 而不 是等到切换后才开始锁定备选时钟源设备, 使从时钟设备同时锁定多路备选 时钟源设备, 只使用与优选时钟源的时间和频率偏差进行本设备时间和频率 的修正, 当发生时钟源设备切换的时候, 尽量切换到当前已经锁定的备选时 钟源设备上, 本发明实施例不但缩短了切换时间, 而且能够最大程度的保证 切换期间的时间和频率的同步精度, 加快时钟源设备切换速度, 提高切换性 能。 附图概述
图 1是现有技术中的主从时钟设备的同步示意图;
图 2是本发明较佳实施方式的主从时钟设备的同步示意图;
图 3 是本发明较佳实施方式时钟同步方法中进行备选时钟源加入的流 程;
图 4是本发明较佳实施方式时钟同步方法中进行主用时钟源失效切换的 流程;
图 5是本发明较佳实施方式时钟同步装置的架构图。 本发明的较佳实施方式
本实施方式中从时钟设备同时与多个备选时钟源设备进行协议报文交 互, 同时计算多个备选时钟源设备对应链路的 PDV (网络延迟抖动) , 进而 计算与多个备选时钟源设备的时间和频率偏差。 当发生时钟源切换时, 釆用 新链路的时间和频率偏差来修正从时钟设备的时间和频率。
本实施方式的时钟同步方法, 包括:
步骤一: 从时钟设备发现新的备选时钟源设备时, 从时钟设备开始建立 和维护与该备选时钟源设备的链接, 进行协议通讯, 计算 PDV并进一步计算 与该备选时钟源设备的时间和频率偏差, 从而与多个备选时钟源设备建立链 接并计算出时间和频率偏差, 进行与多个备选时钟源的锁定; 步骤二: 在从时钟设备当前没有锁定任何时钟源设备时, 从时钟设备选 择优先级最高的备选时钟源设备作为主用时钟源, 采用与主用时钟源的时间 和频率偏差 ^正自身的时间和频率;
步骤三: 在从时钟设备已经锁定一路备选时钟源设备, 而新的备选时钟 源设备优先级还不如当前的主用时钟源高时, 也计算新的时钟源设备的时间 和频率偏差, 而不进行切换;
步骤四: 在从时钟设备已经锁定一路备选时钟源设备, 并且新的备选时 钟源设备具有更高的优先级时, 用户可以选择立即切换或暂时不进行切换, 而等待该新的更高优先级的备选时钟源设备锁定后再进行切换;
步骤五: 在当前主用时钟源设备失效时, 如果次高优先级的备选时钟源 已经锁定, 则从时钟设备立即切换到该次优选时钟源设备, 采用与该时钟源 设备的时间和频率偏差 自身的时间和频率;
步骤六: 在当前主用时钟源设备失效时, 如果次高优先级的备选时钟源 未锁定, 则可以根据用户设置来选择切换到未锁定的次高优先级时钟源设备 还是切换到当前已锁定的备选时钟源设备中优先级最高的一个;
当然, 也可以允许用户随时通过手动操作立即执行时钟源设备切换或不 考虑锁定状态直接指定主用时钟源。 下面结合附图对本实施方式的时钟同步方法在一个拥有两个备用时钟源 的网络上的实现过程进行说明。
如图 1所示,在现有的主备时钟源网络中, 1588从时钟设备同时发现 1588 时钟源 1、 源 2和源 3。 1588从时钟设备根据 BMC算法决定使用哪个时钟源 作为主用时钟源, 其他时钟源设备则自动成为备用时钟源,假定 1588时钟源 1的优先级最高, 则从时钟设备选择源 1作为主用时钟源后只锁定源 1。 当源 1 失效时再去锁定备用源中优先级较高的那个。 重新锁定的过程需要消耗一 段时间并且短期内性能较差。 其中, 涉及交互的报文有通告 ( announce ) 、 同步(Sync ) 、 延时请求(Delay_req ) 、 延时响应 (Delay_resp )等协议报 文。 如图 2所示, 本发明较佳实施方式中从时钟设备同时锁定时钟源 1、 源 2 和源 3 , 但仅采用与源 1 的时间和频率偏差修正自身的时间和频率。 当发生 切换时, 如切换到源 2, 则改变输出为源 2链路计算出的时间和频率偏差, 而不再有重新锁定的过程。
如图 3所示, 本发明较佳实施方式在网络中加入新的时钟源时按以下步 骤进行:
步骤 301 : 1588从时钟设备发现时钟源 1, 开始锁定时钟源 1, 输出时钟 源 1的时间和频率;
步骤 302: 1588从时钟设备发现时钟源 2, 开始锁定时钟源 2, 暂不切换 输出;
步骤 303: 1588时钟源设备判断时钟源 2的优先级是否大于源 1的优先 级, 如杲小于, 则执行步骤 304; 如杲不小于, 执行步骤 305;
步骤 304: 从时钟设备继续输出源 1 的时间和频率, 不切换, 计算与时 钟源 2的时间和频率偏差, 结束;
步骤 305: 从时钟设备判定时钟源 1是否已锁定, 如果未锁定, 则执行 步骤 306; 如果已锁定, 执行步骤 307;
步骤 306: 从时钟设备切换到输出时钟源 2的时间和频率, 结束; 步骤 307: 从时钟设备判断用户是否设置优先使用锁定时钟源, 如果用 户设置优先使用锁定时钟源, 则执行步骤 308; 如果用户没有设置优先使用 锁定时钟源, 执行步骤 309;
步骤 308: 从时钟设备暂不进行切换, 等待时钟源 2锁定后再切换到输 出时钟源 2的时间和频率;
步骤 309: 从时钟设备立即切换输出时钟源 2链路的时间和频率。
按以上步骤进行源选择, 当网络中加入时钟源 2时, 1588从时钟设备就 能够正确进行加入切换操作。
如图 4所示, 本发明较佳实施方式中, 当网络中原有的主用时钟源失效 时按以下步骤进行:
步骤 401 : 1588从时钟设备发现时钟源 1、 2和 3,锁定时钟源 1、 2和 3 , 假设优先级 (1>2>3), 此时从时钟设备输出与时钟源 1交互计算得到的时间和 频率;
步骤 402: 1588从时钟设备发现时钟源 1失效, 则判定时钟源 2是否锁 定;
步骤 403 : 如果时钟源 2已锁定, 则切换输出源 2的时间和频率; 步骤 404: 如果时钟源 2未锁定, 则判断用户是否设置优先使用锁定时 钟源;
步骤 405: 如果用户未设置优先使用锁定时钟源 , 则切换到输出时钟源 2 的时间和频率;
步骤 406: 如果用户设置优先使用锁定时钟源, 则判定时钟源 3是否锁 定;
步骤 407: 如果时钟源 3已锁定, 则切换输出时钟源 3时间和频率; 步骤 408: 如果时钟源 3未锁定, 这时已经没有其他锁定时钟源, 则切 换到优先级最高的有效时钟源, 即输出时钟源 2的时间和频率。
按以上步骤进行源选择, 当网络中优选时钟源 1失效时, 1588从时钟设 备就能够正确进行失效切换操作。
图 5所示为本发明较佳实施方式的时钟同步装置, 包括: 报文交互单元、 偏差计算单元、 主用时钟源选择单元和时间修正单元, 其中:
报文交互单元, 设置成与多个备选时钟源设备进行协议报文的交互; 偏差计算单元, 设置成根据报文交互单元与多个备选时钟源设备的协议 报文的交互, 分别计算与每个备选时钟源设备的时间和频率偏差, 进行与多 个备选时钟源设备的锁定;
主用时钟源选择单元,设置成从多个备选时钟源设备中选择主用时钟源; 时间修正单元, 设置成采用与主用时钟源的时间和频率偏差修正时间和 频率。
主用时钟源选择单元在偏差计算单元未锁定多个时钟源设备的任意之一 时, 从多个时钟源设备中选择出优先级最高的时钟源设备作为主用时钟源。
主用时钟源选择单元在偏差计算单元已锁定一时钟源设备, 并且发现有 优先级更高的备选时钟源设备时, 选择将优先级更高的备选时钟源设备作为 主用时钟源; 或者等待与优先级更高的备选时钟源设备锁定后, 将优先级更 高的备选时钟源设备作为主用时钟源。
主用时钟源选择单元在所述偏差计算单元已锁定一时钟源设备, 并且发 现优先级比所述主用时钟源低的备选时钟源设备时, 计算与所发现的时钟源 设备的时间和频率偏差, 进行与所发现的时钟源设备的锁定。
主用时钟源选择单元在发现主用时钟源失效时, 从多个备选时钟源设备 中选择次高优先級的备选时钟源设备, 在与次高优先级的备选时钟源设备未 锁定时, 选择已锁定的备选时钟源设备中优先级最高的备选时钟源设备作为 主用时钟源; 在与次高优先级的备选时钟源设备已锁定时, 将次高优先级的 备选时钟源设备作为主用时钟源; 或者, 将次高优先级的备选时钟源设备作 为主用时钟源。
显然, 本领域的技术人员应该明白, 上述的本发明的各模块或各步骤可 以用通用的计算装置来实现, 它们可以集中在单个的计算装置上, 或者分布 在多个计算装置所组成的网络上, 可选地, 它们可以用计算装置可执行的程 序代码来实现, 从而, 可以将它们存储在存储装置中由计算装置来执行, 并 且在某些情况下, 可以以不同于此处的顺序执行所示出或描述的步骤, 或者 将它们分别制作成各个集成电路模块, 或者将它们中的多个模块或步骤制作 成单个集成电路模块来实现。 这样, 本发明不限制于任何特定的硬件和软件 结合。
以上所述仅为本发明的优选实施例而已, 并不用于限制本发明, 对于本 领域的技术人员来说, 本发明可以有各种更改和变化。 凡在本发明的精神和 原则之内, 所作的任何修改、 等同替换、 改进等, 均应包含在本发明的保护 范围之内。 工业实用性
本发明实施例提供的时钟同步方法及装置, 在发现备选时钟源设备后立 即开始锁定, 使从时钟设备同时锁定多路备选时钟源设备, 只使用与优选时 钟源的时间和频率偏差进行本设备时间和频率的修正, 当发生时钟源设备切 换的时候, 尽量切换到当前已经锁定的备选时钟源设备上, 可以缩短切换时 间, 保证切换期间的时间和频率的同步精度, 加快时钟源设备切换速度, 提 高切换性能。

Claims

权利 要 求 书
1、 一种时钟同步方法, 包括:
从时钟设备同时与多个备选时钟源设备进行协议报文的交互, 根据与所 述多个备选时钟源设备的协议报文的交互, 分别计算与每个备选时钟源设备 的时间和频率偏差, 进行与所述多个备选时钟源设备的锁定;
所述从时钟设备从所述多个备选时钟源设备中选择主用时钟源, 采用与 所述主用时钟源的时间和频率偏差修正自身的时间和频率。
2、 如权利要求 1所述的方法,其中所述从时钟设备从所述多个备选时钟 源设备中选择主用时钟源包括:
所述从时钟设备在未锁定所述多个备选时钟源设备的任意之一时, 从所 述多个备选时钟源设备中选择出优先级最高的时钟源设备作为主用时钟源。
3、 如权利要求 1所述的方法,其中所述从时钟设备从所述多个备选时钟 源设备中选择主用时钟源包括:
所述从时钟设备在已锁定一备选时钟源设备, 并且发现有优先级更高的 备选时钟源设备时, 选择将所述优先级更高的备选时钟源设备作为主用时钟 源; 或者等待与所述优先级更高的备选时钟源设备锁定后, 将所述优先级更 高的备选时钟源设备作为主用时钟源。
4、 如权利要求 1所述的方法,其中所述从时钟设备从所述多个备选时钟 源设备中选择主用时钟源包括:
所述从时钟设备在已锁定一备选时钟源设备, 并且发现优先级比所述主 用时钟源低的备选时钟源设备时, 计算与所发现的备选时钟源设备的时间和 频率偏差, 进行与所发现的备选时钟源设备的锁定。
5、 如权利要求 1所述的方法, 还包括:
所述从时钟设备在发现主用时钟源失效时, 从所述多个备选时钟源设备 中选择次高优先级的备选时钟源设备, 在与所述次高优先级的时钟源设备已 锁定时, 将所述次高优先级的备选时钟源设备作为主用时钟源。
6、 如权利要求 1所述的方法, 还包括:
所述从时钟设备在发现主用时钟源失效时, 从所述多个备选时钟源设备 中选择次高优先级的备选时钟源设备, 所述从时钟设备在与所述次高优先级 的备选时钟源设备未锁定时, 选择已锁定的备选时钟源设备中优先级最高的 备选时钟源设备作为主用时钟源; 或者, 将所述次高优先级的备选时钟源设 备作为主用时钟源。
7、 一种时钟同步装置, 其包括: 报文交互单元、 偏差计算单元、 主用时 钟源选择单元和时间修正单元, 其中:
所述报文交互单元,设置成与多个备选时钟源设备进行协议报文的交互; 所述偏差计算单元, 设置成根据所述报文交互单元与所述多个备选时钟 源设备的协议报文的交互, 分别计算与每个备选时钟源设备的时间和频率偏 差, 进行与所述多个备选时钟源设备的锁定;
所述主用时钟源选择单元, 设置成从所述多个备选时钟源设备中选择主 用时钟源;
所述时间 单元, 设置成釆用与所述主用时钟源的时间和频率偏差爹 正时间和频率。
8、 如权利要求 7所述的装置, 其中:
所述主用时钟源选择单元在所述偏差计算单元未锁定所述多个备选时钟 源设备的任意之一时, 从所述多个备选时钟源设备中选择出优先级最高的时 钟源设备作为主用时钟源。
9、 如权利要求 7所述的装置, 其中:
所述主用时钟源选择单元在所述偏差计算单元已锁定一备选时钟源设 备, 并且发现有优先级更高的备选时钟源设备时, 选择将所述优先级更高的 备选时钟源设备作为主用时钟源; 或者等待与所述优先级更高的备选时钟源 设备锁定后, 将所述优先级更高的备选时钟源设备作为主用时钟源。
10、 如权利要求 7所述的装置, 其中:
所述主用时钟源选择单元在所述偏差计算单元已锁定一备选时钟源设 备, 并且发现优先级比所述主用时钟源低的备选时钟源设备时, 计算与所发 现的时钟源设备的时间和频率偏差,进行与所发现的备选时钟源设备的锁定。
11、 如权利要求 7所述的装置, 还包括:
所述主用时钟源选择单元在发现主用时钟源失效时, 从所述多个备选时 钟源设备中选择次高优先级的备选时钟源设备, 在与所述次高优先级的备选 时钟源设备未锁定时, 选择已锁定的备选时钟源设备中优先级最高的备选时 钟源设备作为主用时钟源;在与所述次高优先级的备选时钟源设备已锁定时, 将所述次高优先级的备选时钟源设备作为主用时钟源; 或者, 将所述次高优 先级的备选时钟源设备作为主用时钟源。
PCT/CN2012/078883 2011-09-01 2012-07-19 一种时钟同步方法及装置 WO2013029441A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
EP12827400.8A EP2738971B1 (en) 2011-09-01 2012-07-19 Method and device for clock synchronization
RU2014112233/07A RU2583847C2 (ru) 2011-09-01 2012-07-19 Способ и устройство для синхронизации часов
BR112014004559A BR112014004559A2 (pt) 2011-09-01 2012-07-19 método e dispositivo para sincronização de relógio

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201110256492.7A CN102291232B (zh) 2011-09-01 2011-09-01 一种时钟同步方法及装置
CN201110256492.7 2011-09-01

Publications (1)

Publication Number Publication Date
WO2013029441A1 true WO2013029441A1 (zh) 2013-03-07

Family

ID=45337357

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2012/078883 WO2013029441A1 (zh) 2011-09-01 2012-07-19 一种时钟同步方法及装置

Country Status (5)

Country Link
EP (1) EP2738971B1 (zh)
CN (1) CN102291232B (zh)
BR (1) BR112014004559A2 (zh)
RU (1) RU2583847C2 (zh)
WO (1) WO2013029441A1 (zh)

Families Citing this family (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102291232B (zh) * 2011-09-01 2017-04-12 中兴通讯股份有限公司 一种时钟同步方法及装置
CN102752065B (zh) * 2012-06-29 2015-09-09 华为技术有限公司 一种时间同步方法及系统
CN102983960A (zh) * 2012-12-06 2013-03-20 盛科网络(苏州)有限公司 Ptp中实现快速同步切换的方法及装置
CN105024798A (zh) * 2014-04-28 2015-11-04 中兴通讯股份有限公司 一种时间同步的方法及装置
CN104052565B (zh) * 2014-06-26 2017-01-25 青岛海信移动通信技术股份有限公司 一种时间同步方法和通信终端
CN104579534B (zh) * 2014-12-31 2017-10-10 北京东土科技股份有限公司 一种sdh网络中的时钟同步方法及系统
CN105515752B (zh) * 2015-12-07 2018-04-20 中国航空工业集团公司西安航空计算技术研究所 一种消除网络时钟偏差的数据同步方法
CN106911414A (zh) * 2015-12-22 2017-06-30 中兴通讯股份有限公司 时钟同步方法和装置
CN105577311A (zh) * 2015-12-25 2016-05-11 中国南方电网有限责任公司电网技术研究中心 被授时设备1588自适应对时方法与系统
CN106936529B (zh) * 2017-02-28 2018-12-07 南方电网科学研究院有限责任公司 用于并行冗余协议网络中的时钟输出控制方法和系统
CN107070579A (zh) * 2017-05-16 2017-08-18 中国船舶重工集团公司第七0九研究所 三级时间服务器控制与容错方法
CN107342831B (zh) * 2017-06-07 2019-02-26 北京东土军悦科技有限公司 一种主定时源确定方法及装置
JP7301689B2 (ja) * 2019-09-13 2023-07-03 株式会社東芝 Ptpメッセージ選択方法およびプログラム、ならびにptpスレーブ装置
TWI748902B (zh) * 2020-05-19 2021-12-01 瑞昱半導體股份有限公司 用於無縫精確時間協定的控制方法以及時間感知橋接裝置
CN112867132B (zh) * 2020-12-27 2022-07-15 卡斯柯信号有限公司 一种基于ptp的多链路时延抖动优化方法及装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101686093A (zh) * 2008-09-28 2010-03-31 大唐移动通信设备有限公司 传输网时钟同步的方法、设备及系统
US20100098111A1 (en) * 2008-10-21 2010-04-22 Huawei Technologies Co., Ltd. Method and system for precise-clock synchronization, and device for precise-clock frequency/time synchronization
US20100150288A1 (en) * 2008-12-17 2010-06-17 Miao Zhu Synchronization of Low Noise Local Oscillator using Network Connection
CN102123024A (zh) * 2011-03-17 2011-07-13 中兴通讯股份有限公司 一种时钟源设备切换选择方法、系统及装置
CN102291232A (zh) * 2011-09-01 2011-12-21 中兴通讯股份有限公司 一种时钟同步方法及装置

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
RU2133489C1 (ru) * 1997-07-09 1999-07-20 Акционерное общество закрытого типа Фирма "Котлин" Система формирования временных поправок по сигналам спутниковой радионавигационной системы к шкалам времени пространственно разнесенных пунктов
US20100254225A1 (en) * 2009-04-03 2010-10-07 Schweitzer Iii Edmund O Fault tolerant time synchronization

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101686093A (zh) * 2008-09-28 2010-03-31 大唐移动通信设备有限公司 传输网时钟同步的方法、设备及系统
US20100098111A1 (en) * 2008-10-21 2010-04-22 Huawei Technologies Co., Ltd. Method and system for precise-clock synchronization, and device for precise-clock frequency/time synchronization
US20100150288A1 (en) * 2008-12-17 2010-06-17 Miao Zhu Synchronization of Low Noise Local Oscillator using Network Connection
CN102123024A (zh) * 2011-03-17 2011-07-13 中兴通讯股份有限公司 一种时钟源设备切换选择方法、系统及装置
CN102291232A (zh) * 2011-09-01 2011-12-21 中兴通讯股份有限公司 一种时钟同步方法及装置

Also Published As

Publication number Publication date
RU2583847C2 (ru) 2016-05-10
BR112014004559A2 (pt) 2017-06-13
EP2738971A4 (en) 2015-01-28
RU2014112233A (ru) 2015-10-10
EP2738971A1 (en) 2014-06-04
CN102291232A (zh) 2011-12-21
CN102291232B (zh) 2017-04-12
EP2738971B1 (en) 2016-09-21

Similar Documents

Publication Publication Date Title
WO2013029441A1 (zh) 一种时钟同步方法及装置
WO2013182161A1 (zh) 一种时间同步方法和装置
WO2012163172A1 (zh) 一种时钟同步方法及设备
US10181919B2 (en) Synchronization method, controller, synchronization node, synchronous network, and storage medium
WO2013117143A1 (zh) 一种时钟同步方法和装置
WO2013170736A1 (zh) 一种分组网络同步方法、装置及系统
WO2014101669A1 (zh) 时间同步方法及系统
EP2782290A1 (en) Method, system and apparatus for implementing hybrid networking of multiple clock synchronization technologies
JP5450656B2 (ja) 通信装置及び時刻同期システム
WO2017101528A1 (zh) 一种时钟链路切换方法、装置及基站
WO2015170201A1 (en) A method for robust ptp synchronization with default 1588v2 profile
WO2013063943A1 (zh) 一种北向数据配置与自组织网络配置协调处理方法及系统
WO2017107519A1 (zh) 时钟同步方法和装置
WO2015165192A1 (zh) 一种时间同步的方法及装置
WO2012155663A1 (zh) 基于ieee 1588协议调整频率的方法及网络装置
JP5736550B1 (ja) 基地局装置
WO2012048574A1 (zh) 一种实现路由器全保护的方法及系统
WO2014101668A1 (zh) 时间同步处理方法及装置
WO2012152124A1 (zh) 外接时间端口的倒换方法及装置
WO2013091202A1 (zh) 一种同步方法、设备及系统
WO2014086254A1 (zh) 时钟保护方法、系统和相关普通时钟设备
WO2016177240A1 (zh) 一种实现频率同步的方法和装置
JP2018117227A (ja) 時刻同期方法
CN102904661A (zh) Ptp设备实现平滑重启的方法及ptp设备
WO2015078167A1 (zh) 一种确定备份时钟源的方法及装置、计算机存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 12827400

Country of ref document: EP

Kind code of ref document: A1

REEP Request for entry into the european phase

Ref document number: 2012827400

Country of ref document: EP

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2014112233

Country of ref document: RU

Kind code of ref document: A

REG Reference to national code

Ref country code: BR

Ref legal event code: B01A

Ref document number: 112014004559

Country of ref document: BR

ENP Entry into the national phase

Ref document number: 112014004559

Country of ref document: BR

Kind code of ref document: A2

Effective date: 20140226