Mathematical Modelling of The Global Positioning System

advertisement
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 Jogréus
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 couldn’t
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 community of Global Positioning System (GPS) for high precision navigation
problems such as aircraft non precision approach, river and harbor navigation, 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 Professor - Claes Jogréus 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 Introduction . . . . .
1.2 GPS Overview . . . .
1.3 Motivation . . . . . .
1.4 Scope and Objective
1.5 Thesis Structure . . .
.
.
.
.
.
1
1
1
2
3
3
.
.
.
.
.
.
.
.
5
5
7
9
10
12
13
15
16
3 Numerical Method of GPS Tracking Signal
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2 Numerical Expression of The Coordinates . . . . . . . . . .
3.3 Numerical Solution Using Mathematica . . . . . . . . . . . .
17
17
18
20
4 Global Position Systems Applications
4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2 GPS for The Utilities Industry . . . . . . . . . . . . . . . . .
23
23
23
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
2 Modeling of GPS Tracking Signals
2.1 GPS Signal Structure . . . . . . . . . . .
2.2 Basic Phase-Locked Loops . . . . . . . .
2.2.1 First-Order Phase-Locked Loop .
2.2.2 Second-Order Phase-Locked Loop
2.3 Z-Transform of Continuous Systems . . .
2.4 Carrier and Code Tracking . . . . . . . .
2.5 GPS Tarcking Loop Signals . . . . . . .
2.6 Conclusion . . . . . . . . . . . . . . . . .
iv
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
v
4.3
4.4
4.5
4.6
4.7
GPS for Civil Engineering Applications
GPS for Land Seismic Surveying . . .
GPS for Marine Seismic Surveying . .
GPS for Vehicle Navigation . . . . . .
GPS for Transit Systems . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
25
25
27
29
30
Bibliography
33
A GPS Source Code for Data Acquisition
37
List of Figures
1.1
GPS segments . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2
2.1
2.2
6
2.3
2.4
2.5
Architecture of Software-based GPS Receiver . . . . . . . . . . .
Schematic showing the generation of L1 band GPS signal. The
equation is the mathematical representation of C/A code in L1
band . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
A basic Phase-Locked Loop . . . . . . . . . . . . . . . . . . . . .
Loop Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Code and carrier tracking loops. . . . . . . . . . . . . . . . . . .
6
8
12
14
3.1
3.2
Basic idea of GPS positioning . . . . . . . . . . . . . . . . . . .
Satellite and Observer in the Global Positioning System . . . . .
18
19
4.1
4.2
4.3
4.4
4.5
4.6
GPS
GPS
GPS
GPS
GPS
GPS
24
26
27
28
29
31
for
for
for
for
for
for
utility mapping . . . . . .
construction applications .
land seismic surveying . .
marine seismic surveying
vehicle navigation . . . . .
transit systems . . . . . .
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 stations that maintain the satellites in their proper orbits through occasional 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 receives the signals from the GPS satellites and uses the transmitted information to calculate the user’s 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 performance 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 dependability 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 approximatively 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 position 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 navigation 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 crosscorrelation 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 rep5
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 implemented 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 local 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]:
u(t) =
0 for t < 0
1 for t > 0
(2.2)
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
θf (t) =
t
k1 u(t)dt
(2.3)
0
The Laplace transform [7] of θf (t) is:
k1
s
We can obtain from the Figure 2.1b the following equations:
θf (s) =
(2.4)
Vc (s) = k0 (s) = k0 [θi (s) − θf (s)]
(2.5)
V0 (s) = Vc (s)F (s)
(2.6)
θf (s) = V0 (s)
k1
s
Hence result the following:
(t) = θi (s) − θf (s) =
Vc (s)
V0 (s)
sθf (s)
=
=
or
k0
k0 F (s)
k0 k1 F (s)
(2.7)
9
2.2. BASIC PHASE-LOCKED LOOPS
s
θi (s) = θf (s) 1 +
k0 k1 F (s)
(2.8)
Where (s) is the error function. The transfer function H(s) of the loop is
defined as:
H(s) ≡
θf (s)
k0 k1 F (s)
=
θi (s)
s + k0 k1 F (s)
(2.9)
The error transfer function can be defined as:
He (s) =
(s)
θi (s) − θf (s)
s
=
= 1 − H(s) =
θi (s)
θi (s)
s + k0 k1 F (s)
The equivalent noise bandwidth is defined as:
Z ∞
|H(jω)|2 df
Bn =
(2.10)
(2.11)
0
Where ω is the angular frequency and is related to the frequency f by
ω = 2πf
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:
θi (t) = u(t)
or
θi (s) =
1
s
(2.12)
∆ω
s2
(2.13)
The second type is a frequency-modulated signal
θi (t) = ∆ω(t)
2.2.1
or
θi (s) =
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
H(s) =
k0 k1
s + k0 k1
(2.15)
Then the noise bandwidth can be expressed as:
Z ∞
Z
(k0 k1 )2
dω
(k0 k1 )2 ∞
Bn =
df =
2
2
2
ω + (k0 k1 )
2π
ω + (k0 k1 )2
0
0
(k0 k1 )2
Bn =
tan−1
2πk0 k1
ω
k0 k1
∞
=
0
k0 k1
4
(2.16)
Given the input signal θi (s) = 1/s, the error function can be found from
Equation (2.10) as:
(s) = θi (s)He (s)
1
s + k0 k1
(2.17)
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)
t→∞
s→0
(2.18)
It follows from this relation, the final value of (t) can be found as:
s
=0
s→0 s + k0 k1
lim (t) = lim s(s) = lim
t→∞
s→0
(2.19)
Given the input signal θi (s) = ∆ω/s2 , the error function becomes:
(s) = θi (s)He (s)
∆ω
1
s s + k0 k1
(2.20)
Then the steady state error becomes:
∆ω
∆ω
=
s→0 s + k0 k1
k0 k1
lim (t) = lim s(s) = lim
t→0
s→0
(2.21)
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
11
2.2. BASIC PHASE-LOCKED LOOPS
to make such a second-order phase-locked loop is
F (s) =
sτ2 + 1
sτ1
(2.22)
Replacing this relation into Equation (2.9), the transfer function becomes:
H(s) =
k0 k1 τ2 s
+ k0τ1k1
τ1
s2 k0 kτ11τ2 s + k0τ1k1
≡
2ζωn s + ωn2
s2 + 2ζωn s + ωn2
(2.23)
where ωn is the natural frequency, which can be expressed as:
r
k0 k1
ωn =
τ1
(2.24)
and ζ the damping factor which can be determined as follow:
k0 k1 τ2
ωn τ2
or ζ =
τ1
2
Therefore the noise bandwidth can be found as:
2ζωn =
Z
∞
|H(jω)|2 df =
Bn =
0
ωn
2π
∞
Z
0
1−
2ζ ωωn
1+
2 2
ω
ωn
(2.25)
+
2
2ζ ωωn
2 dw
or
ωn
=
2π
Z
0
1 + 4ζ 2
∞
ω
ωn
4
+
2(2ζ 2
ω
ωn
− 1)
2
ω
ωn
2
+1
ωn
dw =
2
1
ζ+
4ζ
(2.26)
This integration can be found in the appendix of [6]. Therefore the error
transfer function can be obtained from Equation (2.10) as:
He (s) = 1 − H(s) =
s2
s2 + 2ζωn s + ωn2
(2.27)
And whenever θi (s) = 1/s, the error function becomes:
(s) =
s2
s2 + 2ζωn s + ωn2
(2.28)
At steady state the error is given by:
lim (t) = lim s(s) = 0
t→∞
s→0
(2.29)
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 frequencymodulated 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=
ts 1 + z −1
(2.30)
where ts is the sampling interval. Substituting this relation in Equation
(2.22) the filter is transformed to:
F (z) = C1 +
C2
(C1 + C2) − C1 z −1
=
1 − z −1
1 − z −1
(2.31)
where:
C1 =
2τ2 − ts
2τ1
and
C2 =
ts
τ1
(2.32)
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
N (z) =
θf (z)
k1 z −1
≡
V0 (z)
1 − z −1
13
(2.33)
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:
H(z) =
k0 k1 (C1 + C2 )z −1 − k0 k1 C1 z −2
1 + [k0 k1 (C1 + C2 ) − 2]z −1 + (1 − k0 k1 C1 )z −2
(2.35)
By using the bilinear transform in Equation (2.32) to Equation (2.23), the
result can be written as:
[4ζωn + (ωn ts )2 ] + 2(ωn ts )2 z −1 + [(ωn ts )2 − rζωn ts ]z −2
[4 + 4ζωn + (ωn ts )2 ] + [2(ωn ts )2 − 8]z −1 + [4 − 4ζωn + (ωn ts )2 ]z −2
(2.36)
By equating the denominator polynomials in the above two equations, C1
and C2 can be determined as:
H(z) =
C1 =
1
8ζωn ts
k0 k1 4 + 4ζωn ts + (ωn ts )2
C2 =
1
4ζωn ts
k0 k1 4 + 4ζωn ts + (ωn ts )2
(2.37)
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. Stripping 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 signal. The acquisition program determines the initial value of the carrier
frequency. The voltage-controlled oscillator (VCO) generates a carrier frequency 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 compared 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 transition. 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 factors of the phase detector, and the VCO (or the digital frequency synthesizer). 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 4π100. 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 environment 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 dynamically 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 processing 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 equations these spheres are given by:
(x − x1 )2 + (y − y1 )2 + (z − z1 )2
(x − x2 )2 + (y − y2 )2 + (z − z2 )2
(x − x3 )2 + (y − y3 )2 + (z − z3 )2
(x − x4 )2 + (y − y4 )2 + (z − z4 )2
= r12
= r22
= r32
= 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
y1 = −11, 757, 191.370
z1 = 25, 391, 471.881
x2 = 11, 092, 568.240
y2 = −14, 198, 201.090
z2 = 21, 471, 165.950
x3 =
y3 =
z3 =
x4 =
y4 =
z4 =
35, 606, 984.591
94, 447, 027.237
9, 101, 378.572
3, 966, 929.048
7, 362, 851.831
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
r2
r3
r4
= 23, 204, 698.51
= 21, 585, 835, 37
= 31, 364, 260.01
= 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 sophistication. The practical implementation of the GPS had to await the
deployment of geosynchronous satellite and the hardware needed to produce 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 sufficient 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
r2
r3
r4
:=
:=
:=
:=
23204698.51
21585835.37
31364260.01
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 implementing the solution. The bulk of the output is taken up with the description 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 elimination 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 standard 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 accuracy, 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 applications. 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 companies 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 collected 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 information 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 required.
4.3. GPS FOR CIVIL ENGINEERING APPLICATIONS
4.3
25
GPS for Civil Engineering Applications
Civil engineering works are often done in a complex and unfriendly environment, 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 industry. 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 communication 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 methods [13].
GPS is also used to track the location and usage of equipment at different 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 easily 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 electronically 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 vehicle’s 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 electronic 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 builtin 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 existing services and to increase ridership. Until recently, transit systems used
old technologies such as odometer/compass sensors and signposts for position determination [18]. odometers are sensors that measure the number of
rotation counts generated by the vehicle’s wheels, which are then used to
estimate the distance traveled by the vehicle. With the help of a compass,
the vehicle’s direction of travel can be determined at any time. Combining
the measurements from the odometer and the compass, the vehicle’s position 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 odometer’s drift error.
Unfortunately, this system has a number of limitations, including its incapability 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 integrating a low-cost autonomous GPS system with one or more of these conventional systems. GPS helps in controlling the drift of the conventional
systems through frequent calibration. In addition, the vehicle’s 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 vehicle’s 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. 56–59. [cited at p. 1]
[5]
Langley, R.B, “The mathematic of GPS”, GPS World, Vol. 2, No. 7
July/August 1991, pp. 45–50. [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 Equations and Mathematical Modelling”. ALGA Publication, Blekinge Institute
of Technology. [cited at p. 8, 10]
[8]
Institute of Navigation. “Global Positioning System monographs”. Washington, 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. 1034–1037. [cited at p. 25]
[12] Elfick, M., et al., “Elementary Surveying”, 8th Edition, Newy York: HarperCollins, 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. 6–8. [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. 36–48.
[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. 38–43. [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
24–26, 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;
Download