WO2012079326A1 - 一种输出时间信息的装置及方法 - Google Patents

一种输出时间信息的装置及方法 Download PDF

Info

Publication number
WO2012079326A1
WO2012079326A1 PCT/CN2011/072773 CN2011072773W WO2012079326A1 WO 2012079326 A1 WO2012079326 A1 WO 2012079326A1 CN 2011072773 W CN2011072773 W CN 2011072773W WO 2012079326 A1 WO2012079326 A1 WO 2012079326A1
Authority
WO
WIPO (PCT)
Prior art keywords
time
local
satellite
soft
output
Prior art date
Application number
PCT/CN2011/072773
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 WO2012079326A1 publication Critical patent/WO2012079326A1/zh

Links

Classifications

    • GPHYSICS
    • G04HOROLOGY
    • G04RRADIO-CONTROLLED TIME-PIECES
    • G04R20/00Setting the time according to the time information carried or implied by the radio signal
    • G04R20/02Setting the time according to the time information carried or implied by the radio signal the radio signal being sent by a satellite, e.g. GPS

Definitions

  • the present invention relates to timing techniques in the field of communications, and more particularly to an apparatus and method for outputting time information. Background technique
  • satellite timing The timing method for broadcasting standard time information by satellite is called satellite timing.
  • receiver After receiving, demodulating, and synchronizing by the satellite signal receiving device (referred to as receiver), the user obtains the standard time consistent with the coordinated world time, which is anywhere in the world.
  • the basic way to get accurate time Commonly used satellite timing systems include the US GPS system, the Russian GLONASS system, the European Galileo system, and the China Beidou system.
  • atomic clocks can be used directly to generate high-precision time information, but atomic clocks are expensive and costly to use.
  • the timing system is one of the most important and critical national infrastructures, and its application areas include modern communication networks, power networks, and so on.
  • a satellite signal receiving device is generally integrated in a device that outputs time information, and the timing information output by the satellite signal receiving device is used as a time source.
  • the timing information outputted by the satellite signal receiving device has a hopping phenomenon, and although the probability of occurrence is low, a scene requiring extremely high timing accuracy, such as a code division multiple access (CDMA) system, once Time hopping will cause the CDMA system to fail to synchronize, causing huge losses to the user. Therefore, how to continue to provide stable time when the timing data changes, has become a problem to be solved. Summary of the invention
  • the main object of the present invention is to provide an apparatus and method for outputting time information, which is to solve the problem of outputting to an application system requiring high precision timing data when there is a jump in the timing information outputted by the satellite signal receiving apparatus. There will be a jump problem.
  • the present invention provides a method for outputting time information, the method comprising: assigning a local soft time according to timing data output by a satellite signal receiving device; adjusting the local soft time in real time according to a unit time; Local soft time.
  • the local soft time assignment includes: real-time receiving the timing data output by the satellite signal receiving device according to the unit time, parsing the received timing data to obtain time information, and updating the currently saved local satellite time in real time. For the obtained time information; when the local satellite time is updated for the first time, the local satellite time is assigned to the local satellite backup time set to calibration, and the local satellite backup time is adjusted in real time according to the unit time; The updated local satellite time is compared with the local satellite backup time. When the local satellite time and the satellite backup time are consecutively equal to the pre-configured evaluation threshold, the current synchronization flag is verified to be false, indicating that the current synchronization flag is not present. Assignment, the local satellite time is assigned to the local soft time, and the synchronization flag is set to true, and the assignment is completed.
  • the local soft time is adjusted in real time according to the unit time, when the satellite signal receiving device receives the pps interrupt signal output according to the unit time, the local satellite backup time is increased by the unit time. .
  • the real-time output of the local soft time is: pre-configuring an interrupt time interval of the timer interrupt counter, the timer interrupt counter counting according to the configured interrupt time interval, and performing a clear operation according to the unit time When the count of the timer interrupt counter reaches a preset output threshold, the current local soft time is output.
  • the timer interrupt counter performs a clear operation according to a unit time, and is: The timer interrupt counter is cleared when receiving the pps interrupt signal output by the satellite signal receiving apparatus according to the unit time.
  • the method further comprises: correcting the local soft time in real time.
  • the real-time correction of the local soft time includes: real-time receiving the timing data output by the satellite signal receiving apparatus according to the unit time, parsing the received timing data to obtain time information, and real-timely storing the currently saved local satellite. The time is updated to the obtained time information; when the count of the timer interrupt counter reaches the preset first correction threshold, and is set to indicate that the count of the equal number of times of the correction reaches the preset second correction threshold, Correcting the local soft time by assigning the current local satellite time to the local soft time; wherein the timer interrupt counter is counted according to a pre-configured interrupt time interval, and is cleared according to the unit time; When the count of the interrupt counter reaches a preset first correction threshold, the equal number of counters are counted or cleared: the current local satellite time does not coincide with the local soft time, and the local satellite time is related to the local satellite When the backup time is equal, the equal number of times A count number, coincides with the local time at the current soft local satellite time, local time
  • the unit time is seconds.
  • the present invention also provides an apparatus for outputting time information, the apparatus comprising: a CPU, an output interface, an input interface, wherein the input interface is configured to connect to a satellite signal receiving device, and receive timing data output by the satellite signal receiving device
  • the CPU is configured to assign a local soft time according to the timing data received by the input interface, and adjust the local soft time according to the unit time in real time; and the output interface is configured to output the local soft time in real time.
  • the CPU is further configured to: parse the time data received by the input interface to obtain time information, and update the currently saved local satellite time to the obtained time in real time. Time information; when the local satellite time is updated for the first time, the local satellite time is assigned to the local satellite backup time set to calibration, and the local satellite backup time is adjusted in real time according to the unit time; the updated local satellite is updated in real time; Comparing the time with the local satellite backup time, and verifying that the current synchronization flag is false when the local satellite time and the satellite backup time are consecutively equal to the pre-configured evaluation threshold, indicating that the current synchronization flag is not assigned, The local satellite time is assigned to the local soft time, and the synchronization flag is set to true, and the assignment is completed.
  • the CPU is further configured to receive a pps interrupt signal output by the satellite signal receiving device in unit time, and adjust the local soft time in real time according to the received pps interruption time.
  • the device further includes: a timer interrupt counter, wherein the timer interrupt counter counts according to the configured interrupt time interval, and performs a clear operation according to a unit time; the CPU is further configured to, at the timing When the count of the interrupt counter reaches the preset output threshold, the current local soft time is output through the output interface.
  • the CPU is further configured to correct the local soft time in real time.
  • the apparatus further includes an equal number of counters, and when the count of the timer interrupt counter reaches a preset first correction threshold, the equal number of counters are counted or cleared: at the current local satellite time When the local soft time is inconsistent, and the local satellite time is equal to the local satellite backup time, the equal number of counters are counted once, the current local satellite time is consistent with the local soft time, and/or the local satellite time When the local satellite backup time is not equal, the equal number of times counter is cleared; the CPU is further configured to: when the count of the equal number of times counter reaches the second correction threshold, assign the current local satellite time to Local soft time, correcting the local soft time.
  • the device for outputting time information according to the present invention assigns a local soft time according to the timing data outputted by the satellite signal receiving device, and adjusts the local soft time according to the unit time, and then outputs the local soft time to the system requiring accurate time information. , replacing satellites by local soft time
  • the timing data directly output by the signal receiving device can ensure the final output of highly accurate time information even if the timing data outputted by the satellite signal receiving device is hopped or erroneous.
  • the present invention adjusts the local soft time according to the pps interrupt signal output by the satellite signal receiving device according to the unit time, ensuring that the local soft time can be accumulated at the correct time point, and at the same time, when the offset occurs at the local soft time through an appropriate protection mechanism. , and can correct the local soft time in time and accurately, so as to ensure that high-precision time information is always output.
  • FIG. 1 is a flowchart of an implementation of a method for outputting time information according to the present invention
  • FIG. 2 is a schematic diagram of a connection between a device for outputting time information and the outside world according to an embodiment of the present invention
  • FIG. 3 is a timing distribution diagram of an embodiment of the present invention
  • FIG. 4 is a schematic flowchart of implementing a local soft time assignment process according to an embodiment of the present invention
  • FIG. 5 is a schematic flowchart of implementing a local soft time correction process according to an embodiment of the present invention.
  • the basic idea of the present invention is: assigning a local soft time according to the timing data outputted by the satellite signal receiving device, and local soft when receiving a second pulse (pps, pulses per second) interrupted by the satellite signal receiving device once per second.
  • the time is increased by 1 second, and the local soft time replaces the timing data outputted by the satellite signal receiving device, and is output to a system that requires time synchronization, such as a CDMA system.
  • the satellite outputted by the satellite signal receiving device is combined.
  • the long-term stability of the time, the high-precision time of the output is stable in both long and short periods, which solves the problem that the timing data has a jump and improves the timing precision.
  • the method for outputting time information of the present invention mainly includes the following steps:
  • Step 101 assign a value to the local soft time according to the timing data output by the satellite signal receiving device; Step 102: adjust the local soft time according to the unit time in real time; Step 103: Output the local soft time in real time.
  • the process of assigning the local soft time may be: real-time receiving the timing data output by the satellite signal receiving device according to the unit time, parsing the received time data to obtain time information, and updating the currently saved local satellite time to the real time in real time.
  • the obtained time information when the local satellite time is updated for the first time, the local satellite time is assigned to the local satellite backup time set to calibration, and the local satellite backup time is adjusted in real time according to the unit time;
  • the local satellite time is compared with the local satellite backup time. When the local satellite time and the satellite backup time are consecutively equal to the pre-configured value threshold, the current synchronization flag is verified to be false, indicating that the current value is not assigned.
  • the local satellite time is then assigned to the local soft time, and the synchronization flag is set to true.
  • the initial values of the local soft time, the local satellite time, and the local satellite backup time may be any time.
  • the setting of the assignment threshold can be determined according to actual needs.
  • the timing data output by the satellite signal receiving device may include information such as time, latitude and longitude, and the number of currently locked satellites.
  • the value of the assignment value may be determined according to the actual application situation. If the assignment needs to be performed quickly, the assignment threshold may be set to a smaller value. If the assignment is not required, and the assignment is more accurate, the The value of the assignment threshold is set to be larger. For example, you can set the assignment threshold to 30 times. This means that it takes 30 unit time to start receiving the timing data to the assignment. If the unit time is seconds, then it means that it takes 30 seconds to start receiving the timing data to the assignment.
  • the local soft time is adjusted in real time according to the unit time, and may be: when receiving the pps interrupt signal output by the satellite signal receiving device, increasing the local satellite backup time by a unit time; wherein the satellite signal The receiving device outputs a pps interrupt signal in units of time.
  • the process of adjusting the local satellite backup time in real time according to the unit time is exactly the same as the process of adjusting the local soft time.
  • the satellite signal receiving device outputs a pps interrupt signal at the edge of the unit time, where the unit time is generally seconds.
  • the real-time output of the local soft time may be: pre-configuring an interrupt time interval of the timer interrupt counter, the timer interrupt counter counting according to the configured interrupt time interval, and performing a clear operation according to a unit time; When the count of the timer interrupt counter reaches the preset output threshold, the current local soft time is output.
  • the output threshold can be determined according to the configured interrupt interrupt interval and the unit time. In actual applications, it is necessary to combine the current receiving timing data, adjust the local soft time, and output the local soft time. And the time required by the application system that requires accurate time information to receive the local soft time is determined.
  • the interrupt time interval of the timer interrupt counter is smaller than the unit time.
  • the unit time is an integer multiple of the configured interrupt time interval. For example, when the unit time is two seconds, the interrupt time interval of the timer interrupt counter is selected between 4 and 25 ms.
  • the configuration of the timer interrupt counter interrupt time interval is a common technical method in the art, and details are not described herein.
  • the timer interrupt counter performs a clear operation according to a unit time, and may be: when receiving the pps interrupt signal output by the satellite signal receiving apparatus, clearing the timer interrupt counter, wherein the satellite signal receiving apparatus The pps interrupt signal is output according to the unit time.
  • the method further includes: correcting the local soft time in real time.
  • the process of correcting the local soft time may be: receiving the time data output by the satellite signal receiving apparatus according to the unit time in real time, parsing the received time data to obtain time information, and updating the currently saved local satellite time in real time. For the time information obtained;
  • the current local satellite time is assigned to the local soft time, and the local soft time is corrected.
  • the timer interrupt counter is counted according to a preset interrupt time interval, and is cleared according to a unit time; when the timer interrupt counter count reaches a preset first correction threshold, the equal number counter Counting or clearing: When the current local satellite time is inconsistent with the local soft time, and the local satellite time is equal to the local satellite backup time, the equal number of counters are counted once, at the current local satellite time and local The equal number of times counter is cleared when the soft time is consistent, and/or the local satellite time is not equal to the local satellite backup time.
  • the first correction threshold is determined by the interrupt time interval of the configured timer interrupt counter and the unit time, and the time interval elapsed from the zero count to the first correction threshold is close to the time interval
  • the unit time is better, so that it can guarantee that the timing data has been received and the local satellite time, local satellite backup time, and local soft time are updated.
  • the second correction threshold may be determined according to an actual application situation. When configured, it may be determined according to a correction time interval of the local soft time. If you want to correct every 300 unit time, you can set the second correction threshold to 300 times.
  • the present invention further provides an apparatus for outputting time information, the apparatus comprising: a CPU, an output interface, an input interface, wherein the input interface is configured to connect to a satellite signal receiving device, and receive the satellite signal receiving device output.
  • the timing data; the CPU is configured to assign a local soft time according to the timing data received by the input interface, and adjust the local soft time according to the unit time in real time; the output interface is set to output the local soft in real time. time.
  • the output interface and the input interface may be a serial port, an Ethernet interface, or the like.
  • the CPU may be configured to parse the timing data received by the input interface. Obtaining time information, and updating the currently saved local satellite time to the obtained time information in real time; when updating the local satellite time for the first time, assigning the local satellite time to the local satellite backup time set to calibration, and according to the Adjusting the local satellite backup time in real time per unit time; comparing the updated local satellite time with the local satellite backup time in real time, and achieving a pre-configured assignment at the same number of consecutive times of the local satellite time and the satellite backup time When the value is wide, it is verified that the current synchronization flag is false, indicating that the current satellite value is not assigned, then the local satellite time is assigned to the local soft time, and the synchronization flag is set to true.
  • the CPU is further configured to receive a pps interrupt signal output by the satellite signal receiving device per unit time, and adjust the local soft time in real time according to the received pps interruption time.
  • the device further includes: a timer interrupt counter, the timer interrupt counter counts according to the configured interrupt time interval, and performs a clear operation according to a unit time; the CPU is further configured to interrupt the counter at the timer When the count reaches the preset output threshold, the current local soft time is output through the output interface.
  • the CPU is further configured to correct the local soft time in real time.
  • the apparatus may further include an equal number of counters, when the count of the timer interrupt counter reaches a preset first correction threshold, the equal number of counters are counted or cleared: at the current local satellite time and local The soft time is inconsistent, and when the local satellite time is equal to the local satellite backup time, the equal number of counters are counted once, the current local satellite time is consistent with the local soft time, and/or the local satellite time is When the local satellite backup time is not equal, the equal number of times counter is cleared; the CPU is further configured to: when the count of the equal number of times counter reaches the second corrected threshold, assign the current local satellite time to the local soft Time, correcting the local soft time.
  • Embodiment 1 For the specific process of time information output by the above device, please refer to the method description above, and details are not described herein again. Embodiment 1
  • the process of outputting the time information may specifically include the following steps: Step 1: connecting the device that outputs the time information to the satellite signal receiving device, and performing an initializing operation;
  • the device for outputting the time information is connected to the outside world as shown in FIG. 2, and the satellite signal receiving device receives the signal sent by the satellite through the antenna.
  • the device that outputs the time information passes through the input port.
  • the physical link is connected to the satellite signal receiving device, and its output port is connected to a system (not shown in FIG. 2) that requires high-precision time information, such as a CDMA system.
  • the device for outputting time information mainly includes an embedded CPU having a connection interface, a timer interrupt counter and an equal number of counters.
  • the connection interface is mainly an input serial port and an output serial port, wherein the input serial port is configured to connect the satellite signal receiving device, receive the timing data output by the satellite signal receiving device, and the other, and the output serial port is set to connect the system requiring high precision time information. , Output local soft time to the outside.
  • Initializing the device for outputting the time information includes: initializing the local soft time T1, configuring an external interrupt, and configuring an interrupt time interval of the timer interrupt counter;
  • the local soft time T1 is initialized, and the local soft time T1 can be set to any time.
  • the initial value of the local soft time T1 can be set to 12 o'clock on January 1, 2003; specifically, the external interrupt can be configured.
  • the pps interrupt signal of the satellite signal receiving device is configured as an external interrupt of the output time information device.
  • the timing data is output once every second, and a pps interrupt signal is generated at the edge of each second.
  • the CPU has multiple interrupt pins. On the interrupt pin of the CPU, if the level jumps, an interrupt is triggered. Connect the pps output port of the satellite signal receiving device to the interrupt pin of the CPU. When the second edge of the satellite time arrives, the pps interrupt signal generated by the satellite signal receiving device jumps and is output to the interrupt pin of the CPU. The CPU will generate Interrupted, such that the device unit time to output time information is seconds and can be synchronized with the satellite's unit time.
  • the interrupt interval of the timer interrupt counter is configured to be 4ms.
  • the interrupt counter will generate 250 timer interrupts per second, which is equivalent to dividing 250 time slices per second.
  • 3 is a timing distribution diagram of the present embodiment, in which the timing is divided into a sequence in seconds by the pps interrupt signal, and in each second, it is divided into 250 time slices by a timed interrupt, each time slice length. It is 4ms.
  • the size of the timer interrupt counter interrupt time interval is actually subject to the CPU of the current output time information device. If the configured timer interrupt counter interrupt interval is too small, such as lms, the interrupt is too frequent, which will affect the external response speed of the device; if the configured timer interrupt counter interrupt interval is too large, for example, 100ms, the granularity is too coarse. It cannot be processed in time after the arrival of the timing data output by the satellite signal receiving device. Generally, the configured timed interrupt counter interrupt interval is suitable between 4 and 25 ms.
  • the CPUs are different, and the specific configuration method is different.
  • the configuration of the timer interrupt counter interrupt time interval is a common technical means in the field, and is no longer Narration.
  • Step 2 Assigning a local soft time according to the timing data output by the satellite signal receiving device; specifically, the process of assigning the local soft time, as shown in FIG. 4, the specific process is as follows: S401: When the pps interrupt signal is currently received, Determining whether the timing data output by the satellite signal receiving device is received in the last second, if yes, proceeding to S402; if not, ending the current process;
  • the satellite signal receiving device outputs the timing data once per second, and each time the timing data is received, the serial port interrupt function is triggered to set the current flag for indicating data reception to true, and the flag is set to false during initialization.
  • the satellite signal receiving device generates a pps interrupt signal at the edge of each second, each time it is received.
  • the pps interrupt signal triggers the pps interrupt function to determine the current status of the flag indicating the data reception. If the status of the flag is true, indicating that the last second time data has been received, the flag is reset to false; The flag is currently false, indicating that the last second of the timing data was not received normally.
  • Ts is updated to the obtained time information
  • the serial port interrupt function is triggered, the received timing data is parsed, time information is obtained, and the obtained time information is saved as the local satellite time Ts.
  • the initial value of the local satellite time Tb may be any time value.
  • this step is also implemented by triggering a serial port interrupt function.
  • the initial value of the local satellite backup time Tb may be any time value.
  • the synchronization identifier is set to indicate whether the local soft time has been assigned currently. Initially, the synchronization identifier is H indicating that the local soft time T1 has not been assigned. The synchronization flag is false each time the initial power is turned on, and the flag is set to true after synchronization.
  • S405 Compare the local satellite time Ts with the local satellite backup time Tb, and when the local satellite time Ts is equal to the local satellite backup time Tb, detect the local satellite time Ts and the local satellite backup time. Whether the number of times Tb consecutively equal reaches a preset value of the threshold, if yes, then continue to S406, and if not, continue to S408;
  • the number of times that the local satellite time Ts and the local satellite backup time Tb are consecutively equal may be counted by a counter set as the value, the counter is not equal to the local satellite backup time Tb each time the current local satellite time Ts is compared.
  • the process proceeds to S406, and if no, the process continues to S408.
  • the value of the assignment threshold can be set to 30 times. In actual applications, it can be determined according to actual application conditions.
  • S406 Assign the local satellite time Ts to the local soft time T1, and set the synchronization flag to true, indicating that the local soft time T1 has been assigned, and the local soft time is assigned.
  • S409 When receiving the next pps interrupt signal, receiving the timing data, parsing the received timing data, obtaining time information, and updating the local satellite time Ts to the obtained time information, and returning to S404.
  • the specific implementation process of S409 is exactly the same as the implementation process of S401-402.
  • the local satellite time Ts is updated every second, and when the local satellite time Ts and the local satellite backup time Tb are consecutively equal to 30 times, the local satellite time Ts is assigned to the local soft time T1, and thus, It can ensure the accuracy of the assignment, and can quickly assign the local soft time after power-on, so that the correct time can be output quickly.
  • Step 3 Adjust the local soft time in seconds in real time
  • the satellite signal receiving device generates a pps interrupt signal every second edge, and receives a pps interrupt signal output by the satellite signal receiving device once, triggers a pps interrupt function, and increases the local soft time T1 and the local satellite backup time Tb. 1 second, in this way, the local soft time can be synchronized with the time of the satellite output to ensure the real-time operation of the local soft time.
  • Step 4 Output local soft time in real time
  • the output of the timer interrupt counter is output every time the preset output threshold is reached. A local soft time.
  • the pps interrupt function is triggered, and the timer interrupt counter is cleared once. After being cleared, the timer interrupt counter restarts counting according to the pre-configured interrupt time interval. If the configured interrupt interval is 4ms, the interrupt counter is counted once every 4ms, and the local soft time is output until the number of times the timer interrupt counter counts is added to the preset output threshold.
  • the output threshold is set to 10 times, and the local soft time T1 is output once each time the timer count counter reaches 10, that is, 40 ms after each reception of the pps interrupt signal.
  • the pps interrupt signal can be output together with the local soft time T1. It is also possible to distribute the pps interrupt signal and the local soft time T1 to each distributed system, so that each distributed system can share a time source, thereby effectively reducing construction costs.
  • the distribution of the time information requires consumption of the transmission time, when the time information arrives at the target system, it is actually out of date, and therefore, it is necessary to simultaneously distribute the pps interrupt signal so that the target system can know the time of the current timeout.
  • the embodiment may further include: a process of correcting the local soft time T1 after the local soft time is assigned. Specifically, as shown in FIG. 5, the process of correcting the local soft time T1 is as follows:
  • S501 Verify that the timer interrupt counter count reaches the preset first correction threshold 200, and if yes, continue to S502, if no, end the current process;
  • the satellite signal receiving device does not immediately output the timing data, and often needs to go through a series of data processing, which takes a certain time; and, the receiving satellite signal receiving After the device outputs the timing data, it also needs to parse the timing data, obtain the time information, and update the local satellite time.
  • This series of processing also takes time.
  • the first correction is wide
  • the value is set to 200.
  • the interrupt interval of the current timer interrupt counter is 4ms, that is, 800ms after receiving the pps interrupt signal, to ensure that the timing data in the current second has been received, and the local satellite time update has been completed.
  • S502 Verify whether the current local soft time T1 is equal to the local satellite time Ts, if yes, continue to S507, if no, continue to S503;
  • S503 Verify whether the local satellite backup time Tb is equal to the local satellite time Ts, if yes, continue to S504, if no, continue to S507;
  • S504-505 Accumulate the equal number of times counter by 1 and verify whether the count of the equal number of counters reaches the preset second correction threshold 300, if yes, continue to S506, if no, return to S501; here, the equal number of counters per second It will be accumulated once. If the count of the equal number of counters reaches 300, that is, in the past 300 seconds (5 minutes), the local satellite time Ts and the local satellite backup time Tb are always equal, indicating that the current local satellite time Ts is precise. At this time, the local soft time T1 is not equal to the local satellite time Ts, indicating that the local soft time has an offset and needs to be corrected.
  • S506 Assign the current local satellite time Ts to the local soft time T1 to complete the current local soft time correction process

