IEEE 1588 Sync和Follow_Up格式

Sync
====

34 bytes header
---------------------
10 - transportSpecific, messageType (1)
02 - reserved, versionPTP (1)
00 2c - messageLength (2)
00 - domainNumber (1)
00 - reserved (1)
02 00 - flagField (2)
00 00 00 00 1c e3 00 00 - correctionField (8)
00 00 00 00 - reserved (4)
00 00 xx xx xx xx xx xx xx xx - sourcePortIdentity (10)
00 0a - sequenceId (2)
00 - controlField (1)
00 - logMessageInterval (1)


10 bytes timestamp data
----------------------------------
00 00 00 00 00 xx xx xx xx xx - originTimestamp (10)


padding octets
--------------------
00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00


Follow_Up
=======

34 bytes header:
---------------------
08
02
00 2c
00
00
00 00
00 00 00 00 00 00 00 00
00 00 00 00
00 00 xx xx xx xx xx xx xx xx
00 0a
02
00


10 bytes data:
-------------------
00 00 00 00 00 xx xx xx xx xx 

Follow_Up消息
---------------------
34字节:消息头部
10字节:preciseOriginTimestamp

其中preciseOriginTimestamp的定义为:

struct Timestamp
{
 UInteger48 secondsField;
 UInteger32 nanosecondsField;
};
secondsField是以秒为单位的时间戳的整数部分.
nanosecondsField 是以纳秒为单位的时间戳的分数部分.
nanosecondsField 总是要小于 10E9.

例如:
+2.000000001 秒表示威:secondsField = 0000 0000 0002 和 nanosecondsField= 0000 0001 (16进制)


9.5.10 Follow_Up消息的发送
----------------------------------------
Follow_Up消息应该尽可能快地在相关联的Sync消息后发送,而且应该在下一个Sync消息之前发送。

Follow_Up消息中的sequenceId字段应该和相关联的Sync消息的sequenceId一致。

preciseOriginTimestamp 字段应该是其关联的Sync消息的syncEventEgressTimestamp值,除去纳秒的小数值。

Follow_Up中的correctionField和preciseOriginTimestamp的和应该是syncEventEgressTimestamp只,包括任何小数的纳秒值。


11.3 Delay request-response机制
=================================

这个机制测量PTP端口对之间的平均路径延迟。

a) master产生一个Sync消息,如果这个节点是一个two-step适中,它还会发送一个Follow_Up消息。
b) slave会:
 1) 接收到Sync的时候产生时间戳 t2
 2) 如果非对称更正是需要的,修改接受到的Sync消息的correctionField.
 3) 如果需要发送Delay_Req消息:
  i) 准备一个带有correctionField的Delay_Req消息,设置correctionField为0. originTimestamp 应该设置为 0,或者是Delay_Req消息的发出时间不差于1秒的估计时间。
  ii) 如果非对称更正是需要的,修改correctionField.
  iii) 发送Delay_Req消息,并记录下时间戳 t3.
c) 收到Delay_Req消息,master会 :
 1) 产生时间戳 t4.
 2) 准备 Delay_Resp 消息,
 3) 设置 sequenceId 与Delay_Req一致.
 4) 设置requestingPortIdentity为Delay_Req的sourcePortIdentity.
 5) 设置 domainNumber 与Delay_Req一致.
 6) 设置 correctionField为 0.
 7) 加入Delay_Req的 correctionField到Delay_Resp的 correctionField.
 8) 设置Delay_Resp消息的receiveTimestamp字段为t4的秒值和纳秒值.
 9) 从Delay_Resp消息的correctionField中减去t4的小数点纳秒部分。
 10) 发出Delay_Resp消息.
d) 收到Delay_Resp消息,slave会:
 1) 如果接受到的Sync消息指明不会收到Follow_Up消息。<meanPathDelay> 可计算为:<meanPathDelay> = [(t2 - t3) + (receiveTimestamp of Delay_Resp message – originTimestamp of Sync message) – correctionField of Sync message – correctionField of Delay_Resp message]/2.
 2) 如果接受到的Sync消息指明会收到Follow_Up消息,  <meanPathDelay> 可计算为:<meanPathDelay> = [(t2 - t3) + (receiveTimestamp of Delay_Resp message – preciseOriginTimestamp of Follow_Up message) – correctionField of Sync message– correctionField of Follow_Up message – correctionField of Delay_Resp message]/2.

你可能感兴趣的:(IEEE 1588 Sync和Follow_Up格式)