WO2017177751A1 - 时间同步方法和装置 - Google Patents

时间同步方法和装置 Download PDF

Info

Publication number
WO2017177751A1
WO2017177751A1 PCT/CN2017/072834 CN2017072834W WO2017177751A1 WO 2017177751 A1 WO2017177751 A1 WO 2017177751A1 CN 2017072834 W CN2017072834 W CN 2017072834W WO 2017177751 A1 WO2017177751 A1 WO 2017177751A1
Authority
WO
WIPO (PCT)
Prior art keywords
message
time
packet
event
timestamp
Prior art date
Application number
PCT/CN2017/072834
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 WO2017177751A1 publication Critical patent/WO2017177751A1/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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L7/00Arrangements for synchronising receiver with transmitter
    • 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/0685Clock or time synchronisation in a node; Intranode synchronisation
    • H04J3/0697Synchronisation in a packet node
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W56/00Synchronisation arrangements
    • H04W56/001Synchronization between nodes

Definitions

  • the present invention relates to the field of communications technologies, and in particular, to a time synchronization method and apparatus.
  • the frequency synchronization is required between the base stations, but also strict time synchronization is required, and the time synchronization is mainly performed according to the time of the event message.
  • the event message in the tag message cannot be distinguished by determining whether the tag message includes a field of the event message type.
  • the packet length in the tag network is not fixed because each node is between The generated message has more content and is more complicated.
  • the tag message may have the same content as the event message type field, so that the time stamper cannot identify the event message from the message, and cannot complete the event report. Text is added to the time information so that time synchronization is not possible in the tag network.
  • the main purpose of the present invention is to provide a time synchronization method and device, which aims to solve the problem that the event message cannot be identified in the tag network, and the time information cannot be added in the event message, so that the time synchronization cannot be realized.
  • the present invention provides a time synchronization method, the method comprising:
  • the time stamping device identifies the 1588 event message from the tag message, wherein the 1588 event message is used between the nodes to be synchronized. Time synchronization
  • the time is synchronized between the nodes to be synchronized according to the time stamp.
  • the step of identifying, by the time stamping device, the 1588 event message from the label message comprises:
  • the packet is parsed by the time stamping device, and the label is identified according to the packet type.
  • Decapsulating the label packet identifies a 1588 event packet.
  • the step of decapsulating the label message to identify a 1588 event message includes:
  • the packet is parsed and matched to the destination mac+ source mac+port number 88f7+ event message type, and is identified as a Layer 2 multicast 1588 event message; or
  • the step of time stamping the event message by the time stamping device comprises:
  • the first timestamp is marked at the P device entry, and the second timestamp is forwarded to the egress, and the CF domain is corrected by the deviation of the first timestamp and the second timestamp, and the correction is performed.
  • the subsequent 1588 event message is sent out;
  • a third timestamp is added to the entry.
  • the step of synchronizing the time between the nodes to be synchronized according to the time stamp comprises:
  • Deviation and delay are calculated according to the third timestamp and the CF domain, and time is synchronized by time correction of the PE device.
  • the configuration of the time stamping device comprises: a message type, a message label number, a label length, a control word number, and a control word length.
  • the present invention also provides a time synchronization device, the device comprising:
  • An identification module configured to identify, in the 1588-enabled tag network configured with a time stamping device, the time stamping device to identify a 1588 event message from the tag message, wherein the 1588 event message is used Time synchronization between nodes to be synchronized;
  • a timestamp adding module configured to time stamp the event message by using the time stamping device
  • the synchronization module is configured to synchronize time between nodes to be synchronized according to the time stamp.
  • the identification module comprises:
  • the parsing unit is configured to parse the packet by using the time stamping device, and identify the label packet according to the packet type;
  • the identification unit is configured to decapsulate the label message to identify a 1588 event message.
  • the identification module is further configured to parse the label message, and match the destination mac+ source mac+ port number 88f7+ event message type, and identify it as a Layer 2 multicast 1588 event message; or
  • the timestamp adding module is further configured to: for the P device, put a first timestamp at the P device entry, forward to the exit and add a second timestamp, by using the first timestamp and the Deviating the CF field of the second timestamp, and transmitting the corrected 1588 event message;
  • a third timestamp is added to the entry.
  • the synchronization module is further configured to: calculate a deviation and a delay according to the third timestamp and the CF domain, and synchronize the time by time correction of the PE device.
  • the configuration of the time stamping device comprises: a message type, a message label number, a label length, a control word number, and a control word length.
  • the present invention configures a time stamping device in the tag network, so that the time stamping device can identify that each node to be synchronized in the tag network can recognize the 1588 event message in the tag message, thereby adding a time stamp to the event message, thereby The timestamps of the event messages in the event packets transmitted between the nodes to be synchronized can be made to be time synchronized.
  • FIG. 1 is a schematic flow chart of a first embodiment of a time synchronization method according to the present invention
  • FIG. 2 is a schematic flowchart of identifying a 1588 event message from a label message by using the time stamping device according to an embodiment of the present invention
  • FIG. 3 is a schematic diagram of a refinement process for decapsulating the label packet to identify a 1588 event packet according to an embodiment of the present disclosure
  • FIG. 4 is a time when the event message is added by the time stamping device in the embodiment of the present invention.
  • FIG. 5 is a schematic diagram of functional modules of a first embodiment of a time synchronization apparatus according to the present invention.
  • FIG. 6 is a schematic diagram of a refinement function module of an identification module according to an embodiment of the present invention.
  • the present invention provides a time synchronization method.
  • FIG. 1 is a schematic flowchart of a first embodiment of a time synchronization method according to the present invention.
  • the time synchronization method includes:
  • Step S10 In the 1588-enabled tag network configured with the time stamping device, the time stamping device identifies the 1588 event message from the tag message;
  • the time stamping device is configured in each node to be synchronized in the tag network, so that each node can identify the event message by time stamping the device.
  • the network measurement and control system precise clock synchronization protocol referred to as IEEE 1588
  • IEEE 1588 is enabled in the tag network when the tag network is created, such that each node in the tag network supports IEEE 1588 time.
  • other protocols such as Network Time Protocol (NTP), can also be used.
  • NTP Network Time Protocol
  • IEEE 1588 defines a Precision Time Protocol (PTP).
  • PTP Precision Time Protocol
  • the purpose of the PTP protocol is to synchronize time.
  • the function of the PTP protocol is as follows: First, the BMC (Best Master Clock Algorithm) is used to select the port state to determine the network topology of the entire network. First, determine the device GM (GrandMaster) that is used to introduce the clock source in the network according to the priority setting of the PTP on the device. Then, determine the port role of the device in the network through the port state selection algorithm.
  • the port status of the PTP includes three.
  • the message of the event message type includes: Sync, Delay_Req, Pdelay_Req, Pdelay_Resp; common messages include: Announce, Follow_Up, Delay_Resp, Pdelay_Resp_Follow_Up, Management, Signaling.
  • the event message is mainly used to generate and interact with common and edge clock information that needs to be synchronized, and uses a "delay request response mechanism".
  • the general message is mainly used to measure the link delay between two clock ports, using the "peer delay mechanism”.
  • Announce messages are used to enable synchronous layering. Management is used between the management node and the clock to query and upgrade the PTP data settings for clock maintenance. It can also be used to customize the PTP system and initialization, as well as error management. Signaling is used to perform other purposes of interaction between clocks, such as negotiating unicast message rates.
  • the encapsulation format of PTP packets supports the types of IEEE802, IPV4, and IPV 6.
  • the encapsulation format of the IEEE 802.13 protocol is a Layer 2 packet encapsulation, mainly in the form of Layer 2 multicast. In this type of encapsulation, there is no requirement for the VLAN configuration of the device. When the packet sent by the device is in Ethernet format, the tag information is not tagged.
  • the IPV4 packet encapsulation format is a Layer 3 packet encapsulation. It includes three layers of unicast and Layer 3 multicast. In this type of encapsulation, the port of the device is required to be added to the Layer 3 PTP VLAN. If the Layer 3 unicast format is used, the device needs to be connected through Layer 3 routing. If it is in Layer 3 multicast format, it is required. Devices in the network are multicast in the same VLAN.
  • the time synchronization function of 1588 it is necessary to realize the frequency recovery of the 1588 clock source by means of the clock chip, and then send the protocol message through the CPU, and time stamp the time stamp of the message loaded by the device. Complete the time correction for the slave clock.
  • the implementation of the Layer 3 unicast packet encapsulation is performed by writing the configuration of the port enabled with the PTP protocol, including the source address information and the destination address information of the IP address to the clock chip, and performing the IP address information obtained on the clock chip. Encapsulation of the message.
  • edge clock node mode BC normal clock mode OC
  • transparent transmission clock mode TC OC+TC
  • TC+BC transparent transmission clock mode
  • users can select the corresponding mode according to the selected routing device.
  • IEEE 1588 enables the most accurate clocks in a distributed network to be synchronized with other clocks, not only for tag networks, but also for sensors and implementations in standard Ethernet or other distributed bus systems using multicast technology. And clocks in other terminal devices Synchronization, which can perform sub-microsecond synchronization.
  • configuring the time stamping device in the label network in the embodiment further includes: configuring a packet type, a packet label number, a label length, a control word number, and a control word length in the time stamping device.
  • the configuration may be configured on a case-by-case basis. For example, when the lengths of the labels in some networks are the same, the label length does not need to be configured.
  • a combination of several types of information may be selected to determine whether it is an event message. Those skilled in the art may know that the more types of information configured, the higher the accuracy of the judgment result.
  • each node in the label network After configuring the time to stamp the device, start the timing module and time algorithm of each node in the tag network, such as enabling the clock in each node.
  • each node in the label network When the label network is started, each node in the label network generates a label message according to the requirement, and the label message includes but is not limited to an event message and an ordinary message, and the label message may be automatically generated or generated according to a user operation. .
  • the time stamping device identifies the 1588 event message from the tag message.
  • the process of the time stamping device identifying the 1588 event message may include:
  • Step S11 parsing the packet by the time stamping device, and identifying the label packet according to the packet type
  • Step S12 Decapsulating the label message to identify a 1588 event message.
  • the packets that are transferred between the nodes to be synchronized are generally packaged or encrypted.
  • the packet is usually parsed. Specifically, the packet generated by the local node is parsed or the packet sent by other nodes is received, and the label packet is identified according to the type of the packet. Then, the label message is unsealed to identify the 1588 event message.
  • the process of decapsulating the label message to identify a 1588 event message includes:
  • step S121 the label packet is parsed and matched to the destination mac+ source mac+port number 88f7+ event message type, and is identified as a Layer 2 multicast 1588 event message; or
  • step S122 the packet is matched to the ipv4 packet and the port number 320, and is identified as a Layer 3 multicast event packet or a Layer 3 unicast 1588 event packet.
  • the type of the event message may also be determined. Because the type of the event message may be different at different time information, the event may be determined according to the event. The type of the message adds time information or a timestamp to the corresponding location. For example, the label message is parsed according to the pre-configured number of tags, the length of the tag, the number of control words, and the length of the control word. The content of the tag is determined to be Layer 2 multicast 1588.
  • the event packet is a Layer 3 multicast 1588 event packet or a Layer 3 unicast event packet. If it matches the destination mac+ source mac+88f7+ event message type, it is identified as a Layer 2 multicast event packet.
  • the packet type identifies that it is not a label message, it directly matches the destination mac+ source mac+88f7+ event message type and the ipv4 packet + port number 320.
  • Step S20 time stamping the event packet by using the time stamping device
  • each node to be synchronized identifies an event message in the tag message generated or received by each node, and then adds the event message in the identified event message.
  • the timestamp that is, the timestamp added by the time stamping device, specifically, the time at which the timestamp is added is at the entry and exit of each node to be synchronized.
  • time information may be added to the corresponding location according to the identified event message type.
  • the process of adding a timestamp by time stamping the device includes:
  • Step S21 For the P device, put a first timestamp at the P device entry, forward to the egress to add a second timestamp, and correct the CF domain by the deviation of the first timestamp and the second timestamp. Sending the corrected 1588 event message;
  • Step S22 After receiving the 1588 event message, the PE device adds a third timestamp to the entry.
  • the time stamping device parses the packet, and identifies a tag packet according to the packet type, and then, The tag message is parsed according to the pre-configured number of tags, the length of the tag, the number of control words, the length of the control word, and the like. If the content of the parsed message can match the destination MAC+source MAC+88f7+ event message type, it is identified as Layer 2 multicast event packets. If it matches the IPV4 packet + port number 320, it is identified as a Layer 3 multicast event packet or a Layer 3 unicast event packet. 88f7 is a protocol type in the IEEE1588 protocol; port number 320 is a port specified by the IEEE1588 protocol, and this port generates an event message.
  • the packet enters the ingress timestamp at the entry of the P device, forwards it to the egress and puts it out of the egress timestamp, and corrects the CF domain with the deviation of the two timestamps.
  • the message is sent to the PE device, and after receiving the 1588 event message, the PE device adds a third timestamp to the entry.
  • the PE device forwards the received packet to the PTP module for processing.
  • Step S30 synchronizing the time between nodes to be synchronized according to the time stamp.
  • the label message including the timestamp is sent to other nodes to be synchronized for processing.
  • the other nodes to be synchronized may be one or more.
  • the time-stamped device After receiving the tagged message, the time-stamped device identifies the event packet in the received tagged message, and obtains the timestamp in the received tagged message. The time of the self is time corrected according to the time stamp in the received tag message and the current time of the tag.
  • a timestamp is added to the egress to the next node to be synchronized, and other nodes perform similar processing, so that the time synchronization of each node to be synchronized in the tag network is achieved.
  • the synchronization module 30 is further configured to: calculate a deviation and a delay according to the third timestamp and the CF domain, and perform time correction on the PE device to perform time Synchronize.
  • the PE device For the label network in which the P device and the PE device are present, the PE device identifies the CF field of the event packet in the received label message according to the label message sent by the P device, and then receives the label according to the CF domain and the label.
  • the time of the text that is, the third timestamp added when the tag message is received, corrects the time of the PE device, thereby synchronizing the time.
  • the calculation process and results may be different. Time correction is performed based on the calculated third time, deviation, and time delay.
  • the present invention configures a time stamping device in the tag network, so that the time stamping device can identify that each node to be synchronized in the tag network can recognize the 1588 event message in the tag message, thereby adding a time stamp to the event message, thereby The timestamps of the event messages in the event packets transmitted between the nodes to be synchronized can be made to be time synchronized.
  • the invention further provides a time synchronization device.
  • FIG. 5 is a schematic diagram of functional modules of a first embodiment of a time synchronization apparatus according to the present invention.
  • the time synchronization device includes:
  • Identification module 10 configured to enable a 1588-enabled tag network with a time stamping device In the network, the time stamping device identifies a 1588 event message from the tag message, where the 1588 event message is used for time synchronization between nodes to be synchronized;
  • the time stamping device is configured in each node to be synchronized in the tag network, so that each node can identify the event message by time stamping the device.
  • the network measurement and control system precise clock synchronization protocol referred to as IEEE 1588
  • IEEE 1588 is enabled in the tag network when the tag network is created, such that each node in the tag network supports IEEE 1588 time.
  • other protocols such as Network Time Protocol (NTP), can also be used.
  • NTP Network Time Protocol
  • IEEE 1588 defines a Precision Time Protocol (PTP).
  • PTP Precision Time Protocol
  • the purpose of the PTP protocol is to synchronize time.
  • the function of the PTP protocol is as follows: First, the BMC (Best Master Clock Algorithm) is used to select the port state to determine the network topology of the entire network. First, determine the device GM (GrandMaster) that is used to introduce the clock source in the network according to the priority setting of the PTP on the device. Then, determine the port role of the device in the network through the port state selection algorithm.
  • the port status of the PTP includes three.
  • the error the type of PTP message used for the time offset check calculation, mainly includes two categories: event message message and general message message.
  • the message of the event message type includes: Sync, Delay_Req, Pdelay_Req, Pdelay_Resp; common messages include: Announce, Follow_Up, Delay_Resp, Pdelay_Resp_Follow_Up, Management, Signaling.
  • the event message is mainly used to generate and interact with common and edge clock information that needs to be synchronized, and uses a "delay request response mechanism".
  • the general message is mainly used to measure the link delay between two clock ports, using the "peer delay mechanism”.
  • Announce messages are used to enable synchronous layering. Management is used between the management node and the clock to query and upgrade the PTP data settings for clock maintenance. It can also be used to customize the PTP system and initialization, as well as error management. Signaling is used to perform other purposes of interaction between clocks, such as negotiating unicast message rates.
  • the encapsulation format of PTP packets supports the types of IEEE802, IPV4, and IPV 6.
  • the encapsulation format of the IEEE 802.13 protocol is a Layer 2 packet encapsulation, mainly in the form of Layer 2 multicast. In this type of encapsulation, there is no requirement for the VLAN configuration of the device. In the Ethernet format, the tag information is not tagged.
  • the IPV4 packet encapsulation format is a Layer 3 packet encapsulation. It includes three layers of unicast and Layer 3 multicast. In this type of encapsulation, the port of the device is required to be added to the Layer 3 PTP VLAN. If the Layer 3 unicast format is used, the device needs to be connected through Layer 3 routing. If it is in Layer 3 multicast format, it is required. Devices in the network are multicast in the same VLAN.
  • the time synchronization function of 1588 it is necessary to realize the frequency recovery of the 1588 clock source by means of the clock chip, and then send the protocol message through the CPU, and time stamp the time stamp of the message loaded by the device. Complete the time correction for the slave clock.
  • the implementation of the Layer 3 unicast packet encapsulation is performed by writing the configuration of the port enabled with the PTP protocol, including the source address information and the destination address information of the IP address to the clock chip, and performing the IP address information obtained on the clock chip. Encapsulation of the message.
  • edge clock node mode BC normal clock mode OC
  • transparent transmission clock mode TC OC+TC
  • TC+BC transparent transmission clock mode
  • users can select the corresponding mode according to the selected routing device.
  • IEEE 1588 enables the most accurate clocks in a distributed network to be synchronized with other clocks, not only for tag networks, but also for sensors and implementations in standard Ethernet or other distributed bus systems using multicast technology.
  • the clocks in the device and other terminal devices are synchronized, which can perform sub-microsecond synchronization.
  • configuring the time stamping device in the label network in the embodiment further includes: configuring a packet type, a packet label number, a label length, a control word number, and a control word length in the time stamping device.
  • the configuration may be configured on a case-by-case basis. For example, when the lengths of the labels in some networks are the same, the label length does not need to be configured.
  • a combination of several types of information may be selected to determine whether it is an event message. Those skilled in the art may know that the more types of information configured, the higher the accuracy of the judgment result.
  • each node in the label network After configuring the time to stamp the device, start the timing module and time algorithm of each node in the tag network, such as enabling the clock in each node.
  • each node in the label network When the label network is started, each node in the label network generates a label message according to the requirement, and the label message includes but is not limited to an event message and an ordinary message, and the label message may be automatically generated or generated according to a user operation. .
  • the time stamping device identifies the 1588 event message from the tag message.
  • the identification module 10 may include:
  • the parsing unit 11 is configured to parse the packet by using the time stamping device, and identify the label packet according to the packet type;
  • the identifying unit 12 is configured to decapsulate the label message to identify a 1588 event message.
  • the packets that are transferred between the nodes to be synchronized are generally packaged or encrypted.
  • the packet is usually parsed. Specifically, the packet generated by the local node is parsed or the packet sent by other nodes is received, and the label packet is identified according to the type of the packet. Then, the label message is unsealed to identify the 1588 event message.
  • the identification module 10 is further configured to parse the label message, and match the destination mac+ source mac+ port number 88f7+ event message type, and identify it as a Layer 2 multicast 1588 event message; or
  • the type of the event message may be determined.
  • the type of the event message may be different according to the type of the event message. Add time information or timestamp to the location.
  • the label message is parsed according to the pre-configured number of tags, the length of the tag, the number of control words, and the length of the control word.
  • the content of the tag is determined to be Layer 2 multicast 1588.
  • the event packet is a Layer 3 multicast 1588 event packet or a Layer 3 unicast event packet. If it matches the destination mac+ source mac+88f7+ event message type, it is identified as a Layer 2 multicast event packet.
  • the packet type identifies that it is not a label message, it directly matches the destination mac+ source mac+88f7+ event message type and the ipv4 packet + port number 320.
  • the timestamp adding module 20 is configured to time stamp the event message by using the time stamping device
  • each node to be synchronized identifies the event message in the tag message generated or received by the node, and then adds a timestamp to the identified event message. That is, the time stamp added by the time stamping device, specifically, the time when the time stamp is added is at the entrance and exit of each node to be synchronized.
  • time information may be added to the corresponding location according to the identified event message type.
  • the timestamp adding module 20 is further configured to: for the P device, put a first timestamp at the P device entry, forward to the exit and add a second timestamp, by using the first timestamp and the The deviation of the second timestamp corrects the CF field, and sends the corrected 1588 event message.
  • the third timestamp is added to the entry.
  • the time stamping device parses the packet, and identifies a tag packet according to the packet type, and then, The tag message is parsed according to the pre-configured number of tags, the length of the tag, the number of control words, the length of the control word, and the like. If the content of the parsed message can match the destination MAC+source MAC+88f7+ event message type, it is identified as Layer 2 multicast event packets. If it matches the IPV4 packet + port number 320, it is identified as a Layer 3 multicast event packet or a Layer 3 unicast event packet. 88f7 is a protocol type in the IEEE1588 protocol; port number 320 is a port specified by the IEEE1588 protocol, and this port generates an event message.
  • the packet enters the ingress timestamp at the entry of the P device, forwards the egress timestamp to the egress, and corrects the CF domain with the deviation of the two timestamps, and then sends the packet to the PE device, and then the PE device. After receiving the 1588 event message, a third timestamp is added to the entry. Of course, if only the PE device is used in the label network, the PE device forwards the received packet to the PTP module for processing.
  • the synchronization module 30 is configured to synchronize the time between the nodes to be synchronized according to the time stamp.
  • the label message including the timestamp is sent to other nodes to be synchronized for processing.
  • the other nodes to be synchronized may be one or more.
  • the time-stamped device After receiving the tagged message, the time-stamped device identifies the event packet in the received tagged message, and obtains the timestamp in the received tagged message. The time of the self is time corrected according to the time stamp in the received tag message and the current time of the tag.
  • a timestamp is added to the egress to the next node to be synchronized, and other nodes perform similar processing, so that the time synchronization of each node to be synchronized in the tag network is achieved.
  • the time stamp Synchronizing the time between nodes to be synchronized includes calculating a deviation and a delay according to the third time stamp and the CF domain, and synchronizing the time by time correction of the PE device.
  • the PE device For the label network in which the P device and the PE device are present, the PE device identifies the CF field of the event packet in the received label message according to the label message sent by the P device, and then receives the label according to the CF domain and the label.
  • the time of the text that is, the third timestamp added when the tag message is received, corrects the time of the PE device, thereby synchronizing the time.
  • the calculation process and results may be different. Time correction is performed based on the calculated third time, deviation, and time delay.
  • the present invention configures a time stamping device in the tag network, so that the time stamping device can identify that each node to be synchronized in the tag network can recognize the 1588 event message in the tag message, thereby adding a time stamp to the event message, thereby The timestamps of the event messages in the event packets transmitted between the nodes to be synchronized can be made to be time synchronized.
  • each node can be time synchronized in an event message transmitted between nodes to be synchronized.

