1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 04:30:33 +00:00

Replace some C-style cast by static_cast<>()

See https://stackoverflow.com/questions/1609163/what-is-the-difference-between-static-cast-and-c-style-casting
This commit is contained in:
Carles Fernandez 2017-08-18 12:45:47 +02:00
parent f71933e938
commit 61f8df3586
58 changed files with 398 additions and 390 deletions

View File

@ -280,7 +280,7 @@ rtklib_pvt_cc::rtklib_pvt_cc(unsigned int nchannels, bool dump, std::string dump
d_dump_filename.append("_raw.dat"); d_dump_filename.append("_raw.dat");
dump_ls_pvt_filename.append("_ls_pvt.dat"); dump_ls_pvt_filename.append("_ls_pvt.dat");
d_ls_pvt = std::make_shared<rtklib_solver>((int)nchannels, dump_ls_pvt_filename, d_dump, rtk); d_ls_pvt = std::make_shared<rtklib_solver>(static_cast<int>(nchannels), dump_ls_pvt_filename, d_dump, rtk);
d_ls_pvt->set_averaging_depth(1); d_ls_pvt->set_averaging_depth(1);
d_rx_time = 0.0; d_rx_time = 0.0;

View File

@ -505,7 +505,7 @@ void Pvt_Solution::perform_pos_averaging()
bool avg = d_flag_averaging; bool avg = d_flag_averaging;
if (avg == true) if (avg == true)
{ {
if (d_hist_longitude_d.size() == (unsigned int)d_averaging_depth) if (d_hist_longitude_d.size() == static_cast<unsigned int>(d_averaging_depth))
{ {
// Pop oldest value // Pop oldest value
d_hist_longitude_d.pop_back(); d_hist_longitude_d.pop_back();

View File

@ -1133,7 +1133,7 @@ void Rinex_Printer::update_nav_header(std::fstream& out, const Galileo_Iono& gal
out.close(); out.close();
out.open(navGalfilename, std::ios::out | std::ios::trunc); out.open(navGalfilename, std::ios::out | std::ios::trunc);
out.seekp(0); out.seekp(0);
for (int i = 0; i < (int) data.size() - 1; i++) for (int i = 0; i < static_cast<int>(data.size()) - 1; i++)
{ {
out << data[i] << std::endl; out << data[i] << std::endl;
} }
@ -1284,7 +1284,7 @@ void Rinex_Printer::update_nav_header(std::fstream& out, const Gps_Utc_Model& ut
out.close(); out.close();
out.open(navfilename, std::ios::out | std::ios::trunc); out.open(navfilename, std::ios::out | std::ios::trunc);
out.seekp(0); out.seekp(0);
for (int i = 0; i < (int) data.size() - 1; i++) for (int i = 0; i < static_cast<int>(data.size()) - 1; i++)
{ {
out << data[i] << std::endl; out << data[i] << std::endl;
} }
@ -1379,7 +1379,7 @@ void Rinex_Printer::update_nav_header(std::fstream & out, const Gps_CNAV_Utc_Mod
out.close(); out.close();
out.open(navfilename, std::ios::out | std::ios::trunc); out.open(navfilename, std::ios::out | std::ios::trunc);
out.seekp(0); out.seekp(0);
for (int i = 0; i < (int) data.size() - 1; i++) for (int i = 0; i < static_cast<int>(data.size()) - 1; i++)
{ {
out << data[i] << std::endl; out << data[i] << std::endl;
} }
@ -1510,7 +1510,7 @@ void Rinex_Printer::update_nav_header(std::fstream& out, const Gps_Iono& gps_ion
out.close(); out.close();
out.open(navMixfilename, std::ios::out | std::ios::trunc); out.open(navMixfilename, std::ios::out | std::ios::trunc);
out.seekp(0); out.seekp(0);
for (int i = 0; i < (int) data.size() - 1; i++) for (int i = 0; i < static_cast<int>(data.size()) - 1; i++)
{ {
out << data[i] << std::endl; out << data[i] << std::endl;
} }
@ -3522,7 +3522,7 @@ void Rinex_Printer::update_obs_header(std::fstream& out, const Gps_Utc_Model& ut
out.close(); out.close();
out.open(obsfilename, std::ios::out | std::ios::trunc); out.open(obsfilename, std::ios::out | std::ios::trunc);
out.seekp(0); out.seekp(0);
for (int i = 0; i < (int) data.size() - 1; i++) for (int i = 0; i < static_cast<int>( data.size()) - 1; i++)
{ {
out << data[i] << std::endl; out << data[i] << std::endl;
} }
@ -3581,7 +3581,7 @@ void Rinex_Printer::update_obs_header(std::fstream& out, const Gps_CNAV_Utc_Mode
out.close(); out.close();
out.open(obsfilename, std::ios::out | std::ios::trunc); out.open(obsfilename, std::ios::out | std::ios::trunc);
out.seekp(0); out.seekp(0);
for (int i = 0; i < (int) data.size() - 1; i++) for (int i = 0; i < static_cast<int>(data.size()) - 1; i++)
{ {
out << data[i] << std::endl; out << data[i] << std::endl;
} }
@ -3641,7 +3641,7 @@ void Rinex_Printer::update_obs_header(std::fstream& out, const Galileo_Utc_Model
out.close(); out.close();
out.open(obsfilename, std::ios::out | std::ios::trunc); out.open(obsfilename, std::ios::out | std::ios::trunc);
out.seekp(0); out.seekp(0);
for (int i = 0; i < (int) data.size() - 1; i++) for (int i = 0; i < static_cast<int>(data.size()) - 1; i++)
{ {
out << data[i] << std::endl; out << data[i] << std::endl;
} }

View File

@ -61,10 +61,10 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition(
if (sampled_ms_ % 4 != 0) if (sampled_ms_ % 4 != 0)
{ {
sampled_ms_ = (int)(sampled_ms_/4) * 4; sampled_ms_ = static_cast<int>(sampled_ms_ / 4) * 4;
LOG(WARNING) << "coherent_integration_time should be multiple of " LOG(WARNING) << "coherent_integration_time should be multiple of "
<< "Galileo code length (4 ms). coherent_integration_time = " << "Galileo code length (4 ms). coherent_integration_time = "
<< sampled_ms_ << " ms will be used."; << sampled_ms_ << " ms will be used.";
} }
max_dwells_ = configuration_->property(role + ".max_dwells", 1); max_dwells_ = configuration_->property(role + ".max_dwells", 1);
@ -73,13 +73,12 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition(
default_dump_filename); default_dump_filename);
//--- Find number of samples per spreading code (4 ms) ----------------- //--- Find number of samples per spreading code (4 ms) -----------------
code_length_ = round( code_length_ = round(
fs_in_ fs_in_
/ (Galileo_E1_CODE_CHIP_RATE_HZ / (Galileo_E1_CODE_CHIP_RATE_HZ
/ Galileo_E1_B_CODE_LENGTH_CHIPS)); / Galileo_E1_B_CODE_LENGTH_CHIPS));
vector_length_ = code_length_ * (int)(sampled_ms_/4); vector_length_ = code_length_ * static_cast<int>(sampled_ms_ / 4);
int samples_per_ms = code_length_ / 4; int samples_per_ms = code_length_ / 4;
@ -239,7 +238,7 @@ void GalileoE1Pcps8msAmbiguousAcquisition::reset()
float GalileoE1Pcps8msAmbiguousAcquisition::calculate_threshold(float pfa) float GalileoE1Pcps8msAmbiguousAcquisition::calculate_threshold(float pfa)
{ {
unsigned int frequency_bins = 0; unsigned int frequency_bins = 0;
for (int doppler = (int)(-doppler_max_); doppler <= (int)doppler_max_; doppler += doppler_step_) for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += doppler_step_)
{ {
frequency_bins++; frequency_bins++;
} }
@ -251,7 +250,7 @@ float GalileoE1Pcps8msAmbiguousAcquisition::calculate_threshold(float pfa)
double val = pow(1.0 - pfa,exponent); double val = pow(1.0 - pfa,exponent);
double lambda = double(vector_length_); double lambda = double(vector_length_);
boost::math::exponential_distribution<double> mydist (lambda); boost::math::exponential_distribution<double> mydist (lambda);
float threshold = (float)quantile(mydist,val); float threshold = static_cast<float>(quantile(mydist,val));
return threshold; return threshold;
} }

View File

@ -60,7 +60,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
if (sampled_ms_ % 4 != 0) if (sampled_ms_ % 4 != 0)
{ {
sampled_ms_ = (int)(sampled_ms_ / 4) * 4; sampled_ms_ = static_cast<int>(sampled_ms_ / 4) * 4;
LOG(WARNING) << "coherent_integration_time should be multiple of " LOG(WARNING) << "coherent_integration_time should be multiple of "
<< "Galileo code length (4 ms). coherent_integration_time = " << "Galileo code length (4 ms). coherent_integration_time = "
<< sampled_ms_ << " ms will be used."; << sampled_ms_ << " ms will be used.";
@ -93,12 +93,14 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
bit_transition_flag_, use_CFAR_algorithm_flag_, dump_, dump_filename_); bit_transition_flag_, use_CFAR_algorithm_flag_, dump_, dump_filename_);
DLOG(INFO) << "acquisition(" << acquisition_sc_->unique_id() << ")"; DLOG(INFO) << "acquisition(" << acquisition_sc_->unique_id() << ")";
}else{ }
item_size_ = sizeof(gr_complex); else
acquisition_cc_ = pcps_make_acquisition_cc(sampled_ms_, max_dwells_, {
doppler_max_, if_, fs_in_, samples_per_ms, code_length_, item_size_ = sizeof(gr_complex);
bit_transition_flag_, use_CFAR_algorithm_flag_, dump_, dump_filename_); acquisition_cc_ = pcps_make_acquisition_cc(sampled_ms_, max_dwells_,
DLOG(INFO) << "acquisition(" << acquisition_cc_->unique_id() << ")"; doppler_max_, if_, fs_in_, samples_per_ms, code_length_,
bit_transition_flag_, use_CFAR_algorithm_flag_, dump_, dump_filename_);
DLOG(INFO) << "acquisition(" << acquisition_cc_->unique_id() << ")";
} }
stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_); stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_);
@ -296,7 +298,7 @@ void GalileoE1PcpsAmbiguousAcquisition::set_state(int state)
float GalileoE1PcpsAmbiguousAcquisition::calculate_threshold(float pfa) float GalileoE1PcpsAmbiguousAcquisition::calculate_threshold(float pfa)
{ {
unsigned int frequency_bins = 0; unsigned int frequency_bins = 0;
for (int doppler = (int)(-doppler_max_); doppler <= (int)doppler_max_; doppler += doppler_step_) for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += doppler_step_)
{ {
frequency_bins++; frequency_bins++;
} }
@ -308,7 +310,7 @@ float GalileoE1PcpsAmbiguousAcquisition::calculate_threshold(float pfa)
double val = pow(1.0 - pfa,exponent); double val = pow(1.0 - pfa,exponent);
double lambda = double(vector_length_); double lambda = double(vector_length_);
boost::math::exponential_distribution<double> mydist (lambda); boost::math::exponential_distribution<double> mydist (lambda);
float threshold = (float)quantile(mydist,val); float threshold = static_cast<float>(quantile(mydist,val));
return threshold; return threshold;
} }

View File

@ -67,14 +67,13 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui
int samples_per_ms = round(code_length_ / 4.0); int samples_per_ms = round(code_length_ / 4.0);
/*Calculate the folding factor value based on the formula described in the paper. /*Calculate the folding factor value based on the formula described in the paper.
This may be a bug, but acquisition also work by variying the folding factor at va- This may be a bug, but acquisition also work by variying the folding factor at va-
lues different that the expressed in the paper. In adition, it is important to point lues different that the expressed in the paper. In adition, it is important to point
out that by making the folding factor smaller we were able to get QuickSync work with out that by making the folding factor smaller we were able to get QuickSync work with
Galileo. Future work should be directed to test this asumption statistically.*/ Galileo. Future work should be directed to test this asumption statistically.*/
//folding_factor_ = (unsigned int)ceil(sqrt(log2(code_length_))); //folding_factor_ = static_cast<unsigned int>(ceil(sqrt(log2(code_length_))));
folding_factor_ = configuration_->property(role + ".folding_factor", 2); folding_factor_ = configuration_->property(role + ".folding_factor", 2);
if (sampled_ms_ % (folding_factor_*4) != 0) if (sampled_ms_ % (folding_factor_*4) != 0)
@ -85,11 +84,11 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui
if(sampled_ms_ < (folding_factor_*4)) if(sampled_ms_ < (folding_factor_*4))
{ {
sampled_ms_ = (int) (folding_factor_*4); sampled_ms_ = static_cast<int>(folding_factor_ * 4);
} }
else else
{ {
sampled_ms_ = (int)(sampled_ms_/(folding_factor_*4)) * (folding_factor_*4); sampled_ms_ = static_cast<int>(sampled_ms_/(folding_factor_*4)) * (folding_factor_*4);
} }
LOG(WARNING) << "coherent_integration_time should be multiple of " LOG(WARNING) << "coherent_integration_time should be multiple of "
<< "Galileo code length (4 ms). coherent_integration_time = " << "Galileo code length (4 ms). coherent_integration_time = "
@ -296,7 +295,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_state(int state)
float GalileoE1PcpsQuickSyncAmbiguousAcquisition::calculate_threshold(float pfa) float GalileoE1PcpsQuickSyncAmbiguousAcquisition::calculate_threshold(float pfa)
{ {
unsigned int frequency_bins = 0; unsigned int frequency_bins = 0;
for (int doppler = (int)(-doppler_max_); doppler <= (int)doppler_max_; doppler += doppler_step_) for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += doppler_step_)
{ {
frequency_bins++; frequency_bins++;
} }

View File

@ -61,11 +61,10 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition(
if (sampled_ms_ % 4 != 0) if (sampled_ms_ % 4 != 0)
{ {
sampled_ms_ = (int)(sampled_ms_/4) * 4; sampled_ms_ = static_cast<int>(sampled_ms_ / 4) * 4;
LOG(WARNING) << "coherent_integration_time should be multiple of " LOG(WARNING) << "coherent_integration_time should be multiple of "
<< "Galileo code length (4 ms). coherent_integration_time = " << "Galileo code length (4 ms). coherent_integration_time = "
<< sampled_ms_ << " ms will be used."; << sampled_ms_ << " ms will be used.";
} }
tong_init_val_ = configuration->property(role + ".tong_init_val", 1); tong_init_val_ = configuration->property(role + ".tong_init_val", 1);
@ -82,7 +81,7 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition(
/ (Galileo_E1_CODE_CHIP_RATE_HZ / (Galileo_E1_CODE_CHIP_RATE_HZ
/ Galileo_E1_B_CODE_LENGTH_CHIPS)); / Galileo_E1_B_CODE_LENGTH_CHIPS));
vector_length_ = code_length_ * (int)(sampled_ms_/4); vector_length_ = code_length_ * static_cast<int>(sampled_ms_ / 4);
int samples_per_ms = code_length_ / 4; int samples_per_ms = code_length_ / 4;
@ -251,7 +250,7 @@ void GalileoE1PcpsTongAmbiguousAcquisition::set_state(int state)
float GalileoE1PcpsTongAmbiguousAcquisition::calculate_threshold(float pfa) float GalileoE1PcpsTongAmbiguousAcquisition::calculate_threshold(float pfa)
{ {
unsigned int frequency_bins = 0; unsigned int frequency_bins = 0;
for (int doppler = (int)(-doppler_max_); doppler <= (int)doppler_max_; doppler += doppler_step_) for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += doppler_step_)
{ {
frequency_bins++; frequency_bins++;
} }
@ -263,7 +262,7 @@ float GalileoE1PcpsTongAmbiguousAcquisition::calculate_threshold(float pfa)
double val = pow(1.0-pfa,exponent); double val = pow(1.0-pfa,exponent);
double lambda = double(vector_length_); double lambda = double(vector_length_);
boost::math::exponential_distribution<double> mydist (lambda); boost::math::exponential_distribution<double> mydist (lambda);
float threshold = (float)quantile(mydist,val); float threshold = static_cast<float>(quantile(mydist,val));
return threshold; return threshold;
} }

View File

@ -282,7 +282,7 @@ float GalileoE5aNoncoherentIQAcquisitionCaf::calculate_threshold(float pfa)
{ {
//Calculate the threshold //Calculate the threshold
unsigned int frequency_bins = 0; unsigned int frequency_bins = 0;
for (int doppler = (int)(-doppler_max_); doppler <= (int)doppler_max_; doppler += doppler_step_) for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += doppler_step_)
{ {
frequency_bins++; frequency_bins++;
} }
@ -292,7 +292,7 @@ float GalileoE5aNoncoherentIQAcquisitionCaf::calculate_threshold(float pfa)
double val = pow(1.0 - pfa, exponent); double val = pow(1.0 - pfa, exponent);
double lambda = double(vector_length_); double lambda = double(vector_length_);
boost::math::exponential_distribution<double> mydist (lambda); boost::math::exponential_distribution<double> mydist (lambda);
float threshold = (float)quantile(mydist,val); float threshold = static_cast<float>(quantile(mydist,val));
return threshold; return threshold;
} }

View File

@ -89,12 +89,14 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
bit_transition_flag_, use_CFAR_algorithm_flag_, dump_, dump_filename_); bit_transition_flag_, use_CFAR_algorithm_flag_, dump_, dump_filename_);
DLOG(INFO) << "acquisition(" << acquisition_sc_->unique_id() << ")"; DLOG(INFO) << "acquisition(" << acquisition_sc_->unique_id() << ")";
}else{ }
item_size_ = sizeof(gr_complex); else
acquisition_cc_ = pcps_make_acquisition_cc(sampled_ms_, max_dwells_, {
doppler_max_, if_, fs_in_, code_length_, code_length_, item_size_ = sizeof(gr_complex);
bit_transition_flag_, use_CFAR_algorithm_flag_, dump_, dump_filename_); acquisition_cc_ = pcps_make_acquisition_cc(sampled_ms_, max_dwells_,
DLOG(INFO) << "acquisition(" << acquisition_cc_->unique_id() << ")"; doppler_max_, if_, fs_in_, code_length_, code_length_,
bit_transition_flag_, use_CFAR_algorithm_flag_, dump_, dump_filename_);
DLOG(INFO) << "acquisition(" << acquisition_cc_->unique_id() << ")";
} }
stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_); stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_);
@ -130,7 +132,6 @@ void GpsL1CaPcpsAcquisition::set_channel(unsigned int channel)
{ {
acquisition_cc_->set_channel(channel_); acquisition_cc_->set_channel(channel_);
} }
} }
@ -188,9 +189,9 @@ void GpsL1CaPcpsAcquisition::set_doppler_step(unsigned int doppler_step)
{ {
acquisition_cc_->set_doppler_step(doppler_step_); acquisition_cc_->set_doppler_step(doppler_step_);
} }
} }
void GpsL1CaPcpsAcquisition::set_gnss_synchro(Gnss_Synchro* gnss_synchro) void GpsL1CaPcpsAcquisition::set_gnss_synchro(Gnss_Synchro* gnss_synchro)
{ {
gnss_synchro_ = gnss_synchro; gnss_synchro_ = gnss_synchro;
@ -236,7 +237,6 @@ void GpsL1CaPcpsAcquisition::init()
void GpsL1CaPcpsAcquisition::set_local_code() void GpsL1CaPcpsAcquisition::set_local_code()
{ {
std::complex<float>* code = new std::complex<float>[code_length_]; std::complex<float>* code = new std::complex<float>[code_length_];
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0); gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
@ -291,7 +291,7 @@ float GpsL1CaPcpsAcquisition::calculate_threshold(float pfa)
{ {
//Calculate the threshold //Calculate the threshold
unsigned int frequency_bins = 0; unsigned int frequency_bins = 0;
for (int doppler = (int)(-doppler_max_); doppler <= (int)doppler_max_; doppler += doppler_step_) for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += doppler_step_)
{ {
frequency_bins++; frequency_bins++;
} }
@ -301,7 +301,7 @@ float GpsL1CaPcpsAcquisition::calculate_threshold(float pfa)
double val = pow(1.0 - pfa, exponent); double val = pow(1.0 - pfa, exponent);
double lambda = double(vector_length_); double lambda = double(vector_length_);
boost::math::exponential_distribution<double> mydist (lambda); boost::math::exponential_distribution<double> mydist (lambda);
float threshold = (float)quantile(mydist,val); float threshold = static_cast<float>(quantile(mydist,val));
return threshold; return threshold;
} }

View File

@ -220,7 +220,7 @@ float GpsL1CaPcpsAcquisitionFpga::calculate_threshold(float pfa)
{ {
//Calculate the threshold //Calculate the threshold
unsigned int frequency_bins = 0; unsigned int frequency_bins = 0;
for (int doppler = (int) (-doppler_max_); doppler <= (int) doppler_max_; for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_);
doppler += doppler_step_) doppler += doppler_step_)
{ {
frequency_bins++; frequency_bins++;
@ -231,7 +231,7 @@ float GpsL1CaPcpsAcquisitionFpga::calculate_threshold(float pfa)
double val = pow(1.0 - pfa, exponent); double val = pow(1.0 - pfa, exponent);
double lambda = double(vector_length_); double lambda = double(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda); boost::math::exponential_distribution<double> mydist(lambda);
float threshold = (float) quantile(mydist, val); float threshold = static_cast<float>(quantile(mydist, val));
return threshold; return threshold;
} }

View File

@ -236,7 +236,7 @@ float GpsL1CaPcpsMultithreadAcquisition::calculate_threshold(float pfa)
//Calculate the threshold //Calculate the threshold
unsigned int frequency_bins = 0; unsigned int frequency_bins = 0;
for (int doppler = (int)(-doppler_max_); doppler <= (int)doppler_max_; doppler += doppler_step_) for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += doppler_step_)
{ {
frequency_bins++; frequency_bins++;
} }
@ -248,7 +248,7 @@ float GpsL1CaPcpsMultithreadAcquisition::calculate_threshold(float pfa)
double val = pow(1.0 - pfa, exponent); double val = pow(1.0 - pfa, exponent);
double lambda = double(vector_length_); double lambda = double(vector_length_);
boost::math::exponential_distribution<double> mydist (lambda); boost::math::exponential_distribution<double> mydist (lambda);
float threshold = (float)quantile(mydist,val); float threshold = static_cast<float>(quantile(mydist,val));
return threshold; return threshold;
} }

