1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 04:00:34 +00:00

Changing C-styled cast by C++ style

This commit is contained in:
Carles Fernandez 2014-09-12 20:23:39 +02:00
parent 798b54e87c
commit 9c7795dd9a
28 changed files with 207 additions and 211 deletions

View File

@ -347,7 +347,7 @@ bool galileo_e1_ls_pvt::get_PVT(std::map<int,Gnss_Synchro> gnss_pseudoranges_map
d_position_UTC_time = p_time; d_position_UTC_time = p_time;
LOG(INFO) << "Galileo Position at TOW=" << galileo_current_time << " in ECEF (X,Y,Z) = " << mypos; LOG(INFO) << "Galileo Position at TOW=" << galileo_current_time << " in ECEF (X,Y,Z) = " << mypos;
cart2geo((double)mypos(0), (double)mypos(1), (double)mypos(2), 4); cart2geo(static_cast<double>(mypos(0)), static_cast<double>(mypos(1)), static_cast<double>(mypos(2)), 4);
//ToDo: Find an Observables/PVT random bug with some satellite configurations that gives an erratic PVT solution (i.e. height>50 km) //ToDo: Find an Observables/PVT random bug with some satellite configurations that gives an erratic PVT solution (i.e. height>50 km)
if (d_height_m > 50000) if (d_height_m > 50000)
{ {
@ -366,17 +366,17 @@ bool galileo_e1_ls_pvt::get_PVT(std::map<int,Gnss_Synchro> gnss_pseudoranges_map
// 1- Rotation matrix from ECEF coordinates to ENU coordinates // 1- Rotation matrix from ECEF coordinates to ENU coordinates
// ref: http://www.navipedia.net/index.php/Transformations_between_ECEF_and_ENU_coordinates // ref: http://www.navipedia.net/index.php/Transformations_between_ECEF_and_ENU_coordinates
arma::mat F = arma::zeros(3,3); arma::mat F = arma::zeros(3,3);
F(0,0) = -sin(GPS_TWO_PI*(d_longitude_d/360.0)); F(0,0) = -sin(GPS_TWO_PI * (d_longitude_d/360.0));
F(0,1) = -sin(GPS_TWO_PI*(d_latitude_d/360.0))*cos(GPS_TWO_PI*(d_longitude_d/360.0)); F(0,1) = -sin(GPS_TWO_PI * (d_latitude_d/360.0)) * cos(GPS_TWO_PI * (d_longitude_d/360.0));
F(0,2) = cos(GPS_TWO_PI*(d_latitude_d/360.0))*cos(GPS_TWO_PI*(d_longitude_d/360.0)); F(0,2) = cos(GPS_TWO_PI * (d_latitude_d/360.0)) * cos(GPS_TWO_PI * (d_longitude_d/360.0));
F(1,0) = cos((GPS_TWO_PI*d_longitude_d)/360.0); F(1,0) = cos((GPS_TWO_PI * d_longitude_d)/360.0);
F(1,1) = -sin((GPS_TWO_PI*d_latitude_d)/360.0)*sin((GPS_TWO_PI*d_longitude_d)/360.0); F(1,1) = -sin((GPS_TWO_PI * d_latitude_d)/360.0) * sin((GPS_TWO_PI * d_longitude_d)/360.0);
F(1,2) = cos((GPS_TWO_PI*d_latitude_d/360.0))*sin((GPS_TWO_PI*d_longitude_d)/360.0); F(1,2) = cos((GPS_TWO_PI * d_latitude_d/360.0)) * sin((GPS_TWO_PI * d_longitude_d)/360.0);
F(2,0) = 0; F(2,0) = 0;
F(2,1) = cos((GPS_TWO_PI*d_latitude_d)/360.0); F(2,1) = cos((GPS_TWO_PI * d_latitude_d)/360.0);
F(2,2) = sin((GPS_TWO_PI*d_latitude_d/360.0)); F(2,2) = sin((GPS_TWO_PI * d_latitude_d/360.0));
// 2- Apply the rotation to the latest covariance matrix (available in ECEF from LS) // 2- Apply the rotation to the latest covariance matrix (available in ECEF from LS)
arma::mat Q_ECEF = d_Q.submat(0, 0, 2, 2); arma::mat Q_ECEF = d_Q.submat(0, 0, 2, 2);
@ -384,7 +384,7 @@ bool galileo_e1_ls_pvt::get_PVT(std::map<int,Gnss_Synchro> gnss_pseudoranges_map
try try
{ {
DOP_ENU = arma::htrans(F)*Q_ECEF*F; DOP_ENU = arma::htrans(F) * Q_ECEF * F;
d_GDOP = sqrt(arma::trace(DOP_ENU)); // Geometric DOP d_GDOP = sqrt(arma::trace(DOP_ENU)); // Geometric DOP
d_PDOP = sqrt(DOP_ENU(0,0) + DOP_ENU(1,1) + DOP_ENU(2,2)); // PDOP d_PDOP = sqrt(DOP_ENU(0,0) + DOP_ENU(1,1) + DOP_ENU(2,2)); // PDOP
d_HDOP = sqrt(DOP_ENU(0,0) + DOP_ENU(1,1)); // HDOP d_HDOP = sqrt(DOP_ENU(0,0) + DOP_ENU(1,1)); // HDOP
@ -461,9 +461,9 @@ bool galileo_e1_ls_pvt::get_PVT(std::map<int,Gnss_Synchro> gnss_pseudoranges_map
d_avg_longitude_d = d_avg_longitude_d + d_hist_longitude_d.at(i); d_avg_longitude_d = d_avg_longitude_d + d_hist_longitude_d.at(i);
d_avg_height_m = d_avg_height_m + d_hist_height_m.at(i); d_avg_height_m = d_avg_height_m + d_hist_height_m.at(i);
} }
d_avg_latitude_d = d_avg_latitude_d / (double)d_averaging_depth; d_avg_latitude_d = d_avg_latitude_d / static_cast<double>(d_averaging_depth);
d_avg_longitude_d = d_avg_longitude_d / (double)d_averaging_depth; d_avg_longitude_d = d_avg_longitude_d / static_cast<double>(d_averaging_depth);
d_avg_height_m = d_avg_height_m / (double)d_averaging_depth; d_avg_height_m = d_avg_height_m / static_cast<double>(d_averaging_depth);
b_valid_position = true; b_valid_position = true;
return true; //indicates that the returned position is valid return true; //indicates that the returned position is valid
} }
@ -514,9 +514,9 @@ void galileo_e1_ls_pvt::cart2geo(double X, double Y, double Z, int elipsoid_sele
const double f[5] = {1/297, 1/298.247, 1/298.26, 1/298.257222101, 1/298.257223563}; const double f[5] = {1/297, 1/298.247, 1/298.26, 1/298.257222101, 1/298.257223563};
double lambda = atan2(Y, X); double lambda = atan2(Y, X);
double ex2 = (2 - f[elipsoid_selection]) * f[elipsoid_selection] / ((1 - f[elipsoid_selection])*(1 - f[elipsoid_selection])); double ex2 = (2 - f[elipsoid_selection]) * f[elipsoid_selection] / ((1 - f[elipsoid_selection]) * (1 - f[elipsoid_selection]));
double c = a[elipsoid_selection] * sqrt(1+ex2); double c = a[elipsoid_selection] * sqrt(1+ex2);
double phi = atan(Z / ((sqrt(X*X + Y*Y)*(1 - (2 - f[elipsoid_selection])) * f[elipsoid_selection]))); double phi = atan(Z / ((sqrt(X * X + Y * Y) * (1 - (2 - f[elipsoid_selection])) * f[elipsoid_selection])));
double h = 0.1; double h = 0.1;
double oldh = 0; double oldh = 0;
@ -526,8 +526,8 @@ void galileo_e1_ls_pvt::cart2geo(double X, double Y, double Z, int elipsoid_sele
{ {
oldh = h; oldh = h;
N = c / sqrt(1 + ex2 * (cos(phi) * cos(phi))); N = c / sqrt(1 + ex2 * (cos(phi) * cos(phi)));
phi = atan(Z / ((sqrt(X*X + Y*Y) * (1 - (2 - f[elipsoid_selection]) * f[elipsoid_selection] *N / (N + h) )))); phi = atan(Z / ((sqrt(X * X + Y * Y) * (1 - (2 - f[elipsoid_selection]) * f[elipsoid_selection] * N / (N + h) ))));
h = sqrt(X*X + Y*Y) / cos(phi) - N; h = sqrt(X * X + Y * Y) / cos(phi) - N;
iterations = iterations + 1; iterations = iterations + 1;
if (iterations > 100) if (iterations > 100)
{ {
@ -582,7 +582,7 @@ void galileo_e1_ls_pvt::togeod(double *dphi, double *dlambda, double *h, double
} }
// first guess // first guess
double P = sqrt(X*X + Y*Y); // P is distance from spin axis double P = sqrt(X * X + Y * Y); // P is distance from spin axis
//direct calculation of longitude //direct calculation of longitude
if (P > 1.0E-20) if (P > 1.0E-20)
@ -600,7 +600,7 @@ void galileo_e1_ls_pvt::togeod(double *dphi, double *dlambda, double *h, double
*dlambda = *dlambda + 360.0; *dlambda = *dlambda + 360.0;
} }
double r = sqrt(P*P + Z*Z); // r is distance from origin (0,0,0) double r = sqrt(P * P + Z * Z); // r is distance from origin (0,0,0)
double sinphi; double sinphi;
if (r > 1.0E-20) if (r > 1.0E-20)
@ -621,7 +621,7 @@ void galileo_e1_ls_pvt::togeod(double *dphi, double *dlambda, double *h, double
return; return;
} }
*h = r - a*(1 - sinphi*sinphi/finv); *h = r - a * (1 - sinphi * sinphi/finv);
// iterate // iterate
double cosphi; double cosphi;
@ -636,18 +636,18 @@ void galileo_e1_ls_pvt::togeod(double *dphi, double *dlambda, double *h, double
cosphi = cos(*dphi); cosphi = cos(*dphi);
// compute radius of curvature in prime vertical direction // compute radius of curvature in prime vertical direction
N_phi = a / sqrt(1 - esq*sinphi*sinphi); N_phi = a / sqrt(1 - esq * sinphi * sinphi);
// compute residuals in P and Z // compute residuals in P and Z
dP = P - (N_phi + (*h)) * cosphi; dP = P - (N_phi + (*h)) * cosphi;
dZ = Z - (N_phi*oneesq + (*h)) * sinphi; dZ = Z - (N_phi * oneesq + (*h)) * sinphi;
// update height and latitude // update height and latitude
*h = *h + (sinphi*dZ + cosphi*dP); *h = *h + (sinphi * dZ + cosphi * dP);
*dphi = *dphi + (cosphi*dZ - sinphi*dP)/(N_phi + (*h)); *dphi = *dphi + (cosphi * dZ - sinphi * dP)/(N_phi + (*h));
// test for convergence // test for convergence
if ((dP*dP + dZ*dZ) < tolsq) if ((dP * dP + dZ * dZ) < tolsq)
{ {
break; break;
} }
@ -693,12 +693,12 @@ void galileo_e1_ls_pvt::topocent(double *Az, double *El, double *D, arma::vec x,
arma::mat F = arma::zeros(3,3); arma::mat F = arma::zeros(3,3);
F(0,0) = -sl; F(0,0) = -sl;
F(0,1) = -sb*cl; F(0,1) = -sb * cl;
F(0,2) = cb*cl; F(0,2) = cb * cl;
F(1,0) = cl; F(1,0) = cl;
F(1,1) = -sb*sl; F(1,1) = -sb * sl;
F(1,2) = cb*sl; F(1,2) = cb * sl;
F(2,0) = 0; F(2,0) = 0;
F(2,1) = cb; F(2,1) = cb;
@ -713,7 +713,7 @@ void galileo_e1_ls_pvt::topocent(double *Az, double *El, double *D, arma::vec x,
double U = local_vector(2); double U = local_vector(2);
double hor_dis; double hor_dis;
hor_dis = sqrt(E*E + N*N); hor_dis = sqrt(E * E + N * N);
if (hor_dis < 1.0E-20) if (hor_dis < 1.0E-20)
{ {
@ -731,7 +731,7 @@ void galileo_e1_ls_pvt::topocent(double *Az, double *El, double *D, arma::vec x,
*Az = *Az + 360.0; *Az = *Az + 360.0;
} }
*D = sqrt(dx(0)*dx(0) + dx(1)*dx(1) + dx(2)*dx(2)); *D = sqrt(dx(0) * dx(0) + dx(1) * dx(1) + dx(2) * dx(2));
} }
void galileo_e1_ls_pvt::tropo(double *ddr_m, double sinel, double hsta_km, double p_mb, double t_kel, double hum, double hp_km, double htkel_km, double hhum_km) void galileo_e1_ls_pvt::tropo(double *ddr_m, double sinel, double hsta_km, double p_mb, double t_kel, double hum, double hp_km, double htkel_km, double hhum_km)
@ -764,7 +764,7 @@ void galileo_e1_ls_pvt::tropo(double *ddr_m, double sinel, double hsta_km, doubl
const double em = -978.77 / (2.8704e6 * tlapse * 1.0e-5); const double em = -978.77 / (2.8704e6 * tlapse * 1.0e-5);
double tkhum = t_kel + tlapse * (hhum_km - htkel_km); double tkhum = t_kel + tlapse * (hhum_km - htkel_km);
double atkel = 7.5*(tkhum - 273.15) / (237.3 + tkhum - 273.15); double atkel = 7.5 * (tkhum - 273.15) / (237.3 + tkhum - 273.15);
double e0 = 0.0611 * hum * pow(10, atkel); double e0 = 0.0611 * hum * pow(10, atkel);
double tksea = t_kel - tlapse * htkel_km; double tksea = t_kel - tlapse * htkel_km;
double tkelh = tksea + tlapse * hhum_km; double tkelh = tksea + tlapse * hhum_km;

View File

@ -332,7 +332,7 @@ bool gps_l1_ca_ls_pvt::get_PVT(std::map<int,Gnss_Synchro> gnss_pseudoranges_map,
} }
// Compute UTC time and print PVT solution // Compute UTC time and print PVT solution
double secondsperweek = 604800.0; // number of seconds in one week (7*24*60*60) double secondsperweek = 604800.0; // number of seconds in one week (7*24*60*60)
boost::posix_time::time_duration t = boost::posix_time::seconds(utc + secondsperweek*(double)GPS_week); boost::posix_time::time_duration t = boost::posix_time::seconds(utc + secondsperweek * static_cast<double>(GPS_week));
// 22 August 1999 last GPS time roll over // 22 August 1999 last GPS time roll over
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
d_position_UTC_time = p_time; d_position_UTC_time = p_time;
@ -441,9 +441,9 @@ bool gps_l1_ca_ls_pvt::get_PVT(std::map<int,Gnss_Synchro> gnss_pseudoranges_map,
d_avg_longitude_d = d_avg_longitude_d + d_hist_longitude_d.at(i); d_avg_longitude_d = d_avg_longitude_d + d_hist_longitude_d.at(i);
d_avg_height_m = d_avg_height_m + d_hist_height_m.at(i); d_avg_height_m = d_avg_height_m + d_hist_height_m.at(i);
} }
d_avg_latitude_d = d_avg_latitude_d / (double)d_averaging_depth; d_avg_latitude_d = d_avg_latitude_d / static_cast<double>(d_averaging_depth);
d_avg_longitude_d = d_avg_longitude_d / (double)d_averaging_depth; d_avg_longitude_d = d_avg_longitude_d / static_cast<double>(d_averaging_depth);
d_avg_height_m = d_avg_height_m / (double)d_averaging_depth; d_avg_height_m = d_avg_height_m / static_cast<double>(d_averaging_depth);
b_valid_position = true; b_valid_position = true;
return true; //indicates that the returned position is valid return true; //indicates that the returned position is valid
} }

View File

@ -416,7 +416,7 @@ bool hybrid_ls_pvt::get_PVT(std::map<int,Gnss_Synchro> gnss_pseudoranges_map, do
d_position_UTC_time = p_time; d_position_UTC_time = p_time;
LOG(INFO) << "HYBRID Position at TOW=" << hybrid_current_time << " in ECEF (X,Y,Z) = " << mypos; LOG(INFO) << "HYBRID Position at TOW=" << hybrid_current_time << " in ECEF (X,Y,Z) = " << mypos;
cart2geo((double)mypos(0), (double)mypos(1), (double)mypos(2), 4); cart2geo(static_cast<double>(mypos(0)), static_cast<double>(mypos(1)), static_cast<double>(mypos(2)), 4);
//ToDo: Find an Observables/PVT random bug with some satellite configurations that gives an erratic PVT solution (i.e. height>50 km) //ToDo: Find an Observables/PVT random bug with some satellite configurations that gives an erratic PVT solution (i.e. height>50 km)
if (d_height_m > 50000) if (d_height_m > 50000)
{ {
@ -535,9 +535,9 @@ bool hybrid_ls_pvt::get_PVT(std::map<int,Gnss_Synchro> gnss_pseudoranges_map, do
d_avg_longitude_d = d_avg_longitude_d + d_hist_longitude_d.at(i); d_avg_longitude_d = d_avg_longitude_d + d_hist_longitude_d.at(i);
d_avg_height_m = d_avg_height_m + d_hist_height_m.at(i); d_avg_height_m = d_avg_height_m + d_hist_height_m.at(i);
} }
d_avg_latitude_d = d_avg_latitude_d / (double)d_averaging_depth; d_avg_latitude_d = d_avg_latitude_d / static_cast<double>(d_averaging_depth);
d_avg_longitude_d = d_avg_longitude_d / (double)d_averaging_depth; d_avg_longitude_d = d_avg_longitude_d / static_cast<double>(d_averaging_depth);
d_avg_height_m = d_avg_height_m / (double)d_averaging_depth; d_avg_height_m = d_avg_height_m / static_cast<double>(d_averaging_depth);
b_valid_position = true; b_valid_position = true;
return true; //indicates that the returned position is valid return true; //indicates that the returned position is valid
} }

View File

@ -222,8 +222,8 @@ std::string Nmea_Printer::latitude_to_hm(double lat)
north = true; north = true;
} }
int deg = (int)lat; int deg = static_cast<int>(lat);
double mins = lat - (double)deg; double mins = lat - static_cast<double>(deg);
mins *= 60.0 ; mins *= 60.0 ;
std::ostringstream out_string; std::ostringstream out_string;
out_string.setf(std::ios::fixed, std::ios::floatfield); out_string.setf(std::ios::fixed, std::ios::floatfield);
@ -271,7 +271,7 @@ std::string Nmea_Printer::longitude_to_hm(double longitude)
out_string.precision(4); out_string.precision(4);
out_string << mins; out_string << mins;
if (east==true) if (east == true)
{ {
out_string << ",E"; out_string << ",E";
} }
@ -361,7 +361,7 @@ std::string Nmea_Printer::get_GPRMC()
sentence_str << ",V"; sentence_str << ",V";
}; };
if (d_PVT_data->d_flag_averaging==true) if (d_PVT_data->d_flag_averaging == true)
{ {
// Latitude ddmm.mmmm,(N or S) // Latitude ddmm.mmmm,(N or S)
sentence_str << "," << latitude_to_hm(d_PVT_data->d_avg_latitude_d); sentence_str << "," << latitude_to_hm(d_PVT_data->d_avg_latitude_d);

View File

@ -268,7 +268,7 @@ float GalileoE1Pcps8msAmbiguousAcquisition::calculate_threshold(float pfa)
DLOG(INFO) << "Channel " << channel_ << " Pfa = " << pfa; DLOG(INFO) << "Channel " << channel_ << " Pfa = " << pfa;
unsigned int ncells = vector_length_*frequency_bins; unsigned int ncells = vector_length_*frequency_bins;
double exponent = 1/(double)ncells; double exponent = 1 / static_cast<double>(ncells);
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);

View File

@ -277,9 +277,9 @@ float GalileoE1PcpsAmbiguousAcquisition::calculate_threshold(float pfa)
DLOG(INFO) <<"Channel "<<channel_<<" Pfa = "<< pfa; DLOG(INFO) <<"Channel "<<channel_<<" Pfa = "<< pfa;
unsigned int ncells = vector_length_*frequency_bins; unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1/(double)ncells; double exponent = 1 / static_cast<double>(ncells);
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 = (float)quantile(mydist,val);

View File

@ -64,7 +64,7 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition
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.";
@ -82,7 +82,7 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition
/ (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;

View File

@ -305,7 +305,7 @@ float GalileoE1PcpsQuickSyncAmbiguousAcquisition::calculate_threshold(float pfa)
DLOG(INFO) <<"Channel "<<channel_<<" Pfa = "<< pfa; DLOG(INFO) <<"Channel "<<channel_<<" Pfa = "<< pfa;
unsigned int ncells = code_length_/folding_factor_ * frequency_bins; unsigned int ncells = code_length_/folding_factor_ * frequency_bins;
double exponent = 1 / (double)ncells; double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent); double val = pow(1.0 - pfa, exponent);
double lambda = double(code_length_/folding_factor_); double lambda = double(code_length_/folding_factor_);
boost::math::exponential_distribution<double> mydist (lambda); boost::math::exponential_distribution<double> mydist (lambda);

View File

@ -268,10 +268,10 @@ float GalileoE1PcpsTongAmbiguousAcquisition::calculate_threshold(float pfa)
frequency_bins++; frequency_bins++;
} }
DLOG(INFO) <<"Channel "<<channel_<<" Pfa = "<< pfa; DLOG(INFO) << "Channel " << channel_ << " Pfa = " << pfa;
unsigned int ncells = vector_length_*frequency_bins; unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1/(double)ncells; double exponent = 1 / static_cast<double>(ncells);
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);

