WO2023098683A1 - 一种配电终端实时时钟同步方法、同步系统及配电终端 - Google Patents

一种配电终端实时时钟同步方法、同步系统及配电终端 Download PDF

Info

Publication number
WO2023098683A1
WO2023098683A1 PCT/CN2022/135148 CN2022135148W WO2023098683A1 WO 2023098683 A1 WO2023098683 A1 WO 2023098683A1 CN 2022135148 W CN2022135148 W CN 2022135148W WO 2023098683 A1 WO2023098683 A1 WO 2023098683A1
Authority
WO
WIPO (PCT)
Prior art keywords
clock
message
queuing delay
offset
power distribution
Prior art date
Application number
PCT/CN2022/135148
Other languages
English (en)
French (fr)
Inventor
张伟堂
赖奎
武建平
潘松波
胡泰
杨玺
徐伟斌
麦远超
吴力科
Original Assignee
广东电网有限责任公司江门供电局
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 广东电网有限责任公司江门供电局 filed Critical 广东电网有限责任公司江门供电局
Publication of WO2023098683A1 publication Critical patent/WO2023098683A1/zh

Links

Images

Classifications

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

Definitions

  • the invention relates to the technical field of power system time synchronization, in particular to a method for synchronizing a real-time clock of a power distribution terminal, a synchronization system and a power distribution terminal.
  • the feeder automation technology is an important part of the distribution automation system, which can complete the self-healing function of the distribution network only through the fault information interaction between the distribution terminals. This technology often requires each power distribution terminal to have a high time accuracy, generally reaching about 10us, and some may require reaching 0.1us.
  • the traditional clock synchronization technology generally uses the network protocol NTP, which can provide a time synchronization accuracy of 1-50ms.
  • NTP network protocol
  • the IEEE1588 protocol that is, the PTP protocol
  • the invention provides a real-time clock synchronization method for a power distribution terminal, a synchronization system and a power distribution terminal, and solves the technical problem of high-precision clock synchronization of the power distribution terminal.
  • the first aspect of the present invention provides a method for synchronizing a real-time clock of a power distribution terminal.
  • the power distribution terminal has a slave clock, and the power distribution terminal is connected to a server with a master clock.
  • the method includes:
  • the power distribution terminal and the server interact with the master-slave clock synchronization message based on the PTP protocol to obtain the corresponding time stamp information;
  • the power distribution terminal calculates a clock offset and a fixed offset based on the system symmetry assumption according to the timestamp information
  • the power distribution terminal calculates the corresponding normalized forward queuing delay and normalized reverse queuing delay according to the time stamp of the master clock and the time stamp of the slave clock of the current message, and according to the normalized forward queuing delay To the queuing delay and the normalized reverse queuing delay, the corresponding clock instantaneous asymmetry compensation offset of the current message is obtained, and the exponentially weighted moving average processing is performed on the clock instantaneous asymmetry compensation offset to obtain the current message's Clock skew compensation;
  • the power distribution terminal calculates a total clock offset value according to the clock offset, the fixed offset and the clock offset compensation
  • the power distribution terminal corrects the synchronization between the slave clock and the master clock according to the total clock offset value.
  • the power distribution terminal and the server interact with the master-slave clock synchronization message based on the PTP protocol to obtain corresponding timestamp information, including:
  • the power distribution terminal receives the synchronization information message and the additional information message sent by the server, and the additional information message includes the time when the synchronization information message is sent;
  • the power distribution terminal records the time at which the synchronization information message is sent as a first timestamp, and records the time at which the synchronization information message and the additional information message are received at the power distribution terminal according to the slave clock respectively Recorded as a second timestamp and a third timestamp;
  • the power distribution terminal sends a delay request message to the server, and receives a delay response message fed back by the server based on the delay request message, and the delay response message includes the time for sending the additional information message ;
  • the power distribution terminal records the time when the additional information message is sent as a fourth time stamp.
  • the calculation of the corresponding normalized forward queuing delay and normalized reverse queuing delay includes:
  • the timestamp of the master clock and the timestamp of the slave clock are differentially processed to obtain the differential forward queuing delay and differential reverse queuing delay of the current message;
  • Extract forward samples with a capacity of N from each differential forward queuing delay and extract a forward sample with the smallest value from the forward samples, extract a reverse sample with a capacity of N from each differential reverse queuing delay, and extract from Extracting a reverse sample with the smallest value among the reverse samples;
  • the normalized forward queuing delay is obtained according to the differential forward queuing delay of the current message and the forward sample with the smallest value, and the normalized forward queuing delay is obtained according to the differential reverse queuing delay of the current message and the reverse sample with the smallest value. Unified reverse queuing delay.
  • the normalized forward queuing delay is obtained according to the differential forward queuing delay of the current message and the forward sample with the smallest value, and, according to the current message
  • the differential reverse queuing delay of the text and the reverse sample with the minimum value get the normalized reverse queuing delay, including:
  • q fn (x) represents the normalized forward queuing delay of the xth message transmission
  • q f (x) is the differential forward queuing delay of the xth message transmission
  • q f, min (x) indicates the positive sample with the smallest value
  • q rn (x) indicates the normalized reverse queuing delay when the xth message is transmitted
  • q r (x) indicates the differential reverse queuing when the xth message is transmitted Latency
  • q r, min (x) represents the reverse sample with the smallest value.
  • the corresponding clock instantaneous asymmetry compensation offset of the current message is obtained ,include:
  • ⁇ 3 (x) represents the instantaneous clock asymmetry compensation offset when the xth message is transmitted.
  • the power distribution terminal calculates a total clock offset value according to the clock offset, the fixed offset and the clock offset compensation, including:
  • the total clock offset value is calculated using the following formula:
  • ⁇ (x) represents the total clock offset value when the x-th message is transmitted
  • ⁇ 1 (x) is the clock offset when the x-th message is transmitted
  • ⁇ 2 (x) is the clock offset value of the x-th message
  • Fixed offset during file transmission is the clock offset compensation for the xth message transmission
  • is the weight, which is a hyperparameter of the exponentially weighted moving average process.
  • the second aspect of the present invention provides a power distribution terminal, the power distribution terminal is connected to a server with a master clock through a communication device, and the power distribution terminal includes a slave clock and a processor;
  • the processor is set to:
  • the timestamp of the master clock and the timestamp of the slave clock of the current message calculate the corresponding normalized forward queuing delay and normalized reverse queuing delay, according to the normalized forward queuing delay and normalized Unifying the reverse queuing delay to obtain the clock instantaneous asymmetry compensation offset of the corresponding current message, and performing exponential weighted moving average processing on the clock instantaneous asymmetry compensation offset to obtain the clock offset compensation of the current message;
  • the processor when the master-slave clock synchronization message based on the PTP protocol is interacted with the server to obtain corresponding timestamp information, the processor is specifically set to:
  • the server receiving a synchronization information message and an additional information message sent by the server, where the additional information message includes the time when the synchronization information message is sent;
  • the processor when calculating the corresponding normalized forward queuing delay and normalized reverse queuing delay, is specifically configured to:
  • Extract forward samples with a capacity of N from each differential forward queuing delay and extract a forward sample with the smallest value from the forward samples, extract a reverse sample with a capacity of N from each differential reverse queuing delay, and extract from Extracting a reverse sample with the smallest value among the reverse samples;
  • the normalized forward queuing delay is obtained according to the differential forward queuing delay of the current message and the forward sample with the smallest value, and the normalized forward queuing delay is obtained according to the differential reverse queuing delay of the current message and the reverse sample with the smallest value. Unified reverse queuing delay.
  • the normalized forward queuing delay is obtained according to the differential forward queuing delay of the current message and the forward sample with the smallest value, and, according to the current message
  • the differential inverse queuing delay and the inverse sample with the smallest value get the normalized inverse queuing delay when the processor is specifically set to:
  • q fn (x) represents the normalized forward queuing delay of the xth message transmission
  • q f (x) is the differential forward queuing delay of the xth message transmission
  • q f, min (x) indicates the positive sample with the smallest value
  • q rn (x) indicates the normalized reverse queuing delay when the xth message is transmitted
  • q r (x) indicates the differential reverse queuing when the xth message is transmitted Latency
  • q r, min (x) represents the reverse sample with the smallest value.
  • the processor when the instantaneous clock asymmetry compensation offset of the corresponding current message is obtained according to the normalized forward queuing delay and the normalized reverse queuing delay , the processor is specifically set to:
  • ⁇ 3 (x) represents the instantaneous clock asymmetry compensation offset when the xth message is transmitted.
  • the processor when calculating the total clock offset value according to the clock offset, the fixed offset and the clock offset compensation, the processor is specifically configured to :
  • the total clock offset value is calculated using the following formula:
  • ⁇ (x) represents the total clock offset value when the x-th message is transmitted
  • ⁇ 1 (x) is the clock offset when the x-th message is transmitted
  • ⁇ 2 (x) is the clock offset value of the x-th message
  • Fixed offset during file transmission is the clock offset compensation for the xth message transmission
  • is the weight, which is a hyperparameter of the exponentially weighted moving average process.
  • a third aspect of the present invention provides a real-time clock synchronization system for a power distribution terminal, including a server with a master clock and the power distribution terminal described in a manner that can be realized by any one of the above items.
  • the present invention has the following advantages:
  • the power distribution terminal and the server interact with the master-slave clock synchronization message based on the PTP protocol, obtain the corresponding timestamp information, calculate the clock offset and fixed offset based on the system symmetry assumption, and further calculate the clock instantaneous Asymmetric compensation offset, by performing exponentially weighted moving average processing on the instantaneous asymmetric compensation offset of the clock, to obtain the clock offset compensation of the current message, and by compensating the obtained clock offset, fixed offset and clock offset Calculate the total clock offset value, and then correct the synchronization between the slave clock of the power distribution terminal and the master clock of the server according to the total clock offset value; the present invention improves the accuracy of time synchronization based on the PTP protocol, and solves the high Technical issues of precision clock synchronization.
  • Fig. 1 is the flowchart of the automatic scheduling method of a kind of smart card testing platform that an optional embodiment of the present invention provides;
  • Fig. 2 is a schematic diagram of a synchronization process of a PTP protocol master clock and a slave clock node provided by an optional embodiment of the present invention.
  • Fig. 3 is a schematic diagram of a clock synchronization process based on a synchronization system deviation analysis provided by an optional embodiment of the present invention.
  • Embodiments of the present invention provide a method for synchronizing a real-time clock of a power distribution terminal, a synchronization system and a power distribution terminal, which are used to solve the technical problem of high-precision clock synchronization of the power distribution terminal.
  • An embodiment of the present invention provides a method for synchronizing a real-time clock of a power distribution terminal.
  • FIG. 1 shows a flowchart of a method for synchronizing a real-time clock of a power distribution terminal according to an embodiment of the present invention.
  • the power distribution terminal has a slave clock, and the power distribution terminal is connected to a server with a master clock.
  • the server can connect multiple power distribution terminals through routers and switches to form a power distribution network topology.
  • the server sends relevant time synchronization messages to the customer nodes that need time synchronization, that is, the power distribution terminal, and the customer nodes periodically interact with the server nodes for time synchronization messages.
  • PTP time synchronization messages need to be encapsulated into UDP/IP packets before they can be transmitted on the network.
  • a method for synchronizing a real-time clock of a power distribution terminal includes steps S1-S5.
  • step S1 the power distribution terminal and the server exchange time synchronization messages of master-slave clocks based on the PTP protocol to obtain corresponding time stamp information.
  • the power distribution terminal and the server interact with the master-slave clock synchronization message based on the PTP protocol to obtain corresponding timestamp information, including:
  • the power distribution terminal receives the synchronization information message and the additional information message sent by the server, and the additional information message includes the time when the synchronization information message is sent;
  • the power distribution terminal records the time at which the synchronization information message is sent as a first timestamp, and records the time at which the synchronization information message and the additional information message are received at the power distribution terminal according to the slave clock respectively Recorded as a second timestamp and a third timestamp;
  • the power distribution terminal sends a delay request message to the server, and receives a delay response message fed back by the server based on the delay request message, and the delay response message includes the time for sending the additional information message ;
  • the power distribution terminal records the time when the additional information message is sent as a fourth time stamp.
  • the embodiment of the present invention defines 4 kinds of message formats, which are respectively synchronous information message (Sync message), additional information message (FollowUp message), delay request message (DelayReq message) and delay response message (DelayResp message). message).
  • the Sync message is a periodic message sent by the master clock at regular intervals, which includes the estimated sending time of the message.
  • the sending interval is generally 2s. If the interval is too short, the network burden will be heavy, and if the interval is too long, the synchronization accuracy will be affected. Since the precise time of time transmission cannot be exactly the same as the expected time, the FollowUp message is further defined to solve this problem.
  • the FollowUp message contains the precise time when the Sync message is actually sent, that is, the first timestamp.
  • Step S2 the power distribution terminal calculates a clock offset and a fixed offset based on the system symmetry assumption according to the time stamp information.
  • the synchronization process of the master clock and the slave clock node of the PTP protocol mainly includes two stages: the stage of calculating the clock offset and the stage of calculating the line delay.
  • the clock offset represents the clock offset of the nodes in the master-slave mode. Due to the influence of network delay, especially the delivery delay of data messages, the clock offset calculated by transmitting a synchronization message is not accurate, and the line delay needs to be calculated to correct it. .
  • the first time stamp be T m1
  • the time stamp that is, the second time stamp
  • T s1 the time stamp at which the slave clock receives the synchronization information message at the power distribution terminal
  • T offset represents the clock offset
  • T delay represents the line delay
  • the power distribution terminal will randomly delay for a period of time after receiving the Sync message, and then send a delay request message to the main clock, and the following formula is obtained:
  • T s2 is the third time stamp
  • T m2 is the fourth time stamp
  • the calculation principle of the line delay is analyzed.
  • the process is as follows: During the PTP synchronization process, the delayed request message and The additional information message is not sent immediately when the slave clock receives the additional information message, but is sent after a delay for a period of time.
  • the process is shown in Figure 3. Record this period of time as T sq , and record the local timing value of the master clock as T mq during this period of time, it can be deduced that:
  • T s1x is the second timestamp of the xth synchronization
  • T m1x is the first timestamp of the xth synchronization
  • T m2x is the fourth timestamp of the xth synchronization
  • T s2x is the xth synchronization
  • step S3 the embodiment of the present invention continues to execute step S3 to calculate clock offset compensation.
  • Step S3 the power distribution terminal calculates the corresponding normalized forward queuing delay and normalized reverse queuing delay according to the time stamp of the master clock and the time stamp of the slave clock of the current message, according to the normalized
  • the normalized forward queuing delay and the normalized reverse queuing delay are used to obtain the corresponding instantaneous clock asymmetry compensation offset of the current message, and the exponentially weighted moving average processing is performed on the clock instantaneous asymmetry compensation offset to obtain the current Packet clock offset compensation.
  • the calculation of the corresponding normalized forward queuing delay and normalized reverse queuing delay includes:
  • Extract forward samples with a capacity of N from each differential forward queuing delay and extract a forward sample with the smallest value from the forward samples, extract a reverse sample with a capacity of N from each differential reverse queuing delay, and extract from Extracting a reverse sample with the smallest value among the reverse samples;
  • the normalized forward queuing delay is obtained according to the differential forward queuing delay of the current message and the forward sample with the smallest value, and the normalized forward queuing delay is obtained according to the differential reverse queuing delay of the current message and the reverse sample with the smallest value. Unified reverse queuing delay.
  • m(t) represents the generalized clock skew equation
  • represents the skew degree coefficient
  • represents the time offset of the slave clock.
  • d f and q f are the forward physical link delay and forward queuing delay respectively
  • d r and q r are the reverse physical link delay and reverse queuing delay respectively.
  • the normalized forward queuing delay is obtained according to the differential forward queuing delay of the current message and the forward sample with the smallest value
  • the reverse queuing is obtained according to the differential forward queuing delay of the current message
  • the inverse sample with the smallest delay and stated value yields a normalized inverse queuing delay consisting of:
  • q fn (x) represents the normalized forward queuing delay of the xth message transmission
  • q f (x) is the differential forward queuing delay of the xth message transmission
  • q f, min (x) indicates the positive sample with the smallest value
  • q rn (x) indicates the normalized reverse queuing delay when the xth message is transmitted
  • q r (x) indicates the differential reverse queuing when the xth message is transmitted Latency
  • q r, min (x) represents the reverse sample with the smallest value.
  • the corresponding instantaneous clock asymmetry compensation offset of the current message is obtained according to the normalized forward queuing delay and the normalized reverse queuing delay, including:
  • ⁇ 3 (x) represents the instantaneous clock asymmetry compensation offset when the xth message is transmitted.
  • Step S4 the power distribution terminal calculates a total clock offset value according to the clock offset, the fixed offset and the clock offset compensation.
  • Step S5 the power distribution terminal corrects the synchronization between the slave clock and the master clock according to the total clock offset value.
  • the power distribution terminal calculates a total clock offset value according to the clock offset, the fixed offset and the clock offset compensation, including:
  • the total clock offset value is calculated using the following formula:
  • ⁇ (x) represents the total clock offset value when the x-th message is transmitted
  • ⁇ 1 (x) is the clock offset when the x-th message is transmitted
  • ⁇ 2 (x) is the clock offset value of the x-th message
  • Fixed offset during file transmission is the clock offset compensation for the xth message transmission
  • is the weight, which is a hyperparameter of the exponentially weighted moving average process.
  • the setting value of ⁇ can be determined according to the following methods:
  • ⁇ 1 (x) T m1 (x)+T m2 (x)- ⁇ (x)[T s1 (x)+T s2 (x)]
  • T m1 (x) is the first time stamp when the xth message is transmitted
  • T m2 (x) is the fourth time stamp when the xth message is transmitted
  • ⁇ (x) is the time stamp corresponding to the xth time
  • T s1 (x) is the second time stamp when the xth message is transmitted
  • T s2 (x) is the third time stamp when the xth message is transmitted.
  • the present invention also provides a power distribution terminal, which is connected to a server with a master clock through a communication device.
  • a power distribution terminal provided by an embodiment of the present invention includes a slave clock and a processor
  • the processor is set to:
  • the timestamp of the master clock and the timestamp of the slave clock of the current message calculate the corresponding normalized forward queuing delay and normalized reverse queuing delay, according to the normalized forward queuing delay and normalized Unifying the reverse queuing delay to obtain the clock instantaneous asymmetry compensation offset of the corresponding current message, and performing exponential weighted moving average processing on the clock instantaneous asymmetry compensation offset to obtain the clock offset compensation of the current message;
  • the processor is specifically set to:
  • the server receiving a synchronization information message and an additional information message sent by the server, where the additional information message includes the time when the synchronization information message is sent;
  • the processor when calculating the corresponding normalized forward queuing delay and normalized reverse queuing delay, is specifically configured to:
  • Extract forward samples with a capacity of N from each differential forward queuing delay and extract a forward sample with the smallest value from the forward samples, extract a reverse sample with a capacity of N from each differential reverse queuing delay, and extract from Extracting a reverse sample with the smallest value among the reverse samples;
  • the normalized forward queuing delay is obtained according to the differential forward queuing delay of the current message and the forward sample with the smallest value, and the normalized forward queuing delay is obtained according to the differential reverse queuing delay of the current message and the reverse sample with the smallest value. Unified reverse queuing delay.
  • the processor is specifically set to:
  • q fn (x) represents the normalized forward queuing delay of the xth message transmission
  • q f (x) is the differential forward queuing delay of the xth message transmission
  • q f, min (x) indicates the positive sample with the smallest value
  • q rn (x) indicates the normalized reverse queuing delay when the xth message is transmitted
  • q r (x) indicates the differential reverse queuing when the xth message is transmitted Latency
  • q r, min (x) represents the reverse sample with the smallest value.
  • the processor when the corresponding clock instantaneous asymmetry compensation offset of the current message is obtained according to the normalized forward queuing delay and the normalized reverse queuing delay, the processor is specifically set to:
  • ⁇ 3 (x) represents the instantaneous clock asymmetry compensation offset when the xth message is transmitted.
  • the processor when calculating the total clock offset value according to the clock offset, the fixed offset and the clock offset compensation, the processor is specifically configured to:
  • the total clock offset value is calculated using the following formula:
  • ⁇ (x) represents the total clock offset value when the x-th message is transmitted
  • ⁇ 1 (x) is the clock offset when the x-th message is transmitted
  • ⁇ 2 (x) is the clock offset value of the x-th message
  • Fixed offset during file transmission is the clock offset compensation for the xth message transmission
  • is the weight, which is a hyperparameter of the exponentially weighted moving average process.
  • the present invention also provides a real-time clock synchronization system for a power distribution terminal, which includes a server with a master clock and the power distribution terminal described in a manner that can be realized by any one of the above items.
  • the accurate time estimation of the traditional power distribution terminal site is based on the assumption that the forward and backward delays of the physical propagation time of the network are equal.
  • the total clock offset value is composed of three parts: original offset, fixed offset and compensation offset.
  • the original offset and fixed offset are obtained through the system symmetry assumption and the PTP protocol, and the compensation offset adopts the above-mentioned improvement.
  • the method of the embodiment of the present invention has better effects on path delay and clock offset, improves the accuracy of time synchronization through the IEEE1588 protocol, and is expected to reach us and ns levels
  • the time synchronization accuracy provides a good guarantee for real-time monitoring of distribution network faults.
  • the method of the embodiment of the present invention can also obtain a better time synchronization scheme for complex distribution networks.

