mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-09-26 06:34:04 +00:00
Bugfix for Spirent PRS code generator
Not sure about this one. From my understanding of the Spirent knowledge base description of the way in which the PRS code is generated, the first PRS code chip for PRN 1 should be the same as the second p-code chip for PRN 1, but it appears that in fact what is generated is the last chip of the week. In other words the offset is -1 not +1. With this modification I can successfully process E1 PRS data for both even and odd numbered PRNs
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
*/
|
||||
|
||||
#include "spirent_prs_code_generator.h"
|
||||
#include "GPS_P_CODE.h"
|
||||
|
||||
SpirentPrsCodeGenerator::SpirentPrsCodeGenerator( int sv, bool is_e1 )
|
||||
: d_sv( sv ),
|
||||
@@ -50,7 +51,17 @@ bool SpirentPrsCodeGenerator::get_chips( uint64_t first_chip_index,
|
||||
// For E1 we have a downsample factor of 4, while the factor is 2
|
||||
// for E6. The offset is chosen by spirent as 0 for even PRNS and 1
|
||||
// for odd PRNS
|
||||
d_code_gen.get_chips( d_sv, d_downsample_factor*first_chip_index + d_offset,
|
||||
uint64_t first_p_chip_index = d_downsample_factor*first_chip_index;
|
||||
if( first_p_chip_index < d_offset )
|
||||
{
|
||||
first_p_chip_index = first_p_chip_index + get_code_length() - d_offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
first_p_chip_index = first_p_chip_index - d_offset;
|
||||
}
|
||||
|
||||
d_code_gen.get_chips( d_sv, first_p_chip_index,
|
||||
num_chips*d_downsample_factor, d_pcode_store );
|
||||
|
||||
dest.resize( num_chips );
|
||||
@@ -64,6 +75,7 @@ bool SpirentPrsCodeGenerator::get_chips( uint64_t first_chip_index,
|
||||
return true;
|
||||
}
|
||||
|
||||
#include <iostream>
|
||||
void SpirentPrsCodeGenerator::set_prn( int sv )
|
||||
{
|
||||
if( sv < 1 || sv > 50 )
|
||||
|
@@ -78,7 +78,17 @@ TEST(SpirentPrsTest, E1FirstChipsTest)
|
||||
|
||||
code_gen.get_chips( first_chip_index, num_chips, prs );
|
||||
|
||||
pcode_gen.get_chips( sv, downsample_factor*first_chip_index+offset, num_chips*downsample_factor, pcode );
|
||||
uint64_t first_p_chip_index = downsample_factor*first_chip_index;
|
||||
if( first_p_chip_index < offset )
|
||||
{
|
||||
first_p_chip_index = first_p_chip_index + code_gen.get_code_length() - offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
first_p_chip_index = first_p_chip_index - offset;
|
||||
}
|
||||
|
||||
pcode_gen.get_chips( sv, first_p_chip_index, num_chips*downsample_factor, pcode );
|
||||
|
||||
for( unsigned int ii = 0, jj = 0; ii < num_chips; ++ii, jj+=downsample_factor )
|
||||
{
|
||||
@@ -129,7 +139,17 @@ TEST(SpirentPrsTest, E6FirstChipsTest)
|
||||
|
||||
code_gen.get_chips( first_chip_index, num_chips, prs );
|
||||
|
||||
pcode_gen.get_chips( sv, downsample_factor*first_chip_index+offset, num_chips*downsample_factor, pcode );
|
||||
uint64_t first_p_chip_index = downsample_factor*first_chip_index;
|
||||
if( first_p_chip_index < offset )
|
||||
{
|
||||
first_p_chip_index = first_p_chip_index + code_gen.get_code_length() - offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
first_p_chip_index = first_p_chip_index - offset;
|
||||
}
|
||||
|
||||
pcode_gen.get_chips( sv, first_p_chip_index, num_chips*downsample_factor, pcode );
|
||||
|
||||
for( unsigned int ii = 0, jj = 0; ii < num_chips; ++ii, jj+=downsample_factor )
|
||||
{
|
||||
@@ -182,7 +202,17 @@ TEST(SpirentPrsTest, E1LastChipsTest)
|
||||
|
||||
code_gen.get_chips( first_chip_index, num_chips, prs );
|
||||
|
||||
pcode_gen.get_chips( sv, downsample_factor*first_chip_index+offset, num_chips*downsample_factor, pcode );
|
||||
uint64_t first_p_chip_index = downsample_factor*first_chip_index;
|
||||
if( first_p_chip_index < offset )
|
||||
{
|
||||
first_p_chip_index = first_p_chip_index + code_gen.get_code_length() - offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
first_p_chip_index = first_p_chip_index - offset;
|
||||
}
|
||||
|
||||
pcode_gen.get_chips( sv, first_p_chip_index, num_chips*downsample_factor, pcode );
|
||||
|
||||
for( unsigned int ii = 0, jj = 0; ii < num_chips; ++ii, jj+=downsample_factor )
|
||||
{
|
||||
@@ -233,7 +263,17 @@ TEST(SpirentPrsTest, E6LastChipsTest)
|
||||
|
||||
code_gen.get_chips( first_chip_index, num_chips, prs );
|
||||
|
||||
pcode_gen.get_chips( sv, downsample_factor*first_chip_index+offset, num_chips*downsample_factor, pcode );
|
||||
uint64_t first_p_chip_index = downsample_factor*first_chip_index;
|
||||
if( first_p_chip_index < offset )
|
||||
{
|
||||
first_p_chip_index = first_p_chip_index + code_gen.get_code_length() - offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
first_p_chip_index = first_p_chip_index - offset;
|
||||
}
|
||||
|
||||
pcode_gen.get_chips( sv, first_p_chip_index, num_chips*downsample_factor, pcode );
|
||||
|
||||
for( unsigned int ii = 0, jj = 0; ii < num_chips; ++ii, jj+=downsample_factor )
|
||||
{
|
||||
|
Reference in New Issue
Block a user