WO2023045881A1 - 时间同步装置、系统及方法 - Google Patents

时间同步装置、系统及方法 Download PDF

Info

Publication number
WO2023045881A1
WO2023045881A1 PCT/CN2022/119691 CN2022119691W WO2023045881A1 WO 2023045881 A1 WO2023045881 A1 WO 2023045881A1 CN 2022119691 W CN2022119691 W CN 2022119691W WO 2023045881 A1 WO2023045881 A1 WO 2023045881A1
Authority
WO
WIPO (PCT)
Prior art keywords
message
time
node
synchronization
ptp
Prior art date
Application number
PCT/CN2022/119691
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 北京车和家信息技术有限公司
Publication of WO2023045881A1 publication Critical patent/WO2023045881A1/zh

Links

Images

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

Definitions

  • the present disclosure relates to the technical field of computer networks, in particular to a time synchronization device, system and method.
  • the conventional solution to realize the 802.1AS time synchronization in the time sensitive networking (TSN) protocol specification is to receive event messages (Pdelay_Req, Pdelay_Resp or Sync, etc.) Timestamp, and then send the timestamp to the Advanced RISC Machine (ARM) platform.
  • ARM Advanced RISC Machine
  • this scheme has long system start-up time, high system implementation cost and jitter in the event message transmission process.
  • Embodiments of the present disclosure provide a time synchronization device, system and method.
  • An embodiment of the present disclosure provides a time synchronization device, which is configured on the current node, and includes a message receiving and processing module and a synchronization time determination module, the output of the message receiving and processing module is connected to the input of the synchronization time determination module ;
  • the message receiving and processing module is used to receive the PTP message sent by the previous node, and determine the target parameter based on the PTP message, and the target parameter is used to represent the time difference between the current node and the master node. time parameter;
  • the synchronization time determination module is configured to determine the synchronization time of the current node based on the target parameter.
  • the message receiving and processing module includes a message preprocessing unit, and the message preprocessing unit is configured to receive a PTP message sent by a previous node, and perform clock domain conversion on the PTP message.
  • the message receiving and processing module further includes a message parsing unit, the input end of the message parsing unit is connected to the output end of the message preprocessing unit;
  • the message parsing unit is configured to parse the PTP message after clock domain conversion to obtain key parameters of the PTP message, where the key parameter of the PTP message is a time parameter carried by the PTP message.
  • the message parsing unit is configured to parse the PTP message converted by the clock domain, and obtain the key parameters of the PTP message including:
  • the message reception processing module further includes a target parameter determination unit, the input end of the target parameter determination unit is connected to the output end of the message analysis unit;
  • the target parameter determining unit is configured to determine the target parameter based on the key parameter of the PTP message.
  • the target parameter determination unit is specifically used for:
  • the target parameter is determined based on the target timestamp.
  • the key parameters of the PTP message include a synchronization message sending timestamp, a synchronization message receiving timestamp, a synchronization accompanying message time parameter, a terminal delay request message sending timestamp, a terminal delay request Message receiving timestamp, terminal delayed response message sending timestamp and terminal delayed response message receiving timestamp;
  • the target parameters include the correction time of the previous node, the delay request sending time of the current node terminal, and the time stamp of the terminal delayed response message. Delayed request receiving time, delayed response sending time at the previous node end and delayed response receiving time at the current node end.
  • the synchronization time determination module is used for:
  • the correction time of the previous node is determined, and the correction time of the previous node is after the synchronization message is sent by the master node and before it is forwarded by the previous node, in the network Duration of transmission and dwell in the link;
  • the synchronization time is determined based on the precise time of the master node, the correction time of the previous node, the link transmission delay, and the frequency-offset ratio of the current node.
  • the time synchronization device is configured by a programmable logic device.
  • An embodiment of the present disclosure provides a time synchronization system, including a master node, at least one slave node, and the time synchronization device provided in any embodiment of the present disclosure, where the time synchronization device is configured on the slave node.
  • An embodiment of the present disclosure also provides a time synchronization method, which is applied to the time synchronization device provided in any embodiment of the present disclosure, and the method includes:
  • the target parameter is a related time parameter used to characterize the time difference between the current node and the master node
  • a synchronization time of the current node is determined based on the target parameter.
  • determining target parameters based on the PTP message includes:
  • the target parameter is determined based on the key parameter of the PTP message.
  • the PTP message obtained by analyzing the clock domain converted key parameters of the PTP message includes:
  • determining target parameters based on the key parameters of the PTP message includes:
  • the target parameter is determined based on the target timestamp.
  • the key parameters of the PTP message include a synchronization message sending timestamp, a synchronization message receiving timestamp, a synchronization accompanying message time parameter, a terminal delay request message sending timestamp, a terminal delay request Message receiving timestamp, terminal delay response message sending timestamp and terminal delay response message receiving timestamp;
  • the target parameters include the current node terminal delay request sending time, the previous node terminal delay request receiving time, The delayed reply sending time at the previous node end and the delayed reply receiving time at the current node end.
  • determining the synchronization time of the current node based on the target parameter includes:
  • the correction time of the previous node is determined, and the correction time of the previous node is after the synchronization message is sent by the master node and before it is forwarded by the previous node, in the network Duration of transmission and dwell in the link;
  • the synchronization time is determined based on the precise time of the master node, the correction time of the previous node, the link transmission delay, and the frequency-offset ratio of the current node.
  • An embodiment of the present disclosure also provides an electronic device, including: at least one processor; and a memory communicated with the at least one processor; wherein, the memory stores instructions executable by the at least one processor , the instruction is executed by the at least one processor, so that the at least one processor can execute the time synchronization method described in any one of the above embodiments.
  • Embodiments of the present disclosure also provide a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the time synchronization method described in any of the foregoing embodiments.
  • An embodiment of the present disclosure further provides a computer program product, including a computer program, when the computer program is executed by a processor, the time synchronization method described in any of the foregoing embodiments is implemented.
  • An embodiment of the present disclosure further provides a computer program, wherein the computer program includes computer program code, and when the computer program code is run on a computer, the computer is made to execute the time synchronization method as described in any of the foregoing embodiments.
  • the technical solution provided by the embodiment of the present disclosure receives the PTP message sent by the previous node, determines the target parameter based on the PTP message, and determines the synchronization time based on the target parameter.
  • the entire process adopts "hard implementation", which reduces the startup time of the Linux system or Standalone system, reduces the startup time of the entire system, and avoids the participation of the ARM platform, reducing the implementation cost of the entire system.
  • the event message can be sent strictly according to the clock cycle of the programmable logic device itself, so as to ensure the deterministic transmission time of the event message and avoid the problem of jitter in the transmission of the event message.
  • FIG. 1 is a structural block diagram of a time synchronization device provided by an embodiment of the present disclosure
  • FIG. 2 is a specific structural block diagram of a time synchronization device provided by an embodiment of the present disclosure
  • FIG. 3 is a schematic structural diagram of a message preprocessing unit provided by an embodiment of the present disclosure
  • FIG. 4 is a schematic diagram of a logic implementation of a message parsing unit provided by an embodiment of the present disclosure
  • FIG. 5 is a schematic structural diagram of a target parameter determination unit provided by an embodiment of the present disclosure.
  • FIG. 6 is a schematic diagram of a PTP message transmission process provided by an embodiment of the present disclosure.
  • FIG. 7 is a structural block diagram of another time synchronization device provided by an embodiment of the present disclosure.
  • FIG. 8 is a flowchart of a time synchronization method provided by an embodiment of the present disclosure.
  • Fig. 1 is a structural block diagram of a time synchronization device provided by an embodiment of the present disclosure.
  • the time synchronization device can be used to realize the time synchronization of TSN 802.1AS, and can be configured in the slave node in the vehicle communication network, so as to realize the time synchronization between the slave node and the master node.
  • the time synchronization device involved in the embodiments of the present disclosure is configured in a programmable logic device, that is, each module in the time synchronization device can be implemented by a hardware function module in the programmable logic device. As shown in Figure 1, this time synchronization device comprises message reception processing module 11 and synchronization time determination module 12, and the output end of message reception processing module 11 is connected with the input end of synchronization time determination module 12;
  • the message receiving processing module 11 is used to receive the PTP message sent by the previous node, and determine the target parameter based on the PTP message, and the target parameter is a relevant time parameter for representing the time difference between the current node and the master node;
  • the synchronization time determining module 12 is used for determining the synchronization time of the current node based on the target parameter.
  • the time synchronization device in the embodiment of the present disclosure is applied to a node in the Precision Time Protocol (Precision Time Protocol, PTP) domain, that is, a clock node, such as a switch supporting the PTP protocol.
  • PTP Precision Time Protocol
  • Node devices in the PTP domain perform clock synchronization according to a certain master-slave relationship.
  • the node device that synchronizes the clock is called a slave node, and the node device that publishes the clock is called the master node.
  • the master-slave relationship is relative.
  • a node device may synchronize the clock from the upper node device at the same time, and then issue the clock to the lower node device.
  • the clock information is transmitted through the PTP message.
  • the clock node in the embodiment of the present disclosure may be a boundary clock, that is, a clock with two or more PTP communication ports, wherein the two or more PTP communication ports include a master port that issues synchronization time and a slave port that receives synchronization time.
  • the previous node when the current node is a slave node directly connected to the master node, the previous node is the master node; when the current node is a slave node not directly connected to the master node, the previous node is also the slave node .
  • PTP messages include event messages and general messages, wherein event messages are time-concept messages, which are stamped with precise time stamps when entering and leaving device ports, and may include synchronization messages (Sync), delay request messages ( Delay_Req), terminal delay request message (Pdelay_Req) and terminal delay response message (Pdelay_Resp); the general message is a non-time concept message, and no time stamp will be generated when it is transmitted to or output from the device port. For the establishment of master-slave relationship, the request and notification of time information.
  • event messages are time-concept messages, which are stamped with precise time stamps when entering and leaving device ports, and may include synchronization messages (Sync), delay request messages ( Delay_Req), terminal delay request message (Pdelay_Req) and terminal delay response message (Pdelay_Resp);
  • the general message is a non-time concept message, and no time stamp will be generated when it is transmitted to or output from the device port.
  • General messages include announcement message (Announce), accompanying message (Follow_Up), delayed response message (Delay_Resp), terminal delayed response accompanying message (Pdelay_Resp_Follow_Up), management message (Management) and signal message (Signaling) and so on.
  • Sync is used for synchronizing messages, which is sent from the master node to the slave node, and may include the timestamp when the Sync is sent, which may also be included in the subsequent Follow_Up;
  • Delay_Req is used to request the peer to return the received The timestamp of Delay_Req, which is embedded in Delay_Resp;
  • Pdelay_Req is used to initiate a link delay measurement request, including the timestamp when Pdelay_Req is sent;
  • Pdelay_Resp is used to respond to Pdelay_Req, and can include the timestamp when Pdelay_Resp is sent.
  • the timestamp can also be included in the subsequent Pdelay_Resp_Follow_Up; Announce is used to broadcast the status and characteristic information of the sending node and the advanced master clock; Follow_Up is used to transmit the timestamp when sending Sync; Pdelay_Resp_Follow_Up is used to transmit the timestamp when sending Pdelay_Resp; Management Used to transmit information and commands used to manage clock devices; Signaling is used to transmit information, requests and commands between different clocks.
  • the PTP message may include Sync, Follow_Up, Pdelay_Req, Pdelay_Resp, and Pdelay_Resp_Follow_Up.
  • the previous node sends Sync to the current node (when the previous node is a slave node, the previous node forwards the Sync sent by the master node to the current node), and the current node obtains the timestamp when receiving the Sync when it receives the Sync;
  • the previous node continues to send Follow_Up to the current node, and when the current node receives Follow_Up, it obtains the timestamp when the previous node sent Sync from Follow_Up;
  • the node sends Pdelay_Req, and at the same time obtains the timestamp when sending Pdelay_Req; when the previous node receives Pdelay_Req, it sends Pdelay_Resp to the current node, and when the current node receives Pdelay_Resp, it obtains the timestamp when receiving Pdelay_Resp, and obtains from Pdelay_Resp that the previous node received P
  • the programmable logic device may be a Field Programmable Gate Array (Field Programmable Gate Array, FPGA).
  • the programmable logic device can also include an Ethernet control module, the Ethernet control module can be an Ethernet controller, the input end of the Ethernet control module is connected to the Ethernet transceiver (Phy), and the Ethernet control module is used for receiving and sending A PTP message, which stamps a hardware time stamp on the event message in the PTP message.
  • the message receiving processing module 11 includes a message pre-processing unit 113, the input end of the message pre-processing unit 113 is connected to the output end of the Ethernet control module 10, and the message The text preprocessing unit 113 is configured to receive the PTP message sent by the previous node, and perform clock domain conversion on the PTP message.
  • the processing logic of the programmable logic device is different for different bandwidth interfaces, that is, when the bandwidth interface is replaced, the processing logic of the programmable logic device needs to be adjusted.
  • the present disclosure performs clock domain conversion on the PTP message through the message preprocessing unit 113, so that when the bandwidth interface is replaced, the processing logic of the programmable logic device remains unchanged.
  • the message preprocessing unit RX_Control performs clock domain conversion on the PTP message, that is, mac_clk is converted to usr_clk, wherein mac_clk represents the clock at the media access control sublayer protocol (mac) end, and usr_clk represents the clock at the user side.
  • the message preprocessing unit RX_Control can also expand the bit width of the received message data, for example, expand the 8-bit wide data to 9-bit wide data, that is, the 8-bit wide data tdata[7:0]
  • the bit width is expanded to obtain 9-bit bit-width data d_out[8:0], so as to add one bit of data to the high bit to indicate the start and end of the frame.
  • tuser indicates whether each frame of the received message data is an abnormal frame
  • tlast indicates the end flag bit of the frame
  • tvalid indicates whether each byte in each frame is Valid
  • data_valid indicates the validity of the output message data
  • descriptor[x:0] indicates the PTP message descriptor with a bit width of x+1, which is used to indicate the message type.
  • the message reception processing module 11 also includes a message analysis unit 111, the input end of the message analysis unit 111 is connected to the output end of the message preprocessing unit 113, and the message analysis unit 111 uses
  • the key parameter of the PTP message is obtained by parsing the PTP message converted by the clock domain, and the key parameter of the PTP message is the time parameter carried in the PTP message.
  • the packet parsing unit 111 is specifically configured to: acquire a PTP packet descriptor; determine a packet type based on the PTP packet descriptor; extract key parameters of the PTP packet corresponding to the packet type from the PTP packet.
  • the key parameters of the PTP message include a synchronization message sending timestamp, a synchronization message receiving timestamp, a synchronization accompanying message time parameter, a terminal delay request message sending timestamp, a terminal delay request message Receiving time stamp, sending time stamp of terminal delayed response message and receiving time stamp of terminal delayed response message.
  • the packet parsing unit 111 can be implemented by designing a state machine.
  • message reception processing module 11 also comprises target parameter determination unit 112, the input end of target parameter determination unit 112 is connected with the output end of message analysis unit 111; Target parameter determination unit 112 uses The target parameter is determined based on the key parameters of the PTP message.
  • the target parameters include the sending time of the delayed request at the current node, the receiving time of the delayed request at the previous node, the sending time of the delayed reply at the previous node, and the receiving time of the delayed reply at the current node.
  • Fig. 5 shows a schematic structural diagram of a target parameter determining unit, as shown in Fig.
  • the target parameter determining unit RX_TSU extracts the key parameters corresponding to the target from the PTP message key parameters.
  • the target timestamp associated with the parameter; the target parameter is determined based on the target timestamp.
  • the target timestamp includes the sending timestamp of the end-delay request message, the receiving timestamp of the end-delay request message, the sending timestamp of the end-delay response message, and the receiving timestamp of the end-delay response message.
  • the target parameters are determined
  • the unit RX_TSU outputs the delay request sending time t 2,req,send at the current node end, the delay request receiving time t 1,req,rec at the previous node end, and the delayed response sending time t 1 at the previous node end based on the above target timestamp ,resp,send and the current node end delay response receiving time t 2,resp,rec , and output the effective identifier ts_ready_flag, where the effective identifier ts_ready_flag indicates the current node end delay request sending time t 2,req,send , in Whether the delayed request receiving time t 1,req,rec at the previous node end, the delayed response sending time t 1,resp,send at the previous node end, and the delayed response receiving time t 2,resp,rec at the current node end are valid, for example
  • the identifier ts_ready_flag is 1 for valid and 0 for invalid.
  • programmable logic device can also comprise message sending processing module 13, the input end of message sending processing module 13 is connected with the output end of synchronous time determining module 12, message sending processing module The output end of 13 is connected with the input end of Ethernet control module 10, and after synchronous time determination module 12 determines synchronous time, sends PTP message by message transmission processing module 13 to next level slave node (at back node), so that Time synchronization between the master node and the master node.
  • the programmable logic device may also include a real-time clock 14, which is used to regularly update the local clock to achieve time synchronization.
  • the synchronization time determination module is specifically configured to: determine the correction time of the previous node based on the target parameter, the preset correction time and the preset frequency deviation ratio, and the correction time of the previous node is after the synchronization message is sent by the master node The duration of transmission and residence in the network link before being forwarded by the previous node; based on the target parameter and the preset frequency deviation ratio, determine the link transmission delay between the previous node and the current node and the current node Frequency offset ratio, the frequency offset ratio of the current node is the ratio of the clock frequency of the current node and the master node; the synchronization time is determined based on the precise time of the master node, the correction time of the previous node, the link transmission delay and the frequency offset ratio of the current node.
  • the synchronization time is calculated using the following formula:
  • preciseOriginTimeStamp is the precise time of the master node
  • CorrectionField sw(i-1) is the correction time of the previous node
  • Pdelay swi is the link transmission delay
  • RateRatio swi is the frequency offset ratio of the current node
  • t is the time of the current node.
  • neighborRateRatio sw1 ((t 1,resp,send ) n -(t 1,resp,send ) n-1 )/((t 2,resp,rec ) n -(t 2,resp,rec ) n-1 ) ,
  • RateRatio sw1 rateRatio g + neighborRateRatio sw1 -1.
  • the synchronization time of the current node can be calculated by the above formula. It can be understood that some of the above formulas are described by taking slave node 1 in the figure as an example.
  • the current slave node can be used as the master node. For example, when calculating the synchronization time of slave node 2, take slave node 1 as the master node.
  • a programmable logic device implements the design of the switch.
  • the programmable logic device can also include a switch function module 15, and the Ethernet control module 10, the message receiving processing module 11, the synchronization time determining module 12 and the message sending processing module 13 in the above-mentioned embodiment are applied to MAC layer 16.
  • the Ethernet control module, the message receiving processing module and the synchronization time determining module work in parallel. In this way, the reception of the PTP message, the analysis of the PTP message, and the calculation of the synchronization time can be executed in parallel, which greatly improves the calculation speed and the stability of the calculation process.
  • the time synchronization device receives the PTP message sent by the previous node, determines the target parameter based on the PTP message, and determines the synchronization time based on the target parameter, all of which are implemented by hardware function modules on the programmable logic device side, that is, time
  • the entire process of synchronization is "hardly implemented", which reduces the startup time of the Linux system or Standalone system, reduces the startup time of the entire system, and avoids the participation of the ARM platform, reducing the implementation cost of the entire system.
  • the event message can be sent strictly according to the clock cycle of the programmable logic device itself, so as to ensure the deterministic transmission time of the event message and avoid the problem of jitter in the transmission of the event message.
  • An embodiment of the present disclosure further provides a time synchronization system, including a master node, at least one slave node, and the time synchronization device provided in any embodiment of the present disclosure, where the time synchronization device is configured on the slave node.
  • the time synchronization system provided by the embodiments of the present disclosure includes the time synchronization device provided by any embodiment of the present disclosure, and has the same functions and beneficial effects.
  • An embodiment of the present disclosure also provides a time synchronization method, which is applied to the time synchronization device provided in any embodiment of the present disclosure. As shown in FIG. 8 , the method includes:
  • determining the target parameter based on the PTP message includes: receiving the PTP message sent by the previous node, and performing clock domain conversion on the PTP message; analyzing the PTP message after the clock domain conversion to obtain the PTP message
  • the key parameter, the key parameter of the PTP message is the time parameter carried by the PTP message; the target parameter is determined based on the key parameter of the PTP message.
  • analyzing the PTP message converted by the clock domain to obtain the key parameters of the PTP message includes: obtaining the PTP message descriptor; determining the message type based on the PTP message descriptor; extracting the message type correspondence from the PTP message Key parameters of the PTP packet.
  • determining the target parameter based on the key parameter of the PTP message specifically includes: extracting a target time stamp related to the target parameter from the key parameter of the PTP message; and determining the target parameter based on the target time stamp.
  • the key parameters of the PTP message include a synchronization message sending timestamp, a synchronization message receiving timestamp, a synchronization accompanying message time parameter, a terminal delay request message sending timestamp, a terminal delay request message Receiving time stamp, sending time stamp of terminal delayed response message and receiving time stamp of terminal delayed response message; target parameters include sending time of delayed request at current node terminal, receiving time of delayed request at previous node terminal, time stamp of previous node terminal Delayed response sending time and current node end delayed response receiving time.
  • determining the synchronization time of the current node based on the target parameter includes: determining the correction time of the previous node based on the target parameter, the preset correction time and the preset frequency deviation ratio, and the correction time of the previous node is the synchronization message sent by The duration of transmission and residence in the network link after the master node sends out and before being forwarded by the previous node; based on the target parameter and the preset frequency deviation ratio, determine the link transmission delay between the previous node and the current node time and the frequency offset ratio of the current node, the current node frequency offset ratio is the ratio of the clock frequency of the current node and the master node; based on the precise time of the master node, the correction time of the previous node, the link transmission delay and the frequency offset ratio of the current node, determine synchronised time.
  • the time synchronization method provided by the embodiment of the present disclosure and the time synchronization device provided by the embodiment of the present disclosure belong to the same general inventive concept.
  • the content not described in detail in the embodiment of the time synchronization method can refer to the embodiment of the time synchronization device. Let me repeat.
  • An embodiment of the present disclosure also provides an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by at least one processor. Executed by one processor, so that at least one processor can execute the time synchronization method as described in any one of the foregoing embodiments.
  • Embodiments of the present disclosure also provide a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute the time synchronization method as described in any of the preceding embodiments.
  • An embodiment of the present disclosure further provides a computer program product, including a computer program, when the computer program is executed by a processor, the time synchronization method as described in any one of the preceding embodiments is implemented.
  • An embodiment of the present disclosure further provides a computer program, wherein the computer program includes computer program code, and when the computer program code is run on a computer, the computer is made to execute the time synchronization method as described in any one of the foregoing embodiments.
  • time synchronization apparatus and method embodiments are also applicable to the electronic equipment, computer-readable storage media, computer program products, and computer programs in the above embodiments, and details are not repeated here.

