mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-04-13 06:13:17 +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:
parent
88aab41407
commit
3bff16b5d1
@ -126,6 +126,10 @@ void gps_l1_ca_pcps_acquisition_cc::set_satellite(Gnss_Satellite satellite)
|
||||
|
||||
// Now the GPS codes are generated on the fly using a custom version of the GPS code generator
|
||||
code_gen_complex_sampled(d_fft_if->get_inbuf(), satellite.get_PRN(), d_fs_in, 0);
|
||||
|
||||
|
||||
|
||||
|
||||
d_fft_if->execute(); // We need the FFT of GPS C/A code
|
||||
//Conjugate the local code
|
||||
//TODO Optimize it ! try conj()
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -46,7 +46,7 @@ FileOutputFilter::FileOutputFilter(ConfigurationInterface* configuration,
|
||||
out_streams_(out_streams)
|
||||
{
|
||||
|
||||
std::string default_filename = "./data/signal.dat";
|
||||
std::string default_filename = "./output.dat";
|
||||
std::string default_item_type = "short";
|
||||
|
||||
filename_ = configuration->property(role + ".filename", default_filename);
|
||||
|
@ -51,98 +51,95 @@ DEFINE_string(signal_source, "-",
|
||||
FileSignalSource::FileSignalSource(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_streams, unsigned int out_streams,
|
||||
gr_msg_queue_sptr queue) :
|
||||
role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(
|
||||
queue)
|
||||
role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue)
|
||||
{
|
||||
|
||||
std::string default_filename = "./signal_samples/signal.dat";
|
||||
std::string default_filename = "../data/sc2_d16.dat";
|
||||
std::string default_item_type = "short";
|
||||
std::string default_dump_filename = "./data/signal_source.dat";
|
||||
std::string default_dump_filename = "../data/sc2_d16.dat";
|
||||
|
||||
samples_ = configuration->property(role + ".samples", 0);
|
||||
sampling_frequency_ = configuration->property(role
|
||||
+ ".sampling_frequency", 0);
|
||||
sampling_frequency_ = configuration->property(role + ".sampling_frequency", 0);
|
||||
filename_ = configuration->property(role + ".filename", default_filename);
|
||||
|
||||
// override value with commandline flag, if present
|
||||
if (FLAGS_signal_source.compare("-") != 0) filename_= FLAGS_signal_source;
|
||||
|
||||
item_type_ = configuration->property(role + ".item_type",
|
||||
default_item_type);
|
||||
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||
repeat_ = configuration->property(role + ".repeat", false);
|
||||
dump_ = configuration->property(role + ".dump", false);
|
||||
dump_filename_ = configuration->property(role + ".dump_filename",
|
||||
default_dump_filename);
|
||||
enable_throttle_control_ = configuration->property(role
|
||||
+ ".enable_throttle_control", false);
|
||||
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename);
|
||||
enable_throttle_control_ = configuration->property(role + ".enable_throttle_control", false);
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
}
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
}
|
||||
else if (item_type_.compare("float") == 0)
|
||||
{
|
||||
item_size_ = sizeof(float);
|
||||
}
|
||||
{
|
||||
item_size_ = sizeof(float);
|
||||
}
|
||||
else if (item_type_.compare("short") == 0)
|
||||
{
|
||||
item_size_ = sizeof(short);
|
||||
}
|
||||
{
|
||||
item_size_ = sizeof(short);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_AT_LEVEL(WARNING) << item_type_
|
||||
<< " unrecognized item type. Using short.";
|
||||
item_size_ = sizeof(short);
|
||||
}
|
||||
{
|
||||
LOG_AT_LEVEL(WARNING) << item_type_
|
||||
<< " unrecognized item type. Using short.";
|
||||
item_size_ = sizeof(short);
|
||||
}
|
||||
|
||||
file_source_
|
||||
= gr_make_file_source(item_size_, filename_.c_str(), repeat_);
|
||||
file_source_ = gr_make_file_source(item_size_, filename_.c_str(), repeat_);
|
||||
DLOG(INFO) << "file_source(" << file_source_->unique_id() << ")";
|
||||
|
||||
if (samples_==0)
|
||||
{
|
||||
/*!
|
||||
* BUG workaround: The GNURadio file source does not stop the receiver after reaching the End of File.
|
||||
* A possible solution is to compute the file length in samples using file size, excluding the last 100 milliseconds, and enable always the
|
||||
* valve block
|
||||
*/
|
||||
std::ifstream file (filename_.c_str(), std::ios::in|std::ios::binary|std::ios::ate);
|
||||
std::ifstream::pos_type size;
|
||||
if (file.is_open())
|
||||
{
|
||||
size =file.tellg();
|
||||
}else{
|
||||
std::cout<<"file_signal_source: Unable to open the samples file "<<filename_.c_str()<<"\r\n";
|
||||
LOG_AT_LEVEL(WARNING)<<"file_signal_source: Unable to open the samples file "<<filename_.c_str();
|
||||
}
|
||||
std::cout<<std::setprecision(16);
|
||||
std::cout<<"Processing file "<<filename_<<" containing "<<(double)size<<" [bytes] \r\n";
|
||||
if (size>0)
|
||||
{
|
||||
samples_=floor((double)size/(double)item_size())-ceil(0.1*(double)sampling_frequency_); //process all the samples available in the file excluding the last 100 ms
|
||||
if (samples_ == 0)
|
||||
{
|
||||
/*!
|
||||
* BUG workaround: The GNURadio file source does not stop the receiver after reaching the End of File.
|
||||
* A possible solution is to compute the file length in samples using file size, excluding the last 100 milliseconds, and enable always the
|
||||
* valve block
|
||||
*/
|
||||
std::ifstream file (filename_.c_str(), std::ios::in | std::ios::binary | std::ios::ate);
|
||||
std::ifstream::pos_type size;
|
||||
if (file.is_open())
|
||||
{
|
||||
size = file.tellg();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "file_signal_source: Unable to open the samples file " << filename_.c_str() << std::endl;
|
||||
LOG_AT_LEVEL(ERROR) << "file_signal_source: Unable to open the samples file " << filename_.c_str();
|
||||
}
|
||||
std::cout << std::setprecision(16);
|
||||
std::cout <<"Processing file " << filename_ << ", which contains " << (double)size << " [bytes]" << std::endl;
|
||||
if (size > 0)
|
||||
{
|
||||
samples_ = floor((double)size / (double)item_size()) - ceil(0.1 * (double)sampling_frequency_); //process all the samples available in the file excluding the last 100 ms
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
double signal_duration_s;
|
||||
signal_duration_s=(double)samples_*(1/(double)sampling_frequency_);
|
||||
DLOG(INFO)<<"Total samples to be processed="<<samples_<<" GNSS signal duration= "<<signal_duration_s<<" [s]";
|
||||
std::cout<<"GNSS signal recorded time to be processed: "<<signal_duration_s<<" [s]\r\n";
|
||||
signal_duration_s = (double)samples_ * ( 1 /(double)sampling_frequency_);
|
||||
DLOG(INFO) << "Total samples to be processed= "<< samples_ << " GNSS signal duration= " << signal_duration_s << " [s]";
|
||||
std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]" << std::endl;
|
||||
// if samples != 0 then enable a flow valve to stop the process after n samples
|
||||
if (samples_ != 0)
|
||||
{
|
||||
valve_ = gnss_sdr_make_valve(item_size_, samples_, queue_);
|
||||
DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
|
||||
}
|
||||
{
|
||||
valve_ = gnss_sdr_make_valve(item_size_, samples_, queue_);
|
||||
DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
|
||||
}
|
||||
|
||||
if (dump_)
|
||||
{
|
||||
sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str());
|
||||
DLOG(INFO) << "file_sink(" << sink_->unique_id() << ")";
|
||||
}
|
||||
{
|
||||
sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str());
|
||||
DLOG(INFO) << "file_sink(" << sink_->unique_id() << ")";
|
||||
}
|
||||
|
||||
if (enable_throttle_control_)
|
||||
{
|
||||
throttle_ = gr_make_throttle(item_size_, sampling_frequency_);
|
||||
}
|
||||
{
|
||||
throttle_ = gr_make_throttle(item_size_, sampling_frequency_);
|
||||
}
|
||||
DLOG(INFO) << "File source filename " << filename_;
|
||||
DLOG(INFO) << "Samples " << samples_;
|
||||
DLOG(INFO) << "Sampling frequency " << sampling_frequency_;
|
||||
@ -151,132 +148,152 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration,
|
||||
DLOG(INFO) << "Repeat " << repeat_;
|
||||
DLOG(INFO) << "Dump " << dump_;
|
||||
DLOG(INFO) << "Dump filename " << dump_filename_;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
FileSignalSource::~FileSignalSource()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
|
||||
|
||||
void FileSignalSource::connect(gr_top_block_sptr top_block)
|
||||
{
|
||||
if (samples_ != 0)
|
||||
{
|
||||
if (enable_throttle_control_ == true)
|
||||
{
|
||||
top_block->connect(file_source_, 0, throttle_, 0);
|
||||
DLOG(INFO) << "connected file source to throttle";
|
||||
top_block->connect(throttle_, 0, valve_, 0);
|
||||
DLOG(INFO) << "connected throttle to valve";
|
||||
if (dump_)
|
||||
{
|
||||
top_block->connect(valve_, 0, sink_, 0);
|
||||
DLOG(INFO) << "connected valve to file sink";
|
||||
}
|
||||
if (enable_throttle_control_ == true)
|
||||
{
|
||||
top_block->connect(file_source_, 0, throttle_, 0);
|
||||
DLOG(INFO) << "connected file source to throttle";
|
||||
top_block->connect(throttle_, 0, valve_, 0);
|
||||
DLOG(INFO) << "connected throttle to valve";
|
||||
if (dump_)
|
||||
{
|
||||
top_block->connect(valve_, 0, sink_, 0);
|
||||
DLOG(INFO) << "connected valve to file sink";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
top_block->connect(file_source_, 0, valve_, 0);
|
||||
DLOG(INFO) << "connected file source to valve";
|
||||
if (dump_)
|
||||
{
|
||||
top_block->connect(valve_, 0, sink_, 0);
|
||||
DLOG(INFO) << "connected valve to file sink";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
top_block->connect(file_source_, 0, valve_, 0);
|
||||
DLOG(INFO) << "connected file source to valve";
|
||||
if (dump_)
|
||||
{
|
||||
top_block->connect(valve_, 0, sink_, 0);
|
||||
DLOG(INFO) << "connected valve to file sink";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (enable_throttle_control_ == true)
|
||||
{
|
||||
top_block->connect(file_source_, 0, throttle_, 0);
|
||||
DLOG(INFO) << "connected file source to throttle";
|
||||
if (dump_)
|
||||
{
|
||||
top_block->connect(file_source_, 0, sink_, 0);
|
||||
DLOG(INFO) << "connected file source to sink";
|
||||
}
|
||||
if (enable_throttle_control_ == true)
|
||||
{
|
||||
top_block->connect(file_source_, 0, throttle_, 0);
|
||||
DLOG(INFO) << "connected file source to throttle";
|
||||
if (dump_)
|
||||
{
|
||||
top_block->connect(file_source_, 0, sink_, 0);
|
||||
DLOG(INFO) << "connected file source to sink";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dump_)
|
||||
{
|
||||
top_block->connect(file_source_, 0, sink_, 0);
|
||||
DLOG(INFO) << "connected file source to sink";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dump_)
|
||||
{
|
||||
top_block->connect(file_source_, 0, sink_, 0);
|
||||
DLOG(INFO) << "connected file source to sink";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void FileSignalSource::disconnect(gr_top_block_sptr top_block)
|
||||
{
|
||||
if (samples_ != 0)
|
||||
{
|
||||
if (enable_throttle_control_ == true)
|
||||
{
|
||||
top_block->disconnect(file_source_, 0, throttle_, 0);
|
||||
DLOG(INFO) << "disconnected file source to throttle";
|
||||
top_block->disconnect(throttle_, 0, valve_, 0);
|
||||
DLOG(INFO) << "disconnected throttle to valve";
|
||||
if (dump_)
|
||||
{
|
||||
top_block->disconnect(valve_, 0, sink_, 0);
|
||||
DLOG(INFO) << "disconnected valve to file sink";
|
||||
}
|
||||
if (enable_throttle_control_ == true)
|
||||
{
|
||||
top_block->disconnect(file_source_, 0, throttle_, 0);
|
||||
DLOG(INFO) << "disconnected file source to throttle";
|
||||
top_block->disconnect(throttle_, 0, valve_, 0);
|
||||
DLOG(INFO) << "disconnected throttle to valve";
|
||||
if (dump_)
|
||||
{
|
||||
top_block->disconnect(valve_, 0, sink_, 0);
|
||||
DLOG(INFO) << "disconnected valve to file sink";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
top_block->disconnect(file_source_, 0, valve_, 0);
|
||||
DLOG(INFO) << "disconnected file source to valve";
|
||||
if (dump_)
|
||||
{
|
||||
top_block->disconnect(valve_, 0, sink_, 0);
|
||||
DLOG(INFO) << "disconnected valve to file sink";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
top_block->disconnect(file_source_, 0, valve_, 0);
|
||||
DLOG(INFO) << "disconnected file source to valve";
|
||||
if (dump_)
|
||||
{
|
||||
top_block->disconnect(valve_, 0, sink_, 0);
|
||||
DLOG(INFO) << "disconnected valve to file sink";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (enable_throttle_control_ == true)
|
||||
{
|
||||
top_block->disconnect(file_source_, 0, throttle_, 0);
|
||||
DLOG(INFO) << "disconnected file source to throttle";
|
||||
if (dump_)
|
||||
{
|
||||
top_block->disconnect(file_source_, 0, sink_, 0);
|
||||
DLOG(INFO) << "disconnected file source to sink";
|
||||
}
|
||||
if (enable_throttle_control_ == true)
|
||||
{
|
||||
top_block->disconnect(file_source_, 0, throttle_, 0);
|
||||
DLOG(INFO) << "disconnected file source to throttle";
|
||||
if (dump_)
|
||||
{
|
||||
top_block->disconnect(file_source_, 0, sink_, 0);
|
||||
DLOG(INFO) << "disconnected file source to sink";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dump_)
|
||||
{
|
||||
top_block->disconnect(file_source_, 0, sink_, 0);
|
||||
DLOG(INFO) << "disconnected file source to sink";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dump_)
|
||||
{
|
||||
top_block->disconnect(file_source_, 0, sink_, 0);
|
||||
DLOG(INFO) << "disconnected file source to sink";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
gr_basic_block_sptr FileSignalSource::get_left_block()
|
||||
{
|
||||
LOG_AT_LEVEL(WARNING)
|
||||
<< "Left block of a signal source should not be retrieved";
|
||||
<< "Left block of a signal source should not be retrieved";
|
||||
return gr_block_sptr();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
gr_basic_block_sptr FileSignalSource::get_right_block()
|
||||
{
|
||||
if (samples_ != 0)
|
||||
{
|
||||
return valve_;
|
||||
}else
|
||||
{
|
||||
if (enable_throttle_control_ == true)
|
||||
{
|
||||
return throttle_;
|
||||
}else{
|
||||
return file_source_;
|
||||
}
|
||||
}
|
||||
if (samples_ != 0)
|
||||
{
|
||||
return valve_;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (enable_throttle_control_ == true)
|
||||
{
|
||||
return throttle_;
|
||||
}
|
||||
else
|
||||
{
|
||||
return file_source_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc(Gnss_Satell
|
||||
d_carrier_loop_filter.set_params(fll_bw_hz,pll_bw_hz,order);
|
||||
|
||||
// Get space for a vector with the C/A code replica sampled 1x/chip
|
||||
d_ca_code = new gr_complex[(int)GPS_L1_CA_CODE_LENGTH_CHIPS+2];
|
||||
d_ca_code = new gr_complex[(int)GPS_L1_CA_CODE_LENGTH_CHIPS + 2];
|
||||
|
||||
// Get space for the resampled early / prompt / late local replicas
|
||||
//d_early_code = new gr_complex[d_vector_length*2];
|
||||
@ -116,10 +116,16 @@ Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc(Gnss_Satell
|
||||
// space for carrier wipeoff LO vector
|
||||
//d_carr_sign = new gr_complex[d_vector_length*2];
|
||||
|
||||
posix_memalign((void**)&d_early_code, 16, d_vector_length*sizeof(gr_complex)*2);
|
||||
posix_memalign((void**)&d_late_code, 16, d_vector_length*sizeof(gr_complex)*2);
|
||||
posix_memalign((void**)&d_prompt_code, 16, d_vector_length*sizeof(gr_complex)*2);
|
||||
posix_memalign((void**)&d_carr_sign,16, d_vector_length*sizeof(gr_complex)*2);
|
||||
/* If an array is partitioned for more than one thread to operate on,
|
||||
* having the sub-array boundaries unaligned to cache lines could lead
|
||||
* to performance degradation. Here we allocate memory
|
||||
* (gr_comlex array of size 2*d_vector_length) aligned to cache of 16 bytes
|
||||
*/
|
||||
// todo: do something if posix_memalign fails
|
||||
if (posix_memalign((void**)&d_early_code, 16, d_vector_length * sizeof(gr_complex) * 2) == 0){};
|
||||
if (posix_memalign((void**)&d_late_code, 16, d_vector_length * sizeof(gr_complex) * 2) == 0){};
|
||||
if (posix_memalign((void**)&d_prompt_code, 16, d_vector_length * sizeof(gr_complex) * 2) == 0){};
|
||||
if (posix_memalign((void**)&d_carr_sign, 16, d_vector_length * sizeof(gr_complex) * 2) == 0){};
|
||||
|
||||
// sample synchronization
|
||||
d_sample_counter = 0;
|
||||
@ -138,7 +144,6 @@ Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc(Gnss_Satell
|
||||
d_CN0_SNV_dB_Hz = 0;
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_carrier_lock_threshold = 5;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -213,7 +218,9 @@ void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::start_tracking()
|
||||
d_pull_in = true;
|
||||
d_enable_tracking = true;
|
||||
|
||||
std::cout << "PULL-IN Doppler [Hz]= " << d_carrier_doppler_hz << " Code Phase correction [samples]=" << delay_correction_samples << " PULL-IN Code Phase [samples]= " << d_acq_code_phase_samples << std::endl;
|
||||
std::cout << "PULL-IN Doppler [Hz]= " << d_carrier_doppler_hz
|
||||
<< " Code Phase correction [samples]=" << delay_correction_samples
|
||||
<< " PULL-IN Code Phase [samples]= " << d_acq_code_phase_samples << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@ -271,10 +278,6 @@ Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::~Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc()
|
||||
d_dump_file.close();
|
||||
delete[] d_ca_code;
|
||||
|
||||
//delete[] d_early_code;
|
||||
//delete[] d_prompt_code;
|
||||
//delete[] d_late_code;
|
||||
//delete[] d_carr_sign;
|
||||
free(d_prompt_code);
|
||||
free(d_late_code);
|
||||
free(d_early_code);
|
||||
@ -292,14 +295,6 @@ Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::~Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc()
|
||||
int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||
{
|
||||
// if ((unsigned int)ninput_items[0]<(d_vector_length*2))
|
||||
// {
|
||||
// std::cout<<"End of signal detected\r\n";
|
||||
// const int samples_available = ninput_items[0];
|
||||
// consume_each(samples_available);
|
||||
// return 0;
|
||||
// }
|
||||
// process vars
|
||||
float code_error_chips = 0;
|
||||
float correlation_time_s = 0;
|
||||
float PLL_discriminator_hz = 0;
|
||||
@ -318,26 +313,21 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
|
||||
if (d_pull_in == true)
|
||||
{
|
||||
int samples_offset;
|
||||
|
||||
// 28/11/2011 ACQ to TRK transition BUG CORRECTION
|
||||
float acq_trk_shif_correction_samples;
|
||||
int acq_to_trk_delay_samples;
|
||||
acq_to_trk_delay_samples = d_sample_counter-d_acq_sample_stamp;
|
||||
acq_trk_shif_correction_samples = d_next_prn_length_samples - fmod((float)acq_to_trk_delay_samples, (float)d_next_prn_length_samples);
|
||||
//std::cout<<"acq_trk_shif_correction="<<acq_trk_shif_correction_samples<<"\r\n";
|
||||
|
||||
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
|
||||
// /todo: Check if the sample counter sent to the next block as a time reference should be incremented AFTER sended or BEFORE
|
||||
d_sample_counter_seconds = d_sample_counter_seconds + (((double)samples_offset)/(double)d_fs_in);
|
||||
d_sample_counter = d_sample_counter + samples_offset; //count for the processed samples
|
||||
d_pull_in = false;
|
||||
//std::cout<<" samples_offset="<<samples_offset<<"\r\n";
|
||||
consume_each(samples_offset); //shift input to perform alignment with local replica
|
||||
return 1;
|
||||
}
|
||||
// get the sample in and out pointers
|
||||
const gr_complex* in = (gr_complex*) input_items[0]; //block input samples pointer
|
||||
double **out = (double **) &output_items[0]; //block output streams pointer
|
||||
double **out = (double **) &output_items[0]; //block output streams pointer
|
||||
|
||||
// check for samples consistency (this should be done before in the receiver / here only if the source is a file)
|
||||
for(int i=0; i<d_current_prn_length_samples; i++)
|
||||
@ -359,14 +349,14 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
|
||||
update_local_code();
|
||||
update_local_carrier();
|
||||
|
||||
|
||||
gr_complex* E_out;
|
||||
gr_complex* P_out;
|
||||
gr_complex* L_out;
|
||||
|
||||
posix_memalign((void**)&E_out, 16, 8);
|
||||
posix_memalign((void**)&P_out, 16, 8);
|
||||
posix_memalign((void**)&L_out, 16, 8);
|
||||
// TODO: do something if posix_memalign fails
|
||||
if (posix_memalign((void**)&E_out, 16, 8) == 0){};
|
||||
if (posix_memalign((void**)&P_out, 16, 8) == 0){};
|
||||
if (posix_memalign((void**)&L_out, 16, 8) == 0){};
|
||||
|
||||
// perform Early, Prompt and Late correlation
|
||||
d_correlator.Carrier_wipeoff_and_EPL_volk(d_current_prn_length_samples,
|
||||
@ -385,18 +375,7 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
|
||||
free(E_out);
|
||||
free(P_out);
|
||||
free(L_out);
|
||||
/*
|
||||
gr_complex bb_signal_sample(0,0);
|
||||
for(int i=0; i<d_current_prn_length_samples; i++)
|
||||
{
|
||||
//Perform the carrier wipe-off
|
||||
bb_signal_sample = in[i] * d_carr_sign[i];
|
||||
// Now get early, late, and prompt correlation values
|
||||
d_Early += bb_signal_sample * d_early_code[i];
|
||||
d_Prompt += bb_signal_sample * d_prompt_code[i];
|
||||
d_Late += bb_signal_sample * d_late_code[i];
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
* DLL, FLL, and PLL discriminators
|
||||
*/
|
||||
@ -418,16 +397,16 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
|
||||
}
|
||||
|
||||
// Compute PLL error
|
||||
PLL_discriminator_hz = pll_cloop_two_quadrant_atan(d_Prompt)/(float)TWO_PI;
|
||||
PLL_discriminator_hz = pll_cloop_two_quadrant_atan(d_Prompt) / (float)TWO_PI;
|
||||
|
||||
/*!
|
||||
/*
|
||||
* \todo Update FLL assistance algorithm!
|
||||
*/
|
||||
if (((float)d_sample_counter - (float)d_acq_sample_stamp)/(float)d_fs_in>3)
|
||||
if ((((float)d_sample_counter - (float)d_acq_sample_stamp) / (float)d_fs_in) > 3)
|
||||
{
|
||||
d_FLL_discriminator_hz = 0; //disconnect the FLL after the initial lock
|
||||
}
|
||||
/*!
|
||||
/*
|
||||
* DLL and FLL+PLL filter and get current carrier Doppler and code frequency
|
||||
*/
|
||||
carr_nco_hz = d_carrier_loop_filter.get_carrier_error(d_FLL_discriminator_hz, PLL_discriminator_hz, correlation_time_s);
|
||||
@ -466,9 +445,7 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
|
||||
d_channel_internal_queue->push(tracking_message);
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||
|
||||
}
|
||||
//std::cout<<"d_carrier_lock_fail_counter"<<d_carrier_lock_fail_counter<<"\r\n";
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -65,10 +65,10 @@ float gps_l1_ca_CN0_SNV(gr_complex* Prompt_buffer, int length, long fs_in)
|
||||
{
|
||||
// estimate CN0 using buffered values
|
||||
// MATLAB CODE
|
||||
//Psig=((1/N)*sum(abs(imag(x((n-N+1):n)))))^2;
|
||||
//Ptot=(1/N)*sum(abs(x((n-N+1):n)).^2);
|
||||
//SNR_SNV(count)=Psig/(Ptot-Psig);
|
||||
//CN0_SNV_dB=10*log10(SNR_SNV)+10*log10(BW)-10*log10(PRN_length);
|
||||
// Psig=((1/N)*sum(abs(imag(x((n-N+1):n)))))^2;
|
||||
// Ptot=(1/N)*sum(abs(x((n-N+1):n)).^2);
|
||||
// SNR_SNV(count)=Psig/(Ptot-Psig);
|
||||
// CN0_SNV_dB=10*log10(SNR_SNV)+10*log10(BW)-10*log10(PRN_length);
|
||||
float SNR, SNR_dB_Hz;
|
||||
float tmp_abs_I, tmp_abs_Q;
|
||||
float Psig, Ptot;
|
||||
@ -80,12 +80,12 @@ float gps_l1_ca_CN0_SNV(gr_complex* Prompt_buffer, int length, long fs_in)
|
||||
tmp_abs_I = std::abs(Prompt_buffer[i].imag());
|
||||
tmp_abs_Q = std::abs(Prompt_buffer[i].real());
|
||||
Psig += tmp_abs_I;
|
||||
Ptot += Prompt_buffer[i].imag()*Prompt_buffer[i].imag() + Prompt_buffer[i].real()*Prompt_buffer[i].real();
|
||||
Ptot += Prompt_buffer[i].imag() * Prompt_buffer[i].imag() + Prompt_buffer[i].real() * Prompt_buffer[i].real();
|
||||
}
|
||||
Psig = Psig / (float)length;
|
||||
Psig = Psig*Psig;
|
||||
Psig = Psig * Psig;
|
||||
SNR = Psig / (Ptot / (float)length - Psig);
|
||||
SNR_dB_Hz = 10*log10(SNR) + 10*log10(fs_in/2) - 10*log10(GPS_L1_CA_CODE_LENGTH_CHIPS);
|
||||
SNR_dB_Hz = 10 * log10(SNR) + 10 * log10(fs_in/2) - 10 * log10(GPS_L1_CA_CODE_LENGTH_CHIPS);
|
||||
return SNR_dB_Hz;
|
||||
}
|
||||
|
||||
@ -100,22 +100,22 @@ float gps_l1_ca_CN0_SNV(gr_complex* Prompt_buffer, int length, long fs_in)
|
||||
*/
|
||||
float carrier_lock_detector(gr_complex* Prompt_buffer, int length)
|
||||
{
|
||||
/*!
|
||||
* \todo Code lock detector
|
||||
/*
|
||||
* Code lock detector
|
||||
*/
|
||||
// estimate using buffered values
|
||||
// MATLAB CODE
|
||||
// lock detector operation
|
||||
//NBD=sum(abs(imag(x((n-N+1):n))))^2 + sum(abs(real(x((n-N+1):n))))^2;
|
||||
//NBP=sum(imag(x((n-N+1):n)).^2) - sum(real(x((n-N+1):n)).^2);
|
||||
//LOCK(count)=NBD/NBP;
|
||||
// NBD=sum(abs(imag(x((n-N+1):n))))^2 + sum(abs(real(x((n-N+1):n))))^2;
|
||||
// NBP=sum(imag(x((n-N+1):n)).^2) - sum(real(x((n-N+1):n)).^2);
|
||||
// LOCK(count)=NBD/NBP;
|
||||
float tmp_abs_I, tmp_abs_Q;
|
||||
float tmp_sum_abs_I, tmp_sum_abs_Q;
|
||||
float tmp_sum_sqr_I, tmp_sum_sqr_Q;
|
||||
tmp_sum_abs_I=0;
|
||||
tmp_sum_abs_Q=0;
|
||||
tmp_sum_sqr_I=0;
|
||||
tmp_sum_sqr_Q=0;
|
||||
tmp_sum_abs_I = 0;
|
||||
tmp_sum_abs_Q = 0;
|
||||
tmp_sum_sqr_I = 0;
|
||||
tmp_sum_sqr_Q = 0;
|
||||
float NBD,NBP;
|
||||
for (int i=0; i<length; i++)
|
||||
{
|
||||
@ -123,10 +123,10 @@ float carrier_lock_detector(gr_complex* Prompt_buffer, int length)
|
||||
tmp_abs_Q = std::abs(Prompt_buffer[i].real());
|
||||
tmp_sum_abs_I += tmp_abs_I;
|
||||
tmp_sum_abs_Q += tmp_abs_Q;
|
||||
tmp_sum_sqr_I += (Prompt_buffer[i].imag()*Prompt_buffer[i].imag());
|
||||
tmp_sum_sqr_Q += (Prompt_buffer[i].real()*Prompt_buffer[i].real());
|
||||
tmp_sum_sqr_I += (Prompt_buffer[i].imag() * Prompt_buffer[i].imag());
|
||||
tmp_sum_sqr_Q += (Prompt_buffer[i].real() * Prompt_buffer[i].real());
|
||||
}
|
||||
NBD = tmp_sum_abs_I*tmp_sum_abs_I + tmp_sum_abs_Q*tmp_sum_abs_Q;
|
||||
NBD = tmp_sum_abs_I * tmp_sum_abs_I + tmp_sum_abs_Q * tmp_sum_abs_Q;
|
||||
NBP = tmp_sum_sqr_I - tmp_sum_sqr_Q;
|
||||
return NBD/NBP;
|
||||
}
|
||||
|
@ -64,9 +64,9 @@ void correlator::Carrier_wipeoff_and_EPL_generic(int signal_length_samples,const
|
||||
//Perform the carrier wipe-off
|
||||
bb_signal_sample = input[i] * carrier[i];
|
||||
// Now get early, late, and prompt values for each
|
||||
*E_out += bb_signal_sample*E_code[i];
|
||||
*P_out += bb_signal_sample*P_code[i];
|
||||
*L_out += bb_signal_sample*L_code[i];
|
||||
*E_out += bb_signal_sample * E_code[i];
|
||||
*P_out += bb_signal_sample * P_code[i];
|
||||
*L_out += bb_signal_sample * L_code[i];
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,12 +83,12 @@ void correlator::Carrier_wipeoff_and_EPL_volk(int signal_length_samples,const gr
|
||||
//std::cout<<"length="<<signal_length_samples<<std::endl;
|
||||
|
||||
//long int new_length=next_power_2(signal_length_samples);
|
||||
|
||||
posix_memalign((void**)&bb_signal, 16, signal_length_samples * sizeof(gr_complex));
|
||||
posix_memalign((void**)&input_aligned, 16, signal_length_samples * sizeof(gr_complex));
|
||||
//todo: do something if posix_memalign fails
|
||||
if (posix_memalign((void**)&bb_signal, 16, signal_length_samples * sizeof(gr_complex)) == 0) {};
|
||||
if (posix_memalign((void**)&input_aligned, 16, signal_length_samples * sizeof(gr_complex)) == 0){};
|
||||
//posix_memalign((void**)&carrier_aligned, 16, new_length*sizeof(gr_complex));
|
||||
|
||||
memcpy(input_aligned,input,signal_length_samples*sizeof(gr_complex));
|
||||
memcpy(input_aligned,input,signal_length_samples * sizeof(gr_complex));
|
||||
//memcpy(carrier_aligned,carrier,signal_length_samples*sizeof(gr_complex));
|
||||
|
||||
volk_32fc_x2_multiply_32fc_a_manual(bb_signal, input_aligned, carrier, signal_length_samples, volk_32fc_x2_multiply_32fc_a_best_arch.c_str());
|
||||
|
@ -176,7 +176,7 @@ std::vector<GNSSBlockInterface*>* GNSSBlockFactory::GetChannels(
|
||||
ConfigurationInterface *configuration, gr_msg_queue_sptr queue)
|
||||
{
|
||||
|
||||
std::string default_implementation = "PassThrough";
|
||||
std::string default_implementation = "Pass_Through";
|
||||
unsigned int channel_count =
|
||||
configuration->property("Channels.count", 12);
|
||||
std::vector<GNSSBlockInterface*>* channels = new std::vector<
|
||||
@ -242,7 +242,7 @@ GNSSBlockInterface* GNSSBlockFactory::GetBlock(
|
||||
|
||||
else if (implementation.compare("Pass_Through") == 0)
|
||||
{
|
||||
block = new PassThrough(configuration, role, in_streams, out_streams);
|
||||
block = new Pass_Through(configuration, role, in_streams, out_streams);
|
||||
|
||||
}
|
||||
|
||||
|
@ -442,10 +442,10 @@ void GNSSFlowgraph::set_satellites_list()
|
||||
{
|
||||
|
||||
/*
|
||||
* Sets a sequential list of satellites (1...33)
|
||||
* Sets a sequential list of satellites (1...32)
|
||||
*/
|
||||
|
||||
/*!
|
||||
/*
|
||||
* \TODO Describe GNSS satellites more nicely, with RINEX notation
|
||||
* See http://igscb.jpl.nasa.gov/igscb/data/format/rinex301.pdf (page 5)
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
build-project algorithms ;
|
||||
build-project core ;
|
||||
build-project main ;
|
||||
# build-project tests ;
|
||||
build-project tests ;
|
||||
|
||||
|
@ -1,50 +0,0 @@
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <cstdlib>
|
||||
|
||||
#include <gsl/gsl_complex.h>
|
||||
#include <gsl/gsl_vector.h>
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
DEFINE_int32(N, 2046, "Size of the arrays used for calculations");
|
||||
DEFINE_int32(M, 1000, "Iterations");
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Using standard GNU GSL library to perform complex arithmetic";
|
||||
|
||||
std::srand((int)time(0));
|
||||
|
||||
gsl_vector_complex* input = gsl_vector_complex_alloc(FLAGS_N);
|
||||
gsl_complex zero;
|
||||
GSL_SET_COMPLEX(&zero, std::rand() % 10000, std::rand() % 10000);
|
||||
|
||||
gsl_vector_complex_set_all(input, zero);
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Begin calculations";
|
||||
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
|
||||
for(int i=0;i<FLAGS_M;i++) {
|
||||
gsl_vector_complex_mul(input, input);
|
||||
}
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
LOG_AT_LEVEL(INFO) << "Finished in " << (end - begin) << " microseconds";
|
||||
}
|
@ -1,45 +1,73 @@
|
||||
/*!
|
||||
* \file complex_arithmetic_libc.cc
|
||||
* \brief This file implements a unit test for multiplication of long arrays.
|
||||
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||
* Carles Fernandez-Prades, 2012. cfernandez(at)cttc.es
|
||||
*
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <gflags/gflags.h>
|
||||
#include <complex>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
DEFINE_int32(size, 100000, "Size of the arrays used for calculations");
|
||||
DEFINE_int32(size_multiply_test, 100000, "Size of the arrays used for calculations");
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
TEST(Multiply_Test, StandardCImplementation)
|
||||
{
|
||||
//LOG_AT_LEVEL(INFO) << "Using standard C++ library implementation to perform complex arithmetic";
|
||||
std::complex<float>* input = new std::complex<float>[FLAGS_size_multiply_test];
|
||||
std::complex<float>* output = new std::complex<float>[FLAGS_size_multiply_test];
|
||||
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
memset(input, 0, sizeof(std::complex<float>) * FLAGS_size_multiply_test);
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Using standard C++ library implementation to perform complex arithmetic";
|
||||
//LOG_AT_LEVEL(INFO) << "Allocated two vectors containing " << FLAGS_size << " complex numbers";
|
||||
//LOG_AT_LEVEL(INFO) << "Begin multiplications";
|
||||
|
||||
std::complex<float>* input = new std::complex<float>[FLAGS_size];
|
||||
std::complex<float>* output = new std::complex<float>[FLAGS_size];
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
|
||||
memset(input, 0, sizeof(std::complex<float>)*FLAGS_size);
|
||||
for(int i=0; i<FLAGS_size_multiply_test; i++)
|
||||
{
|
||||
output[i] = input[i] * input[i];
|
||||
}
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Allocated two vectors containing " << FLAGS_size << " complex numbers";
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Begin multiplications";
|
||||
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
|
||||
for(int i=0;i<FLAGS_size;i++) {
|
||||
output[i] = input[i] * input[i];
|
||||
}
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
LOG_AT_LEVEL(INFO) << "Finished in " << (end - begin) << " microseconds";
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
// LOG_AT_LEVEL(INFO) << "Finished in " << (end - begin) << " microseconds";
|
||||
std::cout << "Multiplication of "<< FLAGS_size_multiply_test << " complex<float> finished in " << (end - begin) << " microseconds" << std::endl;
|
||||
}
|
||||
|
@ -1,49 +0,0 @@
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "gps_sdr_simd.h"
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
DEFINE_int32(N, 2046, "Size of the arrays used for calculations");
|
||||
DEFINE_int32(M, 1000, "Iterations");
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Using standard SIMD implementation (GPS-SDR) to perform complex arithmetic";
|
||||
|
||||
std::srand((int)time(0));
|
||||
CPX* input = new CPX[FLAGS_N];
|
||||
|
||||
for(int i=0;i<FLAGS_N;i++) {
|
||||
input[i].i = std::rand() % 10000;
|
||||
input[i].q = std::rand() % 10000;
|
||||
}
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Begin calculations";
|
||||
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
|
||||
for(int i=0;i<FLAGS_M;i++) {
|
||||
sse_cmul(input, input, FLAGS_N);
|
||||
}
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
LOG_AT_LEVEL(INFO) << "Finished in " << (end - begin) << " microseconds";
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
#include <sys/time.h>
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
|
||||
#include <gsl/gsl_complex.h>
|
||||
#include <gsl/gsl_vector.h>
|
||||
#include <gsl/gsl_blas.h>
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
DEFINE_int32(N, 2046, "Samples per milisecond of signal");
|
||||
DEFINE_int32(M, 6000, "Number of correlations per GNSS-SDR channel");
|
||||
DEFINE_int32(C, 12, "Number of channels to simulate");
|
||||
DEFINE_string(data_type, "complex", "Data type for samples");
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
|
||||
int correlations = FLAGS_M * FLAGS_C;
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Simulating " << FLAGS_C << " channels";
|
||||
LOG_AT_LEVEL(INFO) << FLAGS_M << " correlations per channel";
|
||||
LOG_AT_LEVEL(INFO) << "Performing " << correlations << " correlations";
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Testing GNU GSL library using float complex numbers";
|
||||
|
||||
std::srand((unsigned)time(0));
|
||||
|
||||
gsl_vector_complex* input = gsl_vector_complex_alloc(FLAGS_N);
|
||||
gsl_vector_complex* ones = gsl_vector_complex_alloc(FLAGS_N);
|
||||
gsl_complex random;
|
||||
gsl_complex one;
|
||||
gsl_complex sum;
|
||||
GSL_SET_COMPLEX(&one, 1, 1);
|
||||
GSL_SET_COMPLEX(&sum, 1, 1);
|
||||
GSL_SET_COMPLEX(&random, std::rand() % 10000, std::rand() % 10000);
|
||||
|
||||
gsl_vector_complex_set_all(input, random);
|
||||
gsl_vector_complex_set_all(ones, one);
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Begin Calculations";
|
||||
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
|
||||
for(int i=0;i<correlations; i++) {
|
||||
gsl_vector_complex_mul(input, input);
|
||||
gsl_vector_complex_mul(input, input);
|
||||
gsl_blas_zdotc(input, ones, &sum);
|
||||
}
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
LOG_AT_LEVEL(INFO) << "Finished in " << (end - begin) << " microseconds";
|
||||
}
|
@ -1,62 +1,92 @@
|
||||
/*!
|
||||
* \file correlations_libc.cc
|
||||
* \brief This file implements a unit test for correlation
|
||||
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||
* Carles Fernandez-Prades, 2012. cfernandez(at)cttc.es
|
||||
*
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <complex>
|
||||
#include <sys/time.h>
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
DEFINE_int32(N, 2046, "Samples per milisecond of signal");
|
||||
DEFINE_int32(M, 6000, "Number of correlations per GNSS-SDR channel");
|
||||
DEFINE_int32(N, 2046, "Samples per millisecond of signal");
|
||||
DEFINE_int32(M, 3, "Number of correlations per GNSS-SDR channel");
|
||||
DEFINE_int32(C, 12, "Number of channels to simulate");
|
||||
DEFINE_string(data_type, "complex", "Data type for samples");
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
TEST(Correlation_Test, StandardCImplementation)
|
||||
{
|
||||
int correlations = FLAGS_M * FLAGS_C;
|
||||
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
//LOG_AT_LEVEL(INFO) << "Simulating " << FLAGS_C << " channels";
|
||||
//LOG_AT_LEVEL(INFO) << FLAGS_M << " correlations per channel";
|
||||
//LOG_AT_LEVEL(INFO) << "Performing " << correlations << " correlations";
|
||||
//LOG_AT_LEVEL(INFO) << "Testing standard C++ library using complex numbers";
|
||||
|
||||
int correlations = FLAGS_M * FLAGS_C;
|
||||
std::complex<float>* input = new std::complex<float>[FLAGS_N];
|
||||
std::complex<float> accum;
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Simulating " << FLAGS_C << " channels";
|
||||
LOG_AT_LEVEL(INFO) << FLAGS_M << " correlations per channel";
|
||||
LOG_AT_LEVEL(INFO) << "Performing " << correlations << " correlations";
|
||||
std::srand((unsigned)time(0));
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Testing standard C++ library using complex numbers";
|
||||
for(int i=0; i < FLAGS_N; i++)
|
||||
{
|
||||
input[i] = std::complex<float>(std::rand() % 10000, std::rand() % 10000);
|
||||
}
|
||||
|
||||
std::complex<float>* input = new std::complex<float>[FLAGS_N];
|
||||
std::complex<float> accum;
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
|
||||
std::srand((unsigned)time(0));
|
||||
for(int i=0; i<correlations; i++)
|
||||
{
|
||||
for(int j=0; j < FLAGS_N; j++)
|
||||
{
|
||||
input[j] = input[j] * input[j];
|
||||
input[j] = input[j] * input[j];
|
||||
accum += input[j];
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0;i<FLAGS_N;i++) {
|
||||
input[i] = std::complex<float>(std::rand() % 10000, std::rand() % 10000);
|
||||
}
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Begin Calculations";
|
||||
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
|
||||
for(int i=0;i<correlations; i++) {
|
||||
for(int j=0;j<FLAGS_N;j++) {
|
||||
input[j] = input[j]*input[j];
|
||||
input[j] = input[j]*input[j];
|
||||
accum += input[j];
|
||||
}
|
||||
}
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
LOG_AT_LEVEL(INFO) << "Finished in " << (end - begin) << " microseconds";
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int end = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
std::cout << correlations << " correlations of " << FLAGS_N
|
||||
<< "-length vectors computed in " << (end - begin)
|
||||
<< " microseconds" << std::endl;
|
||||
}
|
||||
|
@ -1,118 +0,0 @@
|
||||
#include <sys/time.h>
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
|
||||
#include "gps_sdr_simd.h"
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
DEFINE_int32(N, 2046, "Samples per milisecond of signal");
|
||||
DEFINE_int32(M, 6000, "Number of correlations per GNSS-SDR channel");
|
||||
DEFINE_int32(C, 12, "Number of channels to simulate");
|
||||
DEFINE_string(data_type, "complex", "Data type for samples");
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
|
||||
int correlations = FLAGS_M * FLAGS_C;
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Simulating " << FLAGS_C << " channels";
|
||||
LOG_AT_LEVEL(INFO) << FLAGS_M << " correlations per channel";
|
||||
LOG_AT_LEVEL(INFO) << "Performing " << correlations << " correlations";
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Testing GPS SDR SIMD library using CPX struct";
|
||||
|
||||
std::srand((unsigned)time(0));
|
||||
|
||||
CPX* input = new CPX[FLAGS_N];
|
||||
|
||||
for (int i=0;i<FLAGS_N;i++) {
|
||||
input[i].i = std::rand() % 10000;
|
||||
input[i].q = std::rand() % 10000;
|
||||
}
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Begin Calculations";
|
||||
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
|
||||
for(int i=0;i<correlations; i++) {
|
||||
sse_cmul(input, input, FLAGS_N);
|
||||
sse_cmul(input, input, FLAGS_N);
|
||||
}
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
LOG_AT_LEVEL(INFO) << "Finished in " << (end - begin) << " microseconds";
|
||||
}
|
||||
|
||||
|
||||
//void test_gsl_complex() {
|
||||
|
||||
// LOG_AT_LEVEL(INFO) << "Testing GNU GSL library usign gsl_complex";
|
||||
//
|
||||
// gsl_vector_complex* input = gsl_vector_complex_alloc(FLAGS_N);
|
||||
// gsl_vector_complex* ones = gsl_vector_complex_alloc(FLAGS_N);
|
||||
// gsl_complex one;
|
||||
// gsl_complex sum;
|
||||
// GSL_SET_COMPLEX(&one, 1, 1);
|
||||
// GSL_SET_COMPLEX(&sum, 1, 1);
|
||||
//
|
||||
// std::srand((unsigned)time(0));
|
||||
//
|
||||
// for(int i=0;i<FLAGS_N;i++) {
|
||||
// gsl_vector_complex_set(input, i, std::rand() % 10000);
|
||||
// }
|
||||
//
|
||||
// gsl_vector_complex_set_all(ones, one);
|
||||
//
|
||||
// LOG_AT_LEVEL(INFO) << "Begin Calculations";
|
||||
//
|
||||
// struct timeval tv;
|
||||
// gettimeofday(&tv, NULL);
|
||||
// long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
//
|
||||
// for(int i=0;i<FLAGS_M;i++) {
|
||||
// gsl_vector_complex_mul(input, input);
|
||||
// gsl_vector_complex_mul(input, input);
|
||||
// }
|
||||
//
|
||||
// gettimeofday(&tv, NULL);
|
||||
// long long int end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
// LOG_AT_LEVEL(INFO) << "Finished in " << (end - begin) << " microseconds";
|
||||
//}
|
||||
|
||||
//void test_gps_sdr_simd() {
|
||||
|
||||
// LOG_AT_LEVEL(INFO) << "Testing GPS SDR SIMD library";
|
||||
//
|
||||
// CPX* input = new CPX[FLAGS_N];
|
||||
// memset(input, 0, FLAGS_N);
|
||||
//
|
||||
// LOG_AT_LEVEL(INFO) << "Begin Calculations";
|
||||
//
|
||||
// struct timeval tv;
|
||||
// gettimeofday(&tv, NULL);
|
||||
// long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
//
|
||||
// for(int i=0;i<FLAGS_M;i++) {
|
||||
// sse_cmul(input, input, FLAGS_N);
|
||||
// }
|
||||
//
|
||||
// gettimeofday(&tv, NULL);
|
||||
// long long int end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
// LOG_AT_LEVEL(INFO) << "Finished in " << (end - begin) << " microseconds";
|
||||
//}
|
||||
|
@ -1,42 +0,0 @@
|
||||
obj complex_arithmetic_gsl : complex_arithmetic_gsl.cc ;
|
||||
|
||||
exe complex_arithmetic_gsl_blas :
|
||||
.//complex_arithmetic_gsl
|
||||
../../..//glog
|
||||
../../..//gflags
|
||||
../../..//gsl
|
||||
../../..//gslcblas :
|
||||
<define>HAVE_INLINE <define>GSL_RANGE_CHECK_OFF ;
|
||||
|
||||
exe complex_arithmetic_atlas :
|
||||
.//complex_arithmetic_gsl
|
||||
../../..//glog
|
||||
../../..//gflags
|
||||
../../..//gsl
|
||||
../../..//gslcblas :
|
||||
<define>HAVE_INLINE <define>GSL_RANGE_CHECK_OFF ;
|
||||
|
||||
exe complex_arithmetic_gotoblas2 :
|
||||
.//complex_arithmetic_gsl
|
||||
../../..//glog
|
||||
../../..//gflags
|
||||
../../..//gsl
|
||||
../../..//gslcblas :
|
||||
<define>HAVE_INLINE <define>GSL_RANGE_CHECK_OFF ;
|
||||
|
||||
exe complex_arithmetic_libc : complex_arithmetic_libc.cc
|
||||
../../..//glog
|
||||
../../..//gflags ;
|
||||
|
||||
exe complex_arithmetic_simd : complex_arithmetic_simd.cc
|
||||
../../..//glog
|
||||
../../..//gflags
|
||||
../../gps_sdr//gps_sdr_simd ;
|
||||
|
||||
|
||||
install ../../../install/tests :
|
||||
complex_arithmetic_gotoblas2
|
||||
complex_arithmetic_atlas
|
||||
complex_arithmetic_gsl_blas
|
||||
complex_arithmetic_libc
|
||||
complex_arithmetic_simd ;
|
@ -1,25 +1,46 @@
|
||||
|
||||
/**
|
||||
* Copyright notice
|
||||
*/
|
||||
|
||||
/**
|
||||
* Author: Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class implements a Unit Test for the class FileConfiguration.
|
||||
/*!
|
||||
* \file file_configuration_test.cc
|
||||
* \brief This file implements tests for the ControlMessageFactory.
|
||||
* \author Carles Fernandez-Prades, 2012. cfernandez(at)cttc.es
|
||||
*
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "file_configuration.h"
|
||||
|
||||
TEST(FileConfiguration, OverridedProperties) {
|
||||
ConfigurationInterface *configuration = new FileConfiguration("./src/tests/data/config_file_sample.txt");
|
||||
|
||||
|
||||
|
||||
TEST(File_Configuration_Test, OverridedProperties)
|
||||
{
|
||||
ConfigurationInterface *configuration = new FileConfiguration("./data/config_file_sample.txt");
|
||||
std::string default_value = "default_value";
|
||||
std::string value = configuration->property("NotThere", default_value);
|
||||
|
||||
@ -33,7 +54,10 @@ TEST(FileConfiguration, OverridedProperties) {
|
||||
delete configuration;
|
||||
}
|
||||
|
||||
TEST(FileConfiguration, LoadFromNonExistentFile) {
|
||||
|
||||
|
||||
TEST(File_Configuration_Test, LoadFromNonExistentFile)
|
||||
{
|
||||
|
||||
ConfigurationInterface *configuration = new FileConfiguration("./i_dont_exist.conf");
|
||||
std::string default_value = "default_value";
|
||||
@ -44,8 +68,12 @@ TEST(FileConfiguration, LoadFromNonExistentFile) {
|
||||
delete configuration;
|
||||
}
|
||||
|
||||
TEST(FileConfiguration, PropertyDoesNotExist) {
|
||||
ConfigurationInterface *configuration = new FileConfiguration("./src/tests/data/config_file_sample.txt");
|
||||
|
||||
|
||||
|
||||
TEST(File_Configuration_Test, PropertyDoesNotExist)
|
||||
{
|
||||
ConfigurationInterface *configuration = new FileConfiguration("./data/config_file_sample.txt");
|
||||
std::string default_value = "default_value";
|
||||
std::string value = configuration->property("whatever.whatever", default_value);
|
||||
|
||||
|
@ -1,75 +1,101 @@
|
||||
|
||||
/**
|
||||
* Copyright notice
|
||||
*/
|
||||
|
||||
/**
|
||||
* Author: Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class implements a Unit Tests for the class ControlMessageFactory.
|
||||
/*!
|
||||
* \file control message_factory_test.cc
|
||||
* \brief This file implements tests for the ControlMessageFactory.
|
||||
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||
* Carles Fernandez-Prades, 2012. cfernandez(at)cttc.es
|
||||
*
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "control_message_factory.h"
|
||||
|
||||
TEST(ControlMessageFactory, GetQueueMessage) {
|
||||
|
||||
ControlMessageFactory *factory = new ControlMessageFactory();
|
||||
|
||||
gr_message_sptr queue_message = factory->GetQueueMessage(0, 0);
|
||||
ControlMessage *control_message = (ControlMessage*)queue_message->msg();
|
||||
|
||||
EXPECT_EQ(0, control_message->who);
|
||||
EXPECT_EQ(0, control_message->what);
|
||||
EXPECT_EQ(sizeof(ControlMessage), queue_message->length());
|
||||
TEST(Control_Message_Factory_Test, GetQueueMessage)
|
||||
{
|
||||
ControlMessageFactory *factory = new ControlMessageFactory();
|
||||
|
||||
delete factory;
|
||||
gr_message_sptr queue_message = factory->GetQueueMessage(0, 0);
|
||||
ControlMessage *control_message = (ControlMessage*)queue_message->msg();
|
||||
|
||||
EXPECT_EQ(0, control_message->who);
|
||||
EXPECT_EQ(0, control_message->what);
|
||||
EXPECT_EQ(sizeof(ControlMessage), queue_message->length());
|
||||
|
||||
delete factory;
|
||||
}
|
||||
|
||||
TEST(ControlMessageFactory, GetControlMessages) {
|
||||
|
||||
ControlMessageFactory *factory = new ControlMessageFactory();
|
||||
ControlMessage *control_message = new ControlMessage;
|
||||
|
||||
control_message->who = 1;
|
||||
control_message->what = 4;
|
||||
|
||||
gr_message_sptr queue_message = gr_make_message(0, 0, 0, sizeof(ControlMessage));
|
||||
memcpy(queue_message->msg(), control_message, sizeof(ControlMessage));
|
||||
std::vector<ControlMessage*> *control_messages = factory->GetControlMessages(queue_message);
|
||||
TEST(Control_Message_Factory_Test, GetControlMessages)
|
||||
{
|
||||
ControlMessageFactory *factory = new ControlMessageFactory();
|
||||
ControlMessage *control_message = new ControlMessage;
|
||||
|
||||
EXPECT_EQ(1, control_messages->size());
|
||||
EXPECT_EQ(1, control_messages->at(0)->who);
|
||||
EXPECT_EQ(4, control_messages->at(0)->what);
|
||||
control_message->who = 1;
|
||||
control_message->what = 4;
|
||||
|
||||
delete control_message;
|
||||
delete control_messages;
|
||||
delete factory;
|
||||
gr_message_sptr queue_message = gr_make_message(0, 0, 0, sizeof(ControlMessage));
|
||||
memcpy(queue_message->msg(), control_message, sizeof(ControlMessage));
|
||||
std::vector<ControlMessage*> *control_messages = factory->GetControlMessages(queue_message);
|
||||
|
||||
EXPECT_EQ(1, control_messages->size());
|
||||
EXPECT_EQ(1, control_messages->at(0)->who);
|
||||
EXPECT_EQ(4, control_messages->at(0)->what);
|
||||
|
||||
delete control_message;
|
||||
delete control_messages;
|
||||
delete factory;
|
||||
}
|
||||
|
||||
TEST(ControlMessageFactory, GetControlMessagesWrongSize) {
|
||||
|
||||
ControlMessageFactory *factory = new ControlMessageFactory();
|
||||
ControlMessage *control_message = new ControlMessage;
|
||||
|
||||
control_message->who = 1;
|
||||
control_message->what = 4;
|
||||
int another_int = 10;
|
||||
TEST(Control_Message_Factory_Test, GetControlMessagesWrongSize)
|
||||
{
|
||||
|
||||
gr_message_sptr queue_message = gr_make_message(0, 0, 0, sizeof(ControlMessage) + sizeof(int));
|
||||
memcpy(queue_message->msg(), control_message, sizeof(ControlMessage));
|
||||
memcpy(queue_message->msg() + sizeof(ControlMessage), &another_int, sizeof(int));
|
||||
std::vector<ControlMessage*> *control_messages = factory->GetControlMessages(queue_message);
|
||||
ControlMessageFactory *factory = new ControlMessageFactory();
|
||||
ControlMessage *control_message = new ControlMessage;
|
||||
|
||||
EXPECT_EQ(0, control_messages->size());
|
||||
control_message->who = 1;
|
||||
control_message->what = 4;
|
||||
int another_int = 10;
|
||||
|
||||
delete control_message;
|
||||
delete control_messages;
|
||||
delete factory;
|
||||
gr_message_sptr queue_message = gr_make_message(0, 0, 0, sizeof(ControlMessage) + sizeof(int));
|
||||
memcpy(queue_message->msg(), control_message, sizeof(ControlMessage));
|
||||
memcpy(queue_message->msg() + sizeof(ControlMessage), &another_int, sizeof(int));
|
||||
std::vector<ControlMessage*> *control_messages = factory->GetControlMessages(queue_message);
|
||||
|
||||
EXPECT_EQ(0, control_messages->size());
|
||||
|
||||
delete control_message;
|
||||
delete control_messages;
|
||||
delete factory;
|
||||
}
|
||||
|
@ -13,34 +13,32 @@
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <gr_msg_queue.h>
|
||||
|
||||
#include "control_thread.h"
|
||||
#include "in_memory_configuration.h"
|
||||
|
||||
|
||||
TEST(ControlThread, InstantiateRunControlMessages) {
|
||||
TEST(Control_Thread_Test, InstantiateRunControlMessages) {
|
||||
|
||||
InMemoryConfiguration *config = new InMemoryConfiguration();
|
||||
config->set_property("SignalSource.implementation", "FileSignalSource");
|
||||
config->set_property("SignalSource.filename", "./signal_samples/signal.dat");
|
||||
config->set_property("SignalSource.item_type", "gr_complex");
|
||||
config->set_property("SignalConditioner.implementation", "PassThrough");
|
||||
config->set_property("SignalConditioner.item_type", "gr_complex");
|
||||
config->set_property("Channels.count", "12");
|
||||
config->set_property("Acquisition.implementation", "PassThrough");
|
||||
config->set_property("Acquisition.item_type", "gr_complex");
|
||||
config->set_property("Tracking.implementation", "PassThrough");
|
||||
config->set_property("Tracking.item_type", "gr_complex");
|
||||
config->set_property("Navigation.implementation", "PassThrough");
|
||||
config->set_property("Navigation.item_type", "gr_complex");
|
||||
config->set_property("Pseudorange.implementation", "PassThrough");
|
||||
config->set_property("Pseudorange.item_type", "gr_complex");
|
||||
config->set_property("PVT.implementation", "Adder");
|
||||
config->set_property("PVT.item_type", "gr_complex");
|
||||
config->set_property("OutputFilter.implementation", "NullSinkOutputFilter");
|
||||
config->set_property("OutputFilter.item_type", "gr_complex");
|
||||
config->set_property("SignalSource.implementation", "File_Signal_Source");
|
||||
config->set_property("SignalSource.filename", "/Users/carlesfernandez/Documents/workspace/gnss-sdr/trunk/data/sc2_d16.dat");
|
||||
config->set_property("SignalSource.item_type", "gr_complex");
|
||||
config->set_property("SignalConditioner.implementation", "Pass_Through");
|
||||
config->set_property("SignalConditioner.item_type", "gr_complex");
|
||||
config->set_property("Channels.count", "12");
|
||||
config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition");
|
||||
config->set_property("Acquisition.item_type", "gr_complex");
|
||||
config->set_property("Tracking.implementation", "GPS_L1_CA_DLL_FLL_PLL_Tracking");
|
||||
config->set_property("Tracking.item_type", "gr_complex");
|
||||
config->set_property("Navigation.implementation", "GPS_L1_CA_Telemetry_Decoder");
|
||||
config->set_property("Navigation.item_type", "gr_complex");
|
||||
config->set_property("Pseudorange.implementation", "GPS_L1_CA_Observables");
|
||||
config->set_property("Pseudorange.item_type", "gr_complex");
|
||||
config->set_property("PVT.implementation", "GPS_L1_CA_PVT");
|
||||
config->set_property("PVT.item_type", "gr_complex");
|
||||
config->set_property("OutputFilter.implementation", "Null_Sink_Output_Filter");
|
||||
config->set_property("OutputFilter.item_type", "gr_complex");
|
||||
|
||||
ControlThread *control_thread = new ControlThread(config);
|
||||
|
||||
@ -78,26 +76,30 @@ TEST(ControlThread, InstantiateRunControlMessages) {
|
||||
delete control_msg_factory;
|
||||
}
|
||||
|
||||
TEST(ControlThread, InstantiateRunControlMessages2) {
|
||||
|
||||
|
||||
|
||||
|
||||
TEST(Control_Thread_Test, InstantiateRunControlMessages2) {
|
||||
|
||||
InMemoryConfiguration *config = new InMemoryConfiguration();
|
||||
config->set_property("SignalSource.implementation", "FileSignalSource");
|
||||
config->set_property("SignalSource.filename", "./signal_samples/signal.dat");
|
||||
config->set_property("SignalSource.implementation", "File_Signal_Source");
|
||||
config->set_property("SignalSource.filename", "/Users/carlesfernandez/Documents/workspace/gnss-sdr/trunk/data/sc2_d16.dat");
|
||||
config->set_property("SignalSource.item_type", "gr_complex");
|
||||
config->set_property("SignalConditioner.implementation", "PassThrough");
|
||||
config->set_property("SignalConditioner.implementation", "Pass_Through");
|
||||
config->set_property("SignalConditioner.item_type", "gr_complex");
|
||||
config->set_property("Channels.count", "12");
|
||||
config->set_property("Acquisition.implementation", "PassThrough");
|
||||
config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition");
|
||||
config->set_property("Acquisition.item_type", "gr_complex");
|
||||
config->set_property("Tracking.implementation", "PassThrough");
|
||||
config->set_property("Tracking.implementation", "GPS_L1_CA_DLL_FLL_PLL_Tracking");
|
||||
config->set_property("Tracking.item_type", "gr_complex");
|
||||
config->set_property("Navigation.implementation", "PassThrough");
|
||||
config->set_property("Navigation.implementation", "GPS_L1_CA_Telemetry_Decoder");
|
||||
config->set_property("Navigation.item_type", "gr_complex");
|
||||
config->set_property("Pseudorange.implementation", "PassThrough");
|
||||
config->set_property("Pseudorange.implementation", "GPS_L1_CA_Observables");
|
||||
config->set_property("Pseudorange.item_type", "gr_complex");
|
||||
config->set_property("PVT.implementation", "Adder");
|
||||
config->set_property("PVT.implementation", "GPS_L1_CA_PVT");
|
||||
config->set_property("PVT.item_type", "gr_complex");
|
||||
config->set_property("OutputFilter.implementation", "NullSinkOutputFilter");
|
||||
config->set_property("OutputFilter.implementation", "Null_Sink_Output_Filter");
|
||||
config->set_property("OutputFilter.item_type", "gr_complex");
|
||||
|
||||
ControlThread *control_thread = new ControlThread(config);
|
||||
|
@ -1,24 +1,24 @@
|
||||
; Sample for a configuration file for MERCURIO
|
||||
; Sample for a configuration file for GNS-SDR
|
||||
|
||||
[mercurio]
|
||||
[GNSS-SDR]
|
||||
Foo.param1=value
|
||||
|
||||
SignalSource.implementation=FileSignalSource
|
||||
SignalSource.filename=./data/signal.dat
|
||||
SignalSource.filename=/Users/carlesfernandez/Documents/workspace/gnss-sdr/trunk/data/sc2_d16.dat
|
||||
SignalSource.item_size=4
|
||||
SignalSource.repeat=false
|
||||
|
||||
SignalConditioner.implementation=PassThrough
|
||||
SignalConditioner.implementation=Pass_Through
|
||||
SignalConditioner.item_type=float
|
||||
SignalConditioner.vector_size=1
|
||||
|
||||
Channels.count=1
|
||||
|
||||
Channel1.implementation=PassThrough
|
||||
Channel1.implementation=Pass_Through
|
||||
Channel1.item_type=float
|
||||
Channel1.vector_size=1
|
||||
|
||||
PVT.implementation=PassThrough
|
||||
PVT.implementation=Pass_Through
|
||||
PVT.item_type=float
|
||||
PVT.vector_size=1
|
||||
|
||||
|
@ -1,29 +0,0 @@
|
||||
|
||||
/**
|
||||
* Copyright notice
|
||||
*/
|
||||
|
||||
/**
|
||||
* Author: Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class implements a Unit Test for the class Adder
|
||||
*
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "adder.h"
|
||||
#include "in_memory_configuration.h"
|
||||
|
||||
TEST(Adder, Instantiate) {
|
||||
|
||||
InMemoryConfiguration* config = new InMemoryConfiguration();
|
||||
|
||||
config->set_property("Test.item_type", "gr_complex");
|
||||
|
||||
Adder *adder = new Adder(config, "PVT", 4, 1);
|
||||
|
||||
delete adder;
|
||||
}
|
@ -1,30 +1,44 @@
|
||||
|
||||
/**
|
||||
* Copyright notice
|
||||
*/
|
||||
|
||||
/**
|
||||
* Author: Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class implements a Unit Test for the class FileOutputFilter
|
||||
/*!
|
||||
* \file file_output_filter_test.cc
|
||||
* \brief This file implements tests for the FileSignalSourceClass
|
||||
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||
* Carles Fernandez-Prades, 2012. cfernandez(at)cttc.es
|
||||
*
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "file_output_filter.h"
|
||||
#include "in_memory_configuration.h"
|
||||
|
||||
TEST(FileOutoutFilter, Instantiate) {
|
||||
|
||||
InMemoryConfiguration* config = new InMemoryConfiguration();
|
||||
|
||||
config->set_property("Test.filename", "./data/output.dat");
|
||||
config->set_property("Test.item_type", "float");
|
||||
|
||||
FileOutputFilter *output_filter = new FileOutputFilter(config, "Test", 1, 0);
|
||||
|
||||
delete output_filter;
|
||||
}
|
||||
TEST(FileOutputFilterTest, Instantiate)
|
||||
{
|
||||
InMemoryConfiguration* config = new InMemoryConfiguration();
|
||||
config->set_property("Test.filename", "../data/output.dat");
|
||||
config->set_property("Test.item_type", "float");
|
||||
FileOutputFilter *output_filter = new FileOutputFilter(config, "Test", 1, 0);
|
||||
delete output_filter;
|
||||
}
|
||||
|
@ -1,52 +1,77 @@
|
||||
|
||||
/**
|
||||
* Copyright notice
|
||||
*/
|
||||
|
||||
/**
|
||||
* Author: Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class implements a Unit Test for the class InMemoryConfiguration.
|
||||
/*!
|
||||
* \file file_signal_source_test.cc
|
||||
* \brief This file implements tests for the FileSignalSourceClass
|
||||
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||
* Carles Fernandez-Prades, 2012. cfernandez(at)cttc.es
|
||||
*
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <gr_block.h>
|
||||
#include <gr_msg_queue.h>
|
||||
#include <gr_top_block.h>
|
||||
#include <gr_null_sink.h>
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include "file_signal_source.h"
|
||||
#include "in_memory_configuration.h"
|
||||
|
||||
TEST(FileSignalSource, Instantiate) {
|
||||
|
||||
|
||||
TEST(File_Signal_Source_Test, Instantiate)
|
||||
{
|
||||
gr_msg_queue_sptr queue = gr_make_msg_queue(0);
|
||||
|
||||
InMemoryConfiguration* config = new InMemoryConfiguration();
|
||||
|
||||
config->set_property("Test.samples", "0");
|
||||
config->set_property("Test.sampling_frequency", "0");
|
||||
config->set_property("Test.filename", "./signal_samples/signal.dat");
|
||||
|
||||
config->set_property("Test.filename", "/Users/carlesfernandez/Documents/workspace/gnss-sdr/trunk/data/sc2_d16.dat");
|
||||
|
||||
config->set_property("Test.item_type", "gr_complex");
|
||||
config->set_property("Test.repeat", "false");
|
||||
|
||||
FileSignalSource *signal_source = new FileSignalSource(config, "Test", 1, 1, queue);
|
||||
|
||||
EXPECT_STREQ("./signal_samples/signal.dat", signal_source->filename().c_str());
|
||||
try
|
||||
{
|
||||
FileSignalSource *signal_source = new FileSignalSource(config, "Test", 1, 1, queue);
|
||||
}
|
||||
catch(std::exception& e){}
|
||||
EXPECT_STREQ("/Users/carlesfernandez/Documents/workspace/gnss-sdr/trunk/data/sc2_d16.dat", signal_source->filename().c_str());
|
||||
EXPECT_STREQ("gr_complex", signal_source->item_type().c_str());
|
||||
EXPECT_TRUE(signal_source->repeat() == false);
|
||||
|
||||
delete signal_source;
|
||||
}
|
||||
|
||||
TEST(FileSignalSource, InstantiateFileNotExists) {
|
||||
|
||||
|
||||
TEST(File_Signal_Source_Test, InstantiateFileNotExists)
|
||||
{
|
||||
gr_msg_queue_sptr queue = gr_make_msg_queue(0);
|
||||
|
||||
InMemoryConfiguration* config = new InMemoryConfiguration();
|
||||
@ -54,8 +79,9 @@ TEST(FileSignalSource, InstantiateFileNotExists) {
|
||||
config->set_property("Test.samples", "0");
|
||||
config->set_property("Test.sampling_frequency", "0");
|
||||
config->set_property("Test.filename", "./signal_samples/i_dont_exist.dat");
|
||||
|
||||
config->set_property("Test.item_type", "gr_complex");
|
||||
config->set_property("Test.repeat", "false");
|
||||
|
||||
EXPECT_THROW(new FileSignalSource(config, "Test", 1, 1, queue), std::runtime_error);
|
||||
EXPECT_THROW(new FileSignalSource(config, "Test", 1, 1, queue), std::exception);
|
||||
}
|
||||
|
@ -26,10 +26,10 @@ TEST(GNSSBlockFactory, InstantiateChannels) {
|
||||
InMemoryConfiguration *configuration = new InMemoryConfiguration();
|
||||
|
||||
configuration->set_property("Channels.count", "2");
|
||||
configuration->set_property("Channel1.implementation", "PassThrough");
|
||||
configuration->set_property("Channel1.implementation", "Pass_Through");
|
||||
configuration->set_property("Channel1.item_type", "float");
|
||||
configuration->set_property("Channel1.vector_size", "1");
|
||||
configuration->set_property("Channel2.implementation", "PassThrough");
|
||||
configuration->set_property("Channel2.implementation", "Pass_Through");
|
||||
configuration->set_property("Channel2.item_type", "float");
|
||||
configuration->set_property("Channel2.vector_size", "1");
|
||||
|
||||
@ -84,7 +84,7 @@ TEST(GNSSBlockFactory, InstantiateWrongSignalSource) {
|
||||
TEST(GNSSBlockFactory, InstantiateSignalConditioner) {
|
||||
InMemoryConfiguration *configuration = new InMemoryConfiguration();
|
||||
|
||||
configuration->set_property("SignalConditioner.implementation", "PassThrough");
|
||||
configuration->set_property("SignalConditioner.implementation", "Pass_Through");
|
||||
|
||||
gr_msg_queue_sptr queue = gr_make_msg_queue(0);
|
||||
|
||||
@ -117,7 +117,7 @@ TEST(GNSSBlockFactory, InstantiateWrongSignalConditioner) {
|
||||
TEST(GNSSBlockFactory, InstantiatePVT) {
|
||||
InMemoryConfiguration *configuration = new InMemoryConfiguration();
|
||||
|
||||
configuration->set_property("PVT.implementation", "PassThrough");
|
||||
configuration->set_property("PVT.implementation", "Pass_Through");
|
||||
|
||||
gr_msg_queue_sptr queue = gr_make_msg_queue(0);
|
||||
|
||||
@ -178,4 +178,4 @@ TEST(GNSSBlockFactory, InstantiateWrongOutputFilter) {
|
||||
|
||||
delete configuration;
|
||||
delete factory;
|
||||
}
|
||||
}
|
||||
|
@ -13,54 +13,54 @@
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <gnuradio/gr_msg_queue.h>
|
||||
|
||||
#include "gnss_flowgraph.h"
|
||||
#include "gnss_block_interface.h"
|
||||
#include "in_memory_configuration.h"
|
||||
#include "file_configuration.h"
|
||||
#include "channel.h"
|
||||
#include "acquisition_interface.h"
|
||||
#include "correlator_interface.h"
|
||||
#include "tracking_interface.h"
|
||||
#include "channel_interface.h"
|
||||
#include "null_sink_output_filter.h"
|
||||
#include "pass_through.h"
|
||||
#include "file_signal_source.h"
|
||||
|
||||
TEST(GNSSFlowgraph, InstantiateConnectStartStop) {
|
||||
|
||||
InMemoryConfiguration* config = new InMemoryConfiguration();
|
||||
TEST(GNSSFlowgraph, InstantiateConnectStartStop)
|
||||
{
|
||||
InMemoryConfiguration* config = new InMemoryConfiguration();
|
||||
|
||||
config->set_property("SignalSource.implementation", "FileSignalSource");
|
||||
config->set_property("SignalConditioner.implementation", "PassThrough");
|
||||
config->set_property("Channels.count", "2");
|
||||
config->set_property("Channels.acquisition.implementation", "PassThrough");
|
||||
config->set_property("Channels.tracking.implementation", "PassThrough");
|
||||
config->set_property("Channels.navigation.implementation", "PassThrough");
|
||||
config->set_property("Channels.pseudorange.implementation", "PassThrough");
|
||||
config->set_property("PVT.implementation", "Adder");
|
||||
config->set_property("OutputFilter.implementation", "NullSinkOutputFilter");
|
||||
config->set_property("SignalSource.implementation", "File_Signal_Source");
|
||||
config->set_property("SignalConditioner.implementation", "Pass_Through");
|
||||
config->set_property("Channels.count", "2");
|
||||
config->set_property("Channels.acquisition.implementation", "Pass_Through");
|
||||
config->set_property("Channels.tracking.implementation", "Pass_Through");
|
||||
config->set_property("Channels.observables.implementation", "Pass_Through");
|
||||
config->set_property("Observables.implementation", "GpsL1CaObservables");
|
||||
config->set_property("PVT.implementation", "GPS_L1_CA_PVT");
|
||||
config->set_property("OutputFilter.implementation", "NullSinkOutputFilter");
|
||||
|
||||
GNSSFlowgraph* flowgraph = new GNSSFlowgraph(config, gr_make_msg_queue(0));
|
||||
GNSSFlowgraph* flowgraph = new GNSSFlowgraph(config, gr_make_msg_queue(0));
|
||||
|
||||
EXPECT_STREQ("FileSignalSource", flowgraph->signal_source()->implementation().c_str());
|
||||
EXPECT_STREQ("PassThrough", flowgraph->signal_conditioner()->implementation().c_str());
|
||||
EXPECT_STREQ("Channel", flowgraph->channel(0)->implementation().c_str());
|
||||
EXPECT_STREQ("PassThrough", ((GNSSChannel*)flowgraph->channel(0))->acquisition()->implementation().c_str());
|
||||
EXPECT_STREQ("PassThrough", ((GNSSChannel*)flowgraph->channel(0))->tracking()->implementation().c_str());
|
||||
EXPECT_STREQ("PassThrough", ((GNSSChannel*)flowgraph->channel(0))->navigation()->implementation().c_str());
|
||||
EXPECT_STREQ("PassThrough", ((GNSSChannel*)flowgraph->channel(0))->pseudorange()->implementation().c_str());
|
||||
EXPECT_STREQ("Channel", flowgraph->channel(1)->implementation().c_str());
|
||||
EXPECT_STREQ("PassThrough", ((GNSSChannel*)flowgraph->channel(1))->acquisition()->implementation().c_str());
|
||||
EXPECT_STREQ("PassThrough", ((GNSSChannel*)flowgraph->channel(1))->tracking()->implementation().c_str());
|
||||
EXPECT_STREQ("PassThrough", ((GNSSChannel*)flowgraph->channel(1))->navigation()->implementation().c_str());
|
||||
EXPECT_STREQ("PassThrough", ((GNSSChannel*)flowgraph->channel(1))->pseudorange()->implementation().c_str());
|
||||
EXPECT_STREQ("Adder", flowgraph->pvt()->implementation().c_str());
|
||||
EXPECT_STREQ("NullSinkOutputFilter", flowgraph->output_filter()->implementation().c_str());
|
||||
EXPECT_STREQ("FileSignalSource", flowgraph->signal_source()->implementation().c_str());
|
||||
EXPECT_STREQ("Pass_Through", flowgraph->signal_conditioner()->implementation().c_str());
|
||||
EXPECT_STREQ("Channel", flowgraph->channel(0)->implementation().c_str());
|
||||
EXPECT_STREQ("Pass_Through", ((Channel*)flowgraph->channel(0))->acquisition()->implementation().c_str());
|
||||
EXPECT_STREQ("Pass_Through", ((Channel*)flowgraph->channel(0))->tracking()->implementation().c_str());
|
||||
EXPECT_STREQ("Channel", flowgraph->channel(1)->implementation().c_str());
|
||||
EXPECT_STREQ("Pass_Through", ((Channel*)flowgraph->channel(1))->acquisition()->implementation().c_str());
|
||||
EXPECT_STREQ("Pass_Through", ((Channel*)flowgraph->channel(1))->tracking()->implementation().c_str());
|
||||
EXPECT_STREQ("GpsL1CaObservables", flowgraph->observables()->implementation().c_str());
|
||||
EXPECT_STREQ("GPS_L1_CA_PVT", flowgraph->pvt()->implementation().c_str());
|
||||
EXPECT_STREQ("NullSinkOutputFilter", flowgraph->output_filter()->implementation().c_str());
|
||||
|
||||
EXPECT_NO_THROW(flowgraph->connect());
|
||||
EXPECT_TRUE(flowgraph->connected());
|
||||
EXPECT_NO_THROW(flowgraph->start());
|
||||
EXPECT_TRUE(flowgraph->running());
|
||||
flowgraph->stop();
|
||||
EXPECT_FALSE(flowgraph->running());
|
||||
EXPECT_NO_THROW(flowgraph->connect());
|
||||
EXPECT_TRUE(flowgraph->connected());
|
||||
EXPECT_NO_THROW(flowgraph->start());
|
||||
EXPECT_TRUE(flowgraph->running());
|
||||
flowgraph->stop();
|
||||
EXPECT_FALSE(flowgraph->running());
|
||||
|
||||
delete flowgraph;
|
||||
delete flowgraph;
|
||||
}
|
||||
|
@ -1,35 +1,55 @@
|
||||
|
||||
/**
|
||||
* Copyright notice
|
||||
*/
|
||||
|
||||
/**
|
||||
* Author: Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class implements a Unit Test for the class NoConditioningSignalConditioner.
|
||||
/*!
|
||||
* \file pass_through_test.cc
|
||||
* \brief This file implements tests for the Pass_Through block
|
||||
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||
* Carles Fernandez-Prades, 2012. cfernandez(at)cttc.es
|
||||
*
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <gr_block.h>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "pass_through.h"
|
||||
#include "in_memory_configuration.h"
|
||||
|
||||
TEST(PassThrough, Instantiate) {
|
||||
|
||||
InMemoryConfiguration* config = new InMemoryConfiguration();
|
||||
|
||||
config->set_property("Test.item_type", "gr_complex");
|
||||
config->set_property("Test.vector_size", "2");
|
||||
TEST(Pass_Through_Test, Instantiate)
|
||||
{
|
||||
InMemoryConfiguration* config = new InMemoryConfiguration();
|
||||
|
||||
PassThrough *signal_conditioner = new PassThrough(config, "Test", 1, 1);
|
||||
config->set_property("Test.item_type", "gr_complex");
|
||||
config->set_property("Test.vector_size", "2");
|
||||
|
||||
EXPECT_STREQ("gr_complex", signal_conditioner->item_type().c_str());
|
||||
EXPECT_EQ(2, signal_conditioner->vector_size());
|
||||
Pass_Through *signal_conditioner = new Pass_Through(config, "Test", 1, 1);
|
||||
|
||||
delete signal_conditioner;
|
||||
}
|
||||
EXPECT_STREQ("gr_complex", signal_conditioner->item_type().c_str());
|
||||
EXPECT_EQ(2, signal_conditioner->vector_size());
|
||||
|
||||
delete signal_conditioner;
|
||||
}
|
||||
|
@ -26,10 +26,10 @@ TEST(GNSSBlockFactory, InstantiateChannels) {
|
||||
InMemoryConfiguration *configuration = new InMemoryConfiguration();
|
||||
|
||||
configuration->set_property("Channels.count", "2");
|
||||
configuration->set_property("Channel1.implementation", "PassThrough");
|
||||
configuration->set_property("Channel1.implementation", "Pass_Through");
|
||||
configuration->set_property("Channel1.item_type", "float");
|
||||
configuration->set_property("Channel1.vector_size", "1");
|
||||
configuration->set_property("Channel2.implementation", "PassThrough");
|
||||
configuration->set_property("Channel2.implementation", "Pass_Through");
|
||||
configuration->set_property("Channel2.item_type", "float");
|
||||
configuration->set_property("Channel2.vector_size", "1");
|
||||
|
||||
@ -51,7 +51,7 @@ TEST(GNSSBlockFactory, InstantiateChannels) {
|
||||
TEST(GNSSBlockFactory, InstantiateSignalSource) {
|
||||
InMemoryConfiguration *configuration = new InMemoryConfiguration();
|
||||
|
||||
configuration->set_property("SignalSource.implementation", "FileSignalSource");
|
||||
configuration->set_property("SignalSource.implementation", "File_Signal_Source");
|
||||
|
||||
gr_msg_queue_sptr queue = gr_make_msg_queue(0);
|
||||
|
||||
@ -84,7 +84,7 @@ TEST(GNSSBlockFactory, InstantiateWrongSignalSource) {
|
||||
TEST(GNSSBlockFactory, InstantiateSignalConditioner) {
|
||||
InMemoryConfiguration *configuration = new InMemoryConfiguration();
|
||||
|
||||
configuration->set_property("SignalConditioner.implementation", "PassThrough");
|
||||
configuration->set_property("SignalConditioner.implementation", "Pass_Through");
|
||||
|
||||
gr_msg_queue_sptr queue = gr_make_msg_queue(0);
|
||||
|
||||
@ -178,4 +178,4 @@ TEST(GNSSBlockFactory, InstantiateWrongOutputFilter) {
|
||||
|
||||
delete configuration;
|
||||
delete factory;
|
||||
}
|
||||
}
|
||||
|
@ -1,50 +1,65 @@
|
||||
|
||||
/**
|
||||
* Copyright notice
|
||||
*/
|
||||
|
||||
/**
|
||||
* Author: Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class implements unit tests for a the valve custom block.
|
||||
/*!
|
||||
* \file gnss_sdr_valve_test.cc
|
||||
* \brief This file implements unit tests for the valve custom block.
|
||||
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||
* Carles Fernandez-Prades, 2012. cfernandez(at)cttc.es
|
||||
*
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <gr_top_block.h>
|
||||
#include <gr_sig_source_f.h>
|
||||
#include <gr_null_sink.h>
|
||||
#include <gr_msg_queue.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "gnss_sdr_valve.h"
|
||||
//#include <glog/log_severity.h>
|
||||
//#include <glog/logging.h>
|
||||
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
//using google::LogMessage;
|
||||
|
||||
using google::LogMessage;
|
||||
TEST(Valve_Test, CheckEventSentAfter100Samples)
|
||||
{
|
||||
gr_msg_queue_sptr queue = gr_make_msg_queue(0);
|
||||
|
||||
TEST(GNSS_SDR_VALVE, CheckEventSentAfter100Samples) {
|
||||
gr_top_block_sptr top_block = gr_make_top_block("gnss_sdr_valve_test");
|
||||
gr_block_sptr valve = gnss_sdr_make_valve(sizeof(float), 100, queue);
|
||||
gr_sig_source_f_sptr source = gr_make_sig_source_f(100, GR_CONST_WAVE, 100, 1, 0);
|
||||
gr_block_sptr sink = gr_make_null_sink(sizeof(float));
|
||||
|
||||
gr_msg_queue_sptr queue = gr_make_msg_queue(0);
|
||||
//LOG_AT_LEVEL(INFO) << "Queue count is " << queue->count();
|
||||
EXPECT_EQ(0, queue->count());
|
||||
|
||||
gr_top_block_sptr top_block = gr_make_top_block("gnss_sdr_valve_test");
|
||||
gr_block_sptr valve = gnss_sdr_make_valve(sizeof(float), 100, queue);
|
||||
gr_sig_source_f_sptr source = gr_make_sig_source_f(100, GR_CONST_WAVE, 100, 1, 0);
|
||||
gr_block_sptr sink = gr_make_null_sink(sizeof(float));
|
||||
top_block->connect(source, 0, valve, 0);
|
||||
top_block->connect(valve, 0, sink, 0);
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Queue count is " << queue->count();
|
||||
EXPECT_EQ(0, queue->count());
|
||||
top_block->run();
|
||||
top_block->stop();
|
||||
|
||||
top_block->connect(source, 0, valve, 0);
|
||||
top_block->connect(valve, 0, sink, 0);
|
||||
|
||||
top_block->run();
|
||||
top_block->stop();
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Queue count is " << queue->count();
|
||||
EXPECT_EQ(1, queue->count());
|
||||
|
||||
}
|
||||
//LOG_AT_LEVEL(INFO) << "Queue count is " << queue->count();
|
||||
EXPECT_EQ(1, queue->count());
|
||||
}
|
||||
|
@ -49,21 +49,21 @@ DEFINE_int32(B_value, 2, "Value of the initial K variable in Tong algorithm");
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
|
||||
gr_msg_queue_sptr queue = gr_msg_queue_sptr();
|
||||
gr_msg_queue_sptr queue = gr_msg_queue_sptr();
|
||||
|
||||
int samples_per_ms = ceil(FLAGS_fs_in/1000);
|
||||
gr_complex div = 0.001;
|
||||
int samples_per_ms = ceil(FLAGS_fs_in/1000);
|
||||
gr_complex div = 0.001;
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "fs_in " << FLAGS_fs_in;
|
||||
LOG_AT_LEVEL(INFO) << "if_freq " << FLAGS_if_freq;
|
||||
LOG_AT_LEVEL(INFO) << "satellite " << FLAGS_satellite;
|
||||
// LOG_AT_LEVEL(INFO) << "max_dwells " << FLAGS_max_dwells;
|
||||
LOG_AT_LEVEL(INFO) << "threshold " << FLAGS_acquisition_threshold;
|
||||
LOG_AT_LEVEL(INFO) << "A_value " << FLAGS_A_value;
|
||||
LOG_AT_LEVEL(INFO) << "B_value " << FLAGS_B_value;
|
||||
LOG_AT_LEVEL(INFO) << "fs_in " << FLAGS_fs_in;
|
||||
LOG_AT_LEVEL(INFO) << "if_freq " << FLAGS_if_freq;
|
||||
LOG_AT_LEVEL(INFO) << "satellite " << FLAGS_satellite;
|
||||
// LOG_AT_LEVEL(INFO) << "max_dwells " << FLAGS_max_dwells;
|
||||
LOG_AT_LEVEL(INFO) << "threshold " << FLAGS_acquisition_threshold;
|
||||
LOG_AT_LEVEL(INFO) << "A_value " << FLAGS_A_value;
|
||||
LOG_AT_LEVEL(INFO) << "B_value " << FLAGS_B_value;
|
||||
|
||||
|
||||
gr_top_block_sptr top_block = gr_make_top_block("gps_sdr_tong_acquisition_test");
|
||||
@ -81,14 +81,14 @@ int main(int argc, char** argv) {
|
||||
top_block->connect(stream_to_vector, 0 , acquisition, 0);
|
||||
top_block->connect(acquisition, 0, null_sink, 0);
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Run";
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
top_block->run(); // Start threads and wait
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
LOG_AT_LEVEL(INFO) << "Finished in " << (end - begin) << " microseconds";
|
||||
std::cout << (end - begin) << std::endl;
|
||||
top_block->stop();
|
||||
LOG_AT_LEVEL(INFO) << "Run";
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
top_block->run(); // Start threads and wait
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
LOG_AT_LEVEL(INFO) << "Finished in " << (end - begin) << " microseconds";
|
||||
std::cout << (end - begin) << std::endl;
|
||||
top_block->stop();
|
||||
}
|
||||
|
@ -1,77 +0,0 @@
|
||||
|
||||
/**
|
||||
* Copyright notice
|
||||
*/
|
||||
|
||||
/**
|
||||
* Author: Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com
|
||||
*/
|
||||
|
||||
/**
|
||||
* Executes a gps sdr acquisition based on some input parameters.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
#include <gr_top_block.h>
|
||||
#include <gr_file_source.h>
|
||||
#include <gr_null_sink.h>
|
||||
#include <gps_sdr_acquisition_ss.h>
|
||||
#include <gr_stream_to_vector.h>
|
||||
|
||||
#include "gps_sdr_simd.h"
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
|
||||
CPX* A = new CPX[100];
|
||||
CPX* B = new CPX[100];
|
||||
CPX* C = new CPX[100];
|
||||
|
||||
for(int i=0;i<100;i++) {
|
||||
A[i].i = 1;
|
||||
A[i].q = 1;
|
||||
B[i].i = 0;
|
||||
B[i].q = 0;
|
||||
C[i].i = 2;
|
||||
C[i].q = 2;
|
||||
}
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Run";
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
sse_cmulsc(A, B, C, 10, 10);
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
LOG_AT_LEVEL(INFO) << "Finished in " << (end - begin) << " microseconds";
|
||||
std::cout << (end - begin) << std::endl;
|
||||
|
||||
std::cout << "A=[";
|
||||
for(int i=0;i<100;i++) {
|
||||
std::cout << A[i].i << "," << A[i].q << ":";
|
||||
}
|
||||
std::cout << "]" << std::endl;
|
||||
|
||||
std::cout << "B=[";
|
||||
for(int i=0;i<100;i++) {
|
||||
std::cout << B[i].i << "," << B[i].q << ":";
|
||||
}
|
||||
std::cout << "]" << std::endl;
|
||||
|
||||
std::cout << "C=[";
|
||||
for(int i=0;i<100;i++) {
|
||||
std::cout << C[i].i << "," << C[i].q << ":";
|
||||
}
|
||||
std::cout << "]" << std::endl;;
|
||||
}
|
@ -13,46 +13,41 @@
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#include "in_memory_configuration.h"
|
||||
#include "control_thread.h"
|
||||
|
||||
TEST(SignalSource, CorrectFileSignalSource) {
|
||||
TEST(SignalSource, CorrectFileSignalSource)
|
||||
{
|
||||
InMemoryConfiguration* config = new InMemoryConfiguration();
|
||||
|
||||
InMemoryConfiguration* config = new InMemoryConfiguration();
|
||||
config->set_property("ControlThread.wait_for_flowgraph", "true");
|
||||
config->set_property("SignalSource.implementation", "FileSignalSource");
|
||||
config->set_property("SignalSource.samples", "0");
|
||||
config->set_property("SignalSource.filename", "./signal_samples/signal_1ms.dat");
|
||||
config->set_property("SignalSource.dump", "true");
|
||||
config->set_property("SignalSource.dump_filename", "./data/test1_dump.dat");
|
||||
config->set_property("SignalConditioner.implementation", "PassThrough");
|
||||
config->set_property("Channels.count", "1");
|
||||
|
||||
config->set_property("ControlThread.wait_for_flowgraph", "true");
|
||||
ControlThread* control_thread = new ControlThread(config);
|
||||
control_thread->run();
|
||||
|
||||
config->set_property("SignalSource.implementation", "FileSignalSource");
|
||||
config->set_property("SignalSource.samples", "0");
|
||||
config->set_property("SignalSource.filename", "./signal_samples/signal_1ms.dat");
|
||||
config->set_property("SignalSource.dump", "true");
|
||||
config->set_property("SignalSource.dump_filename", "./data/test1_dump.dat");
|
||||
delete control_thread;
|
||||
delete config;
|
||||
|
||||
config->set_property("SignalConditioner.implementation", "PassThrough");
|
||||
std::ifstream signal_expected;
|
||||
signal_expected.open("./signal_samples/signal_1ms.dat", std::ios::in | std::ios::binary | std::ios::ate);
|
||||
EXPECT_FALSE(signal_expected.fail());
|
||||
|
||||
config->set_property("Channels.count", "1");
|
||||
std::ifstream signal_result;
|
||||
signal_result.open("./data/test_dump.dat", std::ios::in | std::ios::binary | std::ios::ate);
|
||||
EXPECT_FALSE(signal_result.fail());
|
||||
|
||||
ControlThread* control_thread = new ControlThread(config);
|
||||
control_thread->run();
|
||||
EXPECT_EQ(signal_expected.tellg(), signal_result.tellg());
|
||||
std::cout << signal_expected.tellg() << ":" << signal_result.tellg() << std::endl;
|
||||
|
||||
delete control_thread;
|
||||
delete config;
|
||||
|
||||
std::ifstream signal_expected;
|
||||
signal_expected.open("./signal_samples/signal_1ms.dat", std::ios::in|std::ios::binary|std::ios::ate);
|
||||
EXPECT_FALSE(signal_expected.fail());
|
||||
|
||||
std::ifstream signal_result;
|
||||
signal_result.open("./data/test_dump.dat", std::ios::in|std::ios::binary|std::ios::ate);
|
||||
EXPECT_FALSE(signal_result.fail());
|
||||
|
||||
EXPECT_EQ(signal_expected.tellg(), signal_result.tellg());
|
||||
std::cout << signal_expected.tellg() << ":" << signal_result.tellg() << std::endl;
|
||||
|
||||
signal_expected.close();
|
||||
signal_result.close();
|
||||
signal_expected.close();
|
||||
signal_result.close();
|
||||
}
|
||||
|
@ -1,3 +1,65 @@
|
||||
build-project arithmetic ;
|
||||
lib gtest ;
|
||||
|
||||
obj test_main : test_main.cc ;
|
||||
obj test_main : test_main.cc ;
|
||||
|
||||
project : build-dir ../../build ;
|
||||
exe run_tests : test_main.cc
|
||||
../algorithms/acquisition/adapters//gps_l1_ca_gps_sdr_acquisition
|
||||
../algorithms/acquisition/adapters//gps_l1_ca_pcps_acquisition
|
||||
../algorithms/acquisition/adapters//gps_l1_ca_tong_pcps_acquisition
|
||||
../algorithms/acquisition/gnuradio_blocks//gps_l1_ca_gps_sdr_acquisition_cc
|
||||
../algorithms/acquisition/gnuradio_blocks//gps_l1_ca_gps_sdr_acquisition_ss
|
||||
../algorithms/acquisition/gnuradio_blocks//gps_l1_ca_pcps_acquisition_cc
|
||||
../algorithms/acquisition/gnuradio_blocks//gps_l1_ca_tong_pcps_acquisition_cc
|
||||
../algorithms/channel/adapters//channel
|
||||
../algorithms/channel/libs//gps_l1_ca_channel_fsm
|
||||
../algorithms/conditioner/adapters//direct_resampler_conditioner
|
||||
../algorithms/conditioner/gnuradio_blocks//direct_resampler_conditioner_cc
|
||||
../algorithms/conditioner/gnuradio_blocks//direct_resampler_conditioner_ss
|
||||
../algorithms/libs//gps_sdr_signal_processing
|
||||
../algorithms/libs//gnss_sdr_valve
|
||||
../algorithms/libs//pass_through
|
||||
../algorithms/libs//gps_sdr_fft
|
||||
../algorithms/libs//gps_sdr_simd
|
||||
../algorithms/libs//gps_sdr_x86
|
||||
../algorithms/observables/adapters//gps_l1_ca_observables
|
||||
../algorithms/observables/gnuradio_blocks//gps_l1_ca_observables_cc
|
||||
../algorithms/PVT/libs//rinex_printer
|
||||
../algorithms/PVT/libs//kml_printer
|
||||
../algorithms/PVT/libs//gps_l1_ca_ls_pvt
|
||||
../algorithms/output_filter/adapters//file_output_filter
|
||||
../algorithms/output_filter/adapters//null_sink_output_filter
|
||||
../algorithms/signal_source/adapters//file_signal_source
|
||||
#../algorithms/signal_source/adapters//usrp1_signal_source
|
||||
../algorithms/telemetry_decoder/adapters//gps_l1_ca_telemetry_decoder
|
||||
../algorithms/telemetry_decoder/gnuradio_blocks//gps_l1_ca_telemetry_decoder_cc
|
||||
../algorithms/telemetry_decoder/libs//gps_l1_ca_subframe_fsm
|
||||
../algorithms/PVT/adapters//gps_l1_ca_pvt
|
||||
../algorithms/PVT/gnuradio_blocks//gps_l1_ca_pvt_cc
|
||||
../algorithms/tracking/adapters//gps_l1_ca_dll_pll_tracking
|
||||
../algorithms/tracking/adapters//gps_l1_ca_dll_fll_pll_tracking
|
||||
../algorithms/tracking/gnuradio_blocks//gps_l1_ca_dll_pll_tracking_cc
|
||||
../algorithms/tracking/gnuradio_blocks//gps_l1_ca_dll_fll_pll_tracking_cc
|
||||
../algorithms/tracking/libs//tracking_discriminators
|
||||
../algorithms/tracking/libs//CN_estimators
|
||||
../algorithms/tracking/libs//tracking_FLL_PLL_filter
|
||||
../algorithms/tracking/libs//tracking_2nd_PLL_filter
|
||||
../algorithms/tracking/libs//tracking_2nd_DLL_filter
|
||||
../algorithms/tracking/libs//correlator
|
||||
../core/libs//INIReader
|
||||
../core/libs//ini
|
||||
../core/libs//string_converter
|
||||
../core/receiver//control_message_factory
|
||||
../core/receiver//control_thread
|
||||
../core/receiver//file_configuration
|
||||
../core/receiver//in_memory_configuration
|
||||
../core/receiver//gnss_block_factory
|
||||
../core/receiver//gnss_flowgraph
|
||||
../core/system_parameters//gps_navigation_message
|
||||
../core/system_parameters//gnss_satellite
|
||||
../..//gflags
|
||||
../..//glog
|
||||
../..//gnuradio-core
|
||||
../..//gtest ;
|
||||
|
||||
install ../../install : run_tests ;
|
@ -1,51 +0,0 @@
|
||||
// Read an INI file into easy-to-access name/value pairs.
|
||||
|
||||
#include <cctype>
|
||||
#include <cstdlib>
|
||||
#include "ini.h"
|
||||
#include "INIReader.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
INIReader::INIReader(string filename)
|
||||
{
|
||||
_error = ini_parse(filename.c_str(), ValueHandler, this);
|
||||
}
|
||||
|
||||
int INIReader::ParseError()
|
||||
{
|
||||
return _error;
|
||||
}
|
||||
|
||||
string INIReader::Get(string section, string name, string default_value)
|
||||
{
|
||||
string key = MakeKey(section, name);
|
||||
return _values.count(key) ? _values[key] : default_value;
|
||||
}
|
||||
|
||||
long INIReader::GetInteger(string section, string name, long default_value)
|
||||
{
|
||||
string valstr = Get(section, name, "");
|
||||
const char* value = valstr.c_str();
|
||||
char* end;
|
||||
// This parses "1234" (decimal) and also "0x4D2" (hex)
|
||||
long n = strtol(value, &end, 0);
|
||||
return end > value ? n : default_value;
|
||||
}
|
||||
|
||||
string INIReader::MakeKey(string section, string name)
|
||||
{
|
||||
string key = section + "." + name;
|
||||
// Convert to lower case to make lookups case-insensitive
|
||||
for (unsigned int i = 0; i < key.length(); i++)
|
||||
key[i] = tolower(key[i]);
|
||||
return key;
|
||||
}
|
||||
|
||||
int INIReader::ValueHandler(void* user, const char* section, const char* name,
|
||||
const char* value)
|
||||
{
|
||||
INIReader* reader = (INIReader*)user;
|
||||
reader->_values[MakeKey(section, name)] = value;
|
||||
return 1;
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
// Read an INI file into easy-to-access name/value pairs.
|
||||
|
||||
// inih and INIReader are released under the New BSD license (see LICENSE.txt).
|
||||
// Go to the project home page for more info:
|
||||
//
|
||||
// http://code.google.com/p/inih/
|
||||
|
||||
#ifndef __INIREADER_H__
|
||||
#define __INIREADER_H__
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
// Read an INI file into easy-to-access name/value pairs. (Note that I've gone
|
||||
// for simplicity here rather than speed, but it should be pretty decent.)
|
||||
class INIReader
|
||||
{
|
||||
public:
|
||||
// Construct INIReader and parse given filename. See ini.h for more info
|
||||
// about the parsing.
|
||||
INIReader(std::string filename);
|
||||
|
||||
// Return the result of ini_parse(), i.e., 0 on success, line number of
|
||||
// first error on parse error, or -1 on file open error.
|
||||
int ParseError();
|
||||
|
||||
// Get a string value from INI file, returning default_value if not found.
|
||||
std::string Get(std::string section, std::string name,
|
||||
std::string default_value);
|
||||
|
||||
// Get an integer (long) value from INI file, returning default_value if
|
||||
// not found.
|
||||
long GetInteger(std::string section, std::string name, long default_value);
|
||||
|
||||
private:
|
||||
int _error;
|
||||
std::map<std::string, std::string> _values;
|
||||
static std::string MakeKey(std::string section, std::string name);
|
||||
static int ValueHandler(void* user, const char* section, const char* name,
|
||||
const char* value);
|
||||
};
|
||||
|
||||
#endif // __INIREADER_H__
|
@ -1,130 +0,0 @@
|
||||
/* inih -- simple .INI file parser
|
||||
|
||||
inih is released under the New BSD license (see LICENSE.txt). Go to the project
|
||||
home page for more info:
|
||||
|
||||
http://code.google.com/p/inih/
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "ini.h"
|
||||
|
||||
#define MAX_LINE 200
|
||||
#define MAX_SECTION 50
|
||||
#define MAX_NAME 50
|
||||
|
||||
/* Strip whitespace chars off end of given string, in place. Return s. */
|
||||
static char* rstrip(char* s)
|
||||
{
|
||||
char* p = s + strlen(s);
|
||||
while (p > s && isspace(*--p))
|
||||
*p = '\0';
|
||||
return s;
|
||||
}
|
||||
|
||||
/* Return pointer to first non-whitespace char in given string. */
|
||||
static char* lskip(const char* s)
|
||||
{
|
||||
while (*s && isspace(*s))
|
||||
s++;
|
||||
return (char*)s;
|
||||
}
|
||||
|
||||
/* Return pointer to first char c or ';' in given string, or pointer to
|
||||
null at end of string if neither found. */
|
||||
static char* find_char_or_comment(const char* s, char c)
|
||||
{
|
||||
while (*s && *s != c && *s != ';')
|
||||
s++;
|
||||
return (char*)s;
|
||||
}
|
||||
|
||||
/* Version of strncpy that ensures dest (size bytes) is null-terminated. */
|
||||
static char* strncpy0(char* dest, const char* src, size_t size)
|
||||
{
|
||||
strncpy(dest, src, size);
|
||||
dest[size - 1] = '\0';
|
||||
return dest;
|
||||
}
|
||||
|
||||
/* See documentation in header file. */
|
||||
int ini_parse(const char* filename,
|
||||
int (*handler)(void*, const char*, const char*, const char*),
|
||||
void* user)
|
||||
{
|
||||
/* Uses a fair bit of stack (use heap instead if you need to) */
|
||||
char line[MAX_LINE];
|
||||
char section[MAX_SECTION] = "";
|
||||
char prev_name[MAX_NAME] = "";
|
||||
|
||||
FILE* file;
|
||||
char* start;
|
||||
char* end;
|
||||
char* name;
|
||||
char* value;
|
||||
int lineno = 0;
|
||||
int error = 0;
|
||||
|
||||
file = fopen(filename, "r");
|
||||
if (!file)
|
||||
return -1;
|
||||
|
||||
/* Scan through file line by line */
|
||||
while (fgets(line, sizeof(line), file) != NULL) {
|
||||
lineno++;
|
||||
start = lskip(rstrip(line));
|
||||
|
||||
#if INI_ALLOW_MULTILINE
|
||||
if (*prev_name && *start && start > line) {
|
||||
/* Non-black line with leading whitespace, treat as continuation
|
||||
of previous name's value (as per Python ConfigParser). */
|
||||
if (!handler(user, section, prev_name, start) && !error)
|
||||
error = lineno;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (*start == '[') {
|
||||
/* A "[section]" line */
|
||||
end = find_char_or_comment(start + 1, ']');
|
||||
if (*end == ']') {
|
||||
*end = '\0';
|
||||
strncpy0(section, start + 1, sizeof(section));
|
||||
*prev_name = '\0';
|
||||
}
|
||||
else if (!error) {
|
||||
/* No ']' found on section line */
|
||||
error = lineno;
|
||||
}
|
||||
}
|
||||
else if (*start && *start != ';') {
|
||||
/* Not a comment, must be a name=value pair */
|
||||
end = find_char_or_comment(start, '=');
|
||||
if (*end == '=') {
|
||||
*end = '\0';
|
||||
name = rstrip(start);
|
||||
value = lskip(end + 1);
|
||||
end = find_char_or_comment(value, ';');
|
||||
if (*end == ';')
|
||||
*end = '\0';
|
||||
rstrip(value);
|
||||
|
||||
/* Valid name=value pair found, call handler */
|
||||
strncpy0(prev_name, name, sizeof(prev_name));
|
||||
if (!handler(user, section, name, value) && !error)
|
||||
error = lineno;
|
||||
}
|
||||
else if (!error) {
|
||||
/* No '=' found on name=value line */
|
||||
error = lineno;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
|
||||
return error;
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
/* inih -- simple .INI file parser
|
||||
|
||||
inih is released under the New BSD license (see LICENSE.txt). Go to the project
|
||||
home page for more info:
|
||||
|
||||
http://code.google.com/p/inih/
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __INI_H__
|
||||
#define __INI_H__
|
||||
|
||||
/* Make this header file easier to include in C++ code */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Parse given INI-style file. May have [section]s, name=value pairs
|
||||
(whitespace stripped), and comments starting with ';' (semicolon). Section
|
||||
is "" if name=value pair parsed before any section heading.
|
||||
|
||||
For each name=value pair parsed, call handler function with given user
|
||||
pointer as well as section, name, and value (data only valid for duration
|
||||
of handler call). Handler should return nonzero on success, zero on error.
|
||||
|
||||
Returns 0 on success, line number of first error on parse error, or -1 on
|
||||
file open error.
|
||||
*/
|
||||
int ini_parse(const char* filename,
|
||||
int (*handler)(void* user, const char* section,
|
||||
const char* name, const char* value),
|
||||
void* user);
|
||||
|
||||
/* Nonzero to allow multi-line value parsing, in the style of Python's
|
||||
ConfigParser. If allowed, ini_parse() will call the handler with the same
|
||||
name for each subsequent line parsed. */
|
||||
#ifndef INI_ALLOW_MULTILINE
|
||||
#define INI_ALLOW_MULTILINE 1
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INI_H__ */
|
@ -1,2 +0,0 @@
|
||||
obj INIParser : ini.c ;
|
||||
obj INIReader : INIReader.cpp ;
|
@ -1,101 +0,0 @@
|
||||
|
||||
/**
|
||||
* Copyright notice
|
||||
*/
|
||||
|
||||
/**
|
||||
* Author: Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com
|
||||
*/
|
||||
|
||||
#include "string_converter.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
||||
StringConverter::StringConverter() {
|
||||
}
|
||||
|
||||
StringConverter::~StringConverter() {
|
||||
}
|
||||
|
||||
bool StringConverter::convert(std::string value, bool default_value) {
|
||||
|
||||
if(value.compare("true") == 0) {
|
||||
return true;
|
||||
} else if(value.compare("false") == 0) {
|
||||
return false;
|
||||
} else {
|
||||
return default_value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
long StringConverter::convert(std::string value, long default_value) {
|
||||
|
||||
std::stringstream stream(value);
|
||||
|
||||
long result;
|
||||
stream >> result;
|
||||
|
||||
if(stream.fail()) {
|
||||
return default_value;
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
int StringConverter::convert(std::string value, int default_value) {
|
||||
|
||||
std::stringstream stream(value);
|
||||
|
||||
int result;
|
||||
stream >> result;
|
||||
|
||||
if(stream.fail()) {
|
||||
return default_value;
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int StringConverter::convert(std::string value, unsigned int default_value) {
|
||||
|
||||
std::stringstream stream(value);
|
||||
|
||||
unsigned int result;
|
||||
stream >> result;
|
||||
|
||||
if(stream.fail()) {
|
||||
return default_value;
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
float StringConverter::convert(std::string value, float default_value) {
|
||||
|
||||
std::stringstream stream(value);
|
||||
|
||||
float result;
|
||||
stream >> result;
|
||||
|
||||
if(stream.fail()) {
|
||||
return default_value;
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
double StringConverter::convert(std::string value, double default_value) {
|
||||
|
||||
std::stringstream stream(value);
|
||||
|
||||
double result;
|
||||
stream >> result;
|
||||
|
||||
if(stream.fail()) {
|
||||
return default_value;
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
|
||||
/**
|
||||
* Copyright notice
|
||||
*/
|
||||
|
||||
/**
|
||||
* Author: Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class interprets the contents of a string and converts it into
|
||||
* different types.
|
||||
*/
|
||||
|
||||
#ifndef STRING_CONVERTER_H_
|
||||
#define STRING_CONVERTER_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
class StringConverter {
|
||||
|
||||
public:
|
||||
StringConverter();
|
||||
virtual ~StringConverter();
|
||||
|
||||
bool convert(std::string value, bool default_value);
|
||||
long convert(std::string value, long default_value);
|
||||
int convert(std::string value, int default_value);
|
||||
unsigned int convert(std::string value, unsigned int default_value);
|
||||
float convert(std::string value, float default_value);
|
||||
double convert(std::string value, double default_value);
|
||||
};
|
||||
|
||||
#endif /*STRING_CONVERTER_H_*/
|
@ -1,61 +1,77 @@
|
||||
|
||||
/**
|
||||
* Copyright notice
|
||||
*/
|
||||
|
||||
/**
|
||||
* Author: Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class implements a Unit Tests for the class StringConverter.
|
||||
/*!
|
||||
* \file string_converter_test.cc
|
||||
* \brief This file implements unit tests for the valve custom block.
|
||||
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||
* Carles Fernandez-Prades, 2012. cfernandez(at)cttc.es
|
||||
*
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "string_converter.h"
|
||||
|
||||
TEST(StringConverter, StringToBool) {
|
||||
|
||||
StringConverter *converter = new StringConverter();
|
||||
|
||||
bool conversion_result = converter->convert("false", true);
|
||||
|
||||
EXPECT_EQ(false, conversion_result);
|
||||
|
||||
delete converter;
|
||||
TEST(String_Converter_Test, StringToBool)
|
||||
{
|
||||
StringConverter *converter = new StringConverter();
|
||||
bool conversion_result = converter->convert("false", true);
|
||||
EXPECT_EQ(false, conversion_result);
|
||||
delete converter;
|
||||
}
|
||||
|
||||
TEST(StringConverter, StringToSizeT) {
|
||||
|
||||
StringConverter *converter = new StringConverter();
|
||||
|
||||
size_t conversion_result = converter->convert("8", 1);
|
||||
|
||||
EXPECT_EQ(8, conversion_result);
|
||||
|
||||
delete converter;
|
||||
TEST(String_Converter_Test, StringToSizeT)
|
||||
{
|
||||
StringConverter *converter = new StringConverter();
|
||||
size_t conversion_result = converter->convert("8", 1);
|
||||
EXPECT_EQ(8, conversion_result);
|
||||
delete converter;
|
||||
}
|
||||
|
||||
TEST(StringConverter, StringToBoolFail) {
|
||||
|
||||
StringConverter *converter = new StringConverter();
|
||||
|
||||
bool conversion_result = converter->convert("lse", true);
|
||||
|
||||
EXPECT_EQ(true, conversion_result);
|
||||
|
||||
delete converter;
|
||||
TEST(String_Converter_Test, StringToBoolFail)
|
||||
{
|
||||
StringConverter *converter = new StringConverter();
|
||||
bool conversion_result = converter->convert("lse", true);
|
||||
EXPECT_EQ(true, conversion_result);
|
||||
delete converter;
|
||||
}
|
||||
|
||||
TEST(StringConverter, StringToSizeTFail) {
|
||||
|
||||
StringConverter *converter = new StringConverter();
|
||||
|
||||
size_t conversion_result = converter->convert("false", 1);
|
||||
|
||||
EXPECT_EQ(1, conversion_result);
|
||||
|
||||
delete converter;
|
||||
}
|
||||
TEST(String_Converter_Test, StringToSizeTFail)
|
||||
{
|
||||
StringConverter *converter = new StringConverter();
|
||||
size_t conversion_result = converter->convert("false", 1);
|
||||
EXPECT_EQ(1, conversion_result);
|
||||
delete converter;
|
||||
}
|
||||
|
@ -1,13 +1,99 @@
|
||||
/*!
|
||||
* \file test_main.cc
|
||||
* \brief This file implements tests for the ControlMessageFactory.
|
||||
* \author Carles Fernandez-Prades, 2012. cfernandez(at)cttc.es
|
||||
*
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <queue>
|
||||
#include <gtest/gtest.h>
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
#include <gnuradio/gr_msg_queue.h>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include "concurrent_queue.h"
|
||||
#include "gps_navigation_message.h"
|
||||
#include "control_thread.h"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
std::cout << "Running main() from test_main.cc\n";
|
||||
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
#include "control_thread/control_message_factory_test.cc"
|
||||
//#include "control_thread/control_thread_test.cc"
|
||||
#include "configuration/file_configuration_test.cc"
|
||||
//#include "flowgraph/file_output_filter_test.cc"
|
||||
//#include "flowgraph/file_signal_source_test.cc"
|
||||
#include "flowgraph/pass_through_test.cc"
|
||||
//#include "flowgraph/gnss_flowgraph_test.cc"
|
||||
//#include "gnss_block/file_output_filter_test.cc"
|
||||
#include "gnuradio_block/gnss_sdr_valve_test.cc"
|
||||
#include "string_converter/string_converter_test.cc"
|
||||
#include "arithmetic/complex_arithmetic_libc.cc"
|
||||
#include "arithmetic/correlations_libc.cc"
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
||||
|
||||
concurrent_queue<Gps_Navigation_Message> global_gps_nav_msg_queue;
|
||||
|
||||
/*
|
||||
class Control_Message_Factory_Test : public ::testing:: Test
|
||||
{
|
||||
protected:
|
||||
Control_Message_Factory_Test(){}
|
||||
};
|
||||
|
||||
|
||||
|
||||
class File_Configuration_Test : public ::testing:: Test
|
||||
{
|
||||
protected:
|
||||
File_Configuration_Test(){}
|
||||
};
|
||||
|
||||
|
||||
class Control_Thread_Test : public ::testing:: Test
|
||||
{
|
||||
protected:
|
||||
Control_Thread_Test(){}
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
std::cout << "Running main() from test_main.cc" << std::endl;
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
@ -3,11 +3,14 @@
|
||||
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
#include "control_message_factory.h"
|
||||
#include <gr_complex_to_interleaved_short.h>
|
||||
#include <gr_file_source.h>
|
||||
#include <gr_file_sink.h>
|
||||
#include <gnuradio/gr_file_source.h>
|
||||
#include <gnuradio/gr_file_sink.h>
|
||||
#include <gr_top_block.h>
|
||||
#include <gnuradio/gr_io_signature.h>
|
||||
#include <gnuradio/gr_sync_block.h>
|
||||
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
|
@ -1,58 +0,0 @@
|
||||
|
||||
/**
|
||||
* Copyright notice
|
||||
*/
|
||||
|
||||
/**
|
||||
* Author: Carlos Avilés, 2010. carlos.avilesr(at)googlemail.com
|
||||
*/
|
||||
|
||||
/**
|
||||
* Integration test for file signal source.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#include "in_memory_configuration.h"
|
||||
#include "control_thread.h"
|
||||
|
||||
TEST(SignalSource, CorrectFileSignalSource) {
|
||||
|
||||
InMemoryConfiguration* config = new InMemoryConfiguration();
|
||||
|
||||
config->set_property("ControlThread.wait_for_flowgraph", "true");
|
||||
|
||||
config->set_property("SignalSource.implementation", "FileSignalSource");
|
||||
config->set_property("SignalSource.samples", "0");
|
||||
config->set_property("SignalSource.filename", "./signal_samples/signal_1ms.dat");
|
||||
config->set_property("SignalSource.dump", "true");
|
||||
config->set_property("SignalSource.dump_filename", "./data/test1_dump.dat");
|
||||
|
||||
config->set_property("SignalConditioner.implementation", "PassThrough");
|
||||
|
||||
config->set_property("Channels.count", "1");
|
||||
|
||||
ControlThread* control_thread = new ControlThread(config);
|
||||
control_thread->run();
|
||||
|
||||
delete control_thread;
|
||||
delete config;
|
||||
|
||||
std::ifstream signal_expected;
|
||||
signal_expected.open("./signal_samples/signal_1ms.dat", std::ios::in|std::ios::binary|std::ios::ate);
|
||||
EXPECT_FALSE(signal_expected.fail());
|
||||
|
||||
std::ifstream signal_result;
|
||||
signal_result.open("./data/test_dump.dat", std::ios::in|std::ios::binary|std::ios::ate);
|
||||
EXPECT_FALSE(signal_result.fail());
|
||||
|
||||
EXPECT_EQ(signal_expected.tellg(), signal_result.tellg());
|
||||
std::cout << signal_expected.tellg() << ":" << signal_result.tellg() << std::endl;
|
||||
|
||||
signal_expected.close();
|
||||
signal_result.close();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user