Clock synchronization method and device, electronic equipment and storage medium

Through the multi-level clock synchronization protocol in a large distributed redundant control system, different clock sources and protocols are used to perform clock synchronization, solving the problem of large clock synchronization errors between devices and achieving high-precision clock synchronization and event recording.

CN119094071APending Publication Date: 2024-12-06SUPCON TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411087949.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-09
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

In large distributed redundant control systems, there are large errors in clock synchronization between devices, which affects the clock synchronization effect and makes it difficult to achieve high-precision event sequence recording.

Method used

Using a multi-level clock synchronization protocol, the controller is synchronized periodically through the first clock synchronization protocol, the second clock synchronization protocol synchronizes the communication forwarding module, and the remote rack is synchronized through the third clock synchronization protocol, using different The clock source and protocol are separated and isolated, and the clock synchronization method is flexibly configured.

Benefits of technology

Reduces clock synchronization error, improves clock synchronization effect, reduces additional equipment costs and data processing delays, and improves the system's clock synchronization accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119094071A_ABST
    Figure CN119094071A_ABST
Patent Text Reader

Abstract

The invention provides a clock synchronization method and device, electronic equipment and a storage medium, and relates to the technical field of network communication, the clock synchronization method and device are applied to a distributed redundancy control system, the distributed redundancy control system comprises a first local rack and a remote rack, and the first local rack comprises a first controller and a first communication forwarding module; the clock synchronization method comprises the following steps: performing periodic clock synchronization on the first controller by adopting a first clock synchronization protocol; performing clock synchronization on the first communication forwarding module by adopting a second clock synchronization protocol and a communication bus according to the first controller; and carrying out clock synchronization on the remote rack by adopting a third clock synchronization protocol through the first communication forwarding module. According to the invention, the clock synchronization effect can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network communication technology, and in particular to a clock synchronization method, device, electronic equipment and storage medium. Background Art

[0002] In scenarios where large-scale distributed redundant control systems such as industrial control systems, power systems, and railway signal systems need to monitor and record the order of events, the system is required to support high-precision sequence of events (SOE), that is, high-precision SOE events, so that engineers and operators can understand the operation of the system, the cause of failures, the interaction between devices, and the response time of the system. In order for the system to support high-precision SOE events, it is necessary to adjust the time between multiple clocks or time sources of the system to keep them consistent or as close as possible, that is, to achieve clock synchronization.

[0003] At present, since large-scale distributed redundant control systems include a variety of devices, and the connection methods and spacings between the devices are different, there are large errors between the devices when synchronizing the clocks of the devices, which affects the effect of clock synchronization. Summary of the invention

[0004] The problem solved by the present invention is how to improve the effect of clock synchronization.

[0005] In a first aspect, the present invention provides a clock synchronization method, which is applied to a distributed redundant control system, wherein the distributed redundant control system includes a first local rack and a remote rack, wherein the first local rack includes a first controller and a first communication forwarding module;

[0006] The clock synchronization method comprises:

[0007] Performing periodic clock synchronization on the first controller using a first clock synchronization protocol;

[0008] According to the first controller, using a second clock synchronization protocol and a communication bus, clock synchronization is performed on the first communication forwarding module;

[0009] The remote rack is clock synchronized by using the first communication forwarding module and a third clock synchronization protocol.

[0010] Optionally, the distributed redundant control system further includes a second local rack, the second local rack includes a second controller and a second communication forwarding module; after the first controller is synchronized with the periodic clock by using the first clock synchronization protocol, the system further includes:

[0011] According to the first controller, adopting the second clock synchronization protocol to synchronize the clock of the second controller;

[0012] According to the second controller, the second clock synchronization protocol is adopted to perform clock synchronization on a second communication forwarding module corresponding to the second controller.

[0013] Optionally, the remote rack includes a third communication forwarding module; and the step of performing clock synchronization on the remote rack by using a third clock synchronization protocol through the first communication forwarding module includes:

[0014] Acquire a first clock difference between the third communication forwarding module and the first communication forwarding module;

[0015] When the first clock difference is greater than a first preset threshold, the first communication forwarding module is used to perform clock synchronization on the third communication forwarding module using the third clock synchronization protocol.

[0016] Optionally, the remote rack further includes an input and output module; after performing clock synchronization on the third communication forwarding module by using the third clock synchronization protocol through the first communication forwarding module when the clock difference is greater than the first preset threshold, the remote rack further includes:

[0017] According to the third communication forwarding module, the third clock synchronization protocol and the communication bus are used to perform clock synchronization on the input-output module.

