CN110290580B - Method and system for transmitting time based on 1588 protocol - Google Patents

Method and system for transmitting time based on 1588 protocol Download PDF

Info

Publication number
CN110290580B
CN110290580B CN201910485851.2A CN201910485851A CN110290580B CN 110290580 B CN110290580 B CN 110290580B CN 201910485851 A CN201910485851 A CN 201910485851A CN 110290580 B CN110290580 B CN 110290580B
Authority
CN
China
Prior art keywords
clock
time
timestamp
clock node
protocol
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201910485851.2A
Other languages
Chinese (zh)
Other versions
CN110290580A (en
Inventor
宋晓琴
邱文才
张辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Yingterui Semiconductor Technology Co ltd
Original Assignee
Shenzhen Yingterui Semiconductor Technology Co ltd
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 Shenzhen Yingterui Semiconductor Technology Co ltd filed Critical Shenzhen Yingterui Semiconductor Technology Co ltd
Priority to CN201910485851.2A priority Critical patent/CN110290580B/en
Publication of CN110290580A publication Critical patent/CN110290580A/en
Application granted granted Critical
Publication of CN110290580B publication Critical patent/CN110290580B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W56/00Synchronisation arrangements
    • H04W56/001Synchronization between nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W84/00Network topologies
    • H04W84/18Self-organising networks, e.g. ad-hoc networks or sensor networks

Abstract

The invention relates to the technical field of time synchronization, and discloses a method and a system for transmitting time based on a 1588 protocol. The method for transmitting time based on the 1588 protocol is applied to a Mesh network, the Mesh network is used for communicating with reference clock equipment, the reference clock equipment is used for providing reference time, the Mesh network comprises a plurality of interconnected clock nodes, and only one clock node communicates with the reference clock equipment, and the method comprises the following steps: acquiring a reference time deviation between a target clock node and the reference clock equipment, wherein the target clock node is communicated with the reference clock equipment; based on 1588 protocol, assembling the reference time deviation in PTP message header of Announce message; and broadcasting the assembled Announce message to the rest clock nodes. The embodiment of the invention realizes the time transmission among the clock nodes in the Mesh network based on the 1588 protocol.

Description

Method and system for transmitting time based on 1588 protocol
Technical Field
The invention relates to the technical field of time synchronization, in particular to a method and a system for transmitting time based on 1588 protocol.
Background
At present, based on a 1588 protocol, a GrandMaster node is adopted to communicate with a reference clock device (namely a GPS), and the rest clock nodes apply 1588 time transmission hop by hop.
However, the above method is applicable to a chain or ring network, and there is a master-slave relationship, and in the Mesh network, all clock nodes are in the same position, there is no master-slave relationship, and except for a target clock node communicating with a reference clock device, the remaining clock nodes cannot directly obtain their reference time deviation from the reference clock device by themselves, so the embodiment of the present invention provides a method for transmitting time based on 1588 protocol applied to the Mesh network.
Disclosure of Invention
The embodiment of the invention aims to provide a method and a system for transmitting time based on a 1588 protocol, which can realize the transmission of time between clock nodes in a Mesh network based on the 1588 protocol.
In order to solve the above technical problems, embodiments of the present invention provide the following technical solutions:
in a first aspect, an embodiment of the present invention provides a method for transmitting time based on a 1588 protocol, where the method is applied to a Mesh network, the Mesh network is used for communicating with a reference clock device, the reference clock device is used for providing reference time, the Mesh network includes a plurality of interconnected clock nodes, and only one clock node communicates with the reference clock device, and the method includes:
acquiring a reference time deviation between a target clock node and the reference clock equipment, wherein the target clock node is communicated with the reference clock equipment;
based on 1588 protocol, assembling the reference time deviation in PTP message header of Announce message;
and broadcasting the assembled Announce message to the rest clock nodes.
In some embodiments, the reference time offset is in a floating-point format, and the assembling the reference time offset in a PTP header of an Announce packet based on 1588 protocol includes:
converting the reference time deviation in the floating point type format into a timestamp in a structure body format, wherein the timestamp comprises numerical value information of the reference time deviation and numerical value positive and negative information of the reference time deviation;
and based on a 1588 protocol, assembling the timestamp in a PTP message header of the Announce message.
In some embodiments, the PTP message header includes a time correction field and a reserved field, and the assembling the timestamp in the PTP message header of an Announce message based on 1588 protocol includes:
redefining the time correction domain field and the reserved field in the PTP message header based on a 1588 protocol;
and assembling the timestamp in a PTP message header of the redefined Announce message.
In some embodiments, the assembling the timestamp in a PTP header of the redefined Announce packet includes:
redefining the time correction field and the reserved field into a timestamp description field, and assembling the timestamp in a PTP message header of the redefined Announce message, wherein the timestamp description field is used for describing the time attribute of the timestamp.
In some embodiments, the timestamp description field comprises a partial-second description field, a partial-nanosecond description field, and a timestamp description field corresponding to the timestamp;
the numerical information of the reference time deviation is respectively filled into the second part description field and the nanosecond part description field, the numerical positive and negative information is filled into the time mark description field, and the time mark description field is used for identifying the positive and negative of the reference time and whether the Announce message carries the reference time.
In some embodiments, each timestamp description field has 8 bits;
when the 0 th bit of the time mark description field is true, the reference time is positive;
when the 0 th bit of the timestamp description field is false, the reference time is negative;
when the 1 st bit of the time mark description field is true, carrying reference time;
when the 1 st bit of the time mark description field is false, the reference time is not carried.
In some embodiments, the reference time is GPS time.
In some embodiments, the method further comprises:
calculating the synchronous time deviation between any one of the residual clock nodes and the reference clock equipment according to the PTP message transmitted between any one of the residual clock nodes and the reference clock equipment;
and controlling the time synchronization of any clock node in the Mesh network and the reference clock equipment according to the reference time deviation and the synchronous time deviation.
In some embodiments, the controlling time synchronization between any clock node in the Mesh network and the reference clock device according to the reference time offset and the synchronization time offset includes:
adding the reference time deviation and the synchronous time deviation to obtain a time deviation sum;
and controlling any clock node in the Mesh network to compensate the time deviation sum so as to synchronize the time of any clock node in the Mesh network with the time of the reference clock equipment.
In a second aspect, an embodiment of the present invention provides a system for transferring time based on a 1588 protocol, including:
a reference clock device; and
the Mesh network is used for communicating with the reference clock equipment, so that any clock node in the Mesh network executes the method for transmitting time based on the 1588 protocol.
The embodiment of the invention has the beneficial effects that: different from the prior art, the embodiment of the invention provides a method and a system for transmitting time based on 1588 protocol. The reference time deviation is assembled in a PTP message header of the Announce message based on a 1588 protocol, and the assembled Announce message is broadcasted to the remaining clock nodes, so that the reference time deviation is transmitted to the remaining clock nodes in the Mesh network. Therefore, the embodiment of the invention realizes the time transfer between the clock nodes in the Mesh network based on the 1588 protocol.
Drawings
One or more embodiments are illustrated by way of example in the accompanying drawings, which correspond to the figures in which like reference numerals refer to similar elements and which are not to scale unless otherwise specified.
Fig. 1 is a schematic structural diagram of a system for transmitting time based on a 1588 protocol according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating a method for transferring time based on the 1588 protocol according to an embodiment of the present invention;
FIG. 3 is a schematic flow chart of step S12 in FIG. 2;
FIG. 4 is a schematic flowchart of step S122 in FIG. 3;
fig. 5 is a flowchart illustrating a method for transferring time based on the 1588 protocol according to another embodiment of the present invention;
FIG. 6 is a schematic flow chart of step S15 in FIG. 5;
fig. 7 is a schematic diagram of transmission of the clock node a and the clock node B in fig. 1 based on a PTP protocol;
fig. 8 is a schematic diagram of transmission of the clock node a and the clock node C in fig. 1 based on the PTP protocol.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In addition, the technical features involved in the embodiments of the present invention described below may be combined with each other as long as they do not conflict with each other.
Fig. 1 is a schematic structural diagram of a system for transmitting time based on 1588 protocol according to an embodiment of the present invention. As shown in fig. 1, the system 300 for transferring time based on the 1588 protocol includes a Mesh network 100 and a reference clock device 200.
The Mesh network 100 is configured to communicate with the reference clock device 200, the Mesh network 100 includes a plurality of interconnected clock nodes 10, only one of the clock nodes 10 communicates with the reference clock device 200, and the clock node 10 communicating with the reference clock device 200 is a target clock node.
It will be appreciated that the clock node 10 refers to a clock in sensors, actuators and other end devices in a standard ethernet or other distributed bus system using multicast technology. Wherein the terminal device refers to a device that inputs a program and data to a computer or receives a result of processing output by the computer via a communication facility.
Wherein each clock node 10 is connected to other clock nodes 10 in the Mesh network 100. For example, the present embodiment is illustrated with the Mesh network 100 having 3 clock nodes 10, where a clock node a is connected to a clock node B and a clock node C, the clock node B is connected to the clock node C and the clock node a, and the clock node C is connected to the clock node a and the clock node B. Further, the clock node a is also communicatively connected to the reference clock device 200, that is, the clock node a is a target clock node of the Mesh network 100 of the 3 clock nodes 10.
Preferably, the target clock node is in wireless communication connection with the reference clock device 200, and the clock nodes 10 are in wireless communication connection with each other. In some embodiments, the target clock node and the reference clock apparatus 200 may be in wired communication connection.
The reference clock device 200 is configured to provide a reference time, where the number of the reference clock devices 200 is one, that is, the reference clock device 200 is a unique synchronous clock in the 1588 protocol time transfer based system 300, and all clock nodes 10 in the Mesh network 100 keep synchronization with the synchronous clock.
In this embodiment, the reference clock device 200 is a GPS (Global Positioning System) or a GPS module, and the reference time is GPS time, which belongs to satellite Positioning System time.
In summary, the reference clock device 200 sends the reference time to the Mesh network 100, and the clock node a receives the reference time and obtains a reference time offset between the clock node a and the reference clock device 200. The clock node a, the clock node B and the clock node C transmit 1588 messages (namely PTP messages) among each other, and the PTP messages include an Announce message sync message, a Delay _ Req message, a Follow _ up message, a Delay _ Resp message and the like.
Taking the clock node a as an example, the clock node a receives and responds to the PTP messages of the clock node B and the clock node C, where the PTP messages include timestamp information, and then obtains a synchronization time deviation between the clock node a and the clock node B and a synchronization time deviation between the clock node a and the clock node C according to the timestamp information; adding the reference time deviation between the clock node A and the reference clock device 200, the synchronous time deviation between the clock node A and the clock node B, and the synchronous time deviation between the clock node A and the clock node C, and dividing the added values by the number of nodes 3 to obtain the phase difference value from the clock node A to the central position of a Mesh network of 3 nodes consisting of the clock node A, the clock node B and the clock node C; the clock node a is aligned to the center position according to the phase difference value, and similarly, the clock node B and the clock node C are aligned to the center position according to the phase difference value, thereby completing the time synchronization of the clock node a, the clock node B, and the clock node C with the reference clock device 200.
In order to solve the problem of time transmission between clock nodes in a Mesh network based on a 1588 protocol, the embodiment of the invention provides a system for transmitting time based on the 1588 protocol, wherein reference time deviation is assembled in a PTP (precision time protocol) header of an Announce message based on the 1588 protocol, and the assembled Announce message is broadcasted to the remaining clock nodes, so that the reference time deviation is transmitted to the remaining clock nodes in the Mesh network. Therefore, the embodiment of the invention realizes the time transfer between the clock nodes in the Mesh network based on the 1588 protocol.
Please refer to fig. 2, which is a flowchart illustrating a method for transmitting time based on 1588 protocol according to an embodiment of the present invention. The method is applied to a Mesh network, the Mesh network is used for communicating with reference clock equipment, the reference clock equipment is used for providing reference time, the Mesh network comprises a plurality of interconnected clock nodes, and only one clock node is communicated with the reference clock equipment. As shown in fig. 2, the method includes:
s11: and acquiring the reference time deviation between a target clock node and the reference clock equipment, wherein the target clock node is communicated with the reference clock equipment.
In this embodiment, the target clock node communicates with the reference clock device, and the PPS second pulse signal of the reference clock device is tracked and locked according to a clock module or an FPGA module built in the target clock node, so that the reference time deviation between the target clock node and the reference clock device is measured and obtained, and is stored in the target clock node, so that the Mesh network can obtain the reference time deviation.
The reference clock equipment is a GPS or a GPS module, the reference time is GPS time, and the target clock node transmits the GPS time among all clock nodes in the Mesh network based on a 1588 protocol according to the acquired GPS time.
Specifically, the reference time deviation is a time difference between the GPS and the target clock node, the GPS sends the GPS time to the target clock node, the target clock receives the GPS time, and the reference time deviation and the phase difference between the GPS and the target clock node are measured according to the GPS time.
S12: and based on a 1588 protocol, assembling the reference time deviation in a PTP message header of the Announce message.
The 1588 protocol is also called as a precision clock synchronization protocol standard of a network measurement and control system, and is used for keeping the most precise clock in the distributed network synchronized with other clocks. The 1588 protocol defines a precision Time protocol PTP (precision Time protocol) for performing sub-microsecond synchronization on clocks in sensors, actuators, and other terminal devices in a standard ethernet or other distributed bus systems using a multicast technology.
Specifically, a 1588 protocol specifies PTP messages, which include an event message and a general message, wherein the event message is a message that requires a precise timestamp in both the sending and receiving processes and triggers sending of subsequent messages, and the event message mainly includes a sync message, a Delay _ Req message, a Pdelay _ Req message, and a Pdelay _ Resp message; the general message does not excite subsequent messages, and mainly comprises an Announce message, a Follow _ up message, a Delay _ Resp message, a Pdelay _ Resp _ Follow _ up message, a Management message and a Signaling message.
The PTP message can adopt modes of a PTP over User Datagram Protocol (UDP) over IPv4, a PTP over UDP over IPv6, a PTP over IEEE 802.3/Ethernet, a PTP over Device NET, a PTP over Control NET, a PTP over IEC 61158Type 10 (field bus) and the like, and the telecommunication network is generally applied to the mode in the former 3. Taking PTP over UDP over IPv4 as an example, the protocol describes how to use UDP and ethernet protocol version 4(IPv4) to complete the transmission of PTP messages. Under the transmission protocol, a PTP message is firstly packaged into a UDP data packet, and in order to identify the PTP message as PTP message data, a first byte of the PTP message is added into an IP packet header of an IPv4 protocol immediately after a last byte of a UDP message header, and then packaged into an Ethernet frame for transmission.
The Announce packet is a packet used to describe a time source capability, and may be used to broadcast to remaining clock nodes in the Mesh network, so that the GPS time is transmitted in the Mesh network. Please refer to table 1, where table 1 is an Announce message format defined in IEEE 1588-2008 protocol.
Octets Offset
header 34 0
originTimestamp 10 34
currentUtcOffset 2 44
reserved 1 46
grandmasterPriority1 1 47
grandmasterClockQuality 4 48
grandmasterPriority2 1 52
grandmasterldentity 8 53
stepsRemoved 2 61
timeSource 1 63
TABLE 1
In this embodiment, the reference time offset is assembled in a PTP header of an Announce packet. Please refer to table 2, where table 2 shows a PTP header format defined in IEEE 1588-.
Figure BDA0002085357750000081
TABLE 2
The Announce message belongs to one of the PTP messages, the PTP message is composed of a message header, a message body, a message extension field (optional), and the like, the PTP message header includes 34 bytes (272 bits), and the format of the PTP message header is suitable for all the PTP messages.
Referring to fig. 3, the assembling the reference time offset into a PTP header of an Announce packet based on a 1588 protocol includes:
s121: and converting the reference time deviation in the floating point type format into a timestamp in a structure body format, wherein the timestamp comprises numerical value information of the reference time deviation and numerical value positive and negative information of the reference time deviation.
In this embodiment, the reference time offset is stored in the target clock node in a floating point format, denoted as gOffset.
The floating point format is converted into a structure format, namely gOffset in the floating point format is converted into gOffset in the struct Timestamp format. The standard time offset in the floating point format is converted into a structure format as defined in the 1588 protocol as follows:
struct Timestamp
{
UInteger48secondsField;
UInteger32nanosecondsField;
};
Timestamp gOffset;
Boolean negative.
the Timestamp defining the structure format (i.e., the gmaffset in the struct Timestamp format) includes Timestamp gmamp gmaffset and Boolean negative, the Timestamp gmamp gmaffset is defined to represent numerical information of the reference time offset, and the Boolean negative is defined to represent numerical positive and negative information of the reference time offset. And when the Boolean negative is equal to TRUE, the reference time deviation is shown as a negative number, and when the Boolean negative is equal to FALSE, the reference time deviation is shown as a positive number.
S122: and based on a 1588 protocol, assembling the timestamp in a PTP message header of the Announce message.
In order to facilitate transmission of the value information Timestamp gOffset of the reference time Offset and the value positive/negative information negative of the reference time Offset, it is necessary to redefine the corrrectionfield whose Offset is 8 and the reserved field whose Offset is 16 in the PTP header.
In this embodiment, the assembling the timestamp in a PTP header of an Announce packet includes: redefining the time correction field and the reserved field into a timestamp description field, and assembling the timestamp in a PTP message header of the redefined Announce message, wherein the timestamp description field is used for describing the time attribute of the timestamp.
Referring to fig. 4, the assembling the timestamp in a PTP header of an Announce packet based on a 1588 protocol includes:
s1221: redefining the time correction domain field and the reserved field in the PTP message header based on a 1588 protocol.
As shown in table 2, the PTP header includes a time correction field and a reserved field.
Specifically, the correctionField and the next field (i.e., the reserved field) of the correctionField in table 2 are redefined as the timestamp description field.
Type Octets Offset
secondsField UInteger48 6 8
nanosecondsField UInteger32 4 14
flag UInteger8 1 18
reserved 1 19
TABLE 3
Referring to table 3, table 3 is a definition of a redefined timestamp description field.
Wherein the timestamp description field comprises a second part description field, a nanosecond part description field, and a timestamp description field corresponding to the timestamp. And the numerical information of the reference time deviation is respectively filled into the second part description field and the nanosecond part description field, the numerical positive and negative information is filled into the time mark description field, and the time mark description field is used for identifying the positive and negative of the reference time and whether the Announce message carries the reference time.
As shown in table 3, the secoconsdfield field is used to describe the second part of the Timestamp gOffset, and the nanosecond field is used to describe the nanosecond part of the Timestamp gOffset.
Figure BDA0002085357750000111
TABLE 4
Referring to table 4, table 4 is a definition of the flag field in table 3.
Wherein, the bit number of each time mark description field is 8 bits; when the 0 th bit of the time mark description field is true, the reference time is positive; when the 0 th bit of the timestamp description field is false, the reference time is negative; when the 1 st bit of the time mark description field is true, carrying reference time; when the 1 st bit of the time mark description field is false, the reference time is not carried.
Specifically, the 0 th bit of the timestamp description field is marked as negative, that is, the 0 th bit of the flag field is filled with the numerical value positive and negative information, when the negative is equal to TRUE, the GPS time is positive, and when the negative is equal to FALSE, the GPS time is negative. The 1 st bit of the timestamp description field is marked as gpsTimeFlag, when the gpsTimeFlag is equal to TRUE, the Announce message is shown to carry GPS time, and when the gpsTimeFlag is equal to FALSE, the Announce message is shown not to carry GPS time.
That is, the positive and negative information of the value of the Timestamp gOffset and whether the Announce message carries the GPS time can be obtained through the content of the corresponding bit of the flag field.
S1222: and assembling the timestamp in a PTP message header of the redefined Announce message.
S13: and broadcasting the assembled Announce message to the rest clock nodes.
And assembling the reference time deviation in a PTP message header of an Announce message, and broadcasting the assembled Announce message to the remaining clock nodes, so that the GPS time is transmitted in the Mesh network, and any clock node in the remaining clock nodes can obtain the reference time deviation.
According to the method for transmitting time based on the 1588 protocol, the reference time deviation is assembled in the PTP message header of the Announce message, and the assembled Announce message is broadcast to the remaining clock nodes, so that the reference time deviation is transmitted to the remaining clock nodes in the Mesh network. Therefore, the embodiment of the invention realizes the time transfer between the clock nodes in the Mesh network based on the 1588 protocol.
Referring to fig. 5, a flowchart of a method for transmitting time based on 1588 protocol according to another embodiment of the present invention is shown. As shown in fig. 5, the method further comprises:
s14: and calculating the synchronous time deviation between any clock node in the residual clock nodes and the reference clock equipment according to the PTP message transmitted between any clock node in the residual clock nodes and the reference clock equipment.
In this embodiment, the synchronization time deviation between any one of the remaining clock nodes and the reference clock device is obtained by a PTP protocol.
For example, as shown in fig. 7, a clock node a is a reference clock device, and PTP messages are transmitted between the clock node a and the clock node B, including receiving and responding to the PTP messages.
The clock node A periodically sends out a sync message, records the accurate sending time t11 when the sync message leaves the clock node A, and meanwhile, the clock node A packages the accurate sending time t11 into a Follow _ up message and sends the Follow _ up message to the clock node B; the clock node B records the accurate arrival time t12 when the sync message arrives at the clock node B; the clock node B sends a Delay _ Req message to the clock node A and records the accurate sending time t13 of the Delay _ Req message; the clock node A records the accurate arrival time t14 reached by the Delay _ Req message; clock node a sends a Delay _ Resp message carrying the accurate arrival time t14 to clock node B.
Therefore, the synchronization time deviation between the clock node B and the clock node A is equal to (t12-t11+ t13-t14)/2, and the transmission delay between the clock node B and the clock node A is equal to (t12-t11-t13+ t 14)/2.
For example, as shown in fig. 8, the clock node a is a reference clock device, and the clock node a and the clock node C transmit PTP messages, including receiving and responding to the PTP messages.
The clock node A periodically sends out a sync message, records the accurate sending time t21 when the sync message leaves the clock node A, and simultaneously packages the accurate sending time t21 into a Follow _ up message and sends the Follow _ up message to the clock node C; the clock node C records the accurate arrival time t22 when the sync message arrives at the clock node C; the clock node C sends a Delay _ Req message to the clock node A, and records the accurate sending time t23 of the Delay _ Req message; the clock node A records the accurate arrival time t24 reached by the Delay _ Req message; and the clock node A sends a Delay _ Resp message carrying the accurate arrival time t24 to the clock node C.
Therefore, the synchronization time deviation between the clock node C and the clock node A is equal to (t22-t21+ t23-t24)/2, and the transmission delay between the clock node C and the clock node A is equal to (t22-t 21-t 23+ t 24)/2.
S15: and controlling the time synchronization of any clock node in the Mesh network and the reference clock equipment according to the reference time deviation and the synchronous time deviation.
The time synchronization is also called phase synchronization, which means that the frequency and the phase of the GPS time signal between any clock node in the Mesh network and the reference clock device are kept consistent.
Referring to fig. 6, controlling the time synchronization between any clock node in the Mesh network and the reference clock device according to the reference time offset and the synchronization time offset includes:
s151: and adding the reference time deviation and the synchronous time deviation to obtain a time deviation sum.
S152: and controlling any clock node in the Mesh network to compensate the time deviation sum so as to synchronize the time of any clock node in the Mesh network with the time of the reference clock equipment.
It can be understood that, taking clock node B as an example, adding the reference time offset and the clock node B between clock node B and clock node a can obtain the time offset between clock node B and the GPS, and by compensating the corresponding time offset, clock node B can be synchronized to the GPS.
According to the method for transmitting time based on the 1588 protocol, provided by the embodiment of the invention, the synchronous time deviation between any clock node in the residual clock nodes and the reference clock equipment is calculated according to the PTP message transmitted between any clock node in the residual clock nodes and the reference clock equipment, and then the time synchronization between any clock node in the Mesh network and the reference clock equipment is controlled according to the reference time deviation and the synchronous time deviation, so that the time synchronization between any clock node in the Mesh network and the reference clock equipment is realized.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; within the idea of the invention, also technical features in the above embodiments or in different embodiments may be combined, steps may be implemented in any order, and there are many other variations of the different aspects of the invention as described above, which are not provided in detail for the sake of brevity; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (8)

1. A method for transmitting time based on 1588 protocol, applied to a Mesh network, where the Mesh network is used for communicating with a reference clock device, the reference clock device is used for providing reference time, the Mesh network includes a plurality of interconnected clock nodes, and only one clock node communicates with the reference clock device, and the method includes:
acquiring a reference time deviation between a target clock node and the reference clock equipment, wherein the target clock node is communicated with the reference clock equipment;
based on 1588 protocol, assembling the reference time deviation in PTP message header of Announce message;
broadcasting the assembled Announce message to the rest clock nodes;
calculating the synchronous time deviation between any clock node in the residual clock nodes and the reference clock equipment according to the PTP message transmitted between any clock node in the residual clock nodes and the target clock node;
adding a reference time deviation between a clock node connected to the reference clock equipment and a synchronization time deviation between the clock node connected to the reference clock equipment and any clock node in the rest clock nodes, and dividing the sum by the total number of the clock nodes to obtain a phase difference value from the target clock node to a central position of the Mesh network, wherein the central position consists of the target clock node and each clock node in the rest clock nodes;
and aligning each clock node in the target clock node and the residual clock nodes to the central position according to the phase difference value.
2. The method according to claim 1, wherein the reference time offset is in a floating-point format, and the assembling the reference time offset into a PTP header of an Announce packet based on 1588 protocol includes:
converting the reference time deviation in the floating point type format into a timestamp in a structure body format, wherein the timestamp comprises numerical value information of the reference time deviation and numerical value positive and negative information of the reference time deviation;
and based on a 1588 protocol, assembling the timestamp in a PTP message header of the Announce message.
3. The method according to claim 2, wherein the PTP packet header includes a time correction field and a reserved field, and the assembling the timestamp in the PTP packet header of an Announce packet based on 1588 protocol includes:
redefining the time correction domain field and the reserved field in the PTP message header based on a 1588 protocol;
and assembling the timestamp in a PTP message header of the redefined Announce message.
4. The method according to claim 3, wherein said assembling the timestamp in a PTP header of the redefined Announce message comprises:
redefining the time correction field and the reserved field into a timestamp description field, and assembling the timestamp in a PTP message header of the redefined Announce message, wherein the timestamp description field is used for describing the time attribute of the timestamp.
5. The method of claim 4, wherein the timestamp description field comprises a partial-second description field, a partial-nanosecond description field, and a timestamp description field corresponding to the timestamp;
the numerical information of the reference time deviation is respectively filled into the second part description field and the nanosecond part description field, the numerical positive and negative information is filled into the time mark description field, and the time mark description field is used for identifying the positive and negative of the reference time and whether the Announce message carries the reference time.
6. The method of claim 5, wherein each timestamp description field has 8 bits;
when the 0 th bit of the time mark description field is true, the reference time is positive;
when the 0 th bit of the timestamp description field is false, the reference time is negative;
when the 1 st bit of the time mark description field is true, carrying reference time;
when the 1 st bit of the time mark description field is false, the reference time is not carried.
7. The method of claim 1, wherein the reference time is GPS time.
8. A system for transferring time based on 1588 protocol, comprising:
a reference clock device; and
a Mesh network for communicating with the reference clock device to cause any clock node in the Mesh network to perform the method of any of claims 1 to 7.
CN201910485851.2A 2019-06-05 2019-06-05 Method and system for transmitting time based on 1588 protocol Active CN110290580B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910485851.2A CN110290580B (en) 2019-06-05 2019-06-05 Method and system for transmitting time based on 1588 protocol

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910485851.2A CN110290580B (en) 2019-06-05 2019-06-05 Method and system for transmitting time based on 1588 protocol

Publications (2)

Publication Number Publication Date
CN110290580A CN110290580A (en) 2019-09-27
CN110290580B true CN110290580B (en) 2021-08-20

Family

ID=68003367

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910485851.2A Active CN110290580B (en) 2019-06-05 2019-06-05 Method and system for transmitting time based on 1588 protocol

Country Status (1)

Country Link
CN (1) CN110290580B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103974408A (en) * 2014-04-01 2014-08-06 宽兆科技(深圳)有限公司 Mesh net based OFDMA (orthogonal frequency division multiple access) system and control method
CN107105498A (en) * 2016-02-22 2017-08-29 华为技术有限公司 Localization method and device
CN107528654A (en) * 2016-06-21 2017-12-29 中兴通讯股份有限公司 It is a kind of based on 1588 method for synchronizing time and device
CN109218007A (en) * 2017-07-03 2019-01-15 中兴通讯股份有限公司 Routing resource, equipment and storage medium
CN109257132A (en) * 2018-09-04 2019-01-22 武汉乐庭软件技术有限公司 A kind of multi-sensor data cognitive method and system based on time synchronization
CN109699071A (en) * 2019-03-18 2019-04-30 辰芯科技有限公司 Method for synchronizing time, system and the readable storage medium storing program for executing of self-organized network communication system

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101616163B (en) * 2009-07-27 2012-11-28 中兴通讯股份有限公司 Method and device for processing precise time transfer protocol message
WO2011025746A1 (en) * 2009-08-25 2011-03-03 Semtech Corporation Measurement and adjustment of real-time values according to residence time in networking equipment without access to real time
US9935726B2 (en) * 2013-01-14 2018-04-03 Cognionics, Inc. Synchronizing wireless data acquisition of physiological information
CN106130681B (en) * 2016-07-25 2019-03-08 广州市国飞信息科技有限公司 For the high-accuracy clock synchronization method of time dissemination system, module, equipment and system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103974408A (en) * 2014-04-01 2014-08-06 宽兆科技(深圳)有限公司 Mesh net based OFDMA (orthogonal frequency division multiple access) system and control method
CN107105498A (en) * 2016-02-22 2017-08-29 华为技术有限公司 Localization method and device
CN107528654A (en) * 2016-06-21 2017-12-29 中兴通讯股份有限公司 It is a kind of based on 1588 method for synchronizing time and device
CN109218007A (en) * 2017-07-03 2019-01-15 中兴通讯股份有限公司 Routing resource, equipment and storage medium
CN109257132A (en) * 2018-09-04 2019-01-22 武汉乐庭软件技术有限公司 A kind of multi-sensor data cognitive method and system based on time synchronization
CN109699071A (en) * 2019-03-18 2019-04-30 辰芯科技有限公司 Method for synchronizing time, system and the readable storage medium storing program for executing of self-organized network communication system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"基于IEEE1588的工业以太网实时同步技术的研究与开发";陈大峰;《中国优秀硕士学位论文全文数据库》;20131215;第15-34页 *

Also Published As

Publication number Publication date
CN110290580A (en) 2019-09-27

Similar Documents

Publication Publication Date Title
US9929855B2 (en) Synchronizing clocks in a communications network
CN110113127B (en) Method and system for transmitting time based on 1588 protocol
US10158444B1 (en) Event-driven precision time transfer
US8681772B2 (en) Timing synchronization for networks with radio links
CN101594673B (en) Method and system for processing 1588 time stamp in distribution mode
US9154292B2 (en) Communication apparatus, communication system, and time synchronization method
US8953645B2 (en) Communication system, communication apparatus and time synchronization method
US7778283B2 (en) Timing bridge device
US20090086764A1 (en) System and method for time synchronization on network
CN101582733A (en) Method and system for realizing high precision time synchronization among SDH equipment
US9838196B2 (en) Synchronization apparatus, synchronization system, radio communication apparatus and synchronization method
JP6527289B2 (en) Time synchronization method, sensor accommodating terminal, and sensor network system
US20220007321A1 (en) Network Entities and Methods for a Wireless Network System for Determining Time Information
CN101399655A (en) Determining method and apparatus for synchronization port of transparent clock device
CN110875818A (en) Clock synchronization method, device, system, storage medium and electronic device
CN103138887A (en) Processing method of 1588 event messages and processing method of 1588 event messages
CN103999387A (en) Sync interval determination
CN101170353A (en) Method and system for adjusting network time
CN110290580B (en) Method and system for transmitting time based on 1588 protocol
CN102571253B (en) Method and equipment for implementing precise time synchronization
CN110224777B (en) Method and system for transmitting time based on 1588 protocol
US20170117980A1 (en) Time synchronization for network device
US20240048261A1 (en) Robust time distribution and synchronization in computer and radio access networks
JP2001036538A (en) Time synchronization method and its system
CN107959968B (en) High-precision low-overhead wireless sensor network clock synchronization method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant