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 6b2fea3aa..e76d782ba 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 @@ -106,6 +106,7 @@ gps_l1_ca_pvt_cc::gps_l1_ca_pvt_cc(unsigned int nchannels, d_rx_time = 0.0; b_rinex_header_writen = false; + b_rinex_header_updated = false; b_rinex_sbs_header_writen = false; rp = std::make_shared(); @@ -150,6 +151,9 @@ int gps_l1_ca_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_ite std::map gnss_pseudoranges_map; Gnss_Synchro **in = (Gnss_Synchro **) &input_items[0]; //Get the input pointer + //Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0]; //Get the output pointer + + //out = in; for (unsigned int i = 0; i < d_nchannels; i++) { @@ -168,6 +172,7 @@ int gps_l1_ca_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_ite { // UTC MODEL data is shared for all the GPS satellites. Read always at ID=0 global_gps_utc_model_map.read(0, d_ls_pvt->gps_utc_model); + std::cout << d_ls_pvt->gps_utc_model.d_A0 << std::endl; } if (global_gps_iono_map.size() > 0) @@ -223,7 +228,7 @@ int gps_l1_ca_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_ite } // ############ 2 COMPUTE THE PVT ################################ - if (gnss_pseudoranges_map.size() > 0 and d_ls_pvt->gps_ephemeris_map.size() >0) + if (gnss_pseudoranges_map.size() > 0 and d_ls_pvt->gps_ephemeris_map.size() > 0) { // compute on the fly PVT solution //mod 8/4/2012 Set the PVT computation rate in this block @@ -242,7 +247,7 @@ int gps_l1_ca_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_ite gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.begin(); if (gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.end()) { - rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second,d_rx_time); + rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, d_rx_time); rp->rinex_nav_header(rp->navFile, d_ls_pvt->gps_iono, d_ls_pvt->gps_utc_model); b_rinex_header_writen = true; // do not write header anymore } @@ -262,6 +267,12 @@ int gps_l1_ca_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_ite { rp->log_rinex_obs(rp->obsFile, gps_ephemeris_iter->second, d_rx_time, gnss_pseudoranges_map); } + if (!b_rinex_header_updated && (d_ls_pvt->gps_utc_model.d_A0 != 0)) + { + //rp->update_obs_header(rp->obsFile, d_ls_pvt->gps_utc_model, d_ls_pvt->gps_iono); + rp->update_nav_header(rp->navFile, d_ls_pvt->gps_utc_model, d_ls_pvt->gps_iono); + b_rinex_header_updated = true; + } } } } @@ -304,7 +315,7 @@ int gps_l1_ca_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_ite } consume_each(1); //one by one - return 0; + return noutput_items; } diff --git a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.h b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.h index d66b8f81c..645760ee3 100644 --- a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.h +++ b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.h @@ -96,6 +96,7 @@ private: bool d_dump; bool b_rinex_header_writen; bool b_rinex_sbs_header_writen; + bool b_rinex_header_updated; std::shared_ptr rp; unsigned int d_nchannels; std::string d_dump_filename; diff --git a/src/algorithms/PVT/libs/rinex_printer.cc b/src/algorithms/PVT/libs/rinex_printer.cc index 0bccdd268..758cbc8db 100644 --- a/src/algorithms/PVT/libs/rinex_printer.cc +++ b/src/algorithms/PVT/libs/rinex_printer.cc @@ -501,6 +501,20 @@ void Rinex_Printer::rinex_nav_header(std::ofstream& out, const Galileo_Iono& ion out << line << std::endl; } + +void Rinex_Printer::update_nav_header(std::ofstream& out, const Gps_Utc_Model& gps_utc, const Gps_Iono& gps_iono) +{ + if (version == 2) + { + + } + if (version == 3) + { + + } +} + + void Rinex_Printer::rinex_nav_header(std::ofstream& out, const Gps_Iono& iono, const Gps_Utc_Model& utc_model) { diff --git a/src/algorithms/PVT/libs/rinex_printer.h b/src/algorithms/PVT/libs/rinex_printer.h index df5829e56..bf0354580 100644 --- a/src/algorithms/PVT/libs/rinex_printer.h +++ b/src/algorithms/PVT/libs/rinex_printer.h @@ -59,6 +59,8 @@ #include #include #include "gps_navigation_message.h" +#include "gps_utc_model.h" +#include "gps_iono.h" #include "galileo_navigation_message.h" #include "sbas_telemetry_data.h" #include "GPS_L1_CA.h" @@ -180,6 +182,8 @@ public: */ void log_rinex_sbs(std::ofstream& out, const Sbas_Raw_Msg& sbs_message); + void update_nav_header(std::ofstream& out, const Gps_Utc_Model& gps_utc, const Gps_Iono& gps_iono); + std::map satelliteSystem; // observationType; // observationCode; //