1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-02-14 18:10:10 +00:00

It seems that definitions such as

const bits_slice INTEGRITY_STATUS_FLAG = {{23,1}};

used in GPS_L1_CA.h are not allowed in the C++11 standard since they do not correspond to any valid constructor. This is accepted by the current version of gcc (probably due to backward compatibility with C and earlier versions of C++), but it *could* not be accepted in future versions. This can be fixed by putting the struct into a std::vector. I don't know if this is the best way but it seems to work well and does not implies major changes in the code.

There is another issue with the Gnss_Synchro class. Since it had a constructor and a destructor, it could not be considered a POD (Plain Old Data) structure and this has some limitations: while gcc and the C99 standard allowed an array's size to be determined at run time, this extension is not permitted in standard C++. This issue has implications when passing Gnss_Synchro through memory between signal processing blocks. In order to fix this, I have removed the Gnss_Synchro.cc implementation and now this is a header-only class where the array size can be determined at compile time


git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@204 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Carles Fernandez 2012-07-02 12:45:20 +00:00
parent b38b2e2177
commit f6892a8bf3
10 changed files with 199 additions and 253 deletions

View File

@ -129,7 +129,9 @@ int gps_l1_ca_observables_cc::general_work (int noutput_items, gr_vector_int &ni
Gnss_Synchro **in = (Gnss_Synchro **) &input_items[0]; //Get the input pointer Gnss_Synchro **in = (Gnss_Synchro **) &input_items[0]; //Get the input pointer
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0]; //Get the output pointer Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0]; //Get the output pointer
Gnss_Synchro current_gnss_synchro[d_nchannels]; const unsigned int cd_channels = d_nchannels;
Gnss_Synchro current_gnss_synchro[cd_channels];
std::map<int,Gnss_Synchro> current_gnss_synchro_map; std::map<int,Gnss_Synchro> current_gnss_synchro_map;
std::map<int,Gnss_Synchro> gnss_synchro_aligned_map; std::map<int,Gnss_Synchro> gnss_synchro_aligned_map;
@ -148,23 +150,24 @@ int gps_l1_ca_observables_cc::general_work (int noutput_items, gr_vector_int &ni
*/ */
for (unsigned int i=0; i<d_nchannels ; i++) for (unsigned int i=0; i<d_nchannels ; i++)
{ {
//Copy the telemetry decoder data to local copy //Copy the telemetry decoder data to local copy
current_gnss_synchro[i]=in[i][0]; current_gnss_synchro[i]=in[i][0];
if (current_gnss_synchro[i].Flag_valid_word) //if this channel have valid word if (current_gnss_synchro[i].Flag_valid_word) //if this channel have valid word
{ {
current_gnss_synchro_map.insert(std::pair<int,Gnss_Synchro>(current_gnss_synchro[i].Channel_ID, current_gnss_synchro[i])); //record the word structure in a map for pseudoranges //record the word structure in a map for pseudoranges
current_gnss_synchro_map.insert(std::pair<int,Gnss_Synchro>(current_gnss_synchro[i].Channel_ID, current_gnss_synchro[i]));
// RECORD PRN start timestamps history // RECORD PRN start timestamps history
if (d_history_gnss_synchro_deque[i].size()<MAX_TOA_DELAY_MS) if (d_history_gnss_synchro_deque[i].size()<MAX_TOA_DELAY_MS)
{ {
d_history_gnss_synchro_deque[i].push_front(current_gnss_synchro[i]); d_history_gnss_synchro_deque[i].push_front(current_gnss_synchro[i]);
flag_history_ok = false; // at least one channel need more samples flag_history_ok = false; // at least one channel need more samples
} }
else else
{ {
//clearQueue(d_history_prn_delay_ms[i]); //clear the queue as the preamble arrives //clearQueue(d_history_prn_delay_ms[i]); //clear the queue as the preamble arrives
d_history_gnss_synchro_deque[i].pop_back(); d_history_gnss_synchro_deque[i].pop_back();
d_history_gnss_synchro_deque[i].push_front(current_gnss_synchro[i]); d_history_gnss_synchro_deque[i].push_front(current_gnss_synchro[i]);
} }
} }
} }
@ -184,81 +187,81 @@ int gps_l1_ca_observables_cc::general_work (int noutput_items, gr_vector_int &ni
if(current_gnss_synchro_map.size() > 0 and flag_history_ok == true) if(current_gnss_synchro_map.size() > 0 and flag_history_ok == true)
{ {
/* /*
* 2.1 Find the correct symbol timestamp in the gnss_synchro history: we have to compare timestamps between channels on the SAME symbol * 2.1 Find the correct symbol timestamp in the gnss_synchro history: we have to compare timestamps between channels on the SAME symbol
* (common TX time algorithm) * (common TX time algorithm)
*/ */
double min_preamble_delay_ms; double min_preamble_delay_ms;
double max_preamble_delay_ms; double max_preamble_delay_ms;
int current_symbol=0; int current_symbol=0;
int reference_channel; int reference_channel;
int history_shift; int history_shift;
Gnss_Synchro tmp_gnss_synchro; Gnss_Synchro tmp_gnss_synchro;
gnss_synchro_iter = min_element(current_gnss_synchro_map.begin(), current_gnss_synchro_map.end(), pairCompare_gnss_synchro_preamble_delay_ms); gnss_synchro_iter = min_element(current_gnss_synchro_map.begin(), current_gnss_synchro_map.end(), pairCompare_gnss_synchro_preamble_delay_ms);
min_preamble_delay_ms = gnss_synchro_iter->second.Preamble_timestamp_ms; //[ms] min_preamble_delay_ms = gnss_synchro_iter->second.Preamble_timestamp_ms; //[ms]
gnss_synchro_iter = max_element(current_gnss_synchro_map.begin(), current_gnss_synchro_map.end(), pairCompare_gnss_synchro_preamble_delay_ms); gnss_synchro_iter = max_element(current_gnss_synchro_map.begin(), current_gnss_synchro_map.end(), pairCompare_gnss_synchro_preamble_delay_ms);
max_preamble_delay_ms = gnss_synchro_iter->second.Preamble_timestamp_ms; //[ms] max_preamble_delay_ms = gnss_synchro_iter->second.Preamble_timestamp_ms; //[ms]
if ((max_preamble_delay_ms-min_preamble_delay_ms)< MAX_TOA_DELAY_MS) if ((max_preamble_delay_ms-min_preamble_delay_ms)< MAX_TOA_DELAY_MS)
{ {
// we have a valid information set. Its time to align the symbols information // we have a valid information set. Its time to align the symbols information
// what is the most delayed symbol in the current set? -> this will be the reference symbol // what is the most delayed symbol in the current set? -> this will be the reference symbol
gnss_synchro_iter=min_element(current_gnss_synchro_map.begin(), current_gnss_synchro_map.end(), pairCompare_gnss_synchro_preamble_symbol_count); gnss_synchro_iter=min_element(current_gnss_synchro_map.begin(), current_gnss_synchro_map.end(), pairCompare_gnss_synchro_preamble_symbol_count);
current_symbol=gnss_synchro_iter->second.Preamble_symbol_counter; current_symbol=gnss_synchro_iter->second.Preamble_symbol_counter;
reference_channel=gnss_synchro_iter->second.Channel_ID; reference_channel=gnss_synchro_iter->second.Channel_ID;
// save it in the aligned symbols map // save it in the aligned symbols map
gnss_synchro_aligned_map.insert(std::pair<int,Gnss_Synchro>(gnss_synchro_iter->second.Channel_ID, gnss_synchro_iter->second)); gnss_synchro_aligned_map.insert(std::pair<int,Gnss_Synchro>(gnss_synchro_iter->second.Channel_ID, gnss_synchro_iter->second));
// Now find where the same symbols were in the rest of the channels searching in the symbol history // Now find where the same symbols were in the rest of the channels searching in the symbol history
for(gnss_synchro_iter = current_gnss_synchro_map.begin(); gnss_synchro_iter != current_gnss_synchro_map.end(); gnss_synchro_iter++) for(gnss_synchro_iter = current_gnss_synchro_map.begin(); gnss_synchro_iter != current_gnss_synchro_map.end(); gnss_synchro_iter++)
{ {
//TODO: Replace the loop using current current_symbol-Preamble_symbol_counter //TODO: Replace the loop using current current_symbol-Preamble_symbol_counter
if (reference_channel!=gnss_synchro_iter->second.Channel_ID) if (reference_channel!=gnss_synchro_iter->second.Channel_ID)
{ {
// compute the required symbol history shift in order to match the reference symbol // compute the required symbol history shift in order to match the reference symbol
history_shift=gnss_synchro_iter->second.Preamble_symbol_counter-current_symbol; history_shift=gnss_synchro_iter->second.Preamble_symbol_counter-current_symbol;
if (history_shift<(int)MAX_TOA_DELAY_MS)// and history_shift>=0) if (history_shift<(int)MAX_TOA_DELAY_MS)// and history_shift>=0)
{ {
tmp_gnss_synchro= d_history_gnss_synchro_deque[gnss_synchro_iter->second.Channel_ID][history_shift]; tmp_gnss_synchro= d_history_gnss_synchro_deque[gnss_synchro_iter->second.Channel_ID][history_shift];
gnss_synchro_aligned_map.insert(std::pair<int,Gnss_Synchro>(gnss_synchro_iter->second.Channel_ID,tmp_gnss_synchro)); gnss_synchro_aligned_map.insert(std::pair<int,Gnss_Synchro>(gnss_synchro_iter->second.Channel_ID,tmp_gnss_synchro));
} }
} }
} }
} }
/* /*
* 3 Compute the pseudorranges using the aligned data map * 3 Compute the pseudorranges using the aligned data map
*/ */
double min_symbol_timestamp_ms; double min_symbol_timestamp_ms;
double max_symbol_timestamp_ms; double max_symbol_timestamp_ms;
gnss_synchro_iter = min_element(gnss_synchro_aligned_map.begin(), gnss_synchro_aligned_map.end(), pairCompare_gnss_synchro_Prn_delay_ms); gnss_synchro_iter = min_element(gnss_synchro_aligned_map.begin(), gnss_synchro_aligned_map.end(), pairCompare_gnss_synchro_Prn_delay_ms);
min_symbol_timestamp_ms = gnss_synchro_iter->second.Prn_timestamp_ms; //[ms] min_symbol_timestamp_ms = gnss_synchro_iter->second.Prn_timestamp_ms; //[ms]
gnss_synchro_iter = max_element(gnss_synchro_aligned_map.begin(), gnss_synchro_aligned_map.end(), pairCompare_gnss_synchro_Prn_delay_ms); gnss_synchro_iter = max_element(gnss_synchro_aligned_map.begin(), gnss_synchro_aligned_map.end(), pairCompare_gnss_synchro_Prn_delay_ms);
max_symbol_timestamp_ms = gnss_synchro_iter->second.Prn_timestamp_ms; //[ms] max_symbol_timestamp_ms = gnss_synchro_iter->second.Prn_timestamp_ms; //[ms]
// check again if this is a valid set of observations // check again if this is a valid set of observations
if ((max_symbol_timestamp_ms - min_symbol_timestamp_ms) < MAX_TOA_DELAY_MS) if ((max_symbol_timestamp_ms - min_symbol_timestamp_ms) < MAX_TOA_DELAY_MS)
/* /*
* 2.3 compute the pseudoranges * 2.3 compute the pseudoranges
*/ */
{ {
for(gnss_synchro_iter = gnss_synchro_aligned_map.begin(); gnss_synchro_iter != gnss_synchro_aligned_map.end(); gnss_synchro_iter++) for(gnss_synchro_iter = gnss_synchro_aligned_map.begin(); gnss_synchro_iter != gnss_synchro_aligned_map.end(); gnss_synchro_iter++)
{ {
traveltime_ms = gnss_synchro_iter->second.Prn_timestamp_ms - min_symbol_timestamp_ms + GPS_STARTOFFSET_ms; //[ms] traveltime_ms = gnss_synchro_iter->second.Prn_timestamp_ms - min_symbol_timestamp_ms + GPS_STARTOFFSET_ms; //[ms]
pseudorange_m = traveltime_ms*GPS_C_m_ms; // [m] pseudorange_m = traveltime_ms*GPS_C_m_ms; // [m]
// update the pseudorange object // update the pseudorange object
current_gnss_synchro[gnss_synchro_iter->second.Channel_ID]=gnss_synchro_iter->second; current_gnss_synchro[gnss_synchro_iter->second.Channel_ID]=gnss_synchro_iter->second;
current_gnss_synchro[gnss_synchro_iter->second.Channel_ID].Pseudorange_m = pseudorange_m; current_gnss_synchro[gnss_synchro_iter->second.Channel_ID].Pseudorange_m = pseudorange_m;
current_gnss_synchro[gnss_synchro_iter->second.Channel_ID].Pseudorange_symbol_shift = (double)current_symbol; // number of symbols shifted from preamble start symbol current_gnss_synchro[gnss_synchro_iter->second.Channel_ID].Pseudorange_symbol_shift = (double)current_symbol; // number of symbols shifted from preamble start symbol
current_gnss_synchro[gnss_synchro_iter->second.Channel_ID].Flag_valid_pseudorange = true; current_gnss_synchro[gnss_synchro_iter->second.Channel_ID].Flag_valid_pseudorange = true;
current_gnss_synchro[gnss_synchro_iter->second.Channel_ID].Pseudorange_timestamp_ms=max_symbol_timestamp_ms; current_gnss_synchro[gnss_synchro_iter->second.Channel_ID].Pseudorange_timestamp_ms=max_symbol_timestamp_ms;
} }
} }
} }

View File

@ -33,7 +33,9 @@
#define GNSS_SDR_GPS_L1_CA_H_ #define GNSS_SDR_GPS_L1_CA_H_
#include <complex> #include <complex>
#include <vector>
#include <gnss_satellite.h> #include <gnss_satellite.h>
//#include <initializer_list>
// Physical constants // Physical constants
const double GPS_C_m_s = 299792458.0; //!< The speed of light, [m/s] const double GPS_C_m_s = 299792458.0; //!< The speed of light, [m/s]
@ -81,19 +83,25 @@ const int GPS_WORD_BITS=30; //!< Number of bits per word in t
/*! /*!
* \brief Navigation message bits slice structure: A portion of bits is indicated by * \brief Navigation message bits slice structure: A portion of bits is indicated by
* the start position inside the subframe and the length in number of bits */ * the start position inside the subframe and the length in number of bits
typedef struct bits_slice * */
typedef struct bits_slice_struct
{ {
int position; int position;
int length; int length;
bits_slice(int p,int l) bits_slice_struct(int p,int l)
{ {
position=p; position=p;
length=l; length=l;
} }
} bits_slice; } bits_slice_struct;
typedef std::vector<bits_slice_struct> bits_slice;
/* Constants for scaling the ephemeris found in the data message /* Constants for scaling the ephemeris found in the data message
the format is the following: TWO_N5 -> 2^-5, TWO_P4 -> 2^4, PI_TWO_N43 -> Pi*2^-43, etc etc the format is the following: TWO_N5 -> 2^-5, TWO_P4 -> 2^4, PI_TWO_N43 -> Pi*2^-43, etc etc
Additionally some of the PI*2^N terms are used in the tracking stuff Additionally some of the PI*2^N terms are used in the tracking stuff
@ -146,130 +154,130 @@ const double PI_TWO_N23 =(3.745070282923929e-007); //!< Pi*2^-2
// SUBFRAME 1-5 (TLM and HOW) // SUBFRAME 1-5 (TLM and HOW)
const bits_slice TOW[]= {{31,17}}; const bits_slice TOW = { {31,17} };
const bits_slice INTEGRITY_STATUS_FLAG[] = {{23,1}}; const bits_slice INTEGRITY_STATUS_FLAG = {{23,1}};
const bits_slice ALERT_FLAG[] = {{48,1}}; const bits_slice ALERT_FLAG = {{48,1}};
const bits_slice ANTI_SPOOFING_FLAG[] = {{49,1}}; const bits_slice ANTI_SPOOFING_FLAG = {{49,1}};
const bits_slice SUBFRAME_ID[]= {{50,3}}; const bits_slice SUBFRAME_ID= {{50,3}};
// SUBFRAME 1 // SUBFRAME 1
const bits_slice GPS_WEEK[]= {{61,10}}; const bits_slice GPS_WEEK= {{61,10}};
const bits_slice CA_OR_P_ON_L2[]= {{71,2}}; //* const bits_slice CA_OR_P_ON_L2= {{71,2}}; //*
const bits_slice SV_ACCURACY[]= {{73,4}}; const bits_slice SV_ACCURACY= {{73,4}};
const bits_slice SV_HEALTH[]= {{77,6}}; const bits_slice SV_HEALTH= {{77,6}};
const bits_slice L2_P_DATA_FLAG[] = {{91,1}}; const bits_slice L2_P_DATA_FLAG = {{91,1}};
const bits_slice T_GD[]= {{197,8}}; const bits_slice T_GD= {{197,8}};
const double T_GD_LSB=TWO_N31; const double T_GD_LSB=TWO_N31;
const bits_slice IODC[]= {{83,2},{211,8}}; const bits_slice IODC= {{83,2},{211,8}};
const bits_slice T_OC[]= {{219,16}}; const bits_slice T_OC= {{219,16}};
const double T_OC_LSB=TWO_P4; const double T_OC_LSB=TWO_P4;
const bits_slice A_F2[]= {{241,8}}; const bits_slice A_F2= {{241,8}};
const double A_F2_LSB=TWO_N55; const double A_F2_LSB=TWO_N55;
const bits_slice A_F1[]= {{249,16}}; const bits_slice A_F1= {{249,16}};
const double A_F1_LSB=TWO_N43; const double A_F1_LSB=TWO_N43;
const bits_slice A_F0[]= {{271,22}}; const bits_slice A_F0= {{271,22}};
const double A_F0_LSB=TWO_N31; const double A_F0_LSB=TWO_N31;
// SUBFRAME 2 // SUBFRAME 2
const bits_slice IODE_SF2[]= {{61,8}}; const bits_slice IODE_SF2= {{61,8}};
const bits_slice C_RS[]= {{69,16}}; const bits_slice C_RS= {{69,16}};
const double C_RS_LSB=TWO_N5; const double C_RS_LSB=TWO_N5;
const bits_slice DELTA_N[]= {{91,16}}; const bits_slice DELTA_N= {{91,16}};
const double DELTA_N_LSB=PI_TWO_N43; const double DELTA_N_LSB=PI_TWO_N43;
const bits_slice M_0[]= {{107,8},{121,24}}; const bits_slice M_0= {{107,8},{121,24}};
const double M_0_LSB=PI_TWO_N31; const double M_0_LSB=PI_TWO_N31;
const bits_slice C_UC[]= {{151,16}}; const bits_slice C_UC= {{151,16}};
const double C_UC_LSB=TWO_N29; const double C_UC_LSB=TWO_N29;
const bits_slice E[]= {{167,8},{181,24}}; const bits_slice E= {{167,8},{181,24}};
const double E_LSB=TWO_N33; const double E_LSB=TWO_N33;
const bits_slice C_US[]= {{211,16}}; const bits_slice C_US= {{211,16}};
const double C_US_LSB=TWO_N29; const double C_US_LSB=TWO_N29;
const bits_slice SQRT_A[]= {{227,8},{241,24}}; const bits_slice SQRT_A= {{227,8},{241,24}};
const double SQRT_A_LSB=TWO_N19; const double SQRT_A_LSB=TWO_N19;
const bits_slice T_OE[]= {{271,16}}; const bits_slice T_OE= {{271,16}};
const double T_OE_LSB=TWO_P4; const double T_OE_LSB=TWO_P4;
const bits_slice FIT_INTERVAL_FLAG[]= {{271,1}}; const bits_slice FIT_INTERVAL_FLAG= {{271,1}};
const bits_slice AODO[] = {{272,5}}; const bits_slice AODO = {{272,5}};
const int AODO_LSB = 900; const int AODO_LSB = 900;
// SUBFRAME 3 // SUBFRAME 3
const bits_slice C_IC[]= {{61,16}}; const bits_slice C_IC= {{61,16}};
const double C_IC_LSB=TWO_N29; const double C_IC_LSB=TWO_N29;
const bits_slice OMEGA_0[]= {{77,8},{91,24}}; const bits_slice OMEGA_0 = {{77,8},{91,24}};
const double OMEGA_0_LSB=PI_TWO_N31; const double OMEGA_0_LSB=PI_TWO_N31;
const bits_slice C_IS[]= {{121,16}}; const bits_slice C_IS = {{121,16}};
const double C_IS_LSB=TWO_N29; const double C_IS_LSB=TWO_N29;
const bits_slice I_0[]= {{137,8},{151,24}}; const bits_slice I_0 = {{137,8},{151,24}};
const double I_0_LSB=PI_TWO_N31; const double I_0_LSB=PI_TWO_N31;
const bits_slice C_RC[]= {{181,16}}; const bits_slice C_RC = {{181,16}};
const double C_RC_LSB=TWO_N5; const double C_RC_LSB=TWO_N5;
const bits_slice OMEGA[]= {{197,8},{211,24}}; const bits_slice OMEGA = {{197,8},{211,24}};
const double OMEGA_LSB=PI_TWO_N31; const double OMEGA_LSB=PI_TWO_N31;
const bits_slice OMEGA_DOT[]= {{241,24}}; const bits_slice OMEGA_DOT = {{241,24}};
const double OMEGA_DOT_LSB=PI_TWO_N43; const double OMEGA_DOT_LSB=PI_TWO_N43;
const bits_slice IODE_SF3[]= {{271,8}}; const bits_slice IODE_SF3 = {{271,8}};
const bits_slice I_DOT[]= {{279,14}}; const bits_slice I_DOT = {{279,14}};
const double I_DOT_LSB=PI_TWO_N43; const double I_DOT_LSB=PI_TWO_N43;
// SUBFRAME 4-5 // SUBFRAME 4-5
const bits_slice SV_DATA_ID[]= {{61,2}}; const bits_slice SV_DATA_ID = {{61,2}};
const bits_slice SV_PAGE[]= {{63,6}}; const bits_slice SV_PAGE = {{63,6}};
// SUBFRAME 4 // SUBFRAME 4
//! \todo read all pages of subframe 4 //! \todo read all pages of subframe 4
// Page 18 - Ionospheric and UTC data // Page 18 - Ionospheric and UTC data
const bits_slice ALPHA_0[]= {{69,8}}; const bits_slice ALPHA_0 = {{69,8}};
const double ALPHA_0_LSB=TWO_N30; const double ALPHA_0_LSB=TWO_N30;
const bits_slice ALPHA_1[]= {{77,8}}; const bits_slice ALPHA_1 = {{77,8}};
const double ALPHA_1_LSB=TWO_N27; const double ALPHA_1_LSB=TWO_N27;
const bits_slice ALPHA_2[]= {{91,8}}; const bits_slice ALPHA_2 = {{91,8}};
const double ALPHA_2_LSB=TWO_N24; const double ALPHA_2_LSB=TWO_N24;
const bits_slice ALPHA_3[]= {{99,8}}; const bits_slice ALPHA_3 = {{99,8}};
const double ALPHA_3_LSB=TWO_N24; const double ALPHA_3_LSB=TWO_N24;
const bits_slice BETA_0[]= {{107,8}}; const bits_slice BETA_0 = {{107,8}};
const double BETA_0_LSB=TWO_P11; const double BETA_0_LSB=TWO_P11;
const bits_slice BETA_1[]= {{121,8}}; const bits_slice BETA_1 = {{121,8}};
const double BETA_1_LSB=TWO_P14; const double BETA_1_LSB=TWO_P14;
const bits_slice BETA_2[]= {{129,8}}; const bits_slice BETA_2 = {{129,8}};
const double BETA_2_LSB=TWO_P16; const double BETA_2_LSB=TWO_P16;
const bits_slice BETA_3[]= {{137,8}}; const bits_slice BETA_3 = {{137,8}};
const double BETA_3_LSB=TWO_P16; const double BETA_3_LSB=TWO_P16;
const bits_slice A_1[]= {{151,24}}; const bits_slice A_1 = {{151,24}};
const double A_1_LSB=TWO_N50; const double A_1_LSB=TWO_N50;
const bits_slice A_0[]= {{181,24},{211,8}}; const bits_slice A_0 = {{181,24},{211,8}};
const double A_0_LSB=TWO_N30; const double A_0_LSB=TWO_N30;
const bits_slice T_OT[]= {{219,8}}; const bits_slice T_OT = {{219,8}};
const double T_OT_LSB=TWO_P12; const double T_OT_LSB=TWO_P12;
const bits_slice WN_T[]= {{227,8}}; const bits_slice WN_T = {{227,8}};
const double WN_T_LSB = 1; const double WN_T_LSB = 1;
const bits_slice DELTAT_LS[]= {{241,8}}; const bits_slice DELTAT_LS = {{241,8}};
const double DELTAT_LS_LSB = 1; const double DELTAT_LS_LSB = 1;
const bits_slice WN_LSF[]= {{249,8}}; const bits_slice WN_LSF = {{249,8}};
const double WN_LSF_LSB = 1; const double WN_LSF_LSB = 1;
const bits_slice DN[]= {{257,8}}; const bits_slice DN = {{257,8}};
const double DN_LSB = 1; const double DN_LSB = 1;
const bits_slice DELTAT_LSF[]= {{271,8}}; const bits_slice DELTAT_LSF = {{271,8}};
const double DELTAT_LSF_LSB = 1; const double DELTAT_LSF_LSB = 1;
// Page 25 - Antispoofing, SV config and SV health (PRN 25 -32) // Page 25 - Antispoofing, SV config and SV health (PRN 25 -32)
const bits_slice HEALTH_SV25[]={{229,6}}; const bits_slice HEALTH_SV25 ={{229,6}};
const bits_slice HEALTH_SV26[]={{241,6}}; const bits_slice HEALTH_SV26 ={{241,6}};
const bits_slice HEALTH_SV27[]={{247,6}}; const bits_slice HEALTH_SV27 ={{247,6}};
const bits_slice HEALTH_SV28[]={{253,6}}; const bits_slice HEALTH_SV28 ={{253,6}};
const bits_slice HEALTH_SV29[]={{259,6}}; const bits_slice HEALTH_SV29 ={{259,6}};
const bits_slice HEALTH_SV30[]={{271,6}}; const bits_slice HEALTH_SV30 ={{271,6}};
const bits_slice HEALTH_SV31[]={{277,6}}; const bits_slice HEALTH_SV31 ={{277,6}};
const bits_slice HEALTH_SV32[]={{283,6}}; const bits_slice HEALTH_SV32 ={{283,6}};
@ -280,33 +288,33 @@ const bits_slice HEALTH_SV32[]={{283,6}};
// page 25 - Health (PRN 1 - 24) // page 25 - Health (PRN 1 - 24)
const bits_slice T_OA[]={{69,8}}; const bits_slice T_OA ={{69,8}};
const double T_OA_LSB = TWO_P12; const double T_OA_LSB = TWO_P12;
const bits_slice WN_A[]={{77,8}}; const bits_slice WN_A ={{77,8}};
const bits_slice HEALTH_SV1[]={{91,6}}; const bits_slice HEALTH_SV1 ={{91,6}};
const bits_slice HEALTH_SV2[]={{97,6}}; const bits_slice HEALTH_SV2 ={{97,6}};
const bits_slice HEALTH_SV3[]={{103,6}}; const bits_slice HEALTH_SV3 ={{103,6}};
const bits_slice HEALTH_SV4[]={{109,6}}; const bits_slice HEALTH_SV4 ={{109,6}};
const bits_slice HEALTH_SV5[]={{121,6}}; const bits_slice HEALTH_SV5 ={{121,6}};
const bits_slice HEALTH_SV6[]={{127,6}}; const bits_slice HEALTH_SV6 ={{127,6}};
const bits_slice HEALTH_SV7[]={{133,6}}; const bits_slice HEALTH_SV7 ={{133,6}};
const bits_slice HEALTH_SV8[]={{139,6}}; const bits_slice HEALTH_SV8 ={{139,6}};
const bits_slice HEALTH_SV9[]={{151,6}}; const bits_slice HEALTH_SV9 ={{151,6}};
const bits_slice HEALTH_SV10[]={{157,6}}; const bits_slice HEALTH_SV10 ={{157,6}};
const bits_slice HEALTH_SV11[]={{163,6}}; const bits_slice HEALTH_SV11 ={{163,6}};
const bits_slice HEALTH_SV12[]={{169,6}}; const bits_slice HEALTH_SV12 ={{169,6}};
const bits_slice HEALTH_SV13[]={{181,6}}; const bits_slice HEALTH_SV13 ={{181,6}};
const bits_slice HEALTH_SV14[]={{187,6}}; const bits_slice HEALTH_SV14 ={{187,6}};
const bits_slice HEALTH_SV15[]={{193,6}}; const bits_slice HEALTH_SV15 ={{193,6}};
const bits_slice HEALTH_SV16[]={{199,6}}; const bits_slice HEALTH_SV16 ={{199,6}};
const bits_slice HEALTH_SV17[]={{211,6}}; const bits_slice HEALTH_SV17 ={{211,6}};
const bits_slice HEALTH_SV18[]={{217,6}}; const bits_slice HEALTH_SV18 ={{217,6}};
const bits_slice HEALTH_SV19[]={{223,6}}; const bits_slice HEALTH_SV19 ={{223,6}};
const bits_slice HEALTH_SV20[]={{229,6}}; const bits_slice HEALTH_SV20 ={{229,6}};
const bits_slice HEALTH_SV21[]={{241,6}}; const bits_slice HEALTH_SV21 ={{241,6}};
const bits_slice HEALTH_SV22[]={{247,6}}; const bits_slice HEALTH_SV22 ={{247,6}};
const bits_slice HEALTH_SV23[]={{253,6}}; const bits_slice HEALTH_SV23 ={{253,6}};
const bits_slice HEALTH_SV24[]={{259,6}}; const bits_slice HEALTH_SV24 ={{259,6}};
/* /*

View File

@ -1,64 +0,0 @@
/*!
* \file gnss_synchro.cc
* \brief Implementation of the Gnss_Synchro class
* \author
* Luis Esteve, 2012. luis(at)epsilon-formacion.com
* Javier Arribas, 2012. jarribas(at)cttc.es
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#include "gnss_synchro.h"
Gnss_Synchro::Gnss_Synchro()
{
PRN = 0;
// Acquisition
Acq_delay_samples = 0.0;
Acq_doppler_hz = 0.0;
Acq_samplestamp_samples = 0;
Flag_valid_acquisition = false;
//Tracking
Prompt_I = 0.0;
Prompt_Q = 0.0;
Carrier_phase_rads = 0.0;
Code_phase_secs = 0.0;
Tracking_timestamp_secs = 0.0;
CN0_dB_hz = 0.0;
Flag_valid_tracking = false;
//Telemetry Decoder
Preamble_timestamp_ms = 0.0;
Prn_timestamp_ms = 0.0;
Channel_ID = 0;
Flag_valid_word = false;
Flag_preamble = false;
// Pseudorange
Pseudorange_m = 0.0;
Pseudorange_symbol_shift = 0.0;
Flag_valid_pseudorange = false;
}
Gnss_Synchro::~Gnss_Synchro()
{}

View File

@ -37,11 +37,11 @@
* \brief This is the class that contains the information that is shared * \brief This is the class that contains the information that is shared
* by the processing blocks. * by the processing blocks.
*/ */
class Gnss_Synchro class Gnss_Synchro
{ {
public: public:
Gnss_Synchro(); //reset();
~Gnss_Synchro(); //~Gnss_Synchro();
// Satellite and signal info // Satellite and signal info
char System; //!< Set by Channel::set_signal(Gnss_Signal gnss_signal) char System; //!< Set by Channel::set_signal(Gnss_Signal gnss_signal)
char Signal[3]; //!< Set by Channel::set_signal(Gnss_Signal gnss_signal) char Signal[3]; //!< Set by Channel::set_signal(Gnss_Signal gnss_signal)

View File

@ -197,11 +197,12 @@ void Gps_Navigation_Message::print_gps_word_bytes(unsigned int GPS_word)
bool Gps_Navigation_Message::read_navigation_bool(std::bitset<GPS_SUBFRAME_BITS> bits, const bits_slice *slices) bool Gps_Navigation_Message::read_navigation_bool(std::bitset<GPS_SUBFRAME_BITS> bits, const bits_slice slices)
{ {
bool value; bool value;
if (bits[GPS_SUBFRAME_BITS - slices[0].position] == 1) //if (bits[GPS_SUBFRAME_BITS - slices->front().position] == 1)
if (bits[GPS_SUBFRAME_BITS - slices.at(0).position] == 1)
{ {
value = true; value = true;
} }
@ -217,17 +218,16 @@ bool Gps_Navigation_Message::read_navigation_bool(std::bitset<GPS_SUBFRAME_BITS>
unsigned long int Gps_Navigation_Message::read_navigation_unsigned(std::bitset<GPS_SUBFRAME_BITS> bits, const bits_slice *slices, int num_of_slices) unsigned long int Gps_Navigation_Message::read_navigation_unsigned(std::bitset<GPS_SUBFRAME_BITS> bits, const bits_slice slices, int num_of_slices)
{ {
unsigned long int value; unsigned long int value;
value = 0; value = 0;
for (int i=0; i<num_of_slices; i++) for (int i=0; i<num_of_slices; i++)
{ {
for (int j=0; j<slices[i].length; j++) for (int j=0; j<slices.at(i).length; j++)
{ {
value <<= 1; //shift left value <<= 1; //shift left
if (bits[GPS_SUBFRAME_BITS - slices[i].position - j] == 1) if (bits[GPS_SUBFRAME_BITS - slices.at(i).position - j] == 1)
{ {
value += 1; // insert the bit value += 1; // insert the bit
} }
@ -241,12 +241,12 @@ unsigned long int Gps_Navigation_Message::read_navigation_unsigned(std::bitset<G
signed long int Gps_Navigation_Message::read_navigation_signed(std::bitset<GPS_SUBFRAME_BITS> bits, const bits_slice *slices, int num_of_slices) signed long int Gps_Navigation_Message::read_navigation_signed(std::bitset<GPS_SUBFRAME_BITS> bits, const bits_slice slices, int num_of_slices)
{ {
signed long int value = 0; signed long int value = 0;
// read the MSB and perform the sign extension // read the MSB and perform the sign extension
if (bits[GPS_SUBFRAME_BITS-slices[0].position]==1) if (bits[GPS_SUBFRAME_BITS-slices.at(0).position]==1)
{ {
value^=0xFFFFFFFF; value^=0xFFFFFFFF;
} }
@ -257,11 +257,11 @@ signed long int Gps_Navigation_Message::read_navigation_signed(std::bitset<GPS_S
for (int i=0; i<num_of_slices; i++) for (int i=0; i<num_of_slices; i++)
{ {
for (int j=0; j<slices[i].length; j++) for (int j=0; j<slices.at(i).length; j++)
{ {
value<<=1; //shift left value<<=1; //shift left
value&=0xFFFFFFFE; //reset the corresponding bit value&=0xFFFFFFFE; //reset the corresponding bit
if (bits[GPS_SUBFRAME_BITS - slices[i].position-j] == 1) if (bits[GPS_SUBFRAME_BITS - slices.at(i).position-j] == 1)
{ {
value+=1; // insert the bit value+=1; // insert the bit
} }

View File

@ -54,9 +54,9 @@ class Gps_Navigation_Message
{ {
private: private:
unsigned long int read_navigation_unsigned(std::bitset<GPS_SUBFRAME_BITS> bits, const bits_slice *slices, int num_of_slices); unsigned long int read_navigation_unsigned(std::bitset<GPS_SUBFRAME_BITS> bits, const bits_slice slices, int num_of_slices);
signed long int read_navigation_signed(std::bitset<GPS_SUBFRAME_BITS> bits, const bits_slice *slices, int num_of_slices); signed long int read_navigation_signed(std::bitset<GPS_SUBFRAME_BITS> bits, const bits_slice slices, int num_of_slices);
bool read_navigation_bool(std::bitset<GPS_SUBFRAME_BITS> bits, const bits_slice *slices); bool read_navigation_bool(std::bitset<GPS_SUBFRAME_BITS> bits, const bits_slice slices);
void print_gps_word_bytes(unsigned int GPS_word); void print_gps_word_bytes(unsigned int GPS_word);
/* /*

View File

@ -3,4 +3,4 @@ project : build-dir ../../../build ;
obj gps_navigation_message : gps_navigation_message.cc ; obj gps_navigation_message : gps_navigation_message.cc ;
obj gnss_satellite : gnss_satellite.cc ; obj gnss_satellite : gnss_satellite.cc ;
obj gnss_signal : gnss_signal.cc ; obj gnss_signal : gnss_signal.cc ;
obj gnss_synchro : gnss_synchro.cc ; #obj gnss_synchro : gnss_synchro.hpp ;

View File

@ -57,12 +57,11 @@ exe gnss-sdr : main.cc
../core/system_parameters//gps_navigation_message ../core/system_parameters//gps_navigation_message
../core/system_parameters//gnss_satellite ../core/system_parameters//gnss_satellite
../core/system_parameters//gnss_signal ../core/system_parameters//gnss_signal
../core/system_parameters//gnss_synchro #../core/system_parameters//gnss_synchro
../..//gflags ../..//gflags
../..//glog ../..//glog
../..//gnuradio-core ../..//gnuradio-core
../..//uhd ../..//uhd
../..//gnuradio-uhd ; ../..//gnuradio-uhd ;
#../..//gnuradio-usrp ;
install ../../install : gnss-sdr ; install ../../install : gnss-sdr ;

View File

@ -108,8 +108,8 @@ int main(int argc, char** argv)
// report the elapsed time // report the elapsed time
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 " << ((double)(end - begin))/1000000.0<< " [seconds]"<< std::endl; std::cout << "Total GNSS-SDR run time " << ((double)(end - begin))/1000000.0 << " [seconds]" << std::endl;
google::ShutDownCommandLineFlags(); google::ShutDownCommandLineFlags();
std::cout<<"GNSS-SDR program ended"<<std::endl; std::cout << "GNSS-SDR program ended." << std::endl;
} }

View File

@ -58,7 +58,7 @@ exe run_tests : test_main.cc
../core/system_parameters//gps_navigation_message ../core/system_parameters//gps_navigation_message
../core/system_parameters//gnss_satellite ../core/system_parameters//gnss_satellite
../core/system_parameters//gnss_signal ../core/system_parameters//gnss_signal
../core/system_parameters//gnss_synchro #../core/system_parameters//gnss_synchro
../..//gflags ../..//gflags
../..//glog ../..//glog
../..//gnuradio-core ../..//gnuradio-core