Time adjustment method, optical fiber link detection method and device, and electronic equipment
By calculating the transmission delay deviation after the change of the optical fiber link and adjusting the time of the communication equipment, the problem of low time synchronization accuracy caused by the change of the optical fiber link is solved, achieving high-precision time synchronization and reducing labor costs.
Patent Information
- Application Number
- CN202310368774.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-28
- Publication Date
- 2024-10-01
AI Technical Summary
When the optical fiber link between communication devices changes, the existing technology is difficult to accurately calculate the time deviation, resulting in low time synchronization accuracy and affecting business availability.
By calculating the deviation between the transmission delay from the first communication device to the second communication device and the transmission delay from the second communication device to the first communication device, the time deviation is adjusted to remove the impact of changes in the optical fiber link, and The time of the first communication device is adjusted according to the adjusted deviation, thereby improving the accuracy of time synchronization.
There is no need for manual measurement and recalculation of time deviations, which reduces costs and promptly eliminates the impact of fiber link changes on time synchronization, improving business availability.
Smart Images

Figure CN118740303A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a time adjustment method, an optical fiber link detection method and device, and an electronic device. Background Art
[0002] When the first communication device and the second communication device are connected via an optical transport network, the time of the slave devices in the first communication device and the second communication device is usually adjusted to maintain time synchronization between the first communication device and the second communication device.
[0003] Assuming that the first communication device is a slave device and the second communication device is a master device, the method of adjusting the time of the slave device generally includes: the first communication device and the second communication device interact with each other through precision time protocol (PTP) messages, the first communication device calculates the time deviation between the first communication device and the second communication device according to the sending time and receiving time of the PTP message during the interaction, and then the first communication device uses the time deviation to adjust the local time of the first communication device.
[0004] If the optical fiber link between the first communication device and the second communication device changes, the change will cause a change in the transmission delay from the first communication device to the second communication device and / or the transmission delay from the second communication device to the first communication device. Since the difference between the transmission delay from the first communication device to the second communication device and the transmission delay from the second communication device to the first communication device is taken as a fixed value in the process of calculating the time deviation between the first communication device and the second communication device, the change is likely to cause the calculated deviation time to be inaccurate, thereby causing the accuracy of the time synchronization between the first communication device and the second communication device to be low, affecting the availability of the service between the first communication device and the second communication device. Summary of the invention
[0005] The present application provides a time adjustment method, an optical fiber link detection method and apparatus, and an electronic device, which can improve the accuracy of time synchronization between a first communication device and a second communication device when a change occurs in the optical fiber link between the first communication device and the second communication device.
[0006] In a first aspect, the present application provides a time adjustment method, the method comprising: determining that a fiber optic link between a first communication device and a second communication device has changed; calculating a delay deviation, the delay deviation being the deviation between a first transmission delay from the first communication device to the second communication device and a second transmission delay from the second communication device to the first communication device; adjusting a first time deviation between the first communication device and the second communication device according to the delay deviation to obtain a second time deviation; and adjusting the time of the first communication device according to the second time deviation.
[0007] In the present application, when the optical fiber link between the first communication device and the second communication device changes, the first time deviation between the first communication device and the second communication device is adjusted by using the deviation between the first transmission delay from the first communication device to the second communication device and the second transmission delay from the second communication device to the first communication device, so as to remove the influence of the change in the optical fiber link between the first communication device and the second communication device in the first time deviation, and then adjust the time of the first communication device according to the adjusted second time deviation, so as to improve the accuracy of time synchronization between the first communication device and the second communication device.
[0008] There is no need to manually measure the time deviation between the first communication device and the second communication device after the optical fiber link changes, which helps to reduce labor costs. In addition, it can promptly eliminate the impact of changes in the optical fiber link and reduce the adverse effects of low time synchronization accuracy on the business.
[0009] Here, the first communication device may be referred to as a slave device, and the second communication device may be referred to as a master device.
[0010] In a possible implementation, whether the optical fiber link changes can be determined based on the average path delay between the first communication device and the second communication device. The average path delay is used to indicate the sum of the first delay and the second delay, the first delay is used to indicate the delay of the second communication device transmitting the first Precision Time Protocol PTP message to the first communication device via the optical fiber link, and the second delay is used to indicate the delay of the first communication device transmitting the second PTP message to the second communication device via the optical fiber link.
[0011] Since the first delay includes the transmission delay of the first PTP message on the optical fiber link and the time deviation between the first communication device and the second communication device. The second delay includes the transmission delay of the second PTP message on the optical fiber link and the time deviation between the first communication device and the second communication device. The first delay and the second delay are added together to eliminate the time deviation between the first communication device and the second communication device. Therefore, the average path delay is only related to the transmission delay from the first communication device to the second communication device and the transmission delay from the second communication device to the first communication device. If the optical fiber link between the first communication device and the second communication device does not change, the average path delay between the first communication device and the second communication device will not change.
[0012] Exemplarily, the average path delay can be determined in the following manner: determine the first delay based on a first time and a second time, the first time being the time when the second communication device sends the first PTP message, and the second time being the time when the first communication device receives the first PTP message; determine the second delay based on a third time and a fourth time, the third time being the time when the first communication device sends the second PTP message, and the fourth time being the time when the second communication device receives the second PTP message; and determine the sum of the first delay and the second delay as the average path delay.
[0013] In this way, the average path delay can be calculated by exchanging PTP messages using the IEEE1588 time synchronization protocol, and the implementation is simple.
[0014] In some examples, when the difference between the first average path delay and the second average path delay is greater than a threshold, it is determined that the optical fiber link between the first communication device and the second communication device has changed, and the first average path delay and the second average path delay are two determined average path delays. In other examples, when the difference between the first average path delay and the second average path delay is less than or equal to a threshold, it is determined that the optical fiber link between the first communication device and the second communication device has not changed.
[0015] Exemplarily, the threshold may be set according to actual needs, for example, may be equal to 0.
[0016] In some examples, the calculation of the delay deviation includes: determining a third delay based on a fifth time and a sixth time, the fifth time being the time when the second communication device sends a third PTP message, and the sixth time being the time when the first communication device receives the third PTP message; determining a fourth delay based on a seventh time and an eighth time, the seventh time being the time when the first communication device sends a fourth PTP message, and the eighth time being the time when the second communication device receives the fourth PTP message; and determining the difference between the third delay and the fourth delay as the delay deviation.
[0017] Optionally, adjusting a first time deviation between the first communication device and the second communication device according to the time delay deviation to obtain a second time deviation includes: adjusting the first time deviation according to half of the time delay deviation to obtain the second time deviation.
[0018] When the system is started, the difference between the transmission delay from the first communication device to the second communication device and the transmission delay from the second communication device to the first communication device is determined through manual measurement and substituted into the time deviation calculation formula as a fixed value. Therefore, if there is no change in the optical fiber link, the time deviation between the first communication device and the second communication device can be basically maintained at 0.
[0019] When the optical fiber link changes, the calculated time deviation between the first communication device and the second communication device is basically caused by the change of the optical fiber link. Therefore, the delay deviation between the transmission delay from the first communication device to the second communication device and the transmission delay from the second communication device to the first communication device after the change of the optical fiber link can be determined based on the time deviation calculated at the fifth time, the sixth time, the seventh time and the eighth time at this time. The time deviation is compensated by the delay deviation to eliminate the influence of the change of the optical fiber link in the time deviation calculated based on the fifth time, the sixth time, the seventh time and the eighth time at this time, so as to maintain the time synchronization between the first communication device and the second communication device.
[0020] The fifth time, sixth time, seventh time and eighth time can respectively determine the first time, second time, third time and fourth time when the optical fiber link changes; or, to determine the first time, second time, third time and fourth time corresponding to the PTP message of the next cycle interaction after the optical fiber link changes.
[0021] In a second aspect, the present application provides a method for monitoring an optical fiber link. The method includes: determining an average path delay between a first communication device and a second communication device, the average path delay being used to indicate the sum of a first delay and a second delay, the first delay being used to indicate a delay in the second communication device transmitting a first PTP message to the first communication device via an optical fiber link, and the second delay being used to indicate a delay in the first communication device transmitting a second PTP message to the second communication device via the optical fiber link; and determining whether the optical fiber link between the first communication device and the second communication device has changed based on the average path delay.
[0022] In the present application, there is no need to manually measure the time deviation between the first communication device and the second communication device after the optical fiber link changes, which is conducive to reducing labor costs, and can promptly eliminate the impact of changes in the optical fiber link and reduce the adverse effects of low time synchronization accuracy on the business.
[0023] For related content, please refer to the first aspect and detailed description is omitted here.
[0024] In a third aspect, the present application provides a time adjustment device, which has the function of implementing the method described in the first aspect or any optional method of the first aspect. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more units corresponding to the above functions.
[0025] In a fourth aspect, the present application further provides a fiber link monitoring device, which has the function of implementing the method described in the second aspect or any optional method of the second aspect. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more units corresponding to the above functions.
[0026] In a fifth aspect, an electronic device is provided. The electronic device includes a processor and a memory. The memory is used to store software programs and modules. The processor implements the method in the first aspect or any possible implementation of the first aspect by running or executing the software program and / or module stored in the memory, or implements the method in the second aspect or any possible implementation of the second aspect.
[0027] Optionally, the number of the processors is one or more, and the number of the memories is one or more.
[0028] Optionally, the memory may be integrated with the processor, or the memory may be provided separately from the processor.
[0029] In the specific implementation process, the memory can be a non-transitory memory, such as a read-only memory (ROM), which can be integrated with the processor on the same chip or can be set on different chips. This application does not limit the type of memory and the setting method of the memory and the processor.
[0030] In a sixth aspect, a computer program product is provided. The computer program product includes computer program code, and when the computer program code is executed by a computer, the computer executes the method in the first aspect or any possible implementation of the first aspect, or executes the method in the second aspect or any possible implementation of the second aspect.
[0031] In the seventh aspect, the present application provides a computer-readable storage medium, which is used to store program codes executed by a processor, wherein the program code includes instructions for implementing the method in any possible implementation of the first aspect above, or includes instructions for implementing the method in any possible implementation of the second aspect above or the second aspect.
[0032] In an eighth aspect, a chip is provided, comprising a processor, wherein the processor is used to call and execute instructions stored in a memory from the memory, so that an electronic device equipped with the chip executes a method in any possible implementation of the first aspect above, or executes a method in any possible implementation of the second aspect above or the second aspect.
[0033] In a ninth aspect, another chip is provided. The another chip includes an input interface, an output interface, a processor, and a memory. The input interface, the output interface, the processor, and the memory are connected via an internal connection path. The processor is used to execute the code in the memory, and when the code is executed, the processor is used to execute the method in any possible implementation of the first aspect above, or execute the method in the second aspect above or any possible implementation of the second aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 It is a structural schematic diagram of an application scenario provided by an embodiment of the present application;
[0035] Figure 2 It is a schematic diagram of the interaction process of the PTP message provided in the embodiment of the present application;
[0036] Figure 3 is a flow chart of a method for monitoring an optical fiber link provided in an embodiment of the present application;
[0037] Figure 4 is a flow chart of a time adjustment method provided in an embodiment of the present application;
[0038] Figure 5 is a block diagram of an optical fiber link monitoring device provided in an embodiment of the present application;
[0039] Figure 6 is a block diagram of a time adjustment device provided in an embodiment of the present application;
[0040] Figure 7 It is a structural diagram of a network device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0041] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0042] Figure 1 is a schematic diagram of an application scenario provided by an embodiment of the present application. Figure 1 As shown in the figure, the operator network is built on the optical transport network (OTN). The operator network includes multiple communication devices, and the OTN includes multiple OTN devices (such as O1 to O4). Adjacent OTN devices are connected by optical fibers. OTN is used to provide an optical fiber link for two communication devices to realize communication between the two communication devices.
[0043] Here, the communication device may be a data communication device, including but not limited to a terminal device, a routing device, a switching device or a gateway device, etc.
[0044] The following is an illustrative description using the communication device as a routing device. Figure 1 As shown in the figure, the operator network includes multiple core network devices (provider, P) (P1~P4) and core network edge devices (provider edge, PE) (such as PE1 and PE2). Each core network device can be connected to an OTN device and access the OTN through the connected OTN device. In this way, the message sent by a core network device can be sent to another core network device through OTN.
[0045] In some examples, there are two OTN devices on the optical fiber link between two communication devices. For example, there are two OTN devices O1 and O4 on the optical fiber link between P1 and P4. In this way, the message sent by P1 passes through O1 and O4 before reaching P4.
[0046] In other examples, there are more than two OTN devices on the optical fiber link between two communication devices. For example, there are three OTN devices on the optical fiber link between P1 and P4, namely O1, O3 and O4. The message sent by P1 is transmitted to P4 through O1, O3 and O4 in sequence.
[0047] In order to ensure the service performance between each communication device, it is necessary to ensure the time synchronization between the communication devices. Generally, the time deviation between two communication devices can be calculated based on the PTP message, and the time of the slave device in the two communication devices is adjusted using the time deviation to ensure that the time synchronization performance between the two communication devices meets the requirements.
[0048] Combine the following Figure 2 The interaction process of PTP messages between the master device and the slave device is described. In the embodiment of the present application, the master device may be Figure 1 Any communication device in the network, and the master device can be pre-designated or automatically selected by multiple communication devices according to set rules.
[0049] The PTP message interaction process between the master device and the slave device includes but is not limited to the following three types. Figure 2 Part (a) shows the first and second interaction processes. Figure 2 Part (b) shows the third interaction process.
[0050] The first one:
[0051] like Figure 2 As shown in part (a), the master device sends a synchronization (sync) message to the slave device. The synchronization message carries a first timestamp, and the first timestamp is used to indicate the time when the master device sends the synchronization message. The time indicated by the first timestamp in the synchronization message is an estimated time. The slave device receives the synchronization message and generates a second timestamp to indicate the time when the synchronization message is received. The slave device sends a request (req) message to the master device and generates a third timestamp to record the time when the request message is sent. The master device receives the request message and then sends a response (resp) message to the slave device, and the response message carries a fourth timestamp, and the fourth timestamp is used to indicate the time when the master device receives the request message.
[0052] Second type:
[0053] like Figure 2As shown in part (a), the master device sends a synchronization message and a follow message to the slave device. The follow message is sent after the synchronization message, and the follow message carries a first timestamp, which is used to indicate the time when the master device sent the synchronization message. The slave device receives the synchronization message and generates a second timestamp indicating the time when the synchronization message is received. The slave device sends a request message to the master device and generates a third timestamp for recording the time when the request message is sent. The master device receives the request message and then sends a response message to the slave device, and the response message carries a fourth timestamp, which is used to indicate the time when the master device receives the request message.
[0054] The third type:
[0055] like Figure 2 As shown in part (b), the slave device sends a request message to the master device and records a first timestamp indicating the time when the request message was sent. The master device receives the request message and then sends a response message to the slave device, the response message carrying a second timestamp and a third timestamp, the second timestamp indicating the time when the master device receives the request message, and the third timestamp indicating the time when the master device sends the response message. The slave device receives the response message and records the fourth timestamp indicating the time when the slave device receives the response message.
[0056] The time deviation between the master device and the slave device can be calculated based on the first to fourth timestamps, and the local time of the slave device can be adjusted based on the time deviation so that the time of the slave device is consistent with that of the master device.
[0057] For the first and second cases, the time deviation between the master device and the slave device can be calculated according to the following formula (1):
[0058] offset = ((t2-t1)- (t4-t3)) / 2 - (delay_MS- delay_SM) / 2 (1)
[0059] For the third case, the time deviation between the master device and the slave device can be calculated according to the following formula (2):
[0060] offset = ((t4-t3)- (t2-t1)) / 2 - (delay_MS- delay_SM) / 2 (2)
[0061] In formulas (1) and (2), offset represents the time deviation, t1 represents the time indicated by the first timestamp, t2 represents the time indicated by the second timestamp, t3 represents the time indicated by the third timestamp, t4 represents the time indicated by the fourth timestamp, delay_MS represents the transmission delay from the master device to the slave device, and delay_SM represents the transmission delay from the slave device to the master device.
[0062] The value of delay_MS is related to the length of the fiber link from the master device to the slave device, and the value of delay_SM is related to the length of the fiber link from the slave device to the master device.
[0063] When the system is started, the staff will determine the difference between delay_MS and delay_SM in formulas (1) and (2) by measurement, and substitute it into the above formulas (1) and (2). In this way, the time deviation between the master device and the slave device can be calculated according to the above formula (1) or (2), and the time synchronization between the master device and the slave device can be maintained based on the time deviation.
[0064] If the optical fiber link between two communication devices changes during system operation, for example, the optical fiber between the OTN device O1 connected to P1 and the ONT device O4 connected to P4 is disconnected, before the disconnection, there are two OTN devices, O1 and O4, on the optical fiber link between P1 and P4; after the disconnection, the optical layer device is switched, and the optical fiber link between P1 and P4 (such as Figure 1 There are three OTN devices on the network, namely O1, O3 and O4. In this case, the change of the optical fiber link causes the difference between delay_MS and delay_SM to change. If the time deviation between the two communication devices is still calculated according to the above formula, the calculated time deviation is inaccurate, resulting in a decrease in the time synchronization performance between the two communication devices.
[0065] The embodiment of the present application provides a method for monitoring an optical fiber link, which can monitor changes in the optical fiber link based on the relevant time (sending time and receiving time) of the PTP message. In addition, the embodiment of the present application also provides a time adjustment method, which is conducive to improving the accuracy of time synchronization of two communication devices when the optical fiber link between the two communication devices changes.
[0066] Figure 3 1 is a flow chart of a method for monitoring an optical fiber link provided in an embodiment of the present application. Figure 3As shown, the method includes the following steps 11 to 12. The method can be performed by the first communication device or the second communication device, or by other communication devices (which can be called link monitoring devices) other than the first communication device and the third communication device. The following is an exemplary description taking the first communication device as a slave device and the second communication device as a master device as an example.
[0067] 11: Determine an average path delay between the first communication device and the second communication device.
[0068] The average path delay is used to indicate the sum of the first delay and the second delay.
[0069] The first delay is used to indicate the delay of the second communication device transmitting the first PTP message to the first communication device via the optical fiber link. The first delay includes the transmission delay of the first PTP message on the optical fiber link and the time deviation between the first communication device and the second communication device.
[0070] The second delay is used to indicate the delay of the first communication device transmitting the second PTP message to the second communication device via the optical fiber link. The second delay includes the transmission delay of the second PTP message on the optical fiber link and the time deviation between the first communication device and the second communication device.
[0071] In step 11, the average path delay may be periodically determined to monitor whether the average path delay changes. Periodically means that the average path delay between the first communication device and the second communication device is determined multiple times at a set time interval. Here, the time interval may be set as needed, and the embodiment of the present application does not limit this. Exemplarily, the time interval may be in milliseconds, for example, 1 ms, or the time interval may be in microseconds, for example, 1 μs, etc.
[0072] Each time the average path delay between the first communication device and the second communication device is determined, the following method can be used: determine the first delay based on the first time and the second time, the first time is the time when the second communication device sends the first PTP message, and the second time is the time when the first communication device receives the first PTP message; determine the second delay based on the third time and the fourth time, the third time is the time when the first communication device sends the second PTP message, and the fourth time is the time when the second communication device receives the second PTP message; determine the sum of the first delay and the second delay as the average path delay.
[0073] The first time delay may be equal to the second time minus the first time, that is, the first time delay may be calculated according to formula (3):
[0074] T2-T1 = delay_MS + offset (3)
[0075] In formula (3), T2 represents the second time, T1 represents the first time, delay_MS represents the transmission delay from the master device to the slave device, and offset represents the time deviation.
[0076] The second time delay may be equal to the fourth time minus the third time, that is, the second time delay may be calculated according to formula (4):
[0077] T4-T3 = delay_SM – offset (4)
[0078] In formula (4), T4 represents the fourth time, T3 represents the third time, delay_SM represents the transmission delay from the slave device to the master device, and offset represents the time deviation.
[0079] According to formula (3) and formula (4), formula (5) can be obtained:
[0080] meanpath delay = delay_MS+ delay_SM=(T2 – T1)+(T4 – T3) (5)
[0081] In formula (5), meanpath delay represents the average path delay, and delay_MS, delay_SM, and T1 to T4 have the same meanings as in formulas (3) and (4).
[0082] It can be seen that the average path delay is only related to the transmission delay from the first communication device to the second communication device and the transmission delay from the second communication device to the first communication device. If the optical fiber link between the first communication device and the second communication device does not change, the average path delay between the first communication device and the second communication device will not change. If the optical fiber link between the first communication device and the second communication device changes, and causes the transmission delay from the first communication device to the second communication device and the transmission delay from the second communication device to the first communication device to change, the average path delay between the first communication device and the second communication device will also change. It can be seen that the change in the average path delay between the first communication device and the second communication device can reflect the change in the optical fiber link between the first communication device and the second communication device.
[0083] Optionally, in the first or second case, the first PTP message may be the aforementioned synchronization message, and the second PTP message may be the aforementioned request message; in the third case, the second PTP message may be the aforementioned request message, and the first PTP message may be the aforementioned response message.
[0084] 12: Determine whether a fiber optic link between the first communication device and the second communication device changes according to the average path delay.
[0085] In the embodiment of the present application, the change of the optical fiber link mainly refers to the change of the length of the optical fiber link.
[0086] In the embodiment of the present application, the reasons why the optical fiber link between the first communication device and the second communication device changes include but are not limited to the following two:
[0087] In the first case, a fiber disconnection in a fiber link between a first communication device and a second communication device causes a link change.
[0088] The second type is switching of OTN devices in optical fiber links between the first communication device and the second communication device.
[0089] It can be seen that the change in the length of the optical fiber link between the first communication device and the second communication device indicates that the network topology of the network where the first communication device and the second communication device are located may have changed.
[0090] In step 12, when the difference between the first average path delay and the second average path delay is greater than a threshold value, it is determined that the length of the optical fiber link between the first communication device and the second communication device has changed; or, when the difference between the first average path delay and the second average path delay is less than or equal to the threshold value, it is determined that the length of the optical fiber link between the first communication device and the second communication device has not changed.
[0091] Here, the first average path delay and the second average path delay are two determined average path delays. In some examples, the first average path delay and the second average path delay are two average path delays determined twice in succession. In other examples, the first average path delay may be referred to as a reference average path delay, which may be an initial reference average path delay set or an average path delay determined when the length of the optical fiber link is most recently determined to have changed, and the second average path delay is the currently determined average path delay.
[0092] The threshold may be determined according to the tolerance of the communication system to time deviation and may be set according to actual scenarios.
[0093] In some examples, the threshold may be 0, that is, once the average path delay changes, it is determined that the length of the optical fiber link between the first communication device and the second communication device changes.
[0094] Optionally, the method further includes: outputting prompt information, where the prompt information is used to prompt that a change has occurred in the optical fiber link between the first communication device and the second communication device.
[0095] In some examples, the way of outputting the prompt information includes but is not limited to outputting text, graphics and other information on a display device, or outputting voice prompt information, etc. The embodiment of the present application does not limit the way of outputting the prompt information, as long as it can play a prompting role.
[0096] This prompt information can remind the staff to check and maintain the network topology in time.
[0097] In the embodiment of the present application, by periodically sending PTP messages and determining the average path delay between the first communication device and the second communication device based on the PTP messages, it is possible to determine whether the optical fiber link between the first communication device and the second communication device has changed based on the average path delay. In this way, automatic identification of optical fiber link changes in the network operation state can be achieved.
[0098] Figure 4 is a flow chart of a time adjustment method provided in an embodiment of the present application. Figure 4 As shown, the method includes the following steps 41 to 48. In this embodiment, the second communication device is a master device, and the first communication device is a slave device. The method can be executed by the first communication device.
[0099] 41: Get first time, second time, third time, and fourth time.
[0100] 42: Determine whether a fiber link between the first communication device and the second communication device changes based on the first time, the second time, the third time, and the fourth time.
[0101] If it is determined that the optical fiber link between the first communication device and the second communication device has changed, steps 43 to 46 are executed; if it is determined that the optical fiber link between the first communication device and the second communication device has not changed, steps 47 to 48 are executed.
[0102] The steps 41 and 42 may be performed by Figure 3 The method shown is implemented, and the detailed process can be seen in Figure 3 It should be noted that, in other embodiments, in addition to determining whether the optical fiber link has changed based on the first time to the fourth time, other methods of monitoring network topology changes may be used to monitor whether the optical fiber link between the first communication device and the second communication device has changed.
[0103] 43: Calculate a delay deviation, where the delay deviation is a deviation between a first transmission delay from the first communication device to the second communication device and a second transmission delay from the second communication device to the first communication device.
[0104] The delay deviation is introduced due to the change of the optical fiber link between the first communication device and the second communication device.
[0105] In some examples, step 43 includes:
[0106] The first step is to determine the third delay according to the fifth time and the sixth time, the fifth time is the time when the second communication device sends the third PTP message, and the sixth time is the time when the first communication device receives the third PTP message; in the first step, the third delay can be equal to the difference between the sixth time and the fifth time.
[0107] The second step is to determine the fourth delay according to the seventh time and the eighth time, where the seventh time is the time when the first communication device sends the fourth PTP message, and the eighth time is the time when the second communication device receives the fourth PTP message; in the second step, the fourth delay can be equal to the difference between the eighth time and the seventh time.
[0108] Step 3: Determine the difference between the third delay and the fourth delay as the delay deviation.
[0109] 44: Calculate a first time offset between the first communication device and the second communication device according to the fifth time, the sixth time, the seventh time and the eighth time.
[0110] 45: The sum of half of the delay deviation and the first time deviation is taken as the second time deviation.
[0111] Through steps 44 and 45, it is possible to adjust the first time offset between the first communication device and the second communication device according to the delay offset to obtain the second time offset.
[0112] Optionally, the fifth time, the sixth time, the seventh time and the eighth time in steps 42 and 43 may be respectively Figure 3 In the method shown, the first time, the second time, the third time and the fourth time when the optical fiber link changes are determined; or Figure 3 In the method shown, the relevant time of the PTP message exchanged in the next cycle after the optical fiber link changes is determined.
[0113] 46: Adjust the time of the first communication device according to the second time deviation.
[0114] As mentioned above, when the system is started, the difference between the transmission delay from the first communication device to the second communication device and the transmission delay from the second communication device to the first communication device is determined through manual measurement and substituted into the time deviation calculation formula as a fixed value. Therefore, if there is no change in the optical fiber link, the time deviation between the first communication device and the second communication device can be basically maintained at 0.
[0115] When the optical fiber link changes, the calculated time deviation between the first communication device and the second communication device is basically caused by the change of the optical fiber link. Therefore, the delay deviation between the transmission delay from the first communication device to the second communication device and the transmission delay from the second communication device to the first communication device after the change of the optical fiber link can be determined based on the time deviation calculated at the fifth time, the sixth time, the seventh time and the eighth time at this time. The time deviation is compensated by the delay deviation to eliminate the influence of the change of the optical fiber link in the time deviation calculated based on the fifth time, the sixth time, the seventh time and the eighth time at this time, so as to maintain the time synchronization between the first communication device and the second communication device.
[0116] 47: Calculate a first time offset between the first communication device and the second communication device according to the first time, the second time, the third time and the fourth time.
[0117] 48: Adjust the time of the first communication device according to the first time deviation.
[0118] During the operation of the system, the time of the slave device may be offset. When the optical fiber link does not change, the time of the slave device (i.e., the first communication device) can be continuously adjusted through steps 47 and 48 to synchronize the time of the slave device with the time of the master device.
[0119] In an embodiment of the present application, when the optical fiber link between the first communication device and the second communication device changes, the first time deviation between the first communication device and the second communication device is adjusted by using the deviation between the first transmission delay from the first communication device to the second communication device and the second transmission delay from the second communication device to the first communication device, so as to remove the influence of the change in the optical fiber link between the first communication device and the second communication device in the first time deviation, and then adjust the time of the first communication device according to the adjusted second time deviation, so as to maintain the time synchronization between the first communication device and the second communication device.
[0120] Since the time deviation between the first communication device and the second communication device can be automatically adjusted, there is no need to manually measure the time deviation between the first communication device and the second communication device again after the optical fiber link changes, which is beneficial to reducing labor costs and can promptly eliminate the impact of changes in the optical fiber link and reduce the adverse effects of low time synchronization accuracy on the business.
[0121] Figure 51 is a block diagram of a time adjustment device provided in an embodiment of the present application. The time adjustment device can be implemented as all or part of the first communication device or the second communication device through software, hardware or a combination of both. The time adjustment device may include: a determination unit 501, a calculation unit 502 and an adjustment unit 503.
[0122] The determination unit 501 is used to determine that a fiber link between a first communication device and a second communication device has changed. The calculation unit 502 is used to calculate a delay deviation, which is a deviation between a first transmission delay from the first communication device to the second communication device and a second transmission delay from the second communication device to the first communication device. The adjustment unit 503 is used to adjust a first time deviation between the first communication device and the second communication device according to the delay deviation to obtain a second time deviation; and adjust the time of the first communication device according to the second time deviation.
[0123] Optionally, the determination unit 501 includes: a first determination subunit 5011 and a second determination subunit 5012. The first determination subunit 5011 is used to determine the average path delay between the first communication device and the second communication device, the average path delay is used to indicate the sum of the first delay and the second delay, the first delay is used to indicate the delay of the second communication device transmitting the first PTP message to the first communication device via the optical fiber link, and the second delay is used to indicate the delay of the first communication device transmitting the second PTP message to the second communication device via the optical fiber link. The second determination subunit 5012 is used to determine that the optical fiber link between the first communication device and the second communication device has changed according to the average path delay.
[0124] Optionally, the first determination subunit 5011 is used to determine a first delay based on a first time and a second time, the first time being the time when the second communication device sends a first PTP message, and the second time being the time when the first communication device receives the first PTP message; determine a second delay based on a third time and a fourth time, the third time being the time when the first communication device sends a second PTP message, and the fourth time being the time when the second communication device receives the second PTP message; and determine the sum of the first delay and the second delay as the average path delay.
[0125] Optionally, the second determination subunit 5012 is used to determine that a change has occurred in the optical fiber link between the first communication device and the second communication device when the difference between the first average path delay and the second average path delay is greater than a threshold, and the first average path delay and the second average path delay are two determined average path delays.
[0126] Optionally, the calculation unit 502 is used to determine a third delay according to a fifth time and a sixth time, the fifth time being the time when the second communication device sends a third PTP message, and the sixth time being the time when the first communication device receives the third PTP message; determine a fourth delay according to a seventh time and an eighth time, the seventh time being the time when the first communication device sends a fourth PTP message, and the eighth time being the time when the second communication device receives the fourth PTP message; and determine the difference between the third delay and the fourth delay as the delay deviation.
[0127] Optionally, the adjusting unit 503 is configured to adjust the first time deviation according to half of the delay deviation to obtain a second time deviation.
[0128] It should be noted that the time adjustment device provided in the above embodiment only uses the division of the above functional units as an example when performing time adjustment. In actual applications, the above functions can be assigned to different functional units as needed, that is, the internal structure of the device is divided into different functional units to complete all or part of the functions described above. In addition, the time adjustment device provided in the above embodiment and the time adjustment method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0129] Figure 6 1 is a block diagram of an optical fiber link monitoring device provided in an embodiment of the present application. The optical fiber link monitoring device can be implemented as all or part of the first communication device, the second communication device or the link monitoring device through software, hardware or a combination of both. The link monitoring device is an independent electronic device other than the first communication device and the second communication device. The optical fiber link monitoring device may include: a path delay determination unit 601 and a change determination unit 602.
[0130] The path delay determination unit 601 is used to determine the average path delay between the first communication device and the second communication device, the average path delay is used to indicate the sum of the first delay and the second delay, the first delay is used to indicate the delay of the second communication device transmitting the first PTP message to the first communication device via the optical fiber link, and the second delay is used to indicate the delay of the first communication device transmitting the second PTP message to the second communication device via the optical fiber link. The change determination unit 602 is used to determine whether the optical fiber link between the first communication device and the second communication device has changed according to the average path delay.
[0131] Optionally, the path delay determination unit 601 includes: a first delay determination subunit 6011 , a second delay determination subunit 6012 and a path delay determination subunit 6013 .
[0132] The first delay determination subunit 6011 is used to determine the first delay according to the first time and the second time, the first time is the time when the second communication device sends the first PTP message, and the second time is the time when the first communication device receives the first PTP message. The second delay determination subunit 6012 is used to determine the second delay according to the third time and the fourth time, the third time is the time when the first communication device sends the second PTP message, and the fourth time is the time when the second communication device receives the second PTP message. The path delay determination subunit 6013 is used to determine the sum of the first delay and the second delay as the average path delay.
[0133] In some examples, the change determination unit 602 is used to determine that a change has occurred in the optical fiber link between the first communication device and the second communication device when the difference between the first average path delay and the second average path delay is greater than a threshold, and the first average path delay and the second average path delay are the two determined average path delays.
[0134] In other examples, the change determination unit 602 is used to determine that the optical fiber link between the first communication device and the second communication device has not changed when the difference between the first average path delay and the second average path delay is less than or equal to a threshold.
[0135] Optionally, the apparatus further includes: an output unit 603. The output unit 603 is used to output prompt information, where the prompt information is used to prompt that the length of the optical fiber link between the first communication device and the second communication device has changed.
[0136] It should be noted that the optical fiber link monitoring device provided in the above embodiment only uses the division of the above functional units as an example when monitoring the optical fiber link. In actual applications, the above functions can be assigned to different functional units as needed, that is, the internal structure of the device can be divided into different functional units to complete all or part of the functions described above. In addition, the optical fiber link monitoring device provided in the above embodiment belongs to the same concept as the optical fiber link monitoring method embodiment. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0137] The descriptions of the processes corresponding to the above-mentioned figures have different emphases. For parts that are not described in detail in a certain process, please refer to the relevant descriptions of other processes.
[0138] Figure 7 700 is a schematic diagram of the structure of an electronic device 700 provided in an embodiment of the present application. The electronic device 700 includes at least one processor 701 , a memory 702 , and at least one network interface 703 .
[0139] Optionally, the electronic device 700 is a single physical computer. Alternatively, the electronic device 700 includes multiple physical computers, and at least one processor 701, a memory 702, and at least one network interface 703 of the electronic device 700 are distributed on different physical computers. For example, the electronic device 700 is a cluster computer.
[0140] The processor 701 is, for example, a general-purpose central processing unit (CPU), a network processor (NP), a graphics processing unit (GPU), a neural-network processing unit (NPU), a data processing unit (DPU), a microprocessor, or one or more integrated circuits for implementing the scheme of the present application. For example, the processor 701 includes an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD is, for example, a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0141] The memory 702 is, for example, a read-only memory (ROM) or other static storage device that can store static information and instructions, a random access memory (RAM) or other dynamic storage device that can store information and instructions, an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. Optionally, the memory 702 exists independently and is connected to the processor 701 through the internal connection 704. Alternatively, the memory 702 and the processor 701 are optionally integrated together.
[0142] The network interface 703 uses any transceiver-like device for communicating with other devices or communication networks. The network interface 703 includes, for example, at least one of a wired network interface or a wireless network interface. The wired network interface is, for example, an Ethernet interface. The Ethernet interface is, for example, an optical interface, an electrical interface, or a combination thereof. The wireless network interface is, for example, a wireless local area network (WLAN) interface, a cellular network interface, or a combination thereof.
[0143] In some embodiments, the processor 701 includes one or more CPUs, such as Figure 7 CPU0 and CPU1 are shown in the figure.
[0144] In some embodiments, the electronic device 700 optionally includes multiple processors, such as Figure 7 , processor 701 and processor 705 are shown in FIG. Each of these processors is, for example, a single-CPU, or a multi-CPU. The processor herein optionally refers to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions).
[0145] In some embodiments, the electronic device 700 further includes an internal connection 704. The processor 701, the memory 702, and the at least one network interface 703 are connected via the internal connection 704. The internal connection 704 includes a path to transmit information between the above components. Optionally, the internal connection 704 is a single board or a bus. Optionally, the internal connection 704 is divided into an address bus, a data bus, a control bus, etc.
[0146] In some embodiments, the electronic device 700 further includes an input-output interface 706. The input-output interface 706 is connected to the internal connection 704.
[0147] In some embodiments, the input / output interface 706 is used to connect to an input device to receive commands or data related to the above method embodiments input by a user through the input device, such as the difference between delay_MS and delay_SM determined by the aforementioned measurement method, etc. The input device includes but is not limited to a keyboard, a touch screen, a microphone, a mouse, or a sensor device, etc.
[0148] In some embodiments, the input / output interface 706 is also used to connect to an output device. The input / output interface 706 outputs the intermediate results and / or final results generated by the processor 301 executing the above method embodiment through the output device, such as prompt information or average path delay, etc. The output device includes but is not limited to a display, a printer, a projector, etc.
[0149] Optionally, the processor 701 implements the method in the above embodiment by reading the program code 710 stored in the memory 702, or the processor 701 implements the method in the above embodiment by the program code stored internally. In the case where the processor 701 implements the method in the above embodiment by reading the program code 710 stored in the memory 702, the memory 702 stores the program code for implementing the method provided in the embodiment of the present application.
[0150] For more details on how the processor 701 implements the above functions, please refer to the descriptions in the previous method embodiments, which will not be repeated here.
[0151] In some embodiments, a computer-readable storage medium is also provided, which stores computer instructions. When the computer instructions stored in the computer-readable storage medium are executed by an electronic device, the electronic device executes the time adjustment method or optical fiber link monitoring method provided above.
[0152] In some embodiments, a computer program product is also provided, which includes one or more computer program instructions. When the computer program instructions are loaded and run by a computer, the computer executes the time adjustment method or optical fiber link monitoring method provided by the above method embodiments.
[0153] In some embodiments, a chip is also provided, including a memory and a processor, the memory is used to store computer instructions, and the processor is used to call and run the computer instructions from the memory to execute the time adjustment method or optical fiber link monitoring method provided by the above method embodiments.
[0154] Unless otherwise defined, the technical or scientific terms used herein shall have the usual meanings understood by persons of ordinary skill in the field to which this application belongs. The words "first", "second", "third" and similar terms used in the patent application specification and claims of this application do not indicate any order, quantity or importance, but are only used to distinguish different components. Similarly, similar words such as "one" or "one" do not indicate a quantitative limitation, but rather indicate the presence of at least one. Similar words such as "include" or "comprise" mean that the elements or objects appearing before "include" or "comprises" cover the elements or objects listed after "include" or "comprises" and their equivalents, and do not exclude other elements or objects.
[0155] The above is only an embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A time adjustment method, It is characterized in that The method comprises: Determining that a change occurs in a fiber optic link between a first communication device and a second communication device; Calculating a delay deviation, where the delay deviation is a deviation between a first transmission delay from the first communication device to the second communication device and a second transmission delay from the second communication device to the first communication device; According to the time delay deviation, adjusting a first time deviation between the first communication device and the second communication device to obtain a second time deviation; The time of the first communication device is adjusted according to the second time offset.
2. The method according to claim 1, It is characterized in that The determining that a change occurs in the optical fiber link between the first communication device and the second communication device includes: Determine an average path delay between the first communication device and the second communication device, the average path delay is used to indicate the sum of a first delay and a second delay, the first delay is used to indicate a delay for the second communication device to transmit a first Precision Time Protocol (PTP) message to the first communication device via an optical fiber link, and the second delay is used to indicate a delay for the first communication device to transmit a second PTP message to the second communication device via the optical fiber link; It is determined, based on the average path delay, that a change occurs in the optical fiber link between the first communication device and the second communication device.
3. The method according to claim 2, It is characterized in that The determining an average path delay between the first communication device and the second communication device comprises: Determine the first delay according to a first time and a second time, the first time being the time when the second communication device sends the first PTP message, and the second time being the time when the first communication device receives the first PTP message; Determine the second delay according to a third time and a fourth time, the third time being the time when the first communication device sends the second PTP message, and the fourth time being the time when the second communication device receives the second PTP message; The sum of the first delay and the second delay is determined as the average path delay.
4. The method according to claim 2 or 3, It is characterized in that The determining, according to the average path delay, that a change occurs in the optical fiber link between the first communication device and the second communication device includes: When the difference between the first average path delay and the second average path delay is greater than a threshold, it is determined that the optical fiber link between the first communication device and the second communication device has changed, and the first average path delay and the second average path delay are the two determined average path delays.
5. The method according to any one of claims 1 to 4, It is characterized in that The calculating of the delay deviation includes: Determine a third delay according to a fifth time and a sixth time, wherein the fifth time is the time when the second communication device sends the third PTP message, and the sixth time is the time when the first communication device receives the third PTP message; Determine a fourth delay according to a seventh time and an eighth time, the seventh time being the time when the first communication device sends a fourth PTP message, and the eighth time being the time when the second communication device receives the fourth PTP message; The difference between the third delay and the fourth delay is determined as the delay deviation.
6. The method according to claim 5, It is characterized in that The step of adjusting a first time offset between the first communication device and the second communication device according to the time delay offset to obtain a second time offset includes: The first time offset is adjusted according to half of the time delay offset to obtain the second time offset.
7. A method for monitoring an optical fiber link, It is characterized in that The method comprises: Determine an average path delay between a first communication device and a second communication device, the average path delay being used to indicate the sum of a first delay and a second delay, the first delay being used to indicate a delay for the second communication device to transmit a first Precision Time Protocol (PTP) message to the first communication device via an optical fiber link, and the second delay being used to indicate a delay for the first communication device to transmit a second PTP message to the second communication device via the optical fiber link; According to the average path delay, it is determined whether the optical fiber link between the first communication device and the second communication device changes.
8. The method according to claim 7, It is characterized in that The determining an average path delay between the first communication device and the second communication device comprises: Determine the first delay according to a first time and a second time, the first time being the time when the second communication device sends the first PTP message, and the second time being the time when the first communication device receives the first PTP message; Determine the second delay according to a third time and a fourth time, the third time being the time when the first communication device sends the second PTP message, and the fourth time being the time when the second communication device receives the second PTP message; The sum of the first delay and the second delay is determined as the average path delay.
9. The method according to claim 7 or 8, It is characterized in that The determining, according to the average path delay, whether a fiber link between the first communication device and the second communication device changes comprises: When the difference between the first average path delay and the second average path delay is greater than a threshold, it is determined that the optical fiber link between the first communication device and the second communication device has changed, and the first average path delay and the second average path delay are the two determined average path delays.
10. The method according to any one of claims 7 to 9, It is characterized in that The method further comprises: Outputting prompt information, where the prompt information is used to prompt that the length of the optical fiber link between the first communication device and the second communication device changes.
11. A time adjustment device, It is characterized in that The device comprises: A determining unit, configured to determine that a change occurs in a fiber optic link between a first communication device and a second communication device; a calculation unit, configured to calculate a delay deviation, wherein the delay deviation is a deviation between a first transmission delay from the first communication device to the second communication device and a second transmission delay from the second communication device to the first communication device; An adjusting unit is used to adjust a first time deviation between the first communication device and the second communication device according to the time delay deviation to obtain a second time deviation; and adjust the time of the first communication device according to the second time deviation.
12. The device according to claim 11, It is characterized in that The determining unit comprises: A first determining subunit is used to determine an average path delay between the first communication device and the second communication device, the average path delay is used to indicate the sum of a first delay and a second delay, the first delay is used to indicate a delay for the second communication device to transmit a first Precision Time Protocol PTP message to the first communication device via an optical fiber link, and the second delay is used to indicate a delay for the first communication device to transmit a second PTP message to the second communication device via the optical fiber link; The second determining subunit is configured to determine, based on the average path delay, whether a change has occurred in the optical fiber link between the first communication device and the second communication device.
13. The device according to claim 12, It is characterized in that The first determining subunit is used to determine the first delay according to a first time and a second time, the first time is the time when the second communication device sends the first PTP message, and the second time is the time when the first communication device receives the first PTP message; Determine the second delay according to a third time and a fourth time, the third time being the time when the first communication device sends the second PTP message, and the fourth time being the time when the second communication device receives the second PTP message; The sum of the first delay and the second delay is determined as the average path delay.
14. The device according to claim 12 or 13, It is characterized in that The second determination subunit is used to determine that the optical fiber link between the first communication device and the second communication device has changed when the difference between the first average path delay and the second average path delay is greater than a threshold, and the first average path delay and the second average path delay are two determined average path delays.
15. The device according to any one of claims 11 to 14, It is characterized in that The calculation unit is used to determine a third delay according to a fifth time and a sixth time, wherein the fifth time is the time when the second communication device sends the third PTP message, and the sixth time is the time when the first communication device receives the third PTP message; Determine a fourth delay according to a seventh time and an eighth time, the seventh time being the time when the first communication device sends the fourth PTP message, and the eighth time being the time when the second communication device receives the fourth PTP message; The difference between the third delay and the fourth delay is determined as the delay deviation.
16. The device according to claim 15, It is characterized in that The adjustment unit is used to adjust the first time deviation according to half of the delay deviation to obtain the second time deviation.
17. An optical fiber link monitoring device, It is characterized in that The device comprises: A path delay determination unit, configured to determine an average path delay between a first communication device and a second communication device, wherein the average path delay is used to indicate the sum of a first delay and a second delay, wherein the first delay is used to indicate a delay for the second communication device to transmit a first Precision Time Protocol (PTP) message to the first communication device via an optical fiber link, and the second delay is used to indicate a delay for the first communication device to transmit a second PTP message to the second communication device via the optical fiber link; A change determination unit is used to determine whether the optical fiber link between the first communication device and the second communication device has changed according to the average path delay.
18. The device according to claim 17, It is characterized in that The path delay determination unit includes: A first delay determination subunit, configured to determine the first delay according to a first time and a second time, wherein the first time is a time when the second communication device sends the first PTP message, and the second time is a time when the first communication device receives the first PTP message; A second delay determination subunit, configured to determine the second delay according to a third time and a fourth time, wherein the third time is a time when the first communication device sends the second PTP message, and the fourth time is a time when the second communication device receives the second PTP message; The path delay determination subunit is used to determine the sum of the first delay and the second delay as the average path delay.
19. The device according to claim 17 or 18, It is characterized in that The change determination unit is used to determine that a change has occurred in the optical fiber link between the first communication device and the second communication device when a difference between a first average path delay and a second average path delay is greater than a threshold, wherein the first average path delay and the second average path delay are two determined average path delays.
20. The device according to any one of claims 17 to 19, It is characterized in that The device also includes: The output unit is used to output prompt information, where the prompt information is used to prompt that the length of the optical fiber link between the first communication device and the second communication device changes.
21. An electronic device, It is characterized in that The electronic device includes a processor and a memory, the memory is used to store software programs, and the processor runs or executes the software programs stored in the memory so that the electronic device implements the method according to any one of claims 1 to 6, or implements the method according to any one of claims 7 to 10.
22. A computer-readable storage medium, It is characterized in that The computer-readable storage medium is used to store program codes executed by a processor, wherein the program codes include instructions for implementing the method according to any one of claims 1 to 6, or instructions for implementing the method according to any one of claims 7 to 10.
23. A computer program product, It is characterized in that The computer program product comprises program codes, and when a computer runs the computer program product, the computer executes the method according to any one of claims 1 to 6, or executes the method according to any one of claims 7 to 10.
