Vous êtes sur la page 1sur 50

Master Thesis

Mathematical Modeling and Simulation


Thesis no: 2008 - 6
May 2008

Mathematical Modelling of The Global


Positioning System Tracking Signals

Mounchili Mama

School of Engineering
Blekinge Institute of Technology
SE - 371 79 Karlskrona
Sweden
This thesis is submitted to the School of Engineering at Blekinge Institute
of Technology in partial fulfillment of the requirements for the degree of
Master of Science in Mathematical Modeling and Simulation. The thesis is
15 credit (15 ECTS ) equivalent to ten weeks of full time studies.

Contact Information

Author : Mounchili Mama


E-mail : moumama@gmail.com

University advisor : Assistant Professor - Claes Jogrus


Department of Mathematical Science
Email : claes.jogreus@bth.se

School of Engineering
Blekinge Institute of Technology
SE - 371 79 Karlskrona
Sweden

Internet : http://www.bth.se/tek/master
Sincere thanks to my Parents and
Siblings who always stood by me whenever needed, without whom I couldnt
be a complete person. Finally to my wife Fatimatou Zahra embellishing my
life, by caring so much about me. I love you Zahra.
Abstract

Recently, there has been increasing interest within the potential user com-
munity of Global Positioning System (GPS) for high precision navigation
problems such as aircraft non precision approach, river and harbor navi-
gation, real-time or kinematic surveying. In view of more and more GPS
applications, the reliability of GPS is at this issue.

The Global Positioning System (GPS) is a space-based radio navigation


system that provides consistent positioning, navigation, and timing services
to civilian users on a continuous worldwide basis. The GPS system receiver
provides exact location and time information for an unlimited number of
users in all weather, day and night, anywhere in the world.

The work in this thesis will mainly focuss on how to model a Mathematical
expression for tracking GPS Signal using Phase Locked Loop filter receiver.
Mathematical formulation of the filter are of two types: the first order
and the second order loops are tested successively in order to find out a
compromised on which one best provide a zero steady state error that will
likely minimize noise bandwidth to tracks frequency modulated signal and
returns the phase comparator characteristic to the null point. Then the
Z-transform is used to build a phase-locked loop in software for digitized
data. Finally, a Numerical Methods approach is developed using either
MATLAB or Mathematica containing the package for Gaussian elimination
to provide the exact location or the tracking of a GPS in the space for a
given a coarse/acquisition (C/A) code.

i
Acknowledgements

I would like to express my sincere thanks to my supervisor Assistant Pro-


fessor - Claes Jogrus for his constructive comments as well as useful advice
throughout the thesis work.

iii
Contents

Contents iv

List of Figures vi

1 Introduction 1
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 GPS Overview . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 Scope and Objective . . . . . . . . . . . . . . . . . . . . . . 3
1.5 Thesis Structure . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 Modeling of GPS Tracking Signals 5


2.1 GPS Signal Structure . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Basic Phase-Locked Loops . . . . . . . . . . . . . . . . . . . 7
2.2.1 First-Order Phase-Locked Loop . . . . . . . . . . . . 9
2.2.2 Second-Order Phase-Locked Loop . . . . . . . . . . . 10
2.3 Z-Transform of Continuous Systems . . . . . . . . . . . . . . 12
2.4 Carrier and Code Tracking . . . . . . . . . . . . . . . . . . . 13
2.5 GPS Tarcking Loop Signals . . . . . . . . . . . . . . . . . . 15
2.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

3 Numerical Method of GPS Tracking Signal 17


3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.2 Numerical Expression of The Coordinates . . . . . . . . . . 18
3.3 Numerical Solution Using Mathematica . . . . . . . . . . . . 20

4 Global Position Systems Applications 23


4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.2 GPS for The Utilities Industry . . . . . . . . . . . . . . . . . 23

iv
v

4.3 GPS for Civil Engineering Applications . . . . . . . . . . . . 25


4.4 GPS for Land Seismic Surveying . . . . . . . . . . . . . . . 25
4.5 GPS for Marine Seismic Surveying . . . . . . . . . . . . . . 27
4.6 GPS for Vehicle Navigation . . . . . . . . . . . . . . . . . . 29
4.7 GPS for Transit Systems . . . . . . . . . . . . . . . . . . . 30

Bibliography 33

A GPS Source Code for Data Acquisition 37


List of Figures

1.1 GPS segments . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2.1 Architecture of Software-based GPS Receiver . . . . . . . . . . . 6


2.2 Schematic showing the generation of L1 band GPS signal. The
equation is the mathematical representation of C/A code in L1
band . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3 A basic Phase-Locked Loop . . . . . . . . . . . . . . . . . . . . . 8
2.4 Loop Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.5 Code and carrier tracking loops. . . . . . . . . . . . . . . . . . . 14

3.1 Basic idea of GPS positioning . . . . . . . . . . . . . . . . . . . 18


3.2 Satellite and Observer in the Global Positioning System . . . . . 19

4.1 GPS for utility mapping . . . . . . . . . . . . . . . . . . . . . . 24


4.2 GPS for construction applications . . . . . . . . . . . . . . . . . 26
4.3 GPS for land seismic surveying . . . . . . . . . . . . . . . . . . 27
4.4 GPS for marine seismic surveying . . . . . . . . . . . . . . . . 28
4.5 GPS for vehicle navigation . . . . . . . . . . . . . . . . . . . . . 29
4.6 GPS for transit systems . . . . . . . . . . . . . . . . . . . . . . 31

vi
Chapter 1

Introduction

1.1 Introduction
The Global Positioning System (GPS) is a satellite-based navigation system
[1], that was developed by the U.S. Department of Defense (DoD) in the
early 1970s. Primarily, GPS was developed as a military system to fulfill
U.S. military needs. However, it was later made available to civilians, and
is now a dual-use system that can be accessed by both military and civilian
users [2]. GPS provides continuous positioning and timing information,
anywhere in the world under any weather conditions. Because it serves an
unlimited number of users as well as being used for security reasons, GPS
is a one-way-ranging (passive) system [4]. That is, users can only receive
the satellite signals.

1.2 GPS Overview


The GPS is made up of three parts: satellites orbiting the Earth; control and
monitoring stations on Earth; and the GPS receivers owned by users. GPS
satellites broadcast signals from space that are picked up and identified by
GPS receivers. Each GPS receiver then provides three-dimensional location
(latitude, longitude, and altitude) plus the time. Furthermore GPS consist
of three segments as shown in Figure 1.1: the space segment, the control
segment and the user segment.

The space segment consists of a nominal constellation of 24 operating


