ECE 6276 Final Project Correlation based GPS System Team 4: Alex Cunningham Phillip Marks Andrew D. Falendysz Meghashyam Adoni Goals • Our goal is to use a correlator bank to determine which GPS satellite(s) are available at a given location. • To design a high-sensitivity, fast acquisition system to provide accurate results for weak GPS signals. The extra processing power can be used to integrate weak signals to the point where they can be used to provide a position or timing solution. System Overview • The GPS system utilizes CDMA with each satellite encoding its data using a unique 1023-’chip’ PRN code called C/A code. • On the receiver end a correlator bank computes the correlation of the received signal with possible PRN codes. • The PRN codes corresponding to the correlators whose output is above a threshold for any given lag are then used to decode the data. • The correlation algorithm used in our project is based on the FFT. System Block Diagram Read New Code Demodulated Input N Shift Register Correlator Chip Clk > Threshold Y Shift Register Code PRN Code Detect Header Correlation Animation 8 Components to Optimize • The primary component for this system is the correlator bank that acquires a lock on particular satellite signals. • For the purposes of this system, returning the correct delay for the position of a C/A frame will be sufficient proof of a lock. • Other parts of the system will be simulated with Matlab/Octave and used as test vectors. General C Implementation int main(int argc, char ** argv) { // Load Data //cout << "Using shift register" << endl; // data will cycle the encoded message continuously // shift existing data in shift_reg for (int i = CA_CODE_SIZE-1; i> 0; i--) { shift_reg[i] = shift_reg[i-1]; } // prep buffers // move CA code into an int buffer float ca_code[CA_CODE_SIZE]; for (int i = 0; i < CA_CODE_SIZE; i++) { ca_code[i] = (float) cacode.get(); } // clear shift register - possibly optional step float shift_reg[CA_CODE_SIZE]; // shift into the current register shift_reg[0] = new_data; // load encoded data into a buffer that can be circled float* encoded_msg = new float[DATA_CYCLE_SIZE]; for (int i = 0; i < DATA_CYCLE_SIZE; i++) { encoded_msg[i] = (float) encoded.get(); } // a pointer to use with the circular buffer float * encoded_msg_ptr = encoded_msg +INPUT_OFFSET; // while waiting on a lock cout << "Looking for lock..." << endl; bool haslock = false; while (!haslock) { // load a new piece of data //cout << "Load more data" << endl; float new_data = (float) *encoded_msg_ptr; // perform circular buffering on dataset if (encoded_msg_ptr = encoded_msg+CA_CODE_SIZE-1) encoded_msg_ptr = encoded_msg; else encoded_msg_ptr++; // perform correlation //cout << "Performing correlation" << endl; float power; cout << "correlating..." << endl; correlator(shift_reg, ca_code, &power, CA_CODE_SIZE); // if threshold is high enough - break out of loop to acquire lock //cout << "checking for lock" << endl; cout << " correlation: " << power << endl; if (power > 0.5) haslock = true; } cout << "Lock found!" << endl; delete[] encoded_msg; cout << "Freeded Encode" << endl; return 0; } C FFTW Implementation of Correlator void correlator(float *d, float *g, float *r, unsigned long N) { fftw_plan pG, pD, pS; double complex *D, *G, *S; for(int i = 0; i<= (N/2)+1; i++) { *D = conj(*D); *S = (*D) * (*G); D++; G++; S++; } S = tempSPtr; D = tempDPtr; G = tempGPtr; D = (double complex*) fftw_malloc(sizeof(double complex) * N); G = (double complex*) fftw_malloc(sizeof(double complex) * N); S = (double complex*) fftw_malloc(sizeof(double complex) * N); //DEBUG: fill in S with dummy data pD = fftw_plan_dft_r2c_1d(N, (double*) d, D, FFTW_ESTIMATE); pG = fftw_plan_dft_r2c_1d(N, (double*) g, G, FFTW_ESTIMATE); pS = fftw_plan_dft_c2r_1d(N/2+1, S, (double*) r, FFTW_ESTIMATE|FFTW_PRESERVE_INPUT); fftw_execute(pS); fftw_destroy_plan(pD); fftw_destroy_plan(pG); fftw_destroy_plan(pS); fftw_cleanup(); fftw_execute(pG); fftw_execute(pD); fftw_free(D); fftw_free(G); fftw_free(S); double complex *tempDPtr, *tempSPtr, *tempGPtr; tempDPtr = D; tempGPtr = G; tempSPtr = S; tempDPtr = NULL; tempGPtr = NULL; tempSPtr = NULL; } C Simulation Results • Octave implementation • Simulates with correct results • C Implementation • Compiles and runs • Can determine when satellite signal locks on • Successful acquisition of lock on simulated signal Test Vectors • Generated using Matlab/Octave scripts: – Synthesized GPS frame data – C/A codes for individual satellites – Frame data encoded with C/A codes – Modulate individual signals – Combine and add noise to signals – Demodulate combined signal • Offsets for lag calculations can be determined from test vectors Data Overview 2 • First, an overview of the data coming from the satellites: • GPS Message • Consists of a NAV message modulated with a much higher-frequency code. • C/A Code • Stands for Coarse/Acquisition Code • 1023-’chip’ code at 1.023 MHz • NAV Message • Contains Navigation, Ephemeris, and Almanac information • 1500 bit message at 50 Hz • 300 bits per each of 5 sub-frames Catapult C Optimizations • Primary optimization plans – Improve the speed of the correlator – Use multiple correlators/partially unrolled loops to parallelize the loop that attempts to lock on the signal • Strategy – Replace correlator with algorithm based on Numerical Recipes in C – Use existing CatapultC-optimized FFT code to improve the performance – Use bit-level algorithms rather than expanding the data from bits to bytes Catapult C Expected Results • Use a parallel bank of correlators to improve acquisition time • Highly optimized correlation/FFT calculations to improve performance Timeline M T W R F S S M T W R F S S M T Task Team Member 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 Create Remaining Test Vectors Andrew Convert Test Bench to Catapult C Meg Convert Functionality to Catapult C Meg Optimize FFT Phil Optimize Correlator Phil Optimize Shift Registers Alex Optimize Acquisition Loop Alex Verify Acquisition with Test Vectors Andrew Milestones Preliminary Design Review X Critical Design Review X Final Presentation X Risks and Project Management • The simulated sections of the system allow for areas where the system can be simplified in the event of difficulties. – Using only a single satellite. – Little to no noise added in analog channel. Prior Art • Many patents available for correlator-based receivers and GPS systems. • Snaptrack High Sensitivity Fast Acquisition GPS.3 • GE Parallel Correlator for GPS receiver.4 • Method and apparatus for computing signal correlation (GPS).5 • Correlator implementations • Multiplexed digital correlator.6 Expected Results • Simulated input and analog channel. • HDL optimized correlator bank for acquiring signals from a simulated data stream. References 1. Global Positioning System Standard Positioning Service Signal Specification, 1995 http://www.navcen.uscg.gov/pubs/gps/sigspec/gpssps1.pdf 2. Peter H. Dana, 1992 http://www.colorado.edu/geography/gcraft/notes/gps/gps.html 3. Fast Acquisition, high sensitivity GPS receiver, Inventor: Norman F. Krasner, Assignee: Snaptrack, No. 6289041, Issued: Sep 11, 2001 4. Parallel correlator for global positioning system receiver, Inventors: Glen W. Brooksby, Gerald J. Michon, Jerome J. Tiemann, Assignee: General Electric Company, No. 5579014, Issued: Nov 26, 1996 5. Method and apparatus for computing signal correlation, Inventor: Charles Abraham et al, Assignee: Global Locate, Inc, No. 6606346, Issued: Aug 12, 2003 6. Multiplexed digital correlator, Inventor: Lawrence M. Leibowitz, Assignee: The United States of America as represented by the Secretary of the Navy, No. 4660164, Issued: Apr 21, 1987 7. Fast algorithms for digital signal processing / Richard E. Blahut. Reading, Mass. : AddisonWesley Pub. Co., c1985. 8. Global Positioning System Overview http://www.colorado.edu/geography/gcraft/notes/gps/gif/bitsanim.gif