An Adaptive Multi-Mode Time Synchronization System and Method

By integrating second pulse, serial port, and Ethernet port interfaces into the slave device, adaptive multi-mode time synchronization is achieved, solving the flexibility problem of the single synchronization method in the existing technology, providing multiple working modes, and expanding the application scope and economy of the end device.

CN119921889BActive Publication Date: 2025-10-28BEIJING AEROSPACE AUTOMATIC CONTROL RES INST
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411984206.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-10-28
Estimated Expiration
2044-12-31

AI Technical Summary

Technical Problem

Existing end devices only support one time synchronization method, which cannot balance synchronization accuracy and cost, thus limiting the flexibility and versatility of applications.

Method used

The device integrates second pulse, serial port and Ethernet port interfaces to achieve adaptive switching of three synchronization modes. It automatically selects the synchronization mode according to the principle of prioritizing accuracy and degrades the synchronization accuracy when the high-precision method is unavailable.

Benefits of technology

Without increasing hardware costs, it offers multiple operating modes suitable for different system sizes and transmission distances, expanding the versatility and economy of end devices and simplifying the usage process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119921889B_ABST
    Figure CN119921889B_ABST
Patent Text Reader

Abstract

This application discloses an adaptive multi-mode time synchronization system and method, relating to the field of distributed measurement and control, and applicable to slave devices. Based on the two commonly used standard synchronization methods—second pulse + serial port time synchronization and network protocol time synchronization—this method proposes a new mode of second pulse + network protocol time synchronization, and integrates the three synchronization modes within the slave device. The slave device adaptively selects the highest precision time synchronization mode available based on the second pulse and synchronization frame information of the time synchronization input, without requiring changes to the slave device design. This allows users to flexibly choose according to application requirements, achieving an optimal combination in terms of system cost, synchronization accuracy, etc.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of distributed measurement and control, and relates to an adaptive multi-mode time synchronization method for end devices. Background Technology

[0002] In a distributed measurement and control system, all end devices typically need to establish a unified time reference for the entire system. A distributed measurement and control system includes end devices and switching devices. End devices are divided into master devices and slave devices. The master device provides the absolute time reference and transmits this absolute time reference to the slave devices through time synchronization methods. Currently, commonly used time synchronization methods for end devices include bus network synchronization such as NTP, serial port time synchronization such as IRIG-B code, PPS second pulse + bus synchronization frame, and PTP, etc. Each method achieves different synchronization accuracy, implementation methods, and economics, and each has its applicable scenarios. NTP is suitable for systems with standard Ethernet connections. It requires no special hardware, but the software implementation is relatively complex. It is economical, but the synchronization accuracy is only at the sub-second level. Serial port timing methods, such as IRIG-B code, require dedicated hardware interface circuits on the end device. They are technically simpler, economical, and achieve synchronization accuracy at the millisecond level. The PPS second pulse + bus synchronization frame method requires dedicated interface circuits on the end device and dedicated connection cables in the system. It has a large hardware overhead, but is technically simple and economical, achieving synchronization accuracy at the sub-microsecond level. PTP and other synchronization methods based on 1588v2 do not require hardware second pulse synchronization signals, but require underlying chips that support 1588v2. They are technically complex and costly, but can achieve synchronization accuracy at the sub-microsecond level. The selection of various synchronization methods must take into account factors such as system scale, distance between synchronization devices, synchronization accuracy, and cost. However, commonly available end devices that support distributed time synchronization only support one synchronization method and achieve a single synchronization accuracy, without providing multiple synchronization methods. This limits the versatility and application scope of end devices, as designers cannot flexibly choose the application mode based on the system scale, transmission distance, synchronization accuracy, and cost requirements of specific application projects.

[0003] Existing time synchronization-enabled end devices generally only support one time synchronization method, making it impossible to balance synchronization accuracy and cost-effectiveness for different applications, thus limiting the flexibility of end device applications. Summary of the Invention

[0004] The technical problem solved by this application is to overcome the shortcomings of the prior art and provide an adaptive multi-mode time synchronization method, so as to realize the adaptive multi-mode time synchronization method in general terminal equipment for distributed measurement and control, thereby facilitating the system application to flexibly select the timing mode and achieve the optimal configuration in terms of system cost, synchronization accuracy, etc.