Landscapes

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

Abstract

公开了一种时间同步装置、系统及方法。时间同步装置包括报文接收处理模块和同步时间确定模块,所述报文接收处理模块的输出端与所述同步时间确定模块的输入端连接;所述报文接收处理模块用于接收在前节点发送的PTP报文,基于所述PTP报文确定目标参数,所述目标参数为用于表征所述当前节点与主节点之间时间差异的相关时间参数;所述同步时间确定模块用于基于所述目标参数确定所述当前节点的同步时间。

Description

时间同步装置、系统及方法
相关申请的交叉引用
本申请基于申请号为202111115390.3、申请日为2021年9月23日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。
技术领域
本公开涉及计算机网络技术领域,具体涉及一种时间同步装置、系统及方法。
背景技术
目前,实现时间敏感网络技术(time sensitive networking,TSN)协议规范中的802.1AS时间同步的常规方案是通过在介质访问控制层接收事件报文(Pdelay_Req、Pdelay_Resp或Sync等),对事件报文打上时间戳,之后将时间戳发送到高级精简指令集计算机(Advanced RISC Machine,ARM)平台上,此ARM平台上可以使用Linux或者Standalone方式,利用C或者C++开发环境进行链路延时、频偏和驻留时间等参数的计算。但是,该方案系统启动时间长、系统实现成本高以及事件报文传输过程中出现抖动。
发明内容
本公开实施例提供了一种时间同步装置、系统及方法。
本公开实施例提供了一种时间同步装置,配置于当前节点,包括报文接收处理模块和同步时间确定模块,所述报文接收处理模块的输出端与所述同步时间确定模块的输入端连接;
所述报文接收处理模块用于接收在前节点发送的PTP报文,基于所述PTP报文确定目标参数,所述目标参数为用于表征所述当前节点与主节点之间时间差异的相关时间参数;
所述同步时间确定模块用于基于所述目标参数确定所述当前节点的同步时间。
在一些实施例中,所述报文接收处理模块包括报文预处理单元,所述报文预处理单元用于接收在前节点发送的PTP报文,对所述PTP报文进行时钟域转换。
在一些实施例中,所述报文接收处理模块还包括报文解析单元,所述报文解析单元的输入端与所述报文预处理单元的输出端连接;
所述报文解析单元用于解析经时钟域转换后的所述PTP报文,得到PTP报文关键参数,所述PTP报文关键参数为所述PTP报文携带的时间参数。
在一些实施例中,所述报文解析单元用于解析经时钟域转换后的所述PTP报文,得到PTP报文关键参数包括:
获取PTP报文描述符;
基于所述PTP报文描述符确定报文类型;
从所述PTP报文中提取所述报文类型对应的PTP报文关键参数。
在一些实施例中,所述报文接收处理模块还包括目标参数确定单元,所述目标参数确定单元的输入端与所述报文解析单元的输出端连接;
所述目标参数确定单元用于基于所述PTP报文关键参数确定所述目标参数。
在一些实施例中,所述目标参数确定单元具体用于:
从所述PTP报文关键参数中提取与所述目标参数相关的目标时间戳;
基于所述目标时间戳确定所述目标参数。
在一些实施例中,所述PTP报文关键参数包括同步报文发送时间戳、同步报文接收时间戳、同步随附报文时间参数、端延时请求报文发送时间戳、端延时请求报文接收时间戳、端延时应答报文发送时间戳和端延时应答报文接收时间戳;所述目标参数包括在前节点修正时间、当前节点端延时请求发送时间、在前节点端延时请求接收时间、在前节点端延时应答发送时间和当前节点端延时应答接收时间。
在一些实施例中,所述同步时间确定模块用于:
基于所述目标参数、预设修正时间和预设频偏比,确定在前节点修正时间,所述在前节点修正时间为同步报文由主节点发出后至被在前节点转发之前,在网络链路中传输和驻留所持续的时间;
基于所述目标参数和所述预设频偏比,确定所述在前节点与所述当前节点之间的链路传输延时和当前节点频偏比,所述当前节点频偏比为当前节点与主节点的时钟频率的比值;
基于主节点精准时间、所述在前节点修正时间、所述链路传输延时和所述当前节点频偏比,确定所述同步时间。
在一些实施例中,所述时间同步装置由可编程逻辑器件配置。
本公开实施例提供了一种时间同步系统,包括一个主节点、至少一个从节点和本公开的任一实施例提供的时间同步装置,所述时间同步装置配置于所述从节点。
本公开实施例还提供了一种时间同步方法,应用于本公开的任一实施例提供的时间同步装置,所述方法包括:
接收在前节点发送的PTP报文,基于所述PTP报文确定目标参数,所述目标参数为用于表征所述当前节点与主节点之间时间差异的相关时间参数;
基于所述目标参数确定所述当前节点的同步时间。
在一些实施例中,基于所述PTP报文确定目标参数,包括:
接收在前节点发送的PTP报文,对所述PTP报文进行时钟域转换;
解析经时钟域转换后的所述PTP报文,得到PTP报文关键参数,所述PTP报文关键参数为所述PTP报文携带的时间参数;
基于所述PTP报文关键参数确定所述目标参数。
在一些实施例中,解析经时钟域转换后的所述PTP报文,得到PTP报文关键参数包括:
获取PTP报文描述符;
基于所述PTP报文描述符确定报文类型;
从所述PTP报文中提取所述报文类型对应的PTP报文关键参数。
在一些实施例中,基于所述PTP报文关键参数确定目标参数,具体包括:
从所述PTP报文关键参数中提取与所述目标参数相关的目标时间戳;
基于所述目标时间戳确定所述目标参数。
在一些实施例中,所述PTP报文关键参数包括同步报文发送时间戳、同步报文接收时间戳、同步随附报文时间参数、端延时请求报文发送时间戳、端延时请求报文接收时间戳、端延时应答报文发送时间戳和端延时应答报文接收时间戳;所述目标参数包括当前节点端延时请求发送时间、在前节点端延时请求接收时间、在前节点端延时应答发送时间和当前节点端延时应答接收时间。
在一些实施例中,基于所述目标参数确定所述当前节点的同步时间,包括:
基于所述目标参数、预设修正时间和预设频偏比,确定在前节点修正时间,所述在前节点修正时间为同步报文由主节点发出后至被在前节点转发之前,在网络链路中传输和驻留所持续的时间;
基于所述目标参数和所述预设频偏比,确定所述在前节点与所述当前节点之间的链路传输延时和当前节点频偏比,所述当前节点频偏比为当前节点与主节点的时钟频率的比值;
基于主节点精准时间、所述在前节点修正时间、所述链路传输延时和所述当前节点频偏比,确定所述同步时间。
本公开实施例还提供了一种电子设备,包括:至少一个处理器;和与所述至少一个处理器通信连接的存储器;其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行上述任一实施例所述的时间同步方法。
本公开实施例还提供了一种存储有计算机指令的非瞬时计算机可读存储介质,其中,所述计算机指令用于使所述计算机执行上述任一实施例所述的时间同步方法。
本公开实施例还提供了一种计算机程序产品,包括计算机程序,所述计算机程序在被处理器执行时实现上述任一实施例所述的时间同步方法。
本公开实施例还提供了一种计算机程序,其中所述计算机程序包括计算机程序代码,当所述计算机程序代码在计算机上运行时,使得计算机执行如上述任一实施例所述的时间同步方法。
本公开实施例提供的技术方案与现有技术相比具有如下优点:
本公开实施例提供的技术方案接收在前节点发送的PTP报文,基于PTP报文确定目标参数,基于目标参数确定同步时间,全部在可编程逻辑器件侧采用硬件功能模块实现,即时间同步的整个过程全部采用“硬实现”,从而减少了Linux系统或者Standalone系统的启动时间,使得整个系统的启动时间降低,而且避免了ARM平台的参与,降低了整个系统的实现成本。同时,事件报文能够严格按照可编程逻辑器件自身的时钟周期进行发送,从而保证事件报文传输时间的确定性,避免了事件报文传输出现抖动的问题。
附图说明
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本公开的实施例,并与说明书一起用于解释本公开的原理。
为了更清楚地说明本公开实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,对于本领域普通技术人员而言,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本公开实施例提供的一种时间同步装置的结构框图;
图2为本公开实施例提供的一种时间同步装置的具体结构框图;
图3为本公开实施例提供的报文预处理单元的结构示意图;
图4为本公开实施例提供的报文解析单元的逻辑实现示意图;
图5为本公开实施例提供的目标参数确定单元的结构示意图;
图6为本公开实施例提供的PTP报文传输过程示意图;
图7为本公开实施例提供的另一种时间同步装置的结构框图;
图8为本公开实施例提供的一种时间同步方法的流程图。
具体实施方式
为了能够更清楚地理解本公开的上述目的、特征和优点,下面将对本公开的方案进行进一步描述。需要说明的是,在不冲突的情况下,本公开的实施例及实施例中的特征可以相互组合。
在下面的描述中阐述了很多具体细节以便于充分理解本公开,但本公开还可以采用其他不同于在此描述的方式来实施;显然,说明书中的实施例只是本公开的一部分实施例,而不是全部的实施例。
图1为本公开实施例提供的一种时间同步装置的结构框图。该时间同步装置可用于实现TSN 802.1AS的时间同步,可配置于车辆通信网络中的从节点中,从而实现从节点与主节点的时间同步。本公开实施例所涉及的时间同步装置配置于可编程逻辑器件中,即时间同步装置中的各模块均可由可编程逻辑器件中的硬件功能模块实现。如图1所示,该时间同步装置包括报文接收处理模块11和同步时间确定模块12,报文接收处理模块11的输出端与同步时间确定模块12的输入端连接;
报文接收处理模块11用于接收在前节点发送的PTP报文,基于PTP报文确定目标参数,目标参数为用于表征当前节点与主节点之间时间差异的相关时间参数;
同步时间确定模块12用于基于目标参数确定当前节点的同步时间。
本公开实施例中的时间同步装置应用于精确时钟同步协议(Precision Time Protocol,PTP)域中的节点,即时钟节点,例如支持PTP协议的交换机。PTP域的节点设备按照一定的主从关系进行时钟同步。同步时钟的节点设备称为从节点,发布时钟的节点设备称为主节点,主从关系是相对而言的,一台节点设备可能同时从上层节点设备同步时钟,然后向下层节点设备发布时钟,本公开实施例通过PTP报文传递时钟信息。本公开实施例中的 时钟节点可以为边界时钟,即有两个或多个PTP通信端口的时钟,其中两个或多个PTP通信端口包括发布同步时间的主端口和接收同步时间的从端口。本公开实施例中,在当前节点为与主节点直接连接的从节点时,在前节点即为主节点;在当前节点为与主节点非直接连接的从节点时,在前节点亦为从节点。
另外,PTP报文包括事件报文和通用报文,其中,事件报文为时间概念报文,进出设备端口时打上精确的时间戳,可包括同步报文(Sync)、延时请求报文(Delay_Req)、端延时请求报文(Pdelay_Req)和端延时应答报文(Pdelay_Resp);通用报文为非时间概念报文,传输至设备端口以及从设备端口输出时不会产生时间戳,用于主从关系的建立、时间信息的请求和通告。通用报文包括声明报文(Announce)、随附报文(Follow_Up)、延时应答报文(Delay_Resp)、端延时应答随附报文(Pdelay_Resp_Follow_Up)、管理报文(Management)和信号报文(Signaling)等。上述PTP报文中,Sync用于同步消息,由主节点发送给从节点,可以包含发送Sync时的时间戳,该时间戳也可以包含于后续的Follow_Up中;Delay_Req用于请求对端返回接收到Delay_Req时的时间戳,该时间戳嵌入在Delay_Resp中;Pdelay_Req用于发起链路延时的测量请求,包含发送Pdelay_Req时的时间戳;Pdelay_Resp用于响应Pdelay_Req,可以包含发送Pdelay_Resp时的时间戳,该时间戳也可以包含于后续的Pdelay_Resp_Follow_Up中;Announce用于广播发送节点和高级主时钟的状态和特征信息;Follow_Up用于传送发送Sync时的时间戳;Pdelay_Resp_Follow_Up用于传送发送Pdelay_Resp时的时间戳;Management用于传输用于管理时钟设备的信息以及命令;Signaling用于在不同时钟之间传送信息、请求以及命令。本公开实施例中,PTP报文可包括Sync、Follow_Up、Pdelay_Req、Pdelay_Resp和Pdelay_Resp_Follow_Up。示例性的,在前节点向当前节点发送Sync(在前节点为从节点时,在前节点向当前节点转发主节点发送的Sync),当前节点接收到Sync时获取接收Sync时的时间戳;当Sync中不包含在前节点发送Sync时的时间戳时,在前节点继续向当前节点发送Follow_Up,当前节点接收到Follow_Up时从Follow_Up中获取在前节点发送Sync时的时间戳;当前节点向在前节点发送Pdelay_Req,同时获取发送Pdelay_Req时的时间戳;在前节点接收到Pdelay_Req时向当前节点发送Pdelay_Resp,当前节点接收到Pdelay_Resp时获取接收Pdelay_Resp时的时间戳,并从Pdelay_Resp中获取在前节点接收Pdelay_Req时的时间戳;当Pdelay_Resp中不包含在前节点发送Pdelay_Resp时的时间戳时,在前节点继续向当前节点发送Pdelay_Resp_Follow_Up,当前节点接收到Pdelay_Resp_Follow_Up时从Pdelay_Resp_Follow_Up中获取在前节点发送Pdelay_Resp时的时间戳(可参考图6)。
上述技术方案中,可编程逻辑器件可以为现场可编程逻辑门阵列(Field Programmable Gate Array,FPGA)。另外,可编程逻辑器件还可包括以太网控制模块,以太网控制模块可以为以太网控制器,以太网控制模块输入端与以太网收发器(Phy)连接,以太网控制模块用于接收和发送PTP报文,为PTP报文中的事件报文打上硬件时间戳。
基于上述技术方案,在一些实施例中,参考图2,报文接收处理模块11包括报文预处 理单元113,报文预处理单元113的输入端与以太网控制模块10的输出端连接,报文预处理单元113用于接收在前节点发送的PTP报文,对PTP报文进行时钟域转换。考虑到对于不同的带宽接口,可编程逻辑器件的处理逻辑不同,即在更换带宽接口时,需要调整可编程逻辑器件的处理逻辑。因此,本公开通过报文预处理单元113对PTP报文进行时钟域转换,使得带宽接口更换时,可编程逻辑器件的处理逻辑保持不变。如图3所示,报文预处理单元RX_Control对PTP报文进行时钟域转换,即mac_clk转换至usr_clk,其中,mac_clk表示介质访问控制子层协议(mac)端的时钟,usr_clk表示用户侧的时钟。同时报文预处理单元RX_Control还可以对接收到的报文数据进行位宽的扩展,例如将8位位宽数据拓展到9位位宽数据,即8位位宽数据tdata[7:0]进行位宽拓展,得到9位位宽数据d_out[8:0],以此在高位增加一位数据,用于表示帧开始和帧结束。另外,如图3所示的报文预处理单元RX_Control中,tuser表示接收的报文数据的每一帧是否为异常帧,tlast表示帧的结束标志位,tvalid表示每一帧中各字节是否有效,data_valid表示输出报文数据的有效性,descriptor[x:0]表示位宽为x+1的PTP报文描述符,用于表示报文类型。
在一些实施例中,参考图2,报文接收处理模块11还包括报文解析单元111,报文解析单元111的输入端与报文预处理单元113的输出端连接,报文解析单元111用于解析经时钟域转换后的PTP报文,得到PTP报文关键参数,PTP报文关键参数为PTP报文携带的时间参数。
在一些实施例中,报文解析单元111具体用于:获取PTP报文描述符;基于PTP报文描述符确定报文类型;从PTP报文中提取报文类型对应的PTP报文关键参数。在一些实施例中,PTP报文关键参数包括同步报文发送时间戳、同步报文接收时间戳、同步随附报文时间参数、端延时请求报文发送时间戳、端延时请求报文接收时间戳、端延时应答报文发送时间戳和端延时应答报文接收时间戳。具体的,报文解析单元111可通过状态机设计实现。如图4所示,当PTP报文描述符为sync时,确定报文类型为Sync,由初始状态state_IDLE跳转到状态state_sync,获取Sync对应的PTP报文关键参数,例如在前节点发送Sync时的时间戳,即同步报文发送时间戳,以及当前节点接收Sync时的时间戳,即同步报文接收时间戳,之后跳转到状态state_dout,输出Sync对应的PTP报文关键参数,并返回初始状态state_IDLE;当PTP报文描述符为followup时,确定报文类型为Follow_Up,由初始状态state_IDLE跳转到状态state_followup,获取Follow_Up对应的PTP报文关键参数,例如同步随附报文时间参数,具体可包括主节点精准时间preciseOriginTimeStamp、预设修正时间CorrectionField g和预设频偏比rateRatio g,之后跳转到状态state_dout,输出Follow_Up对应的PTP报文关键参数,并返回初始状态state_IDLE;当PTP报文描述符为pdelay_req时,确定报文类型为Pdelay_Req,由初始状态state_IDLE跳转到状态state_pdelay_req,获取Pdelay_Req对应的PTP报文关键参数,例如当前节点发送Pdelay_Req的时间戳,即端延时请求报文发送时间戳,之后跳转到状态state_dout,输出Pdelay_Req对应的PTP报文关键参数,并返回初始状态state_IDLE;当PTP报文描述符为pdelay_resp时,确定报文类型为 Pdelay_Resp,由初始状态state_IDLE跳转到状态pdelay_resp,获取Pdelay_Resp对应的PTP报文关键参数,例如在前节点接收到Pdelay_Req时的时间戳,即端延时请求报文接收时间戳,以及当前节点接收Pdelay_Resp时的时间戳,即端延时应答报文接收时间戳,之后跳转到状态state_dout,输出Pdelay_Resp对应的PTP报文关键参数,并返回初始状态state_IDLE;当PTP报文描述符为pdelay_resp_followup时,确定报文类型为Pdelay_Resp_Follow_Up,由初始状态state_IDLE跳转到状态state_pdelay_resp_followup,获取Pdelay_Resp_Follow_Up对应的PTP报文关键参数,例如在前节点响应Pdelay_Req发送Pdelay_Resp时的时间戳,即端延时应答报文发送时间戳,之后跳转到状态state_dout,输出Pdelay_Resp_Follow_Up对应的PTP报文关键参数,并返回初始状态state_IDLE;当PTP报文描述符为send_data时,由初始状态state_IDLE跳转到状态state_data,之后直接返回初始状态state_IDLE。通过上述状态机的设计,实现了对PTP报文的解析,提取各时间戳等PTP报文关键参数。
在一些实施例中,继续参考图2,报文接收处理模块11还包括目标参数确定单元112,目标参数确定单元112的输入端与报文解析单元111的输出端连接;目标参数确定单元112用于基于PTP报文关键参数确定目标参数。在一些实施例中,目标参数包括当前节点端延时请求发送时间、在前节点端延时请求接收时间、在前节点端延时应答发送时间和当前节点端延时应答接收时间。图5示出了一种目标参数确定单元的结构示意图,如图5所示,通过向目标参数确定单元RX_TSU输入PTP报文关键参数,目标参数确定单元RX_TSU从PTP报文关键参数中提取与目标参数相关的目标时间戳;基于目标时间戳确定目标参数。具体的,目标时间戳包括端延时请求报文发送时间戳、端延时请求报文接收时间戳、端延时应答报文发送时间戳和端延时应答报文接收时间戳,目标参数确定单元RX_TSU基于上述目标时间戳输出当前节点端延时请求发送时间t 2,req,send、在前节点端延时请求接收时间t 1,req,rec、在前节点端延时应答发送时间t 1,resp,send和当前节点端延时应答接收时间t 2,resp,rec,并输出有效标识符ts_ready_flag,其中,有效标识符ts_ready_flag表示当前节点端延时请求发送时间t 2,req,send、在前节点端延时请求接收时间t 1,req,rec、在前节点端延时应答发送时间t 1,resp,send和当前节点端延时应答接收时间t 2,resp,rec是否有效,例如有效标识符ts_ready_flag为1表示有效,为0表示无效。
在一些实施例中,继续参考图2,可编程逻辑器件还可包括报文发送处理模块13,报文发送处理模块13的输入端与同步时间确定模块12的输出端连接,报文发送处理模块13的输出端与以太网控制模块10的输入端连接,同步时间确定模块12确定同步时间后,通过报文发送处理模块13向下一级从节点(在后节点)发送PTP报文,以使在后节点与主节点进行时间同步。另外,可编程逻辑器件还可以包括实时时钟14,用于定时更新本地时钟,实现时间同步。
在一些实施例中,同步时间确定模块具体用于:基于目标参数、预设修正时间和预设频偏比,确定在前节点修正时间,在前节点修正时间为同步报文由主节点发出后至被在前 节点转发之前,在网络链路中传输和驻留所持续的时间;基于目标参数和预设频偏比,确定在前节点与当前节点之间的链路传输延时和当前节点频偏比,当前节点频偏比为当前节点与主节点的时钟频率的比值;基于主节点精准时间、在前节点修正时间、链路传输延时和当前节点频偏比,确定同步时间。
具体的,参考图6,采用如下公式计算同步时间:
Figure PCTCN2022119691-appb-000001
其中,preciseOriginTimeStamp为主节点精准时间,CorrectionField sw(i-1)为在前节点修正时间,Pdelay swi为链路传输延时,RateRatio swi为当前节点频偏比,t为当前节点的时间。
上述公式中,CorrectionField sw1=CorrectionField g+ delCorrectionField sw1
Figure PCTCN2022119691-appb-000002
neighborRateRatio sw1=((t 1,resp,send) n-(t 1,resp,send) n-1)/((t 2,resp,rec) n-(t 2,resp,rec) n-1),
Figure PCTCN2022119691-appb-000003
Pdelay sw1=neighborPropDelay sw1*rateRatio g
RateRatio sw1=rateRatio g+neighborRateRatio sw1-1。
通过上述公式可计算出当前节点的同步时间。可以理解的是,上述部分公式以图中从节点1为例进行说明,在计算下一级从节点的同步时间时,可将当前从节点作为主节点。例如,在计算从节点2的同步时间时,将从节点1作为主节点。
在一些实施例中,可编程逻辑器件实现对交换机的设计。如图7所示,可编程逻辑器件还可包括交换机功能模块15,上述实施例中的以太网控制模块10、报文接收处理模块11、同步时间确定模块12和报文发送处理模块13应用于MAC层16。
在一些实施例中,以太网控制模块、报文接收处理模块和同步时间确定模块并行工作。如此,PTP报文的接收、PTP报文的解析和同步时间的计算等可以并行执行,极大提高了计算速度和计算过程的稳定性。
本公开实施例提供的时间同步装置,接收在前节点发送的PTP报文,基于PTP报文确定目标参数,基于目标参数确定同步时间,全部在可编程逻辑器件侧采用硬件功能模块实 现,即时间同步的整个过程全部采用“硬实现”,从而减少了Linux系统或者Standalone系统的启动时间,使得整个系统的启动时间降低,而且避免了ARM平台的参与,降低了整个系统的实现成本。同时,事件报文能够严格按照可编程逻辑器件自身的时钟周期进行发送,从而保证事件报文传输时间的确定性,避免了事件报文传输出现抖动的问题。
本公开实施例还提供了一种时间同步系统,包括一个主节点、至少一个从节点和本公开任一实施例提供的时间同步装置,时间同步装置配置于从节点。
本公开实施例提供的时间同步系统包括本公开任一实施例提供的时间同步装置,具有相同的功能和有益效果。
本公开实施例还提供了一种时间同步方法,应用于本公开任一实施例提供的时间同步装置,如图8所示,方法包括:
S210、接收在前节点发送的PTP报文,基于PTP报文确定目标参数。
在一些实施例中,基于PTP报文确定目标参数,包括:接收在前节点发送的PTP报文,对PTP报文进行时钟域转换;解析经时钟域转换后的PTP报文,得到PTP报文关键参数,PTP报文关键参数为PTP报文携带的时间参数;基于PTP报文关键参数确定目标参数。
具体的,解析经时钟域转换后的PTP报文,得到PTP报文关键参数包括:获取PTP报文描述符;基于PTP报文描述符确定报文类型;从PTP报文中提取报文类型对应的PTP报文关键参数。
在一些实施例中,基于PTP报文关键参数确定目标参数,具体包括:从PTP报文关键参数中提取与目标参数相关的目标时间戳;基于目标时间戳确定目标参数。
在一些实施例中,PTP报文关键参数包括同步报文发送时间戳、同步报文接收时间戳、同步随附报文时间参数、端延时请求报文发送时间戳、端延时请求报文接收时间戳、端延时应答报文发送时间戳和端延时应答报文接收时间戳;目标参数包括当前节点端延时请求发送时间、在前节点端延时请求接收时间、在前节点端延时应答发送时间和当前节点端延时应答接收时间。
S220、基于目标参数确定当前节点的同步时间。
在一些实施例中,基于目标参数确定当前节点的同步时间,包括:基于目标参数、预设修正时间和预设频偏比,确定在前节点修正时间,在前节点修正时间为同步报文由主节点发出后至被在前节点转发之前,在网络链路中传输和驻留所持续的时间;基于目标参数和预设频偏比,确定在前节点与当前节点之间的链路传输延时和当前节点频偏比,当前节点频偏比为当前节点与主节点的时钟频率的比值;基于主节点精准时间、在前节点修正时间、链路传输延时和当前节点频偏比,确定同步时间。
本公开实施例提供的时间同步方法,与本公开实施例提供的时间同步装置属于一个总的发明构思,未在时间同步方法实施例中详尽描述的内容可参考时间同步装置实施例,此处不再赘述。
本公开实施例还提供了一种电子设备,包括:至少一个处理器;和与至少一个处理器 通信连接的存储器;其中,该存储器存储有可被至少一个处理器执行的指令,该指令被至少一个处理器执行,以使至少一个处理器能够执行如前述任一实施例所述的时间同步方法。
本公开实施例还提供了一种存储有计算机指令的非瞬时计算机可读存储介质,其中,该计算机指令用于使计算机执行如前述任一实施例所述的时间同步方法。
本公开实施例还提供了一种计算机程序产品,包括计算机程序,该计算机程序在被处理器执行时实现如前述任一实施例所述的时间同步方法。
本公开实施例还提供了一种计算机程序,其中该计算机程序包括计算机程序代码,当该计算机程序代码在计算机上运行时,使得计算机执行如前述任一实施例所述的时间同步方法。
需要说明的是,前述对时间同步装置和方法实施例的解释说明也适用于上述实施例中的电子设备、计算机可读存储介质、计算机程序产品和计算机程序,此处不再赘述。
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。
以上所述仅是本公开的具体实施方式,使本领域技术人员能够理解或实现本公开。对这些实施例的多种修改对本领域的技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本公开的精神或范围的情况下,在其它实施例中实现。因此,本公开将不会被限制于本文所述的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。
本公开所有实施例均可以单独被执行,也可以与其他实施例相结合被执行,均视为本公开要求的保护范围。

