CN111884751A - Smart grid time synchronization method and device based on PTP - Google Patents

Smart grid time synchronization method and device based on PTP Download PDF

Info

Publication number
CN111884751A
CN111884751A CN202010755739.9A CN202010755739A CN111884751A CN 111884751 A CN111884751 A CN 111884751A CN 202010755739 A CN202010755739 A CN 202010755739A CN 111884751 A CN111884751 A CN 111884751A
Authority
CN
China
Prior art keywords
node
time
synchronization
level
synchronization information
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.)
Pending
Application number
CN202010755739.9A
Other languages
Chinese (zh)
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.)
Big Data Center Of State Grid Corp Of China
Original Assignee
Big Data Center Of State Grid Corp Of China
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 Big Data Center Of State Grid Corp Of China filed Critical Big Data Center Of State Grid Corp Of China
Priority to CN202010755739.9A priority Critical patent/CN111884751A/en
Publication of CN111884751A publication Critical patent/CN111884751A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • H04J3/0658Clock or time synchronisation among packet nodes
    • H04J3/0661Clock or time synchronisation among packet nodes using timestamps
    • H04J3/0667Bidirectional timestamps, e.g. NTP or PTP for compensation of clock drift and for compensation of propagation delays

Abstract

The embodiment of the invention discloses a smart grid time synchronization method and device based on PTP. The method comprises the following steps: receiving first synchronization information sent by a previous-level node; sending second synchronization information to the upper-level node; receiving first synchronization response information returned by the previous-level node after receiving the second synchronization information, wherein the first synchronization response information carries the merging time of the previous-level node; and performing time synchronization according to a first time, a second time and the merging time of the upper-level node, wherein the first time is the time when the node receives the first synchronization information, and the second time is the time when the node sends the second synchronization information. By adopting the technical scheme, the embodiment of the invention can reduce the occupation of the operation resources and the transmission resources of the intelligent power grid system in the time synchronization process.

Description

