CN113328823B - Clock identification method and device based on PTP - Google Patents

Clock identification method and device based on PTP Download PDF

Info

Publication number
CN113328823B
CN113328823B CN202110761811.3A CN202110761811A CN113328823B CN 113328823 B CN113328823 B CN 113328823B CN 202110761811 A CN202110761811 A CN 202110761811A CN 113328823 B CN113328823 B CN 113328823B
Authority
CN
China
Prior art keywords
frequency stability
ptp
master clock
ptp message
clock
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
CN202110761811.3A
Other languages
Chinese (zh)
Other versions
CN113328823A (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.)
Siemens Power Automation Ltd
Original Assignee
Siemens Power Automation 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 Siemens Power Automation Ltd filed Critical Siemens Power Automation Ltd
Priority to CN202110761811.3A priority Critical patent/CN113328823B/en
Publication of CN113328823A publication Critical patent/CN113328823A/en
Application granted granted Critical
Publication of CN113328823B publication Critical patent/CN113328823B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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 invention provides a clock identification method and a clock identification device based on PTP, wherein the method comprises the following steps: receiving a PTP message sent by a master clock; determining a first frequency stability of the master clock according to the PTP message, wherein the first frequency stability is information which is carried in the PTP message and is used for representing the frequency stability of the master clock; determining a second frequency stability according to the PTP message, wherein the second frequency stability is determined based on the actual frequency of the master clock; judging whether the deviation between the first frequency stability and the second frequency stability meets a preset condition or not; and if the judgment result is yes, taking the master clock as a clock which can be synchronized. According to the invention, the forged master clock can be identified in time.

Description