[0018] Optionally, the adopting a first clock synchronization protocol to perform periodic clock synchronization on the first controller includes:

[0019] Obtaining the synchronization times of the first controller;

[0020] When the synchronization number is zero, performing clock synchronization on the first controller using the first clock synchronization protocol;

[0021] When the synchronization times is not zero, the first controller is clock synchronized using the first clock synchronization protocol according to a preset synchronization frequency.

[0022] Optionally, the distributed redundant control system further includes a clock synchronization server, and the adopting of the first clock synchronization protocol to perform periodic clock synchronization on the first controller includes:

[0023] Obtaining a second clock difference between the clock synchronization server and the first controller;

[0024] When the second clock difference is greater than a second preset threshold, the first controller is periodically synchronized by the clock synchronization server using the first clock synchronization protocol.

[0025] Optionally, the performing clock synchronization on the remote rack by using the first communication forwarding module and adopting a third clock synchronization protocol includes:

[0026] When the remote rack is associated with the first controller, a third clock difference between the remote rack and the first communication forwarding module is obtained; if the third clock difference is greater than a third preset threshold, the remote rack is clock synchronized by the first communication forwarding module using the third clock synchronization protocol;

[0027] When the remote rack is associated with the second controller, the clock of the remote rack is synchronized by using the third clock synchronization protocol through the first-second communication forwarding module.

[0028] In a second aspect, the present invention provides a clock synchronization device, comprising:

[0029] A first synchronization module, configured to perform periodic clock synchronization on the first controller using a first clock synchronization protocol;

[0030] A second synchronization module, configured to perform clock synchronization on the first communication forwarding module according to the first controller using a second clock synchronization protocol and a communication bus;

[0031] The third synchronization module is used to synchronize the clock of the remote rack by using the third clock synchronization protocol through the first communication forwarding module.

[0032] In a third aspect, the present invention provides an electronic device, including a memory and a processor;

[0033] The memory is used to store computer programs;

[0034] The processor is used to implement the clock synchronization method as described in the first aspect when executing the computer program.

[0035] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the clock synchronization method as described in the first aspect is implemented.

[0036] The clock synchronization method, device, electronic device and storage medium of the present invention have the following beneficial effects:

[0037] First, the first controller is synchronized with the periodic clock by using the first clock synchronization protocol. At this time, the clock source is the clock synchronization server corresponding to the first clock synchronization protocol. Then, the synchronized first controller is used as the clock source, and the second clock synchronization protocol and the communication bus are used to synchronize the clock of the first communication forwarding module. Finally, the synchronized first communication forwarding module is used as the clock source, and the third clock synchronization protocol is used to synchronize the clock of the remote rack. Since different clock sources are set at each step of time synchronization, that is, the clock source of the distributed redundant control system is divided and isolated, and different synchronization protocols are used in each step to obtain a more flexible clock synchronization configuration method, which is convenient for coping with the complex structure of the distributed redundant control system, reducing errors, and improving the effect of clock synchronization. Moreover, clock synchronization through the communication bus can also reduce the additional equipment cost of clock synchronization, reduce delays and uncertainties in data processing and communication, and thus improve the effect of clock synchronization. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 A schematic diagram of a clock synchronization method according to an embodiment of the present invention;

[0039] Figure 2 A schematic diagram of the structure of a distributed redundant control system provided by an embodiment of the present invention;

[0040] Figure 3 A schematic diagram of the structure of a distributed redundant control system provided by another embodiment of the present invention;

[0041] Figure 4 A schematic diagram of the structure of a clock synchronization device provided by an embodiment of the present invention;

[0042] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0043] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. Although certain embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be interpreted as being limited to the embodiments described herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present invention. It should be understood that the drawings and embodiments of the present invention are only for exemplary purposes and are not intended to limit the scope of protection of the present invention.

[0044] It should be understood that the various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.

[0045] The term "including" and its variations used in this document are open inclusions, that is, "including but not limited to"; the term "based on" means "based at least in part on"; the term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments"; the term "optionally" means "optional embodiments". The relevant definitions of other terms will be given in the following description. It should be noted that the concepts of "first", "second", etc. mentioned in the present invention are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0046] It should be noted that the modifications of "one" and "plurality" mentioned in the present invention are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0047] The names of the messages or information exchanged between multiple devices in the embodiments of the present invention are only used for illustrative purposes, and are not used to limit the scope of these messages or information.

[0048] In view of the problems existing in the above-mentioned related technologies, this embodiment provides a clock synchronization method, device, electronic device and storage medium.

