Vous êtes sur la page 1sur 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

SIM UNIVERSITY
SCHOOL OF SCIENCE AND TECHNOLOGY

SIMULINK MODELING OF SINGLE CHANNEL GPS


(GLOBAL POSITIONING SYSTEM) RECEIVER

STUDENT

: N0707027 (PI NO.)

SUPERVISOR

: WILSON OON

PROJECT CODE

: JUL2009/ENG/01

A project report submitted to SIM University


in partial fulfilment of the requirements for the degree of
Bachelor Engineering of Electronics
May 2010

Page 1 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

ABSTRACT
In this decade, Global Positioning System (GPS) has been widely utilised by many
communication devices for commercial purposes. The GPS gadgets are getting more
advanced and complicated as the technology progresses. In order to follow up with the
industry and get hand on, a study onto the software model development will be helpful in
getting a deeper knowledge of GPS. During the past few years a lot of efforts have been
exerted to make the inner working of the GPS receiver visible, clear and easy to learn and
modify either on the level of software or hardware.
Software-based GPS receiver will assist many of us to analyze GPS signal that would not
have been possible using conventional GPS receivers. SIMULINK modeling software is used
in the implementation of such receiver, thereby introducing a new look for the SDR
technology that can be accomplished via a graphical user interface environment.
The aim of this project is to develop a single channel GPS receiver model using SIMULINK.
The implementation will consist of GPS signal simulator, acquisition, partial tracking. The
GPS signal simulator emulates the function of a satellite which constantly transmits GPS L1
frequency. This signal contains a coarse acquisition (C/A) code and a navigation data
message. Parallel code phase search acquisition as one of the three acquisition methods is
chosen for identifying the correct carrier and C/A code for demodulation. Once the
acquisition determines coarse value of the visible satellite signal, the tracking model will
refine the frequency and remove the carrier. Decoding the C/A code in the code tracking will
be the future work.
This report will cover on the objectives of the project, literature review of GPS and project
management aspects. The main focus will be on the researching on the GPS topic, model
development, implementation and testing of the GPS receiver. Finally, topic such as
conclusions, recommendations, critical review and reflections of this project will be
discussed. A user guide to run the SIMULINK models is enclosed at Appendix A.

Page 2 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

ACKNOWLEDGEMENT
First and foremost, I would like to offer my sincere gratitude to my tutor, Dr. Wilson Oon, for
his encouragement, patience, guidance and support throughout the project. Even though my
progress in research was slow and results were scant, he never ceased to inspire me and
encourage me to preserve on.
Next, I would like to thank my friends in UniSIM for their support and practical suggestions
towards this project. They have made my learning experience in UniSIM a pleasant and
enriching one.
I would also like to thank my manager and colleagues for their support and encouragement
throughout my curriculum in UniSIM.
There are many people to who directly or indirectly help me in completing my project. My
special thank and appreciation to everyone especially to my cell groups friends who
consistently praying for me during the final part of my studies.
Lastly, my deepest appreciation goes out to my family and loved ones, who have shown great
care and concern during the entire development of the project. With their understanding and
moral support, I was able to have the strength to persevere on.

Page 3 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

TABLE OF CONTENT

ABSTRACT..............................................................................................................................2
ACKNOWLEDGEMENT.......................................................................................................3
CHAPTER ONE.....................................................................................................................10
1.

INTRODUCTION..........................................................................................................10
1.1 Background and Motivation.....................................................................................10
1.2 Overall Objective.....................................................................................................11
1.3 Scope........................................................................................................................11
1.3.1 Comprehending GPS technology.........................................................................12
1.3.2 Choice of programming language........................................................................12
1.3.3 System implementation........................................................................................12
1.4

Outline of Report Structure..................................................................................13

CHAPTER TWO....................................................................................................................14
2.

PROJECT MANAGEMENT.........................................................................................14
2.1 Project Plan..............................................................................................................14
2.2 Project Management.................................................................................................14
2.3 Proposed Approach And Method To Be Employed.................................................15
2.4 Risk Management.....................................................................................................16

CHAPTER THREE...............................................................................................................17
3.

REVIEW OF LITERATURE........................................................................................17
3.1 Review of Global Positioning System (GPS) Technology.......................................17
3.2 What is GPS?...........................................................................................................20
3.3 Elements of GPS......................................................................................................21
3.4 How does GPS work?..............................................................................................25
3.5 Concepts and Principles used in GPS Technology...................................................27

Page 4 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

3.5.1 Trilateration..........................................................................................................27
3.5.2 Doppler Shift........................................................................................................29
3.6 Overview of Satellite system...................................................................................30
3.6.1 Satellite Orbits......................................................................................................30
3.6.2 NAVSTAR............................................................................................................32
3.6.3 GLONASS...........................................................................................................32
3.6.4 GALILEO............................................................................................................34
3.6.5 Chinese COMPASS systems................................................................................35
3.7 Overview of GPS Signal..........................................................................................36
3.7.1 GPS Frequency.....................................................................................................36
3.7.2 GPS Signal Structure............................................................................................37
3.7.3 Structure of GPS Navigation Data.......................................................................38
3.7.4 Precision (P(Y)) Code..........................................................................................39
3.7.5 GPS Signal Generation........................................................................................40
3.8 Overview of Software-Defined GPS Receivers (SDR)...........................................41
3.9 Overview of CDMA systems...................................................................................43
3.9.1 Access Scheme.....................................................................................................43
3.9.2 Coding..................................................................................................................43
3.9.3 Direct Sequence Spreading Spectrum (DSSS).....................................................44
3.10 GPS Application.......................................................................................................45
3.10.1 Military.................................................................................................................45
3.10.2 Personal navigation..............................................................................................45
3.10.3 Vehicle tracking systems......................................................................................45
3.11 MATLAB/SIMULINK application...........................................................................46
CHAPTER FOUR..................................................................................................................47
4.

SYSTEM DEVELOPMENT..........................................................................................47
4.1 System Overview.....................................................................................................47
Page 5 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

4.2 System Architecture.................................................................................................48


4.2.1 Simple Transmitter Simulator Architecture.........................................................48
4.3

Simple Receiver Simulator Architecture..............................................................50

CHAPTER FIVE....................................................................................................................52
5

SYSTEM DESIGN CONSIDERATIONS...............................................................52

5.1 GPS Transmitter.......................................................................................................52


5.2 Coarse/Acquisition (C/A) code................................................................................53
5.2.1 Overview..............................................................................................................53
5.2.2 Pseudo Random Noise (PRN) Sequence..............................................................53
5.2.3 Gold Sequence.....................................................................................................54
5.2.4 C/A Code Generator.............................................................................................55
5.2.5 C/A Code Generation...........................................................................................56
5.2.6 C/A Code Phase Assignment................................................................................58
5.3 Navigation Data.......................................................................................................59
5.3.1 Overview..............................................................................................................59
5.3.2 Navigation Data Generation.................................................................................59
5.4 Precision (P/Y) code................................................................................................62
5.4.1 Overview..............................................................................................................62
5.4.2 Precision code Generation....................................................................................62
5.5 Modulation...............................................................................................................63
5.5.1 Overview..............................................................................................................63
5.5.2 Mixer/Local Oscillator Implementation...............................................................63
5.5.3 BPSK Modulation................................................................................................64
5.6 Correlation Properties..............................................................................................64
5.7 Combining the signal components in GPS Transmitter...........................................65
5.8 GPS Receiver...........................................................................................................66
5.9 Data Acquisition.......................................................................................................66
Page 6 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

5.9.1 Serial Search Acquisition.....................................................................................67


5.9.2 Parallel Frequency Space Search Acquisition......................................................68
5.9.3 Parallel Code Phase Search Acquisition..............................................................70
5.9.4 The Selection of Acquisition Search....................................................................71
5.10 Demodulation...........................................................................................................72
5.10.1 Overview..............................................................................................................72
5.10.2 Carrier Tracking...................................................................................................73
5.10.3 Code Tracking......................................................................................................76
5.11 Factors Affecting GPS Accuracy..............................................................................78
CHAPTER SIX.......................................................................................................................79
6

SIMULINK MODEL DEVELOPMENT FOR GPS TRANSMITTER...................79

6.1 GPS Transmitter in SIMULINK model implementation.........................................79


6.1.1 Pre Initialization...................................................................................................79
6.1.2 Result on C/A code generation for Transmitter........................................................87
6.1.3 Result on Navigation data generation for Transmitter.............................................91
6.2 Result on P(Y) code generation for Transmitter......................................................96
6.3 Result on carrier generation for Transmitter............................................................97
6.4 Integrating the components for Transmitter.............................................................98
6.5 System Testings and Results..................................................................................100
CHAPTER SEVEN..............................................................................................................103
7

SIMULINK MODEL DEVELOPMENT FOR GPS RECEIVER.........................103

7.1 GPS Receiver in SIMULINK model implementation...........................................103


7.2

Parallel code phase search acquisition...............................................................103

7.3 Modeling Testing and Results................................................................................108


7.4 Carrier tracking implementation............................................................................109
CHAPTER EIGHT...............................................................................................................111
8

PROBLEMS AND DISCUSSIONS.......................................................................111


Page 7 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

8.1 Accuracy of GPS data............................................................................................111


8.2 Compatibility Considerations.................................................................................111
8.3 Many types of data.................................................................................................112
8.4 Correct usage of Sampling time.............................................................................112
CHAPTER NINE.................................................................................................................113
9

CONCLUSIONS AND RECOMMENDATIONS.................................................113

9.1 Conclusions............................................................................................................113
9.2 Recommendations and Future Work......................................................................113
CHAPTER TEN...................................................................................................................114
10

CRITICAL REVIEWS AND REFLECTIONS......................................................114

REFERENCES.....................................................................................................................115
APPENDIX A........................................................................................................................119
User Manual for running SIMULINK models................................................................119
APPENDIX B.......................................................................................................................125
B.1 M-Files : initSettings.m................................................................................................125
B2 M-Files : insignal_sfunc.m.............................................................................................127
B.3 M-Files : oscillator_sfunc.m.........................................................................................130
B.4 M-Files : caCodesTable.m............................................................................................133
B.5 M-Files : generateCaCodes.m......................................................................................135
B.6 M-Files : fft_sfunc.m.....................................................................................................137
B.7 M-Files : ifft_sfunc.m...................................................................................................139
B.8 M-Files : acquire2_sfunc.m..........................................................................................141
B.9 M-Files : Run_Reciver.m..............................................................................................146
APPENDIX C.......................................................................................................................147
SIMULINK model File for PRN 01 to PRN 32.............................................................147
APPENDIX D.......................................................................................................................179
GANTT CHART..................................................................................................................179
Page 8 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

APPENDIX E.......................................................................................................................180
E1 Meeting Log #01.......................................................................................................180
E2 Meeting Log #02.......................................................................................................181
E3 Meeting Log #03.......................................................................................................182
E4 Meeting Log #04.......................................................................................................182
E5 Meeting Log #05.......................................................................................................183
E6 Meeting Log #06.......................................................................................................183
E7 Meeting Log #07.......................................................................................................184
E8 Meeting Log #08.......................................................................................................184
E9 Meeting Log #09.......................................................................................................185
E10 Meeting Log #10.....................................................................................................185

Page 9 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

CHAPTER ONE
1. INTRODUCTION

1.1 Background and Motivation


The United States Navstar Global Positioning System (GPS) has been in operation since
1994. This system involves a constellation for 24 satellites revolving around the Earth
transmitting code-division multiple access system (CDMA) signals on 1.57542 GHz for
civilian ranging purpose with appropriate ground receivers. The successful operation of the
GPS system has opened a slew of Personal and Vehicular navigation Gadgets from
standalone Device such as Garmin GPS receiver to GPS receiver embedded in handphone
such as Nokia 6220 Personal Navigator. All the gadgets and devices appeared as a hardware
component where GPS software algorithm is not revealed. Understanding the technology
behind the hardware will require some studies. The software modelling is a visualization of
the entire system that is a good approximate representation of the real item that is being built.
For many years, engineers, scientists and other professional who build complex structures or
systems have been creating model of what they build. In all cases, a model serves as an
abstraction and visualization on any system development
Software-defined radios (SDR) have been around for more than a decade. SDR is a rapidly
evolving technology that is getting enormous recognition and is generating widespread
interest in the receiver industry. SDR technology can demonstrate and emulate segments of
the GPS signal environment for detailed analysis. The open architecture and flexible receiver
allows development and testing of various applications where dynamic selection of
parameters for individual modules is possible. Using software approach can speed up the
design process and also reduce costs.

Page 10 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1.2 Overall Objective


.2 The goal is to develop a single channel GPS receiver model using MATLAB/SIMULINK
tool.
.2 This project will develop a simulation model that will allow user/(s) to have a platform to
simulate the function of a single channel GPS receiver function. The platform will have
two sub-models GPS transmitter and a single GPS receiver. The satellite will be
represented by the GPS transmitter model and is designed to simulate GPS data coming
from many GPS Satellites. While the model for the GPS receiver will encompass the
necessary signal processing sub-models for single channel processing. The project will
demonstrate the data acquisition in CDMA based GPS signal and the ways of data
tracking so as to allow for data demodulation.
.2 The project gives a general idea of how the methodology of the GPS transmitter and
receiver operates where the understanding of GPS technology can be viewed in the flow
of the simulation flow. Modelling GPS receiver in MATLAB/SIMULINK has advantage
of its modularity, which allows the user to replace the implemented system by the user
own architecture. The model in SIMULINK can be built on various block diagrams of
different level hardware components. The SIMULINKs library has sufficient resource to
dynamically program to reconfigure the characteristic of the hardware. Because of its
individual unit, it is flexible to work on each subsystem of the GPS. After successful
testing simulations, it is possible to exchange SIMULINK block to other systems like
Xilinxs system generation library in order to generate the actual hardware design in
Field Programmable Gate Array (FPGA). For further project enhancement, successful
modelling of single channel receiver will be possible to duplicate it into multiple
channels modelling which resemble the real GPS receiver.

1.3 Scope
.2 This project requires knowledge in various fields/areas in order to develop the system
and complete it successfully.

Page 11 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1.3.1 Comprehending GPS technology


.2 In the GPS technology, satellite transmitter and receiver are the main physical hardware.
In order to model them, it is required to have an in depth understanding of the operation
and the components within the hardware. Research on signal generation, signal
acquisition and signal tracking can help to comprehend the GPS infrastructure system.
1.3.2 Choice of programming language
.2 As the project requires the development of a program platform to test out the GPS
structure, it is important to evaluate the various object programming languages for
implementation. MATLAB/SIMULINK was chosen as the software to develop the GPS
components. The main reason for the choice is that SIMULINK has a very intuitive user
interface combined with its numerous features. SIMULINK is a graphical environment
which is able to make the relation between the system modelling, simulation, and
implementation clearer and easier to debug because we can put test points anywhere and
obtain immediate results.
1.3.3 System implementation
.2 The implementation is divided into two sections: GPS transmitter and GPS receiver. The
system requirement is to implement the designed layout of each individual GPS
component. The components are combined and integrated to do functionality test and
display graphical result to show the simulation.
.2
.2

Page 12 of 273

SIMULINK Modeling of Single Channel GPS Receiver

1.4

(ENG499 JUL2009/ENG/014)

Outline of Report Structure

.2 Fill in later.

Page 13 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

CHAPTER TWO
2. PROJECT MANAGEMENT
2.1 Project Plan
.2 In any project, planning is a critical aspect as it ensures the project scope is defined and
determines the appropriate methods for completing the project. With proper planning,
risks factors and uncertainties will decrease, resulting in optimum outcome.
.2 The work breakdown structure (WBS) of the project is showed in Figure 2-1. It is a guide
on defining and grouping the work elements to help in organising and providing the
necessary framework in outlining the total work scope of the project.
.2

Global Positioning System (GPS)

Signal Generation
(Transmitter)

Generating
C/A Code/
Gold code

.2

Navigation
data
Generation

Generating
P(Y) Code

Level 1

GPS
Receiver

BPSK
Modulation

Carrier
Tracking

Code
Tracking

Level 2

Parallel Code
Phase Search
Acquisition

Level 3

Figure 2-1 : Work Breakdown Structure (WBS)

2.2

Project Management

.2 This project is planned to complete in ten months. A Gantt chart gives an overview
schedule of activities that is broken down into phases to serve as a time reference. The
chart is a monitoring board that shows the progress of the project.
Page 14 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

.2 At the initial planning phase, the activities/tasks were identified and listed out. The time
was allocated to implement each activity/task.
.2 For the monitoring phase, the gantt chart timeline was used to identify activities that were
behind or ahead of the schedule. Remedial actions were done to rectify problems and
ensure the project was able to meet the deadline specified.
.2 The time frame of this project was penned down onto the Gantt chart reflected in
Appendix D1. Appendix D2 provides the activities breakdown chart for enhanced the
simplicity in viewing. In order to understand the background of the topic, research and
literature review were essential to kick start the project. The system design as well as the
implementation methodology and approach needed to be conceptualised to fulfil the
project scope and requirements. Effort to familiarise with the SIMULINK software has to
be grasped in order to develop the GPS receiver. Finally, evaluation will be sought to
further improve the software.

2.3 Proposed Approach And Method To Be Employed


.2 The main approach is to pick up the knowledge of GPS system within the quickest time.
The study will include the GPS application, the GPS signal structure, Geodetic System
GPS signal processing structure and position computation algorithms
.2 This project focuses on the GPS signal scheme that is represented by the spreading
sequences/codes. The codes are Coarse/Acquisition codes and encrypted Precision codes
(P(Y)).
.2 The GPS model will be implemented using MATLAB/SIMULINK. The GPS model is
classified into two sub-models which are GPS transmitter model and single channel GPS
receiver model. Each model consists of different components.
.2 The model implementation shall start with the GPS transmitter module. In the progress
of the project, some experiments have to be performed to decide on the best method for
GPS signal acquisition.
.2 After completing the GPS transmitter implementation, the modelling of single channel
GPS receiver model shall be next. Both modules shall integrate to simulate desired
results.
Page 15 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

.2 There is a flow chart to illustrate the project approach


.2

Understand GPS System Use MATLAB /SIMULINKImplement GPS transmitter

Integration to simulate results Tests and experiments Implement GPS receiver

.2 Figure 2-2 : Flow chart of project approach


.2

2.4 Risk Management


.2 Risk assessment is performed during the planning so that any risks, potential drawbacks,
or unfortunate events could be identified and pre-empt to minimise the probability of
them jeopardizing the timely completion of the project. It is a good practice to anticipate
the possible risks and have the mitigation steps to react when they arise. Some of the
risks identified are as followed:

High in personal commitments such as career and family and resulted in less time
spent for project
Procrastination of actions which will drag and delay the project plan

Loss of data e.g. crashing of hard disk or misplacing of data

.2 Project is a commitment and the result is based on how well the work is produced. A
level of self discipline and self motivation has to be displayed. Allocation of time for the
project is absolutely necessary. Always maintaining a regular check on the Gantt chart
and stick to the time frame can prevent procrastination. To protect the data, it is important
to save them in a protected environment and constantly create additional back up.
Page 16 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

CHAPTER THREE
3. REVIEW OF LITERATURE
.2

3.1 Review of Global Positioning System (GPS) Technology


.2 In the pre-modern history, people used primitive ways to determine positions and helped
them in their navigation. There were several techniques that people used to determine
their location include navigation using stars, using terrestrial marks as reference, judging
the winds for direction and etc. [1] In Greece, the Minoans a of Creteb are an example of
an early Western Civilization that used celestial navigation. Their palaces and
mountaintop sanctuaries exhibit architectural features that align with the rising sun on the
equinoxes as well as setting of particular stars. The Minoans made sea voyages to the
island of Thera and to Egypt and used the locations of particular stars, especially that of
constellation Ursa Majorc to orient the ship in the correct location. All the attempts were
imprecise.
.2 Historical people continued to develop instruments that helped in navigation.[2] The first
compass was made in China during the Qin dynasty (221 AD - 206 BC) and it was first
used for fortune telling. Between 850 and 1050 AD, magnetic compass became common
as navigational devices on ship.

.2
.2

Figure 3-1 : Model of Han Dynasty (206BC 220AD) south-indicating ladle Chinese
compass

.2

.2

.2

The inhabitants of ancient Crete whom we call Minoans, a Bronze Age civilization, flourished from approximately 2700 to 1450 BC