[0005] This invention proposes a new synchronization mode combining second pulse and network protocol synchronization, based on the two existing standard synchronization methods of second pulse + serial port and network protocol synchronization. It integrates these three synchronization modes within the slave device and supports automatic priority selection of multiple synchronization methods based on accuracy. When a high-precision synchronization method is available, the slave device automatically achieves high-precision synchronization; when the high-precision synchronization method becomes unavailable due to a fault, the slave device can degrade the synchronization accuracy while maintaining synchronization. This method features low overall cost and ease of implementation, making it suitable for large-scale distributed cluster electrical control systems or simple electrical systems, and has broad application prospects in the field of distributed measurement and control.

[0006] The technical solution provided in this application is as follows:

[0007] An adaptive multi-mode time synchronization system includes a slave device, which has a second pulse interface, a serial port, and an Ethernet port; input signals are input to the slave device through the second pulse interface, serial port data frames are input to the slave device through the serial port, and Ethernet port data frames are input to the slave device through the Ethernet port.

[0008] The device is equipped with a microsecond timer and a second timer. The microsecond timer keeps count in microseconds. Every time the microsecond timer reaches 1 second, the second timer increments by 1 second. The second timer starts counting in seconds from a predetermined absolute time by accumulating the time from the microsecond timer.

[0009] The device is equipped with a second pulse status register, a serial port status register, a network port status register, a serial port time register, a network port time register, a time synchronization controller, and a mode selector;

[0010] The second pulse status register is used to store whether there is an input signal input to the slave device to obtain the second pulse status;

[0011] The serial port status register is used to store whether there is a serial data frame being input to the slave device, and to obtain the serial port status;

[0012] The network port status register is used to store whether there are network port data frames being input to the slave device, thus obtaining the network port status;

[0013] The serial port time register is used to temporarily store the synchronization time extracted from the serial port data frame;

[0014] The network port time register is used to temporarily store the synchronization time extracted from the network port data frame;

[0015] The mode selector is used to detect the second pulse status, serial port status, and network port status of the second pulse status register, serial port status register, and network port status register, and determine the synchronization mode according to the principle of precision priority.

[0016] The time synchronization controller is used to copy the synchronization time temporarily stored in the serial port time register or network port time register corresponding to the synchronization mode to the second timer according to the synchronization mode determined by the mode selector, so as to realize the time synchronization slave device.

[0017] Optionally, it also includes a node status register, which is used to temporarily store the current synchronization mode of the slave device. The mode selector writes the determined synchronization mode into the node status register.

[0018] The node status register contains a synchronization status indicator bit and a synchronization mode indicator bit. The synchronization status indicator bit includes an unsynchronized state and a synchronized state. The synchronized state is within a set time after the synchronization time is copied to the second timer. The unsynchronized state is when the node fails to synchronize with the synchronization master once within the set time. The synchronization mode indicator bit is used to indicate the synchronization mode, which includes second pulse + serial port synchronization mode, second pulse + network port synchronization mode, or network port synchronization mode.

[0019] Optionally, the device also includes a timer, which is used to change the node status register from a synchronized state to an unsynchronized state when the slave device has not received any input signal, serial data frame, and / or network data frame input for an extended period of time.

[0020] Optionally, the initial state of the node status register after the slave device is powered on is: unsynchronized state and second pulse + serial port synchronization mode; each time the slave device is successfully synchronized, the node status register is updated to synchronized state and the timer is reset and recounted; if the slave device fails to synchronize again within the set time, the node status register is updated to unsynchronized state.

[0021] Optional features also include a second pulse filter and a microsecond controller;

[0022] The second pulse filter performs digital filtering on the input signal. When the input signal's pulse width is greater than the set pulse width, a trigger signal is obtained; otherwise, no trigger signal is obtained. After the trigger signal, the value of the temporary microsecond timer is activated, waiting for the next trigger signal with a pulse width greater than the set pulse width. After the next trigger signal, the value of the temporary microsecond timer is activated again. If the difference between the temporary microsecond timer values ​​corresponding to two consecutive trigger signals is less than a set threshold, a valid second pulse signal is determined to have been received, and a valid second pulse signal is sent to the microsecond controller.

[0023] The microsecond controller resets and restarts the microsecond timer upon receiving a valid second pulse signal, and performs delay compensation on the microsecond timer according to the filtering process. At the same time, it determines the value of the microsecond timer and the value of the node status register at the reset time. If the working state of the slave device in the node status register is in the synchronous state and the value of the microsecond timer is greater than a certain threshold but less than 1 second, then the value of the second timer is incremented by 1 second.