View File

@ -233,7 +233,7 @@ float GpsL1CaPcpsOpenClAcquisition::calculate_threshold(float pfa)
//Calculate the threshold //Calculate the threshold
unsigned int frequency_bins = 0; unsigned int frequency_bins = 0;
for (int doppler = (int)(-doppler_max_); doppler <= (int)doppler_max_; doppler += doppler_step_) for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += doppler_step_)
{ {
frequency_bins++; frequency_bins++;
} }
@ -245,7 +245,7 @@ float GpsL1CaPcpsOpenClAcquisition::calculate_threshold(float pfa)
double val = pow(1.0 - pfa, exponent); double val = pow(1.0 - pfa, exponent);
double lambda = double(vector_length_); double lambda = double(vector_length_);
boost::math::exponential_distribution<double> mydist (lambda); boost::math::exponential_distribution<double> mydist (lambda);
float threshold = (float)quantile(mydist,val); float threshold = static_cast<float>(quantile(mydist,val));
return threshold; return threshold;
} }

View File

@ -59,34 +59,32 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition(
doppler_max_ = configuration->property(role + ".doppler_max", 5000); doppler_max_ = configuration->property(role + ".doppler_max", 5000);
sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 4); sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 4);
//--- Find number of samples per spreading code ------------------------- //--- Find number of samples per spreading code -------------------------
code_length_ = round(fs_in_ code_length_ = round(fs_in_
/ (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)); / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS));
/*Calculate the folding factor value based on the calculations*/ /*Calculate the folding factor value based on the calculations*/
unsigned int temp = (unsigned int)ceil(sqrt(log2(code_length_))); unsigned int temp = static_cast<unsigned int>(ceil(sqrt(log2(code_length_))));
folding_factor_ = configuration_->property(role + ".folding_factor", temp); folding_factor_ = configuration_->property(role + ".folding_factor", temp);
if ( sampled_ms_ % folding_factor_ != 0) if ( sampled_ms_ % folding_factor_ != 0)
{ {
LOG(WARNING) << "QuickSync Algorithm requires a coherent_integration_time" LOG(WARNING) << "QuickSync Algorithm requires a coherent_integration_time"
<< " multiple of " << folding_factor_ << "ms, Value entered " << " multiple of " << folding_factor_ << "ms, Value entered "
<< sampled_ms_ << " ms"; << sampled_ms_ << " ms";
if(sampled_ms_ < folding_factor_) if(sampled_ms_ < folding_factor_)
{ {
sampled_ms_ = (int) folding_factor_; sampled_ms_ = static_cast<int>(folding_factor_);
} }
else else
{ {
sampled_ms_ = (int)(sampled_ms_/folding_factor_) * folding_factor_; sampled_ms_ = static_cast<int>(sampled_ms_ / folding_factor_) * folding_factor_;
} }
LOG(WARNING) <<" Coherent_integration_time of " LOG(WARNING) << " Coherent_integration_time of "
<< sampled_ms_ << " ms will be used instead."; << sampled_ms_ << " ms will be used instead.";
} }
vector_length_ = code_length_ * sampled_ms_; vector_length_ = code_length_ * sampled_ms_;
bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false); bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false);
@ -276,7 +274,7 @@ float GpsL1CaPcpsQuickSyncAcquisition::calculate_threshold(float pfa)
{ {
//Calculate the threshold //Calculate the threshold
unsigned int frequency_bins = 0; unsigned int frequency_bins = 0;
for (int doppler = (int)(-doppler_max_); doppler <= (int)doppler_max_; doppler += doppler_step_) for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += doppler_step_)
{ {
frequency_bins++; frequency_bins++;
} }
@ -298,7 +296,6 @@ void GpsL1CaPcpsQuickSyncAcquisition::connect(gr::top_block_sptr top_block)
{ {
top_block->connect(stream_to_vector_, 0, acquisition_cc_, 0); top_block->connect(stream_to_vector_, 0, acquisition_cc_, 0);
} }
} }

View File

@ -232,7 +232,7 @@ float GpsL1CaPcpsTongAcquisition::calculate_threshold(float pfa)
{ {
//Calculate the threshold //Calculate the threshold
unsigned int frequency_bins = 0; unsigned int frequency_bins = 0;
for (int doppler = (int)(-doppler_max_); doppler <= (int)doppler_max_; doppler += doppler_step_) for (int doppler = static_cast<int>(-doppler_max_); doppler <= static_cast<int>(doppler_max_); doppler += doppler_step_)
{ {
frequency_bins++; frequency_bins++;
} }
@ -244,7 +244,7 @@ float GpsL1CaPcpsTongAcquisition::calculate_threshold(float pfa)
double val = pow(1.0 - pfa,exponent); double val = pow(1.0 - pfa,exponent);
double lambda = double(vector_length_); double lambda = double(vector_length_);
boost::math::exponential_distribution<double> mydist (lambda); boost::math::exponential_distribution<double> mydist (lambda);
float threshold = (float)quantile(mydist, val); float threshold = static_cast<float>(quantile(mydist, val));
return threshold; return threshold;
} }

View File

@ -88,12 +88,14 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
bit_transition_flag_, use_CFAR_algorithm_flag_, dump_, dump_filename_); bit_transition_flag_, use_CFAR_algorithm_flag_, dump_, dump_filename_);
DLOG(INFO) << "acquisition(" << acquisition_sc_->unique_id() << ")"; DLOG(INFO) << "acquisition(" << acquisition_sc_->unique_id() << ")";
}else{ }
item_size_ = sizeof(gr_complex); else
acquisition_cc_ = pcps_make_acquisition_cc(1, max_dwells_, {
doppler_max_, if_, fs_in_, code_length_, code_length_, item_size_ = sizeof(gr_complex);
bit_transition_flag_, use_CFAR_algorithm_flag_, dump_, dump_filename_); acquisition_cc_ = pcps_make_acquisition_cc(1, max_dwells_,
DLOG(INFO) << "acquisition(" << acquisition_cc_->unique_id() << ")"; doppler_max_, if_, fs_in_, code_length_, code_length_,
bit_transition_flag_, use_CFAR_algorithm_flag_, dump_, dump_filename_);
DLOG(INFO) << "acquisition(" << acquisition_cc_->unique_id() << ")";
} }
stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_); stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_);
@ -305,7 +307,7 @@ float GpsL2MPcpsAcquisition::calculate_threshold(float pfa)
double val = pow(1.0 - pfa, exponent); double val = pow(1.0 - pfa, exponent);
double lambda = double(vector_length_); double lambda = double(vector_length_);
boost::math::exponential_distribution<double> mydist (lambda); boost::math::exponential_distribution<double> mydist (lambda);
float threshold = (float)quantile(mydist,val); float threshold = static_cast<float>(quantile(mydist,val));
return threshold; return threshold;
} }

View File