View File

@ -293,9 +293,9 @@ float GalileoE5aNoncoherentIQAcquisitionCaf::calculate_threshold(float pfa)
{ {
frequency_bins++; frequency_bins++;
} }
DLOG(INFO) << "Channel " << channel_<< " Pfa = " << pfa; DLOG(INFO) << "Channel " << channel_ << " Pfa = " << pfa;
unsigned int ncells = vector_length_*frequency_bins; unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1/(double)ncells; double exponent = 1 / static_cast<double>(ncells);
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);

View File

@ -254,8 +254,8 @@ float GpsL1CaPcpsAcquisition::calculate_threshold(float pfa)
frequency_bins++; frequency_bins++;
} }
DLOG(INFO) << "Channel " << channel_<< " Pfa = " << pfa; DLOG(INFO) << "Channel " << channel_<< " Pfa = " << pfa;
unsigned int ncells = vector_length_*frequency_bins; unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1/(double)ncells; double exponent = 1 / static_cast<double>(ncells);
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);

View File

@ -250,11 +250,11 @@ float GpsL1CaPcpsMultithreadAcquisition::calculate_threshold(float pfa)
frequency_bins++; frequency_bins++;
} }
DLOG(INFO) <<"Channel "<<channel_<<" Pfa = "<< pfa; DLOG(INFO) << "Channel "<< channel_ << " Pfa = " << pfa;
unsigned int ncells = vector_length_*frequency_bins; unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1/(double)ncells; double exponent = 1 / static_cast<double>(ncells);
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 = (float)quantile(mydist,val);

