Clock skew adjustment method and device, equipment and storage medium

By obtaining the target clock offset based on the sampling parameters of the sliding time window in the power system, and adopting a step-by-step adjustment strategy, the problem of slow convergence speed or divergence of the synchronization process caused by the clock deviation of distributed sampling equipment is solved, and efficient adjustment of clock deviation and timing consistency of the sampling equipment is achieved.

CN120508184APending Publication Date: 2025-08-19SOUTHERN POWER GRID SENSING TECHNOLOGY (GUANGDONG) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510557256.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-29
Publication Date
2025-08-19

AI Technical Summary

Technical Problem

In power systems, the clock deviation of the distributed sampling device causes the convergence speed of the clock synchronization process to be slow or divergent, and it is difficult for the prior art to set a reasonable step time to improve the clock deviation adjustment efficiency.

Method used

By obtaining the target clock offset based on the sampling parameters of the sliding time window, comparing the target clock offset with the preset step size, determining the adjustment step size and adjustment time, and gradually adjusting the sampling edge of the sampling device using a step-by-step adjustment strategy to achieve synchronization between the clock signal and the reference signal.

Benefits of technology

It improves the efficiency and accuracy of clock deviation adjustment, ensures the timing consistency of the sampling equipment, and improves the accuracy of power system operation status analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120508184A_ABST
    Figure CN120508184A_ABST
Patent Text Reader

Abstract

The invention relates to a clock skew adjustment method and device, equipment and a storage medium. The method comprises the following steps: acquiring a target clock offset between a sampling clock signal and a reference signal based on a sampling parameter of sampling equipment in a sliding time window; the sliding time window comprises a plurality of time windows corresponding to the reference signals; comparing the target clock offset with a preset step length, and determining an adjustment step length and adjustment time corresponding to the adjustment step length; and adjusting the sampling edge of the sampling equipment according to the adjustment time corresponding to the adjustment step length. By adopting the method, the rationality of adjusting the step length time can be improved, and the adjusting efficiency of the clock skew is further improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of power systems, and in particular to a clock deviation adjustment method, apparatus, device, and storage medium. Background Art

[0002] In power systems, distributed sampling of different types of power parameters at substations helps accurately analyze the operating status of the power system. Therefore, ensuring the timing consistency of distributed sampling equipment is crucial for analyzing the operating status of the power system.

[0003] In related technologies, when clock deviation exists in distributed sampling devices, clock synchronization is usually performed according to a preset fixed step time. If the step time is too small, the convergence speed will be slow, while if the step time is too large, the synchronization process will diverge.

[0004] Based on this, how to set a reasonable step time and improve the efficiency of clock deviation adjustment is a technical problem that needs to be solved urgently. Summary of the Invention

[0005] Based on this, it is necessary to provide a clock deviation adjustment method, device, equipment and storage medium to address the above technical problems, so as to improve the rationality of the adjustment step time and thereby improve the adjustment efficiency of the clock deviation.

[0006] In a first aspect, the present application provides a clock deviation adjustment method, comprising:

[0007] Obtaining a target clock offset between a sampling clock signal and a reference signal based on sampling parameters of a sampling device in a sliding time window; the sliding time window includes time windows corresponding to a plurality of reference signals;

[0008] Comparing the target clock offset with a preset step size to determine an adjustment step size and an adjustment time corresponding to the adjustment step size;

[0009] Adjust the sampling edge of the sampling device according to the adjustment time corresponding to the adjustment step.

[0010] In one embodiment, obtaining a target clock offset between a sampling clock signal and a reference signal based on sampling parameters of a sampling device in a sliding time window includes:

[0011] Input the sampling parameters into a preset time offset function to obtain an initial clock offset; the time offset function includes the window weight of each time window;

[0012] Based on the initial clock offset, the weights of each window in the time offset function are cyclically updated until the convergence condition is met, and an updated time offset function is obtained;

[0013] The clock offset corresponding to the updated time offset function is determined as the target clock offset.

[0014] In one embodiment, the sampling parameters include a counting time interval of each time window and an accumulated count value of each time window; the sampling parameters are input into a preset time offset function to obtain an initial clock offset, including:

[0015] Based on the window weight of each time window, the counting time intervals of each time window are fused to obtain the average time interval of the sampling device;

[0016] The sampling time of the sampling device is obtained according to the average time interval of the sampling device and the accumulated count value of each time window;

[0017] The difference between the sampling time and the sliding time of the sliding time window is determined as the overall clock offset of the sampling device in the sliding time window;

[0018] The ratio of the overall clock offset to the number of windows in the sliding time window is calculated to obtain the initial clock offset.

[0019] In one embodiment, based on the initial clock offset, cyclically updating the weights of each window in the time offset function includes:

[0020] Calculate the weight gradient of the initial clock offset with respect to each window weight;

