Skip to content
This repository has been archived by the owner on May 13, 2021. It is now read-only.

JohnBagshaw/GNSS_SDR_C-_YU_ESSE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

[INPUT DATA]

This directory contains twenty data sets for use with the GNSS Software Defined Receiver (SDR).  

The primary data set is named 'sample_nottochange_ch1_fileN_n' (where n = 0 - 19) and it is has been 
collected at York University, Toronto, CA by Junchan. This was 
collected using the bladeRF front end. The parameters necessary for 
processing this data are as follows: 

 - Sampling Frequency: 38.192 MHz (40 MHz)
 - Intermediate Frequency: 9.55 MHz (nominal) (10 MHz)
 - signed character (16 bit) sample format

To run simulation through Visual Studio 2019 IDE,

1) Open visual studio 2019 and create your project and .sln file
2) Open SDR project properties and replace 2017a with 2019b (your version of MATLAB)
3) Press Alt+F7 to open project properties again, goto Debugging and enter 
$(SolutionDir)in_data\sample_nottochange_ch1_fileN_0.bin in Command Arguments.
4) To feed a different file to Visual Studio SDR project, change file name in 
Debugging -> Command Arguments
5) Simulation will run and print execution times of acquisition part and tracking part.
6) Simulation will run and also compare current outputted results with pre-generated 
MATLAB results and print if each element of array is exactly equal to MATLAB's counterpart.

To run simulation if you want to run executable directly from commandline,

1) open command prompt
2) to SDR C++ folder
3) issue command ".\x64\Debug\SDR.exe" ".\in_data\sample_nottochange_ch1_fileN_n.bin"

[OVERVIEW]:

SDR project is re-structured keeping in mind easier to read and modular software design.


[FILE LIST]:

Following is the list of source files excluding DDM and weak signal acquisition files. These are located in ...\src directory.

1) acquisition.cpp
2) gen_code.cpp
3) matcreat.cpp
4) result_read_write.cpp
5) SDR.cpp
6) settings.cpp
7) tracking.cpp

Following is the list of header files excluding DDM and weak signal acquisition files. These are located in ...\hdr directory.

1) acquisition.hpp
2) timing.hpp
3) matcreat.hpp
4) result_read_write.hpp
5) SDR.hpp
6) settings.hpp
7) tracking.hpp
8) constants.h
9) code_table.h
10) structures.hpp

...\fftw-3.3.5-dll64 contain FFTW library, dll and header files.
...\in_data contains list of input binary files. Currently only 20 files are placed here. 
You can put more here later.
...\Readme.txt contains instructions to run the simulation.
VCProject\sample_nottochange_ch1_fileN_*_cpp.mat are files generated by running SDR.exe. 
These contain results from C++ code.
VCProject\sample_nottochange_ch1_fileN_*_mat.mat are files generated by running matlab. 
These contain results from MATLAB scripts.
...\SDR.* are Visual Studio project files are necessary for IDE but not for us.

[CODE DESCRIPTION]

Main source file is SDR.cpp. This contain application entry point function called main() and 
another important function called postProcessing().
main() accepts name of binary input file and should be provided as instructed in Readme.txt. 

IMPORTANT FUNCTIONS LIST

	- postProcessing()
	- settings()
	- acquisition()
	- tracking()

STRUCTURE LIST

	- Settings_t
	- AcqResults_t
	- TrackResults_t


main() function first calls initSettings() function to populate the Settings_t structure with proper settings parameters.
It then calls postProcessing function. postProcessing() function takes in Settings_t structure and then calls acquisition function to get acquisition results in AcqResults_t structure
and tracking() to get tracking results in TrackResults_t structure. After returning from acquisition() function and before calling tracking(), postProcessing() function calls preRun()
to arrange/sort acquisition results and make them suitable for tracking function and also showChannelStatus() to display results on the console.

postProcessing() function then calls saveResults() to save tracking and acquisition results to sample_nottochange_ch1_fileN_*_cpp.mat files.
Finally, postProcessing() function calls compareAcquisitionResults() and compareTrackingResults() to load sample_nottochange_ch1_fileN_*_mat.mat files and 
compare each and every one of results array elements with it's counterpart in MATLAB.

[CONFIGURATION PARAMETERS]

Settings_t structure contains all the parameter structures. Most important ones are acqThreshold, msToProcess, acqSearchBand, samplingFreq and iF. 
acqThreshold should be changed if simulation run indicates that no GNSS signals are captured. Currently, acqThreshold=1.2 which seems good to get enough number
of measurements but it can further be lowered and can be experimented with.

Other parameters like msToProcess and acqSearchBand will change simulation run time because they effect number of computations in the algorithm directly.

[CODE OPTIMIZATION]

Code is quite optimized now and major execution time is spent in third party fftw library calls. 
FFTW library itself is quite fast.

Acquisition function run time is reduced from 22 seconds to 9 seconds by following steps,
	a) inline complex multiplication
	b) removing usage of memset
	c) moving malloc calls out of loops
	d) DSP trick of conj(fft(x)) is equal to ifft(x) if x is real
	e) removing common code

Tracking function is quite fast because it doesn't involve calls to expensive FFTW functions.

Execution time stats are available at the console for each simulation run.

About

C++ version of GPS-receiver

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published