Clock identification method and device based on PTP
Technical Field
The invention relates to the field of power systems, in particular to a clock identification method and device based on PTP.
Background
PTP (Precision Time Protocol) is a high-Precision Time synchronization Protocol, which is a master-slave synchronization system and uses hardware timestamps. The PTP protocol defines a plurality of PTP messages, including a synchronization message (Sync message) and an announcement message (announcement message). The sync messages are periodically sent from the master clock and contain the clock attributes required by the master clock algorithm and also contain a timestamp that accurately describes the expected time of transmission of the data packet. The message master clock is declared to send out characteristic information of its own clock, e.g. frequency related information, and the slave clocks in the domain use this message for the optimal master clock algorithm. For example, the slave clock determines whether to use the master clock that transmits the PTP message as the final synchronous clock according to the information carried in the PTP message, and the specific determination method is already specified in the relevant standard.
Due to the characteristics of the PTP protocol itself, the PTP message is transmitted in a multicast manner. In this case, if there is a hacking attack, for example, a master clock is forged and PTP messages are sent to other slave clocks in the domain, the slave clocks are likely to use the forged master clock as the master clock, which may cause a problem in sampling time-setting reference, and the relay protection device may malfunction, even bring about a large loss in production.
Disclosure of Invention
In view of this, the present invention provides a method for clock identification based on PTP, including: receiving a PTP message sent by a master clock; the method further comprises the following steps:
determining a first frequency stability of the master clock according to the PTP message, wherein the first frequency stability is information which is carried in the PTP message and is used for representing the frequency stability of the master clock;
determining a second frequency stability according to the PTP message, wherein the second frequency stability is determined based on the actual frequency of the master clock;
judging whether the deviation between the first frequency stability and the second frequency stability meets a preset condition or not;
and if so, taking the master clock as a synchronizable clock.
The method as described above, optionally, further comprising:
if the judgment result is negative, at least one of the following operations is adopted:
the first operation is as follows: discarding the PTP message;
the second operation is as follows: sending out an alarm;
the third operation: recording;
a fourth operation: the master clock is de-prioritized.
According to the method as described above, optionally, the preset condition is: i K s |<|K m |+|K s (max) |, where K m Representing a first frequency stability, K s Representing a second degree of frequency stability, K s (max) is a preset maximum frequency stability of the master clock.
According to the method as described above, optionally,
Figure BDA0003149325380000021
wherein the content of the first and second substances,<syncEventIngressTimestamp> N+1 representing the time of the (N + 1) th PTP message for determining the first frequency stabilityThe time stamp is carried out on the time stamp,<syncEventIngressTimestamp> 1 the timestamp of the 1 st PTP message used to determine the first frequency stability is indicated,<correctedMasterEventTimestamp> N+1 represents the sum of the timestamp carried in the (N + 1) th PTP message used for determining the first frequency stability and the delay time for transmitting the (N + 1) th PTP message,<correctedMasterEventTimestamp> 1 and the sum of a timestamp carried in the 1 st PTP message for determining the first frequency stability and the delay time for transmitting the 1 st PTP message is represented, wherein N is a positive integer greater than or equal to 1.
According to the method as described above, optionally,
determining the first frequency stability of the master clock according to the PTP message includes: taking the PTP variance of the master clock of the PTP message as the first frequency stability;
determining the second frequency stability according to the PTP message includes: determining the actual PTP variance of the master clock as the second frequency stability according to the timestamp in the received PTP message;
the preset condition is σ sm <c, where σ s Representing a second degree of frequency stability, σ m Representing a first frequency stability and c representing a preset deviation ratio.
According to the method as described above, optionally,
Figure BDA0003149325380000022
wherein N represents the total sampling number of the PTP messages, k represents the kth message in the N PTP messages, and x k Is shown at time t k Time difference measurement, x, between the master clock that is done at the moment and the slave clock that receives the PTP message k+1 Is shown at time t k Time difference measurement, x, between the master clock finished at + τ and the slave clock receiving the PTP message k+2 Is shown at time t k Measuring the time difference between a master clock finished at +2 tau time and a slave clock receiving the PTP message, wherein tau is a sampling periodAnd (4) a period.
The present invention also provides a PTP-based clock identification apparatus, including:
the receiving unit is used for receiving a PTP message sent by a master clock;
the device further comprises:
a first determining unit, configured to determine a first frequency stability of the master clock according to the PTP packet, where the first frequency stability is information carried in the PTP packet and used to indicate the frequency stability of the master clock;
a second determining unit, configured to determine a second frequency stability according to the PTP message, where the second frequency stability is determined based on an actual frequency of the master clock;
a judging unit, configured to judge whether a deviation between the first frequency stability and the second frequency stability satisfies a preset condition, and if yes, trigger a third determining unit;
the third determining unit is configured to use the master clock as a clock that can be synchronized.
According to the apparatus as described above, optionally, the preset condition is: i K s |<|K m |+|K s (max) |, where K m Representing a first frequency stability, K s Representing a second degree of frequency stability, K s (max) is a preset maximum frequency stability of the master clock.
The apparatus according to the above, optionally, characterized in that,
Figure BDA0003149325380000031
wherein the content of the first and second substances,<syncEventIngressTimestamp> N+1 a timestamp indicating the received (N + 1) th PTP message used to determine the first frequency stability,<syncEventIngressTimestamp> 1 a timestamp representing the 1 st PTP message received for determining the first frequency stability,<correctedMasterEventTimestamp> N+1 the sum of the timestamp carried in the (N + 1) th PTP message for determining the first frequency stability and the delay time for transmitting the (N + 1) th PTP message is expressed,<correctedMasterEventTimestamp> 1 and the sum of a timestamp carried in the 1 st PTP message used for determining the first frequency stability and the delay time for transmitting the 1 st PTP message is represented, wherein N is a positive integer greater than or equal to 1.
The apparatus according to the above, optionally, characterized in that,
the first determining unit is specifically configured to: taking the PTP variance of the master clock of the PTP message as the first frequency stability;
the second determining unit is specifically configured to: determining the actual PTP variance of the master clock as the second frequency stability according to the timestamp of the received PTP message; the preset condition is σ sm <c, where σ s Representing a second degree of frequency stability, σ m Representing a first frequency stability and c representing a preset deviation ratio.
The apparatus according to the above, optionally,
Figure BDA0003149325380000041
wherein N represents the total sampling number of the PTP messages, k represents the kth message in the N PTP messages, and x k Is shown at time t k Measurement of the time difference between the Master clock, which is completed at that moment, and the Slave clock, which receives the PTP message, x k+1 Is shown at time t k Measurement of the time difference between the master clock finished at + τ and the slave clock receiving the PTP message, x k+2 Is shown at time t k And measuring the time difference between the master clock finished at the moment of +2 tau and the slave clock receiving the PTP message, wherein tau is a sampling period.
The invention also provides a clock identification device based on PTP, comprising:
at least one memory for storing instructions;
at least one processor configured to execute the method of PTP based clock identification according to any one of the above in accordance with instructions stored by the memory.
The present invention further provides a readable storage medium having stored therein machine readable instructions which, when executed by a machine, the machine performs a method of PTP based clock identification according to any one of the above.
According to the invention, before the operation of the existing clock synchronization process, whether the master clock is a forged master clock is determined according to the claimed frequency stability of the master clock and the actual frequency stability of the master clock measured according to the PTP message of the master clock, and the master clock can be identified in time so as to avoid subsequent loss as much as possible. The invention does not change the existing PTP protocol and can be applied in any scene. In addition, the method can be completed by only one device side, such as a slave clock side, and is convenient and quick.
Drawings
The foregoing and other features and advantages of the invention will become more apparent to those skilled in the art to which the invention relates upon consideration of the following detailed description of a preferred embodiment of the invention with reference to the accompanying drawings, in which:
fig. 1 is a flowchart illustrating a PTP-based clock identification method according to an embodiment of the present invention.
Fig. 2 is a flowchart illustrating a method for PTP based clock identification according to another embodiment of the present invention.
Fig. 3 is a flowchart illustrating a PTP-based clock identification method according to still another embodiment of the present invention.
Fig. 4 is a schematic structural diagram of a PTP-based clock identification apparatus according to another embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail by referring to the following examples.
For a forged master clock caused by hacking, because the forged master clock is not a real physical entity and has no crystal oscillator, the physical characteristics of the forged master clock are inferior to those of the real master clock, so that the frequency stability of the forged master clock is inferior to that of the real master clock, or the forged master clock is not good in description in a PTP message sent by the forged master clock. Where frequency stability represents the ability of the frequency to remain constant, it is the ratio of the frequency change to the nominal frequency, which refers to the nominal frequency asserted by the master clock. Based on this, the inventors have invented a method to identify the true master clock based on frequency stability.
Example one
The present embodiment provides a PTP-based clock identification method, the execution subject of which is a PTP-based clock identification device that can be integrated in a slave clock.
As shown in fig. 1, a flowchart of a PTP-based clock identification method according to the present embodiment is shown, and the method includes:
step 100, receiving a PTP message sent by a master clock.
PTP messages are messages based on the PTP protocol. The PTP message at least comprises a synchronization message and a statement message. In fact, the device may receive PTP messages sent by multiple master clocks, and subsequently determine which master clock is used as the synchronized clock according to the PTP messages. In the prior art, there are many methods for calculating which is the best master clock of the slave clock, for example, a device identified by a clock based on PTP may determine a final synchronization clock according to a PTP message according to a BMC algorithm, which is not described herein again.
Step 101, determining a first frequency stability of the master clock according to the PTP message, where the first frequency stability is information carried in the PTP message and used for indicating the frequency stability of the master clock.
The PTP message may include information that explicitly indicates the frequency stability of the master clock that transmits the PTP message, and the PTP message may specifically be a declaration message. The information for indicating the frequency stability may be directly obtained through the PTP message, or may be indirectly obtained through the content in the PTP message.
And 102, determining a second frequency stability according to the PTP message, wherein the second frequency stability is determined based on the actual frequency of the master clock.
For example, the second frequency stability is determined according to the timestamp of the received PTP message, or the second frequency stability is determined according to the time difference between the currently received PTP message and the received 1 st PTP message. That is, the second frequency stability is measured by the clock recognition device based on the PTP. The frequency stability of the present embodiment can be calculated from the frequency offset ratio or from the Allan variance.
It should be noted that, the 1 st PTP message refers to the 1 st PTP message used for calculation, and is not the 1 st PTP message received in the actual sense, and if there are M PTP messages used in the method, the first PTP message is the 1 st PTP message in the M messages. The method of this embodiment is periodic, each time, it is equivalent to selecting M messages to execute the method of this embodiment, the M PTP messages may be obtained by sampling from the received PTP messages, and the specific sampling interval may be set according to actual needs. The PTP message received in step 100 may be taken as the mth message, where M is a natural number.
Step 103, determining whether the deviation between the first frequency stability and the second frequency stability meets a preset condition, and if so, executing step 104.
The preset condition may be continuously set according to actual needs, and details are not described again.
And step 104, taking the master clock as a synchronizable clock.
The synchronizable clock indicates that the master clock is not excluded from the synchronizable master clock, and does not mean that the master clock must eventually be selected as the synchronizable clock. That is, the prior art may be subsequently used to determine the best master clock of the slave clocks that receive PTP messages sent by that master clock.
Alternatively, in the case where the determination result of step 103 is no, one of the following operations may be adopted:
the first operation is: and discarding the PTP message. The discarded message may indicate that the master clock cannot be used as a synchronizable clock, and the PTP message sent by the master clock cannot be dealt with subsequently, or may indicate that the PTP message received this time has a problem, and the PTP message is discarded first for the time, and waits for the next message.
The second operation is as follows: and sending out an alarm. For example, alarm information can be sent to preset workers, so that the workers can find some possibly potential forged master clocks in time and adopt corresponding measures to process the clocks.
The third operation: and (6) recording. For example, the information of the master clock corresponding to the PTP message may be stored in a log, which is convenient for later analysis.
A fourth operation: the priority of the master clock is lowered. For example, if the master clock and another master clock can be synchronized at the same time, the priority of the master clock is lowered, and another master clock is selected as the synchronized clock.
Optionally, after step 104, a new PTP message is received, and the operations in steps 101 to 104 may be performed by using a new PTP message as the mth message according to the sampling frequency. The operation of the period can identify the forged master clock in time.
According to the embodiment, before the operation of the existing clock synchronization process, whether the master clock is a forged master clock is determined according to the claimed frequency stability of the master clock and the actual frequency stability of the master clock measured according to the PTP message of the master clock, and the master clock can be identified in time to avoid subsequent loss as much as possible. The method does not change the existing PTP protocol and can be applied in any scene. In addition, the method can be completed by only one device side, such as a slave clock side, and is convenient and quick.
Example two
The present embodiment specifically exemplifies the PTP-based clock identification method in the first embodiment. In this embodiment, it is determined whether the master clock is a clock that can be synchronized according to the frequency offset.
Step 200, receiving a PTP message sent by a master clock.
This step is identical to step 100 and will not be described herein.
Step 201, determining a first frequency stability of the master clock according to the PTP message, where the first frequency stability is information carried in the PTP message and used for representing the frequency stability of the master clock.
The first frequency stability may be K m To indicate. This step is identical to step 101 and will not be described herein.
Step 202, determining a second frequency stability according to the PTP message, the second frequency stability being determined based on the actual frequency of the master clock.
This step is identical to step 102 and will not be described herein.
Step 203, determining whether the deviation between the first frequency stability and the second frequency stability meets a preset condition, where the preset condition is: i K s |<|K m |+|K s (max) |, where K m Representing a first frequency stability, K s Representing a second degree of frequency stability, K s (max) is the preset maximum frequency stability of the master clock. If yes, go to step 204.
As an example of the way in which the illustration is made,
Figure BDA0003149325380000071
wherein, the first and the second end of the pipe are connected with each other,<syncEventIngressTimestamp> N+1 the timestamp representing the (N + 1) th PTP message,<syncEventIngressTimestamp> 1 the timestamp representing the 1 st PTP message,<correctedMasterEventTimestamp> N+1 represents the sum of the timestamp carried in the (N + 1) th PTP message and the delay time for transmitting the (N + 1) th PTP message,<correctedMasterEventTimestamp> 1 and the sum of the timestamp carried in the 1 st PTP message and the delay time for transmitting the 1 st PTP message is represented, wherein N is a positive integer greater than or equal to 2. The timestamp carried in the PTP message is the time when the PTP message is sent from the master clock. The PTP message is received after sampling the message for calculating the second frequency stabilityTime-ordered.
K m Is the information carried in a field in the Announce message in the IEEE1588 protocol, which is used to indicate the claimed frequency stability of the master clock. K s (max) may be derived from physical measurements or from a manual of the crystal oscillator, for example, where the crystal oscillator has a frequency characteristic parameter, specifically plus or minus 25PPM (Part Per Million), which indicates that the frequency shift is controlled to within plus or minus 25 parts Per Million. In some cases, K m Can be connected with K s The value of (max) is equal, for example, when the frequency stability of the slave clock receiving the PTP message is equal to the frequency stability of the master clock transmitting the PTP message.
Step 204, using the master clock as a synchronizable clock.
The master clock is used as one of the alternative clocks which can be synchronized, and then an optimal master clock can be selected according to the information of other master clocks.
Step 205, determining the final synchronized master clock according to the information of the master clock and other master clocks.
Step 205 belongs to the prior art and is not described herein.
According to the embodiment, whether the master clock is a forged master clock is judged through the deviation between the claimed frequency stability of the master clock and the actually measured frequency stability, so that the subsequent loss can be avoided as much as possible, and the method is simple and rapid.
EXAMPLE III
The present embodiment specifically exemplifies the PTP-based clock identification method in the first embodiment. In this embodiment, whether the master clock is a synchronizable clock is determined according to the PTP variance.
Step 300, receiving a PTP message sent by a master clock.
This step is identical to step 100 and will not be described herein.
Step 301, using information of PTP variance of a master clock of a PTP message as a first frequency stability.
Specifically, the first frequency stability may be a ratio of a clockAccuracy field in the declaration message divided by a period of the declaration message, and if the clockAccuracy field is 1 μ s and the period of the declaration message is 1s, the first frequency stability is 1PPM.
This step is identical to step 101 and will not be described herein.
Step 302, determining the actual PTP variance of the master clock as the second frequency stability according to the timestamp in the PTP message.
In particular, the amount of the solvent to be used,
Figure BDA0003149325380000091
wherein, N represents the total sampling number of PTP messages, k represents the kth message in the N PTP messages, and x k Is shown at time t k Measurement of the time difference between the Master clock, which is completed at that moment, and the Slave clock, which receives the PTP message, x k+1 Is shown at time t k Measurement of the time difference between the master clock finished at + τ and the slave clock receiving the PTP message, x k+2 Is shown at time t k And measuring the time difference between the master clock finished at the moment of +2 tau and the slave clock receiving the PTP message, wherein tau is a sampling period. The N PTP messages may be selected from the N received messages. The time difference measurement here refers to the calculation of the time deviation between the master clock and the slave clock receiving the PTP message, i.e. offset frommaster, and as an exemplary illustration, the time difference measurement = the receiving timestamp of the sync message-the timestamp it is sent-the path delay and the dwell time.
Step 303, determining whether the deviation between the first frequency stability and the second frequency stability meets a preset condition, and if so, executing step 304.
The preset condition of this embodiment is σ sm <c, where σ s Representing a second degree of frequency stability, σ m Representing a first frequency stability and c representing a preset deviation ratio. The value of c is, for example, 10%.
Step 304, the master clock is used as a synchronizable clock.
This step is identical to step 104 and will not be described herein.
And step 305, determining a final synchronous master clock according to the information of the master clock and other master clocks.
This step 305 belongs to the prior art and is not described herein.
In this embodiment, the difference between the claimed frequency stable value of the master clock and the real frequency stable value is determined by using the PTP variance, and whether the master clock is a forged master clock can be accurately determined, thereby avoiding further loss.
Example four
The present embodiment provides a PTP-based clock identification apparatus for implementing the PTP-based clock identification method according to the first embodiment.
Fig. 4 is a schematic diagram showing the structure of a PTP-based clock identification apparatus according to the present embodiment. The PTP-based clock identification apparatus includes a receiving unit 401, a first determining unit 402, a second determining unit 403, a judging unit 404, and a third determining unit 405.
The receiving unit 401 is configured to receive a PTP packet sent by a master clock; the first determining unit 402 is configured to determine a first frequency stability of the master clock according to the PTP message, where the first frequency stability is information carried in the PTP message and used to indicate the frequency stability of the master clock; a second determining unit 403, configured to determine a second frequency stability according to the PTP message, where the second frequency stability is determined based on the actual frequency of the master clock; the determining unit 404 is configured to determine whether a deviation between the first frequency stability and the second frequency stability meets a preset condition, and if the determination result is yes, trigger a third determining unit 405; the third determination unit 405 is used to treat the master clock as a clock that can be synchronized.
Optionally, the preset conditions are: i K s |<|K m |+|K s (max) |, where K m Representing a first degree of frequency stability, K s Representing a second degree of frequency stability, K s (max) is the preset maximum frequency stability of the master clock.
Alternatively,
Figure BDA0003149325380000101
wherein the content of the first and second substances,<syncEventIngressTimestamp> N+1 a timestamp indicating the received (N + 1) th PTP message used to determine the first frequency stability,<syncEventIngressTimestamp> 1 a timestamp representing the received 1 st PTP message used to determine the first frequency stability,<correctedMasterEventTimestamp> N+1 the sum of the timestamp carried in the (N + 1) th PTP message for determining the first frequency stability and the delay time for transmitting the (N + 1) th PTP message,<correctedMasterEventTimestamp> 1 and the sum of a timestamp carried in the 1 st PTP message used for determining the first frequency stability and the delay time for transmitting the 1 st PTP message is represented, wherein N is a positive integer greater than or equal to 1.
Or, alternatively,
the first determining unit 402 is specifically configured to: taking PTP variance of a master clock of a PTP message as first frequency stability;
the second determining unit 403 is specifically configured to: determining the actual PTP variance of the master clock as a second frequency stability according to the timestamp of the received PTP message; the predetermined condition is σ sm <c, wherein σ s Representing a second degree of frequency stability, σ m Representing a first frequency stability and c representing a preset deviation ratio.
Figure BDA0003149325380000102
Wherein N represents the total sampling number of PTP messages, k represents the kth message in the N PTP messages, and x k Is shown at time t k Time difference measurement, x, between the master clock that is done at the moment and the slave clock that receives the PTP message k+1 Is shown at time t k Time difference measurement, x, between the master clock finished at + τ and the slave clock receiving the PTP message k+2 Is shown at time t k And measuring the time difference between the master clock finished at the moment of +2 tau and the slave clock receiving the PTP message, wherein tau is a sampling period.
The working method of each unit of this embodiment is the same as that of the previous embodiment, and is not described herein again.
According to the embodiment, before the operation of the existing clock synchronization process, whether the master clock is a forged master clock is determined according to the claimed frequency stability of the master clock and the actual frequency stability of the master clock measured according to the PTP message of the master clock, and the master clock can be identified in time to avoid subsequent loss as much as possible. In addition, the present embodiment does not change the existing PTP protocol, and can be applied in any scenario. In addition, the embodiment can be completed by only one device side, such as a slave clock side, and is convenient and quick.
The invention also provides a device for clock identification based on PTP, comprising at least one memory and at least one processor, wherein the memory is used for storing instructions; the processor is configured to execute the method for PTP based clock identification according to any one of the preceding embodiments in accordance with instructions stored in the memory.
Embodiments of the present invention also provide a readable storage medium. The readable storage medium has stored therein machine readable instructions which, when executed by a machine, the machine performs the method of PTP based clock identification described in any of the preceding embodiments.
The readable medium has stored thereon machine readable instructions which, when executed by a processor, cause the processor to perform any of the methods previously described. In particular, a system or apparatus may be provided which is provided with a readable storage medium on which software program code implementing the functionality of any of the embodiments described above is stored and which causes a computer or processor of the system or apparatus to read and execute machine-readable instructions stored in the readable storage medium.
In this case, the program code itself read from the readable medium can realize the functions of any of the above-described embodiments, and thus the machine-readable code and the readable storage medium storing the machine-readable code form part of the present invention.
Examples of the readable storage medium include floppy disks, hard disks, magneto-optical disks, optical disks (e.g., CD-ROMs, CD-Rs, CD-RWs, DVD-ROMs, DVD-RAMs, DVD-RWs, DVD + RWs), magnetic tapes, nonvolatile memory cards, and ROMs. Alternatively, the program code may be downloaded from a server computer or the cloud by a communication network.
It will be understood by those skilled in the art that various changes and modifications may be made in the above-disclosed embodiments without departing from the spirit of the invention. Accordingly, the scope of the invention should be limited only by the attached claims.
It should be noted that not all steps and units in the above flows and system structure diagrams are necessary, and some steps or units may be omitted according to actual needs. The execution sequence of the steps is not fixed and can be adjusted according to the needs. The apparatus structures described in the above embodiments may be physical structures or logical structures, that is, some units may be implemented by the same physical entity, or some units may be implemented by a plurality of physical entities, or some units may be implemented by some components in a plurality of independent devices.
In the above embodiments, the hardware unit may be implemented mechanically or electrically. For example, a hardware unit or processor may comprise permanently dedicated circuitry or logic (such as a dedicated processor, FPGA or ASIC) to perform the corresponding operations. The hardware units or processors may also include programmable logic or circuitry (e.g., a general purpose processor or other programmable processor) that may be temporarily configured by software to perform the corresponding operations. The specific implementation (mechanical, or dedicated permanent, or temporarily set) may be determined based on cost and time considerations.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (13)