The island of Crete is located in the center of the eastern Mediterranean at the crossroads of Africa, Asia and Europe
[http://www.ancient-greece.org/history/minoan.html]
c
Ursa Major is a constellation visible throughout the year in most of the northern hemisphere. The seven brighest stars of Ursa Major
form the asterism, which is useful pointer toward north.

Page 17 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

.2 [3] With progression to modern times, the sextant was developed around 1757 as the
main instrument for navigation, which measured the elevation angle of a celestial object
above the horizon. It made use of the principle of mirrors by bringing into coincidence
rays of light received directly from one object and by reflection from the other, to
measure the angle between the two objects. In the late 18 th century, Harrison came up
with a timepiece called a chronometer, which was able to measure longitude. In early
World War II, United States developed Long Range Aid to Navigation (LORAN) with a
range of 1,200 miles (1,930 km) to play a crucial role in military research and
development. It was a terrestrial radio navigation system using low frequency radio
transmitter however the hyperbolic approach of LORAN was rather inaccurate due to
high propagation errors.

.2
.2

Figure 3-2 : Sextant Figure 3-3 : Using the sextant to measure the altitude of the
Sun above the horizon

.2 With continuous advance in technology, Navy Navigation Satellite System NAVSAT,


also known as TRANSIT (a system of 6 satellites circling the earth) was the worlds first
operational satellite navigation system conceived in the early 1960s. It made use of the
Doppler Effect to yield the satellites position and velocity.

.2

Figure 3-4 : Operational TRANSIT satellite

Page 18 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

.2 The United States Department of Defence (DOD) designed a satellite-based radio


navigation called Navigation Satellite with Time and Ranging Global Positioning
System (NAVSTAR GPS), which was launched in 1978. It is operated by U.S. Air Force
which provides highly accurate navigation information. It was originally designed to
enable soldiers and military vehicles, planes, and ships in accurately determining their
locations in unknown locations world-wide. However, given the wide array of
application that GPS can use in, United States made this technology available for
commercial and scientific use in the 1980s. The GPS uses the principle of trilateration,
where multiple distance measurements are carried out in order to allow the receiver to
calculate a position.

.2
.2

Figure 3-5 : Determine location using satellite.

.2 [4] Another Global Navigation Satellite System (GNSS) was the GLONASS, deployed
by the Soviet Union, as its own global navigation satellite system. Development of the
GLONASS began in 1976 and Soviet Union successfully launched the experimental tests
in 1982. It also makes use of Frequency Division Multiple Access (FDMA). Unlike GPS,
the technology used for GLONASS, did not involve multiple access schemes.
.2 [5] Beidou Satellite Navigation and Positioning System was developed by China as its
own regional 3D satellite positioning and communication system (CNSS). China
launched the first constellation satellites in 2000. Its purpose is similar to both United
States GPS and Russias GLONASS. However, Beidou uses 2 geostationary satellites
and its navigation system is a 2-way range of 2D navigation, where its ground-based
central control system calculates the 3D positioning for users. For GPS, it is a passive 1way pseudo-range 3D navigation, where the GPS receiver calculates its own 3D position.
Page 19 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

Therefore, the user capacity for Beidou is limited, whereas the user capacity for GPS is
infinite. Nevertheless, China has future plans in developing a second version of Beidou
which known as Compass which consists of 35 satellites. It is an improvement to the
existing satellite system.
.2 The upcoming navigational system is known as Galileo, is currently being built by the
European Union (EU) and European Space Agency (ESA). Galileo is intended to provide
users with more accurate data, to enhance the coverage of high latitude regions and
reduce dependence of the current GPS system. The fully deployed Galileo system
consists of 30 satellites that allow positions to be determined more accurately. With the
satellites situated in orbits at a greater inclination to the equatorial plane, a better
coverage at high latitudes will be attained by Galileo.

3.2 What is GPS?


.2 Global Positioning System also known as GPS uses signals from the satellites in the
space to identify the location of an object on Earth. [6] GPS is a constellation of 24
satellites that orbit around the Earth at about 20,200 km, which makes two complete
rotations a day. The current location, time and velocity can be determined by a GPS
receiver that acquires radio signals transmitted by the satellites. A GPS receiver device
such as the one in Figure 3-6 would be use to read the radio signals.
.2 The receiver converts the signals from the satellites into information such as:

Latitude

Longitude

Speed

Elevation etc
.2
.2

Figure 3-6 : GPS Receiver, Holux - GPSmile 52 Plus Touchscreen..

.2
.2 The device program process the information to do navigation, tracking and tracing.

Page 20 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

3.3 Elements of GPS


.2 The current GPS consists of three major segments. These are the space segment (SS), a
control segment (CS) and user segment (US) as shown in Figure 3-7 and Table 3-1

.2
.2 Figure 3-7 : Elements of GPS.
.2 Segment

.2 Input

.2 Function

.2 Output

.2 Space

.2 Navigation
message

.2
.2
.2
.2

.2 Control

.2 P-Code
Observations,
.2 Time

.2 User

.2 Code
observation,
.2 Carrier phase
observation,

.2 Generate and
transmit code
and carrier phase
and navigation
message
.2 Produce GPS
time,
.2 Predict
ephemeris,
.2 Manage space
vehicles (SVs)
.2 Navigation
solution,
.2 Surveying
solution

P-Code,
C/A Code,
L1, L2 carrier
Navigation
message
.2 Navigation
message

.2 Position,
velocity, time

Page 21 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

.2 Navigation
message
.2 Table [3-1]. Functions of various segment of GPS. [7]&[8]
.2 The space segment comprises of GPS satellites or Space Vehicles (SV) in GPS parlance.
They are powered by solar cells that constantly adjust the solar panels toward the sun and
the antennas toward Earth. The satellite vehicles (SVs) orbit the earth in six 12 hours
(11hrs 58min) orbital planes (four satellites in each plane). They circle the earth twice a
day. The six orbits have approximately 55 inclination (tilt relative to Earths equator)
and are equally spaced, resulting in 60 separation. This constellation ensures that
(barring obstructions) a user located anywhere on the globe has a direct line of sight to at
least four satellites at any time.
.2 Orbiting at an altitude of approximately 20,200 kilometers about 10 satellites are visible
within line of sight.

.2
.2 Figure 3-8 : GPS constellation. [9]

Page 22 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

.2 Since satellites are not in geosynchronous orbits, the geometric relation between the
satellites in view is constantly changing, but predictable, position-estimation accuracy for
positions determined from a fixed set of satellites. The SVs emit coded radio signals that
a GPS receiver will decode to determine important system parameters.
.2 Control segment is responsible for monitoring the health and the status of the space
segment. The control segment consists of a system of tracking stations located around the
world, including six monitor stations, four ground antennas, and a master control station,
as given in Table 3-2. The ground monitoring station measure signals from the SVs that
are transmitted to the master control station. The monitor stations receive data (orbits,
altitude, location, speed) from the satellites and send this data to the master control
station, where it corrects the orbital and clock information known as ephemeris data, and
update the satellites via ground antennas. It also prevents the satellites from drifting away
and ensures that they orbit within limits. These data are relayed to the ground antennas
for transmission to the satellites for broadcast to the user segment.
.2 Table 3-2: Locations of the Components of the Operation Control Segment [10]
.2
.2
.2
.2
.2
.2
.2
.2
.2
.2
.2
.2

Master control station


Springs, CO
Master control station (backup)
Monitor station
Springs, CO
Remote monitor station
Remote monitor station
Remote monitor station
Remote monitor station
Remote monitor station
Ground antenna
Ground antenna
Ground antenna
Ground antenna

Schriever Air Force Base (formerly Falcon AFB), Colorado


Gaithersburg, MD
Schriever Air Force Base (formerly Falcon AFB), Colorado
Cape Canaveral, FL
Hawaii
Ascension Islands
Diego Garcia
Kwajalein
Cape Canaveral, FL
Ascension Islands
Diego Garcia
Kwajalein

.2

Page 23 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

.2
.2 Figure 3-9 : Control segment

Page 24 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

.2 User segment consists of antennas and receiver-processors that measure and decode the
satellite transmissions to provide positioning, velocity, and precise timing information to
the user by computing the four dimensions of X, Y, Z (position) and Time. Since the user
receiver operates passively (i.e. it does not transmit any signals), the GPS space segment
can provide service to an unlimited number of users. Most modern GPS receivers are a
parallel multi channels design, typically to have between five and twelve receiver
circuits.

.2
.2 Figure 3-10 : Different type of modern GPS receivers

.2

Page 25 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

.2 Figure 3-11 : GPS receiver estimates the GPS signal with the lock on four satellites
simultaneously

Page 26 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

3.4 How does GPS work?


.2

[11] GPS satellites circle the earth twice a day in a very precise orbit and broadcast radio
signals (coded information) over to the GPS receivers. The information consists of
ephemeris data, almanac data and a pseudorandom code.

.2
.2 Figure 3-12 : GPS satellites broadcast signals to
.2 Ephemeris data is a set of parameter that has the corrected orbital and clock information
which sent from the master control station to the GPS satellites. This data is useable for a
few hours and is transmitted as coded information to the GPS receiver to provide its
orbital information on the path that the satellite is following as it orbits Earth
.2 Next, almanac data is used to predict which satellites are nearby when the GPS receivers
are looking for GPS signals. This data is continuously transmitted by each satellite
notifying its state (health) of the satellite constellation, coarse data on every satellites
orbit, current date and time to the GPS receivers.
.2 With the ephemeris and almanac data, the GPS receiver computes the position of the
satellites at all times.
.2 Each satellite has its own unique Pseudo-Random code which mixes with the coded
information. Both the satellite and receiver will generate the same code at the same time,
and use it to reconstruct the data. However due to delay in signal propagation, the
satellites signal will lag behind the receivers signal when it reaches the earth. This delay
is the time travel. Therefore, the distance between the GPS receiver and each satellite can
be computed using the following equation:

Page 27 of 273

SIMULINK Modeling of Single Channel GPS Receiver


.2 Distance = Speed x (Travel Time)

(ENG499 JUL2009/ENG/014)

; Speed = speed of light (2.98 x 10 8

(m/s))
.2 The users location can be determined by triangulating the distances from several
satellites to determine the 3-dimensional positioning. This mathematical principle is
known as trilateration.

.2
.2 Figure 3.13: How GPS work [12]

Page 28 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

3.5 Concepts and Principles used in GPS Technology


3.5.1 Trilateration
.2

[13] Trilateration is a method of determining the relative positions of objects using the
geometry of triangle. The position is determined based on triangulation:

.2

knowing each satellite position

knowing difference between distances to each satellite

using good clock on the receiver side

adding some error correction


[14] The satellites are used to be the reference point which can get a very accurate and

precise location on earth. The measurement of distance requires the use of at least 3
satellites to provide a precise location. GPS receiver takes into account four or more
satellites to improve accuracy and provide extra information like altitude of the object.
Here is an illustration:
.2 If the distance of satellite A is known to be about 100 km away from GPS device, the
GPS device could be on surface of a huge imaginary sphere of 100 km radius around
Satellite A.
.2

Satellite A
100KM

Page 29 of 273

SIMULINK Modeling of Single Channel GPS Receiver


.2

(ENG499 JUL2009/ENG/014)

Figure 3-14 : Location tracking with satellite A

.2 GPS device locks on to second satellite with the distance of a satellite B is known to be
about 150 km. The imaginary spheres of 100 km and 150 km around satellites A and B
respectively intersect in a perfect circle.
.2

Intersection
Satellite A
100KM

Satellite B
150KM

Figure 3-15 : Area of intersection with 2 Satellites


.2
.2 If the distance of a third satellite C is known to be about 200 km away from the GPS
device, this would narrow down our location by just two points. The imaginary sphere of
Satellite C cuts through the circle that is the intersection of the first two spheres. Thus,
we can more or less tell our location.

Page 30 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

.2

Intersection
Satellite A

Satellite B

100KM

150KM

Satellite C

200KM

.2 Figure 3-16 : Area of intersection with 3 Satellites


3.5.2 Doppler Shift
.2 [15] The Doppler shift analysis is applied in GPS to determine the speed of the receiver.
A GPS receiver-satellite pair is in the Earths gravity field and GPS signals travel at the
speed of light. The relative displacement of both the motion of the satellite and the
receiver are 2 components of the Doppler Effect to be taken into account, which allows
identification and time management.
.2 GPS satellite orbits the Earth at a high speed (approximately 3.8 km/s), transmitting
electromagnetic wave signals that travel at the speed of light, relatively to a GPS
Page 31 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

receiver, there is an apparent shift in frequency. If the distance between the satellite and
the receiver becomes further, the frequency will decrease. Whereas, the distance between
the satellite and the receiver gets nearer, the frequency will increase. Figure 3-17 depicts
the example of Doppler shift; the whistle of an approaching train has a higher pitch than
normal and the change in pitch can be heard as the train passes.

.2
.2 Figure 3-17 : Principle of Doppler shift [16]

Page 32 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

3.6 Overview of Satellite system


3.6.1 Satellite Orbits
[17] There is only one main force acting on a satellite when it is in orbit, and that is the
gravitational force exerted on the satellite by the Earth. This force is constantly pulling the
satellite towards the centre of the Earth.
There are many different types of orbits used for satellite telecommunications. The orbits are
sometimes described by their inclination - this is the angle between the orbital plane and the
equatorial plane.
3.6.1.1 Geostationary Orbit

Figure 3-18 : Geostationary orbit


The most common orbit used for satellite communications is the geostationary orbit (GEO).
This is the orbit described above the rotational period is equal to that of the Earth. The
orbit has zero inclination so is an equatorial orbit (located directly above the equator) and
has an altitude of around 36,000 km. The satellite and the Earth move together so a GEO
satellite appears as a fixed point in the sky from the Earth.
The advantages of such an orbit are that no tracking is required from the ground station
since the satellite appears at a fixed position in the sky. The satellite can also provide
continuous operation in the area of visibility of the satellite.
3.6.1.2 Low Earth Orbit/Medium Earth Orbit
A low earth orbit (LEO), or medium earth orbit (MEO) describes a satellite which circles
close to the Earth. Generally, LEOs have altitudes of around 300 1000 km with low
inclination angles, and MEOs have altitudes of around 10,000 km. A special type of LEO is
Page 33 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

the Polar Orbit. This is a LEO with a high inclination angle (close to 90degrees). This means
the satellite travels over the poles.

Figure 3-19 : Low Earth Orbit (left) and Polar Orbit (right)
Satellites that observe our planet such as remote sensing and weather satellites often travel in
a highly inclined LEO so they can capture detailed images of the Earths surface due to their
closeness to Earth. A satellite in a Polar orbit will pass over every region of Earth so can
provide global coverage. Also a satellite in such an orbit will sometimes appear overhead
(unlike a GEO which is only overhead to ground stations on the equator). This can enable
communication in urban areas where obstacles such as tall buildings can block the path to a
satellite.
3.6.1.3 Elliptical Orbits

Figure 3-20 : Elliptical Orbit


A satellite in elliptical orbit follows an oval-shaped path. One part of the orbit is closest to the
centre of Earth (perigee) and another part is farthest away (apogee). A satellite in this type of
orbit generally has an inclination angle of 64 degrees and takes about 12 hours to circle the
planet. This type of orbit covers regions of high latitude for a large fraction of its orbital
period.

Page 34 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

3.6.2 NAVSTAR
[18] Navigation Signal Timing and Ranging Global Positioning System (NAVSTAR) is one
of the leading GNSS providers. The 24 current GPS satellites are in the Block II
configuration and were launched between 1989 and 1994.

NAVSTAR GPS
Navigation Signal Timing and Ranging Global Positioning System

CONSTELLATION DESCRIPTION
Number of Satellites

24 Active, 4 Spare

Geometry

6 planes, 4 satellites each

Orbit

MEO - 20,200 km (10,900 nmi) circular, 55 inclination (Block I


satellites orbited at 63 inclination)

Orbit Period

12 hours

Coverage

Global

Initial Operational
Capability (IOC)

1993 December 8

Full Operational
Capability (FOC)

1995 April 27

Managed by:

USAF NAVSTAR GPS Joint Program Office, Space and Missile


Systems Center

Operated by:

USAF 50th Space Wing


Table 3-3 : NAVSTAR GPS general information

3.6.3 GLONASS
The formerly Soviet, and now Russian, GLObal'naya NAvigatsionnaya Sputnikovaya
Sistema(GLObal NAvigation Satellite System), or GLONASS, was a fully functional
navigation constellation but since the collapse of the Soviet Union has fallen into disrepair,

Page 35 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

leading to gaps in coverage and only partial availability. The Russian Federation has pledged
to restore it to full global availability by 2011.

Figure 3-21 : GLONASS system architecture.

GLONASS
Global'naya Navigatsionnaya Sputnikovaya Sistema
Global Navigation Satellite System

CONSTELLATION DESCRIPTION
Number of Satellites

24 Active

Geometry

3 planes, 8 satellites each

Orbit

MEO - 19,100 km (10,313 nmi) circular, 64.8 inclination

Orbit Period

11 hours 15 minutes

Coverage

Global

Page 36 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

Initial Operational
Capability (IOC)

1993 September 24

Full Operational
Capability (FOC)

Operation with restrictions, in the process of restoration and


modernization by 2011

Operated by:

Coordination Scientific Information Center (KNITs)


Table 3-4 : GLONASS general information.[20]

Page 37 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

3.6.4 GALILEO
[21] Galileo is an independent, European, civil satellite navigation system which is being
developed for worldwide use. Galileo is designed to make the European Union (EU)
independent of the USA's GPS (Global Positioning System) and the Russian Federation's
Global Navigation Satellite System (GLONASS). As a joint project of the EU and the
European Space Agency (ESA), Galileo will be compatible and interoperable with GPS, but
will guarantee independent and reliable usability.
The Nederlands Economisch Institut (NEI) has calculated that if GPS were to fail for just 2
days, Europe would suffer a loss of 220 million euros in the transport sector alone.
According to ESA, Galileo will perform better in finding location within 3 feet (1 meter)
compared to 16 feet (five meters) with NAVSTAR GPS. It also offer greater penetration in
urban areas and the coverage will improve in northern Europe and other high latitude areas.
Giove A, first Galileo demonstrator is in orbit, marking the very
first step to full operability of Europes new global navigation
satellite system, under a partnership between ESA and the European
Commission (EC).

Figure 3-22 : Giove A, the first Galileo in-orbit [22]

GALILEO
The European satellite navigation system

CONSTELLATION DESCRIPTION
Number of Satellites

27 Active, 3 active spare

Geometry

3 planes, 9 satellites and 1 spare each

Orbit

MEO 23,222 km circular, 56 inclination

Orbit Period

14 hours 4 minutes

Page 38 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

Coverage

Global

Initial Operational
Capability (IOC)

Under construction. Scheduled in April 2011

Full Operational
Capability (FOC)

Expects in 2014
Table 3-5-1 : Galileo general information[23]

3.6.5 Chinese COMPASS systems


China is setting up a satellite system to challenge U.S GPS. Compass Navigation Satellite
System, or BeiDou 2 is the second generation satellite navigation system capable of
providing continuous, real time passive 3D geo-spatial position and speed measurement.
BEIDOU
Compass Navigation Satellite System CNSS

CONSTELLATION DESCRIPTION
Number of Satellites

35 Active (Beidou 2 or Compass)

Geometry

3 planes, 9 satellites and 1 spare each

Orbit

GEO 21,500 km circular, 56 inclination

Orbit Period

14 hours 4 minutes

Coverage

Area from 70E to 140E, and from 5N to 55N. Long term


goal is to develop global coverage

Initial Operational
Capability (IOC)

Scheduled in April 2011

Full Operational
Capability (FOC)

Under construction. Expects in 2017

Operated by:

Coordination Scientific Information Center (KNITs)

Page 39 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

Table 3-5-2 : Beidou general information.


3.6.5.1 Current technology (Beidou-1)
Unlike the GPS, GLONASS, and Galileo systems, which use medium Earth orbit satellites,
Beidou 1 uses satellites in geostationary orbit. This means that the system does not require a
large constellation of satellites, but it also limits the coverage to areas on Earth where the
satellites are visible. The area that can be serviced is from 70E to 140E, and from 5N to
55N.
3.6.5.2 Future Plans (Beidou-2 or Compass)
The new system will be a constellation of 35 satellites, which include 5 geostationary orbit
(GEO) satellites, for backward compatibility with Beidou-1, and 30 medium Earth orbit
(MEO) satellites, that will offer complete coverage of the globe. There will be two levels of
service provided; free service for those in China, and licensed service for the military.
Three satellites for Beidou 2 have been launched in early 2007, in early 2009 and in early
2010. In the next few years, China plans to continue setting up the system for global
operation from 2017 with 30 satellites. Regional operation within Asia Pacific would be
completed with more than 10 satellites in late 2012.

Page 40 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

3.7 Overview of GPS Signal


3.7.1 GPS Frequency
3.8

GPS signals are transmitted in UHF band. The UHF band covers the frequency band
from 500MHz to 3GHz.

3.9

3.10

3.11

Figure 3-23 : Radio frequency spectrum [24]

All signal components are derived from the output of a highly stable atomic clock.
The clocks generate a pure sine wave at a frequency f 0 = 10.23MHz, with a stability
of the order of 1 part in 1013 over one day. The frequency generated by the clocks is
referred to as the fundamental frequency.

3.12

For the ranging codes and navigation message to travel from the satellite to the
receiver, they must be modulated onto a carrier frequency, f0. Multiplying the
fundamental frequency f0 by integer factors yields the two microwave L-band carrier
waves L1 and L2 respectively (above Figure 3-24). The frequencies of the two waves
are obtained as follows:
3.13

L1 = fL1 = f0 x 154 = 1575.42MHz


3.15
Page 41 of 273

SIMULINK Modeling of Single Channel GPS Receiver


3.17

(ENG499 JUL2009/ENG/014)

L2 = fL2 = f0 x 120 = 1227.60MHz

Page 42 of 273

SIMULINK Modeling of Single Channel GPS Receiver

3.17.1
3.18

(ENG499 JUL2009/ENG/014)

GPS Signal Structure

[25] GPS signals have two bands; L1 band frequency is 1575.42 MHz and L2 band
frequency is 1227.60 MHz. L1 band has Coarse/Acquisition code (C/A), Precision
code (P(Y)) and navigation data. L2 band has only P(Y)-code and navigation data.
Table 3-6 shows the characteristics of GPS signal structure.
3.20

3.19
3.23
3.27
3.31

Frequency
(Chipping rate)
Length per chip
Repetition

3.35

Code type

3.39

Carrier

3.43

Feature

3.24

1.023 MHz
(Mbps)
3.28
293 m
3.32
1 ms
3.36
3.40

3.44

3.47
3.48

Coarse/Acquisitio
n (C/A) code

Gold
L1

Easy to acquire

3.21

P(Y)-code

3.25

10.23 MHz
(Mbps)
29.31m
1 week
Pseudo
random
L1, L2
Precise
positioning,
jam resistant

3.29
3.33
3.37
3.41
3.45

3.22

Navigation
Data

3.26

50 Hz (bps)

3.30
5950 km
3.34
N/A
3.38
3.42
3.46

N/A
L1, L2
Time,
ephemeris,
HOW

Table 3-6 : GPS Satellite signals characteristics

C/A code is a sequence of zeros and ones and is unique for every satellite. The code is
based on Gold Codes. Two sets of gold codes with different phase tappings are used to
generate unique C/A code for every satellite. The C/A code is also called PRN code.
PRN code or number is assigned to each satellite based on which PRN code is
assigned to a particular satellite. If PRN (C/A) code 1 is assigned to a satellite, then
this satellite is named as PRN-1. The properties of C/A codes are that they have the
best cross-correlation characteristic. The cross-correlation between any two codes is
much lower than auto-correlation of each of the codes. The frequency of the C/A code
is 1.023 MHz.

3.49

The P(Y) code is encrypted using encryption code and is called Y-code. P(Y)-code is
also a sequence of zeros and ones and is generated using a set of Gold Codes. P(Y)
code has a frequency of 10.23 MHz.

3.50

Navigation data are also a sequence of zeros and ones based at a rate of 50 bits per
second. The navigation data structure is defined in the interface control document
(ICD) of GPS. The navigation data and C/A code are modulated with the carrier wave
using BPSK (Binary Phase Shift Keying) and DSSS (Direct Sequence Spread

Page 43 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

Spectrum) techniques. DSSS is a type of CDMA hence all the satellites use the same
carrier frequency but different code.
3.51
3.51.1
3.52

Structure of GPS Navigation Data

[26] In addition to the C/A code navigational information is modulated into the L1
signal. The information has a frequency of 50 Hz signal and it contains data like
satellite orbits, clock corrections and other system parameters (information about the
status of the satellites). These data are constantly transmitted by each satellite. The
receiver uses these data to determine its date, the approximate time and the position of
the satellites.

3.53

3.54
3.55
3.56

Figure 3-24 : Navigation data format

With a bit rate of 50 bps and a cycle time of 30 seconds, the total information content
of a navigation data set is 1500 bits. The navigation message consists of 25 data
frames and is subdivided into five subframes of six-second duration comprising 300
bits of information. Each subframe contains the data words of 30 bits each. In
calculation, it will take 30 seconds to receive one data frame and 12.5 minutes to
receive the complete signal. Six of these are control bits. The first two words of each
subframe are the Telemetry Work (TLM) and the C/A-P-Code Hand over Work
Page 44 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

(HOW). TLM contains information about the age of the ephemeris data which
facilitates the access to the navigation data. The next word is the HOW, which
contains GPS system time of transmission. HOW allows the transition between
tracking the C/A code to the P(Y) code.
3.56.1
3.57

Precision (P(Y)) Code

[27] The P(Y) code is also a PRN, however each satellite's P (Y) code PRN code is
6.1871 1012 bits long (6,187,100,000,000 bits) and only repeats once a week (it is
transmitted at 10.23 Mbit/s). The extreme length of the P-code increases its
correlation gain and eliminates any range ambiguity within the Solar System.
However, the code is so long and complex it was believed that a receiver could not
directly acquire and synchronize with this signal alone. It was expected that the
receiver would first lock onto the relatively simple C/A code and then, after obtaining
the current time and approximate position, synchronize with the P-code.

3.58

Whereas the C/A PRNs are unique for each satellite, the P-code PRN is actually a
small segment of a master P-code approximately 2.35 10 14 bits in length
(235,000,000,000,000 bits) and each satellite repeatedly transmits its assigned
segment of the master code.

3.59

To prevent unauthorized users from using or potentially interfering with the military
signal through a process called spoofing, it was decided to encrypt the P-code. To that
end the P-code was modulated with the W-code, a special encryption sequence, to
generate the Y-code. The Y-code is what the satellites have been transmitting since the
anti-spoofing module was set to the "on" state. The encrypted signal is referred to as
the P(Y)-code.

3.60

The details of the W-code are kept secret, but it is known that it is applied to the Pcode at approximately 500 KHz, which is a slower rate than that of the P-code itself
by a factor of approximately 20. This has allowed companies to develop semicodeless approaches for tracking the P(Y) signal, without knowledge of the W-code
itself.

Page 45 of 273

SIMULINK Modeling of Single Channel GPS Receiver

3.60.1
3.61

(ENG499 JUL2009/ENG/014)

GPS Signal Generation

The GPS signal generation is showed in the Figure 3-25 below. The C/A code and
P(Y) code are combined with the navigation data through a modulo-2 adders. The
exclusive OR operation is usded on binary sequences represented by 0s and 1s, and
its properties are showed in Table 3-7.

3.62

90

Table 3-7 :
Output of the exclusive OR Operation

3.63

Figure 3-25 : GPS Satellite signal generation

3.64

The C/A code data and the P(Y) code data signals are supplied to the two
modulators for the L1 frequency. Here the signals are modulated onto the carrier
signal using the binary phase shift keying (BPSK) method. The two codes are
modulated in-phase and quadrature with each other on L1 which is 90 phase shift
between the two codes. These two L1 signals are added to form the resulting L1
signal. The so-called standard positioning service (SPS) is based on C/A code signals
alone.

3.65

It follows that the signal transmitted from satellite k can be described as

3.66
3.67 where
3.68 PC, PPL1, and PPL2 are the powers of signals with C/A or P
code,
3.69 Ck is the C/A code sequence assigned to satellite number k,

Page 46 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

3.70 Pk is the P(Y) code sequence assigned to satellite number k,


3.71 Dk is the navigation data sequence,
3.72 and fL1 and fL2 are the carrier frequencies of L1 and L2,
respectively.

Page 47 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

3.73 Overview of Software-Defined GPS Receivers (SDR)


3.74

[28] GPS receiver is the third component of the GPS system. It can be implemented
using software on a personal computer without investing in new hardware. The
concept of SDR is not new and evolving capabilities of digital electronics are making
practical many processes that were once only theoretically possible. Joseph Mitola
published the first papera on this topic in 1992. The SDR has its origins in the defense
sector since the late 1970s in both U.S. and Europe. The first public software radio
initiative was U.S. military project named SpeakEasy which used for communication.

3.75

First example of software based GPS receiver can be illustrated in the Figure 3-26
below.

3.76
3.77

Figure 3-26 : Architecture of Conventional GPS receiver

3.78
3.79

Figure 3-27 : Architecture of Software-based GPS Receiver

3.80
3.81

[29] The RF front-end and signal processor are all built upon IC chips. The outputs of
the signal processor are displayed to a display unit. There is limited access to change
the parameters or install new algorithms. Figure 3-27 shows architecture of a
software-based GPS receiver (SGR). The hardware component is RF front-end
device, however the rest of the signal processing is done using high level language
like C/C++, MATLAB etc. It gives the highest level of flexibility.

3.82

J Mitola, "The Software Radio," IEEE National Telesystems Conference, 1992 - Digital Object Identifier
10.1109/NTC.1992.267870

Page 48 of 273

SIMULINK Modeling of Single Channel GPS Receiver


3.83

(ENG499 JUL2009/ENG/014)

Second example of software GPS receiver designed and implemented on FPGA plus
DSP partition.

3.84

3.85

Figure 3-28 : FPGA portion of the GPS receiver design using Xilinx system generator
library.

3.86

[30] Designs are increasing complex and often comprise hybrid technologies
including RF, low to high speed signal processing and control. Instead of constructing
Page 49 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

a hardware module of GPS, which might be unclear about achieving the optimal
output. Model based design can use the available toolbox options in MATLAB to
implement a system model. This can verify the success of the performance goals
before implement the model into field-programmable gate arrays (FPGAs) or
application-specific integrated circuits (ASICs).
3.87

Page 50 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

3.88 Overview of CDMA systems


3.88.1
3.89

Access Scheme

[31] For radio systems there are two resources, frequency and time. Division by
frequency, so that each pair of communicators is allocated part of the spectrum for all
of the time, results in Frequency Division Multiple Access (FDMA). Division by
time, so that each pair of communicators is allocated all (or at least a large part) of the
spectrum for part of the time results in Time Division Multiple Access (TDMA). In
Code Division Multiple Access (CDMA), every communicator will be allocated the
entire spectrum all of the time. CDMA uses codes to identify connections.
3.90

3.91
3.91.1
3.92

Figure 3-29 : Multiple Access Schemes

Coding

CDMA uses unique spreading codes to spread the baseband data before transmission.
The signal is transmitted in a channel, which is below noise level. The receiver then
uses a correlator to despread the wanted signal, which is passed through a narrow
bandpass filter. Unwanted signals will not be despread and will not pass through the
filter. Codes take the form of a carefully designed one/zero sequence produced at a
much higher rate than that of the baseband data.
Page 51 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

3.93

3.93.1
3.94

Direct Sequence Spreading Spectrum (DSSS)

In a communication system, DSSS is a spread spectrum technique whereby the


original data is multiplied with a Pseudo Random noise (PN).

3.95

3.96
3.97

Figure 3-30 : Spread Spectrum communication system

The spread spectrum code is a pseudorandom sequence of 1 and -1 values at a


frequency much higher than the original data signal, thereby spreading the energy of
the original signal into a much wider band.

3.98
3.99

Figure 3-31 : Direct Sequence Spread Spectrum [32]

3.100 DSSS improves protection against interfering (or jamming) signals especially
narrowband and makes the signal less noticeable. Multiple users are able to share a
single channel by just using different PN codes.
3.101 In GNSS, U.S. NAVSTAR and European Galileo are using CMDA technology.
Page 52 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

3.102

Page 53 of 273

SIMULINK Modeling of Single Channel GPS Receiver

3.103

GPS Application

3.103.1

Military

3.104

(ENG499 JUL2009/ENG/014)

[33] GPS tracking was developed in the 1970s by the United States Department of
Defense to improve tracking capabilities of its targets. Since then, GPS tracking have
also found other uses. The military applications of GPS span many purposes:

Navigation: GPS allows soldiers to find objectives in the dark or in unfamiliar


territory, and to coordinate the movement of troops and supplies.

Target tracking: Various military weapons systems use GPS to track potential ground
and air targets before they are flagged as hostile. These weapons systems pass GPS
co-ordinates of targets to precision-guided munitions to allow them to engage the
targets accurately.

3.104.1

Personal navigation

3.105 A Personal Navigation Assistant (PNA) also known as Personal Navigation Device or
Portable Navigation Device (PND) is a portable electronic product which combines a
positioning capability (such as GPS) and navigation functions. The personal
navigation market is growing rapidly, with unit sales in Europe and the US surpassing
8 million in 2005 and expected to reach almost 14 million by the end of 2006. Rising
activity in mobile and smartphone solutions is likely to challenge manufacturers of
dedicated navigation devices
3.105.1
3.106

Vehicle tracking systems

[34] One of the biggest technological advancements in vehicle security has been the
advent of the vehicle tracking system. Vehicle tracking systems use satellite or radio
positioning in order to locate a vehicle after it has been stolen. Vehicle tracking
systems are becoming increasingly popular for people who own expensive or
executive cars. If the car is stolen, the vehicle tracking system will send out a signal
that only the police can trace. Vehicles fitted with a satellite Global Positioning
System (GPS) can pinpoint the exact location of the vehicle and send information to
the police. Police departments also have equipment in place to track vehicles with
Page 54 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

GPS systems fitted. Software is used to plot the actual position of the vehicle on
maps.

Page 55 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

3.11 MATLAB/SIMULINK application


3.107
3.108 SIMULINK is an environment for multi-domain simulation and Model-Based Design
for dynamic and embedded systems. It provides an interactive graphical environment
and a customizable set of block libraries that let you design, simulate, implement, and
test a variety of time-varying systems, including communications, controls, signal
processing, video processing, and image processing.
3.109 Add-on products extend SIMULINK to multiple modeling domains, as well as
provide tools for design, implementation, and verification and validation tasks.
3.110 SIMULINK is integrated with MATLAB, providing immediate access to an extensive
range of tools that let you develop algorithms, analyze and visualize simulations,
create batch processing scripts, customize the modeling environment, and define
signal, parameter, and test data.
3.111

3.112

Page 56 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

3.113 Figure 3-32 : SIMULINK interface

Page 57 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

CHAPTER FOUR
4. SYSTEM DEVELOPMENT
4.1 System Overview
3.114

GPS Receiver

GPS Satellite

Acquisition
Tracking
Positioning

C/A code Generation


Precision code Generation
Navigation data Generation

Display

Display results
Plot graphs

3.115 Figure 4-1 : System level diagram for GPS model


3.116 The system level diagram of the GPS model is outlined in Figure 4-1. Looking at the
GPS system level, practically the GPS is in hardware nature and the signal processing
functions are in embedded processors. The system is not transparent and inflexible to
the users. The functions of the GPS can be replicated in the MATLAB/SIMULINK
which allows users to change the parameters and values.
3.117 Software modelling is as if strip-open of the hardware which let users to examine and
understand the system portion by portion. The key components in the hardware shall
be emulated into MATLAB/SIMULINK block functions.
Page 58 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

3.118 Basically, GPS satellite (transmitter) and GPS receiver are the two main systems
which will be modelled in SIMULINK. The transmitter model should perform the
basic function of signal and codes generation. Demodulation and decoding will be the
essential criterion that a single channel receiver should carry out. As a functional GPS
receiver, the SIMULINK model should have the acquisition for visible signals, code
and carrier tracking and navigation computing

4.2 System Architecture


4.2.1 Simple Transmitter Simulator Architecture
3.119 The GPS signal generation at the satellites are showed in the figure [] below.

3.120
3.121 Figure 4-2 . Generation of GPS signals at the satellites
3.122 Understanding the GPS signal generation from above figure, all GPS properties can
be modelled in SIMULINK. In this project, only L1 band GPS signal is discussed. As
C/A code is not modulated onto L2 carrier, L2 band signal is not necessary to
implement onto the transmitter model. The structure of P(Y) code is rather complex
and secret to civil user and furthermore it is not relevant to the acquisition and
tracking algorithms, as the result of that, this component is simplified in the
simulation.

Page 59 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

3.123
3.124 Figure 4-3: Generation of L1 band GPS signal
3.125 The L1 GPS signal simulator should emulate GPS signal properties which similar to
GPS environment. For each satellite, it should be possible to define the details listed
below
3.126 Satel
lite
signa
l
3.128 Additional details to define in GPS signal simulator
3.127 prop
ertie
s
3.129 PRN 3.130 The pseudorandom noise number corresponding to the satellite. This
number indicates which of the C/A codes should be used.
3.131 Dop 3.132 The Doppler count is the frequency deviation from the IF. The Doppler
pler
count is directly associated with line-of-sight dynamics between the
satellite and the receiver.
3.133 Code 3.134 The code phase is the time alignment of the PRN code in the received
Phas
data.
e
3.135 P(Y) 3.136 In addition to the C/A code, the L1 signal contains the P(Y) code. This
Code
code is modulated onto the carrier wave as a quadrature component
while the C/A code is present in the in-phase component.
3.137 Data 3.138 The navigation data bits are phase-modulated onto the carrier wave
Bits
with a frequency of 50Hz.
3.139 Sign 3.140 Due to the long signal path from the satellite to the receiver in
al
combination with a low power transmitter at the satellite, the received
Stren
signal is very weak. An additional property of the GPS signal is the
gth
signal-to-noise ratio (SNR), the ratio between the signal and the noise
originating from the signal path.
3.141 Table 3-8 : Some definitions inside a GPS signal simulator. [35]
Page 60 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

3.142

Page 61 of 273

SIMULINK Modeling of Single Channel GPS Receiver

4.3

(ENG499 JUL2009/ENG/014)

Simple Receiver Simulator Architecture

3.143 The basic concept of a receiver is showed in Fig 4-4.


3.144

3.145 Figure 4-4: Block diagram of the receiver


3.146 Receiv
er
blocks
3.147 propert
ies
3.149 Filter

3.148 Additional details to define in GNSS receiver


3.150 The filters are used to extract the desired frequency band from the
input while rejecting the reminder.
3.152 The LNA is placed to amplify the signal while adding a minimum of
noise.

3.151 Low
Noise
Amplif
ier
(LNA)
3.153 Mixers 3.154 The mixer is used for frequency conversion of information. The LO
/ Local
uses the voltage controlled to serve as a sampling clock for
oscillat
conversion. The combination of mixer & LO can convert the
or
frequency to the desired Intermediate Frequency (IF) (usually lower
(LO)
frequency for signal processing).
Page 62 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

3.155 Freque 3.156 A frequency synthesize is basically a Phase Locked Loop (PLL)
ncy
with a fixed reference frequency at the input and frequency division
Synthe
in the feedback so that it can use to generate channel frequencies
sizer
with a certain spacing.
3.157 Demod 3.158 The demodulator correlates the input RF signal with the In-phase
ulator
and Quadrature.
3.159 Analog 3.161 After the I/Q demodulator and baseband filter/amplifier, signal is
to
converted to digital domain.
3.160 Digital
Conver
ter
(ADC)
3.162 Table 3-9 : Some of the receiver blocks properties inside a GNSS receiver. [36]

Page 63 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

3.163 The fully functional GNSS L1 front end is depicted in Figure 4-4. This
figure establishes the concept of implementing the receiver in
SIMULINK. The real GPS signal was taken from SE4110 ASIC-based
front end which shows in Figure 4-5. The SE4110 is highly integrated
GPS receiver offering high performance and low power operation.
The

parameters

of

the

receiver

components

(e.g.

sampling

frequency, IF) can be emulated from GNSS L1 front end.


3.164

3.165 Figure 4-5 : GNSS L1 front end component

Page 64 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

3.166
3.167 Figure 4-5 : The functional block diagram of the SE4100 ASIC-based
front end. [35]

Page 65 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

CHAPTER FIVE
5 SYSTEM DESIGN CONSIDERATIONS
5.1 GPS Transmitter
3.168 Figure 5-1 shows the complete GPS signal simulator for one satellite implementation.
3.169
3.170
3.171
3.172
3.173
3.174
3.175
3.176
3.177
3.178 Figure 5-1 : GPS transmitter model in SIMULINK
3.179 There is twolevel design for the Transmitter model. The lower level is the
implementation of each satellite where the signal originating from each satellite is
generated. The signals should include the following four components:
-

C/A code
Navigation data
P(Y) code
Noise

3.180 The upper level is where each satellite contributing to the resulting signal is
initialized. The individual initialization data should be saved in a file:
-

32 possible PRN codes with all possible shifted versions. Refer to Table 5-11
Navigation data. Refer to Table

Page 66 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

5.2 Coarse/Acquisition (C/A) code


5.2.1 Overview
5.3

The C/A codes are often referred to as Gold codes named after Robert Gold and also
referred to as Pseudo-Random noise sequence, or simply PRN sequences.

5.3.1 Pseudo Random Noise (PRN) Sequence


5.4

The pseudorandom noise (PN) sequence are a series of 1s and 0s which lack of any
definite pattern and consists of a deterministic sequence of pulse that will repeat after
its period. The heart of PN sequence generator is usually made up of linear feedback
shift registers (LFSR). Each C/A code is generated using a tapped LFSR and it
generates a maximal-length sequence of length N = 2n 1 elements.

5.5

The figure 5-2 below the maximal sequence consists of every possible state except the
0000 state. The XOR gate provides the feedback to the register that shifts bits from
left to right.

5.6
5.7

Figure 5-2 : A 4 bit LFSR with its state diagram. [


5.8

Page 67 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

5.8.1 Gold Sequence


5.9

The generation of Gold codes using two preferred m-sequence generators of degree n,
with a fixed non-zero seed in the first generator,

2n Gold codes are obtained by

changing the seed of the second generator from 0 to 2n1 . Another Gold sequence
can obtained by setting all zero to the first generator, which is the second m-sequence
itself. In total, 2n +1 Gold codes are available.
5.10

In SIMULINK, the Gold Sequence Generator can be created by using two PN


Sequence Generator blocks to generate the preferred pair of sequences, and then
XORs these sequences to produce the output sequence, as shown in the Figure 5-3.

5.11

5.12
5.13

Figure 5-3: Gold Sequence Generator

On such instance of using PN Sequence Generator to create Gold code, it does not
have the flexibility to generate different codes for GPS satellite when the output of G2
isnt phase selected. Create various Gold code is made possible by using creating msequence example below which is taken from MATLAB help template.

5.14

Page 68 of 273

SIMULINK Modeling of Single Channel GPS Receiver


5.15
5.15.1
5.16

(ENG499 JUL2009/ENG/014)

Figure 5-4 : Example of the operation of the PN Sequence generator


C/A Code Generator

Taking the example of Gold code generation, the C/A code generator can be modelled
as shown in the figure. It produces a different 1023 chip sequence for each phase tap
(selector) setting. G1 shift register=f ( x ) =1+ x3 + x 10
G1 and G2 Initial State = all ones

Tap 3 & 8 = PRN 31

5.17

5.18
5.19

G2 shift register=f ( x ) =1+ x + x + x + x + x + x

10

Figure 5-5 : GPS C/A code generator.

The gold code generator contains two shift registers known as G1 and G2. These shift
registers have 10 cells generating sequence of length 1023. The two resulting 1023
chirping long sequences are modulo-2 added to generate a 1023 chip long C/A code.
It works only if the polynomial is able to generate code of maximum length.

5.20

Every 1023rd period, the shift registers are reset with all ones, making the code start
over.

5.21

The G1 register always has a feedback configuration with the polynomial


3

f ( x )=1+ x + x

10

, meaning that the state 3 and state 10 are fed back to the input. In

the same way, G2 register has the polynomial f ( x )=1+ x 2+ x3 + x 6 +x 8 + x 9+ x10 .

Page 69 of 273

SIMULINK Modeling of Single Channel GPS Receiver


5.22

(ENG499 JUL2009/ENG/014)

To make different C/A codes for the satellites, the output of the 2 shift registers are
combined in a very special manner. The G1 register always supplies it output, but the
G2 register supplies two of its states to a modulo-2 adder to generate its output. The
selection of states for the modulo2- adder is called the phase selection.

Page 70 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

5.2.5 C/A Code Generation


Pre Initialization stage
All 32 PRN C/A code sequence are generated and save into a file for initialization. The
precomputed file can be used to load onto the Lookup table. The C/A code generator uses
binary value 0 and 1, however in signal processing algorithms, it is more convenient to
present the codes with a polar no-return-to-zero (NRZ) representation. C/A code repeats itself
every 1 ms.

Binary Bit
0

NRZ Bit
-1

Binary Bit

NRZ Bit

Figure 5-7 : NRZ representation


After Initialization stage
All C/A codes are saved to a saved workspace where it can be retrieved when each satellite
model points to its PRN number. For example, Satellite #1 will use PRN #1 C/A code. The
flow chart is the process of generating one complete 1023 chips C/A code generation.
Part A

Part B

Page 71 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

Up counter
From x a to x a +1023
(code
delay)
Code
Phase
Delay
Lookup Table
For C/A code

No
Yes

No

1.023 MHz

Frequency of
chipping rate

Up counter
From 0 to 1022
(no code delay)

Yes
PRN sequence successfully generated at code delayed (1023 chips)
Lookup Table
For C/A code

Reach 1022 ?

Table contains
Precomputed
C/A codes

One PRN sequence successfully generated


(1023 chips)
Reach 1022 ?

Figure 5-8 : Flow chart of obtaining one complete C/A code


x a = code phase delay

Page 72 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

Figure 5-9 : C/A code generation


In the satellite model, the C/A code generation must have three component parameters which
is stated in the Table
C/A Code
Parameters
Frequency
oscillator
Counter

Remarks
-

1.023 MHz (digital pulse)

Part A non code phase delay


- Count from 0 to 1022, referring to the 1023 chips in one C/A code
- Counter increases its value on a pulse falling edge
- Output is reset to its initial zero after 1022 counts (non code phase delay)
Part B code phase delay
- Count from x a to x a +1023, referring to the 1023 chips in one C/A code
- Counter increases its value on a pulse falling edge
- Output is reset to its x a after 1022 counts (code phase delay)

- Supply the output to lookup table


- Two dimensional array
- First dimension indicates 32 PRN codes
- Second Dimension indicates the 1023 chips
Table 5-10 : Parameter for generating C/A Code
Lookup
Table

Page 73 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

5.2.6 C/A Code Phase Assignment


The selection of different states for the code phase generates the different C/A codes for the
GPS satellites. There are 37 PRN C/A codes and the first 32 codes are assigned to satellites
while code 33 to code 37 are reserved for other uses, including ground transmitter.

Table 5-11 : C/A code phase assignment.


Page 74 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

5.3 Navigation Data


5.3.1 Overview
In this project, real navigation data are not used in the simulation, the default navigation data
signal is simulated as a digital signal alternating between 1 and 1. The navigation data are
transmitted on the L1 frequency with bit rate of 50 bps and mixed together with the C/A code
and P(Y) code.
5.3.2 Navigation Data Generation
Pre Initialization stage
The navigation data are also precomputed and saved into a file for initialization. The
precomputed file can be used to load onto the Lookup table. The binary values 0 and 1 are
also represented in NRZ representation. The data is designed to be pseudorandom for its
correlation properties.
Binary Bit
0

NRZ Bit
1

Binary Bit

NRZ Bit

Figure 5-10: NRZ representation


The basic format of the navigation data is a 1500 bit long frame containing 5 subframes, each
having length 300 bits. For this project, the simulation only requires simple data generation
and navigation message does not compute positioning. Therefore navigation message can
keep within a frame of consistent and manageable value to manipulate. The generation can
build with PN sequence which allows 1,500 bits of deterministic pattern. PN Sequence
Generator has a linear feedback shift register (LFSR) and base on the default parameters to
create the pseudorandom sequence. The sample time determines the number of bits and it is
set to 1499 in turn generates 1500 bits (0 to 1499).

Figure 5-11 : PN Sequence Generator block


Page 75 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

After Initialization stage


Navigation data saved to a saved workspace where it can be loaded on the Lookup table in
each satellite model.

1 KHz

Up counter #1
From 0 to 20

Up counter #2
Fom 0 to 1500

Period = 1 ms Bit rate = 50 Hz (20 ms)


From C/A code period

Lookup Table
For Navigation data

Navigation frame
Table contains
size = 1500
Precomputed Navigation data

Figure

Page 76 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

Part A

Part B

Navigation delay

No

Reach
20 ?
No

Yes
Up counter
From x a to x a +1499
(navigation delay)

Page 77 of 273

Reach 1499 ?

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

Yes

Figure 5-12 : Flow chart of obtaining one complete Navigation data


Up counter
From 0 to 20

x a = navigation phase delay

One period of successfully generated navigation data


Frame (1500 bits)

Lookup Table
For Navigation data

1 ms
Complete cycle of a PRN code
No

Reach
20 ?
No

Up counter
From 0 to 20
Yes

Up counter
Figure 5-13 : Navigation
data generation
From 0 to 1499
(no navigation delay)

In another part of the satellite model, the navigation data generation must have three
component parameters which is stated in the Table
Navigation
Data
Parameters
Frequency
Counter #1
(Navigation
Period)

Counter #2
(Navigation
Message)

Lookup
Table

Remarks
Yes

- 1.023 KHz (output from C/A counter)


Reach 1499 ?
- Count from 0 to 20, referring to the 50 Hz
- Counter increases its value on a pulse falling edge
- Output is reset to its initial zero when it reaches 20
Part A non navigation phase delay
Table contains
- (non navigation
delay)
One period
of successfully generated Lookup
navigation
data
Table
Precomputed
Part B navigation phase delay
Frame (1500 bits)
For Navigation data
Navigation bit
- Count from x a to x a +1499, referring to the 1500 frame size
- Counter increases its value on a pulse falling edge
- Output is reset to its x a after 1499 counts (navigation phase delay)
-

Supply the output to lookup table


Load Navigation bits from precomputed file
Table 5-12 : Parameter for generating Navigation data

Page 78 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

Page 79 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

5.4 Precision (P/Y) code


5.4.1 Overview
5.5

Similarly to navigation data, P(Y) code is simulated as a digital signal alternating


between 1 and 1. The frequency of the chip rate is 10.23 MHz

5.5.1 Precision code Generation


5.6

The P(Y) code generation has the same principles as the C/A code, except that 4 shift
registers with 12 cells are used. However in system architecture, it was mentioned that
the P(Y) code can be implemented as squared pulse. A simulated P(Y) code is sufficient
to apply in the GPS satellites.

5.7

The simple P(Y) code is created by clock pulses. In order to have a NRZ representation,
P(Y) code is required to simulate as alternating between 1 and 1. The period is 10.23
million chips per second.
5.8

Period = 10.23 MHz

5.9

Figure 5-14: Clock to generate P(Y) code

5.10 The clock block should output 1 for the first half of the specified sample period and 1
for the other half of the sample period. The Unit Delay block delays the input by the
P(Y) code period and initial condition should set as 1 to achieve NRZ.

5.11
5.12 Figure 5-15 : Sub system of the clock

Page 80 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

5.13

5.14
5.14.1

Modulation
Overview

5.15 L1 band GPS signal is transmitted at 1575 MHz and in a RF front end device, it is
usually down converted from high frequency to a much lower frequency for processing.
The reason for this is to bring the frequency to usable ranges in which to perform the
analog to digital conversion (ADC).

The lower frequency is called Intermediate

Frequency (IF).
5.16 In circuitry level, active devices such as transistors cannot deliver much gain without
becoming unstable. In order to minimise the poor signal processing at high frequency
(usually GHz), using a lower frequency translation is becoming necessary. The key
reason for using IF is to improve frequency selectivity. There is always a difficult task
to filter the wanted signal/(s). Filter has better selectivity at lower frequency when
bandwidth is narrower. The task to separate out of extract the wanted signal/(s) is easier
at lower IF. The down conversion is achieved by using a local oscillator.
5.16.1

Mixer/Local Oscillator Implementation

5.17 The local oscillator is implemented with Discrete Time Voltage Controlled Oscillator
(VCO). VCO produces a periodic signal, the frequency of which changes based on an
input. Base on the down conversion, we use IF = 9.548 MHz at the quiescent frequency.

5.18
5.19 Figure 5-16 : SIMULINK block for mixer/local oscillator
Page 81 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

5.20
5.20.1

BPSK Modulation

5.21 The local oscillator is implemented with Discrete Time Voltage Controlled Oscillator
(VCO). VCO produces a periodic signal, the frequency of which changes based on an
input. Base on the down conversion, we use IF = 9.548 MHz at the quiescent frequency.
5.22

Data bits
PRN code
Data bits * PNR code
Carrier
Carrier after BPSK

5.23 Figure 5-17 : The effect of BPSK modulation of the L1 carrier wave with the C/A code
and the navigation data

5.24

Correlation Properties

5.25 C/A codes have two important properties which are described below.

Nearly no cross correlation. All the C/A codes are nearly uncorrelated with each
other. The codes Ci and Ck for satellite I and k, the cross correlation can be written as
1022

5.26

r ik ( m )= Ci ( l ) C k (l+m ) 0 f all m .
l=0

5.27

Nearly no correlation except for zero lag. All the C/A codes are nearly uncorrelated
with themselves, except for zero lag. This property makes it easy to find out when two
Page 82 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

similar codes are perfectly aligned. The autocorrelation property for satellite k can be
written as
1022

r kk ( m )= C k ( l ) C k (l+m ) 0 f all m 1.
l=0

5.28

Page 83 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

5.29 Combining the signal components in GPS Transmitter


5.30 The signal component combines:
-

C/A code is combined with the Navigation data (Part I)


P(Y) code is combined with the Navigation data (Part II)
Part I is modulated onto a carrier using BPSK modulation
Part II is modulated on a 90 phase shift carrier using BPSK modulation

5.31

BPSK

Part

Combining signal
components

Part

90 phase shift
BPSK

5.32 Figure 5-18 : Combining all the transmitter components.


5.33 Part I
5.34 The C/A code is multiplied with the navigation data. In the earlier section on both
signals, they are generated in binary data sequence consisting of 1s and 1s. After

Page 84 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

multiplication, the signal is modulated onto a carrier generated by cosine wave in a


voltage-controlled oscillator (VCO).
5.35 Part II
5.36 Similarly, navigation data is also multiplied with the P(Y) code. The multiplied signal is
modulated onto another carrier generated by sine wave in the second voltage-controlled
oscillator (VCO).

Page 85 of 273

SIMULINK Modeling of Single Channel GPS Receiver

5.37

(ENG499 JUL2009/ENG/014)

GPS Receiver

5.38 The GPS receiver implementation is showed by the block diagram below.
*optional

5.39
5.40 Figure 5-19 : One receiver channel
5.41 There are two different parts for a receiver to achieve in the scope of the objective.
-

Acquisition
Demodulation (Tracking)

5.42 Basically, the receiver has to be able to acquire the signal from the transmitter. The
identifying of visible satellite is done at the acquisition part. The tracking part is split to
two parts which consist of code tracking and carrier tracking. These two tracking
components are able to demodulate the transmitted signal.

5.43

Data Acquisition

5.44 The rough estimation process of code phase and Doppler frequency is called
acquisition. Basically, for acquisition, C/A code and carrier wave are generated for the
satellite. The receiver generated signal is then correlated with incoming signal and the
correlation value is evaluated to make decision whether a satellite visible.
5.45 There are three types of data acquisition:
i)
ii)
iii)