[0024] Optionally, the precision priority principle includes: second pulse + serial port synchronization mode is higher than second pulse + network port synchronization mode, and second pulse + network port synchronization mode is higher than network port synchronization mode.

[0025] Optionally, if the second pulse status is yes, the serial port status is yes, and the network port status is no, or if the second pulse status is yes, the serial port status is yes, and the network port status is yes, then the second pulse + serial port synchronization mode is used; if the second pulse status is yes, the serial port status is no, and the network port status is yes, then the second pulse + network port synchronization mode is used; if only the network port status is yes, then the network port synchronization mode is used.

[0026] Optionally, the time synchronization controller accumulates the number of successful time synchronizations and the number of failed time synchronizations. When the status of the second pulse status register, serial port status register, and network port status register detected by the mode selector is lower than the priority of the synchronization mode temporarily stored in the node status register, the mode selector will pause the time synchronization controller until the number of failed time synchronizations accumulated by the time synchronization controller reaches a set number. Then, the mode selector will modify the synchronization mode determined by the status of the second pulse status register, serial port status register, and network port status register and the accuracy priority principle to the node status register. When the status of the second pulse status register, serial port status register, and network port status register detected by the mode selector is higher than the priority of the synchronization mode temporarily stored in the node status register, and the number of successful time synchronizations accumulated by the time synchronization controller reaches a set number, the mode selector will modify the synchronization mode determined by the status of the second pulse status register, serial port status register, and network port status register and the accuracy priority principle to the node status register.

[0027] Optionally, when in second pulse + serial port synchronization mode, the second pulse status register refresh will trigger the time synchronization controller to enable serial port time register write operation and start countdown. If a new synchronization time is stored in the serial port time register before the countdown ends, the time synchronization controller will copy the value of the serial port time register to the second timer to complete the time synchronization of the slave device; when the countdown ends, the time synchronization controller will disable serial port time register write operation.

[0028] When in the second pulse + network port synchronization mode, the second pulse status register refresh will trigger the time synchronization controller to enable the network port time register write operation and start the countdown. If a new synchronization time is stored in the network port time register before the countdown ends, the time synchronization controller will copy the value of the network port time register to the second timer to complete the time synchronization of the slave device; when the countdown ends, the time synchronization controller will disable the network port time register write operation.

[0029] If in network port synchronization mode, after the time controller detects that the network port time register has been updated to synchronize the time, it immediately copies the value of the network port time register to the second timer to complete the time synchronization with the slave device.

[0030] An adaptive multi-mode time synchronization method, comprising time synchronization according to any of the aforementioned adaptive multi-mode time synchronization systems, including:

[0031] S1. The inputs obtained from the device include input signals, serial port data frames and / or network port data frames. S2 is performed on the obtained input signals, S3 is performed on the obtained serial port data frames, and S4 is performed on the obtained network port data frames.

[0032] S2. Based on the input signal, save whether there is a second pulse signal input to the slave device to obtain the second pulse status;

[0033] The input signal is digitally filtered. When the input signal's width is greater than the set pulse width, a trigger signal is obtained; otherwise, no trigger signal is obtained. After the trigger signal, the value of the temporary microsecond timer is activated, and the system waits for the next trigger signal with a width greater than the set pulse width. After the next trigger signal, the value of the temporary microsecond timer is activated again. If the difference between the temporary microsecond timer values ​​corresponding to two consecutive trigger signals is less than a set threshold, a valid second pulse signal is considered to have been received. Upon receiving a valid second pulse signal, the microsecond timer is reset and restarted, and delay compensation is applied to the microsecond timer based on the filtering process. Simultaneously, the value of the microsecond timer at the reset moment and the value of the node status register are compared. If the slave device's working state in the node status register is in a synchronized state and the value of the microsecond timer is greater than a certain threshold but less than 1 second, the value of the second timer is incremented by 1 second.

[0034] S3. Based on the serial port data frame, save whether there is a serial port data frame input to the slave device and obtain the serial port status; extract the synchronization time from the serial port data frame;

[0035] S4. Based on the network port data frame, save whether there is a current network port data frame input to the slave device to obtain the network port status; extract the synchronization time from the network port data frame.

[0036] S5. Detect the second pulse status of S2, the serial port status of S3, and the network port status of S4, and determine the synchronization mode according to the principle of prioritizing accuracy.