Landscapes

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

Abstract

本发明公开了一种时间同步方法,该方法包括:在配置有时间打戳器件的启用了1588的标签网络中,通过所述时间打戳器件从标签报文中识别出1588事件报文,其中,所述1588事件报文设置为待同步节点间的时间同步;通过所述时间打戳器件对所述事件报文加上时间戳;根据所述时间戳在待同步节点间对时间进行同步。本发明还公开了一种时间同步装置。本发明能够在标签网络中实现时间同步。

Description

时间同步方法和装置 技术领域
本发明涉及通信技术领域,尤其涉及一种时间同步方法和装置。
背景技术
在移动网路中,基站之间不仅要求频率同步,而且要求实现严格的时间同步,时间同步主要根据事件报文的时间进行。
然而,在标签网络中,不能通过判断标签报文是否包括事件报文类型的字段,来分辨出标签报文中事件报文;此外,标签网络中报文长度也不固定,因为各个节点之间产生的报文中内容较多、较杂,标签报文中可能存在与事件报文类型的字段相同的内容,从而时间打戳器无法从报文中识别出事件报文,无法完成在事件报文添加时间信息,从而在标签网络中无法实现时间同步。
发明内容
本发明的主要目的在于提出一种时间同步方法和装置,旨在解决标签网络中无法识别事件报文,无法完成在事件报文添加时间信息,从而无法实现时间同步的技术问题。
为实现上述目的,本发明提供的一种时间同步方法,所述方法包括:
在配置有时间打戳器件的启用了1588的标签网络中,通过所述时间打戳器件从标签报文中识别出1588事件报文,其中,所述1588事件报文用于待同步节点间的时间同步;
通过所述时间打戳器件对所述事件报文加上时间戳;
根据所述时间戳在待同步节点间对时间进行同步。
优选地,通过所述时间打戳器件从标签报文中识别出1588事件报文的步骤包括:
通过所述时间打戳器件对报文进行解析,根据报文类型识别出标签报 文;
对所述标签报文进行解封装识别出1588事件报文。
优选地,对所述标签报文进行解封装识别出1588事件报文的步骤包括:
对所述标签报文进行解析,匹配到目的mac+源mac+端口号88f7+事件消息类型,识别为二层组播1588事件报文;或者,
匹配到ipv4包+端口号320,识别为三层组播事件报文或者三层单播1588事件报文。
优选地,通过所述时间打戳器件对所述事件报文加上时间戳的步骤包括:
对于P设备,在所述P设备入口处打上第一时间戳,转发到出口处加上第二时间戳,通过所述第一时间戳和所述第二时间戳的偏差修正CF域,将修正后的1588事件报文发送出去;
对于PE设备,在接收到1588事件报文之后,在入口加上第三时间戳。
优选地,对于PE设备,根据所述时间戳在待同步节点间对时间进行同步的步骤包括:
根据所述第三时间戳和CF域计算偏差和时延,并通过对所述PE设备的时间校正对时间进行同步。
优选地,所述时间打戳器件的配置包括:报文类型、报文标签数量、标签长度、控制字数量和控制字长度。
此外,为实现上述目的,本发明还提供一种时间同步装置,所述装置包括:
识别模块,设置为在配置有时间打戳器件的启用了1588的标签网络中,通过所述时间打戳器件从标签报文中识别出1588事件报文,其中,所述1588事件报文用于待同步节点间的时间同步;
时间戳添加模块,设置为通过所述时间打戳器件对所述事件报文加上时间戳;
同步模块,设置为根据所述时间戳在待同步节点间对时间进行同步。
优选地,所述识别模块包括:
解析单元,设置为通过所述时间打戳器件对报文进行解析,根据报文类型识别出标签报文;
识别单元,设置为对所述标签报文进行解封装识别出1588事件报文。
优选地,所述识别模块还设置为对所述标签报文进行解析,匹配到目的mac+源mac+端口号88f7+事件消息类型,识别为二层组播1588事件报文;或者,
匹配到ipv4包+端口号320,识别为三层组播事件报文或者三层单播1588事件报文。
优选地,所述时间戳添加模块还设置为:对于P设备,在所述P设备入口处打上第一时间戳,转发到出口处加上第二时间戳,通过所述第一时间戳和所述第二时间戳的偏差修正CF域,将修正后的1588事件报文发送出去;
对于PE设备,在接收到1588事件报文之后,在入口加上第三时间戳。
优选地,所述同步模块还设置为:根据所述第三时间戳和CF域计算偏差和时延,并通过对所述PE设备的时间校正对时间进行同步。
优选地,所述时间打戳器件的配置包括:报文类型、报文标签数量、标签长度、控制字数量和控制字长度。
本发明通过在标签网络中配置时间打戳器件,使得时间打戳器件能够识别标签网络中各个待同步节点能够识别标签报文中的1588事件报文,从而在事件报文中添加时间戳,从而可以使得各个节点能够在各待同步节点之间传递的事件报文中时间戳进行时间同步。
附图说明
图1为本发明时间同步方法第一实施例的流程示意图;
图2为本发明实施例中通过所述时间打戳器件从标签报文中识别出1588事件报文的一种流程示意图;
图3为本发明实施例中对所述标签报文进行解封装识别出1588事件报文的一种细化流程示意图;
图4为本发明实施例中通过所述时间打戳器件对所述事件报文加上时 间戳的一种流程示意图;
图5为本发明时间同步装置第一实施例的功能模块示意图;
图6为本发明实施例中识别模块的细化功能模块示意图。
本发明目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。
本发明提供一种时间同步方法。
参照图1,图1为本发明时间同步方法第一实施例的流程示意图。
在本实施例中,该时间同步方法包括:
步骤S10,在配置有时间打戳器件的启用了1588的标签网络中,通过所述时间打戳器件从标签报文中识别出1588事件报文;
在创建标签网络时,先在标签网络中各待同步节点中配置时间打戳器件,使得各个节点可以通过时间打戳器件识别出事件报文。
在一优选实施例中,在创建标签网络时,在所述标签网络中启用网络测控***精确时钟同步协议,简称IEEE1588,使得标签网络中各个节点支持IEEE1588时间。当然还可以采用其他的协议,比如网络时间协议NTP(Network Time Protocol)。
IEEE 1588定义了一种精确时间协议PTP(Precision Time Protocol)。PTP协议的目的是用来同步时间,其功能包括两个方面:一是通过最佳时钟算法(BMC:Best Master Clock Algorithm),对端口状态进行选择,确定全网的组网拓扑结构。首先,根据设备上PTP的优先级设置,确定组网中的引入时钟源的设备GM(GrandMaster);然后通过端口的状态选择算法,确定组网中设备的端口角色,PTP的端口状态共包括三种:master、slave和passive,根据设备状态,则知道标签报文的流转关系;二是通过PTP报文的收发处理,进行时间偏差校验等的计算,完成全网的时间同步,并保证校验误差,用于时间偏差校验计算的PTP报文消息类型,主要包括 两大类:事件消息报文和通用消息报文。
事件消息类型的报文,包括:Sync,Delay_Req,Pdelay_Req,Pdelay_Resp;通用消息包括:Announce,Follow_Up,Delay_Resp,Pdelay_Resp_Follow_Up,Management,Signaling。
其中,事件消息主要用来发生和交互需要同步的普通和边缘时钟信息,使用“延迟请求响应机制”。而通用消息则主要用于测量2个时钟端口之间的链路延迟,使用“对等体延迟机制”。Announce消息用来使能同步分层。Management用在管理结点和时钟之间,用来询问和升级时钟维护的PTP数据设置,也可用来定制PTP***和初始化,以及错误管理。Signaling用来在时钟之间完成其它目的的交互,如协商单播消息速率。
PTP报文的封装格式,则支持IEEE802、IPV4和IPV 6的类型。其中:IEEE802.13协议的封装格式,即为二层报文封装,主要以二层组播的方式。此种封装时,对设备的VLAN配置没有要求,当设备发出去的报文为Ethernet格式时,是不加标签Tag信息的。IPV4报文封装格式,即为三层报文封装,这里包括了三层单播和三层组播两种格式。此种封装时,要求设备的端口首先要添加到三层的PTP VLAN中,如果是三层单播格式时,要求设备间通过三层路由来打通;如果是三层组播格式时,则要求组网内的设备间在同一个VLAN内组播。
在功能实现上,要实现1588的时间同步功能,则需要借助于时钟芯片来实现对1588时钟源的频率恢复,然后再通过CPU发送协议报文,及时间打戳器件加载的报文时间戳来完成对从时钟的时间修正。目前对三层单播报文封装的实现方式,是通过将启用了PTP协议的端口的配置,包括IP的源地址信息、目的地址信息写到时钟芯片,根据时钟芯片上获取到的IP地址信息进行报文的封装。
并可以支持边缘时钟节点模式BC、普通时钟模式OC、透传时钟模式TC、OC+TC和TC+BC等模式,在实际应用中用户可以根据选择的路由设备选择对应的模式。
采用IEEE 1588可以使分布式网络内的最精确时钟与其他时钟保持同步,不仅可以用于标签网络,还可以用于对标准以太网或其他采用多播技术的分布式总线***中的传感器、执行器以及其他终端设备中的时钟进行 同步,其可以进行亚微秒级同步。
具体地,本实施例中将标签网络中配置时间打戳器件还包括:在时间打戳器件中配置报文类型、报文标签数量、标签长度、控制字数量和控制字长度。当然在其他实施例中可以视具体情况配置,比如有些网络中的标签长度相同时,则不需要配置标签长度。具体实施中也可以选择其中几种信息的组合用于判断是否为事件报文,本领域人员可知在配置的信息种类越多,判断结果准确性越高。
在配置好时间打戳器件后,启动标签网络中各个节点的计时模块和时间算法等,比如启用各个节点中时钟。在启动标签网络时,标签网络中各个节点根据需要产生标签报文,所述标签报文包括但不限于事件报文和普通报文,所述标签报文可以自动产生也可以是根据用户操作产生。时间打戳器件从标签报文中识别出1588事件报文。
具体地,参阅图2,时间打戳器件识别出1588事件报文的过程可以包括:
步骤S11,通过所述时间打戳器件对报文进行解析,根据报文类型识别出标签报文;
步骤S12,对所述标签报文进行解封装识别出1588事件报文。
为减少发送数据的大小,以及在减少带宽的占用,在待同步节点之间流转的报文一般会进行打包或者加密等处理。在识别时通常需要解析报文,具体地,解析本节点产生的报文或者接收到其他节点发送的报文,根据报文的类型识别出标签报文。然后对标签报文进行解封,从而识别出1588事件报文。
具体地,参阅图3,对所述标签报文进行解封装识别出1588事件报文的过程包括:
步骤S121,对所述标签报文进行解析,匹配到目的mac+源mac+端口号88f7+事件消息类型,识别为二层组播1588事件报文;或者,
步骤S122,匹配到ipv4包+端口号320,识别为三层组播事件报文或者三层单播1588事件报文。
在识别出所述事件报文后,还可以判断所述事件报文的类型,因为所述事件报文的类型不同时间信息添加位置可能不同,则可以根据所述事件 报文的类型在相应的位置添加时间信息或者打上时间戳。比如根据预配置的标签数量、标签长度、控制字数量、控制字长度等信息解析所述标签报文,根据解析获得的内容可以判断出所述标签报文中事件报文是二层组播1588事件报文,还是三层组播1588事件报文或者三层单播事件报文。如果能匹配到目的mac+源mac+88f7+事件消息类型,则识别为二层组播事件报文。如果能匹配到ipv4包+端口号320,则识别为三层组播事件报文或者三层单播事件报文。如果报文类型识别出不是标签报文,则直接匹配目的mac+源mac+88f7+事件消息类型和ipv4包+端口号320这两个条件。
步骤S20,通过所述时间打戳器件对所述事件报文加上时间戳;
根据在步骤S10产生的标签报文或者接收到的标签报文,各个待同步节点识别出各自产生或接收到的所述标签报文中的事件报文,然后在识别出的事件报文中添加时间戳,即通过时间打戳器件添加的时间戳,具体地,添加时间戳的时间在各个待同步节点的入口和出口处。当然对于不同的事件报文,可以根据识别出的所述事件报文类型在相应位置添加时间信息。
具体地,参阅图4,通过时间打戳器件添加时间戳的过程包括:
步骤S21,对于P设备,在所述P设备入口处打上第一时间戳,转发到出口处加上第二时间戳,通过所述第一时间戳和所述第二时间戳的偏差修正CF域,将修正后的1588事件报文发送出去;
步骤S22,对于PE设备,在接收到1588事件报文之后,在入口加上第三时间戳。
如果用户选择的设备为P设备和PE设备,则P设备和PE设备接收到1588标签报文之后,时间打戳器件对报文进行解析,根据报文类型识别出是一个标签报文,然后,根据预配置的标签数量、标签长度、控制字数量、控制字长度等信息来解析所述标签报文,如果在解析获得的内容中能匹配到目的MAC+源MAC+88f7+事件消息类型,则识别为二层组播事件报文。如果能匹配到IPV4包+端口号320,则识别为三层组播事件报文或者三层单播事件报文。其中88f7是IEEE1588协议中一种协议类型;端口号320是IEEE1588协议规定的一个端口,这个端口会产生事件报文。
对于P设备,报文在P设备入口处打上进入ingress时间戳,转发到出口处打上出去egress时间戳,用两个时间戳的偏差修正CF域,再将报 文发送给PE设备,然后PE设备在接收到1588事件报文之后,在入口加上第三时间戳。当然如果在标签网络中只采用PE设备,则PE设备在入口出给接收到的报文打上时间戳后,直接转发到PTP模块进行处理。
步骤S30,根据所述时间戳在待同步节点间对时间进行同步。
根据在步骤S20在所述事件报文中添加时间戳后,将包括时间戳的标签报文发送给其他待同步节点进行处理,其他待同步节点可以是一个也可以是多个。其他待同步节点接收到包括有时间戳的标签报文后,通过配置的时间打戳器件识别出接收到的标签报文中的事件报文,从而获得接收的标签报文中的时间戳,进而根据获得接收的标签报文中的时间戳以及自身当前的时间,对自身的时间进行时间校正。在发送给下一个待同步节点时,在出口处添加时间戳后发生给下一个待同步节点,其他的节点进行类似的处理,从而使得标签网络中各个待同步节点的达到时间同步的效果。
具体地,对于存在P设备和PE设备的标签网络,同步模块30还设置为:根据所述第三时间戳和CF域计算偏差和时延,并通过对所述PE设备的时间校正对时间进行同步。
对于存在P设备和PE设备的标签网络,PE设备根据接收到P设备发送的标签报文,识别出接收到的标签报文中事件报文的CF域,然后根据CF域以及在接收到标签报文的时间,即在接收到标签报文时添加的第三时间戳,对PE设备的时间校正,从而对时间进行同步。当然在应用不同的协议或者时间算法时,其计算过程和结果可能不同。根据计算获得的第三时间、偏差和时延进行时间校正。
本发明通过在标签网络中配置时间打戳器件,使得时间打戳器件能够识别标签网络中各个待同步节点能够识别标签报文中的1588事件报文,从而在事件报文中添加时间戳,从而可以使得各个节点能够在各待同步节点之间传递的事件报文中时间戳进行时间同步。
本发明进一步提供一种时间同步装置。
参照图5,图5为本发明时间同步装置第一实施例的功能模块示意图。
在本实施例中,该时间同步装置包括:
识别模块10,设置为在配置有时间打戳器件的启用了1588的标签网 络中,通过所述时间打戳器件从标签报文中识别出1588事件报文,其中,所述1588事件报文用于待同步节点间的时间同步;
在创建标签网络时,先在标签网络中各待同步节点中配置时间打戳器件,使得各个节点可以通过时间打戳器件识别出事件报文。
在一优选实施例中,在创建标签网络时,在所述标签网络中启用网络测控***精确时钟同步协议,简称IEEE1588,使得标签网络中各个节点支持IEEE1588时间。当然还可以采用其他的协议,比如网络时间协议NTP(Network Time Protocol)。
IEEE 1588定义了一种精确时间协议PTP(Precision Time Protocol)。PTP协议的目的是用来同步时间,其功能包括两个方面:一是通过最佳时钟算法(BMC:Best Master Clock Algorithm),对端口状态进行选择,确定全网的组网拓扑结构。首先,根据设备上PTP的优先级设置,确定组网中的引入时钟源的设备GM(GrandMaster);然后通过端口的状态选择算法,确定组网中设备的端口角色,PTP的端口状态共包括三种:master、slave和passive,根据设备状态,则知道标签报文的流转关系;二是通过PTP报文的收发处理,进行时间偏差校验等的计算,完成全网的时间同步,并保证校验误差,用于时间偏差校验计算的PTP报文消息类型,主要包括两大类:事件消息报文和通用消息报文。
事件消息类型的报文,包括:Sync,Delay_Req,Pdelay_Req,Pdelay_Resp;通用消息包括:Announce,Follow_Up,Delay_Resp,Pdelay_Resp_Follow_Up,Management,Signaling。
其中,事件消息主要用来发生和交互需要同步的普通和边缘时钟信息,使用“延迟请求响应机制”。而通用消息则主要用于测量2个时钟端口之间的链路延迟,使用“对等体延迟机制”。Announce消息用来使能同步分层。Management用在管理结点和时钟之间,用来询问和升级时钟维护的PTP数据设置,也可用来定制PTP***和初始化,以及错误管理。Signaling用来在时钟之间完成其它目的的交互,如协商单播消息速率。
PTP报文的封装格式,则支持IEEE802、IPV4和IPV 6的类型。其中:IEEE802.13协议的封装格式,即为二层报文封装,主要以二层组播的方式。此种封装时,对设备的VLAN配置没有要求,当设备发出去的报文为 Ethernet格式时,是不加标签Tag信息的。IPV4报文封装格式,即为三层报文封装,这里包括了三层单播和三层组播两种格式。此种封装时,要求设备的端口首先要添加到三层的PTP VLAN中,如果是三层单播格式时,要求设备间通过三层路由来打通;如果是三层组播格式时,则要求组网内的设备间在同一个VLAN内组播。
在功能实现上,要实现1588的时间同步功能,则需要借助于时钟芯片来实现对1588时钟源的频率恢复,然后再通过CPU发送协议报文,及时间打戳器件加载的报文时间戳来完成对从时钟的时间修正。目前对三层单播报文封装的实现方式,是通过将启用了PTP协议的端口的配置,包括IP的源地址信息、目的地址信息写到时钟芯片,根据时钟芯片上获取到的IP地址信息进行报文的封装。
并可以支持边缘时钟节点模式BC、普通时钟模式OC、透传时钟模式TC、OC+TC和TC+BC等模式,在实际应用中用户可以根据选择的路由设备选择对应的模式。
采用IEEE 1588可以使分布式网络内的最精确时钟与其他时钟保持同步,不仅可以用于标签网络,还可以用于对标准以太网或其他采用多播技术的分布式总线***中的传感器、执行器以及其他终端设备中的时钟进行同步,其可以进行亚微秒级同步。
具体地,本实施例中将标签网络中配置时间打戳器件还包括:在时间打戳器件中配置报文类型、报文标签数量、标签长度、控制字数量和控制字长度。当然在其他实施例中可以视具体情况配置,比如有些网络中的标签长度相同时,则不需要配置标签长度。具体实施中也可以选择其中几种信息的组合用于判断是否为事件报文,本领域人员可知在配置的信息种类越多,判断结果准确性越高。
在配置好时间打戳器件后,启动标签网络中各个节点的计时模块和时间算法等,比如启用各个节点中时钟。在启动标签网络时,标签网络中各个节点根据需要产生标签报文,所述标签报文包括但不限于事件报文和普通报文,所述标签报文可以自动产生也可以是根据用户操作产生。时间打戳器件从标签报文中识别出1588事件报文。
具体地,参阅图6,识别模块10可以包括:
解析单元11,设置为通过所述时间打戳器件对报文进行解析,根据报文类型识别出标签报文;
识别单元12,设置为对所述标签报文进行解封装识别出1588事件报文。
为减少发送数据的大小,以及在减少带宽的占用,在待同步节点之间流转的报文一般会进行打包或者加密等处理。在识别时通常需要解析报文,具体地,解析本节点产生的报文或者接收到其他节点发送的报文,根据报文的类型识别出标签报文。然后对标签报文进行解封,从而识别出1588事件报文。
具体地,所述识别模块10还设置为对所述标签报文进行解析,匹配到目的mac+源mac+端口号88f7+事件消息类型,识别为二层组播1588事件报文;或者,
匹配到ipv4包+端口号320,识别为三层组播事件报文或者三层单播1588事件报文。
在识别出所述事件报文后,还可以判断所述事件报文的类型,因为所述事件报文的类型不同时间信息添加位置可能不同,则可以根据所述事件报文的类型在相应的位置添加时间信息或者打上时间戳。比如根据预配置的标签数量、标签长度、控制字数量、控制字长度等信息解析所述标签报文,根据解析获得的内容可以判断出所述标签报文中事件报文是二层组播1588事件报文,还是三层组播1588事件报文或者三层单播事件报文。如果能匹配到目的mac+源mac+88f7+事件消息类型,则识别为二层组播事件报文。如果能匹配到ipv4包+端口号320,则识别为三层组播事件报文或者三层单播事件报文。如果报文类型识别出不是标签报文,则直接匹配目的mac+源mac+88f7+事件消息类型和ipv4包+端口号320这两个条件。
时间戳添加模块20,设置为通过所述时间打戳器件对所述事件报文加上时间戳;
根据本节点产生或者接收到上一节点的标签报文,各个待同步节点识别出各自产生或接收到的所述标签报文中的事件报文,然后在识别出的事件报文中添加时间戳,即通过时间打戳器件添加的时间戳,具体地,添加时间戳的时间在各个待同步节点的入口和出口处。当然对于不同的事件报 文,可以根据识别出的所述事件报文类型在相应位置添加时间信息。
具体地,时间戳添加模块20还设置为:对于P设备,在所述P设备入口处打上第一时间戳,转发到出口处加上第二时间戳,通过所述第一时间戳和所述第二时间戳的偏差修正CF域,将修正后的1588事件报文发送出去;对于PE设备,在接收到1588事件报文之后,在入口加上第三时间戳。
如果用户选择的设备为P设备和PE设备,则P设备和PE设备接收到1588标签报文之后,时间打戳器件对报文进行解析,根据报文类型识别出是一个标签报文,然后,根据预配置的标签数量、标签长度、控制字数量、控制字长度等信息来解析所述标签报文,如果在解析获得的内容中能匹配到目的MAC+源MAC+88f7+事件消息类型,则识别为二层组播事件报文。如果能匹配到IPV4包+端口号320,则识别为三层组播事件报文或者三层单播事件报文。其中88f7是IEEE1588协议中一种协议类型;端口号320是IEEE1588协议规定的一个端口,这个端口会产生事件报文。
对于P设备,报文在P设备入口处打上进入ingress时间戳,转发到出口处打上出去egress时间戳,用两个时间戳的偏差修正CF域,再将报文发送给PE设备,然后PE设备在接收到1588事件报文之后,在入口加上第三时间戳。当然如果在标签网络中只采用PE设备,则PE设备在入口出给接收到的报文打上时间戳后,直接转发到PTP模块进行处理。
同步模块30,设置为根据所述时间戳在待同步节点间对时间进行同步。
根据在步骤S20在所述事件报文中添加时间戳后,将包括时间戳的标签报文发送给其他待同步节点进行处理,其他待同步节点可以是一个也可以是多个。其他待同步节点接收到包括有时间戳的标签报文后,通过配置的时间打戳器件识别出接收到的标签报文中的事件报文,从而获得接收的标签报文中的时间戳,进而根据获得接收的标签报文中的时间戳以及自身当前的时间,对自身的时间进行时间校正。在发送给下一个待同步节点时,在出口处添加时间戳后发生给下一个待同步节点,其他的节点进行类似的处理,从而使得标签网络中各个待同步节点的达到时间同步的效果。
具体地,对于存在P设备和PE设备的标签网络,根据所述时间戳在 待同步节点间对时间进行同步包括:根据所述第三时间戳和CF域计算偏差和时延,并通过对所述PE设备的时间校正对时间进行同步。
对于存在P设备和PE设备的标签网络,PE设备根据接收到P设备发送的标签报文,识别出接收到的标签报文中事件报文的CF域,然后根据CF域以及在接收到标签报文的时间,即在接收到标签报文时添加的第三时间戳,对PE设备的时间校正,从而对时间进行同步。当然在应用不同的协议或者时间算法时,其计算过程和结果可能不同。根据计算获得的第三时间、偏差和时延进行时间校正。
本发明通过在标签网络中配置时间打戳器件,使得时间打戳器件能够识别标签网络中各个待同步节点能够识别标签报文中的1588事件报文,从而在事件报文中添加时间戳,从而可以使得各个节点能够在各待同步节点之间传递的事件报文中时间戳进行时间同步。
以上仅为本发明的优选实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。
工业实用性
如上所述,本发明实施例提供的一种时间同步方法和装置具有以下有益效果:可以使得各个节点能够在各待同步节点之间传递的事件报文中时间戳进行时间同步。