[0049] like Figure 1 As shown, a clock synchronization method provided by an embodiment of the present invention is applied to a distributed redundant control system, wherein the distributed redundant control system includes a local rack and a remote rack, wherein the local rack includes a first local rack and a remote rack, and wherein the first local rack includes a first controller and a first communication forwarding module;

[0050] The clock synchronization method comprises:

[0051] S1. Perform periodic clock synchronization on the first controller using a first clock synchronization protocol.

[0052] Specifically, the structure of the distributed redundant control system is as follows: Figure 2As shown, the distributed redundant control system includes a first local rack and a remote rack, the local rack includes a first controller and a first communication forwarding module, and when synchronizing the distributed redundant control system, the clock synchronization server corresponding to the first clock synchronization protocol is first used as the clock source, and the first clock synchronization protocol is used to perform periodic clock synchronization on the first controller of the first local rack to improve the accuracy of the system. The first clock synchronization protocol can be selected according to actual conditions, for example, the Network Time Protocol (NTP), the Precision Time Protocol (PTP), the Simple Network Time Protocol (SNTP), the Timestamp Protocol, and the IEEE 1588 protocol, etc. For example, if the NTP (Network Time Protocol) protocol is adopted, the first controller is synchronized with the soft clock cycle through the clock synchronization server, and the NTP protocol can improve the compatibility of the clock synchronization server without additional hardware support, and its main function is to firstly grant time to the first controller, and the subsequent clock synchronization server does not directly participate in the internal clock synchronization of the distributed redundant control system, so the accuracy of the NTP protocol does not affect the accuracy of the clock synchronization inside the system.

[0053] S2: According to the first controller, a second clock synchronization protocol and a communication bus are used to perform clock synchronization on the first communication forwarding module.

[0054] Specifically, the synchronized first controller is used as the clock source, and the second clock synchronization protocol and the communication bus are used to synchronize the clock of the first communication forwarding module. By using a clock source different from the previous step and using the communication bus between the first controller and the first communication forwarding module, the error of network transmission can be reduced and the effect of clock synchronization can be improved. The communication bus includes I 2C (Inter-Intereg rated Circuit) bus, SPI (Serial Peripheral Interface) bus, CAN (Controller Area Network) bus, EtherCAT bus and FPGA's ECI bus, etc. The second clock synchronization protocol can be selected according to the actual situation, for example, Network Time Protocol (NTP), Precision Time Protocol (PTP), Simple Network Time Protocol (SNTP), Timestamp Protocol and IEEE1588 protocol, etc. Exemplarily, when the first controller and the first communication forwarding module use FPGA to communicate using the ECI bus, the FPGA includes a real-time clock component, and the second clock synchronization protocol can use the IEEE 1588 protocol. The IEEE1588 clock source of the first controller maintains the corresponding FPGA real-time clock of the first communication forwarding module, and the FPGA real-time clock component of the first communication forwarding module is maintained by the FPGA of the first controller through periodic broadcast clock synchronization messages, that is, PTP clock synchronization is achieved. Exemplarily, the fifth clock difference between the first controller and the first communication forwarding module is determined. When the fifth clock difference is greater than a fifth preset threshold, time synchronization is performed; when the fifth clock difference is less than or equal to the fifth preset threshold, time synchronization is not performed.

[0055] S3, performing clock synchronization on the remote rack through the first communication forwarding module and adopting a third clock synchronization protocol.

[0056] Specifically, by using the synchronized first communication forwarding module as the clock source, the third clock synchronization protocol is used to synchronize the clock of the remote rack. By using a clock source different from the previous step, the clock source of the distributed redundant control system is divided and isolated, which can reduce errors and improve the effect of clock synchronization. Among them, the third clock synchronization protocol can be selected according to actual conditions, for example, the Network Time Protocol (NTP), the Precision Time Protocol (PTP), the Simple Network Time Protocol (SNTP), the Timestamp Protocol and the IEEE 1588 protocol, etc. Exemplarily, if the local rack and the remote rack are connected by Ethernet, the soft clock of the first communication forwarding module is used as the clock source, and the third clock synchronization protocol uses the standard Ethernet IEEE1588 protocol to synchronize the clock of the remote rack. Since the clock synchronization is performed through Ethernet, the network fluctuation is small and the accuracy will not fluctuate greatly. By using the soft clock of the first communication forwarding module as the clock source, while ensuring that the system clock follows the controller for synchronization adjustment, the module jitter of the remote rack caused by clock synchronization jitter can be reduced, for example, the jitter of the input and output modules on the remote rack.

