Clock synchronization method and device, computer equipment and storage medium

By sending uplink feedback messages to the master clock in the PON network to determine the waiting time and using this time in the slave clock for clock synchronization, the clock synchronization problem caused by waiting time during the transmission of uplink data in the PON network is solved, ensuring industrial Processing accuracy.

CN119094076APending Publication Date: 2024-12-06CHINA TELECOM CORP LTD TECHNOLOGY INNOVATION CENTER +1
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

There is a waiting time in the PON network during transmission of uplink data, which makes it impossible to accurately realize clock synchronization between the master clock and the slave clock, affecting the accuracy of industrial processing.

Method used

By sending at least one uplink feedback message to the master clock when the current time reaches the initial uplink time, the master clock determines the waiting time based on the received uplink feedback message, and sends the waiting time and the uplink end time to the slave clock. The clock is clocked with the main clock according to the waiting time, the initial uplink time and the end of uplink.

Benefits of technology

The clock synchronization operation of the master clock and slave clock is accurately realized to prevent industrial processing accuracy from being affected.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119094076A_ABST
    Figure CN119094076A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of industrial control services, in particular to a clock synchronization method and device, computer equipment and a storage medium. The method comprises the following steps: when current time reaches uplink initial time, sequentially sending at least one uplink feedback message to a master clock; receiving waiting duration and uplink end time sent by the master clock; wherein the waiting duration is determined by the master clock according to the received uplink feedback message; and performing clock synchronization with the master clock according to the waiting duration, the uplink initial time and the uplink end time. The clock synchronization operation of the master clock and the slave clock is accurately realized, and the subsequent industrial processing precision is prevented from being influenced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of industrial control business technology, and in particular to a clock synchronization method, device, computer equipment and storage medium. Background Art

[0002] As the industrial manufacturing industry continues to upgrade, manufacturing equipment is evolving towards higher precision and higher execution efficiency. For example, in the CNC machine tool industry, the control involves multi-axis synchronous linkage, with a fast refresh rate. The synchronization accuracy and jitter index of each axis directly affect the processing accuracy; therefore, the synchronization accuracy of industrial communications directly affects the control accuracy and execution efficiency.

[0003] PON (Passive Optical Network) transmits data through optical fiber. Due to its high bandwidth, long-distance transmission capability and good anti-interference characteristics, it is very suitable for industrial environments that require high reliability and real-time performance. However, due to the waiting time in the process of transmitting uplink data in the PON network, it is impossible to accurately achieve clock synchronization between the master clock and the slave clock, affecting the accuracy of industrial processing. Summary of the invention

[0004] Based on this, it is necessary to provide a clock synchronization method, device, computer equipment and storage medium that can accurately implement clock synchronization operations of a master clock and a slave clock in order to solve the above technical problems.

[0005] In a first aspect, the present application provides a clock synchronization method, applied to a slave clock, the method comprising:

[0006] When the current time reaches the uplink initial time, at least one uplink feedback message is sent to the master clock in sequence;

[0007] Receive the waiting time and uplink end time sent by the master clock; wherein the waiting time is determined by the master clock according to the received uplink feedback message;

[0008] Clock synchronization is performed with the master clock according to the waiting time, the uplink initial time and the uplink end time.

[0009] In one of the embodiments, the sending at least one uplink feedback message to the master clock in sequence includes:

[0010] Based on a preset unit time interval, at least one uplink feedback message is sent to the master clock in sequence, so that the master clock determines the waiting time according to the unit time interval and the number of received uplink feedback messages.

[0011] In one embodiment, performing clock synchronization with the master clock according to the waiting time, the uplink initial time and the uplink end time includes:

[0012] Get the downlink initial time and downlink end time;

[0013] Clock synchronization for the master clock is performed according to the waiting time, the uplink initial time, the uplink end time, the downlink initial time and the downlink end time.

[0014] In one embodiment, performing clock synchronization for the master clock according to the waiting time, the uplink initial time, the uplink end time, the downlink initial time, and the downlink end time includes:

[0015] Determine a first time difference between the uplink end time and the uplink initial time, and a second time difference between the downlink end time and the downlink initial time;

[0016] Performing a sum operation on the first time difference and the second time difference to obtain a sum operation result;

[0017] Taking half of the sum of the sum operation result and the waiting time as the forwarding delay;

[0018] Using the difference between the second time difference and the forwarding delay as the compensation deviation value corresponding to the forwarding delay;

[0019] Clock synchronization for the master clock is performed according to the forwarding delay and the compensation offset value.

[0020] In a second aspect, the present application provides a clock synchronization method, which is applied to a master clock, and the method includes:

[0021] Determine the waiting time according to at least one received uplink feedback message; the uplink feedback message is sent after the slave clock reaches the uplink initial time at the current time;