Smart grid time synchronization method and device based on PTP
Technical Field
The invention relates to the technical field of smart grid time synchronization, in particular to a smart grid time synchronization method and device based on PTP.
Background
The time synchronization is the basis of normal operation of the intelligent power grid system, and the same time reference is established for operation, maintenance and charging of the intelligent power grid system. Various terminal devices in the current smart grid system rely on a local clock to keep time. Due to the manufacturing cost, the time keeping accuracy of a clock in the smart grid system is poor, and therefore, high-accuracy network time synchronization needs to be performed on the terminal equipment in the smart grid system.
At present, the most common network Time synchronization mode in the smart grid system is Time synchronization based on a Precision Time Protocol (PTP). As shown in fig. 1 (only level 0, level 1 and level 2 nodes in the smart grid system are shown in the figure), PTP iterates between a root node (i.e., level 0 node in fig. 1) and various levels of slave nodes (e.g., level 1 and level 2 nodes in fig. 1 or other slave nodes) of the smart grid system. For example, in the first iteration, the level 0 node is used as the master clock node of the current time synchronization, the level 1 node is used as the slave clock node of the current time synchronization, the master clock node sends a SYNC message carrying a synchronization message (i.e., SYNC message) sending time estimated value to the slave clock node, and after the SYNC message is sent, the SYNC message carrying a SYNC message sending time accurate value t is sent to the slave clock node1Follow message (i.e., foldup message); correspondingly, the slave clock node records the receiving time t of the SYNC message2And the transmission time t of the FOLLOWUP message carried in the FOLLOWUP message1Sending a delay request message (i.e. DREQ message) to the master clock node, and recording the sending time t of the DREQ message3(ii) a After receiving the DREQ message sent by the slave clock node, the master clock node generates a receiving time t carrying the DREQ message4Delayed request response message (i.e. DRPLY message)Text), therefore, the slave clock node can receive the DRPLY message sent by the master clock node according to the formula
Figure BDA0002610661980000021
And calculating the time offset between the master clock node and the master clock node, and performing time synchronization according to the time offset. And after the time synchronization of the level 1 node is completed, the level 1 node is taken as a master clock node, the level 2 node is taken as a slave clock node, and the time synchronization process is repeated to perform the time synchronization. By analogy, the time synchronization of each slave node in the intelligent power grid system can be completed.
However, in the PTP time synchronization method in the prior art, the slave clock node needs to perform a plurality of information interactions when performing time synchronization with the master clock node, so that the time synchronization process of the smart grid system needs to occupy more operation resources and transmission resources.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for synchronizing time of a smart grid based on PTP, so as to reduce the number of times of information interaction required in a time synchronization process, and reduce occupation of operating resources and transmission resources of a smart grid system by the time synchronization process.
In a first aspect, an embodiment of the present invention provides a smart grid time synchronization method based on PTP, including:
receiving first synchronization information sent by a previous-level node;
sending second synchronization information to the upper-level node;
receiving first synchronization response information returned by the previous-level node after receiving the second synchronization information, wherein the first synchronization response information carries the merging time of the previous-level node;
and performing time synchronization according to a first time, a second time and the merging time of the upper-level node, wherein the first time is the time when the node receives the first synchronization information, and the second time is the time when the node sends the second synchronization information.
In a second aspect, an embodiment of the present invention further provides a smart grid time synchronization apparatus based on PTP, including:
the first receiving module is used for receiving first synchronization information sent by a previous-level node;
the first sending module is used for sending second synchronization information to the upper-level node;
a second receiving module, configured to receive first synchronization response information returned by the previous-stage node after receiving the second synchronization information, where the first synchronization response information carries merging time of the previous-stage node;
and the time synchronization module is used for carrying out time synchronization according to a first time, a second time and the merging time of the upper-level node, wherein the first time is the time when the node receives the first synchronization information, and the second time is the time when the node sends the second synchronization information.
In the method and the device for synchronizing the time of the smart grid based on the PTP, after receiving first synchronization information sent by a previous-stage node, second synchronization information is sent to the previous-stage node, first synchronization response information to the second synchronization information sent by the previous-stage node is received, and then time synchronization is carried out according to the first time when the first synchronization information is received by the device, the second time when the local terminal sends the second synchronization information to the previous-stage node, and the merging time of the previous-stage node carried in the first synchronization response information. By adopting the above technical scheme, the time synchronization of the node can be realized only by transmitting three data packets, namely the first synchronization information, the second synchronization information and the first synchronization response information, between the node and the previous-stage node, and the transmitted first synchronization information does not need to carry the sending time of the first synchronization information, so that the number of times of data interaction with the previous-stage node in the time synchronization process can be reduced, the size of the transmitted data packet is reduced, the occupation of the operation resources and the transmission resources of the smart grid system in the time synchronization process is reduced, and the time consumed in the time synchronization process of each node is shortened.
Drawings
Other features, objects and advantages of the invention will become more apparent upon reading of the detailed description of non-limiting embodiments made with reference to the following drawings:
FIG. 1 is a diagram illustrating a PTP-based time synchronization process in the prior art;
fig. 2 is a schematic flowchart of a PTP-based smart grid time synchronization method according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a PTP-based time synchronization process according to an embodiment of the present invention;
fig. 4 is a schematic flowchart of a PTP-based smart grid time synchronization method according to a second embodiment of the present invention;
fig. 5 is a block diagram of a structure of a smart grid time synchronization device based on PTP according to a third embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some but not all of the relevant aspects of the present invention are shown in the drawings. In addition, the embodiments and features of the embodiments of the present invention may be combined with each other without conflict
Example one
The embodiment of the invention provides a smart grid time synchronization method based on PTP. The method may be performed by a PTP-based smart grid time synchronization apparatus, wherein the apparatus may be implemented by software and/or hardware, may be integrated in a node (i.e. a terminal device) of a smart grid system, and may typically be integrated in a slave node of the smart grid system. The network of the smart grid system can be a multi-hop wireless network comprising a root node and a plurality of slave nodes, and each slave node can be in communication connection with the root node in a direct connection or indirect connection mode.
In the embodiment of the present invention, taking the root node as the 0 th-level node as an example, assuming that the transmission distances of the nodes in the smart grid are the same, the 1 st-level node is a node located within the transmission distance of the root node in the smart grid system and directly connected to the root node; the 2 nd level node is the other nodes except the root node and located in the transmission distance of the 1 st level node in the intelligent power grid system; and in sequence, the nth node in the smart grid system is the node except the nth-2 node in the smart grid system, which is located within the transmission distance of the nth-1 node. The other nodes except the 0 th level node in the smart grid system are all slave nodes, the 1 st level node in the slave nodes of the smart grid system is directly connected with the root node, and the other slave nodes except the 1 st level node in the slave nodes of the smart grid system are indirectly connected with the root node.
It can be understood that the level number of each node in the smart grid system is only an exemplary description for convenience of description in the embodiment of the present invention, and in a specific application, the level number of each node in the smart grid system may be set according to needs, for example, the root node may be labeled as a level 1 node, a level 2 node, and the like of the smart grid system, as long as the root node is a node with the smallest level in the smart grid system, which is not limited in this embodiment.
Fig. 2 is a schematic flowchart of a PTP-based smart grid time synchronization method according to an embodiment of the present invention. As shown in fig. 2, the method includes:
and S110, receiving first synchronization information sent by the upper-level node.
The first synchronization information may be understood as synchronization information sent by a previous-level node in the smart grid system to the node, and the first synchronization information may be used to instruct the node to start executing a process of performing time synchronization with a root node (i.e., a 0 th-level node in the smart grid system), that is, when the node receives the first synchronization information sent by the previous-level node, it is determined that the node needs to perform time synchronization, and perform time synchronization. The node may be any slave node in the smart grid system, the previous node may be a root node or a slave node in the smart grid system, the first synchronization information may be a synchronization message or a delay request message, and specifically, when the previous node is the root node in the smart grid system, the first synchronization information may be a synchronization message; when the previous node is a slave node in the smart grid system, the first synchronization information may be a delay request message, and the first synchronization information does not need to carry the sending time of the first synchronization information.
Specifically, when the current condition of the previous-stage node of the node meets a preset condition for sending first synchronization information to the node, the previous-stage node sends the first synchronization information to the node, and when the current condition of the previous-stage node of the node is a root node of the smart grid system, the previous-stage node can send the first synchronization information to the next-stage node of the node when the current condition meets a preset time synchronization condition of the smart grid system; when the previous node of the node is a slave node of the smart grid system, the previous node may send the first synchronization information to a next node (e.g., the node) while sending the synchronization information to the previous node of the previous node. Correspondingly, the local node receives the first synchronization information sent by the previous node, and records the first time when the first synchronization information is received, namely the receiving time of the first synchronization information in the local node. Here, the preset time synchronization condition may be flexibly set, for example, the preset time synchronization condition may be a time synchronization instruction generated by receiving a trigger of a manager of the smart grid system or a set time when the current time reaches the smart grid system for time synchronization, and the like, which is not limited in this embodiment.
And S120, sending second synchronization information to the upper-level node.
The second synchronization information may be understood as synchronization information that is sent to other nodes (including a previous-stage node) in the smart grid after the node receives the first synchronization information sent by the previous-stage node, where the synchronization information may be a delay request message, and the delay request message does not need to carry sending time of the second synchronization information.
Specifically, after receiving first synchronization information sent by a previous-level node, the node queries and obtains an IP address of the previous-level node according to the identity ID of the previous-level node carried in the first synchronization information, and sends the first synchronization information to the previous-level node based on the IP address; or broadcasting the second synchronization information according to a preset broadcasting mode so that the upper-level node receives the second synchronization information. S130, receiving first synchronization response information returned by the previous-stage node after the second synchronization information is received, wherein the first synchronization response information carries the merging time of the previous-stage node.
The first synchronization response information can be understood as response information which is sent to the node by a previous-level node of the node in the smart grid system and aims at second synchronization information sent to the previous-level node by the node. The merging time of a certain node in the smart grid system may be understood as a time value obtained by calculating the time when the node receives and/or sends the corresponding synchronization information and the merging time of the node at the previous stage, and may be calculated by the following formula (1):
Figure BDA0002610661980000071
wherein, tnMerging time, t, of nth node in smart grid systemn-1For the merging time of the n-1 level node in the smart grid system,
Figure BDA0002610661980000072
for the time when the nth level node receives the first synchronization information transmitted by the nth-1 level node,
Figure BDA0002610661980000073
for the time when the nth level node receives the third synchronization information transmitted by the (n + 1) th level node,
Figure BDA0002610661980000074
time for the nth level node to send the second synchronization information to the (n + 1) th level node; n is an integer greater than or equal to 0, and when n is 0, the 0 th-level node is a root node; when n ≧ 1, the nth-stage node is a slave node.
In this embodiment, please refer to fig. 3 (only level 0 and level 1 nodes of the smart grid system are shown in the figure)Information interaction between the point and the level 2 node, and taking the synchronization information sent by the root node as a SYNC message, the synchronization information sent by the slave node as a DREQ message, and the synchronization response information sent by each node as a DRPLY message as an example), assuming that the level of the root node is 0, that is, the root node is the level 0 node, and assuming that the time when the nth level node receives the synchronization information sent by the mth level node is
Figure BDA0002610661980000081
The nth node sends the synchronization information to the mth node at the time of
Figure BDA0002610661980000082
The merging time of the nth node is tnThen, the level 1 node is time offset from the root node(1,0)Can be as follows:
Figure BDA0002610661980000083
due to the time when the level 0 node receives the synchronization information sent by the level 1 node
Figure BDA0002610661980000084
And the time when the level 0 node transmits the synchronization information to the level 1 node
Figure BDA0002610661980000085
All come from level 0 nodes (i.e., determined by level 0 nodes), so this embodiment can be paired in level 0
Figure BDA0002610661980000086
Calculated and taken as the merging time t of the 0 th level node0To the level 1 node, at which point the order is
Figure BDA0002610661980000087
Then there are:
Figure BDA0002610661980000088
time offset of level 2 node relative to root node(2,0)Can be as follows:
Figure BDA0002610661980000089
due to the time when the level 1 node receives the synchronization information sent by the level 0 node
Figure BDA00026106619800000810
Time when level 1 node receives synchronization information sent by level 2 node
Figure BDA00026106619800000811
And a merging time t of the level 0 node0All come from the level 1 node (i.e. the level 2 node gets the three times from the level 1 node), therefore, this embodiment can be applied to the level 1 node
Figure BDA00026106619800000812
Calculated and taken as the merging time t of the level 1 node1To a level 2 node, at which point the order is
Figure BDA00026106619800000813
Then there are:
Figure BDA0002610661980000091
by analogy, the merging time of the nth level node (n is an integer not less than zero) in the smart grid system is as follows:
Figure BDA0002610661980000092
then the time offset of the nth level node relative to the root node is set when n ≧ 1(n,0)Comprises the following steps:
Figure BDA0002610661980000093
therefore, in the embodiment of the present invention, after each level of nodes in the smart grid receive the synchronization information sent by the next level of nodes, the merging time of the node may be calculated according to the formula (1), and the merging time is carried in the synchronization response information and sent to the next level of nodes, so that it is not necessary to carry the sending time of the synchronization information in the synchronization information sent to the next level of nodes, and it is not necessary to send the delay request packet carrying the accurate sending time of the synchronization information to the next level of nodes, thereby reducing the size and number of the data packets sent in the time synchronization process.
And S140, performing time synchronization according to a first time, a second time and the merging time of the upper-level node, wherein the first time is the time when the node receives the first synchronization information, and the second time is the time when the node sends the second synchronization information.
For example, after receiving a first synchronization response message sent by a previous-stage node, the node may analyze the first synchronization response message to obtain a merge time of the previous-stage node carried in the first synchronization response message; and calculating the time offset of the node relative to the root node according to the first time when the node receives the first synchronization information, the second time when the node sends the second synchronization information to the upper-level node and the combined time obtained by analysis, and carrying out time synchronization according to the time offset.
In the method for synchronizing time of a smart grid based on PTP according to an embodiment of the present invention, after receiving first synchronization information sent by a previous node, second synchronization information is sent to the previous node, and first synchronization response information to the second synchronization information sent by the previous node is received, so that time synchronization is performed according to a first time when the first synchronization information is received, a second time when a local terminal sends the second synchronization information to the previous node, and a merge time of the previous node carried in the first synchronization response information. By adopting the above technical scheme, the time synchronization of the node can be realized only by transmitting three data packets, namely the first synchronization information, the second synchronization information and the first synchronization response information, between the node and the previous-stage node, and the transmitted first synchronization information does not need to carry the sending time of the first synchronization information, so that the number of times of data interaction with the previous-stage node in the time synchronization process can be reduced, the size of the transmitted data packet is reduced, the occupation of the operation resources and the transmission resources of the smart grid system in the time synchronization process is reduced, and the time consumed in the time synchronization process of each node is shortened.
Example two
Fig. 4 is a schematic flowchart of a PTP-based smart grid time synchronization method according to a second embodiment of the present invention. In this embodiment, on the basis of the above embodiment, the "sending the second synchronization information to the upper node" is optimized as follows: and sending second synchronization information in a broadcast mode so that the upper-level node and the lower-level node of the node receive the second synchronization information.
Further, the smart grid time synchronization method based on PTP provided in this embodiment further includes: receiving third synchronization information sent by the next-level node; calculating the merging time of the node according to the merging time and the first time of the upper-level node and the third time when the node receives the third synchronous information; and sending second synchronization response information carrying the merging time of the node to the next-stage node so as to enable the next-stage node to carry out time synchronization.
Further, the performing time synchronization according to the first time, the second time, and the merging time of the upper node includes: calculating the time offset of the node relative to a root node in the smart grid system according to the first time, the second time and the merging time of the upper-level node; and performing time calibration based on the time offset so as to keep the time of the node synchronous with the time of the root node.
Correspondingly, as shown in fig. 4, the method for synchronizing the time of the smart grid based on PTP according to this embodiment includes:
s210, receiving first synchronization information sent by a node at the upper stage.
S220, sending second synchronization information in a broadcasting mode, so that the upper-level node and the lower-level node of the node receive the second synchronization information.
In this embodiment, it is assumed that the transmission distances of the nodes in the smart grid are the same, that is, the distances that the wireless signals can transmit when the nodes perform wireless communication (including broadcasting) are the same, at this time, because the node is located within the transmission distance of the node above, correspondingly, the node above is also located within the transmission distance of the node, that is, the node above and the node below are both located within the transmission distance of the node, therefore, the node can broadcast the second synchronization information after receiving the first synchronization information sent by the node above, so that the node above and the node below that are located within the transmission distance of the node receive the second synchronization information.
S230, receiving a first synchronization response message returned by the previous node after receiving the second synchronization message and a third synchronization message sent by the next node, where the first synchronization response message carries the merge time of the previous node.
Wherein, the upper node and the lower node of the node can be identified by staff in advance; the node may also determine itself, for example, when the node receives time information sent by another node for the first time in the process of time synchronization, the other node sending the time information may be determined as a previous node of the node, and the time information may be determined as first synchronization information sent by the previous node; when the node does not receive the time information sent by other nodes for the first time in the time synchronization process, the other node sending the time information may be determined as a node next to the node, and the time information may be determined as third synchronization information sent by the node next to the node.
S240, calculating the merging time of the node according to the merging time of the previous-level node, the first time and the third time when the node receives the third synchronization information, wherein the first time is the time when the node receives the first synchronization information.
Specifically, since the node exists in the smart grid system, that is, the node is not a root node of the smart grid system, at this time, the node may use a difference between a sum of the merging time of the previous node and the first time when the node receives the first synchronization information sent by the previous node and a third time when the node receives the third synchronization information sent by the next node as the merging time of the node. That is, assuming that the node is an nth node in the smart grid system, n is greater than or equal to 1 and n is an integer, the merging time of the node may be calculated by the following equation (2):
Figure BDA0002610661980000121
wherein, tnMerging time, t, of nth node in smart grid systemn-1For the merging time of the n-1 level node in the smart grid system,
Figure BDA0002610661980000122
for the time when the nth level node receives the first synchronization information transmitted by the nth-1 level node,
Figure BDA0002610661980000123
is the time when the nth level node receives the third synchronization information sent by the (n + 1) th level node.
It can be understood that, in this embodiment, each node in the smart grid system may also directly send each calculation factor of the merging time to the next-level node without calculating the merging time of the node itself, and the next-level node calculates the merging time of the node. That is, after receiving the third synchronization information sent by the next-level node, the node may directly generate the merging time of the previous-level node carrying the node, the first time when the node receives the first synchronization information sent by the previous-level node, and the third time when the node receives the third synchronization information sent by the next-level node, and send the third synchronization information to the next-level node, and the next-level node calculates the merging time of the node. At this time, correspondingly, the first synchronization response information sent by the previous-stage node received by the node may carry a calculation factor of the merging time of the previous-stage node, for example, when the previous-stage node is a root node of the smart grid system, the first synchronization response information may carry a time when the previous-stage node receives the second synchronization information sent by the node and a time when the previous-stage node sends the first synchronization information to the node; when the previous-stage node is a slave node of the smart grid system, the first synchronization response message may carry a synchronization time of the previous-stage node, a time when the previous-stage node receives the synchronization message sent by the previous-stage node of the previous-stage node, and a time when the previous-stage node receives the synchronization message sent by the node, so that after receiving the first synchronization response message sent by the previous-stage node, the node may calculate the merging time of the previous-stage node according to each calculation factor of the merging time of the previous-stage node carried in the first synchronization response message.
And S250, sending second synchronization response information carrying the merging time of the node to the next-stage node so as to enable the next-stage node to carry out time synchronization.
The second synchronization response information may be understood as response information, which is sent to a next-stage node of the node and is specific to the third synchronization information after the node receives the third synchronization information sent by the next-stage node, and for example, when the third synchronization information sent by the next-stage node is a delay request message, the second synchronization response information may be a delay request response message.
Specifically, after the merging time of the node is obtained through calculation, the node generates second synchronization corresponding information carrying the merging time, and sends the second synchronization response information to the next-stage node in a broadcast or bidirectional communication manner; therefore, when the next-level node performs time synchronization, the second synchronization information sent by the node received by the next-level node may be used as the first synchronization information received by the next-level node, the third synchronization information sent to the node may be used as the second synchronization information sent by the next-level node, and the second synchronization response information received by the next-level node may be used as the first synchronization response information received by the next-level node, and further, the time synchronization may be performed according to the time when the next-level node receives the first synchronization information, the time when the next-level node sends the second synchronization information, and the merging time carried in the second synchronization response information received by the next-level node.
And S260, calculating the time offset of the node relative to a root node in the smart grid system according to the first time, the second time and the merging time of the upper-level node, wherein the second time is the time for the node to send the second synchronization information.
Specifically, assuming that the node is an nth-level node in the smart grid system, the node may calculate a time offset of the node relative to a root node in the smart grid system by using the following equation (3):
Figure BDA0002610661980000141
wherein the offset(n,0)The time offset of the nth node in the smart grid system relative to the root node in the smart grid system is obtained,
Figure BDA0002610661980000142
for the time when the nth level node receives the first synchronization information transmitted by the nth-1 level node,
Figure BDA0002610661980000143
time for the nth level node to send the second synchronization information to the nth-1 level node, tn-1And the merging time is the merging time of the n-1 level node in the intelligent power grid system.
And S270, performing time calibration based on the time offset so as to keep the time of the node synchronous with the time of the root node.
Specifically, the node calibrates its time according to its time offset relative to a root node in the smart grid system, so that its time is calibrated to be time-synchronized with the root node.
It should be noted that, in actual application, the execution order of the above steps may be flexibly set according to needs, for example, S260 may also be executed before S240 and/or S250 or executed simultaneously with S240 and/or S250, and this embodiment does not limit the execution order of the above steps.
The second method for synchronizing smart grid time based on PTP according to the embodiment of the present invention is to send second synchronization information to the previous node and the next node of the node in a broadcast manner after receiving the first synchronization information sent by the previous node, receive the first synchronization response information returned by the previous node after receiving the second synchronization information and the third synchronization information sent by the next node, calculate the merging time of the node according to the merging time of the previous node, the first time when the node receives the first synchronization information and the third time when the node receives the third synchronization information, send the merging time of the node to the next node while carrying the merging time of the node in the second synchronization response information, and calculate the time offset of the node relative to the root node in the smart grid system according to the first time, the second time when the node sends the second synchronization information and the merging time of the previous node and the node, time synchronization is performed based on the time offset. By adopting the technical scheme, the occupation of the operation resources and the transmission resources of the intelligent power grid system in the time synchronization process can be reduced, and the time consumed in the time synchronization process of each node is shortened; in addition, when the second synchronization information is sent to the previous-stage node, the second synchronization information is sent to the next-stage node synchronously, and the next-stage node is instructed by the second synchronization information to start the execution time passing process, so that the next-stage node does not need to perform time synchronization after the time synchronization of the node is completed.
EXAMPLE III
The third embodiment of the invention provides a smart grid time synchronization device based on PTP. The device can be implemented by software and/or hardware, can be integrated in a node (i.e. a terminal device) of the smart grid system, and typically can be integrated in a slave node of the smart grid system, and can perform time synchronization by executing a smart grid time synchronization method based on PTP. Fig. 5 is a block diagram of a structure of a smart grid time synchronization device based on PTP according to a third embodiment of the present invention. As shown in fig. 5, the apparatus includes: a first receiving module 301, a first transmitting module 302, a second receiving module 303, and a time synchronization module 304, wherein,
a first receiving module 301, configured to receive first synchronization information sent by a previous-stage node;
a first sending module 302, configured to send second synchronization information to the upper-level node;
a second receiving module 303, configured to receive first synchronization response information returned by the previous-stage node after receiving the second synchronization information, where the first synchronization response information carries merging time of the previous-stage node;
a time synchronization module 304, configured to perform time synchronization according to a first time, a second time, and the merging time of the previous-stage node, where the first time is a time when the node receives the first synchronization information, and the second time is a time when the node sends the second synchronization information.
In the smart grid time synchronization device based on PTP according to the third embodiment of the present invention, the first receiving module receives the first synchronization information sent by the previous node, the first sending module sends the second synchronization information to the previous node, the second receiving module receives the first synchronization response information to the second synchronization information sent by the previous node, and the time synchronization module performs time synchronization according to the first time when the time synchronization module receives the first synchronization information, the second time when the terminal sends the second synchronization information to the previous node, and the merge time of the previous node carried in the first synchronization response information. By adopting the above technical scheme, the time synchronization of the node can be realized only by transmitting three data packets, namely the first synchronization information, the second synchronization information and the first synchronization response information, between the node and the previous-stage node, and the transmitted first synchronization information does not need to carry the sending time of the first synchronization information, so that the number of times of data interaction with the previous-stage node in the time synchronization process can be reduced, the size of the transmitted data packet is reduced, the occupation of the operation resources and the transmission resources of the smart grid system in the time synchronization process is reduced, and the time consumed in the time synchronization process of each node is shortened.
In the foregoing scheme, the first sending module 302 may specifically be configured to: and sending second synchronization information in a broadcast mode so that the upper-level node and the lower-level node of the node receive the second synchronization information.
Further, the smart grid time synchronization device based on PTP may further include: a third receiving module, configured to receive third synchronization information sent by the next-stage node; the time calculation module is used for calculating the merging time of the node according to the merging time and the first time of the upper-level node and the third time when the node receives the third synchronization information; and the second sending module is used for sending second synchronization response information carrying the merging time of the node to the next-stage node so as to enable the next-stage node to carry out time synchronization.
In the above scheme, the merging time of each level of nodes in the smart grid system can be calculated by using the following formula:
Figure BDA0002610661980000171
wherein, tnMerging time, t, of nth node in smart grid systemn-1For the merging time of the n-1 level node in the smart grid system,
Figure BDA0002610661980000172
for the time when the nth level node receives the first synchronization information transmitted by the nth-1 level node,
Figure BDA0002610661980000173
for the time when the nth level node receives the third synchronization information transmitted by the (n + 1) th level node,
Figure BDA0002610661980000174
time for the nth level node to send the second synchronization information to the (n + 1) th level node; n is an integer of 0 or more, when n is 0, the firstThe 0-level node is a root node; when n ≧ 1, the nth-stage node is a slave node.
In the above scheme, the time synchronization module 304 may include: the offset calculation unit is used for calculating the time offset of the node relative to a root node in the smart grid system according to the first time, the second time and the merging time of the node at the upper stage; and the time synchronization unit is used for carrying out time calibration based on the time offset so as to keep the time of the node synchronous with the time of the root node.
In the foregoing solution, the offset calculation unit may be specifically configured to: calculating the time offset of the node relative to a root node in the smart grid system by adopting the following formula:
Figure BDA0002610661980000175
wherein the offset(n,0)The time offset of the nth node in the smart grid system relative to the root node in the smart grid system is obtained,
Figure BDA0002610661980000176
is the time at which the nth level node sends the second synchronization information to the nth-1 level node.
The smart grid time synchronization device based on PTP provided by the third embodiment of the invention can execute the smart grid time synchronization method based on PTP provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects for executing the smart grid time synchronization method based on PTP. Technical details that are not described in detail in this embodiment can be referred to a PTP-based smart grid time synchronization method provided in any embodiment of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A smart grid time synchronization method based on PTP is characterized by comprising the following steps:
receiving first synchronization information sent by a previous-level node;
sending second synchronization information to the upper-level node;
receiving first synchronization response information returned by the previous-level node after receiving the second synchronization information, wherein the first synchronization response information carries the merging time of the previous-level node;
and performing time synchronization according to a first time, a second time and the merging time of the upper-level node, wherein the first time is the time when the node receives the first synchronization information, and the second time is the time when the node sends the second synchronization information.
2. The method of claim 1, wherein sending second synchronization information to the superordinate node comprises:
and sending second synchronization information in a broadcast mode so that the upper-level node and the lower-level node of the node receive the second synchronization information.
3. The method of claim 2, further comprising:
receiving third synchronization information sent by the next-level node;
calculating the merging time of the node according to the merging time and the first time of the upper-level node and the third time when the node receives the third synchronous information;
and sending second synchronization response information carrying the merging time of the node to the next-stage node so as to enable the next-stage node to carry out time synchronization.
4. The method according to any one of claims 1 to 3, wherein the combination time of each level of nodes in the smart grid system is calculated by adopting the following formula:
Figure FDA0002610661970000011
wherein, tnMerging time, t, of nth node in smart grid systemn-1For the merging time of the n-1 level node in the smart grid system,
Figure FDA0002610661970000021
for the time when the nth level node receives the first synchronization information transmitted by the nth-1 level node,
Figure FDA0002610661970000022
for the time when the nth level node receives the third synchronization information transmitted by the (n + 1) th level node,
Figure FDA0002610661970000023
time for the nth level node to send the second synchronization information to the (n + 1) th level node; n is an integer greater than or equal to 0, and when n is 0, the 0 th-level node is a root node; when n ≧ 1, the nth-stage node is a slave node.
5. The method of claim 4, wherein the time synchronizing according to the first time, the second time and the merging time of the upper level node comprises:
calculating the time offset of the node relative to a root node in the smart grid system according to the first time, the second time and the merging time of the upper-level node;
and performing time calibration based on the time offset so as to keep the time of the node synchronous with the time of the root node.
6. The method according to claim 5, wherein calculating the time offset of the node relative to the root node in the smart grid system according to the first time, the second time and the merging time of the previous node comprises:
calculating the time offset of the node relative to a root node in the smart grid system by adopting the following formula:
Figure FDA0002610661970000024
wherein the offset(n,0)The time offset of the nth node in the smart grid system relative to the root node in the smart grid system is obtained,
Figure FDA0002610661970000025
is the time at which the nth level node sends the second synchronization information to the nth-1 level node.
7. A smart grid time synchronization device based on PTP is characterized by comprising:
the first receiving module is used for receiving first synchronization information sent by a previous-level node;
the first sending module is used for sending second synchronization information to the upper-level node;
a second receiving module, configured to receive first synchronization response information returned by the previous-stage node after receiving the second synchronization information, where the first synchronization response information carries merging time of the previous-stage node;
and the time synchronization module is used for carrying out time synchronization according to a first time, a second time and the merging time of the upper-level node, wherein the first time is the time when the node receives the first synchronization information, and the second time is the time when the node sends the second synchronization information.
8. The apparatus of claim 7, wherein the first sending module is specifically configured to:
and sending second synchronization information in a broadcast mode so that the upper-level node and the lower-level node of the node receive the second synchronization information.
9. The apparatus of claim 8, further comprising:
a third receiving module, configured to receive third synchronization information sent by the next-stage node;
the time calculation module is used for calculating the merging time of the node according to the merging time and the first time of the upper-level node and the third time when the node receives the third synchronization information;
and the second sending module is used for sending second synchronization response information carrying the merging time of the node to the next-stage node so as to enable the next-stage node to carry out time synchronization.
10. The device according to any one of claims 7 to 9, wherein the combination time of each level of nodes in the smart grid system is calculated by adopting the following formula:
Figure FDA0002610661970000031
wherein, tnMerging time, t, of nth node in smart grid systemn-1For the merging time of the n-1 level node in the smart grid system,
Figure FDA0002610661970000041
for the time when the nth level node receives the first synchronization information transmitted by the nth-1 level node,
Figure FDA0002610661970000042
for the time when the nth level node receives the third synchronization information transmitted by the (n + 1) th level node,
Figure FDA0002610661970000043
sending a second synchronization signal to the (n + 1) th node for the nth nodeThe time of rest; n is an integer greater than or equal to 0, and when n is 0, the 0 th-level node is a root node; when n ≧ 1, the nth-stage node is a slave node.
CN202010755739.9A 2020-07-30 2020-07-30 Smart grid time synchronization method and device based on PTP Pending CN111884751A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010755739.9A CN111884751A (en) 2020-07-30 2020-07-30 Smart grid time synchronization method and device based on PTP

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010755739.9A CN111884751A (en) 2020-07-30 2020-07-30 Smart grid time synchronization method and device based on PTP