1. A method of PTP based clock identification, the method comprising: receiving a PTP message sent by a master clock; characterized in that the method further comprises:
determining a first frequency stability of the master clock according to the PTP message, wherein the first frequency stability is information which is carried in the PTP message and is used for representing the frequency stability of the master clock;
determining a second frequency stability according to the PTP message, wherein the second frequency stability is determined based on the actual frequency of the master clock;
judging whether the deviation between the first frequency stability and the second frequency stability meets a preset condition or not;
and if so, taking the master clock as a synchronizable clock.
2. The method of claim 1, further comprising:
if the judgment result is negative, at least one of the following operations is adopted:
the first operation is as follows: discarding the PTP message;
the second operation is as follows: sending out an alarm;
the third operation: recording;
a fourth operation: the priority of the master clock is lowered.
3. The method according to claim 1, wherein the preset condition is: i K s |<|K m |+|K s (max) |, where k m Representing a first degree of frequency stability, K s Representing a second degree of frequency stability, K s (max) is a preset maximum frequency stability of the master clock.
4. The method of claim 3,
Figure FDA0003149325370000011
wherein, the first and the second end of the pipe are connected with each other,<syncEventIngressTimestamp> N+1 a timestamp representing the N +1 st PTP message used to determine the first frequency stability,<syncEventIngressTimestamp> 1 a timestamp representing the 1 st PTP message used to determine the first frequency stability,<correctedMasterEventTimestamp> N+1 represents the sum of the timestamp carried in the (N + 1) th PTP message used for determining the first frequency stability and the delay time for transmitting the (N + 1) th PTP message,<correctedMasterEventTimestamp> 1 and the sum of a timestamp carried in the 1 st PTP message for determining the first frequency stability and the delay time for transmitting the 1 st PTP message is represented, wherein N is a positive integer greater than or equal to 1.
5. The method of claim 1,
determining the first frequency stability of the master clock according to the PTP message includes: using a PTP variance of the master clock of the PTP message as the first frequency stability;
determining the second frequency stability according to the PTP message includes: determining the actual PTP variance of the master clock according to the received time stamp in the PTP message as the second frequency stability;
the preset condition is σ sm < c, where σ s Representing a second degree of frequency stability, σ m Representing a first frequency stability and c representing a preset deviation ratio.
6. The method of claim 5,
Figure FDA0003149325370000021
wherein N represents the total sampling number of the PTP messages, k represents the kth message in the N PTP messages, and x k Is shown at time t k Time difference measurement, x, between the master clock that is done at the moment and the slave clock that receives the PTP message k+1 Is shown at time t k Time difference measurement, x, between the master clock finished at + τ and the slave clock receiving the PTP message k+2 Is shown at time t k And measuring the time difference between the master clock finished at the moment of +2 tau and the slave clock receiving the PTP message, wherein tau is a sampling period.
7. A PTP-based clock identification apparatus, the apparatus comprising:
the receiving unit is used for receiving a PTP message sent by a master clock;
characterized in that, the device still includes:
a first determining unit, configured to determine a first frequency stability of the master clock according to the PTP message, where the first frequency stability is information carried in the PTP message and used to indicate the frequency stability of the master clock;
a second determining unit, configured to determine a second frequency stability according to the PTP message, where the second frequency stability is determined based on an actual frequency of the master clock;
a judging unit, configured to judge whether a deviation between the first frequency stability and the second frequency stability satisfies a preset condition, and if the judgment result is yes, trigger a third determining unit;
the third determining unit is configured to use the master clock as a synchronizable clock.
8. The apparatus of claim 7, wherein the preset condition is: i K s |<|K m |+|K s (max) |, where K m Representing a first degree of frequency stability, K s Representing a second degree of frequency stability, K s (max) is a preset maximum frequency stability of the master clock.
9. The apparatus of claim 8,
Figure FDA0003149325370000022
wherein the content of the first and second substances,<syncEventIngressTimestamp> N+1 a timestamp representing the received N +1 st PTP message used to determine the first frequency stability,<syncEventIngressTimestamp> 1 a timestamp representing the received 1 st PTP message used to determine the first frequency stability,<correctedMasterEventTimestamp> N+1 indicating the sum of the timestamp carried in the received (N + 1) th PTP message for determining the first frequency stability and the delay time for transmitting the (N + 1) th PTP message,<correctedMasterEventTimestamp> 1 and the sum of a timestamp carried in the 1 st PTP message used for determining the first frequency stability and the delay time for transmitting the 1 st PTP message is represented, wherein N is a positive integer greater than or equal to 1.
10. The apparatus of claim 7,
the first determining unit is specifically configured to: using a PTP variance of the master clock of the PTP message as the first frequency stability;
the second determining unit is specifically configured to: determining the actual PTP variance of the master clock as the second frequency stability according to the timestamp of the received PTP message; the preset condition is σ sm < c, where σ s Representing a second degree of frequency stability, σ m Representing a first frequency stability and c representing a preset deviation ratio.
11. The apparatus of claim 10,
Figure FDA0003149325370000031
wherein N represents the acquisition of the PTP messageThe total number of samples, k represents the kth message in the N PTP messages, x k Is shown at time t k Time difference measurement, x, between the master clock that is done at the moment and the slave clock that receives the PTP message k+1 Is shown at time t k Time difference measurement, x, between the master clock finished at + τ and the slave clock receiving the PTP message k+2 Is shown at time t k And measuring the time difference between the master clock finished at the moment of +2 tau and the slave clock receiving the PTP message, wherein tau is a sampling period.
12. An apparatus for PTP-based clock identification, comprising:
at least one memory for storing instructions;
at least one processor configured to perform the method of PTP based clock identification of any one of claims 1-6 in accordance with instructions stored by the memory.
13. Readable storage medium having stored therein machine readable instructions which, when executed by a machine, perform a method of PTP based clock identification according to any one of claims 1-6.
CN202110761811.3A 2021-07-06 2021-07-06 Clock identification method and device based on PTP Active CN113328823B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110761811.3A CN113328823B (en) 2021-07-06 2021-07-06 Clock identification method and device based on PTP

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110761811.3A CN113328823B (en) 2021-07-06 2021-07-06 Clock identification method and device based on PTP

