mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-10-26 13:07:39 +00:00
Code cleaning.
Test infrastructure reactivated. Now a run_tests executable is created and runs some tests. git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@138 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
@@ -146,50 +146,50 @@ signed int code_gen(CPX *_dest, signed int _prn)
|
||||
*/
|
||||
void code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, signed int _fs, unsigned int _chip_shift)
|
||||
{
|
||||
// This function is based on the GNU software GPS for MATLAB in the Kay Borre book
|
||||
std::complex<float> _code[1023];
|
||||
signed int _samplesPerCode,_codeValueIndex;
|
||||
float _ts;
|
||||
float _tc;
|
||||
const signed int _codeFreqBasis=1023000; //Hz
|
||||
const signed int _codeLength=1023;
|
||||
// This function is based on the GNU software GPS for MATLAB in the Kay Borre book
|
||||
std::complex<float> _code[1023];
|
||||
signed int _samplesPerCode, _codeValueIndex;
|
||||
float _ts;
|
||||
float _tc;
|
||||
const signed int _codeFreqBasis = 1023000; //Hz
|
||||
const signed int _codeLength = 1023;
|
||||
|
||||
//--- Find number of samples per spreading code ----------------------------
|
||||
_samplesPerCode = round(_fs / (_codeFreqBasis / _codeLength));
|
||||
//--- Find number of samples per spreading code ----------------------------
|
||||
_samplesPerCode = round(_fs / (_codeFreqBasis / _codeLength));
|
||||
|
||||
//--- Find time constants --------------------------------------------------
|
||||
_ts = 1/(float)_fs; // Sampling period in sec
|
||||
_tc = 1/(float)_codeFreqBasis; // C/A chip period in sec
|
||||
code_gen_conplex(_code,_prn,_chip_shift); //generate C/A code 1 sample per chip
|
||||
//std::cout<<"ts="<<_ts<<std::endl;
|
||||
//std::cout<<"tc="<<_tc<<std::endl;
|
||||
//std::cout<<"sv="<<_prn<<std::endl;
|
||||
for (signed int i=0;i<_samplesPerCode;i++)
|
||||
{
|
||||
//=== Digitizing =======================================================
|
||||
//--- Find time constants --------------------------------------------------
|
||||
_ts = 1/(float)_fs; // Sampling period in sec
|
||||
_tc = 1/(float)_codeFreqBasis; // C/A chip period in sec
|
||||
code_gen_conplex(_code,_prn, _chip_shift); //generate C/A code 1 sample per chip
|
||||
//std::cout<<"ts="<<_ts<<std::endl;
|
||||
//std::cout<<"tc="<<_tc<<std::endl;
|
||||
//std::cout<<"sv="<<_prn<<std::endl;
|
||||
for (signed int i=0; i<_samplesPerCode; i++)
|
||||
{
|
||||
//=== Digitizing =======================================================
|
||||
|
||||
//--- Make index array to read C/A code values -------------------------
|
||||
// The length of the index array depends on the sampling frequency -
|
||||
// number of samples per millisecond (because one C/A code period is one
|
||||
// millisecond).
|
||||
//--- Make index array to read C/A code values -------------------------
|
||||
// The length of the index array depends on the sampling frequency -
|
||||
// number of samples per millisecond (because one C/A code period is one
|
||||
// millisecond).
|
||||
|
||||
|
||||
_codeValueIndex = ceil((_ts * ((float)i+1)) / _tc)-1;
|
||||
_codeValueIndex = ceil((_ts * ((float)i + 1)) / _tc) - 1;
|
||||
|
||||
//--- Make the digitized version of the C/A code -----------------------
|
||||
// The "upsampled" code is made by selecting values form the CA code
|
||||
// chip array (caCode) for the time instances of each sample.
|
||||
if (i==_samplesPerCode-1){
|
||||
//--- Correct the last index (due to number rounding issues) -----------
|
||||
_dest[i] = _code[_codeLength-1];
|
||||
|
||||
}else{
|
||||
_dest[i] = _code[_codeValueIndex]; //repeat the chip -> upsample
|
||||
}
|
||||
//std::cout<<_codeValueIndex;
|
||||
|
||||
}
|
||||
//--- Make the digitized version of the C/A code -----------------------
|
||||
// The "upsampled" code is made by selecting values form the CA code
|
||||
// chip array (caCode) for the time instances of each sample.
|
||||
if (i == _samplesPerCode - 1)
|
||||
{
|
||||
//--- Correct the last index (due to number rounding issues) -----------
|
||||
_dest[i] = _code[_codeLength - 1];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
_dest[i] = _code[_codeValueIndex]; //repeat the chip -> upsample
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
PassThrough::PassThrough(ConfigurationInterface* configuration, std::string role,
|
||||
Pass_Through::Pass_Through(ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams) :
|
||||
role_(role),
|
||||
@@ -77,25 +77,25 @@ PassThrough::PassThrough(ConfigurationInterface* configuration, std::string role
|
||||
DLOG(INFO) << "kludge_copy(" << kludge_copy_->unique_id() << ")";
|
||||
}
|
||||
|
||||
PassThrough::~PassThrough()
|
||||
Pass_Through::~Pass_Through()
|
||||
{}
|
||||
|
||||
void PassThrough::connect(gr_top_block_sptr top_block)
|
||||
void Pass_Through::connect(gr_top_block_sptr top_block)
|
||||
{
|
||||
DLOG(INFO) << "nothing to connect internally";
|
||||
}
|
||||
|
||||
void PassThrough::disconnect(gr_top_block_sptr top_block)
|
||||
void Pass_Through::disconnect(gr_top_block_sptr top_block)
|
||||
{
|
||||
// Nothing to disconnect
|
||||
}
|
||||
|
||||
gr_basic_block_sptr PassThrough::get_left_block()
|
||||
gr_basic_block_sptr Pass_Through::get_left_block()
|
||||
{
|
||||
return kludge_copy_;
|
||||
}
|
||||
|
||||
gr_basic_block_sptr PassThrough::get_right_block()
|
||||
gr_basic_block_sptr Pass_Through::get_right_block()
|
||||
{
|
||||
return kludge_copy_;
|
||||
}
|
||||
|
||||
@@ -43,16 +43,16 @@
|
||||
|
||||
class ConfigurationInterface;
|
||||
|
||||
class PassThrough : public GNSSBlockInterface
|
||||
class Pass_Through : public GNSSBlockInterface
|
||||
{
|
||||
|
||||
public:
|
||||
PassThrough(ConfigurationInterface* configuration,
|
||||
Pass_Through(ConfigurationInterface* configuration,
|
||||
std::string role,
|
||||
unsigned int in_stream,
|
||||
unsigned int out_stream);
|
||||
|
||||
virtual ~PassThrough();
|
||||
virtual ~Pass_Through();
|
||||
|
||||
std::string role()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user