WO2023082620A1 - 一种时钟晶振同步的方法、装置及系统 - Google Patents

一种时钟晶振同步的方法、装置及系统 Download PDF

Info

Publication number
WO2023082620A1
WO2023082620A1 PCT/CN2022/097367 CN2022097367W WO2023082620A1 WO 2023082620 A1 WO2023082620 A1 WO 2023082620A1 CN 2022097367 W CN2022097367 W CN 2022097367W WO 2023082620 A1 WO2023082620 A1 WO 2023082620A1
Authority
WO
WIPO (PCT)
Prior art keywords
time
deviation
sensor
calculation unit
network
Prior art date
Application number
PCT/CN2022/097367
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 北京津发科技股份有限公司
Priority to EP22822258.4A priority Critical patent/EP4209885A4/en
Priority to US18/086,928 priority patent/US20230155807A1/en
Publication of WO2023082620A1 publication Critical patent/WO2023082620A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/05Digital input using the sampling of an analogue quantity at regular intervals of time, input from a/d converter or output to d/a converter
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/04Generating or distributing clock signals or signals derived directly therefrom
    • G06F1/12Synchronisation of different clock signals provided by a plurality of clock generators

Definitions

  • the present application relates to the field of time synchronization, in particular to a clock crystal oscillator synchronization method, device and system for calculating, evaluating, correcting and compensating time errors caused by clock crystal oscillators.
  • the computing unit Before using the computing unit for data analysis and other work, there are usually external devices such as sensors to collect the data to be processed, and transmit it to the computing unit for storage and waiting for processing.
  • the sensor hardware is equipped with a clock
  • the calculation unit is also equipped with its corresponding clock.
  • the commonly used solution is to connect the sensor to the computing unit, and the sensor adjusts its own clock according to the clock in the computing unit, so that the clock in the sensor and the clock in the computing unit are synchronized to reduce the time deviation between the sensor and the computing unit.
  • this application provides a clock crystal oscillator synchronization method for the calculation, evaluation, compensation, and correction of the time error caused by Methods, devices and systems.
  • the present application provides a method for clock crystal oscillator synchronization, which adopts the following technical solution:
  • a method for clock crystal oscillator synchronization comprising:
  • the sensor time is updated and an actual outage frequency of the sensor is calculated.
  • the calculating the first deviation between the calculation unit time and the network clock time includes:
  • the calculating and recording the network delay every first preset time includes:
  • the request receiving time T 2 is the time when the network clock receives the request
  • the response sending Time T3 is the time when the network clock returns the response
  • calculating the first deviation between the calculation unit time and the network clock time according to the network delay every second preset time includes:
  • the network delay d starts, and it is continuously taken A value of the network delay d, set up a basic data set;
  • the basic data set calculate the value of the operating frequency and drift frequency corresponding to each of the network delay d in the basic data set, and obtain the operating frequency difference set and the drift frequency difference set;
  • a first deviation fitting line is obtained according to the operating frequency difference set and the drift frequency difference set, a first slope of the first deviation fitting line is calculated, and the first deviation is calculated according to the first slope.
  • the calculating the second deviation between the calculation unit time and the sensor time includes:
  • Every fourth preset time according to the maximum value of the first difference within each third preset time, and the data sending time corresponding to the maximum value of the first difference, calculate the A second deviation between the sensor time and the calculation unit time, wherein the fourth preset time includes a plurality of the third preset times.
  • Every fourth preset time, according to the maximum value of the first difference within each third preset time, and the maximum value corresponding to the first difference The data sending time calculates the second deviation between the sensor time and the calculation unit time, including:
  • one fourth preset time interval according to the maximum value of the first difference value and the data sending time corresponding to the maximum value of the first difference value in each of the third preset time intervals, Respectively obtain the first difference set and the data sending time set;
  • the calculating the actual interruption frequency of the sensor includes:
  • the present application provides a device for clock crystal oscillator synchronization, which adopts the following technical solution:
  • a device for synchronizing clock crystal oscillators including a processor, a memory, and a computing unit program stored in the memory and capable of running on the processor, when the processor runs the computing unit program, it can realize the following In one aspect, the clock crystal oscillator synchronization method.
  • the device performs time synchronization with the computing unit and the sensor respectively. After the synchronization is completed, the sensor uploads the data to be processed collected by itself to the computing unit.
  • a separate clock crystal oscillator synchronization device can also facilitate the management of the device. The method in the first aspect.
  • the present application provides a system for clock crystal oscillator synchronization, which adopts the following technical solution:
  • a clock crystal oscillator synchronization system including a sensor, a computing unit, and a clock crystal oscillator synchronization device according to the second aspect;
  • the sensor measures and sends the information to be processed;
  • the calculation unit receives the information to be processed by the facility from the sensor;
  • the device for synchronizing the clock crystal oscillator calculates the first deviation between the calculation unit time and the network clock time when the calculation unit has a network connection; updates the basic deviation according to the first deviation; updates the basic deviation according to the basic deviation. the calculation unit time and calculate the actual refresh frequency of the calculation unit; and
  • the sensor time is updated and an actual outage frequency of the sensor is calculated.
  • the clock crystal oscillator synchronization device in the system performs time synchronization with the computing unit and the sensor respectively.
  • Unit time synchronization, no clock error, improves the reliability of clock synchronization, and reduces the complexity of calculation.
  • the present application includes at least one of the following beneficial technical effects:
  • the actual refresh frequency in the device and the actual interrupt frequency in the sensor will be modified, and the updated actual refresh frequency and actual interrupt frequency will be used for synchronization in the next synchronization , improve the stability of the whole system and reduce the complexity of calculation.
  • Fig. 1 is a flow chart of a method for clock crystal oscillator synchronization in the embodiment of the present application
  • Fig. 2 is a flow chart of calculating the first deviation in a method for clock crystal oscillator synchronization according to an embodiment of the present application
  • FIG. 3 is a flow chart of calculating the second deviation in a method for clock crystal oscillator synchronization according to an embodiment of the present application
  • FIG. 4 is a schematic structural diagram of a device for clock crystal oscillator synchronization in an embodiment of the present application
  • Fig. 5 is a schematic structural diagram of a clock crystal oscillator synchronization system in an embodiment of the present application.
  • the embodiment of the present application discloses a method for clock crystal oscillator synchronization, including:
  • the sensor time is updated and the actual interrupt frequency of the sensor is calculated.
  • this method comprises:
  • Step S100 when the computing unit is connected to the network, establish a connection between the computing unit and the network clock, calculate and record the network delay between the computing unit and the network clock every first preset time.
  • the network clock taking the Network Time Protocol server as an example, is a protocol used to synchronize the time of the computing unit. It enables the computing unit to synchronize its server or clock source and provide high-precision time correction.
  • Step S200 calculating a first deviation x 1 between the time of the computing unit and the time of the network clock according to the network delay every second preset time.
  • Each second preset time includes a plurality of first preset times.
  • Step S300 update the basic deviation x 0 according to the first deviation x 1 and calculate the actual refresh frequency h 1 .
  • the initial value of the basic deviation is zero.
  • the preset threshold such as 100
  • the value of the first deviation is reasonable, and the value of the first deviation is regarded as the basic deviation. renew. If the calculated absolute value of the first deviation is greater than the preset threshold, the first deviation value is unreasonable, and the result is discarded and not used for updating the basic deviation.
  • the tick frequency is an indicator of the clock. In the calculation unit, it represents the number of refreshes of the clock within one second, and in the sensor, it represents the number of interruptions of the clock within one second.
  • step S400 the calculation unit time is updated according to the basic deviation, and the updated calculation unit time is equal to the sum of the calculation unit time before updating and the basic deviation.
  • Step S500 when establishing a connection with the sensor, continuously acquire the data sending time of the sensor and the data receiving time of the corresponding data received by the calculation unit, calculate the first difference between the data receiving time and the data sending time, every third preset time Determine the maximum value of the first difference within the third preset time.
  • the data sending time indicates the time when the sensor sends the information to be processed measured by itself to the calculation unit
  • the data receiving time indicates the time when the calculation unit receives the information to be processed from the sensor
  • Step S600 every fourth preset time, calculate the second deviation x2 between the sensor time and the calculation unit time according to the maximum value of the first difference and the corresponding data transmission time in each third preset time;
  • Each fourth preset time includes a plurality of third preset times.
  • Step S700 update the sensor time according to the second deviation x2 , the updated sensor time is equal to the sum of the sensor time before updating and the second deviation.
  • Step S800 calculating the actual interruption frequency f 1 of the sensor according to the second deviation x 2 .
  • the interrupt frequency f of the sensor refers to the number of interrupts the sensor emits within one second, and the basic interrupt frequency is stored in the sensor.
  • step S800 includes:
  • the initial interruption interval time t 1 between two adjacent interruptions is calculated; among them, the initial interruption interval time
  • step S100 of the embodiment of the present application the method for calculating the network delay includes:
  • step S200 of the embodiment of the present application the method for calculating the first deviation includes:
  • Step S210 sort all network delays d within the second preset time in ascending order to obtain a delay data set, and record the total number of network delays d within the second preset time as n.
  • Step S220 in the delay data set, from the start with a network delay d, and take The value of the network delay d to establish the basic data set.
  • Step S230 according to the basic data set, correspondingly calculate the values of running ticks and drifting ticks corresponding to each network delay d in the basic data set, and correspondingly calculate the running tick difference set and the drifting tick difference set.
  • Tick is a relative time unit, and the corresponding specific time is related to the calculation unit.
  • Step S240 obtain the first deviation fitting line according to the running tick difference set and the drifting tick difference set, calculate the first slope of the first deviation fitting line, and multiply the first slope by 106 to obtain the calculation unit time and the network clock time First deviation x 1 .
  • the slope reflects the ratio of the drift tick variation to the running tick variation, that is, the first deviation between the computing unit time and the network clock time.
  • step S230 includes:
  • the running tick is equal to the sum of T 3 and the basic time difference t, namely
  • the drift tick is equal to the difference between T 4 and the running tick, that is
  • the difference between each item of data in the running tick set and the drifting tick set and the first item of data in the running tick set and the drifting tick set is respectively obtained to obtain the running tick difference set and the drifting tick difference set.
  • step S300 of the embodiment of the present application the method for calculating the actual refresh frequency h1 includes:
  • the initial refresh frequency h 0 is the default value
  • step S600 includes:
  • Step S610 within a fourth preset time interval, according to the maximum value of the first difference value and the data sending time corresponding to the maximum value of the first difference value within each third preset time interval, respectively obtain the first difference Value set and data sending time set.
  • Each item of data in the first difference set is equal to the product of the corresponding first difference and 10 6
  • each item of data in the data transmission time set is the data transmission that the sensor corresponding to each first difference sends information to be processed to the computing unit time.
  • Step S620 obtain the second deviation fitting line according to the first difference set and the data sending time set, calculate the second slope of the second deviation fitting line, the second deviation x 2 between the sensor time and the calculation unit time is equal to the first Two slopes.
  • Each item of data in the data transmission time set is used as the abscissa, and the data corresponding to the data transmission time set in the first difference set is used as the ordinate to perform linear fitting to obtain the second deviation fitting line, and the first deviation fitting line of the second deviation fitting line
  • the second slope reflects the ratio of the data sending time to the first difference, that is, the first deviation between the sensor and the computing unit.
  • the embodiment of the present application also discloses a device for clock crystal oscillator synchronization.
  • the computing unit program running on the processor 12, and the processor 12 can implement the clock crystal oscillator synchronization method as described in the above specification when running the computing unit program.
  • the embodiment of the present application discloses a clock crystal oscillator synchronization system.
  • FIG. 5 it includes a clock crystal oscillator synchronization device 10, a sensor 20 and a computing unit 30 as provided in this embodiment, wherein:
  • the sensor 20 is used to measure and send the information to be processed
  • a computing unit 30, configured to acquire information to be processed from the sensor 20;
  • the device 10 of clock crystal oscillator synchronization when there is a network connection in the computing unit 30, calculates the first deviation between the computing unit 30 time and the network clock time; according to the first deviation, updates the basic deviation; updates the computing unit 30 time according to the basic deviation and calculates the actual Refresh frequency; calculate the second deviation of the calculation unit 30 time and the sensor 20 time connected to the calculation unit 30; according to the second deviation, update the sensor 30 time and calculate the actual interruption frequency of the sensor 20; complete the calculation unit 30 and the sensor 20 clock for calibration .
  • the device 10 for synchronizing the clock crystal oscillator can be installed on the computing unit 30 , and the memory 11 and the processor 12 of the device 10 for synchronizing the clock crystal oscillator are the memory and the processor of the computing unit 30 .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Electric Clocks (AREA)