satellites that transmit one-way signals that give the current GPS
satellite position and time.

1
2 CHAPTER 1. INTRODUCTION

Figure 1.1: GPS segments

The control segment consists of worldwide monitor and control sta-


tions that maintain the satellites in their proper orbits through occa-
sional command maneuvers, and adjust the satellite clocks. It tracks
the GPS satellites, uploads updated navigational data, and maintains
health and status of the satellite constellation.

The user segment consists of the GPS receiver equipment, which re-
ceives the signals from the GPS satellites and uses the transmitted in-
formation to calculate the users three-dimensional position and time.

1.3 Motivation
GPS satellites provide service to civilian and military users [8]. The civilian
service is freely available to all users on a continuous, worldwide basis. The
military service is available to governments and allied armed forces as well
as other Government agencies.
A variety of GPS augmentation systems and techniques are accessible
to improve system performance to meet specific user requirements. The
improved signal availability, accuracy, and integrity, allows even better per-
formance than is possible using the basic GPS civilian service.
1.4. SCOPE AND OBJECTIVE 3

The outstanding performance of GPS over many years has earned the
confidence of millions of civil users worldwide. It has proven its dependabil-
ity in the past and promises to be of benefit to users, all over the world, far
into the future.

1.4 Scope and Objective


The goal of this thesis work is primarily to formulate some mathematical
models that best describe phase locked loop necessary to determine approx-
imatively the GPS tracking signal. Then the next step will be to make a
transform from continuous to discrete systems to build a phase-locked loop
in software for digitized data, the continuous system must be changed into
a discrete system. Numerical method such as the Gaussian Elimination
method will be use to simulation on mathematica package the exact posi-
tion of a GPS signal receiver in the three dimension space. Finally some
GPS applications area will be discussed.

1.5 Thesis Structure


Chapter 1 of the book introduces the GPS system and its components.
Chapter 2 examines the mathematical modeling or formulation of GPS
tracking signal structure, coupled with the GPS modernization, and the
key types of the GPS measurements. Another simple way to determine
the GPS signal is developed using Gaussian Elimination method package
of Mathematical, is presented in Chapter 3. The GPS applications in the
various fields are given in Chapter 4, which covers the other satellite nav-
igation systems developed or proposed in different parts of the world that
fit with different purpose.
Chapter 2

Modeling of GPS Tracking Signals

The main objective in this chapter is to determine how GPS signal can
be processed by using acquisition and tracking algorithms to extract the
navigation information bits from the raw data. The navigation data bits
provide all the necessary information to compute the pseudo-range between
the receiver and the visible satellites.

2.1 GPS Signal Structure


Generally the GPS has two bands, L1 and L2. Where L1 band has coarse /
acquisition (C/A) code, P-code and navigation data and L2 band has only
P-code. The P-code is encrypted with an encryption code and is named
Y-code. While the C/A code is a succession of zeros and ones and is unique
for every satellite. The code is relied on Gold Codes. Two strings of gold
codes with different phase tapings are considered to generate unique C/A
code for each satellite. The C/A code is also called pseudorandom number
(PRN) code. PRN code or number is attributed to every satellite depending
on which PRN code is attributed to a particular satellite. If PRN (C/A)
code of 1 is assigned to a satellite, in that case this satellite is named as
PRN-1. The particularities of C/A codes are that they have the best cross-
correlation feature. The cross-correlation among any two codes is much
lower than auto-correlation of each one of the codes. The frequency of the
C/A code is 1.023 MHz. P-code is also a sequence of zeros and ones and is
generated using a set of Gold Codes. P-code has a frequency of 10.23 MHz.

Fig.2.1 depicss a general schematic to generate a L1 band signal as rep-

5
6 CHAPTER 2. MODELING OF GPS TRACKING SIGNALS

Figure 2.1: Architecture of Software-based GPS Receiver

Figure 2.2: Schematic showing the generation of L1 band GPS signal. The
equation is the mathematical representation of C/A code in L1 band
2.2. BASIC PHASE-LOCKED LOOPS 7

resented by the equation shown in the figure for C/A code. In conventional
hardware-based GPS receiver, the lower three blocks in Fig.2.2 are imple-
mented in an IC chip and hence the user cannot access the algorithms
built inside the chips. In software-based receiver, these blocks are fully
implemented using high level programming languages granting the user a
complete control over the algorithms. Hence the main difference between
the software-based GPS receiver and a conventional hardware receiver.

2.2 Basic Phase-Locked Loops


During the tracking process, the center frequency of the narrow-band filter
is fixed, while a locally generated signal follows the frequency of the input
signal. Moreover the phases of both signals are compared through a phase
comparator of which passes through a narrow-band filter. Given that the
tracking circuit posses narrow bandwidth, the sensitivity is fairly high in
comparison with the acquisition method.

In the case of phase shifts in the carrier due to the C/A code, as in a GPS
signal, the code has to be stripped off first. The tracking process will follow
the signal and acquire the information of the navigation data. In case a
GPS receiver is stationary, the desired frequency variation is very slow due
to satellite motion. Given this condition, the frequency variation of the
locally generated signal is also slow; consequently, the update rate of the
tracking loop can be low. Therefore, to track a GPS signal two tracking
loops are needed: a loop to track the carrier frequency referred as carrier
loop and the other one to track the C/A code known as the code loop.

The main purpose of a phase-locked loop is to adjust the frequency of a lo-


cal oscillator to match the frequency of an input signal, which is sometimes
referred to as the reference signal. A basic phase-locked loop is shown in
Figure 2.3.

Figure 2.3a shows the time domain configuration and Figure 2.3b shows the
s-domain configuration, which is obtained from the Laplace transform. The
input signal is i (t) and the output from the voltage-controlled oscillator
(VCO) is f (t). The phase comparator measures the phase difference
of these two signals. The amplifier k0 represents the gain of the phase
comparator and the low-pass filter limits the noise in the loop. The input
8 CHAPTER 2. MODELING OF GPS TRACKING SIGNALS

Figure 2.3: A basic Phase-Locked Loop

voltage Vo to the VCO controls its output frequency, which can be expressed
as:

2 (t) = 0 + k1 u(t) (2.1)


where 0 is the center angular frequency of the VCO, k1 is the gain of
the VCO, and u(t) is a unit step function, which is defined as [6]:

0 for t < 0
u(t) = (2.2)
1 for t > 0
The phase angle of the VCO can be obtained by integrating Equation (2.1)
as: Z t Z t
2 (t)dt = 0 t + f (t) = 0 t + k1 u(t)dt
0 0
Where: Z t
f (t) = k1 u(t)dt (2.3)
0
The Laplace transform [7] of f (t) is:
k1
f (s) = (2.4)
s
We can obtain from the Figure 2.1b the following equations:

Vc (s) = k0 (s) = k0 [i (s) f (s)] (2.5)

V0 (s) = Vc (s)F (s) (2.6)

k1
f (s) = V0 (s) (2.7)
s
Hence result the following:
Vc (s) V0 (s) sf (s)
(t) = i (s) f (s) = = = or
k0 k0 F (s) k0 k1 F (s)
2.2. BASIC PHASE-LOCKED LOOPS 9

 
s
i (s) = f (s) 1 + (2.8)
k0 k1 F (s)
Where (s) is the error function. The transfer function H(s) of the loop is
defined as:

f (s) k0 k1 F (s)
H(s) = (2.9)
i (s) s + k0 k1 F (s)
The error transfer function can be defined as:
(s) i (s) f (s) s
He (s) = = = 1 H(s) = (2.10)
i (s) i (s) s + k0 k1 F (s)

The equivalent noise bandwidth is defined as:


Z
Bn = |H(j)|2 df (2.11)
0

Where is the angular frequency and is related to the frequency f by


= 2f

In order to study the properties of the phase-locked loops, two types of


input signals are usually studied. The first type is a unit step function as:

1
i (t) = u(t) or i (s) = (2.12)
s
The second type is a frequency-modulated signal


i (t) = (t) or i (s) = (2.13)
s2

2.2.1 First-Order Phase-Locked Loop


A first-order phase-locked loop implies that the denominator of the transfer
function H(s) is a first-order function of s [6]. The order of the phase-locked
loop depends on the order of the filter in the loop. The expression of the
filter function in the case of the first order phase-locked loop, is:

F (s) = 1 (2.14)

Hence the simplest expression of phase-locked loop. In the case of a unit


step function input, the equivalent transfer function from Equation (2.9)
becomes:
10 CHAPTER 2. MODELING OF GPS TRACKING SIGNALS

k0 k1
H(s) = (2.15)
s + k0 k1
Then the noise bandwidth can be expressed as:
Z
(k0 k1 )2 (k0 k1 )2
Z
d
Bn = 2 2
df =
0 + (k0 k1 ) 2 0 + (k0 k1 )2
2


(k0 k1 )2

k0 k1
Bn = tan1 = (2.16)
2k0 k1 k0 k1 0 4
Given the input signal i (s) = 1/s, the error function can be found from
Equation (2.10) as:

1
(s) = i (s)He (s) (2.17)
s + k0 k1
The steady-state error can be found from the final value theorem [7] of the
Laplace transform as follow:

lim y(t) = lim sY (s) (2.18)


t s0

It follows from this relation, the final value of (t) can be found as:

s
lim (t) = lim s(s) = lim =0 (2.19)
t s0 s0 s + k0 k1

Given the input signal i (s) = /s2 , the error function becomes:

1
(s) = i (s)He (s) (2.20)
s s + k0 k1
Then the steady state error becomes:


lim (t) = lim s(s) = lim = (2.21)
t0 s0 s0 s + k0 k1 k0 k1
It results that the steady-state phase error is not equal to zero. Therefore
for a large value of k0 k1 makes the error small. However, from Equation
(2.15) the 3 dB bandwidth occurs at s = k0 k1 . Thus a small value of (t)
also means large bandwidth, that is likely to contain more noise.

2.2.2 Second-Order Phase-Locked Loop


In the case of a second-order phase-locked loop means the denominator of
the transfer function H(s) is a second-order function of s. One of the filters
2.2. BASIC PHASE-LOCKED LOOPS 11

to make such a second-order phase-locked loop is


s2 + 1
F (s) = (2.22)
s1
Replacing this relation into Equation (2.9), the transfer function becomes:
k0 k1 2 s
1
+ k01k1 2n s + n2
H(s) = (2.23)
s2 k0 k112 s + k01k1 s2 + 2n s + n2
where n is the natural frequency, which can be expressed as:
r
k0 k1
n = (2.24)
1
and the damping factor which can be determined as follow:

k0 k1 2 n 2
2n =
or = (2.25)
1 2
Therefore the noise bandwidth can be found as:

 2
Z
n
Z 1+ 2 n
Bn = |H(j)|2 df =   2 2 2 dw
2
 
0 0
1 n
+ 2 n

or
 2

n
Z 1 + 4 2 n n

1

= 4 2 dw = + (2.26)
2 2 4
 
0
n
+ 2(2 2 1) n
+1

This integration can be found in the appendix of [6]. Therefore the error
transfer function can be obtained from Equation (2.10) as:

s2
He (s) = 1 H(s) = (2.27)
s2 + 2n s + n2
And whenever i (s) = 1/s, the error function becomes:

s2
(s) = (2.28)
s2 + 2n s + n2
At steady state the error is given by:

lim (t) = lim s(s) = 0 (2.29)


t s0
12 CHAPTER 2. MODELING OF GPS TRACKING SIGNALS

Figure 2.4: Loop Filter

Unlike the first-order loop, the steady-state error is zero for the frequency
modulated signal. Meaning that, the second-order loop tracks a frequency-
modulated signal and returns the phase comparator characteristic to the
null point. Therefore, the conventional phase-locked loop in a GPS receiver
is usually a second-order one.

2.3 Z-Transform of Continuous Systems


In order to build a phase-locked loop in software for digitized data, the
continuous system must be changed into a discrete system. The transfer
from the continuous s-domain into the discrete z-domain is through bilinear
transform as:

2 1 z 1
s= (2.30)
ts 1 + z 1
where ts is the sampling interval. Substituting this relation in Equation
(2.22) the filter is transformed to:

C2 (C1 + C2) C1 z 1
F (z) = C1 + = (2.31)
1 z 1 1 z 1
where:

22 ts ts
C1 = and C2 = (2.32)
21 1
This filter is shown in Figure 2.4. The VCO in the phase-locked loop is
replaced by a direct digital frequency synthesizer and its transfer function
N (z) can be used to replace the result in Equation (2.7) with:
2.4. CARRIER AND CODE TRACKING 13

f (z) k1 z 1
N (z) = (2.33)
V0 (z) 1 z 1
Using the same approach as Equation (2.8), the transfer function H(z) can
be written as:
f (z) k0 F (z)N (z)
H(z) = = (2.34)
i (z) 1 + k0 F (z)N (z)
The substituting the results of Equations (2.33) and (2.35) into the above
equation, yields:

k0 k1 (C1 + C2 )z 1 k0 k1 C1 z 2
H(z) = (2.35)
1 + [k0 k1 (C1 + C2 ) 2]z 1 + (1 k0 k1 C1 )z 2
By using the bilinear transform in Equation (2.32) to Equation (2.23), the
result can be written as:

[4n + (n ts )2 ] + 2(n ts )2 z 1 + [(n ts )2 rn ts ]z 2


H(z) =
[4 + 4n + (n ts )2 ] + [2(n ts )2 8]z 1 + [4 4n + (n ts )2 ]z 2
(2.36)
By equating the denominator polynomials in the above two equations, C1
and C2 can be determined as:

1 8n ts
C1 =
k0 k1 4 + 4n ts + (n ts )2
1 4n ts
C2 = (2.37)
k0 k1 4 + 4n ts + (n ts )2
The filter here is implemented in digital format and the result can be used for
phase-locked loop designs, but it is not the part of this thesis scope since we
are only concerned with mathematical expression. Where the desired noise
bandwidth signal from the Equation (2.26) can is expressed as:
 
n 1
Bn = +
2 4

2.4 Carrier and Code Tracking


Within a GPS receiver, the input is the GPS signal and a phase-locked loop
must follow (or track) this signal. On the other hand, the GPS signal is a
bi-phase coded signal. The carrier and code frequencies change due to the
Doppler Effect, which is caused by the motion of the GPS satellite as well
14 CHAPTER 2. MODELING OF GPS TRACKING SIGNALS

Figure 2.5: Code and carrier tracking loops.

as from the motion of the GPS receiver. In order to track the GPS signal,
the C/A code information have to be removed. Consequently, it requires
two phase-locked loops to track a GPS signal. One loop is to track the C/
A code and the other one is to track the carrier frequency. These two loops
must be coupled together are depicted in Figure 3.3.
In Figure 2.3, the C/A code loop generates three outputs: an early
code, a late code, and a prompt code. The prompt code is applied to the
digitized input signal and strips the C/A code from the input signal. Strip-
ping the C/A code means to multiply the C/A code to the input signal
with the proper phase. The output will be a continuous wave (cw) signal
with phase transition caused only by the navigation data. This signal is
applied to the input of the carrier loop. The output from the carrier loop
is a cw with the carrier frequency of the input signal. This signal is used
to strip the carrier from the digitized input signal, which means using this
signal to multiply the input signal. The output is a signal with only a C/A
code and no carrier frequency, which is applied to the input of the code loop.

Every output passes through a moving average filter and the output of
the filter is squared. The two squared outputs are compared to generate a
2.5. GPS TARCKING LOOP SIGNALS 15

control signal to adjust the rate of the locally generated C/A code to match
the C/A code of the input signal. The locally generated C/A code is the
prompt C/A code and this signal is used to strip the C/A code from the
digitized input signal.

The carrier frequency loop receives a cw signal phase modulated only


by the navigation data as the C/A code is stripped off from the input sig-
nal. The acquisition program determines the initial value of the carrier
frequency. The voltage-controlled oscillator (VCO) generates a carrier fre-
quency with respect to the value obtained from the acquisition program.
This signal is divided into two paths: a direct path and the other one with
a 90-degree phase shift. These two signals are correlated with the input
signal. The outputs of the correlators are filtered and their phases are com-
pared against each other through an arctangent comparator.

The arctangent process is insensitive to the phase transition caused by


the navigation data and it can be considered as one type of a Costas loop.
A Costas loop is a phase-locked loop, which is insensitive to phase transi-
tion. The output of the comparator is filtered again and generates a control
signal. This control signal is used to tune the oscillator to generate a carrier
frequency to follow the input cw signal. This carrier frequency is also used
to strip the carrier from the input signal.

2.5 GPS Tarcking Loop Signals


The input data to the tracking loop are collected from satellites. Several
constants have to be determined such as the noise bandwidth, the gain fac-
tors of the phase detector, and the VCO (or the digital frequency synthe-
sizer). These constants are determined through trial and error or guessing
and are by no means optimized. This tracking program is applied only on
limited data length. Although it generates acceptable results, further study
might be needed if it is used in a software GPS receiver designed to track
long records of data. The following steps can be applied to both the code
loop and the carrier loop:

1. Set the bandwidths and the gain of the code and carrier loops. The
loop gain includes the gains of the phase detector and the VCO. The
bandwidth of the code loop is narrower than the carrier loop because
it tracks the signal for a longer period of time. Select the noise band-
16 CHAPTER 2. MODELING OF GPS TRACKING SIGNALS

width of the code loop to be 1 Hz and the carrier loop to be 20 Hz.


This is one set of several probable selections that the tracking program
can run.

2. Choose the damping factor in Equation (2.25) to be = .707. The


value is often assumed near about its optimum [9].

3. The natural frequency can be found from Equation (2.26).

4. Select the code loop gain (k0 k1 ) to be 50 and the carrier loop gain to
be 4100. These values are also one set of several possible selections.
The constants C1 and C2 of the filter can be found from Equation
(2.39).

The above four steps provide the necessary information for the two loops.
Once the constants of the loops are known, the phase of the code loop and
the phase of the carrier frequency can be adjusted to follow the input signals.

2.6 Conclusion
Hence the completed the algorithms for acquisition and tracking. The goal
of these algorithms has to be tested on various data sets in different envi-
ronment using different type of antenna including left hand and right hand
polarized antenna. I have found that, it is necessary to tune the parameters
of the tracking algorithm and threshold values of acquisition either dynam-
ically or based on some rule for successful acquisition and tracking of GPS
signal in standard environment. In some cases, we have found that tracking
could not be done for satellites though acquisition is perfect. In this case,
a change of parameter values of the Phase Lock Loop manually makes the
tracking successful. This type of manual setting shall be automated in the
future. The future work consists of extracting the navigation message from
the tracking output and to compute the position of the receiver. It is also
necessary to make the processing as fast as possible.
Chapter 3

Numerical Method of GPS Tracking


Signal

The idea behind GPS is rather simple. If the distances from a point on
the Earth (a GPS receiver) to three GPS satellites are known along with
the satellite locations, then the location of the point (or receiver) can be
determined by simply applying the well-known concept of resection [5]. Now
arises a question on how we can get the distances to the satellites as well as
the satellite locations?