Publications (1)

Publication Number Publication Date
CN111884751A true CN111884751A (en) 2020-11-03

Family

ID=73204346

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010755739.9A Pending CN111884751A (en) 2020-07-30 2020-07-30 Smart grid time synchronization method and device based on PTP

Country Status (1)

Country Link
CN (1) CN111884751A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112511257A (en) * 2020-11-24 2021-03-16 泰斗微电子科技有限公司 Processing method of time service state
CN112600641A (en) * 2020-12-31 2021-04-02 深圳市英特瑞半导体科技有限公司 Network equipment time synchronization method, device, equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101686093A (en) * 2008-09-28 2010-03-31 大唐移动通信设备有限公司 Transmission network clock synchronizing method, equipment and system
CN102332973A (en) * 2011-09-07 2012-01-25 上海交通大学 Real-time communication and clock synchronization method of chain network
US20130182806A1 (en) * 2010-09-24 2013-07-18 Siemens Aktiengesellschaft Method for Time Synchronization in a Communications Network
CN103945525A (en) * 2014-04-30 2014-07-23 国家电网公司 Hierarchical structure based wireless sensor network time synchronization method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101686093A (en) * 2008-09-28 2010-03-31 大唐移动通信设备有限公司 Transmission network clock synchronizing method, equipment and system
US20130182806A1 (en) * 2010-09-24 2013-07-18 Siemens Aktiengesellschaft Method for Time Synchronization in a Communications Network
CN102332973A (en) * 2011-09-07 2012-01-25 上海交通大学 Real-time communication and clock synchronization method of chain network
CN103945525A (en) * 2014-04-30 2014-07-23 国家电网公司 Hierarchical structure based wireless sensor network time synchronization method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112511257A (en) * 2020-11-24 2021-03-16 泰斗微电子科技有限公司 Processing method of time service state
CN112600641A (en) * 2020-12-31 2021-04-02 深圳市英特瑞半导体科技有限公司 Network equipment time synchronization method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
US7826374B2 (en) Method and apparatus for efficient transfer of data over a network
US9742514B2 (en) Method, apparatus, and system for generating timestamp
US9900120B2 (en) Clock synchronization method and apparatus
CN105262555B (en) Time synchronization method, programmable logic device, single board and network element
CN109996325B (en) Clock synchronization system and method of wireless sensor network
JP6132734B2 (en) Time synchronization system and apparatus
JP2009111654A (en) Time synchronization processing system, time information distributor, time synchronization processor, time information distribution program, and time synchronization processing program
CN105281885B (en) Time synchronization method and device for network equipment and time synchronization server
JP5811895B2 (en) Communication apparatus and communication method
CN111884751A (en) Smart grid time synchronization method and device based on PTP
CN103138887A (en) Processing method of 1588 event messages and processing method of 1588 event messages
CN103546268A (en) Method and device for compensating system time
WO2016177090A1 (en) Clock synchronization method and device
CN106455038A (en) Master node, slave node and synchronization information self-correcting method
CN106850397A (en) Message delivery method and device in Internet of Things
CN108738127B (en) Radio remote unit, baseband processing unit, distributed base station and synchronization method thereof
CN112583477B (en) Delay measurement method, delay measurement system and storage medium
CN114258126A (en) Data processing method and device
US20170117980A1 (en) Time synchronization for network device
US10334539B2 (en) Metered interface
CN116318506A (en) Clock synchronization method for wireless time-sensitive network in spacecraft
CN111586833A (en) Positioning method, device, terminal, base station and management function entity
US10554319B2 (en) Wireless communications with time synchronization processing
CN115278856A (en) Time synchronization method, time synchronization device, medium, and electronic apparatus
US20210247799A1 (en) Distributed Network Time Synchronization

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20201103

RJ01 Rejection of invention patent application after publication