Claims (12)

  1. 一种时间同步方法,所述方法包括:
    在配置有时间打戳器件的启用了1588的标签网络中,通过所述时间打戳器件从标签报文中识别出1588事件报文,其中,所述1588事件报文用于待同步节点间的时间同步;
    通过所述时间打戳器件对所述事件报文加上时间戳;
    根据所述时间戳在待同步节点间对时间进行同步。
  2. 如权利要求1所述的方法,其中,通过所述时间打戳器件从标签报文中识别出1588事件报文的步骤包括:
    通过所述时间打戳器件对报文进行解析,根据报文类型识别出标签报文;
    对所述标签报文进行解封装识别出1588事件报文。
  3. 如权利要求2所述的方法,其中,对所述标签报文进行解封装识别出1588事件报文的步骤包括:
    对所述标签报文进行解析,匹配到目的mac+源mac+端口号88f7+事件消息类型,识别为二层组播1588事件报文;或者,
    匹配到ipv4包+端口号320,识别为三层组播事件报文或者三层单播1588事件报文。
  4. 如权利要求1至3中任一项所述的方法,其中,通过所述时间打戳器件对所述事件报文加上时间戳的步骤包括:
    对于P设备,在所述P设备入口处打上第一时间戳,转发到出口处加上第二时间戳,通过所述第一时间戳和所述第二时间戳的偏差修正CF域,将修正后的1588事件报文发送出去;
    对于PE设备,在接收到1588事件报文之后,在入口加上第三时间戳。
  5. 如权利要求4所述的方法,其中,对于PE设备,根据所述时间戳 在待同步节点间对时间进行同步的步骤包括:
    根据所述第三时间戳和CF域计算偏差和时延,并通过对所述PE设备的时间校正对时间进行同步。
  6. 如权利要求1至3或5中任一项所述的方法,其中,所述时间打戳器件的配置包括:报文类型、报文标签数量、标签长度、控制字数量和控制字长度。
  7. 一种时间同步装置,所述装置包括:
    识别模块,设置为在配置有时间打戳器件的启用了1588的标签网络中,通过所述时间打戳器件从标签报文中识别出1588事件报文,其中,所述1588事件报文用于待同步节点间的时间同步;
    时间戳添加模块,设置为通过所述时间打戳器件对所述事件报文加上时间戳;
    同步模块,设置为根据所述时间戳在待同步节点间对时间进行同步。
  8. 如权利要求7所述的装置,其中,所述识别模块包括:
    解析单元,设置为通过所述时间打戳器件对报文进行解析,根据报文类型识别出标签报文;
    识别单元,设置为对所述标签报文进行解封装识别出1588事件报文。
  9. 如权利要求8所述的装置,其中,所述识别模块还设置为对所述标签报文进行解析,匹配到目的mac+源mac+端口号88f7+事件消息类型,识别为二层组播1588事件报文;或者,
    匹配到ipv4包+端口号320,识别为三层组播事件报文或者三层单播1588事件报文。
  10. 如权利要求7-9中任一项所述的装置,其中,所述时间戳添加模块还设置为:对于P设备,在所述P设备入口处打上第一时间戳,转发到出口处加上第二时间戳,通过所述第一时间戳和所述第二时间戳的偏差修 正CF域,将修正后的1588事件报文发送出去;
    对于PE设备,在接收到1588事件报文之后,在入口加上第三时间戳。
  11. 如权利要求10所述的装置,其中,所述同步模块还设置为:根据所述第三时间戳和CF域计算偏差和时延,并通过对所述PE设备的时间校正对时间进行同步。
  12. 如权利要求7至9或11中任一项所述的装置,其中,所述时间打戳器件的配置包括:报文类型、报文标签数量、标签长度、控制字数量和控制字长度。
