A timing server, timing method and device
By using high-precision clock chip and SNTP protocol in the timing server, combined with real-time calibration mechanism, the problems of insufficient timing accuracy and insufficient applicability in the existing technology are solved, and a high-precision and low-cost time synchronization solution is realized, which is suitable for Underground environment of urban rail transit industry.
Patent Information
- Application Number
- CN202111276867.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-29
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2041-10-29
AI Technical Summary
In the prior art, there are professional NTP timer servers that are expensive and not suitable for underground environments, or software implementation methods that are low-cost but insufficiently accurate, which are difficult to meet the high-precision requirements of the urban rail transit industry for time synchronization.
A timing server was designed, using the high-precision clock chip DS3231 as the real-time clock module, combining the SNTP timing hardware module and the main control module, sending time data to the network client through the SNTP protocol, and calibrating the clock in real time to ensure the accuracy of time synchronization and Stability, suitable for various scenarios.
It realizes high-precision time synchronization, meets the requirements of the urban rail transit industry for the synchronous acquisition accuracy of the acquisition board, and has a simple structure and low cost, which is suitable for underground and occlusion situations.
Smart Images

Figure CN114006673B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a timing server, a timing method and a device. Background Art
[0002] With the rapid development of science and technology, industries such as urban rail transit have higher and higher requirements for the synchronous acquisition of measurement and control devices. At present, the acquisition board and the main monitoring device mostly communicate through Ethernet or CAN (Controller Area Network) communication interface. Due to the actual situation on site, the time synchronization of multiple acquisition boards can only be achieved through the Ethernet NTP protocol (Network Time Protocol).
[0003] Currently, there are two main ways to implement timing services: one is to directly purchase a professional NTP timing server, which is relatively expensive and has high timing accuracy, but its clock source is mostly GPS (Global Positioning System) or Beidou and other satellite clocks, which are suitable for open places but not suitable for underground or obstructed situations; the other is to implement NTP service through software in the main monitoring device, which has the advantage of low cost, but is more difficult to implement, and the timing accuracy generally cannot meet the synchronization acquisition accuracy requirements of the acquisition board. Summary of the invention
[0004] In view of this, the purpose of the present invention is to provide a timing server, a timing method and a device, which can improve the timing accuracy and are not limited by the usage scenario. The specific scheme is as follows:
[0005] In a first aspect, the present application discloses a timing server, comprising:
[0006] A real-time clock module is used to send a pulse signal to the SNTP timing hardware module to provide a time reference for the SNTP timing hardware module;
[0007] The SNTP timing hardware module connected to the real-time clock module is used to send time data to the client to be timed in the network according to the SNTP protocol based on the time reference;
[0008] The main control module is respectively connected to the real-time clock module and the SNTP timing hardware module, and is used for obtaining the current time of the real-time clock module if a time calibration command sent by a main monitoring device is received, and judging whether the time calibration time in the time calibration command is consistent with the current time; if they are inconsistent, calibrating the time of the real-time clock module and the SNTP timing hardware module based on the time calibration time.
[0009] Optionally, the real-time clock module is a high-precision clock chip DS3231, the real-time clock module includes a temperature-compensated clock, the clock accuracy of the real-time clock module is 2PPM, and the real-time clock module includes a programmable pulse output.
[0010] Optionally, the SNTP timing hardware module is a CH9126 chip, the SNTP timing hardware module has a built-in SNTP protocol, and contains a MAC interface and a PHY interface.
[0011] Optionally, the main control module is an STM32 microcontroller.
[0012] Optionally, the main control module is also used to receive a configuration command sent by the main monitoring device, and update relevant parameters of the real-time clock module and / or the SNTP timing hardware module according to the configuration parameters in the configuration command.
[0013] Optionally, the timing server further includes:
[0014] A communication module is used to receive the timing command and / or the configuration command sent by the main monitoring device, and forward the timing command and / or the configuration command to the main control module; the communication module is a CAN communication module or a 485 communication module or a 232 communication module.
[0015] Optionally, the configuration command includes a first configuration command for the real-time clock module and a second configuration command for the SNTP timing hardware module; the configuration parameters in the first configuration command include any one or more of year, month, day, hour, minute and second; the configuration parameters in the second configuration command include any one or more of working mode, network configuration parameters and serial port communication configuration parameters; the working mode includes client mode and server mode.
[0016] In a second aspect, the present application discloses a timing method, comprising:
[0017] Sending a pulse signal to the SNTP timing hardware module through the real-time clock module to provide a time reference to the SNTP timing hardware module;
[0018] Sending time data to a client to be timed in the network according to the SNTP protocol based on the time reference through the SNTP timing hardware module connected to the real-time clock module;
[0019] Through the main control module respectively connected to the real-time clock module and the SNTP timing hardware module, the time calibration command sent by the main monitoring device is received, and the current time of the real-time clock module is obtained according to the time calibration command, and it is determined whether the time calibration time in the time calibration command is consistent with the current time. If they are inconsistent, the time of the real-time clock module and the SNTP timing hardware module are calibrated based on the time calibration time.
[0020] In a third aspect, the present application discloses an electronic device, comprising:
[0021] Memory, used to store computer programs;
[0022] The processor is used to execute the computer program to implement the aforementioned timing method.
[0023] In this application, a pulse signal is sent to the SNTP timing hardware module connected to the real-time clock module through the real-time clock module to provide a time reference to the SNTP timing hardware module, so that the SNTP timing hardware module is based on the time reference and sends time data to the client to be timed in the network according to the SNTP protocol to achieve time service, that is, the real-time clock module is used as the clock source in this application, and there is no need to use satellite clocks such as GPS or Beidou, and the use scenario is not restricted, which is convenient for on-site installation and deployment. In addition, this application receives the time calibration time sent by the main monitoring device in real time through the main control module through the main control module, reads the time calibration time of the real-time clock module at the same time, and compares the time calibration time with the current time, and judges whether it is necessary to correct the time of the real-time clock module and the NTP timing hardware module according to the comparison result, so as to ensure high time accuracy, meet the accuracy requirements of the acquisition board, and have a simple structure and low cost, and is particularly suitable for the situation where the equipment of the urban rail transit industry is underground and blocked. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0025] Figure 1 A schematic diagram of the timing server structure provided for this application;
[0026] Figure 2 A schematic diagram of a specific timing server structure provided for this application;
[0027] Figure 3A timing server flow chart provided for this application;
[0028] Figure 4 A structural diagram of an electronic device provided for this application. DETAILED DESCRIPTION
[0029] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0030] In the prior art, there are two main ways to implement timing services: one is to directly purchase a professional NTP timing server, which is relatively expensive and has high timing accuracy, but its clock source is mostly GPS (Global Positioning System) or Beidou and other satellite clocks, which are suitable for open places, but not suitable for underground or blocked situations; the other is to implement NTP services through software in the main monitoring device, which has the advantage of low cost, but is difficult to implement, and the timing accuracy generally cannot meet the synchronization acquisition accuracy requirements of the acquisition board. In order to overcome the above technical problems, the present application proposes a timing server that can improve the timing accuracy and is not limited by the usage scenario.
[0031] The present application embodiment discloses a timing server, see Figure 1 As shown, the timing server may include:
[0032] The real-time clock module 11 is used to send a pulse signal to the SNTP timing hardware module to provide a time reference for the SNTP timing hardware module.
[0033] In this embodiment, the real-time clock module 11 is used to send a pulse signal to the SNTP (Simple Network Time Protocol) timing hardware module 12 to provide a time reference to the SNTP timing hardware module 12. In other words, the real-time clock module 11 provides the pulse signal as a time reference to the SNTP timing hardware module 12, and the pulse signal can be a pulse signal with a period of 1S and a pulse width of 100ms. The real-time clock module 11 and the SNTP timing hardware module 12 can be connected through a common IO interface.
[0034] In this embodiment, the real-time clock module 11 is a high-precision clock chip DS3231, the real-time clock module 11 includes a temperature-compensated clock, the clock accuracy of the real-time clock module 11 is 2PPM, and the real-time clock module 11 includes a programmable pulse output. That is, the real-time clock module 11 is implemented using a high-precision clock chip DS3231, which has a temperature-compensated clock inside, the clock accuracy is 2PPM, and has a programmable pulse output, specifically a PPIS pulse signal.
[0035] The SNTP timing hardware module 12 connected to the real-time clock module 11 is used to send time data to the client to be timed in the network according to the SNTP protocol based on the time reference.
[0036] In this embodiment, the SNTP timing hardware module 12 receives the time reference sent by the real-time clock module 11, converts the received time reference into the SNTP protocol, and transmits the time data to the client in the network. That is to say, the received time reference is a pulse signal. The SNTP timing hardware module 12 needs to process the time reference signal and then transmit the time data to the client through the network protocol. The transmitted network protocol is the SNTP protocol.
[0037] In the present embodiment, the SNTP timing hardware module 12 is a CH9126 chip, and the SNTP timing hardware module 12 has a built-in SNTP protocol and contains a MAC interface and a PHY interface. That is, the SNTP timing hardware module 12 can be implemented using the Qinheng CH9126 chip, which has an internal built-in SNTP protocol, a built-in MAC (Media Access Control, media access control sublayer protocol) interface and a PHY (Physical, physical layer) interface, and supports 10M / 100M full / half duplex adaptation.
[0038] The main control module 13, which is respectively connected to the real-time clock module 11 and the SNTP timing hardware module 12, is used to obtain the current time of the real-time clock module 11 if a time calibration command sent by a main monitoring device is received, and to determine whether the time calibration time in the time calibration command is consistent with the current time. If not, the time of the real-time clock module 11 and the SNTP timing hardware module 12 are calibrated based on the time calibration time.
[0039] In this embodiment, the time calibration time sent by the main monitoring device is received in real time by the main control module 13, and the time calibration time of the real-time clock module 11 is read at the same time, and the time calibration time is compared with the current time. According to the comparison result, it is determined whether the time of the real-time clock module 11 and the NTP timing hardware module 12 needs to be corrected. If the time calibration time in the time calibration command is inconsistent with the current time, a time calibration command is sent to the real-time clock module 11 and the SNTP timing hardware module 12 based on the time calibration time. The main control module 13 and the real-time clock module 11 can be interconnected through an I2C interface. In this embodiment, the accuracy of the time calibration time can be 10ms.
[0040] In this embodiment, the main control module 13 is an STM32 single-chip microcomputer. That is, in this embodiment, the main control module 13 can adopt an STM32 series high-performance single-chip microcomputer. In addition, the above-mentioned main monitoring device can be a DZC-6 type monitoring device.
[0041] In this embodiment, the main control module 13 is also used to receive the configuration command sent by the main monitoring device, and update the relevant parameters of the real-time clock module 11 and / or the SNTP timing hardware module 12 according to the configuration parameters in the configuration command. That is, the main control module 13 is not only used to receive the time calibration command sent by the main monitoring device, but also receives the configuration command sent by the main monitoring device, and the configuration command is used to control the main control module 13 to update the relevant parameters of the real-time clock module 11 and / or the SNTP timing hardware module 12 according to the configuration parameters.
[0042] Specifically, the configuration command may include a first configuration command for the real-time clock module 11 and a second configuration command for the SNTP timing hardware module 12; the configuration parameters in the first configuration command include any one or more of year, month, day, hour, minute, and second; the configuration parameters in the second configuration command include any one or more of working mode, network configuration parameters, and serial communication configuration parameters; the working mode includes client mode and server mode. The working mode in the above-mentioned second configuration command includes but is not limited to client mode and server mode; the network configuration parameters may specifically include but are not limited to IP address, subnet mask, default gateway, destination IP address, and polling interval; the serial communication configuration parameters include but are not limited to baud rate, data bit, checksum, data packet length, timeout, and communication data format.
[0043] In this embodiment, the timing server may further include: a communication module 14, which is used to receive the timing command and / or the configuration command sent by the main monitoring device, and forward the timing command and / or the configuration command to the main control module; the communication module is a CAN communication module or a 485 communication module or a 232 communication module. Figure 2 As shown, the communication module 14 is connected to the main control module 13 and the main monitoring device, and is used to receive the time calibration, configuration and other commands sent by the main monitoring device, and transmit the received control commands to the main control module 13. In other words, the main monitoring device sends the configuration command to the main control module 13 through the communication module 14, and then the main control module 13 updates the configuration parameters in the two modules according to the configuration parameters in the configuration command. The above-mentioned communication module can be specifically a CAN communication module, a 485 communication module or a 232 communication module.
[0044] As can be seen from the above, in this embodiment, a pulse signal is sent to the SNTP timing hardware module connected to the real-time clock module through the real-time clock module to provide a time reference to the SNTP timing hardware module, so that the SNTP timing hardware module is based on the time reference and sends time data to the client to be timed in the network according to the SNTP protocol to achieve time service, that is, the real-time clock module is used as the clock source in this application, and there is no need to use satellite clocks such as GPS or Beidou, and the use scenario is not restricted, which is convenient for on-site installation and deployment. In addition, this application receives the time calibration time sent by the main monitoring device in real time through the main control module through the main control module, reads the time calibration time of the real-time clock module at the same time, and compares the time calibration time with the current time, and judges whether it is necessary to correct the time of the real-time clock module and the NTP timing hardware module according to the comparison result, so as to ensure high time calibration accuracy, meet the accuracy requirements of the acquisition board, and have a simple structure and low cost, and is particularly suitable for the situation where the equipment of the urban rail transit industry is underground and blocked.
[0045] The present application embodiment discloses a timing method, see Figure 3 As shown, the method may include the following steps:
[0046] Step S11: Sending a pulse signal to the SNTP timing hardware module through the real-time clock module to provide a time reference for the SNTP timing hardware module.
[0047] Step S12: sending time data to the client to be timed in the network according to the SNTP protocol based on the time reference through the SNTP timing hardware module connected to the real-time clock module.
[0048] Step S13: Receive the time calibration command sent by the main monitoring device through the main control module respectively connected to the real-time clock module and the SNTP timing hardware module, and obtain the current time of the real-time clock module according to the time calibration command, and determine whether the time calibration time in the time calibration command is consistent with the current time. If not, calibrate the time of the real-time clock module and the SNTP timing hardware module based on the time calibration time.
[0049] As can be seen from the above, in this embodiment, a pulse signal is sent to the SNTP timing hardware module connected to the real-time clock module through the real-time clock module to provide a time reference to the SNTP timing hardware module, so that the SNTP timing hardware module is based on the time reference and sends time data to the client to be timed in the network according to the SNTP protocol to achieve time service, that is, the real-time clock module is used as the clock source in this application, and there is no need to use satellite clocks such as GPS or Beidou, and the use scenario is not restricted, which is convenient for on-site installation and deployment. In addition, this application receives the time calibration time sent by the main monitoring device in real time through the main control module through the main control module, reads the time calibration time of the real-time clock module at the same time, and compares the time calibration time with the current time, and judges whether it is necessary to correct the time of the real-time clock module and the NTP timing hardware module according to the comparison result, so as to ensure high time calibration accuracy, meet the accuracy requirements of the acquisition board, and have a simple structure and low cost, and is particularly suitable for the situation where the equipment of the urban rail transit industry is underground and blocked.
[0050] In this embodiment, the real-time clock module may be a high-precision clock chip DS3231, the real-time clock module includes a temperature-compensated clock, the clock accuracy of the real-time clock module is 2PPM, and the real-time clock module includes a programmable pulse output.
[0051] In this embodiment, the SNTP timing hardware module may be a CH9126 chip. The SNTP timing hardware module has a built-in SNTP protocol and includes a MAC interface and a PHY interface.
[0052] In this embodiment, the main control module may be an STM32 single chip microcomputer.
[0053] In this embodiment, the main control module is also used to receive the configuration command sent by the main monitoring device, and update the relevant parameters of the real-time clock module and / or the SNTP timing hardware module according to the configuration parameters in the configuration command.
[0054] In this embodiment, the communication module is also used to receive the timing command and / or the configuration command sent by the main monitoring device, and forward the timing command and / or the configuration command to the main control module; the communication module is a CAN communication module, a 485 communication module, or a 232 communication module.
[0055] In this embodiment, the configuration command includes a first configuration command for the real-time clock module and a second configuration command for the SNTP timing hardware module; the configuration parameters in the first configuration command include any one or more of year, month, day, hour, minute, and second; the configuration parameters in the second configuration command include any one or more of working mode, network configuration parameters, and serial port communication configuration parameters; the working mode includes client mode and server mode.
[0056] Furthermore, the present application also discloses an electronic device, see Figure 4 As shown, the contents in the drawings should not be considered as any limitation on the scope of use of the present application.
[0057] Figure 4 The present invention provides a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the timing method disclosed in any of the aforementioned embodiments.
[0058] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0059] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon include an operating system 221, a computer program 222, and data 223 including timing commands, etc. The storage method can be temporary storage or permanent storage.
[0060] The operating system 221 is used to manage and control the hardware devices and computer programs 222 on the electronic device 20, so as to realize the operation and processing of the massive data 223 in the memory 22 by the processor 21, and it can be Windows Server, Netware, Unix, Linux, etc. In addition to including the computer program that can be used to complete the timing performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include computer programs that can be used to complete other specific tasks.
[0061] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0062] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0063] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0064] The above is a detailed introduction to a timing server, timing method and device provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for a general technician in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A timing server, characterized in that: include: A real-time clock module is used to send a pulse signal to the SNTP timing hardware module to provide a time reference for the SNTP timing hardware module; The SNTP timing hardware module connected to the real-time clock module is used to send time data to the client to be timed in the network according to the SNTP protocol based on the time reference; A main control module connected to the real-time clock module and the SNTP timing hardware module respectively, for obtaining the current time of the real-time clock module if a time calibration command sent by a main monitoring device is received, and determining whether the time calibration time in the time calibration command is consistent with the current time, and if not consistent, calibrating the time of the real-time clock module and the SNTP timing hardware module based on the time calibration time; Wherein, the SNTP timing hardware module is a CH9126 chip, the SNTP timing hardware module has a built-in SNTP protocol, and contains a MAC interface and a PHY interface; Wherein, the main control module is also used to receive the configuration command sent by the main monitoring device, and update the relevant parameters of the real-time clock module and / or the SNTP timing hardware module according to the configuration parameters in the configuration command; The configuration command includes a first configuration command for the real-time clock module and a second configuration command for the SNTP timing hardware module; the configuration parameters in the first configuration command include any one or more of year, month, day, hour, minute and second; the configuration parameters in the second configuration command include any one or more of working mode, network configuration parameters and serial port communication configuration parameters; the working mode includes client mode and server mode.
2. The timing server according to claim 1, characterized in that: The real-time clock module is a high-precision clock chip DS3231. The real-time clock module includes a temperature-compensated clock. The clock accuracy of the real-time clock module is 2PPM. The real-time clock module includes a programmable pulse output.
3. The timing server according to claim 1, characterized in that: The main control module is an STM32 single-chip microcomputer.
4. The timing server according to claim 1, characterized in that: Also includes: A communication module is used to receive the timing command and / or the configuration command sent by the main monitoring device, and forward the timing command and / or the configuration command to the main control module; the communication module is a CAN communication module or a 485 communication module or a 232 communication module.
5. A timing method, characterized in that: Applicable to the timing server including real-time clock module, SNTP timing hardware module and main control module, including: Sending a pulse signal to the SNTP timing hardware module through the real-time clock module to provide a time reference to the SNTP timing hardware module; The SNTP timing hardware module connected to the real-time clock module sends time data to the client to be timed in the network according to the SNTP protocol based on the time reference; A main control module connected to the real-time clock module and the SNTP timing hardware module respectively receives a time calibration command sent by a main monitoring device, obtains the current time of the real-time clock module according to the time calibration command, and determines whether the time calibration time in the time calibration command is consistent with the current time. If they are inconsistent, the time of the real-time clock module and the SNTP timing hardware module are calibrated based on the time calibration time; Wherein, the SNTP timing hardware module is a CH9126 chip, the SNTP timing hardware module has a built-in SNTP protocol, and contains a MAC interface and a PHY interface; Receive the configuration command sent by the main monitoring device through the main control module, and update the relevant parameters of the real-time clock module and / or the SNTP timing hardware module according to the configuration parameters in the configuration command; The configuration command includes a first configuration command for the real-time clock module and a second configuration command for the SNTP timing hardware module; the configuration parameters in the first configuration command include any one or more of year, month, day, hour, minute and second; the configuration parameters in the second configuration command include any one or more of working mode, network configuration parameters and serial port communication configuration parameters; the working mode includes client mode and server mode.
6. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the timing method as claimed in claim 5.
Citation Information
Patent Citations
Time server
CN204013564U