A method for selecting and switching a redundant master clock
By selecting redundant master clocks in the clock synchronization network and switching quickly in the event of a failure, the problem of excessive network switching time caused by the best master clock failure is solved, and the reliability and stability of the time-sensitive network is improved.
Patent Information
- Application Number
- CN202210247936.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-14
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2042-03-14
AI Technical Summary
When the best master clock in the prior art fails, reselecting a new best master clock causes too long network switching times, affecting the reliability of time-sensitive applications and low-latency communication services.
Provide a redundant master clock selection method. By receiving candidate clock information and determining the redundant master clock according to preset comparison rules, the synchronization information selected by the best master clock is not required to add additional messages, and the redundant master clock is selected, and the redundant master clock is selected without additional messages. In case of failure, the redundant master clock is quickly switched through the inquiry mechanism.
Effectively avoid bandwidth consumption caused by signaling interaction caused by redundant technology, improve the performance and service quality of time-sensitive networks, quickly judge and handle the best master clock failure, reduce information processing errors, and improve the reliability of the clock synchronization network Sex and stability.
Smart Images

Figure CN114826466B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication clock synchronization, and in particular to a method for selecting and switching a redundant master clock. Background Art
[0002] With the rapid development of emerging applications such as industrial automation and autonomous driving, the sensors and control systems deployed need to transmit a large amount of data in real time and reliably. Traditional technologies can no longer meet the communication needs of such applications. Therefore, time-sensitive networking (TSN) technology with high bandwidth and low latency has emerged. Clock synchronization, as the core key technology of time-sensitive networking technology, is the basis for TSN technology to ensure the real-time and reliability of communication. In order to ensure the clock synchronization of devices in the network, the TSN working group has successively developed protocol versions such as IEEE 802.1AS and IEEE 802.1AS2020. These protocols are based on IEEE 1588v2. Through algorithms such as the Best Master Clock Algorithm (BMCA), the best master clock (Grand Master, GM) is selected in the network, and the network clock synchronization spanning tree is constructed with GM as the time base standard. After that, GM periodically sends synchronization information, which is passed down along the clock synchronization tree, and finally the clock synchronization of the entire network is achieved.
[0003] As can be seen from the above, the selection of GM and the performance of GM will directly affect the performance of clock synchronization, thereby affecting the performance of TSN. When a GM fails, the clock synchronization network will again determine a new GM and establish a new clock synchronization path according to the selection algorithm such as BMCA, which causes the clock synchronization network to spend more time to resynchronize, making TSN unable to guarantee the reliability and low latency of time-sensitive applications. Considering this problem, the IEEE 802.1AS-2020 protocol proposes that a redundant clock method should be adopted, that is, in addition to selecting a GM, a redundant GM is provided. When the GM fails, it can quickly switch to the redundant GM and the corresponding synchronization path, thereby reducing the time for reestablishing the time synchronization path. However, the protocol does not provide a method for selecting a redundant master clock and a method for forming a redundant synchronization path. The existing method provides a redundant path support method, where the slave node receives synchronization information from two different directions and selects the synchronization information with a shorter transmission path to synchronize the local clock. However, this method requires the network to run two synchronization paths at the same time, resulting in an increase in network load. In addition, when the GM encounters a failure, how to quickly switch has not yet been studied.
[0004] Therefore, how to provide a method for selecting and switching a redundant master clock to overcome the above-mentioned defects in the prior art has increasingly become one of the technical problems that those skilled in the art need to solve urgently. Summary of the invention
[0005] The purpose of the present invention is to provide a method for selecting and switching a redundant master clock to solve the problem in the prior art that when the best master clock fails, the switching time is greatly affected due to the reselection of a new best master clock, and the network service cannot provide low-latency, high-reliability communication services.
[0006] In order to achieve the above object, the present invention provides a redundant master clock selection method, comprising the following steps:
[0007] The clock synchronization node receives candidate clock information within a preset period, wherein the clock synchronization node includes current clock information;
[0008] S2: According to a preset comparison rule, obtain a comparison result between the current clock information and the candidate clock information, and confirm a redundant master clock according to the comparison result.
[0009] Optionally, in step S2, obtaining a comparison result between the current clock information and the candidate clock information according to a preset comparison rule, and selecting a redundant master clock according to the comparison result, includes:
[0010] S21: for each of the candidate clock information received by the clock synchronization node within the preset period, compare the priority vector of the candidate clock information with the priority vector of the current clock information according to a comparison rule of the priority vectors, and determine new current clock information according to the comparison result;
[0011] S22: Selecting the redundant master clock according to the new current clock information;
[0012] Among them, the priority vector includes: seven clock attribute elements, namely: a first clock priority, a clock quality level, a clock accuracy, a clock stability, a second clock priority, a clock identification information and the number of hops from the current node to the current super master; wherein, the priorities of the seven clock attribute elements are: the first clock priority > the clock quality level > the clock accuracy > the clock stability > the second clock priority > the clock identification information, and the priority of the number of hops from the current node to the current super master is between any two priorities, the highest priority or the lowest priority.
[0013] Optionally, the comparison rule of the priority vector in step S21, comparing the priority vector of the candidate clock information with the priority vector of the current clock information, and determining new current clock information according to the comparison result, includes:
[0014] S211: Determine whether the first clock priority of the current clock information is less than the first clock priority of the candidate clock information. If so, use the current clock information as the new current clock information. If not, determine whether the first clock priority of the current clock information is greater than the first clock priority of the candidate clock information. If so, use the candidate clock information as the new current clock information. If not, execute step S212.
[0015] S212: Determine whether the clock quality level of the current clock information is less than the clock quality level of the candidate clock information. If so, use the current clock information as the new current clock information. If not, determine whether the clock quality level of the current clock information is greater than the clock quality level of the candidate clock information. If so, use the candidate clock information as the new current clock information. If not, execute step S213.
[0016] S213: Determine whether the number of hops from the current node of the current clock information to the current super master is greater than the number of hops from the current node of the candidate clock information to the current super master. If so, use the current clock information as the new current clock information; if not, determine whether the number of hops from the current node of the current clock information to the current super master is less than the number of hops from the current node of the candidate clock information to the current super master. If so, use the candidate clock information as the new current clock information; if not, execute step S214;
[0017] S214: Determine whether the clock accuracy of the current clock information is less than the clock accuracy of the candidate clock information. If so, use the current clock information as the new current clock information. If not, determine whether the clock accuracy of the current clock information is greater than the clock accuracy of the candidate clock information. If so, use the candidate clock information as the new current clock information. If not, execute step S215.
[0018] S215: Determine whether the clock stability of the current clock information is less than the clock stability of the candidate clock information. If so, use the current clock information as the new current clock information. If not, determine whether the clock stability of the current clock information is greater than the clock stability of the candidate clock information. If so, use the candidate clock information as the new current clock information. If not, execute step S216.
[0019] S216: Determine whether the second clock priority of the current clock information is less than the second clock priority of the candidate clock information, if so, use the current clock information as the new current clock information; if not, determine whether the second clock priority of the current clock information is greater than the second clock priority of the candidate clock information, if so, use the candidate clock information as the new current clock information; if not, execute step S217;
[0020] S217: Compare the sizes of the clock identification information of the current clock information and the clock identification information of the candidate clock information, and use the one with smaller clock identification information as the new current clock information.
[0021] Optionally, step S1 further includes: using the new current clock information obtained by combining the previous candidate clock information with the current clock information as the current clock information, for comparison with the previous candidate clock information according to a comparison rule of a priority vector;
[0022] Step S2 includes: taking new current clock information obtained by comparing the last candidate clock information with the current clock information as a redundant master clock.
[0023] Optionally, after acquiring the redundant master clock, the method further includes confirming the synchronization path of the redundant master clock in the following manner:
[0024] According to the synchronization path generation protocol, the synchronization path is automatically generated according to the redundant master clock; or according to the preset port comparison rule, the port status of the current clock information and the candidate clock information are compared, and the synchronization path of the redundant master clock is obtained according to the comparison result of the port status.
[0025] Optionally, comparing the port status of the current clock information and the candidate clock information according to a preset port comparison rule, and acquiring the synchronization path of the redundant master clock according to the comparison result of the port status, including:
[0026] Step A1: for each candidate time information, according to the comparison rule of the port priority vector, compare the port priority vector of the candidate clock information with the port priority vector of the current clock information, and determine the master node according to the comparison result;
[0027] Step A2: confirming the synchronization path of the redundant master clock in combination with the plurality of master nodes according to a preset synchronization path determination rule;
[0028] Among them, the port priority vector includes three port elements, namely: the number of hops from the currently recognized redundant master clock, the port identifier of the sending message, and the port number of the receiving message port; the priority of the three port priority elements is: the number of hops from the currently recognized redundant master clock> the port identifier of the sending message> the port number of the receiving message port.
[0029] Optionally, in step A1, comparing the port priority vector of the candidate clock information with the port priority vector of the current clock information according to the comparison rule of the port priority vector, and determining the master node according to the comparison result includes the following steps:
[0030] Step A11: Determine whether the number of hops from the current clock information to the currently recognized redundant master clock is less than the number of hops from the candidate clock information to the currently recognized redundant master clock. If so, use the clock synchronization node where the current clock information is located as the master node; if not, determine whether the number of hops from the current clock information to the currently recognized redundant master clock is greater than the number of hops from the candidate clock information to the currently recognized redundant master clock. If so, use the clock synchronization node where the candidate clock information is located as the master node; if not, execute step A12;
[0031] Step A12: Determine whether the port identifier of the message sent by the current clock information is smaller than the port identifier of the message sent by the candidate clock information. If so, take the clock synchronization node where the current clock information is located as the master node; if not, determine whether the port identifier of the message sent by the current clock information is larger than the port identifier of the message sent by the candidate clock information. If so, take the clock synchronization node where the candidate clock information is located as the master node; if not, execute step A13;
[0032] Step A13: Determine whether the port number of the receiving message port of the current clock information is smaller than the port number of the receiving message port of the candidate clock information. If so, take the clock synchronization node where the current clock information is located as the master node; if not, determine whether the port number of the receiving message port of the current clock information is larger than the port number of the receiving message port of the candidate clock information. If so, take the clock synchronization node where the candidate clock information is located as the master node; if not, take either the clock synchronization node where the current clock information is located or the clock synchronization node where the candidate clock information is located as the master node.
[0033] The present invention also provides a redundant master clock switching method, comprising switching the optimal master clock and the redundant master clock selected by any one of the above selection methods, the switching method comprising the following steps:
[0034] Step B1: Determine whether the neighboring node adjacent to the best master clock node receives the synchronization information sent by the best master clock or the redundant master clock within a preset receiving time. If not, execute step B2; if yes, execute step B4;
[0035] Step B2: Sending a query message to the best master clock through the neighbor node to determine whether the neighbor node receives the reply message of the best master clock within the preset reply time. If not, execute step B3; if yes, execute step B4.
[0036] Step B3: Determine that the best master clock fails or the link connected to the best master clock fails, and broadcast the switching information of replacing the best master clock with the redundant master clock through the neighboring nodes. After receiving the switching information, all the clock synchronization nodes in the network enable the synchronization information of the redundant master clock, discard the received synchronization information of the best master clock, and periodically send synchronization information through the redundant master clock synchronization path;
[0037] Step B4: Determine that the best master clock is normal, and continue to use the synchronization information of the best master clock.
[0038] Optionally, the preset receiving time in step B1 satisfies the following formula:
[0039] SyncTimeout=syncInterval*2+residentTime
[0040] Among them, the SyncTimeout is the preset receiving time, the syncInterval is the time interval for the best master clock to send synchronization messages, and the residentTime is the time for the adjacent node to process and forward the message.
[0041] Optionally, the preset response time in step B2 satisfies the following formula:
[0042] respondTimeout=transmissiondelay*2+esidentTime
[0043] Among them, the respondTimeout is the preset response time and the transmissiondelay is the transmission time required for the synchronization message from the best master clock to the neighbor node.
[0044] Compared with the prior art, the method for selecting and switching a redundant master clock provided by the present invention has the following beneficial effects:
[0045] The present invention provides a method for selecting a redundant master clock. First, a clock synchronization node receives candidate clock information within a preset period, wherein the clock synchronization node contains current clock information; then, according to a preset comparison rule, a comparison result between the current clock information and the candidate clock information is obtained, and the redundant master clock is confirmed according to the comparison result. The method for selecting a redundant master clock provided by the present invention selects the redundant master clock while selecting the best master clock, and in the process of selecting synchronization information using the best master clock, no new messages are added. Therefore, bandwidth resource consumption caused by a large amount of signaling interaction caused by redundant technology can be avoided, thereby effectively ensuring the performance and service quality of time-sensitive network technology.
[0046] Furthermore, the present invention provides a method for switching a redundant master clock, which first determines whether the neighboring nodes adjacent to the best master clock node receive the synchronization information sent by the best master clock or the redundant master clock within a preset receiving time. If so, the best master clock is determined to be normal and the synchronization information of the best master clock continues to be used. If not, a query message is sent to the best master clock through the neighboring node, and it is determined whether the neighboring node receives the reply information of the best master clock within a preset reply time. If so, the best master clock is still determined to be normal and the synchronization information of the best master clock continues to be used. Otherwise, if it is determined that the best master clock is faulty or the link connected to the best master clock is faulty, the switching information broadcast network of the best master clock to be replaced by the redundant master clock is broadcasted through the neighboring node, and all the clock synchronization nodes in the network enable the synchronization information of the redundant master clock after receiving the switching information, discard the received synchronization information of the best master clock, and periodically send synchronization information through the redundant master clock synchronization path. The redundant master clock switching method provided by the present invention can not only quickly determine whether the optimal master clock is faulty and take corresponding measures after determining the fault through the inquiry mechanism, but also avoid the problem of confusion in the synchronization process caused by the simultaneous existence of the synchronization signaling of the optimal master clock and the redundant master clock during the switching process of the network master clock after the optimal master clock fails. At the same time, it can reduce the problem of information processing errors caused by the clustering of clock synchronization information, thereby effectively improving the reliability and stability of the clock synchronization network. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 A flow chart of a redundant master clock selection method provided by an embodiment of the present invention;
[0048] Figure 2 A redundant master clock attribute comparison process provided by an embodiment of the present invention;
[0049] Figure 3 The port status between adjacent nodes provided by an embodiment of the present invention;
[0050] Figure 4 A method for quickly switching between an optimal master clock and a redundant master clock provided by an embodiment of the present invention;
[0051] Figure 5 A network topology structure provided by an embodiment of the present invention;
[0052] Figure 6 A comparison of the time required for network recovery by rebuilding the clock synchronization tree through BMCA provided in an embodiment of the present invention and the redundant synchronization network proposed in the method. DETAILED DESCRIPTION
[0053] The specific implementation of the present invention will be described in more detail below in conjunction with the schematic diagram. The advantages and features of the present invention will become clearer based on the following description. It should be noted that the drawings are all in a very simplified form and are not in exact proportions, and are only used to facilitate and clearly assist in explaining the purpose of the embodiments of the present invention.
[0054] Embodiment 1
[0055] This embodiment provides a redundant master clock selection method. For details, see Figure 1 , Figure 1 This is a flow chart of the method involved in the present invention. It can be seen from the figure that the selection method includes the following steps:
[0056] S1: The clock synchronization node receives candidate clock information within a preset period, wherein the clock synchronization node includes current clock information;
[0057] S2: According to a preset comparison rule, obtain a comparison result between the current clock information and the candidate clock information, and confirm a redundant master clock according to the comparison result.
[0058] With such a setting, the redundant master clock selection method provided by the present invention selects a redundant master clock while selecting the best master clock, and uses the synchronization information selected by the best master clock without adding any new messages. Therefore, it can effectively avoid the bandwidth resource consumption caused by a large amount of signaling interaction brought about by redundant technology, thereby effectively ensuring the performance and service quality of time-sensitive network technology.
[0059] Preferably, in step S2, obtaining a comparison result between the current clock information and the candidate clock information according to a preset comparison rule, and selecting a redundant master clock according to the comparison result, includes:
[0060] S21: for each of the candidate clock information received by the clock synchronization node within the preset period, compare the priority vector of the candidate clock information with the priority vector of the current clock information according to a comparison rule of the priority vectors, and determine new current clock information according to the comparison result;
[0061] S22: Selecting the redundant master clock according to the new current clock information;
[0062] Wherein, the priority vector includes: seven clock attribute elements, namely: first clock priority (priority1), clock quality level (clockClass), clock accuracy (clockAccuracy), clock stability (offsetScaledLogVariance), second clock priority (priority2), clock identification information (clockIdentity) and the number of hops (stepsRemoved) of the current node from the current super master; wherein, the priorities of the seven clock attribute elements are: the first clock priority (priority1)> the clock quality level (clockClass)> the clock accuracy (clockAccuracy)> the clock stability (offsetScaledLogVariance)> the second clock priority (priority2)> the clock identification information (clockIdentity), and the priority of the number of hops (stepsRemoved) of the current node from the current super master is between any two priorities, the highest priority or the lowest priority. Therefore, the selection method provided by the present invention can determine the current suboptimal master clock by comparing the sizes of the seven elements, and at the same time use the current suboptimal master clock as the redundant master clock.
[0063] See attached Figure 2 , Figure 2 The redundant master clock attribute comparison process provided by an embodiment of the present invention, as can be seen from the figure, in step S21, according to the comparison rule of the priority vector, the priority vector of the candidate clock information is compared with the priority vector of the current clock information, and the new current clock information is determined according to the comparison result, including:
[0064] S211: Determine whether the first clock priority (priority1) of the current clock information is less than the first clock priority (priority1) of the candidate clock information. If so, use the current clock information as the new current clock information. If not, determine whether the first clock priority (priority1) of the current clock information is greater than the first clock priority (priority1) of the candidate clock information. If so, use the candidate clock information as the new current clock information. If not, execute step S212.
[0065] S212: Determine whether the clock quality class (clockClass) of the current clock information is less than the clock quality class (clockClass) of the candidate clock information. If so, use the current clock information as the new current clock information. If not, determine whether the clock quality class (clockClass) of the current clock information is greater than the clock quality class (clockClass) of the candidate clock information. If so, use the candidate clock information as the new current clock information. If not, execute step S213.
[0066] S213: Determine whether the number of hops (stepsRemoved) from the current node of the current clock information to the current super master is greater than the number of hops (stepsRemoved) from the current node of the candidate clock information to the current super master. If so, use the current clock information as the new current clock information; if not, determine whether the number of hops (stepsRemoved) from the current node of the current clock information to the current super master is less than the number of hops (stepsRemoved) from the current node of the candidate clock information to the current super master. If so, use the candidate clock information as the new current clock information; if not, execute step S214;
[0067] S214: Determine whether the clock accuracy (clockAccuracy) of the current clock information is less than the clock accuracy (clockAccuracy) of the candidate clock information. If so, use the current clock information as the new current clock information. If not, determine whether the clock accuracy (clockAccuracy) of the current clock information is greater than the clock accuracy (clockAccuracy) of the candidate clock information. If so, use the candidate clock information as the new current clock information. If not, execute step S215.
[0068] S215: Determine whether the clock stability (offsetScaledLogVariance) of the current clock information is less than the clock stability (offsetScaledLogVariance) of the candidate clock information. If so, use the current clock information as the new current clock information. If not, determine whether the clock stability (offsetScaledLogVariance) of the current clock information is greater than the clock stability (offsetScaledLogVariance) of the candidate clock information. If so, use the candidate clock information as the new current clock information. If not, execute step S216.
[0069] S216: Determine whether the second clock priority (priority2) of the current clock information is less than the second clock priority (priority2) of the candidate clock information. If so, use the current clock information as the new current clock information; if not, determine whether the second clock priority (priority2) of the current clock information is greater than the second clock priority (priority2) of the candidate clock information. If so, use the candidate clock information as the new current clock information; if not, execute step S217;
[0070] S217: Compare the sizes of the clock identification information (clockIdentity) of the current clock information and the candidate clock information, and use the clock identification information (clockIdentity) with the smaller size as the new current clock information.
[0071] Thus, by comparing the priority order of the seven clock elements, the redundant master clock can be quickly selected. At the same time, because the present invention adds the number of hops (stepsRemoved) from the current node to the current super master, the redundant master clock selected by the present invention also takes the clock position into consideration, and selects the redundant master clock away from the best master clock, thereby avoiding the problem that the synchronization information of the best master clock and the redundant master clock cannot be transmitted to each node of the network due to a communication link failure. And the priority of the number of hops (stepsRemoved) from the current node to the current super master can also be set according to the user's network environment, so it can also meet various network environment requirements.
[0072] Preferably, step S1 further comprises: taking the new current clock information obtained by combining the previous candidate clock information with the current clock information as the current clock information, for comparison with the previous candidate clock information according to a comparison rule of a priority vector;
[0073] Step S2 includes: comparing the last candidate clock information with the current clock information to obtain the new current clock information as the redundant master clock. Thus, it is ensured that the redundant master clock selected by the selection method provided by the present invention is selected after fully comparing all the candidate clock information that the clock synchronization node can receive within the cycle, thereby ensuring the correctness of the redundant master clock.
[0074] Preferably, after acquiring the redundant master clock, the method further comprises confirming the synchronization path of the redundant master clock in the following manner:
[0075] According to the synchronization path generation protocol, the synchronization path is automatically generated according to the redundant master clock; or according to the preset port comparison rule, the port status of the current clock information and the candidate clock information is compared, and the synchronization path of the redundant master clock is obtained according to the comparison result of the port status. Thus, by selecting the synchronization path of the redundant master clock, it is ensured that the synchronization information sent by each node can be normally transmitted along the synchronization path.
[0076] Preferably, comparing the port status of the current clock information and the candidate clock information according to a preset port comparison rule, and acquiring the synchronization path of the redundant master clock according to the comparison result of the port status, includes:
[0077] Step A1: for each candidate time information, according to the comparison rule of the port priority vector, compare the port priority vector of the candidate clock information with the port priority vector of the current clock information, and determine the master node according to the comparison result;
[0078] Step A2: confirming the synchronization path of the redundant master clock in combination with the plurality of master nodes according to a preset synchronization path determination rule;
[0079] The port priority vector includes three port elements, namely: the number of hops from the currently recognized redundant master clock (substepsRemoved), the port identifier of the message sent (subsourcePortIdentity), and the port number of the message receiving port (subportNumber); the priorities of the three port priority elements are: the number of hops from the currently recognized redundant master clock (substepsRemoved)> the port identifier of the message sent (subsourcePortIdentity)> the port number of the message receiving port (subportNumber). Therefore, by comparing the priorities of the three port priority elements, the port status connecting the adjacent nodes can be finally determined. Thus, the synchronization path can be quickly confirmed.
[0080] See also Figure 3 , Figure 3 The port status between adjacent nodes provided by an embodiment of the present invention can be seen from the figure that, according to the comparison rule of the port priority vectors, the port priority vector of the candidate clock information is compared with the port priority vector of the current clock information in step A1, and the master node is determined according to the comparison result, including the following steps:
[0081] Step A11: Determine whether the number of hops (substepsRemoved) of the current clock information from the currently recognized redundant master clock is less than the number of hops (substepsRemoved) of the candidate clock information from the currently recognized redundant master clock. If so, take the clock synchronization node where the current clock information is located as the master node; if not, determine whether the number of hops (substepsRemoved) of the current clock information from the currently recognized redundant master clock is greater than the number of hops (substepsRemoved) of the candidate clock information from the currently recognized redundant master clock. If so, take the clock synchronization node where the candidate clock information is located as the master node; if not, execute step A12;
[0082] Step A12: Determine whether the port identifier (subsourcePortIdentity) of the sending message of the current clock information is smaller than the port identifier (subsourcePortIdentity) of the sending message of the candidate clock information. If so, take the clock synchronization node where the current clock information is located as the master node; if not, determine whether the port identifier (subsourcePortIdentity) of the sending message of the current clock information is larger than the port identifier (subsourcePortIdentity) of the sending message of the candidate clock information. If so, take the clock synchronization node where the candidate clock information is located as the master node; if not, execute step A13;
[0083] Step A13: Determine whether the port number (subportNumber) of the receiving message port of the current clock information is less than the port number (subportNumber) of the receiving message port of the candidate clock information. If so, take the clock synchronization node where the current clock information is located as the master node; if not, determine whether the port number (subportNumber) of the receiving message port of the current clock information is greater than the port number (subportNumber) of the receiving message port of the candidate clock information. If so, take the clock synchronization node where the candidate clock information is located as the master node; if not, take the clock synchronization node where the current clock information is located or the clock synchronization node where the candidate clock information is located as the master node. Thus, the port status connecting the adjacent nodes can be finally determined by successive comparisons, thereby generating a synchronization path and ensuring that the synchronization information sent by the clock synchronization node can be transmitted normally.
[0084] Embodiment 2
[0085] The present invention also provides a redundant master clock switching method, see Figure 4 , Figure 4 A method for quickly switching between the best master clock and the redundant master clock provided by an embodiment of the present invention; as can be seen from the figure, the switching method includes switching between the best master clock and the redundant master clock selected by any of the above selection methods, and the switching method includes the following steps:
[0086] Step B1: Determine whether the neighboring node adjacent to the best master clock node receives the synchronization information sent by the best master clock or the redundant master clock within a preset receiving time. If not, execute step B2; if yes, execute step B4;
[0087] Step B2: Sending a query message to the best master clock through the neighbor node to determine whether the neighbor node receives the reply message of the best master clock within the preset reply time. If not, execute step B3; if yes, execute step B4.
[0088] Step B3: Determine that the best master clock fails or the link connected to the best master clock fails, and broadcast the switching information of replacing the best master clock with the redundant master clock through the neighboring nodes. After receiving the switching information, all the clock synchronization nodes in the network enable the synchronization information of the redundant master clock, discard the received synchronization information of the best master clock, and periodically send synchronization information through the redundant master clock synchronization path;
[0089] Step B4: Determine that the best master clock is normal, and continue to use the synchronization information of the best master clock.
[0090] With such a configuration, the redundant master clock switching method provided by the present invention can not only quickly determine whether the best master clock is faulty and take corresponding measures through the inquiry mechanism, but also avoid the problem of confusion in the synchronization process caused by the simultaneous existence of the best master clock and the redundant master clock synchronization signaling during the switching process of the network master clock after the best master clock fails. At the same time, it can reduce the information processing error problem caused by the clustering of clock synchronization information, thereby effectively improving the reliability and stability of the clock synchronization network. It should be further explained that, among them, the method for selecting the best master clock includes: after the clock synchronization network starts to run, adjacent nodes send Announce messages to each other, and the Announce messages carry clock information for determining the best master clock and the redundant master clock, which are respectively located in different fields of the Announce message. When the clock synchronization node receives the Announce message sent by the adjacent node, it compares the received best master clock information, redundant master clock information with the best master clock information and redundant master clock information stored by itself, and obtains the best master clock by the data set comparison method in the BMCA algorithm using the four clock information obtained.
[0091] Preferably, the preset receiving time in step B1 satisfies the following formula:
[0092] SyncTimeout=syncInterval*2+residentTime
[0093] The preset response time in step B2 satisfies the following formula:
[0094] respondTimeout=transmissiondelay*2+residentTime
[0095] Among them, the SyncTimeout is the preset receiving time, the syncInterval is the time interval for the best master clock to send synchronization messages, the residentTime is the time for the neighboring node to process and forward the message, the respondTimeout is the preset reply time, and the transmissiondelay is the transmission time required for the synchronization message from the best master clock to the neighboring node. Therefore, a time basis is provided for determining whether the best master clock is faulty.
[0096] For details, please refer to Figure 5 , Figure 5A network topology structure is provided for an embodiment of the present invention. As can be seen from the figure, when bridge 1 does not receive the synchronization information sent by the best master clock within the syncTimeout time, bridge 1 will actively send an inquiry message to the best master clock. When no reply from the best master clock is received within the respondTimeout time, it is determined that the current best master clock is faulty. Bridge 1 will broadcast the best master clock switching information to the network to inform all nodes that the current best master clock has failed and the redundant master clock will be enabled. Synchronization information will be periodically sent through the redundant master clock synchronization path, and clock synchronization will be performed through the synchronization information sent by the redundant master clock.
[0097] In addition, in order to verify that the redundant mechanism clock synchronization network can recover from the fault more quickly when a fault occurs, the present invention compares and simulates the existing BMCA algorithm to rebuild the clock synchronization spanning tree and the redundant master clock switching method proposed in this paper. Figure 6 The simulation results are shown in Figure 2. Figure 6 The simulation results show that the time required to rebuild the clock synchronization spanning tree through the BMCA algorithm is greatly affected by the number of network nodes. When the number of nodes in the network increases, it will take a lot of time to establish the clock synchronization spanning tree structure through the BMCA algorithm, while the time consumed by the redundant master clock switching method has little effect on the number of nodes in the network. Therefore, when there are many nodes in the clock synchronization network, the time to restore the network using the redundancy mechanism will be greatly reduced compared to the time to rebuild the clock synchronization network through the BMCA algorithm. It can ensure that the clock synchronization network can quickly recover from the fault when a fault occurs, thereby effectively improving the reliability of the clock synchronization network.
[0098] It should be noted that the systems and methods disclosed in the embodiments of this article can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architectures, functions and operations of the devices, methods and computer program products according to the multiple embodiments of this article. In this regard, each box in the flowchart or block diagram can represent a part of a module, program or code, and the module, program segment or part of the code contains one or more executable instructions for implementing the specified logical functions, and the module, program segment or part of the code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0099] In summary, the redundant master clock selection method provided by the present invention selects a redundant master clock while selecting the best master clock, and uses the synchronization information selected by the best master clock without adding any new messages. Therefore, it can effectively avoid the bandwidth resource consumption caused by a large amount of signaling interaction brought about by redundant technology, thereby effectively ensuring the performance and service quality of time-sensitive network technology.
[0100] The redundant master clock switching method provided by the present invention can not only quickly determine whether the optimal master clock is faulty and take corresponding measures through the inquiry mechanism, but also avoid the problem of confusion in the synchronization process caused by the simultaneous existence of the synchronization signaling of the optimal master clock and the redundant master clock during the switching process of the network master clock after the optimal master clock fails. At the same time, it can reduce the information processing error problem caused by the clustering of clock synchronization information, thereby effectively improving the reliability and stability of the clock synchronization network.
[0101] The above is only a preferred embodiment of the present invention and does not limit the present invention in any way. Any technician in the relevant technical field, without departing from the scope of the technical solution of the present invention, makes any form of equivalent replacement or modification to the technical solution and technical content disclosed in the present invention, which does not depart from the content of the technical solution of the present invention and still falls within the protection scope of the present invention.
Claims
1. A method for selecting a redundant master clock, characterized in that: The following steps are involved: S1: The clock synchronization node receives candidate clock information within a preset period, wherein the clock synchronization node includes current clock information; S2: Obtaining a comparison result between the current clock information and the candidate clock information according to a preset comparison rule, and confirming a redundant master clock according to the comparison result; In step S2, obtaining a comparison result between the current clock information and the candidate clock information according to a preset comparison rule, and confirming a redundant master clock according to the comparison result, includes: S21: for each of the candidate clock information received by the clock synchronization node within the preset period, compare the priority vector of the candidate clock information with the priority vector of the current clock information according to a comparison rule of the priority vectors, and determine new current clock information according to the comparison result; S22: Selecting the redundant master clock according to the new current clock information; Among them, the priority vector includes: seven clock attribute elements, namely: a first clock priority, a clock quality level, a clock accuracy, a clock stability, a second clock priority, a clock identification information and the number of hops from the current node to the current super master; wherein, the priorities of the seven clock attribute elements are: the first clock priority > the clock quality level > the clock accuracy > the clock stability > the second clock priority > the clock identification information, and the priority of the number of hops from the current node to the current super master is between any two priorities, the highest priority or the lowest priority.
2. A redundant master clock selection method as claimed in claim 1, characterized in that: The comparison rule of the priority vector in step S21, comparing the priority vector of the candidate clock information with the priority vector of the current clock information, and determining new current clock information according to the comparison result, includes: S211: Determine whether the first clock priority of the current clock information is less than the first clock priority of the candidate clock information. If so, use the current clock information as the new current clock information. If not, determine whether the first clock priority of the current clock information is greater than the first clock priority of the candidate clock information. If so, use the candidate clock information as the new current clock information. If not, execute step S212. S212: Determine whether the clock quality level of the current clock information is less than the clock quality level of the candidate clock information. If so, use the current clock information as the new current clock information. If not, determine whether the clock quality level of the current clock information is greater than the clock quality level of the candidate clock information. If so, use the candidate clock information as the new current clock information. If not, execute step S213. S213: Determine whether the number of hops from the current node of the current clock information to the current super master is greater than the number of hops from the current node of the candidate clock information to the current super master. If so, use the current clock information as the new current clock information; if not, determine whether the number of hops from the current node of the current clock information to the current super master is less than the number of hops from the current node of the candidate clock information to the current super master. If so, use the candidate clock information as the new current clock information; if not, execute step S214; S214: Determine whether the clock accuracy of the current clock information is less than the clock accuracy of the candidate clock information. If so, use the current clock information as the new current clock information. If not, determine whether the clock accuracy of the current clock information is greater than the clock accuracy of the candidate clock information. If so, use the candidate clock information as the new current clock information. If not, execute step S215. S215: Determine whether the clock stability of the current clock information is less than the clock stability of the candidate clock information. If so, use the current clock information as the new current clock information. If not, determine whether the clock stability of the current clock information is greater than the clock stability of the candidate clock information. If so, use the candidate clock information as the new current clock information. If not, execute step S216. S216: Determine whether the second clock priority of the current clock information is less than the second clock priority of the candidate clock information, if so, use the current clock information as the new current clock information; if not, determine whether the second clock priority of the current clock information is greater than the second clock priority of the candidate clock information, if so, use the candidate clock information as the new current clock information; if not, execute step S217; S217: Compare the sizes of the clock identification information of the current clock information and the clock identification information of the candidate clock information, and use the one with smaller clock identification information as the new current clock information.
3. A redundant master clock selection method as claimed in claim 2, characterized in that: Step S1 further includes: taking the new current clock information obtained by combining the previous candidate clock information with the current clock information as the current clock information, so as to compare it with the previous candidate clock information according to the comparison rule of the priority vector; Step S2 includes: taking new current clock information obtained by comparing the last candidate clock information with the current clock information as a redundant master clock.
4. A redundant master clock selection method as claimed in claim 1, characterized in that: After acquiring the redundant master clock, the method further includes confirming the synchronization path of the redundant master clock in the following manner: According to the synchronization path generation protocol, the synchronization path is automatically generated according to the redundant master clock; or according to the preset port comparison rule, the port status of the current clock information and the candidate clock information are compared, and the synchronization path of the redundant master clock is obtained according to the comparison result of the port status.
5. A redundant master clock selection method as claimed in claim 4, characterized in that: The comparing the port status of the current clock information and the candidate clock information according to a preset port comparison rule, and acquiring the synchronization path of the redundant master clock according to the comparison result of the port status, includes: Step A1: for each of the candidate clock information, according to the comparison rule of the port priority vector, compare the port priority vector of the candidate clock information with the port priority vector of the current clock information, and determine the master node according to the comparison result; Step A2: confirming the synchronization path of the redundant master clock in combination with the plurality of master nodes according to a preset synchronization path determination rule; Among them, the port priority vector includes three port elements, namely: the number of hops from the currently recognized redundant master clock, the port identifier of the sending message, and the port number of the receiving message port; the priority of the three port elements is: the number of hops from the currently recognized redundant master clock> the port identifier of the sending message> the port number of the receiving message port.
6. A redundant master clock selection method as claimed in claim 5, characterized in that: The step A1, according to the comparison rule of the port priority vectors, compares the port priority vector of the candidate clock information with the port priority vector of the current clock information, and determines the master node according to the comparison result, comprising the following steps: Step A11: Determine whether the number of hops from the current clock information to the currently recognized redundant master clock is less than the number of hops from the candidate clock information to the currently recognized redundant master clock. If so, use the clock synchronization node where the current clock information is located as the master node; if not, determine whether the number of hops from the current clock information to the currently recognized redundant master clock is greater than the number of hops from the candidate clock information to the currently recognized redundant master clock. If so, use the clock synchronization node where the candidate clock information is located as the master node; if not, execute step A12; Step A12: Determine whether the port identifier of the message sent by the current clock information is smaller than the port identifier of the message sent by the candidate clock information. If so, take the clock synchronization node where the current clock information is located as the master node; if not, determine whether the port identifier of the message sent by the current clock information is larger than the port identifier of the message sent by the candidate clock information. If so, take the clock synchronization node where the candidate clock information is located as the master node; if not, execute step A13; Step A13: Determine whether the port number of the receiving message port of the current clock information is smaller than the port number of the receiving message port of the candidate clock information. If so, take the clock synchronization node where the current clock information is located as the master node; if not, determine whether the port number of the receiving message port of the current clock information is larger than the port number of the receiving message port of the candidate clock information. If so, take the clock synchronization node where the candidate clock information is located as the master node; if not, take either the clock synchronization node where the current clock information is located or the clock synchronization node where the candidate clock information is located as the master node.
7. A redundant master clock switching method, characterized in that: The method comprises switching the optimal master clock and the redundant master clock selected by any one of the selection methods in claims 1 to 6, wherein the switching method comprises the following steps: Step B1: Determine whether the neighboring node adjacent to the best master clock node receives the synchronization information sent by the best master clock or the redundant master clock within a preset receiving time. If not, execute step B2; if yes, execute step B4; Step B2: Sending a query message to the best master clock through the neighbor node to determine whether the neighbor node receives the reply message of the best master clock within a preset reply time. If not, executing step B3; if yes, executing step B4. Step B3: Determine that the best master clock fails or the link connected to the best master clock fails, and broadcast the switching information of replacing the best master clock with the redundant master clock through the neighboring nodes. After receiving the switching information, all the clock synchronization nodes in the network enable the synchronization information of the redundant master clock, discard the received synchronization information of the best master clock, and periodically send synchronization information through the redundant master clock synchronization path; Step B4: Determine that the best master clock is normal, and continue to use the synchronization information of the best master clock.
8. A redundant master clock switching method as claimed in claim 7, characterized in that: The preset receiving time in step B1 satisfies the following formula: SyncTimeout=syncInterval*2+residentTime Among them, the SyncTimeout is the preset receiving time, the syncInterval is the time interval for the best master clock to send synchronization messages, and the residentTime is the time for the neighbor node to process and forward the message.
9. A redundant master clock switching method as claimed in claim 8, characterized in that: The preset response time in step B2 satisfies the following formula: respondTimeout=transmissiondelay*2+esidentTime Among them, the respondTimeout is the preset response time, the residentTime is the time for the neighbor node to process and forward the message, and the transmissiondelay is the transmission time required for the synchronization message from the best master clock to the neighbor node.
