A clock synchronization method and system

By designing a clock synchronization system in an industrial network, using the clock modules between the master, secondary and slave devices to synchronize in series, the network chaos and data communication blind spots caused by the failure of the master clock device are solved, and the stability of the network clock is achieved and reliability avoid overall failure of the control system and bandwidth waste.

CN115102658BActive Publication Date: 2024-11-19CHINA RAILWAY ENGINEERING EQUIPMENT GROUP CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210846433.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-19
Publication Date
2024-11-19
Estimated Expiration
2042-07-19

AI Technical Summary

Technical Problem

When the main clock device fails or is offline in the existing industrial network, the clock synchronization method leads to network chaos, scheduling abnormalities and control system failure, and there are problems such as data communication blind spots and bandwidth waste.

Method used

Design a clock synchronization system, including a master device, a secondary master device and a slave device, each device is equipped with a master clock synchronization module and at least two slave clock synchronization modules. Through series synchronization between the clock synchronization modules, ensure that the main When the clock device fails, the secondary master and slave devices can obtain clock information from other clock modules to maintain the stability of the global network clock and avoid data communication blind spots and bandwidth waste.

Benefits of technology

The network clock is switched at zero delay, avoiding scheduling chaos caused by the failure of the main clock device and failure of the control system, ensuring the certainty and high reliability of data communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115102658B_ABST
    Figure CN115102658B_ABST
Patent Text Reader

Abstract

The present invention proposes a clock synchronization method and system to solve the technical problem that the existing clock synchronization method cannot meet the network's requirements for clock stability and reliability. The clock synchronization system of the present invention includes a master device, a sub-master device and a slave device. The master device, the sub-master device and the slave device are all provided with a master clock synchronization module and a port. The port is provided with at least two slave clock synchronization modules. The master clock synchronization module cooperates with the slave clock synchronization module, and the slave clock synchronization modules cooperate with each other. The present invention realizes clock series synchronization in the network by performing clock synchronization between each device and the master clock synchronization module of the previous device. When the master clock device fails or is disconnected, the device is still synchronized with the master clock synchronization module of the previous device to ensure that there is no blind spot in the network, and realizes zero-delay switching of the network clock, solving the scheduling chaos caused by the failure or offline of the master clock device in the existing industrial network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of clock synchronization, and in particular to a clock synchronization method and system. Background Art

[0002] Ethernet has been further applied to industrial sites due to its openness, wide application and low price. Clock synchronization technology, as the basis of data scheduling technology, is gaining more and more attention, and a stable clock can effectively improve the overall stability of the industrial network. However, in existing industrial networks, there is often only one master clock device or a backup master clock is used. When the device encounters a failure or attack, the network will lose the master clock device, which often leads to network chaos or scheduling anomalies due to the loss of the master clock device or the switching between the master and backup clocks, and ultimately leads to the overall failure of the control system.

[0003] It can be seen that the limitations and defects of existing clock synchronization methods cannot meet the network's requirements for clock stability and reliability.

[0004] The invention patent application with application number 2022100828825 discloses a clock synchronization optimization method based on the EPA bus structure, including: using the master clock of the master device as the synchronization reference for clock synchronization; the master device sends a periodic message containing the master clock to each slave device; the slave device obtains the master clock according to the received periodic message, and returns a synchronization request message to the master device; the master device responds to the received synchronization request message and sends a synchronization response message to the corresponding slave device; the slave device obtains the line delay between the slave device and the master device according to the received synchronization response message, and detects whether the connection link between the slave device and the master device has changed when the slave device is in the communication stage: if the connection link has not changed, the local clock of the slave device is updated according to the line delay; if the connection link has changed, repeat the above steps to update the line delay. When the network master clock is offline, the network will have a short blind spot, and the clock synchronization needs to be re-performed, resulting in uncontrollable data communication. Summary of the invention

[0005] In view of the technical problem that the existing clock synchronization method cannot meet the network's requirements for clock stability and reliability, the present invention proposes a clock synchronization method and system to solve the scheduling chaos caused by the failure or offline of the main clock device in the existing industrial network, and avoid the overall failure of the control system; it can avoid the data communication blind area that occurs when the link is disconnected, realize the intensive transmission of large amounts of data, and avoid the problem of bandwidth waste.

[0006] In order to achieve the above-mentioned purpose, the technical solution of the present invention is implemented as follows: a clock synchronization system includes a master device, a sub-master device and a slave device, the master device, the sub-master device and the slave device are all provided with a master clock synchronization module and a port, and at least two slave clock synchronization modules are provided on the port, the master clock synchronization module and the slave clock synchronization module cooperate with each other, and the slave clock synchronization modules cooperate with each other.