Claims (22)

  1. 一种时间同步装置,配置于当前节点,其特征在于,包括报文接收处理模块和同步时间确定模块,所述报文接收处理模块的输出端与所述同步时间确定模块的输入端连接;
    所述报文接收处理模块用于接收在前节点发送的PTP报文,基于所述PTP报文确定目标参数,所述目标参数为用于表征所述当前节点与主节点之间时间差异的相关时间参数;
    所述同步时间确定模块用于基于所述目标参数确定所述当前节点的同步时间。
  2. 根据权利要求1所述的装置,其特征在于,所述报文接收处理模块包括报文预处理单元,所述报文预处理单元用于接收在前节点发送的PTP报文,对所述PTP报文进行时钟域转换。
  3. 根据权利要求1或2所述的装置,其特征在于,所述报文接收处理模块还包括报文解析单元,所述报文解析单元的输入端与所述报文预处理单元的输出端连接;
    所述报文解析单元用于解析经时钟域转换后的所述PTP报文,得到PTP报文关键参数,所述PTP报文关键参数为所述PTP报文携带的时间参数。
  4. 根据权利要求3所述的装置,其特征在于,所述报文解析单元用于解析经时钟域转换后的所述PTP报文,得到PTP报文关键参数包括:
    获取PTP报文描述符;
    基于所述PTP报文描述符确定报文类型;
    从所述PTP报文中提取所述报文类型对应的PTP报文关键参数。
  5. 根据权利要求3或4所述的装置,其特征在于,所述报文接收处理模块还包括目标参数确定单元,所述目标参数确定单元的输入端与所述报文解析单元的输出端连接;
    所述目标参数确定单元用于基于所述PTP报文关键参数确定所述目标参数。
  6. 根据权利要求5所述的装置,其特征在于,所述目标参数确定单元具体用于:
    从所述PTP报文关键参数中提取与所述目标参数相关的目标时间戳;
    基于所述目标时间戳确定所述目标参数。
  7. 根据权利要求3至6中任一项所述的装置,其特征在于,所述PTP报文关键参数包括同步报文发送时间戳、同步报文接收时间戳、同步随附报文时间参数、端延时请求报文发送时间戳、端延时请求报文接收时间戳、端延时应答报文发送时间戳和端延时应答报文接收时间戳;所述目标参数包括当前节点端延时请求发送时间、在前节点端延时请求接收时间、在前节点端延时应答发送时间和当前节点端延时应答接收时间。
  8. 根据权利要求1至7中任一项所述的装置,其特征在于,所述同步时间确定模块用于:
    基于所述目标参数、预设修正时间和预设频偏比,确定在前节点修正时间,所述在前节点修正时间为同步报文由主节点发出后至被在前节点转发之前,在网络链路中传输和驻留所持续的时间;
    基于所述目标参数和所述预设频偏比,确定所述在前节点与所述当前节点之间的链路传输延时和当前节点频偏比,所述当前节点频偏比为当前节点与主节点的时钟频率的比值;
    基于主节点精准时间、所述在前节点修正时间、所述链路传输延时和所述当前节点频偏比,确定所述同步时间。
  9. 根据权利要求1至8中任一项所述的装置,其特征在于,所述时间同步装置由可编程逻辑器件配置。
  10. 一种时间同步系统,其特征在于,包括一个主节点和至少一个从节点,如权利要求1至9中任一项所述的时间同步装置配置于所述从节点中。
  11. 一种时间同步方法,其特征在于,应用于如权利要求1至9中任一项所述的时间同步装置,所述方法包括:
    接收在前节点发送的PTP报文,基于所述PTP报文确定目标参数,所述目标参数为用于表征所述当前节点与主节点之间时间差异的相关时间参数;
    基于所述目标参数确定所述当前节点的同步时间。
  12. 根据权利要求11所述的方法,其特征在于,所述接收在前节点发送的PTP报文,基于所述PTP报文确定目标参数,包括:
    接收在前节点发送的PTP报文,对所述PTP报文进行时钟域转换。
  13. 根据权利要求11或12所述的方法,其特征在于,所述接收在前节点发送的PTP报文,基于所述PTP报文确定目标参数,还包括:
    解析经时钟域转换后的所述PTP报文,得到PTP报文关键参数,所述PTP报文关键参数为所述PTP报文携带的时间参数。
  14. 根据权利要求13所述的方法,其特征在于,所述解析经时钟域转换后的所述PTP报文,得到PTP报文关键参数,包括:
    获取PTP报文描述符;
    基于所述PTP报文描述符确定报文类型;
    从所述PTP报文中提取所述报文类型对应的PTP报文关键参数。
  15. 根据权利要求13或14所述的方法,其特征在于,所述方法还包括:
    基于所述PTP报文关键参数确定目标参数。
  16. 根据权利要求15所述的方法,其特征在于,所述基于所述PTP报文关键参数确定目标参数,具体包括:
    从所述PTP报文关键参数中提取与所述目标参数相关的目标时间戳;
    基于所述目标时间戳确定所述目标参数。
  17. 根据权利要求13至16中任一项所述的方法,其特征在于,所述PTP报文关键参数包括同步报文发送时间戳、同步报文接收时间戳、同步随附报文时间参数、端延时请求报文发送时间戳、端延时请求报文接收时间戳、端延时应答报文发送时间戳和端延时应答报文接收时间戳;所述目标参数包括当前节点端延时请求发送时间、在前节点端延时请求 接收时间、在前节点端延时应答发送时间和当前节点端延时应答接收时间。
  18. 根据权利要求11至17中任一项所述的方法,其特征在于,所述基于所述目标参数确定所述当前节点的同步时间,包括:
    基于所述目标参数、预设修正时间和预设频偏比,确定在前节点修正时间,所述在前节点修正时间为同步报文由主节点发出后至被在前节点转发之前,在网络链路中传输和驻留所持续的时间;
    基于所述目标参数和所述预设频偏比,确定所述在前节点与所述当前节点之间的链路传输延时和当前节点频偏比,所述当前节点频偏比为当前节点与主节点的时钟频率的比值;
    基于主节点精准时间、所述在前节点修正时间、所述链路传输延时和所述当前节点频偏比,确定所述同步时间。
  19. 一种电子设备,包括:
    至少一个处理器;和
    与所述至少一个处理器通信连接的存储器;其中,
    所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行权利要求11至18中任一项所述的时间同步方法。
  20. 一种存储有计算机指令的非瞬时计算机可读存储介质,其中,所述计算机指令用于使所述计算机执行根据权利要求11至18中任一项所述的时间同步方法。
  21. 一种计算机程序产品,包括计算机程序,所述计算机程序在被处理器执行时实现根据权利要求11至18中任一项所述的时间同步方法。
  22. 一种计算机程序,其中所述计算机程序包括计算机程序代码,当所述计算机程序代码在计算机上运行时,使得计算机执行如权利要求11至18中任一项所述的时间同步方法。