Serial Search Acquisition


Parallel Frequency Space Search Acquisition
Parallel Code Phase Search Acquisition

5.46 The three methods are to discuss in term of the implementation and their performance.
One of the methods will be chosen for the acquisition design.
5.47

Page 86 of 273

SIMULINK Modeling of Single Channel GPS Receiver


5.47.1

(ENG499 JUL2009/ENG/014)

Serial Search Acquisition


5.48

5.49 Figure 5-20 : Block diagram of the serial search algorithm


5.50 [book]Serial search acquisition is an often used method for acquisition in CDMA
systems. As seen in Figure 5-20 , the algorithm is based multiplication of locally
generated PRN code sequences and locally generated carrier signals. The PRN
generator generates a C/A codes corresponding to a specific satellite. After
multiplication with the PRN sequence, the signal is multiplied by a locally generated
carrier signal. Multiplication with the locally generated carrier signal generates the
inphase signal I, and multiplication with a 90 phase-shifted of the locally generated
carrier signal generates the quadrature signal Q.
5.51 The I and Q signals are integrated over the period of one C/A code, and finally squared
and added. Ideally, the signal power should be located in the I part of the signal, as the
C/A code is only modulated onto that. However, in this case the I signal generated at
the satellite does not necessarily correspond to the demodulated I . This is because the
phase of the received signal is unknown. So to be certain that the signal is detected, it is
necessary to investigate both the I and the Q signal. The output is a value of correlation
between the incoming signal and the locally generated signal. If a predefined threshold
Page 87 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