[0007] Preferably, each port is provided with two slave clock synchronization modules, and the two slave clock synchronization modules are respectively a slave clock synchronization module I and a slave clock synchronization module II.

[0008] Preferably, the master clock synchronization module generates clock information, and the master clock synchronization module is synchronized with the slave clock synchronization module based on a clock synchronization mechanism.

[0009] A synchronization method for a clock synchronization system, the steps of which are as follows:

[0010] Step 1: Power on and run. Determine the master and secondary master devices in the network through pre-power-on configuration or competition. All other devices are slave devices.

[0011] Step 2: The master device periodically sends a clock synchronization message or a clock synchronization trigger message to start the clock synchronization process; after receiving the clock synchronization message or the clock synchronization trigger message, the secondary master device and the slave device in the network start a slave clock synchronization module of the port and complete the clock synchronization with the master device through the clock synchronization protocol;

[0012] Step 3: The master clock synchronization module of the secondary master device periodically sends a clock synchronization message or a clock synchronization trigger message to start the secondary master clock synchronization process. After the slave device in the network receives the clock synchronization message or the clock synchronization trigger message sent by the secondary master device, a slave clock synchronization module of the start port completes the clock synchronization with the secondary master device through the clock synchronization protocol.

[0013] Preferably, the competition in step 1 is implemented based on the size of the device logical address.

[0014] Preferably, after the secondary master device and the slave device in step 2 receive the clock synchronization message or the clock synchronization trigger message sent by the master device, they simultaneously start a slave clock synchronization module on the port, recorded as slave clock synchronization module I, and the slave clock synchronization module I completes the clock synchronization with the master device through 1588 and related optimized clock synchronization protocols.

[0015] Preferably, after the secondary master device completes the clock synchronization with the master device, the slave clock synchronization module I synchronizes the clock information to its own master clock module by directly assigning values.

[0016] Preferably, in the secondary master clock synchronization process, the message sending time point of the secondary master device is at the midpoint of the message sending cycle of the master device; after the slave device in the network receives the message, it simultaneously starts a slave clock synchronization module of the port, recorded as slave clock synchronization module II, and the slave clock synchronization module II completes the clock synchronization with the secondary master device through the clock synchronization protocol.

[0017] Preferably, when the slave device periodically completes the clock synchronization with the master device, the master clock synchronization module of the master device is synchronized with the slave clock synchronization module I of the slave device, and the slave device will synchronize the clock information of the slave clock synchronization module I to its own slave clock synchronization module II; similarly, when the slave device periodically completes the clock synchronization with the secondary master device, the master clock synchronization module of the secondary master device is synchronized with the slave clock synchronization module II of the slave device, and the clock information of the slave clock synchronization module II will also be synchronized to its own slave clock synchronization module I.

[0018] Preferably, when a master device fails, the secondary master device in the network and the slave clock synchronization module I in the slave device lose the master clock information, but can still obtain clock information from the slave clock synchronization module II; the clock synchronization between the slave clock synchronization module II of the slave device and the master clock synchronization module of the secondary master device can still maintain the entire network system in a global clock stable state; at this time, the secondary master device is upgraded to the master device, and the slave clock synchronization module II of the slave device is also upgraded to the slave clock synchronization module I.

[0019] When the secondary master device fails, the slave clock synchronization module II of the slave device loses the master clock information, but can still obtain clock information from the slave clock synchronization module I; the slave clock synchronization module I of the slave device can still normally receive the master clock information sent by the master device, and the entire network system is still in a global clock stable state; when the secondary master device fails, a new secondary master device is online through pre-configuration or competition, and the master clock synchronization module of the secondary master device completes the clock synchronization process with the slave clock synchronization modules II of other slave devices by sending clock synchronization messages or clock synchronization trigger messages.

[0020] Beneficial effects of the present invention: The present invention realizes clock series synchronization in the network by synchronizing the clock of each device with the master clock synchronization module of the previous device. When the master clock device fails or is disconnected, the device is still synchronized with the master clock synchronization module of the previous device to ensure that there are no blind spots in the network, and achieves zero-delay switching of the network clock, thereby solving the scheduling chaos caused by the failure or offline of the master clock device in the existing industrial network, avoiding control deviation or data packet loss caused by data errors in the control system, and avoiding the overall failure of the control system. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0022] Figure 1 It is a structural schematic diagram of the present invention.

[0023] Figure 2 It is a schematic diagram of the topological structure of the present invention. DETAILED DESCRIPTION

