A method for time synchronization in a master-slave clock system
By employing a PLC network and BMC algorithm to select the master clock in the master-slave clock system, and combining the endpoint delay algorithm to calculate the transmission delay, the problems of large timing errors and high dependence on external devices in existing technologies are solved, achieving high-precision time synchronization and low-cost communication.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-31
- Publication Date
- 2026-03-06
AI Technical Summary
Existing master-slave clock systems suffer from problems such as large timing errors, high dependence on external equipment, and high communication costs. In particular, under RS-485 bus and Ethernet timing methods, the timing accuracy of the end slave clock is low and it is easily affected by network equipment failures.
Using a PLC network for networking communication, the optimal master clock is selected as the main clock through the BMC algorithm, and the transmission delay is calculated by combining the endpoint delay algorithm to achieve time synchronization, reduce dependence on external devices, and lower communication costs.
It improves the reliability and accuracy of time synchronization, reduces communication costs, and enables real-time interaction and high-precision unified time synchronization of time signals between master and slave clock systems.
Smart Images

Figure CN116054989B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of time synchronization technology, and more specifically, to a time synchronization method for a master-slave clock system. Background Technology
[0002] The master-slave clock system consists of slave clocks and a master clock. The master clock is the central part of the master-slave clock system. It mainly uses satellite signals or time signals from the previous level as a clock source for time synchronization and serves as the time reference for all slave clocks. All slave clocks receive the time signal from the master clock and keep time synchronized with the master clock.
[0003] In related technologies, master-slave clock systems typically use RS-485 bus or Ethernet to provide time synchronization to the slave clock. If RS-485 bus is used, the time synchronization signal is mainly a serial time message; if Ethernet is used, the time synchronization signal is mainly an NTP network message.
[0004] The master-slave clock system time synchronization technology mentioned above has the following shortcomings:
[0005] 1. The time synchronization method using RS-485 bus through serial port messages is usually one-way time synchronization, which does not take into account the transmission delay during the path transmission process, resulting in a large time synchronization error and low time accuracy of the end slave clock.
[0006] 2. Using RS-485 bus requires laying dedicated lines in a daisy-chain manner for transmission, without any branches in the middle. In some places, it may be necessary to lay the lines in a roundabout way, which will cause the transmission delay of the terminal slave clocks in the alphabet clock system to be large due to the long bus line.
[0007] 3. Using Ethernet to synchronize time via NTP network packets requires the use of external network devices such as network switches. This is subject to the working status of the external network devices. If the network is congested or a network device malfunctions, it will affect the operation of the slave clock time synchronization. Summary of the Invention
[0008] To address the shortcomings of existing master-slave clock systems in related technologies, this invention provides a master-slave clock system time synchronization method. This method is applied to a master-slave clock system where the master clock and slave clocks are connected only by a power supply line and communicate via a PLC network. Multiple master clocks can operate simultaneously in the system, but only one master clock serves as the master node of the PLC network, managing the network's communication. This master-slave clock system, based on power line communication within the PLC network, reduces reliance on external devices, improves time synchronization reliability, and lowers communication costs. Furthermore, considering the characteristics of the PLC network, the BMC algorithm is used to select the optimal master clock in the PLC network as the master clock of the master-slave clock system. Based on the endpoint delay algorithm, the time deviation and first transmission delay between the master clock of the master node and the master clock of the slave clock system, as well as the second transmission delay between other master clocks and multiple slave clocks and the master clock of the PLC network, are calculated. Then, with the master clock of the slave clock system as the reference, the master clock of the PLC network adjusts its time according to the time deviation and the first transmission delay to synchronize with the master clock of the slave clock system. Furthermore, with the master clock of the PLC network as the reference and the second transmission delay as the reference, compensation is made for other master clocks and slave clocks to achieve time synchronization of the slave clock system. This takes into account the transmission delay during the path transmission process, reduces the timing error, and realizes real-time interaction of time signals between the slave clock system.
[0009] The above-mentioned technical objective of the present invention is achieved through the following technical solution:
[0010] This application provides a time synchronization method for a master-slave clock system, which includes at least one master clock and multiple slave clocks. One master clock serves as the master node of a PLC network, managing communication within the PLC network. The other master clocks and slave clocks act as slave nodes of the PLC network. The method includes:
[0011] Obtain the clock information of the slave node master clock and the master node master clock in the PLC network. Compare the clock information of the master node master clock and the slave node master clock according to the BMC algorithm, and select the optimal master clock of the PLC network as the master clock of the master-slave clock system. The clock information includes the time quality, clock level, clock variance and clock ID of the master clock.
[0012] The endpoint delay method was used to measure the time deviation and first transmission delay between the master clock of the PLC network master node and the master clock of the slave clock system.
[0013] The endpoint delay method was used to measure the second transmission delay between other master clocks and slave clocks and the master node master clock of the PLC network.
[0014] Using the master clock of the master-slave clock system as a reference, the master node master clock of the PLC network adjusts its time according to the time deviation and the first transmission delay to synchronize with the master clock of the master-slave clock system; and, using the master node master clock of the PLC network as a reference and the second transmission delay as a reference, it compensates for other master clocks and slave clocks to achieve time synchronization of the master-slave clock system.
[0015] In one implementation, the time quality is determined by the master clock based on the synchronization status of the satellite clock source or the higher-level clock source; the clock level is a preset value set according to the priority level of the master clock; and the clock variance is calculated based on the residual value of the local time of the master clock under test and the time measured by the local reference clock source.
[0016] In one implementation, the clock variance is calculated as follows:
[0017] ,in, yes The residual value between the local time of the master clock being measured and the time measured by the local reference clock source at any given time, where T is the sampling period and N represents the number of samples.
[0018] In one implementation, the clock information of the slave node master clock and the master node master clock of the PLC network is obtained. The clock information of the master node master clock and the slave node master clock is compared according to the BMC algorithm, and the optimal master clock of the PLC network is selected as the master clock of the master-slave clock system. Specifically, this includes:
[0019] When the master node clock of the PLC network broadcasts a message, the clock information of the master node clock in the PLC network is used as the first clock information, and the clock information of the slave node clock is used as the second clock information. The master node clock broadcasts the first clock information to all slave node clocks.
[0020] The first clock information and the second clock information are compared according to the BMC algorithm to obtain the comparison result;
[0021] Based on the comparison results, the optimal master clock among the slave node master clocks of the PLC network is selected as the master clock of the slave clock system.
[0022] In one implementation, the first clock information and the second clock information are compared according to the BMC algorithm to obtain a comparison result, specifically including:
[0023] The slave clocks of the PLC network do not process the received message. Each slave master clock compares the received first clock information with its own second clock information. If the second clock information is better than the first clock information, the second clock information is sent to the master clock of the PLC network. The master clock compares the received second clock information and selects the master clock with the best second clock information as the master clock of the slave clock system.
[0024] In one implementation scheme, the comparison between the first clock information and the second clock information is specifically as follows:
[0025] When the time quality, clock level, clock variance, and clock ID of the first clock information are not equal to the time quality, clock level, clock variance, and clock ID of the second clock information, determine whether the time quality, clock level, clock variance, and clock ID of the first clock information are less than the time quality, clock level, clock variance, and clock ID of the corresponding second clock information. If they are less, the first clock information is superior to the second clock information; otherwise, the second clock information is superior to the received first clock information, and the second clock information is sent to the master node clock of the PLC network.
[0026] Accordingly, the master node clock compares the received second clock information and selects the slave node clock with the optimal second clock information as the master clock of the slave clock system.
[0027] In one implementation, the time deviation and first transmission delay between the master clock of the PLC network's master node and the master clock of the slave clock system are calculated using the following formula:
[0028] , ,in, The time for sending a delay request message to the master clock of the PLC network's master node. The time when the master clock of the master-slave clock system receives the delay request message. The time for sending a delay request reply message to the master clock of the master-slave clock system. This refers to the time when the master clock of the PLC network receives the delay request reply message. The time deviation between the master clock of the PLC network's master node and the master clock of the slave clock system. The first transmission delay between the master clock of the PLC network's master node and the master clock of the slave clock system.
[0029] In one implementation, the second transmission delay between other master clocks and slave clocks and the master node master clock of the PLC network is calculated using the endpoint delay method. ,in, The time for sending delay request messages to other master clocks or slave clocks The time when the master node's parent clock receives the delay request message. The time it takes for the master node's master clock to send a delay request reply message. For the time when other master clocks or slave clocks receive the delayed request reply message, This is the second transmission delay between the network master node's master clock and other master or slave clocks.
[0030] In one implementation, using the master clock of the master-slave clock system as a reference, the master node master clock of the PLC network adjusts its time according to the time deviation and a first transmission delay to synchronize with the master clock of the master-slave clock system, including:
[0031] Using the master clock of the master-slave clock system as a reference, the master node master clock initiates a delay measurement request to the master clock of the master-slave clock system, adjusts the time of the master node master clock according to the time deviation and the first transmission delay, and synchronizes with the master clock of the master-slave clock system.
[0032] In one implementation, the master clock of the PLC network is used as a reference, and the other master clocks and slave clocks are compensated based on the second transmission delay to achieve time synchronization of the master-slave clock system. This includes: the master clock uses a round-robin method to notify the other master clocks and slave clocks of the slave nodes to initiate delay requests to the master clock; the master clock uses a broadcast method to send synchronization messages based on the master clock; and the other master clocks and slave clocks of the slave nodes compensate the master clock according to the second transmission delay and synchronize with the master clock to achieve time synchronization of the master-slave clock system.
[0033] Compared with the prior art, the present invention has the following beneficial effects:
[0034] The time synchronization method of this invention is applied to a master-slave clock system, where the master clock and slave clock are connected only to the power supply line and communicate via a PLC network. Multiple master clocks can operate simultaneously in the system, but only one master clock serves as the master clock of the PLC network master node, managing the PLC network communication. This master-slave clock system, based on power line communication within the PLC network, reduces dependence on external devices, improves time synchronization reliability, and lowers communication costs. Furthermore, considering the characteristics of the PLC network, the BMC algorithm is used to select the optimal master clock in the PLC network as the master clock of the master-slave clock system. Finally, the endpoint delay algorithm is used to calculate the master clock's connection to the slave clock. The system considers the time deviation and first transmission delay between the master clocks of the master clock system, as well as the second transmission delay between other master clocks and multiple slave clocks and the master node master clock of the PLC network. Then, using the master clock of the master clock system as a reference, the master node master clock of the PLC network adjusts its time according to the time deviation and the first transmission delay to synchronize with the master clock of the master clock system. In addition, using the master node master clock of the PLC network as a reference and the second transmission delay as a reference, compensation is made for other master clocks and slave clocks to achieve time synchronization of the master clock system. This takes into account the transmission delay in the path transmission process, reduces the timing error, and realizes real-time interaction of time signals between the master clock system and slave clock system. Attached Figure Description
[0035] The accompanying drawings, which are included to provide a further understanding of embodiments of the invention and form part of this application, do not constitute a limitation thereof. In the drawings:
[0036] Figure 1 A flowchart illustrating a time synchronization method for a master-slave clock system provided in an embodiment of this application;
[0037] Figure 2 This is an architecture diagram of a master-slave clock system provided in an embodiment of this application;
[0038] Figure 3 This is a network topology diagram of the master clock and slave clock in a master-slave clock system provided in an embodiment of this application;
[0039] Figure 4 A flowchart of the BMC algorithm provided in the embodiments of this application;
[0040] Figure 5 This application provides a schematic diagram of EDM technology for embodiments.
[0041] Figure 6 This is a schematic diagram illustrating the principle of a master-slave clock system provided in this application for compensating for delays in other master and slave clocks. Detailed Implementation
[0042] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the embodiments and accompanying drawings. The illustrative embodiments and descriptions of the present invention are only used to explain the present invention and are not intended to limit the present invention.
[0043] It should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0044] As described in the background section, in related technologies, master-slave clock systems typically use RS-485 bus or Ethernet to provide time synchronization to the slave clock. If RS-485 bus is used, the time synchronization signal is mainly a serial port time message; if Ethernet is used, the time synchronization signal is mainly an NTP network message.
[0045] The master-slave clock system time synchronization technology mentioned above has the following shortcomings:
[0046] 1. The time synchronization method using RS-485 bus through serial port messages is usually one-way time synchronization, which does not take into account the transmission delay during the path transmission process, resulting in a large time synchronization error and low time accuracy of the end slave clock.
[0047] 2. Using RS-485 bus requires laying dedicated lines in a daisy-chain manner for transmission, without any branches in the middle. In some places, it may be necessary to lay the lines in a roundabout way, which will cause the transmission delay of the terminal slave clocks in the alphabet clock system to be large due to the long bus line.
[0048] 3. Using Ethernet to synchronize time via NTP network packets requires the use of external network devices such as network switches. This is subject to the working status of the external network devices. If the network is congested or a network device malfunctions, it will affect the operation of the slave clock time synchronization.
[0049] As described in the background section, the hardware structure and path extension defects of the master-slave clock system in the related technology result in large timing errors and low timing accuracy in the existing master-slave clock system.
[0050] Therefore, this application provides a time synchronization method for a master-slave clock system, which is applied to a master-slave clock system. The master-slave clock system includes at least one master clock and multiple slave clocks, with one master clock serving as the master node master clock of the PLC network, used to manage the communication of the PLC network, and the other master clocks and slave clocks serving as slave nodes of the PLC network. Please refer to... Figure 2 As shown, Figure 2 This is a block diagram of the architecture of the novel master-slave clock timekeeping system proposed in this application. In a master-slave clock system, the master clock and slave clocks are connected only to a 220V power line and communicate via a PLC (Power Line Communication). Multiple master clocks can operate simultaneously in the system, with only one master clock serving as the network master node, denoted as M0, and the others denoted as M1~Mn. The master clock and slave clocks are connected only to a 220V AC power line, which serves both as a power supply and a communication line. When used for communication, a tree-like network is formed through the PLCs. The master clock M0 in the master-slave clock system acts as the PLC network master node, responsible for managing PLC communication. The other master clocks M1~Mn and slave clocks C1~Cm act as slave nodes in the PLC network.
[0051] Please refer to Figure 1 , Figure 1 A flowchart illustrating a time synchronization method for a master-slave clock system provided in this application embodiment, the method comprising the following steps:
[0052] S110: Obtain the clock information of the slave node master clock and the master node master clock of the PLC network. Compare the clock information of the master node master clock and the slave node master clock according to the BMC algorithm, and select the optimal master clock of the PLC network as the master clock of the master-slave clock system. The clock information includes the time quality, clock level, clock variance and clock ID of the master clock.
[0053] In this embodiment, the BMC algorithm is a Best Master Clock algorithm, one of the core technologies of IEEE 1588. Systems synchronizing clocks according to the IEEE 1588 protocol select the master clock by running the Best Master Clock algorithm, with all other clocks using the master clock as a reference for synchronization. Here, the second clock information refers to the clock information collected from the slave node's master clock. The BMC algorithm compares the first and second clock information from the master node's master clock, comparing them one by one in terms of time quality, clock class, clock variance, and clock ID, thereby selecting the optimal master clock from the slave node master clocks of the PLC network as the master clock of the slave clock system.
[0054] S120 uses the endpoint delay method to measure the time deviation and first transmission delay between the master clock of the PLC network's master node and the master clock of the slave clock system.
[0055] Specifically, after selecting the master clock in the system, the Endpoint Delay Measurement (EDM) algorithm is used to calculate the time deviation and first transmission delay between the network master node master clock M0 and the system master clock master clock Mz.
[0056] S130 uses the endpoint delay method to measure the second transmission delay between other master clocks and slave clocks and the master node master clock of the PLC network.
[0057] In this embodiment, since the time of other master clocks and slave clocks on the slave node is synchronized through the master clock of the PLC network, please refer to [reference needed]. Figure 3 It can be seen that there is only a transmission delay between the master node of the PLC network and other master clocks M1~Mn and child clocks C1~Cm. Since the delay request messages are sent to other master clocks and child clocks at the same time, there is no time deviation.
[0058] S140, using the master clock of the master-slave clock system as a reference, the master node master clock of the PLC network adjusts the time of the master node master clock according to the time deviation and the first transmission delay, and synchronizes with the master clock of the master-slave clock system; and, using the master node master clock of the PLC network as a reference and the second transmission delay as a reference, compensates for other master clocks and slave clocks to achieve time synchronization of the master-slave clock system.
[0059] In this embodiment, two reference cases were considered respectively, thereby achieving time synchronization between the master clock of the master node and the master clock of the slave clock system, reducing the final timing error, and realizing real-time interaction of time signals between the master and slave clock systems.
[0060] In summary, the present invention provides a time synchronization method for a master-slave clock system. This system utilizes power lines to network the master clock and slave clocks, enabling real-time interaction of time signals between the devices and thus achieving time synchronization. This not only achieves high-precision unified time synchronization for the master-slave clock system but also reduces dependence on external devices, improves the reliability of the time synchronization system, and lowers communication costs, providing a new approach to time synchronization for master-slave clock systems.
[0061] Furthermore, the time quality is determined by the master clock based on the synchronization status of the satellite clock source or the higher-level clock source; the clock level is a preset value, set according to the priority level of the master clock; the clock variance is calculated based on the residual value of the local time of the master clock under test and the time measured by the local reference clock source.
[0062] Furthermore, the formula for calculating clock variance is:
[0063] ,in, yes The residual value between the local time of the master clock being measured and the time measured by the local reference clock source at any given time, where T is the sampling period and N represents the number of samples.
[0064] Please refer to Figure 4 , Figure 4 This is a flowchart of the BMC algorithm described in this application embodiment. It involves obtaining the clock information of the slave node master clock and the master node master clock in the PLC network, comparing the clock information of the master node master clock and the slave node master clock according to the BMC algorithm, and selecting the optimal master clock of the PLC network as the master clock of the master-slave clock system. Specifically, it includes:
[0065] When the master node clock of the PLC network broadcasts a message, the clock information of the master node clock in the PLC network is used as the first clock information, and the clock information of the slave node clock is used as the second clock information. The master node clock broadcasts the first clock information to all slave node clocks.
[0066] The first clock information and the second clock information are compared according to the BMC algorithm to obtain the comparison result;
[0067] Based on the comparison results, the optimal master clock among the slave node master clocks of the PLC network is selected as the master clock of the slave clock system.
[0068] For further details, please refer to... Figure 4The BMC algorithm is used to compare the first clock information and the second clock information to obtain a comparison result. Specifically, the slave node clocks of the PLC network do not process the message they receive. Each slave node master clock compares the received first clock information with its own second clock information. If the second clock information is better than the first clock information, the second clock information is sent to the master node master clock of the PLC network. The master node master clock compares the received second clock information and selects the master clock with the best second clock information as the master clock of the slave clock system.
[0069] For further details, please refer to... Figure 4 ,
[0070] The comparison between the first clock information and the second clock information is as follows:
[0071] When the time quality, clock level, clock variance, and clock ID of the first clock information are not equal to the time quality, clock level, clock variance, and clock ID of the second clock information, determine whether the time quality, clock level, clock variance, and clock ID of the first clock information are less than the time quality, clock level, clock variance, and clock ID of the corresponding second clock information. If they are less, the first clock information is superior to the second clock information; otherwise, the second clock information is superior to the received first clock information, and the second clock information is sent to the master node clock of the PLC network.
[0072] Accordingly, the master node clock compares the received second clock information and selects the slave node clock with the optimal second clock information as the master clock of the slave clock system.
[0073] In the above embodiments of the BMC algorithm, such as Figure 4 As shown, when any one of the parameters of the second clock information—time quality, clock level, clock variance, and clock ID—is not equal to the corresponding parameters of the first clock information, it is determined whether the four parameters of the second clock information are less than the four parameters of the first clock information. If they are less, the second clock information of the slave node's own master clock is superior, and the second clock information is sent to the master node's master clock. Otherwise, the received first clock information is superior, and the second clock information is not sent to the master node's master clock in the PLC network. Then, the second clock information received by the master node's master clock is compared, and the slave node's master clock corresponding to the superior second clock information is selected as the master clock of the master-slave clock system. The comparison principle is the same, using the BMC algorithm, so it will not be described in detail here.
[0074] Please refer to Figure 5 , Figure 5The schematic diagram of EDM technology provided in this application embodiment shows the following formula for calculating the time deviation and first transmission delay between the master clock of the PLC network master node and the master clock of the slave clock system:
[0075] , ,in, The time for sending a delay request message to the master clock of the PLC network's master node. The time when the master clock of the master-slave clock system receives the delay request message. The time for sending a delay request reply message to the master clock of the master-slave clock system. This refers to the time when the master clock of the PLC network receives the delay request reply message. The time deviation between the master clock of the PLC network's master node and the master clock of the slave clock system. The first transmission delay between the master clock of the PLC network's master node and the master clock of the slave clock system.
[0076] In this embodiment, it can be understood that, Figure 5 The reference end in the PLC network is the master clock, while the requesting end consists of other master clocks and several slave clocks. The time deviation and first transmission delay between the master clock of the PLC network master node and the master clock of the slave clock system are determined by the delay request message issued by the reference end and the response from the requesting end.
[0077] In one embodiment, the formula for calculating the second transmission delay between other master clocks and slave clocks and the master node master clock of the PLC network, using the endpoint delay method, is as follows: ,in, The time for sending delay request messages to other master clocks or slave clocks The time when the master node's parent clock receives the delay request message. The time it takes for the master node's master clock to send a delay request reply message. For the time when other master clocks or slave clocks receive the delayed request reply message, This is the second transmission delay between the network master node's master clock and other master or slave clocks.
[0078] Specifically, it is understandable that The time for sending delay request messages for other master clocks M1~Mn (excluding Mz) or slave clocks C1~Cm. The time when the network master node's master clock M0 receives the delay request message. The time for the network master node's master clock M0 to send a delay request reply message. The time when other master clocks M1~Mn (excluding Mz) or slave clocks C1~Cm receive the delayed request reply message; The second transmission delay between the master node's mother clock M0 and other mother clocks M1~Mn (excluding Mz) or daughter clocks C1~Cm.
[0079] In one embodiment, using the master clock of the master-slave clock system as a reference, the master node master clock of the PLC network adjusts its time according to the time deviation and the first transmission delay to synchronize with the master clock of the master-slave clock system. This includes: using the master clock of the master-slave clock system as a reference, the master node master clock initiates a delay measurement request to the master clock of the master-slave clock system, adjusts its time according to the time deviation and the first transmission delay, and synchronizes with the master clock of the master-slave clock system.
[0080] Specifically, it can be understood that transmission delay is also a time parameter, that is, the time delay that occurs during signal transmission. Therefore, in order to ensure the accuracy of the master clock of the PLC network, the master clock of the PLC network needs to adjust the time of the master clock according to the time deviation and the first transmission delay, and synchronize it with the master clock Mz of the slave clock system.
[0081] Please refer to Figure 6 , Figure 6 This is a schematic diagram illustrating the principle of compensating for delays in other master clocks and slave clocks in the master-slave clock system provided in this application embodiment. Using the master clock of the PLC network as a reference and a second transmission delay as a reference, compensation is performed on other master clocks and slave clocks to achieve time synchronization of the master-slave clock system. This includes: the master clock notifying other master clocks and slave clocks on the slave nodes to initiate delay requests to the master clock via a round-robin method; the master clock sending synchronization messages via a broadcast method based on the master clock; and the other master clocks and slave clocks on the slave nodes compensating for the delays in the master clock and synchronizing with the master clock, thus achieving time synchronization of the master-slave clock system.
[0082] Specifically, the network master node's mother clock M0 uses a round-robin method to notify other master clocks M1~Mn (excluding Mz) and child clocks C1~Cm to initiate delay requests to it. Then, based on the network master node's mother clock M0, it sends synchronization messages using a broadcast method. Other master clocks M1~Mn (excluding Mz) and child clocks C1~Cm delay according to the obtained path. Compensation is performed and synchronized to the network master node's master clock M0 to achieve time synchronization between the master and slave clock systems.
[0083] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for time dissemination by a master-slave clock system, characterized in that, The application is applied to a master-slave clock system, the master-slave clock system comprises at least one master clock and a plurality of slave clocks, and one master clock is used as a master node master clock of a PLC network for managing the communication of the PLC network, and other master clocks and slave clocks are used as slave nodes of the PLC network, and the method comprises the following steps: Clock information of the master node master clock and the slave node master clock of the PLC network is acquired, the clock information of the master node master clock and the slave node master clock is compared according to a BMC algorithm, and the optimal master clock of the PLC network is selected as a master clock of the master-slave clock system, wherein the clock information comprises time quality, clock level, clock variance and clock ID of the master clock; An endpoint delay method is used to measure a time deviation and a first transmission delay between the master node master clock of the PLC network and the master clock of the master-slave clock system; An endpoint delay method is used to measure a second transmission delay between the master node master clock of the PLC network and other master clocks and slave clocks; The master node master clock of the PLC network is adjusted according to the time deviation and the first transmission delay, and is synchronized to the master clock of the master-slave clock system; and other master clocks and slave clocks are compensated according to the second transmission delay, so that time synchronization of the master-slave clock system is realized.
2. The master-slave clock system time-provisioning method of claim 1, wherein, The time quality is determined by the master clock according to synchronization of a satellite clock source or a higher-level clock source; the clock level is a preset value and is set according to a priority level of the master clock; and the clock variance is calculated according to a residual value of a local time of the measured master clock and a time measured by a local reference clock source.
3. The master-slave clock system time-provisioning method of claim 2, wherein, The formula for calculating the clock variance is wherein, is The residual value of the time measured by the local time of the parent clock and the time measured by the local reference clock source, T is the sampling period, and N represents the number of samples.
4. The master-slave clock system time-provisioning method of claim 2, wherein, Clock information of the master node master clock and the slave node master clock of the PLC network is acquired, the clock information of the master node master clock and the slave node master clock is compared according to a BMC algorithm, and the optimal master clock of the PLC network is selected as a master clock of the master-slave clock system, and specifically comprises the following steps: When the master node master clock of the PLC network broadcasts a message, clock information of the master node master clock of the PLC network is used as first clock information, clock information of the slave node master clock is used as second clock information, and the master node master clock broadcasts the first clock information to all slave node master clocks; The first clock information and the second clock information are compared according to the BMC algorithm, and a comparison result is obtained; The optimal master clock of the slave node master clock of the PLC network is selected as the master clock of the master-slave clock system according to the comparison result.
5. The master-slave clock system time-provisioning method of claim 4, wherein, The first clock information and the second clock information are compared according to the BMC algorithm, and a comparison result is obtained, and specifically comprises the following steps: The slave clock of the slave node of the PLC network receives the message and does not process it, each slave node master clock compares the received first clock information with the second clock information of itself, and if the second clock information is better than the first clock information, the second clock information is sent to the master node master clock of the PLC network, the master node master clock compares the received second clock information, and the master clock of the optimal second clock information is selected as the master clock of the master-slave clock system.
6. The master-slave clock system time-provisioning method of claim 5, wherein, The comparison of the first clock information and the second clock information specifically comprises the following steps: When the time quality, clock level, clock variance and clock ID of the first clock information are not equal to the time quality, clock level, clock variance and clock ID of the second clock information, it is judged whether the time quality, clock level, clock variance and clock ID of the first clock information are less than the corresponding time quality, clock level, clock variance and clock ID of the second clock information, if yes, the first clock information is superior to the second clock information, otherwise, the second clock information is superior to the received first clock information, and the second clock information is sent to the master clock of the PLC network; Correspondingly, the master clock compares the received second clock information, selects the slave node master clock of the optimal second clock information as the master clock of the sub-master clock system.
7. The master-slave clock system time-provisioning method of claim 1, wherein, The calculation formula of the time deviation between the master clock of the PLC network and the master clock of the sub-master clock system and the first transmission delay is as follows: , wherein, is the time at which the master node mother clock of the PLC network sends a delay request message, is the time at which the master clock of the child-mother clock system receives the delay request message, is the time at which the master clock of the child-mother clock system sends a delay request reply message, is the time at which the master node mother clock of the PLC network receives the delay request reply message, is the time deviation of the master node mother clock of the PLC network with respect to the master clock of the child-mother clock system, is the first transmission delay between the master node mother clock of the PLC network and the master clock of the child-mother clock system.
8. The master-slave clock system time-provisioning method of claim 1, wherein, The calculation formula of the second transmission delay between the other master clock and the slave clock and the master clock of the PLC network is measured by the end-point delay method wherein, is the time when the other master clock or the slave clock sends the delay request message, is the time when the master clock receives the delay request message, is the time when the master clock sends the delay request reply message, is the time when the other master clock or the slave clock receives the delay request reply message, is the second transmission delay between the master clock of the network and the other master clock or the slave clock.
9. The master-slave clock system time-provisioning method of claim 1, wherein, Taking the master clock of the sub-master clock system as a reference, the master clock of the PLC network adjusts the time of the master clock of the PLC network according to the time deviation and the first transmission delay, and synchronizes to the master clock of the sub-master clock system, including: Taking the master clock of the sub-master clock system as a reference, the master clock of the PLC network adjusts the time of the master clock of the PLC network according to the time deviation and the first transmission delay, and synchronizes to the master clock of the sub-master clock system.
10. The master-slave clock system time-provisioning method of claim 9, wherein, Taking the master clock of the PLC network as a reference, the second transmission delay is taken as a reference to compensate other master clocks and slave clocks, and the time synchronization of the sub-master clock system is realized, including: the master clock of the PLC network adopts the way of broadcasting to inform the slave node other master clocks and slave clocks to initiate a delay request to the master clock of the PLC network, taking the master clock of the PLC network as a reference, the master clock of the PLC network adopts the way of broadcasting to send a synchronization message, the slave node other master clocks and slave clocks compensate the master clock of the PLC network according to the second transmission delay, synchronize to the master clock of the PLC network, and realize the time synchronization of the sub-master clock system.
Citation Information
Patent Citations
Time synchronization method, system thereof and time synchronous communication equipment
CN101557255A
System and method for synchronizing audio-visual devices on a power line communications (PLC) network
US20060072695A1