is exceeded, the frequency and code phase parameters are correct, and the parameters
can be passed on to the tracking algorithms.
5.52 The output is visible with a peak when the parameters are correct and the output is not
present when the parameters are not matched. The Figure 5-21 shows these output.
5.53

5.54 Figure 5-21 : Output from serial search acquisition


5.55 (a) PRN 19 is not visible so no peak is present. (b) PRN 21 is visible so a significant
peak is present. The peak occurs at C/A code phase = 359 chips and frequency 9.5475
MH
5.56
5.57
5.58 The serial search algorithm performs two different sweeps: a frequency sweep over all
possible carrier frequencies of IF 10 kHz in steps of 500 Hz and a code phase sweep
over all 1023 different code phases.
5.59 In total, this sum up to a total of

5.60
Page 88 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

5.61 The combinations are considerably large number which the search routines tend to be
the main weakness.
5.61.1

Parallel Frequency Space Search Acquisition

5.62
5.63 Figure 5-22 : Block diagram of the parallel frequency space search algorithm
5.64
5.65 [35] As the name parallel frequency space search acquisition implies, this second
method of acquisition parallelizes the search for the one parameter. This method utilizes
the Fourier transform to perform a transformation from the time domain into the
frequency domain.
5.66 The incoming signal is multiplied by a locally generated PRN sequence, with a code
corresponding to a specific satellite and a code phase between 0 and 1022 chips. The
resulting signal is transformed into the frequency domain by a Fourier transform.
5.67 The result of multiplying the incoming signal with a perfectly aligned locally generated
PRN sequence. The result is a continuous wave signal. Of course, this only happens
when the locally generated PRN code is perfectly aligned with the code in the incoming
signal. If the incoming signal contains signal components from other satellites, these
components will be minimized as a result of the cross-correlation properties of the PRN
sequences.
5.68
5.69 With a perfectly aligned PRN code, the output of the Fourier transform will show a
distinct peak in magnitude. The peak will be located at the frequency index
corresponding to the frequency of the continuous-wave signal and thereby the
frequency of the carrier wave signal.

Page 89 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

5.70
5.71 Figure 5-23 : PSD plot of the incoming signal multiplied by a locally generated PRN
code sequence.
5.72
5.73 (a) When multiplying with a perfectly aligned PRN code, the output will show a peak at
the carrier frequency. (b) When multiplying with a nonaligned code, the output will not
show any peaks. The IF is 9.548 MHz.
5.73.1

Parallel Code Phase Search Acquisition

5.74
5.75 Figure 5-24 : Block diagram of the parallel code phase search algorithm.
5.76 The goal of the parallel code phase search acquisition is to perform a correlation with
the incoming signal and a PRN code. Instead of multiplying the input signal with a
PRN code with 1023 different code phases as done in the serial search acquisition
method, it is more convenient to make a circular cross correlation between the input and
the PRN code without shifted code phase.

Page 90 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

5.77 Parallel code phase search acquisition utilizes the advantage of parallelizing the quicker
code phase to do the search. The goal of the acquisition is to perform a correlation with
the incoming signal and a PRN code. Instead of multiplying the input signal with a
PRN code with 1023 different code phases as done in the serial search acquisition
method, it is more convenient to make a circular cross correlation between the input and
the PRN code without shifted code phase.
5.78 When the frequency domain representation of the cross correlation is found, the timedomain representation can be found through inverse Fourier transform. The incoming
signal is multiplied by a locally generated carrier signal. Multiplication with the signal
generates the I signal, and multiplication with a 90 phase-shifted version of the signal
generates the Q signal. The I and Q signals are combined to form a complex input
signal x(n) = I (n) + j Q(n) to the DFT function.
5.79 The generated PRN code is transformed into the frequency domain and the result is
complex conjugated.
5.80 The Fourier transform of the input is multiplied with the Fourier transform of the PRN
code. The result of the multiplication is transformed into the time domain by an inverse
Fourier transform. The absolute value of the output of the inverse Fourier transform
represents the correlation between the input and the PRN code. If a peak is present in
the correlation, the index of this peak marks the PRN code phase of the incoming
signal.

5.81
5.82 Figure 5-25 : Output from parallel code phase search acquisition.
5.83 (a) PRN 19 is not visible so no peak is present. (b) PNR 21 is visible so a significant
peak is present. The peak code phase 13404 samples and frequency 9.5475 MHz.
5.84
Page 91 of 273

SIMULINK Modeling of Single Channel GPS Receiver


5.84.1

(ENG499 JUL2009/ENG/014)

The Selection of Acquisition Search

5.85 The choice of implementing the data acquisition search will depend on their criteria.
The considerations are:
-

The effect of navigation data bit transitions


The probability of making a successful acquisition
The computation demands as a function of the length of data to be analyzed.

5.86 The three considerations will determine the speed and accuracy of the acquisition. With
the requirement of fast processing speed, Parallel Code Phase Search is chosen

5.87
5.88 Table 5-13 : Execution time for three different acquisition search

5.89
5.89.1

Demodulation
Overview

5.90 Once, acquisition is successfully determined, the satellites are visible at that time. In the
next step, the visible satellites are continuously for fine tuning of the code phase and
Doppler frequency. The tracking process removes the C/A code and carrier wave from
the GPS signal and hence the remaining signal represents navigation data and some
noise.

5.91
5.92 Figure 5-26 : Demodulation scheme to demodulate the navigation message.
5.93 There are some equations to describe how the demodulation scheme is conducted.
5.94 The total signal is given as

Page 92 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

5.95

5.96
5.97
5.98

f L1 f L2 -- carrier frequencies of L1 and L2.


Pc , , P PL1 , PPL 2 -- power signals with C/A or P code
C k (t) C/A code sequence ,
Pk (t) P(Y) code sequence,
Navigation data sequence

Dk (t)

5.99
5.100The output from the front end including filtering and down conversion can be described
as
5.101
5.102where IF

is the intermediate frequency

5.103This signal is then sampled by the A/D converter. Because of the narrow bandpass filter
around the C/A code, the P code is distorted. In this way the last term in Equation (7.2)
is filtered out and cannot be demodulated and is in the following described as noise
e(n). The signal from satellite k after the A/D conversion can be described as
5.104
5.105with n in units of 1/fs ; n indicates that the signal is discrete in time.

Page 93 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

5.106To obtain the navigation data Dk (n) from the above signal, the signal has to be
converted down to baseband. The carrier removal is done by multiplying the input
signal with a replica of the carrier as shown in Figure 5-26. If the carrier replica is
identical to the incoming carrier in both frequency and phase, the product of both is

5.107
5.108where the first term is the navigation message multiplied with the PRN code and the
second term is a carrier with the double intermediate frequency. The latter part of the
signal can be removed by applying a lowpass filter. The signal after the lowpass filter is
5.109
5.110The next step is to remove the code Ck (n) from the signal. This is done by correlating
the signal with a local code replica. If the code replica is exactly the same as the code in
the signal, the output of the correlation is

5.111
5.112where N Dk (n) is the navigation message multiplied by the amount of points in the
signal N.
5.113The above description of the demodulation is only for a signal with one satellite. This
gives a simpler idea of the demodulation scheme. In the demodulation scheme, two
local signal replicas are required. To produce the exact replica some kind of feedback is
required. The feedback loop to the carrier replica is referred to as the carrier tracking
loop and the feeback loop to produce the exact code replica is referred to as the code
tracking loop.
5.113.1

Carrier Tracking

5.113.1.1 Overview
5.114Costas loop is a phase-locked loop (PLL) used for carrier phase receiver from the
suppressed-carrier modulation signals. The second order PLL system contains a first
order filter and a voltage controlled oscillator (VCO). The damping ratio and noise
bandwidth are crucial factors for the implementation.
Page 94 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

5.114.1.1 Demodulation of carrier


5.115To demodulate the navigation data successfully, an exact carrier wave replica has to be
generated. To track a carrier wave signal, phase lock loops (PLL) or frequency lock
loops (FLL) are often used.

5.116
5.117Figure 5-27 : Basic GPS receiver carrier tracking loop block diagram
5.118The two first multiplications wipe off the carrier and the PRN code of the input signal.
The loop discriminator block is used to find the phase error on the local carrier wave
replica. The output of the discriminator, which is the phase error, is then filtered and
used as a feedback to the numerically controlled oscillator (NCO), which adjusts the
frequency of the local carrier wave. In this way the local carrier wave could be an
almost precise replica of the input signal carrier wave.
5.119On the point to note, ordinary PLL is sensitive to 180 phase shift. Due to navigation bit
transitions, a PLL used in a GPS receiver has to be insensitive to 180 phase shifts.
Costas loop has the property of this insensitive to phase shift. Figure 5-28 shows the
Costas loop.

5.120
Page 95 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

5.121Figure 5-28 : Costas loop used to track the carrier wave

Page 96 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

5.122The first multiplication is the product between the input signal and the local carrier
wave and the second multiplication is between a 90 phase-shifted carrier wave and the
input signal. The aim of the Costas loop is to try to keep all energy in the I (in-phase)
arm. In order to do this, some kind of feedback to the oscillator is needed. If it is
assumed that the code replica in Figure 5-28 is perfectly aligned, the multiplication in
the I arm yields the following sum:
5.123
5.124

5.125where

is the phase difference between the phase of the input signal and the phase

of the local replica of the carrier phase.


5.126The multiplication in the quadrature arm gives the following:
5.127
5.128
5.129
5.130If the two signals are lowpass filtered after the multiplication, the two terms with the
double intermediate frequency are eliminated and the following two signals remain:
5.131

5.132
5.133
5.134To find a term to feed back to the carrier phase oscillator, it can be seen that the phase
error of the local carrier phase replica can be found as
5.135

5.136
5.137
Page 97 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

5.138The phase error is minimized when the correlation in the quadrature-phase arm is zero
and the correlation value in the in-phase arm is maximum.
5.139

Page 98 of 273

SIMULINK Modeling of Single Channel GPS Receiver

5.139.1

(ENG499 JUL2009/ENG/014)

Code Tracking

5.139.1.1 Overview
5.140Delay lock loop (DLL) is used for keeping track of the code phase of a specific code in
the signal. The output of the loop is a perfectly aligned replica of the code. The DLL is
correlated to the input signal with three replicas of the PRN code.
5.140.1.1 Demodulation of code
5.141

5.142Figure 5-29 : Basic code tracking loop block diagram


5.143The incoming signal is multiplied by the perfectly aligned local replica of the carrier
wave. Afterwards the signal is multiplied with three code code replicas. The three
replicas are nominally generated with a spacing of

1
2

chip. After this second

multiplication, the three outputs are integrated and dumped. The output of these
integrations is a numerical value indicating how much the specific code replica
correlates with the code in the incoming signal.

Page 99 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

5.144The three correlation outputs IE , IP, and IL are then compared to see which one provides
the highest correlation. The Figure 5-30 illustrates an example of code tracking. The
DLL with three correlators is optimal when the local carrier wave is locked in phase
and frequency.
5.145

Page 100 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

5.146
5.147Figure 5-30 : Code tracking Three local codes are generated and correlated with the
incoming signal.
5.148(a) The late replica has the highest correlation so the code phase must be decreased, i.e.,
the code sequence must be delayed. (b) The prompt code has the highest correlation and
the early and late have similar correlation. The loop is perfectly tuned in.
5.149However when there is a phase error on the local carrier wave, the signal will be
noisier, making it more difficult for the DLL to keep lock on the code. Often, DLL in a
GPS receiver is designed with six correlators as in Figure 5-31. The advantage of the
design is that it is independent of the phase on the local carrier wave. If the local carrier
wave is in phase with the input signal, all the energy will be in the in-phase arm. But if
the local carrier phase drifts compared to the input signal, the energy will switch
between the in-phase and the quadrature arm.

5.150
5.151Figure 5-31 : DLL block diagram with six correlators
Page 101 of 273

SIMULINK Modeling of Single Channel GPS Receiver

5.152

(ENG499 JUL2009/ENG/014)

Factors Affecting GPS Accuracy

5.153There are multiple error sources associated with GNSS signal processing. Below is the
list of them:
5.154Navigation error sources
5.155Error in the calculated navigation state can arise from four main sources:
5.156Instrumentation Errors: The sensed variables may not equal the physical quantities
because of imperfections in the sensor (e.g. bias, scale factor, nonlinearity, random
noise).
5.157Computational Errors: The navigation equations are typically implemented by a
digital computer. Quantization, overflow, and numeric (e.g. integration) errors can
occur.
5.158Alignment Errors: The sensors and their platform cannot be aligned perfectly with
their assumed directions. In addition, instrumentation and computational errors result in
errors in the computed transformations between reference frames. If uncompensated, a
portion of the computed motion along a given axis is manifested along a difference axis
in the actual system.
5.159Environment Errors: The environment cannot be modeled exactly and affects
compensation of the measurements. An example is the inability to exactly predict the
magnitude and the direction of the effective gravity vector.
-

Receiver clock bias


Satellite clock bias
Atmospheric delay (nondispersive and dispersive)
Tropospheric delay (for satellites at low elevations)
Ionospheric delay
Selective Availability (intentional dithering of the satellite clock as to degrade the
accuracy of civilian receiver)
Ephemeris errors (radial, tangential and cross track)
Multipath
Receiver noise
Pseudorange error model

5.160

5.161
Page 102 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

5.162

Page 103 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

CHAPTER SIX
6

SIMULINK MODEL DEVELOPMENT FOR GPS TRANSMITTER

6.1 GPS Transmitter in SIMULINK model implementation


6.1.1 Pre Initialization
6.3

During the pre initialization, there are two parts to execute so that the parameters are
setup for GPS transmitter simulation. The two parts are:

6.4

Part 1 C/A Code Generation

6.5

We require to create the model of the m-sequence shift registers for generating the C/A
code of a particular satellite. The shift register is represented by the unit delay block.

6.6

With reference to the Figure 5-5, the C/A generator can be created. According to the
Table 5-11, the phase selector is chosen to generate the PRN signal number. The Figure
6-1 shows the model of PRN #01. The code phase selection is 2

6. The output of

unit delay 2 and unit delay 6 are modulo-2 added.

6.7
6.8

Figure 6-1: C/A code generator

Page 104 of 273

SIMULINK Modeling of Single Channel GPS Receiver


6.9

(ENG499 JUL2009/ENG/014)

In the C/A code generator, all unit delay blocks initial conditions have to be predefined once the model is opened. All the initial conditions are defined as 1 at the
Callbacks preload function.

6.10
6.11 Figure 6-2 : Unit delay initial condition

Page 105 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.12

6.13 Figure 6-3 : Preload the initial states when the C/A code generator is executed

Page 106 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.14 The C/A code generator for one PRN is being blocked under a sub system. By selecting
the entire C/A code generator, a subsystem is created.

6.15
6.16 Figure 6-4 : PRN01 main system block of the C/A code generator
6.17 As the NRZ is more convenient in the simulation, the lookup table will convert the
binary bit 0 to a NRZ bit -1.

6.18
6.19 Figure 6-5 : Lookup Table input values
6.20 After converting the binary bits of the C/A code generator, the result is saved into a
workspace. The data points are limited to 1023 to emulate one cycle. A variable name is
assigned for each PRN signal number.

6.21
Page 107 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.22 Figure 6-6 : To workspace is to store the C/A code PRN01 value
6.23 The C/A code consists of 1023 sequences which have binary value of 0 and 1. The
figure below shows one period of the C/A code.
6.24

6.25

Figure 6-7 : 1023 sequence C/A code

6.26 There are 32 PRN signal numbers to be created in order to simulate the GPS satellites
Gold codes. It applies the identical method of creating PRN#01 and duplicates the C/A
code generator for the rest of the 31 PRN signal numbers. Refer to Appendix C for the
model of all PRN signal simulator.

Page 108 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.27
6.28 Figure 6-8 : Combining the PRN signal numbers with a bus creator

Page 109 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.29
6.30 Figure 6-9 : 32 PRN signal numbers combined by a bus creator block to the Workspace
for storage

Page 110 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.31 The result of the 32 C/A codes is plotted below. All the values are stored into a lookup
table which will be used for PRN selector during the transmitter signal generation.
Refer to the Appendix C for the C/A codes values.

Bits of C/A codes (1023)


PRN Signal number

Bit 1
Bit 0

6.32
6.33 Figure 6-10 : The values of 32 PRN signal number C/A codes.

Page 111 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.34 Part 2 Navigation Generation


6.35 The navigation data is a set of pseudo random data generated by the PN sequence
generator block. With the similar implementation of C/A code, it is also a NRZ
representation and therefore a lookup table is used for bit conversion. The bit is
converted and stored into the workspace.

6.36
6.37 Figure 6-11 : Navigation data generator
6.38 The data points are limited to 1500 to emulate one cycle. A variable name NavTable
is assigned for call up. The plot of navigation data is showed in Figure 6-12.

6.39
6.40 Figure 6-12 : To Workspace to store Navigation data
Page 112 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.41

6.42 Figure 6-13 : Sample of Navigation data in one period, 1500 bits
6.43 The input of the PN sequence generators initial states is configured to [1 1 0 1 0 1] so
that the navigation data can have some differentiation at the beginning few bits.

Page 113 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.44
6.45 Figure 6-14 : PN Sequence generator for
navigation data generation

6.1.2

Figure 6-15 : The first 25 bits of navigation

Result on C/A code generation for Transmitter

6.46 Once the pre initialization is done on the C/A code generation and navigation data
generation, the two modules can be inserted into the transmitter model. The C/A code
requires the clock of 1.023 MHz to trigger. One C/A period is a counter of 1023 before
the counter resets the count again.
6.47 There is a user defined parameter if user likes to create a code phase shift change on the
starting bit. The parameter name is code places at the C/A counter.