View File

@ -249,11 +249,11 @@ float GpsL1CaPcpsOpenClAcquisition::calculate_threshold(float pfa)
frequency_bins++; frequency_bins++;
} }
DLOG(INFO) <<"Channel "<<channel_<<" Pfa = "<< pfa; DLOG(INFO) << "Channel " << channel_ << " Pfa = " << pfa;
unsigned int ncells = vector_length_*frequency_bins; unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1/(double)ncells; double exponent = 1 / static_cast<double>(ncells);
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 = (float)quantile(mydist,val);

View File

@ -286,10 +286,10 @@ float GpsL1CaPcpsQuickSyncAcquisition::calculate_threshold(float pfa)
frequency_bins++; frequency_bins++;
} }
DLOG(INFO) << "Channel " << channel_<< " Pfa = " << pfa; DLOG(INFO) << "Channel " << channel_<< " Pfa = " << pfa;
unsigned int ncells = (code_length_/folding_factor_)*frequency_bins; unsigned int ncells = (code_length_ / folding_factor_) * frequency_bins;
double exponent = 1/(double)ncells; double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent); double val = pow(1.0 - pfa, exponent);
double lambda = double((code_length_/folding_factor_)); double lambda = double((code_length_ / folding_factor_));
boost::math::exponential_distribution<double> mydist (lambda); boost::math::exponential_distribution<double> mydist (lambda);
float threshold = (float)quantile(mydist,val); float threshold = (float)quantile(mydist,val);

View File

@ -239,14 +239,14 @@ float GpsL1CaPcpsTongAcquisition::calculate_threshold(float pfa)
frequency_bins++; frequency_bins++;
} }
DLOG(INFO) <<"Channel "<<channel_<<" Pfa = "<< pfa; DLOG(INFO) << "Channel "<< channel_ <<" Pfa = "<< pfa;
unsigned int ncells = vector_length_*frequency_bins; unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1/(double)ncells; double exponent = 1 / static_cast<double>(ncells);
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 = (float)quantile(mydist, val);
return threshold; return threshold;
} }

View File