3.1 Introduction
As mentioned before, each GPS satellite continuously transmits a microwave
radio signal composed of two carriers, two codes, and a navigation message.
When a GPS receiver is switched on, it will pick up the GPS signal through
the receiver antenna. Once the receiver acquires the GPS signal, it will
process it using its built-in software. The partial outcome of the signal pro-
cessing consists of the distances to the GPS satellites through the digital
codes (known as the pseudo ranges) and the satellite coordinates through
the navigation message.

Theoretically, only three distances to three simultaneously tracked satellites


are needed. In this case, the receiver would be located at the intersection
of three spheres; each has a radius of one receiver-satellite distance and is
centered on that particular satellite (Figure 3.1). However from the practical
point of view, a fourth satellite needed to account for the receiver clock offset

17
18 CHAPTER 3. NUMERICAL METHOD OF GPS TRACKING SIGNAL

Figure 3.1: Basic idea of GPS positioning

[3].

3.2 Numerical Expression of The Coordinates


The launching over the last three decade of the so-called geosynchronous
satellites (i.e., satellites located at a fixed point above the surface of the
earth) has made it possible to determine tracking signal position anywhere
on earth. this is done by measuring the time it take for a signal to travel
between the observer and any satellite and translating it into distance ri
between the two.

To exact the desired coordinates of the observer from these measurements,


we construct a sphere of radius ri about each of four satellites. The equa-
tions these spheres are given by:

(x x1 )2 + (y y1 )2 + (z z1 )2 = r12
(x x2 )2 + (y y2 )2 + (z z2 )2 = r22
(x x3 )2 + (y y3 )2 + (z z3 )2 = r32
(x x4 )2 + (y y4 )2 + (z z4 )2 = r42

Where xi , yi , zi are the known coordinates of the satellites in the space and
x, y, z are the unknown coordinate of the observer on the earth as shown
on the Figure 3.2. We now subtract the first of these equations from each
of the three. This eliminates quadratic terms in x, y, z and leads to the
following set of nonhomogeneous linear equation in x, y, z:
3.2. NUMERICAL EXPRESSION OF THE COORDINATES 19

Figure 3.2: Satellite and Observer in the Global Positioning System

2 2 2 2

2(x2 x1 )x + 2(y2 y1 )y + 2(z2 z1 )z = r1 x1 r2 + x2
(S) 2(x3 x1 )x + 2(y3 y1 )y + 2(z3 z1 )z = r12 x21 r32 + x23
2(x4 x1 )x + 2(y4 y1 )y + 2(z4 z1 )z = r12 x21 r42 + x24

This system can be solved by either Mathematica or Matlab containing


package for Gaussian elimination.

Let us consider an actual numerical example. Assuming that the coordinate


of the satellites with respect to a chosen point on the earth are given by the
following values (in meters):

x1 = 2, 088, 202.299 x3 = 35, 606, 984.591


y1 = 11, 757, 191.370 y3 = 94, 447, 027.237
z1 = 25, 391, 471.881 z3 = 9, 101, 378.572
x2 = 11, 092, 568.240 x4 = 3, 966, 929.048
y2 = 14, 198, 201.090 y4 = 7, 362, 851.831
z2 = 21, 471, 165.950 z4 = 26, 388, 447.172

Suppose that in addition the distances registered by the GPS devices are
20 CHAPTER 3. NUMERICAL METHOD OF GPS TRACKING SIGNAL

given by:
r1 = 23, 204, 698.51
r2 = 21, 585, 835, 37
r3 = 31, 364, 260.01
r4 = 24, 966, 798.73
Using the Gaussian Elimination to solve the system (S), the following results
are obtained:
x = 3.0168 106 m
y = 7231.03m
z = 3.13188 107 m
These are the coordinates of the observer with respect to a fixed known
origin on earth. Hence we have here the application of simple expressions
drawn from the analytical geometry of sphere and the elementary use of
Gaussian elimination to arrive at the solution of a problem of some so-
phistication. The practical implementation of the GPS had to await the
deployment of geosynchronous satellite and the hardware needed to pro-
duce compact GPS devices, which can now be installed in automobiles.

It is worth mentioning here that three equation (i.e., the use of only three
satellites in our case given that many can be involved) would have been suffi-
cient to calculate the coordinates x, y, z of the observer. In practice problem
when many satellites come into play. Hence the need to develop computer
algorithm that could be used to solve the problem in such situation.

3.3 Numerical Solution Using Mathematica


The computer outpout obtained in connection with the above problem are
as follow:

GPS
The 3-dimensional coordinates of each satellite are the following:

x1 := 2088202.299
y1 := -11757191.370
z1 := 25391471.881

x2 := 11092568.240
y2 := -14198201.090
z2 := 21471165.950
3.3. NUMERICAL SOLUTION USING MATHEMATICA 21

x3 := 35606984.591
y3 := -4447027.239
z3 := 9101378.572

x4 := 3966929.048
y4 := 7362851.831
z4 := 26388447.172

The distance registered in the GPS device are:

r1 := 23204698.51
r2 := 21585835.37
r3 := 31364260.01
r4 := 24966798.73

eqn1 := 2(x2-x1)x + 2(y2-y1)y + 2(z2-z1)z=r1^2-r2^2-x1^2+x2^2


eqn2 := 2(x3-x1)x + 2(y3-y1)y + 2(z3-z1)z=r1^2-r3^2-x1^2+x3^2
eqn3 := 2(x4-x1)x + 2(y4-y1)y + 2(z4-z1)z=r1^2-r4^2-x1^2+x4^2

In[721] := Solve [{eqn1, eqn2, eqn3}, {x,y,z}]


Out[721] = {{x --> -3.0168*10^6, y --> 7231.03, z --> -3.13188*10^7}}

The striking feature in this output is the terseness of the statement imple-
menting the solution. The bulk of the output is taken up with the descrip-
tion of the system to be solved and listing of the numerical coefficients of
the equations involved. Implementation takes only two lines and is obtained
with the command In[721], where Solve is the code for the Gaussian elim-
ination routine and the Out[721] is the result of its application.

It is worth mentioning here that the entire procedure is thus hidden in a


"black box," which can be cracked open to provide more solution details,
albeit at the cost of some additional effort. Black boxes containing stan-
dard AE or ODE solution methods often run to several hundred pages of
instructions or more, which the typical user never sees.
Chapter 4

Global Position Systems Applications

GPS has found his way into many applications, mainly as result of its ac-
curacy, global availability, and cost-effectiveness.