Page 114 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.48
6.49 Figure 6-16 : Using scope to get the results of C/A codes
6.50
1.023 MHz clock

C/A code counter (1023)

1 complete count
C/A code period (1ms)

1 period

6.51Figure 6-17 : C/A code counter

Page 115 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.52 The look-up table points to one set of C/A code with each period.
6.53
1.023 MHz clock

C/A code counter (1023)

C/A code (1ms)

6.54Figure 6-18 : A zoom in on the C/A code counter

Page 116 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.55

1 period

6.56Figure 6-19 : C/A counter resets approximately every 1ms

Page 117 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.57 The look-up table points to the last bit of the one cycle C/A code at 1022 counts. The
look-up table will go back to first bit of C/A code after the counter resets. The cycle of
the C/A code will continue to run until the simulation is stopped.
6.58

1.023 MHz clock

C/A code counter (1023)

Counter resets at
1022 counts

C/A code (1ms)

Last bit of PRN#01


C/A code

6.59Figure 6-20 : Zoom in on the counter resets when it reaches 1022


6.60 The required C/A code for the transmitter is chosen at the upper level. When the
transmitter selects the PRN signal number, the look-up table will point to the correct
PRN C/A code. In order to perform this, a variable parameter (prn) is used at the Table
data. The vector of input values has a range of 0 to 1022 which in total, there is 1023
vector to contain one set of C/A code.

6.61
6.62 Figure 6-21 : Parameters in Look-Up for C/A code
Page 118 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.63 The Figure 6-22 shows the Look-up Table block data when the transmitter points to the
required PRN signal number.

6.64
6.65 Figure 6-22 : Look-up Table for PRN#01
Page 119 of 273

SIMULINK Modeling of Single Channel GPS Receiver

6.1.3

Result

on

Navigation

(ENG499 JUL2009/ENG/014)

data

generation

for

Transmitter
6.66 The navigation counter required the counter of C/A code to clock the navigation data.
The first counter for navigation period is based on 20 before it resets, that is, every
20ms corresponding to 50 Hz. The second counter works in the same as the counter in
C/A part. That is, it increases its output value with every falling edge of the input signal,
and it resets at the end of a period. In this case, the period is set to be one navigation
data frame corresponding to 1500 bits.
6.67 There is a user defined parameter if user likes to create a navigation phase change on
the starting bit. The parameter name is seed places at the 2nd navigation message
counter.

Page 120 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.68

6.69 Figure 6-23 : Using scope to get the results of navigation data
6.70

Page 121 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.71 The look-up table points to one set of navigation data with each period.
6.72
50 Hz clock
Navigation period
counter (20 counts)

Navigation message
counter (1500 counts)
1 complete count

Navigation data
(30sec)

1 period

6.73Figure 6-24 : Navigation counter

Page 122 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.74
6.75Figure 6-25 : A zoom in on the navigation period counter. It resets
after 20 steps

Page 123 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.76 The look-up table points to the last bit of the one cycle navigation data at 1499 counts.
The look-up table will go back to first bit of navigation data after the counter resets.
The cycle of the navigation data will continue to run until the simulation is stopped.
6.77
6.78

Counter resets at
20 counts

Navigation period
counter (20 counts)

Counter resets at
1500 counts

Last bit of
Navigation data

Navigation message
counter (1500 counts)

Navigation data
(30sec)

6.79 Figure 6-26 : A zoom in on the Navigation counter

6.80
6.81 Figure 6-27 : Parameters in Look-Up for Navigation data

Page 124 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.82
6.83 Figure 6-28 : Look-up Table for Navigation data

Page 125 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.84 The Figure 6-29 and Table 6-14 is used to verify the correct look-up table output.

6.85
6.86 Figure 6-29 : The navigation data from 0 to 0.3 sec
6.87
6.88No
6.90 1
6.92 2
6.94 3
6.96 4
6.98 5
6.100 6
6.102 7
6.104 8
6.106 9
6.108 10
6.110 11
6.112 12
6.114 13
6.116 14
6.118 15

6.89Bit
6.91 -1
6.93 1
6.95 -1
6.97 1
6.99 1
6.101 1
6.103 1
6.105 1
6.107 1
6.109 -1
6.111 -1
6.113 -1
6.115 -1
6.117 -1
6.119 1

6.120 Table 6-14 : Navigation data of first fifteen bits.

Page 126 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.2 Result on P(Y) code generation for Transmitter


6.121 The P(Y) code in the transmitter is not relevant to the acquisition
and tracking algorithms and thus, it only requires to simulate as a
square pulse alternating between 1 and -1.

6.122
6.123Figure 6-30 : Using scope to get the results of P(Y) code
6.124

Page 127 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.125

6.126Figure 6-31 : P(Y) code at 10.23 MHz

6.3 Result on carrier generation for Transmitter


6.127The carrier generation is using a Discrete Time VCO with the ramp input. The ramp
input requires being in discrete format and therefore a zero-order hold is placed before
the VCO. The VCO quiescent frequency is using the IF 9.548 MHz.
6.128On the C/A code generating portion, there is a phase shift of 90 compared to the other
VCO for P code. The 90 phase shift VCO generates a cosine wave. The Doppler shift
Page 128 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

is set as a variable parameter which can be defined by user. It is defined by the


parameter name doppler

6.129
6.130Figure 6-32 : Using scope to get the results of carrier for BPSK modulation

6.131
6.132 Figure 6-33 : Carrier wave at 9.548 MHz

Page 129 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.4 Integrating the components for Transmitter


6.133All the components are integrated to create the model for transmitter. The components
are showed in Figure 6-34.
-

C/A code
Navigation data
P(Y) code
Carrier
Noise channel

Page 130 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.134

6.135 Figure 6-34 : Transmitter model after the integration


6.136

Page 131 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.137 The components are then created into a sub system for easy
managed which the Figure 6-35 shows the transmitter system.
6.138

6.139 Figure 6-35 : GPS signal simulator for generating PNR #01
6.140 In this GPS transmitter model, there are some parameters that can
be defined by user. They are:

Page 132 of 273

SIMULINK Modeling of Single Channel GPS Receiver


-

PRN signal number (Range from 1

to 32)
C/A code phase (Range from 0 to

1022)
Navigation Phase (Range from 0 to

1499)
SNR dB
Doppler Frequency Hz
Sampling time (1/38192000)

(ENG499 JUL2009/ENG/014)

6.141
6.142
6.143
6.144 Figure 6-36 : Parameter setting for transmitter

Page 133 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.5 System Testings and Results


6.145The combined of C/A code and navigation data is multiplied onto the carrier. The
combined P(Y) code and navigation is added into the carrier.
6.146 The Figure shows the signal of the transmitter. At a higher SNR, the
signal is more distinct from the noise.

6.147

Page 134 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.148Figure 6-37 : Transmitter Signal modulated at IF = 9.548 MHz at SNR

= 0dB
6.149 Figure 6-38 : Transmitter Signal modulated at IF = 9.548 MHz at SNR
= 30dB

Page 135 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.150C/A code is multiplied to the navigation data to form the transmitter signal. The Figure
6-39 shows the transmitters signal has a change in amplitude when C/A code and
navigation of different amplitudes are multiplied.
6.151
C/A code multiplied
with Navigation data

C/A code for PRN#01

Navigation data

6.152Figure 6-39 : Transmitters signal of first 5 bits of Navigation data.

Page 136 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.153
1

0x1=0

C/A code multiplied with Navigation data

1x1=1
0

C/A code for PRN#01

1
Navigation data
0

6.154Figure 6-40 : A zoom in on the transmitters signal during the transition of 1st bit and 2nd
bit of navigation data.

Page 137 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.155 The figure below shows the transmitters signal changes in


amplitude when the navigation data goes from 1 to 0.
6.156
1

0x1=0

1x1=1

C/A code multiplied with Navigation data

1
C/A code for PRN#01

1
Navigation data
0

6.157 Figure 6-41 : GPS A zoom in on the transmitters signal during the transition of 2nd
bit and 3rd bit of navigation data.
6.158
6.159 When the code phase is changed between 0 to 1022, the C/A code
cycle will start at defined value. The Figure 6-42 shows the C/A code
started at 51 when time is zero.

Page 138 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

Code phase = 51

6.160
6.161 Figure 6-42 : C/A code started at code phase = 51

Page 139 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

CHAPTER SEVEN
7 SIMULINK MODEL DEVELOPMENT FOR GPS RECEIVER
7.1 GPS Receiver in SIMULINK model implementation
6.162There are two parts in implementing the receiver models based on the system
consideration in chapter 5. The two parts are
7.2

Parallel code phase search acquisition

6.163In this acquisition, it requires 2 local generated conditions for correlation with the
incoming signal. The first condition is to create a local generated PRN code. This PRN
generator is duplicated directly from the transmitter model.

6.164
6.165Figure 7-1 : Local PRN code generator

6.166
6.167Figure 7-2 : Subsystem of PRN code generator

Page 140 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.168The second condition is to create local oscillator carrier signal which is a replica from
the transmitter.
6.169A user defined function called S-Function is used to perform the generating of local
oscillation carrier. A level 2 S-Functions allow to create blocks with many of the
features and capabilities of SIMULINK built-in blocks. The S-Function supports
various signal attributes, the ability to accept vector or matrix signals.
6.170The equation for generating carrier is

6.171
6.172where is 2fc and a(t) is the amplitude.
6.173A template of S-Function can be found in MATLAB M-file which can be used to setup
the ports and parameters declaration. The function M-file for oscillator_sfunc can be
referred to Appendix B3. The computation equation is taken out from this M-file.
6.174
6.175
6.176
6.177
6.178

function Outputs(block)
ts = block.RuntimePrm(1).Data;
load acq_data
block.OutputPort(1).Data = sin((0:38191)' * 2 * pi * ts*IFval);
block.OutputPort(2).Data = cos((0:38191)' * 2 * pi * ts*IFval);

6.179
6.180Figure 7-3 : Level-2 S-Function M-file for carrier generation.

Page 141 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.181The incoming signal from transmitter model is imported into the acquisition for
identifying the right PRN signal number. Level-2 S-function is used to load the signal.
The M-file of insignal_sfunc is at Appendix B2. The code below shows the loading of
transmitter signal saved in .mat file.
6.182
6.183
6.184
6.185
6.186
6.187
6.188
6.189
6.190

function Outputs(block)
load GPSSignals.mat;
idx = block.Dwork(1).Data;
idx = idx + 1;
X = signals(2,(idx-1)*38192+1:idx*38192)';
block.OutputPort(1).Data = X;
block.Dwork(1).Data = idx;
%endfunction

6.191
6.192Figure 7-4 : insignal_sfunc for incoming signal

6.193
6.194Figure 7-5 : System for insignal_sfunc

Page 142 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.195The I and Q signals are combined to form a complex input signal x(n) = I (n) + j
Q(n) to the DFT function. The Fast Fourier transform (FFT) is used in the computation
of the I and Q signals.
6.196

6.197Figure 7-6 : Fast Fourier transform (FFT) at the I and Q signals


6.198The FFT is performed by built in function of Level-2 S-function. The fft_sfunc.m for
FFT function is found at Appendix B6.
6.199
6.200
6.201
6.202

function OutputFrame(block)
% Output method for the frame-based signals.
% Get the input data and allocate space for the output

signal.

6.203

block.OutputPort(1).Data = fft(block.InputPort(1).Data + 1j*


block.InputPort(2).Data);

6.204
6.205At the PRN code generator, the C/A code without code phase is Fourier transmform and
the result is complex conjugate. After the complex conjugate, the result is multiplied
with the discrete I and Q signals. Then after, the output from the multiplication is used
Page 143 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

for inverse Fourier transform implemented as the built-in function IFFT in MATLAB.
This function has the properties similar to the FFT function regarding execution time.
The code for ifft_sfunc.m can be found at Appendix B7.
6.206The output from the IFFT is squared to obtain absolute value. The function at the
acquire2_sfunc signal is computing the peak of the value to be plotted onto the graph.

Page 144 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.207With the acquire2_sfunc S-function, there is a function to compare the value so that the
highest peak can be recorded. There is a loop to execute the routine until the
comparisons reach the end. A detail explanation of the comparison can be referred to
Appendix B8
6.208The acquire2_sfunc will provide the result of the carrier fequency and code phase chips
at the display.
6.209

6.210Figure 7-7 : The parallel code phase search acquisition model

Page 145 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.211

6.212Figure 7-8 : The display of parallel code phase search result

Page 146 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

7.3 Modeling Testing and Results

6.213
6.214Figure 7-9 : The peak is visible for PRN 01 when the code phase = 0

6.215
6.216Figure 7-10 : The peak is visible for PRN 01 when the code phase = 511

Page 147 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

7.4 Carrier tracking implementation

6.217Figure 7-11 : Carrier tracking model

6.218 Figure 7-12 : Result after carrier is removed


Page 148 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.219

6.220 Figure 7-13 : Zoom in on the result after carrier is removed


6.221

Page 149 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.222

6.223 Figure 7-14 : Carrier removed at I signal


6.224

6.225 Figure 7-15 : Carrier removed at Q signal

Page 150 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

CHAPTER EIGHT
8 PROBLEMS AND DISCUSSIONS
8.1 Accuracy of GPS data
6.226 There are many types of error which could have happened during
the wideband transmission. The important messages are transmitted
together with the carrier. At certain times when the signal is not
strong enough, the visibility of the result is not obvious. The issue can
be elevated by amplifying the signal, however the signal to noise
ratio could also be amplified.

8.2 Compatibility Considerations


6.227 If you have implemented any S-functions in C, Ada, or Fortran or
have models that reference other models, you should recreate any
mexopts.bat files (other than the one in your MATLAB preferences
directory) that you use to build S-functions and model reference
simulation targets else it will have compilation error. There is also a
chance of compatibility in the MATLAB software version. For instance,
the I/O port interface might be lacking on the older version which
resulted to have simulation error on the solver or compiler.

Page 151 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.228

6.229 Figure 8-1 : The compiler does not support on certain block in
SIMULINK
6.230

8.3 Many types of data


6.231There are some confusion when handling data type e.g. int16, int32, double, Boolean
and etc. The type of data has to be given the right type in SIMULINK model building.
There were many occasions whereas error occurred during the simulation.
6.232

8.4 Correct usage of Sampling time


6.233Usually majority of the SIMULINK block will require the input of sample time. When
comes to calculate the sample time for the block, it is necessary to have the right answer
for the sampling time. Otherwise the results might not be able to plot the correct graph.
6.234This sampling time is also important in the synchronising of the

Page 152 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.235

Page 153 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

CHAPTER NINE
9 CONCLUSIONS AND RECOMMENDATIONS
9.1 Conclusions
6.236This capstone is indeed very interesting topic to touch on. The study of the GPS
topology and the background has been an eye opening. The technology of wireless
communication is such a wonder to discover and realize. The scope of this project is so
vast that there is plenty of space to select the methods for implementation
6.237In this report, the focus is on achieving a working GPS receiver model which allows the
functions of acquire, demodulate GPS signals. The models are modular and
independent by themselves. The models can also be copy onto the relevant module to
achieve the results.
6.238Because of the GPS topic has
6.239There are many taste of failures during the whole period of the capstone. The problems
encountered always look very challenging and unoptimistic to tackle. Nonetheless,
putting in your best effort will definitely show results, seeking the right guidance and
advice will enable us to move a little bit further.
6.240The

9.2 Recommendations and Future Work


6.241There is certainly more rooms for further enhancement in this project.
-

Improve on the speed of processing the SIMULINK model


Create the code tracking model to decode the C/A code from the signal.
Implement pseudo range calculation.
Increase more channel receivers to process the search and tracking faster.

6.242

Page 154 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

CHAPTER TEN
10CRITICAL REVIEWS AND REFLECTIONS
6.243 Taking capstone for 3 semesters is quite a long time. Because of
high commitment and some health issues, I tried very hard to pull
through. This GPS topic is heavy and required a lot of effort to run
simulation and debug.
6.244 Now I have learnt to better manage time between school work and
other commitment. I know that I am a much organised person in
coping with stress. This project really taught me a lot.

Page 155 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

REFERENCES
6.245
6.246[1] Wikipedia (2010), History of navigation
6.247http://en.wikipedia.org/wiki/History_of_navigation
6.248
6.249[2] About.com:Inventors by Mary Bellis, Hisotry of the Compass The Compass and
other Magnetic Innovations
6.250http://inventors.about.com/od/cstartinventions/a/Compass.htm
6.251
6.252[3] Wikipedia (2010), Sextant
6.253http://en.wikipedia.org/wiki/Sextant
6.254
6.255[4] Wikipedia (2010), GLONASS
6.256http://en.wikipedia.org/wiki/GLONASS
6.257
6.258[5] Wikipedia (2010), Beidou navigation system
6.259http://en.wikipedia.org/wiki/Beidou_navigation_system
6.260
6.261[6] Wikipedia (2010), Global Positioning System
6.262 http://en.wikipedia.org/wiki/Global_Positioning_System
6.263
6.264[7] Peter H. Dana, Department of Geography, University of Texas (1994), Global
Positioning System Overiew
6.265 http://www.colorado.edu/geography/gcraft/notes/gps/gps.html
6.266
6.267[8] GPS Primer (2007), GPS Element
6.268 http://www.aero.org/education/primers/gps/elements.html
6.269
6.270[9] Peter H. Dana, Department of Geography, University of Texas (1994), Global
Positioning System Overiew
6.271 http://www.colorado.edu/geography/gcraft/notes/gps/gif/orbits.gif
6.272
6.273[10] The global positioning system and inertial navigation by Jay Farrell, Matthew
Berth, (2005), Chapter 5
6.274

6.275[11] Topic Briefs (2006), How GPS Works


6.276 http://www.how-gps-works.com/
6.277
6.278[12] GPS Prime (2007), How GPS Works
6.279 http://www.aero.org/education/primers/gps/howgpsworks.html
6.280
6.281[13] Trimble Navagation Limited (1999), How GPS works, Triangulating
6.282 http://www.trimble.com/gps/howgps-triangulating.shtml
6.283
6.284[14] RoseIndia (2008), What is Trilateration?
6.285 http://www.roseindia.net/technology/gps/what-is-trilateration.shtml
6.286

Page 156 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.287[15] RMIT Research Repository (2006), Zhang J, Zhang K, Grenfell R, Deakin R, On


the Relativistic Doppler Effect for Precise Velocity Determination using GPS
6.288 http://researchbank.rmit.edu.au/eserv/rmit:138/n2006000316.pdf
6.289
6.290[16] Windows to the Universe (2010), Becca Hatheway, The Doppler Effect
6.291 http://www.windows.ucar.edu/tour/link=/earth/Atmosphere/tornado/doppler_effect.html
6.292
6.293[17] SATCOM online (2002), Satellite School/Satellite Orbits
6.294 http://www.satcom.co.uk/article.asp?article=11
6.295
6.296[18] Andrews Space && Technology (2001), NAVSTAR GPS - summary
6.297 http://www.spaceandtech.com/spacedata/constellations/navstar-gps_consum.shtml
6.298
6.299[19] The Global Navigation satellite system GLONASS : Development and usage in the
21st century (2002)
6.300 http:tycho.usno.navy.mil/ptti/ptti2002/paper13.pdf
6.301
6.302[20] Andrews Space && Technology (2001), GLONASS summary
6.303 http://www.spaceandtech.com/spacedata/constellations/glonass_consum.shtml
6.304
6.305[21] European Space Agency (2005), First Galileo satellite on orbit to demonstrate key
technologies
6.306 http://www.esa.int/esaCP/SEMSRO8A9HE_index_0.html
6.307
6.308[22] European Space Agency ESA News (2005)
6.309 http://www.esa.int/images/Galileo_GSTB-V2A_08185_M,0.jpg
6.310
6.311[23] Wikipedia (2010), Global navigation satellite system
6.312 http://en.wikipedia.org/wiki/Galileo_(satellite_navigation)
6.313
6.314[24] Encyclopaedia Britannica (1999),
6.315 http://www.britannica.com/EBchecked/topic-art/585825/3697/Commercially-exploitedbands-of-the-radio-frequency-spectrum
6.316
6.317[25] FUNDAMENTALS OF GPS by P.L.N Raju
6.318 http://www.wamis.org/agm/pubs/agm8/Paper-7.pdf
6.319
6.320[26] Kowoma.de (2009), The GPS System, Composition of the Data Signal
6.321 http://www.kowoma.de/en/gps/data_composition.htm
6.322
6.323[27] Wikipedia (2010), GPS signals
6.324 http://en.wikipedia.org/wiki/GPS_signals
6.325[28] Wikipedia (2010), Software-defined radio
6.326 http://en.wikipedia.org/wiki/Software-defined_radio
6.327
6.328[29] SOFTWARE-BASED GPS RECEIVER A RESEARCH AND SIMULATION
TOOL FOR GLOBAL NAVIGATION SATELLITE SYSTEM Dinesh MANANDHAR,
Ryosuke SHIBASAKI Center for Spatial Information Science, The University of Tokyo
6.329
Page 157 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.330[30] The Design and Implementation of a GPS Receiver Channel by Dick Benson, The
MATHWORKS INC
6.331 http://www.dsp-fpga.com/articles/id/?79
6.332
6.333[31] UMTSWorld (2003), CDMA Overview
6.334 http://www.umtsworld.com/technology/cdmabasics.htm
6.335
6.336[32] Telecom ABC (2005), DSSS Direct Sequence Spread Spectrum
6.337 http://www.telecomabc.com/d/dsss.html
6.338
6.339[33] LandAirSea System, Inc (2009), GPS Tracking in Action
6.340 http://www.landairsea.com/gps-tracking-blog/category/gps-tracking-aritcles/gpstracking-in-action/
6.341
6.342[34] WiseGEEK (2010), What is Vehicle Tracking?
6.343 http://www.wisegeek.com/what-is-vehicle-tracking.htm
6.344
6.345[35] A software-defined GPS and Galileo receiver, A single-frequency approach by Kai
Borre, Dennis M Akos, Nicolaj Bertelsen, Perer Rinder, Soren Holdt Jensen (2007)
6.346
6.347[36] Danish GPS Center (2006), GPS Receiver Technology Receiver II: Receiver
components
6.348
6.349[37] Wikipedia (2010), Linear Feedback Shift Register
6.350 http://en.wikipedia.org/wiki/Linear_feedback_shift_register

Page 158 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

6.351
6.352
6.353
6.354
6.355
6.356
6.357
6.358
6.359
6.360
6.361
6.362
6.363
6.364

Page 159 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

APPENDIX A
User Manual for running SIMULINK models
6.365 Steps
1) Copy the folder to your MATLAB software folder in your hard disk. Always keep the
working files folder at current directory

6.366
2) Open file <Run_Receiver.m>
3) To clear the previous variables and start fresh, it need to highlight the line 3 & line 4
and evaluate the both line by pressing F9 or right click on the highlighted line and
choose Evaluate Selection
6.367

6.368
4) Evaluate line 5open_system (NavTable) and the NavTable.mdl will open in the
window.

6.369

Page 160 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

5) Press the
button to start the simulation to generate the Navigation data. The
NavTable will be save onto the workspace in MATLAB

6)
7) Evaluate line 6open_system (CATable) and the CATable.mdl will open in the
window.

8)

Page 161 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

9) Ensure that the Workspace has the <iniStates> value before you generate the C/A
codes. The iniStates is required in the shift register input.

10)
11) Press the
button to start the simulation to generate the C/A codes. The CATable
will be save onto the workspace in MATLAB

12)
13)
14) Evaluate line 7 initSettings to initialize the parameters required to run the files.

15)
16) Evaluate line 9 open_system (GPS_Signals_Generator) and
GPS_Signals_Generator.mdl will open in the windows.
17)

18) Press the


button to start the simulation to generate the GPS Signals. The
GPSSignals.mat and GPS_signals will be saved onto the workspace in MATLAB. It
will take 2 to 5 minutes depending on the computer processing speed.
19) Evaluate line 10 to 14 by highlighting them together in order to set up the parameter
for data acquisition.
Page 162 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