@ -249,8 +249,8 @@ void galileo_e5a_noncoherentIQ_acquisition_caf_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++;
@ -261,7 +261,7 @@ void galileo_e5a_noncoherentIQ_acquisition_caf_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;
complex_exp_gen_conj(d_grid_doppler_wipeoffs[doppler_index], complex_exp_gen_conj(d_grid_doppler_wipeoffs[doppler_index],
d_freq + doppler, d_fs_in, d_fft_size); d_freq + doppler, d_fs_in, d_fft_size);
} }
@ -329,17 +329,17 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
{ {
const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer
unsigned int buff_increment; unsigned int buff_increment;
if (ninput_items[0]+d_buffer_count <= d_fft_size) if (ninput_items[0] + d_buffer_count <= d_fft_size)
{ {
buff_increment = ninput_items[0]; buff_increment = ninput_items[0];
} }
else else
{ {
buff_increment = (d_fft_size-d_buffer_count); buff_increment = (d_fft_size - d_buffer_count);
} }
memcpy(&d_inbuffer[d_buffer_count], in, sizeof(gr_complex)*buff_increment); memcpy(&d_inbuffer[d_buffer_count], in, sizeof(gr_complex) * buff_increment);
// If buffer will be full in next iteration // If buffer will be full in next iteration
if (d_buffer_count >= d_fft_size-d_gr_stream_buffer) if (d_buffer_count >= d_fft_size - d_gr_stream_buffer)
{ {
d_state=2; d_state=2;
} }
@ -370,7 +370,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
float magt_IB = 0.0; float magt_IB = 0.0;
float magt_QA = 0.0; float magt_QA = 0.0;
float magt_QB = 0.0; float magt_QB = 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);
d_input_power = 0.0; d_input_power = 0.0;
d_mag = 0.0; d_mag = 0.0;
d_well_count++; d_well_count++;
@ -384,14 +384,14 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
// 1- Compute the input signal power estimation // 1- Compute the input signal power estimation
volk_32fc_magnitude_squared_32f(d_magnitudeIA, d_inbuffer, d_fft_size); volk_32fc_magnitude_squared_32f(d_magnitudeIA, d_inbuffer, d_fft_size);
volk_32f_accumulator_s32f(&d_input_power, d_magnitudeIA, d_fft_size); volk_32f_accumulator_s32f(&d_input_power, d_magnitudeIA, 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(), d_inbuffer, volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), d_inbuffer,
d_grid_doppler_wipeoffs[doppler_index], d_fft_size); d_grid_doppler_wipeoffs[doppler_index], d_fft_size);
@ -543,8 +543,8 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
// 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 = d_sample_counter; d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter;
// 5- Compute the test statistics and compare to the threshold // 5- Compute the test statistics and compare to the threshold
@ -585,88 +585,88 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
{ {
int CAF_bins_half; int CAF_bins_half;
float* accum = static_cast<float*>(volk_malloc(sizeof(float), volk_get_alignment())); float* accum = static_cast<float*>(volk_malloc(sizeof(float), volk_get_alignment()));
CAF_bins_half = d_CAF_window_hz/(2*d_doppler_step); CAF_bins_half = d_CAF_window_hz / (2 * d_doppler_step);
float weighting_factor; float weighting_factor;
weighting_factor = 0.5/(float)CAF_bins_half; weighting_factor = 0.5 / static_cast<float>(CAF_bins_half);
// weighting_factor = 0; // weighting_factor = 0;
// std::cout << "weighting_factor " << weighting_factor << std::endl; // std::cout << "weighting_factor " << weighting_factor << std::endl;
// Initialize first iterations // Initialize first iterations
for (int doppler_index=0;doppler_index<CAF_bins_half;doppler_index++) for (int doppler_index=0; doppler_index < CAF_bins_half; doppler_index++)
{ {
d_CAF_vector[doppler_index] = 0; d_CAF_vector[doppler_index] = 0;
// volk_32f_accumulator_s32f_a(&d_CAF_vector[doppler_index], d_CAF_vector_I, CAF_bins_half+doppler_index+1); // volk_32f_accumulator_s32f_a(&d_CAF_vector[doppler_index], d_CAF_vector_I, CAF_bins_half+doppler_index+1);
for (int i = 0; i < CAF_bins_half+doppler_index+1; i++) for (int i = 0; i < CAF_bins_half + doppler_index + 1; i++)
{ {
d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1-weighting_factor*(unsigned int)(abs(doppler_index - i))); d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1 - weighting_factor * static_cast<unsigned int>(abs(doppler_index - i)));
} }
// d_CAF_vector[doppler_index] /= CAF_bins_half+doppler_index+1; // d_CAF_vector[doppler_index] /= CAF_bins_half+doppler_index+1;
d_CAF_vector[doppler_index] /= 1+CAF_bins_half+doppler_index - weighting_factor*CAF_bins_half*(CAF_bins_half+1)/2 - weighting_factor*doppler_index*(doppler_index+1)/2; // triangles = [n*(n+1)/2] d_CAF_vector[doppler_index] /= 1 + CAF_bins_half+doppler_index - weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2 - weighting_factor*doppler_index*(doppler_index+1)/2; // triangles = [n*(n+1)/2]
if (d_both_signal_components) if (d_both_signal_components)
{ {
accum[0] = 0; accum[0] = 0;
// volk_32f_accumulator_s32f_a(&accum[0], d_CAF_vector_Q, CAF_bins_half+doppler_index+1); // volk_32f_accumulator_s32f_a(&accum[0], d_CAF_vector_Q, CAF_bins_half+doppler_index+1);
for (int i = 0; i < CAF_bins_half+doppler_index+1; i++) for (int i = 0; i < CAF_bins_half+doppler_index+1; i++)
{ {
accum[0] += d_CAF_vector_Q[i] * (1-weighting_factor*(unsigned int)(abs(doppler_index - i))); accum[0] += d_CAF_vector_Q[i] * (1 - weighting_factor * static_cast<unsigned int>(abs(doppler_index - i)));
} }
// accum[0] /= CAF_bins_half+doppler_index+1; // accum[0] /= CAF_bins_half+doppler_index+1;
accum[0] /= 1+CAF_bins_half+doppler_index - weighting_factor*CAF_bins_half*(CAF_bins_half+1)/2 - weighting_factor*doppler_index*(doppler_index+1)/2; // triangles = [n*(n+1)/2] accum[0] /= 1+CAF_bins_half+doppler_index - weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2 - weighting_factor * doppler_index * (doppler_index + 1) / 2; // triangles = [n*(n+1)/2]
d_CAF_vector[doppler_index] += accum[0]; d_CAF_vector[doppler_index] += accum[0];
} }
} }
// Body loop // Body loop
for (unsigned int doppler_index=CAF_bins_half;doppler_index<d_num_doppler_bins-CAF_bins_half;doppler_index++) for (unsigned int doppler_index = CAF_bins_half;doppler_index<d_num_doppler_bins-CAF_bins_half;doppler_index++)
{ {
d_CAF_vector[doppler_index] = 0; d_CAF_vector[doppler_index] = 0;
// volk_32f_accumulator_s32f_a(&d_CAF_vector[doppler_index], &d_CAF_vector_I[doppler_index-CAF_bins_half], 2*CAF_bins_half+1); // volk_32f_accumulator_s32f_a(&d_CAF_vector[doppler_index], &d_CAF_vector_I[doppler_index-CAF_bins_half], 2*CAF_bins_half+1);
for (int i = doppler_index-CAF_bins_half; i < doppler_index+CAF_bins_half+1; i++) for (int i = doppler_index-CAF_bins_half; i < doppler_index+CAF_bins_half+1; i++)
{ {
d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1-weighting_factor*(unsigned int)(abs(doppler_index - i))); d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1-weighting_factor * static_cast<unsigned int>(abs(doppler_index - i)));
} }
// d_CAF_vector[doppler_index] /= 2*CAF_bins_half+1; // d_CAF_vector[doppler_index] /= 2*CAF_bins_half+1;
d_CAF_vector[doppler_index] /= 1+2*CAF_bins_half - 2*weighting_factor*CAF_bins_half*(CAF_bins_half+1)/2; d_CAF_vector[doppler_index] /= 1 + 2 * CAF_bins_half - 2 *weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2;
if (d_both_signal_components) if (d_both_signal_components)
{ {
accum[0] = 0; accum[0] = 0;
// volk_32f_accumulator_s32f_a(&accum[0], &d_CAF_vector_Q[doppler_index-CAF_bins_half], 2*CAF_bins_half); // volk_32f_accumulator_s32f_a(&accum[0], &d_CAF_vector_Q[doppler_index-CAF_bins_half], 2*CAF_bins_half);
for (int i = doppler_index-CAF_bins_half; i < doppler_index+CAF_bins_half+1; i++) for (int i = doppler_index-CAF_bins_half; i < doppler_index+CAF_bins_half+1; i++)
{ {
accum[0] += d_CAF_vector_Q[i] * (1-weighting_factor*(unsigned int)(abs(doppler_index - i))); accum[0] += d_CAF_vector_Q[i] * (1 -weighting_factor * static_cast<unsigned int>(abs(doppler_index - i)));
} }
// accum[0] /= 2*CAF_bins_half+1; // accum[0] /= 2*CAF_bins_half+1;
accum[0] /= 1+2*CAF_bins_half - 2*weighting_factor*CAF_bins_half*(CAF_bins_half+1)/2; accum[0] /= 1+2*CAF_bins_half - 2*weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2;
d_CAF_vector[doppler_index] += accum[0]; d_CAF_vector[doppler_index] += accum[0];
} }
} }
// Final iterations // Final iterations
for (unsigned int doppler_index=d_num_doppler_bins-CAF_bins_half;doppler_index<d_num_doppler_bins;doppler_index++) for (unsigned int doppler_index = d_num_doppler_bins - CAF_bins_half;doppler_index<d_num_doppler_bins;doppler_index++)
{ {
d_CAF_vector[doppler_index] = 0; d_CAF_vector[doppler_index] = 0;
// volk_32f_accumulator_s32f_a(&d_CAF_vector[doppler_index], &d_CAF_vector_I[doppler_index-CAF_bins_half], CAF_bins_half + (d_num_doppler_bins-doppler_index)); // volk_32f_accumulator_s32f_a(&d_CAF_vector[doppler_index], &d_CAF_vector_I[doppler_index-CAF_bins_half], CAF_bins_half + (d_num_doppler_bins-doppler_index));
for (int i = doppler_index-CAF_bins_half; i < d_num_doppler_bins; i++) for (int i = doppler_index - CAF_bins_half; i < d_num_doppler_bins; i++)
{ {
d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1-weighting_factor*(abs(doppler_index - i))); d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1 - weighting_factor * (abs(doppler_index - i)));
} }
// d_CAF_vector[doppler_index] /= CAF_bins_half+(d_num_doppler_bins-doppler_index); // d_CAF_vector[doppler_index] /= CAF_bins_half+(d_num_doppler_bins-doppler_index);
d_CAF_vector[doppler_index] /= 1+CAF_bins_half+(d_num_doppler_bins-doppler_index-1) -weighting_factor*CAF_bins_half*(CAF_bins_half+1)/2 -weighting_factor*(d_num_doppler_bins-doppler_index-1)*(d_num_doppler_bins-doppler_index)/2; d_CAF_vector[doppler_index] /= 1+CAF_bins_half+(d_num_doppler_bins-doppler_index-1) - weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2 - weighting_factor * (d_num_doppler_bins - doppler_index - 1) * (d_num_doppler_bins - doppler_index) / 2;
if (d_both_signal_components) if (d_both_signal_components)
{ {
accum[0] = 0; accum[0] = 0;
// volk_32f_accumulator_s32f_a(&accum[0], &d_CAF_vector_Q[doppler_index-CAF_bins_half], CAF_bins_half + (d_num_doppler_bins-doppler_index)); // volk_32f_accumulator_s32f_a(&accum[0], &d_CAF_vector_Q[doppler_index-CAF_bins_half], CAF_bins_half + (d_num_doppler_bins-doppler_index));
for (int i = doppler_index-CAF_bins_half; i < d_num_doppler_bins; i++) for (int i = doppler_index-CAF_bins_half; i < d_num_doppler_bins; i++)
{ {
accum[0] += d_CAF_vector_Q[i] * (1-weighting_factor*(abs(doppler_index - i))); accum[0] += d_CAF_vector_Q[i] * (1 - weighting_factor * (abs(doppler_index - i)));
} }
// accum[0] /= CAF_bins_half+(d_num_doppler_bins-doppler_index); // accum[0] /= CAF_bins_half+(d_num_doppler_bins-doppler_index);
accum[0] /= 1+CAF_bins_half+(d_num_doppler_bins-doppler_index-1) -weighting_factor*CAF_bins_half*(CAF_bins_half+1)/2 -weighting_factor*(d_num_doppler_bins-doppler_index-1)*(d_num_doppler_bins-doppler_index)/2; accum[0] /= 1 + CAF_bins_half + (d_num_doppler_bins - doppler_index - 1) - weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2 - weighting_factor * (d_num_doppler_bins - doppler_index - 1) * (d_num_doppler_bins - doppler_index) / 2;
d_CAF_vector[doppler_index] += accum[0]; d_CAF_vector[doppler_index] += accum[0];
} }
} }
// Recompute the maximum doppler peak // Recompute the maximum doppler peak
volk_32f_index_max_16u(&indext, d_CAF_vector, d_num_doppler_bins); volk_32f_index_max_16u(&indext, d_CAF_vector, d_num_doppler_bins);
doppler = -(int)d_doppler_max + d_doppler_step*indext; doppler = -static_cast<int>(d_doppler_max) + d_doppler_step * indext;
d_gnss_synchro->Acq_doppler_hz = (double)doppler; d_gnss_synchro->Acq_doppler_hz = static_cast<double>(doppler);
// Dump if required, appended at the end of the file // Dump if required, appended at the end of the file
if (d_dump) if (d_dump)
{ {

View File

@ -149,8 +149,8 @@ void galileo_pcps_8ms_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++;
@ -161,9 +161,8 @@ void galileo_pcps_8ms_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;
complex_exp_gen_conj(d_grid_doppler_wipeoffs[doppler_index], complex_exp_gen_conj(d_grid_doppler_wipeoffs[doppler_index], d_freq + doppler, d_fs_in, d_fft_size);
d_freq + doppler, d_fs_in, d_fft_size);
} }
} }
@ -209,7 +208,7 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items,
float magt_A = 0.0; float magt_A = 0.0;
float magt_B = 0.0; float magt_B = 0.0;
const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer
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);
d_input_power = 0.0; d_input_power = 0.0;
d_mag = 0.0; d_mag = 0.0;
@ -226,14 +225,14 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items,
// 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);
@ -290,8 +289,8 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items,
if (d_mag < magt) if (d_mag < magt)
{ {
d_mag = magt; d_mag = magt;
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 = d_sample_counter; d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter;
} }