[0057] In this embodiment, first, the first clock synchronization protocol is used to perform periodic clock synchronization on the first controller. At this time, the clock source is the clock synchronization server corresponding to the first clock synchronization protocol. Then, the synchronized first controller is used as the clock source, and the second clock synchronization protocol and the communication bus are used to perform clock synchronization on the first communication forwarding module. Finally, the synchronized first communication forwarding module is used as the clock source, and the third clock synchronization protocol is used to perform clock synchronization on the remote rack. Since different clock sources are set at each step of time synchronization, that is, the clock source of the distributed redundant control system is divided and isolated, and the synchronization protocol used in each step is different, and the synchronization protocol of each step can be set according to actual conditions, and different clock synchronization methods are used to obtain a more flexible clock synchronization configuration method, which is convenient for coping with the complex structure of the distributed redundant control system, reducing errors, and improving the effect of clock synchronization. Clock synchronization through the communication bus can also reduce the additional equipment cost of clock synchronization, reduce delays and uncertainties in data processing and communication, and thus improve the effect of clock synchronization.

[0058] In this embodiment, if the NTP protocol is used to perform periodic clock synchronization on the first controller, the clock source at this time is the NTP clock synchronization server. After clock synchronization, the NTP protocol does not directly participate in the clock synchronization of the remaining components of the distributed redundant control system. The accuracy of the NTP protocol clock synchronization does not affect the synchronization accuracy of the remaining components, which is convenient for dealing with complex distributed redundant control systems, improving the compatibility of clock synchronization, and the NTP protocol does not require additional hardware support, and can also save clock synchronization costs. According to the first controller, if the IEEE1588 protocol and the ECI bus connected between the first controller and the first communication forwarding module are used to perform clock synchronization on the first communication forwarding module, the FPGA real-time clock component of the first communication forwarding module is maintained by the FPGA of the first controller for periodic broadcast clock synchronization messages, that is, PTP (Precision Time Protocol) clock synchronization is realized. At the same time, the ECI bus is used to obtain a higher clock synchronization accuracy without adding additional hardware. At this time, the clock source is the IEEE1588 clock source of the first controller. Through the first communication forwarding module, if the IEEE1588 protocol and Ethernet are used to perform clock synchronization on the remote rack, since the clock synchronization is performed through Ethernet, the network fluctuation is small and the accuracy will not fluctuate significantly. Using the soft clock of the first communication forwarding module as the clock source, while ensuring that the system clock follows the controller synchronization adjustment, the module jitter of the remote rack caused by clock synchronization jitter can be reduced. The clock source at this time is the clock of the first communication forwarding module. Since different clock sources are set at each step of time synchronization, the clock source of the distributed redundant control system is divided and isolated to obtain a more flexible clock synchronization configuration method to cope with the complex structure of the distributed redundant control system and improve the clock synchronization effect. At the same time, different clock synchronization configuration methods can also adopt low-cost solutions to save clock synchronization costs.

[0059] Alternatively, if Figure 3 As shown, the distributed redundant control system further includes a second local rack, the second local rack includes a second controller and a second communication forwarding module; after the first controller is synchronized with the periodic clock by using the first clock synchronization protocol, it also includes:

[0060] According to the first controller, adopting the second clock synchronization protocol to synchronize the clock of the second controller;

[0061] According to the second controller, the second clock synchronization protocol is adopted to perform clock synchronization on a second communication forwarding module corresponding to the second controller.

[0062] Specifically, the specific number of local racks and remote racks is determined according to actual conditions. This embodiment provides a first local rack, a second local rack and two remote racks, wherein the first local rack includes a first controller and a first communication forwarding module, and the second local rack includes a second controller and a second communication forwarding module. In order to improve the control capability of clock synchronization, the first controller can be used as the master controller and the second controller as the slave controller. If multiple second local racks are set, the second controller of each second local rack is used as a slave controller. After the first controller is synchronized with the periodic clock using the first clock synchronization protocol, the second controller is synchronized with the clock using the second clock synchronization protocol according to the first controller; the master clock is always based on the first controller, and the clock of the second controller is only hot standby. The highest precision solution is adopted to limit the system clock jump during switching, that is, when switching between the first controller and the second controller, in order to avoid sudden jumps in the system clock, the clock of the second controller is always in hot standby state and synchronized with the clock of the first controller. In this way, when the master controller fails, the slave controller can take over seamlessly without causing significant changes in the system clock, ensuring the smooth transition and continuous operation of the system. Then, according to the second controller, a second clock synchronization protocol is adopted to perform clock synchronization on the second communication forwarding module.