20)
21) Evaluate line 16 to 22 by highlighting them together to load the GPSSignal.mat to the
workspace for data acquisition.

22)
23) Evaluate line 24 open_system (GPS_acquisition_receiver) and
GPS_acquisition_receiver.mdl will open in the windows.
24)
There will have three windows open up. Two of them are the subsystem of the
GPS_acquisition_receiver.mdl.

25)

26)

Page 163 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

27)
28) Press the
button to start the simulation to run the data acquisition. The CATable
will be saved onto the workspace in MATLAB. It will take 2 to 3 minutes depending
on the computer processing speed.
29)
The display block will show information after the acquisition. The display
show carrier frequency and the code phase based on the transmitter simulator

30)

Page 164 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

31) Evaluate line 28 to 35 by highlighting them together to plot the contour graph to
demonstrate the acquired data.

32)
33) Evaluate line 35 to 36 by highlighting them together to open the Carrier_tracking.mdl

34)
35) Press the
button to start the simulation to run the carrier tracking. The scope
display the carrier has been removed.
36)

37)

Page 165 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

APPENDIX B
B.1 M-Files : initSettings.m
38)
39)

Initializing the paramenters and variables


%% Processing settings
====================================================
40)
% Number of milliseconds to be processed used 36000 + any
transients (see
41)
% below - in Nav parameters) to ensure nav subframes are
provided
42)
settings.msToProcess
= 37000;
%[ms]
43)
44)
% Number of channels to be used for signal processing
45)
settings.numberOfChannels
= 8;
46)
47)
% Move the starting point of processing. Can be used to start
the signal
48)
% processing at any point in the data record (e.g. for long
records). fseek
49)
% function is used to move the file read point, therefore
advance is byte
50)
% based only.
51)
settings.skipNumberOfBytes
= 0;
52)
53)
%% Raw signal file name and other parameter
===============================
54)
% This is a "default" name of the data file (signal record) to
be used in
55)
% the post-processing mode
56)
settings.fileName
= 'GPSSignals.mat';
57)
58)
% Data type used to store one sample
59)
settings.dataType
= 'int8';
60)
61)
% Intermediate, sampling and code frequencies
62)
settings.IF
= 9.548e6;
%[Hz]
63)
settings.samplingFreq
= 38.192e6;
%[Hz]
64)
settings.codeFreqBasis
= 1.023e6;
%[Hz]
65)
66)
% Define number of chips in a code period
67)
settings.codeLength
= 1023;
68)
69)
%% Acquisition settings
===================================================
70)
% List of satellites to look for. Some satellites can be
excluded to speed
71)
% up acquisition
72)
settings.acqSatelliteList
= 1:32;
%[PRN numbers]
73)
% Band around IF to search for satellite signal. Depends on max
Doppler
74)
settings.acqSearchBand
= 14;
%[kHz]
75)
% Threshold for the signal presence decision rule
76)
settings.acqThreshold
= 2.5;
77)
78)
%% Tracking loops settings
================================================
79)
% Code tracking loop parameters
80)
settings.dllDampingRatio
= 0.7;

Page 166 of 273

SIMULINK Modeling of Single Channel GPS Receiver


81)
82)
83)
84)
85)
86)
87)
88)

settings.dllNoiseBandwidth
settings.dllCorrelatorSpacing

(ENG499 JUL2009/ENG/014)
= 2;
= 0.5;

% Carrier tracking loop parameters


settings.pllDampingRatio
= 0.7;
settings.pllNoiseBandwidth
= 25;

%[Hz]
%[chips]

%[Hz]

%% Navigation solution settings


===========================================

89)
90)
91)
92)
93)

% Period for calculating pseudoranges and position


settings.navSolPeriod
= 500;
%[ms]

% Elevation mask to exclude signals from satellites at low


elevation
94)
settings.elevationMask
= 10;
%[degrees 0 - 90]
95)
% Enable/dissable use of tropospheric correction
96)
settings.useTropCorr
= 1;
% 0 - Off
97)
% 1 - On
98)
% True position of the antenna in UTM system (if known).
Otherwise enter
99)
% all NaN's and mean position will be used as a reference .
100)
settings.truePosition.E
= nan;
101)
settings.truePosition.N
= nan;
102)
settings.truePosition.U
= nan;
103)
104)
%% Plot settings
==========================================================
105)
% Enable/disable plotting of the tracking results for each
channel
106)
settings.plotTracking
= 1;
% 0 - Off
107)
% 1 - On
108)
%% Constants
==============================================================
109)
110)
settings.c
= 299792458;
% The speed of
light, [m/s]
111)
settings.startOffset
= 68.802;
%[ms] Initial sign.
travel time

Page 167 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

B2 M-Files : insignal_sfunc.m
112)
113)
114)

function insignal_sfunc(block)
%MSFUNTMPL A template for an M-file S-function
%
The M-file S-function is written as a MATLAB function with

the

115)

same name as the S-function. Replace 'msfuntmpl' with the

name

116)
117)
118)

%
%
%
similar
119)
%
more
120)
%
the
121)
%
122)
%
123)
%
124)
%

125)
126)
127)
128)

of your S-function.
It should be noted that the M-file S-function is very
to Level-2 C-Mex S-functions. You should be able to get
information for each of the block methods by referring to
documentation for C-Mex S-functions.
Copyright 2003-2009 The MathWorks, Inc.
$Revision: 1.1.6.17 $

%
% The setup method is used to setup the basic attributes of the
% S-function such as ports, parameters, etc. Do not add any

other

129)
130)
131)
132)
133)
134)
135)

% calls to the main body of the function.


%
setup(block);
%endfunction

% Function: setup
===================================================
136)
% Abstract:
137)
%
Set up the S-function block's basic characteristics such
as:
138)
%
- Input ports
139)
%
- Output ports
140)
%
- Dialog parameters
141)
%
- Options
142)
%
143)
%
Required
: Yes
144)
%
C-Mex counterpart: mdlInitializeSizes
145)
%
146)
function setup(block)

147)
148)
149)
150)
151)
152)
153)

% Register the number of ports.


block.NumInputPorts = 0;
block.NumOutputPorts = 1;
% Set up the port properties to be inherited or dynamic.
block.SetPreCompOutPortInfoToDynamic;

Page 168 of 273

SIMULINK Modeling of Single Channel GPS Receiver


154)
155)
156)
157)
158)
159)
160)
161)
162)
163)
164)
165)
166)
167)
168)
169)
170)

(ENG499 JUL2009/ENG/014)

% Override the output port properties.


% trigger
block.OutputPort(1).DatatypeID = 0; % boolean
block.OutputPort(1).Complexity = 'Real';
block.OutputPort(1).SamplingMode = 'Sample';
block.OutputPort(1).Dimensions
= 38192;
% Register the parameters.
block.NumDialogPrms
= 0;
% Set up the continuous states.
block.NumContStates = 1;
block.SampleTimes = [-1 0];

%
----------------------------------------------------------------171)
% Options
172)
%
----------------------------------------------------------------173)
% Specify if Accelerator should use TLC or call back to the
174)
% M-file
175)
block.SetAccelRunOnTLC(false);

176)
177)
178)

% Specify the block simStateCompliance. The allowed values are:


%
'UnknownSimState', < The default setting; warn and assume
DefaultSimState
179)
%
'DefaultSimState', < Same SimState as a built-in block
180)
%
'HasNoSimState',
< No SimState
181)
%
'CustomSimState', < Has GetSimState and SetSimState
methods
182)
%
'DisallowSimState' < Errors out when saving or restoring
the SimState
183)
block.SimStateCompliance = 'DefaultSimState';

184)
185)

%
----------------------------------------------------------------186)
% The M-file S-function uses an internal registry for all
187)
% block methods. You should register all relevant methods
188)
% (optional and required) as illustrated below. You may choose
189)
% any suitable name for the methods and implement these methods
190)
% as local functions within the same file.
191)
%
-----------------------------------------------------------------

192)
193)

%
----------------------------------------------------------------194)
% Register the methods called during update
diagram/compilation.
195)
%
-----------------------------------------------------------------

Page 169 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

196)
197)
198)

%% Register methods
block.RegBlockMethod('PostPropagationSetup',
@DoPostPropSetup);
199)
block.RegBlockMethod('Start',
200)
block.RegBlockMethod('WriteRTW',
201)
block.RegBlockMethod('Outputs',

202)
203)
204)
205)
206)
207)
208)
209)
210)
211)
212)
213)
214)
215)
216)
217)
218)
219)
220)
221)
222)
223)
224)
225)
226)
227)
228)
229)
230)
231)
232)
233)

@Start);
@WriteRTW);
@Outputs);

function DoPostPropSetup(block)
block.NumDworks = 1;
block.Dwork(1).Name
block.Dwork(1).Dimensions
block.Dwork(1).DatatypeID
block.Dwork(1).Complexity
block.Dwork(1).UsedAsDiscState

=
=
=
=
=

'idx';
1;
0;
% double
'Real'; % real
true;

function Start(block)
%% Initialize Dwork
block.Dwork(1).Data = 0;
%endfunction
function WriteRTW(block)
block.WriteRTWParam('string', 'Mode', 'Auto');
%endfunction
function Outputs(block)
load GPSSignals.mat;
idx = block.Dwork(1).Data;
idx = idx + 1;
X = signals(2,(idx-1)*38192+1:idx*38192)';
block.OutputPort(1).Data = X;
block.Dwork(1).Data = idx;
%endfunction

Page 170 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

B.3 M-Files : oscillator_sfunc.m


234)
function oscillator_sfunc(block)
235)
%MSFUNTMPL A template for an M-file S-function
236)
%
The M-file S-function is written as a MATLAB function with
the
237)
%
same name as the S-function. Replace 'msfuntmpl' with the
name
238)
%
of your S-function.
239)
%
240)
%
It should be noted that the M-file S-function is very
similar
241)
%
to Level-2 C-Mex S-functions. You should be able to get
more
242)
%
information for each of the block methods by referring to
the
243)
%
documentation for C-Mex S-functions.
244)
%
245)
%
Copyright 2003-2009 The MathWorks, Inc.
246)
%
$Revision: 1.1.6.17 $
247)
248)
%
249)
% The setup method is used to setup the basic attributes of the
250)
% S-function such as ports, parameters, etc. Do not add any
other
251)
% calls to the main body of the function.
252)
%
253)
setup(block);
254)
255)
%endfunction
256)
257)
% Function: setup
===================================================
258)
% Abstract:
259)
%
Set up the S-function block's basic characteristics such
as:
260)
%
- Input ports
261)
%
- Output ports
262)
%
- Dialog parameters
263)
%
- Options
264)
%
265)
%
Required
: Yes
266)
%
C-Mex counterpart: mdlInitializeSizes
267)
%
268)
function setup(block)
269)
270)
% Register the number of ports.
271)
block.NumInputPorts = 0;
272)
block.NumOutputPorts = 2;
273)
274)
% Set up the port properties to be inherited or dynamic.
275)
block.SetPreCompOutPortInfoToDynamic;
276)
277)
% Override the output port properties.
278)
% trigger
279)
block.OutputPort(1).DatatypeID = 0; % boolean
280)
block.OutputPort(1).Complexity = 'Real';
281)
block.OutputPort(1).SamplingMode = 'Sample';
282)
block.OutputPort(1).Dimensions
= [38192 1];
283)
284)
% Override the output port properties.

Page 171 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

285)
% trigger
286)
block.OutputPort(2).DatatypeID = 0; % boolean
287)
block.OutputPort(2).Complexity = 'Real';
288)
block.OutputPort(2).SamplingMode = 'Sample';
289)
block.OutputPort(2).Dimensions
= [38192 1];
290)
291)
% Register the parameters.
292)
block.NumDialogPrms
= 1;
293)
block.DialogPrmsTunable = {'Tunable'};
294)
block.DialogPrm(1).DataTypeId = 0;
295)
296)
% Set up the continuous states.
297)
block.NumContStates = 1;
298)
299)
% Register the sample times.
300)
301)
block.SampleTimes = [-1 0];
302)
303)
%
----------------------------------------------------------------304)
% Options
305)
%
----------------------------------------------------------------306)
% Specify if Accelerator should use TLC or call back to the
307)
% M-file
308)
block.SetAccelRunOnTLC(false);
309)
310)
% Specify the block simStateCompliance. The allowed values are:
311)
%
'UnknownSimState', < The default setting; warn and assume
DefaultSimState
312)
%
'DefaultSimState', < Same SimState as a built-in block
313)
%
'HasNoSimState',
< No SimState
314)
%
'CustomSimState', < Has GetSimState and SetSimState
methods
315)
%
'DisallowSimState' < Errors out when saving or restoring
the SimState
316)
block.SimStateCompliance = 'DefaultSimState';
317)
318)
%
----------------------------------------------------------------319)
% The M-file S-function uses an internal registry for all
320)
% block methods. You should register all relevant methods
321)
% (optional and required) as illustrated below. You may choose
322)
% any suitable name for the methods and implement these methods
323)
% as local functions within the same file.
324)
%
----------------------------------------------------------------325)
326)
%
----------------------------------------------------------------327)
% Register the methods called during update
diagram/compilation.
328)
%
----------------------------------------------------------------329)
330)
%% Register methods
331)
block.RegBlockMethod('CheckParameters',
@CheckPrms);
332)
block.RegBlockMethod('ProcessParameters',
@ProcessPrms);
333)
block.RegBlockMethod('PostPropagationSetup',
@DoPostPropSetup);
334)
block.RegBlockMethod('Start',
@Start);

Page 172 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

335)
block.RegBlockMethod('WriteRTW',
@WriteRTW);
336)
block.RegBlockMethod('Outputs',
@Outputs);
337)
338)
%
------------------------------------------------------------------339)
% The local functions below are provided to illustrate how you
may implement
340)
% the various block methods listed above.
341)
%
------------------------------------------------------------------342)
343)
function CheckPrms(block)
344)
345)
a = block.DialogPrm(1).Data;
346)
if ~strcmp(class(a), 'double')
347)
DAStudio.error('Simulink:block:invalidParameter');
348)
end
349)
350)
%endfunction
351)
352)
function ProcessPrms(block)
353)
354)
block.AutoUpdateRuntimePrms;
355)
356)
%endfunction
357)
358)
function DoPostPropSetup(block)
359)
360)
block.NumDworks = 0;
361)
362)
block.AutoRegRuntimePrms;
363)
364)
%endfunction
365)
366)
function Start(block)
367)
368)
369)
function WriteRTW(block)
370)
371)
block.WriteRTWParam('string', 'Mode', 'Auto');
372)
373)
%endfunction
374)
375)
function Outputs(block)
376)
ts = block.RuntimePrm(1).Data;
377)
load acq_data
378)
block.OutputPort(1).Data = sin((0:38191)' * 2 * pi * ts*IFval);
379)
block.OutputPort(2).Data = cos((0:38191)' * 2 * pi * ts*IFval);
380)
381)
%endfunction

Page 173 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

B.4 M-Files : caCodesTable.m


382)
function caCodesTable = makeCaTable(settings, caCode)
383)
%Function generates CA codes for all 32 satellites based on the
settings
384)
%provided in the structure "settings". The codes are digitized
at the
385)
%sampling frequency specified in the settings structure.
386)
%One row in the "caCodesTable" is one C/A code. The row number
is the PRN
387)
%number of the C/A code.
388)
%
389)
%caCodesTable = makeCaTable(settings)
390)
%
391)
%
Inputs:
392)
%
settings
- receiver settings
393)
%
Outputs:
394)
%
caCodesTable
- an array of arrays (matrix)
containing C/A codes
395)
%
for all satellite PRN-s
396)
397)
%------------------------------------------------------------------------398)
%
SoftGNSS v3.0
399)
%
400)
% Copyright (C) Darius Plausinaitis
401)
% Written by Darius Plausinaitis
402)
% Based on Peter Rinder and Nicolaj Bertelsen
403)
%------------------------------------------------------------------------404)
%This program is free software; you can redistribute it and/or
405)
%modify it under the terms of the GNU General Public License
406)
%as published by the Free Software Foundation; either version 2
407)
%of the License, or (at your option) any later version.
408)
%
409)
%This program is distributed in the hope that it will be
useful,
410)
%but WITHOUT ANY WARRANTY; without even the implied warranty of
411)
%MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
412)
%GNU General Public License for more details.
413)
%
414)
%You should have received a copy of the GNU General Public
License
415)
%along with this program; if not, write to the Free Software
416)
%Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301,
417)
%USA.
418)
%------------------------------------------------------------------------419)
420)
%CVS record:
421)
%$Id: makeCaTable.m,v 1.1.2.6 2006/08/14 11:38:22 dpl Exp $
422)
423)
%--- Find number of samples per spreading code
---------------------------424)
samplesPerCode = round(settings.samplingFreq / ...
425)
(settings.codeFreqBasis / settings.codeLength));
426)
427)
%--- Prepare the output matrix to speed up function
----------------------428)
caCodesTable = zeros(32, samplesPerCode);

Page 174 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

429)
430)
%--- Find time constants
-------------------------------------------------431)
ts = 1/settings.samplingFreq;
% Sampling period in sec
432)
tc = 1/settings.codeFreqBasis; % C/A chip period in sec
433)
434)
%=== For all satellite PRN-s ...
435)
436)
%--- Generate CA code for given PRN
----------------------------------437)
438)
%=== Digitizing
=======================================================
439)
440)
%--- Make index array to read C/A code values
------------------------441)
% The length of the index array depends on the sampling
frequency 442)
% number of samples per millisecond (because one C/A code
period is one
443)
% millisecond).
444)
codeValueIndex = ceil((ts * (1:samplesPerCode)) / tc);
445)
446)
%--- Correct the last index (due to number rounding issues)
----------447)
codeValueIndex(end) = 1023;
448)
449)
%--- Make the digitized version of the C/A code
----------------------450)
% The "upsampled" code is made by selecting values form the CA
code
451)
% chip array (caCode) for the time instances of each sample.
452)
caCodesTable = caCode(codeValueIndex);

Page 175 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

B.5 M-Files : generateCaCodes.m


453)
function CAcode = generateCAcode(PRN)
454)
% generateCAcode.m generates one of the 32 GPS satellite C/A
codes.
455)
%
456)
% CAcode = generateCAcode(PRN)
457)
%
458)
%
Inputs:
459)
%
PRN
- PRN number of the sequence.
460)
%
461)
%
Outputs:
462)
%
CAcode
- a vector containing the desired C/A code
sequence
463)
%
(chips).
464)
465)
%------------------------------------------------------------------------466)
%
SoftGNSS v3.0
467)
%
468)
% Copyright (C) Darius Plausinaitis
469)
% Written by Darius Plausinaitis
470)
% Based on Dennis M. Akos, Peter Rinder and Nicolaj Bertelsen
471)
%------------------------------------------------------------------------472)
%This program is free software; you can redistribute it and/or
473)
%modify it under the terms of the GNU General Public License
474)
%as published by the Free Software Foundation; either version 2
475)
%of the License, or (at your option) any later version.
476)
%
477)
%This program is distributed in the hope that it will be
useful,
478)
%but WITHOUT ANY WARRANTY; without even the implied warranty of
479)
%MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
480)
%GNU General Public License for more details.
481)
%
482)
%You should have received a copy of the GNU General Public
License
483)
%along with this program; if not, write to the Free Software
484)
%Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301,
485)
%USA.
486)
%------------------------------------------------------------------------487)
488)
%CVS record:
489)
%$Id: generateCAcode.m,v 1.1.2.5 2006/08/14 11:38:22 dpl Exp $
490)
491)
%--- Make the code shift array. The shift depends on the PRN
number ------492)
% The g2s vector holds the appropriate shift of the g2 code to
generate
493)
% the C/A code (ex. for SV#19 - use a G2 shift of g2s(19) =
471)
494)
g2s = [ 5,
6,
7,
8, 17, 18, 139, 140, 141, 251, ...
495)
252, 254, 255, 256, 257, 258, 469, 470, 471, 472, ...
496)
473, 474, 509, 512, 513, 514, 515, 516, 859, 860, ...
497)
861, 862 ... end of shifts for GPS satellites
498)
... Shifts for the ground GPS transmitter are not included

Page 176 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

499)
... Shifts for EGNOS and WAAS satellites (true_PRN = PRN +
87)
500)
145, 175, 52, 21, 237, 235, 886, 657, ...
501)
634, 762, 355, 1012, 176, 603, 130, 359, 595, 68, ...
502)
386];
503)
504)
%--- Pick right shift for the given PRN number
---------------------------505)
g2shift = g2s(PRN);
506)
507)
%--- Generate G1 code
----------------------------------------------------508)
509)
%--- Initialize g1 output to speed up the function --510)
g1 = zeros(1, 1023);
511)
%--- Load shift register --512)
reg = -1*ones(1, 10);
513)
514)
%--- Generate all G1 signal chips based on the G1 feedback
polynomial ----515)
for i=1:1023
516)
g1(i)
= reg(10);
517)
saveBit
= reg(3)*reg(10);
518)
reg(2:10)
= reg(1:9);
519)
reg(1)
= saveBit;
520)
end
521)
522)
%--- Generate G2 code
----------------------------------------------------523)
524)
%--- Initialize g2 output to speed up the function --525)
g2 = zeros(1, 1023);
526)
%--- Load shift register --527)
reg = -1*ones(1, 10);
528)
529)
%--- Generate all G2 signal chips based on the G2 feedback
polynomial ----530)
for i=1:1023
531)
g2(i)
= reg(10);
532)
saveBit
= reg(2)*reg(3)*reg(6)*reg(8)*reg(9)*reg(10);
533)
reg(2:10)
= reg(1:9);
534)
reg(1)
= saveBit;
535)
end
536)
537)
%--- Shift G2 code
-------------------------------------------------------538)
%The idea: g2 = concatenate[ g2_right_part, g2_left_part ];
539)
g2 = [g2(1023-g2shift+1 : 1023), g2(1 : 1023-g2shift)];
540)
541)
%--- Form single sample C/A code by multiplying G1 and G2
----------------542)
CAcode = -(g1 .* g2);

543)

Page 177 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

B.6 M-Files : fft_sfunc.m


544)
function fft_sfunc(block)
545)
546)
% Level-2 M file S-Function.
547)
% Two-tap FIR filter implementation for frame-based and
sample-based signals.
548)
% Filter coefficients are passed as block parameters.
549)
%
550)
%
Copyright 2009 The MathWorks, Inc.
551)
% $Revision: 1.1.6.1 $ $Date: 2009/11/13 05:06:08 $
552)
553)
setup(block);
554)
555)
function setup(block)
556)
% Register number of ports.
557)
block.NumInputPorts = 2;
558)
block.NumOutputPorts = 1;
559)
560)
% In Accelerator mode, the block runs on TLC.
561)
block.SetAccelRunOnTLC(true);
562)
563)
% Set up the functional port properties.
564)
block.SetPreCompInpPortInfoToDynamic;
565)
block.SetPreCompOutPortInfoToDynamic;
566)
567)
% Set up the inport data-type properties.
568)
block.InputPort(1).DatatypeID = -1;
569)
block.InputPort(1).Complexity = 'Real';
570)
571)
block.InputPort(2).DatatypeID = -1;
572)
block.InputPort(2).Complexity = 'Real';
573)
574)
% Set up the outport data-type properties.
575)
block.OutputPort(1).DatatypeID = -1;
576)
block.OutputPort(1).Complexity = 'Complex';
577)
578)
% Register the parameters.
579)
block.NumDialogPrms
= 0;
580)
581)
% Register the methods.
582)
% Note that the Output method is registered in DoPostProp as
it
583)
% requires knowledge about the signal sampling mode.
584)
block.RegBlockMethod('SetInputPortDimensions',
@SetInpPortDims);
585)
block.RegBlockMethod('SetOutputPortDimensions',
@SetOutPortDims);
586)
block.RegBlockMethod('SetInputPortSamplingMode',@SetInpPortFrameData)
;
587)
block.RegBlockMethod('PostPropagationSetup',
@DoPostPropSetup);
588)
block.RegBlockMethod('Start',
@Start);
589)
block.RegBlockMethod('WriteRTW',
@WriteRTW);
590)
591)
function SetInpPortDims(block, idx, di)
592)
% Set the port dimensions for forward propagation of the
dimensions.
593)
block.InputPort(idx).Dimensions = di;