[0022] The waiting time and the uplink end time are sent to the slave clock, so that the slave clock is synchronized with the master clock according to the waiting time, the uplink initial time and the uplink end time.

[0023] In one of the embodiments, determining the waiting time according to at least one received uplink feedback message includes:

[0024] Determine a unit time interval between two consecutive uplink feedback messages received;

[0025] The unit time interval and the number of received uplink feedback messages are multiplied to obtain the waiting time.

[0026] In a third aspect, the present application further provides a clock synchronization device, configured on a slave clock, the device comprising:

[0027] A sending module, used to send at least one uplink feedback message to the master clock in sequence when the current time reaches the uplink initial time;

[0028] A receiving module, used to receive the waiting time and the uplink end time sent by the master clock; wherein the waiting time is determined by the master clock according to the received uplink feedback message;

[0029] The first synchronization module is used to perform clock synchronization with the master clock according to the waiting time, the uplink initial time and the uplink end time.

[0030] In a fourth aspect, the present application further provides a clock synchronization device, configured on a master clock, the device comprising:

[0031] A determination module, configured to determine the waiting time according to at least one received uplink feedback message; the uplink feedback message is sent from the clock after the current time reaches the uplink initial time;

[0032] The second synchronization module is used to send the waiting time and the uplink end time to the slave clock, so that the slave clock is synchronized with the master clock according to the waiting time, the uplink initial time and the uplink end time.

[0033] In a fifth aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

[0034] When the current time reaches the uplink initial time, at least one uplink feedback message is sent to the master clock in sequence;

[0035] Receive the waiting time and uplink end time sent by the master clock; wherein the waiting time is determined by the master clock according to the received uplink feedback message;

[0036] Clock synchronization is performed with the master clock according to the waiting time, the uplink initial time and the uplink end time.

[0037] In a sixth aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

[0038] Determine the waiting time according to at least one received uplink feedback message; the uplink feedback message is sent after the slave clock reaches the uplink initial time at the current time;

[0039] The waiting time and the uplink end time are sent to the slave clock, so that the slave clock is synchronized with the master clock according to the waiting time, the uplink initial time and the uplink end time.

[0040] In a seventh aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0041] When the current time reaches the uplink initial time, at least one uplink feedback message is sent to the master clock in sequence;

[0042] Receive the waiting time and uplink end time sent by the master clock; wherein the waiting time is determined by the master clock according to the received uplink feedback message;

[0043] Clock synchronization is performed with the master clock according to the waiting time, the uplink initial time and the uplink end time.

[0044] In an eighth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0045] Determine the waiting time according to at least one received uplink feedback message; the uplink feedback message is sent after the slave clock reaches the uplink initial time at the current time;

[0046] The waiting time and the uplink end time are sent to the slave clock, so that the slave clock is synchronized with the master clock according to the waiting time, the uplink initial time and the uplink end time.

[0047] In a ninth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0048] When the current time reaches the uplink initial time, at least one uplink feedback message is sent to the master clock in sequence;

[0049] Receive the waiting time and uplink end time sent by the master clock; wherein the waiting time is determined by the master clock according to the received uplink feedback message;

[0050] Clock synchronization is performed with the master clock according to the waiting time, the uplink initial time and the uplink end time.

[0051] In a tenth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0052] Determine the waiting time according to at least one received uplink feedback message; the uplink feedback message is sent after the slave clock reaches the uplink initial time at the current time;

[0053] The waiting time and the uplink end time are sent to the slave clock, so that the slave clock is synchronized with the master clock according to the waiting time, the uplink initial time and the uplink end time.

[0054] The above-mentioned clock synchronization method, device, computer equipment and storage medium, when the current time reaches the uplink initial time, the slave clock sends at least one uplink feedback message to the master clock in sequence, so that the master clock determines the waiting time according to the at least one uplink feedback message received, and sends the waiting time and the uplink end time to the slave clock. Then, the slave clock synchronizes with the master clock according to the waiting time, the uplink initial time and the uplink end time. According to the above content, it can be known that in the process of clock synchronization between the master clock and the slave clock, the present application will not only refer to the uplink initial time and the uplink end time to realize the clock synchronization between the slave clock and the master clock, but also send at least one uplink feedback message to the master clock, so that the master clock determines the waiting time according to the received uplink feedback message, and the slave clock will receive the waiting time and the uplink end time sent by the master clock, thereby realizing that in the subsequent clock synchronization between the slave clock and the master clock, it not only relies on the uplink initial time and the uplink end time, but also takes into account the waiting time of the PON network in the process of transmitting uplink data. Therefore, the present application accurately realizes the clock synchronization operation of the master clock and the slave clock to prevent the subsequent industrial processing accuracy from being affected. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] FIG1 is an application environment diagram of a clock synchronization method provided by an embodiment of the present application;