PCT/CN2017/072834 2016-04-12 2017-02-03 时间同步方法和装置 WO2017177751A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610224689.5 2016-04-12
CN201610224689.5A CN107294633A (zh) 2016-04-12 2016-04-12 时间同步方法和装置

Publications (1)

Publication Number Publication Date
WO2017177751A1 true WO2017177751A1 (zh) 2017-10-19

Family

ID=60042303

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/072834 WO2017177751A1 (zh) 2016-04-12 2017-02-03 时间同步方法和装置

Country Status (2)

Country Link
CN (1) CN107294633A (zh)
WO (1) WO2017177751A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019241611A1 (en) * 2018-06-14 2019-12-19 Microchip Technology Incorporated Performing phy-level hardware timestamping and time synchronization in cost-optimized environments

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110351823A (zh) * 2018-04-03 2019-10-18 华为技术有限公司 通信的方法和装置
CN113395719A (zh) * 2020-03-11 2021-09-14 华为技术有限公司 一种时钟端口状态处理方法、装置及***
CN112235067B (zh) * 2020-09-24 2022-03-25 烽火通信科技股份有限公司 一种集中式1588的时间同步方法和时间同步***
CN113014351B (zh) * 2021-03-15 2022-07-22 四川英得赛克科技有限公司 一种无侵入式对时方法、***及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101447861A (zh) * 2008-12-29 2009-06-03 中兴通讯股份有限公司 Ieee 1588时间同步***及其实现方法
CN101453316A (zh) * 2007-11-30 2009-06-10 华为技术有限公司 时间信息同步***及方法以及相关装置
CN101754429A (zh) * 2008-12-03 2010-06-23 华为技术有限公司 识别精准时间协议报文的方法、装置及***
CN103138887A (zh) * 2011-12-05 2013-06-05 中兴通讯股份有限公司 一种1588事件报文的处理方法及***
CN103475461A (zh) * 2013-09-30 2013-12-25 武汉邮电科学研究院 一种1588时钟同步功能实现***及方法

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100466587C (zh) * 2006-08-30 2009-03-04 华为技术有限公司 L2vpn异种介质互连中三层协议识别方法、设备及***
CN103427927B (zh) * 2012-05-17 2017-04-12 中兴通讯股份有限公司 Mpls‑tp网络实现时钟同步的方法及装置
CN103117845A (zh) * 2012-11-13 2013-05-22 华为技术有限公司 一种透明时钟驻留时间的修正方法、装置及***
US9112631B2 (en) * 2013-09-11 2015-08-18 Khalifa University of Science, Technology, and Research Method and devices for frequency distribution
CN104506433B (zh) * 2014-12-30 2018-07-06 盛科网络(苏州)有限公司 一种mpls网络中识别ptp报文的方法和装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101453316A (zh) * 2007-11-30 2009-06-10 华为技术有限公司 时间信息同步***及方法以及相关装置
CN101754429A (zh) * 2008-12-03 2010-06-23 华为技术有限公司 识别精准时间协议报文的方法、装置及***
CN101447861A (zh) * 2008-12-29 2009-06-03 中兴通讯股份有限公司 Ieee 1588时间同步***及其实现方法
CN103138887A (zh) * 2011-12-05 2013-06-05 中兴通讯股份有限公司 一种1588事件报文的处理方法及***
CN103475461A (zh) * 2013-09-30 2013-12-25 武汉邮电科学研究院 一种1588时钟同步功能实现***及方法

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019241611A1 (en) * 2018-06-14 2019-12-19 Microchip Technology Incorporated Performing phy-level hardware timestamping and time synchronization in cost-optimized environments
US11050501B2 (en) 2018-06-14 2021-06-29 Microchip Technology Incorporated Performing PHY-level hardware timestamping and time synchronization in cost-sensitive environments