[0063] Exemplarily, standard Ethernet IEEE1588 precision clock synchronization can be achieved through two dedicated redundant fiber channels between the first controller and the second controller, that is, the second clock synchronization protocol adopts the IEEE1588 protocol, and the clock source is the first controller IEEE1588 clock source. The first controller adopts hardware-level IEEE1588 precision clock synchronization, and the first controller periodic point-to-point clock synchronization avoids the uncertainty caused by network broadcasting and reduces the impact of network delay and jitter. The synchronization link between the first controller and the second controller is shared with the redundant line, and the dedicated line prevents network jitter clock fluctuations. Exemplarily, the fourth clock difference between the first controller and the second controller is determined. When the fourth clock difference is greater than the fourth preset threshold, time synchronization is performed. When the fourth clock difference is less than or equal to the fourth preset threshold, time synchronization is not performed.

[0064] Exemplarily, when the second controller and the second communication forwarding module use FPGA to communicate using the ECI bus, the FPGA includes a real-time clock component, the second clock synchronization protocol can select the IEEE 1588 protocol, the IEEE1588 clock source of the second controller maintains the corresponding FPGA real-time clock of the second communication forwarding module, and the FPGA real-time clock component of the second communication forwarding module is maintained by the FPGA of the second controller through periodic broadcast clock synchronization messages, that is, PTP clock synchronization is achieved. Exemplarily, the sixth clock difference between the second controller and the second communication forwarding module is determined, and when the sixth clock difference is greater than the sixth preset threshold, time synchronization is performed, and when the sixth clock difference is less than or equal to the sixth preset threshold, time synchronization is not performed.

[0065] Alternatively, if Figure 3 As shown, the remote rack includes a third communication forwarding module, and the remote rack is synchronized with the clock by using the third clock synchronization protocol through the first communication forwarding module, including:

[0066] Acquire a first clock difference between the third communication forwarding module and the first communication forwarding module;

[0067] When the first clock difference is greater than a first preset threshold, the first communication forwarding module is used to perform clock synchronization on the third communication forwarding module using the third clock synchronization protocol.

[0068] Specifically, the first clock difference refers to the time interval between the third communication forwarding module and the first communication forwarding module. After obtaining the first clock difference, when the first clock difference is greater than the first preset threshold, the third communication forwarding module is clock synchronized by the first communication forwarding module using the third clock synchronization protocol; when the first clock difference is less than or equal to the first preset threshold, clock synchronization is not performed. Exemplarily, the first preset threshold can be set according to actual conditions and can be set to twice the fluctuation time. If the fluctuation time is 50ms, the first preset threshold is 100ms.

[0069] Alternatively, if Figure 3 As shown, the remote rack further includes an input and output module; after the clock synchronization of the third communication forwarding module is performed by the first communication forwarding module and the third clock synchronization protocol is adopted when the clock difference is greater than the first preset threshold, the remote rack further includes:

[0070] According to the third communication forwarding module, the third clock synchronization protocol and the communication bus are used to perform clock synchronization on the input-output module.

[0071] Specifically, the remote rack further includes at least one input-output module, and the input-output module is clock-synchronized by the third communication forwarding module of the remote rack using the third clock synchronization protocol and the communication bus. Preferably, the third clock synchronization protocol can use the IEEE1588 protocol, and the communication bus can use the ECI bus of the FPGA for clock synchronization. Exemplarily, the seventh clock difference between the input-output module and the third communication forwarding module of the corresponding remote rack is determined. When the seventh clock difference is greater than the seventh preset threshold, time synchronization is performed. When the seventh clock difference is less than or equal to the seventh preset threshold, time synchronization is not performed.

[0072] Optionally, the adopting a first clock synchronization protocol to perform periodic clock synchronization on the first controller includes:

[0073] Obtaining the synchronization times of the first controller;

[0074] When the synchronization number is zero, performing clock synchronization on the first controller using the first clock synchronization protocol;

[0075] When the synchronization times is not zero, the first controller is clock synchronized using the first clock synchronization protocol according to a preset synchronization frequency.

[0076] Specifically, when the first clock synchronization protocol is used to perform periodic clock synchronization on the first controller, the clock synchronization is performed immediately for the first time, that is, when the synchronization number is zero, the first clock synchronization protocol is used to synchronize the clock of the first controller, and then periodic clock synchronization is performed according to the preset synchronization frequency. The preset synchronization frequency can be set according to actual conditions, for example, synchronization is requested once every 5 minutes.

