From d72d853843230bb1e84d67c2f203c1aa44c7778f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 4 Mar 2015 16:15:59 +0100 Subject: [PATCH] Fixing reading of UTC and IONO data in Galileo --- .../PVT/gnuradio_blocks/galileo_e1_pvt_cc.cc | 52 ++++++++++-- .../PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc | 4 +- .../PVT/gnuradio_blocks/hybrid_pvt_cc.cc | 85 ++++++++++++++++--- 3 files changed, 123 insertions(+), 18 deletions(-) diff --git a/src/algorithms/PVT/gnuradio_blocks/galileo_e1_pvt_cc.cc b/src/algorithms/PVT/gnuradio_blocks/galileo_e1_pvt_cc.cc index fac0e5231..002dc51f8 100644 --- a/src/algorithms/PVT/gnuradio_blocks/galileo_e1_pvt_cc.cc +++ b/src/algorithms/PVT/gnuradio_blocks/galileo_e1_pvt_cc.cc @@ -155,22 +155,62 @@ int galileo_e1_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_it if (global_galileo_utc_model_map.size() > 0) { - // UTC MODEL data is shared for all the Galileo satellites. Read always at ID=0 - global_galileo_utc_model_map.read(0, d_ls_pvt->galileo_utc_model); + // UTC MODEL data is shared for all the Galileo satellites. Read always at a locked channel + signed int i = 0; + while(true) + { + if (in[i][0].Flag_valid_pseudorange == true) + { + global_galileo_utc_model_map.read(0, d_ls_pvt->galileo_utc_model); + break; + } + i++; + if (i == (signed int)d_nchannels - 1) + { + break; + } + } } if (global_galileo_iono_map.size() > 0) { - // IONO data is shared for all the Galileo satellites. Read always at ID=0 - global_galileo_iono_map.read(0, d_ls_pvt->galileo_iono); + // IONO data is shared for all Galileo satellites. Read always at a locked channel + signed int i = 0; + while(true) + { + if (in[i][0].Flag_valid_pseudorange == true) + { + global_galileo_iono_map.read(i, d_ls_pvt->galileo_iono); + break; + } + i++; + if (i == (signed int)d_nchannels - 1) + { + break; + } + } } if (global_galileo_almanac_map.size() > 0) { - // Almanac data is shared for all the Galileo satellites. Read always at ID=0 - global_galileo_almanac_map.read(0, d_ls_pvt->galileo_almanac); + // ALMANAC data is shared for all Galileo satellites. Read always at a locked channel + signed int i = 0; + while(true) + { + if (in[i][0].Flag_valid_pseudorange == true) + { + global_galileo_almanac_map.read(i, d_ls_pvt->galileo_almanac); + break; + } + i++; + if (i == (signed int)d_nchannels - 1) + { + break; + } + } } + // ############ 2 COMPUTE THE PVT ################################ if (gnss_pseudoranges_map.size() > 0 and d_ls_pvt->galileo_ephemeris_map.size() > 0) { diff --git a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc index 0532ae1a8..3402978e9 100644 --- a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc +++ b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc @@ -178,7 +178,7 @@ int gps_l1_ca_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_ite break; } i++; - if (i == d_nchannels - 1) + if (i == (signed int)d_nchannels - 1) { break; } @@ -197,7 +197,7 @@ int gps_l1_ca_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_ite break; } i++; - if (i == d_nchannels - 1) + if (i == (signed int)d_nchannels - 1) { break; } diff --git a/src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.cc b/src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.cc index e7389b726..436083a1f 100644 --- a/src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.cc +++ b/src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.cc @@ -164,20 +164,59 @@ int hybrid_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_items, if (global_galileo_utc_model_map.size() > 0) { - // UTC MODEL data is shared for all the Galileo satellites. Read always at ID=0 - global_galileo_utc_model_map.read(0, d_ls_pvt->galileo_utc_model); + // UTC MODEL data is shared for all the Galileo satellites. Read always at a locked channel + signed int i = 0; + while(true) + { + if (in[i][0].Flag_valid_pseudorange == true) + { + global_galileo_utc_model_map.read(0, d_ls_pvt->galileo_utc_model); + break; + } + i++; + if (i == (signed int)d_nchannels - 1) + { + break; + } + } } if (global_galileo_iono_map.size() > 0) { - // IONO data is shared for all the Galileo satellites. Read always at ID=0 - global_galileo_iono_map.read(0, d_ls_pvt->galileo_iono); + // IONO data is shared for all Galileo satellites. Read always at a locked channel + signed int i = 0; + while(true) + { + if (in[i][0].Flag_valid_pseudorange == true) + { + global_galileo_iono_map.read(i, d_ls_pvt->galileo_iono); + break; + } + i++; + if (i == (signed int)d_nchannels - 1) + { + break; + } + } } if (global_galileo_almanac_map.size() > 0) { - // Almanac data is shared for all the Galileo satellites. Read always at ID=0 - arrived_galileo_almanac = global_galileo_almanac_map.read(0, d_ls_pvt->galileo_almanac); + // ALMANAC data is shared for all Galileo satellites. Read always at a locked channel + signed int i = 0; + while(true) + { + if (in[i][0].Flag_valid_pseudorange == true) + { + arrived_galileo_almanac = global_galileo_almanac_map.read(i, d_ls_pvt->galileo_almanac); + break; + } + i++; + if (i == (signed int)d_nchannels - 1) + { + break; + } + } } // ############ 1. READ GPS EPHEMERIS/UTC_MODE/IONO FROM GLOBAL MAPS #### @@ -189,14 +228,40 @@ int hybrid_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_items, if (global_gps_utc_model_map.size() > 0) { - // UTC MODEL data is shared for all the Galileo satellites. Read always at ID=0 - global_gps_utc_model_map.read(0, d_ls_pvt->gps_utc_model); + // UTC MODEL data is shared for all the GPS satellites. Read always at a locked channel + signed int i = 0; + while(true) + { + if (in[i][0].Flag_valid_pseudorange == true) + { + global_gps_utc_model_map.read(i, d_ls_pvt->gps_utc_model); + break; + } + i++; + if (i == (signed int)d_nchannels - 1) + { + break; + } + } } if (global_gps_iono_map.size() > 0) { - // IONO data is shared for all the Galileo satellites. Read always at ID=0 - global_gps_iono_map.read(0, d_ls_pvt->gps_iono); + // IONO data is shared for all the GPS satellites. Read always at a locked channel + signed int i = 0; + while(true) + { + if (in[i][0].Flag_valid_pseudorange == true) + { + global_gps_iono_map.read(i, d_ls_pvt->gps_iono); + break; + } + i++; + if (i == (signed int)d_nchannels - 1) + { + break; + } + } }