[0024] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0025] Embodiment 1, as Figure 1 As shown, a clock synchronization system includes a master device, a sub-master device and a slave device, wherein the master device, the sub-master device and the slave device are all provided with a master clock synchronization module and a port, and the port is provided with at least two slave clock synchronization modules, and the master clock synchronization module cooperates with the slave clock synchronization module. The two slave clock synchronization modules cooperate with each other, and the modules are written by the internal code of the device and are internally connected.

[0026] The system is adaptable to different topologies. Each device contains a master clock synchronization module and two slave clock synchronization modules for each port.

[0027] The role of the master device, the sub-master device, and the slave device is to achieve data deterministic communication based on network synchronization. The role of the port is to connect to the network. Two ports need to be set for the ring network. The master clock synchronization module generates clock information, and the slave clock synchronization module synchronizes with the master clock synchronization module. Based on the clock synchronization mechanism, including but not limited to the 1588 protocol, and the optimized 1588 protocol, the communication or clock synchronization of the master clock synchronization module and the slave clock synchronization module is realized.

[0028] Embodiment 2, a clock synchronization method, the steps of which are as follows:

[0029] Step 1: When powered on, the master and secondary master devices in the network are determined through pre-power-on configuration or competition, and all other devices are slave devices.

[0030] Competition is implemented based on the size of the device logical address.

[0031] Step 2: The master device periodically sends a clock synchronization message or a clock synchronization trigger message to start the clock synchronization process. After the secondary master device and the slave device in the network receive the clock synchronization message or the clock synchronization trigger message, they start a slave clock synchronization module of the port and complete the clock synchronization with the master device through the clock synchronization protocol.

[0032] After the master and slave devices are determined in the network, the master device periodically sends a clock synchronization message or a clock synchronization trigger message to start the clock synchronization process. After the secondary master device and the slave device in the network receive the above message, they simultaneously start a slave clock synchronization module on the port, which is recorded as slave clock synchronization module I. The slave clock synchronization module I completes the clock synchronization with the master device through the clock synchronization protocol. For specific methods, please refer to 1588 and related optimized clock synchronization protocols.

[0033] Step 3: The master clock synchronization module of the secondary master device periodically sends a clock synchronization message or a clock synchronization trigger message to start the secondary master clock synchronization process. After the slave device in the network receives the clock synchronization message or the clock synchronization trigger message sent by the secondary master device, a slave clock synchronization module of the start port completes the clock synchronization with the secondary master device through the clock synchronization protocol.

[0034] After the secondary master device completes the clock synchronization with the primary device, it synchronizes the clock information of the slave clock synchronization module I to its own primary clock module, which is achieved by direct assignment inside the device.

[0035] The secondary master device periodically sends clock synchronization messages or clock synchronization trigger messages, which can be customized by the user or in accordance with relevant standards. The secondary master clock synchronization process is started, but the message sending time point is at the midpoint of the message sending cycle of the master device. After receiving the above message, the slave device in the network simultaneously starts a slave clock synchronization module of the port, which is recorded as slave clock synchronization module II, and completes the clock synchronization with the secondary master device through the clock synchronization protocol.

[0036] After the network completes clock synchronization, the slave clock synchronization module I of the secondary master device and the slave device in the network are synchronized with the master clock synchronization module of the master device; the master clock synchronization module of the secondary master device is synchronized with the clock synchronization module II of the slave device; the slave clock synchronization module II of the slave device is synchronized with the master clock synchronization module of the secondary master device, thereby forming a clock synchronization chain, thereby achieving clock synchronization of the entire network.

[0037] At this time, when the slave device periodically completes the clock synchronization with the master device, the master clock synchronization module of the master device is synchronized with the slave clock synchronization module I of the slave device, and the slave device will synchronize the clock information of the slave clock synchronization module I to its own slave clock synchronization module II; similarly, when the slave device periodically completes the clock synchronization with the secondary master device, the master clock synchronization module of the secondary master device is synchronized with the slave clock synchronization module II of the slave device, and the clock information of the slave clock synchronization module II will also be synchronized to its own slave clock synchronization module I.

[0038] When the master device fails, the secondary master device in the network and the slave clock synchronization module I in the slave device lose the master clock information, but can still obtain clock information from the slave clock synchronization module II; the clock synchronization between the slave clock synchronization module II of the slave device and the master clock synchronization module of the secondary master device can still maintain the entire network system in a global clock stable state; at this time, the secondary master device is upgraded to the master device, and the slave clock synchronization module II of the slave device is also upgraded to the slave clock synchronization module I.