[0077] Alternatively, if Figure 3 As shown, the distributed redundant control system further includes a clock synchronization server, and the use of a first clock synchronization protocol to perform periodic clock synchronization on the first controller includes:

[0078] Obtaining a second clock difference between the clock synchronization server and the first controller;

[0079] When the second clock difference is greater than a second preset threshold, the first controller is periodically synchronized by the clock synchronization server using the first clock synchronization protocol.

[0080] Specifically, the second clock difference refers to the clock interval between the clock synchronization server and the first controller. When the second clock difference is greater than the second preset threshold, the first clock synchronization protocol is used to perform periodic clock synchronization on the first controller; when the second clock difference is less than or equal to the second preset threshold, periodic clock synchronization is not performed. Exemplarily, the second preset threshold can be set according to actual conditions and can be set to twice the fluctuation time. If the fluctuation time is 50ms, the second preset threshold is 100ms.

[0081] Optionally, the performing clock synchronization on the remote rack by using the first communication forwarding module and adopting a third clock synchronization protocol includes:

[0082] When the remote rack is associated with the first controller, a third clock difference between the remote rack and the first communication forwarding module is obtained; if the third clock difference is greater than a third preset threshold, the remote rack is clock synchronized by the first communication forwarding module using the third clock synchronization protocol;

[0083] When the remote rack is associated with the second controller, the clock of the remote rack is synchronized by using the third clock synchronization protocol through the first-second communication forwarding module.

[0084] Specifically, when there are a first local rack and a second local rack, when the remote rack is clock synchronized, first determine the association between the remote rack and the controller, that is, determine whether the remote rack is on the main controller side, under the premise that the first controller is the main controller: when the remote rack is associated with the first controller, it means that the remote rack is communicatively connected to the first local rack, that is, the first communication forwarding module connected to the remote rack is on the main controller side, then determine whether the third clock difference between the remote rack and the first communication forwarding module is greater than the third preset threshold, when it is greater than the third preset threshold, adopt the third clock synchronization protocol to synchronize the remote rack clock; when it is less than or equal to the third preset threshold, do not synchronize the clock; when the remote rack is associated with the second controller, it means that the remote rack is communicatively connected to the second local rack, that is, the second communication forwarding module connected to the remote rack is not on the main controller side, then directly use the third clock synchronization protocol through the first communication forwarding module of the first controller to synchronize the clock to ensure that the clock sources all come from the first controller. On the premise that the first controller is the main controller: it indicates that the first controller stops working. At this time, the remote rack is associated with the second controller to obtain the eighth clock difference between the remote rack and the second communication forwarding module; if the eighth clock difference is greater than the eighth preset threshold, the remote rack is synchronized with the clock through the second communication forwarding module using the third clock synchronization protocol.

[0085] Alternatively, if Figure 3As shown, the local rack further includes a coprocessor, after the first controller uses the second clock synchronization protocol and the communication bus to perform clock synchronization on the first communication forwarding module, and before the first communication forwarding module uses the third clock synchronization protocol to perform clock synchronization on the remote rack, it also includes:

[0086] According to the first communication forwarding module, the third clock synchronization protocol and the communication bus are used to synchronize the clock of the coprocessor.

[0087] Specifically, the local rack also includes a coprocessor, which needs to be clocked by the first communication forwarding module using a third clock synchronization protocol and a communication bus coprocessor. Preferably, the IEEE1588 protocol and the ECI bus can be used to synchronize the coprocessor's clock.

[0088] In the present invention, after simulation test, the clock error of each embodiment of the present invention is within 10ms. During normal operation, the system clock source of the two input and output modules of the system comes from the first communication forwarding module on the first local rack, and the relative time error is:

[0089]

[0090] Among them, ΔT(IO-IO) is the relative time error between the two input and output modules, and ΔTi is the relative time error of the i-th synchronization step.

[0091] During normal operation, the relative time error between the input and output module and the controller is:

[0092]

[0093] Among them, ΔT(GCU-IO) is the relative time between the input and output module and the controller. Even in the most extreme case of the distributed redundant control system switching moment, it can meet the high precision requirement of the clock synchronization error within the system less than about 0.2ms, and the accuracy between the more commonly used input and output modules is about 0.1ms, and the error is mainly determined by the accuracy of the clock synchronization steps corresponding to the input and output modules. If there are higher precision requirements in the future, only the clock synchronization steps corresponding to the input and output modules need to be improved. The system synchronization solution does not need to be replaced, which has higher maintainability and is convenient for system upgrades.

[0094] like Figure 4 As shown, a clock synchronization device 400 provided in an embodiment of the present invention includes:

[0095] A first synchronization module 410, configured to perform periodic clock synchronization on the first controller using a first clock synchronization protocol;

[0096] A second synchronization module 420, configured to perform clock synchronization on the first communication forwarding module according to the first controller using a second clock synchronization protocol and a communication bus;

[0097] The third synchronization module 430 is used to synchronize the clock of the remote rack by using the third clock synchronization protocol through the first communication forwarding module.

[0098] Optionally, the clock synchronization device 400 further includes a fourth synchronization module, and the fourth synchronization module is used to perform clock synchronization on the second controller according to the first controller using the second clock synchronization protocol;

[0099] According to the second controller, the second clock synchronization protocol is adopted to perform clock synchronization on a second communication forwarding module corresponding to the second controller.

[0100] Optionally, the third synchronization module 430 is specifically used to: obtain a first clock difference between the third communication forwarding module and the first communication forwarding module;

[0101] When the first clock difference is greater than a first preset threshold, the first communication forwarding module is used to perform clock synchronization on the third communication forwarding module using the third clock synchronization protocol.

[0102] Optionally, the clock synchronization device 400 further includes a fifth synchronization module, and the fifth synchronization module is used to: perform clock synchronization on the input-output module according to the third communication forwarding module, using the third clock synchronization protocol and the communication bus.

[0103] Optionally, the first synchronization module 410 is specifically used to: obtain the synchronization times of the first controller;

[0104] When the synchronization number is zero, performing clock synchronization on the first controller using the first clock synchronization protocol;

[0105] When the synchronization times is not zero, the first controller is clock synchronized using the first clock synchronization protocol according to a preset synchronization frequency.

[0106] Optionally, the first synchronization module 410 is specifically used to obtain a second clock difference between the clock synchronization server and the first controller;

[0107] When the second clock difference is greater than a second preset threshold, the first controller is periodically synchronized by the clock synchronization server using the first clock synchronization protocol.

[0108] Optionally, the third synchronization module 430 is specifically used to obtain a third clock difference between the remote rack and the first communication forwarding module when the remote rack is associated with the first controller; if the third clock difference is greater than a third preset threshold, the remote rack is synchronized by using the third clock synchronization protocol through the first communication forwarding module;

[0109] When the remote rack is associated with the second controller, the clock of the remote rack is synchronized by using the third clock synchronization protocol through the first-second communication forwarding module.

[0110] Optionally, the clock synchronization device 400 further includes a sixth synchronization module, and the sixth synchronization module is used to perform clock synchronization on the coprocessor according to the first communication forwarding module, using the third clock synchronization protocol and the communication bus.

[0111] like Figure 5 As shown, an electronic device 500 provided by an embodiment of the present invention includes a memory 510 and a processor 520; the memory 510 is used to store a computer program; the processor 520 is used to implement the clock synchronization method as described above when executing the computer program.

[0112] In other words, an electronic device 500 includes a memory 510 and a processor 520 coupled to the memory 510; the memory 510 is configured to store a computer program; and the processor 520 is configured to perform the following operations when executing the computer program:

[0113] Applied to a distributed redundant control system, the distributed redundant control system comprises a first local rack and a remote rack, the first local rack comprises a first controller and a first communication forwarding module;

[0114] The clock synchronization method comprises:

[0115] Performing periodic clock synchronization on the first controller using a first clock synchronization protocol;

[0116] According to the first controller, using a second clock synchronization protocol and a communication bus, clock synchronization is performed on the first communication forwarding module;

[0117] The remote rack is clock synchronized by using the first communication forwarding module and a third clock synchronization protocol.

[0118] An embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the clock synchronization method as described above is implemented.

[0119] In other words, a non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor performs the following operations:

[0120] Applied to a distributed redundant control system, the distributed redundant control system comprises a first local rack and a remote rack, the first local rack comprises a first controller and a first communication forwarding module;

[0121] The clock synchronization method comprises:

[0122] Performing periodic clock synchronization on the first controller using a first clock synchronization protocol;

[0123] According to the first controller, using a second clock synchronization protocol and a communication bus, clock synchronization is performed on the first communication forwarding module;

[0124] The remote rack is clock synchronized by using the first communication forwarding module and a third clock synchronization protocol.

[0125] An electronic device 500 that can be used as a server or client of the present invention will now be described, which is an example of a hardware device that can be applied to various aspects of the present invention. The electronic device 500 is intended to represent various forms of digital electronic computer equipment, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device 500 can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples, and are not intended to limit the implementation of the present invention described and / or required herein.

