The idea behind the smoothing of pseudorange observations using integrated carrier phase observations (in short: code smoothing) has been elaborated by Mr. Ron Hatch in the beginning of the eighties (the smoothing algorithm is sometimes called the 'Hatch filter') and is based on the simple concept that

- the integrated carrier phase observation when converted to length unit ('carrier range') is also a measure of the range between an SV and a receiver, and
- the change in pseudorange between observations at different points of time (epochs) equals the change in carrier range. and
- the change in carrier range can be determined with far more accuracy (in practice in the order of mm's) than the change in pseodorange (in practice in the order of meters).

Consider a series of N observations of pseudoranges P_{i} and
carrier ranges C_{i} , i = 1 , .. , N , to an SV:

epoch 1 ; P_{1} ; C_{1}

epoch 2 ; P_{2 }; C_{2}

etc

etc

epoch N ; P_{N} ; C_{N}.

According the above thesis we can formulate the N equations:

P_{N} - P_{1} = C_{N} - C_{1}

P_{N}- P_{2} = C_{N} - C_{2}

etc

etc

P_{N} - P_{N-1} = C_{N} - C_{N-1}

P_{N} - P_{N} = C_{N} - C_{N} (this
equation looks, and is pathological, but required in the following deduction)

or

P_{N} = P_{1} + C_{N} - C_{1}

P_{N} = P_{2} + C_{N} - C_{2}

etc

etc

P_{N} = P_{N-1} + C_{N} - C_{N-1}

P_{N} = P_{N} + C_{N} - C_{N}

Here N equations for P_{N} are formulated which are used to
determine the average (or smoothed) value **P _{N}** which should
be more precise than the observation P

**P _{N}** = (P

This equation can be re-arranged in the more convenient recursive form:

**P _{N}** = P

with **P _{N-1}** the smoothed pseudorange of the previous epoch.
The above re-arranging is straight forward and is left as an exercise to
the reader (that's what my textbooks used to say about insolvable problems,
and I like to get some revenge at this moment !)

In principle the more epochs of data are used in the smoothing process the more precise the smoothed pseudorange should become, and should approach the precision of the carrier range (remember: mm-level). In practise there are always facts which destroy the ideal world.

- Since the ionosphere delays the pseudorange and advances the carrier range (see the theory page) the change in pseudorange does not equal exactly the change in carrier range (this effect is called the ionospheric divergence).
- If the receiver channel looses lock on the SV momentarily, or if the range rate of change is too high, the carrier phase integration process is disrupted, resulting in a 'cycle slip', and an incorrect change in carrier range.

To overcome the above drawbacks the number of observations used to smooth the pseudoranges is limited. At one observation per second a maximum of 100 seems a good value. Moreover, large cycle slips can be detected : if the carrier rate of change is larger by a certain margin than the pseudorange rate of change, a cycle slip is declared and the smoothing algorithm is reset (n = 1). The margin depends very much on the noise- and multipath figures of your receiver and the antenna location. For high quality receivers with optimally located antennas the margin could be as low as 1 m, a value of 15 m is more realistic, which implies that slips of more than 100 cycles (1 cycle is about 0.2 m) remain undetected. The limit value for N limits the error in the smoothed pseudorange, and lets it fade away after one to two minutes.

Code smoothing reduces multipath and receiver noise on the pseudoranges. Although theoretically a reduction of a factor 10 can be reached, you can count on a reduction of at least a factor 2, and with some luck 5. Code smoothing does not improve the stand alone position very much, because the errors induced by Selective Availbility are far larger than the reduction in pseodorange noise and multipath. For differential code GPS the multipath and noise may very well be the largest contributions to the error budget, and in this case code smoothing does a good job.

OK, enough with the dull theory, let's look at the implementation of the
code smoothing concept with single difference processing.. I start with the
remark, that at this point in the s/w pages it's the first time that we discuss
*time series* of observations in stead of observations at one epoch
only. Its for this reason, that I added some overhead s/w to process time
series in stead of one epoch. And in order to conserve disk space (my provider
limits me), and for clarity I removed all procedures and functions which
were formulated in earlier examples. If you want to run the example code,
you should copy the procedures and functions from the
single difference example code.

View/ download the example code by clicking here. I also prepared files with reference receiver data, , moving receiver data and support data, with observations of about 100 epochs of data taken from two stationary receivers, and the output , as generated by the program. The position noise in the ouput file is very low, I collected this data with very good receivers.

Experiment with the data by changing the maximum value of the number of observations (Nmax in procedure 'readsmooth') to a lower value, or switch off the filter by setting Nmax to 1.

Have fun !

Back to s/w index

This page was constructed on 6 November 1997.