@ -218,7 +218,7 @@ void gps_pcps_acquisition_fpga_sc::set_active(bool active)
d_sample_counter = initial_sample; d_sample_counter = initial_sample;
temp_peak_to_noise_level = (float) (magt / input_power); temp_peak_to_noise_level = static_cast<float>(magt) / static_cast<float>(input_power);
if (peak_to_noise_level < temp_peak_to_noise_level) if (peak_to_noise_level < temp_peak_to_noise_level)
{ {
peak_to_noise_level = temp_peak_to_noise_level; peak_to_noise_level = temp_peak_to_noise_level;

View File

@ -165,8 +165,8 @@ void pcps_multithread_acquisition_cc::init()
// Count the number of bins // Count the number of bins
d_num_doppler_bins = 0; d_num_doppler_bins = 0;
for (int doppler = (int)(-d_doppler_max); for (int doppler = static_cast<int>(-d_doppler_max);
doppler <= (int)d_doppler_max; doppler <= static_cast<int>(d_doppler_max);
doppler += d_doppler_step) doppler += d_doppler_step)
{ {
d_num_doppler_bins++; d_num_doppler_bins++;
@ -177,7 +177,7 @@ void pcps_multithread_acquisition_cc::init()
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++) for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
{ {
d_grid_doppler_wipeoffs[doppler_index] = static_cast<gr_complex*>(volk_malloc(d_fft_size * sizeof(gr_complex), volk_get_alignment())); d_grid_doppler_wipeoffs[doppler_index] = static_cast<gr_complex*>(volk_malloc(d_fft_size * sizeof(gr_complex), volk_get_alignment()));
int doppler = -(int)d_doppler_max + d_doppler_step * doppler_index; int doppler = -static_cast<int>(d_doppler_max) + d_doppler_step * doppler_index;
float phase_step_rad = static_cast<float>(GPS_TWO_PI) * (d_freq + doppler) / static_cast<float>(d_fs_in); float phase_step_rad = static_cast<float>(GPS_TWO_PI) * (d_freq + doppler) / static_cast<float>(d_fs_in);
float _phase[1]; float _phase[1];
_phase[0] = 0; _phase[0] = 0;
@ -201,7 +201,7 @@ void pcps_multithread_acquisition_cc::acquisition_core()
int doppler; int doppler;
uint32_t indext = 0; uint32_t indext = 0;
float magt = 0.0; float magt = 0.0;
float fft_normalization_factor = (float)d_fft_size * (float)d_fft_size; float fft_normalization_factor = static_cast<float>(d_fft_size) * static_cast<float>(d_fft_size);
gr_complex* in = d_in_buffer[d_well_count]; gr_complex* in = d_in_buffer[d_well_count];
unsigned long int samplestamp = d_sample_counter_buffer[d_well_count]; unsigned long int samplestamp = d_sample_counter_buffer[d_well_count];
@ -219,14 +219,14 @@ void pcps_multithread_acquisition_cc::acquisition_core()
// 1- Compute the input signal power estimation // 1- Compute the input signal power estimation
volk_32fc_magnitude_squared_32f(d_magnitude, in, d_fft_size); volk_32fc_magnitude_squared_32f(d_magnitude, in, d_fft_size);
volk_32f_accumulator_s32f(&d_input_power, d_magnitude, d_fft_size); volk_32f_accumulator_s32f(&d_input_power, d_magnitude, d_fft_size);
d_input_power /= (float)d_fft_size; d_input_power /= static_cast<float>(d_fft_size);
// 2- Doppler frequency search loop // 2- Doppler frequency search loop
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++) for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
{ {
// doppler search steps // doppler search steps
doppler = -(int)d_doppler_max + d_doppler_step*doppler_index; doppler = -static_cast<int>(d_doppler_max) + d_doppler_step * doppler_index;
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in, volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in,
d_grid_doppler_wipeoffs[doppler_index], d_fft_size); d_grid_doppler_wipeoffs[doppler_index], d_fft_size);
@ -264,8 +264,8 @@ void pcps_multithread_acquisition_cc::acquisition_core()
// restarted between consecutive dwells in multidwell operation. // restarted between consecutive dwells in multidwell operation.
if (d_test_statistics < (d_mag / d_input_power) || !d_bit_transition_flag) if (d_test_statistics < (d_mag / d_input_power) || !d_bit_transition_flag)
{ {
d_gnss_synchro->Acq_delay_samples = (double)(indext % d_samples_per_code); d_gnss_synchro->Acq_delay_samples = static_cast<double>(indext % d_samples_per_code);
d_gnss_synchro->Acq_doppler_hz = (double)doppler; d_gnss_synchro->Acq_doppler_hz = static_cast<double>(doppler);
d_gnss_synchro->Acq_samplestamp_samples = samplestamp; d_gnss_synchro->Acq_samplestamp_samples = samplestamp;
// 5- Compute the test statistics and compare to the threshold // 5- Compute the test statistics and compare to the threshold
@ -384,7 +384,7 @@ int pcps_multithread_acquisition_cc::general_work(int noutput_items,
// Fill internal buffer with d_max_dwells signal blocks. This step ensures that // Fill internal buffer with d_max_dwells signal blocks. This step ensures that
// consecutive signal blocks will be processed in multi-dwell operation. This is // consecutive signal blocks will be processed in multi-dwell operation. This is
// essential when d_bit_transition_flag = true. // essential when d_bit_transition_flag = true.
unsigned int num_dwells = std::min((int)(d_max_dwells-d_in_dwell_count),ninput_items[0]); unsigned int num_dwells = std::min(static_cast<int>(d_max_dwells - d_in_dwell_count), ninput_items[0]);
for (unsigned int i = 0; i < num_dwells; i++) for (unsigned int i = 0; i < num_dwells; i++)
{ {
memcpy(d_in_buffer[d_in_dwell_count++], (gr_complex*)input_items[i], memcpy(d_in_buffer[d_in_dwell_count++], (gr_complex*)input_items[i],
@ -393,7 +393,7 @@ int pcps_multithread_acquisition_cc::general_work(int noutput_items,
d_sample_counter_buffer.push_back(d_sample_counter); d_sample_counter_buffer.push_back(d_sample_counter);
} }
if (ninput_items[0] > (int)num_dwells) if (ninput_items[0] > static_cast<int>(num_dwells))
{ {
d_sample_counter += d_fft_size * (ninput_items[0]-num_dwells); d_sample_counter += d_fft_size * (ninput_items[0]-num_dwells);
} }

View File

@ -90,9 +90,7 @@ gps_fpga_acquisition_8sc::gps_fpga_acquisition_8sc(std::string device_name,
unsigned int nsamples_total, long fs_in, long freq, unsigned int nsamples_total, long fs_in, long freq,
unsigned int sampled_ms, unsigned select_queue) unsigned int sampled_ms, unsigned select_queue)
{ {
// initial values // initial values
d_device_name = device_name; d_device_name = device_name;
d_freq = freq; d_freq = freq;
d_fs_in = fs_in; d_fs_in = fs_in;
@ -115,10 +113,7 @@ gps_fpga_acquisition_8sc::gps_fpga_acquisition_8sc(std::string device_name,
std::complex<float>* code = new std::complex<float>[nsamples_total]; // buffer for the local code std::complex<float>* code = new std::complex<float>[nsamples_total]; // buffer for the local code
std::complex<float> * code_total = new gr_complex[vector_length]; // buffer for the local code repeate every number of ms std::complex<float> * code_total = new gr_complex[vector_length]; // buffer for the local code repeate every number of ms
gr_complex* d_fft_codes_padded = gr_complex* d_fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(vector_length * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
static_cast<gr_complex*>(volk_gnsssdr_malloc(
vector_length * sizeof(gr_complex),
volk_gnsssdr_get_alignment()));
d_all_fft_codes = new lv_16sc_t[vector_length * NUM_PRNs]; // memory containing all the possible fft codes for PRN 0 to 32 d_all_fft_codes = new lv_16sc_t[vector_length * NUM_PRNs]; // memory containing all the possible fft codes for PRN 0 to 32
@ -130,19 +125,16 @@ gps_fpga_acquisition_8sc::gps_fpga_acquisition_8sc(std::string device_name,
for (unsigned int i = 0; i < sampled_ms; i++) for (unsigned int i = 0; i < sampled_ms; i++)
{ {
memcpy(&(code_total[i * nsamples_total]), code, memcpy(&(code_total[i * nsamples_total]), code, sizeof(gr_complex) * nsamples_total); // repeat for each ms
sizeof(gr_complex) * nsamples_total); // repeat for each ms
} }
int offset = 0; int offset = 0;
memcpy(d_fft_if->get_inbuf() + offset, code_total, memcpy(d_fft_if->get_inbuf() + offset, code_total, sizeof(gr_complex) * vector_length); // copy to FFT buffer
sizeof(gr_complex) * vector_length); // copy to FFT buffer
d_fft_if->execute(); // Run the FFT of local code d_fft_if->execute(); // Run the FFT of local code
volk_32fc_conjugate_32fc(d_fft_codes_padded, d_fft_if->get_outbuf(), volk_32fc_conjugate_32fc(d_fft_codes_padded, d_fft_if->get_outbuf(), vector_length); // conjugate values
vector_length); // conjugate values
max = 0; // initialize maximum value max = 0; // initialize maximum value
@ -160,11 +152,8 @@ gps_fpga_acquisition_8sc::gps_fpga_acquisition_8sc(std::string device_name,
for (unsigned int i = 0; i < vector_length; i++) // map the FFT to the dynamic range of the fixed point values an copy to buffer containing all FFTs for (unsigned int i = 0; i < vector_length; i++) // map the FFT to the dynamic range of the fixed point values an copy to buffer containing all FFTs
{ {
d_all_fft_codes[i + vector_length * PRN] = lv_16sc_t( d_all_fft_codes[i + vector_length * PRN] = lv_16sc_t(static_cast<int>(d_fft_codes_padded[i].real() * (pow(2, 7) - 1) / max),
(int) (d_fft_codes_padded[i].real() static_cast<int>(d_fft_codes_padded[i].imag() * (pow(2, 7) - 1) / max));
* (pow(2, 7) - 1) / max),
(int) (d_fft_codes_padded[i].imag()
* (pow(2, 7) - 1) / max));
} }
} }
@ -174,21 +163,22 @@ gps_fpga_acquisition_8sc::gps_fpga_acquisition_8sc(std::string device_name,
delete[] code_total; delete[] code_total;
delete d_fft_if; delete d_fft_if;
delete[] d_fft_codes_padded; delete[] d_fft_codes_padded;
} }
gps_fpga_acquisition_8sc::~gps_fpga_acquisition_8sc() gps_fpga_acquisition_8sc::~gps_fpga_acquisition_8sc()
{ {
delete[] d_all_fft_codes; delete[] d_all_fft_codes;
} }
bool gps_fpga_acquisition_8sc::free() bool gps_fpga_acquisition_8sc::free()
{ {
return true; return true;
} }
unsigned gps_fpga_acquisition_8sc::fpga_acquisition_test_register(
unsigned writeval) unsigned gps_fpga_acquisition_8sc::fpga_acquisition_test_register(unsigned writeval)
{ {
unsigned readval; unsigned readval;
// write value to test register // write value to test register
@ -199,8 +189,8 @@ unsigned gps_fpga_acquisition_8sc::fpga_acquisition_test_register(
return readval; return readval;
} }
void gps_fpga_acquisition_8sc::fpga_configure_acquisition_local_code(
lv_16sc_t fft_local_code[]) void gps_fpga_acquisition_8sc::fpga_configure_acquisition_local_code(lv_16sc_t fft_local_code[])
{ {
short int local_code; short int local_code;
unsigned int k, tmp, tmp2; unsigned int k, tmp, tmp2;
@ -216,6 +206,7 @@ void gps_fpga_acquisition_8sc::fpga_configure_acquisition_local_code(
} }
} }
void gps_fpga_acquisition_8sc::run_acquisition(void) void gps_fpga_acquisition_8sc::run_acquisition(void)
{ {
// enable interrupts // enable interrupts
@ -235,6 +226,7 @@ void gps_fpga_acquisition_8sc::run_acquisition(void)
} }
} }
void gps_fpga_acquisition_8sc::configure_acquisition() void gps_fpga_acquisition_8sc::configure_acquisition()
{ {
d_map_base[0] = d_select_queue; d_map_base[0] = d_select_queue;
@ -242,16 +234,15 @@ void gps_fpga_acquisition_8sc::configure_acquisition()
d_map_base[2] = d_nsamples; d_map_base[2] = d_nsamples;
} }
void gps_fpga_acquisition_8sc::set_phase_step(unsigned int doppler_index) void gps_fpga_acquisition_8sc::set_phase_step(unsigned int doppler_index)
{ {
float phase_step_rad_real; float phase_step_rad_real;
float phase_step_rad_int_temp; float phase_step_rad_int_temp;
int32_t phase_step_rad_int; int32_t phase_step_rad_int;
int doppler = -static_cast<int>(d_doppler_max) int doppler = -static_cast<int>(d_doppler_max) + d_doppler_step * doppler_index;
+ d_doppler_step * doppler_index; float phase_step_rad = GPS_TWO_PI * (d_freq + doppler) / static_cast<float>(d_fs_in);
float phase_step_rad = GPS_TWO_PI * (d_freq + doppler)
/ static_cast<float>(d_fs_in);
// The doppler step can never be outside the range -pi to +pi, otherwise there would be aliasing // The doppler step can never be outside the range -pi to +pi, otherwise there would be aliasing
// The FPGA expects phase_step_rad between -1 (-pi) to +1 (+pi) // The FPGA expects phase_step_rad between -1 (-pi) to +1 (+pi)
// The FPGA also expects the phase to be negative since it produces cos(x) -j*sin(x) // The FPGA also expects the phase to be negative since it produces cos(x) -j*sin(x)
@ -269,6 +260,7 @@ void gps_fpga_acquisition_8sc::set_phase_step(unsigned int doppler_index)
d_map_base[3] = phase_step_rad_int; d_map_base[3] = phase_step_rad_int;
} }
void gps_fpga_acquisition_8sc::read_acquisition_results(uint32_t* max_index, void gps_fpga_acquisition_8sc::read_acquisition_results(uint32_t* max_index,
float* max_magnitude, unsigned *initial_sample, float *power_sum) float* max_magnitude, unsigned *initial_sample, float *power_sum)
{ {
@ -277,24 +269,26 @@ void gps_fpga_acquisition_8sc::read_acquisition_results(uint32_t* max_index,
readval = d_map_base[1]; readval = d_map_base[1];
*initial_sample = readval; *initial_sample = readval;
readval = d_map_base[2]; readval = d_map_base[2];
*max_magnitude = (float) readval; *max_magnitude = static_cast<float>(readval);
readval = d_map_base[4]; readval = d_map_base[4];
*power_sum = (float) readval; *power_sum = static_cast<float>(readval);
readval = d_map_base[3]; readval = d_map_base[3];
*max_index = readval; *max_index = readval;
} }
void gps_fpga_acquisition_8sc::block_samples() void gps_fpga_acquisition_8sc::block_samples()
{ {
d_map_base[14] = 1; // block the samples d_map_base[14] = 1; // block the samples
} }
void gps_fpga_acquisition_8sc::unblock_samples() void gps_fpga_acquisition_8sc::unblock_samples()
{ {
d_map_base[14] = 0; // unblock the samples d_map_base[14] = 0; // unblock the samples
} }
void gps_fpga_acquisition_8sc::open_device() void gps_fpga_acquisition_8sc::open_device()
{ {
@ -302,13 +296,13 @@ void gps_fpga_acquisition_8sc::open_device()
{ {
LOG(WARNING) << "Cannot open deviceio" << d_device_name; LOG(WARNING) << "Cannot open deviceio" << d_device_name;
} }
d_map_base = (volatile unsigned *) mmap(NULL, PAGE_SIZE, d_map_base = (volatile unsigned *) mmap(NULL, PAGE_SIZE,
PROT_READ | PROT_WRITE, MAP_SHARED, d_fd, 0); PROT_READ | PROT_WRITE, MAP_SHARED, d_fd, 0);
if (d_map_base == (void *) -1) if (d_map_base == (void *) -1)
{ {
LOG(WARNING) LOG(WARNING) << "Cannot map the FPGA acquisition module into user memory";
<< "Cannot map the FPGA acquisition module into user memory";
} }
// sanity check : check test register // sanity check : check test register
@ -319,8 +313,8 @@ void gps_fpga_acquisition_8sc::open_device()
// acquisition, etc ..) // acquisition, etc ..)
unsigned writeval = TEST_REGISTER_ACQ_WRITEVAL; unsigned writeval = TEST_REGISTER_ACQ_WRITEVAL;
unsigned readval; unsigned readval;
readval = gps_fpga_acquisition_8sc::fpga_acquisition_test_register( readval = gps_fpga_acquisition_8sc::fpga_acquisition_test_register(writeval);
writeval);
if (writeval != readval) if (writeval != readval)
{ {
LOG(WARNING) << "Acquisition test register sanity check failed"; LOG(WARNING) << "Acquisition test register sanity check failed";
@ -329,8 +323,9 @@ void gps_fpga_acquisition_8sc::open_device()
{ {
LOG(INFO) << "Acquisition test register sanity check success !"; LOG(INFO) << "Acquisition test register sanity check success !";
} }
} }
void gps_fpga_acquisition_8sc::close_device() void gps_fpga_acquisition_8sc::close_device()
{ {
if (munmap((void*) d_map_base, PAGE_SIZE) == -1) if (munmap((void*) d_map_base, PAGE_SIZE) == -1)
@ -338,6 +333,5 @@ void gps_fpga_acquisition_8sc::close_device()
printf("Failed to unmap memory uio\n"); printf("Failed to unmap memory uio\n");
} }
close(d_fd); close(d_fd);
} }

View File

@ -57,7 +57,7 @@ int gnss_sdr_sample_counter::work (int noutput_items,
{ {
const Gnss_Synchro *in = (const Gnss_Synchro *) input_items[0]; // input const Gnss_Synchro *in = (const Gnss_Synchro *) input_items[0]; // input
double current_T_rx_s = in[noutput_items-1].Tracking_sample_counter / (double)in[noutput_items-1].fs; double current_T_rx_s = in[noutput_items-1].Tracking_sample_counter / static_cast<double>(in[noutput_items-1].fs);
if ((current_T_rx_s - last_T_rx_s) > report_interval_s) if ((current_T_rx_s - last_T_rx_s) > report_interval_s)
{ {
std::cout << "Current receiver time: " << floor(current_T_rx_s) << " [s]" << std::endl; std::cout << "Current receiver time: " << floor(current_T_rx_s) << " [s]" << std::endl;

View File

@ -51,7 +51,7 @@ DirectResamplerConditioner::DirectResamplerConditioner(
std::string default_dump_file = "./data/signal_conditioner.dat"; std::string default_dump_file = "./data/signal_conditioner.dat";
double fs_in; double fs_in;
fs_in = configuration->property("GNSS-SDR.internal_fs_hz", 2048000.0); fs_in = configuration->property("GNSS-SDR.internal_fs_hz", 2048000.0);
sample_freq_in_ = configuration->property(role_ + ".sample_freq_in", (double)4000000.0); sample_freq_in_ = configuration->property(role_ + ".sample_freq_in", 4000000.0);
sample_freq_out_ = configuration->property(role_ + ".sample_freq_out", fs_in); sample_freq_out_ = configuration->property(role_ + ".sample_freq_out", fs_in);
if(std::fabs(fs_in - sample_freq_out_) > std::numeric_limits<double>::epsilon()) if(std::fabs(fs_in - sample_freq_out_) > std::numeric_limits<double>::epsilon())
{ {

View File

@ -87,19 +87,19 @@ SignalGenerator::SignalGenerator(ConfigurationInterface* configuration,
{ {
if (signal1[0].at(0)=='5') if (signal1[0].at(0)=='5')
{ {
vector_length = round((float) fs_in / (Galileo_E5a_CODE_CHIP_RATE_HZ vector_length = round(static_cast<float>(fs_in) / (Galileo_E5a_CODE_CHIP_RATE_HZ
/ Galileo_E5a_CODE_LENGTH_CHIPS)); / Galileo_E5a_CODE_LENGTH_CHIPS));
} }
else else
{ {
vector_length = round((float)fs_in / (Galileo_E1_CODE_CHIP_RATE_HZ vector_length = round(static_cast<float>(fs_in) / (Galileo_E1_CODE_CHIP_RATE_HZ
/ Galileo_E1_B_CODE_LENGTH_CHIPS)) / Galileo_E1_B_CODE_LENGTH_CHIPS))
* Galileo_E1_C_SECONDARY_CODE_LENGTH; * Galileo_E1_C_SECONDARY_CODE_LENGTH;
} }
} }
else if (std::find(system.begin(), system.end(), "G") != system.end()) else if (std::find(system.begin(), system.end(), "G") != system.end())
{ {
vector_length = round((float)fs_in vector_length = round(static_cast<float>(fs_in)
/ (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)); / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS));
} }

View File

@ -122,7 +122,7 @@ NsrFileSignalSource::NsrFileSignalSource(ConfigurationInterface* configuration,
if (file.is_open()) if (file.is_open())
{ {
size = file.tellg(); size = file.tellg();
LOG(INFO) << "Total samples in the file= " << floor((double)size / (double)item_size()); LOG(INFO) << "Total samples in the file= " << floor(static_cast<double>(size) / static_cast<double>(item_size()));
} }
else else
{ {
@ -131,20 +131,20 @@ NsrFileSignalSource::NsrFileSignalSource(ConfigurationInterface* configuration,
} }
std::streamsize ss = std::cout.precision(); std::streamsize ss = std::cout.precision();
std::cout << std::setprecision(16); std::cout << std::setprecision(16);
std::cout << "Processing file " << filename_ << ", which contains " << (double)size << " [bytes]" << std::endl; std::cout << "Processing file " << filename_ << ", which contains " << size << " [bytes]" << std::endl;
std::cout.precision (ss); std::cout.precision (ss);
if (size > 0) if (size > 0)
{ {
int sample_packet_factor = 4; // 1 byte -> 4 samples int sample_packet_factor = 4; // 1 byte -> 4 samples
samples_ = floor((double)size / (double)item_size())*sample_packet_factor; samples_ = floor(static_cast<double>(size) / static_cast<double>(item_size())) * sample_packet_factor;
samples_ = samples_- ceil(0.002 * (double)sampling_frequency_); //process all the samples available in the file excluding the last 2 ms samples_ = samples_- ceil(0.002 * static_cast<double>(sampling_frequency_)); //process all the samples available in the file excluding the last 2 ms
} }
} }
CHECK(samples_ > 0) << "File does not contain enough samples to process."; CHECK(samples_ > 0) << "File does not contain enough samples to process.";
double signal_duration_s; double signal_duration_s;
signal_duration_s = (double)samples_ * ( 1 /(double)sampling_frequency_); signal_duration_s = static_cast<double>(samples_) * ( 1 /static_cast<double>(sampling_frequency_));
LOG(INFO) << "Total number samples to be processed= " << samples_ << " GNSS signal duration= " << signal_duration_s << " [s]"; LOG(INFO) << "Total number 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; std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]" << std::endl;

View File

@ -60,10 +60,10 @@ OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration,
// OSMOSDR Driver parameters // OSMOSDR Driver parameters
AGC_enabled_ = configuration->property(role + ".AGC_enabled", true); AGC_enabled_ = configuration->property(role + ".AGC_enabled", true);
freq_ = configuration->property(role + ".freq", GPS_L1_FREQ_HZ); freq_ = configuration->property(role + ".freq", GPS_L1_FREQ_HZ);
gain_ = configuration->property(role + ".gain", (double)40.0); gain_ = configuration->property(role + ".gain", 40.0);
rf_gain_ = configuration->property(role + ".rf_gain", (double)40.0); rf_gain_ = configuration->property(role + ".rf_gain", 40.0);
if_gain_ = configuration->property(role + ".if_gain", (double)40.0); if_gain_ = configuration->property(role + ".if_gain", 40.0);
sample_rate_ = configuration->property(role + ".sampling_frequency", (double)2.0e6); sample_rate_ = configuration->property(role + ".sampling_frequency", 2.0e6);
item_type_ = configuration->property(role + ".item_type", default_item_type); item_type_ = configuration->property(role + ".item_type", default_item_type);
osmosdr_args_ = configuration->property(role + ".osmosdr_args", std::string( )); osmosdr_args_ = configuration->property(role + ".osmosdr_args", std::string( ));

View File

@ -61,10 +61,10 @@ RtlTcpSignalSource::RtlTcpSignalSource(ConfigurationInterface* configuration,
short default_port = 1234; short default_port = 1234;
AGC_enabled_ = configuration->property(role + ".AGC_enabled", true); AGC_enabled_ = configuration->property(role + ".AGC_enabled", true);
freq_ = configuration->property(role + ".freq", GPS_L1_FREQ_HZ); freq_ = configuration->property(role + ".freq", GPS_L1_FREQ_HZ);
gain_ = configuration->property(role + ".gain", (double)40.0); gain_ = configuration->property(role + ".gain", 40.0);
rf_gain_ = configuration->property(role + ".rf_gain", (double)40.0); rf_gain_ = configuration->property(role + ".rf_gain", 40.0);
if_gain_ = configuration->property(role + ".if_gain", (double)40.0); if_gain_ = configuration->property(role + ".if_gain", 40.0);
sample_rate_ = configuration->property(role + ".sampling_frequency", (double)2.0e6); sample_rate_ = configuration->property(role + ".sampling_frequency", 2.0e6);
item_type_ = configuration->property(role + ".item_type", default_item_type); item_type_ = configuration->property(role + ".item_type", default_item_type);
address_ = configuration->property(role + ".address", default_address); address_ = configuration->property(role + ".address", default_address);
port_ = configuration->property(role + ".port", default_port); port_ = configuration->property(role + ".port", default_port);

View File

@ -121,7 +121,7 @@ SpirFileSignalSource::SpirFileSignalSource(ConfigurationInterface* configuration
if (file.is_open()) if (file.is_open())
{ {
size = file.tellg(); size = file.tellg();
LOG(INFO) << "Total samples in the file= " << floor((double)size / (double)item_size()); LOG(INFO) << "Total samples in the file= " << floor(static_cast<double>(size) / static_cast<double>(item_size()));
} }
else else
{ {
@ -130,20 +130,20 @@ SpirFileSignalSource::SpirFileSignalSource(ConfigurationInterface* configuration
} }
std::streamsize ss = std::cout.precision(); std::streamsize ss = std::cout.precision();
std::cout << std::setprecision(16); std::cout << std::setprecision(16);
std::cout << "Processing file " << filename_ << ", which contains " << (double)size << " [bytes]" << std::endl; std::cout << "Processing file " << filename_ << ", which contains " << size << " [bytes]" << std::endl;
std::cout.precision (ss); std::cout.precision (ss);
if (size > 0) if (size > 0)
{ {
int sample_packet_factor = 1; // 1 int -> 1 complex sample (I&Q from 1 channel) int sample_packet_factor = 1; // 1 int -> 1 complex sample (I&Q from 1 channel)
samples_ = floor((double)size / (double)item_size())*sample_packet_factor; samples_ = floor(static_cast<double>(size) / static_cast<double>(item_size())) * sample_packet_factor;
samples_ = samples_- ceil(0.002 * (double)sampling_frequency_); //process all the samples available in the file excluding the last 2 ms samples_ = samples_- ceil(0.002 * static_cast<double>(sampling_frequency_)); //process all the samples available in the file excluding the last 2 ms
} }
} }
CHECK(samples_ > 0) << "File does not contain enough samples to process."; CHECK(samples_ > 0) << "File does not contain enough samples to process.";
double signal_duration_s; double signal_duration_s;
signal_duration_s = (double)samples_ * ( 1 /(double)sampling_frequency_); signal_duration_s = static_cast<double>(samples_) * ( 1 /static_cast<double>(sampling_frequency_));
LOG(INFO) << "Total number samples to be processed= " << samples_ << " GNSS signal duration= " << signal_duration_s << " [s]"; LOG(INFO) << "Total number 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; std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]" << std::endl;

View File

@ -119,7 +119,7 @@ TwoBitCpxFileSignalSource::TwoBitCpxFileSignalSource(ConfigurationInterface* con
if (file.is_open()) if (file.is_open())
{ {
size = file.tellg(); size = file.tellg();
LOG(INFO) << "Total samples in the file= " << floor((double)size / (double)item_size()); LOG(INFO) << "Total samples in the file= " << floor(static_cast<double>(size) / static_cast<double>(item_size()));
} }
else else
{ {
@ -128,20 +128,20 @@ TwoBitCpxFileSignalSource::TwoBitCpxFileSignalSource(ConfigurationInterface* con
} }
std::streamsize ss = std::cout.precision(); std::streamsize ss = std::cout.precision();
std::cout << std::setprecision(16); std::cout << std::setprecision(16);
std::cout << "Processing file " << filename_ << ", which contains " << (double)size << " [bytes]" << std::endl; std::cout << "Processing file " << filename_ << ", which contains " << size << " [bytes]" << std::endl;
std::cout.precision (ss); std::cout.precision (ss);
if (size > 0) if (size > 0)
{ {
int sample_packet_factor = 2; // 1 byte -> 2 samples int sample_packet_factor = 2; // 1 byte -> 2 samples
samples_ = floor((double)size / (double)item_size())*sample_packet_factor; samples_ = floor(static_cast<double>(size) / static_cast<double>(item_size())) * sample_packet_factor;
samples_ = samples_- ceil(0.002 * (double)sampling_frequency_); //process all the samples available in the file excluding the last 2 ms samples_ = samples_- ceil(0.002 * static_cast<double>(sampling_frequency_)); //process all the samples available in the file excluding the last 2 ms
} }
} }
CHECK(samples_ > 0) << "File does not contain enough samples to process."; CHECK(samples_ > 0) << "File does not contain enough samples to process.";
double signal_duration_s; double signal_duration_s;
signal_duration_s = (double)samples_ * ( 1 /(double)sampling_frequency_); signal_duration_s = static_cast<double>(samples_) * ( 1 /static_cast<double>(sampling_frequency_));
LOG(INFO) << "Total number samples to be processed= " << samples_ << " GNSS signal duration= " << signal_duration_s << " [s]"; LOG(INFO) << "Total number 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; std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]" << std::endl;

View File

@ -185,7 +185,7 @@ TwoBitPackedFileSignalSource::TwoBitPackedFileSignalSource(ConfigurationInterfac
if (file.is_open()) if (file.is_open())
{ {
size = file.tellg(); size = file.tellg();
samples_ = floor((double)size * ( is_complex_ ? 2.0 : 4.0 ) ); samples_ = floor(static_cast<double>(size) * ( is_complex_ ? 2.0 : 4.0 ) );
LOG(INFO) << "Total samples in the file= " << samples_; // 4 samples per byte LOG(INFO) << "Total samples in the file= " << samples_; // 4 samples per byte
samples_ -= bytes_to_skip; samples_ -= bytes_to_skip;
@ -199,13 +199,13 @@ TwoBitPackedFileSignalSource::TwoBitPackedFileSignalSource(ConfigurationInterfac
} }
std::streamsize ss = std::cout.precision(); std::streamsize ss = std::cout.precision();
std::cout << std::setprecision(16); std::cout << std::setprecision(16);
std::cout << "Processing file " << filename_ << ", which contains " << (double)size << " [bytes]" << std::endl; std::cout << "Processing file " << filename_ << ", which contains " << size << " [bytes]" << std::endl;
std::cout.precision (ss); std::cout.precision (ss);
} }
CHECK(samples_ > 0) << "File does not contain enough samples to process."; CHECK(samples_ > 0) << "File does not contain enough samples to process.";
double signal_duration_s; double signal_duration_s;
signal_duration_s = (double)samples_ * ( 1 /(double)sampling_frequency_); signal_duration_s = static_cast<double>(samples_) * ( 1 /static_cast<double>(sampling_frequency_));
LOG(INFO) << "Total number samples to be processed= " << samples_ << " GNSS signal duration= " << signal_duration_s << " [s]"; LOG(INFO) << "Total number 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; std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]" << std::endl;

View File

@ -71,7 +71,7 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
subdevice_ = configuration->property(role + ".subdevice", empty); subdevice_ = configuration->property(role + ".subdevice", empty);
clock_source_ = configuration->property(role + ".clock_source", std::string("internal")); clock_source_ = configuration->property(role + ".clock_source", std::string("internal"));
RF_channels_ = configuration->property(role + ".RF_channels", 1); RF_channels_ = configuration->property(role + ".RF_channels", 1);
sample_rate_ = configuration->property(role + ".sampling_frequency", (double)4.0e6); sample_rate_ = configuration->property(role + ".sampling_frequency", 4.0e6);
item_type_ = configuration->property(role + ".item_type", default_item_type); item_type_ = configuration->property(role + ".item_type", default_item_type);
if (RF_channels_ == 1) if (RF_channels_ == 1)
@ -82,7 +82,7 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
dump_filename_.push_back(configuration->property(role + ".dump_filename", default_dump_file)); dump_filename_.push_back(configuration->property(role + ".dump_filename", default_dump_file));
freq_.push_back(configuration->property(role + ".freq", GPS_L1_FREQ_HZ)); freq_.push_back(configuration->property(role + ".freq", GPS_L1_FREQ_HZ));
gain_.push_back(configuration->property(role + ".gain", (double)50.0)); gain_.push_back(configuration->property(role + ".gain", 50.0));
IF_bandwidth_hz_.push_back(configuration->property(role + ".IF_bandwidth_hz", sample_rate_/2)); IF_bandwidth_hz_.push_back(configuration->property(role + ".IF_bandwidth_hz", sample_rate_/2));
@ -98,7 +98,7 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
dump_filename_.push_back(configuration->property(role + ".dump_filename" + boost::lexical_cast<std::string>(i), default_dump_file)); dump_filename_.push_back(configuration->property(role + ".dump_filename" + boost::lexical_cast<std::string>(i), default_dump_file));
freq_.push_back(configuration->property(role + ".freq" + boost::lexical_cast<std::string>(i), GPS_L1_FREQ_HZ)); freq_.push_back(configuration->property(role + ".freq" + boost::lexical_cast<std::string>(i), GPS_L1_FREQ_HZ));
gain_.push_back(configuration->property(role + ".gain" + boost::lexical_cast<std::string>(i), (double)50.0)); gain_.push_back(configuration->property(role + ".gain" + boost::lexical_cast<std::string>(i), 50.0));
IF_bandwidth_hz_.push_back(configuration->property(role + ".IF_bandwidth_hz" + boost::lexical_cast<std::string>(i), sample_rate_/2)); IF_bandwidth_hz_.push_back(configuration->property(role + ".IF_bandwidth_hz" + boost::lexical_cast<std::string>(i), sample_rate_/2));
} }

View File

@ -69,16 +69,16 @@ int unpack_byte_2bit_samples::work(int noutput_items,
// Read packed input sample (1 byte = 4 samples) // Read packed input sample (1 byte = 4 samples)
signed char c = in[i]; signed char c = in[i];
sample.two_bit_sample = c & 3; sample.two_bit_sample = c & 3;
out[n++] = (float)sample.two_bit_sample; out[n++] = static_cast<float>(sample.two_bit_sample);
sample.two_bit_sample = (c>>2) & 3; sample.two_bit_sample = (c>>2) & 3;
out[n++] = (float)sample.two_bit_sample; out[n++] = static_cast<float>(sample.two_bit_sample);
sample.two_bit_sample = (c>>4) & 3; sample.two_bit_sample = (c>>4) & 3;
out[n++] = (float)sample.two_bit_sample; out[n++] = static_cast<float>(sample.two_bit_sample);
sample.two_bit_sample = (c>>6) & 3; sample.two_bit_sample = (c>>6) & 3;
out[n++] = (float)sample.two_bit_sample; out[n++] = static_cast<float>(sample.two_bit_sample);
} }
return noutput_items; return noutput_items;
} }

View File

@ -70,10 +70,10 @@ void galileo_e1b_telemetry_decoder_cc::viterbi_decoder(double *page_part_symbols
/* create appropriate transition matrices */ /* create appropriate transition matrices */
int *out0, *out1, *state0, *state1; int *out0, *out1, *state0, *state1;
out0 = (int*)calloc( max_states, sizeof(int) ); out0 = static_cast<int*>(calloc( max_states, sizeof(int) ));
out1 = (int*)calloc( max_states, sizeof(int) ); out1 = static_cast<int*>(calloc( max_states, sizeof(int) ));
state0 = (int*)calloc( max_states, sizeof(int) ); state0 = static_cast<int*>(calloc( max_states, sizeof(int) ));
state1 = (int*)calloc( max_states, sizeof(int) ); state1 = static_cast<int*>(calloc( max_states, sizeof(int) ));
nsc_transit( out0, state0, 0, g_encoder, KK, nn ); nsc_transit( out0, state0, 0, g_encoder, KK, nn );
nsc_transit( out1, state1, 1, g_encoder, KK, nn ); nsc_transit( out1, state1, 1, g_encoder, KK, nn );
@ -404,14 +404,14 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items __attribut
if(d_nav.flag_TOW_5 == true) //page 5 arrived and decoded, so we are in the odd page (since Tow refers to the even page, we have to add 1 sec) if(d_nav.flag_TOW_5 == true) //page 5 arrived and decoded, so we are in the odd page (since Tow refers to the even page, we have to add 1 sec)
{ {
//TOW_5 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later plus the decoding delay //TOW_5 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later plus the decoding delay
d_TOW_at_current_symbol = d_nav.TOW_5 + GALILEO_INAV_PAGE_PART_SECONDS+((double)required_symbols)*GALILEO_E1_CODE_PERIOD; //-GALILEO_E1_CODE_PERIOD;//+ (double)GALILEO_INAV_PREAMBLE_LENGTH_BITS/(double)GALILEO_TELEMETRY_RATE_BITS_SECOND; d_TOW_at_current_symbol = d_nav.TOW_5 + GALILEO_INAV_PAGE_PART_SECONDS + (static_cast<double>(required_symbols)) * GALILEO_E1_CODE_PERIOD; //-GALILEO_E1_CODE_PERIOD;//+ (double)GALILEO_INAV_PREAMBLE_LENGTH_BITS/(double)GALILEO_TELEMETRY_RATE_BITS_SECOND;
d_nav.flag_TOW_5 = false; d_nav.flag_TOW_5 = false;
} }
else if(d_nav.flag_TOW_6 == true) //page 6 arrived and decoded, so we are in the odd page (since Tow refers to the even page, we have to add 1 sec) else if(d_nav.flag_TOW_6 == true) //page 6 arrived and decoded, so we are in the odd page (since Tow refers to the even page, we have to add 1 sec)
{ {
//TOW_6 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later plus the decoding delay //TOW_6 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later plus the decoding delay
d_TOW_at_current_symbol = d_nav.TOW_6 + GALILEO_INAV_PAGE_PART_SECONDS+((double)required_symbols)*GALILEO_E1_CODE_PERIOD;//-GALILEO_E1_CODE_PERIOD;//+ (double)GALILEO_INAV_PREAMBLE_LENGTH_BITS/(double)GALILEO_TELEMETRY_RATE_BITS_SECOND; d_TOW_at_current_symbol = d_nav.TOW_6 + GALILEO_INAV_PAGE_PART_SECONDS + (static_cast<double>(required_symbols)) * GALILEO_E1_CODE_PERIOD;//-GALILEO_E1_CODE_PERIOD;//+ (double)GALILEO_INAV_PREAMBLE_LENGTH_BITS/(double)GALILEO_TELEMETRY_RATE_BITS_SECOND;
d_nav.flag_TOW_6 = false; d_nav.flag_TOW_6 = false;
} }
else else

View File

@ -206,7 +206,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attribute_
} }
else if (d_stat == 1) //check 6 seconds of preamble separation else if (d_stat == 1) //check 6 seconds of preamble separation
{ {
preamble_diff_ms = round((((double)d_symbol_history.at(0).Tracking_sample_counter - d_preamble_time_samples)/(double)d_symbol_history.at(0).fs) * 1000.0); preamble_diff_ms = round(((static_cast<double>(d_symbol_history.at(0).Tracking_sample_counter) - d_preamble_time_samples) / static_cast<double>(d_symbol_history.at(0).fs)) * 1000.0);
if (abs(preamble_diff_ms - GPS_SUBFRAME_MS) < 1) if (abs(preamble_diff_ms - GPS_SUBFRAME_MS) < 1)
{ {
DLOG(INFO) << "Preamble confirmation for SAT " << this->d_satellite; DLOG(INFO) << "Preamble confirmation for SAT " << this->d_satellite;
@ -216,7 +216,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attribute_
if (!d_flag_frame_sync) if (!d_flag_frame_sync)
{ {
// send asynchronous message to tracking to inform of frame sync and extend correlation time // send asynchronous message to tracking to inform of frame sync and extend correlation time
pmt::pmt_t value = pmt::from_double((double)d_preamble_time_samples/(double)d_symbol_history.at(0).fs - 0.001); pmt::pmt_t value = pmt::from_double(static_cast<double>(d_preamble_time_samples) / static_cast<double>(d_symbol_history.at(0).fs) - 0.001);
this->message_port_pub(pmt::mp("preamble_timestamp_s"), value); this->message_port_pub(pmt::mp("preamble_timestamp_s"), value);
d_flag_frame_sync = true; d_flag_frame_sync = true;
if (corr_value < 0) if (corr_value < 0)
@ -228,7 +228,8 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attribute_
{ {
flag_PLL_180_deg_phase_locked = false; flag_PLL_180_deg_phase_locked = false;
} }
DLOG(INFO) << " Frame sync SAT " << this->d_satellite << " with preamble start at " << (double)d_preamble_time_samples/(double)d_symbol_history.at(0).fs << " [s]"; DLOG(INFO) << " Frame sync SAT " << this->d_satellite << " with preamble start at "
<< static_cast<double>(d_preamble_time_samples) / static_cast<double>(d_symbol_history.at(0).fs) << " [s]";
} }
} }
} }
@ -237,7 +238,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attribute_
{ {
if (d_stat == 1) if (d_stat == 1)
{ {
preamble_diff_ms = round((((double)d_symbol_history.at(0).Tracking_sample_counter - (double)d_preamble_time_samples)/(double)d_symbol_history.at(0).fs) * 1000.0); preamble_diff_ms = round(((static_cast<double>(d_symbol_history.at(0).Tracking_sample_counter) - static_cast<double>(d_preamble_time_samples)) / static_cast<double>(d_symbol_history.at(0).fs)) * 1000.0);
if (preamble_diff_ms > GPS_SUBFRAME_MS+1) if (preamble_diff_ms > GPS_SUBFRAME_MS+1)
{ {
DLOG(INFO) << "Lost of frame sync SAT " << this->d_satellite << " preamble_diff= " << preamble_diff_ms; DLOG(INFO) << "Lost of frame sync SAT " << this->d_satellite << " preamble_diff= " << preamble_diff_ms;

View File

@ -149,13 +149,13 @@ int gps_l2c_telemetry_decoder_cc::general_work (int noutput_items __attribute__(
} }
//update TOW at the preamble instant //update TOW at the preamble instant
d_TOW_at_Preamble = (int)msg.tow; d_TOW_at_Preamble = static_cast<int>(msg.tow);
//std::cout<<"["<<(int)msg.prn<<"] deco delay: "<<delay<<"[symbols]"<<std::endl; //std::cout<<"["<<(int)msg.prn<<"] deco delay: "<<delay<<"[symbols]"<<std::endl;
//* The time of the last input symbol can be computed from the message ToW and //* The time of the last input symbol can be computed from the message ToW and
//* delay by the formulae: //* delay by the formulae:
//* \code //* \code
//* symbolTime_ms = msg->tow * 6000 + *pdelay * 20 //* symbolTime_ms = msg->tow * 6000 + *pdelay * 20
d_TOW_at_current_symbol = ((double)msg.tow) * 6.0 + ((double)delay) * GPS_L2_M_PERIOD + 12 * GPS_L2_M_PERIOD; d_TOW_at_current_symbol = static_cast<double>(msg.tow) * 6.0 + static_cast<double>(delay) * GPS_L2_M_PERIOD + 12 * GPS_L2_M_PERIOD;
d_TOW_at_current_symbol = floor(d_TOW_at_current_symbol * 1000.0) / 1000.0; d_TOW_at_current_symbol = floor(d_TOW_at_current_symbol * 1000.0) / 1000.0;
d_flag_valid_word = true; d_flag_valid_word = true;
} }

View File

@ -143,7 +143,7 @@ int sbas_l1_telemetry_decoder_cc::general_work (int noutput_items __attribute__(
(sample_alignment ? 0 : -1) (sample_alignment ? 0 : -1)
+ d_samples_per_symbol*(symbol_alignment ? -1 : 0) + d_samples_per_symbol*(symbol_alignment ? -1 : 0)
+ d_samples_per_symbol * d_symbols_per_bit * it->first; + d_samples_per_symbol * d_symbols_per_bit * it->first;
double message_sample_stamp = sample_stamp + ((double)message_sample_offset)/1000; double message_sample_stamp = sample_stamp + static_cast<double>(message_sample_offset) / 1000.0;
VLOG(EVENT) << "message_sample_stamp=" << message_sample_stamp VLOG(EVENT) << "message_sample_stamp=" << message_sample_stamp
<< " (sample_stamp=" << sample_stamp << " (sample_stamp=" << sample_stamp
<< " sample_alignment=" << sample_alignment << " sample_alignment=" << sample_alignment
@ -446,7 +446,7 @@ void sbas_l1_telemetry_decoder_cc::crc_verifier::get_valid_frames(const std::vec
ss << " Relbitoffset=" << candidate_it->first << " content="; ss << " Relbitoffset=" << candidate_it->first << " content=";
for (std::vector<unsigned char>::iterator byte_it = candidate_bytes.begin(); byte_it < candidate_bytes.end(); ++byte_it) for (std::vector<unsigned char>::iterator byte_it = candidate_bytes.begin(); byte_it < candidate_bytes.end(); ++byte_it)
{ {
ss << std::setw(2) << std::setfill('0') << std::hex << (unsigned int)(*byte_it); ss << std::setw(2) << std::setfill('0') << std::hex << static_cast<unsigned int>((*byte_it));
} }
VLOG(SAMP_SYNC) << ss.str() << std::setfill(' ') << std::resetiosflags(std::ios::hex) << std::endl; VLOG(SAMP_SYNC) << ss.str() << std::setfill(' ') << std::resetiosflags(std::ios::hex) << std::endl;
} }
@ -471,13 +471,13 @@ void sbas_l1_telemetry_decoder_cc::crc_verifier::zerropad_back_and_convert_to_by
if (idx_bit % bits_per_byte == bits_per_byte - 1) if (idx_bit % bits_per_byte == bits_per_byte - 1)
{ {
bytes.push_back(byte); bytes.push_back(byte);
VLOG(LMORE) << ss.str() << " -> byte=" << std::setw(2) << std::setfill('0') << std::hex << (unsigned int)byte; ss.str(""); VLOG(LMORE) << ss.str() << " -> byte=" << std::setw(2) << std::setfill('0') << std::hex << static_cast<unsigned int>(byte); ss.str("");
byte = 0; byte = 0;
} }
} }
bytes.push_back(byte); // implies: insert 6 zeros at the end to fit the 250bits into a multiple of bytes bytes.push_back(byte); // implies: insert 6 zeros at the end to fit the 250bits into a multiple of bytes
VLOG(LMORE) << " -> byte=" << std::setw(2) VLOG(LMORE) << " -> byte=" << std::setw(2)
<< std::setfill('0') << std::hex << (unsigned int)byte << std::setfill('0') << std::hex << static_cast<unsigned int>(byte)
<< std::setfill(' ') << std::resetiosflags(std::ios::hex); << std::setfill(' ') << std::resetiosflags(std::ios::hex);
} }
@ -499,12 +499,12 @@ void sbas_l1_telemetry_decoder_cc::crc_verifier::zerropad_front_and_convert_to_b
{ {
bytes.push_back(byte); bytes.push_back(byte);
VLOG(LMORE) << ss.str() << " -> byte=" << std::setw(2) VLOG(LMORE) << ss.str() << " -> byte=" << std::setw(2)
<< std::setfill('0') << std::hex << (unsigned int)byte; ss.str(""); << std::setfill('0') << std::hex << static_cast<unsigned int>(byte); ss.str("");
byte = 0; byte = 0;
} }
idx_bit++; idx_bit++;
} }
VLOG(LMORE) << " -> byte=" << std::setw(2) VLOG(LMORE) << " -> byte=" << std::setw(2)
<< std::setfill('0') << std::hex << (unsigned int)byte << std::setfill('0') << std::hex << static_cast<unsigned int>(byte)
<< std::setfill(' ') << std::resetiosflags(std::ios::hex); << std::setfill(' ') << std::resetiosflags(std::ios::hex);
} }

View File

@ -70,7 +70,7 @@ GpsL2MDllPllTracking::GpsL2MDllPllTracking(
std::string default_dump_filename = "./track_ch"; std::string default_dump_filename = "./track_ch";
dump_filename = configuration->property(role + ".dump_filename", dump_filename = configuration->property(role + ".dump_filename",
default_dump_filename); //unused! default_dump_filename); //unused!
vector_length = std::round((double)fs_in / ((double)GPS_L2_M_CODE_RATE_HZ / (double)GPS_L2_M_CODE_LENGTH_CHIPS)); vector_length = std::round(static_cast<double>(fs_in) / (static_cast<double>(GPS_L2_M_CODE_RATE_HZ) / static_cast<double>(GPS_L2_M_CODE_LENGTH_CHIPS)));
//################# MAKE TRACKING GNURadio object ################### //################# MAKE TRACKING GNURadio object ###################
if (item_type.compare("gr_complex") == 0) if (item_type.compare("gr_complex") == 0)

View File

@ -297,7 +297,7 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attr
float acq_trk_shif_correction_samples; float acq_trk_shif_correction_samples;
int acq_to_trk_delay_samples; int acq_to_trk_delay_samples;
acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp; acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp;
acq_trk_shif_correction_samples = d_current_prn_length_samples - fmod((float)acq_to_trk_delay_samples, (float)d_current_prn_length_samples); acq_trk_shif_correction_samples = d_current_prn_length_samples - fmod(static_cast<float>(acq_to_trk_delay_samples), static_cast<float>(d_current_prn_length_samples));
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples); samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
current_synchro_data.Tracking_sample_counter = d_sample_counter + samples_offset; current_synchro_data.Tracking_sample_counter = d_sample_counter + samples_offset;
current_synchro_data.fs = d_fs_in; current_synchro_data.fs = d_fs_in;
@ -370,10 +370,10 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attr
double T_prn_samples; double T_prn_samples;
double K_blk_samples; double K_blk_samples;
// Compute the next buffer lenght based in the new period of the PRN sequence and the code phase error estimation // Compute the next buffer lenght based in the new period of the PRN sequence and the code phase error estimation
T_chip_seconds = 1 / (double)d_code_freq_chips; T_chip_seconds = 1 / static_cast<double>(d_code_freq_chips);
T_prn_seconds = T_chip_seconds * Galileo_E1_B_CODE_LENGTH_CHIPS; T_prn_seconds = T_chip_seconds * Galileo_E1_B_CODE_LENGTH_CHIPS;
T_prn_samples = T_prn_seconds * (double)d_fs_in; T_prn_samples = T_prn_seconds * static_cast<double>(d_fs_in);
K_blk_samples = T_prn_samples + d_rem_code_phase_samples + code_error_filt_secs * (double)d_fs_in; K_blk_samples = T_prn_samples + d_rem_code_phase_samples + code_error_filt_secs * static_cast<double>(d_fs_in);
d_current_prn_length_samples = round(K_blk_samples); //round to a discrete samples d_current_prn_length_samples = round(K_blk_samples); //round to a discrete samples
//d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; //rounding error < 1 sample //d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; //rounding error < 1 sample
@ -415,15 +415,15 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attr
} }
// ########### Output the tracking data to navigation and PVT ########## // ########### Output the tracking data to navigation and PVT ##########
current_synchro_data.Prompt_I = (double)(*d_Prompt).real(); current_synchro_data.Prompt_I = static_cast<double>((*d_Prompt).real());
current_synchro_data.Prompt_Q = (double)(*d_Prompt).imag(); current_synchro_data.Prompt_Q = static_cast<double>((*d_Prompt).imag());
// Tracking_timestamp_secs is aligned with the PRN start sample // Tracking_timestamp_secs is aligned with the PRN start sample
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_current_prn_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + d_current_prn_length_samples;
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples; current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; //rounding error < 1 sample d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; //rounding error < 1 sample
current_synchro_data.Carrier_phase_rads = (double)d_acc_carrier_phase_rad; current_synchro_data.Carrier_phase_rads = static_cast<double>(d_acc_carrier_phase_rad);
current_synchro_data.Carrier_Doppler_hz = (double)d_carrier_doppler_hz; current_synchro_data.Carrier_Doppler_hz = static_cast<double>(d_carrier_doppler_hz);
current_synchro_data.CN0_dB_hz = (double)d_CN0_SNV_dB_Hz; current_synchro_data.CN0_dB_hz = static_cast<double>(d_CN0_SNV_dB_Hz);
current_synchro_data.Flag_valid_symbol_output = true; current_synchro_data.Flag_valid_symbol_output = true;
current_synchro_data.correlation_length_ms = 4; current_synchro_data.correlation_length_ms = 4;
} }
@ -498,7 +498,7 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attr
// AUX vars (for debug purposes) // AUX vars (for debug purposes)
tmp_float = d_rem_code_phase_samples; tmp_float = d_rem_code_phase_samples;
d_dump_file.write((char*)&tmp_float, sizeof(float)); d_dump_file.write((char*)&tmp_float, sizeof(float));
tmp_double = (double)(d_sample_counter+d_current_prn_length_samples); tmp_double = static_cast<double>(d_sample_counter + d_current_prn_length_samples);
d_dump_file.write((char*)&tmp_double, sizeof(double)); d_dump_file.write((char*)&tmp_double, sizeof(double));
// PRN // PRN

View File

@ -83,7 +83,7 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::forecast (int noutput_items,
{ {
if (noutput_items != 0) if (noutput_items != 0)
{ {
ninput_items_required[0] = (int)d_vector_length*2; //set the required available samples in each call ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call
} }
} }
@ -125,7 +125,7 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc(
// correlator outputs (scalar) // correlator outputs (scalar)
d_n_correlator_taps = 3; // Very-Early, Early, Prompt, Late, Very-Late d_n_correlator_taps = 3; // Very-Early, Early, Prompt, Late, Very-Late
d_correlator_outs = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_n_correlator_taps*sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_correlator_outs = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
for (int n = 0; n < d_n_correlator_taps; n++) for (int n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs[n] = gr_complex(0,0); d_correlator_outs[n] = gr_complex(0,0);
@ -141,7 +141,7 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc(
d_local_code_shift_chips[1] = 0.0; d_local_code_shift_chips[1] = 0.0;
d_local_code_shift_chips[2] = d_early_late_spc_chips; d_local_code_shift_chips[2] = d_early_late_spc_chips;
d_correlation_length_samples=d_vector_length; d_correlation_length_samples = d_vector_length;
multicorrelator_cpu.init(2 * d_correlation_length_samples, d_n_correlator_taps); multicorrelator_cpu.init(2 * d_correlation_length_samples, d_n_correlator_taps);
@ -161,7 +161,7 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc(
d_enable_tracking = false; d_enable_tracking = false;
d_pull_in = false; d_pull_in = false;
d_current_prn_length_samples = (int)d_vector_length; d_current_prn_length_samples = static_cast<int>(d_vector_length);
// CN0 estimation and lock detector buffers // CN0 estimation and lock detector buffers
d_cn0_estimation_counter = 0; d_cn0_estimation_counter = 0;
@ -201,9 +201,9 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::start_tracking()
long int acq_trk_diff_samples; long int acq_trk_diff_samples;
float acq_trk_diff_seconds; float acq_trk_diff_seconds;
acq_trk_diff_samples = (long int)d_sample_counter - (long int)d_acq_sample_stamp; acq_trk_diff_samples = static_cast<long int>(d_sample_counter) - static_cast<long int>(d_acq_sample_stamp);
std::cout << "acq_trk_diff_samples=" << acq_trk_diff_samples << std::endl; std::cout << "acq_trk_diff_samples=" << acq_trk_diff_samples << std::endl;
acq_trk_diff_seconds = (float)acq_trk_diff_samples / (float)d_fs_in; acq_trk_diff_seconds = static_cast<float>(acq_trk_diff_samples) / static_cast<float>(d_fs_in);
//doppler effect //doppler effect
// Fd=(C/(C+Vr))*F // Fd=(C/(C+Vr))*F
float radial_velocity; float radial_velocity;
@ -216,18 +216,18 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::start_tracking()
d_code_phase_step_chips = static_cast<double>(d_code_freq_hz) / static_cast<double>(d_fs_in); d_code_phase_step_chips = static_cast<double>(d_code_freq_hz) / static_cast<double>(d_fs_in);
T_chip_mod_seconds = 1/d_code_freq_hz; T_chip_mod_seconds = 1/d_code_freq_hz;
T_prn_mod_seconds = T_chip_mod_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS; T_prn_mod_seconds = T_chip_mod_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS;
T_prn_mod_samples = T_prn_mod_seconds * (float)d_fs_in; T_prn_mod_samples = T_prn_mod_seconds * static_cast<float>(d_fs_in);
d_next_prn_length_samples = round(T_prn_mod_samples); d_next_prn_length_samples = round(T_prn_mod_samples);
float T_prn_true_seconds = GPS_L1_CA_CODE_LENGTH_CHIPS / GPS_L1_CA_CODE_RATE_HZ; float T_prn_true_seconds = GPS_L1_CA_CODE_LENGTH_CHIPS / GPS_L1_CA_CODE_RATE_HZ;
float T_prn_true_samples = T_prn_true_seconds * (float)d_fs_in; float T_prn_true_samples = T_prn_true_seconds * static_cast<float>(d_fs_in);
float T_prn_diff_seconds; float T_prn_diff_seconds;
T_prn_diff_seconds = T_prn_true_seconds - T_prn_mod_seconds; T_prn_diff_seconds = T_prn_true_seconds - T_prn_mod_seconds;
float N_prn_diff; float N_prn_diff;
N_prn_diff = acq_trk_diff_seconds / T_prn_true_seconds; N_prn_diff = acq_trk_diff_seconds / T_prn_true_seconds;
float corrected_acq_phase_samples, delay_correction_samples; float corrected_acq_phase_samples, delay_correction_samples;
corrected_acq_phase_samples = fmod((d_acq_code_phase_samples + T_prn_diff_seconds * N_prn_diff * (float)d_fs_in), T_prn_true_samples); corrected_acq_phase_samples = fmod((d_acq_code_phase_samples + T_prn_diff_seconds * N_prn_diff * static_cast<float>(d_fs_in)), T_prn_true_samples);
if (corrected_acq_phase_samples < 0) if (corrected_acq_phase_samples < 0)
{ {
corrected_acq_phase_samples = T_prn_mod_samples + corrected_acq_phase_samples; corrected_acq_phase_samples = T_prn_mod_samples + corrected_acq_phase_samples;
@ -333,12 +333,12 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attri
float acq_trk_shif_correction_samples; float acq_trk_shif_correction_samples;
int acq_to_trk_delay_samples; int acq_to_trk_delay_samples;
acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp; 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); acq_trk_shif_correction_samples = d_next_prn_length_samples - fmod(static_cast<float>(acq_to_trk_delay_samples), static_cast<float>(d_next_prn_length_samples));
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples); samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
current_synchro_data.Tracking_sample_counter = d_sample_counter + samples_offset; current_synchro_data.Tracking_sample_counter = d_sample_counter + samples_offset;
current_synchro_data.fs = d_fs_in; current_synchro_data.fs = d_fs_in;
*out[0] = current_synchro_data; *out[0] = current_synchro_data;
d_sample_counter_seconds = d_sample_counter_seconds + (((double)samples_offset) / (double)d_fs_in); d_sample_counter_seconds = d_sample_counter_seconds + (static_cast<double>(samples_offset) / static_cast<double>(d_fs_in));
d_sample_counter = d_sample_counter + samples_offset; //count for the processed samples d_sample_counter = d_sample_counter + samples_offset; //count for the processed samples
d_pull_in = false; d_pull_in = false;
consume_each(samples_offset); //shift input to perform alignement with local replica consume_each(samples_offset); //shift input to perform alignement with local replica
@ -390,21 +390,21 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attri
// Update the phasestep based on code freq (variable) and // Update the phasestep based on code freq (variable) and
// sampling frequency (fixed) // sampling frequency (fixed)
d_code_phase_step_chips = d_code_freq_hz / (float)d_fs_in; //[chips] d_code_phase_step_chips = d_code_freq_hz / static_cast<float>(d_fs_in); //[chips]
// variable code PRN sample block size // variable code PRN sample block size
double T_chip_seconds; double T_chip_seconds;
double T_prn_seconds; double T_prn_seconds;
double T_prn_samples; double T_prn_samples;
double K_blk_samples; double K_blk_samples;
T_chip_seconds = 1 / (double)d_code_freq_hz; T_chip_seconds = 1.0 / static_cast<double>(d_code_freq_hz);
T_prn_seconds = T_chip_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS; T_prn_seconds = T_chip_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS;
T_prn_samples = T_prn_seconds * (double)d_fs_in; T_prn_samples = T_prn_seconds * static_cast<double>(d_fs_in);
d_rem_code_phase_samples = d_next_rem_code_phase_samples; d_rem_code_phase_samples = d_next_rem_code_phase_samples;
K_blk_samples = T_prn_samples + d_rem_code_phase_samples;//-code_error*(double)d_fs_in; K_blk_samples = T_prn_samples + d_rem_code_phase_samples;//-code_error*(double)d_fs_in;
// Update the current PRN delay (code phase in samples) // Update the current PRN delay (code phase in samples)
double T_prn_true_seconds = GPS_L1_CA_CODE_LENGTH_CHIPS / GPS_L1_CA_CODE_RATE_HZ; double T_prn_true_seconds = GPS_L1_CA_CODE_LENGTH_CHIPS / GPS_L1_CA_CODE_RATE_HZ;
double T_prn_true_samples = T_prn_true_seconds * (double)d_fs_in; double T_prn_true_samples = T_prn_true_seconds * static_cast<double>(d_fs_in);
d_code_phase_samples = d_code_phase_samples + T_prn_samples - T_prn_true_samples; d_code_phase_samples = d_code_phase_samples + T_prn_samples - T_prn_true_samples;
if (d_code_phase_samples < 0) if (d_code_phase_samples < 0)
{ {
@ -453,15 +453,15 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attri
// ########### Output the tracking data to navigation and PVT ########## // ########### Output the tracking data to navigation and PVT ##########
current_synchro_data.Prompt_I = (double)(*d_Prompt).real(); current_synchro_data.Prompt_I = static_cast<double>((*d_Prompt).real());
current_synchro_data.Prompt_Q = (double)(*d_Prompt).imag(); current_synchro_data.Prompt_Q = static_cast<double>((*d_Prompt).imag());
//compute remnant code phase samples AFTER the Tracking timestamp //compute remnant code phase samples AFTER the Tracking timestamp
d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; //rounding error < 1 sample d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; //rounding error < 1 sample
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_current_prn_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + d_current_prn_length_samples;
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples; current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
current_synchro_data.Carrier_phase_rads = (double)d_acc_carrier_phase_rad; current_synchro_data.Carrier_phase_rads = static_cast<double>(d_acc_carrier_phase_rad);
current_synchro_data.Carrier_Doppler_hz = (double)d_carrier_doppler_hz; current_synchro_data.Carrier_Doppler_hz = static_cast<double>(d_carrier_doppler_hz);
current_synchro_data.CN0_dB_hz = (double)d_CN0_SNV_dB_Hz; current_synchro_data.CN0_dB_hz = static_cast<double>(d_CN0_SNV_dB_Hz);
current_synchro_data.Flag_valid_symbol_output = true; current_synchro_data.Flag_valid_symbol_output = true;
current_synchro_data.correlation_length_ms=1; current_synchro_data.correlation_length_ms=1;
} }
@ -546,7 +546,7 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attri
} }
consume_each(d_current_prn_length_samples); // this is necessary in gr::block derivates consume_each(d_current_prn_length_samples); // this is necessary in gr::block derivates
d_sample_counter_seconds = d_sample_counter_seconds + ( ((double)d_current_prn_length_samples) / (double)d_fs_in ); d_sample_counter_seconds = d_sample_counter_seconds + ( static_cast<double>(d_current_prn_length_samples) / static_cast<double>(d_fs_in) );
d_sample_counter += d_current_prn_length_samples; //count for the processed samples d_sample_counter += d_current_prn_length_samples; //count for the processed samples
return 1; //output tracking result ALWAYS even in the case of d_enable_tracking==false return 1; //output tracking result ALWAYS even in the case of d_enable_tracking==false

View File

@ -82,6 +82,7 @@ void fpga_multicorrelator_8sc::set_initial_sample(int samples_offset)
d_initial_sample_counter = samples_offset; d_initial_sample_counter = samples_offset;
} }
bool fpga_multicorrelator_8sc::set_local_code_and_taps(int code_length_chips, bool fpga_multicorrelator_8sc::set_local_code_and_taps(int code_length_chips,
const lv_16sc_t* local_code_in, float *shifts_chips) const lv_16sc_t* local_code_in, float *shifts_chips)
{ {
@ -94,6 +95,7 @@ bool fpga_multicorrelator_8sc::set_local_code_and_taps(int code_length_chips,
return true; return true;
} }
bool fpga_multicorrelator_8sc::set_output_vectors(lv_16sc_t* corr_out) bool fpga_multicorrelator_8sc::set_output_vectors(lv_16sc_t* corr_out)
{ {
// Save CPU pointers // Save CPU pointers
@ -102,6 +104,7 @@ bool fpga_multicorrelator_8sc::set_output_vectors(lv_16sc_t* corr_out)
return true; return true;
} }
void fpga_multicorrelator_8sc::update_local_code(float rem_code_phase_chips) void fpga_multicorrelator_8sc::update_local_code(float rem_code_phase_chips)
{ {
d_rem_code_phase_chips = rem_code_phase_chips; d_rem_code_phase_chips = rem_code_phase_chips;
@ -110,6 +113,7 @@ void fpga_multicorrelator_8sc::update_local_code(float rem_code_phase_chips)
fpga_multicorrelator_8sc::fpga_configure_code_parameters_in_fpga(); fpga_multicorrelator_8sc::fpga_configure_code_parameters_in_fpga();
} }
bool fpga_multicorrelator_8sc::Carrier_wipeoff_multicorrelator_resampler( bool fpga_multicorrelator_8sc::Carrier_wipeoff_multicorrelator_resampler(
float rem_carrier_phase_in_rad, float phase_step_rad, float rem_carrier_phase_in_rad, float phase_step_rad,
float rem_code_phase_chips, float code_phase_step_chips, float rem_code_phase_chips, float code_phase_step_chips,
@ -141,6 +145,7 @@ bool fpga_multicorrelator_8sc::Carrier_wipeoff_multicorrelator_resampler(
return true; return true;
} }
fpga_multicorrelator_8sc::fpga_multicorrelator_8sc(int n_correlators, fpga_multicorrelator_8sc::fpga_multicorrelator_8sc(int n_correlators,
std::string device_name, unsigned int device_base) std::string device_name, unsigned int device_base)
{ {
@ -173,11 +178,13 @@ fpga_multicorrelator_8sc::fpga_multicorrelator_8sc(int n_correlators,
d_correlator_length_samples = 0; d_correlator_length_samples = 0;
} }
fpga_multicorrelator_8sc::~fpga_multicorrelator_8sc() fpga_multicorrelator_8sc::~fpga_multicorrelator_8sc()
{ {
close(d_device_descriptor); close(d_device_descriptor);
} }
bool fpga_multicorrelator_8sc::free() bool fpga_multicorrelator_8sc::free()
{ {
// unlock the hardware // unlock the hardware
@ -200,6 +207,7 @@ bool fpga_multicorrelator_8sc::free()
return true; return true;
} }
void fpga_multicorrelator_8sc::set_channel(unsigned int channel) void fpga_multicorrelator_8sc::set_channel(unsigned int channel)
{ {
char device_io_name[MAX_LENGTH_DEVICEIO_NAME]; // driver io name char device_io_name[MAX_LENGTH_DEVICEIO_NAME]; // driver io name
@ -245,6 +253,7 @@ void fpga_multicorrelator_8sc::set_channel(unsigned int channel)
} }
unsigned fpga_multicorrelator_8sc::fpga_acquisition_test_register( unsigned fpga_multicorrelator_8sc::fpga_acquisition_test_register(
unsigned writeval) unsigned writeval)
{ {
@ -257,6 +266,7 @@ unsigned fpga_multicorrelator_8sc::fpga_acquisition_test_register(
return readval; return readval;
} }
void fpga_multicorrelator_8sc::fpga_configure_tracking_gps_local_code(void) void fpga_multicorrelator_8sc::fpga_configure_tracking_gps_local_code(void)
{ {
@ -289,6 +299,7 @@ void fpga_multicorrelator_8sc::fpga_configure_tracking_gps_local_code(void)
} }
} }
void fpga_multicorrelator_8sc::fpga_compute_code_shift_parameters(void) void fpga_multicorrelator_8sc::fpga_compute_code_shift_parameters(void)
{ {
float temp_calculation; float temp_calculation;
@ -303,8 +314,7 @@ void fpga_multicorrelator_8sc::fpga_compute_code_shift_parameters(void)
{ {
temp_calculation = temp_calculation + d_code_length_chips; // % operator does not work as in Matlab with negative numbers temp_calculation = temp_calculation + d_code_length_chips; // % operator does not work as in Matlab with negative numbers
} }
d_initial_index[i] = (unsigned) ((int) temp_calculation) d_initial_index[i] = static_cast<unsigned>( (static_cast<int>(temp_calculation)) % d_code_length_chips);
% d_code_length_chips;
// initial interpolator counter calculation // initial interpolator counter calculation
temp_calculation = fmod(d_shifts_chips[i] + d_rem_code_phase_chips, temp_calculation = fmod(d_shifts_chips[i] + d_rem_code_phase_chips,
@ -313,11 +323,11 @@ void fpga_multicorrelator_8sc::fpga_compute_code_shift_parameters(void)
{ {
temp_calculation = temp_calculation + 1.0; // fmod operator does not work as in Matlab with negative numbers temp_calculation = temp_calculation + 1.0; // fmod operator does not work as in Matlab with negative numbers
} }
d_initial_interp_counter[i] = (unsigned) floor( d_initial_interp_counter[i] = static_cast<unsigned>( floor( MAX_CODE_RESAMPLER_COUNTER * temp_calculation));
MAX_CODE_RESAMPLER_COUNTER * temp_calculation);
} }
} }
void fpga_multicorrelator_8sc::fpga_configure_code_parameters_in_fpga(void) void fpga_multicorrelator_8sc::fpga_configure_code_parameters_in_fpga(void)
{ {
int i; int i;
@ -329,12 +339,12 @@ void fpga_multicorrelator_8sc::fpga_configure_code_parameters_in_fpga(void)
d_map_base[8] = d_code_length_chips - 1; // number of samples - 1 d_map_base[8] = d_code_length_chips - 1; // number of samples - 1
} }
void fpga_multicorrelator_8sc::fpga_compute_signal_parameters_in_fpga(void) void fpga_multicorrelator_8sc::fpga_compute_signal_parameters_in_fpga(void)
{ {
float d_rem_carrier_phase_in_rad_temp; float d_rem_carrier_phase_in_rad_temp;
d_code_phase_step_chips_num = (unsigned) roundf( d_code_phase_step_chips_num = static_cast<unsigned>( roundf(MAX_CODE_RESAMPLER_COUNTER * d_code_phase_step_chips));
MAX_CODE_RESAMPLER_COUNTER * d_code_phase_step_chips);
if (d_rem_carrier_phase_in_rad > M_PI) if (d_rem_carrier_phase_in_rad > M_PI)
{ {
@ -351,16 +361,16 @@ void fpga_multicorrelator_8sc::fpga_compute_signal_parameters_in_fpga(void)
d_rem_carrier_phase_in_rad_temp = d_rem_carrier_phase_in_rad; d_rem_carrier_phase_in_rad_temp = d_rem_carrier_phase_in_rad;
} }
d_rem_carr_phase_rad_int = (int) roundf( d_rem_carr_phase_rad_int = static_cast<int>( roundf(
(fabs(d_rem_carrier_phase_in_rad_temp) / M_PI) (fabs(d_rem_carrier_phase_in_rad_temp) / M_PI)
* pow(2, PHASE_CARR_NBITS_FRAC)); * pow(2, PHASE_CARR_NBITS_FRAC)));
if (d_rem_carrier_phase_in_rad_temp < 0) if (d_rem_carrier_phase_in_rad_temp < 0)
{ {
d_rem_carr_phase_rad_int = -d_rem_carr_phase_rad_int; d_rem_carr_phase_rad_int = -d_rem_carr_phase_rad_int;
} }
d_phase_step_rad_int = (int) roundf( d_phase_step_rad_int = static_cast<int>( roundf(
(fabs(d_phase_step_rad) / M_PI) * pow(2, PHASE_CARR_NBITS_FRAC)); // the FPGA accepts a range for the phase step between -pi and +pi (fabs(d_phase_step_rad) / M_PI) * pow(2, PHASE_CARR_NBITS_FRAC))); // the FPGA accepts a range for the phase step between -pi and +pi
if (d_phase_step_rad < 0) if (d_phase_step_rad < 0)
{ {
@ -368,6 +378,7 @@ void fpga_multicorrelator_8sc::fpga_compute_signal_parameters_in_fpga(void)
} }
} }
void fpga_multicorrelator_8sc::fpga_configure_signal_parameters_in_fpga(void) void fpga_multicorrelator_8sc::fpga_configure_signal_parameters_in_fpga(void)
{ {
d_map_base[0] = d_code_phase_step_chips_num; d_map_base[0] = d_code_phase_step_chips_num;
@ -377,6 +388,7 @@ void fpga_multicorrelator_8sc::fpga_configure_signal_parameters_in_fpga(void)
d_map_base[13] = d_initial_sample_counter; d_map_base[13] = d_initial_sample_counter;
} }
void fpga_multicorrelator_8sc::fpga_launch_multicorrelator_fpga(void) void fpga_multicorrelator_8sc::fpga_launch_multicorrelator_fpga(void)
{ {
// enable interrupts // enable interrupts
@ -386,6 +398,7 @@ void fpga_multicorrelator_8sc::fpga_launch_multicorrelator_fpga(void)
d_map_base[14] = 0; // writing anything to reg 14 launches the tracking d_map_base[14] = 0; // writing anything to reg 14 launches the tracking
} }
void fpga_multicorrelator_8sc::read_tracking_gps_results(void) void fpga_multicorrelator_8sc::read_tracking_gps_results(void)
{ {
int readval_real; int readval_real;
@ -413,12 +426,14 @@ void fpga_multicorrelator_8sc::read_tracking_gps_results(void)
} }
void fpga_multicorrelator_8sc::unlock_channel(void) void fpga_multicorrelator_8sc::unlock_channel(void)
{ {
// unlock the channel to let the next samples go through // unlock the channel to let the next samples go through
d_map_base[12] = 1; // unlock the channel d_map_base[12] = 1; // unlock the channel
} }
void fpga_multicorrelator_8sc::lock_channel(void) void fpga_multicorrelator_8sc::lock_channel(void)
{ {
// lock the channel for processing // lock the channel for processing

View File

@ -201,39 +201,39 @@ void gnss_sdr_supl_client::read_supl_data()
if (assist.set & SUPL_RRLP_ASSIST_REFTIME) if (assist.set & SUPL_RRLP_ASSIST_REFTIME)
{ {
/* TS 44.031: GPSTOW, range 0-604799.92, resolution 0.08 sec, 23-bit presentation */ /* TS 44.031: GPSTOW, range 0-604799.92, resolution 0.08 sec, 23-bit presentation */
gps_time.d_TOW = ((double)assist.time.gps_tow)*0.08; gps_time.d_TOW = static_cast<double>(assist.time.gps_tow) * 0.08;
gps_time.d_Week = (double)assist.time.gps_week; gps_time.d_Week = static_cast<double>(assist.time.gps_week);
gps_time.d_tv_sec = (double)assist.time.stamp.tv_sec; gps_time.d_tv_sec = static_cast<double>(assist.time.stamp.tv_sec);
gps_time.d_tv_usec = (double)assist.time.stamp.tv_usec; gps_time.d_tv_usec = static_cast<double>(assist.time.stamp.tv_usec);
gps_time.valid = true; gps_time.valid = true;
} }
// READ UTC MODEL // READ UTC MODEL
if (assist.set & SUPL_RRLP_ASSIST_UTC) if (assist.set & SUPL_RRLP_ASSIST_UTC)
{ {
gps_utc.d_A0 = ((double)assist.utc.a0)*pow(2.0, -30); gps_utc.d_A0 = static_cast<double>(assist.utc.a0) * pow(2.0, -30);
gps_utc.d_A1 = ((double)assist.utc.a1)*pow(2.0, -50); gps_utc.d_A1 = static_cast<double>(assist.utc.a1) * pow(2.0, -50);
gps_utc.d_DeltaT_LS = ((double)assist.utc.delta_tls); gps_utc.d_DeltaT_LS = static_cast<double>(assist.utc.delta_tls);
gps_utc.d_DeltaT_LSF = ((double)assist.utc.delta_tlsf); gps_utc.d_DeltaT_LSF = static_cast<double>(assist.utc.delta_tlsf);
gps_utc.d_t_OT = ((double)assist.utc.tot)*pow(2.0,12); gps_utc.d_t_OT = static_cast<double>(assist.utc.tot) * pow(2.0,12);
gps_utc.i_DN = ((double)assist.utc.dn); gps_utc.i_DN = static_cast<double>(assist.utc.dn);
gps_utc.i_WN_T = ((double)assist.utc.wnt); gps_utc.i_WN_T = static_cast<double>(assist.utc.wnt);
gps_utc.i_WN_LSF = ((double)assist.utc.wnlsf); gps_utc.i_WN_LSF = static_cast<double>(assist.utc.wnlsf);
gps_utc.valid = true; gps_utc.valid = true;
} }
// READ IONOSPHERIC MODEL // READ IONOSPHERIC MODEL
if (assist.set & SUPL_RRLP_ASSIST_IONO) if (assist.set & SUPL_RRLP_ASSIST_IONO)
{ {
gps_iono.d_alpha0 = (double)assist.iono.a0 * ALPHA_0_LSB; gps_iono.d_alpha0 = static_cast<double>(assist.iono.a0) * ALPHA_0_LSB;
gps_iono.d_alpha1 = (double)assist.iono.a1 * ALPHA_1_LSB; gps_iono.d_alpha1 = static_cast<double>(assist.iono.a1) * ALPHA_1_LSB;
gps_iono.d_alpha2 = (double)assist.iono.a2 * ALPHA_2_LSB; gps_iono.d_alpha2 = static_cast<double>(assist.iono.a2) * ALPHA_2_LSB;
gps_iono.d_alpha3 = (double)assist.iono.a3 * ALPHA_3_LSB; gps_iono.d_alpha3 = static_cast<double>(assist.iono.a3) * ALPHA_3_LSB;
gps_iono.d_beta0 = (double)assist.iono.b0 * BETA_0_LSB; gps_iono.d_beta0 = static_cast<double>(assist.iono.b0) * BETA_0_LSB;
gps_iono.d_beta1 = (double)assist.iono.b1 * BETA_1_LSB; gps_iono.d_beta1 = static_cast<double>(assist.iono.b1) * BETA_1_LSB;
gps_iono.d_beta2 = (double)assist.iono.b2 * BETA_2_LSB; gps_iono.d_beta2 = static_cast<double>(assist.iono.b2) * BETA_2_LSB;
gps_iono.d_beta3 = (double)assist.iono.b3 * BETA_3_LSB; gps_iono.d_beta3 = static_cast<double>(assist.iono.b3) * BETA_3_LSB;
gps_iono.valid = true; gps_iono.valid = true;
} }
@ -254,16 +254,16 @@ void gnss_sdr_supl_client::read_supl_data()
gps_almanac_iterator = this->gps_almanac_map.find(a->prn); gps_almanac_iterator = this->gps_almanac_map.find(a->prn);
} }
gps_almanac_iterator->second.i_satellite_PRN = a->prn; gps_almanac_iterator->second.i_satellite_PRN = a->prn;
gps_almanac_iterator->second.d_A_f0 = ((double)a->AF0)*pow(2.0, -20); gps_almanac_iterator->second.d_A_f0 = static_cast<double>(a->AF0) * pow(2.0, -20);
gps_almanac_iterator->second.d_A_f1 = ((double)a->AF1)*pow(2.0, -38); gps_almanac_iterator->second.d_A_f1 = static_cast<double>(a->AF1) * pow(2.0, -38);
gps_almanac_iterator->second.d_Delta_i = ((double)a->Ksii)*pow(2.0, -19); gps_almanac_iterator->second.d_Delta_i = static_cast<double>(a->Ksii) * pow(2.0, -19);
gps_almanac_iterator->second.d_OMEGA = ((double)a->w)*pow(2.0, -23); gps_almanac_iterator->second.d_OMEGA = static_cast<double>(a->w) * pow(2.0, -23);
gps_almanac_iterator->second.d_OMEGA0 = ((double)a->OMEGA_0)*pow(2.0, -23); gps_almanac_iterator->second.d_OMEGA0 = static_cast<double>(a->OMEGA_0) * pow(2.0, -23);
gps_almanac_iterator->second.d_sqrt_A = ((double)a->A_sqrt)*pow(2.0, -11); gps_almanac_iterator->second.d_sqrt_A = static_cast<double>(a->A_sqrt) * pow(2.0, -11);
gps_almanac_iterator->second.d_OMEGA_DOT = ((double)a->OMEGA_dot)*pow(2.0, -38); gps_almanac_iterator->second.d_OMEGA_DOT = static_cast<double>(a->OMEGA_dot) * pow(2.0, -38);
gps_almanac_iterator->second.d_Toa = ((double)a->toa)*pow(2.0, 12); gps_almanac_iterator->second.d_Toa = static_cast<double>(a->toa) * pow(2.0, 12);
gps_almanac_iterator->second.d_e_eccentricity = ((double)a->toa)*pow(2.0, -21); gps_almanac_iterator->second.d_e_eccentricity = static_cast<double>(a->toa) * pow(2.0, -21);
gps_almanac_iterator->second.d_M_0 = ((double)a->M0)*pow(2.0, -23); gps_almanac_iterator->second.d_M_0 = static_cast<double>(a->M0) * pow(2.0, -23);
} }
} }
@ -288,7 +288,7 @@ void gnss_sdr_supl_client::read_supl_data()
{ {
gps_eph_iterator->second.i_GPS_week = assist.time.gps_week; gps_eph_iterator->second.i_GPS_week = assist.time.gps_week;
/* TS 44.031: GPSTOW, range 0-604799.92, resolution 0.08 sec, 23-bit presentation */ /* TS 44.031: GPSTOW, range 0-604799.92, resolution 0.08 sec, 23-bit presentation */
gps_eph_iterator->second.d_TOW = ((double)assist.time.gps_tow)*0.08; gps_eph_iterator->second.d_TOW = static_cast<double>(assist.time.gps_tow) * 0.08;
} }
else else
{ {
@ -300,32 +300,32 @@ void gnss_sdr_supl_client::read_supl_data()
gps_eph_iterator->second.i_code_on_L2 = e->bits; gps_eph_iterator->second.i_code_on_L2 = e->bits;
gps_eph_iterator->second.i_SV_accuracy = e->ura; //User Range Accuracy (URA) gps_eph_iterator->second.i_SV_accuracy = e->ura; //User Range Accuracy (URA)
gps_eph_iterator->second.i_SV_health = e->health; gps_eph_iterator->second.i_SV_health = e->health;
gps_eph_iterator->second.d_IODC = (double)e->IODC; gps_eph_iterator->second.d_IODC = static_cast<double>(e->IODC);
//miss P flag (1 bit) //miss P flag (1 bit)
//miss SF1 Reserved (87 bits) //miss SF1 Reserved (87 bits)
gps_eph_iterator->second.d_TGD = ((double)e->tgd)*T_GD_LSB; gps_eph_iterator->second.d_TGD = static_cast<double>(e->tgd) * T_GD_LSB;
gps_eph_iterator->second.d_Toc = ((double)e->toc)*T_OC_LSB; gps_eph_iterator->second.d_Toc = static_cast<double>(e->toc) * T_OC_LSB;
gps_eph_iterator->second.d_A_f0 = ((double)e->AF0)*A_F0_LSB; gps_eph_iterator->second.d_A_f0 = static_cast<double>(e->AF0) * A_F0_LSB;
gps_eph_iterator->second.d_A_f1 = ((double)e->AF1)*A_F1_LSB; gps_eph_iterator->second.d_A_f1 = static_cast<double>(e->AF1) * A_F1_LSB;
gps_eph_iterator->second.d_A_f2 = ((double)e->AF2)*A_F2_LSB; gps_eph_iterator->second.d_A_f2 = static_cast<double>(e->AF2) * A_F2_LSB;
gps_eph_iterator->second.d_Crc = ((double)e->Crc)*C_RC_LSB; gps_eph_iterator->second.d_Crc = static_cast<double>(e->Crc) * C_RC_LSB;
gps_eph_iterator->second.d_Delta_n = ((double)e->delta_n)*DELTA_N_LSB; gps_eph_iterator->second.d_Delta_n = static_cast<double>(e->delta_n) * DELTA_N_LSB;
gps_eph_iterator->second.d_M_0 = ((double)e->M0)*M_0_LSB; gps_eph_iterator->second.d_M_0 = static_cast<double>(e->M0) * M_0_LSB;
gps_eph_iterator->second.d_Cuc = ((double)e->Cuc)*C_UC_LSB; gps_eph_iterator->second.d_Cuc = static_cast<double>(e->Cuc) * C_UC_LSB;
gps_eph_iterator->second.d_e_eccentricity = ((double)e->e)*E_LSB; gps_eph_iterator->second.d_e_eccentricity = static_cast<double>(e->e) * E_LSB;
gps_eph_iterator->second.d_Cus = ((double)e->Cus)*C_US_LSB; gps_eph_iterator->second.d_Cus = static_cast<double>(e->Cus) * C_US_LSB;
gps_eph_iterator->second.d_sqrt_A = ((double)e->A_sqrt)*SQRT_A_LSB; gps_eph_iterator->second.d_sqrt_A = static_cast<double>(e->A_sqrt) * SQRT_A_LSB;
gps_eph_iterator->second.d_Toe = ((double)e->toe)*T_OE_LSB; gps_eph_iterator->second.d_Toe = static_cast<double>(e->toe) * T_OE_LSB;
//miss fit interval flag (1 bit) //miss fit interval flag (1 bit)
gps_eph_iterator->second.i_AODO = e->AODA * AODO_LSB; gps_eph_iterator->second.i_AODO = e->AODA * AODO_LSB;
gps_eph_iterator->second.d_Cic = ((double)e->Cic)*C_IC_LSB; gps_eph_iterator->second.d_Cic = static_cast<double>(e->Cic) * C_IC_LSB;
gps_eph_iterator->second.d_OMEGA0 = ((double)e->OMEGA_0)*OMEGA_0_LSB; gps_eph_iterator->second.d_OMEGA0 = static_cast<double>(e->OMEGA_0) * OMEGA_0_LSB;
gps_eph_iterator->second.d_Cis = ((double)e->Cis)*C_IS_LSB; gps_eph_iterator->second.d_Cis = static_cast<double>(e->Cis) * C_IS_LSB;
gps_eph_iterator->second.d_i_0 = ((double)e->i0)*I_0_LSB; gps_eph_iterator->second.d_i_0 = static_cast<double>(e->i0) * I_0_LSB;
gps_eph_iterator->second.d_Crs = ((double)e->Crs)*C_RS_LSB; gps_eph_iterator->second.d_Crs = static_cast<double>(e->Crs) * C_RS_LSB;
gps_eph_iterator->second.d_OMEGA = ((double)e->w)*OMEGA_LSB; gps_eph_iterator->second.d_OMEGA = static_cast<double>(e->w) * OMEGA_LSB;
gps_eph_iterator->second.d_OMEGA_DOT = (double)e->OMEGA_dot*OMEGA_DOT_LSB; gps_eph_iterator->second.d_OMEGA_DOT = static_cast<double>(e->OMEGA_dot) * OMEGA_DOT_LSB;
gps_eph_iterator->second.d_IDOT = ((double)e->i_dot)*I_DOT_LSB; gps_eph_iterator->second.d_IDOT = static_cast<double>(e->i_dot) * I_DOT_LSB;
} }
} }
@ -348,16 +348,16 @@ void gnss_sdr_supl_client::read_supl_data()
} }
// fill the acquisition assistance structure // fill the acquisition assistance structure
gps_acq_iterator->second.i_satellite_PRN = e->prn; gps_acq_iterator->second.i_satellite_PRN = e->prn;
gps_acq_iterator->second.d_TOW = (double)assist.acq_time; gps_acq_iterator->second.d_TOW = static_cast<double>(assist.acq_time);
gps_acq_iterator->second.d_Doppler0 = (double)e->doppler0; gps_acq_iterator->second.d_Doppler0 = static_cast<double>(e->doppler0);
gps_acq_iterator->second.d_Doppler1 = (double)e->doppler1; gps_acq_iterator->second.d_Doppler1 = static_cast<double>(e->doppler1);
gps_acq_iterator->second.dopplerUncertainty = (double)e->d_win; gps_acq_iterator->second.dopplerUncertainty = static_cast<double>(e->d_win);
gps_acq_iterator->second.Code_Phase = (double)e->code_ph; gps_acq_iterator->second.Code_Phase = static_cast<double>(e->code_ph);
gps_acq_iterator->second.Code_Phase_int = (double)e->code_ph_int; gps_acq_iterator->second.Code_Phase_int = static_cast<double>(e->code_ph_int);
gps_acq_iterator->second.Code_Phase_window = (double)e->code_ph_win; gps_acq_iterator->second.Code_Phase_window = static_cast<double>(e->code_ph_win);
gps_acq_iterator->second.Azimuth = (double)e->az; gps_acq_iterator->second.Azimuth = static_cast<double>(e->az);
gps_acq_iterator->second.Elevation = (double)e->el; gps_acq_iterator->second.Elevation = static_cast<double>(e->el);
gps_acq_iterator->second.GPS_Bit_Number = (double)e->bit_num; gps_acq_iterator->second.GPS_Bit_Number = static_cast<double>(e->bit_num);
} }
} }
} }