Landscapes

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

Abstract

一种配电终端实时时钟同步方法、同步系统及配电终端,涉及电力系统时间同步技术领域,配电终端与服务器进行基于PTP协议的主从时钟对时报文交互,获取对应的时间戳信息,基于系统对称性假设计算时钟偏移和固定偏移,并进一步计算时钟瞬时不对称补偿偏移,通过对所述时钟瞬时不对称补偿偏移进行指数加权移动平均处理,得到当前报文的时钟偏移补偿,通过对得到的时钟偏移、固定偏移和时钟偏移补偿计算总时钟偏移值,再根据所述总时钟偏移值校正配电终端的从时钟与服务器的主时钟同步,提高了基于PTP协议进行对时的精度,解决了配电终端的高精度时钟同步的技术问题。

Description

一种配电终端实时时钟同步方法、同步系统及配电终端
本申请要求于2021年11月30日提交中国专利局、申请号为202111447474.7、发明名称为“一种配电终端实时时钟同步方法、同步系统及配电终端”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及电力系统时间同步技术领域,尤其涉及一种配电终端实时时钟同步方法、同步系统及配电终端。
背景技术
馈线自动化技术是配电自动化系统的重要组成部分,其仅通过配电终端间的故障信息交互即可完成配电网的自愈功能。这种技术往往需要各配电终端具备较高的时间精度,一般要达到10us左右,有些可能要求达到0.1us。
传统的时钟同步技术一般采用网络协议NTP,该技术可以提供1-50ms的对时精度。相比于NTP,IEEE1588协议(即PTP协议)可以达到更高的时钟同步精度。如何在智能配电网中引进IEEE1588对时技术以及如何使得配电终端的对时精度得到进一步提高成为当下的研究重点。
发明内容
本发明提供了一种配电终端实时时钟同步方法、同步系统及配电终端,解决了配电终端的高精度时钟同步的技术问题。
本发明第一方面提供一种配电终端实时时钟同步方法,所述配电终端具有从时钟,所述配电终端连接至具有主时钟的服务器,所述方法包括:
配电终端与服务器进行基于PTP协议的主从时钟对时报文交互,获取对应的时间戳信息;
所述配电终端根据所述时间戳信息,基于系统对称性假设计算时钟偏移和固定偏移;
所述配电终端根据当前报文的主时钟的时间戳和从时钟的时间戳,计算对应的归一化的正向排队延迟和归一化的逆向排队延迟,根据所述归一化的正向排队延迟和归一化的逆向排队延迟,得到对应的当前报文的时钟瞬时不对称补偿偏移,并对所述时钟瞬时不对称补偿偏移进行指数加权移动平均处理,得到当前报文的时钟偏移补偿;
所述配电终端根据所述时钟偏移、所述固定偏移和所述时钟偏移补偿计算总时钟偏移值;
所述配电终端根据所述总时钟偏移值校正所述从时钟与所述主时钟同步。
根据本发明第一方面的一种能够实现的方式,所述配电终端与服务器进行基于PTP协议的主从时钟对时报文交互,获取对应的时间戳信息,包括:
所述配电终端接收所述服务器发送的同步信息报文及附加信息报文,所述附加信息报文包括发送所述同步信息报文的时间;
所述配电终端将所述发送所述同步信息报文的时间记录为第一时间戳,将根据从时钟在所述配电终端处接收所述同步信息报文及附加信息报文的时间分别记录为第二时间戳和第三时间戳;
所述配电终端向所述服务器发送延迟请求报文,并接收所述服务器基于所述延迟请求报文反馈的延迟响应报文,所述延迟响应报文包括发送所述附加信息报文的时间;
所述配电终端将所述发送所述附加信息报文的时间记录为第四时间戳。
根据本发明第一方面的一种能够实现的方式,所述计算对应的归一化的正向排队延迟和归一化的逆向排队延迟,包括:
根据广义时钟偏移方程得到所述当前报文的主时钟的时间戳和从时钟的时间戳;
对所述主时钟的时间戳和从时钟的时间戳进行差分处理,得到当前报 文的差分正向排队延迟和差分逆向排队延迟;
从各差分正向排队延迟中抽取容量为N的正向样本,并从所述正向样本中抽取值最小的正向样本,从各差分逆向排队延迟中抽取容量为N的逆向样本,并从所述逆向样本中抽取值最小的逆向样本;
根据当前报文的差分正向排队延迟和所述值最小的正向样本得到归一化的正向排队延迟,以及,根据当前报文的差分逆向排队延迟和所述值最小的逆向样本得到归一化的逆向排队延迟。
根据本发明第一方面的一种能够实现的方式,所述根据当前报文的差分正向排队延迟和所述值最小的正向样本得到归一化的正向排队延迟,以及,根据当前报文的差分逆向排队延迟和所述值最小的逆向样本得到归一化的逆向排队延迟,包括:
根据下式计算所述归一化的正向排队延迟和所述归一化的逆向排队延迟:
Figure PCTCN2022135148-appb-000001
式中,q fn(x)表示第x次报文传输时的归一化的正向排队延迟,q f(x)为第x次报文传输时的差分正向排队延迟,q f,min(x)表示值最小的正向样本,q rn(x)表示第x次报文传输时的归一化的逆向排队延迟,q r(x)表示第x次报文传输时的差分逆向排队延迟,q r,min(x)表示值最小的逆向样本。
根据本发明第一方面的一种能够实现的方式,所述根据所述归一化的正向排队延迟和归一化的逆向排队延迟,得到对应的当前报文的时钟瞬时不对称补偿偏移,包括:
根据下式计算对应的当前报文的时钟瞬时不对称补偿偏移:
Figure PCTCN2022135148-appb-000002
式中,δ 3(x)表示第x次报文传输时的时钟瞬时不对称补偿偏移。
根据本发明第一方面的一种能够实现的方式,所述配电终端根据所述 时钟偏移、所述固定偏移和所述时钟偏移补偿计算总时钟偏移值,包括:
采用下式计算所述总时钟偏移值:
Figure PCTCN2022135148-appb-000003
其中
Figure PCTCN2022135148-appb-000004
式中,δ(x)表示第x次报文传输时的总时钟偏移值,δ 1(x)为第x次报文传输时的时钟偏移,δ 2(x)为第x次报文传输时的固定偏移,
Figure PCTCN2022135148-appb-000005
为第x次报文传输时的时钟偏移补偿,
Figure PCTCN2022135148-appb-000006
为第x-1次报文传输时的时钟偏移补偿,β为权重,其是指数加权移动平均处理过程的一个超参数。
本发明第二方面提供一种配电终端,所述配电终端通过通信设备连接具有主时钟的服务器,所述配电终端包括从时钟以及处理器;
所述处理器被设置成:
与所述服务器进行基于PTP协议的主从时钟对时报文交互,获取对应的时间戳信息;
根据所述时间戳信息,基于系统对称性假设计算时钟偏移和固定偏移;
根据当前报文的主时钟的时间戳和从时钟的时间戳,计算对应的归一化的正向排队延迟和归一化的逆向排队延迟,根据所述归一化的正向排队延迟和归一化的逆向排队延迟,得到对应的当前报文的时钟瞬时不对称补偿偏移,并对所述时钟瞬时不对称补偿偏移进行指数加权移动平均处理,得到当前报文的时钟偏移补偿;
根据所述时钟偏移、所述固定偏移和所述时钟偏移补偿计算总时钟偏移值;
根据所述总时钟偏移值校正所述从时钟与所述主时钟同步;
根据本发明第二方面的一种能够实现的方式,当与服务器进行基于PTP协议的主从时钟对时报文交互,获取对应的时间戳信息时,所述处理器被具体设置成:
接收所述服务器发送的同步信息报文及附加信息报文,所述附加信息报文包括发送所述同步信息报文的时间;
将所述发送所述同步信息报文的时间记录为第一时间戳,将根据从时钟接收到的所述同步信息报文及附加信息报文的时间分别记录为第二时间戳和第三时间戳;
向所述服务器发送延迟请求报文,并接收所述服务器基于所述延迟请求报文反馈的延迟响应报文,所述延迟响应报文包括发送所述附加信息报文的时间;
将所述发送所述附加信息报文的时间记录为第四时间戳。
根据本发明第二方面的一种能够实现的方式,当计算对应的归一化的正向排队延迟和归一化的逆向排队延迟时,所述处理器被具体设置成:
根据广义时钟偏移方程得到所述当前报文的主时钟的时间戳和从时钟的时间戳;
对所述主时钟的时间戳和从时钟的时间戳进行差分处理,得到当前报文的差分正向排队延迟和差分逆向排队延迟;
从各差分正向排队延迟中抽取容量为N的正向样本,并从所述正向样本中抽取值最小的正向样本,从各差分逆向排队延迟中抽取容量为N的逆向样本,并从所述逆向样本中抽取值最小的逆向样本;
根据当前报文的差分正向排队延迟和所述值最小的正向样本得到归一化的正向排队延迟,以及,根据当前报文的差分逆向排队延迟和所述值最小的逆向样本得到归一化的逆向排队延迟。
根据本发明第二方面的一种能够实现的方式,当根据当前报文的差分正向排队延迟和所述值最小的正向样本得到归一化的正向排队延迟,以及,根据当前报文的差分逆向排队延迟和所述值最小的逆向样本得到归一化的逆向排队延迟时,所述处理器被具体设置成:
根据下式计算所述归一化的正向排队延迟和所述归一化的逆向排队延迟:
Figure PCTCN2022135148-appb-000007
式中,q fn(x)表示第x次报文传输时的归一化的正向排队延迟,q f(x)为 第x次报文传输时的差分正向排队延迟,q f,min(x)表示值最小的正向样本,q rn(x)表示第x次报文传输时的归一化的逆向排队延迟,q r(x)表示第x次报文传输时的差分逆向排队延迟,q r,min(x)表示值最小的逆向样本。
根据本发明第二方面的一种能够实现的方式,当根据所述归一化的正向排队延迟和归一化的逆向排队延迟,得到对应的当前报文的时钟瞬时不对称补偿偏移时,所述处理器被具体设置成:
根据下式计算对应的当前报文的时钟瞬时不对称补偿偏移:
Figure PCTCN2022135148-appb-000008
式中,δ 3(x)表示第x次报文传输时的时钟瞬时不对称补偿偏移。
根据本发明第二方面的一种能够实现的方式,当根据所述时钟偏移、所述固定偏移和所述时钟偏移补偿计算总时钟偏移值时,所述处理器被具体设置成:
采用下式计算所述总时钟偏移值:
Figure PCTCN2022135148-appb-000009
其中
Figure PCTCN2022135148-appb-000010
式中,δ(x)表示第x次报文传输时的总时钟偏移值,δ 1(x)为第x次报文传输时的时钟偏移,δ 2(x)为第x次报文传输时的固定偏移,
Figure PCTCN2022135148-appb-000011
为第x次报文传输时的时钟偏移补偿,
Figure PCTCN2022135148-appb-000012
为第x-1次报文传输时的时钟偏移补偿,β为权重,其是指数加权移动平均处理过程的一个超参数。
本发明第三方面提供一种配电终端实时时钟同步系统,包括具有主时钟的服务器以及如上任一项能够实现的方式所述的配电终端。
从以上技术方案可以看出,本发明具有以下优点:
本发明实施例中,配电终端与服务器进行基于PTP协议的主从时钟对时报文交互,获取对应的时间戳信息,基于系统对称性假设计算时钟偏移和固定偏移,并进一步计算时钟瞬时不对称补偿偏移,通过对所述时钟瞬时不对称补偿偏移进行指数加权移动平均处理,得到当前报文的时钟偏移补偿,通过对得到的时钟偏移、固定偏移和时钟偏移补偿计算总时钟偏移值,再根据所述总时钟偏移值校正配电终端的从时钟与服务器的主时钟同步;本发明提高了基于PTP协议进行对时的精度,解决了配电终端的高精度时钟同步的技术问题。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其它的附图。
图1为本发明一个可选实施例提供的一种智能卡测试平台的自动调度方法的流程图;
图2为本发明一个可选实施例提供的PTP协议主时钟和从时钟节点的同步过程示意图。
图3为本发明一个可选实施例提供的基于同步系统偏差分析的时钟同步过程示意图。
具体实施方式
本发明实施例提供了一种配电终端实时时钟同步方法、同步系统及配电终端,用于解决配电终端的高精度时钟同步的技术问题。
为使得本发明的发明目的、特征、优点能够更加的明显和易懂,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,下面所描述的实施例仅仅是本发明一部分实施例,而 非全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。
本发明实施例提供了一种配电终端实时时钟同步方法。
请参阅图1,图1示出了本发明实施例提供的一种配电终端实时时钟同步方法的流程图。
其中,该配电终端具有从时钟,所述配电终端连接至具有主时钟的服务器。该服务器可以通过路由器和交换机连接多个配电终端,从而组成配电网络拓扑结构。服务器作为主站节点,为需要对时的客户节点即配电终端发送相关对时报文,客户节点则周期性地与服务器节点进行对时报文交互。PTP对时报文需要封装成UDP/IP包之后才可以在网络中进行传输。
本发明实施例提供的一种配电终端实时时钟同步方法,包括步骤S1-S5。
步骤S1,配电终端与服务器进行基于PTP协议的主从时钟对时报文交互,获取对应的时间戳信息。
在一种能够实现的方式中,所述配电终端与服务器进行基于PTP协议的主从时钟对时报文交互,获取对应的时间戳信息,包括:
所述配电终端接收所述服务器发送的同步信息报文及附加信息报文,所述附加信息报文包括发送所述同步信息报文的时间;
所述配电终端将所述发送所述同步信息报文的时间记录为第一时间戳,将根据从时钟在所述配电终端处接收所述同步信息报文及附加信息报文的时间分别记录为第二时间戳和第三时间戳;
所述配电终端向所述服务器发送延迟请求报文,并接收所述服务器基于所述延迟请求报文反馈的延迟响应报文,所述延迟响应报文包括发送所述附加信息报文的时间;
所述配电终端将所述发送所述附加信息报文的时间记录为第四时间戳。
本发明实施例定义了4种报文格式,分别是同步信息报文(Sync报文)、附加信息报文(FollowUp报文)、延迟请求报文(DelayReq报文)和延迟响应报文(DelayResp报文)。通过该4种类型报文的交互,可以得到该第 一时间戳、第二时间戳、第三时间戳和第四时间戳。Sync报文是主时钟定时发送的周期性报文,其中包含该报文的预计发送时间,其发送间隔一般为2s,间隔太短会使网络负担严重,间隔太长会影响同步精度。由于时间发送的精确时间不可能与预计的时间完全相同,所以进一步定义FollowUp报文来解决该问题。FollowUp报文中包含了Sync报文实际发送的精确时间,即第一时间戳。
步骤S2,所述配电终端根据所述时间戳信息,基于系统对称性假设计算时钟偏移和固定偏移。
如图2所示,PTP协议主时钟和从时钟节点的同步过程主要包含两个阶段:计算时钟偏移阶段和计算线路延迟阶段。时钟偏移表示主从式中节点的时钟偏差,由于受到网络延迟,尤其是数据报文的递交延迟的影响,一次传送同步报文计算的时钟偏移并不准确,还需计算线路延迟加以修正。
具体地,设第一时间戳为T m1,从时钟在所述配电终端处接收所述同步信息报文的时间戳(即第二时间戳)为T s1,此时可得到下式:
T s1-T offset-T delay=T m1
式中,T offset表示时钟偏移,T delay表示线路延迟;
为了准确算出时钟偏移和线路延迟,配电终端在接收Sync报文后会随机延迟一段时间后向主时钟发出一个延迟请求报文,得到下式:
T s2-T offset+T delay=T m2
式中,T s2为第三时间戳,T m2为第四时间戳;
整理得到:
Figure PCTCN2022135148-appb-000013
Figure PCTCN2022135148-appb-000014
根据同步系统偏差分析,同步瞬间偏差较大的原因是由于线路延时计算不准确造成的,由此对线路延时计算原理进行分析,其过程如下:在PTP同步过程中,延迟请求报文并不是当从时钟收到附加信息报文时立刻发出, 而是延时了一段时间再发出,其过程如图3所示。将这段时间记为T sq,将主时钟在该段时间内的本地计时值记为T mq,可以推出:
Figure PCTCN2022135148-appb-000015
综合可得,第x次同步时的时钟偏移T offset,x为:
Figure PCTCN2022135148-appb-000016
式中,T s1x为第x次同步时的第二时间戳,T m1x为第x次同步时的第一时间戳,T m2x为第x次同步时的第四时间戳,T s2x为第x次同步时的第三时间戳。
以上得到的时间延迟和时间偏移值的前提条件是主时钟到从时钟和从时钟到主时钟之间的路径对称,即报文的传输延迟Delay在不同传输方向上是相同的。但这是一种理想情况,在网络上有较大的负载的情形下,这种假设很难保证。为了解决路径不对称,提高时钟同步精度的问题,本发明实施例继续执行步骤S3,以计算时钟偏移补偿。
步骤S3,所述配电终端根据当前报文的主时钟的时间戳和从时钟的时间戳,计算对应的归一化的正向排队延迟和归一化的逆向排队延迟,根据所述归一化的正向排队延迟和归一化的逆向排队延迟,得到对应的当前报文的时钟瞬时不对称补偿偏移,并对所述时钟瞬时不对称补偿偏移进行指数加权移动平均处理,得到当前报文的时钟偏移补偿。
在一种能够实现的方式中,所述计算对应的归一化的正向排队延迟和归一化的逆向排队延迟,包括:
根据广义时钟偏移方程得到所述当前报文的主时钟的时间戳和从时钟的时间戳;
对所述主时钟的时间戳和从时钟的时间戳进行差分处理,得到当前报文的差分正向排队延迟和差分逆向排队延迟;
从各差分正向排队延迟中抽取容量为N的正向样本,并从所述正向样 本中抽取值最小的正向样本,从各差分逆向排队延迟中抽取容量为N的逆向样本,并从所述逆向样本中抽取值最小的逆向样本;
根据当前报文的差分正向排队延迟和所述值最小的正向样本得到归一化的正向排队延迟,以及,根据当前报文的差分逆向排队延迟和所述值最小的逆向样本得到归一化的逆向排队延迟。
其中,设定广义时钟偏移方程为:
m(t)=αs(t)+δ
式中,m(t)表示广义时钟偏移方程,α代表歪斜程度系数,δ代表从时钟的时间偏移。
在PTP信息交换过程中会产生固定的物理链路延迟和可变排队延迟,通过该广义时钟偏移方程,可以得到所述当前报文的主时钟的时间戳和从时钟的时间戳为:
Figure PCTCN2022135148-appb-000017
式中,d f、q f分别为正向物理链路延迟和正向排队延迟,d r、q r分别为逆向物理链路延迟和逆向排队延迟。
在一种能够实现的方式中,所述根据当前报文的差分正向排队延迟和所述值最小的正向样本得到归一化的正向排队延迟,以及,根据当前报文的差分逆向排队延迟和所述值最小的逆向样本得到归一化的逆向排队延迟,包括:
根据下式计算所述归一化的正向排队延迟和所述归一化的逆向排队延迟:
Figure PCTCN2022135148-appb-000018
式中,q fn(x)表示第x次报文传输时的归一化的正向排队延迟,q f(x)为第x次报文传输时的差分正向排队延迟,q f,min(x)表示值最小的正向样本,q rn(x)表示第x次报文传输时的归一化的逆向排队延迟,q r(x)表示第x次报 文传输时的差分逆向排队延迟,q r,min(x)表示值最小的逆向样本。
在一种能够实现的方式中,所述根据所述归一化的正向排队延迟和归一化的逆向排队延迟,得到对应的当前报文的时钟瞬时不对称补偿偏移,包括:
根据下式计算对应的当前报文的时钟瞬时不对称补偿偏移:
Figure PCTCN2022135148-appb-000019
式中,δ 3(x)表示第x次报文传输时的时钟瞬时不对称补偿偏移。
步骤S4,所述配电终端根据所述时钟偏移、所述固定偏移和所述时钟偏移补偿计算总时钟偏移值。
步骤S5,所述配电终端根据所述总时钟偏移值校正所述从时钟与所述主时钟同步。
在一种能够实现的方式中,所述配电终端根据所述时钟偏移、所述固定偏移和所述时钟偏移补偿计算总时钟偏移值,包括:
采用下式计算所述总时钟偏移值:
Figure PCTCN2022135148-appb-000020
其中
Figure PCTCN2022135148-appb-000021
式中,δ(x)表示第x次报文传输时的总时钟偏移值,δ 1(x)为第x次报文传输时的时钟偏移,δ 2(x)为第x次报文传输时的固定偏移,
Figure PCTCN2022135148-appb-000022
为第x次报文传输时的时钟偏移补偿,
Figure PCTCN2022135148-appb-000023
为第x-1次报文传输时的时钟偏移补偿,β为权重,其是指数加权移动平均处理过程的一个超参数。
其中,β的设定值可以根据下列方式确定:
通过设定样本容量以及歪斜程度系数,分析在β取值不同时得到的配电终端的时间偏差和时延,并进行记录,当检测到时间偏差和时延小于记录值时,取得β值。
其中,结合所述当前报文的主时钟的时间戳和从时钟的时间戳的表达式可得到:
δ 1(x)=T m1(x)+T m2(x)-α(x)[T s1(x)+T s2(x)]
δ 2(x)=d f-d r
式中,T m1(x)为第x次报文传输时的第一时间戳,T m2(x)为第x次报文传输时的第四时间戳,α(x)为对应第x次报文传输时的歪斜程度系数,T s1(x)为第x次报文传输时的第二时间戳,T s2(x)为第x次报文传输时的第三时间戳。
本发明还提供了一种配电终端,所述配电终端通过通信设备连接具有主时钟的服务器。
本发明实施例提供的一种配电终端包括从时钟以及处理器;
所述处理器被设置成:
与所述服务器进行基于PTP协议的主从时钟对时报文交互,获取对应的时间戳信息;
根据所述时间戳信息,基于系统对称性假设计算时钟偏移和固定偏移;
根据当前报文的主时钟的时间戳和从时钟的时间戳,计算对应的归一化的正向排队延迟和归一化的逆向排队延迟,根据所述归一化的正向排队延迟和归一化的逆向排队延迟,得到对应的当前报文的时钟瞬时不对称补偿偏移,并对所述时钟瞬时不对称补偿偏移进行指数加权移动平均处理,得到当前报文的时钟偏移补偿;
根据所述时钟偏移、所述固定偏移和所述时钟偏移补偿计算总时钟偏移值;
根据所述总时钟偏移值校正所述从时钟与所述主时钟同步.
在一种能够实现的方式中,当与服务器进行基于PTP协议的主从时钟对时报文交互,获取对应的时间戳信息时,所述处理器被具体设置成:
接收所述服务器发送的同步信息报文及附加信息报文,所述附加信息报文包括发送所述同步信息报文的时间;
将所述发送所述同步信息报文的时间记录为第一时间戳,将根据从时 钟接收到的所述同步信息报文及附加信息报文的时间分别记录为第二时间戳和第三时间戳;
向所述服务器发送延迟请求报文,并接收所述服务器基于所述延迟请求报文反馈的延迟响应报文,所述延迟响应报文包括发送所述附加信息报文的时间;
将所述发送所述附加信息报文的时间记录为第四时间戳。
在一种能够实现的方式中,当计算对应的归一化的正向排队延迟和归一化的逆向排队延迟时,所述处理器被具体设置成:
根据广义时钟偏移方程得到所述当前报文的主时钟的时间戳和从时钟的时间戳;
对所述主时钟的时间戳和从时钟的时间戳进行差分处理,得到当前报文的差分正向排队延迟和差分逆向排队延迟;
从各差分正向排队延迟中抽取容量为N的正向样本,并从所述正向样本中抽取值最小的正向样本,从各差分逆向排队延迟中抽取容量为N的逆向样本,并从所述逆向样本中抽取值最小的逆向样本;
根据当前报文的差分正向排队延迟和所述值最小的正向样本得到归一化的正向排队延迟,以及,根据当前报文的差分逆向排队延迟和所述值最小的逆向样本得到归一化的逆向排队延迟。
在一种能够实现的方式中,当根据当前报文的差分正向排队延迟和所述值最小的正向样本得到归一化的正向排队延迟,以及,根据当前报文的差分逆向排队延迟和所述值最小的逆向样本得到归一化的逆向排队延迟时,所述处理器被具体设置成:
根据下式计算所述归一化的正向排队延迟和所述归一化的逆向排队延迟:
Figure PCTCN2022135148-appb-000024
式中,q fn(x)表示第x次报文传输时的归一化的正向排队延迟,q f(x)为第x次报文传输时的差分正向排队延迟,q f,min(x)表示值最小的正向样本, q rn(x)表示第x次报文传输时的归一化的逆向排队延迟,q r(x)表示第x次报文传输时的差分逆向排队延迟,q r,min(x)表示值最小的逆向样本。
在一种能够实现的方式中,当根据所述归一化的正向排队延迟和归一化的逆向排队延迟,得到对应的当前报文的时钟瞬时不对称补偿偏移时,所述处理器被具体设置成:
根据下式计算对应的当前报文的时钟瞬时不对称补偿偏移:
Figure PCTCN2022135148-appb-000025
式中,δ 3(x)表示第x次报文传输时的时钟瞬时不对称补偿偏移。
在一种能够实现的方式中,当根据所述时钟偏移、所述固定偏移和所述时钟偏移补偿计算总时钟偏移值时,所述处理器被具体设置成:
采用下式计算所述总时钟偏移值:
Figure PCTCN2022135148-appb-000026
其中
Figure PCTCN2022135148-appb-000027
式中,δ(x)表示第x次报文传输时的总时钟偏移值,δ 1(x)为第x次报文传输时的时钟偏移,δ 2(x)为第x次报文传输时的固定偏移,
Figure PCTCN2022135148-appb-000028
为第x次报文传输时的时钟偏移补偿,
Figure PCTCN2022135148-appb-000029
为第x-1次报文传输时的时钟偏移补偿,β为权重,其是指数加权移动平均处理过程的一个超参数。
本发明还提供一种配电终端实时时钟同步系统,包括具有主时钟的服务器以及如上任一项能够实现的方式所述的配电终端。
本发明上述实施例的配电终端和其处理器的具体执行过程和效果,可以参考上述实施例中的配电终端实时时钟同步方法,为陈述简洁,在此不再赘述。
传统的配电终端现场的精确时间估算是基于网络的物理传播时间前后 向时延是相等的这一假设,但在现实生活中,由于网络交换机路由器等设备的影响,两者经历的时间时延缺失不同的。由此需要对主从时钟间误差不对称的方法进行改进。本发明上述实施例,通过总时钟偏移值来进行时间偏移和延迟的计算。总时钟偏移值由原有偏移、固定偏移和补偿偏移三部分组成,而原有偏移与固定偏移值通过系统对称性假设和PTP协议得到,补偿偏移则采用上述的改进算法得到,通过与传统方式相比,本发明实施例的方法,对路径时延和时钟偏移都产生了较优的效果,提高了通过IEEE1588协议进行对时的精度,有望到达us和ns级别的对时精度,对配电网故障实时监测提供了良好的保障。本发明实施例的方法,对复杂配电网也可以得到较好的对时方案。