[0126] The electronic device 500 includes a computing unit, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) or a computer program loaded from a storage unit into a random access memory (RAM). In the RAM, various programs and data required for the operation of the device can also be stored. The computing unit, ROM, and RAM are connected to each other via a bus. An input / output (I / O) interface is also connected to the bus.

[0127] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc. In the present application, the unit described as a separate component may or may not be physically separated, and the component displayed as a unit may or may not be a physical unit, that is, it may be located in one place, or it may be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment of the present invention. In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

[0128] Although the present invention is disclosed as above, the protection scope of the present invention is not limited thereto. Those skilled in the art may make various changes and modifications without departing from the spirit and scope of the present invention, and these changes and modifications will fall within the protection scope of the present invention.

Claims

1. A clock synchronization method, characterized in that: Applied to a distributed redundant control system, the distributed redundant control system comprises a first local rack and a remote rack, the first local rack comprises a first controller and a first communication forwarding module; The clock synchronization method comprises: Performing periodic clock synchronization on the first controller using a first clock synchronization protocol; According to the first controller, using a second clock synchronization protocol and a communication bus, clock synchronization is performed on the first communication forwarding module; The remote rack is clock synchronized by using the first communication forwarding module and a third clock synchronization protocol.

2. The clock synchronization method according to claim 1, characterized in that: The distributed redundant control system further comprises a second local rack, wherein the second local rack comprises a second controller and a second communication forwarding module; After the first controller is synchronized with the first clock synchronization protocol, the method further includes: According to the first controller, using the second clock synchronization protocol to synchronize the clock of the second controller; According to the second controller, the second clock synchronization protocol is adopted to perform clock synchronization on a second communication forwarding module corresponding to the second controller.

3. The clock synchronization method according to claim 1, characterized in that: The remote rack includes a third communication forwarding module; The step of performing clock synchronization on the remote rack by using the first communication forwarding module and adopting a third clock synchronization protocol includes: Obtaining a first clock difference between the third communication forwarding module and the first communication forwarding module; When the first clock difference is greater than a first preset threshold, the first communication forwarding module is used to perform clock synchronization on the third communication forwarding module using the third clock synchronization protocol.

4. The clock synchronization method according to claim 3, characterized in that: The remote rack further includes an input and output module; after performing clock synchronization on the third communication forwarding module by using the third clock synchronization protocol through the first communication forwarding module when the clock difference is greater than the first preset threshold, the remote rack further includes: According to the third communication forwarding module, the third clock synchronization protocol and the communication bus are used to perform clock synchronization on the input and output modules.

5. The clock synchronization method according to claim 1, characterized in that: The adopting a first clock synchronization protocol to perform periodic clock synchronization on the first controller includes: Obtaining the synchronization times of the first controller; When the synchronization number is zero, performing clock synchronization on the first controller using the first clock synchronization protocol; When the synchronization times is not zero, the first controller is clock synchronized using the first clock synchronization protocol according to a preset synchronization frequency.

6. The clock synchronization method according to claim 1, characterized in that: The distributed redundant control system further includes a clock synchronization server, and the first controller is synchronized with a periodic clock using a first clock synchronization protocol, including: Obtaining a second clock difference between the clock synchronization server and the first controller; When the second clock difference is greater than a second preset threshold, the first controller is periodically synchronized by the clock synchronization server using the first clock synchronization protocol.

7. The clock synchronization method according to claim 2, characterized in that: The step of performing clock synchronization on the remote rack by using the first communication forwarding module and adopting a third clock synchronization protocol includes: When the remote rack is associated with the first controller, a third clock difference between the remote rack and the first communication forwarding module is obtained; if the third clock difference is greater than a third preset threshold, the remote rack is clock synchronized by the first communication forwarding module using the third clock synchronization protocol; When the remote rack is associated with the second controller, the clock of the remote rack is synchronized by using the third clock synchronization protocol through the first-second communication forwarding module.

8. A clock synchronization device, characterized in that: include: A first synchronization module, configured to perform periodic clock synchronization on the first controller using a first clock synchronization protocol; A second synchronization module, configured to perform clock synchronization on the first communication forwarding module according to the first controller using a second clock synchronization protocol and a communication bus; The third synchronization module is used to synchronize the clock of the remote rack by using the third clock synchronization protocol through the first communication forwarding module.

9. An electronic device, characterized in that: including memory and processor; The memory is used to store computer programs; The processor is used to implement the clock synchronization method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the clock synchronization method according to any one of claims 1 to 7 is implemented.