Page 178 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

594)
block.OutputPort(1).Dimensions = di;
595)
596)
function SetOutPortDims(block, idx, di)
597)
% Set the port dimensions for backward propagation of the
dimensions.
598)
block.InputPort(1).Dimensions
= di;
599)
block.InputPort(2).Dimensions
= di;
600)
block.OutputPort(idx).Dimensions = di;
601)
602)
603)
function SetInpPortFrameData(block, idx, fd)
604)
% Set the block sampling mode to Frame or Sample depending on
the
605)
% sampling mode of the input signal.
606)
block.InputPort(idx).SamplingMode = fd;
607)
block.OutputPort(1).SamplingMode = fd;
608)
609)
610)
function DoPostPropSetup(block)
611)
% Set the proper Output method based on the sampling mode.
612)
block.RegBlockMethod('Outputs', @OutputFrame);
613)
614)
615)
% Set up the dwork vector or scalar.
616)
block.NumDworks = 0;
617)
618)
function Start(block)
619)
% Initialize the data.
620)
621)
function OutputFrame(block)
622)
% Output method for the frame-based signals.
623)
624)
% Get the input data and allocate space for the output
signal.
625)
block.OutputPort(1).Data = fft(block.InputPort(1).Data + 1j*
block.InputPort(2).Data);

Page 179 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

B.7 M-Files : ifft_sfunc.m


626)
function ifft_sfunc(block)
627)
628)
% Level-2 M file S-Function.
629)
% Two-tap FIR filter implementation for frame-based and
sample-based signals.
630)
% Filter coefficients are passed as block parameters.
631)
%
632)
%
Copyright 2009 The MathWorks, Inc.
633)
% $Revision: 1.1.6.1 $ $Date: 2009/11/13 05:06:08 $
634)
635)
setup(block);
636)
637)
function setup(block)
638)
% Register number of ports.
639)
block.NumInputPorts = 1;
640)
block.NumOutputPorts = 1;
641)
642)
% In Accelerator mode, the block runs on TLC.
643)
block.SetAccelRunOnTLC(true);
644)
645)
% Set up the functional port properties.
646)
block.SetPreCompInpPortInfoToDynamic;
647)
block.SetPreCompOutPortInfoToDynamic;
648)
649)
% Set up the inport data-type properties.
650)
block.InputPort(1).DatatypeID = -1;
651)
block.InputPort(1).Complexity = 'Complex';
652)
653)
% Set up the outport data-type properties.
654)
block.OutputPort(1).DatatypeID = 0;
655)
block.OutputPort(1).Complexity = 'Complex';
656)
block.OutputPort(1).SamplingMode = 'Sample';
657)
block.OutputPort(1).Dimensions
= [38192 1];
658)
% Register the parameters.
659)
block.NumDialogPrms
= 0;
660)
661)
% Register the methods.
662)
% Note that the Output method is registered in DoPostProp as
it
663)
% requires knowledge about the signal sampling mode.
664)
block.RegBlockMethod('SetInputPortDimensions',
@SetInpPortDims);
665)
block.RegBlockMethod('SetInputPortSamplingMode',@SetInpPortFrameData)
;
666)
block.RegBlockMethod('PostPropagationSetup',
@DoPostPropSetup);
667)
block.RegBlockMethod('Start',
@Start);
668)
block.RegBlockMethod('WriteRTW',
@WriteRTW);
669)
670)
function SetInpPortDims(block, idx, di)
671)
% Set the port dimensions for forward propagation of the
dimensions.
672)
block.InputPort(idx).Dimensions = di;
673)
block.OutputPort(1).Dimensions = di;
674)
675)
function SetInpPortFrameData(block, idx, fd)
676)
% Set the block sampling mode to Frame or Sample depending on
the

Page 180 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

677)
% sampling mode of the input signal.
678)
block.InputPort(idx).SamplingMode = fd;
679)
680)
function DoPostPropSetup(block)
681)
% Set the proper Output method based on the sampling mode.
682)
block.RegBlockMethod('Outputs', @OutputFrame);
683)
684)
% Set up the dwork vector or scalar.
685)
block.NumDworks = 0;
686)
687)
function Start(block)
688)
% Initialize the data.
689)
690)
function OutputFrame(block)
691)
% Output method for the frame-based signals.
692)
693)
% Get the input data and allocate space for the output
signal.
694)
block.OutputPort(1).Data = ifft(block.InputPort(1).Data);
695)
696)
function WriteRTW(block) % Save the parameters to an RTW file
for code generation.

Page 181 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

B.8 M-Files : acquire2_sfunc.m


697)
function acquire2_sfunc(block)
698)
%MSFUNTMPL A template for an M-file S-function
699)
%
The M-file S-function is written as a MATLAB function with
the
700)
%
same name as the S-function. Replace 'msfuntmpl' with the
name
701)
%
of your S-function.
702)
%
703)
%
It should be noted that the M-file S-function is very
similar
704)
%
to Level-2 C-Mex S-functions. You should be able to get
more
705)
%
information for each of the block methods by referring to
the
706)
%
documentation for C-Mex S-functions.
707)
%
708)
%
Copyright 2003-2009 The MathWorks, Inc.
709)
%
$Revision: 1.1.6.17 $
710)
711)
%
712)
% The setup method is used to setup the basic attributes of the
713)
% S-function such as ports, parameters, etc. Do not add any
other
714)
% calls to the main body of the function.
715)
%
716)
setup(block);
717)
718)
%endfunction
719)
720)
% Function: setup
===================================================
721)
% Abstract:
722)
%
Set up the S-function block's basic characteristics such
as:
723)
%
- Input ports
724)
%
- Output ports
725)
%
- Dialog parameters
726)
%
- Options
727)
%
728)
%
Required
: Yes
729)
%
C-Mex counterpart: mdlInitializeSizes
730)
%
731)
function setup(block)
732)
733)
% Register the number of ports.
734)
block.NumInputPorts = 1;
735)
block.NumOutputPorts = 2;
736)
737)
% Set up the port properties to be inherited or dynamic.
738)
block.SetPreCompOutPortInfoToDynamic;
739)
740)
block.InputPort(1).Complexity
= 'Real';
741)
block.InputPort(1).DataTypeId
= 0;
742)
block.InputPort(1).SamplingMode = 'Sample';
743)
block.InputPort(1).Dimensions
= [38192 1];
744)
745)
% Override the output port properties.
746)
% trigger

Page 182 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

747)
block.OutputPort(1).DatatypeID = 0; % boolean
748)
block.OutputPort(1).Complexity = 'Real';
749)
block.OutputPort(1).SamplingMode = 'Sample';
750)
block.OutputPort(1).Dimensions
= 2;
751)
752)
% Override the output port properties.
753)
% trigger
754)
block.OutputPort(2).DatatypeID = 8; % boolean
755)
block.OutputPort(2).Complexity = 'Real';
756)
block.OutputPort(2).SamplingMode = 'Sample';
757)
block.OutputPort(2).Dimensions
= 1;
758)
759)
% Register the parameters.
760)
block.NumDialogPrms
= 1;
761)
block.DialogPrmsTunable = {'Tunable'};
762)
block.DialogPrm(1).DataTypeId = 0;
763)
764)
% Set up the continuous states.
765)
block.NumContStates = 1;
766)
767)
block.SampleTimes = [-1 0];
768)
769)
%
----------------------------------------------------------------770)
% Options
771)
%
----------------------------------------------------------------772)
% Specify if Accelerator should use TLC or call back to the
773)
% M-file
774)
block.SetAccelRunOnTLC(false);
775)
776)
% Specify the block simStateCompliance. The allowed values are:
777)
%
'UnknownSimState', < The default setting; warn and assume
DefaultSimState
778)
%
'DefaultSimState', < Same SimState as a built-in block
779)
%
'HasNoSimState',
< No SimState
780)
%
'CustomSimState', < Has GetSimState and SetSimState
methods
781)
%
'DisallowSimState' < Errors out when saving or restoring
the SimState
782)
block.SimStateCompliance = 'DefaultSimState';
783)
784)
%
----------------------------------------------------------------785)
% The M-file S-function uses an internal registry for all
786)
% block methods. You should register all relevant methods
787)
% (optional and required) as illustrated below. You may choose
788)
% any suitable name for the methods and implement these methods
789)
% as local functions within the same file.
790)
%
----------------------------------------------------------------791)
792)
%
----------------------------------------------------------------793)
% Register the methods called during update
diagram/compilation.
794)
%
----------------------------------------------------------------795)
796)
%% Register methods
797)
block.RegBlockMethod('CheckParameters',
@CheckPrms);

Page 183 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

798)
block.RegBlockMethod('ProcessParameters',
@ProcessPrms);
799)
block.RegBlockMethod('PostPropagationSetup',
@DoPostPropSetup);
800)
block.RegBlockMethod('Start',
@Start);
801)
block.RegBlockMethod('WriteRTW',
@WriteRTW);
802)
block.RegBlockMethod('Outputs',
@Outputs);
803)
804)
%
------------------------------------------------------------------805)
% The local functions below are provided to illustrate how you
may implement
806)
% the various block methods listed above.
807)
%
------------------------------------------------------------------808)
809)
function CheckPrms(block)
810)
811)
a = block.DialogPrm(1).Data;
812)
if ~strcmp(class(a), 'double')
813)
DAStudio.error('Simulink:block:invalidParameter');
814)
end
815)
816)
%endfunction
817)
818)
function ProcessPrms(block)
819)
820)
block.AutoUpdateRuntimePrms;
821)
822)
%endfunction
823)
824)
function DoPostPropSetup(block)
825)
826)
block.NumDworks = 3;
827)
828)
block.Dwork(1).Name
= 'X2';
829)
block.Dwork(1).Dimensions
= 38192;
830)
block.Dwork(1).DatatypeID
= 0;
% double
831)
block.Dwork(1).Complexity
= 'Real'; % real
832)
block.Dwork(1).UsedAsDiscState = true;
833)
834)
block.Dwork(2).Name
= 'flags';
835)
block.Dwork(2).Dimensions
= 3;
836)
block.Dwork(2).DatatypeID
= 0;
% double
837)
block.Dwork(2).Complexity
= 'Real'; % real
838)
block.Dwork(2).UsedAsDiscState = true;
839)
840)
block.Dwork(3).Name
= 'IF';
841)
block.Dwork(3).Dimensions
= 1;
842)
block.Dwork(3).DatatypeID
= 0;
% double
843)
block.Dwork(3).Complexity
= 'Real'; % real
844)
block.Dwork(3).UsedAsDiscState = true;
845)
%endfunction
846)
847)
function Start(block)
848)
849)
%% Initialize Dwork
850)
block.Dwork(1).Data = zeros(38192,1);
851)
block.Dwork(2).Data = [0;0;0];
852)
block.Dwork(3).Data = 9.548e6 - 7000;
853)
%endfunction
854)

Page 184 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

855)
function WriteRTW(block)
856)
857)
block.WriteRTWParam('string', 'Mode', 'Auto');
858)
859)
%endfunction
860)
861)
function Outputs(block)
862)
X1 = block.InputPort(1).Data;
863)
PRN = block.DialogPrm(1).Data;
864)
load acq_data
865)
flg = block.Dwork(2).Data;
866)
if sum(X1) ~= 0
867)
X2 = block.Dwork(1).Data;
868)
869)
flg(1) = flg(1) + 1;
870)
871)
if flg(1) == 2 && flg(3) < 30
872)
flg(3) = flg(3) + 1;
873)
if (max(X2) > max(X1))
874)
results(flg(3), :) = X2';
875)
else
876)
results(flg(3), :) = X1';
877)
end
878)
flg(1) = 0;
879)
880)
IFval = IFval + 500;
881)
end %if flg(1) == 2 && flg(3) < 30
882)
883)
if flg(3) == 29
884)
initSettings
885)
acqResults.carrFreq = 0;
886)
acqResults.codePhase = 0;
887)
%% Look for correlation peaks in the results
==============================
888)
% Find the highest peak and compare it to the second
highest peak
889)
% The second peak is chosen not closer than 1 chip to
the highest peak
890)
891)
%--- Find the correlation peak and the carrier
frequency -------------892)
[peakSize frequencyBinIndex] = max(max(results, [],
2));
893)
894)
%--- Find code phase of the same correlation peak
--------------------895)
[peakSize codePhase] = max(max(results));
896)
897)
%--- Find 1 chip wide C/A code phase exclude range
around the peak ---898)
samplesPerCodeChip
= round(settings.samplingFreq /
settings.codeFreqBasis);
899)
excludeRangeIndex1 = codePhase - samplesPerCodeChip;
900)
excludeRangeIndex2 = codePhase + samplesPerCodeChip;
901)
902)
%--- Correct C/A code phase exclude range if the range
includes array
903)
%boundaries
904)
if excludeRangeIndex1 < 2
905)
codePhaseRange = excludeRangeIndex2 : (38192 +
excludeRangeIndex1);

Page 185 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

906)
907)
elseif excludeRangeIndex2 >= 38192
908)
codePhaseRange = (excludeRangeIndex2 - 38192) :
excludeRangeIndex1;
909)
else
910)
codePhaseRange = [1:excludeRangeIndex1,
excludeRangeIndex2 : 38192];
911)
end
912)
913)
%--- Find the second highest correlation peak in the
same freq. bin --914)
secondPeakSize = max(results(frequencyBinIndex,
codePhaseRange));
915)
flg(2) = 1;
916)
%--- Store result
----------------------------------------------------917)
acqResults.peakMetric = peakSize/secondPeakSize;
918)
if (peakSize/secondPeakSize) > settings.acqThreshold
919)
acqResults.codePhase = codePhase;
920)
IFval = 9.548e6 - 7000 + (frequencyBinIndex-1)*500;
921)
acqResults.carrFreq = IFval;
922)
acqResults.PRN = PRN;
923)
end
% if (peakSize/secondPeakSize) > settings.acqTh
924)
save acq_results acqResults
925)
end
926)
block.Dwork(2).Data = flg;
927)
block.Dwork(1).Data = X1;
928)
save acq_data results IFval
929)
end
930)
if flg(2) == 0
931)
block.OutputPort(1).Data = [IFval 0];
932)
block.OutputPort(2).Data = boolean(0);
933)
else
934)
block.OutputPort(1).Data = [IFval
floor(acqResults.codePhase*1022/38192)];
935)
block.OutputPort(2).Data = boolean(1);
936)
end
937)
%endfunction

Page 186 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

B.9 M-Files : Run_Reciver.m


938)
939)

%Use F9 to evaluate each line.


%Refer to Appendix A for user guide on running the GPS receiver

940)
941)
942)
943)
944)
945)
946)

clc
clear all
open_system('NavTable')
open_system('CATable')
initSettings

models

open_system('GPS_Signals_Generator')
%start simulation and
proceed next only when simulation ends
947)
for i = 1:32
948)
CAcode(i,:) = double(CATable(:,i)');
949)
caCodesTable = makeCaTable(settings, CAcode(i,:));
950)
caCodeFreqDom(i,:) = conj(fft(caCodesTable));
951)
end

952)
953)
954)
955)
956)
957)
958)
959)
960)
961)

load GPSSignals.mat;
%load incoming signal for receiver
longSignal = signals(2,:);
save receiver caCodeFreqDom CAcode longSignal
IFval = 9.548e6 - 7000;
results = zeros(29, 38192); %receiver
save acq_data results IFval settings

open_system('GPS_acquisition_receiver') %start simulation and


proceed next only when simulation ends

962)
963)

% To plot the aquisition, highlight and evaluate line 27"load


acq_data" to
964)
% line 35"zlabel ('Magnitude') in same time
965)
load acq_data
966)
[X,Y] = meshgrid(linspace(1,1023,38192),
(IFval:500:IFval+14000)/1e6);
967)
contour3(X,Y, results, 100)
968)
set(gca,'YTickLabel',{'9.54','9.55','9.66'})
969)
ylabel ('Frequency (MHz)')
970)
set(gca,'XTickLabel',{'1','256','512','768','1023'})
971)
xlabel ('Code Phase (Chips)')
972)
zlabel ('Magnitude')

973)
974)
975)
976)

%to run Carrier Tracker


load acq_results
open_system('Carrier_tracking')

Page 187 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

APPENDIX C
SIMULINK model File for PRN 01 to PRN 32
977)

PRN01.mdl
978)

Page 188 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

979)

980)

Page 189 of 273

SIMULINK Modeling of Single Channel GPS Receiver


981)

(ENG499 JUL2009/ENG/014)

PRN02.mdl

982)

Page 190 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

983)

984)

PRN03.mdl

Page 191 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

985)

Page 192 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

986)

987)

PRN04.mdl

Page 193 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

988)

Page 194 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

989)

990)

PRN05.mdl

Page 195 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

991)

Page 196 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

992)

993)

PRN06.mdl

Page 197 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

994)

995)

Page 198 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

996)

997)

PRN07.mdl

Page 199 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

998)

Page 200 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

999)

1000)
1001)

PRN08.mdl

Page 201 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1002)

Page 202 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1003)

1004)

PRN09.mdl

Page 203 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1005)

Page 204 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1006)

PRN10.mdl

Page 205 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1007)

Page 206 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

Page 207 of 273

SIMULINK Modeling of Single Channel GPS Receiver


1008)

(ENG499 JUL2009/ENG/014)

PRN11.mdl

Page 208 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1009)

Page 209 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

Page 210 of 273

SIMULINK Modeling of Single Channel GPS Receiver


1010)

(ENG499 JUL2009/ENG/014)

PRN12.mdl

Page 211 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1011)

Page 212 of 273

SIMULINK Modeling of Single Channel GPS Receiver


1012)

(ENG499 JUL2009/ENG/014)

PRN13.mdl
1013)

Page 213 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1014)

PRN14.mdl

Page 214 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1015)

Page 215 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1016)

PR
N15.mdl

Page 216 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1017)

Page 217 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1018)

PRN16.mdl

Page 218 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1019)

Page 219 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1020)

Page 220 of 273

SIMULINK Modeling of Single Channel GPS Receiver


1021)

(ENG499 JUL2009/ENG/014)

PRN17.mdl

Page 221 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1022)

Page 222 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

Page 223 of 273

SIMULINK Modeling of Single Channel GPS Receiver


1023)

(ENG499 JUL2009/ENG/014)

PRN18.mdl

1024)

Page 224 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1025)

PRN19.mdl

Page 225 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1026)

Page 226 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1027)

PRN20.mdl

Page 227 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1028)

Page 228 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1029)

PRN21.mdl

Page 229 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1030)

Page 230 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

Page 231 of 273

SIMULINK Modeling of Single Channel GPS Receiver


1031)

(ENG499 JUL2009/ENG/014)

PRN22.mdl

Page 232 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1032)

Page 233 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

Page 234 of 273

SIMULINK Modeling of Single Channel GPS Receiver


1033)

(ENG499 JUL2009/ENG/014)

PRN23.mdl

Page 235 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1034)

Page 236 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1035)

Page 237 of 273

SIMULINK Modeling of Single Channel GPS Receiver


1036)

(ENG499 JUL2009/ENG/014)

PRN24.mdl

Page 238 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1037)

Page 239 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

Page 240 of 273

SIMULINK Modeling of Single Channel GPS Receiver


1038)

(ENG499 JUL2009/ENG/014)

PRN25.mdl

Page 241 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1039)

Page 242 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

Page 243 of 273

SIMULINK Modeling of Single Channel GPS Receiver


1040)

(ENG499 JUL2009/ENG/014)

PRN26.mdl

Page 244 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1041)

Page 245 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

Page 246 of 273

SIMULINK Modeling of Single Channel GPS Receiver


1042)

(ENG499 JUL2009/ENG/014)

PRN27.mdl

Page 247 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1043)

Page 248 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

Page 249 of 273

SIMULINK Modeling of Single Channel GPS Receiver


1044)

(ENG499 JUL2009/ENG/014)

PRN28.mdl

1045)

Page 250 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1046)

PRN29.mdl

Page 251 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1047)

Page 252 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1048)

PRN30.mdl

Page 253 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1049)

Page 254 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

Page 255 of 273

SIMULINK Modeling of Single Channel GPS Receiver


1050)

(ENG499 JUL2009/ENG/014)

PRN31.mdl

Page 256 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1051)

Page 257 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

Page 258 of 273

SIMULINK Modeling of Single Channel GPS Receiver


1052)

(ENG499 JUL2009/ENG/014)

PRN32.mdl

1053)

Page 259 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

APPENDIX D
GANTT CHART
1054)

D1

Page 260 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1055)

1056)

D2

Page 261 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

1057)

APPENDIX E
E1 Meeting Log #01
1058)

1059)

Date

1060)

06th August 2009

1062)

Time

1063)

1930hrs to 2000hrs

1065)

Duration

1066)

30mins

1068)

Venue

1069)

UNISIM HQ at Clementi Road

1071)
Name

Student

1072)

Lim Tze Wei

1074)
Name

Project

1075)

Simulink Modeling of Single Channel GPS Receiver

1077)
Review
of Previous Meeting
and progress

1078)
1079)

This is the first meeting. No review of previous meeting and progress

1081)
Minutes
of current meeting

1082)
Minutes of Meeting
Attendee: Wilson Onn and Zack Lim Tze Wei
1083)
Agenda :
1084)
1) Brief on project requirement
1085)
2) Discuss on the project proposal submission
1086)
3) Meeting log submission after every project meeting
1087)
4) Next meeting
1088)

1
1061)
2
1064)
3
1067)
4
1070)
5
1073)
6
1076)
7
1080)
8

Page 262 of 273

SIMULINK Modeling of Single Channel GPS Receiver

1097)
9

1098)
items/

1)

Action
Targets

to

achieve

1099)
10
1102)
11

1109)
12

1100)
Other
comment/Areas to
improve
1103)
Referenc
e materials

1110)
How did
you progress so far?
1111)(10 Excellent, 1
Poor)

(ENG499 JUL2009/ENG/014)

1089)
1) Brief on project requirement
1090)
Mr Wilson has given a brief introduction of what the project required.
At the end of the project, I have to deliver GPS transmitter model also GPS
receiver model in Matlab/Simulink. There are several references given by project
supervisor for read up on the GPS and Simulink. The components in each model
have to be built in Simulink. Then after get the results from the Simulink
simulation and improve on the results. Was advised to build the transmitter
model in order to generate the data for GPS receiver. Correlator is another
component that is also able to build in Simulink at the beginning.
1091)
Mr Wilson stated his expectation on spending 12-15hours of
commitment every week for capstone project. He expects me to have an indepth understanding of GPS.
1092)
2) Discuss on the project proposal submission
1093)
Base on the dateline (31st Aug 09) of the project proposal submission,
I need to come out a plan schedule for achieving the targeted date submission.
1094)
3) Meeting log submission after every project meeting
1095)
UNISIM and project supervisor require student to do a meeting log
after every project meeting. We are expected to keep updating the logs as the
project progresses. I am required to submit my meeting log to supervisor for
review and reference.
1096)
4) Next meeting to be arranged on 22nd Aug 09
To understand the GPS technology and its components of receiver and
transmitter

2)

To read up the simulink examples of each GPS component

3)

To build correlator component in simulink as a start

4)

To give a proposal schedule as to how to achieve completion of


Capstone Project proposal on time
1101)

Nil

