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

Enabled hybrid pseudorange generation

This commit is contained in:
marabra 2014-06-13 18:38:16 +02:00
parent b0d33328d5
commit bf03c7a374
7 changed files with 69 additions and 29 deletions

View File

@ -99,6 +99,10 @@ bool Hybrid_pairCompare_gnss_synchro_Prn_delay_ms( std::pair<int,Gnss_Synchro> a
}
bool Hybrid_pairCompare_gnss_synchro_d_TOW_hybrid_at_current_symbol( std::pair<int,Gnss_Synchro> a, std::pair<int,Gnss_Synchro> b)
{
return (a.second.d_TOW_hybrid_at_current_symbol) < (b.second.d_TOW_hybrid_at_current_symbol);
}
bool Hybrid_pairCompare_gnss_synchro_d_TOW_at_current_symbol( std::pair<int,Gnss_Synchro> a, std::pair<int,Gnss_Synchro> b)
{
@ -106,7 +110,6 @@ bool Hybrid_pairCompare_gnss_synchro_d_TOW_at_current_symbol( std::pair<int,Gnss
}
int hybrid_observables_cc::general_work (int noutput_items, gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
@ -148,30 +151,32 @@ int hybrid_observables_cc::general_work (int noutput_items, gr_vector_int &ninpu
* common RX time algorithm
*/
// what is the most recent symbol TOW in the current set? -> this will be the reference symbol
// gnss_synchro_iter = max_element(current_gnss_synchro_map.begin(), current_gnss_synchro_map.end(), Hybrid_pairCompare_gnss_synchro_d_TOW_at_current_symbol);
// double d_TOW_reference = gnss_synchro_iter->second.d_TOW_at_current_symbol;
// double d_ref_PRN_rx_time_ms = gnss_synchro_iter->second.Prn_timestamp_ms;
gnss_synchro_iter = max_element(current_gnss_synchro_map.begin(), current_gnss_synchro_map.end(), Hybrid_pairCompare_gnss_synchro_d_TOW_hybrid_at_current_symbol);
double d_TOW_reference = gnss_synchro_iter->second.d_TOW_hybrid_at_current_symbol;
std::cout<<"d_TOW_hybrid_reference [ms] = "<< d_TOW_reference*1000 <<std::endl;
double d_ref_PRN_rx_time_ms = gnss_synchro_iter->second.Prn_timestamp_ms;
std::cout<<"ref_PRN_rx_time_ms [ms] = "<< d_ref_PRN_rx_time_ms <<std::endl;
//int reference_channel= gnss_synchro_iter->second.Channel_ID;
// Now compute RX time differences due to the PRN alignment in the correlators
// double traveltime_ms;
// double pseudorange_m;
// double delta_rx_time_ms;
for(gnss_synchro_iter = current_gnss_synchro_map.begin(); gnss_synchro_iter != current_gnss_synchro_map.end(); gnss_synchro_iter++)
double traveltime_ms;
double pseudorange_m;
double delta_rx_time_ms;
for(gnss_synchro_iter = current_gnss_synchro_map.begin(); gnss_synchro_iter != current_gnss_synchro_map.end(); gnss_synchro_iter++)
{
// compute the required symbol history shift in order to match the reference symbol
delta_rx_time_ms = gnss_synchro_iter->second.Prn_timestamp_ms-d_ref_PRN_rx_time_ms;
//compute the pseudorange
traveltime_ms = (d_TOW_reference - gnss_synchro_iter->second.d_TOW_hybrid_at_current_symbol)*1000.0 + delta_rx_time_ms + GALILEO_STARTOFFSET_ms;
pseudorange_m = traveltime_ms * GALILEO_C_m_ms; // [m]
std::cout<<"CH "<<gnss_synchro_iter->second.Channel_ID<<" tracking GNSS System "<<gnss_synchro_iter->second.System<<" has PRN start at= "<<gnss_synchro_iter->second.Prn_timestamp_ms<<" [ms], d_TOW_at_current_symbol = "<<(gnss_synchro_iter->second.d_TOW_at_current_symbol)*1000<<" [ms], d_TOW_hybrid_at_current_symbol = "<<(gnss_synchro_iter->second.d_TOW_hybrid_at_current_symbol)*1000<<"[ms], delta_rx_time_ms = "<< delta_rx_time_ms << "[ms], travel_time = " << traveltime_ms << ", pseudorange[m] = "<< pseudorange_m << std::endl;
// 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].Pseudorange_m = pseudorange_m;
current_gnss_synchro[gnss_synchro_iter->second.Channel_ID].Flag_valid_pseudorange = true;
current_gnss_synchro[gnss_synchro_iter->second.Channel_ID].d_TOW_hybrid_at_current_symbol = round(d_TOW_reference*1000)/1000 + GALILEO_STARTOFFSET_ms/1000.0;
std::cout<<"CH "<<gnss_synchro_iter->second.Channel_ID<<" tracking GNSS System "<<gnss_synchro_iter->second.System<<" has PRN start at= "<<gnss_synchro_iter->second.Prn_timestamp_ms<<" [ms]"<<std::endl;
// // compute the required symbol history shift in order to match the reference symbol
// delta_rx_time_ms = gnss_synchro_iter->second.Prn_timestamp_ms-d_ref_PRN_rx_time_ms;
// //compute the pseudorange
// traveltime_ms = (d_TOW_reference - gnss_synchro_iter->second.d_TOW_at_current_symbol)*1000.0 + delta_rx_time_ms + GALILEO_STARTOFFSET_ms;
// pseudorange_m = traveltime_ms * GALILEO_C_m_ms; // [m]
// // 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].Pseudorange_m = pseudorange_m;
// current_gnss_synchro[gnss_synchro_iter->second.Channel_ID].Flag_valid_pseudorange = true;
// current_gnss_synchro[gnss_synchro_iter->second.Channel_ID].d_TOW_at_current_symbol = round(d_TOW_reference*1000)/1000 + GALILEO_STARTOFFSET_ms/1000.0;
//
}
std::cout<<std::endl;
}
@ -205,11 +210,11 @@ int hybrid_observables_cc::general_work (int noutput_items, gr_vector_int &ninpu
consume_each(1); //consume one by one
// for (unsigned int i = 0; i < d_nchannels ; i++)
// {
// *out[i] = current_gnss_synchro[i];
// }
for (unsigned int i = 0; i < d_nchannels ; i++)
{
*out[i] = current_gnss_synchro[i];
}
//todo: enable output when the hybrid algorithm is completed
return 0; //Output the observables
return 1; //Output the observables
}

View File

@ -169,7 +169,7 @@ galileo_e1b_telemetry_decoder_cc::galileo_e1b_telemetry_decoder_cc(
d_flag_parity = false;
d_TOW_at_Preamble = 0;
d_TOW_at_current_symbol = 0;
delta_t = 0;
d_CRC_error_counter = 0;
}
@ -193,7 +193,7 @@ void galileo_e1b_telemetry_decoder_cc::decode_word(double *page_part_symbols,int
// 2. Viterbi decoder
// 2.1 Take into account the NOT gate in G2 polynomial (Galileo ICD Figure 13, FEC encoder)
// 2.2 Take into account the possible inversion of the polarity due to PLL lock at 180¼
// 2.2 Take into account the possible inversion of the polarity due to PLL lock at 180<EFBFBD>
for (int i = 0; i < frame_length; i++)
{
if ((i + 1) % 2 == 0)
@ -278,7 +278,7 @@ void galileo_e1b_telemetry_decoder_cc::decode_word(double *page_part_symbols,int
std::cout<<"d_TOW_at_current_symbol="<<d_TOW_at_current_symbol<<std::endl;
std::cout<<"d_nav.WN_0="<<d_nav.WN_0<<std::endl;
double delta_t;
//double delta_t; declared out of this function to be used in the observable block
delta_t=almanac.A_0G_10+almanac.A_1G_10*(d_TOW_at_current_symbol-almanac.t_0G_10+604800*(fmod((d_nav.WN_0-almanac.WN_0G_10),64)));
std::cout<<"delta_t="<<delta_t<<"[s]"<<std::endl;
@ -445,9 +445,10 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items, gr_vector
}
else
{
//this page has no timming information
//this page has no timing information
d_TOW_at_Preamble = d_TOW_at_Preamble + GALILEO_INAV_PAGE_SECONDS;
d_TOW_at_current_symbol = d_TOW_at_current_symbol + GALIELO_E1_CODE_PERIOD;// + GALILEO_INAV_PAGE_PART_SYMBOLS*GALIELO_E1_CODE_PERIOD;
}
}
@ -457,6 +458,14 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items, gr_vector
}
//if (d_flag_frame_sync == true and d_nav.flag_TOW_set==true and d_nav.flag_CRC_test == true)
if(d_nav.flag_GGTO_1 == true and d_nav.flag_GGTO_2 == true and d_nav.flag_GGTO_3 == true and d_nav.flag_GGTO_4 == true) //all GGTO parameters arrived
{
delta_t=d_nav.A_0G_10+d_nav.A_1G_10*(d_TOW_at_current_symbol-d_nav.t_0G_10+604800*(fmod((d_nav.WN_0-d_nav.WN_0G_10),64)));
}
if (d_flag_frame_sync == true and d_nav.flag_TOW_set == true)
{
current_synchro_data.Flag_valid_word = true;
@ -466,8 +475,12 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items, gr_vector
current_synchro_data.Flag_valid_word = false;
}
current_synchro_data.d_TOW = d_TOW_at_Preamble;
current_synchro_data.d_TOW_at_current_symbol = d_TOW_at_current_symbol;
current_synchro_data.d_TOW_hybrid_at_current_symbol= current_synchro_data.d_TOW_at_current_symbol - delta_t; //delta_t = t_gal - t_gps ----> t_gps = t_gal -delta_t
std::cout<< "delta_t = " << delta_t << std::endl;
current_synchro_data.Flag_preamble = d_flag_preamble;
current_synchro_data.Prn_timestamp_ms = in[0][0].Tracking_timestamp_secs * 1000.0;
current_synchro_data.Prn_timestamp_at_preamble_ms = Prn_timestamp_at_preamble_ms;

View File

@ -138,6 +138,8 @@ private:
double d_TOW_at_current_symbol;
double Prn_timestamp_at_preamble_ms;
bool flag_TOW_set;
double delta_t; //GPS-GALILEO time offset
std::string d_dump_filename;
std::ofstream d_dump_file;

View File

@ -318,6 +318,8 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i
current_synchro_data.d_TOW = d_TOW_at_Preamble;
current_synchro_data.d_TOW_at_current_symbol = d_TOW_at_current_symbol;
current_synchro_data.d_TOW_hybrid_at_current_symbol= current_synchro_data.d_TOW_at_current_symbol; // to be used in the hybrid configuration
current_synchro_data.Flag_valid_word = (d_flag_frame_sync == true and d_flag_parity == true and flag_TOW_set==true);
current_synchro_data.Flag_preamble = d_flag_preamble;
current_synchro_data.Prn_timestamp_ms = in[0][0].Tracking_timestamp_secs * 1000.0;

View File

@ -66,6 +66,12 @@ void Galileo_Navigation_Message::reset()
flag_TOW_5 = 0;
flag_TOW_set = false;
flag_GGTO= false;
flag_GGTO_1= false;
flag_GGTO_2= false;
flag_GGTO_3= false;
flag_GGTO_4= false;
IOD_ephemeris = 0;
/*Word type 1: Ephemeris (1/4)*/
IOD_nav_1 = 0;
@ -974,14 +980,18 @@ int Galileo_Navigation_Message::page_jk_decoder(const char *data_jk)
DLOG(INFO) << "E1B_HS_10= " << E1B_HS_10;
A_0G_10 = (double)read_navigation_signed(data_jk_bits, A_0G_10_bit);
A_0G_10 = A_0G_10 * A_0G_10_LSB;
flag_GGTO_1=true;
DLOG(INFO) << "A_0G_10= " << A_0G_10;
A_1G_10 = (double)read_navigation_signed(data_jk_bits, A_1G_10_bit);
A_1G_10 = A_1G_10 * A_1G_10_LSB;
flag_GGTO_2=true;
DLOG(INFO) << "A_1G_10= " << A_1G_10;
t_0G_10 = (double)read_navigation_unsigned(data_jk_bits, t_0G_10_bit);
t_0G_10 = t_0G_10 * t_0G_10_LSB;
flag_GGTO_3=true;
DLOG(INFO) << "t_0G_10= " << t_0G_10;
WN_0G_10 = (double)read_navigation_unsigned(data_jk_bits, WN_0G_10_bit);
flag_GGTO_4=true;
DLOG(INFO) << "WN_0G_10= " << WN_0G_10;
flag_almanac_4 = true;
DLOG(INFO) << "flag_tow_set" << flag_TOW_set;

View File

@ -87,6 +87,12 @@ public:
int IOD_ephemeris;
bool flag_GGTO;
bool flag_GGTO_1;
bool flag_GGTO_2;
bool flag_GGTO_3;
bool flag_GGTO_4;
/*Word type 1: Ephemeris (1/4)*/
int IOD_nav_1; //!< IOD_nav page 1
double t0e_1; //!< Ephemeris reference time [s]

View File

@ -70,6 +70,8 @@ public:
bool Flag_preamble; //!< Set by Telemetry Decoder processing block
double d_TOW; //!< Set by Telemetry Decoder processing block
double d_TOW_at_current_symbol;
double d_TOW_hybrid_at_current_symbol; //Galileo TOW is expressed in the GPS time scale (it will be the same for any other constellation)
// Pseudorange
double Pseudorange_m;
bool Flag_valid_pseudorange;