[0037] S6. According to the synchronization mode determined in S5, copy the synchronization time temporarily stored in the serial port time register or network port time register corresponding to the synchronization mode to the second timer.

[0038] In summary, this application includes at least the following beneficial technical effects:

[0039] 1) This invention utilizes common interfaces of existing measurement and control system end equipment to provide multiple working modes suitable for different system scales, transmission distances, synchronization accuracy, and economics without increasing hardware costs, thereby expanding the versatility and economy of end equipment;

[0040] 2) The various working modes mentioned in this invention can be integrated into the terminal device. When applying the device, there is no need to change the hardware and software design and parameter configuration of the terminal device. The working mode is adaptively selected according to the principle of optimal accuracy, which greatly simplifies the use of the terminal device.

[0041] 3) This invention proposes a new synchronization method of second pulse + Ethernet time synchronization frame. Compared with the commonly used second pulse + serial port time synchronization frame method, it utilizes the original Ethernet port of the distributed measurement and control system terminal equipment. Under the condition of comparable synchronization accuracy, it can simplify the bus connection of the distributed measurement and control system, and at the same time increase the maximum allowed number of synchronization slave devices, which can be applied to a larger system scale. Attached Figure Description

[0042] Figure 1 This is a schematic diagram illustrating the principle of this application;

[0043] Figure 2 This is a structural diagram illustrating a specific implementation of this application. Detailed Implementation

[0044] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments disclosed in the present invention will be described in further detail below with reference to the accompanying drawings.

[0045] like Figure 1 As shown in the figure, this application discloses an adaptive multi-mode time synchronization method, which is applied to a slave device. The slave device is configured with at least three interfaces: a second pulse interface, a serial port, and an Ethernet port. The slave device is equipped with multiple functional modules, including a second pulse filter, a microsecond controller, a microsecond timer, a serial port synchronization time extraction, an Ethernet synchronization time extraction, a second pulse status register, a serial port status register, an Ethernet port status register, a serial port time register, an Ethernet port time register, a time synchronization controller, a mode selector, a second timer, a node status register, and a timer, etc.

[0046] The second pulse filter receives externally input second pulse signals. The microsecond controller checks the validity of the filtered second pulses and controls the microsecond timer to start counting from zero at the rising / falling edge of the second pulse. The microsecond timer enables the slave device to achieve high-precision timing down to the second level with an accuracy of 1 microsecond. Serial port synchronization time extraction identifies time synchronization frames from serial port message frames and parses out the transmission synchronization time. Ethernet synchronization time extraction identifies time synchronization frames from Ethernet message frames and parses out the transmission synchronization time. The second pulse status register stores whether an external second pulse signal is currently input to the slave device. The serial port status register stores whether a serial port time synchronization frame is currently input to the slave device. The network port status register stores whether a network port time synchronization frame is currently input to the slave device. The serial port time register... The network port time register is used to temporarily store the synchronization time extracted from the serial port. The time synchronization controller is used to synchronize the slave device according to the synchronization mode determined by the mode selector. The mode selector is used to detect the second pulse status register, serial port status register, and network port status register and autonomously determine the best synchronization mode for the slave device according to the principle of precision priority. The second timer is used to realize the slave device to accumulate time in seconds starting from a certain agreed absolute moment. The node status register is used to temporarily store the current working state of the slave device, including the initial state after power-on and the synchronized state after synchronization with the external time (including second pulse + serial port, second pulse + network port, and network port). The timer is used to reset the node status register after a long period of no external synchronization input, changing the register from the synchronized state to the unsynchronized state.

[0047] The node status register contains synchronization status and synchronization mode bits. The synchronization status bits indicate either unsynchronized or synchronized states, while the synchronization mode bits indicate either second pulse + serial port synchronization mode, second pulse + Ethernet port synchronization mode, or Ethernet port synchronization mode. Upon power-up, the slave device defaults to the unsynchronized state and second pulse + serial port synchronization mode. After a number of successful time synchronizations, the node status register is updated to synchronized state, and the timer is reset and recounted. If the slave device fails to synchronize again for a continuous period, it is updated to the unsynchronized state. The mode selector dynamically updates the synchronization mode of the node status register based on monitoring results.