[0021] Based on the learning rate parameter corresponding to the current cycle, the weight gradients of each window weight are fused to obtain the weight update amount of each window weight;

[0022] For any window weight, the difference between the window weight and the weight update amount of the window weight is determined as the updated window weight value corresponding to the window weight, completing a weight update of each window weight in the time offset function.

[0023] In one embodiment, comparing the target clock offset with a preset step size to determine the adjustment step size and the adjustment time corresponding to the adjustment step size includes:

[0024] When the target clock offset is greater than the preset step size, determining at least a first adjustment step size and a second adjustment step size according to a ratio of the target clock offset to the preset step size;

[0025] Determine the preset step length as the adjustment time of each first adjustment step length;

[0026] The adjustment time of the second adjustment step is determined according to the target clock offset and the adjustment time of each first adjustment step.

[0027] In one embodiment, determining the adjustment time of the second adjustment step according to the target clock offset and the adjustment time of each first adjustment step includes:

[0028] Superimposing the adjustment time of each first adjustment step;

[0029] The time difference between the target clock offset and the superposition result is determined as the adjustment time of the second adjustment step.

[0030] In one embodiment, comparing the target clock offset with a preset step size to determine the adjustment step size and the adjustment time corresponding to the adjustment step size includes:

[0031] When the target clock offset is less than or equal to the preset step size, a third adjustment step size is determined, and the target clock offset is determined as the adjustment time corresponding to the third adjustment step size.

[0032] In a second aspect, the present application further provides a clock deviation adjustment device, comprising:

[0033] An acquisition module is configured to acquire a target clock offset between a sampling clock signal and a reference signal based on sampling parameters of a sampling device in a sliding time window; the sliding time window includes time windows corresponding to a plurality of reference signals;

[0034] A determination module, configured to compare the target clock offset with a preset step size, and determine the number of adjustment steps and the adjustment time corresponding to the adjustment step size;

[0035] The adjustment module is used to adjust the sampling edge of the sampling device according to the adjustment time corresponding to the adjustment step.

[0036] In a third aspect, the present application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the method in any one of the embodiments of the first aspect are implemented.

[0037] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method in any one of the embodiments of the first aspect above.

[0038] In a fifth aspect, the present application also provides a computer program product, comprising a computer program, which, when executed by a processor, implements the steps of the method in any one of the embodiments of the first aspect above.

[0039] The clock deviation adjustment method, apparatus, device, and storage medium described above obtain a target clock offset between a sampling clock signal and a reference signal based on the sampling parameters of a sampling device in a sliding time window, wherein the sliding time window includes multiple time windows corresponding to the reference signals. The target clock offset is then compared with a preset step size to determine an adjustment step size and an adjustment time corresponding to the adjustment step size. The sampling edge of the sampling device is adjusted according to the adjustment time corresponding to the adjustment step size. In this method, the actual sampling duration of the sampling clock signal in the sliding time window is determined based on the sampling parameters of the sampling device in the sliding time window. Based on the actual sampling duration and the sliding time window, the target clock offset between the sampling clock signal and the reference signal in a unit time window is determined. The clock offset is then compared with a preset step size, and the preset step size is flexibly adjusted to determine a more accurate and reasonable adjustment step size and adjustment time for each adjustment step size suitable for the current clock deviation of the sampling device, thereby achieving step-by-step adjustment of the sampling edge of the sampling device and improving the efficiency of clock deviation adjustment. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments of the present application or related technical descriptions. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying any creative work.

[0041] Figure 1 A diagram illustrating an application environment of a clock deviation adjustment method according to an embodiment;

[0042] Figure 2 1 is a flow chart of a clock deviation adjustment method according to an embodiment;

[0043] Figure 3 A schematic flow chart of a clock offset determination step in one embodiment;

[0044] Figure 4 Schematic diagram of a flow chart of a clock offset determination step in another embodiment;

[0045] Figure 5 Schematic diagram of a weight updating process in one embodiment;

[0046] Figure 6 A schematic flow chart of a step of adjusting time determination in one embodiment;

[0047] Figure 7 is a flow chart of a clock deviation adjustment method according to another embodiment;

[0048] Figure 8 is a structural block diagram of a clock deviation adjustment device in one embodiment;

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

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

[0051] The clock deviation adjustment method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown, the satellite system 102 communicates with the distributed sampling device 104 in the power system via an antenna. The sampling device 104 can be a sensor device, such as a pressure sensor, a temperature sensor, a humidity sensor, etc.

[0052] The following will describe in detail the technical solutions of the present application and how the technical solutions of the present application solve the above-mentioned technical problems through embodiments and in conjunction with the accompanying drawings. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The following will describe clearly and completely the technical solutions in the embodiments of the present application in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments.

[0053] In an exemplary embodiment, Figure 2 As shown, a clock deviation adjustment method is provided, which is applied to Figure 1 Take any sampling device in as an example to illustrate, including the following steps:

[0054] S201 : Acquire a target clock offset between a sampling clock signal and a reference signal based on sampling parameters of a sampling device in a sliding time window; the sliding time window includes time windows corresponding to a plurality of reference signals.

[0055] Sampling equipment refers to data acquisition devices within power systems. Based on the type of data collected, it can be categorized as power quality sampling equipment and electrical parameter sampling equipment. Power quality sampling equipment is distributed across the power network to collect power quality parameters such as voltage, current, frequency, and harmonics. Electrical parameter sampling equipment, distributed throughout the power lines, uses distributed current and voltage sampling devices to monitor line load and operating status in real time.

[0056] The reference signal is a standard signal used by the sampling device to adjust the sampling clock signal. It can be a pulse per second signal (1 Pulse Per Second) transmitted by a satellite at full seconds. The sliding time window includes multiple time windows corresponding to the reference signal. For example, if the reference signal is a pulse per second signal, and the sliding time window includes N time windows corresponding to N pulse per second signals, the duration of the sliding time window is N seconds, where N is a positive integer greater than 1.

[0057] The sampling parameters are the sampling data corresponding to each time window corresponding to the reference signal in the sliding time window of the sampling device, such as the accumulated count value in the time window corresponding to the first reference signal, the accumulated count value in the time window corresponding to the second reference signal, etc.

[0058] In an optional embodiment, the target clock offset can be the unit clock offset between the sampling clock signal and the reference signal in a single time window. In this case, assuming the sampling parameters include the count value of the sampling device in each time window, the target clock offset is obtained by obtaining the average time interval of the sampling device in each time window based on the count value of the sampling device in each time window. Then, based on the average time interval and the accumulated count value of the sampling device in the sliding time window, the cumulative sampling time of the sampling device in the sliding time window is obtained. Finally, the cumulative sampling time and the number of windows in the sliding time window are calculated to obtain the unit clock offset.

[0059] In another optional embodiment, the target clock offset may be obtained by determining the actual sampling value of the sampling device in each time window according to the mapping relationship between the count value and the actual sampling time, superimposing or weighting the actual sampling time of the sampling device in each time window in the sliding time window to obtain the cumulative sampling time of the sampling clock signal and the reference signal, and finally calculating the cumulative sampling time and the number of windows in the sliding time window to obtain the unit clock offset.

[0060] S202: Compare the target clock offset with a preset step size to determine an adjustment step size and an adjustment time corresponding to the adjustment step size.

[0061] It should be noted that both the target clock offset and the preset step size are time lengths. The target clock offset refers to the clock offset between the sampling clock signal and a single reference signal. Furthermore, the preset step size is significantly smaller than the time window of a single reference signal to allow the sampling device to make multiple adjustments to the sampling edge within a single time window.

[0062] In an embodiment of the present application, a step adjustment strategy is determined by comparing the target clock offset with a preset step size. The adjustment strategy includes the number of adjustment steps and the adjustment time corresponding to each adjustment step size.

[0063] Exemplarily, if the target clock offset is smaller than the preset step size, a one-time adjustment strategy is determined, and the adjustment time for the one-time adjustment is the target clock offset.

[0064] Exemplarily, if the target clock offset is greater than or equal to a preset step size, multiple adjustment strategies are determined, and the step size of each adjustment is no greater than the preset step size.

[0065] S203: Adjust the sampling edge of the sampling device according to the adjustment time corresponding to the adjustment step.

[0066] The number of times the sampling edge is adjusted is determined according to the number of adjustment steps, and the sampling edge is adjusted according to the adjustment time of each adjustment step. Through a step-by-step adjustment method, the sampling edge clock signal of the sampling device gradually approaches the reference signal until it is consistent with the clock signal of the reference signal.

[0067] Each adjustment may be performed by moving the first sampling edge of the sampling clock signal in the next window of the sliding time window forward by a length matching the adjustment time according to the rising edge direction of the sampling clock, thereby obtaining a corrected sampling clock signal. In this way, after multiple adjustments, the sampling edge of the finally adjusted sampling clock signal is aligned with the edge of the reference signal.

[0068] It should be noted that the target clock offset refers to the clock offset within a unit time window, that is, in each time window corresponding to the reference signal, the sampling edge of the sampling device needs to be adjusted step by step as described above.

[0069] In an embodiment of the present application, based on the sampling parameters of the sampling device in the sliding time window, a target clock offset between the sampling clock signal and the reference signal is obtained, wherein the sliding time window includes multiple time windows corresponding to the reference signals, and then the target clock offset is compared with a preset step size to determine an adjustment step size and an adjustment time corresponding to the adjustment step size, and the sampling edge of the sampling device is adjusted according to the adjustment time corresponding to the adjustment step size. In this method, based on the sampling parameters of the sampling device in the sliding time window, the actual sampling duration of the sampling clock signal in the sliding time window in the sampling device is determined, and based on the actual sampling duration and the sliding time window, the target clock offset between the sampling clock signal and the reference signal in a unit time window is determined, and then the clock offset is compared with the preset step size, and the preset step size is flexibly adjusted to determine a more accurate and reasonable adjustment step size suitable for the current clock deviation of the sampling device, as well as the adjustment time of each adjustment step size, so as to achieve a step-by-step adjustment of the sampling edge of the sampling device and improve the adjustment efficiency of the clock deviation.