[0056] FIG2 is a schematic diagram of a flow chart of a first clock synchronization method provided in an embodiment of the present application;

[0057] FIG3 is a schematic diagram of sending an uplink feedback message from a clock according to an embodiment of the present application;

[0058] FIG4 is a schematic diagram of a flow chart of a second clock synchronization method provided in an embodiment of the present application;

[0059] FIG5 is a schematic diagram of a flow chart of a third clock synchronization method provided in an embodiment of the present application;

[0060] FIG6 is a signaling diagram of a clock synchronization method provided in an embodiment of the present application;

[0061] FIG7 is a structural block diagram of a first clock synchronization device provided in an embodiment of the present application;

[0062] FIG8 is a structural block diagram of a second clock synchronization device provided in an embodiment of the present application;

[0063] FIG. 9 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0064] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0065] It is understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. In the description of the present application, the description of the reference terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily have to be directed to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples without contradicting each other.

[0066] The clock synchronization method provided in the embodiment of the present application can be applied in the application environment as shown in Figure 1. Among them, the slave clock 102 communicates with the master clock 104 through the network. The data storage system can be integrated on the slave clock 102, or it can be placed on the cloud or other network servers. The slave clock 102 sends at least one uplink feedback message to the master clock 104 in sequence when the current time reaches the uplink initial time, so that the master clock 104 determines the waiting time according to the at least one uplink feedback message received, and sends the waiting time and the uplink end time to the slave clock 102, and then, the slave clock 102 is clock synchronized with the master clock 104 according to the waiting time, the uplink initial time and the uplink end time.

[0067] In one embodiment, as shown in FIG. 2 , a clock synchronization method is provided, which is described by taking the method applied to the slave clock 102 in FIG. 1 as an example, and includes the following steps:

[0068] S201: When the current time reaches the uplink initial time, at least one uplink feedback message is sent to the master clock in sequence.

[0069] It should be noted that in order to ensure that the waiting time sent by the master clock can be successfully received later, it is necessary to ensure that in the process of sending at least one uplink feedback message to the master clock, each uplink feedback message carries relevant parameters for indicating time information, so that the master clock can determine the waiting time according to the relevant parameters carried in the uplink feedback message; or, in the process of sending at least one uplink feedback message to the master device, the slave device selects a preset time node to send the uplink feedback message, so as to ensure that the master clock can determine the waiting time according to the time of the received uplink feedback message.

[0070] In one embodiment of the present application, the uplink feedback message carries a timestamp corresponding to when the uplink feedback message is sent. Therefore, after the slave clock sends at least one uplink feedback message to the master clock in sequence, the master clock may perform a difference operation on the timestamp recorded in the first received uplink feedback message and the timestamp recorded in the last received uplink feedback message, and the difference operation result is the waiting time.

[0071] In another embodiment of the present application, when the slave clock sends an uplink feedback message to the master clock, it can follow a preset time result. Therefore, after the slave clock sends at least one uplink feedback message to the master clock in turn, the master clock can multiply the preset time interval by the number of received uplink feedback messages, and the result obtained is the waiting time.

[0072] S202, receiving the waiting time and uplink end time sent by the master clock.

[0073] The waiting time is determined by the master clock according to the received uplink feedback message.

[0074] In one embodiment of the present application, if at least one uplink feedback message sent sequentially from the slave clock to the master clock carries a timestamp corresponding to the sending of the uplink feedback message, then the second timestamp can be differenced with the first timestamp based on the first timestamp recorded in the first received uplink feedback message and the second timestamp recorded in the last received uplink feedback message, and the result of the difference operation is the waiting time.

[0075] In another embodiment of the present application, if the slave clock sends at least one uplink feedback message to the master clock in sequence according to a predetermined time interval, the master clock can count the number of uplink feedback messages received within a time period, and subtract one from the number of uplink feedback messages and multiply it by the preset time interval, and the result of the calculation is the waiting time.

[0076] S203: Perform clock synchronization with the master clock according to the waiting time, the uplink initial time and the uplink end time.

[0077] It should be noted that in order to realize the clock synchronization operation for the master clock (the clock corresponding to the control server) and the slave clock (the clock corresponding to the control terminal), the forwarding delay corresponding to the slave clock and the compensation deviation value corresponding to the forwarding delay can be determined according to the waiting time, the initial uplink time and the uplink end time; then, according to the forwarding delay and the compensation deviation value, the clock synchronization for the master clock is performed.