Claims (13)

  1. 一种配电终端实时时钟同步方法,其特征在于,所述配电终端具有从时钟,所述配电终端连接至具有主时钟的服务器,所述方法包括:
    配电终端与服务器进行基于PTP协议的主从时钟对时报文交互,获取对应的时间戳信息;
    所述配电终端根据所述时间戳信息,基于系统对称性假设计算时钟偏移和固定偏移;
    所述配电终端根据当前报文的主时钟的时间戳和从时钟的时间戳,计算对应的归一化的正向排队延迟和归一化的逆向排队延迟,根据所述归一化的正向排队延迟和归一化的逆向排队延迟,得到对应的当前报文的时钟瞬时不对称补偿偏移,并对所述时钟瞬时不对称补偿偏移进行指数加权移动平均处理,得到当前报文的时钟偏移补偿;
    所述配电终端根据所述时钟偏移、所述固定偏移和所述时钟偏移补偿计算总时钟偏移值;
    所述配电终端根据所述总时钟偏移值校正所述从时钟与所述主时钟同步。
  2. 根据权利要求1所述的配电终端实时时钟同步方法,其特征在于,所述配电终端与服务器进行基于PTP协议的主从时钟对时报文交互,获取对应的时间戳信息,包括:
    所述配电终端接收所述服务器发送的同步信息报文及附加信息报文,所述附加信息报文包括发送所述同步信息报文的时间;
    所述配电终端将所述发送所述同步信息报文的时间记录为第一时间戳,将根据从时钟在所述配电终端处接收所述同步信息报文及附加信息报文的时间分别记录为第二时间戳和第三时间戳;
    所述配电终端向所述服务器发送延迟请求报文,并接收所述服务器基于所述延迟请求报文反馈的延迟响应报文,所述延迟响应报文包括发送所述附加信息报文的时间;
    所述配电终端将所述发送所述附加信息报文的时间记录为第四时间戳。
  3. 根据权利要求1所述的配电终端实时时钟同步方法,其特征在于,所述计算对应的归一化的正向排队延迟和归一化的逆向排队延迟,包括:
    根据广义时钟偏移方程得到所述当前报文的主时钟的时间戳和从时钟的时间戳;
    对所述主时钟的时间戳和从时钟的时间戳进行差分处理,得到当前报文的差分正向排队延迟和差分逆向排队延迟;
    从各差分正向排队延迟中抽取容量为N的正向样本,并从所述正向样本中抽取值最小的正向样本,从各差分逆向排队延迟中抽取容量为N的逆向样本,并从所述逆向样本中抽取值最小的逆向样本;
    根据当前报文的差分正向排队延迟和所述值最小的正向样本得到归一化的正向排队延迟,以及,根据当前报文的差分逆向排队延迟和所述值最小的逆向样本得到归一化的逆向排队延迟。
  4. 根据权利要求3所述的配电终端实时时钟同步方法,其特征在于,所述根据当前报文的差分正向排队延迟和所述值最小的正向样本得到归一化的正向排队延迟,以及,根据当前报文的差分逆向排队延迟和所述值最小的逆向样本得到归一化的逆向排队延迟,包括:
    根据下式计算所述归一化的正向排队延迟和所述归一化的逆向排队延迟:
    Figure PCTCN2022135148-appb-100001
    式中,q fn(x)表示第x次报文传输时的归一化的正向排队延迟,q f(x)为第x次报文传输时的差分正向排队延迟,q f,min(x)表示值最小的正向样本,q rn(x)表示第x次报文传输时的归一化的逆向排队延迟,q r(x)表示第x次报文传输时的差分逆向排队延迟,q r,min(x)表示值最小的逆向样本。
  5. 根据权利要求4所述的配电终端实时时钟同步方法,其特征在于,所述根据所述归一化的正向排队延迟和归一化的逆向排队延迟,得到对应的当前报文的时钟瞬时不对称补偿偏移,包括:
    根据下式计算对应的当前报文的时钟瞬时不对称补偿偏移:
    Figure PCTCN2022135148-appb-100002
    式中,δ 3(x)表示第x次报文传输时的时钟瞬时不对称补偿偏移。
  6. 根据权利要求5所述的配电终端实时时钟同步方法,其特征在于,所述配电终端根据所述时钟偏移、所述固定偏移和所述时钟偏移补偿计算总时钟偏移值,包括:
    采用下式计算所述总时钟偏移值:
    Figure PCTCN2022135148-appb-100003
    其中
    Figure PCTCN2022135148-appb-100004
    式中,δ(x)表示第x次报文传输时的总时钟偏移值,δ 1(x)为第x次报文传输时的时钟偏移,δ 2(x)为第x次报文传输时的固定偏移,
    Figure PCTCN2022135148-appb-100005
    为第x次报文传输时的时钟偏移补偿,
    Figure PCTCN2022135148-appb-100006
    为第x-1次报文传输时的时钟偏移补偿,β为权重,其是指数加权移动平均处理过程的一个超参数。
  7. 一种配电终端,其特征在于,所述配电终端通过通信设备连接具有主时钟的服务器,所述配电终端包括从时钟以及处理器;
    所述处理器被设置成:
    与所述服务器进行基于PTP协议的主从时钟对时报文交互,获取对应的时间戳信息;
    根据所述时间戳信息,基于系统对称性假设计算时钟偏移和固定偏移;
    根据当前报文的主时钟的时间戳和从时钟的时间戳,计算对应的归一化的正向排队延迟和归一化的逆向排队延迟,根据所述归一化的正向排队延迟和归一化的逆向排队延迟,得到对应的当前报文的时钟瞬时不对称补偿偏移,并对所述时钟瞬时不对称补偿偏移进行指数加权移动平均处理,得到当前报文的时钟偏移补偿;
    根据所述时钟偏移、所述固定偏移和所述时钟偏移补偿计算总时钟偏移值;
    根据所述总时钟偏移值校正所述从时钟与所述主时钟同步.
  8. 根据权利要求7所述的配电终端,其特征在于,当与服务器进行基于PTP协议的主从时钟对时报文交互,获取对应的时间戳信息时,所述处理器被具体设置成:
    接收所述服务器发送的同步信息报文及附加信息报文,所述附加信息报文包括发送所述同步信息报文的时间;
    将所述发送所述同步信息报文的时间记录为第一时间戳,将根据从时钟接收到的所述同步信息报文及附加信息报文的时间分别记录为第二时间戳和第三时间戳;
    向所述服务器发送延迟请求报文,并接收所述服务器基于所述延迟请求报文反馈的延迟响应报文,所述延迟响应报文包括发送所述附加信息报文的时间;
    将所述发送所述附加信息报文的时间记录为第四时间戳。
  9. 根据权利要求7所述的配电终端实时时钟同步方法,其特征在于,当计算对应的归一化的正向排队延迟和归一化的逆向排队延迟时,所述处理器被具体设置成:
    根据广义时钟偏移方程得到所述当前报文的主时钟的时间戳和从时钟的时间戳;
    对所述主时钟的时间戳和从时钟的时间戳进行差分处理,得到当前报文的差分正向排队延迟和差分逆向排队延迟;
    从各差分正向排队延迟中抽取容量为N的正向样本,并从所述正向样本中抽取值最小的正向样本,从各差分逆向排队延迟中抽取容量为N的逆向样本,并从所述逆向样本中抽取值最小的逆向样本;
    根据当前报文的差分正向排队延迟和所述值最小的正向样本得到归一化的正向排队延迟,以及,根据当前报文的差分逆向排队延迟和所述值最小的逆向样本得到归一化的逆向排队延迟。
  10. 根据权利要求9所述的配电终端实时时钟同步方法,其特征在于, 当根据当前报文的差分正向排队延迟和所述值最小的正向样本得到归一化的正向排队延迟,以及,根据当前报文的差分逆向排队延迟和所述值最小的逆向样本得到归一化的逆向排队延迟时,所述处理器被具体设置成:
    根据下式计算所述归一化的正向排队延迟和所述归一化的逆向排队延迟:
    Figure PCTCN2022135148-appb-100007
    式中,q fn(x)表示第x次报文传输时的归一化的正向排队延迟,q f(x)为第x次报文传输时的差分正向排队延迟,q f,min(x)表示值最小的正向样本,q rn(x)表示第x次报文传输时的归一化的逆向排队延迟,q r(x)表示第x次报文传输时的差分逆向排队延迟,q r,min(x)表示值最小的逆向样本。
  11. 根据权利要求10所述的配电终端实时时钟同步方法,其特征在于,当根据所述归一化的正向排队延迟和归一化的逆向排队延迟,得到对应的当前报文的时钟瞬时不对称补偿偏移时,所述处理器被具体设置成:
    根据下式计算对应的当前报文的时钟瞬时不对称补偿偏移:
    Figure PCTCN2022135148-appb-100008
    式中,δ 3(x)表示第x次报文传输时的时钟瞬时不对称补偿偏移。
  12. 根据权利要求11所述的配电终端实时时钟同步方法,其特征在于,当根据所述时钟偏移、所述固定偏移和所述时钟偏移补偿计算总时钟偏移值时,所述处理器被具体设置成:
    采用下式计算所述总时钟偏移值:
    Figure PCTCN2022135148-appb-100009
    其中
    Figure PCTCN2022135148-appb-100010
    式中,δ(x)表示第x次报文传输时的总时钟偏移值,δ 1(x)为第x次报文传输时的时钟偏移,δ 2(x)为第x次报文传输时的固定偏移,
    Figure PCTCN2022135148-appb-100011
    为第x次报文传输时的时钟偏移补偿,
    Figure PCTCN2022135148-appb-100012
    为第x-1次报文传输时的时钟偏移补偿,β为权重,其是指数加权移动平均处理过程的一个超参数。
  13. 一种配电终端实时时钟同步系统,其特征在于,包括具有主时钟的服务器以及如权利要求7-12任一项所述的配电终端。