Abstract

本申请涉及一种时钟晶振同步的方法、装置及系统,其中方法包括在计算单元存在网络连接时,计算计算单元时间与网络时钟时间的第一偏差;根据第一偏差,更新基本偏差;根据基本偏差更新计算单元时间并计算实际刷新频率;计算计算单元时间与传感器时间的第二偏差;根据第二偏差,更新传感器时间并计算传感器的实际中断频率。本申请对于由时钟晶振引起的时间误差提供了计算、评估、校正、补偿的同步方法,具有减小在单个或多个传感器与单个或多个计算单元进行数据交换时减少时间误差的效果。

Description

一种时钟晶振同步的方法、装置及系统 技术领域
本申请涉及时间同步的领域,尤其是涉及一种对由时钟晶振引起的时间误差的计算、评估、校正、补偿的时钟晶振同步的方法、装置及系统。
背景技术
在使用计算单元进行数据分析等工作之前,通常要有传感器等外接设备对待处理数据进行收集,并传输到计算单元内存储等待处理。传感器硬件设备内均设置有时钟,计算单元内同样设置有其对应的时钟,传感器与计算单元建立连接时,二者时钟难免会自然走偏而使二者产生时间差,导致传感器与计算单元之间传输的数据存在较大延迟或提前。
目前常用的解决方法为令传感器与计算单元连接时,传感器根据计算单元中的时钟来调整自身时钟,使传感器内时钟与计算单元内时钟进行同步,减少传感器与计算单元之间的时间偏差。
但是随着项目的使用需求和技术的逐渐发展,在使用多台传感器和多台计算单元进行数据交换时,或者在同一个项目需要更换不同计算单元进行时,每个计算单元之间的时钟无法保证完全相同,若使传感器与连接的计算单元进行同步,最终连接不同计算单元的传感器采集的测量数据时间也会存在相应偏差,导致后续对所有传感器采集的测量数据进行整合处理时较为困难。
发明内容
为了减小在单个或多个传感器与单个或多个计算单元共同进 行数据交换时的时间误差,本申请对由引起的时间误差的计算、评估、补偿、校正的提供了一种时钟晶振同步的方法、装置及系统。
第一方面,本申请提供一种时钟晶振同步的方法,采用如下的技术方案:
一种时钟晶振同步的方法,包括:
在计算单元存在网络连接时,计算所述计算单元时间与网络时钟时间的第一偏差;
根据所述第一偏差,更新基本偏差;
根据所述基本偏差更新所述计算单元时间并计算所述计算单元的实际刷新频率;
计算所述计算单元时间与传感器时间的第二偏差;
根据所述第二偏差,更新所述传感器时间并计算所述传感器的实际中断频率。
通过采用上述技术方案,先将计算单元时间与网络时钟的时间进行同步后,保证计算单元时间准确,再将传感器时间与计算单元时间进行同步,保证所有传感器时间都与网络时钟的时间保持同步,能够减小单个或多个传感器通过单个或多个计算单元进行数据交换时的时间误差,提高测量数据的准确性和适用性,也便于测量数据的整合处理。
可选的,所述计算所述计算单元时间与网络时钟时间的第一偏差包括:
每隔第一预设时间计算网络延时并记录;
每隔第二预设时间根据所述网络延时计算所述计算单元时间 与所述网络时钟时间的第一偏差。
可选的,所述每隔第一预设时间计算网络延时并记录包括:
向所述网络时钟发送请求,记录请求发送时间T 1
接收来自所述网络时钟的应答,记录应答接收时间T 4、请求接收时间T 2和应答发送时间T 3;其中,所述请求接收时间T 2为网络时钟接收到请求的时间,所述应答发送时间T 3为网络时钟返回应答的时间;
计算所述网络延时d=(T 2-T 1)+(T 4-T 3)。
可选的,所述每隔第二预设时间根据所述网络延时计算所述计算单元时间与所述网络时钟时间的第一偏差,包括:
将所述第二预设时间内的所有所述网络延时d进行升序排序得到延时数据集,并将第二预设时间内所述网络延时d的总数记为n;
在所述延时数据集中,从第
Figure PCTCN2022097367-appb-000001
个所述网络延时d开始,连续取
Figure PCTCN2022097367-appb-000002
个所述网络延时d的值,建立基础数据集;
根据所述基础数据集,计算所述基础数据集中每个所述网络延时d对应的运行频率和漂移频率的值,并得到运行频率差集和漂移频率差集;
根据所述运行频率差集和所述漂移频率差集得到第一偏差拟合线,计算所述第一偏差拟合线的第一斜率,根据所述第一斜率计算所述第一偏差。
可选的,所述计算所述计算单元时间与传感器时间的第二偏差,包括:
获取所述传感器每次发送数据的数据发送时间和所述计算单 元接收所述数据的数据接收时间,计算每次所述数据接收时间与所述数据发送时间的第一差值;
每隔第三预设时间确定所述第三预设时间内所述第一差值的最大值;
每隔第四预设时间,根据每个所述第三预设时间内所述第一差值的最大值,以及与所述第一差值的最大值对应的所述数据发送时间计算所述传感器时间与所述计算单元时间的第二偏差,其中,所述第四预设时间包含多个所述第三预设时间。
可选的,所述每隔第四预设时间,根据每个所述第三预设时间内所述第一差值的最大值,以及与所述第一差值的最大值对应的所述数据发送时间计算所述传感器时间与所述计算单元时间的第二偏差,包括:
在一个所述第四预设时间间隔内,根据每个所述第三预设时间内所述第一差值的最大值和所述第一差值的最大值对应的所述数据发送时间,分别得到第一差值集和数据发送时间集;
根据所述第一差值集和所述数据发送时间集得到第二偏差拟合线,并计算所述第二偏差拟合线的第二斜率,根据所述第二斜率计算所述第二偏差。
可选的,所述计算所述传感器的实际中断频率包括:
根据初始中断频率f 0计算得到初始中断时间间隔t 1
根据所述中断时间间隔t 1和所述第二偏差x 2计算实际中断时间间隔t 2;其中,所述实际中断时间间隔t 2=t 1+x 2×10 6
根据所述实际终端时间间隔t 2计算所述实际中断频率f 1;其 中,所述实际中断频率
Figure PCTCN2022097367-appb-000003
第二方面,本申请提供一种时钟晶振同步的装置,采用如下的技术方案:
一种时钟晶振同步的装置,包括处理器和存储器,以及存储在所述存储器上并可以在所述处理器上运行的计算单元程序,所述处理器运行所述计算单元程序时能够实现如第一方面所述的时钟晶振同步的方法。
通过采用上述技术方案,该装置分别与计算单元和传感器进行时间同步,同步完成后,传感器才将自身采集得到的待处理数据上传至计算单元,单独设置时钟晶振同步装置也能够便于管理该装置完成第一方面中的方法。
第三方面,本申请提供一种时钟晶振同步的系统,采用如下的技术方案:
一种时钟晶振同步的系统,包括传感器、计算单元以及第二方面所述的一种时钟晶振同步的装置;
所述传感器测量并发送待处理信息;所述计算单元从所述传感器接收设施待处理信息;
所述时钟晶振同步的装置在所述计算单元存在网络连接时,计算所述计算单元时间与网络时钟时间的第一偏差;根据所述第一偏差,更新基本偏差;根据所述基本偏差更新所述计算单元时间并计算所述计算单元的实际刷新频率;以及
计算所述计算单元时间与传感器时间的第二偏差;
根据所述第二偏差,更新所述传感器时间并计算所述传感器的 实际中断频率。
通过采用上述技术方案,该系统中时钟晶振同步的装置分别与计算单元和传感器进行时间同步,同步完成后,传感器才将自身采集得到的待处理数据上传至计算单元,使系统中所有传感器和计算单元时间同步,无时钟误差,提高时钟同步的可靠性,降低计算的复杂程度。
综上所述,本申请包括以下至少一种有益技术效果:
1.将所有参加项目的计算单元与网络时钟进行时间同步,之后再进行传感器与计算单元之间的时间同步,保证所有传感器的时间与网络时钟时间之间的同步,减少传感器测量数据之间的误差;
2.对计算单元和传感器进行时间同步完毕后,会对装置内的实际刷新频率以及传感器内的实际中断频率进行修改,并在下次进行同步时使用更新后的实际刷新频率和实际中断频率进行同步,提高整个系统的稳定性,降低计算的复杂程度。
附图说明
图1是本申请实施例中一种时钟晶振同步的方法的流程图;
图2是本申请实施例一种时钟晶振同步的方法中计算第一偏差的流程图;
图3是本申请实施例一种时钟晶振同步的方法中计算第二偏差的流程图;
图4是本申请实施例中一种时钟晶振同步的装置的结构示意图;
图5是本申请实施例中一种时钟晶振同步的系统的结构示意 图。
具体实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图1-5及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。
本申请实施例公开一种时钟晶振同步的方法,包括:
在计算单元存在网络连接时,计算计算单元时间与网络时钟时间的第一偏差;
根据第一偏差,更新基本偏差;
根据基本偏差更新计算单元时间并计算实际刷新频率;
计算计算单元时间与传感器时间的第二偏差;
根据第二偏差,更新传感器时间并计算传感器的实际中断频率。
参照图1,作为时钟晶振同步方法的一种实施方式,该方法包括:
步骤S100,在计算单元存在网络连接时,通过计算单元与网络时钟建立连接,每隔第一预设时间计算计算单元与网络时钟之间的网络延时并进行记录。
网络时钟,以Network Time Protocol服务器为例,是用来使计算单元时间同步化的一种协议,它可以使计算单元对其服务器或时钟源做同步化,提供高精准度的时间校正。
步骤S200,每隔第二预设时间,根据网络延时计算计算单元 时间与网络时钟时间的第一偏差x 1。每个第二预设时间内包括多个第一预设时间。
步骤S300,根据第一偏差x 1更新基本偏差x 0并计算实际刷新频率h 1
基本偏差的初始值为零,计算得到第一偏差后,若第一偏差的绝对值小于等于预设阈值(如100),该第一偏差的数值合理,将第一偏差的数值作为基本偏差进行更新。若计算所得的第一偏差的绝对值大于预设阈值,该第一偏差值不合理,将该结果舍去,不用于更新基本偏差。tick频率是时钟的一种指标,在计算单元中其代表一秒内时钟的刷新次数,在传感器中其代表一秒内时钟的中断次数。
步骤S400,根据基本偏差更新计算单元时间,更新后的计算单元时间等于更新前的计算单元时间与基本偏差的和。
步骤S500,与传感器建立连接时,持续获取传感器的数据发送时间以及计算单元接收对应数据的数据接收时间,计算数据接收时间与数据发送时间之间的第一差值,每隔第三预设时间确定该第三预设时间内第一差值的最大值。
数据发送时间表示传感器将自身测量的待处理信息向计算单元发送的时间,数据接收时间表示计算单元接收来自传感器的待处理信息的时间。
步骤S600,每隔第四预设时间,根据每个第三预设时间内的第一差值的最大值和对应的数据发送时间计算传感器时间与计算单元时间之间的第二偏差x 2;每个第四预设时间内包括多个第三预设时间。
步骤S700,根据第二偏差x 2更新传感器时间,更新后的传感器时间等于更新前的传感器时间与第二偏差的和。
步骤S800,根据第二偏差x 2计算传感器的实际中断频率f 1
传感器的中断频率f指传感器在一秒内发射信号的中断次数,传感器内存储有基础中断频率。
在本实施例中,步骤S800包括:
根据初始中断频率f 0计算得到相邻两次中断之间的初始中断间隔时间t 1;其中,初始中断间隔时间
Figure PCTCN2022097367-appb-000004
根据中断时间间隔t 1和第二偏差x 2计算实际中断时间间隔t 2;其中,实际中断时间间隔t 2=t 1+x 2
根据实际中断时间间隔t 2计算实际中断频率f 1,并将实际中断频率f 1;其中,实际中断频率
Figure PCTCN2022097367-appb-000005
在本申请实施例的步骤S100中,计算网络延时的方法包括:
向网络时钟发送请求,并记录请求发送时间T 1
接收来自网络时钟的应答,并记录应答接收时间T 4、请求接收时间T 2和应答发送时间T 3;其中,请求接收时间T 2为网络时钟接收到请求的时间,应答发送时间T 3为网络时钟返回应答的时间;
计算网络延时d=(T 2-T 1)+(T 4-T 3)。
参照图2,本申请实施例步骤S200中,计算第一偏差的方法包括:
步骤S210,将第二预设时间内的所有网络延时d进行升序排序得到延时数据集,并将第二预设时间内网络延时d的总数记为n。
步骤S220,在延时数据集中,从第
Figure PCTCN2022097367-appb-000006
个网络延时d开始,连续取
Figure PCTCN2022097367-appb-000007
个网络延时d的值,建立基础数据集。
步骤S230,根据基础数据集,对应计算基础数据集中每个网络延时d对应的运行tick和漂移tick的值,并对应计算得到运行tick差集和漂移tick差集。tick为一种相对时间单位,其对应的具体时间与计算单元有关。
步骤S240,根据运行tick差集和漂移tick差集得到第一偏差拟合线,计算第一偏差拟合线的第一斜率,将第一斜率乘以10 6得到计算单元时间与网络时钟时间的第一偏差x 1
将运行tick差集中的每项数据作为横坐标,漂移tick差集中与运行tick差集对应的数据作为纵坐标进行线性拟合,得到第一偏差拟合线,第一偏差拟合线的第一斜率反映了漂移tick变化量与运行tick变化量的比值,即计算单元时间与网络时钟时间的第一偏差。
在本申请实施例中,步骤S230包括:
计算得到每个网络延时d对应的计算单元与NTP系统之间的基础时差t,计算公式为:
Figure PCTCN2022097367-appb-000008
根据基础时差t计算运行tick和漂移tick,并得到运行tick集和漂移tick集;
其中,运行tick等于T 3与基础时差t之和,即
Figure PCTCN2022097367-appb-000009
漂移tick等于T 4与运行tick的差值,即
Figure PCTCN2022097367-appb-000010
将运行tick集和漂移tick集中的每项数据分别与运行tick集和漂移tick集中的第一项数据做差,对应得到运行tick差集和漂移tick差集。
本申请实施例步骤S300中,计算实际刷新频率h 1的方法包括:
根据计算单元的初始刷新频率h 0,计算初始刷新频率间隔s 1;其中,
Figure PCTCN2022097367-appb-000011
初始刷新频率h 0为预设值;
根据初始刷新频率间隔s 1和基本偏差x 0,计算实际刷新频率间隔s 2;其中,s 2=s 1+x 0
根据实际刷新频率间隔s 2计算实际刷新频率h 1;其中,
Figure PCTCN2022097367-appb-000012
参照图3,本申请实施例中,步骤S600包括:
步骤S610,在一个第四预设时间间隔内,根据其中每个第三预设时间内的第一差值的最大值和第一差值的最大值对应的数据发送时间,分别得到第一差值集和数据发送时间集。
第一差值集中的每项数据等于对应的第一差值与10 6的乘积,数据发送时间集中的每项数据为每项第一差值对应的传感器向计算单元发送待处理信息的数据发送时间。
步骤S620,根据第一差值集和数据发送时间集得到第二偏差拟合线,计算第二偏差拟合线的第二斜率,传感器时间与计算单元时间之间的第二偏差x 2等于第二斜率。
将数据发送时间集中的每项数据作为横坐标,第一差值集中与数据发送时间集对应的数据作为纵坐标进行线性拟合,得到第二偏差拟合 线,第二偏差拟合线的第二斜率反映了数据发送时间与第一差值的比值,即传感器与计算单元的第一偏差。
本申请实施例还公开一种时钟晶振同步的装置,参照图4,作为时钟晶振同步的装置的一种实施方式,该装置包括存储器11和处理器12,以及存储在存储器11上并可以在处理器12上运行的计算单元程序,并且处理器12运行计算单元程序时能够实现如上述说明书中的时钟晶振同步的方法。
本申请实施例公开一种时钟晶振同步的系统,参照图5,包括如本实施例提供的一种时钟晶振同步的装置10、传感器20和计算单元30,其中:
传感器20,用于测量并发送待处理信息;
计算单元30,用于从传感器20获取待处理信息;
时钟晶振同步的装置10,在计算单元30存在网络连接时,计算计算单元30时间与网络时钟时间的第一偏差;根据第一偏差,更新基本偏差;根据基本偏差更新计算单元30时间并计算实际刷新频率;计算计算单元30时间与计算单元30连接的传感器20时间的第二偏差;根据第二偏差,更新传感器30时间并计算传感器20的实际中断频率;完成计算单元30以及传感器20时钟进行校准。
在本申请实施例中,时钟晶振同步的装置10可以安装在计算单元30上,时钟晶振同步的装置10的存储器11和处理器12为计算单元30的存储器和处理器。
以上均为本申请的较佳实施例,并非依此限制本申请的保护范 围,本说明书(包括摘要和附图)中公开的任一特征,除非特别叙述,均可被其他等效或者具有类似目的的替代特征加以替换。即,除非特别叙述,每个特征只是一系列等效或类似特征中的一个例子而已。