[0078] It is further explained that in the process of calculating the forwarding delay corresponding to the slave clock and the compensation deviation value corresponding to the forwarding delay, it is also necessary to obtain the downlink initial time and the downlink end time, and then, according to the waiting time, the uplink initial time, the uplink end time, the downlink initial time and the downlink end time, determine the forwarding delay corresponding to the slave clock and the compensation deviation value corresponding to the forwarding delay, and perform clock synchronization for the master clock based on the forwarding delay and the compensation deviation value.

[0079] In the clock synchronization method, the slave clock sends at least one uplink feedback message to the master clock in sequence when the current time reaches the uplink initial time, so that the master clock determines the waiting time according to the received at least one uplink feedback message, and sends the waiting time and the uplink end time to the slave clock, and then the slave clock performs clock synchronization with the master clock according to the waiting time, the uplink initial time and the uplink end time. According to the above content, in the process of clock synchronization between the master clock and the slave clock, the present application will not only refer to the uplink initial time and the uplink end time to achieve clock synchronization between the slave clock and the master clock, but also send at least one uplink feedback message to the master clock, so that the master clock determines the waiting time according to the received uplink feedback message, and the slave clock will receive the waiting time and the uplink end time sent by the master clock, so as to achieve that in the subsequent clock synchronization between the slave clock and the master clock, it not only relies on the uplink initial time and the uplink end time, but also considers the waiting time existing in the PON network during the transmission of uplink data. Therefore, the present application accurately realizes the clock synchronization operation of the master clock and the slave clock, and prevents the subsequent industrial processing accuracy from being affected.

[0080] In one embodiment, when it is necessary to send at least one uplink feedback message to the master clock in sequence, in order to ensure that the subsequent master clock can smoothly determine the waiting time and ensure that the slave clock can successfully complete the clock synchronization operation for the master clock, a unit time interval can be determined before sending the uplink feedback message to the master clock, and then, the uplink feedback message is sent to the master clock according to the unit time interval. Specifically: based on the preset unit time interval, at least one uplink feedback message is sent to the master clock in sequence, so that the master clock determines the waiting time according to the unit time interval and the number of uplink feedback messages received.

[0081] In one embodiment of the present application, as shown in Figure 3, it includes an uplink initial time, an uplink end time, a downlink initial time and a downlink end time; the maximum number n of uplink feedback messages sent can be determined in advance based on the business cycle of the corresponding control business between the master clock and the slave clock, and then, when the current time reaches the uplink initial time, the slave clock sends at least one uplink feedback message to the master clock in sequence. If a total of m uplink feedback messages are sent to the master clock, the master clock can determine the waiting time based on the m uplink feedback messages and the unit time interval.

[0082] The above-mentioned clock synchronization method realizes the operation of sending at least one uplink feedback message to the master clock in sequence through a preset unit time interval. The subsequent master clock can determine the waiting time according to the unit time interval and the number of uplink feedback messages received, thereby realizing the clock synchronization operation of the master clock and the slave clock, and preventing the subsequent industrial processing accuracy from being affected.

[0083] In one embodiment, as shown in FIG4 , when clock synchronization with the master clock is required based on the waiting time, the uplink initial time, and the uplink end time, the following contents may be specifically included:

[0084] S401, obtaining the downlink initial time and the downlink end time.

[0085] It should be noted that the downlink initial time refers to the time when the master clock starts to send a downlink synchronization message to the slave clock; the downlink end time refers to the time when the slave clock receives the downlink synchronization message sent by the master clock.

[0086] In one embodiment of the present application, when it is necessary to obtain the downlink initial time and the downlink end time, the master clock may send a follow-up message to the slave clock, and the master clock embeds the downlink initial time corresponding to the sent follow-up message into the follow-up message, and the slave clock records the time corresponding to the received synchronization message and uses the time as the downlink end time.

[0087] S402: Perform clock synchronization for the master clock according to the waiting time, the uplink initial time, the uplink end time, the downlink initial time and the downlink end time.

[0088] It should be noted that when it is necessary to perform clock synchronization operations for the master clock, the present application can determine the forwarding delay for the slave clock and the compensation deviation value corresponding to the forwarding delay based on the waiting time, the uplink initial time, the uplink end time, the downlink initial time and the downlink end time, and then, based on the forwarding delay and the compensation deviation value, perform clock synchronization for the master clock.

[0089] To further illustrate, when it is necessary to perform clock synchronization for the master clock based on the waiting time, the uplink initial time, the uplink end time, the downlink initial time and the downlink end time, it may specifically include the following contents: determining a first time difference between the uplink end time and the uplink initial time, and a second time difference between the downlink end time and the downlink initial time; performing a sum operation on the first time difference and the second time difference to obtain a sum operation result; taking half of the sum of the sum operation result and the waiting time as the forwarding delay; taking the difference between the second time difference and the forwarding delay as the compensation deviation value corresponding to the forwarding delay; and performing clock synchronization for the master clock based on the forwarding delay and the compensation deviation value.

