Train clock synchronization control method and apparatus based on ntp
By using the NTP protocol for time synchronization control on the train, the transmission delay of the Ethernet link is eliminated, the problem of time inconsistency between different systems on the train is solved, and high-precision time consistency is achieved.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2026-04-30
AI Technical Summary
The time recorded by different systems on a train is inconsistent, and existing technology cannot effectively achieve time consistency.
The train clock synchronization control method based on NTP is adopted. By transmitting messages between the central control unit and the switch based on the NTP protocol, the transmission delay of clock messages in the Ethernet link is eliminated, and a time synchronization control strategy is set to achieve time consistency between different systems of the train.
It improves the overall time synchronization accuracy of the train, achieves time consistency between different systems of the train, and does not increase the functional complexity of the subsystems.
Smart Images

Figure CN2024128516_30042026_PF_FP_ABST
Abstract
Description
A train clock synchronization control method and device based on NTP
[0001] Cross-reference to related applications
[0002] This disclosure claims priority to Chinese Patent Application No. 2024114948287, filed on October 24, 2024, entitled “A Train Clock Synchronization Control Method and Device Based on NTP”, the entire of which is incorporated herein by reference. Technical Field
[0003] This disclosure relates to the field of rail transit vehicle network technology, and in particular to a train clock synchronization control method and device based on NTP. Background Technology
[0004] Currently, the time source for various systems in rail transit vehicles is the train network control system. These systems are not connected to Beijing time or GPS (Global Positioning System) time, leading to inconsistencies in the time recorded by different systems. Therefore, achieving time consistency across different train systems is a pressing issue that needs to be addressed in this field.
[0005] Summary of the Invention
[0006] This disclosure provides a train clock synchronization control method and apparatus based on NTP to achieve time consistency between different systems of a train.
[0007] In a first aspect, this disclosure provides an NTP-based train clock synchronization control method, applied to a switch deployed on a train, the switch being configured as an NTP client. The method includes: sending an NTP request message to an NTP server every first time interval; receiving an NTP response message from the NTP server to obtain NTP time information; comparing the NTP time information with the operating system time of the NTP client; if the difference between the NTP time information and the operating system time of the NTP client exceeds a second time interval, synchronizing the operating system time of the NTP client with the NTP time information; and distributing the operating system time of the NTP client to the subsystems connected to the physical network port of the NTP client, so that if the difference between the operating system time and the subsystem's own time exceeds a third time interval, the subsystem will synchronize its own time with the operating system time.
[0008] In an exemplary embodiment, before comparing the NTP time information with the operating system time of the NTP client, the method further includes: calculating the relative time difference between the NTP server and the NTP client based on the information carried in the NTP response message; and adjusting the NTP time information based on the relative time difference.
[0009] In an exemplary embodiment, the NTP server and the NTP client transmit messages using a TSN transmission link; before comparing the NTP time information with the operating system time of the NTP client, the method further includes: calculating the path delay of the TSN transmission link based on the information carried in the NTP response message; and adjusting the NTP time information based on the path delay.
[0010] Secondly, this disclosure provides an NTP-based train clock synchronization control method, applied to a central control unit deployed on a train. The central control unit is configured as an NTP server. The method includes: receiving an NTP request message sent by an NTP client; processing the NTP request message and sending an NTP response message carrying NTP time information to the NTP client, so that if the NTP time information differs from the operating system time of the NTP client by more than a second duration, the NTP client will synchronize the operating system time of the NTP client with the NTP time information.
[0011] Thirdly, this disclosure provides a switch including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method of the first aspect.
[0012] Fourthly, this disclosure provides a central control unit, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method of the second aspect.
[0013] Fifthly, this disclosure provides an NTP-based train clock synchronization control device, comprising: at least one third-party switch, arranged on the train and configured as an NTP client; and at least one fourth-party central control unit, arranged on the train and configured as an NTP server.
[0014] In some exemplary embodiments, the central control unit supports NTP, TSN, and TRDP protocols, and the switch and the central control unit transmit messages based on NTP and TSN transmission links; the subsystems connected to the physical network ports of the switch support the TRDP protocol.
[0015] In a sixth aspect, this disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method of the first or second aspect.
[0016] In a seventh aspect, this disclosure provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the method of the first or second aspect.
[0017] This disclosure provides a train clock synchronization control method and apparatus based on NTP. By transmitting messages between the central control unit and the switch based on the NTP protocol, the transmission delay of clock messages in the Ethernet link is eliminated. Furthermore, time synchronization control strategies are set between the central control unit and the switch, and between the switch and the subordinate subsystems. Thus, without increasing the functional complexity of the subsystems, the time synchronization accuracy of the whole vehicle can be effectively improved, and the time recorded between different systems of the train can be made consistent. Attached Figure Description
[0018] The present disclosure will be described in more detail below with reference to embodiments and the accompanying drawings.
[0019] Figure 1 is a schematic flowchart of a train clock synchronization control method based on NTP provided in an embodiment of this disclosure.
[0020] Figure 2 is a schematic diagram of the principle of calculating the relative time difference offset provided in the embodiments of this disclosure.
[0021] Figure 3 is a schematic diagram illustrating the principle of eliminating message transmission delay on the link provided in the embodiments of this disclosure.
[0022] Figure 4 is a schematic diagram of the time synchronization process provided in this embodiment of the present disclosure, taking a first duration of 100ms as an example.
[0023] Figure 5 is a flowchart illustrating another NTP-based train clock synchronization control method provided in this embodiment of the present disclosure.
[0024] Figure 6 is a topology diagram of the NTP-based train clock synchronization control device provided in an embodiment of this disclosure.
[0025] In the accompanying drawings, the same parts are referred to by the same reference numerals, and the drawings are not drawn to scale. Detailed Implementation
[0026] To enable those skilled in the art to better understand the technical solutions of this disclosure, and to fully understand and implement the process of how this disclosure applies technical means to solve technical problems and achieve corresponding technical effects, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of this disclosure, not all embodiments. The embodiments of this disclosure and the various features within them can be combined with each other without conflict, and the resulting technical solutions are all within the protection scope of this disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without creative effort should fall within the protection scope of this disclosure.
[0027] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion.
[0028] Currently, the time source for various systems in rail transit vehicles is the train network control system. These systems are not connected to Beijing time or GPS (Global Positioning System) time, leading to inconsistencies in the time recorded by different systems. Therefore, achieving time consistency across different train systems is a pressing issue that needs to be addressed in this field.
[0029] In related technologies, the common TRDP (Train Real-time Data Protocol) is used to transmit clock information. However, TRDP cannot eliminate link delays, which can introduce errors into the time synchronization of the entire train. The train clock synchronization control method and device based on NTP (Network Time Protocol) provided in this disclosure eliminates the transmission delay of clock messages in the Ethernet link by transmitting messages between the central control unit and the switch based on the NTP protocol. Furthermore, it sets time synchronization control strategies between the central control unit and the switch, and between the switch and its subordinate subsystems. Thus, without increasing the functional complexity of the subsystems, it can effectively improve the time synchronization accuracy of the entire train and achieve time consistency between different systems of the train.
[0030] Example 1
[0031] Figure 1 is a flowchart illustrating an NTP-based train clock synchronization control method according to an embodiment of this disclosure. As shown in Figure 1, the NTP-based train clock synchronization control method is applied to a Switch Route Unit (SRU) deployed on the train, with the SRU configured as an NTP client. A Central Control Unit (CCU) is also deployed on the train, configured as an NTP server. Message transmission between the SRU and CCU is based on the NTP protocol.
[0032] The method of this embodiment includes at least steps S11 to S16.
[0033] Step S11: Send an NTP request message to the NTP server every first time interval.
[0034] In this embodiment, the first duration is a pre-set window period, which can be set according to actual needs, such as 100ms. The SRU regularly sends NTP request messages to the CCU within this window period to obtain reference time information obtained by the CCU from external sources. The reference time information can be, but is not limited to, BeiDou time or GPS time.
[0035] Step S12: Receive the NTP response message sent by the NTP server to obtain NTP time information.
[0036] In this embodiment, after receiving the NTP request message sent by the SRU, the CCU processes the message and sends a response message to the SRU. The response message carries reference time information, which is obtained by the SRU as NTP time information after the SRU receives the NTP response message.
[0037] In some exemplary embodiments, before comparing the NTP time information with the operating system time of the NTP client, the method of this embodiment further includes: calculating the relative time difference between the NTP server and the NTP client based on the information carried in the NTP response message; and adjusting the NTP time information based on the relative time difference.
[0038] Taking Figure 2 as an example, the process for calculating the relative time difference offset is as follows.
[0039] 1. The SRU sends an NTP request message to the CCU, which contains the timestamp t1 of the NTP request message leaving the SRU.
[0040] 2. The NTP request message arrives at the CCU at time t2. After processing the NTP request message, the CCU sends an NTP response message at time t3. The NTP response message carries the timestamps t1 (when the NTP request message left the SRU), t2 (when the NTP request message arrived at the CCU), and t3 (when the NTP response message left the CCU).
[0041] 3. When the SRU receives an NTP response message, it records the timestamp t4 of the arrival of the NTP response message.
[0042] 4. Using the above four timestamps, the SRU can calculate two key parameters: the round-trip delay of the NTP message from the SRU to the CCU and the relative time difference offset between the SRU and the CCU.
[0043] 4-1. Round-trip delay of NTP messages from SRU to CCU.
[0044] delay = (t4-t1)-(t3-t2).
[0045] 4-2. The relative time difference offset between SRU and CCU.
[0046] The following system of equations can be used to solve the problem.
[0047] System of equations:
[0048] Relative time difference:
[0049] 5. The SRU eliminates link delay by calculating the relative time difference offset through the NTP protocol, and then achieves clock synchronization with the CCU based on the following clock synchronization control strategy.
[0050] In some exemplary embodiments, the NTP server and the NTP client use a TSN transmission link for message transmission. Before comparing the NTP time information with the operating system time of the NTP client, the method of this embodiment further includes: calculating the path delay of the TSN transmission link based on the information carried in the NTP response message; and adjusting the NTP time information based on the path delay.
[0051] Building upon the calculation of the relative time difference offset to eliminate time delays during NTP protocol message transmission, this embodiment employs TSN clock synchronization technology to calculate the path delay D between the delay request initiator (CCU) and the delay request responder (SRU) to further eliminate overall link time delays. This eliminates message transmission delays on the link, resulting in more accurate clock information. As shown in Figure 3, the calculation logic for the path delay D is as follows: The delay request initiator (SRU) obtains four timestamps, allowing the calculation of the path delay D between the SRU and the CCU. ir =t2-t1 t ri =t4-t3
[0052] Among them, t ir t represents the delay from the initiator of the delay request to the responder of the delay request. ri This indicates the delay from the responder to the initiator of the delay request.
[0053] Based on adjusting the NTP time information according to the relative time difference offset, further adjusting the NTP time information according to the path delay can more effectively eliminate time delay. Then, based on the clock synchronization control strategy below, clock synchronization with CCU can be achieved, improving the time synchronization accuracy of the whole vehicle.
[0054] Step S13: Compare the NTP time information with the operating system time of the NTP client.
[0055] SRU stores the acquired NTP time information in a log and compares the NTP time information with the operating system time of the NTP client.
[0056] Step S14: Determine if the difference between the NTP time information and the NTP client's operating system time exceeds the second duration. If the difference exceeds the second duration, proceed to step S15. If the difference is less than the second duration, synchronization with NTP time is unnecessary; instead, the NTP client's operating system time is sent to the subsystem connected to the NTP client's physical network port. The second duration is a pre-set window period that can be set according to actual needs, for example, 100ms.
[0057] Step S15: Synchronize the operating system time of the NTP client with NTP time information.
[0058] Step S16: Send the operating system time of the NTP client to the subsystem connected to the physical network port of the NTP client, so that the subsystem will synchronize its own time with the operating system time if the difference between the operating system time and the subsystem's own time exceeds the third time interval.
[0059] In practical applications, each train set is equipped with at least one switch, and the entire vehicle is equipped with at least two central control units. Each switch only sends the operating system time to its own subordinate subsystems via TRDP messages. For example, SRU1 in vehicle 1 only sends the time to its own subordinate subsystems. Clock information is not transmitted through the ring network. The switches of the entire vehicle synchronize time with the CCU via the NTP protocol. The sending period for sending the operating system time of the NTP client to the subsystems connected to the physical network port of the NTP client via TRDP messages can be set according to requirements, for example, 20ms. The third duration is a pre-set window period, which can be set according to actual needs, for example, 100ms. If the difference between the operating system time and the subsystem's own time does not exceed the third duration, no time synchronization is performed. The time synchronization process with the first duration of 100ms as an example is shown in Figure 4.
[0060] Example 2
[0061] This disclosure provides an NTP-based train clock synchronization control method, applied to a central control unit (CCU) deployed on a train. The CCU is configured as an NTP server, and the SRU is configured as an NTP client. The SRU and CCU transmit messages based on the NTP protocol.
[0062] As shown in Figure 5, the method of this embodiment includes steps S21 to S22.
[0063] Step S21: Receive the NTP request message sent by the NTP client.
[0064] Step S22: After processing the NTP request message, send an NTP response message carrying NTP time information to the NTP client so that the NTP client will synchronize the NTP client's operating system time with the NTP time information if the difference between the NTP time information and the NTP client's operating system time exceeds the second time interval.
[0065] The SRU sends an NTP request message to the NTP server every first interval. After the CCU processes the NTP request message, it sends an NTP response message carrying NTP time information to the NTP client. The SRU receives the NTP response message to obtain the NTP time information and compares it with the operating system time of the NTP client. If the difference between the NTP time information and the SRU's operating system time exceeds a second interval, the SRU's operating system time is synchronized with the NTP time information, and the SRU's operating system time is sent to the subsystems connected to the NTP client's physical network interface via TRDP messages, so that if the difference between the subsystem's operating system time and its own time exceeds a third interval, the subsystem will synchronize its own time with the operating system time.
[0066] Example 3
[0067] This disclosure provides a switch, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method of Embodiment 1.
[0068] This disclosure also provides a central control unit, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method of Embodiment 2.
[0069] In some embodiments of this example, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the steps of the method described in the above embodiments.
[0070] In some embodiments of this example, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps of the methods described in the above embodiments.
[0071] The processor may include, but is not limited to, one or more processors or microprocessors. Each processor may be implemented as an Application Specific Integrated Circuit (ASIC), Digital Signal Processor (DSP), Digital Signal Processing Device (DSPD), Programmable Logic Device (PLD), Field Programmable Gate Array (FPGA), controller, microcontroller, microprocessor, or other electronic component, for performing the methods in the above embodiments.
[0072] Computer-readable storage media can be implemented by any type of volatile or non-volatile storage device or a combination thereof. Computer-readable storage media may include, but are not limited to, random access memory (RAM), read-only memory (ROM), flash memory, EPROM memory, EEPROM memory, registers, and computer storage media (e.g., hard disks, floppy disks, solid-state drives, removable disks, CD-ROMs, DVD-ROMs, Blu-ray discs, etc.).
[0073] Computer-readable storage media may also store at least one computer-executable program / instruction, such as computer-readable instructions. Computer-readable storage media include, but are not limited to, volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory. Computer-readable storage media may include, for example, read-only memory (ROM), hard disk, flash memory, etc. For example, a non-transitory computer-readable storage medium may be connected to a computing device such as a computer, and then, when the computing device executes the computer-readable instructions stored on the computer-readable storage medium, the various methods described above can be performed.
[0074] In addition, the computer device may include (but is not limited to) a data bus, an input / output (I / O) bus, a display, and input / output devices (e.g., keyboard, mouse, speakers, etc.).
[0075] The processor can communicate with external devices via the I / O bus through wired or wireless networks.
[0076] In one embodiment, the at least one computer-executable instruction may also be compiled into or comprise a software product / computer program product, wherein one or more computer-executable instructions are executed by a processor to perform the steps of the various functions and / or methods in the embodiments described herein.
[0077] Example 4
[0078] This disclosure provides an NTP-based train clock synchronization control device, comprising: at least one switch as described in the above embodiments and at least one central control unit as described in the above embodiments. The switch is arranged on the train and configured as an NTP client; the central control unit is arranged on the train and configured as an NTP server.
[0079] In some exemplary embodiments, the central control unit supports NTP, TSN, and TRDP protocols. Message transmission between the switch and the central control unit is based on NTP and TSN transmission links. Subsystems connected to the switch's physical network ports support the TRDP protocol.
[0080] If the entire train uses NTP for time synchronization, the requirements for each system are too high, thus failing to achieve universality. This embodiment only requires the Rear Unit (RSU) and Central Control Unit (CCU) to support NTP, TSN, and TRDP protocols simultaneously, while each subsystem is only required to support TRDP. This embodiment solves the problem that using ordinary TRDP for clock information transmission cannot eliminate link delays, thus introducing errors into the overall train clock synchronization, without increasing the functional complexity of the subsystems.
[0081] In one example, as shown in Figure 6, the CCU obtains the BeiDou time from an external source. The CCU and SRU1 to SRU10 transmit messages via the NTP protocol. SRU1 to SRU10 distribute the operating system time to the subsystems via the TRDP protocol. Since the device in this embodiment of the disclosure needs to use the NTP protocol, and it is not excluded that subsequent subsystems may directly obtain the CCU's time via NTP, the vehicle subsystem meets the requirements shown in the table below.
[0082] The NTP-based train clock synchronization control method and apparatus disclosed herein transmits messages between the central control unit and the switch based on the NTP protocol. This eliminates the transmission delay of clock messages in the Ethernet link and establishes time synchronization control strategies between the central control unit and the switch, as well as between the switch and its subordinate subsystems. This disclosure effectively improves the overall train time synchronization accuracy and achieves time consistency across different systems of the train without increasing the functional complexity of the subsystems.
[0083] In the embodiments provided in this disclosure, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative; for example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0084] It should be noted that, in this disclosure, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element limited by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0085] While the embodiments disclosed herein are as described above, the foregoing content is merely for the purpose of facilitating understanding of this disclosure and is not intended to limit this disclosure. Any person skilled in the art to which this disclosure pertains may make any modifications and changes in form and detail of the implementation without departing from the spirit and scope of this disclosure; however, the scope of patent protection of this disclosure shall still be determined by the scope defined in the appended claims.
Claims
1. A train clock synchronization control method based on NTP, wherein, A method for using a switch deployed on a train, the switch being configured as an NTP client, includes: Every first time interval, an NTP request message is sent to the NTP server. Receive the NTP response message sent by the NTP server to obtain NTP time information; Compare the NTP time information with the operating system time of the NTP client; If the NTP time information differs from the operating system time of the NTP client by more than a second duration, then the operating system time of the NTP client will be synchronized with the NTP time information. The operating system time of the NTP client is sent to the subsystem connected to the physical network port of the NTP client, so that if the difference between the operating system time and the subsystem's own time exceeds a third time interval, the subsystem will synchronize its own time with the operating system time.
2. The method according to claim 1, wherein, Before comparing the NTP time information with the operating system time of the NTP client, the method further includes: Calculate the relative time difference between the NTP server and the NTP client based on the information carried in the NTP response message; The NTP time information is adjusted based on the relative time difference.
3. The method according to claim 1 or 2, wherein, The NTP server and the NTP client use a TSN transmission link for message transmission. Before comparing the NTP time information with the operating system time of the NTP client, the method further includes: The path delay of the TSN transmission link is calculated based on the information carried in the NTP response message. The NTP time information is adjusted based on the path delay.
4. A train clock synchronization control method based on NTP, wherein, A method for use with a central control unit deployed on a train, the central control unit being configured as an NTP server, the method comprising: Receive NTP request messages sent by NTP clients; After processing the NTP request message, an NTP response message carrying NTP time information is sent to the NTP client, so that if the NTP time information differs from the NTP client's operating system time by more than a second duration, the NTP client will synchronize the NTP client's operating system time with the NTP time information.
5. A switch, comprising a memory, a processor, and a computer program stored in the memory, wherein, The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 3.
6. A central control unit, comprising a memory, a processor, and a computer program stored in the memory, wherein, The processor executes the computer program to implement the steps of the method of claim 4.
7. A train clock synchronization control device based on NTP, wherein, include: At least one switch as described in claim 5 is arranged on the train and configured as an NTP client; At least one central control unit as described in claim 6 is arranged on the train and configured as an NTP server.
8. The NTP-based train clock synchronization control device according to claim 7, wherein, The central control unit supports NTP, TSN, and TRDP protocols. The switch and the central control unit transmit messages based on NTP and TSN transmission links. The subsystems connected to the physical network ports of the switch support the TRDP protocol.
9. A computer-readable storage medium having a computer program stored thereon, wherein, When executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 4.
10. A computer program product comprising a computer program, wherein, When executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 4.