When the measurement ISR is called it reads the measurement status register and then immediately calls the measurement DSR, this is done to minimise potential clashes between the two main interrupt routines.

The DSR increments the system time and measurement interval by the measurement tic period (time between interrupts), then reads the number of carrier phase cycles since the last measurement interrupt and adds this to a running total for each channel.

Then if the accumulated measurement interval is equal to the inverse of the measurement rate, all the hardware measurement registers are read for each channel. So when a measurement is taken the data read from the register comprises code offset, code phase, epoch count(no of milliseconds), we already have the accumulated no of carrier cycles.

Next a timestamp is saved and a copy of the receiver system time is used for this purpose. Finally the measurement thread is called which converts the register contents to pseudorange values.

The measurement thread calculates the pseudorange by first calculating the satellite time corresponding to the position of the received satellite code signal when the measurement was taken. This is accomplished by adding the code phase to the code bit offset*1024 plus the no of milliseconds (full 1023 bit gold code*2) *1024*2046 plus the no of data bits (20 milliseconds) *1024*2046*20.

There are 1024 code phase bits in a code bit and 2046 code sample bits in a millisecond or full gold code, the gold code is sampled at twice the bit rate to give 2046 instead of the expected 1023.The data bits are at a rate of 50Hz or 20ms in length to give the fractional second part of the time.

To adjust for differences in the number of seconds the satellite signal tow value is subtracted from the receiver tow value,these can only differ by one second if the satellite tow value is just less than a second and the receiver tow is just greater than the same second. The range of values for pseudorange for an earth based receiver are approximately 60-85 milliseconds, the time of flight from a satellite directly overhead and for one on the horizon.

If this is a WAAS channel the delay from the viterbi decoder is added, which is 32*0.004 seconds, 32 bits through the decoder with two symbols every 4 milliseconds.

The time of flight is then converted into metres by multiplying by the speed of light to give a pseudorange value.

Next the doppler offset is calculated by calculating the number of carrier phase cycles in the measurement interval and subtracting the number of cycles due to the carrier signal frequency, ie the carrier frequency * measurement interval.

However due to receiver oscillator errors, the txco will not be exactly the same as the design frequency perhaps only by 2.5*10-6 or less, but a correction must be made for the current value of the oscillator error or clock drift. 2.5 Hz in 1 Mhz may not seem very much but when we subtract out the the carrier frequency of 1575 Mhz this small error gets highly magnified.

The calculated doppler cycles are converted to metres to give the delta/change in the range and added to the current value of the adr (accumulated doppler range). This value is also used to smooth the pseudorange by filtering the current smoothed pseudorange plus the doppler range with the current pseudorange value over 20 samples.

new_smoothed_psr = (old_smoothed_psr+delta_range)*(20-1)/20+new_psr/20

A check is then made to see that the pseudorange is within reasonable limits and if 4 or more sateliites have valid pseudoranges then a call is made to the position thread.

Back to Top of Page