DSPRelated.com
Forums

False phase lock detector for PLL (GPS application domain)

Started by Unknown June 15, 2016
On 16/06/2016 16:40, Evgeny Filatov wrote:
> On 16/06/2016 15:55, adel@swift-nav.com wrote: >> Gene, this explanation is beautiful! All the assumptions you've made >> are correct and match my case exactly. I have followed you all along >> and everything you've written makes sense to me. Thank you very much >> for shedding light on it. I really appreciate it. >> >> About the 300us + 19.7ms split. This came from the HW correlator >> implementation I am dealing with at the moment. It does not have >> sample buffering capabilities and the tracking loop corrections are >> taken in use only 300us after the beginning of the correlation round. >> So, I was going to take advantage of it and use the intermediate 300us >> I/Q reading also for the false lock detector. Now I am convinced that >> I have to reconsider it and do an extra I/Q reading after 9.7ms since >> the last 300us reading just for the sake of the false lock detector. >> Luckily the HW allows for that. >> > > Adel, you are welcome! > >> FWIW, it turns out that the Kaplan book has a diagram typo, where he >> explains the false frequency and false phase lock detector details: >> http://tinyurl.com/hz4pp37. The diagram there suggests that you should >> accumulate DOT and CROSS products over 1 second and then compute >> atan2(CROSS, DOT). However, since atan2's range is -pi,+pi, the >> overall algorithm will never result in anything more than pi/(2*pi) = >> 0.5 Hz error. To fix this, the accumulation step should be done after >> atan2 is computed. >> > > I think Kaplan should be trusted here. > > You can accumulate DOT and CROSS products, because if you have a couple > of vectors 'a' and 'b', and 'angle' is angle between them, then > DOT = abs(a) * abs(b) * cos(angle), > CROSS = abs(a) * abs(b) * sin(angle), > where abs(a) denotes magnitude of vector a. > (You can see that DOT and CROSS are actually just scalar and vector > multiplication, respectfully.) > > Accumulation is allowed at this point, because 'angle' already contains > frequency information, as angle = 2*pi*f*delta_t, where f is frequency > and delta_t is the time difference between centers of a pair of > intervals for which you calculate DOT and CROSS. > > Then atan2 only retrieves the angle from a point on a circle, defined by > its Cartesian coordinates cos(angle) and sin(angle). > > Gene >
Moreover, if you are familiar with a seminal work by Viterbi and Viterbi, http://sci-hub.cc/10.1109/TIT.1983.1056713 you should immediately recognize the standard scheme for feedforward phase estimation (just look at Fig. 2). Gene
I must be missing something, but let me clarify my point about the false phase lock detector diagram in Kaplan book. It suggests that the CROSS and DOT products are accumulated over 1 second. This results in 50 additions in the book's example.
So, if:
DOT   = abs(a) * abs(b) * cos(angle),
CROSS = abs(a) * abs(b) * sin(angle),
and assuming that we get roughly same values of DOT and CROSS in each of those 50 times, then
sum(DOT) = 50 * DOT
sum(CROSS) = 50 * CROSS
and atan2(CROSS, DOT) returns the angle, which corresponds to (50 * DOT)/ (50 * CROSS) = DOT / CROSS = cos(angle)/sin(angle). It turns out that the angle was not accumulated and the result is the angle for 20ms time interval - not for 1 second.
It would work fine though, if the summation would be done for atan2 output.

Since we are trying to detect 25Hz error, the accumulated angle over one second is expected to be 2*pi*25 ~ +-157 radians, but atan2's range is only +-pi.
On 16/06/2016 17:23, adel@swift-nav.com wrote:
> I must be missing something, but let me clarify my point about the false phase lock detector diagram in Kaplan book. It suggests that the CROSS and DOT products are accumulated over 1 second. This results in 50 additions in the book's example. > So, if: > DOT = abs(a) * abs(b) * cos(angle), > CROSS = abs(a) * abs(b) * sin(angle), > and assuming that we get roughly same values of DOT and CROSS in each of those 50 times, then > sum(DOT) = 50 * DOT > sum(CROSS) = 50 * CROSS > and atan2(CROSS, DOT) returns the angle, which corresponds to (50 * DOT)/ (50 * CROSS) = DOT / CROSS = cos(angle)/sin(angle). It turns out that the angle was not accumulated and the result is the angle for 20ms time interval - not for 1 second. > It would work fine though, if the summation would be done for atan2 output. > > Since we are trying to detect 25Hz error, the accumulated angle over one second is expected to be 2*pi*25 ~ +-157 radians, but atan2's range is only +-pi. >
Indeed, you can treat the situation described in Kaplan's book as if you measure angle for 20 ms. That's a correct description and that allows you to detect 25 Hz error. Accumulations ONLY allow you to get better statistics, i.e. measure angle with greater precision and reliability, nothing less or more! I'm just explaining that there's nothing wrong with the method described in the book. Of course, that doesn't mean that you shouldn't try any other method you like. Even if you do not succeed you'd learn new stuff. And, it's just fun to try! Gene
Right. Now I got it. The diagram is fine. It is the explanation to the diag=
ram, which confused me. It says: "The absolute value of E (the output of at=
an2) represents the change in phase in 1 second, F, which is in units of he=
rtz; this is compared to a threshold, G (for this example, this is 15.5Hz).=
..". If, as you said, treat the diagram for the measurement of the angle ov=
er 20ms time interval, then it makes a perfect sense to me.

Thank you for the help again, Gene.