4.1 Introduction
GPS has been available for civil and military use for more than two decades.
That period of time has witnessed the creation of numerous new GPS ap-
plications. Because it provides high-accuracy positioning in a cost effective
manner, GPS has found its way into many industrial applications, replacing
conventional methods in most cases. For example, with GPS, machineries
can be automatically guided and controlled. This is especially useful in
hazardous areas, where human lives are endangered. Even some species of
birds are benefiting from GPS technology, as they are being monitored with
GPS during their immigration season. This way, help can be presented as
needed. This chapter describes how GPS is being used in land, marine, and
airborne applications.

4.2 GPS for The Utilities Industry


Accurate and up-to-date maps of utilities are essential for utility companies.
The availability of such maps helps electric, gas, and water utility compa-
nies to plan, build, and maintain their assets.

The GPS/GIS system provides a cost-effective, efficient, and accurate


tool for creating utility maps. With the help of GPS, locations of features

23
24 CHAPTER 4. GLOBAL POSITION SYSTEMS APPLICATIONS

Figure 4.1: GPS for utility mapping

such as gas lines can be accurately collected, along with their attributes
(such as their conditions and whether or not a repair is needed). The col-
lected information can then be used by a GIS system to create updated
utility maps.

In situations of poor GPS reception, such as in urban canyons, it might be


useful to use integrated GPS and LRF systems [10]. This integrated system
is an efficient tool for rapid utility mapping. A GPS receiver remains in
the open for the best signal reception, while the LRF measures the offset
information (range and azimuth) to the utility assets such as light poles (see
Figure 4.1). The processing software should be able to combine both the
GPS and the LRF information.
Buried utilities such as electric cables or water pipes can also be mapped
efficiently using GPS (Figure 4.1). With the help of a pipe/cable locator
attached to the second port of the GPS handheld controller, accurate infor-
mation on the location and the depth of the buried utility can be collected.
This is a very cost-effective and efficient tool, as no ground marking is re-
quired.
4.3. GPS FOR CIVIL ENGINEERING APPLICATIONS 25

4.3 GPS for Civil Engineering Applications


Civil engineering works are often done in a complex and unfriendly envi-
ronment, making it difficult for personnel to operate efficiently. The ability
of GPS to provide real-time submeter- and centimeter-level accuracy in a
cost-effective manner has significantly changed the civil engineering indus-
try. Construction firms are using GPS in many applications such as road
construction, Earth moving, and fleet management.

In road construction and Earth moving, GPS, combined with wireless com-
munication and computer systems, is installed onboard the Earthmoving
machine [11]. Designed surface information, in a digital format, is uploaded
into the system. With the help of the computer display and the real-time
GPS position information, the operator can view whether the correct grade
has been reached (see Figure 4.2). In situations in which millimeter-level
elevation is needed, GPS can be integrated with rotated beam lasers [12].

The same technology (i.e.) combined GPS, wireless communications,


and computers) is also used for foundation works (e.g., pile positioning)
and precise structural placement (e.g., prefabricated bridge sections and
coastal structures). In these applications, the operators are guided through
the onboard computer displays, eliminating the need for conventional meth-
ods [13].

GPS is also used to track the location and usage of equipment at differ-
ent sites. By sending this information to a central location, GPS enables
contractors to deploy their equipment more efficiently. Moreover, vehicle
operators can be efficiently guided to their destinations

4.4 GPS for Land Seismic Surveying


Oil and gas exploration requires mapping of the subsurface geology through
seismic surveying. In land seismic surveys, low-frequency acoustic energy is
sent down into the underground rock layers (Figure 4.3). The source of the
acoustic energy is often selected to be a mechanical vibrator consisting of
a metal plate mounted on a truck. The plate is pressed against the ground
and vibrated to produce the acoustic energy. In rough areas, dynamite is
still being used as the energy source.
26 CHAPTER 4. GLOBAL POSITION SYSTEMS APPLICATIONS

Figure 4.2: GPS for construction applications

As the acoustic energy (signal) crosses the various underground rock


layers, it is affected by the physical properties of the rocks. Portions of the
signal are reflected back to the surface by the various layers. The reflected
energy can be detected by special seismic devices called geophones, which
are laid out al known distances from the energy Source along the survey line
(Figure 4.3). Upon detecting .seismic energy, geophones output electrical
signals that are proportional to the intensity of the reflected energy [14].
The electrical signals are then recorded on magnetic tapes for geophysical
analysis and interpretation.

It is clear that unless the positions of the energy source and the geophones
are known with sufficient accuracy, the very expensive seismic data becomes
useless. GPS is used to provide the positioning information in a standard
4.5. GPS FOR MARINE SEISMIC SURVEYING 27

Figure 4.3: GPS for land seismic surveying

or a user-defined coordinate system. Integrated GPS/GLONASS (Global


Navigation Satellite System) and GPS/digital barometer systems have been
used successfully in situations of poor GPS signal reception [15]. With the
help of GPS, the environmental impacts (e.g., the need to cut trees) as well
as the operating cost of seismic surveys have been reduced significantly.

4.5 GPS for Marine Seismic Surveying


Marine seismic surveying is similar in principle to land seismic surveying.
That is, a low-frequency acoustic energy is sent down into the subsurface
rock layers, and is reflected back to the surface to reveal information about
28 CHAPTER 4. GLOBAL POSITION SYSTEMS APPLICATIONS

Figure 4.4: GPS for marine seismic surveying

the composition of subsurface rocks (Figure 4.4).

Different methods are used iJ1 marine seismic surveys depending on the
water depth. In deep waters, seismic vessels tow seismic cables, known
as streamers, which contain devices called hydrophones used for detecting
reflected energy. A single vessel will normally tow four to eight parallel
streamers; each has a length of several kilometers [14]. The low-frequency
acoustic energy is generated using a number of air guns towed behind the
vessel at about 6m below the surface. In shallow waters, both the land
and the marine methods are used. Ocean bottom cable (OBC) survey is a
relatively new technology that has been used recently for water depth of up
to about 200m. In this method, hydrophones and geophones are combined
in a single receiver to avoid water column reverberation (Figure 4.4).

To obtain meaningful results, the positions of the energy source and the
hydrophones must be known with sufficient accuracy. This can be eas-
ily achieved, at lower cost, with GPS. As the operation of marine seismic
surveys is very expensive, the issue of quality control (QC) is essential. To
maintain QC, the seismic industry has suggested the use of two independent
positioning systems, with GPS being the primary one [14].
4.6. GPS FOR VEHICLE NAVIGATION 29

Figure 4.5: GPS for vehicle navigation

4.6 GPS for Vehicle Navigation