[0048] The second pulse filter continuously acquires the input signal (from the second pulse interface) according to a set sampling period, performs digital filtering on the input signal, and obtains a trigger signal when the level width of the input signal is greater than the set pulse width; otherwise, no trigger signal is obtained. The trigger signal obtained by the second pulse filter triggers the value of the temporary microsecond timer, and then waits for the next input signal with a width greater than the set pulse width. The next signal triggers the value of the temporary microsecond timer again. If the difference between the temporary microsecond timer values ​​of two consecutive input pulses is less than a certain set threshold, it is determined that a valid second pulse signal has been received, and a valid second pulse signal is sent to the microsecond controller.

[0049] The microsecond controller, upon receiving a valid second pulse signal, resets and restarts the microsecond timer, and performs delay compensation on the microsecond timer according to the filtering process. Simultaneously, it checks the value of the microsecond timer at the reset point and the value of the node status register. If the slave device's operating state in the node status register is in a synchronized state and the microsecond timer value is greater than a certain threshold but less than 1 second, then the second timer value is incremented by 1. Every 1 second the microsecond timer completes, the second timer's time is incremented by 1 second (the second timer's increment is controlled by the microsecond timer and does not count itself). The precise second is obtained through the second pulse.

[0050] The microsecond timer relies on a crystal oscillator inside the device to continuously time in units of 1 microsecond.

[0051] Serial port synchronization time extraction: Parity check is performed on the externally input serial port data frame. After successfully identifying the time synchronization frame according to the set frame type, the synchronization time in the frame is parsed and extracted and stored in the serial port time register. At the same time, the serial port status register is set to the valid state.

[0052] The serial port status register is set to an invalid state by default after the slave device is powered on. After the "serial port synchronization extraction" receives a time synchronization frame, the register is set to an valid state. If no time synchronization frame is received for several seconds, the register is changed back to an invalid state.

[0053] The serial port time register temporarily stores the synchronization time value contained in the time synchronization frame input from the serial port.

[0054] The network port synchronization time extraction performs CRC verification on the externally input network port data frames. After successfully identifying the time synchronization frame according to the set frame type, the synchronization time in the frame is parsed and extracted and stored in the network port time register. At the same time, the network port status register is set to the valid state.

[0055] The network port status register is set to an invalid state by default after the slave device is powered on. After the "network port synchronization extraction" receives a time synchronization frame, the register is set to an valid state. If no time synchronization is received for several seconds, the register is changed back to an invalid state.

[0056] The network port time register temporarily stores the synchronization time value contained in the time synchronization frame input to the network port.

[0057] The mode selector continuously monitors the values ​​of the second pulse status register, serial port status register, and network port status register. If both the second pulse and serial port time synchronization frames exist, the second pulse + serial port synchronization mode is used first. If the serial port time synchronization frame does not exist but the second pulse and network port time synchronization frames exist, the second pulse + network port synchronization mode is used. If both the second pulse and serial port time synchronization frames do not exist but the network port time synchronization frame exists, the network port synchronization mode is used. The priority order is: second pulse + serial port > second pulse + network port, and second pulse + network port > network port. The mode selector updates the mode indicator bit status of the node status register after completing a number of consecutive time synchronizations. The mode selector sets the current synchronization mode based on the value of the node status register. During operation, if a high-priority synchronization mode condition is met, the high-priority synchronization mode is used immediately. When the status of the second pulse, serial port, or network port status register detected by the mode selector is lower than the priority of the status temporarily stored in the node status register, the mode selector pauses the time synchronization controller. If multiple synchronization failures occur, the mode selector lowers the priority of the node status register to the highest available priority mode.

[0058] The time synchronization controller has three synchronization modes: second pulse + serial port, second pulse + Ethernet port, and Ethernet port. The mode selector determines which synchronization mode is in use. In second pulse + serial port synchronization mode, refreshing the second pulse status register triggers the time synchronization controller to enable serial port time register write operations and start a countdown. The countdown time is configurable, typically 300ms. If a new synchronization time is stored in the serial port time register before the countdown ends, the time synchronization controller copies the value from the serial port time register to the second timer, completing the slave device time synchronization. When the countdown ends, the time synchronization controller disables serial port time register write operations. In second pulse + serial port synchronization mode... In network port synchronization mode, a refresh of the second pulse status register triggers the time synchronization controller to enable the network port time register write operation and start a countdown. The countdown time is configurable, typically 300ms. If a new synchronization time is stored in the network port time register before the countdown ends, the time synchronization controller copies the value of the network port time register to the second timer to complete the slave device time synchronization. When the countdown ends, the time synchronization controller disables the network port time register write operation. If in network port synchronization mode, the time synchronization controller immediately copies the value of the network port time register to the second timer after detecting an update to the synchronization time in the network port time register, completing the slave device time synchronization.

[0059] The time synchronization controller accumulates the number of successful time synchronizations and the number of failed time synchronizations.

[0060] The connection between the slave device and the master device can take the form of a time synchronization serial port and / or Ethernet.

[0061] The synchronization mode includes three modes: second pulse + serial port, second pulse + network port, and network port. If both the second pulse and serial port time synchronization frames exist, the second pulse + serial port synchronization mode is used first. If the serial port time synchronization frame does not exist but the second pulse and network port time synchronization frames exist, the second pulse + network port synchronization mode is used. If both the second pulse and serial port time synchronization frames do not exist but the network port time synchronization frame exists, the network port synchronization mode is used. That is, the priority order is: second pulse + serial port is higher than second pulse + network port, and second pulse + network port is higher than network port.

[0062] The mode selector updates the mode indicator bit status of the node status register after completing a number of consecutive time synchronizations. The mode selector sets the current synchronization mode based on the synchronization mode of the node status register. During operation, if a high-priority synchronization mode condition is detected to be higher than the input, the high-priority synchronization mode is used immediately. When the status of the second pulse status register, serial port status register, and network port status register detected by the mode selector is lower than the priority of the status temporarily stored in the node status register, the mode selector will pause the time synchronization controller. If the mode selector reads the accumulated number of time synchronization failures from the time synchronization controller and reaches a set number, the mode selector will lower the priority of the node status register to the highest available priority mode. When a change in the input from the slave device is detected and is higher than the synchronization mode of the node status register, and the mode selector reads the accumulated number of successful time synchronizations from the time synchronization controller and reaches a set number, the mode selector modifies the synchronization mode of the node status register according to the input.

[0063] Based on the second pulse + serial port, a new method of second pulse + Ethernet port synchronization mode is proposed without increasing hardware overhead, utilizing the Ethernet ports commonly found in distributed nodes. Its accuracy is the same as that of the second pulse + serial port synchronization mode.

[0064] After a device enters the synchronization state (i.e., the node status register is in the synchronization state), if synchronization fails, the device can continue to keep time and maintain the synchronization state by relying on its own crystal oscillator and microsecond timer and second timer. If the synchronization failure continues for a certain period of time and the synchronization accuracy of the device exceeds the set threshold, the device and the node status register will change to the out-of-synchronization state.

[0065] The second pulse + serial port synchronization mode, the second pulse + network port synchronization mode, and the network port synchronization mode can be performed independently. The high-precision synchronization mode has a higher priority and the low-precision synchronization mode has a lower priority. Switching from high-precision synchronization mode to low-precision synchronization mode can be applied immediately, while switching from high-precision synchronization mode to low-precision mode requires a protection period of a certain period of time.

[0066] When the microsecond timer is cleared and restarted, the microsecond timer is compensated for based on the filtering delay generated by the digital filter.

[0067] In this embodiment, the slave device is connected to the master device via a second pulse interface, a serial port, and / or an Ethernet port.

[0068] In the embodiments of this application, such as Figure 2 As shown, the device integrates a programmable logic chip and an embedded processor. The programmable logic chip is an FPGA or CPLD, and the embedded processor includes an MCU (microcontroller) or CPU (general-purpose processor) chip. The embedded processor and the programmable logic chip are connected via a bus interface.

[0069] like Figure 2 As shown, the second pulse interface and serial port are connected to the FPGA, and the Ethernet port is connected to the MCU. The second pulse filter, microsecond controller, microsecond timer, serial port synchronization time extractor, second pulse status register, serial port status register, serial port time register, time synchronization controller, and second timer are all located on the FPGA; the Ethernet synchronization time extractor, Ethernet port time register, Ethernet port status register, mode selector, node status register, and timer are all located on the MCU. The connection relationships between the functional modules are the same as described above.

[0070] The contents not described in detail in this application specification are common knowledge to those skilled in the art.

[0071] The present application has been described in detail above with reference to specific embodiments and exemplary examples; however, these descriptions should not be construed as limiting the present application. Those skilled in the art will understand that various equivalent substitutions, modifications, or improvements can be made to the technical solutions and implementation methods of the present application without departing from the spirit and scope of the present application, and all such modifications and improvements fall within the scope of the present application. The scope of protection of the present application is determined by the appended claims.

Claims

1. An adaptive multi-mode time synchronization system, characterized in that, Includes a slave device, which has a second pulse interface, a serial port, and an Ethernet port; input signals are input to the slave device through the second pulse interface, serial data frames are input to the slave device through the serial port, and Ethernet data frames are input to the slave device through the Ethernet port; The device is equipped with a microsecond timer and a second timer. The microsecond timer keeps count in microseconds. Every time the microsecond timer reaches 1 second, the second timer increments by 1 second. The second timer starts counting in seconds from a predetermined absolute time by accumulating the time from the microsecond timer. The device is equipped with a second pulse status register, a serial port status register, a network port status register, a serial port time register, a network port time register, a time synchronization controller, and a mode selector; The second pulse status register is used to store whether there is an input signal input to the slave device to obtain the second pulse status; The serial port status register is used to store whether there is a serial data frame being input to the slave device, and to obtain the serial port status; The network port status register is used to store whether there are network port data frames being input to the slave device, thus obtaining the network port status; The serial port time register is used to temporarily store the synchronization time extracted from the serial port data frame; The network port time register is used to temporarily store the synchronization time extracted from the network port data frame; The mode selector is used to detect the second pulse status, serial port status, and network port status of the second pulse status register, serial port status register, and network port status register, and determine the synchronization mode according to the principle of precision priority. The time synchronization controller is used to copy the synchronization time temporarily stored in the serial port time register or network port time register corresponding to the synchronization mode determined by the mode selector to the second timer, so as to realize the time synchronization slave device; The precision priority principle includes: second pulse + serial port synchronization mode is higher than second pulse + network port synchronization mode, and second pulse + network port synchronization mode is higher than network port synchronization mode. The time synchronization controller accumulates the number of successful time synchronizations and the number of failed time synchronizations. When the status of the second pulse status register, serial port status register, and network port status register detected by the mode selector is lower than the priority of the synchronization mode temporarily stored in the node status register, the mode selector will pause the time synchronization controller until the cumulative number of time synchronization failures read by the mode selector reaches a set number. Then, the mode selector will modify the synchronization mode to the node status register according to the status of the second pulse status register, serial port status register, and network port status register and the accuracy priority principle. When the status of the second pulse status register, serial port status register, and network port status register detected by the mode selector is higher than the synchronization mode temporarily stored in the node status register, and the mode selector reads the accumulated number of successful time synchronizations from the time synchronization controller to reach the set number, the mode selector will modify the synchronization mode determined by the status of the second pulse status register, serial port status register, and network port status register and the accuracy priority principle to the node status register.

2. The adaptive multi-mode time synchronization system according to claim 1, characterized in that: It also includes a node status register, which is used to temporarily store the current synchronization mode of the slave device. The mode selector writes the determined synchronization mode into the node status register. The node status register contains a synchronization status indicator bit and a synchronization mode indicator bit. The synchronization status indicator bit includes an unsynchronized state and a synchronized state. The synchronized state is within a set time after the synchronization time is copied to the second timer, and the unsynchronized state is after the set time is exceeded. The synchronization mode indicator bit is used to indicate the synchronization mode, which includes second pulse + serial port synchronization mode, second pulse + network port synchronization mode, or network port synchronization mode.

3. The adaptive multi-mode time synchronization system according to claim 2, characterized in that, It also includes a timer, which is used to change the node status register from a synchronized state to an unsynchronized state when the slave device has not received any input signals, serial data frames and / or network data frames for an extended period of time.

4. The adaptive multi-mode time synchronization system according to claim 3, characterized in that: The initial state of the node status register after the slave device is powered on is: unsynchronized state and second pulse + serial port synchronization mode; each time the slave device is successfully synchronized, the node status register is updated to synchronized state and the timer is reset and recounted; if the slave device fails to synchronize again after the set time is connected, the node status register is updated to unsynchronized state.

5. The adaptive multi-mode time synchronization system according to claim 1, characterized in that: It also includes a second pulse filter and a microsecond controller; The second pulse filter performs digital filtering on the input signal. When the input signal's pulse width is greater than the set pulse width, a trigger signal is obtained; otherwise, no trigger signal is obtained. After the trigger signal, the value of the temporary microsecond timer is activated, waiting for the next trigger signal with a pulse width greater than the set pulse width. After the next trigger signal, the value of the temporary microsecond timer is activated again. If the difference between the temporary microsecond timer values ​​corresponding to two consecutive trigger signals is less than a set threshold, a valid second pulse signal is determined to have been received, and a valid second pulse signal is sent to the microsecond controller. The microsecond controller resets and restarts the microsecond timer upon receiving a valid second pulse signal, and performs delay compensation on the microsecond timer according to the filtering process. At the same time, it determines the value of the microsecond timer and the value of the node status register at the reset time. If the working state of the slave device in the node status register is in the synchronous state and the value of the microsecond timer is greater than a certain threshold but less than 1 second, then the value of the second timer is incremented by 1 second.

6. The adaptive multi-mode time synchronization system according to claim 1, characterized in that: If the second pulse status is yes, the serial port status is yes and the network port status is no, or if the second pulse status is yes, the serial port status is yes and the network port status is yes, then the second pulse + serial port synchronization mode is used. If the second pulse status is yes, the serial port status is no, and the network port status is yes, then the second pulse + network port synchronization mode is used. If only the network port status is "yes", then use the network port synchronization mode.

7. The adaptive multi-mode time synchronization system according to claim 1, characterized in that: When in second pulse + serial port synchronization mode, the second pulse status register refresh will trigger the time synchronization controller to enable serial port time register write operation and start countdown. If a new synchronization time is stored in the serial port time register before the countdown ends, the time synchronization controller will copy the value of the serial port time register to the second timer to complete the slave device time synchronization; when the countdown ends, the time synchronization controller will disable serial port time register write operation. When in the second pulse + network port synchronization mode, the second pulse status register refresh will trigger the time synchronization controller to enable the network port time register write operation and start the countdown. If a new synchronization time is stored in the network port time register before the countdown ends, the time synchronization controller will copy the value of the network port time register to the second timer to complete the time synchronization of the slave device; when the countdown ends, the time synchronization controller will disable the network port time register write operation. If in network port synchronization mode, after the time controller detects that the network port time register has been updated to synchronize the time, it immediately copies the value of the network port time register to the second timer to complete the time synchronization with the slave device.

8. An adaptive multi-mode time synchronization method, characterized in that, An adaptive multi-mode time synchronization system according to any one of claims 1-7 performs time synchronization, comprising: S1. The inputs obtained from the device include input signals, serial port data frames and / or network port data frames. S2 is performed on the obtained input signals, S3 is performed on the obtained serial port data frames, and S4 is performed on the obtained network port data frames. S2. Based on the input signal, save whether there is a second pulse signal input to the slave device to obtain the second pulse status; The input signal is digitally filtered. When the input signal's width is greater than the set pulse width, a trigger signal is obtained; otherwise, no trigger signal is obtained. After the trigger signal, the value of the temporary microsecond timer is activated, and the system waits for the next trigger signal with a width greater than the set pulse width. After the next trigger signal, the value of the temporary microsecond timer is activated again. If the difference between the temporary microsecond timer values ​​corresponding to two consecutive trigger signals is less than a set threshold, a valid second pulse signal is considered to have been received. Upon receiving a valid second pulse signal, the microsecond timer is reset and restarted, and delay compensation is applied to the microsecond timer based on the filtering process. Simultaneously, the value of the microsecond timer at the reset moment and the value of the node status register are compared. If the slave device's working state in the node status register is in a synchronized state and the value of the microsecond timer is greater than a certain threshold but less than 1 second, the value of the second timer is incremented by 1 second. S3. Based on the serial port data frame, save whether there is a serial port data frame input to the slave device and obtain the serial port status; extract the synchronization time from the serial port data frame; S4. Based on the network port data frame, save whether there is a current network port data frame input to the slave device to obtain the network port status; extract the synchronization time from the network port data frame. S5. Detect the second pulse status of S2, the serial port status of S3, and the network port status of S4, and determine the synchronization mode according to the principle of prioritizing accuracy. S6. According to the synchronization mode determined in S5, copy the synchronization time temporarily stored in the serial port time register or network port time register corresponding to the synchronization mode to the second timer.

Citation Information

Patent Citations

  • Platform and method for controlling work state of communication radio stations in multichannel mode

    CN107145112A

  • Beidou timing and punctuality system based on VPX board card in complex environment

    CN108628157A