[0090] In one embodiment of the present application, when it is necessary to determine the forwarding delay, the waiting time, the uplink initial time, the uplink end time, the downlink initial time and the downlink end time can be substituted into the calculation formula (1), and the output result of the calculation formula (1) is obtained, and the output result is the forwarding delay.

[0091] The calculation formula (1) is as follows:

[0092] = (t4—t3+ t2—t1) / 2 (1)

[0093] Specifically, D refers to the forwarding delay; t4 refers to the uplink end time; t3 refers to the uplink initial time; t2 refers to the downlink end time; and t1 refers to the downlink initial time.

[0094] In one embodiment of the present application, when it is necessary to determine the compensation deviation value, the forwarding delay, the downlink initial time and the downlink end time can be substituted into calculation formula (2), and the output result of calculation formula (2) can be obtained, and the output result is the compensation deviation value.

[0095] The calculation formula (2) is as follows:

[0096] offset = t2 - t1 - D (2)

[0097] Specifically, offset refers to the compensation deviation value, D refers to the forwarding delay; t2 refers to the downlink end time; and t1 refers to the downlink initial time.

[0098] The above clock synchronization method realizes clock synchronization for the master clock by determining the forwarding delay and the compensation deviation value corresponding to the forwarding delay, thereby accurately realizing the clock synchronization operation of the master clock and the slave clock to prevent the subsequent industrial processing accuracy from being affected.

[0099] In one embodiment, as shown in FIG. 5 , a clock synchronization method is provided, which is described by taking the method applied to the master clock 104 in FIG. 1 as an example, and includes the following steps:

[0100] S501: Determine a waiting time according to at least one received uplink feedback message.

[0101] The uplink feedback message is sent after the current time of the slave clock reaches the uplink initial time.

[0102] It should be noted that when it is necessary to determine the waiting time based on at least one uplink feedback message received, it may specifically include the following contents: determining the unit time interval between two adjacent uplink feedback messages received; multiplying the unit time interval and the number of uplink feedback messages received to obtain the waiting time.

[0103] Specifically, if the master clock receives a total of m uplink feedback messages, when the waiting time needs to be determined, the number of uplink feedback messages received is reduced by one and multiplied by the unit time interval, and the result of the calculation is the waiting time.

[0104] S502, sending the waiting time and the uplink end time to the slave clock, so that the slave clock synchronizes with the master clock according to the waiting time, the uplink initial time and the uplink end time.

[0105] In one embodiment of the present application, when the slave clock needs to be synchronized with the master clock, the following contents may be included: determining a first time difference between the uplink end time and the uplink initial time, and a second time difference between the downlink end time and the downlink initial time; performing a sum operation on the first time difference and the second time difference to obtain a sum operation result; using half of the sum of the sum operation result and the waiting time as the forwarding delay; using the difference between the second time difference and the forwarding delay as the compensation deviation value corresponding to the forwarding delay; and achieving clock synchronization between the slave clock and the master clock based on the forwarding delay and the compensation deviation value.

[0106] In the clock synchronization method, the slave clock sends at least one uplink feedback message to the master clock in sequence when the current time reaches the uplink initial time, so that the master clock determines the waiting time according to the received at least one uplink feedback message, and sends the waiting time and the uplink end time to the slave clock, and then the slave clock performs clock synchronization with the master clock according to the waiting time, the uplink initial time and the uplink end time. According to the above content, in the process of clock synchronization between the master clock and the slave clock, the present application will not only refer to the uplink initial time and the uplink end time to achieve clock synchronization between the slave clock and the master clock, but also send at least one uplink feedback message to the master clock, so that the master clock determines the waiting time according to the received uplink feedback message, and the slave clock will receive the waiting time and the uplink end time sent by the master clock, so as to achieve that in the subsequent clock synchronization between the slave clock and the master clock, it not only relies on the uplink initial time and the uplink end time, but also considers the waiting time existing in the PON network during the transmission of uplink data. Therefore, the present application accurately realizes the clock synchronization operation of the master clock and the slave clock, and prevents the subsequent industrial processing accuracy from being affected.

[0107] In one embodiment, as shown in FIG6 , when the slave clock needs to be synchronized with the master clock, the following contents may be specifically included:

[0108] S601: The master clock sends a synchronization message to the slave clock.

[0109] S602, the master clock sends the downlink initial time to the slave clock via a follow message.

[0110] S603, the slave clock queries the burst cycle of the control service between the master clock and the slave clock through the PON link, and determines the maximum number of uplink feedback messages to be sent according to the burst cycle.

[0111] S604: When the current time reaches the uplink initial time, the slave clock sequentially sends at least one uplink feedback message to the master clock based on a preset unit time interval and a maximum sending quantity.