[0070] As can be seen from the above embodiments, the target clock offset is an important basis for the clock deviation adjustment strategy. Based on this, a method for obtaining the target clock offset is described in detail below. In an exemplary embodiment, Figure 3 As shown, based on the sampling parameters of the sampling device in the sliding time window, the target clock offset between the sampling clock signal and the reference signal is obtained, including:

[0071] S301 , inputting sampling parameters into a preset time offset function to obtain an initial clock offset; the time offset function includes a window weight of each time window.

[0072] The time offset function is a mathematical model that represents the cumulative time function of a sampling device in a sliding time window and the number of windows in the sliding time window. The cumulative time function includes the actual sampling time function of the sampling device and the standard sampling time. The actual sampling time function is specifically a functional relationship between the window weight and sampling parameters of each time window.

[0073] The sampling parameters are input into the preset time offset function, and the sampling parameters are processed by the actual sampling time function to obtain the actual sampling time of the sampling device. Then, the cumulative time offset between the actual sampling time and the standard sampling time is calculated by the cumulative time function. Finally, the mean between the cumulative time offset and the number of windows is calculated to obtain the clock offset corresponding to the sampling device in a single time window, that is, the initial clock offset.

[0074] S302 : Based on the initial clock offset, cyclically update the weight of each window in the time offset function until a convergence condition is met, thereby obtaining an updated time offset function.

[0075] Based on the initial clock offset, a genetic algorithm, particle swarm optimization algorithm, or other methods are used to cyclically update the window weights in the time offset function. The clock offset corresponding to each update is obtained until at least one convergence condition is met. Updated window weights are then obtained, and thus an updated time offset function is obtained. Convergence conditions include the difference in clock offsets between two consecutive updates being less than a preset change threshold, the update time reaching a preset update time, and the number of updates reaching a preset update threshold.

[0076] S303: Determine the clock offset corresponding to the updated time offset function as the target clock offset.

[0077] Substitute the sampling parameters of the sampling device in the sliding time window into the updated time offset function to obtain the clock offset, that is, the target clock offset.

[0078] In an embodiment of the present application, the sampling parameters are input into a preset time offset function to obtain an initial clock offset. Based on the initial clock offset, the weights of each window in the time offset function are cyclically updated, and a reasonable optimal weight is determined for each time window, so that the function value of the time offset function tends to converge, and the minimum function value corresponding to the time offset function is obtained, that is, the target clock offset, which provides a reliable adjustment basis for subsequent adjustment of the sampling clock deviation.

[0079] In an exemplary embodiment, the sampling parameters include the counting time interval of each time window and the accumulated count value of each time window; Figure 4 As shown, Figure 4 An implementation of the aforementioned step S301 of "inputting the sampling parameters into a preset time offset function to obtain an initial clock offset" includes:

[0080] S401 , based on the window weight of each time window, the counting time intervals of each time window are integrated to obtain the average time interval of the sampling device.

[0081] It should be known that for any time window of the reference signal, the accumulated count value is the accumulated count value of the counter of the sampling device in the time window, and the counting time interval is the ratio between the time length of the time window and the accumulated count value of the time window.

[0082] Taking the reference signal as a pulse-per-second signal, that is, the length of a single time window is 1s, as an example, the average time interval The expression is as follows:

[0083] (Formula 1)

[0084] in, Represents the window weights from window 1 to window Q in the sliding time window, and is also the optimization parameter of the time offset function; The count value corresponding to window 1 to window Q, where Q represents the number of windows.

[0085] S402 : Obtain the sampling time of the sampling device according to the average time interval of the sampling device and the accumulated count value of each time window.

[0086] The average time interval of the sampling device is used as the time interval of the sampling device in the sliding time window, and the product of the average time interval and the accumulated count value is used as the sampling time of the sampling device in the sliding time window.

[0087] Sampling time The expression is as follows:

[0088] (Formula 2)

[0089] S403 : Determine the difference between the sampling time and the sliding time of the sliding time window as the overall clock offset of the sampling device in the sliding time window.

[0090] Overall clock offset The expression is as follows:

[0091] (Formula 3)

[0092] in, It represents the time of Q time windows, that is, the total time length of the sliding time window, that is, Q seconds.

[0093] S404 , calculating the ratio between the overall clock offset and the number of windows in the sliding time window to obtain an initial clock offset.

[0094] Initial clock offset The calculation expression is as follows:

[0095] (Formula 4)

[0096] In an embodiment of the present application, based on the window weight of each time window, the counting time gaps of each time window are fused to obtain the average time gap of the sampling device, and the sampling time of the sampling device is obtained according to the average time gap of the sampling device and the accumulated count value of each time window. The difference between the sampling time and the sliding time of the sliding time window is determined as the overall clock offset of the sampling device in the sliding time window. Finally, the ratio between the overall clock offset and the number of windows in the sliding time window is calculated to obtain the initial clock offset. The entire implementation process has clear logic and is suitable for flexible deployment in sampling devices in various scenarios, and adapts to various complex power system environments.

[0097] In an exemplary embodiment, Figure 5 As shown, Figure 5 This is an implementation of the aforementioned step S301 of "cyclically updating the weights of each window in the time offset function based on the initial clock offset", including:

[0098] S501: Calculate the weight gradient of the initial clock offset with respect to each window weight.

[0099] Calculate the first-order derivative of the time offset function for each window weight to obtain the weight gradient vector corresponding to each window weight. The weight gradient vector includes the weight gradient value of each window weight. The expression is as follows:

[0100] (Formula 5)

[0101] in, They refer to The corresponding weight gradient.

[0102] S502: Based on the learning rate parameter corresponding to the current cycle round, the weight gradients of the window weights are integrated to obtain the weight update amount of each window weight.

[0103] The learning rate parameter is determined by a learning rate function, which is a mathematical expression representing the dynamic changes in the learning rate over the iterations of the loop. In practical applications, the learning rate function can be a constant expression, meaning that the learning rate parameter for each iteration is fixed; or it can be a dynamic mathematical expression, in which case the learning rate parameter for different iterations can be the same or different.

[0104] For any window weight, determine the learning rate parameter corresponding to the current cycle round, and use the product of the learning rate parameter and the weight gradient of the window weight as the weight update amount of the window weight.

[0105] It should be noted that the weight gradient of each window weight is expressed in vector form, and the corresponding weight update amount is also in vector form, expressed as ,in, is the learning rate parameter corresponding to the current cycle.

[0106] S503: For any window weight, the difference between the window weight and the weight update amount of the window weight is determined as the updated window weight value corresponding to the window weight, completing a weight update of each window weight in the time offset function.

[0107] It should be noted that the weight gradient of each window weight is expressed as a vector, and the corresponding weight update amount is also in vector form. The corresponding expression is:

[0108] (Formula 6)

[0109] in, is the learning rate parameter corresponding to the current cycle round, Represents the weight value sequence before update, which is , Represents the updated weight value sequence.

[0110] In an embodiment of the present application, based on the learning rate parameter corresponding to the current cycle round, the weight gradient of the initial clock offset for each window weight is fused to obtain the weight update amount of each window weight, and the difference between each window weight and the corresponding weight update amount is determined as the updated window weight value corresponding to each window weight, completing a weight update of each window weight in the time offset function, repeating the above steps, updating the time offset function, so that the time offset function gradually and accurately characterizes the characteristics of the window weight data, thereby improving the accuracy of the time offset function.

[0111] The above embodiment describes how to obtain the target clock offset. Next, the following describes how to determine different clock deviation adjustment strategies based on the target clock offset and different comparison results between the target clock offset and the preset step size.

[0112] In an exemplary embodiment, Figure 6 As shown, the target clock offset is compared with the preset step size to determine the adjustment step size and the adjustment time corresponding to the adjustment step size, including:

[0113] S601 : When a target clock offset is greater than a preset step size, determine at least a first adjustment step size and a second adjustment step size according to a ratio of the target clock offset to the preset step size.

[0114] by Characterize the target clock offset, Characterize the preset step size, if In this embodiment, the ratio of the target clock offset to the preset step size is rounded down to the integer value as the number of the first adjustment step size, and a second adjustment step size is determined.

[0115] S602: Determine the preset step length as the adjustment time of each first adjustment step length.

[0116] The adjustment time of each first adjustment step is set to the preset step, which means that the offset adjusted by the first adjustment step each time is , then the expression of the clock offset after each adjustment is:

[0117] (Formula 7)

[0118] in, 、 The clock offset before and after performing a first adjustment step.

[0119] S603: Determine an adjustment time for a second adjustment step according to the target clock offset and the adjustment time of each first adjustment step.

[0120] Specifically, the adjustment times of the first adjustment steps are superimposed, and the time difference between the target clock offset and the superimposed result is determined as the adjustment time of the second adjustment step.

[0121] For example, the number of the first adjustment step is m, where m is a positive integer greater than 1. The adjustment time of the second adjustment step is for:

[0122] (Formula 8)

[0123] Obviously, after the last adjustment of the first adjustment step is completed, the adjustment time of the second adjustment step is , must be less than or equal to the preset step size, that is , to ensure that the length of each adjustment step is less than or equal to the preset step length, preventing the clock deviation adjustment from diverging.