PCT/CN2022/119691 2021-09-23 2022-09-19 时间同步装置、系统及方法 WO2023045881A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111115390.3 2021-09-23
CN202111115390.3A CN115865246A (zh) 2021-09-23 2021-09-23 时间同步装置、系统及方法

Publications (1)

Publication Number Publication Date
WO2023045881A1 true WO2023045881A1 (zh) 2023-03-30

Family

ID=85652987

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/119691 WO2023045881A1 (zh) 2021-09-23 2022-09-19 时间同步装置、系统及方法

Country Status (2)

Country Link
CN (1) CN115865246A (zh)
WO (1) WO2023045881A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116545572A (zh) * 2023-06-30 2023-08-04 苏州齐思智行汽车系统有限公司 一种基于fpga的原始图像数据采集系统
CN117061439B (zh) * 2023-10-10 2023-12-12 长沙先度科技有限公司 一种tsn实时以太网交换机的数据处理方法

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102104476A (zh) * 2011-02-21 2011-06-22 中兴通讯股份有限公司 时钟同步装置及方法
CN103067112A (zh) * 2012-12-17 2013-04-24 福建星网锐捷网络有限公司 时钟同步方法、装置及网络设备
US20130170507A1 (en) * 2011-12-13 2013-07-04 Canning Hsueh Time synchronization for network testing equipment
CN113411153A (zh) * 2021-06-07 2021-09-17 中国人民解放军国防科技大学 一种用于时间敏感网络的集中式控制时间同步方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102104476A (zh) * 2011-02-21 2011-06-22 中兴通讯股份有限公司 时钟同步装置及方法
US20130170507A1 (en) * 2011-12-13 2013-07-04 Canning Hsueh Time synchronization for network testing equipment
CN103067112A (zh) * 2012-12-17 2013-04-24 福建星网锐捷网络有限公司 时钟同步方法、装置及网络设备
CN113411153A (zh) * 2021-06-07 2021-09-17 中国人民解放军国防科技大学 一种用于时间敏感网络的集中式控制时间同步方法