[0112] S605: The master clock determines a waiting time according to at least one received uplink feedback message.

[0113] S606: The master clock sends the waiting time and the uplink end time to the slave clock.

[0114] S607, the slave clock determines a forwarding delay and a compensation deviation value according to the waiting time, the uplink initial time, the uplink end time, the downlink initial time and the downlink end time.

[0115] S608: The slave clock performs clock synchronization for the master clock according to the forwarding delay and the compensation deviation value.

[0116] In the clock synchronization method, the slave clock sends at least one uplink feedback message to the master clock in sequence when the current time reaches the uplink initial time, so that the master clock determines the waiting time according to the received at least one uplink feedback message, and sends the waiting time and the uplink end time to the slave clock, and then the slave clock performs clock synchronization with the master clock according to the waiting time, the uplink initial time and the uplink end time. According to the above content, in the process of clock synchronization between the master clock and the slave clock, the present application will not only refer to the uplink initial time and the uplink end time to achieve clock synchronization between the slave clock and the master clock, but also send at least one uplink feedback message to the master clock, so that the master clock determines the waiting time according to the received uplink feedback message, and the slave clock will receive the waiting time and the uplink end time sent by the master clock, so as to achieve that in the subsequent clock synchronization between the slave clock and the master clock, it not only relies on the uplink initial time and the uplink end time, but also considers the waiting time existing in the PON network during the transmission of uplink data. Therefore, the present application accurately realizes the clock synchronization operation of the master clock and the slave clock, and prevents the subsequent industrial processing accuracy from being affected.

[0117] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0118] Based on the same inventive concept, the embodiment of the present application also provides a clock synchronization device for implementing the clock synchronization method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more clock synchronization device embodiments provided below can refer to the limitations on the clock synchronization method above, and will not be repeated here.

[0119] In one embodiment, as shown in FIG. 7 , a clock synchronization device is provided, which is configured in a slave clock and includes: a sending module 10, a receiving module 20 and a first synchronization module 30, wherein:

[0120] The sending module 10 is used to send at least one uplink feedback message to the master clock in sequence when the current time reaches the uplink initial time.

[0121] The receiving module 20 is used to receive the waiting time and the uplink end time sent by the master clock; wherein the waiting time is determined by the master clock according to the received uplink feedback message.

[0122] The first synchronization module 30 is used to perform clock synchronization with the master clock according to the waiting time, the uplink initial time and the uplink end time.

[0123] In one embodiment, at least one uplink feedback message is sent to the master clock in sequence based on a preset unit time interval, so that the master clock determines the waiting time according to the unit time interval and the number of received uplink feedback messages.

[0124] In one embodiment, obtaining a downlink initial time and a downlink end time;

[0125] Clock synchronization for the master clock is performed based on the waiting time, the uplink initial time, the uplink end time, the downlink initial time, and the downlink end time.

[0126] In one embodiment, a first time difference between an uplink end time and an uplink initial time, and a second time difference between a downlink end time and a downlink initial time are determined;

[0127] Perform a sum operation on the first time difference and the second time difference to obtain a sum operation result;

[0128] The half of the sum of the sum operation result and the waiting time is taken as the forwarding delay;

[0129] Using the difference between the second time difference and the forwarding delay as the compensation deviation value corresponding to the forwarding delay;

[0130] Clock synchronization with respect to the master clock is performed based on the forwarding delay and the compensation offset value.

[0131] In one embodiment, as shown in FIG8 , a clock synchronization device is provided, which is configured on a master clock and includes: a determination module 40 and a second synchronization module 50 , wherein:

[0132] The determination module 40 is used to determine the waiting time according to at least one received uplink feedback message; the uplink feedback message is sent from the clock after the current time reaches the uplink initial time.

[0133] The second synchronization module 50 is used to send the waiting time and the uplink end time to the slave clock, so that the slave clock is synchronized with the master clock according to the waiting time, the uplink initial time and the uplink end time.

[0134] In one embodiment, determining a unit time interval between two consecutive receptions of uplink feedback messages;

[0135] The waiting time is obtained by multiplying the unit time interval by the number of received uplink feedback messages.

[0136] In the clock synchronization device, the slave clock sends at least one uplink feedback message to the master clock in sequence when the current time reaches the uplink initial time, so that the master clock determines the waiting time according to the received at least one uplink feedback message, and sends the waiting time and the uplink end time to the slave clock, and then the slave clock performs clock synchronization with the master clock according to the waiting time, the uplink initial time and the uplink end time. According to the above content, in the process of clock synchronization between the master clock and the slave clock, the present application will not only refer to the uplink initial time and the uplink end time to achieve clock synchronization between the slave clock and the master clock, but also send at least one uplink feedback message to the master clock, so that the master clock determines the waiting time according to the received uplink feedback message, and the slave clock will receive the waiting time and the uplink end time sent by the master clock, so as to achieve that in the subsequent clock synchronization between the slave clock and the master clock, it not only relies on the uplink initial time and the uplink end time, but also considers the waiting time existing in the PON network during the transmission of uplink data. Therefore, the present application accurately realizes the clock synchronization operation of the master clock and the slave clock, and prevents the subsequent industrial processing accuracy from being affected.

