Self-adaptive multi-mode time synchronization system and method

By implementing an adaptive multi-mode time synchronization method in the end device, it supports the automatic selection of accuracy of multiple synchronization modes first, which solves the problem that existing end devices can only support a single time synchronization method, achieving higher flexibility and economy.

CN119921889AActive Publication Date: 2025-05-02BEIJING AEROSPACE AUTOMATIC CONTROL RES INST
View PDF 6 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing end devices that support time synchronization generally only support a certain time synchronization method, and cannot balance and choose the best of different applications between synchronization accuracy and economy, limiting the application flexibility of end devices.

Method used

An adaptive multi-mode time synchronization method is proposed. By implementing a new mode of two standard synchronization methods, second pulse + serial port time and network protocol timer, it supports automatic selection of accuracy priority for multiple synchronization methods, and realizes high-precision synchronization or downgrading synchronization accuracy to maintain synchronization.

Benefits of technology

It realizes that without increasing hardware costs, it provides multiple synchronization modes for end devices in the field of distributed measurement and control, expands the versatility and economy of end devices, simplifies the use of equipment, and is suitable for large-scale distributed cluster electrical control systems or simple electrical systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119921889A_ABST
    Figure CN119921889A_ABST
Patent Text Reader

Abstract

The invention discloses a self-adaptive multi-mode time synchronization system and method, relates to the field of distributed measurement and control, and is suitable for slave equipment. According to the method, on the basis of two common standard synchronization methods of pulse per second + serial port time service and network protocol time service, a new mode of pulse per second + network protocol time service is provided, and integration of three synchronization modes is realized in slave equipment. The slave device adaptively selects the available time service mode with the highest precision according to the time synchronization input pulse per second and the synchronization frame condition, the design of the slave device does not need to be changed, a user can conveniently and flexibly select according to application requirements, and the optimal combination of system cost, synchronization precision and the like is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of distributed measurement and control, and relates to an adaptive multi-mode time synchronization method applied to terminal equipment. Background Art

[0002] All end devices in a distributed measurement and control system generally need to establish a unified time reference for the entire system. The distributed measurement and control system includes end devices and switching devices. The end devices are divided into master devices and slave devices. The master device is used to provide an absolute time reference, and the master device will provide the absolute time reference to the slave device through a time synchronization method. Currently, the commonly used end device time synchronization methods include bus network synchronization such as NTP, serial port timing such as IRIG-B code, PPS second pulse + bus synchronization frame, and PTP. The synchronization accuracy, implementation method, and economy achieved by various methods are different, and each has its own applicable scenarios. NTP is applicable to systems with standard Ethernet connections. It does not require special hardware, and the software implementation is relatively complex and economical. However, the synchronization accuracy is only sub-second. Serial port timing methods, such as IRIG-B code, require dedicated hardware interface circuit overhead on the end device. The technology is relatively simple, economical, and the synchronization accuracy is at the millisecond level. The PPS second pulse + bus synchronization frame method requires a dedicated interface circuit on the end device and a dedicated connection cable on the system. The hardware overhead is relatively large, but the technology is simple, economical, and the synchronization accuracy is at the sub-microsecond level. PTP and other synchronization methods based on 1588v2 do not require hardware second pulse synchronization signals, but the underlying chip needs to support 1588V2. The technology is complex and costly, and the synchronization accuracy can reach sub-microseconds. The selection of each synchronization method must take into account factors such as system scale, distance to the synchronization end device, synchronization accuracy, and cost. However, the common end devices on the market that support distributed time synchronization only support one synchronization method and achieve a single synchronization accuracy. They do not provide multiple synchronization methods. This allows designers to flexibly select application modes based on the system scale, transmission distance, synchronization accuracy, and economy requirements of specific application projects, which limits the universality and application scope of the end devices.

[0003] Existing terminal devices that support time synchronization generally only support a certain time synchronization method, and are unable to balance synchronization accuracy and economy for different applications, limiting the flexibility of terminal device applications. Summary of the invention

[0004] The technical problem solved by the present application is: to overcome the deficiencies 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 a general terminal device for the field of 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] Based on the existing two standard synchronization methods of second pulse + serial port timing and network protocol timing, the present invention proposes a new mode of second pulse + network protocol timing, and realizes the integration of three synchronization modes in the slave device, and supports the automatic selection of the accuracy priority of multiple synchronization methods. When the high-precision synchronization method is available, the end device automatically realizes high-precision synchronization. When the high-precision synchronization method is unavailable due to a fault, the end device can downgrade the synchronization accuracy and maintain synchronization. This method has the characteristics of low comprehensive cost and easy implementation, and is suitable for use in 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 solutions provided by this application are as follows:

[0007] An adaptive multi-mode time synchronization system includes a slave device, wherein the slave device has a pulse-per-second interface, a serial port, and an Ethernet port; an input signal is input into the slave device through the pulse-per-second interface, a serial port data frame is input into the slave device through the serial port, and a network port data frame is input into the slave device through the Ethernet port;

[0008] The slave device is provided with a microsecond timer and a second timer. The microsecond timer keeps timing in microseconds. After the microsecond timer counts for 1 second, the second timer is controlled to add 1 second. The second timer starts timing in seconds from the agreed absolute time by accumulating the microsecond timer.

[0009] The slave device is provided with a pulse-per-second status register, a serial port status register, a network port status register, a serial port time register, a network port time register, a time calibration controller and a mode selector;

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

[0011] The serial port status register is used to save whether there is a serial port data frame input from the device and obtain the serial port status;

[0012] The network port status register is used to save whether there is a network port data frame input from the device and obtain 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] A mode selector, used to detect the pulse-per-second status, serial port status and network port status of the pulse-per-second status register, the serial port status and the network port status register, and determine the synchronization mode according to the principle of accuracy priority;

[0016] The time calibration controller is used to copy the synchronization time temporarily stored in the serial port time register or the 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 calibration slave device.

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

[0018] The node status register includes a synchronization status indication bit and a synchronization mode indication bit. The synchronization status indication bit includes an unsynchronized state and a synchronized state. The synchronization state is within the set time after the synchronization time is copied to the second timer. If the synchronization with the synchronization master fails to be performed once within the set time, it is an unsynchronized state. The synchronization mode indication bit is used to indicate the synchronization mode. The synchronization modes include second pulse + serial port synchronization mode, second pulse + network port synchronization mode or network port synchronization mode.

[0019] Optionally, the method further includes a timer, which is used to change the node status register from a synchronized state to an unsynchronized state when there is no input signal, serial port data frame and / or network port data frame input from the slave device for a long 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 calibrated, the node status register is updated to the synchronized state, and the timer is reset and recalculated; if the slave device fails to calibrate again within the set time, the node status register is updated to the unsynchronized state.

[0021] Optionally, it also includes pulse-per-second filtering and microsecond controller;

[0022] The second pulse filter performs digital filtering on the input signal. When the level width of the input signal 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 temporarily stored microsecond timer is triggered, and the next trigger signal with a width greater than the set pulse width is waited for. After the next trigger signal, the value of the temporarily stored microsecond timer is triggered; when the difference between the temporarily stored values ​​of the microsecond timer corresponding to two consecutive trigger signals is less than the set threshold, it is determined that a valid second pulse signal is received, and a second pulse valid 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 a synchronous 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 increased by 1S.

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

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

[0026] Optionally, the timing controller accumulates the number of successful timing and the number of failed timing; when the status of the second pulse status register, the serial port status register, and the 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 timing controller until the mode selector reads the cumulative number of timing failures of the timing controller to reach a set number, and the mode selector will modify the synchronization mode determined according to the status of the second pulse status register, the serial port status register, and the network port status register and the precision priority principle to the node status register; when the status of the second pulse status register, the serial port status register, and the 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 cumulative number of successful timing read by the mode selector to reach a set number, the mode selector will modify the synchronization mode determined according to the status of the second pulse status register, the serial port status register, and the network port status register and the precision priority principle to the node status register.

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

[0028] When in the second pulse + network port synchronization mode, the refresh of the second pulse status register will trigger the time calibration 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 calibration controller will copy the value of the network port time register to the second timer to complete the slave device time calibration; when the countdown ends, the time calibration controller will prohibit the network port time register write operation;

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

[0030] An adaptive multi-mode time synchronization method, performing time synchronization according to any of the above-mentioned adaptive multi-mode time synchronization systems, comprises:

[0031] S1. The input obtained from the device includes an input signal, a serial port data frame and / or a network port data frame. S2 is performed on the obtained input signal, S3 is performed on the obtained serial port data frame, and S4 is performed on the obtained network port data frame.

[0032] S2, according to the input signal, save whether there is a second pulse signal input from the device, and obtain the second pulse state;

