IEEE1588 chapter6.6 Synchronization overview

6.6.1 General

PTP协议的正常执行分为两步

(1) 建立master-salve hierarchy

(2)同步时钟 synchronizing the clocks

6.6.2 建立master-slave hireachy

6.6.2.1 General

在每一个domain内,每个ordinary cloc 或者boundary clock的port都执行一个独立的protocol的state machine. 对于"state decision events",每个port都会explain 在port上接收到的所以的Announce message的信息。通过用best maste clock algorithm 算法, 对 Announce message 的内容以及与ordinary clock或boundary clock相关联的data sets进行分析,以确定每个port的clock的状态。

6.6.2.2 PTP state machine

每个ordinary 或者boundary clock的port都分别独立maintain一个PTP state machine的copy。这个state machine定义了port的allowed states 以及各个状态之间的跳转规则。 确定master-slave hierarchy 的端口状态(port state)如下:

  a) MASTER: The port is the source of time on the path served by the port.

 b) SLAVE: The port synchronizes to the device on the path with the port that is in the MASTER state.

 c) PASSIVE: The port is not the master on the path nor does it synchronize to a master.

6.6.2.3 Best master clock algorithm

  Best master clock algorithm 比较两个clock的data describing 来决定哪一个data describe更好的时钟。此算法用来确定local port 接收到的几个Announce messages中描述的clock是best clock。它也可以用来决定一个newly discovered clock ——a forgine master——是否是比local clock更好。 描述 foreign master的data describing 包含在 grandmaster fields中的Announce message中。描述local clock的data 包含在defauldDS data set中。

  Best master clock algorithm 由两个独立的算法构成: a) Data set comparison algorithm    b) State decision algorithm

Data set comparison algorithm 是基于具有以下优先级的属性的成对比较:

a) priority1: A user configurable designation that a clock belongs to an ordered set of clocks from which a master is selected
b) clockClass: An attribute defining a clock’s TAI traceability
c) clockAccuracy: An attribute defining the accuracy of a clock
d) offsetScaledLogVariance: An attribute defining the stability of a clock
e) priority2: A user configurable designation that provides finer grained ordering among otherwise
equivalent clocks
f) clockIdentity: A tie-breaker based on unique identifiers

除了此优先级顺序外,当两个Announce message反应相同的foreign master时,还使用由 local clock和foreign master之间的 boundary clocks的数量测量的"distance".该距离在“Announce”消息的stepsRemoved字段中指示。 这种情况可能发生在PTP系统中,循环路径未被PTP之外的协议删除。 数据集比较算法明确选择两个时钟之一为“更好”或“拓扑更好”.

状态决策算法根据数据集比较算法的结果以及本地时钟的类别是否小于128,确定端口的下一个状态(推荐状态)是MASTER,SLAVE还是PASSIVE。 参见7.6.2.4。然后,端口协议引擎根据协议状态机的当前状态评估此推荐状态,以确定实际的下一个端口状态。

6.6.2.4 Simple master-slave hierachy

The process establishing a master−slave hierarchy among the ordinary and boundary clocks in a domain is
illustrated in Figure 10.


In this example, ordinary clock-1 is at the root of the hierarchy and is called the grandmaster clock. Port-1 of boundary clock-1 is a slave (as indicated by the S) to the grandmaster clock. All other ports on boundary clock-1 are masters to the clocks connected to them. Thus, port-1 of boundary clock-2 is a slave to boundary clock-1 and so forth. Only ordinary and boundary clocks maintain this form of state, and only boundary clocks establish the branch points in the master−slave hierarchy (i.e., paths 1, 2, 3, 4, and 5 may contain transparent clocks, but these clocks do not participate in the master−slave hierarchy and do not maintain this form of state).

6.6.2.5 Pruning mesh topologies

图11说明了通过协议将网状网络简化为树状主从层次结构的情况。 当基础桥接或路由协议没有消除循环路径时,就会发生这种情况。 在图11中,假定通过最佳主时钟算法已将普通时钟1选择为主时钟。 在边界时钟中,已通过最佳主时钟算法选择了端口状态,如图所示,以构造树。 修剪的路径以虚线显示。 对于每个边界时钟,最佳主时钟算法都会选择一个端口作为从端口。 其他端口设置为主模式或被动状态。 最佳的主时钟算法可确保在每个段上选择单个主端口。

6.6.3 Synchronizing ordinary and boundary clocks

在PTP系统中,ordinary 或boundary clocks 通过在链接两个clocks的通信路径上交换PTP timing message来进行同步。例如,在figure10中,boundar clock-1 和 ordinary clock-1的同步是通过communication path-1上exchanging message;

The basic pattern of synchronization message exchange is illustrated in Figure 12.

