PTP - Best Master Clock Algorithm
The Best Master Clock Algorithm (BMCA) is a critical component of the PTP - Precision Time Protocol|Precision Time Protocol (PTP), as defined in IEEE 1588. This algorithm is used to establish a hierarchy of clocks within a PTP network and to select the best clock to provide the time reference for all other clocks in the network. Here's an overview of how BMCA works:
-
Objective: The primary goal of BMCA is to determine the best available clock, which will act as the Master Clock. All other clocks will synchronize their time to this Master Clock.
-
Clock Properties: Each clock in a PTP network is characterized by several properties, such as clock class, clock accuracy, offset scaled log variance, and priority1 and priority2 values. These properties are used by BMCA to evaluate the suitability of a clock to be the Master Clock.
-
Announce Messages: Clocks send out Announce messages at regular intervals. These messages carry the clock properties necessary for the BMCA to evaluate and compare the clocks.
-
Algorithm Steps:
- Comparing Clocks: BMCA compares the clocks based on their properties. The comparison involves checking priority1, clock class, clock accuracy, offset scaled log variance, priority2, and clock identity, in that order.
- Priority1 and Priority2: These are user-defined settings that can be used to influence the selection of the Master Clock. A lower priority value indicates a higher preference to become the Master Clock.
- Clock Class and Accuracy: These indicate the inherent quality of a clock. A lower clock class and higher accuracy make a clock more likely to be chosen as the Master Clock.
- Offset Scaled Log Variance: This measures the stability of a clock. A lower variance indicates a more stable clock.
- Clock Identity: This is a unique identifier for each clock. If all other factors are equal, the clock with the lower clock identity becomes the Master Clock.
-
Selection of the Master Clock: The clock that ranks highest based on the above criteria is selected as the Master Clock. All other clocks become slave clocks and synchronize their time to this Master Clock.
-
Dynamic Re-evaluation: BMCA is not a one-time process. It is continuously carried out to account for changes in the network, such as the addition of new clocks, changes in clock properties, or the loss of the current Master Clock. This ensures that the network always synchronizes to the best available time source.
-
Network Topology Considerations: In larger networks with multiple layers of switches and routers, the BMCA ensures that the selection of the Master Clock is optimal across the entire network, taking into account the network topology and the propagation delays.
-
The BMCA is also responsible for determining the interface roles of master or slave.
The Best Master Clock Algorithm is a systematic method used in PTP networks to determine the most suitable clock to be the Master Clock, ensuring accurate and consistent time synchronization across the network.