Publications (2)

Publication Number Publication Date
CN113328823A CN113328823A (en) 2021-08-31
CN113328823B true CN113328823B (en) 2022-10-14

Family

ID=77425774

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110761811.3A Active CN113328823B (en) 2021-07-06 2021-07-06 Clock identification method and device based on PTP

Country Status (1)

Country Link
CN (1) CN113328823B (en)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102480350B (en) * 2010-11-29 2014-10-15 北京中和威软件有限公司 Method and device for time synchronization and maintaining based on frequency deviation estimation
CN102185686B (en) * 2011-05-16 2016-09-21 南京中兴软件有限责任公司 Method and the network equipment of frequency is adjusted based on IEEE 1588 agreement
CN102546071B (en) * 2011-12-23 2014-08-13 北京北方烽火科技有限公司 Clock synchronization method and system
CN103209069A (en) * 2013-05-07 2013-07-17 浙江赛思电子科技有限公司 Time synchronization device and method based on precise time protocol
US9819541B2 (en) * 2015-03-20 2017-11-14 Cisco Technology, Inc. PTP over IP in a network topology with clock redundancy for better PTP accuracy and stability

Also Published As

Publication number Publication date
CN113328823A (en) 2021-08-31

Similar Documents

Publication Publication Date Title
EP2683110B1 (en) Synchronization system, synchronization method, first synchronization device, second synchronization device, and computer program
KR102031268B1 (en) Method and apparatus for communicating time information between time-aware devices
CN103563287B (en) Synchronization device and synchronization method
CN109669899B (en) Method for adaptively adjusting serial port communication baud rate and serial port device
US10958367B2 (en) Network apparatus and clock synchronization method
EP1961186B1 (en) Using travel-time as means for improving the accuracy of simple network time protocol
EP2811672A1 (en) Communication apparatus, communication system, and communication method for time synchronization
CN110133998B (en) Method for preventing duration time synchronization attack
JP2007174681A (en) Method and system for correcting inaccurate time synchronization caused by internal asymmetric delay in device
CN111984059B (en) PPS (polyphenylene sulfide) jump detection method and system for timing by time service module
US9401856B2 (en) Latency monitoring function
CN104660359A (en) Clock frequency offset detection method, device and equipment
CN103647614A (en) Method for reliably improving time synchronization precision based on IEEE1588 protocol
CN112395231B (en) Method and device for calculating data delay time among multiple processors
CN113328823B (en) Clock identification method and device based on PTP
US20110016232A1 (en) Time stamping apparatus and method for network timing synchronization
JP2009199139A (en) Packet monitor
WO2017000480A1 (en) Time synchronization method, server and system, and storage medium
CN112564883B (en) Time synchronization apparatus, method and automatic driving system
CN112702231A (en) Network delay measuring method and system
CN113572556A (en) Time synchronization method, sensor and system
CN105207768B (en) Router side access equipment and the inconsistent based reminding method of internet time and system
CN114157377B (en) Power distribution terminal real-time clock synchronization method, synchronization system and power distribution terminal
CN113055113A (en) Clock time synchronization method, device, equipment and storage medium
KR101965932B1 (en) UTC Time Synchronization Method for a Device using GPS Module

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