View File

@ -65,10 +65,10 @@ TEST(CodeGenerationTest, CodeGenGPSL1SampledTest)
{ {
signed int _prn = 1; signed int _prn = 1;
unsigned int _chip_shift = 4; unsigned int _chip_shift = 4;
double _fs = 8000000; double _fs = 8000000.0;
const signed int _codeFreqBasis = 1023000; //Hz const signed int _codeFreqBasis = 1023000; //Hz
const signed int _codeLength = 1023; const signed int _codeLength = 1023;
int _samplesPerCode = round(_fs / (double)(_codeFreqBasis / _codeLength)); int _samplesPerCode = round(_fs / static_cast<double>(_codeFreqBasis / _codeLength));
std::complex<float>* _dest = new std::complex<float>[_samplesPerCode]; std::complex<float>* _dest = new std::complex<float>[_samplesPerCode];
int iterations = 1000; int iterations = 1000;
@ -92,11 +92,11 @@ TEST(CodeGenerationTest, CodeGenGPSL1SampledTest)
TEST(CodeGenerationTest, ComplexConjugateTest) TEST(CodeGenerationTest, ComplexConjugateTest)
{ {
double _fs = 8000000; double _fs = 8000000.0;
double _f = 4000; double _f = 4000.0;
const signed int _codeFreqBasis = 1023000; //Hz const signed int _codeFreqBasis = 1023000; //Hz
const signed int _codeLength = 1023; const signed int _codeLength = 1023;
int _samplesPerCode = round(_fs / (double)(_codeFreqBasis / _codeLength)); int _samplesPerCode = round(_fs / static_cast<double>(_codeFreqBasis / _codeLength));
std::complex<float>* _dest = new std::complex<float>[_samplesPerCode]; std::complex<float>* _dest = new std::complex<float>[_samplesPerCode];
int iterations = 1000; int iterations = 1000;

View File

@ -42,10 +42,10 @@ TEST(ComplexCarrierTest, StandardComplexImplementation)
// Dynamic allocation creates new usable space on the program STACK // Dynamic allocation creates new usable space on the program STACK
// (an area of RAM specifically allocated to the program) // (an area of RAM specifically allocated to the program)
std::complex<float>* output = new std::complex<float>[FLAGS_size_carrier_test]; std::complex<float>* output = new std::complex<float>[FLAGS_size_carrier_test];
const double _f = 2000; const double _f = 2000.0;
const double _fs = 2000000; const double _fs = 2000000.0;
const double phase_step = (double)((GPS_TWO_PI * _f) / _fs); const double phase_step = static_cast<double>((GPS_TWO_PI * _f) / _fs);
double phase = 0; double phase = 0.0;
std::chrono::time_point<std::chrono::system_clock> start, end; std::chrono::time_point<std::chrono::system_clock> start, end;
start = std::chrono::system_clock::now(); start = std::chrono::system_clock::now();
@ -82,10 +82,10 @@ TEST(ComplexCarrierTest, C11ComplexImplementation)
{ {
// declaration: load data onto the program data segment // declaration: load data onto the program data segment
std::vector<std::complex<float>> output(FLAGS_size_carrier_test); std::vector<std::complex<float>> output(FLAGS_size_carrier_test);
const double _f = 2000; const double _f = 2000.0;
const double _fs = 2000000; const double _fs = 2000000.0;
const double phase_step = (double)((GPS_TWO_PI * _f) / _fs); const double phase_step = static_cast<double>((GPS_TWO_PI * _f) / _fs);
double phase = 0; double phase = 0.0;
std::chrono::time_point<std::chrono::system_clock> start, end; std::chrono::time_point<std::chrono::system_clock> start, end;
start = std::chrono::system_clock::now(); start = std::chrono::system_clock::now();
@ -116,12 +116,12 @@ TEST(ComplexCarrierTest, C11ComplexImplementation)
TEST(ComplexCarrierTest, OwnComplexImplementation) TEST(ComplexCarrierTest, OwnComplexImplementation)
{ {
std::complex<float>* output = new std::complex<float>[FLAGS_size_carrier_test]; std::complex<float>* output = new std::complex<float>[FLAGS_size_carrier_test];
double _f = 2000; double _f = 2000.0;
double _fs = 2000000; double _fs = 2000000.0;
std::chrono::time_point<std::chrono::system_clock> start, end; std::chrono::time_point<std::chrono::system_clock> start, end;
start = std::chrono::system_clock::now(); start = std::chrono::system_clock::now();
complex_exp_gen(output, _f, _fs, (unsigned int)FLAGS_size_carrier_test); complex_exp_gen(output, _f, _fs, static_cast<unsigned int>(FLAGS_size_carrier_test));
end = std::chrono::system_clock::now(); end = std::chrono::system_clock::now();
std::chrono::duration<double> elapsed_seconds = end - start; std::chrono::duration<double> elapsed_seconds = end - start;

View File

@ -48,7 +48,7 @@ TEST(MagnitudeSquaredTest, StandardCComplexImplementation)
std::chrono::time_point<std::chrono::system_clock> start, end; std::chrono::time_point<std::chrono::system_clock> start, end;
start = std::chrono::system_clock::now(); start = std::chrono::system_clock::now();
for(number = 0; number < (unsigned int)FLAGS_size_magnitude_test; number++) for(number = 0; number < static_cast<unsigned int>(FLAGS_size_magnitude_test); number++)
{ {
output[number] = (input[number].real() * input[number].real()) + (input[number].imag() * input[number].imag()); output[number] = (input[number].real() * input[number].real()) + (input[number].imag() * input[number].imag());
} }

View File

@ -285,7 +285,7 @@ TEST(GNSSBlockFactoryTest, InstantiateChannels)
gr::msg_queue::sptr queue = gr::msg_queue::make(0); gr::msg_queue::sptr queue = gr::msg_queue::make(0);
std::unique_ptr<GNSSBlockFactory> factory; std::unique_ptr<GNSSBlockFactory> factory;
std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> channels = std::move(factory->GetChannels(configuration, queue)); std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> channels = std::move(factory->GetChannels(configuration, queue));
EXPECT_EQ((unsigned int) 2, channels->size()); EXPECT_EQ(2U, channels->size());
channels->erase(channels->begin(), channels->end()); channels->erase(channels->begin(), channels->end());
} }

View File

@ -379,7 +379,7 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::process_message()
detection_counter++; detection_counter++;
// The term -5 is here to correct the additional delay introduced by the FIR filter // The term -5 is here to correct the additional delay introduced by the FIR filter
double delay_error_chips = std::abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples-5)*1023.0/((double)fs_in*1e-3)); double delay_error_chips = std::abs(static_cast<double>(expected_delay_chips) - (static_cast<double>(gnss_synchro.Acq_delay_samples) - 5) * 1023.0 / (static_cast<double>(fs_in)*1e-3));
double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz);
mse_delay += std::pow(delay_error_chips, 2); mse_delay += std::pow(delay_error_chips, 2);
@ -393,16 +393,16 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::process_message()
realization_counter++; realization_counter++;
std::cout << "Progress: " << round((float)realization_counter/num_of_realizations*100) << "% \r" << std::flush; std::cout << "Progress: " << round(static_cast<float>(realization_counter) / static_cast<float>(num_of_realizations) * 100.0) << "% \r" << std::flush;
if (realization_counter == num_of_realizations) if (realization_counter == num_of_realizations)
{ {
mse_delay /= num_of_realizations; mse_delay /= num_of_realizations;
mse_doppler /= num_of_realizations; mse_doppler /= num_of_realizations;
Pd = (double)correct_estimation_counter / (double)num_of_realizations; Pd = static_cast<double>(correct_estimation_counter) / static_cast<double>(num_of_realizations);
Pfa_a = (double)detection_counter / (double)num_of_realizations; Pfa_a = static_cast<double>(detection_counter) / static_cast<double>(num_of_realizations);
Pfa_p = (double)(detection_counter-correct_estimation_counter) / (double)num_of_realizations; Pfa_p = static_cast<double>(detection_counter - correct_estimation_counter) / static_cast<double>(num_of_realizations);
mean_acq_time_us /= num_of_realizations; mean_acq_time_us /= num_of_realizations;
@ -555,7 +555,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS."; EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
if (message == 1) if (message == 1)
{ {
EXPECT_EQ((unsigned int)1, correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation."; EXPECT_EQ(1U, correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
} }
} }

View File

@ -382,7 +382,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::process_message()
detection_counter++; detection_counter++;
// The term -5 is here to correct the additional delay introduced by the FIR filter // The term -5 is here to correct the additional delay introduced by the FIR filter
double delay_error_chips = std::abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples-5)*1023.0/((double)fs_in*1e-3)); double delay_error_chips = std::abs(static_cast<double>(expected_delay_chips) - (static_cast<double>(gnss_synchro.Acq_delay_samples)- 5 ) * 1023.0 / static_cast<double>(fs_in*1e-3));
double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz);
mse_delay += std::pow(delay_error_chips, 2); mse_delay += std::pow(delay_error_chips, 2);
@ -396,18 +396,18 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::process_message()
realization_counter++; realization_counter++;
std::cout << "Progress: " << round((float)realization_counter/num_of_realizations*100) << "% \r" << std::flush; std::cout << "Progress: " << round(static_cast<float>(realization_counter) / static_cast<float>(num_of_realizations) * 100.0) << "% \r" << std::flush;
if (realization_counter == num_of_realizations) if (realization_counter == num_of_realizations)
{ {
mse_delay /= (double)num_of_realizations; mse_delay /= static_cast<double>(num_of_realizations);
mse_doppler /= (double)num_of_realizations; mse_doppler /= static_cast<double>(num_of_realizations);
Pd = (double)correct_estimation_counter / (double)num_of_realizations; Pd = static_cast<double>(correct_estimation_counter) / static_cast<double>(num_of_realizations);
Pfa_a = (double)detection_counter / (double)num_of_realizations; Pfa_a = static_cast<double>(detection_counter) / static_cast<double>(num_of_realizations);
Pfa_p = (double)(detection_counter-correct_estimation_counter) / (double)num_of_realizations; Pfa_p = static_cast<double>(detection_counter-correct_estimation_counter) / static_cast<double>(num_of_realizations);
mean_acq_time_us /= (double)num_of_realizations; mean_acq_time_us /= static_cast<double>(num_of_realizations);
stop_queue(); stop_queue();
top_block->stop(); top_block->stop();
@ -535,7 +535,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS."; EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
if (message == 1) if (message == 1)
{ {
EXPECT_EQ((unsigned int)1, correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation."; EXPECT_EQ(1U, correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
} }
} }
else if (i == 1) else if (i == 1)

View File

@ -258,7 +258,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults)
std::cout << "Doppler: " << gnss_synchro.Acq_doppler_hz << std::endl; std::cout << "Doppler: " << gnss_synchro.Acq_doppler_hz << std::endl;
double delay_error_samples = std::abs(expected_delay_samples - gnss_synchro.Acq_delay_samples); double delay_error_samples = std::abs(expected_delay_samples - gnss_synchro.Acq_delay_samples);
float delay_error_chips = (float)(delay_error_samples * 1023 / 4000000); float delay_error_chips = static_cast<float>(delay_error_samples * 1023 / 4000000);
double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz);
EXPECT_LE(doppler_error_hz, 166) << "Doppler error exceeds the expected value: 166 Hz = 2/(3*integration period)"; EXPECT_LE(doppler_error_hz, 166) << "Doppler error exceeds the expected value: 166 Hz = 2/(3*integration period)";