PCT/CN2022/135148 2021-11-30 2022-11-29 一种配电终端实时时钟同步方法、同步系统及配电终端 WO2023098683A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111447474.7 2021-11-30
CN202111447474.7A CN114157377B (zh) 2021-11-30 2021-11-30 一种配电终端实时时钟同步方法、同步系统及配电终端

Publications (1)

Publication Number Publication Date
WO2023098683A1 true WO2023098683A1 (zh) 2023-06-08

Family

ID=80455382

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/135148 WO2023098683A1 (zh) 2021-11-30 2022-11-29 一种配电终端实时时钟同步方法、同步系统及配电终端

Country Status (2)

Country Link
CN (1) CN114157377B (zh)
WO (1) WO2023098683A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116938376A (zh) * 2023-06-26 2023-10-24 南京国电南自电网自动化有限公司 低压台区电能表对时的时钟校准方法和装置

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114157377B (zh) * 2021-11-30 2023-06-27 广东电网有限责任公司江门供电局 一种配电终端实时时钟同步方法、同步系统及配电终端

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014037684A1 (en) * 2012-09-04 2014-03-13 Khalifa University of Science, Technology, and Research Methods and devices for clock synchronization
CN104993900A (zh) * 2015-07-06 2015-10-21 江苏省电力公司南京供电公司 一种基于ieee1588时钟模型的同步校正方法
CN108418235A (zh) * 2018-01-30 2018-08-17 国网电力科学研究院武汉南瑞有限责任公司 应用于四断口串联断路器的信号传输时钟同步的补偿方法
CN114157377A (zh) * 2021-11-30 2022-03-08 广东电网有限责任公司江门供电局 一种配电终端实时时钟同步方法、同步系统及配电终端

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105743598B (zh) * 2016-01-26 2018-06-26 华中科技大学 一种工业以太网时钟同步方法及系统

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014037684A1 (en) * 2012-09-04 2014-03-13 Khalifa University of Science, Technology, and Research Methods and devices for clock synchronization
CN104993900A (zh) * 2015-07-06 2015-10-21 江苏省电力公司南京供电公司 一种基于ieee1588时钟模型的同步校正方法
CN108418235A (zh) * 2018-01-30 2018-08-17 国网电力科学研究院武汉南瑞有限责任公司 应用于四断口串联断路器的信号传输时钟同步的补偿方法
CN114157377A (zh) * 2021-11-30 2022-03-08 广东电网有限责任公司江门供电局 一种配电终端实时时钟同步方法、同步系统及配电终端

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116938376A (zh) * 2023-06-26 2023-10-24 南京国电南自电网自动化有限公司 低压台区电能表对时的时钟校准方法和装置