[0124] In an embodiment of the present application, when the target clock offset is greater than the preset step size, at least one first adjustment step size and a second adjustment step size are determined based on the ratio of the target clock offset to the preset step size, the preset step size is determined as the adjustment time of each first adjustment step size, and the adjustment time of the second adjustment step size is determined based on the target clock offset and the adjustment time of each first adjustment step size. In this way, through the distributed adjustment method, the convergence speed is improved while the divergence probability in the synchronization process is also reduced.

[0125] In an exemplary embodiment, comparing the target clock offset with a preset step size to determine the adjustment step size and the adjustment time corresponding to the adjustment step size includes:

[0126] When the target clock offset is less than or equal to the preset step size, a third adjustment step size is determined, and the target clock offset is determined as the adjustment time corresponding to the third adjustment step size.

[0127] by Characterize the target clock offset, Characterize the preset step length, then determine a single third adjustment step length, and set the adjustment time of the third adjustment step length to , one-time adjustment is made to achieve clock synchronization between the sampling edge of the sampling device and the reference signal.

[0128] In an exemplary embodiment, as shown in FIG7 , a clock deviation adjustment method is provided, comprising the following steps:

[0129] S701: Construct a clock offset function, where the clock offset function includes a window weight.

[0130] S702: Calculate the gradient of the clock offset function for each window weight.

[0131] S703: Update the window weights in the clock offset function according to the gradient of each window weight.

[0132] S704: Determine whether the clock offset function meets a convergence condition.

[0133] If not satisfied, return to step S702.

[0134] S705: If the conditions are met, output the clock offset of the clock offset function.

[0135] S706: Determine whether the clock offset is less than a preset step size.

[0136] S707: If not, perform multiple adjustments in steps to update the clock offset function, and return to step S706 until the updated clock offset is less than or equal to the preset step size.

[0137] S708: If yes, determine the clock offset as the adjustment step.

[0138] In an embodiment of the present application, the offset value between the sampling clock signal of the sampling device and the reference signal is optimized, which is applicable to minimizing the offset value in different scenarios, and the time step is adjusted based on the minimized loss function, which improves the convergence speed while also reducing the divergence probability during the synchronization process.

[0139] In an exemplary embodiment, a clock deviation adjustment method includes the following steps:

[0140] (1) Obtaining sampling parameters of the sampling device in a sliding time window; the sliding time window includes multiple time windows corresponding to the reference signals; the sampling parameters include the counting time interval of each time window and the accumulated count value of each time window.

[0141] (2) The sampling parameters of the sampling device in the sliding time window are input into the preset time offset function to obtain the initial clock offset; the time offset function includes the window weight of each time window.

[0142] Based on the window weight of each time window, the counting time gaps of each time window are fused to obtain the average time gap of the sampling device; the sampling time of the sampling device is obtained based on the average time gap of the sampling device and the accumulated count value of each time window; the difference between the sampling time and the sliding time of the sliding time window is determined as the overall clock offset of the sampling device in the sliding time window; the ratio between the overall clock offset and the number of windows in the sliding time window is calculated to obtain the initial clock offset.

[0143] (3) Calculate the weight gradient of the initial clock offset with respect to each window weight.

[0144] (4) Based on the learning rate parameter corresponding to the current cycle, the weight gradients of each window weight are fused to obtain the weight update amount of each window weight.

[0145] (5) For any window weight, the difference between the window weight and the weight update amount of the window weight is determined as the updated window weight value corresponding to the window weight, completing a weight update of each window weight in the time offset function.

[0146] (6) Determine whether the offset value corresponding to the updated time offset function meets the convergence condition. If not, execute the above steps (3) to (5) repeatedly, and update the weights of each window in the time offset function cyclically until the convergence condition is met. Execute step (7) to obtain the updated time offset function.

[0147] (7) The clock offset corresponding to the updated time offset function is determined as the target clock offset.

[0148] (8) Compare the target clock offset with the preset step size to determine the adjustment step size and the adjustment time corresponding to the adjustment step size.

[0149] (9) When the target clock offset is greater than the preset step size, at least one first adjustment step size and a second adjustment step size are determined according to the ratio of the target clock offset to the preset step size.

[0150] (10) Determining the preset step length as the adjustment time of each first adjustment step length; and superimposing the adjustment time of each first adjustment step length, and determining the time difference between the target clock offset and the superimposed result as the adjustment time of the second adjustment step length.

[0151] (11) When the target clock offset is less than or equal to the preset step size, a third adjustment step size is determined, and the target clock offset is determined as the adjustment time corresponding to the third adjustment step size.

[0152] (12) Adjust the sampling edge of the sampling device according to the adjustment time corresponding to the adjustment step.

