Generate GPS Coarse Acquisition Codes
This model shows how to configure the Gold Sequence Generator block to generate coarse acquisition (C/A) codes as presented in [ 1 ] and uses a discrete block model representation of the same configuration for validating the code generated. GPS uses C/A codes to facilitate acquisition and tracking of transmission signals.
Explore Model
The model contains a discrete block model C/A codes as presented in [ 1 ] and configures the Gold Sequence Generator block to generate the same codes.
To produce the GPS C/A codes, the configuration of the Gold Sequence Generator block requires consideration of these setup details.
Primitive polynomials (
g1
andg2
) and code phases (m2
), specified in thePreLoadFcn
callback of the model matching the discrete block model and the descending ordered polynomials in [ 1 ].g1
,g2
, andm2
are used to configure the Preferred polynomial (1), Preferred polynomial (2), and Sequence index parameters of the Gold Sequence Generator block.In [ 1 ], the polynomials are interpreted as descending ordered, so the Gold Sequence Generator block uses the
fliplr
function to flip theg1
,g2
, andm2
binary vectors to match the discrete block model configuration.The Sequence index parameter corresponds to the delayed second code of the discrete block model. In the discrete block implementation, the shift registers are XOR'd to achieve this mask shift. During initialization, the
mask2shift
function converts the specified mask to the scalar delay used by the Gold Sequence generator block.The feedback register configuration must remain static for the duration of the simulation.
Comparing Results
After running the model, the isequal
is used to compare the GPS C/A codes produced by using the discrete block model and the Gold Sequence Generator block.
isequal(G1_Output,code1) = 1 isequal(G2_Output,code2) = 1 isequal(gps_ca,goldseq) = 1
References
Tsui, James Bao-Yen. Fundamentals of Global Positioning System Receivers: A Software Approach. Hoboken, NJ, USA: John Wiley & Sons, Inc., 2004. https://doi.org/10.1002/0471712582.