Claims (9)

  1. 一种时钟晶振同步的方法,其特征在于,包括:
    在计算单元存在网络连接时,计算所述计算单元时间与网络时钟时间的第一偏差;
    根据所述第一偏差,更新基本偏差;
    根据所述基本偏差更新所述计算单元时间并计算所述计算单元的实际刷新频率;
    计算所述计算单元时间与传感器时间的第二偏差;
    根据所述第二偏差,更新所述传感器时间并计算所述传感器的实际中断频率。
  2. 根据权利要求1所述的方法,其特征在于:所述计算所述计算单元时间与网络时钟时间的第一偏差包括:
    每隔第一预设时间计算网络延时并记录;
    每隔第二预设时间根据所述网络延时计算所述计算单元时间与所述网络时钟时间的第一偏差。
  3. 根据权利要求2所述的方法,其特征在于,所述每隔第一预设时间计算网络延时并记录包括:
    向所述网络时钟发送请求,记录请求发送时间T 1
    接收来自所述网络时钟的应答,记录应答接收时间T 4、请求接收时间T 2和应答发送时间T 3;其中,所述请求接收时间T 2为网络时钟接收到请求的时间,所述应答发送时间T 3为网络时钟返回应答的时间;
    计算所述网络延时d=(T 2-T 1)+(T 4-T 3)。
  4. 根据权利要求2所述的方法,其特征在于,所述每隔第二预设时间根据所述网络延时计算所述计算单元时间与所述网络时钟时间的第一偏差,包括:
    将所述第二预设时间内的所有所述网络延时d进行升序排序得到延时数据集,并将第二预设时间内所述网络延时d的总数记为n;
    在所述延时数据集中,从第
    Figure PCTCN2022097367-appb-100001
    个所述网络延时d开始,连续取
    Figure PCTCN2022097367-appb-100002
    个所述网络延时d的值,建立基础数据集;
    根据所述基础数据集,计算所述基础数据集中每个所述网络延时d对应的运行频率和漂移频率的值,并得到运行频率差集和漂移频率差集;
    根据所述运行频率差集和所述漂移频率差集得到第一偏差拟合线,计算所述第一偏差拟合线的第一斜率,根据所述第一斜率计算所述第一偏差。
  5. 根据权利要求1所述的方法,其特征在于,所述计算所述计算单元时间与传感器时间的第二偏差,包括:
    获取所述传感器每次发送数据的数据发送时间和所述计算单元接收所述数据的数据接收时间,计算每次所述数据接收时间与所述数据发送时间的第一差值;
    每隔第三预设时间确定所述第三预设时间内所述第一差值的最大值;
    每隔第四预设时间,根据每个所述第三预设时间内所述第一差值的最大值,以及与所述第一差值的最大值对应的所述数据发送时间计算所述传感器时间与所述计算单元时间的第二偏差,其中,所述第四预设时间包含多个所述第三预设时间。
  6. 根据权利要求5所述的方法,其特征在于,所述每隔第四预设时间,根据每个所述第三预设时间内所述第一差值的最大值,以及与所述第一差值的最大值对应的所述数据发送时间计算所述传感器时间与所述计算单元时间的第二偏差,包括:
    在一个所述第四预设时间间隔内,根据每个所述第三预设时间内所述第一差值的最大值和所述第一差值的最大值对应的所述数据发送时间,分别得到第一差值集和数据发送时间集;
    根据所述第一差值集和所述数据发送时间集得到第二偏差拟合线,并计算所述第二偏差拟合线的第二斜率,根据所述第二斜率计算所述第二偏差。
  7. 根据权利要求1所述的方法,其特征在于,所述计算所述传感器的实际中断频率包括:
    根据初始中断频率f 0计算得到初始中断时间间隔t 1
    根据所述中断时间间隔t 1和所述第二偏差x 2计算实际中断时间间隔t 2;其中,所述实际中断时间间隔t 2=t 1+x 2×10 6
    根据所述实际终端时间间隔t 2计算所述实际中断频率f 1;其中,所述实际中断频率
    Figure PCTCN2022097367-appb-100003
  8. 一种时钟晶振同步的装置,包括处理器、存储器以及存储在所述存储器上并可以在所述处理器上运行的计算机程序,其特征在于,所述处理器运行所述计算机程序时能够实现如权利要求1-7中任一项所述的时钟晶振同步的方法。
  9. 一种时钟晶振同步的系统,其特征在于,包括传感器、计算单元以及如权利要求8所述的一种时钟晶振同步的装置;
    所述传感器测量并发送待处理信息;所述计算单元从所述传感器接收设施待处理信息;
    所述时钟晶振同步的装置在所述计算单元存在网络连接时,计算所述计算单元时间与网络时钟时间的第一偏差;根据所述第一偏差,更新基本偏差;根据所述基本偏差更新所述计算单元时间并计算所述计算单元的实际刷新频率;以及
    计算所述计算单元时间与传感器时间的第二偏差;
    根据所述第二偏差,更新所述传感器时间并计算所述传感器的实际中断频率。