View File

@ -140,8 +140,8 @@ void pcps_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++;
@ -153,7 +153,7 @@ void pcps_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;
complex_exp_gen_conj(d_grid_doppler_wipeoffs[doppler_index], d_freq + doppler, d_fs_in, d_fft_size); complex_exp_gen_conj(d_grid_doppler_wipeoffs[doppler_index], d_freq + doppler, d_fs_in, d_fft_size);
} }
} }
@ -206,7 +206,7 @@ int pcps_acquisition_cc::general_work(int noutput_items,
unsigned int indext = 0; unsigned int indext = 0;
float magt = 0.0; float magt = 0.0;
const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer
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);
d_input_power = 0.0; d_input_power = 0.0;
d_mag = 0.0; d_mag = 0.0;
@ -223,14 +223,14 @@ int pcps_acquisition_cc::general_work(int noutput_items,
// 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);
@ -268,8 +268,8 @@ int pcps_acquisition_cc::general_work(int noutput_items,
// 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 = d_sample_counter; d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter;
// 5- Compute the test statistics and compare to the threshold // 5- Compute the test statistics and compare to the threshold

View File

@ -187,7 +187,7 @@ void pcps_acquisition_fine_doppler_cc::update_carrier_wipeoff()
doppler_hz = d_config_doppler_min + d_doppler_step*doppler_index; doppler_hz = d_config_doppler_min + d_doppler_step*doppler_index;
// doppler search steps // doppler search steps
// compute the carrier doppler wipe-off signal and store it // compute the carrier doppler wipe-off signal and store it
phase_step_rad = (float)GPS_TWO_PI*doppler_hz / (float)d_fs_in; phase_step_rad = static_cast<float>(GPS_TWO_PI) * doppler_hz / static_cast<float>(d_fs_in);
d_grid_doppler_wipeoffs[doppler_index] = new gr_complex[d_fft_size]; d_grid_doppler_wipeoffs[doppler_index] = new gr_complex[d_fft_size];
fxp_nco(d_grid_doppler_wipeoffs[doppler_index], d_fft_size,0, phase_step_rad); fxp_nco(d_grid_doppler_wipeoffs[doppler_index], d_fft_size,0, phase_step_rad);
} }
@ -214,15 +214,15 @@ double pcps_acquisition_fine_doppler_cc::search_maximum()
} }
// Normalize the maximum value to correct the scale factor introduced by FFTW // Normalize the maximum value to correct the scale factor introduced by FFTW
fft_normalization_factor = (float)d_fft_size * (float)d_fft_size;; fft_normalization_factor = static_cast<float>(d_fft_size) * static_cast<float>(d_fft_size);
magt = magt / (fft_normalization_factor * fft_normalization_factor); magt = magt / (fft_normalization_factor * fft_normalization_factor);
// 5- Compute the test statistics and compare to the threshold // 5- Compute the test statistics and compare to the threshold
d_test_statistics = magt/(d_input_power*std::sqrt(d_well_count)); d_test_statistics = magt/(d_input_power*std::sqrt(d_well_count));
// 4- record the maximum peak and the associated synchronization parameters // 4- record the maximum peak and the associated synchronization parameters
d_gnss_synchro->Acq_delay_samples = (double)index_time; d_gnss_synchro->Acq_delay_samples = static_cast<double>(index_time);
d_gnss_synchro->Acq_doppler_hz = (double)(index_doppler * d_doppler_step + d_config_doppler_min); d_gnss_synchro->Acq_doppler_hz = static_cast<double>(index_doppler * d_doppler_step + d_config_doppler_min);
d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter; d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter;
// Record results to file if required // Record results to file if required
@ -250,7 +250,7 @@ float pcps_acquisition_fine_doppler_cc::estimate_input_power(gr_vector_const_voi
float power = 0; float power = 0;
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(&power, d_magnitude, d_fft_size); volk_32f_accumulator_s32f(&power, d_magnitude, d_fft_size);
power /= (float)d_fft_size; power /= static_cast<float>(d_fft_size);
return power; return power;
} }
@ -305,6 +305,7 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler(gr_vector_const_void_star
int zero_padding_factor = 16; int zero_padding_factor = 16;
int fft_size_extended = d_fft_size * zero_padding_factor; int fft_size_extended = d_fft_size * zero_padding_factor;
gr::fft::fft_complex *fft_operator = new gr::fft::fft_complex(fft_size_extended, true); gr::fft::fft_complex *fft_operator = new gr::fft::fft_complex(fft_size_extended, true);
//zero padding the entire vector //zero padding the entire vector
memset(fft_operator->get_inbuf(), 0, fft_size_extended * sizeof(gr_complex)); memset(fft_operator->get_inbuf(), 0, fft_size_extended * sizeof(gr_complex));
@ -313,9 +314,8 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler(gr_vector_const_void_star
gps_l1_ca_code_gen_complex_sampled(code_replica, d_gnss_synchro->PRN, d_fs_in, 0); gps_l1_ca_code_gen_complex_sampled(code_replica, d_gnss_synchro->PRN, d_fs_in, 0);
int shift_index = (int)d_gnss_synchro->Acq_delay_samples; int shift_index = static_cast<int>(d_gnss_synchro->Acq_delay_samples);
//std::cout<<"shift_index="<<shift_index<<std::endl;
// Rotate to align the local code replica using acquisition time delay estimation // Rotate to align the local code replica using acquisition time delay estimation
if (shift_index != 0) if (shift_index != 0)
{ {
@ -336,9 +336,7 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler(gr_vector_const_void_star
volk_32fc_magnitude_squared_32f(p_tmp_vector, fft_operator->get_outbuf(), fft_size_extended); volk_32fc_magnitude_squared_32f(p_tmp_vector, fft_operator->get_outbuf(), fft_size_extended);
unsigned int tmp_index_freq = 0; unsigned int tmp_index_freq = 0;
volk_32f_index_max_16u(&tmp_index_freq,p_tmp_vector,fft_size_extended); volk_32f_index_max_16u(&tmp_index_freq, p_tmp_vector, fft_size_extended);
//std::cout<<"FFT maximum index present at "<<tmp_index_freq<<std::endl;
//case even //case even
int counter = 0; int counter = 0;
@ -347,20 +345,20 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler(gr_vector_const_void_star
for (int k=0; k < (fft_size_extended / 2); k++) for (int k=0; k < (fft_size_extended / 2); k++)
{ {
fftFreqBins[counter] = (((float)d_fs_in / 2.0) * (float)k) / ((float)fft_size_extended / 2.0); fftFreqBins[counter] = ((static_cast<float>(d_fs_in) / 2.0) * static_cast<float>(k)) / (static_cast<float>(fft_size_extended) / 2.0);
counter++; counter++;
} }
for (int k = fft_size_extended / 2; k > 0; k--) for (int k = fft_size_extended / 2; k > 0; k--)
{ {
fftFreqBins[counter] = ((-(float)d_fs_in / 2) * (float)k) / ((float)fft_size_extended / 2.0); fftFreqBins[counter] = ((-static_cast<float>(d_fs_in) / 2) * static_cast<float>(k)) / (static_cast<float>(fft_size_extended) / 2.0);
counter++; counter++;
} }
// 5. Update the Doppler estimation in Hz // 5. Update the Doppler estimation in Hz
if (abs(fftFreqBins[tmp_index_freq] - d_gnss_synchro->Acq_doppler_hz) < 1000) if (abs(fftFreqBins[tmp_index_freq] - d_gnss_synchro->Acq_doppler_hz) < 1000)
{ {
d_gnss_synchro->Acq_doppler_hz = (double)fftFreqBins[tmp_index_freq]; d_gnss_synchro->Acq_doppler_hz = static_cast<double>(fftFreqBins[tmp_index_freq]);
//std::cout<<"FFT maximum present at "<<fftFreqBins[tmp_index_freq]<<" [Hz]"<<std::endl; //std::cout<<"FFT maximum present at "<<fftFreqBins[tmp_index_freq]<<" [Hz]"<<std::endl;
} }
else else

View File

@ -230,7 +230,7 @@ void pcps_assisted_acquisition_cc::redefine_grid()
doppler_hz = d_doppler_min + d_doppler_step*doppler_index; doppler_hz = d_doppler_min + d_doppler_step*doppler_index;
// doppler search steps // doppler search steps
// compute the carrier doppler wipe-off signal and store it // compute the carrier doppler wipe-off signal and store it
phase_step_rad = (float)GPS_TWO_PI*doppler_hz / (float)d_fs_in; phase_step_rad = static_cast<float>(GPS_TWO_PI) * doppler_hz / static_cast<float>(d_fs_in);
d_grid_doppler_wipeoffs[doppler_index] = new gr_complex[d_fft_size]; d_grid_doppler_wipeoffs[doppler_index] = new gr_complex[d_fft_size];
fxp_nco(d_grid_doppler_wipeoffs[doppler_index], d_fft_size, 0, phase_step_rad); fxp_nco(d_grid_doppler_wipeoffs[doppler_index], d_fft_size, 0, phase_step_rad);
} }
@ -258,15 +258,15 @@ double pcps_assisted_acquisition_cc::search_maximum()
} }
// Normalize the maximum value to correct the scale factor introduced by FFTW // Normalize the maximum value to correct the scale factor introduced by FFTW
fft_normalization_factor = (float)d_fft_size * (float)d_fft_size; fft_normalization_factor = static_cast<float>(d_fft_size) * static_cast<float>(d_fft_size);
magt = magt / (fft_normalization_factor * fft_normalization_factor); magt = magt / (fft_normalization_factor * fft_normalization_factor);
// 5- Compute the test statistics and compare to the threshold // 5- Compute the test statistics and compare to the threshold
d_test_statistics = 2 * d_fft_size * magt /(d_input_power*d_well_count); d_test_statistics = 2 * d_fft_size * magt / (d_input_power * d_well_count);
// 4- record the maximum peak and the associated synchronization parameters // 4- record the maximum peak and the associated synchronization parameters
d_gnss_synchro->Acq_delay_samples = (double)index_time; d_gnss_synchro->Acq_delay_samples = static_cast<double>(index_time);
d_gnss_synchro->Acq_doppler_hz = (double)(index_doppler*d_doppler_step + d_doppler_min); d_gnss_synchro->Acq_doppler_hz = static_cast<double>(index_doppler * d_doppler_step + d_doppler_min);
d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter; d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter;
// Record results to file if required // Record results to file if required
@ -300,7 +300,7 @@ float pcps_assisted_acquisition_cc::estimate_input_power(gr_vector_const_void_st
float power; float power;
volk_32f_accumulator_s32f(&power, p_const_tmp_vector, d_fft_size); volk_32f_accumulator_s32f(&power, p_const_tmp_vector, d_fft_size);
volk_free(p_tmp_vector); volk_free(p_tmp_vector);
return ( power / (float)d_fft_size); return ( power / static_cast<float>(d_fft_size));
} }

View File

@ -137,7 +137,7 @@ void pcps_cccwsr_acquisition_cc::set_local_code(std::complex<float>* code_data,
std::complex<float>* code_pilot) std::complex<float>* code_pilot)
{ {
// Data code (E1B) // Data code (E1B)
memcpy(d_fft_if->get_inbuf(), code_data, sizeof(gr_complex)*d_fft_size); memcpy(d_fft_if->get_inbuf(), code_data, sizeof(gr_complex) * d_fft_size);
d_fft_if->execute(); // We need the FFT of local code d_fft_if->execute(); // We need the FFT of local code
@ -145,12 +145,12 @@ void pcps_cccwsr_acquisition_cc::set_local_code(std::complex<float>* code_data,
volk_32fc_conjugate_32fc(d_fft_code_data,d_fft_if->get_outbuf(),d_fft_size); volk_32fc_conjugate_32fc(d_fft_code_data,d_fft_if->get_outbuf(),d_fft_size);
// Pilot code (E1C) // Pilot code (E1C)
memcpy(d_fft_if->get_inbuf(), code_pilot, sizeof(gr_complex)*d_fft_size); memcpy(d_fft_if->get_inbuf(), code_pilot, sizeof(gr_complex) * d_fft_size);
d_fft_if->execute(); // We need the FFT of local code d_fft_if->execute(); // We need the FFT of local code
//Conjugate the local code, //Conjugate the local code,
volk_32fc_conjugate_32fc(d_fft_code_pilot,d_fft_if->get_outbuf(),d_fft_size); volk_32fc_conjugate_32fc(d_fft_code_pilot, d_fft_if->get_outbuf(), d_fft_size);
} }
void pcps_cccwsr_acquisition_cc::init() void pcps_cccwsr_acquisition_cc::init()
@ -163,8 +163,8 @@ void pcps_cccwsr_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++;
@ -176,7 +176,7 @@ void pcps_cccwsr_acquisition_cc::init()
{ {
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;
complex_exp_gen_conj(d_grid_doppler_wipeoffs[doppler_index], complex_exp_gen_conj(d_grid_doppler_wipeoffs[doppler_index],
d_freq + doppler, d_fs_in, d_fft_size); d_freq + doppler, d_fs_in, d_fft_size);
} }
@ -223,7 +223,7 @@ int pcps_cccwsr_acquisition_cc::general_work(int noutput_items,
float magt_plus = 0.0; float magt_plus = 0.0;
float magt_minus = 0.0; float magt_minus = 0.0;
const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer
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);
d_sample_counter += d_fft_size; // sample counter d_sample_counter += d_fft_size; // sample counter
@ -238,14 +238,14 @@ int pcps_cccwsr_acquisition_cc::general_work(int noutput_items,
// 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);
@ -314,8 +314,8 @@ int pcps_cccwsr_acquisition_cc::general_work(int noutput_items,
if (d_mag < magt) if (d_mag < magt)
{ {
d_mag = magt; d_mag = magt;
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 = d_sample_counter; d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter;
} }

View File

@ -105,7 +105,7 @@ pcps_opencl_acquisition_cc::pcps_opencl_acquisition_cc(
d_well_count = 0; d_well_count = 0;
d_doppler_max = doppler_max; d_doppler_max = doppler_max;
d_fft_size = d_sampled_ms * d_samples_per_ms; d_fft_size = d_sampled_ms * d_samples_per_ms;
d_fft_size_pow2 = pow(2, ceil(log2(2*d_fft_size))); d_fft_size_pow2 = pow(2, ceil(log2(2 * d_fft_size)));
d_mag = 0; d_mag = 0;
d_input_power = 0.0; d_input_power = 0.0;
d_num_doppler_bins = 0; d_num_doppler_bins = 0;
@ -298,8 +298,8 @@ void pcps_opencl_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++;
@ -316,7 +316,7 @@ void pcps_opencl_acquisition_cc::init()
{ {
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;
complex_exp_gen_conj(d_grid_doppler_wipeoffs[doppler_index], complex_exp_gen_conj(d_grid_doppler_wipeoffs[doppler_index],
d_freq + doppler, d_fs_in, d_fft_size); d_freq + doppler, d_fs_in, d_fft_size);
@ -381,7 +381,7 @@ void pcps_opencl_acquisition_cc::acquisition_core_volk()
int doppler; int doppler;
unsigned int indext = 0; unsigned int 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];
@ -399,13 +399,13 @@ void pcps_opencl_acquisition_cc::acquisition_core_volk()
// 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);
@ -443,8 +443,8 @@ void pcps_opencl_acquisition_cc::acquisition_core_volk()
// 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
@ -503,7 +503,7 @@ void pcps_opencl_acquisition_cc::acquisition_core_opencl()
int doppler; int doppler;
unsigned int indext = 0; unsigned int indext = 0;
float magt = 0.0; float magt = 0.0;
float fft_normalization_factor = ((float)d_fft_size_pow2 * (float)d_fft_size); //This works, but I am not sure why. float fft_normalization_factor = (static_cast<float>(d_fft_size_pow2) * static_cast<float>(d_fft_size)); //This works, but I am not sure why.
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];
@ -531,7 +531,7 @@ void pcps_opencl_acquisition_cc::acquisition_core_opencl()
// 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);
cl::Kernel kernel; cl::Kernel kernel;
@ -540,7 +540,7 @@ void pcps_opencl_acquisition_cc::acquisition_core_opencl()
{ {
// 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;
//Multiply input signal with doppler wipe-off //Multiply input signal with doppler wipe-off
kernel = cl::Kernel(d_cl_program, "mult_vectors"); kernel = cl::Kernel(d_cl_program, "mult_vectors");
@ -605,8 +605,8 @@ void pcps_opencl_acquisition_cc::acquisition_core_opencl()
// 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
@ -702,7 +702,7 @@ int pcps_opencl_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],
@ -711,7 +711,7 @@ int pcps_opencl_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

@ -187,8 +187,8 @@ void pcps_quicksync_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++;
@ -199,7 +199,7 @@ void pcps_quicksync_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_samples_per_code * d_folding_factor * sizeof(gr_complex), volk_get_alignment())); d_grid_doppler_wipeoffs[doppler_index] = static_cast<gr_complex*>(volk_malloc(d_samples_per_code * d_folding_factor * 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;
complex_exp_gen_conj(d_grid_doppler_wipeoffs[doppler_index], complex_exp_gen_conj(d_grid_doppler_wipeoffs[doppler_index],
d_freq + doppler, d_fs_in, d_freq + doppler, d_fs_in,
d_samples_per_code * d_folding_factor); d_samples_per_code * d_folding_factor);
@ -273,7 +273,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
/*Stores a copy of the folded version of the signal.This is used for /*Stores a copy of the folded version of the signal.This is used for
the FFT operations in future steps of excecution*/ the FFT operations in future steps of excecution*/
// gr_complex in_folded[d_fft_size]; // gr_complex in_folded[d_fft_size];
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);
d_input_power = 0.0; d_input_power = 0.0;
d_mag = 0.0; d_mag = 0.0;
@ -299,7 +299,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
being performed in a signal of size nxp */ being performed in a signal of size nxp */
volk_32fc_magnitude_squared_32f(d_magnitude, in, d_samples_per_code * d_folding_factor); volk_32fc_magnitude_squared_32f(d_magnitude, in, d_samples_per_code * d_folding_factor);
volk_32f_accumulator_s32f(&d_input_power, d_magnitude, d_samples_per_code * d_folding_factor); volk_32f_accumulator_s32f(&d_input_power, d_magnitude, d_samples_per_code * d_folding_factor);
d_input_power /= (float)(d_samples_per_code * d_folding_factor); d_input_power /= static_cast<float>(d_samples_per_code * d_folding_factor);
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++)
{ {
@ -312,7 +312,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
/*Doppler search steps and then multiplication of the incoming /*Doppler search steps and then multiplication of the incoming
signal with the doppler wipeoffs to eliminate frequency offset signal with the doppler wipeoffs to eliminate frequency offset
*/ */
doppler = -(int)d_doppler_max + d_doppler_step*doppler_index; doppler = -static_cast<int>(d_doppler_max) + d_doppler_step * doppler_index;
/*Perform multiplication of the incoming signal with the /*Perform multiplication of the incoming signal with the
complex exponential vector. This removes the frequency doppler complex exponential vector. This removes the frequency doppler
@ -324,7 +324,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
/*Perform folding of the carrier wiped-off incoming signal. Since /*Perform folding of the carrier wiped-off incoming signal. Since
superlinear method is being used the folding factor in the superlinear method is being used the folding factor in the
incoming raw data signal is of d_folding_factor^2*/ incoming raw data signal is of d_folding_factor^2*/
for ( int i = 0; i < (int)(d_folding_factor*d_folding_factor); i++) for ( int i = 0; i < static_cast<int>(d_folding_factor * d_folding_factor); i++)
{ {
std::transform ((in_temp + i * d_fft_size), std::transform ((in_temp + i * d_fft_size),
(in_temp + ((i + 1) * d_fft_size)) , (in_temp + ((i + 1) * d_fft_size)) ,
@ -357,7 +357,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
// (1 / (fft_normalization_factor * fft_normalization_factor)), d_fft_size); // (1 / (fft_normalization_factor * fft_normalization_factor)), d_fft_size);
volk_32f_index_max_16u(&indext, d_magnitude_folded, d_fft_size); volk_32f_index_max_16u(&indext, d_magnitude_folded, d_fft_size);
magt = d_magnitude_folded[indext]/ (fft_normalization_factor * fft_normalization_factor); magt = d_magnitude_folded[indext] / (fft_normalization_factor * fft_normalization_factor);
delete d_signal_folded; delete d_signal_folded;
@ -380,26 +380,25 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
gr_complex complex_acumulator[100]; gr_complex complex_acumulator[100];
//gr_complex complex_acumulator[d_folding_factor]; //gr_complex complex_acumulator[d_folding_factor];
for (int i = 0; i < (int)d_folding_factor; i++) for (int i = 0; i < static_cast<int>(d_folding_factor); i++)
{ {
d_possible_delay[i] = detected_delay_samples_folded + (i)*d_fft_size; d_possible_delay[i] = detected_delay_samples_folded + (i) * d_fft_size;
} }
for ( int i = 0; i < (int)d_folding_factor; i++) for ( int i = 0; i < static_cast<int>(d_folding_factor); i++)
{ {
/*Copy a signal of 1 code length into suggested buffer. /*Copy a signal of 1 code length into suggested buffer.
The copied signal must have doppler effect corrected*/ The copied signal must have doppler effect corrected*/
memcpy(in_1code,&in_temp[d_possible_delay[i]], memcpy(in_1code,&in_temp[d_possible_delay[i]],
sizeof(gr_complex)*(d_samples_per_code)); sizeof(gr_complex) * (d_samples_per_code));
/*Perform multiplication of the unmodified local /*Perform multiplication of the unmodified local
generated code with the incoming signal with doppler generated code with the incoming signal with doppler
effect corrected and accumulates its value. This effect corrected and accumulates its value. This
is indeed correlation in time for an specific value is indeed correlation in time for an specific value
of a shift*/ of a shift*/
volk_32fc_x2_multiply_32fc(corr_output, in_1code, volk_32fc_x2_multiply_32fc(corr_output, in_1code, d_code, d_samples_per_code);
d_code, d_samples_per_code);
for(int j = 0; j < d_samples_per_code; j++) for(int j = 0; j < d_samples_per_code; j++)
{ {
@ -412,8 +411,8 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
volk_32f_index_max_16u(&indext, d_corr_output_f, d_folding_factor); volk_32f_index_max_16u(&indext, d_corr_output_f, d_folding_factor);
/*Now save the real code phase in the gnss_syncro block for use in other stages*/ /*Now save the real code phase in the gnss_syncro block for use in other stages*/
d_gnss_synchro->Acq_delay_samples = (double)(d_possible_delay[indext]); d_gnss_synchro->Acq_delay_samples = static_cast<double>(d_possible_delay[indext]);
d_gnss_synchro->Acq_doppler_hz = (double)doppler; d_gnss_synchro->Acq_doppler_hz = static_cast<double>(doppler);
d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter; d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter;
/* 5- Compute the test statistics and compare to the threshold d_test_statistics = 2 * d_fft_size * d_mag / d_input_power;*/ /* 5- Compute the test statistics and compare to the threshold d_test_statistics = 2 * d_fft_size * d_mag / d_input_power;*/
@ -487,8 +486,8 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
DLOG(INFO) << "test statistics value " << d_test_statistics; DLOG(INFO) << "test statistics value " << d_test_statistics;
DLOG(INFO) << "test statistics threshold " << d_threshold; DLOG(INFO) << "test statistics threshold " << d_threshold;
DLOG(INFO) << "folding factor " << d_folding_factor; DLOG(INFO) << "folding factor " << d_folding_factor;
DLOG(INFO) << "possible delay correlation output"; DLOG(INFO) << "possible delay correlation output";
for (int i = 0; i < (int)d_folding_factor; i++) DLOG(INFO) << d_possible_delay[i] <<"\t\t\t"<<d_corr_output_f[i]; for (int i = 0; i < static_cast<int>(d_folding_factor); i++) DLOG(INFO) << d_possible_delay[i] << "\t\t\t" << d_corr_output_f[i];
DLOG(INFO) << "code phase " << d_gnss_synchro->Acq_delay_samples; DLOG(INFO) << "code phase " << d_gnss_synchro->Acq_delay_samples;
DLOG(INFO) << "doppler " << d_gnss_synchro->Acq_doppler_hz; DLOG(INFO) << "doppler " << d_gnss_synchro->Acq_doppler_hz;
DLOG(INFO) << "magnitude folded " << d_mag; DLOG(INFO) << "magnitude folded " << d_mag;
@ -517,7 +516,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
DLOG(INFO) << "test statistics threshold " << d_threshold; DLOG(INFO) << "test statistics threshold " << d_threshold;
DLOG(INFO) << "folding factor "<<d_folding_factor; DLOG(INFO) << "folding factor "<<d_folding_factor;
DLOG(INFO) << "possible delay corr output"; DLOG(INFO) << "possible delay corr output";
for (int i = 0; i < (int)d_folding_factor; i++) DLOG(INFO) << d_possible_delay[i] << "\t\t\t" << d_corr_output_f[i]; for (int i = 0; i < static_cast<int>(d_folding_factor); i++) DLOG(INFO) << d_possible_delay[i] << "\t\t\t" << d_corr_output_f[i];
DLOG(INFO) << "code phase " << d_gnss_synchro->Acq_delay_samples; DLOG(INFO) << "code phase " << d_gnss_synchro->Acq_delay_samples;
DLOG(INFO) << "doppler " << d_gnss_synchro->Acq_doppler_hz; DLOG(INFO) << "doppler " << d_gnss_synchro->Acq_doppler_hz;
DLOG(INFO) << "magnitude folded " << d_mag; DLOG(INFO) << "magnitude folded " << d_mag;

View File

@ -158,8 +158,8 @@ void pcps_tong_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++;
@ -172,7 +172,7 @@ void pcps_tong_acquisition_cc::init()
{ {
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;
complex_exp_gen_conj(d_grid_doppler_wipeoffs[doppler_index], complex_exp_gen_conj(d_grid_doppler_wipeoffs[doppler_index],
d_freq + doppler, d_fs_in, d_fft_size); d_freq + doppler, d_fs_in, d_fft_size);
@ -232,7 +232,7 @@ int pcps_tong_acquisition_cc::general_work(int noutput_items,
unsigned int indext = 0; unsigned int indext = 0;
float magt = 0.0; float magt = 0.0;
const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer
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);
d_input_power = 0.0; d_input_power = 0.0;
d_mag = 0.0; d_mag = 0.0;
@ -249,14 +249,14 @@ int pcps_tong_acquisition_cc::general_work(int noutput_items,
// 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);
@ -293,8 +293,8 @@ int pcps_tong_acquisition_cc::general_work(int noutput_items,
if (d_mag < magt) if (d_mag < magt)
{ {
d_mag = magt; d_mag = magt;
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 = d_sample_counter; d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter;
} }

View File

@ -456,7 +456,7 @@ int galileo_e5a_telemetry_decoder_cc::general_work (int noutput_items, gr_vector
{ {
d_CRC_error_counter = 0; d_CRC_error_counter = 0;
d_flag_preamble = true; //valid preamble indicator (initialized to false every work()) d_flag_preamble = true; //valid preamble indicator (initialized to false every work())
d_preamble_time_seconds = in[0][0].Tracking_timestamp_secs - ((double)(GALILEO_FNAV_CODES_PER_PAGE+GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD); //record the PRN start sample index associated to the preamble start. d_preamble_time_seconds = in[0][0].Tracking_timestamp_secs - (static_cast<double>(GALILEO_FNAV_CODES_PER_PAGE+GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD); //record the PRN start sample index associated to the preamble start.
if (!d_flag_frame_sync) if (!d_flag_frame_sync)
{ {
d_flag_frame_sync = true; d_flag_frame_sync = true;
@ -505,25 +505,25 @@ int galileo_e5a_telemetry_decoder_cc::general_work (int noutput_items, gr_vector
if (d_nav.flag_TOW_1 == true) if (d_nav.flag_TOW_1 == true)
{ {
d_TOW_at_Preamble = d_nav.FNAV_TOW_1; d_TOW_at_Preamble = d_nav.FNAV_TOW_1;
d_TOW_at_current_symbol = d_TOW_at_Preamble + ((double)(GALILEO_FNAV_CODES_PER_PAGE+GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD); d_TOW_at_current_symbol = d_TOW_at_Preamble + (static_cast<double>(GALILEO_FNAV_CODES_PER_PAGE+GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD);
d_nav.flag_TOW_1 = false; d_nav.flag_TOW_1 = false;
} }
if (d_nav.flag_TOW_2 == true) if (d_nav.flag_TOW_2 == true)
{ {
d_TOW_at_Preamble = d_nav.FNAV_TOW_2; d_TOW_at_Preamble = d_nav.FNAV_TOW_2;
d_TOW_at_current_symbol = d_TOW_at_Preamble + ((double)(GALILEO_FNAV_CODES_PER_PAGE+GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD); d_TOW_at_current_symbol = d_TOW_at_Preamble + (static_cast<double>(GALILEO_FNAV_CODES_PER_PAGE+GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD);
d_nav.flag_TOW_2 = false; d_nav.flag_TOW_2 = false;
} }
if (d_nav.flag_TOW_3 == true) if (d_nav.flag_TOW_3 == true)
{ {
d_TOW_at_Preamble = d_nav.FNAV_TOW_3; d_TOW_at_Preamble = d_nav.FNAV_TOW_3;
d_TOW_at_current_symbol = d_TOW_at_Preamble + ((double)(GALILEO_FNAV_CODES_PER_PAGE+GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD); d_TOW_at_current_symbol = d_TOW_at_Preamble + (static_cast<double>(GALILEO_FNAV_CODES_PER_PAGE+GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD);
d_nav.flag_TOW_3 = false; d_nav.flag_TOW_3 = false;
} }
if (d_nav.flag_TOW_4 == true) if (d_nav.flag_TOW_4 == true)
{ {
d_TOW_at_Preamble = d_nav.FNAV_TOW_4; d_TOW_at_Preamble = d_nav.FNAV_TOW_4;
d_TOW_at_current_symbol = d_TOW_at_Preamble + ((double)(GALILEO_FNAV_CODES_PER_PAGE+GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD); d_TOW_at_current_symbol = d_TOW_at_Preamble + (static_cast<double>(GALILEO_FNAV_CODES_PER_PAGE+GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD);
d_nav.flag_TOW_4 = false; d_nav.flag_TOW_4 = false;
} }
else else

View File

@ -67,7 +67,7 @@ double Galileo_Utc_Model::GST_to_UTC_time(double t_e, int WN)
* the GST/Utc relationship is given by * the GST/Utc relationship is given by
*/ */
//std::cout<<"GST->UTC case a"<<std::endl; //std::cout<<"GST->UTC case a"<<std::endl;
Delta_t_Utc = Delta_tLS_6 + A0_6 + A1_6 * (t_e - t0t_6 + 604800 * (double)((WN % 256) - WNot_6)); Delta_t_Utc = Delta_tLS_6 + A0_6 + A1_6 * (t_e - t0t_6 + 604800 * static_cast<double>((WN % 256) - WNot_6));
t_Utc_daytime = fmod(t_e - Delta_t_Utc, 86400); t_Utc_daytime = fmod(t_e - Delta_t_Utc, 86400);
} }
else else
@ -78,7 +78,7 @@ double Galileo_Utc_Model::GST_to_UTC_time(double t_e, int WN)
* the effective time is computed according to the following equations: * the effective time is computed according to the following equations:
*/ */
//std::cout<<"GST->UTC case b"<<std::endl; //std::cout<<"GST->UTC case b"<<std::endl;
Delta_t_Utc = Delta_tLS_6 + A0_6 + A1_6 * (t_e - t0t_6 + 604800 * (double)((WN % 256) - WNot_6)); Delta_t_Utc = Delta_tLS_6 + A0_6 + A1_6 * (t_e - t0t_6 + 604800 * static_cast<double>((WN % 256) - WNot_6));
double W = fmod(t_e - Delta_t_Utc - 43200, 86400) + 43200; double W = fmod(t_e - Delta_t_Utc - 43200, 86400) + 43200;
t_Utc_daytime = fmod(W, 86400 + Delta_tLSF_6 - Delta_tLS_6); t_Utc_daytime = fmod(W, 86400 + Delta_tLSF_6 - Delta_tLS_6);
//implement something to handle a leap second event! //implement something to handle a leap second event!
@ -94,7 +94,7 @@ double Galileo_Utc_Model::GST_to_UTC_time(double t_e, int WN)
* the following equation: * the following equation:
*/ */
//std::cout<<"GST->UTC case c"<<std::endl; //std::cout<<"GST->UTC case c"<<std::endl;
Delta_t_Utc = Delta_tLSF_6 + A0_6 + A1_6 * (t_e - t0t_6 + 604800 * (double)((WN % 256) - WNot_6)); Delta_t_Utc = Delta_tLSF_6 + A0_6 + A1_6 * (t_e - t0t_6 + 604800 * static_cast<double>((WN % 256) - WNot_6));
t_Utc_daytime = fmod(t_e - Delta_t_Utc, 86400); t_Utc_daytime = fmod(t_e - Delta_t_Utc, 86400);
} }

View File

@ -47,7 +47,7 @@ double Gps_Utc_Model::utc_time(double gpstime_corrected, int i_GPS_week)
{ {
double t_utc; double t_utc;
double t_utc_daytime; double t_utc_daytime;
double Delta_t_UTC = d_DeltaT_LS + d_A0 + d_A1 * (gpstime_corrected - d_t_OT + 604800 * (double)(i_GPS_week - i_WN_T)); double Delta_t_UTC = d_DeltaT_LS + d_A0 + d_A1 * (gpstime_corrected - d_t_OT + 604800 * static_cast<double>(i_GPS_week - i_WN_T));
// Determine if the effectivity time of the leap second event is in the past // Determine if the effectivity time of the leap second event is in the past
int weeksToLeapSecondEvent = i_WN_LSF - i_GPS_week; int weeksToLeapSecondEvent = i_WN_LSF - i_GPS_week;
@ -87,7 +87,7 @@ double Gps_Utc_Model::utc_time(double gpstime_corrected, int i_GPS_week)
} }
if ( (gpstime_corrected - secondOfLeapSecondEvent) > 21600) if ( (gpstime_corrected - secondOfLeapSecondEvent) > 21600)
{ {
Delta_t_UTC = d_DeltaT_LSF + d_A0 + d_A1 * (gpstime_corrected - d_t_OT + 604800*(double)(i_GPS_week - i_WN_T)); Delta_t_UTC = d_DeltaT_LSF + d_A0 + d_A1 * (gpstime_corrected - d_t_OT + 604800 * static_cast<double>(i_GPS_week - i_WN_T));
t_utc_daytime = fmod(gpstime_corrected - Delta_t_UTC, 86400); t_utc_daytime = fmod(gpstime_corrected - Delta_t_UTC, 86400);
} }
} }
@ -99,7 +99,7 @@ double Gps_Utc_Model::utc_time(double gpstime_corrected, int i_GPS_week)
* WNLSF and DN values, is in the "past" (relative to the user's current time), * WNLSF and DN values, is in the "past" (relative to the user's current time),
* and the user<EFBFBD>s current time does not fall in the time span as given above * and the user<EFBFBD>s current time does not fall in the time span as given above
* in 20.3.3.5.2.4b,*/ * in 20.3.3.5.2.4b,*/
Delta_t_UTC = d_DeltaT_LSF + d_A0 + d_A1 * (gpstime_corrected - d_t_OT + 604800 * (double)(i_GPS_week - i_WN_T)); Delta_t_UTC = d_DeltaT_LSF + d_A0 + d_A1 * (gpstime_corrected - d_t_OT + 604800 * static_cast<double>(i_GPS_week - i_WN_T));
t_utc_daytime = fmod(gpstime_corrected - Delta_t_UTC, 86400); t_utc_daytime = fmod(gpstime_corrected - Delta_t_UTC, 86400);
} }

View File

@ -178,7 +178,7 @@ int main(int argc, char** argv)
gettimeofday(&tv, NULL); gettimeofday(&tv, NULL);
long long int end = tv.tv_sec * 1000000 + tv.tv_usec; long long int end = tv.tv_sec * 1000000 + tv.tv_usec;
std::cout << "Total GNSS-SDR run time " std::cout << "Total GNSS-SDR run time "
<< ((double)(end - begin))/1000000.0 << (static_cast<double>(end - begin)) / 1000000.0
<< " [seconds]" << std::endl; << " [seconds]" << std::endl;
google::ShutDownCommandLineFlags(); google::ShutDownCommandLineFlags();