[0033] Perform digital filtering on the input signal. When the level width of the input signal 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 temporarily stored microsecond timer is triggered, and the next trigger signal with a width greater than the set pulse width is waited for. After the next trigger signal, the value of the temporarily stored microsecond timer is triggered. When the difference between the temporarily stored values ​​of the microsecond timer corresponding to two consecutive trigger signals is less than the set threshold, it is determined that a valid second pulse signal is received. When a valid second pulse signal is received, the microsecond timer is reset and restarted, and delay compensation is performed on the microsecond timer according to the filtering process. At the same time, the value of the microsecond timer and the value of the node status register at the time of reset are determined. If the working state of the slave device in the node status register is in a synchronous 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 increased by 1S.

[0034] S3, according to the serial port data frame, save whether there is currently a serial port data frame input from the device, obtain the serial port status; extract the synchronization time from the serial port data frame;

[0035] S4, according to the network port data frame, save whether there is a network port data frame currently input from the device, obtain the network port status; extract the synchronization time from the network port data frame;

[0036] S5, detect the second pulse state of S2, the serial port state of S3 and the network port state of S4, and determine the synchronization mode according to the principle of accuracy priority;

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

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

[0039] 1) The present invention utilizes the common interfaces of the existing measurement and control system terminal equipment, and provides multiple working modes suitable for different system scales, transmission distances, synchronization accuracy, and economy without adding additional hardware costs, thereby expanding the versatility and economy of the terminal equipment;

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

[0041] 3) The present invention proposes a new second pulse + network port time synchronization frame synchronization method. 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 end device. Under the condition of equivalent 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 connections of the synchronization slave device, which can be suitable for a larger system scale. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0043] Figure 2 This is a structural diagram of a specific implementation of this application. DETAILED DESCRIPTION

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

[0045] like Figure 1 As shown, the embodiment of the present application discloses an adaptive multi-mode time synchronization method, which is applied to a slave device, and the slave device is externally configured with at least three interfaces: a second pulse interface, a serial port and an Ethernet port. The slave device is provided 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, a network port status register, a serial port time register, a network port time register, a time calibration controller, a mode selector, a second timer, a node status register, a timer, etc.;

[0046] The second pulse filter is used to receive the second pulse signal input from the outside. The microsecond controller is used to check the validity of the filtered second pulse and control the microsecond timer to count from zero with the rising edge / falling edge of the second pulse as the starting time. The microsecond timer is used to achieve high-precision timing below the second level with an accuracy of 1 microsecond from the device. The serial port synchronization time extraction is used to identify the time synchronization frame from the serial port message frame and parse out the transmission synchronization time. The Ethernet synchronization time extraction is used to identify the time synchronization frame from the Ethernet message frame and parse out the transmission synchronization time. The second pulse status register is used to save whether there is an external second pulse signal input from the device. The serial port status register is used to save whether there is a serial port time synchronization frame input from the device. The network port status register is used to save whether there is a network port time synchronization frame input from the device. The serial port time register It is used to temporarily store the synchronization time extracted from the serial port. The network port time register is used to temporarily store the synchronization time extracted from the serial port. The timing controller is used to time 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, the serial port status register and the network port status register and autonomously determine the best synchronization mode of the slave device according to the principle of accuracy priority. The second timer is used to realize the cumulative timing of the slave device in seconds starting from a certain agreed absolute time. The node status register is used to temporarily store the current working state of the slave device, including the power-on initial state and the synchronization state synchronized with the external time (including second pulse + serial port, second pulse + network port, network port); the timer is used to reset the node status register when there is no external synchronization input for a long time, and change the register from the synchronized state to the unsynchronized state.

[0047] The node status register includes a synchronization status indication bit and a synchronization mode indication bit. The synchronization status indication bit includes an unsynchronized state and a synchronized state. The synchronization mode indication bit includes a second pulse + serial port synchronization mode, a second pulse + network port synchronization mode, or a network port synchronization mode. After the slave device is powered on, it defaults to an unsynchronized state and a second pulse + serial port synchronization mode. After several successful time calibrations, the node status register is updated to a synchronized state, and the timer is reset and recalculated. When the slave device fails to calibrate again for a period of time, it is updated to an unsynchronized state. The mode selector dynamically updates the synchronization mode of the node status register based on the monitoring results.