Also Published As

Publication number Publication date
CN107294633A (zh) 2017-10-24

Similar Documents

Publication Publication Date Title
WO2017177751A1 (zh) 时间同步方法和装置
CN107113236B (zh) 在网络中传输滞留时间信息
CN101455014B (zh) 传送所发送的或者所接收的消息的发送时间信息或者接收时间信息的方法和装置
US9106353B2 (en) Time synchronization for network testing equipment
EP2395696B1 (en) Clock message tunnel transmission method, network node and communication system thereof
US9553713B2 (en) Method and system for transmitting clock reference streams with timestamps directly to audio/video end nodes in an audio/video bridging network
JP5518191B2 (ja) 光伝送網が時刻同期プロトコルをキャリングする方法及びシステム
US10063335B2 (en) Method, apparatus and system for remotely configuring PTP service of optical network unit
US10778359B2 (en) Time synchronization method, programmable logic device, single board and network element
US20150117471A1 (en) Method and apparatus for securing clock synchronization in a network
WO2012071910A1 (zh) 一种实现时间同步的方法及装置
JP5426695B2 (ja) 少なくとも1つのタイミング配信プロトコルにより第1のデータおよび第2のデータを別々に伝送することによってクロックを同期するための方法、ならびに関連するシステムおよびモジュール
Diarra et al. Improved clock synchronization start-up time for Ethernet AVB-based in-vehicle networks
EP2458757B1 (en) A method for transmitting IEEE 1588V2 synchronization packets over ethernet in link-by-link mode, via network elements having a transparent clock, and associated help device
JP5041815B2 (ja) 通信装置および基地局システム
JP2011040870A (ja) 光伝送システム及び時刻基準パルスを用いた同期方法
JP6341869B2 (ja) 通信装置および通信システム
JP2007124029A (ja) 時刻同期情報または同期クロック生成供給方法および装置
JP6326468B2 (ja) 受動光ネットワークの時刻同期化方法
KR20150016735A (ko) 중앙 집중 제어 평면을 이용한 네트워크 시각 동기 시스템
WO2011140798A1 (zh) 一种处理ieee1588v2报文的方法及装置
Chowdhury Packet Timing: Precision Time Protocol
Han et al. A software-defined time synchronization solution in transport networks
Roberts et al. TICTOC Working Group S. Davari Internet-Draft A. Oren Intended status: Standards Track Broadcom Corp. Expires: November 25, 2011 M. Bhatia
Roberts et al. TICTOC Working Group S. Davari Internet-Draft A. Oren Intended status: Standards Track Broadcom Corp. Expires: April 9, 2012 M. Bhatia

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

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

Ref document number: 17781727

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 17781727

Country of ref document: EP

Kind code of ref document: A1