When traveling through unfamiliar areas, vehicle drivers often use paper
road maps for route guidance. However, besides being inefficient, searching
for a destination using a paper map is unsafe, especially in busy areas. A
new technology, incorporating GPS with digital road maps and a computer
system, has been developed so that route guidance can be obtained elec-
tronically with a touch of a button [16]. Figure 4.5 illustrates this concept.

The role of GPS in this technology is to contiJ1uously determine the vehi-


cles location. In obstructed areas, such as urban canyons and tunnels, GPS
is supplemented by a terrestrial system such as the DR system to overcome
the GPS signal blockage. This system is accurate only over a short period
of time. The GPS-determined vehicle location is superimposed on an elec-
tronic digital road map, containing in its database digital information such
as street names and directions, business listings, airports, attractions, and
other related information. Once the driver inputs a destination, the built-
in computer finds the best route to reach that destination. Factors such as
shortest distance and time to destination, one-way roads, illegal turns, and
rush-hour restrictions, are all considered in the path finding. Some systems
allow the drivers to input other factors such as accident avoidance.

The driver usually gets turn-by-turn instructions, with audio and/or visual
indications, to the destination. If the driver misses a turn, the system
30 CHAPTER 4. GLOBAL POSITION SYSTEMS APPLICATIONS

displays a warning message and finds an alternative best route based on the
current location of the vehicle. Some manufacturers add cellular systems
to provide weather and traffic information and to locate the vehicles in
case of emergency. Recent advances in wireless communication technology
even make it possible for drivers to remotely access the Internet from their
vehicles [17].

4.7 GPS for Transit Systems


Transit system authorities in many countries are faced with a challenging
trend of fiscal constraints, which limits their capabilities to expand exist-
ing services and to increase ridership. Until recently, transit systems used
old technologies such as odometer/compass sensors and signposts for posi-
tion determination [18]. odometers are sensors that measure the number of
rotation counts generated by the vehicles wheels, which are then used to
estimate the distance traveled by the vehicle. With the help of a compass,
the vehicles direction of travel can be determined at any time. Combining
the measurements from the odometer and the compass, the vehicles posi-
tion can be determined with respect to an initial (known) position.

Unfortunately, both the odometer and the compass drift over time, which
causes significant error in the estimated position. Signposts, in contrast,
are radio beacon transmitters that are placed at known locations along the
bus routes [19]. Each beacon transmits a low-power microwave signal, which
is detected by a receiver on the bus, to account for the odometers drift error.

Unfortunately, this system has a number of limitations, including its inca-


pability of knowing the exact location of a vehicle in between two signposts.
In addition, it is not possible to track a vehicle that goes off-route as a result
of, for example, a road closure [18].

To overcome the limitations of these systems, transit authorities are inte-


grating a low-cost autonomous GPS system with one or more of these con-
ventional systems. GPS helps in controlling the drift of the conventional
systems through frequent calibration. In addition, the vehicles position can
be obtained reliably with GPS if the vehicle goes off-route. However, since
some of the GPS signals will be obstructed in areas with high-rise buildings,
such as downtown areas, the vehicles position may be obtained with the
4.7. GPS FOR TRANSIT SYSTEMS 31

Figure 4.6: GPS for transit systems

help of conventional systems. As such, the performance of the integrated


system is indeed better than either positioning system alone.

The integrated positioning system not only helps the transit authorities to
locate their fleet of buses on a digital base map in real time, but also helps
in performing other advanced functions (see Figure 4.6). For example, if the
bus locations are available in real time, the bus arrival times at the bus stops
can be computed reliably, thus minimizing the waiting time at the bus stops.
This is a very important feature, especially under severe weather conditions.
In addition, the availability of the real-time bus location information enables
the transit authorities to dynamically design more efficient bus scheduling,
thus improving bus efficiency and customer service. This information can
be accessed through the Internet, greatly enhancing customer satisfaction
[18].
Bibliography

[1] Dinesh M., Yongcheol S., Ryosuke S., Technical Repport of IEICE. GPS
Signal Acquisition and Tracking. The Institute of Electronics, Information
and Communication Engineers. [cited at p. 1]

[2] FRP, U.S. Federal Radionavigation Plan, 1999. [cited at p. 1]

[3] Kaplan, E. Understanding GPS: Principles and Application, Norwood MA:


Artech House 1990. [cited at p. 18]

[4] Langley, R.B, Why is The GPS signal so Complex?, GPS World, Vol. 1,
No. 3 May/June 1990, pp. 5659. [cited at p. 1]

[5] Langley, R.B, The mathematic of GPS, GPS World, Vol. 2, No. 7
July/August 1991, pp. 4550. [cited at p. 17]

[6] Peyton Z., Peebles, JR. Tata eds. 2001. Probability, Random Variables and
Random Signal principles. Tata McGraw-Hill Publishing Company Limited.
New Delhi. [cited at p. 8, 9, 11]

[7] Nail H. Ibragimov. eds. 2006. A Practical Course in Differential Equa-


tions and Mathematical Modelling. ALGA Publication, Blekinge Institute
of Technology. [cited at p. 8, 10]

[8] Institute of Navigation. Global Positioning System monographs. Washing-


ton, DC: The Institute of Navigation. [cited at p. 2]

[9] Global Positioning System Standard Positioning Service Specification, 2nd


Edition, June2, 1995. [cited at p. 16]

[10] Laser Technology Inc., Survey Laser for Forestery,Powerpoint Presentation,


access July 18, 2001, www.lasertech.com/download.html. [cited at p. 24]

[11] Smith, B. S., GPS Grade Control for Construction, Smith, B. S., "GPS
Grade Control for Construction," Proc. ION GPS 2000, 13th Intl. Techni-

33
34 BIBLIOGRAPHY

cal Meeting, Satellite Division, Institute of Navigation, Salt Lake City, UT,
September 19-22, 2000, pp. 10341037. [cited at p. 25]

[12] Elfick, M., et al., Elementary Surveying, 8th Edition, Newy York: Harper-
Collins, 1994. [cited at p. 25]

[13] El-Rabbany, A.,A. Chrzanowski, and M. Santos, GPS Application in Civil


Engineering , Ontario Land Surveyor Quaterly 2001, pp. 68. [cited at p. 25]

[14] Jensen, M.H Quality Control for Differential GPS on Offshore Oil and
Gaz Exploration, GPS World, Vol. 3, No. 8 September 1992, pp. 3648.
[cited at p. 26, 28]

[15] McLintock, D.,G. Deren and E. Krakwisky Environment Sensitive: DGPS


and Barometry for Seismic Survey , GPS World, Vol. 3, No. 8 February
1994, pp. 20-26. [cited at p. 27]