Landscapes

  • Engineering & Computer Science (AREA)
  • Radar, Positioning & Navigation (AREA)
  • Remote Sensing (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Electric Clocks (AREA)
  • Synchronisation In Digital Transmission Systems (AREA)
  • Position Fixing By Use Of Radio Waves (AREA)

Abstract

本发明公开了一种输出时间信息的方法,所述方法包括:根据卫星信号接收装置输出的授时数据,为本地软时间赋值;将所述本地软时间按照单位时间实时进行调整;实时输出所述本地软时间。本发明还公开了一种输出时间信息的装置,即使卫星信号接收装置输出的授时数据发生跳变或错误,本发明也能够保证最终输出高精准的时间信息。

Description

一种输出时间信息的装置及方法 技术领域
本发明涉及通信领域的授时技术, 尤其涉及一种输出时间信息的装置 及方法。 背景技术
要在全球任意地点产生高精度时间信息, 通常需要依赖人造卫星。 由 人造卫星广播标准时间信息的授时手段称为卫星授时, 用户通过卫星信号 接收装置 (简称接收机)接收、 解调、 同步后, 获得与协调世界时一致的 标准时间, 这是在全球任意地点获取精准时间的基本方法。 常用的卫星授 时系统有美国的 GPS系统、俄罗斯的 GLONASS系统、欧洲的伽利略系统、 中国的北斗系统等。
除此之外, 亦可直接使用原子钟来产生高精度时间信息, 但是原子钟 造价高昂, 利用起来代价不菲。
授时系统是最重要、 也最关键的国家基础设施之一, 其应用领域包括 现代通信网、 电力网等等。 对具体应用而言, 一般是在输出时间信息的设 备中集成卫星信号接收装置, 以卫星信号接收装置输出的授时信息作为时 间源。 在实际应用中, 卫星信号接收装置输出的授时信息存在跳变现象, 虽然出现概率较低,但对授时精度要求极高的场景,例如码分多址(CDMA, Code Division Multiple Access )系统, 一旦时间出现跳变, 就会导致 CDMA 系统无法同步, 给用户带来巨大损失。 因此, 如何在授时数据出现跳变时, 继续提供稳定时间, 就成了需要解决的问题。 发明内容
有鉴于此, 本发明的主要目的在于提供一种输出时间信息的装置及方 法, 以解决在卫星信号接收装置输出的授时信息存在跳变时, 输出到需要 高精度授时数据的应用系统中的时间会出现跳变的问题。
为达到上述目的, 本发明的技术方案是这样实现的:
本发明提供了一种输出时间信息的方法, 所述方法包括: 根据卫星信 号接收装置输出的授时数据, 为本地软时间赋值; 将所述本地软时间按照 单位时间实时进行调整; 实时输出所述本地软时间。
在上述方案中, 所述为本地软时间赋值, 包括: 实时接收卫星信号接 收装置按照单位时间输出的授时数据, 对接收到的授时数据解析得到时间 信息, 并实时将当前保存的本地卫星时间更新为所得到的时间信息; 在首 次更新本地卫星时间时, 将所述本地卫星时间赋值给设置为校准的本地卫 星备份时间, 并按照所述单位时间实时调整所述本地卫星备份时间; 实时 将所更新的本地卫星时间与所述本地卫星备份时间进行比较, 在所述本地 卫星时间与所述卫星备份时间的连续相等次数达到预先配置的赋值阔值 时, 验证当前同步标志为假, 表示当前未赋值, 则将所述本地卫星时间赋 值到本地软时间, 同时设置同步标志为真, 完成赋值。
在上述方案中, 所述将所述本地软时间按照单位时间实时进行调整, 为:接收到所述卫星信号接收装置按照单位时间输出的 pps中断信号时,将 所述本地卫星备份时间增加单位时间。
在上述方案中, 所述实时输出所述本地软时间, 为: 预先配置定时中 断计数器的中断时间间隔, 所述定时中断计数器按照所配置的中断时间间 隔进行计数, 并按照单位时间进行清零操作; 在所述定时中断计数器的计 数达到预先设置的输出阔值时, 输出当前的本地软时间。
在上述方案中, 所述定时中断计数器按照单位时间进行清零操作, 为: 接收到所述卫星信号接收装置按照单位时间输出的 pps中断信号时,所述定 时中断计数器清零。
在上述方案中, 在为所述本地软时间赋值后, 所述方法还包括: 实时 校正所述本地软时间。
在上述方案中, 所述实时校正所述本地软时间, 包括: 实时接收卫星 信号接收装置按照单位时间输出的授时数据, 对接收到的授时数据解析得 到时间信息, 并实时将当前保存的本地卫星时间更新为所得到的时间信息; 在定时中断计数器的计数达到预先设定的第一校正阔值时, 且设置为指示 校正的相等次数计数器的计数达到预先设定的第二校正阔值时, 将当前的 本地卫星时间赋值给本地软时间, 对所述本地软时间进行校正; 其中, 所 述定时中断计数器按照预先配置的中断时间间隔进行计数, 并按照单位时 间进行清零; 在所述定时中断计数器的计数达到预先设定的第一校正阔值 时, 所述相等次数计数器进行计数或清零: 在当前的本地卫星时间与本地 软时间不一致, 且所述本地卫星时间与所述本地卫星备份时间相等时, 所 述相等次数计数器计数一次, 在当前的本地卫星时间与本地软时间一致、 和 /或所述本地卫星时间与所述本地卫星备份时间不相等时, 所述相等次数 计数器清零。
在上述方案中, 所述单位时间为秒。
本发明还提供了一种输出时间信息的装置, 所述装置包括: CPU、 输 出接口、 输入接口, 其中, 输入接口, 设置为连接卫星信号接收装置, 接 收所述卫星信号接收装置输出的授时数据; CPU, 设置为根据所述输入接 口接收到的授时数据, 为本地软时间赋值, 并将所述本地软时间按照单位 时间实时进行调整; 输出接口, 设置为实时输出所述本地软时间。
在上述方案中, 所述 CPU还设置为, 对所述输入接口接收到的授时数 据解析得到时间信息, 并实时将当前保存的本地卫星时间更新为所得到的 时间信息; 在首次更新本地卫星时间时, 将所述本地卫星时间赋值给设置 为校准的本地卫星备份时间, 并按照所述单位时间实时调整所述本地卫星 备份时间; 实时将所更新的本地卫星时间与所述本地卫星备份时间进行比 较, 在所述本地卫星时间与所述卫星备份时间的连续相等次数达到预先配 置的赋值阔值时, 验证当前同步标志为假, 表示当前未赋值, 则将所述本 地卫星时间赋值到本地软时间, 同时设置同步标志为真, 完成赋值。
在上述方案中, 所述 CPU还设置为接收所述卫星信号接收装置按单位 时间输出的 pps中断信号,根据所接收到的 pps中断时间, 将所述本地软时 间实时进行调整。
在上述方案中, 所述装置还包括: 定时中断计数器, 所述定时中断计 数器按照所配置的中断时间间隔进行计数, 并按照单位时间进行清零操作; 所述 CPU还设置为, 在所述定时中断计数器的计数达到预先设置的输出阔 值时, 将当前的本地软时间通过所述输出接口输出。
在上述方案中, 所述 CPU还设置为, 实时校正所述本地软时间。
在上述方案中, 所述装置还包括相等次数计数器, 在所述定时中断计 数器的计数达到预先设定的第一校正阈值时, 所述相等次数计数器进行计 数或清零: 在当前的本地卫星时间与本地软时间不一致, 且所述本地卫星 时间与所述本地卫星备份时间相等时, 所述相等次数计数器计数一次, 在 当前的本地卫星时间与本地软时间一致、 和 /或所述本地卫星时间与所述本 地卫星备份时间不相等时,所述相等次数计数器清零; 所述 CPU还设置为, 在所述相等次数计数器的计数达到第二校正阔值时, 将当前的本地卫星时 间赋值给本地软时间 , 对所述本地软时间进行校正。
本发明的输出时间信息的装置, 根据卫星信号接收装置输出的授时数 据, 对本地软时间赋值, 并将本地软时间按照单位时间调整, 之后, 向需 要精确时间信息的系统输出本地软时间即可, 通过本地软时间来代替卫星 信号接收装置直接输出的授时数据, 即使卫星信号接收装置输出的授时数 据发生跳变或错误, 也能够保证最终输出高精准的时间信息。
此外, 本发明根据卫星信号接收装置按照单位时间输出的 pps 中断信 号, 调整本地软时间, 保证了本地软时间能够在正确时间点累加, 同时通 过恰当的保护机制, 在本地软时间出现偏移时, 又能够及时准确的校正本 地软时间, 从而保证始终输出高精度的时间信息。 附图说明
图 1为本发明的输出时间信息方法的实现流程图;
图 2为本发明一种实施例中输出时间信息的装置与外界的连接示意图; 图 3为本发明一种实施例的时序分布图;
图 4为本发明一种实施例中实现本地软时间赋值过程的流程示意图; 图 5为本发明一种实施例中实现本地软时间校正过程的流程示意图。 具体实施方式
本发明的基本思想是: 根据卫星信号接收装置输出的授时数据, 为本 地软时间赋值,并在接收到卫星信号接收装置每秒输出一次的秒脉冲(pps, pulses per second ) 中断时, 本地软时间增加 1秒, 由本地软时间代替卫星 信号接收装置输出的授时数据, 输出到需要时间同步的系统, 如 CDMA系 统, 如此, 利用本地软时间的短稳特性, 结合卫星信号接收装置输出的卫 星时间的长稳特性, 输出长短期均稳定的高精度时间, 解决了授时数据存 在跳变的问题, 提高了授时精度。
其中, 本发明的输出时间信息的方法, 参照图 1 所示, 主要包括以下 步骤:
步骤 101 :根据卫星信号接收装置输出的授时数据,为本地软时间赋值; 步骤 102: 将所述本地软时间按照单位时间实时进行调整; 步骤 103: 实时输出所述本地软时间。
其中, 为本地软时间赋值的过程, 可以是: 实时接收卫星信号接收装 置按照单位时间输出的授时数据, 对接收到的授时数据解析得到时间信息, 并实时将当前保存的本地卫星时间更新为所得到的时间信息; 在首次更新 本地卫星时间时, 将所述本地卫星时间赋值给设置为校准的本地卫星备份 时间, 并按照所述单位时间实时调整所述本地卫星备份时间; 实时将所更 新的本地卫星时间与所述本地卫星备份时间进行比较, 在所述本地卫星时 间与所述卫星备份时间的连续相等次数达到预先配置的赋值阔值时, 验证 当前同步标志为假, 表示当前未赋值, 则将所述本地卫星时间赋值到本地 软时间, 同时设置同步标志为真。
这里, 所述本地软时间、 本地卫星时间和本地卫星备份时间的初始值 均可以是任意时间。 在上述过程中, 所述赋值阔值的设定可以根据实际需 要来确定。
这里, 卫星信号接收装置输出的授时数据可以包括时间、 经纬度、 当 前锁定卫星数量等信息。
这里, 所述赋值阔值可以根据实际应用情况来确定, 如果需要快速进 行赋值, 可以将所述赋值阔值设置的较小一些, 如果不需要快速进行赋值, 要求赋值更加准确, 则可以将所述赋值阔值设置的较大一些。 例如, 可以 将赋值阔值设置为 30次, 如此, 表明在开始接收授时数据到赋值需要经过 30个单位时间, 如果单位时间为秒, 那么, 说明在开始接收授时数据到赋 值需要经过 30秒。
其中, 将所述本地软时间按照单位时间实时进行调整, 可以为: 接收 到所述卫星信号接收装置输出的 pps中断信号时,将所述本地卫星备份时间 增加单位时间; 其中,所述卫星信号接收装置按照单位时间输出 pps中断信 号。 其中, 按照所述单位时间实时调整所述本地卫星备份时间的过程与调 整所述本地软时间的过程完全相同。
实际应用中,所述卫星信号接收装置在单位时间边沿处输出 pps中断信 号, 这里的单位时间一般是秒。
其中, 实时输出所述本地软时间, 可以是: 预先配置定时中断计数器 的中断时间间隔, 所述定时中断计数器按照所配置的中断时间间隔进行计 数, 并按照单位时间进行清零操作; 在所述定时中断计数器的计数达到预 先设置的输出阔值时, 输出当前的本地软时间。
这里, 输出阔值可以根据所配置的定时中断计数器的中断时间间隔和 所述单位时间来确定, 实际应用中, 需要结合当前接收授时数据、 调整本 地软时间、 和输出本地软时间要消耗的时间, 以及需要精确时间信息的应 用系统接收所述本地软时间所需要的时间等情况来确定。
这里, 定时中断计数器的中断时间间隔要小于所述单位时间, 一般, 所述单位时间是所配置的中断时间间隔的整数倍。 例如, 所述单位时间为 秒时,所述定时中断计数器的中断时间间隔在 4 ~ 25ms之间选择比较合适, 配置定时中断计数器中断时间间隔是本领域常用技术手段, 在此不再赘述。
这里, 所述定时中断计数器按照单位时间进行清零操作, 可以为: 接 收到所述卫星信号接收装置输出的 pps中断信号时,将所述定时中断计数器 清零, 其中, 所述卫星信号接收装置按照单位时间输出 pps中断信号。
其中, 在为所述本地软时间赋值后, 所述方法还包括: 实时校正所述 本地软时间。
具体地, 校正所述本地软时间的过程, 可以是: 实时接收卫星信号接 收装置按照单位时间输出的授时数据, 对接收到的授时数据解析得到时间 信息, 并实时将当前保存的本地卫星时间更新为所得到的时间信息;
在定时中断计数器的计数达到预先设定的第一校正阔值时, 且设置为 指示校正的相等次数计数器的计数达到预先设定的第二校正阔值时, 将当 前的本地卫星时间赋值给本地软时间, 对所述本地软时间进行校正。
其中, 所述定时中断计数器按照预先配置的中断时间间隔进行计数, 并按照单位时间进行清零; 在所述定时中断计数器的计数达到预先设定的 第一校正阔值时, 所述相等次数计数器进行计数或清零: 在当前的本地卫 星时间与本地软时间不一致, 且所述本地卫星时间与所述本地卫星备份时 间相等时, 所述相等次数计数器计数一次, 在当前的本地卫星时间与本地 软时间一致、 和 /或所述本地卫星时间与所述本地卫星备份时间不相等时, 所述相等次数计数器清零。
这里, 所述第一校正阔值由所配置的定时中断计数器的中断时间间隔 与所述单位时间来确定, 所述定时中断计数器从零计数到第一校正阔值所 经历的时间间隔接近所述单位时间较宜, 如此, 能够保证当前已接收到授 时数据并完成了本地卫星时间、 本地卫星备份时间、 以及本地软时间的更 新。
所述第二校正阔值可以根据实际应用情况来确定, 配置时, 可以根据 本地软时间的校正时间间隔来确定。 如果要求每隔 300个单位时间, 校正 一次, 那么, 可以将第二校正阔值设置为 300次。
相应的, 本发明还提供了一种输出时间信息的装置, 所述装置包括: CPU, 输出接口、 输入接口, 其中, 输入接口, 设置为连接卫星信号接收 装置, 接收所述卫星信号接收装置输出的授时数据; CPU, 设置为根据所 述输入接口接收到的授时数据, 为本地软时间赋值, 并将所述本地软时间 按照单位时间实时进行调整; 输出接口, 设置为实时输出所述本地软时间。
实际应用中, 所述输出接口和输入接口具体可以是串口、 以太网接口 等。
其中, 所述 CPU可以设置为, 对所述输入接口接收到的授时数据解析 得到时间信息, 并实时将当前保存的本地卫星时间更新为所得到的时间信 息; 在首次更新本地卫星时间时, 将所述本地卫星时间赋值给设置为校准 的本地卫星备份时间, 并按照所述单位时间实时调整所述本地卫星备份时 间; 实时将所更新的本地卫星时间与所述本地卫星备份时间进行比较, 在 所述本地卫星时间与所述卫星备份时间的连续相等次数达到预先配置的赋 值阔值时, 验证当前同步标志为假, 表示当前未赋值, 则将所述本地卫星 时间赋值到本地软时间, 同时设置同步标志为真。
这里, 所述 CPU还设置为接收所述卫星信号接收装置按单位时间输出 的 pps中断信号,根据所接收到的 pps中断时间, 将所述本地软时间实时进 行调整。
其中, 所述装置还包括: 定时中断计数器, 所述定时中断计数器按照 所配置的中断时间间隔进行计数, 并按照单位时间进行清零操作; 所述 CPU, 还设置为在所述定时中断计数器的计数达到预先设置的输出阔值时, 将当前的本地软时间通过所述输出接口输出。
其中, 所述 CPU还设置为, 实时校正所述本地软时间。
这里, 所述装置还可以包括相等次数计数器, 在所述定时中断计数器 的计数达到预先设定的第一校正阈值时, 所述相等次数计数器进行计数或 清零: 在当前的本地卫星时间与本地软时间不一致, 且所述本地卫星时间 与所述本地卫星备份时间相等时, 所述相等次数计数器计数一次, 在当前 的本地卫星时间与本地软时间一致、 和 /或所述本地卫星时间与所述本地卫 星备份时间不相等时, 所述相等次数计数器清零; 所述 CPU还设置为, 在 所述相等次数计数器的计数达到第二校正阔值时, 将当前的本地卫星时间 赋值给本地软时间, 对所述本地软时间进行校正。
通过上述的装置实现时间信息输出的具体过程, 请参照上述的方法描 述, 在此不再赘述。 实施例一
本实施例中, 输出时间信息的过程, 具体可以包括如下步骤: 步骤 1 : 将输出时间信息的装置与卫星信号接收装置连接, 并进行初始 化操作;
具体地, 本实施例中, 输出时间信息的装置与外界的连接方式如图 2 所示, 卫星信号接收装置通过天线接收卫星发出的信号, 本实施例中输出 时间信息的装置, 其输入端口通过物理链路与卫星信号接收装置连接, 其 输出端口与需要高精度时间信息的系统(图 2中未示)进行连接,如 CDMA 系统。
其中, 所述输出时间信息的装置主要包括一个嵌入式 CPU, 该 CPU上 具有连接接口、 定时中断计数器和相等次数计数器。 这里, 连接接口主要 是输入串口和输出串口, 其中, 输入串口设置为连接所述卫星信号接收装 置, 接收卫星信号接收装置输出的授时数据及其他, 输出串口设置为连接 需要高精度时间信息的系统, 向外输出本地软时间。
对所述输出时间信息的装置进行初始化操作, 包括: 初始化本地软时 间 T1, 配置外部中断, 配置定时中断计数器的中断时间间隔;
这里, 初始化本地软时间 T1, 可以将本地软时间 T1设置为任意一个时 间, 例如, 可以将本地软时间 T1的初始值设为 2003年 1月 1 日 12点整; 具体地,配置外部中断可以是:将卫星信号接收装置的 pps中断信号配 置为所述输出时间信息装置的外部中断。 这里, 在卫星信号接收装置初始 化后, 会每秒钟输出一次授时数据, 在每秒边沿处产生一次 pps中断信号。
实际应用中, CPU都有多个中断引脚, 在 CPU的中断引脚上, 如果电 平发生跳变,就会触发一个中断。将卫星信号接收装置的 pps输出端口连接 到 CPU的中断引脚上, 在卫星时间的秒边沿到来时, 卫星信号接收装置产 生的 pps中断信号发生跳变, 并输出到 CPU的中断引脚上, CPU就会产生 中断, 这样, 使得输出时间信息的装置单位时间为秒, 并且能够与卫星的 单位时间同步。
具体地, 配置定时中断计数器的中断时间间隔为 4ms , 这样, 在每秒 钟定时中断计数器将会产生 250次定时中断, 相当于把每秒分成 250个时 间片。
图 3是本实施例的时序分布图,其中, 时序被 pps中断信号分割成以秒 为单位的序列, 而在每一秒内, 又被定时中断分割成 250个时间片, 每个 时间片长度为 4ms。
这里, 定时中断计数器中断时间间隔的大小, 实际受制于当前输出时 间信息装置的 CPU。 如果配置的定时中断计数器中断时间间隔太小, 例如 lms, 则中断太频繁, 会影响所述装置对外的响应速度; 如果配置的定时中 断计数器中断时间间隔太大, 例如 100ms , 则粒度太粗, 无法在卫星信号 接收装置输出的授时数据到来后及时处理。 一般, 配置的定时中断计数器 中断时间间隔在 4 ~ 25ms之间比较合适, 承载的 CPU不同, 具体的配置方 法也就不同, 配置定时中断计数器中断时间间隔是本领域常用技术手段, 在此不再赘述。
步骤 2: 根据卫星信号接收装置输出的授时数据, 为本地软时间赋值; 具体地, 为本地软时间赋值的过程, 如图 4所示, 具体流程如下: S401 : 当前接收到 pps 中断信号时, 判断上一秒是否接收到所述卫星 信号接收装置输出的授时数据, 如果是, 则继续 S402; 如果否, 结束当前 流程;
具体地, 卫星信号接收装置每秒输出一次授时数据, 每接收到授时数 据时, 触发串口中断函数, 将当前的用于表示数据接收的标志设置为 true, 初始化时, 该标志设置为 false。
卫星信号接收装置每秒边沿处会产生一次 pps 中断信号, 每次接收到 pps中断信号, 触发 pps中断函数, 判断当前的所述表示数据接收的标志状 态, 如果所述标志的状态为 true, 说明上一秒的授时数据已经收到, 则重新 设置该标志为 false; 如果所述标志当前为 false, 表明上一秒的授时数据未 正常收到。
S402: 解析所接收到的授时数据, 得到时间信息, 并将本地卫星时间
Ts更新为所得到的时间信息;
具体地, 每接收到授时数据时, 触发串口中断函数, 对接收到的授时 数据进行解析, 得到时间信息, 并将所得到的时间信息作为本地卫星时间 Ts保存。
这里, 本地卫星时间 Tb的初始值可以是任意时间值。
S403: 将所述本地卫星时间 Ts赋值给本地卫星备份时间 Tb;
具体地, 本步骤也是通过触发串口中断函数来实现。
这里, 本地卫星备份时间 Tb的初始值可以是任意时间值。
S404: 判断当前同步标识是否为假, 如果是, 则继续 S405; 如果否, 结束当前的赋值流程;
这里, 同步标识设置为表示当前是否已对本地软时间赋值, 初始时, 该同步标识为 H 表明还没有对本地软时间 T1赋值。 每次初始上电时, 同 步标识都为假, 同步之后, 该标志设为真。
S405: 将所述本地卫星时间 Ts与所述本地卫星备份时间 Tb进行比较, 在本地卫星时间 Ts与所述本地卫星备份时间 Tb相等时, 检测所述本地卫 星时间 Ts与所述本地卫星备份时间 Tb连续相等的次数是否达到预先设置 的赋值阔值, 如果是, 则继续 S406, 如果否, 继续 S408;
这里, 可以通过设置为赋值的计数器对本地卫星时间 Ts与所述本地卫 星备份时间 Tb连续相等的次数进行计数,该计数器在每次比较当前本地卫 星时间 Ts与所述本地卫星备份时间 Tb不相等时, 清零; 每次比较当前本 地卫星时间 Ts与本地卫星备份时间 Tb相等时, 计数一次。 在所述设置为 赋值的计数器的计数达到预先设置的赋值阔值时, 继续 S406, 如果否, 继 续 S408。
本实施例中, 可以将所述赋值阔值设置为 30次, 实际应用中, 可以根 据实际应用情况来确定。
S406: 将所述本地卫星时间 Ts赋值为本地软时间 T1 ,并将所述同步标 志设置为真, 表明本地软时间 T1已赋值, 完成本地软时间的赋值。
S407: 将本地软时间 T1和本地卫星备份时间 Tb各增加 1秒, 结束当 前流程;
S408: 将所述本地卫星备份时间 Tb增加 1秒;
S409: 接收到下一个 pps 中断信号时, 接收授时数据, 解析所接收到 的授时数据, 得到时间信息, 并将本地卫星时间 Ts更新为所得到的时间信 息, 返回 S404。
具体地, S409的具体实现过程与 S401~402的实现过程完全相同。 这里, 按照上述流程, 每秒都会更新一次本地卫星时间 Ts, 在本地卫 星时间 Ts与本地卫星备份时间 Tb连续相等的次数达到 30次时, 将本地卫 星时间 Ts赋值给本地软时间 T1 , 如此, 既能够保证赋值的准确性, 还能够 在上电后迅速为本地软时间赋值, 以便可以快速输出正确时间。
步骤 3 , 实时按秒调整本地软时间;
具体地,卫星信号接收装置每秒边沿处会产生一次 pps中断信号,每接 收到一次卫星信号接收装置输出的 pps中断信号, 触发 pps中断函数,将本 地软时间 T1和本地卫星备份时间 Tb都增加 1秒, 如此, 使得本地软时间 能够与卫星输出的时间同步增加, 保证本地软时间的实时运行。
步骤 4: 实时输出本地软时间;
这里, 在定时中断计数器的计数每达到一次预设的输出阔值, 就输出 一次本地软时间。
具体地, 每接收到一次 pps中断信号, 触发 pps中断函数, 将所述定时 中断计数器清零一次, 清零之后, 定时中断计数器会按照预先配置的中断 时间间隔重新开始计数。 如果配置的中断时间间隔为 4ms , 则每隔 4ms , 定 时中断计数器计数一次, 直到所述定时中断计数器计数的次数累加到预设 的输出阔值时, 就输出一次本地软时间。
本实施例中, 将输出阔值设置为 10次, 在每次定时中断计数器计数达 到 10时,也就是在每次接收到 pps中断信号之后的 40ms,输出一次本地软 时间 Tl。
实际使用中, 可以将所述 pps中断信号和本地软时间 T1一起输出。 还 可以将 pps中断信号和本地软时间 T1分发到各分布式系统, 这样, 各分布 式系统就可以共享一个时间源, 从而能够有效降低建设成本。
这里, 由于时间信息的分发需要消耗传输时间, 当时间信息到达目标 系统时, 实际已经过时, 因此, 需要同时分发 pps中断信号, 以便目标系统 能够知道当前超时的时间。
其中, 在对本地软时间赋值之后, 本实施例还可以包括: 对本地软时 间 T1进行校正的过程。 具体地, 如图 5所示, 对本地软时间 T1进行校正 的流程如下:
S501 : 验证定时中断计数器的计数是否达到预设的第一校正阔值 200, 如果是, 继续 S502, 如果否, 结束当前流程;
这里, 在绝对时间的秒沿时刻, 也就是 pps中断信号到来时, 卫星信号 接收装置并不会马上输出授时数据, 往往需要经过一系列数据处理, 需要 消耗一定的时间; 并且, 接收卫星信号接收装置输出的授时数据后, 还需 要对授时数据进行解析, 得到时间信息, 更新本地卫星时间, 这一系列的 处理过程也需要消耗时间。 考虑到上述情况, 本实施例中, 将第一校正阔 值设置为 200, 当前定时中断计数器的中断时间间隔为 4ms , 也就是接收到 pps中断信号后的 800ms, 以保证当前秒内的授时数据已接收到, 并且本地 卫星时间的更新也已经完成。
S502: 验证当前的本地软时间 T1与本地卫星时间 Ts是否相等, 如果 是, 则继续 S507, 如果否, 继续 S503;
S503: 验证本地卫星备份时间 Tb与本地卫星时间 Ts是否相等, 如果 是, 则继续 S504, 如果否, 继续 S507;
S504-505: 将相等次数计数器累加 1 , 并验证相等次数计数器的计数是 否达到预设的第二校正阔值 300, 如果是, 继续 S506, 如果否, 返回 S501 ; 这里, 在相等次数计数器每秒会累加 1 次, 如果相等次数计数器的计 数达到 300, 即在过去的 300秒(5分钟) 内, 本地卫星时间 Ts与本地卫 星备份时间 Tb一直都是相等的, 说明当前的本地卫星时间 Ts是准确的。 而此时, 本地软时间 T1与本地卫星时间 Ts不相等, 则说明本地软时间出 现了偏移, 需要校正。
S506: 将当前的本地卫星时间 Ts赋值给本地软时间 T1 , 完成当前本地 软时间的校正过程;
S507: 清零相等次数计数器, 返回 S501。
以上所述, 仅为本发明的较佳实施例而已, 并非用于限定本发明的保 护范围, 凡在本发明的精神和原则之内所作的任何修改、 等同替换和改进 等, 均应包含在本发明的保护范围之内。

Claims

权利要求书
1、 一种输出时间信息的方法, 所述方法包括:
根据卫星信号接收装置输出的授时数据, 为本地软时间赋值; 将所述本地软时间按照单位时间实时进行调整;
实时输出所述本地软时间。
2、 根据权利要求 1所述的输出时间信息的方法, 其中, 所述为本地软 时间赋值, 包括:
实时接收卫星信号接收装置按照单位时间输出的授时数据, 对接收到 的授时数据解析得到时间信息, 并实时将当前保存的本地卫星时间更新为 所得到的时间信息;
在首次更新本地卫星时间时, 将所述本地卫星时间赋值给设置为校准 的本地卫星备份时间, 并按照所述单位时间实时调整所述本地卫星备份时 间;
实时将所更新的本地卫星时间与所述本地卫星备份时间进行比较, 在 所述本地卫星时间与所述卫星备份时间的连续相等次数达到预先配置的赋 值阔值时, 验证当前同步标志为假, 表示当前未赋值, 则将所述本地卫星 时间赋值到本地软时间, 同时设置同步标志为真, 完成赋值。
3、 根据权利要求 1所述的输出时间信息的方法, 其中, 所述将所述本 地软时间按照单位时间实时进行调整, 为:
接收到所述卫星信号接收装置按照单位时间输出的 pps中断信号时,将 所述本地卫星备份时间增加单位时间。
4、 根据权利要求 1所述的输出时间信息的方法, 其中, 所述实时输出 所述本地软时间, 为:
预先配置定时中断计数器的中断时间间隔, 所述定时中断计数器按照 所配置的中断时间间隔进行计数, 并按照单位时间进行清零操作; 在所述 定时中断计数器的计数达到预先设置的输出阔值时, 输出当前的本地软时 间。
5、 根据权利要求 4所述的输出时间信息的方法, 其中, 所述定时中断 计数器按照单位时间进行清零操作, 为:
接收到所述卫星信号接收装置按照单位时间输出的 pps中断信号时,所 述定时中断计数器清零。
6、 根据权利要求 1所述的输出时间信息的方法, 其中, 在为所述本地 软时间赋值后, 所述方法还包括: 实时校正所述本地软时间。
7、 根据权利要求 6所述的输出时间信息的方法, 其中, 所述实时校正 所述本地软时间, 包括:
实时接收卫星信号接收装置按照单位时间输出的授时数据, 对接收到 的授时数据解析得到时间信息, 并实时将当前保存的本地卫星时间更新为 所得到的时间信息;
在定时中断计数器的计数达到预先设定的第一校正阔值时, 且设置为 指示校正的相等次数计数器的计数达到预先设定的第二校正阔值时, 将当 前的本地卫星时间赋值给本地软时间, 对所述本地软时间进行校正;
其中, 所述定时中断计数器按照预先配置的中断时间间隔进行计数, 并按照单位时间进行清零; 在所述定时中断计数器的计数达到预先设定的 第一校正阔值时, 所述相等次数计数器进行计数或清零: 在当前的本地卫 星时间与本地软时间不一致, 且所述本地卫星时间与所述本地卫星备份时 间相等时, 所述相等次数计数器计数一次, 在当前的本地卫星时间与本地 软时间一致、 和 /或所述本地卫星时间与所述本地卫星备份时间不相等时, 所述相等次数计数器清零。
8、 根据权利要求 1至 7任一项所述的输出时间信息的方法, 其中, 所 述单位时间为秒。
9、 一种输出时间信息的装置, 所述装置包括: CPU、 输出接口、 输入 接口, 其中,
输入接口, 设置为连接卫星信号接收装置, 接收所述卫星信号接收装 置输出的授时数据;
CPU, 设置为根据所述输入接口接收到的授时数据, 为本地软时间赋 值, 并将所述本地软时间按照单位时间实时进行调整;
输出接口, 设置为实时输出所述本地软时间。
10、 根据权利要求 9所述的输出时间信息的装置, 其中, 所述 CPU还 设置为, 对所述输入接口接收到的授时数据解析得到时间信息, 并实时将 当前保存的本地卫星时间更新为所得到的时间信息; 在首次更新本地卫星 时间时, 将所述本地卫星时间赋值给设置为校准的本地卫星备份时间, 并 按照所述单位时间实时调整所述本地卫星备份时间;
实时将所更新的本地卫星时间与所述本地卫星备份时间进行比较, 在 所述本地卫星时间与所述卫星备份时间的连续相等次数达到预先配置的赋 值阔值时, 验证当前同步标志为假, 表示当前未赋值, 则将所述本地卫星 时间赋值到本地软时间, 同时设置同步标志为真, 完成赋值。
11、 根据权利要求 9所述的输出时间信息的装置, 其中, 所述 CPU还 设置为接收所述卫星信号接收装置按单位时间输出的 pps中断信号,根据所 接收到的 pps中断时间, 将所述本地软时间实时进行调整。
12、 根据权利要求 9所述的输出时间信息的装置, 其中, 所述装置还 包括: 定时中断计数器, 所述定时中断计数器按照所配置的中断时间间隔 进行计数, 并按照单位时间进行清零操作;
所述 CPU还设置为, 在所述定时中断计数器的计数达到预先设置的输 出阔值时, 将当前的本地软时间通过所述输出接口输出。
13、 根据权利要求 9所述的输出时间信息的装置, 其中, 所述 CPU还 设置为, 实时校正所述本地软时间。
14、 根据权利要求 9至 13任一项所述的输出时间信息的装置, 其中, 所述装置还包括相等次数计数器, 在所述定时中断计数器的计数达到预先 设定的第一校正阔值时, 所述相等次数计数器进行计数或清零: 在当前的 本地卫星时间与本地软时间不一致, 且所述本地卫星时间与所述本地卫星 备份时间相等时, 所述相等次数计数器计数一次, 在当前的本地卫星时间 与本地软时间一致、 和 /或所述本地卫星时间与所述本地卫星备份时间不相 等时, 所述相等次数计数器清零;
所述 CPU还设置为, 在所述相等次数计数器的计数达到第二校正阔值 时, 将当前的本地卫星时间赋值给本地软时间, 对所述本地软时间进行校 正。
PCT/CN2011/072773 2010-12-15 2011-04-14 一种输出时间信息的装置及方法 WO2012079326A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN 201010589155 CN102023565B (zh) 2010-12-15 2010-12-15 一种输出时间信息的装置及方法
CN201010589155.5 2010-12-15

Publications (1)

Publication Number Publication Date
WO2012079326A1 true WO2012079326A1 (zh) 2012-06-21

Family

ID=43864961

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/072773 WO2012079326A1 (zh) 2010-12-15 2011-04-14 一种输出时间信息的装置及方法

Country Status (2)

Country Link
CN (1) CN102023565B (zh)
WO (1) WO2012079326A1 (zh)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102809926B (zh) * 2012-07-31 2017-07-04 中国科学院紫金山天文台 天文望远镜多通道定时装置
CN103309228B (zh) * 2013-06-21 2017-08-25 厦门雅迅网络股份有限公司 车载终端系统的时间校正方法
US10162792B2 (en) * 2016-10-13 2018-12-25 Baidu Usa Llc Method and system for high precision time synchronization
CN106940665B (zh) * 2017-03-24 2021-04-20 惠州Tcl移动通信有限公司 一种基于移动终端的时间校正控制方法、系统及移动终端
CN109960141A (zh) * 2017-12-26 2019-07-02 北京无线电计量测试研究所 一种原子时尺度快速监测的系统及方法
CN109150353B (zh) * 2018-07-25 2020-01-14 安徽江淮汽车集团股份有限公司 一种电动汽车车载tbox的校时方法及系统
CN110177220B (zh) * 2019-05-23 2020-09-01 上海图趣信息科技有限公司 一种具有外部授时功能的相机及其控制方法
CN112379587A (zh) * 2020-10-30 2021-02-19 中国石油天然气集团有限公司 海洋节点授时系统及授时方法
CN114089038B (zh) * 2021-11-16 2024-04-16 许昌许继软件技术有限公司 同步相量测量装置动态数据的时标秒位跳变处理方法及系统

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101242231A (zh) * 2008-03-03 2008-08-13 电子科技大学 面向电力系统同步相量测量的时钟同步装置
US7538726B1 (en) * 2007-04-10 2009-05-26 Air Semiconductor, Ltd. PVT optimization architecture for always-on GPS receivers
CN101770208A (zh) * 2008-12-30 2010-07-07 郑州威科姆科技股份有限公司 一种电力系统授时时钟的实现方法

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR960009539B1 (en) * 1993-12-27 1996-07-20 Hyundai Electronics Ind Apparatus for synchronizing time using satellite
JP3839277B2 (ja) * 2001-05-25 2006-11-01 三菱電機株式会社 無線通信システム及び基地局のフレーム同期方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7538726B1 (en) * 2007-04-10 2009-05-26 Air Semiconductor, Ltd. PVT optimization architecture for always-on GPS receivers
CN101242231A (zh) * 2008-03-03 2008-08-13 电子科技大学 面向电力系统同步相量测量的时钟同步装置
CN101770208A (zh) * 2008-12-30 2010-07-07 郑州威科姆科技股份有限公司 一种电力系统授时时钟的实现方法

Also Published As

Publication number Publication date
CN102023565A (zh) 2011-04-20
CN102023565B (zh) 2013-08-07

Similar Documents

Publication Publication Date Title
WO2012079326A1 (zh) 一种输出时间信息的装置及方法
CN109617641B (zh) 一种基于秒脉冲的可调精度时间获取方法
US11177896B2 (en) Time synchronization device and time synchronization method
US20210141096A1 (en) Internet-based time and frequency recovery for position fixing of gnss receiver
US9838196B2 (en) Synchronization apparatus, synchronization system, radio communication apparatus and synchronization method
CA2767499C (en) A method of time synchronization of free running nodes in an avionics network
US7191354B2 (en) Method for synchronizing a first clock to a second clock, processing unit and synchronization system
US20120294318A1 (en) Method and System for Implementing Time Synchronization in Local Area Network (LAN)
US9722772B2 (en) Distribution of dynamic accuracy information in a network of IEEE 1588 clocks
US9763207B2 (en) Timing synchronization device and timing synchronization control method
WO2017101484A1 (zh) 时间同步方法和装置
US20220360350A1 (en) Method and apparatus for acquiring timestamp of data stream, storage medium, and electronic apparatus
CN104469929A (zh) 同步基站组件的方法
CN112162591B (zh) 具有多个处理器的电子装置及其同步方法
CN106572528B (zh) 一种时钟同步方法及装置
CN112600637A (zh) 无线广播授时校准方法、设备及计算机可读存储介质
US20200382233A1 (en) Information processing apparatus and time synchronization method
CN104393981A (zh) 一种多路测量数据并行的时间标记方法及系统
CN109361485B (zh) 一种在非实时系统中校准ptp主时钟的方法
JP6516217B2 (ja) 同期メッセージ送出装置、時刻同期システム、同期メッセージ送出方法およびプログラム
WO2022062670A1 (zh) 计时方法、目视助航设备控制方法及相关装置
CN117320144A (zh) 基于无线通信的子母钟时间同步方法和系统
US20170222744A1 (en) Frequency calibration apparatus and method
CN108873669B (zh) 一种计算机同步时钟的utc时间计算方法
JP6516216B2 (ja) 同期メッセージ送出装置、時刻同期システム、同期メッセージ送出方法およびプログラム

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: 11847922

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 11847922

Country of ref document: EP

Kind code of ref document: A1