[0039] When a secondary master device fails, the slave clock synchronization module II of the slave device loses the master clock information, but can still obtain clock information from the slave clock synchronization module I; the slave clock synchronization module I of the slave device can still normally receive the master clock information sent by the master device, and the entire network system is still in a global clock stable state. When the above situation occurs, a new secondary master device is online through pre-configuration or competition, and the master clock synchronization module of the secondary master device completes the clock synchronization process with the slave clock synchronization module II of other slave devices by sending clock synchronization messages or clock synchronization trigger messages.

[0040] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A clock synchronization system, characterized in that: It includes a master device, a sub-master device and a slave device, each of which is provided with a master clock synchronization module and a port, and at least two slave clock synchronization modules are provided on the port, the master clock synchronization module cooperates with the slave clock synchronization module, and the slave clock synchronization modules cooperate with each other; The steps of its clock synchronization method are as follows: Step 1: Power on and run. Determine the master and secondary master devices in the network through pre-power-on configuration or competition. All other devices are slave devices. Step 2: The master device periodically sends a clock synchronization message or a clock synchronization trigger message to start the clock synchronization process; After receiving the clock synchronization message or the clock synchronization trigger message, the secondary master device and the slave device in the network start a slave clock synchronization module of the port and complete the clock synchronization with the master device through the clock synchronization protocol; Step 3: The master clock synchronization module of the secondary master device periodically sends a clock synchronization message or a clock synchronization trigger message to start the secondary master clock synchronization process. After the slave device in the network receives the clock synchronization message or the clock synchronization trigger message sent by the secondary master device, a slave clock synchronization module of the start port completes the clock synchronization with the secondary master device through the clock synchronization protocol; Each port is provided with two slave clock synchronization modules, the two slave clock synchronization modules are slave clock synchronization module I and slave clock synchronization module II respectively; When the slave device periodically completes the clock synchronization with the master device, the master clock synchronization module of the master device is synchronized with the slave clock synchronization module I of the slave device, and the slave device will synchronize the clock information of the slave clock synchronization module I to its own slave clock synchronization module II; similarly, when the slave device periodically completes the clock synchronization with the secondary master device, the master clock synchronization module of the secondary master device is synchronized with the slave clock synchronization module II of the slave device, and the clock information of the slave clock synchronization module II will also be synchronized to its own slave clock synchronization module I.

2. The clock synchronization system according to claim 1, characterized in that: The master clock synchronization module generates clock information, and the master clock synchronization module is synchronized with the slave clock synchronization module based on a clock synchronization mechanism.

3. The clock synchronization system according to claim 1, characterized in that: The competition in step 1 is implemented based on the size of the device logical address.

4. The clock synchronization system according to claim 1, characterized in that: After the secondary master device and the slave device in step 2 receive the clock synchronization message or clock synchronization trigger message sent by the master device, they simultaneously start a slave clock synchronization module on the port, recorded as slave clock synchronization module I, and slave clock synchronization module I completes clock synchronization with the master device through the 1588 optimized clock synchronization protocol.

5. The clock synchronization system according to any one of claims 2 to 4, characterized in that: After the secondary master device completes the clock synchronization with the master device, the slave clock synchronization module 1 synchronizes the clock information to its own master clock module by direct assignment.

6. The clock synchronization system according to claim 5, characterized in that: In the secondary master clock synchronization process, the message sending time point of the secondary master device is at the midpoint of the message sending cycle of the master device; after the slave device in the network receives the message, it simultaneously starts a slave clock synchronization module of the port, recorded as slave clock synchronization module II, and the slave clock synchronization module II completes the clock synchronization with the secondary master device through the clock synchronization protocol.

7. The clock synchronization system according to claim 6, characterized in that: When the master device fails, the secondary master device in the network and the slave clock synchronization module I in the slave device lose the master clock information, but can still obtain clock information from the slave clock synchronization module II; The clock synchronization between the slave clock synchronization module II of the slave device and the master clock synchronization module of the secondary master device can still maintain the entire network system in a global clock stable state; at this time, the secondary master device is upgraded to the master device, and the slave clock synchronization module II of the slave device is also upgraded to the slave clock synchronization module I.

8. The clock synchronization system according to claim 5, characterized in that: When the master device fails, when the secondary master device fails, the slave clock synchronization module II of the slave device loses the master clock information, but can still obtain the clock information from the slave clock synchronization module I; The slave clock synchronization module 1 of the slave device can still normally receive the master clock information sent by the master device, and the entire network system is still in a global clock stable state; When a secondary master device fails, a new secondary master device is online through pre-configuration or competition. The master clock synchronization module of the secondary master device completes the clock synchronization process with the slave clock synchronization module II of other slave devices by sending clock synchronization messages or clock synchronization trigger messages.