[0153] In an embodiment of the present application, based on the sampling parameters of the sampling device in the sliding time window, the actual sampling duration of the sampling clock signal in the sampling device in the sliding time window is determined, and according to the actual sampling duration and the sliding time window, the target clock offset between the sampling clock signal and the reference signal in the unit time window is determined. Then, the clock offset is compared with the preset step size, and the preset step size is flexibly adjusted to determine a more accurate and reasonable adjustment step size suitable for the current clock deviation of the sampling device, as well as the adjustment time of each adjustment step size, so as to realize step-by-step adjustment of the sampling edge of the sampling device and improve the adjustment efficiency of the clock deviation.

[0154] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.

[0155] Based on the same inventive concept, embodiments of the present application also provide a clock deviation adjustment device for implementing the aforementioned clock deviation adjustment method. The solution provided by this device is similar to the solution described in the aforementioned method. Therefore, the specific limitations of one or more clock deviation adjustment device embodiments provided below can be found in the aforementioned limitations of the clock deviation adjustment method and are not further elaborated here.

[0156] In an exemplary embodiment, Figure 8 As shown, a clock deviation adjustment device is provided, including: an acquisition module 801, a determination module 802 and an adjustment module 803, wherein:

[0157] An acquisition module 801 is configured to acquire a target clock offset between a sampling clock signal and a reference signal based on sampling parameters of a sampling device in a sliding time window; the sliding time window includes time windows corresponding to multiple reference signals;

[0158] A determination module 802 is configured to compare the target clock offset with a preset step size to determine the number of adjustment steps and the adjustment time corresponding to the adjustment step size;

[0159] The adjustment module 803 is configured to adjust the sampling edge of the sampling device according to the adjustment time corresponding to the adjustment step.

[0160] In an exemplary embodiment, the acquisition module 801 includes: a function operation unit, a function update unit, and an offset determination unit, wherein:

[0161] A function operation unit is used to input the sampling parameters into a preset time offset function to obtain an initial clock offset; the time offset function includes a window weight of each time window;

[0162] A function updating unit, configured to cyclically update the weights of each window in the time offset function based on the initial clock offset until a convergence condition is met, thereby obtaining an updated time offset function;

[0163] The offset determination unit is configured to determine the clock offset corresponding to the updated time offset function as the target clock offset.

[0164] In an exemplary embodiment, the sampling parameters include a counting time gap of each time window and an accumulated count value of each time window; the function operation unit includes: a gap acquisition subunit, a time determination subunit, an offset determination subunit, and an offset calculation subunit, wherein:

[0165] The gap acquisition subunit is used to fuse the counting time gaps of each time window based on the window weight of each time window to obtain the average time gap of the sampling device;

[0166] A time determination subunit, configured to obtain a sampling time of the sampling device according to an average time interval of the sampling device and an accumulated count value of each time window;

[0167] an offset determination subunit, configured to determine a difference between a sampling time and a sliding time of the sliding time window as an overall clock offset of the sampling device in the sliding time window;

[0168] The offset calculation subunit is used to calculate the ratio between the overall clock offset and the number of windows in the sliding time window to obtain the initial clock offset.

[0169] In an exemplary embodiment, the function update unit includes: a gradient calculation subunit, a gradient fusion subunit and a weight update subunit, wherein:

[0170] A gradient calculation subunit, used to calculate the weight gradient of the initial clock offset for each window weight;

[0171] The gradient fusion subunit is used to fuse the weight gradients of each window weight based on the learning rate parameter corresponding to the current cycle round to obtain the weight update amount of each window weight;

[0172] The weight update subunit is used to determine the difference between the window weight and the weight update amount of the window weight as the updated window weight value corresponding to the window weight for any window weight, thereby completing a weight update of each window weight in the time offset function.

[0173] In an exemplary embodiment, the determination module 802 includes: a first step length determination unit, a first time determination unit, and a second time determination unit, wherein:

[0174] a first step length determining unit, configured to determine at least a first adjustment step length and a second adjustment step length according to a ratio of the target clock offset to the preset step length when the target clock offset is greater than the preset step length;

[0175] A first time determining unit, configured to determine a preset step length as an adjustment time for each first adjustment step length;

[0176] The second time determining unit is configured to determine the adjustment time of the second adjustment step according to the target clock offset and the adjustment time of each first adjustment step.

[0177] In an exemplary embodiment, the second time determination unit is further configured to superimpose the adjustment times of the first adjustment steps; and determine the time difference between the target clock offset and the superimposed result as the adjustment time of the second adjustment step.

[0178] In an exemplary embodiment, the determination module 802 includes: a second step determination unit, configured to determine a third adjustment step when the target clock offset is less than or equal to a preset step, and determine the target clock offset as the adjustment time corresponding to the third adjustment step.

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