[0048] Second pulse filtering continuously collects input signals (input from the second pulse interface) according to the set sampling period, and performs digital filtering on the input signals. When the level width of the input signal is greater than the set pulse width, a trigger signal is obtained, otherwise, no trigger signal is obtained; the trigger signal obtained by the second pulse filtering triggers the value of the temporarily stored 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 temporarily stored microsecond timer again. In this way, if the difference between the temporarily stored values ​​of the microsecond timer of two consecutive input pulses is less than a certain set threshold, it is determined that a valid second pulse signal is received, and a second pulse valid signal is sent to the microsecond controller;

[0049] The microsecond controller resets the microsecond timer and restarts it when 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 a synchronous 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 increased by 1; after the microsecond timer counts for 1 second, the time of the second timer is controlled to increase by 1 second (the time increase of the second timer is controlled by the microsecond timer, and it does not count itself). Through the second pulse, the exact second moment is obtained.

[0050] Microsecond timer, which uses the crystal oscillator in the slave device to continuously measure time in units of 1 microsecond;

[0051] Serial port synchronization time extraction, parity check of external 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, and the serial port status register is set to the valid state;

[0052] The serial port status register is set to the invalid state by default after the device is powered on. The "serial port synchronization extraction" sets the register to the valid state after receiving the time synchronization frame. If the time synchronization frame is not received for several seconds, the register is changed to the invalid state.

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

[0054] Network port synchronization time extraction, CRC check is performed on the external input network 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 network port time register, and the network port status register is set to a valid state;

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

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

[0057] The mode selector continuously detects the values ​​of the pulse-per-second status register, the serial port status register, and the network port status register. If both the pulse-per-second and the serial port time synchronization frames exist, the pulse-per-second + serial port synchronization mode is used first. If the serial port time synchronization frame does not exist but the pulse-per-second and network port time synchronization frame exist, the pulse-per-second + network port synchronization mode is used. If the pulse-per-second 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: pulse-per-second + serial port is higher than pulse-per-second + network port, and pulse-per-second + network port is higher than network port. The mode selector updates the mode representation bit state of the node status register after completing several consecutive time synchronizations; the mode selector sets the current synchronization mode according to the value of the node status register. During the working process, the high priority synchronization mode is used immediately when the high priority synchronization mode conditions are detected. When the status of the pulse-per-second status register, the serial port status register, and the 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 suspend the time controller. If the synchronization fails for many consecutive times, the mode selector will reduce the priority of the node status register to the highest available priority mode.

[0058] The time calibration controller has three synchronization modes: second pulse + serial port, second pulse + network port, and network port. The mode selector determines which synchronization mode it is in. When in the second pulse + serial port synchronization mode, the second pulse status register refresh will trigger the time calibration controller to enable the serial port time register write operation and start the countdown. The countdown time can be set, generally 300ms. If a new synchronization time is stored in the serial port time register before the countdown ends, the time calibration controller will copy the value of the serial port time register to the second timer to complete the slave device time calibration. When the countdown ends, the time calibration controller prohibits the serial port time register write operation. When in the second pulse + In the network port synchronization mode, the refresh of the second pulse status register will trigger the time controller to enable the network port time register write operation and start the countdown. The countdown time can be set, usually 300ms. If a new synchronization time is stored in the network port time register before the countdown ends, the time controller will copy the value of the network port time register to the second timer to complete the slave device time calibration; when the countdown ends, the time controller prohibits the network port time register write operation; if it is in the network port synchronization mode, the time controller will immediately copy the value of the network port time register to the second timer after detecting that the network port time register updates the synchronization time, completing the slave device time calibration;

[0059] The timing controller accumulates the number of successful timing calibrations and the number of failed timing calibrations.

[0060] The connection between the slave device and the master device includes a timing serial port and / or Ethernet.

[0061] The synchronization mode includes three synchronization modes: pulse-second + serial port, pulse-second + network port, and network port. If both pulse-second and serial port time synchronization frames exist, the pulse-second + serial port synchronization mode is used first. If the serial port time synchronization frame does not exist but the pulse-second and network port time synchronization frames exist, the pulse-second + network port synchronization mode is used. If the pulse-second 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: pulse-second + serial port is higher than pulse-second + network port, and pulse-second + network port is higher than network port.

