# Research on Distributed Autonomous Timekeeping Algorithm for Low-Earth-Orbit Constellation
## 2 Autonomous Timekeeping Framework  
The local time of each satellite is maintained by its onboard atomic clock, and the two-way comparison link between satellites enables high-precision measurements of the time differences between them. The satellite with the best clock performance is designated as the primary satellite, and all satellites in the constellation are compared with the primary satellite to determine clock errors. A system time reference is then established using a timekeeping algorithm. Due to satellite visibility constraints, satellites within the primary satellite's line of sight identify clock errors through direct comparison, while those outside its visibility calculate clock errors indirectly via relay satellites. At the primary satellite, the system's time reference is established by synthesizing inter-satellite link measurement data using a timekeeping algorithm. The deviation between each satellite's time and this reference is computed, and satellite clock parameters are fitted and transmitted to all satellites, enabling network-wide time synchronization.  
Figure 1 illustrates the autonomous timing framework based on the inter-satellite link. In this system, N satellites are compared to the primary satellite, resulting in N sets of clock error sequences. The clock error between the satellite \(i\) and the primary satellite is expressed as follows [8]:  
\[x_{im}(t)=h_{i}(t)-h_{m}(t) \tag{1}\]  
where \(h_{i}(t)\) is the clock reading of the satellite \(i\), and \(h_{m}(t)\) is the clock reading of the primary satellite. \(x_{im}(t)\) is the relative clock error between the satellite \(i\) and the primary satellite. The time reference established in practice is the deviation from the primary node, denoted as \(x_{em}\). The calculation formula for the time reference is as follows [12]:  
\[x_{em}=\sum_{i=1}^{N}w_{i}(t)(x_{im}(t)-\hat{x}_{ie}(t)) \tag{2}\]  
where \(\hat{x}_{ie}(t)\) is the predicted value between the satellite \(i\) and the time reference, which is calculated from historical data to ensure that the system will not change suddenly when the weight changes and when the time is increased or decreased, and \(w_{i}(t)\) is the weight, satisfying the following constraint:  
\[\sum_{i=1}^{N}w_{i}(t)=1 \tag{3}\]  
Figure 1: Autonomous timekeeping framework based on inter-satellite link.  
When the satellite-to-ground link is connected, the deviation between the established time reference and GNSS time can be calculated, and then it can be traced back to UTC indirectly:  
\[x_{e}(t)=x_{em}(t)+x_{m}(t) \tag{4}\]  
where \(x_{em}(t)\) is the time deviation between the time reference and the primary satellite established by the inter-satellite link measurement data, \(x_{m}(t)\) is the time deviation between the primary satellite and GNSS time, and \(x_{e}(t)\) is the time deviation between the time reference and GNSS time.  
When the system switches to autonomous timekeeping mode, historical data must be used to predict and correct the time accuracy of the system to ensure synchronization with GNSS time. As the autonomous operation duration extends, the prediction error between the time reference and GNSS time will gradually increase. Therefore, the predictability of the time reference serves as a crucial metric for evaluating the autonomous timekeeping performance.