Also Published As

Publication number Publication date
CN115865246A (zh) 2023-03-28

Similar Documents

Publication Publication Date Title
WO2023045881A1 (zh) 时间同步装置、系统及方法
EP2817902B1 (en) Method and network node for processing a precision time protocol
US10673551B2 (en) Time synchronization method and apparatus
CN104836630B (zh) Ieee1588时钟同步系统及其实现方法
CN112838903B (zh) 一种时钟同步方法、设备及存储介质
WO2014083640A1 (ja) 通信装置、通信システムおよび時刻同期方法
US20110035511A1 (en) Remote Hardware Timestamp-Based Clock Synchronization
WO2016004644A1 (zh) 一种监控以太网时钟同步的方法及装置
EP2807785B1 (en) Packet-based timing measurement
CN103929293A (zh) 非对称延迟的时间同步方法及系统
JP2012170076A (ja) アビオニクスネットワーク内のフリーランニングノードを時間同期させる方法
WO2015117501A1 (zh) 一种时间同步方法、可编程逻辑器件、单板及网元
WO2015196685A1 (zh) 时钟同步方法及装置
CN110572230A (zh) 一种用于实现时间同步的修正方法及装置
WO2019036943A1 (zh) 一种报文处理的方法和网络设备
CN103138887A (zh) 一种1588事件报文的处理方法及系统
WO2017177751A1 (zh) 时间同步方法和装置
CN103259640A (zh) 一种同步时间的方法和设备
CN111726188B (zh) Airt-ros实时系统与非实时系统时钟同步方法及装置
CN111953442A (zh) 一种快速高精度时间同步系统
CN113574813A (zh) 用于确定时间信息的无线网络系统的网络实体和方法
WO2018041108A1 (zh) 确定时间同步报文的时钟时间的方法、装置和设备
WO2016004645A1 (zh) 一种基于e1链路的ieee1588时钟同步方法、系统及装置
CN111800212B (zh) 一种时间戳抖动补偿方法及装置
Diarra et al. Improved clock synchronization start-up time for Ethernet AVB-based in-vehicle networks

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: 22871927

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 2022871927

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: 2022871927

Country of ref document: EP

Effective date: 20240423