PCT/CN2022/097367 2021-11-13 2022-06-07 一种时钟晶振同步的方法、装置及系统 WO2023082620A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP22822258.4A EP4209885A4 (en) 2021-11-13 2022-06-07 METHOD, DEVICE AND SYSTEM FOR CLOCK QUARTZ OSCILLATOR SYNCHRONIZATION
US18/086,928 US20230155807A1 (en) 2021-11-13 2022-12-22 Clock quartz oscillator synchronization method, apparatus and system

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111343650.2A CN114035740B (zh) 2021-11-13 2021-11-13 一种时钟晶振同步的方法、装置及系统
CN202111343650.2 2021-11-13

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US18/086,928 Continuation US20230155807A1 (en) 2021-11-13 2022-12-22 Clock quartz oscillator synchronization method, apparatus and system

Publications (1)

Publication Number Publication Date
WO2023082620A1 true WO2023082620A1 (zh) 2023-05-19

Family

ID=80137546

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/097367 WO2023082620A1 (zh) 2021-11-13 2022-06-07 一种时钟晶振同步的方法、装置及系统

Country Status (2)

Country Link
CN (1) CN114035740B (zh)
WO (1) WO2023082620A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114035740B (zh) * 2021-11-13 2022-12-02 北京津发科技股份有限公司 一种时钟晶振同步的方法、装置及系统

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101588628A (zh) * 2009-06-19 2009-11-25 山东省计算中心 无线传感器网络时钟同步方法
CN113055117A (zh) * 2021-04-25 2021-06-29 电子科技大学 一种无线分布式网络的时钟同步装置及方法
WO2021220034A1 (en) * 2020-04-29 2021-11-04 Nokia Technologies Oy Synchronizing terminal device to network clock
CN113645683A (zh) * 2021-10-14 2021-11-12 昂科信息技术(上海)股份有限公司 晶振自适应时钟同步方法及系统
CN114035740A (zh) * 2021-11-13 2022-02-11 北京津发科技股份有限公司 一种时钟晶振同步的方法、装置及系统

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101005349B (zh) * 2007-01-09 2010-05-19 华为技术有限公司 一种时钟同步方法和系统
CN100525212C (zh) * 2007-08-10 2009-08-05 中控科技集团有限公司 网络时钟同步的方法及系统
CN102355319B (zh) * 2011-08-17 2015-07-08 中国科学院深圳先进技术研究院 无线传感器网络中的时间同步方法及系统
EP2713172B1 (en) * 2012-09-26 2019-05-29 Rheinisch-Westfälisch-Technische Hochschule Aachen Measurement apparatus for electricity distribution grids
CN113037415B (zh) * 2021-02-25 2024-05-28 上海赫千电子科技有限公司 一种基于车载以太网传输的tsn网络时钟同步方法、系统及设备
CN113193933A (zh) * 2021-06-08 2021-07-30 上海睿奈电子科技有限公司 一种传感器网络时钟同步方法及装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101588628A (zh) * 2009-06-19 2009-11-25 山东省计算中心 无线传感器网络时钟同步方法
WO2021220034A1 (en) * 2020-04-29 2021-11-04 Nokia Technologies Oy Synchronizing terminal device to network clock
CN113055117A (zh) * 2021-04-25 2021-06-29 电子科技大学 一种无线分布式网络的时钟同步装置及方法
CN113645683A (zh) * 2021-10-14 2021-11-12 昂科信息技术(上海)股份有限公司 晶振自适应时钟同步方法及系统
CN114035740A (zh) * 2021-11-13 2022-02-11 北京津发科技股份有限公司 一种时钟晶振同步的方法、装置及系统