View File

@ -381,7 +381,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::process_message()
detection_counter++; detection_counter++;
// The term -5 is here to correct the additional delay introduced by the FIR filter // The term -5 is here to correct the additional delay introduced by the FIR filter
double delay_error_chips = std::abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples-5)*1023.0/((double)fs_in*1e-3)); double delay_error_chips = std::abs(static_cast<double>(expected_delay_chips) - static_cast<double>(gnss_synchro.Acq_delay_samples - 5) * 1023.0 / (static_cast<double>(fs_in) * 1e-3));
double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz);
mse_delay += std::pow(delay_error_chips, 2); mse_delay += std::pow(delay_error_chips, 2);
@ -395,16 +395,16 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::process_message()
realization_counter++; realization_counter++;
std::cout << "Progress: " << round((float)realization_counter/num_of_realizations*100) << "% \r" << std::flush; std::cout << "Progress: " << round(static_cast<float>(realization_counter) / static_cast<float>(num_of_realizations) * 100.0) << "% \r" << std::flush;
if (realization_counter == num_of_realizations) if (realization_counter == num_of_realizations)
{ {
mse_delay /= num_of_realizations; mse_delay /= num_of_realizations;
mse_doppler /= num_of_realizations; mse_doppler /= num_of_realizations;
Pd = (double)correct_estimation_counter / (double)num_of_realizations; Pd = static_cast<double>(correct_estimation_counter) / static_cast<double>(num_of_realizations);
Pfa_a = (double)detection_counter / (double)num_of_realizations; Pfa_a = static_cast<double>(detection_counter) / static_cast<double>(num_of_realizations);
Pfa_p = (double)(detection_counter-correct_estimation_counter) / (double)num_of_realizations; Pfa_p = static_cast<double>(detection_counter-correct_estimation_counter) / static_cast<double>(num_of_realizations);
mean_acq_time_us /= num_of_realizations; mean_acq_time_us /= num_of_realizations;
@ -542,7 +542,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResults)
//EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS."; //EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
if (message == 1) if (message == 1)
{ {
EXPECT_EQ((unsigned int)1, correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation."; EXPECT_EQ(1U, correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
} }
} }
else if (i == 1) else if (i == 1)