1104)
1) Mastering SIMULINK 4 by James B. Dabney, Thomas L.
Harman, Publisher: Prentice Hall; 2 edition (April 5, 2001)
1105)
2) Introduction to Simulink with Engineering Applications by
Steven T. Karris, Publisher: Orchard Publications; 1 edition (May 26, 2006)
1106)
3) A Software-Defined GPS and Galileo Receiver: A SingleFrequency Approach (Applied and Numerical Harmonic Analysis)
(Paperback)
1107)
by Kai Borre (Author), Dennis M. Akos (Author), Nicolaj Bertelsen
(Author), Peter Rinder (Author), Soren Holdt Jensen (Author) , Publisher:
Birkhuser Boston; 1 edition (November 9, 2006)
1108)
4) Fundamentals of global positioning system receivers a software
approach by James Bao-Yen Tsui, Publisher: Wiley-Interscience; 2 edition
(December 3, 2004)
1112)
Rating 4

Page 263 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

E2 Meeting Log #02


1113)
1
1116)
2
1119)
3
1122)
4
1125)
5
1128)
6
1131)
7

1135)
8

1161)
9

1114)
Date
1117)
Time
1120)
Duration
1123)
Venue
1126)
Student
Nam
e
1129)
Project
Nam
e
1132)
Review of
Prev
ious
Meet
ing
and
prog
ress
1136)
Minutes
of
curre
nt
meet
ing

1162)
Action
item
s/
Targ
ets
to
achi

1115)

22nd August 2009

1118)

1345hrs to 1445hrs

1121)

1 hour

1124)

UNISIM Blk 82, level 1, Clementi Road

1127)

Lim Tze Wei

1130)

Simulink Modeling of Single Channel GPS Receiver

1133)
This is second project meeting. Update of progress status and a review of the project
proposal draft
1134)

1137)
Minutes of Meeting
Attendee: Wilson Onn and Zack Lim Tze Wei
1138)
Agenda :
1139)
1) Review of project proposal report
1140)
2) Discuss on the GPS transmitter implementation
1141)
3) Project plan and schedule (Gantt chart)
1142)
4) Next meeting
1143)
1144)
1) Review of project proposal report
1145)
Base on the guidelines on the capstone handbook, there are 3 sections to be included
in the project proposal. First section - Project Definition. Mr Wilson gave a recap on what are
the important points to emphasize in the project objective, what is the reason of this project and
also how to approach the project implementation.
1146)
There are several advices given to begin the writing of project proposal report.
1147)
-Understanding GPS as much as possible to build the foundation of GPS knowledge.
1148)
- Understanding GPS signal, primarily the Coarse/Acquisition (C/A) code.
1149)
- Understanding code acquisitions which are serial search acquisition and parallel
search acquisition.
1150)
- Understanding carrier and code tracking
1151)
- Understanding data processing
1152)
He assessed the draft copy of proposal and he suggested putting in more detailed
objective to specify the reason for the project.
1153)
Second Section Investigation of Project Background. Mr Wilson briefly went
through the literature review and had no comment.
1154)
Third Section Project Plan. Mr Wilson also touched on the Gantt chart which the
work was not ready. Zack explained that he has not work on it due to the time was spent on
doing other assignment. He offered his help to comment on the second draft of the proposal if it
can be done on 28th Aug 09.
1155)
2) Discuss on the GPS transmitter implementation
1156)
Zack showed the reference book [3] with contained the block diagram of GPS signal
simulator which GPS signal simulator represented GPS transmitter. Mr Wilson recommended
that the diagram is a good start to work on the data generation.
1157)
3) Project plan and schedule (Gantt chart)
1158)
Lastly, Mr Wilson highlighted the Gantt chart should have milestones stated the
target date of completion. The milestones should have the completion target of both model
implementation and report writing. Constantly writing is a good practice to build up the report.
1159)
4) Next meeting
1160)
He mentioned the third meeting will be on 19th Sept 09
1163)
To understand the more GPS technology and its components of receiver and
transmitter
1164)
To familiarize Matlab/Simulink by doing some topic related tutorials
1165)
To build a GPS transmitter in Matlab/Simulink base on the source from reference
material
1166)
To submit project proposal draft for pre-assessment on 28th Aug 2009 (Friday)

Page 264 of 273

SIMULINK Modeling of Single Channel GPS Receiver

1167)
10

1170)
11
1174)
12

eve
1168)
Other
com
ment
/Are
as to
impr
ove
1171)
Reference
mate
rials
1175)
How did
you
prog
ress
so
far?
1176)
(10
Exce
llent,
1
Poor
)

(ENG499 JUL2009/ENG/014)

1169)
To gradually build up the knowledge of GPS and Simulink with more reading and
hand on Simulink

1172)
[1] Mastering SIMULINK 4 by James B. Dabney, Thomas L. Harman, Publisher:
Prentice Hall; 2 edition (April 5, 2001)
1173)
[2] Introduction to Simulink with Engineering Applications by Steven T. Karris,
Publisher: Orchard Publications; 1 edition (May 26, 2006)
1177)
Rating 3

Page 265 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

E3 Meeting Log #03


1178)
1
1181)
2
1184)
3
1187)
4
1190)
5
1193)
6
1196)
7

1200)
8

1220)
9

1225)
10

1228)
11
1231)
12

1179)
Date
1182)
Time
1185)
Duration
1188)
Venue
1191)
Student
Name
1194)
Project Name
1197)
Review
of
Previou
s
Meeting
and
progres
s
1201)
Minutes
of
current
meeting

1221)
Action items/
Targets
to
achieve
1226)
Other
comme
nt/Area
s
to
improve
1229)
Reference
material
s
1232)
How did you
progres
s so far?
1233)
(10 Excellent,
1 Poor)

1180)

19th September 2009

1183)

1215hrs to 1300hrs

1186)

45 minutes

1189)

UNISIM Blk 82 at Clementi Road

1192)

Lim Tze Wei

1195)

Simulink Modeling of Single Channel GPS Receiver

1198)
1199)

This is third project meeting. A review of the weekly report base on work done

1202)
Minutes of Meeting
Attendee: Wilson Onn and Zack Lim Tze Wei
1203)
Agenda :
1204)
1) Proposal comments
1205)
2) Work direction and Work done
1206)
3) Grading scheme per week
1207)
4) Weekly report and meeting minutes
1208)
5) Next meeting
1209)
1210)
1) Proposal comments
1211)
Mr Wilson has mentioned the Project proposal needs to be improved for final
report. The grade of the proposal was revealed. He expected to see more of mathematic
equation in the final report. He also requested to have more detail on the literature review.
Gantt Chart should include the schedule on interim submission and should also mention manhours
1212)
2) Work direction & Work done
1213)
Zack updated the work done on Simulink. Mr Wilson emphasized on building the
knowledge of C/A code (Gold code) and CDMA. Should understand the correlation
properties
1214)
3) Grading scheme per week
1215)
Mr Wilson mentioned about the grading scheme will be given to the weekly work
done.
1216)
4) Weekly report and meeting minutes
1217)
He requested the work done to be recorded in the project journal and update to
him weekly.
1218)
5) Next meeting
1219)
He mentioned the fourth meeting will be on 03rd Oct 09
1222)
To send a amended Gantt chart by 21st Sept 09
1223)
To study in depth of C/A codes and Gold codes
1224)
To submit weekly report base on the work done by 23rd Sept 09
1227)

To spend more time on familiarizing the GPS transmitter

1230)

Extra notes on CMDA spreading code from project supervisor

1234)

Rating 4

Page 266 of 273

SIMULINK Modeling of Single Channel GPS Receiver

(ENG499 JUL2009/ENG/014)

E4 Meeting Log #04


1235)
1
1238)
2
1241)
3
1244)
4
1247)
5
1250)
6
1253)
7

1257)
8

1269)
9

1274)
10

1277)
11
1280)
12

1236)
Date
1239)
Time
1242)
Duration
1245)
Venue
1248)
Student
Name
1251)
Project Name
1254)
Review
of
Previou
s
Meeting
and
progres
s
1258)
Minutes
of
current
meeting

1270)
Action items/
Targets
to
achieve
1275)
Other
comme
nt/Area
s
to
improve
1278)
Reference
material
s
1281)
How did you
progres
s so far?
1282)
(10 Excellent,
1 Poor)

1237)

19th December 2009

1240)

1145hrs to 1205hrs

1243)

20 minutes

1246)

MacDonald at Ang Mo Kio Park

1249)

Lim Tze Wei

1252)

Simulink Modeling of Single Channel GPS Receiver

1255)
This is fourth project meeting. Discussion about the requirement to pass the
Capstone.
1256)

1259)
Minutes of Meeting
Attendee: Wilson Onn and Zack Lim Tze Wei
1260)
Agenda :
1261)
1) Understand the situation of capstone progress
1262)
2) Understand the capstone requirement and effort
1263)
3) Next meeting
1264)
1265)
Wilson discussed some of the points that will contribute to the progress forward,
namely
(a)
Able
to
take
a
few
weeks
leave
to
bootstrap
your
work
(b) Able to ascertain your office work will allow you to have >20hours per week of your on
time
(c) Able to Have the time/energy/commitment to spend the necessary hours to achieve your
goal
on
a
weekly
basis
and
do
so
independently
(d) Willing to extend for another six months should you for some reason can't complete the
Capstone
project
by
week
42.
(e) Cognizant of the fact that I will only be able to support you based the suggested schedule
(Eg. 3x more Meetings etc) by the school
1266)
Use the points to consider the decision of whether to continue or withdraw from
capstone
1267)
1268)
He mentioned the fourth meeting will be on 17th Jan 10
1271)
To consider how to lighten the personal commitment
1272)
To learn to manage and take care of my health in order to continue with the
capstone
1273)
To plan a schedule that is realistic and feasible
1276)
To manage and organise the available time to work on what task that is not
completed.

1279)

Introduction to Simulink with Engineering Applications by Steven T.Karris

1283)

Rating 2

E5 Meeting Log #05


1284)

1285)

1286)

16th January 2010

Page 267 of 273

SIMULINK Modeling of Single Channel GPS Receiver


1
1287)
2
1290)
3
1293)
4
1296)
5
1299)
6
1302)
7

1306)
8

1317)
9

1321)
10

1324)
11
1327)
12

Date
1288)
Time
1291)
Duration
1294)
Venue
1297)
Student
Name
1300)
Project Name
1303)
Review
of
Previou
s
Meeting
and
progres
s
1307)
Minutes
of
current
meeting

1318)
Action items/
Targets
to
achieve
1322)
Other
comme
nt/Area
s
to
improve
1325)
Reference
material
s
1328)
How did you
progres
s so far?
1329)
(10 Excellent,
1 Poor)

(ENG499 JUL2009/ENG/014)

1289)

1440hrs to 1510hrs

1292)

30 minutes

1295)

UNISIM Blk 83 Level 5 at Clementi Road

1298)

Lim Tze Wei

1301)

Simulink Modeling of Single Channel GPS Receiver

1304)
This is fifth meeting. Review on the possibility to complete capstone in the given
timeframe.
1305)

1308)
Minutes of Meeting
Attendee: Wilson Onn and Zack Lim Tze Wei
1309)
Agenda :
1310)
1) Review of schedule and tasks.
1311)
2) Discuss on the strategy to handle the capstone
1312)
3) Advise and guide on how to work on the problem and doubts
1313)
4) Weekly report and meeting minutes
1314)
5) Next meeting
1315)
1316)
He mentioned the fourth meeting will be on 06th Feb 10
1319)
To send 2 revised schedules (current & 6months extenstion)
1320)
To submit weekly report base on the work done

1323)

To gain more knowledge with simulink libraries

1326)

1330)

Rating 4

E6 Meeting Log #06


1331)
1
1334)
2
1337)
3
1340)
4
1343)
5
1346)
6
1349)
7

1332)
Date
1335)
Time
1338)
Duration
1341)
Venue
1344)
Student
Name
1347)
Project Name
1350)
Review
of
Previou
s
Meeting

1333)

16th January 2010

1336)

1230hrs to 1300hrs

1339)

30 minutes

1342)

UNISIM Blk 81 Level 1 at Clementi Road

1345)

Lim Tze Wei

1348)

Simulink Modeling of Single Channel GPS Receiver

1351)
1352)

This is sixth meeting. Give update on status.

Page 268 of 273

SIMULINK Modeling of Single Channel GPS Receiver

1353)
8

1365)
9

1369)
10

1372)
11
1375)
12

and
progres
s
1354)
Minutes
of
current
meeting

1366)
Action items/
Targets
to
achieve
1370)
Other
comme
nt/Area
s
to
improve
1373)
Reference
material
s
1376)
How did you
progres
s so far?
1377)
(10 Excellent,
1 Poor)

(ENG499 JUL2009/ENG/014)

1355)
Minutes of Meeting
Attendee: Wilson Onn and Zack Lim Tze Wei
1356)
Agenda :
1357)
1) Review of staus vs plan.
1358)
2) Action plan to catch and meet goals
1359)
3) Work in progress : show the
1360)
4) Write up plan
1361)
1362)
He mentioned to have regular meeting for month of Feb 2010
1363)
Send supervisor specific questions to ask and clarify.
1364)
1367)
Work on how to use Lookup table to save
1368)
Supervisor will help to give guide on how to have the parameter
for the simulink block
1371)

To complete the GPS transmitter module

1374)

1378)

Rating 6

E7 Meeting Log #07


1379)
1
1382)
2
1385)
3
1388)
4
1391)
5
1394)
6
1397)
7

1401)
8

1380)
Date
1383)
Time
1386)
Duration
1389)
Venue
1392)
Student
Name
1395)
Project Name
1398)
Review
of
Previou
s
Meeting
and
progres
s
1402)
Minutes
of
current
meeting

1381)

27th February 2010

1384)

1400hrs to 1530hrs

1387)

1hour 30 minutes

1390)

UNISIM Blk 82 Level 2 at Clementi Road

1393)

Lim Tze Wei

1396)

Simulink Modeling of Single Channel GPS Receiver

1399)
This is seventh meeting. Able to show how to use lookup table to store data for
C/A code and Navigation data. Supervisor provided the sampled signal for IF frequency =
9.548MHz. This frequency will put into the Discrete VCO in simulink block.
1400)

1403)
Minutes of Meeting
Attendee: Wilson Onn and Zack Lim Tze Wei
1404)
Agenda :
1405)
1) Solving simulink questions
1406)
- use phase selector to create different C/A codes for Satellite. Create 2 shift
registers and exclusive OR.
1407)
- use PN sequence generation with sign block to create Navigation data.
1408)
- use ramp, Z.O.H, discrete VCO to simulate waveform result
1409)
2) Action plan to catch and meet goals
1410)
He mentioned to have regular meeting on every Saturday until end of March
1411)
Supervisor will not ask for weekly report. But he offers help if there are specific
questions to ask and clarify.
1412)
Next meeting is on 06th March 2010.

Page 269 of 273

SIMULINK Modeling of Single Channel GPS Receiver


1413)
9

1418)
10

1423)
11
1426)
12

1414)
Action items/
Targets
to
achieve
1419)
Other
comme
nt/Area
s
to
improve
1424)
Reference
material
s
1427)
How did you
progres
s so far?
1428)
(10 Excellent,
1 Poor)

(ENG499 JUL2009/ENG/014)

1415)
1416)
1417)

To complete the GPS transmitter module by coming Saturday 6th March 2010
2) Include P-code portion in the GPS transmitter
3) Work on data acquisition. Choose one method

1420)
1421)
1422)

Have good understanding of the theory to tackle the problem encounter.


Able to find solution independently.
Use the consultation time with more specific questions.

1425)
Book: Applying Signal Processing Techniques with Matlab Simulink P2 Section 6
create signal processing model
1429)

Rating 6

E8 Meeting Log #08


1430)
1
1433)
2
1436)
3
1439)
4
1442)
5
1445)
6
1448)
7

1452)
8

1464)
9

1470)
10

1474)

1431)
Date
1434)
Time
1437)
Duration
1440)
Venue
1443)
Student
Name
1446)
Project Name
1449)
Review
of
Previou
s
Meeting
and
progres
s
1453)
Minutes
of
current
meeting

1465)
Action items/
Targets
to
achieve
1471)
Other
comme
nt/Area
s
to
improve
1475)

1432)

06th March 2010

1435)

1445hrs to 1530hrs

1438)

45 minutes

1441)

UNISIM Blk 82 Level 2 at Clementi Road

1444)

Lim Tze Wei

1447)

Simulink Modeling of Single Channel GPS Receiver

1450)
This is eighth meeting. Objective for current meeting is to show GPS transmitter
with P-code portion added. Review the problems encountered in simulink
1451)

1454)
Minutes of Meeting
Attendee: Wilson Onn and Zack Lim Tze Wei
1455)
Agenda :
1456)
1) Solving simulink questions
1457)
- use lookup table to load take in data from gold code and navigation data
generation. Able to convert signal and it has to use 0 and 1 for input value and use -1 and
1 for table data in the lookup table.
1458)
2) Action plan to catch and meet goals
1459)
- base on the submission date (17 th May 2010) and work back on the date for
draft submission.
1460)
- propose to show report structure on 4th April 2010
1461)
- propose to show draft report on 25th April 2010
1462)
3) Discuss on how to spend and use time wisely. If possible, seek help on simulink
to expedite the progress.
1463)
Next meeting is on 13th March 2010.
1466)
To complete the GPS transmitter module by coming Saturday 6th March 2010
1467)
2) Include P-code portion in the GPS transmitter
1468)
1) Work on data acquisition and show it by coming Saturday 13th March 2010
1469)
2) Work on code tracking
1472)
Seek external help to expedite in solving doubt in simulink
1473)
Use the consultation time to clear questions which can help to progress faster and
simulink problem should solve it independently.

1476)

Page 270 of 273

SIMULINK Modeling of Single Channel GPS Receiver


11
1477)
12

Reference
material
s
1478)
How did you
progres
s so far?
1479)
(10 Excellent,
1 Poor)

1480)

(ENG499 JUL2009/ENG/014)

Rating 6

E9 Meeting Log #09


1481)
1
1484)
2
1487)
3
1490)
4
1493)
5
1496)
6
1499)
7

1503)
8

1482)
Date
1485)
Time
1488)
Duration
1491)
Venue
1494)
Student
Name
1497)
Project Name
1500)
Review
of
Previou
s
Meeting
and
progres
s
1504)
Minutes
of
current
meeting

1510)
9

1511)
Action items/
Targets
to
achieve

1518)
10

1519)
Other
comme
nt/Area
s
to
improve
1523)
Reference
material
s
1527)
How did you
progres
s so far?
1528)
(10 Excellent,
1 Poor)

1522)
11
1526)
12

1483)

23th March 2010

1486)

2045hrs to 2125hrs

1489)

40 minutes

1492)

MacDonald along Ang Mo Kio Ave 10

1495)

Lim Tze Wei

1498)

Simulink Modeling of Single Channel GPS Receiver

1501)
This is ninth meeting. Objective for current meeting is to show status of GPS
transmitter
1502)

1505)
Minutes of Meeting
Attendee: Wilson Onn and Zack Lim Tze Wei
1506)
Agenda :
1507)
1) Check and determine on sample rate and sample time for simulink block in
Navigation data and C/A code.
1508)
2) Discuss on how to which acquisition type to use. Parallel code phase
acquisition is a better choice
1509)
Next meeting is on 30th March 2010.
1512)
To complete the GPS transmitter module by coming Saturday 6th March 2010
1513)
2) Include P-code portion in the GPS transmitter
1514)
3) Work on data acquisition and show it by coming Saturday 13th March 2010
1515)
1) Send GPS transmitter simulink file to supervisor for checking
1516)
2) To work on parallel code phase acquisition
1517)
3) Work on code tracking
1520)
Seek external help to expedite in solving doubt in simulink
1521)
If need to check on any questions, email supervisor in advance before the next
meet up.

1524)
1) A Software-Defined GPS and Galileo Receiver: A Single-Frequency Approach
Chapter 6:Acquisition
1525)
1529)

Rating 6

E10 Meeting Log #10


1530)
1
1533)
2

1531)
Date
1534)
Time

1532)

28th August 2010

1535)

1250hrs to 1350hrs

Page 271 of 273

SIMULINK Modeling of Single Channel GPS Receiver


1536)
3
1539)
4
1542)
5
1545)
6
1548)
7

1552)
8

1588)
9

1537)
Duration
1540)
Venue
1543)
Student
Name
1546)
Project Name
1549)
Review
of
Previou
s
Meeting
and
progres
s
1553)
Minutes
of
current
meeting

1589)
Action items/
Targets
to
achieve

(ENG499 JUL2009/ENG/014)

1538)

60 minutes

1541)

UNISIM Blk 81 Level 1 at Clementi Road

1544)

Lim Tze Wei

1547)

Simulink Modeling of Single Channel GPS Receiver

1550)
1551)

This is first meeting after the six month extension. Review of the work done.

1554)
Minutes of Meeting
Attendee: Wilson Onn and Zack Lim Tze Wei
1555)
Agenda :
1556)
Summary of work done to date
1557)
Review of schedule
1558)
Highlight of possible challenges
1559)
Current issue
1560)
AOB
1561)
1562)
1) Review of the progress of work done to date.
1563)
Show the design of serial search acquisition, parallel code phase search
acquisition and carrier tracking on simulink file. Zack mentioned the current work is at doing
the carrier tracking.
1564)
1565)
2) Show the gantt chart schedule and highlight the milestone on each task.
1566)
The report submission is on 15 th Nov 2010 @ 12pm and the Oral presentation is
on 27th Nov 2010 @ 1pm to 4.30pm. According to schedule, a final draft of the report will
submit to supervisor on 17th Oct 2010 for vetting.
1567)
Four more tentative dates are allocated for meeting and they are all on the
Saturdays (11st Sept, 2nd Oct, 23rd Oct, 30th Oct)
1568)
1569)
3) Zack mentioned that there is a high commitment in his full time job which
requires travelling for business trip on 13th Sept to 19th Sept 2010.
1570)
1571)
4) Demonstrate the result in simulink. The result is not assembled according to the
reference material. GPS Tx signal does not show a very distinct carrier of 9.58MHz. There is
plenty of noise in the signal. Has tried to remove the AWGN channel and the signal improves
very little. Supervisor will email Zack the correct result.
1572)
1573)
There are some other issues which are not completed due to the results do not
produce the autocorrelation. The graph should show a spike (peak) when the signal is correct.
1574)
1575)
Supervisor highlighted on the sample time has to be correct. Zack has to cross
check on the file on tx with the file that is used for demo. Supervisor has sent the file in April
2010.
1576)
1577)
The acquisition which was demo did not show any spike which can tell the code
phase. The scope axis values seemed too low. It should be magnitude 10^7 instead of 10^
minus 11.
1578)
1579)
Supervisor mentioned to use reference book as a guide and try to replicate the
result shown in the book.
1580)
1581)
Zack has mentioned on the difficulty in plotting the graph and he will require
example to follow on how to plot the 3D graph which can show the spike.
1582)
1583)
1584)
5) Supervisor expects to have a bi weekly email update and a write up submission
of work done before the project meet up.
1585)
1586)
Next meeting is on 11st Sept 2010.
1587)
1590)
1) Revise schedule and update on the incomplete section
1591)
2) Produce the correct result on tx which is according to the reference book
1592)
3) Check and incorporate NCO
1593)
4) Integrate tx and acquisition rx and show the spike when without code phase
delay and show no spike when with code phase delay.
1594)
5) Supervisor will email the correct result on the tx signal and also the result on

Page 272 of 273

SIMULINK Modeling of Single Channel GPS Receiver

1595)
10

1599)
11
1603)
12

1596)
Other
comme
nt/Area
s
to
improve
1600)
Reference
material
s
1604)
How did you
progres
s so far?
1605)
(10 Excellent,
1 Poor)

(ENG499 JUL2009/ENG/014)

serial search and parallel code phase search acquisition.


1597)
Expedite the work and putting in more time to work on the simulink
1598)
Supervisor hopes to see the receiver can decode message and can integrate all the
parts together

1601)
1602)

1) A Software-Defined GPS and Galileo Receiver: A Single-Frequency Approach

1606)

Rating 6

1607)
1608)

Page 273 of 273

Vous aimerez peut-être aussi