[0062] The mode selector updates the mode representation bit state of the node status register after completing several consecutive time synchronizations; the mode selector sets the current synchronization mode according to the synchronization mode of the node status register. During operation, it detects that the high priority synchronization mode condition is higher than the input, and immediately uses the high priority synchronization mode. When the state of the second pulse status register, the serial port status register, and the network port status register detected by the mode selector is lower than the priority of the state temporarily stored in the node status register, the mode selector will suspend the time controller. If the mode selector reads the accumulated time synchronization failure number of the time synchronization controller to reach the set number, the mode selector will lower the priority of the node status register to the highest available priority mode; when it is detected that the input of the slave device has changed and is higher than the synchronization mode of the node status register, and the accumulated time synchronization success number of the time synchronization controller read by the mode selector reaches the 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 + network port synchronization mode is proposed by utilizing the Ethernet port commonly used in distributed nodes without increasing hardware overhead. Its accuracy is the same as that of the second pulse + serial port synchronization mode.

[0064] After the slave device enters the synchronization state, that is, the node status register is in the synchronization state, if the synchronization fails, the slave device can rely on its own crystal oscillator and microsecond timer and second timer to continue to keep time and maintain the synchronization state. When the synchronization failure continues for a certain period of time, the synchronization accuracy of the slave device exceeds the set threshold, and the slave device and the node status register become out-of-sync state;

[0065] The second pulse + serial port synchronization mode, second pulse + network port synchronization mode, and network port synchronization mode are performed independently, and the high-precision synchronization mode has a high priority, and the low-precision synchronization mode has a low priority. The high-precision synchronization mode can be applied immediately after switching to the low-precision synchronization mode, and the high-precision synchronization mode needs to go through a protection period to switch to the low-precision mode.

[0066] When the microsecond timer is cleared and restarted, the microsecond timer is compensated according to the filter delay caused by the digital filter.

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

[0068] In the present application embodiment, Figure 2 As shown, a programmable logic chip and an embedded processor are integrated inside the device. The programmable logic chip is an FPGA or CPLD programmable logic chip, and the embedded processor includes an MCU (microcontroller) or CPU (universal processor) chip. The embedded processor and the programmable logic chip are connected via a bus interface.

[0069] like Figure 2 As shown, the pulse-per-second interface and the serial port are connected to the FPGA, and the Ethernet port is connected to the MCU. The pulse-per-second filter, microsecond controller, microsecond timer, serial port synchronization time extraction, pulse-per-second status register, serial port status register, serial port time register, timing controller, and second timer are all set in the FPGA; the Ethernet synchronization time extraction, network port time register, network port status register, mode selector, node status register, and timer are all set in the MCU. The connection relationship between each functional module is the same as described above.

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

[0071] The present application is described in detail above in conjunction with specific implementation methods and exemplary examples, but these descriptions cannot be understood as limiting the present application. Those skilled in the art understand that, without departing from the spirit and scope of the present application, a variety of equivalent replacements, modifications or improvements can be made to the technical solution of the present application and its implementation methods, all of which fall within the scope of the present application. The scope of protection of the present application shall be subject to the attached claims.

Claims

1. An adaptive multi-mode time synchronization system, characterized in that: The slave device includes a pulse-per-second interface, a serial port and an Ethernet port; the input signal is input into the slave device through the pulse-per-second interface, the serial port data frame is input into the slave device through the serial port, and the network port data frame is input into the slave device through the Ethernet port; The slave device is provided with a microsecond timer and a second timer. The microsecond timer keeps timing in microseconds. After the microsecond timer counts for 1 second, the second timer is controlled to add 1 second. The second timer starts timing in seconds from the agreed absolute time by accumulating the microsecond timer. The slave device is provided with a pulse-per-second status register, a serial port status register, a network port status register, a serial port time register, a network port time register, a time calibration controller and a mode selector; The pulse-per-second status register is used to save whether there is an input signal input to the slave device and obtain the pulse-per-second status; The serial port status register is used to save whether there is a serial port data frame input from the device and obtain the serial port status; The network port status register is used to save whether there is a network port data frame input from the device and obtain 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; A mode selector, used to detect the pulse-per-second status, serial port status and network port status of the pulse-per-second status register, the serial port status and the network port status register, and determine the synchronization mode according to the principle of accuracy priority; The time calibration controller is used to copy the synchronization time temporarily stored in the serial port time register or the 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 calibration slave device.

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

3. An adaptive multi-mode time synchronization system according to claim 2, characterized in that: The method also includes a timer, which is used to change the node status register from a synchronized state to an unsynchronized state when there is no input signal, serial port data frame and / or network port data frame input from the slave device for a long 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 calibrated, the node status register is updated to the synchronized state, and the timer is reset and recalculated; if the slave device fails to calibrate the time again after connecting to the set time, the node status register is updated to the unsynchronized state.