[0137] Each module in the above clock synchronization device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0138] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be shown in FIG9. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, the memory, and the input / output interface are connected via a system bus, and the communication interface, the display unit, and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner may be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a clock synchronization method is implemented. The display unit of the computer device is used to form a visually visible picture, which may be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.

[0139] Those skilled in the art will understand that the structure shown in FIG. 9 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0140] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0141] When the current time reaches the uplink initial time, at least one uplink feedback message is sent to the master clock in sequence;

[0142] Receive the waiting time and uplink end time sent by the master clock; wherein the waiting time is determined by the master clock according to the received uplink feedback message;

[0143] The clock is synchronized with the master clock based on the waiting time, the initial uplink time, and the end uplink time.

[0144] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0145] Based on a preset unit time interval, at least one uplink feedback message is sent to the master clock in sequence, so that the master clock determines the waiting time according to the unit time interval and the number of received uplink feedback messages.

[0146] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0147] Get the downlink initial time and downlink end time;

[0148] Clock synchronization for the master clock is performed based on the waiting time, the uplink initial time, the uplink end time, the downlink initial time, and the downlink end time.

[0149] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0150] Determine a first time difference between an uplink end time and an uplink initial time, and a second time difference between a downlink end time and a downlink initial time;

[0151] Perform a sum operation on the first time difference and the second time difference to obtain a sum operation result;

[0152] The half of the sum of the sum operation result and the waiting time is taken as the forwarding delay;

[0153] Using the difference between the second time difference and the forwarding delay as the compensation deviation value corresponding to the forwarding delay;

[0154] Clock synchronization with respect to the master clock is performed based on the forwarding delay and the compensation offset value.

[0155] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0156] Determine the waiting time according to at least one received uplink feedback message; the uplink feedback message is sent from the clock after the current time reaches the uplink initial time;

[0157] The waiting time and the uplink end time are sent to the slave clock, so that the slave clock is synchronized with the master clock according to the waiting time, the uplink initial time and the uplink end time.

[0158] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0159] Determine a unit time interval between two consecutive uplink feedback messages received;

[0160] The waiting time is obtained by multiplying the unit time interval by the number of received uplink feedback messages.

[0161] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0162] When the current time reaches the uplink initial time, at least one uplink feedback message is sent to the master clock in sequence;

[0163] Receive the waiting time and uplink end time sent by the master clock; wherein the waiting time is determined by the master clock according to the received uplink feedback message;

[0164] The clock is synchronized with the master clock based on the waiting time, the initial uplink time, and the end uplink time.

[0165] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0166] Based on a preset unit time interval, at least one uplink feedback message is sent to the master clock in sequence, so that the master clock determines the waiting time according to the unit time interval and the number of received uplink feedback messages.

[0167] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0168] Get the downlink initial time and downlink end time;

[0169] Clock synchronization for the master clock is performed based on the waiting time, the uplink initial time, the uplink end time, the downlink initial time, and the downlink end time.

[0170] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0171] Determine a first time difference between an uplink end time and an uplink initial time, and a second time difference between a downlink end time and a downlink initial time;

[0172] Perform a sum operation on the first time difference and the second time difference to obtain a sum operation result;

[0173] The half of the sum of the sum operation result and the waiting time is taken as the forwarding delay;

[0174] Using the difference between the second time difference and the forwarding delay as the compensation deviation value corresponding to the forwarding delay;

[0175] Clock synchronization with respect to the master clock is performed based on the forwarding delay and the compensation offset value.

[0176] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0177] Determine the waiting time according to at least one received uplink feedback message; the uplink feedback message is sent from the clock after the current time reaches the uplink initial time;

[0178] The waiting time and the uplink end time are sent to the slave clock, so that the slave clock is synchronized with the master clock according to the waiting time, the uplink initial time and the uplink end time.

[0179] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0180] Determine a unit time interval between two consecutive uplink feedback messages received;

[0181] The waiting time is obtained by multiplying the unit time interval by the number of received uplink feedback messages.

[0182] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0183] When the current time reaches the uplink initial time, at least one uplink feedback message is sent to the master clock in sequence;

[0184] Receive the waiting time and uplink end time sent by the master clock; wherein the waiting time is determined by the master clock according to the received uplink feedback message;

