Method, device and system for detecting time synchronization performance
By using the time difference between two devices that have completed time synchronization and have no time synchronization relationship in the target network to detect the time synchronization performance, the problem of low detection efficiency in the prior art is solved, and efficient and real-time time synchronization performance detection is achieved.
Patent Information
- Application Number
- CN202110042241.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-13
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2041-01-13
AI Technical Summary
When detecting time synchronization performance, the prior art requires detecting equipment in the network one by one, resulting in low detection efficiency.
By acquiring the time difference between the first device and the second device, using both devices to complete time synchronization and no time synchronization relationship, it is quickly judged whether the time synchronization performance of the target network is abnormal.
This method does not require the use of additional GPS instruments to detect equipment one by one, significantly improving the detection efficiency of time synchronization performance and real-time detection and rapid response.
Smart Images

Figure CN114765586B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communications, and in particular to a method, device and system for detecting time synchronization performance. Background Art
[0002] Time synchronization (also known as time tracking or clock synchronization) technology refers to the technology of keeping the time of at least two devices in a communication system synchronized. After the at least two devices complete the time synchronization, it is possible to detect whether the time synchronization performance of the at least two devices is abnormal to determine the overall time synchronization effect of the at least two devices.
[0003] At present, for networks that have completed time synchronization, such as a ring network (including at least three devices connected end to end), the time synchronization performance of the devices in the network can be measured one by one through a Global Positioning System (GPS) instrument. The measurement process of each device may include: the GPS instrument achieves time synchronization through GPS components and satellites, so that the time of the GPS instrument is the satellite time. After that, the GPS instrument establishes a connection with the device through the measurement port. The time of the device is obtained through the established connection. The time of the device is subtracted from the satellite time of the GPS instrument. If the absolute value of the difference is greater than a preset threshold, it is determined that the time synchronization performance of the device is abnormal. If the time synchronization performance of any device in the network is abnormal, it is determined that the time synchronization performance of the network is abnormal.
[0004] However, the aforementioned method for detecting time synchronization performance requires detecting devices in the network one by one to determine whether the time synchronization performance of the network is abnormal, resulting in low efficiency in detecting the time synchronization performance of the network. Summary of the invention
[0005] The embodiments of the present application provide a method, device and system for detecting time synchronization performance to improve the detection efficiency of time synchronization performance.
[0006] In a first aspect, the present application provides a method for detecting time synchronization performance. The method includes: obtaining a time difference between a first device and a second device. The first device is in a state of completing time synchronization with a clock source device. The second device is in a state of completing time synchronization with the clock source device, and there is no time synchronization relationship between the first device and the second device. When the absolute value of the time difference is greater than a preset threshold, it is determined that the time synchronization performance of the target network is abnormal. The target network is a network to which the first device and the second device belong. Optionally, the devices in the target network complete time synchronization based on a time synchronization protocol. For example, 1588 protocol, NTP, RTP or other time synchronization protocols.
[0007] In the embodiment of the present application, when both the first device and the second device have completed time synchronization and there is no time synchronization relationship between the first device and the second device, whether the time synchronization performance of the target network is abnormal is determined based on the time difference between the first device and the second device, thereby quickly determining whether the time synchronization performance of the target network is abnormal. In addition, the method for detecting time synchronization performance does not require the use of additional GPS instruments to detect devices in the network one by one, effectively improving the detection efficiency of the time synchronization performance of the target network.
[0008] Wherein, the manner of determining that there is no time synchronization relationship with the second device may include the following two manners: In the first manner, if the time synchronization priority of the first device is the same as the time synchronization priority of the second device, and both are the first priority, it is determined that there is no time synchronization relationship between the first device and the second device. In the second manner, if the first device and the second device are a preset pair of devices that do not require time synchronization, it is determined that there is no time synchronization relationship between the first device and the second device.
[0009] The method of obtaining the time difference between the first device and the second device may include the following two optional implementation methods:
[0010] In a first optional implementation, the time difference is determined based on a message transmitted between the first device and the second device. The first device and the second device respectively send a message to the other end. The time difference is determined by obtaining the sending and receiving time of the two messages. The time difference can be calculated by the first device, or calculated by the second device and the calculation result is notified to the first device, or calculated by a third device and the calculation result is notified to the first device. The third device can be a management device. By transmitting a message between the first device and the second device to obtain the time difference, the time difference can be quickly obtained without human intervention. In this way, real-time detection of time synchronization performance is achieved, effectively improving detection efficiency.
[0011] In the first example, the process of obtaining the time difference between the first device and the second device includes: determining the time difference based on a first moment, a second moment, a third moment, and a fourth moment; wherein the first moment is the moment when the first device sends a first message to the second device. The second moment is the moment when the second device receives the first message. The third moment is the moment when the second device sends the second message to the first device. The fourth moment is the moment when the first device receives the second message. In this example, the first device sends the first message to the second device. After receiving the first message, the second device sends the second message to the first device. Correspondingly, the first device receives the second message sent by the second device.
[0012] In the second example, the process of obtaining the time difference between the first device and the second device includes: determining the time difference based on a first moment, a second moment, a third moment, and a fourth moment; wherein the first moment is the moment when the second device sends a first message to the first device, the second moment is the moment when the first device receives the first message, the third moment is the moment when the first device sends a second message to the second device, and the fourth moment is the moment when the second device receives the second message. In this example, the second device sends a first message to the first device. After receiving the first message, the first device sends a second message to the second device. Correspondingly, the second device receives the second message sent by the first device.
[0013] In the above two examples, the format of the time carried in the message can refer to the format of the timestamp in the 1588 message. For example, in a target network with high time accuracy requirements, the length of the timestamp corresponding to the first to fourth moments is 96 bits; in a target network with general time accuracy requirements, the length of the timestamp corresponding to the first to fourth moments is 80 bits.
[0014] In an embodiment of the present application, the target message transmitted between the first device and the second device for calculating the time difference between the first device and the second device may be different from the content of the traditional 1588 message. For example, the target message may include a message type field, and the message type field carries a performance detection identifier. The performance detection identifier indicates that the message where the performance detection identifier is located is used to detect time synchronization performance. In this way, the target message transmitted between the first device and the second device can be compatible with the format of the traditional 1588 message, reducing the complexity of the message construction. By way of example, the target message includes a first message and a second message.
[0015] In a second optional implementation, a first time difference between the first device and the satellite time is obtained through a GPS instrument; a second time difference between the second device and the satellite time is obtained through a GPS instrument; and a time difference between the first and second devices is determined based on the first and second time differences. The GPS instrument is used to detect the two devices separately to obtain the time difference, and the time synchronization performance can be detected by only detecting the time difference between the GPS instrument and the two devices. Compared with the traditional method of detecting devices in the network one by one to determine whether the time synchronization performance of the network is abnormal, the number of devices to be detected is effectively reduced, thereby improving the detection efficiency.
[0016] Optionally, after determining that the time synchronization performance of the target network is abnormal, the third device may also be notified. For example, the third device is notified by sending abnormal indication information to the third device. The abnormal indication information is used to indicate that the time synchronization performance of the target network is abnormal. In an optional implementation, the third device is a management device, and the abnormal indication information may be management information or alarm information. After obtaining the abnormal indication information, the third device may issue a notification message to notify the staff that the time synchronization performance of the target network is abnormal. In this way, it is convenient for the staff to locate the abnormal device in the target network in a timely manner, and to repair or replace the abnormal device. In another optional implementation, the third device is a device in the target network that needs to be synchronized with the aforementioned clock source device but has not yet been synchronized. The third device may determine that the time synchronization performance of the target network is abnormal based on the abnormal indication information, and prohibit time synchronization with the clock source device. To avoid invalid time after synchronization, reduce the impact of abnormal time synchronization performance of the target network on the third device. For example, when the first device and the second device are non-adjacent devices on the ring network, the third device is a device between the first device and the second device on the ring network. In another optional implementation, the third device is a pre-designated device. For example, it is a mobile terminal of a staff member. The staff member can use the third device to quickly and conveniently determine that the time synchronization performance of the target network is abnormal, so as to perform maintenance on the target network in a timely manner.
[0017] In an optional manner, the first device is a device adjacent to the second device in the target network. If the target network includes a ring network, the first device and the second device can be two adjacent devices on the ring network, such as leaf devices. Then the time synchronization effect of the first device reflects the time synchronization effect on a semi-ring path from the first device to the clock source device; the time synchronization effect of the second device reflects the time synchronization effect on another semi-ring path from the second device to the clock source device. The time difference between the first device and the second device reflects the time synchronization effect of the entire ring network.
[0018] There are multiple ways to obtain the aforementioned preset threshold. In one example, the preset threshold is a value of a pre-set device. The preset threshold can be read from a storage space storing the preset threshold. In another example, the preset threshold is calculated by the first device. The preset number of hops and the set duration can be obtained. The product of the preset number of hops and the set duration is determined as the preset threshold. The set duration is the allowable synchronization deviation of one hop. By way of example, the target network includes a ring network in which the first device and the second device are located, and the preset number of hops can be the total number of hops of the devices in the ring network. Then the preset threshold is the product of the total number of hops and the set duration.
[0019] It is worth noting that the aforementioned target network may include a ring network or a mesh network (also called a mesh network or mesh networking). The mesh network may be divided into multiple ring networks according to the time synchronization requirements. The aforementioned method for detecting time synchronization performance may be performed by the first device, the second device, or the third device.
[0020] In a second aspect, the present application provides a device for detecting time synchronization performance. The device for detecting time synchronization performance may include at least one module. The at least one module may be used to implement the method for detecting time synchronization performance provided by the first aspect or any possible implementation of the first aspect.
[0021] In a third aspect, the present application provides a device. The device includes: a processing chip and a communication port. The processing chip is used to execute the method provided in the first aspect or any possible implementation of the first aspect; the communication port is used for the processing chip to communicate with other devices.
[0022] In a fourth aspect, the present application provides a device. The device includes a processor and a memory. The memory stores computer instructions; the processor executes the computer instructions stored in the memory, so that the device performs the method provided by the first aspect or any possible implementation of the first aspect.
[0023] In a fifth aspect, the present application provides a computer-readable storage medium. The computer-readable storage medium stores computer instructions. The computer instructions instruct a device to execute the method provided by the first aspect or any possible implementation of the first aspect.
[0024] In a sixth aspect, the present application provides a computer program product. The computer program product includes computer instructions, which are stored in a computer-readable storage medium. A processor of a device can read the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the device performs the method provided by the first aspect or any possible implementation of the first aspect.
[0025] In a seventh aspect, the present application provides a time synchronization system, which includes: a target network including at least three devices, wherein the target network includes the apparatus for detecting time synchronization performance according to the second aspect.
[0026] In an eighth aspect, the present application provides a chip. The chip may include a programmable logic circuit and / or a program instruction, and when the chip is running, it is used to implement any method for detecting time synchronization performance as described in the first aspect.
[0027] In summary, in the embodiment of the present application, whether the time synchronization performance of the target network is abnormal is determined based on the time difference between the first device and the second device that complete time synchronization with the same clock source and have no time synchronization relationship. Thus, whether the time synchronization performance of the target network is abnormal is quickly determined, effectively improving the detection efficiency of the time synchronization performance of the target network. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 This is a schematic diagram of an application environment provided by an embodiment of the present application;
[0029] Figure 2 It is a flowchart of a method for detecting time synchronization performance provided by an embodiment of the present application;
[0030] Figure 3 It is a schematic diagram of the principle of completing time synchronization of a device in a target network based on the 1588 protocol provided by an embodiment of the present application;
[0031] Figure 4 This is another application environment schematic diagram provided by an embodiment of the present application;
[0032] Figure 5 It is a flowchart of another method for detecting time synchronization performance provided by an embodiment of the present application;
[0033] Figure 6 It is a structural schematic diagram of a device for detecting time synchronization performance provided by an embodiment of the present application;
[0034] Figure 7 It is a structural schematic diagram of a device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0035] In order to make the principles and technical solutions of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0036] Figure 1It is a schematic diagram of an application environment involved in a method for detecting time synchronization performance provided in an embodiment of the present application. In the application environment, the time synchronization system includes: a management device 101 and multiple communication devices 102. The time synchronization system is used to provide accurate reference time for a wireless communication system or a power relay protection system. Optionally, multiple communication devices 102 can form a ring network. The communication devices on the ring network are connected end to end, and each communication device can communicate with two adjacent communication devices on the ring network. Adjacent communication devices on the ring network are directly connected via optical fiber or cable. For example, the ring network is an Ethernet ring network, an optical transport network (OTN) ring network, and a synchronous digital hierarchy (SDH) ring network. Among them, the management device 101 is used to manage multiple communication devices 102. The management device 101 can communicate with each communication device separately. The management device 101 can be a network management device (also called a network management device) or a controller (also called a central controller). In actual implementation, the management device 101 can be set independently of the multiple communication devices 102, or can be a device set or elected in the multiple communication devices 102. The management device 101 can be a computer, a server, a server cluster composed of multiple servers, or a cloud computing center. The communication device 102 can be a network device such as an OTN wavelength division device, a router, or an access network device. Figure 1 In the time synchronization system, the management device 101 is set independently from the multiple communication devices 102, and the multiple communication devices 102 form a ring network setting for explanation.
[0037] Figure 2 Schematic diagram of a method for detecting time synchronization performance provided by an embodiment of the present application. The method can be applied to Figure 1 In the application environment shown. Figure 2 As shown, the method includes:
[0038] S201. Devices in the target network perform time synchronization.
[0039] The target network includes at least two devices for clock synchronization with the same clock source device (also called a root device). The subsequent embodiments of the present application assume that the at least two devices include a first device and a second device. For example, the target network may include a ring network. The devices in the target network may use a variety of methods to perform time synchronization. The embodiments of the present application are described by taking the following two methods as examples:
[0040] In the first mode, the devices in the target network are respectively synchronized with the clock source devices outside the target network to achieve time synchronization of the devices in the target network. For example, the clock source device is a device with a reference time (or reference clock). For example, the reference time is satellite time. The clock source device is a device in GPS, a device in the Beidou system, or a device in the Galileo system. For example, a satellite.
[0041] In the second method, the devices in the target network complete time synchronization based on the time synchronization protocol. The aforementioned time synchronization protocol may be the 1588 protocol, the Network Time Protocol (NTP), the Real-time Transport Protocol (RTP) or other time synchronization protocols. Among them, due to the time synchronization accuracy of the 1588 protocol, this protocol is usually used to complete time synchronization. The 1588 protocol is also called the precise time protocol (PTP). The 1588 protocol may be 1588 version 1 or 1588 version 2 (version 2), or other versions, which are not limited in the embodiments of the present application.
[0042] Figure 3 It is a schematic diagram of the principle of completing time synchronization of a device in a target network based on the 1588 protocol provided in an embodiment of the present application. Figure 3 Assume that the target network includes a ring network. The ring network includes the aforementioned first device, the second device, and a clock source device. Optionally, the devices in the ring network are Figure 1 The communication device shown. Figure 3 It is assumed that the target network includes 5 devices, namely devices 1 to 5 in the ring network. It should be noted that after any device in the target network based on the 1588 protocol completes time synchronization, the time synchronization priority will be updated from the second priority to the first priority. The first priority is higher than the second priority. The two priorities are pre-set. In addition, the time tracking algorithm in the 1588 protocol indicates to select the shortest path for tracking. Therefore, the devices in the ring network actually complete direct time synchronization with the devices adjacent to themselves. Then the devices 1 to 5 complete time synchronization by executing the following steps.
[0043] A1. Device 1 performs time synchronization with an external clock source device through an external time synchronization port.
[0044] Each non-clock source device in the ring network (such as any device in devices 2 to 4) usually has two ports, which are mainly used to communicate with adjacent devices on the ring network, such as business transmission. In addition to the two ports, the clock source device also has an external time synchronization port. This port is used to synchronize time with an external clock source device. The external clock source device is a device outside the ring network, which has a reference time. For example, the reference time is satellite time. For example, the external clock source device is a device in GPS, a device in the Beidou system, or a device in the Galileo system. Such as a satellite.
[0045] After the 1588 time synchronization function is enabled, if a device in the ring network detects that it can receive a message carrying clock information through an external time synchronization port, it means that the device can synchronize time with an external clock source device. Figure 3 Assume that device 1 has an external time synchronization port. In one implementation, device 1 can send a clock synchronization request to the external clock source device through the external time synchronization port. Afterwards, the clock synchronization response sent by the external clock source device is received through the external time synchronization port. The clock synchronization response carries the reference time provided by the external clock source device. In another implementation, the external clock source device can send its own reference time in real time through the external time synchronization port. Device 1 receives the reference time through the external time synchronization port.
[0046] After device 1 adjusts its own time based on the reference time, it completes the time synchronization with the external clock source. After completing the time synchronization, device 1 is the clock source device in the ring network. Other devices in the ring network need to synchronize their time with the clock source device.
[0047] A2, device 2, and device 5 perform time synchronization with device 1 respectively.
[0048] After completing time synchronization, device 1 updates its own time synchronization priority from the second priority to the first priority. After that, device 2 and device 5 perform time synchronization with device 1 respectively. The following takes the process of device 2 and device 1 performing time synchronization as an example for description, and the process of device 5 and device 1 performing time synchronization can refer to this process. Device 1 sends a negotiation request to device 2, and the negotiation request includes the time synchronization priority of device 1. After receiving the negotiation request, device 2 compares the time synchronization priority in the negotiation request with its own time synchronization priority. When the time synchronization priority in the negotiation request is higher than its own time synchronization priority, device 2 sends a negotiation response to device 1. The negotiation response is used to instruct device 2 to track the time of device 1. For example, after sending the negotiation response, device 2 sets the port sending the negotiation response to the slave (slave, S) port. After receiving the negotiation response, device 1 sets the port receiving the negotiation response to the master (master, M) port. After that, device 2 tracks the time of device 1. The tracking process includes: device 1 sends a first message to the slave port of device 2 through the master port; the slave port of device 2 sends a second message to the master port of device 1. Device 2 determines the time difference with device 1 based on the first moment, the second moment, the third moment and the fourth moment, and adjusts the time of device 2 based on the time difference so that the time of device 2 is consistent with the time of device 1, thereby completing time synchronization. The first moment is the moment when device 1 sends a first message to device 2, the second moment is the moment when device 2 receives the first message, the third moment is the moment when device 2 sends a second message to device 1, and the fourth moment is the moment when device 1 receives the second message. In an optional example, device 1 may also send a third message carrying the first moment and a fourth message carrying the fourth moment to device 2. In the 1588 protocol, the first message is called a synchronization (sync) message; the second message is called a delay request (Delay_req) message; the third message is called a follow (Follow_up) message; and the fourth message is called a delay request response (Delay_resp) message.
[0049] A3. Device 3 is synchronized with device 2, and device 4 is synchronized with device 5.
[0050] After completing time synchronization, device 2 and device 5 update their own time synchronization priority from the second priority to the first priority. Afterwards, device 3 performs time synchronization with device 2, and device 4 performs time synchronization with device 5. The time synchronization process can refer to the time synchronization process of device 2 and device 1 in A3. Among them, in the process of time synchronization between device 3 and device 2, the action of device 3 refers to the action of device 2 in A3; the action of device 2 refers to the action of device 1 in A3. Similarly, in the process of time synchronization between device 4 and device 5, the action of device 4 refers to the action of device 2 in A3; the action of device 5 refers to the action of device 1 in A3.
[0051] A4. Device 3 and device 4 determine that they have no time synchronization relationship.
[0052] A time synchronization relationship refers to a relationship that requires time synchronization. After completing time synchronization, device 3 and device 4 update their own time synchronization priorities from the second priority to the first priority. Afterwards, device 3 and device 4 determine through negotiation that there is no time synchronization relationship between the two. In the first optional example, device 3 sends a negotiation request to device 4, and the negotiation request includes the time synchronization priority of device 3. After receiving the negotiation request, device 4 compares the time synchronization priority in the negotiation request with its own time synchronization priority. When the time synchronization priority in the negotiation request is equal to its own time synchronization priority, and both are the first priority, device 4 sends a negotiation response to device 3, and the negotiation response is used to indicate that device 4 has no time synchronization relationship with device 3. In the second optional example, device 4 sends a negotiation request to device 3, and device 3 sends a negotiation response to device 4. The actions of device 3 and device 4 are swapped relative to the aforementioned first optional example. This is not elaborated in the embodiments of the present application.
[0053] In traditional technology, time synchronization is not required between devices that have no time synchronization relationship. Therefore, there is no need to transmit time synchronization related messages between the two, such as the first message to the fourth message mentioned above. For example, device 3 and device 4 identify that device 3 and device 4 have no time synchronization relationship by setting the port that communicates with the other end to a degraded (passive, P) port. The degraded port does not need to transmit time synchronization related messages. In a ring network, the device to which the degraded port belongs is called a leaf device. For example, after the execution of the first optional example mentioned above, device 3 sets the port that sends the negotiation response as a degraded port after sending the negotiation response. After receiving the negotiation response, device 4 sets the port that receives the negotiation response as a degraded port.
[0054] As mentioned above, all devices in the target network have completed time synchronization with the clock source device directly or indirectly. Figure 3In the ring network based on the 1588 protocol for time synchronization, each device directly or indirectly achieves time synchronization with the clock source device. After the device in the target network completes time synchronization, the embodiment of the present application detects whether the time synchronization performance of the target network is abnormal. The subsequent embodiments take the first device and the second device in the target network as an example to illustrate the detection process. Assume that the first device is in a state of completing time synchronization with the clock source device, the second device is in a state of completing time synchronization with the clock source device, and there is no time synchronization relationship between the first device and the second device. Then the detection process includes:
[0055] S202: The first device obtains a time difference between the first device and the second device. Execute S203 or S204.
[0056] The first device may obtain the time difference between the first device and the second device after determining that both the first device and the second device have completed time synchronization and that there is no time synchronization relationship between the first device and the second device.
[0057] In an embodiment of the present application, after completing time synchronization, any device in the target network can notify other devices in the target network that the device has completed time synchronization by sending a preset message. After receiving the preset message sent by the second device, the first device determines that the second device has completed time synchronization. For example, the preset message can be a message carrying the aforementioned negotiation request.
[0058] Optionally, the manner in which the first device determines that there is no time synchronization relationship with the second device may include the following two manners.
[0059] In the first manner, if the time synchronization priority of the first device is the same as the time synchronization priority of the second device and both are the first priority, it is determined that there is no time synchronization relationship between the first device and the second device.
[0060] like Figure 3 As shown, after any device in the target network completes time synchronization, the time synchronization priority will be updated from the lower second priority to the higher first priority. The first device can then determine whether there is a time synchronization relationship between the two by comparing the time synchronization priority with the second device. If the time synchronization priorities of the two are equal and both are the higher first priority, it means that both have completed time synchronization and do not need to be synchronized again, so there is no time synchronization relationship. The process of determining that there is no time synchronization relationship can refer to the process of determining that there is no time synchronization relationship between device 3 and device 4 in A4 above. If the time synchronization priorities of the two are not equal, it means that the two need to be synchronized, so there is a time synchronization relationship. The process of determining that there is a time synchronization relationship can refer to the negotiation process between device 2 and device 1 in A2 above.
[0061] In the second manner, if the first device and the second device are a preset pair of devices that do not require time synchronization, it is determined that there is no time synchronization relationship between the first device and the second device.
[0062] For example, the relationship between a pair of devices can be set to not require time synchronization through the aforementioned management device, or by searching for devices that already have a synchronization relationship, if a pair of devices has no synchronization relationship, it can be determined that there is no need for synchronization between them. The first device can detect whether itself and the second device are a preset pair of devices that do not require time synchronization. If it is detected that the second device is a preset pair of devices that do not require time synchronization, it is determined that there is no time synchronization relationship between the first device and the second device. In actual implementation, when a pair of devices does not require time synchronization, a counterpart device that does not require time synchronization can also be configured in each device of the pair of devices, and each device can determine which device does not require time synchronization by querying its own records. For example, the device that does not require time synchronization is configured as the second device in the first device through the management device, and the first device can determine that it does not require time synchronization with the second device by querying its own records.
[0063] Optionally, the aforementioned method of obtaining the time difference between the first device and the second device may include the following two optional implementation methods:
[0064] In a first optional implementation, the time difference is determined based on a message transmitted between the first device and the second device. The first device and the second device respectively send a message to the other end, and the time difference is determined by obtaining the sending and receiving time of the two messages. The time difference can be calculated by the first device, or calculated by the second device and the calculation result is notified to the first device; it can also be calculated by a third device and the calculation result is notified to the first device, and the third device can be the aforementioned management device.
[0065] In the first example, the first device sends a first message to the second device. After receiving the first message, the second device sends a second message to the first device. Correspondingly, the first device receives the second message sent by the second device. Afterwards, the time difference can be determined based on t1, the second moment t2, the third moment t3, and the fourth moment t4. Among them, t1 is the moment when the first device sends the first message to the second device, t2 is the moment when the second device receives the first message, t3 is the moment when the second device sends the second message to the first device, and t4 is the moment when the first device receives the second message. In this case, the actions of the first device and the second device can correspond to the actions of device 1 and device 2 in A2 above.
[0066] When the time difference is calculated by the first device, the first device needs to obtain the aforementioned t2 and t3. For example, the second message includes t2 and t3. For another example, the second message includes t2, and the second device also sends a third message to the first device, and the third message includes t2. When the time difference is calculated by the second device, the second device needs to obtain the aforementioned t1 and t4. For example, the first message includes t1, and the first device also sends a third message to the second device, and the third message includes t4. For another example, the first device also sends a third message and a fourth message to the second device, and the third message includes t1, and the fourth message includes t4. When the time difference is calculated by the third device, the third device needs to obtain the aforementioned first to fourth moments. The first device can send a message carrying t1 and t4 to the third device; the second device can send a message carrying t2 and t3 to the third device.
[0067] In the second example, the second device sends a first message to the first device. After receiving the first message, the first device sends a second message to the second device. Correspondingly, the second device receives the second message sent by the first device. Afterwards, the time difference can be determined based on the first moment t1, the second moment t2, the third moment t3, and the fourth moment t4. Among them, t1 is the moment when the second device sends the first message to the first device, t2 is the moment when the first device receives the first message, t3 is the moment when the first device sends the second message to the second device, and t4 is the moment when the second device receives the second message. In this case, the actions of the first device and the second device can correspond to the actions of device 2 and device 1 in A2 above, respectively.
[0068] When the time difference is calculated by the first device, the actions of the first device and the second device are swapped relative to the actions in the case where the time difference is calculated by the second device in the first example. When the time difference is calculated by the second device, the actions of the first device and the second device are swapped relative to the actions in the case where the time difference is calculated by the first device in the first example. When the time difference is calculated by the third device, the actions of the first device and the second device are swapped relative to the actions in the case where the time difference is calculated by the third device in the first example. This embodiment of the application will not be elaborated on.
[0069] In the above two examples, the format of the time carried in the message can refer to the format of the timestamp in the 1588 message. For example, in a target network with high time accuracy requirements, the length of the timestamp corresponding to the first to fourth moments is 96 bits; in a target network with general time accuracy requirements, the length of the timestamp corresponding to the first to fourth moments is 80 bits.
[0070] As described in A4 above, in the conventional technology, time synchronization is not required between devices without a time synchronization relationship, so there is no need to transmit time synchronization related messages between the two. In the first optional implementation, in order to calculate the time difference between the first device and the second device, at least the first message and the second message need to be transmitted between the first device and the second device.
[0071] The traditional 1588 message includes a message type (MsgType) field, which is used to indicate the type of the 1588 message. The different identifiers carried by the message type field represent different types of messages. For example, identifiers 0x00 and 0x02 are used to indicate the aforementioned synchronization message and delay request message, respectively. The length of the message type field is usually 4 bits. Identifiers 0x0E to 0x0F are reserved identifiers.
[0072] In an optional example of an embodiment of the present application, the target message transmitted between the first device and the second device for calculating the time difference between the first device and the second device can reuse the traditional 1588 message. For example, the first message to the fourth message are respectively a synchronization message, a delay request message, a follow-up message, and a delay request response message. In another optional example of an embodiment of the present application, the target message transmitted between the first device and the second device for calculating the time difference between the first device and the second device can be different from the content of the traditional 1588 message. For example, the target message may include a message type field. The message type field carries a performance detection identifier. The performance detection identifier indicates that the message where the performance detection identifier is located is used to detect time synchronization performance. For example, the performance detection identifier can be any of the aforementioned reserved identifiers, and the structure of other fields of the target message can refer to the structure of the 1588 message. In this way, the target message transmitted between the first device and the second device can be compatible with the format of the traditional 1588 message, reducing the complexity of the message construction. For example, the target message includes a first message and a second message. Optionally, the target message may also include a third message and / or a fourth message.
[0073] In the aforementioned first optional implementation, if the 1588 protocol is used to determine the time difference. In one example, assuming that the message transmission delay (i.e., the receiving and sending delay) between the first device and the second device is symmetrical and equal, the time difference △t=[(t4-t1)+(t3-t2)] / 2. In another example, assuming that the message transmission between the first device and the second device is asymmetric, the time difference is calculated based on the aforementioned t1, t2, t3 and t4 using a weighted average algorithm. For example, the time difference △t=[a(t4-t1)+b(t3-t2)] / 2. Among them, a and b are preset weights or weights calculated based on a preset algorithm. The embodiment of the present application does not limit the weights in the weighted average algorithm.
[0074] By acquiring the time difference by transmitting messages between the first device and the second device, the time difference can be quickly acquired without human intervention, thereby realizing real-time detection of time synchronization performance and effectively improving detection efficiency.
[0075] In a second optional implementation, a first time difference between the first device and the satellite time is obtained through a GPS instrument; a second time difference between the second device and the satellite time is obtained through a GPS instrument; and a time difference between the first device and the second device is determined based on the first time difference and the second time difference. For example, the GPS instrument establishes a connection with the first device through a measuring port of the first device, obtains the time of the first device through the established connection, and obtains the first time difference by subtracting the time of the first device from the satellite time of the GPS instrument. The process of obtaining the second time difference can refer to the process of obtaining the first time difference.
[0076] By using a GPS instrument to detect the first device and the second device respectively to obtain the time difference, the time synchronization performance can be detected by only detecting the time difference between the GPS instrument and the two devices. Compared with the traditional method of detecting devices in the network one by one to determine whether the time synchronization performance of the network is abnormal, the number of devices to be detected is effectively reduced, thereby improving the detection efficiency.
[0077] S203: When the absolute value of the time difference is greater than a preset threshold, the first device determines that the time synchronization performance of the target network is abnormal. Execute S205.
[0078] The first device may first obtain a preset threshold, and then compare the obtained time difference with the preset threshold. Based on the comparison result, it may be determined whether the time synchronization performance of the target network is abnormal.
[0079] There are multiple ways to obtain the preset threshold. In one example, the preset threshold is a value of a pre-set device. The first device can read the preset threshold from a storage space storing the preset threshold. In another example, the preset threshold is calculated by the first device. The first device can obtain a preset number of hops and a set duration. The product of the preset number of hops and the set duration is determined as the preset threshold. The set duration is an allowable synchronization deviation of one hop. By way of example, the target network includes a ring network where the first device and the second device are located, and the preset number of hops can be the total number of hops of the devices in the ring network.
[0080] In scenarios with different time synchronization accuracy requirements, the length of the set time is different. For example, in a scenario requiring high time synchronization accuracy, the set time may be 5 nanoseconds (ns). In a scenario requiring normal time synchronization accuracy, the set time may be 30 nanoseconds.
[0081] Since the first device and the second device are directly or indirectly synchronized with the same clock source device, when the absolute value of the time difference is greater than the preset threshold, it means that the time difference between the first device and the second device is large, and the synchronization effect between the first device and the second device and the clock source device does not reach the expected effect, so the synchronization performance of the target network to which the first device and the second device belong is abnormal.
[0082] For example, if both the first device and the second device perform time synchronization based on the 1588 protocol. Then the time synchronization effect of the first device reflects the time synchronization effect of each device from the first device to the clock source device (these devices are the devices that the shortest path between the first device and the clock source device passes through). The time synchronization effect of the second device reflects the time synchronization effect of each device from the second device to the clock source device (these devices are the devices that the shortest path between the second device and the clock source device passes through). Then the time difference between the first device and the second device reflects the overall time synchronization effect of each device from the first device to the clock source device and from the second device to the clock source device. In this way, the time synchronization effect of multiple devices in the target network can be reflected by the time difference between two devices in the target network. In particular, when the number of devices from the first device to the clock source device and the number of devices from the second device to the clock source device are large, the time synchronization effect of most devices in the target network can be reflected by one time difference. Thereby effectively improving the efficiency of time synchronization performance detection of the target network. When the absolute value of the aforementioned time difference is greater than a preset threshold, it indicates that the time synchronization performance of at least one device from the first device to the clock source device and from the second device to the clock source device is abnormal.
[0083] Furthermore, if the target network includes a ring network, the first device and the second device are two devices on the ring network. Then the time synchronization effect of the first device reflects the time synchronization effect on the first path from the first device to the clock source device (the first path is the shortest path between the first device and the clock source device); the time synchronization effect of the second device reflects the time synchronization effect on the second path from the second device to the clock source device (the second path is the shortest path between the second device and the clock source device). The time difference between the first device and the second device reflects both the time difference on the third path from the first device to the second device (the third path is the shortest path between the first device and the second device) and the time difference on the fourth path from the first device to the second device. The fourth path is composed of the first path and the second path. The third path and the fourth path constitute the loop of the entire ring network. Therefore, the time difference between the first device and the second device actually reflects the time synchronization effect of the entire ring network. Figure 3Taking the ring network shown in FIG. 1 as an example, assuming that the first device is device 3 and the second device is device 5. Then the first path is the path formed by devices 1, 2 and 3; the second path is the path formed by devices 1 and 5; the third path is the path formed by devices 3, 4 and 5; the fourth path is the path formed by devices 3, 2, 1 and 5. When the absolute value of the aforementioned time difference is greater than the preset threshold, it indicates that the time synchronization performance of at least one device in the ring network is abnormal.
[0084] If the target network includes a ring network, the first device and the second device are two adjacent devices on the ring network, such as leaf devices. The time synchronization effect of the first device reflects the time synchronization effect on a semi-ring path from the first device to the clock source device; the time synchronization effect of the second device reflects the time synchronization effect on another semi-ring path from the second device to the clock source device. The time difference between the first device and the second device reflects the time synchronization effect of the entire ring network. Figure 3 Taking the ring network shown as an example, assuming that the first device is device 3 and the second device is device 4. Then one semi-ring path is the path formed by devices 1, 2 and 3; the other semi-ring path is the path formed by devices 1, 5 and 4. When the absolute value of the aforementioned time difference is greater than the preset threshold, it indicates that the time synchronization performance of at least one device in the ring network is abnormal.
[0085] To summarize, the embodiment of the present application reflects the time synchronization effect of multiple devices in the target network or even the entire ring network through the time difference between two specific devices (i.e., the first device and the second device), thereby effectively reducing the complexity of time synchronization performance detection and improving the efficiency of time synchronization performance detection of the target network.
[0086] S205: After determining that the time synchronization performance of the target network is abnormal, the first device sends abnormality indication information to the third device. The abnormality indication information is used to indicate that the time synchronization performance of the target network is abnormal.
[0087] In an embodiment of the present application, after determining that the time synchronization performance of the target network is abnormal, the first device can also notify the third device. For example, the third device is notified by sending abnormal indication information to the third device. In an optional implementation, the third device is the aforementioned management device, and the abnormal indication information can be management information or alarm information. After obtaining the abnormal indication information, the third device can issue a notification message. The notification message is used to notify the staff that the time synchronization performance of the target network is abnormal. In this way, it is convenient for the staff to locate the abnormal device in the target network in a timely manner, and repair or replace the abnormal device. In another optional implementation, the third device is a device in the target network that needs to be synchronized with the aforementioned clock source device, but has not yet been synchronized. The third device can determine that the time synchronization performance of the target network is abnormal based on the abnormal indication information, and prohibit time synchronization with the clock source device. To avoid invalid time after synchronization, reduce the impact of abnormal time synchronization performance of the target network on the third device. For example, when the first device and the second device are non-adjacent devices on the ring network, the third device is a device between the first device and the second device on the ring network. In another optional implementation, the third device is a pre-designated device. For example, it is a mobile terminal of a staff member. The staff member can use the third device to quickly and conveniently determine that the time synchronization performance of the target network is abnormal, so as to perform maintenance on the target network in a timely manner.
[0088] S204: When the absolute value of the time difference is not greater than a preset threshold, the first device determines that the time synchronization performance of the target network is normal.
[0089] Referring to S203, if the first device and the second device both perform time synchronization based on the 1588 protocol. The time difference between the first device and the second device reflects the overall time synchronization effect of each device from the first device to the clock source device and from the second device to the clock source device. When the absolute value of the aforementioned time difference is not greater than the preset threshold, it means that the time synchronization performance from the first device to the clock source device and from the second device to the clock source device are normal. Further, if the target network includes a ring network, the first device and the second device are two devices on the ring network. The time difference between the first device and the second device reflects the time synchronization effect of the entire ring network. When the absolute value of the aforementioned time difference is not greater than the preset threshold, it means that the time synchronization performance of the devices on the ring network is normal.
[0090] After determining that the time synchronization performance of the target network is normal, the first device may stop the action or send normal indication information to the third device, where the normal indication information is used to indicate that the time synchronization performance of the target network is normal.
[0091] It is worth noting that the aforementioned S201 to S205 can be executed periodically according to the time synchronization and detection needs of the target network. It can also be executed after the first specified condition is met. For example, it can be executed after the initial deployment of the target network; or it can be executed after the management device sends a trigger instruction to the target network to instruct time synchronization.
[0092] Alternatively, after the aforementioned S201 is executed, S202 to S205 may be executed periodically according to the detection needs of the target network, or may be executed after the second specified condition is met, for example, after each time synchronization of the target network; or, after the management device sends a trigger instruction to the device in the target network to instruct to perform performance anomaly detection.
[0093] Furthermore, the sequence of the steps of the method for detecting time synchronization performance provided in the embodiment of the present application can be appropriately adjusted, and the steps can be increased or decreased accordingly according to the situation. For example, the aforementioned S205 may not be executed. Any technician familiar with the technical field can easily think of a method of change within the technical scope disclosed in this application, which should be included in the protection scope of this application, so it will not be repeated.
[0094] In summary, in the embodiment of the present application, when both the first device and the second device have completed time synchronization, and the first device and the second device have no time synchronization relationship, it is determined whether the time synchronization performance of the target network is abnormal based on the time difference between the first device and the second device, thereby quickly determining whether the time synchronization performance of the target network is abnormal. And the method for detecting time synchronization performance does not need to use additional GPS instruments to detect the devices in the network one by one, which effectively improves the detection efficiency of the time synchronization performance of the target network. Furthermore, when the time difference is obtained based on the message transmitted between the first device and the second device, the time synchronization performance of the target network can also be detected in real time, reducing the detection delay and the cost of detection.
[0095] Figure 1 The application environment involved in the method for detecting time synchronization performance is described by taking a ring network formed by multiple communication devices 102 as an example. In actual implementation, the method for detecting time synchronization performance can also be applied to other types of networks. Figure 4 This is another schematic diagram of an application environment involved in a method for detecting time synchronization performance provided in an embodiment of the present application. In this application environment, a plurality of communication devices 102 included in a time synchronization system form a mesh network (also called a mesh network or mesh networking). Figure 4 Assume that the multiple communication devices 102 include communication devices 1021 to 1025. The mesh network can be divided into multiple ring networks according to the time synchronization requirements. The process of the method for detecting the time synchronization performance of each ring network can refer to the aforementioned Figure 2The process of the method for detecting time synchronization performance is provided. For example, Figure 4 The mesh network in the embodiment can be divided into three ring networks, namely, a first ring network composed of communication devices 1021, 1022, 1023 and 1024, a second ring network composed of communication devices 1023, 1024 and 1025, and a third ring network composed of communication devices 1021, 1024, 1025, 1023 and 1022. The way of dividing the mesh network into ring networks can be pre-configured or indicated by the management device 101.
[0096] Figure 2 The method for detecting time synchronization performance is performed by the first device as an example for explanation. In actual implementation, the method for detecting time synchronization performance can also be performed by the second device, or by the third device. When the method for detecting time synchronization performance is performed by the second device, the actions of the first device and the second device are swapped relative to the aforementioned S202 to S205. Figure 5 It is a flowchart of another method for detecting time synchronization performance provided in an embodiment of the present application. Figure 5 Assume that the method for detecting time synchronization performance is performed by a third device. The method can be applied to Figure 1 or Figure 4 In the application environment shown. Figure 5 As shown, the method includes:
[0097] S301. Devices in the target network perform time synchronization.
[0098] S302: The third device obtains the time difference between the first device and the second device. Execute S303 or S304.
[0099] The third device may obtain the time difference between the first device and the second device after determining that both the first device and the second device have completed time synchronization and the first device and the second device have no time synchronization relationship.
[0100] In an optional example, after the first device and the second device complete time synchronization respectively, they send a first communication message to the third device. The first notification message is used to indicate that the corresponding device has completed time synchronization. After receiving the first notification message sent by the first device and the second device, the third device determines that the first device and the second device have completed time synchronization respectively.
[0101] In the second optional example, the first device may send a second communication message to the third device after determining that both the first device and the second device have completed time synchronization. Alternatively, the second device may send a second communication message to the third device after determining that both the first device and the first device have completed time synchronization. The second notification message is used to indicate that the first device and the second device have completed time synchronization respectively. After receiving the second notification message, the third device determines that the first device and the second device have completed time synchronization respectively.
[0102] The manner in which the third device determines that the first device and the second device have no time synchronization relationship may include the following two manners.
[0103] In the first manner, if the time synchronization priority of the first device is the same as the time synchronization priority of the second device and both are the first priority, it is determined that there is no time synchronization relationship between the first device and the second device.
[0104] In an optional example, the first device or the second device may send a third communication message to the third device after determining that there is no time synchronization relationship between the first device and the second device. The third communication message is used to indicate that there is no time synchronization relationship between the first device and the second device. After receiving the third notification message, the third device determines that there is no time synchronization relationship between the first device and the second device. The process of the first device or the second device determining that there is no time synchronization relationship between the first device and the second device can refer to the first method in S202.
[0105] In another optional example, after completing time synchronization, the first device and the second device send a fourth communication message to the third device. The fourth notification message is used to indicate the time synchronization priority of the corresponding device. After receiving the fourth notification message sent by the first device and the second device, the third device determines that the time synchronization priority of the first device is the same as the time synchronization priority of the second device based on the time synchronization priority carried in the message, and both are the first priority. Accordingly, it is determined that there is no time synchronization relationship between the first device and the second device.
[0106] In the second manner, if the first device and the second device are a preset pair of devices that do not require time synchronization, it is determined that there is no time synchronization relationship between the first device and the second device.
[0107] For example, a pair of devices that do not require time synchronization can be set up through a third device. There is no need for time synchronization between the pair of devices, that is, the time synchronization relationship is terminated. The third device detects the pre-set information. When it is detected that the first device and the second device are a preset pair of devices that do not require time synchronization, it is determined that there is no time synchronization relationship between the first device and the second device.
[0108] The way in which the third device obtains the time difference can refer to the two optional implementations of obtaining the time difference between the first device and the second device in the aforementioned S202. It should be noted that, unlike the aforementioned first optional implementation, if the time difference is calculated by the first device, the first device sends the time difference to the third device after completing the time difference calculation. If the time difference is calculated by the second device, the second device sends the time difference to the third device after completing the time difference calculation. If the time difference is calculated by the third device, the third device does not need to send the time difference to the first device after completing the time difference calculation.
[0109] S303: When the absolute value of the time difference is greater than a preset threshold, the third device determines that the time synchronization performance of the target network is abnormal.
[0110] S304: When the absolute value of the time difference is not greater than a preset threshold, the third device determines that the time synchronization performance of the target network is normal.
[0111] The processes in the aforementioned S301, S303 and S304 may respectively correspond to the processes in the aforementioned S201, S203 and S204. This embodiment of the present application will not be elaborated on. It is worth noting that the aforementioned S301 to S304 may be executed periodically according to the time synchronization and detection needs of the target network, or may be executed after the aforementioned first specified condition is met. Alternatively, after the aforementioned S301 is executed, S302 to S304 may be executed periodically according to the detection needs of the target network, or may be executed after the aforementioned second specified condition is met.
[0112] In summary, in the embodiment of the present application, when both the first device and the second device complete time synchronization and there is no time synchronization relationship between the first device and the second device, whether the time synchronization performance of the target network is abnormal is determined based on the time difference between the first device and the second device, thereby quickly determining whether the time synchronization performance of the target network is abnormal. And the method for detecting time synchronization performance does not need to use additional GPS instruments to detect the devices in the network one by one, which effectively improves the detection efficiency of the time synchronization performance of the target network. In addition, the beneficial effects of the device embodiment are similar to the beneficial effects of the corresponding steps of the method, and will not be repeated below.
[0113] Figure 6It is a structural diagram of a device 40 for detecting time synchronization performance provided by an embodiment of the present application. The device 40 includes: an acquisition module 401 and a first determination module 402. Among them, the acquisition module 401 is used to obtain the time difference between the first device and the second device. The first device is in a state of completing time synchronization with the clock source device. The second device is in a state of completing time synchronization with the clock source device. There is no time synchronization relationship between the first device and the second device. The first determination module 402 is used to determine that the time synchronization performance of the target network is abnormal when the absolute value of the time difference is greater than a preset threshold. The target network is the network to which the first device and the second device belong.
[0114] Optionally, the acquisition module 401 is used to determine the time difference based on a first moment, a second moment, a third moment, and a fourth moment. The first moment is the moment when the first device sends the first message to the second device. The second moment is the moment when the second device receives the first message. The third moment is the moment when the second device sends the second message to the first device. The fourth moment is the moment when the first device receives the second message.
[0115] For example, the first device includes the device 40. The device 40 also includes: a first sending module and a receiving module. The first sending module is used to send the first message to the second device; the receiving module is used to receive the second message sent by the second device. Wherein, the first message and the second message both include a message type field, the message type field carries a performance detection identifier, and the performance detection identifier indicates that the message where the performance detection identifier is located is used to detect time synchronization performance.
[0116] In an optional implementation, the device 40 further includes: a second determination module. The second determination module is used to determine that there is no time synchronization relationship between the first device and the second device if the time synchronization priority of the first device is the same as the time synchronization priority of the second device and both are the first priority. In another optional implementation, the device 40 further includes: a third determination module. The third determination module is used to determine that there is no time synchronization relationship between the first device and the second device if both the first device and the second device are preset devices that do not require time synchronization.
[0117] Optionally, the apparatus 40 further includes: a second sending module. The second sending module is used to send abnormality indication information to a third device after determining that the time synchronization performance of the target network is abnormal. The abnormality indication information is used to indicate that the time synchronization performance of the target network is abnormal.
[0118] In an optional implementation, the first device is a device in the target network that is adjacent to the second device. Optionally, the devices in the target network can complete time synchronization based on the 1588 protocol.
[0119] For example, the target network includes a ring network, the ring network includes the first device and the second device, the preset threshold is the product of the total number of hops of the devices in the ring network and a set time length, and the set time length is an allowable synchronization deviation of one hop.
[0120] The embodiment of the present application provides a time synchronization system, including: a target network including at least three devices, the target network including the time synchronization performance determination device as described in any of the above embodiments. For example, the time synchronization system can be Figure 1 or Figure 4 The time synchronization system shown in FIG. 10 is a time synchronization system shown in FIG.
[0121] Figure 7 Schematic diagram of the structure of a device 50 provided in an embodiment of the present application. Figure 7 As shown, the device 50 includes: a processing chip 501 and a communication port 502 . Figure 7 The device 50 shown can be applied to the first device, the second device or the third device of the time synchronization system. The processing chip 501 can be a field programmable gate array (FPGA) or an application specific integrated circuit (ASIC) chip. The processing chip 501 is used to execute the method for detecting time synchronization performance provided by the aforementioned embodiment. The communication port 502 is used for the processing chip 501 to communicate with other devices. For example, the communication port 502 is an optical transceiver, which is used for the processing chip 501 to communicate with other devices through optical fibers.
[0122] In an optional implementation, the processing chip 501 includes a cache structure, such as a storage structure inside an FPGA or ASIC chip. In another optional implementation, the device 50 further includes: a memory. For example, the memory is a flash memory.
[0123] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product, which includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium, or a semiconductor medium (e.g., a solid-state hard disk), etc.
[0124] In this application, the terms "first", "second" and "third" are used for descriptive purposes only and should not be understood as indicating or implying relative importance. The term "at least one" means one or more, and the term "plurality" means two or more, unless otherwise expressly limited. A refers to B, which means that A is the same as B or A is a simple variation of B.
[0125] It should be noted that: when the time synchronization system provided in the above embodiment executes the method for detecting time synchronization performance, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the time synchronization system provided in the above embodiment and the method embodiment for detecting time synchronization performance belong to the same concept. The specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0126] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0127] The above description is only an optional 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 shall be included in the protection scope of the present application.
Claims
1. A method for detecting time synchronization performance, characterized in that: The method comprises: Acquire a time difference between a first device and a second device, wherein the first device is in a state of completing time synchronization with a clock source device, the second device is in a state of completing time synchronization with the clock source device, and there is no time synchronization relationship between the first device and the second device; When the absolute value of the time difference is greater than a preset threshold, it is determined that the time synchronization performance of the target network is abnormal, the target network is the network to which the first device and the second device belong, the target network includes a ring network, the ring network includes the first device and the second device, the preset threshold is the product of the total number of hops of the devices in the ring network and the set duration, and the set duration is the allowable synchronization deviation of one hop.
2. The method according to claim 1, characterized in that The method further comprises: If the time synchronization priority of the first device is the same as the time synchronization priority of the second device, and both are the first priority, it is determined that there is no time synchronization relationship between the first device and the second device.
3. The method according to claim 1, characterized in that The method further comprises: If the first device and the second device are a preset pair of devices that do not require time synchronization, it is determined that there is no time synchronization relationship between the first device and the second device.
4. The method according to claim 1, characterized in that: The acquiring the time difference between the first device and the second device includes: Determining the time difference based on the first moment, the second moment, the third moment, and the fourth moment; Among them, the first moment is the moment when the first device sends a first message to the second device, the second moment is the moment when the second device receives the first message, the third moment is the moment when the second device sends a second message to the first device, and the fourth moment is the moment when the first device receives the second message.
5. The method according to claim 4, characterized in that The method is performed by the first device, and the method further includes: Sending the first message to the second device; Receive the second message sent by the second device.
6. The method according to claim 4, characterized in that The first message and the second message both include a message type field, the message type field carries a performance detection identifier, and the performance detection identifier indicates that the message containing the performance detection identifier is used for detecting time synchronization performance.
7. The method according to claim 4, characterized in that The method further comprises: After determining that the time synchronization performance of the target network is abnormal, abnormal indication information is sent to a third device, where the abnormal indication information is used to indicate that the time synchronization performance of the target network is abnormal.
8. The method according to claim 1, characterized in that The first device is a device adjacent to the second device in the target network.
9. The method according to any one of claims 1 to 8, characterized in that: The devices in the target network complete time synchronization based on the 1588 protocol.
10. A device for detecting time synchronization performance, characterized in that: The device comprises: an acquisition module, configured to acquire a time difference between a first device and a second device, wherein the first device is in a state of completing time synchronization with a clock source device, the second device is in a state of completing time synchronization with the clock source device, and there is no time synchronization relationship between the first device and the second device; The first determination module is used to determine that the time synchronization performance of the target network is abnormal when the absolute value of the time difference is greater than a preset threshold value, the target network is the network to which the first device and the second device belong, the target network includes a ring network, the ring network includes the first device and the second device, the preset threshold value is the product of the total number of hops of the devices in the ring network and a set duration, and the set duration is an allowable synchronization deviation of one hop.
11. The device according to claim 10, characterized in that The device also includes: The second determination module is used to determine that there is no time synchronization relationship between the first device and the second device if the time synchronization priority of the first device is the same as the time synchronization priority of the second device and both are first priority.
12. The device according to claim 10, characterized in that The device also includes: The third determination module is configured to determine that there is no time synchronization relationship between the first device and the second device if the first device and the second device are a preset pair of devices that do not require time synchronization.
13. The device according to claim 10, characterized in that The acquisition module is used to: Determining the time difference based on the first moment, the second moment, the third moment, and the fourth moment; Among them, the first moment is the moment when the first device sends a first message to the second device, the second moment is the moment when the second device receives the first message, the third moment is the moment when the second device sends a second message to the first device, and the fourth moment is the moment when the first device receives the second message.
14. The device according to claim 13, characterized in that The first device includes the apparatus, and the apparatus further includes: A first sending module, used to send the first message to the second device; A receiving module is used to receive the second message sent by the second device.
15. The device according to claim 13, characterized in that The first message and the second message both include a message type field, the message type field carries a performance detection identifier, and the performance detection identifier indicates that the message containing the performance detection identifier is used for detecting time synchronization performance.
16. The device according to claim 13, characterized in that The device also includes: The second sending module is used to send abnormality indication information to a third device after determining that the time synchronization performance of the target network is abnormal, where the abnormality indication information is used to indicate that the time synchronization performance of the target network is abnormal.
17. The device according to claim 10, characterized in that The first device is a device adjacent to the second device in the target network.
18. The device according to any one of claims 10 to 17, characterized in that The devices in the target network complete time synchronization based on the 1588 protocol.
19. A time synchronization system, characterized in that: include: A target network comprising at least three devices, wherein the target network comprises the apparatus for detecting time synchronization performance as claimed in any one of claims 10 to 18.
20. A communication device, characterized in that: The communication device comprises: a processing chip and a communication port, The processing chip is used to execute the method for detecting time synchronization performance according to any one of claims 1 to 9; The communication port is used for the processing chip to communicate with other devices.
21. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions instruct a device to execute any one of the methods of claims 1 to 9.
Citation Information
Patent Citations
Detector and method for detecting abnormality in time synchronization
US20070274349A1