1. Background Introduction
With the development of mobile communication technology, various new communication services have needed higher and higher requirements for the accuracy of clocks. For example, the 5G-enhanced primary reference time clock (ePRTC) requires a time accuracy within 30 ns [
1] and a frequency accuracy within
[
2]. In IoT sensor networks, millisecond or even microsecond time synchronization is also required [
3]. This is usually achieved by configuring the satellite timing module in a few nodes or by using a time synchronization protocol [
4,
5,
6]. These two methods have a common feature that they need to use the Global Navigation Satellite System (GNSS) or a standard reference time to discipline the node’s local clock to achieve clock synchronization. The basic principle is that the node obtains the reference time and locks its local clock to the reference time by using a disciplining algorithm.
GNSS has been widely used to access a highly accurate reference time. Therefore, this paper takes a GNSS disciplining local clock as an example to carry out the disciplining algorithm research. The schematic diagram of the GNSS disciplining the local clock is shown in
Figure 1 [
7,
8]. A GNSS receiver is used to receive and generate a 1PPS reference signal with high long-term accuracy and stability. The time deviation between the 1PPS signal of the GNSS receiver and the 1PPS signal from the local clock is measured by the time interval tester, and the test data is processed by a clock disciplining algorithm. Then, the local clock is locked to the GNSS clock and outputs the time and frequency signals with high precision.
1.1. Review of Conventional PID Algorithm
Currently, the commonly used clock disciplining algorithm is PID. Its basic principle is to calculate the proportion, integration, and differentiation of the clock error and to provide feedback control to adjust the clock. The feedback control quantity is the weighted composite value of the proportion, integration, and differentiation [
9,
10,
11,
12,
13,
14,
15]. As shown in
Figure 2, after the original error data
enters the PID controller, the feedback control quantity
is calculated by the PID algorithm.
is the sum of the three components of PID and the proportional, integral, and differential coefficients are
,
, and
, respectively. After the feedback control quantity acts on
, the error quantity
is obtained. The PID controller recalculates the data error
using
and carries out a new feedback control. And, this continues to loop until the end of the data
input.
This algorithm has many advantages, such as a simple structure, easy implementation, and a good control effect [
16]. Therefore, it has been widely used in the field of clock disciplining. In 2014, Liang K. et al. proposed a disciplined oscillator system using UTC(NIM) for remote time and frequency traceability [
17]. In this method, UTC(NIM) time is obtained by a common-view GNSS receiver. By measuring the time deviation between a local rubidium clock and UTC(NIM), the frequency deviation of the local clock is obtained. The frequency of the local clock is corrected using the Proportion and Differentiation (PD) algorithm. The experimental results show that the daily time difference is within 25 ns and the frequency accuracy of NIMDO could be better than
averaging over one day. In 2016, Yu F. et al. proposed the design of a high precision time synchronization system based on GPS/BD dual-mode [
18]. This method uses a GPS/BD dual-mode receiver to provide time reference. The frequency deviation is also calculated by measuring the deviation from reference time, and the frequency of the local OCXO is corrected by the PID algorithm. The experimental results show that the time accuracy of the clock is 50 ns.
Both methods use the PID algorithm to calculate the fractional frequency deviation of a local clock, and the calculation results are fed back to the local clock, which has the characteristics of a simple structure. However, these PID clock disciplining algorithms still have a defect. This algorithm only carries out PID control for a single variable. It means that the variable used to calculate PID is the same as the one that receives feedback. But, the clock contains both time and frequency signals, and usually requires both variables to converge. Since time is an integral of frequency, if the frequency converges, it cannot guarantee time to converge. Time may introduce some oscillations, or it cannot converge in a short time and may even converge with a constant offset. In contrast, when time converges, it cannot guarantee frequency to converge within a small range. So, this algorithm cannot theoretically guarantee both time and frequency to converge at the same time.
1.2. Two Variables PID Algorithm
To solve the above problems, a new two variables PID clock disciplining algorithm is proposed in this paper. The block diagram of the two variables PID algorithm is shown in
Figure 3.
represents the time deviation between the local clock and the reference signal as shown in
Figure 1.
represents the time deviation after feedback. After the PID calculation,
is converted to
, as shown in box (a).
is taken the derivative and divided by a proportional coefficient
n to obtain the adjustment quantity of fractional frequency deviation
, as shown in box (b). After feeding
back to the frequency of the local clock
,
is obtained, as shown in box (c). The local clock then runs with the new fractional frequency deviation
until the next measurement of
. The algorithm utilizes the integral relation between frequency and time. It uses time as the PID constraint variable and frequency as the feedback variable so that the time and frequency can be correlated. That the time is taken as the constraint variable of PID means that time adjustment quantity is calculated by PID to ensure the convergence of time. Then, it can ensure a good long-term stability of frequency. That the frequency is taken as the feedback variable means that the time adjustment quantity is converted into a frequency adjustment quantity to feedback the frequency. It can ensure the short-term stability of frequency and the continuity of time. Therefore, the convergence of time and frequency can theoretically be guaranteed at the same time, and the clock output has good accuracy and stability. The simulation results show that the time deviation range of the two variables PID algorithm is −0.38 ns∼0.31 ns and the fractional frequency deviation range is
. The frequency accuracy is better than
averaging over one day and the long-term time stability (TDEV) for a day is about 7 ps after convergence. Compared with a single variable PID algorithm, the time accuracy of the two variables PID algorithm is improved by about one order of magnitude and the long-term time stability is improved by about two orders of magnitude.
The rest of the paper is organized as follows. In
Section 2, the principles of the two variables PID control clock disciplining algorithm are described in detail. In order to ensure the correctness of the algorithm, a non-strict theoretical proof of the algorithm is provided in
Section 3. In
Section 4, the simulations are carried out and the simulation results are discussed in detail. Then, the paper is concluded in
Section 5.
2. Algorithm Principle
First, the clock model is established, as shown in Equation (
1).
where
is the time deviation of clock,
is the initial time deviation,
y is the fractional frequency deviation,
d is the aging rate,
t is the duration, and
is the inherent time noise of the clock. According to the Power Laws theory [
19], the power spectral density
of inherent time noise
can be reasonably well-modeled by a superposition of five independent noise processes obeying power laws with integer exponents
as shown in Equation (
2).
where
=
and 2, respectively, represent frequency random walk of frequency noise, flicker frequency noise, white frequency noise, flicker phase noise, and white phase noise.
is the power spectral density coefficient, which has a certain relationship with the stability of the signal. After constructing the power laws model,
can be obtained by the inverse Fourier transform.
When the GNSS receiver receives the GNSS time signal, the GNSS time is filtered, and the time of the local clock is roughly adjusted to obtain the initial time, which is usually within 30 ns for GNSS dual-frequency receivers. Then, the PID disciplining is carried out. The algorithm process is shown in
Figure 4, and this paper focuses on the design of the PID algorithm after rough adjustment, as shown in the solid box of
Figure 4.
When it is not disciplined, the local clock is in the state of free run with the parameters y, d, and t. When it is disciplined, the system measures the time difference . The time adjustment quantity is calculated using by PID. The frequency feedback quantity is obtained by a time–frequency conversion. Then, frequency is given negative feedback by at last.
In the process of PID design, the proportional term is set as the measured time difference of the clock, the integral term is the sum of each time difference, and the differential term is the fractional frequency deviation of the clock. The proportion, integration, and differentiation coefficients are
,
, and
, respectively. Then, the time adjustment quantity
is calculated using Equation (
3).
The frequency feedback quantity
is obtained using Equation (
4).
where
represents the disciplining interval, and
n represents the approximate number of epochs to complete disciplining.
3. Algorithm Verification
It is mentioned in
Section 1 that this algorithm can ensure that the time and frequency of the equipment converge simultaneously, so the algorithm is theoretically proofed in this section. In order to make the proof result more general, it is assumed that the measured clock deviation is
. Equation (
5) is obtained by a Taylor series expansion of
.
The feedback quantity
is discretized, and Equation (
6) is obtained, where
is the adjustment period, assuming that the adjustment is completed within about
n epochs.
This algorithm is used to feedback the frequency, so PID is used to directly feedback the first-order differential term. To make
,
; then, the feedback quantity can be obtained as shown in Equation (
7).
In order to provide negative feedback on the frequency, Equation (
7) is substituted into Equation (
5). Then, Equation (
8) can be obtained.
The algorithm can achieve the following three effects, which are not strictly proved below.
3.1. The Time Deviation of the Disciplined Clock Is Convergent
Because
, Equation (
9) can be obtained.
So, the error variable is convergent overall.
3.2. The Fractional Frequency Deviation of the Disciplined Clock Is Bounded
Since
converges, then
is also bounded, i.e.,
where
C is a fixed constant, then,
So, is also bounded.
3.3. The Time of the Disciplined Clock Is Continuous
Suppose that
is adjusted at time
and the amount of adjustment is
, then,
After taking the limit on both ends of Equation (
12), it can be obtained that
It can be seen from
Section 3.2 that
is bounded, then,
So, is continuous.
According to the above analysis, it can be concluded that the time of the disciplined clock is continuous and convergent, and the frequency is bounded.
4. Simulation and Results Analysis
At present, a high precision clock is generally realized by a GNSS dual-frequency receiver [
7] or a common-view GNSS receiver [
8]. In this experiment, GNSS time deviation data using a common-view GNSS receiver are collected, as shown in
Figure 5. The GNSS receivers at the local clock and the remote clock measure the time deviation between their own time and the GNSS time. The remote clock is UTC(NIM). Then,
and
can be obtained. By exchanging the time difference information over the data network, the local clock can calculate the time deviation between the local clock and UTC(NIM). Then, the local clock can be locked to UTC(NIM) with high precision. When the local clock continues to measure the time deviation between its own time and that of GNSS, the
is the collected GNSS time deviation in simulation. The collected GNSS time deviation is the time difference between the
and
, as shown in
Figure 1. It is entered into the clock disciplining algorithm, and then the local clock can be locked to GNSS time.
According to the analysis in
Section 3, it is assumed that the initial phase of the local clock is 30 ns. According to the typical performance parameters of the rubidium clock, it is assumed that the fractional frequency deviation of the local clock is
, the day frequency drift rate is
, the disciplining interval of each epoch is set to 30 s, and disciplining is completed within about 1000 epochs. According to Equation (
2), the noise of any kind of
can be seen as the result of
noise multiplied by a 1/2 order integrator. The 1/2 order integrator can be expressed as Equation (
15).
Therefore, the flicker phase noise can be obtained by multiplying the white phase noise by the 1/2 order integrator in the frequency domain. Then, the flicker phase noise in the time domain can be obtained by an inverse Fourier transform. Analogously, other types of noise can be obtained by repeating the above operation for white phase noise. The coefficients of the power spectral density
of
are shown in
Table 1, where R is the number between 1 and 10. It can be seen from
Table 1 that the main factor affecting rubidium clock noise is frequency white noise. R is randomly set to 4.7, and the time-domain noise
can be obtained through simulation, as shown in
Figure 6. In comparison, the GNSS time reference is assumed to have no noise first. This means that the deviation of the GNSS time reference is zero. The single variable PID algorithm and the two variables PID algorithm are used to discipline the local clock. In order to avoid time hopping caused by time adjustment, the single variable PID algorithm only performs PID calculation and feedback on the frequency variable. The two variables PID algorithm is shown in the second part of the paper. Matlab R2021b (9.11.0.1769968) is used to do the simulation, and the simulation results are shown in
Figure 7 and
Figure 8.
It can be seen from
Figure 7 and
Figure 8 that the time deviation range of the local clock after convergence is
ns∼1.2 ns when using the single variable PID algorithm and the fractional frequency deviation range is
. The time deviation range after convergence is −0.25 ns∼0.25 ns when using the two variables PID algorithm and the fractional frequency deviation range is
. The frequency accuracies of the two variables PID algorithm and the single variable PID algorithm are almost the same, but the two variables PID algorithm has a higher time accuracy and shorter convergence time than that of the single variable PID algorithm.
In the next step, we intend to discipline the local clock using the real GNSS time, and a GNSS receiver is used to collected the GNSS time for 20922 epochs with an interval of 30 s, as shown in
Figure 9a. The maximum deviation of GNSS time is 6.8 ns, the minimum deviation is −5.8 ns, and the standard deviation is 1.3 ns. The data distribution for the GNSS time is analyzed, as shown in
Figure 9b. By fitting the histogram, the curve of the data distribution is obtained. It can be seen that the GNSS time follows the normal distribution N (0, 1.45).
Before disciplining, Kalman filtering is usually applied to the collected GNSS time to reduce the noise. The maximum deviation of the filtered GNSS time is 1.3 ns, the minimum deviation is −1.7 ns, and the standard deviation is 0.7 ns, as shown in
Figure 9a.
The filtered GNSS time is taken as a time reference to discipline the local clock when using the single variable and two variables PID algorithms. The disciplining result is shown in
Figure 10 and
Figure 11.
According to
Figure 10 and
Figure 11, the time deviation range of the local clock after convergence is −2.8 ns∼2.4 ns when using single variable PID algorithm and the fractional frequency deviation range is
. The frequency accuracy is better than
averaging over one day, as shown in
Figure 12. The time deviation range after convergence is −0.38 ns ∼ 0.31 ns when using the two variables PID algorithm and the fractional frequency deviation range is
. The frequency accuracy is better than
averaging over one day, as shown in
Figure 12. From the above data, it can be seen that the time accuracy and frequency accuracy (averaging over one day) of the two variables PID algorithm are about one order of magnitude better than these of the single variable PID algorithm and the short-term fractional frequency deviation range is close to that of the single variable PID algorithm. These results are also better than the results mentioned in [
17,
18].
The time and frequency stability values after convergence are calculated, as shown in
Figure 13 and
Figure 14. It can be seen from
Figure 13 and
Figure 14 that the long-term time stability (TDEV) of the two variables PID algorithm is about 7 ps per day, while that of the single variable PID algorithm is about 0.6 ns per day. Compared with the single variable PID algorithm, the long-term time stability (TDEV) of the two variables PID algorithm is improved by about two orders of magnitude, which is also better than the result mentioned in [
17]. The frequency stability values of both algorithms are similar, and the long-term stability values of both algorithms show a downward trend, as shown in
Figure 14.