Also Published As

Publication number Publication date
CN114035740A (zh) 2022-02-11
CN114035740B (zh) 2022-12-02

Similar Documents

Publication Publication Date Title
US7379480B2 (en) Fast frequency adjustment method for synchronizing network clocks
US9671822B2 (en) Method and devices for time transfer using end-to-end transparent clocks
EP3284217B1 (en) Methods, systems, and computer readable medium for synchronizing timing among network interface cards (nics) in a network equipment test device
US6327274B1 (en) Method for estimating relative skew between clocks in packet networks
US6157957A (en) Clock synchronization system and method using a continuous conversion function for a communication network
US7340630B2 (en) Multiprocessor system with interactive synchronization of local clocks
CN100583730C (zh) 用于校准tod时钟的装置和方法
CN104981742B (zh) 分发装置、分发系统以及分发方法
US8370675B2 (en) Precise clock synchronization
WO2023082620A1 (zh) 一种时钟晶振同步的方法、装置及系统
EP2811672A1 (en) Communication apparatus, communication system, and communication method for time synchronization
Ferrari et al. Experimental characterization of uncertainty sources in a software-only synchronization system
CN102480350A (zh) 一种基于频率偏差估计的时间同步和维持的方法及装置
EP4044466A1 (en) Synchronization method and device
WO2016092243A1 (en) Method and devices for time transfer using end to end transparent clocks
TWI618432B (zh) 頻率校正裝置及方法
TWI726448B (zh) 利用對準標記實現時間戳記的奈秒精度及其形成方法
EP4209885A1 (en) Clock crystal oscillator synchronization method, apparatus and system
US11853116B2 (en) Clock error-bound tracker
CN109286461B (zh) 用于匹配在检测传感器数据时的时间戳的方法
JP6893070B2 (ja) 情報通信システム
JPWO2008142815A1 (ja) 同期通信システム
CN112115079B (zh) 总线周期同步的方法和系统
US20240154782A1 (en) Synchronizing network reference time among power line components
CN113132041B (zh) 一种数据传输延时的计算方法和装置

Legal Events

Date Code Title Description
ENP Entry into the national phase

Ref document number: 2022822258

Country of ref document: EP

Effective date: 20221221