Gps Stack Sim

Simulation of the full GPS stack, from satellites' transmission to position calculation at receivers
Alternatives To Gps Stack Sim
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
2 years ago9otherPython
:earth_americas::globe_with_meridians: GPicSync: inserts location in your pictures metadata from a GPS tracklog.
21 days ago4September 22, 20215mitPython
:earth_asia: :satellite: :earth_asia: :satellite: LEOGPS - Satellite Navigation with GPS on Python!
Scikit Dataaccess38
24 years ago31October 30, 20181otherPython
Scikit Data Access: Data Interfaces for Python
Gpsdetector Library24
5 years agoJava
:earth_americas: Android library. If GPS disabled, dialog shown and if user confirms GPS enabled. (2016)
Orange3 Geo23
2 months ago4gpl-3.0Python
:tangerine: :earth_africa: Orange add-on for dealing with geography and geo-location
Gps Stack Sim14
4 years agogpl-2.0MATLAB
Simulation of the full GPS stack, from satellites' transmission to position calculation at receivers
Geoelevations10113 years ago1October 08, 2013apache-2.0Ruby
SRTM (world elevations) and EGM (world undulations) parser library for Ruby
4 years agoC++
Satellites Above10
14 years ago5August 21, 20161mitCoffeeScript
📡 GPS satellite tracker - which GPS satellites are currently visible above a given location on earth?
5 years agoFebruary 20, 20216mitPython
Geonaute Keymaze 500/700 GPS watch device communicator
Alternatives To Gps Stack Sim
Select To Compare

Alternative Project Comparisons


Toolkit which allows for the simulation of GPS C/A code transmission and receiver acquisition and position calculation.

A full listing of provided functions can be found here. We include scripts which demonstrate following high level functionality:

The scripts/plots_demo.m script generates most of the plots included in this README file.

A set of Ephemeris and Almanac files are included in the files directory. An explanation of the information included in these files and how to download updated versions is also included.

Before running, add the /lib folder and sub-folders to the MATLAB path. Also add the /files folder if you want to use the provided world map, Ephemeris files and Almanacs.

Calculating SV position and visible SV

scripts/sv_view.m reads an Ephemeris file and calculates the position of all Space Vehicles (SVs). It then calculates which ones are visible from a certain point on earth with a certain visibility angle. We provide an image of the earth's surface which is superimposed on a ellipsoidal model of earth. A valid ephemeris file is required. A vision elevation angle of 30 degrees is assumed in the following image.

In this example, our receiver is located in Zaragoza, Spain.

Signal transmission from SV, receiver error/delay compensation and lock on

Given valid user position (ECEF), almanac and ephemeris files, the scripts/stack_simulation.m script simulates the C/A code transmission, the channel, the acquisition procedure (warm start) and the receiver's position calculation. This is done using the visible SV from the receiver's position assuming a vision angle of 30 degrees.

C/A codes are transmitted using BPSK at 1575.42 MHz. All operations are done at base band as simulating signals on the L2 band is very resource intensive.

Transmitted signal

We generate the Gold codes for every SV and multiply it with a 50 Hz navigation message. The signal is then modulated using BPSK.

We plot the transmitted signal from SV1 in time. The carrier frequency is 1575.42 MHz. Simulating this signal is very memory intensive. In the following plot, the carrier frequency has been reduced by a factor of 100.

In the frequency domain:

Channel modeling

We consider propagation delay, tropospheric delay, ionospheric delay, clock error and delay introduced by relativistic effects. SV1's signal is shown in base band in the following plot before and after passing through the channel. Its autocorrelation and power spectrum density (PSD) are also shown.

Acquisition and position recovery

The receiver starts of by searching for visible SV. This is done through a C/A code search in time and phase. The latter is necessary due to Doppler shift. The search procedure is done by correlation:

Tracking is done with a delay lock loop (DLL) / phase lock loop (PLL) (Not implemented).

Once SV have been found, clock correction is applied to compensate for relativistic effects and receiver position is recovered using least squares. Since tropospheric and ionospheric delays depend on receiver position, this operation is done iteratively. Dilution of precision (DOP) values are calculated.

The following plot shows the convergence of receiver position and pseudoranges from the receiver to each SV.

The following plot shows the convergence of the calculated value for each of the sources of error we model.

Plotting a trajectory on a map

The script CSVmap.m plots a trajectory, given as ECEF (x, y, z) coordinates, on a map in ETRS89 UTM coordinates. The following files are required but not provided: A .csv file with the trajectory, a map file in any format and a corresponding .tfw file.

Provided functions

All functions can be found under the /lib directory. It contains the following subdirectories with the following functions.

Note that this README is a work in progress and not all subdirectories and functions are listed.


[ enu ] = ecef2enu( xyz, tmat ) % Convert Earth-centered Earth-Fixed to Local east, north, up (ENU)

[ azel ] = enu2azel( enu ) % Convert Eeast-North-Up to Azimuth + Elevation

[x, y, z] = lla2xyz( fi, lambda, h, a, e2 ) % Convert geodetic latitude, longitude, altitude (LLA) coordinates to XYZ

[ lat, lon, alt ] = xyz2lla( x, y, z, a, e2 ) % Vonvert earth-centered earth-fixed (ECEF) cartesian coordinates to latitude, longitude, and altitude

[ t ] = ltcmat( llh ) % Compute the intermediate matrix for LLH to ECEF

[ dist ] = ECEFrange( SVx, SVy, SVz, gx, gy, gz ) % Calculates distance between observer and SV


[EPH ,header] = read_rinex_nav( filename, sv_IDs) % Reads an ephemerides file and get the information of the requested space vehicles.

[ gps_week, gps_seconds ] = cal2gpstime(varargin) % Calculates GPS seconds from UTC

[ dt ] = gpst2utc( week_number, reference_time, leap_seconds ) % Calculates UTC from GPS seconds

[sat_xyz, orbit_parameters] = eph2ecef(eph ,tsv) % Compute sv orbits and sv position in ECEF for the specified time (tsv) from ephemerides

TC Lib

[sCA] = CA_gen(pulseLength, SV_vec) % Generates C/A codes for all SVs

[ modulator ] = generate_doppler( f_vec, L ) % generates a matrix to shift CA codes in frequency

[delay_CA, cicles, prop_delay, sat_clock_offset, sat_clock_rel, iono_T, trop_T_equiv] = gps_channel(head, eph, time, Rpos, sCA, L) % Get TX channel including tropo, iono, clock error and relativistic clock


[ vis_sv ] = visible_sv( satp, rcv_lla, e_mask ) % Search for visible SV given an observation position and elevation

[ f ] = plot_orbits( sat_xyz, orbit_parameters, earth_surface_image, varargin) % Plots SV orbits around the globe


  • It turns out that if you code something similar to this project in C you can spoof real GPS receivers 😁: osqzss/gps-sdr-sim
Popular Gps Projects
Popular Earth Projects
Popular Hardware Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.