View File

@ -494,7 +494,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::process_message()
detection_counter++; detection_counter++;
// The term -5 is here to correct the additional delay introduced by the FIR filter // The term -5 is here to correct the additional delay introduced by the FIR filter
double delay_error_chips = std::abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples - 5) * 1023.0 / ((double)fs_in * 1e-3)); double delay_error_chips = std::abs(static_cast<double>(expected_delay_chips) - static_cast<double>(gnss_synchro.Acq_delay_samples - 5) * 1023.0 / (static_cast<double>(fs_in) * 1e-3));
double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz);
mse_delay += std::pow(delay_error_chips, 2); mse_delay += std::pow(delay_error_chips, 2);
@ -518,19 +518,19 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::process_message()
realization_counter++; realization_counter++;
std::cout << "Progress: " << round((float)realization_counter / num_of_realizations * 100) << "% \r" << std::flush; std::cout << "Progress: " << round(static_cast<float>(realization_counter) / static_cast<float>(num_of_realizations) * 100.0) << "% \r" << std::flush;
if (realization_counter == num_of_realizations) if (realization_counter == num_of_realizations)
{ {
mse_delay /= (double)num_of_realizations; mse_delay /= static_cast<double>(num_of_realizations);
mse_doppler /= (double)num_of_realizations; mse_doppler /= static_cast<double>(num_of_realizations);
Pd = (double)correct_estimation_counter / (double)num_of_realizations; Pd = static_cast<double>(correct_estimation_counter) / static_cast<double>(num_of_realizations);
Pfa_a = (double)detection_counter / (double)num_of_realizations; Pfa_a = static_cast<double>(detection_counter) / static_cast<double>(num_of_realizations);
Pfa_p = (double)(detection_counter - correct_estimation_counter) / (double)num_of_realizations; Pfa_p = static_cast<double>(detection_counter - correct_estimation_counter) / static_cast<double>(num_of_realizations);
Pmd = (double)miss_detection_counter / (double)num_of_realizations; Pmd = static_cast<double>(miss_detection_counter) / static_cast<double>(num_of_realizations);
mean_acq_time_us /= (double)num_of_realizations; mean_acq_time_us /= static_cast<double>(num_of_realizations);
stop_queue(); stop_queue();
top_block->stop(); top_block->stop();
@ -669,7 +669,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
if (i == 0) if (i == 0)
{ {
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS."; EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
EXPECT_EQ((unsigned int)1, correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation."; EXPECT_EQ(1U, correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
} }
else if (i == 1) else if (i == 1)
{ {
@ -759,7 +759,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
if (i == 0) if (i == 0)
{ {
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS."; EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
EXPECT_EQ((unsigned int)1, correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation."; EXPECT_EQ(1U, correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
} }
else if (i == 1) else if (i == 1)
{ {

View File

@ -387,7 +387,7 @@ void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test::process_message()
detection_counter++; detection_counter++;
// The term -5 is here to correct the additional delay introduced by the FIR filter // The term -5 is here to correct the additional delay introduced by the FIR filter
double delay_error_chips = std::abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples-5)*1023.0/((double)fs_in*1e-3)); double delay_error_chips = std::abs(static_cast<double>(expected_delay_chips) - static_cast<double>(gnss_synchro.Acq_delay_samples - 5) * 1023.0 / (static_cast<double>(fs_in) * 1e-3));
double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz);
mse_delay += std::pow(delay_error_chips, 2); mse_delay += std::pow(delay_error_chips, 2);
@ -401,16 +401,16 @@ void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test::process_message()
realization_counter++; realization_counter++;
std::cout << "Progress: " << round((float)realization_counter/num_of_realizations*100) << "% \r" << std::flush; std::cout << "Progress: " << round(static_cast<float>(realization_counter) / static_cast<float>(num_of_realizations) * 100.0) << "% \r" << std::flush;
if (realization_counter == num_of_realizations) if (realization_counter == num_of_realizations)
{ {
mse_delay /= num_of_realizations; mse_delay /= num_of_realizations;
mse_doppler /= num_of_realizations; mse_doppler /= num_of_realizations;
Pd = (double)correct_estimation_counter / (double)num_of_realizations; Pd = static_cast<double>(correct_estimation_counter) / static_cast<double>(num_of_realizations);
Pfa_a = (double)detection_counter / (double)num_of_realizations; Pfa_a = static_cast<double>(detection_counter) / static_cast<double>(num_of_realizations);
Pfa_p = (double)(detection_counter-correct_estimation_counter) / (double)num_of_realizations; Pfa_p = static_cast<double>(detection_counter - correct_estimation_counter) / static_cast<double>(num_of_realizations);
mean_acq_time_us /= num_of_realizations; mean_acq_time_us /= num_of_realizations;
@ -541,7 +541,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
if (i == 0) if (i == 0)
{ {
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS."; EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
EXPECT_EQ((unsigned int)1, correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation."; EXPECT_EQ(1U, correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
} }
else if (i == 1) else if (i == 1)
{ {

View File

@ -205,7 +205,7 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_1()
integration_time_ms = 1; integration_time_ms = 1;
fs_in = 32e6; fs_in = 32e6;
expected_delay_chips = round(14000*((double)10230000/(double)fs_in)); expected_delay_chips = round(14000.0 * 10230000.0 / static_cast<double>(fs_in));
expected_doppler_hz = 2800; expected_doppler_hz = 2800;
expected_delay_sec = 94; expected_delay_sec = 94;
CAF_window_hz = 0; CAF_window_hz = 0;
@ -464,19 +464,19 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::process_message()
switch (sat) switch (sat)
{ {
case 0: case 0:
delay_error_chips = std::abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples-5)*10230.0/((double)fs_in*1e-3)); delay_error_chips = std::abs(static_cast<double>(expected_delay_chips) - static_cast<double>(gnss_synchro.Acq_delay_samples - 5) * 10230.0 / (static_cast<double>(fs_in) * 1e-3));
doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz);
break; break;
case 1: case 1:
delay_error_chips = std::abs((double)expected_delay_chips1 - (double)(gnss_synchro.Acq_delay_samples-5)*10230.0/((double)fs_in*1e-3)); delay_error_chips = std::abs(static_cast<double>(expected_delay_chips1) - static_cast<double>(gnss_synchro.Acq_delay_samples - 5) * 10230.0 / (static_cast<double>(fs_in) * 1e-3));
doppler_error_hz = std::abs(expected_doppler_hz1 - gnss_synchro.Acq_doppler_hz); doppler_error_hz = std::abs(expected_doppler_hz1 - gnss_synchro.Acq_doppler_hz);
break; break;
case 2: case 2:
delay_error_chips = std::abs((double)expected_delay_chips2 - (double)(gnss_synchro.Acq_delay_samples-5)*10230.0/((double)fs_in*1e-3)); delay_error_chips = std::abs(static_cast<double>(expected_delay_chips2) - static_cast<double>(gnss_synchro.Acq_delay_samples - 5) * 10230.0 / (static_cast<double>(fs_in) * 1e-3));
doppler_error_hz = std::abs(expected_doppler_hz2 - gnss_synchro.Acq_doppler_hz); doppler_error_hz = std::abs(expected_doppler_hz2 - gnss_synchro.Acq_doppler_hz);
break; break;
case 3: case 3:
delay_error_chips = std::abs((double)expected_delay_chips3 - (double)(gnss_synchro.Acq_delay_samples-5)*10230.0/((double)fs_in*1e-3)); delay_error_chips = std::abs(static_cast<double>(expected_delay_chips3) - static_cast<double>(gnss_synchro.Acq_delay_samples - 5) * 10230.0 / (static_cast<double>(fs_in) * 1e-3));
doppler_error_hz = std::abs(expected_doppler_hz3 - gnss_synchro.Acq_doppler_hz); doppler_error_hz = std::abs(expected_doppler_hz3 - gnss_synchro.Acq_doppler_hz);
break; break;
default: // case 3 default: // case 3
@ -502,16 +502,16 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::process_message()
realization_counter++; realization_counter++;
//std::cout << correct_estimation_counter << "correct estimation counter" << std::endl; //std::cout << correct_estimation_counter << "correct estimation counter" << std::endl;
std::cout << "Progress: " << round((float)realization_counter/num_of_realizations*100) << "% \r" << std::flush; std::cout << "Progress: " << round(static_cast<float>(realization_counter / num_of_realizations * 100)) << "% \r" << std::flush;
//std::cout << message << "message" <<std::endl; //std::cout << message << "message" <<std::endl;
if (realization_counter == num_of_realizations) if (realization_counter == num_of_realizations)
{ {
mse_delay /= num_of_realizations; mse_delay /= num_of_realizations;
mse_doppler /= num_of_realizations; mse_doppler /= num_of_realizations;
Pd = (double)correct_estimation_counter / (double)num_of_realizations; Pd = static_cast<double>(correct_estimation_counter) / static_cast<double>(num_of_realizations);
Pfa_a = (double)detection_counter / (double)num_of_realizations; Pfa_a = static_cast<double>(detection_counter) / static_cast<double>(num_of_realizations);
Pfa_p = (double)(detection_counter - correct_estimation_counter) / (double)num_of_realizations; Pfa_p = static_cast<double>(detection_counter - correct_estimation_counter) / static_cast<double>(num_of_realizations);
mean_acq_time_us /= num_of_realizations; mean_acq_time_us /= num_of_realizations;
@ -654,7 +654,7 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ValidationOfSIM)
{ {
// std::cout << gnss_synchro.Acq_delay_samples << "acq delay" <<std::endl; // std::cout << gnss_synchro.Acq_delay_samples << "acq delay" <<std::endl;
// std::cout << gnss_synchro.Acq_doppler_hz << "acq doppler" <<std::endl; // std::cout << gnss_synchro.Acq_doppler_hz << "acq doppler" <<std::endl;
EXPECT_EQ((unsigned int) 1, correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation."; EXPECT_EQ(1U, correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
} }
} }
else if (i == 1) else if (i == 1)

View File

@ -383,7 +383,7 @@ void GpsL1CaPcpsAcquisitionGSoC2013Test::process_message()
detection_counter++; detection_counter++;
// The term -5 is here to correct the additional delay introduced by the FIR filter // The term -5 is here to correct the additional delay introduced by the FIR filter
double delay_error_chips = std::abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples-5)*1023.0/((double)fs_in*1e-3)); double delay_error_chips = std::abs(static_cast<double>(expected_delay_chips) - static_cast<double>(gnss_synchro.Acq_delay_samples - 5) *1023.0 / (static_cast<double>(fs_in) * 1e-3));
double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz);
mse_delay += std::pow(delay_error_chips, 2); mse_delay += std::pow(delay_error_chips, 2);
@ -397,16 +397,16 @@ void GpsL1CaPcpsAcquisitionGSoC2013Test::process_message()
realization_counter++; realization_counter++;
std::cout << "Progress: " << round((float)realization_counter/num_of_realizations*100) << "% \r" << std::flush; std::cout << "Progress: " << round(static_cast<float>(realization_counter) / static_cast<float>(num_of_realizations) * 100.0) << "% \r" << std::flush;
if (realization_counter == num_of_realizations) if (realization_counter == num_of_realizations)
{ {
mse_delay /= num_of_realizations; mse_delay /= num_of_realizations;
mse_doppler /= num_of_realizations; mse_doppler /= num_of_realizations;
Pd = (double)correct_estimation_counter / (double)num_of_realizations; Pd = static_cast<double>(correct_estimation_counter) / static_cast<double>(num_of_realizations);
Pfa_a = (double)detection_counter / (double)num_of_realizations; Pfa_a = static_cast<double>(detection_counter) / static_cast<double>(num_of_realizations);
Pfa_p = (double)(detection_counter - correct_estimation_counter) / (double)num_of_realizations; Pfa_p = static_cast<double>(detection_counter - correct_estimation_counter) / static_cast<double>(num_of_realizations);
mean_acq_time_us /= num_of_realizations; mean_acq_time_us /= num_of_realizations;
@ -537,7 +537,7 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResults)
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS."; EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
if (message == 1) if (message == 1)
{ {
EXPECT_EQ((unsigned int) 1, correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation."; EXPECT_EQ(1U, correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
} }
} }

View File

@ -254,7 +254,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults)
ASSERT_EQ(1, msg_rx->rx_message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS."; ASSERT_EQ(1, msg_rx->rx_message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
double delay_error_samples = std::abs(expected_delay_samples - gnss_synchro.Acq_delay_samples); double delay_error_samples = std::abs(expected_delay_samples - gnss_synchro.Acq_delay_samples);
float delay_error_chips = (float)(delay_error_samples * 1023 / 4000); float delay_error_chips = static_cast<float>(delay_error_samples * 1023 / 4000);
double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz);
EXPECT_LE(doppler_error_hz, 666) << "Doppler error exceeds the expected value: 666 Hz = 2/(3*integration period)"; EXPECT_LE(doppler_error_hz, 666) << "Doppler error exceeds the expected value: 666 Hz = 2/(3*integration period)";

View File

@ -134,7 +134,7 @@ void thread_acquisition_send_rx_samples(gr::top_block_sptr top_block,
int transfer_size; int transfer_size;
int num_transferred_samples = 0; int num_transferred_samples = 0;
while (num_transferred_samples < (int) (file_length / FLOAT_SIZE)) while (num_transferred_samples < static_cast<int>((file_length / FLOAT_SIZE)))
{ {
if (((file_length / FLOAT_SIZE) - num_transferred_samples) > DMA_ACQ_TRANSFER_SIZE) if (((file_length / FLOAT_SIZE) - num_transferred_samples) > DMA_ACQ_TRANSFER_SIZE)
{ {
@ -152,7 +152,7 @@ void thread_acquisition_send_rx_samples(gr::top_block_sptr top_block,
fread(buffer_float, FLOAT_SIZE, 1, rx_signal_file); fread(buffer_float, FLOAT_SIZE, 1, rx_signal_file);
// specify (float) (int) for a quantization maximizing the dynamic range // specify (float) (int) for a quantization maximizing the dynamic range
buffer_DMA[t] = (signed char) ((pointer_float[0] * (RX_SIGNAL_MAX_VALUE - 1)) / max); buffer_DMA[t] = static_cast<signed char>((pointer_float[0] * (RX_SIGNAL_MAX_VALUE - 1) / max));
} }
//send_acquisition_gps_input_samples(buffer_DMA, transfer_size, dma_descr); //send_acquisition_gps_input_samples(buffer_DMA, transfer_size, dma_descr);
@ -376,7 +376,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTestFpga, ValidationOfResults)
ASSERT_EQ(1, msg_rx->rx_message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS."; ASSERT_EQ(1, msg_rx->rx_message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
double delay_error_samples = std::abs(expected_delay_samples - gnss_synchro.Acq_delay_samples); double delay_error_samples = std::abs(expected_delay_samples - gnss_synchro.Acq_delay_samples);
float delay_error_chips = (float) (delay_error_samples * 1023 / 4000); float delay_error_chips = static_cast<float>(delay_error_samples * 1023 / 4000);
double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz);
EXPECT_LE(doppler_error_hz, 666) << "Doppler error exceeds the expected value: 666 Hz = 2/(3*integration period)"; EXPECT_LE(doppler_error_hz, 666) << "Doppler error exceeds the expected value: 666 Hz = 2/(3*integration period)";

View File

@ -322,7 +322,7 @@ void GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test::process_message()
detection_counter++; detection_counter++;
// The term -5 is here to correct the additional delay introduced by the FIR filter // The term -5 is here to correct the additional delay introduced by the FIR filter
double delay_error_chips = std::abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples-5)*1023.0/((double)fs_in*1e-3)); double delay_error_chips = std::abs(static_cast<double>(expected_delay_chips) - static_cast<double>(gnss_synchro.Acq_delay_samples - 5) * 1023.0 / (static_cast<double>(fs_in) * 1e-3));
double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz);
mse_delay += std::pow(delay_error_chips, 2); mse_delay += std::pow(delay_error_chips, 2);
@ -336,16 +336,16 @@ void GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test::process_message()
realization_counter++; realization_counter++;
std::cout << "Progress: " << round((float)realization_counter/num_of_realizations*100) << "% \r" << std::flush; std::cout << "Progress: " << round(static_cast<float>(realization_counter) / static_cast<float>(num_of_realizations) * 100.0) << "% \r" << std::flush;
if (realization_counter == num_of_realizations) if (realization_counter == num_of_realizations)
{ {
mse_delay /= num_of_realizations; mse_delay /= num_of_realizations;
mse_doppler /= num_of_realizations; mse_doppler /= num_of_realizations;
Pd = (double)correct_estimation_counter / (double)num_of_realizations; Pd = static_cast<double>(correct_estimation_counter) / static_cast<double>(num_of_realizations);
Pfa_a = (double)detection_counter / (double)num_of_realizations; Pfa_a = static_cast<double>(detection_counter) / static_cast<double>(num_of_realizations);
Pfa_p = (double)(detection_counter-correct_estimation_counter) / (double)num_of_realizations; Pfa_p = static_cast<double>(detection_counter - correct_estimation_counter) / static_cast<double>(num_of_realizations);
mean_acq_time_us /= num_of_realizations; mean_acq_time_us /= num_of_realizations;
@ -471,7 +471,7 @@ TEST_F(GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test, ValidationOfResults)
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS."; EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
if (message == 1) if (message == 1)
{ {
EXPECT_EQ((unsigned int)1, correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation."; EXPECT_EQ(1U, correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
} }
} }

View File

@ -379,7 +379,7 @@ void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::process_message()
detection_counter++; detection_counter++;
// The term -5 is here to correct the additional delay introduced by the FIR filter // The term -5 is here to correct the additional delay introduced by the FIR filter
double delay_error_chips = std::abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples- 5 )*1023.0/((double)fs_in*1e-3)); double delay_error_chips = std::abs(static_cast<double>(expected_delay_chips) - static_cast<double>(gnss_synchro.Acq_delay_samples - 5) * 1023.0 / (static_cast<double>(fs_in) * 1e-3));
double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz);
mse_delay += std::pow(delay_error_chips, 2); mse_delay += std::pow(delay_error_chips, 2);
@ -393,16 +393,16 @@ void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::process_message()
realization_counter++; realization_counter++;
std::cout << "Progress: " << round((float)realization_counter/num_of_realizations*100) << "% \r" << std::flush; std::cout << "Progress: " << round(static_cast<float>(realization_counter) / static_cast<float>(num_of_realizations) * 100) << "% \r" << std::flush;
if (realization_counter == num_of_realizations) if (realization_counter == num_of_realizations)
{ {
mse_delay /= num_of_realizations; mse_delay /= num_of_realizations;
mse_doppler /= num_of_realizations; mse_doppler /= num_of_realizations;
Pd = (double)correct_estimation_counter / (double)num_of_realizations; Pd = static_cast<double>(correct_estimation_counter) / static_cast<double>(num_of_realizations);
Pfa_a = (double)detection_counter / (double)num_of_realizations; Pfa_a = static_cast<double>(detection_counter) / static_cast<double>(num_of_realizations);
Pfa_p = (double)(detection_counter-correct_estimation_counter) / (double)num_of_realizations; Pfa_p = static_cast<double>(detection_counter - correct_estimation_counter) / static_cast<double>(num_of_realizations);
mean_acq_time_us /= num_of_realizations; mean_acq_time_us /= num_of_realizations;
@ -528,7 +528,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResults)
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS."; EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
if (message == 1) if (message == 1)
{ {
EXPECT_EQ((unsigned int)1, correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation."; EXPECT_EQ((1U, correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
} }
} }

View File

@ -490,7 +490,7 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::process_message()
detection_counter++; detection_counter++;
// The term -5 is here to correct the additional delay introduced by the FIR filter // The term -5 is here to correct the additional delay introduced by the FIR filter
double delay_error_chips = std::abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples - 5) * 1023.0/ ((double)fs_in * 1e-3)); double delay_error_chips = std::abs(static_cast<double>(expected_delay_chips) - static_cast<double>(gnss_synchro.Acq_delay_samples - 5) * 1023.0 / (static_cast<double>(fs_in) * 1e-3));
double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz);
mse_delay += std::pow(delay_error_chips, 2); mse_delay += std::pow(delay_error_chips, 2);
@ -508,17 +508,17 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::process_message()
realization_counter++; realization_counter++;
std::cout << "Progress: " << round((float)realization_counter / num_of_realizations * 100) << "% \r" << std::flush; std::cout << "Progress: " << round(static_cast<float>(realization_counter) / static_cast<float>(num_of_realizations) * 100.0) << "% \r" << std::flush;
if (realization_counter == num_of_realizations) if (realization_counter == num_of_realizations)
{ {
mse_delay /= num_of_realizations; mse_delay /= num_of_realizations;
mse_doppler /= num_of_realizations; mse_doppler /= num_of_realizations;
Pd = (double)correct_estimation_counter / (double)num_of_realizations; Pd = static_cast<double>(correct_estimation_counter) / static_cast<double>(num_of_realizations);
Pfa_a = (double)detection_counter / (double)num_of_realizations; Pfa_a = static_cast<double>(detection_counter) / static_cast<double>(num_of_realizations);
Pfa_p = (double)(detection_counter-correct_estimation_counter) / (double)num_of_realizations; Pfa_p = static_cast<double>(detection_counter - correct_estimation_counter) / static_cast<double>(num_of_realizations);
Pmd = (double)miss_detection_counter / (double)num_of_realizations; Pmd = static_cast<double>(miss_detection_counter) / static_cast<double>(num_of_realizations);
mean_acq_time_us /= num_of_realizations; mean_acq_time_us /= num_of_realizations;
@ -651,7 +651,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResults)
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS."; EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
if (message == 1) if (message == 1)
{ {
EXPECT_EQ((unsigned int)1, correct_estimation_counter) EXPECT_EQ(1U, correct_estimation_counter)
<< "Acquisition failure. Incorrect parameters estimation."; << "Acquisition failure. Incorrect parameters estimation.";
} }
} }
@ -745,7 +745,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsWithNoise
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS."; EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
if (message == 1) if (message == 1)
{ {
EXPECT_EQ((unsigned int)1, correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation."; EXPECT_EQ(1U, correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
} }
} }