The message exchange pattern is as follows:
a) The master sends a Sync message to the slave and notes the time t1 at which it was sent.(master向slave发Sync message,并记下发送时间t1).
b) The slave receives the Sync message and notes the time of reception t2.(Slave接收到Sync message 并记录接收时间t2).
c) The master conveys to the slave the timestamp t1 by: (Master通过以下方式将时间戳t1传给slave):
    1) Embedding the timestamp t1 in the Sync message. This requires some sort of hardware processing for highest accuracy and precision.(将时间戳t1嵌入到Sync消息中。这需要某种硬件处理,以实现最高的准确性和精度)。
    2) Embedding the timestamp t1 in a Follow_Up message. (将时间戳t1嵌入到Follow_Up消息中)。
d) The slave sends a Delay_Req message to the master and notes the time t3 at which it was sent.(Slave向master发送Delay_Req message,并记录发送时间t3)。
e) The master receives the Delay_Req message and notes the time of reception t4.(Master收到Delay_Req message并记录接收时间t4)。
f) The master conveys to the slave the timestamp t4 by embedding it in a Delay_Resp message.(Master 将时间戳t4嵌入到Delay_Resp message中,从而传递给slave).

在所有的message exchange结束后,slave就有了所有的4个timestamps。这些timestamps可用于计算slave's clock相对于master's clock的offset(偏移量),以及两个clock之间message的平均传播时间,在Figure-12中为t-ms 和t-sm的平均值。                在计算offset和propagation time时假定master-to-slave和slave-to-master的propagation times(传播时间)相同。任何传播时间的不对称都会在clock offset的计算中引入误差,由于不对称性,计算出的平均传播时间和实际传播时间会不同。

6.6.4 Measuring link propagation delay in clocks supporting peer-to-peer path correction

实现peer delay mechainism的两个port之间的link delay 测量机制如Figure 13所示。改测量是由实现该机制的所有ports实现的。因此,共享一条link的两个port都独立进行测量,所有,两个port都知道link delay。这允许进行6.5.5中描述的correction,而与Sync message的方向无关。重要的是,即使在被非PTP算法阻塞的端口上进行此测量也很重要,该非PTP算法用于消除循环拓扑,以便在链路改变路径的情况下,所有链路的最新链路延迟测量均可用。 同步消息(请参阅6.5.5)。

link delay 测量开始如下,port1发出Pdelay_Req message,并且为Pdelay_Req message 生成timestamp t1. Port2接收到Pdelay_Req message 并且生成timestamp t2。Port2返回Pdelay_Resp message 并为此message生成timestamp t3。为了最大程度减少由于两个ports之间的的任何frequency offset引起的error,port2在收到Pdelay_Req message 后尽快返回Pdelay_Resp message。                                                                                                                                                                                          Port-2 either:
1. returns the difference between the timestamps t2 and t3 in the Pdelay_Resp message.(在Pdelay_Resp中返回t2和t3之间的差异)。
2. returns the difference between the timestamps t2 and t3 in a Pdelay_Resp_Follow_Up message.(在Pdelay_Resp_Follow_Up中返回t2和t3之间的差异)。
3. returns the timestamps t2 and t3 in the Pdelay_Resp and Pdelay_Resp_Follow_Up messages, respectively.(分别在Pdelay_Resp和Pdelay_Resp_Follow_Up 消息中返回时间戳t2和t3)。


Port-1 generates a timestamp t4 upon receiving the Pdelay_Resp message. Port-1 then uses these four timestamps to compute the mean link delay.(port1 在收到Pdelay_Resp 消息后会生成一个timestamp t4, 然后port1使用这四个timestamps来计算平均link delay)。

6.6.5 Generation of messate time stamps

 在TX或RX 任何event message时都会生成一个timestamp event.当message的timestamp point cross node和network的boundary时,就会发生timestamp event;

PTP timing messages are issued from the PTP application code in one clock and received and processed by the PTP application code in another clock. These messages typically have a preamble specified by the physical layer of the communication protocol in use on the network. The preamble is followed by one or more protocol specific headers and then user data such as the PTP payload. For every such transport mechanism, this standard specifies a particular point in PTP timing messages, often the start of frame signal, as a distinguished point termed the message timestamp point. As a PTP message traverses the protocol stack in a node, the timestamps are generated when the message timestamp point passes a defined point in the stack. This point may be in the application layer, illustrated by “C” in Figure 14, in the kernel or interrupt service routines, illustrated by “B”, or in the physical layer of the protocol stack illustrated by “A”. In general, the closer this point is to the actual network connection, the smaller the timing errors introduced by fluctuations in the time taken to traverse the lower layers. In cases where timestamps are generated in the physical layer, some sort of hardware assist circuitry, illustrated by the dotted lines, is often employed. In this case, the timestamp is conveyed to the PTP code via a path outside of the normal path followed by the PTP timing message itself. To ensure that the timestamps are associated with the correct message, the hardware assist often captures additional information from the PTP timing message that is passed with the timestamp to the PTP code.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值