Also Published As

Publication number Publication date
CN114157377A (zh) 2022-03-08
CN114157377B (zh) 2023-06-27

Similar Documents

Publication Publication Date Title
WO2023098683A1 (zh) 一种配电终端实时时钟同步方法、同步系统及配电终端
US11516101B2 (en) Method, a computer program product, and a carrier for indicating one-way latency in a data network
CN103929293B (zh) 非对称延迟的时间同步方法及系统
US7475272B2 (en) Method for calculating clock offset and skew
EP2388962B1 (en) Device and method for implementing clock transparent transmission
WO2014146554A1 (zh) 一种智能变电站过程层网络的报文同步方法及系统
CN101675614A (zh) 使网络组件的时钟与另外的网络组件的时钟同步的方法及其网络组件
WO2012151808A1 (zh) 基于精确时钟协议提高同步精度的方法及系统
CN104993900B (zh) 一种基于ieee1588时钟模型的同步校正方法
CN114389735A (zh) 一种基于ieee802.1as冗余主时钟的时钟同步方法
US8861552B2 (en) Fault-tolerant self-stabilizing distributed clock synchronization protocol for arbitrary digraphs
US10334539B2 (en) Metered interface
US9344209B2 (en) Discrete time compensation mechanisms
Maruyama et al. Time synchronization for real-time control systems without PTP-enabled switches
Wei et al. Analysis and Correction Methods for Network Time-delay Error of IEEE 1588 Synchronization Clock
Bian et al. Application and research of IEEE1588 protocol in ubiquitous power internet of things
Kang et al. Timing and Synchronization with Propagation Delay Symmetry and Originated Slave Clock Frequency for Ubiquitous Computing
Na et al. Enhancement of the precision time protocol in automation networks with a line topology
CN117792557A (zh) 一种时钟同步方法、装置、设备及可读存储介质
WO2015087023A1 (en) Method and devices for packet selection
CN113890841A (zh) 高效的大规模单向延迟测量方法及装置
Zhu Study and implementation of IEEE 1588 Precise Time Protocol

Legal Events

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

Ref document number: 22900487

Country of ref document: EP

Kind code of ref document: A1