[16] Zhao, Y., Vehicle Location and Navigation Systems, Nonvood, MA: Artech
House, 1997. [cited at p. 29]

[17] Hada, H., et al., The Internet, Cars, and DGPS: Bringing Mobile Sensors
and Global Correction Services On Line, GPS World, Vol. 11, No.5, May
2000, pp. 3843. [cited at p. 30]

[18] El-Rabbany, A., A. Shabby, and S. Zolfaghari, Real-Time Bus Location,


Passenger Information and Scheduling for Public Transportation, Presented
at GPS meeting, GOEIDE 2000 Conference, Calgary, Alberta, Canada, May
2426, 2000. [cited at p. 30, 31]

[19] Drane, C., and C. Rizos, Positionillg Systems in Intelligent Transportation


Systems, Norwood, MA: Artech House, 1998. [cited at p. 30]
Appendices

35
Appendix A

GPS Source Code for Data Acquisition

37
% p7 1.m performs acquisition on collected data

clear

% ***** initial condition *****

svnumcinput(enter satellite number c );


intodatc10001; %input(enter initial pt into data (multiple of n) c
);
fsc5e6; % *** sampling freq
tsc1/fs; % *** sampling time
ncfs/1000; % *** data pt in 1 ms
nnc[0:n-1]; % *** total no. of pts
fcc1.25e6; % *** center freq without Doppler
nsatclength(svnum); % *** total number of satellites to be processed

% ***** input data file *****

fidcfopen(d:/gps/Big data/srvy1sf1.dat, r);


fseek(fid,intodat-1, bof);
x2cfread(fid,6*n, schar);

yy c zeros(21,n);

% ***** start acquisition *****

codecdigitizg(n,fs,0,svnum); % digitize C/A code


xf c fft(x2(1:n));
for i c [1:21]; % *** find coarse freq 1 KHz resolution
frcfc-10000+(i-1)*1000;
lcccode.* exp(j*2*pi*fr*ts*nn); % generate local code
lcfcfft(lc);
yy(i,:)cifft(xf .* conj(lcf)); % circular correlation
end
[amp crw]cmax(max(abs(yy))); % find highest peak
[amp ccn]cmax(max(abs(yy)));

pt initcccn; % initial point


cfrqcfc+1000*(crw-11); % coarse freq

% ***** gerenate 5 ms data by stripping C/A code *****

z5cx2(pt init:pt init+5*n-1); % take 5 ms data starting with C/A code


za5cz5 .* [code code code code code];% create cw from 5 sets of data
% ***** find medium freq resolution 400 KHz apart *****

for i c [1:3];
frccfrq-400+(i-1)*400;
mfrq0(i)csum(za5(1:5000) .* exp(j*2*pi*fr*ts*nn));
mfrq1(i)cabs(mfrq0(i));
end
[mamp mrw] c max(mfrq1); % find highest peak
mfrqccfrq+200*(mrw-2);
frcmfrq; % medium freq

% ***** find fine freq *****

zb5cza5 .* exp(j*2*pi*fr*ts*[0:5*n-1]); % one DFT component


zc5cdiff(-angle(sum(reshape(zb5,n,5)))); % find difference angle
zc5fixczc5;

% ***** Adjust phase and take out possible phase shift *****

thresholdc2.3*pi/5;
for ic1:4;
if abs(zc5(i))>threshold;% for angle adjustment
zc5(i)czc5fix(i)-2*pi;
if abs(zc5(i))>threshold;
zc5(i)czc5fix(i)+2*pi; % end
if abs(zc5(i))>2.2*pi/5; % for pi phase shift correction
zc5(i)czc5fix(i)-pi;
if abs(zc5(i))>threshold;
zc5(i)czc5fix(i) - 3*pi;
if abs(zc5(i))>threshold;
zc5(i)czc5fix(i)+pi; %end
end
end
end
end
end
end

dfrqcmean(zc5)*1000/(2*pi);
frrcfr+dfrq;% fine freq

plot(abs(yy(crw,1:n)))
title([GPS c num2str(svnum) max at num2str(pt init)])
figure
plot(abs(yy):,ccn)), *)
% title([GPS c num2str(svnum) Freq c num2str(frr)])
format
pt init
format long e
frr

% digitizg.m This prog generates the C/A code and digitizes it


function code2 c digitizg(n,fs,offset,svnum);

% code - gold code


% n - number of samples
% fs - sample frequency in Hz;
% offset - delay time in seconds must be less than 1/fs cannot shift
left
% svnum - satellite number;

gold rate c 1.023e6; %gold code clock rate in Hz.


tsc1/fs;
tcc1/gold rate;

cmd1 c codegen(svnum); % generate C/A code


code inccdm1;

% ***** creating 16 C/A code for digitizing *****

code a c [code in code in code in code in];


code ac[code a code a];
code ac[code a code a];

% ***** digitizing *****

b c [1:n];
c c ceil((ts*b+offset)/tc);
code c code a(c);

% ***** adjusting first data point *****

if offset>c0;
code2c[code(1) code(1:n-1)];
else
code2c[code(n) code(1:n-1)];
end
function [ca used]ccodegen(svnum);

% ca used : a vector containing the desired output sequence


% the g2s vector holds the appropriate shift of the g2 code to generate
% the C/A code (ex. for SV#19 - use a G2 shift of g2s(19)c471)
% svnum: Satellite number

gs2 c [5;6;7;8;17;18;139;140;141;251;252;254;255;256;257;258;
469;470;471; ... 472;473;474;509;512;513;514;515;516;
859;860;861;862];

g2shiftcg2s(svnum,1);

% ***** Generate G1 code *****

% load shift register


reg c -1*ones(1,10);
for i c 1:1023,
g1(i) c reg(10);
save1 c reg(3)*reg(10);
reg(1,2:10) c reg(1:1:9);
reg(1) c save1;
end,

% ***** Generate G2 code *****


% load shift register
reg c -1*ones(1,10);
for i c 1:1023,
g2(i) c reg(10);
save2 c reg(2)*reg(3)*reg(6)*reg(8)*reg(9)*reg(10);
reg(1,2:10) c reg(1:1:9);
reg(1) c save2;
end

% ***** Shift G2 code *****


g2tmp(1,1:g2shift)cg2(1,1023-g2shift+1:1023);
g2tmp(1,g2shift+1:1023)cg2(1,1:1023-g2shift);
g2 c g2tmp;

% ***** Form single sample C/A code by multiplying G1 and G2

ss ca c g1.*g2;
ca usedc-ss ca;

Vous aimerez peut-être aussi