[0185] The clock is synchronized with the master clock based on the waiting time, the initial uplink time, and the end uplink time.

[0186] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0187] Based on a preset unit time interval, at least one uplink feedback message is sent to the master clock in sequence, so that the master clock determines the waiting time according to the unit time interval and the number of received uplink feedback messages.

[0188] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0189] Get the downlink initial time and downlink end time;

[0190] Clock synchronization for the master clock is performed based on the waiting time, the uplink initial time, the uplink end time, the downlink initial time, and the downlink end time.

[0191] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0192] Determine a first time difference between an uplink end time and an uplink initial time, and a second time difference between a downlink end time and a downlink initial time;

[0193] Perform a sum operation on the first time difference and the second time difference to obtain a sum operation result;

[0194] The half of the sum of the sum operation result and the waiting time is taken as the forwarding delay;

[0195] Using the difference between the second time difference and the forwarding delay as the compensation deviation value corresponding to the forwarding delay;

[0196] Clock synchronization with respect to the master clock is performed based on the forwarding delay and the compensation offset value.

[0197] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0198] Determine the waiting time according to at least one received uplink feedback message; the uplink feedback message is sent from the clock after the current time reaches the uplink initial time;

[0199] The waiting time and the uplink end time are sent to the slave clock, so that the slave clock is synchronized with the master clock according to the waiting time, the uplink initial time and the uplink end time.

[0200] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0201] Determine a unit time interval between two consecutive uplink feedback messages received;

[0202] The waiting time is obtained by multiplying the unit time interval by the number of received uplink feedback messages.

[0203] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0204] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0205] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0206] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A clock synchronization method, characterized in that: Applied to a slave clock, the method comprises: When the current time reaches the uplink initial time, at least one uplink feedback message is sent to the master clock in sequence; Receive the waiting time and uplink end time sent by the master clock; wherein the waiting time is determined by the master clock according to the received uplink feedback message; Clock synchronization is performed with the master clock according to the waiting time, the uplink initial time and the uplink end time.

2. The method according to claim 1, characterized in that: The sending at least one uplink feedback message to the master clock in sequence includes: Based on a preset unit time interval, at least one uplink feedback message is sent to the master clock in sequence, so that the master clock determines the waiting time according to the unit time interval and the number of received uplink feedback messages.

3. The method according to claim 1, characterized in that The performing clock synchronization with the master clock according to the waiting time, the uplink initial time and the uplink end time comprises: Get the downlink initial time and downlink end time; Clock synchronization for the master clock is performed according to the waiting time, the uplink initial time, the uplink end time, the downlink initial time and the downlink end time.

4. The method according to claim 3, characterized in that The performing clock synchronization for the master clock according to the waiting time, the uplink initial time, the uplink end time, the downlink initial time and the downlink end time comprises: Determine a first time difference between the uplink end time and the uplink initial time, and a second time difference between the downlink end time and the downlink initial time; Performing a sum operation on the first time difference and the second time difference to obtain a sum operation result; Taking half of the sum of the sum operation result and the waiting time as the forwarding delay; Using the difference between the second time difference and the forwarding delay as the compensation deviation value corresponding to the forwarding delay; Clock synchronization for the master clock is performed according to the forwarding delay and the compensation offset value.

5. A clock synchronization method, characterized in that: Applied to a master clock, the method comprises: Determine the waiting time according to at least one received uplink feedback message; the uplink feedback message is sent after the slave clock reaches the uplink initial time at the current time; The waiting time and the uplink end time are sent to the slave clock, so that the slave clock is synchronized with the master clock according to the waiting time, the uplink initial time and the uplink end time.

6. The method according to claim 5, characterized in that The determining the waiting time according to the at least one received uplink feedback message includes: Determine a unit time interval between two consecutive uplink feedback messages received; The unit time interval and the number of received uplink feedback messages are multiplied to obtain the waiting time.

7. A clock synchronization device, characterized in that: Configured as a slave clock, the device comprises: A sending module, used to send at least one uplink feedback message to the master clock in sequence when the current time reaches the uplink initial time; A receiving module, used to receive the waiting time and the uplink end time sent by the master clock; wherein the waiting time is determined by the master clock according to the received uplink feedback message; The first synchronization module is used to perform clock synchronization with the master clock according to the waiting time, the uplink initial time and the uplink end time.

8. A clock synchronization device, characterized in that: Configured on a master clock, the device comprises: A determination module, configured to determine the waiting time according to at least one received uplink feedback message; the uplink feedback message is sent from the clock after the current time reaches the uplink initial time; The second synchronization module is used to send the waiting time and the uplink end time to the slave clock, so that the slave clock is synchronized with the master clock according to the waiting time, the uplink initial time and the uplink end time.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.