5. The adaptive multi-mode time synchronization system according to claim 1, characterized in that: Also includes pulse-per-second filtering and microsecond controller; The second pulse filter performs digital filtering on the input signal. When the level width of the input signal 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 temporarily stored microsecond timer is triggered, and the next trigger signal with a width greater than the set pulse width is waited for. After the next trigger signal, the value of the temporarily stored microsecond timer is triggered; when the difference between the temporarily stored values ​​of the microsecond timer corresponding to two consecutive trigger signals is less than the set threshold, it is determined that a valid second pulse signal is received, and a second pulse valid 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 a synchronous 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 increased by 1S.

6. The adaptive multi-mode time synchronization system according to claim 1, characterized in that: The precision priority principle includes: the second pulse + serial port synchronization mode is higher than the second pulse + network port synchronization mode, and the second pulse + network port synchronization mode is higher than the network port synchronization mode.

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

8. The adaptive multi-mode time synchronization system according to claim 6, characterized in that: The timing controller accumulates the number of successful timing calibrations and the number of failed timing calibrations; When the status of the pulse-per-second status register, the serial port status register, and the 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 suspend the time calibration controller until the accumulated number of time calibration failures read by the mode selector reaches the set number. The mode selector will modify the synchronization mode determined according to the status of the pulse-per-second status register, the serial port status register, and the network port status register and the principle of accuracy priority 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 has a higher priority than the synchronization mode temporarily stored in the node status register, and the cumulative number of successful time synchronization read by the mode selector from the time synchronization controller reaches the set number, the mode selector will modify the synchronization mode determined according to the status of the second pulse status register, serial port status register, and network port status register and the principle of accuracy priority to the node status register.

9. The adaptive multi-mode time synchronization system according to claim 1, characterized in that: When in the second pulse + serial port synchronization mode, the refresh of the second pulse status register will trigger the time calibration controller to enable the serial port time register write operation and start the countdown. If a new synchronization time is stored in the serial port time register before the countdown ends, the time calibration controller will copy the value of the serial port time register to the second timer to complete the slave device time calibration; when the countdown ends, the time calibration controller prohibits the serial port time register write operation; When in the second pulse + network port synchronization mode, the refresh of the second pulse status register will trigger the time calibration 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 calibration controller will copy the value of the network port time register to the second timer to complete the slave device time calibration; when the countdown ends, the time calibration controller will prohibit the network port time register write operation; If it is in the network port synchronization mode, after the time synchronization controller detects that the network port time register updates the synchronization time, it immediately copies the value of the network port time register to the second timer to complete the slave device time synchronization.

10. An adaptive multi-mode time synchronization method, characterized in that: An adaptive multi-mode time synchronization system according to any one of claims 1 to 9 performs time synchronization, comprising: S1. The input obtained from the device includes an input signal, a serial port data frame and / or a network port data frame. S2 is performed on the obtained input signal, S3 is performed on the obtained serial port data frame, and S4 is performed on the obtained network port data frame. S2, according to the input signal, save whether there is a second pulse signal input from the device, and obtain the second pulse state; Perform digital filtering on the input signal. When the level width of the input signal 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 temporarily stored microsecond timer is triggered, and the next trigger signal with a width greater than the set pulse width is waited for. After the next trigger signal, the value of the temporarily stored microsecond timer is triggered. When the difference between the temporarily stored values ​​of the microsecond timer corresponding to two consecutive trigger signals is less than the set threshold, it is determined that a valid second pulse signal is received. When a valid second pulse signal is received, the microsecond timer is reset and restarted, and delay compensation is performed on the microsecond timer according to the filtering process. At the same time, the value of the microsecond timer and the value of the node status register at the time of reset are determined. If the working state of the slave device in the node status register is in a synchronous 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 increased by 1S. S3, according to the serial port data frame, save whether there is currently a serial port data frame input from the device, obtain the serial port status; extract the synchronization time from the serial port data frame; S4, according to the network port data frame, save whether there is a network port data frame currently input from the device, obtain the network port status; extract the synchronization time from the network port data frame; S5, detect the second pulse state of S2, the serial port state of S3 and the network port state of S4, and determine the synchronization mode according to the principle of accuracy priority; S6. According to the synchronization mode determined in S5, the synchronization time temporarily stored in the serial port time register or the network port time register corresponding to the synchronization mode is copied 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

  • Clock server based on multi-mode clock source synchronization

    CN202818320U

  • Sensor network high-precision time synchronization device

    CN214954113U

  • System and method for timing synchronization

    US11899491B1