[0180] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 9As shown. The computer device includes a processor, memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and 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 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 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 external devices. The communication interface of the computer device is used to communicate with external terminals via wired or wireless means, and the wireless means can be implemented via Wi-Fi, a mobile cellular network, near-field communication (NFC), or other technologies. When executed by the processor, the computer program implements a clock deviation adjustment method. The display unit of the computer device is used to form a visually visible image and can 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 casing, or an external keyboard, touchpad or mouse.

[0181] Those skilled in the art will understand that Figure 9 The structure shown in the figure is only a block diagram of a part of the 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 component arrangement.

[0182] In an exemplary embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in the above method embodiments when executing the computer program.

[0183] In an exemplary embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0184] In an exemplary embodiment, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0185] 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 regulations.

[0186] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. 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. In particular, any reference to memory, database, or other media used in the embodiments provided in this application can include at least one of non-volatile memory 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), magnetic 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. By way of illustration and not limitation, RAM can take various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the various embodiments provided herein may be, but are not limited to, general-purpose processors, central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), programmable logic devices (PLDs), quantum computing-based data processing logic devices, artificial intelligence (AI) processors, and the like.

[0187] The technical features of the above embodiments can be combined arbitrarily. In order 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 application.

[0188] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.

Claims

1. A clock deviation adjustment method, characterized in that: The method comprises: Obtaining a target clock offset between a sampling clock signal and a reference signal based on sampling parameters of a sampling device in a sliding time window; the sliding time window includes a plurality of time windows corresponding to the reference signals; Comparing the target clock offset with a preset step size to determine an adjustment step size and an adjustment time corresponding to the adjustment step size; The sampling edge of the sampling device is adjusted according to the adjustment time corresponding to the adjustment step.

2. The method according to claim 1, characterized in that The acquiring of a target clock offset between a sampling clock signal and a reference signal based on a sampling parameter of a sampling device in a sliding time window includes: Inputting the sampling parameters into a preset time offset function to obtain an initial clock offset; the time offset function includes a window weight of each time window; Based on the initial clock offset, cyclically updating each window weight in the time offset function until a convergence condition is met, thereby obtaining an updated time offset function; The clock offset corresponding to the updated time offset function is determined as the target clock offset.

3. The method according to claim 2, characterized in that The sampling parameters include the counting time interval of each time window and the accumulated count value of each time window; the inputting the sampling parameters into a preset time offset function to obtain the initial clock offset includes: Based on the window weights of the time windows, the counting time intervals of the time windows are integrated to obtain the average time interval of the sampling device; Obtaining a sampling time of the sampling device according to an average time interval of the sampling device and an accumulated count value of each time window; Determine the difference between the sampling time and the sliding time of the sliding time window as the overall clock offset of the sampling device in the sliding time window; The ratio of the overall clock offset to the number of windows in the sliding time window is calculated to obtain the initial clock offset.

4. The method according to claim 2, characterized in that The cyclically updating the window weights in the time offset function based on the initial clock offset includes: Calculating a weight gradient of the initial clock offset with respect to each of the window weights; Based on the learning rate parameter corresponding to the current cycle round, the weight gradients of the window weights are fused to obtain the weight update amount of the window weights; For any window weight, the difference between the window weight and the weight update amount of the window weight is determined as the updated window weight value corresponding to the window weight, completing a weight update of each window weight in the time offset function.

5. The method according to any one of claims 1 to 4, characterized in that The comparing the target clock offset with a preset step size to determine an adjustment step size and an adjustment time corresponding to the adjustment step size includes: When the target clock offset is greater than the preset step size, determining at least a first adjustment step size and a second adjustment step size according to a ratio of the target clock offset to the preset step size; Determining the preset step length as the adjustment time of each first adjustment step length; The adjustment time of the second adjustment step is determined according to the target clock offset and the adjustment time of each first adjustment step.

6. The method according to claim 5, characterized in that The determining the adjustment time of the second adjustment step according to the target clock offset and the adjustment time of each first adjustment step includes: superimposing the adjustment times of the first adjustment steps; The time difference between the target clock offset and the superposition result is determined as the adjustment time of the second adjustment step.

7. The method according to any one of claims 1 to 4, characterized in that The comparing the target clock offset with a preset step size to determine an adjustment step size and an adjustment time corresponding to the adjustment step size includes: In a case where the target clock offset is less than or equal to the preset step size, a third adjustment step size is determined, and the target clock offset is determined as the adjustment time corresponding to the third adjustment step size.

8. A clock deviation adjustment device, characterized in that: The device comprises: an acquisition module, configured to acquire a target clock offset between a sampling clock signal and a reference signal based on sampling parameters of a sampling device in a sliding time window; the sliding time window includes a plurality of time windows corresponding to the reference signals; a determination module, configured to compare the target clock offset with a preset step size, and determine the number of adjustment steps and the adjustment time corresponding to the adjustment step size; The adjustment module is used to adjust the sampling edge of the sampling device according to the adjustment time corresponding to the adjustment step.

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.