View File

@ -378,7 +378,7 @@ void GpsL1CaPcpsTongAcquisitionGSoC2013Test::process_message()
detection_counter++; detection_counter++;
// The term -5 is here to correct the additional delay introduced by the FIR filter // The term -5 is here to correct the additional delay introduced by the FIR filter
double delay_error_chips = std::abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples-5)*1023.0/((double)fs_in*1e-3)); double delay_error_chips = std::abs(static_cast<double>(expected_delay_chips) - static_cast<double>(gnss_synchro.Acq_delay_samples - 5) * 1023.0 / (static_cast<double>(fs_in) * 1e-3));
double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz);
mse_delay += std::pow(delay_error_chips, 2); mse_delay += std::pow(delay_error_chips, 2);
@ -392,16 +392,16 @@ void GpsL1CaPcpsTongAcquisitionGSoC2013Test::process_message()
realization_counter++; realization_counter++;
std::cout << "Progress: " << round((float)realization_counter/num_of_realizations*100) << "% \r" << std::flush; std::cout << "Progress: " << round(static_cast<float>(realization_counter) / static_cast<float>(num_of_realizations) * 100.0) << "% \r" << std::flush;
if (realization_counter == num_of_realizations) if (realization_counter == num_of_realizations)
{ {
mse_delay /= num_of_realizations; mse_delay /= num_of_realizations;
mse_doppler /= num_of_realizations; mse_doppler /= num_of_realizations;
Pd = (double)correct_estimation_counter / (double)num_of_realizations; Pd = static_cast<double>(correct_estimation_counter) / static_cast<double>(num_of_realizations);
Pfa_a = (double)detection_counter / (double)num_of_realizations; Pfa_a = static_cast<double>(detection_counter) / static_cast<double>(num_of_realizations);
Pfa_p = (double)(detection_counter-correct_estimation_counter) / (double)num_of_realizations; Pfa_p = static_cast<double>(detection_counter - correct_estimation_counter) / static_cast<double>(num_of_realizations);
mean_acq_time_us /= num_of_realizations; mean_acq_time_us /= num_of_realizations;
@ -534,7 +534,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResults)
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS."; EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
if (message == 1) if (message == 1)
{ {
EXPECT_EQ((unsigned int)1, correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation."; EXPECT_EQ(1U, correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
} }
} }
else if (i == 1) else if (i == 1)

View File

@ -146,7 +146,7 @@ void GpsL2MPcpsAcquisitionTest::init()
gnss_synchro.PRN = 7; gnss_synchro.PRN = 7;
sampling_freqeuncy_hz = 5000000; sampling_freqeuncy_hz = 5000000;
nsamples = round((double)sampling_freqeuncy_hz*GPS_L2_M_PERIOD)*2; nsamples = round(static_cast<double>(sampling_freqeuncy_hz) * GPS_L2_M_PERIOD) * 2;
config->set_property("GNSS-SDR.internal_fs_hz", std::to_string(sampling_freqeuncy_hz)); config->set_property("GNSS-SDR.internal_fs_hz", std::to_string(sampling_freqeuncy_hz));
config->set_property("Acquisition.item_type", "gr_complex"); config->set_property("Acquisition.item_type", "gr_complex");
config->set_property("Acquisition.if", "0"); config->set_property("Acquisition.if", "0");
@ -273,7 +273,7 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ValidationOfResults)
ASSERT_EQ(1, msg_rx->rx_message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS."; ASSERT_EQ(1, msg_rx->rx_message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
double delay_error_samples = std::abs(expected_delay_samples - gnss_synchro.Acq_delay_samples); double delay_error_samples = std::abs(expected_delay_samples - gnss_synchro.Acq_delay_samples);
float delay_error_chips = (float)(delay_error_samples * 1023 / 4000); float delay_error_chips = static_cast<float>(delay_error_samples * 1023 / 4000);
double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz);
EXPECT_LE(doppler_error_hz, 200) << "Doppler error exceeds the expected value: 666 Hz = 2/(3*integration period)"; EXPECT_LE(doppler_error_hz, 200) << "Doppler error exceeds the expected value: 666 Hz = 2/(3*integration period)";

View File

@ -461,7 +461,7 @@ TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults)
epoch_counter = 0; epoch_counter = 0;
while(tlm_dump.read_binary_obs()) while(tlm_dump.read_binary_obs())
{ {
tlm_timestamp_s(epoch_counter) = (double)tlm_dump.Tracking_sample_counter/(double)baseband_sampling_freq; tlm_timestamp_s(epoch_counter) = static_cast<double>(tlm_dump.Tracking_sample_counter) / static_cast<double>(baseband_sampling_freq);
tlm_TOW_at_Preamble(epoch_counter) = tlm_dump.d_TOW_at_Preamble; tlm_TOW_at_Preamble(epoch_counter) = tlm_dump.d_TOW_at_Preamble;
tlm_tow_s(epoch_counter) = tlm_dump.TOW_at_current_symbol; tlm_tow_s(epoch_counter) = tlm_dump.TOW_at_current_symbol;
epoch_counter++; epoch_counter++;