diff --git a/src/core/system_parameters/galileo_iono.h b/src/core/system_parameters/galileo_iono.h index cc8af7392..90c861c12 100644 --- a/src/core/system_parameters/galileo_iono.h +++ b/src/core/system_parameters/galileo_iono.h @@ -32,6 +32,7 @@ #ifndef GNSS_SDR_GALILEO_IONO_H_ #define GNSS_SDR_GALILEO_IONO_H_ +#include /*! * \brief This class is a storage for the GALILEO IONOSPHERIC data as described in Galileo ICD paragraph 5.1.6 @@ -61,6 +62,30 @@ public: * Default constructor */ Galileo_Iono(); + + template + + /*! + * \brief Serialize is a boost standard method to be called by the boost XML serialization. + Here is used to save the iono data on disk file. + */ + inline void serialize(Archive& archive, const unsigned int version) + { + using boost::serialization::make_nvp; + if (version) + { + }; + archive& make_nvp("ai0_5", ai0_5); + archive& make_nvp("ai1_5", ai1_5); + archive& make_nvp("ai2_5", ai2_5); + archive& make_nvp("Region1_flag_5", Region1_flag_5); + archive& make_nvp("Region2_flag_5", Region2_flag_5); + archive& make_nvp("Region3_flag_5", Region3_flag_5); + archive& make_nvp("Region4_flag_5", Region4_flag_5); + archive& make_nvp("Region5_flag_5", Region5_flag_5); + archive& make_nvp("TOW_5", TOW_5); + archive& make_nvp("WN_5", WN_5); + } }; #endif diff --git a/src/core/system_parameters/galileo_utc_model.h b/src/core/system_parameters/galileo_utc_model.h index cc72d78e2..a4448ab19 100644 --- a/src/core/system_parameters/galileo_utc_model.h +++ b/src/core/system_parameters/galileo_utc_model.h @@ -33,6 +33,7 @@ #ifndef GNSS_SDR_GALILEO_UTC_MODEL_H_ #define GNSS_SDR_GALILEO_UTC_MODEL_H_ +#include /*! * \brief This class is a storage for the GALILEO UTC MODEL data as described in Galileo ICD @@ -58,6 +59,28 @@ public: * Default constructor */ Galileo_Utc_Model(); + + template + + /*! + * \brief Serialize is a boost standard method to be called by the boost XML serialization. + Here is used to save the UTC data on disk file. + */ + inline void serialize(Archive& archive, const unsigned int version) + { + using boost::serialization::make_nvp; + if (version) + { + }; + archive& make_nvp("A0_6", A0_6); + archive& make_nvp("A1_6", A1_6); + archive& make_nvp("Delta_tLS_6", Delta_tLS_6); + archive& make_nvp("t0t_6", t0t_6); + archive& make_nvp("WNot_6", WNot_6); + archive& make_nvp("WN_LSF_6", WN_LSF_6); + archive& make_nvp("DN_6", DN_6); + archive& make_nvp("Delta_tLSF_6", Delta_tLSF_6); + } }; #endif diff --git a/src/utils/rinex2assist/CMakeLists.txt b/src/utils/rinex2assist/CMakeLists.txt index 8bf5fb3a6..b7db9e90f 100644 --- a/src/utils/rinex2assist/CMakeLists.txt +++ b/src/utils/rinex2assist/CMakeLists.txt @@ -32,6 +32,8 @@ include_directories( ${GPSTK_INCLUDE_DIR} ) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated") + add_executable(rinex2assist ${CMAKE_CURRENT_SOURCE_DIR}/main.cc) target_link_libraries(rinex2assist @@ -45,7 +47,6 @@ if(NOT GPSTK_FOUND OR ENABLE_OWN_GPSTK) add_dependencies(rinex2assist gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}) endif(NOT GPSTK_FOUND OR ENABLE_OWN_GPSTK) - add_custom_command(TARGET rinex2assist POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ ${CMAKE_SOURCE_DIR}/install/$) diff --git a/src/utils/rinex2assist/main.cc b/src/utils/rinex2assist/main.cc index 11792d040..b0d786e6c 100644 --- a/src/utils/rinex2assist/main.cc +++ b/src/utils/rinex2assist/main.cc @@ -32,6 +32,8 @@ #include "gps_ephemeris.h" #include "galileo_ephemeris.h" +#include "gps_utc_model.h" +#include "gps_iono.h" #include #include #include @@ -49,30 +51,29 @@ int main(int argc, char** argv) "This program comes with ABSOLUTELY NO WARRANTY;\n" + "See COPYING file to see a copy of the General Public License.\n \n" + "Usage: \n" + - " rinex2assist []"); + " rinex2assist "); google::SetUsageMessage(intro_help); google::SetVersionString("1.0"); google::ParseCommandLineFlags(&argc, &argv, true); - if ((argc < 2) or (argc > 3)) + if ((argc != 2)) { std::cerr << "Usage:" << std::endl; std::cerr << " " << argv[0] - << " []" + << " " << std::endl; google::ShutDownCommandLineFlags(); return 1; } std::string xml_filename; - if (argc == 3) - { - xml_filename = argv[2]; - } std::map eph_map; std::map eph_gal_map; + Gps_Utc_Model gps_utc_model; + Gps_Iono gps_iono; + int i = 0; int j = 0; try @@ -93,6 +94,31 @@ int main(int argc, char** argv) return 1; } + // Collect UTC parameters from RINEX header + if (hdr.fileSys.compare("G: (GPS)") == 0 || hdr.fileSys.compare("MIXED") == 0) + { + gps_utc_model.valid = (hdr.valid > 2147483648) ? true : false; + gps_utc_model.d_A1 = hdr.mapTimeCorr["GPUT"].A0; + gps_utc_model.d_A0 = hdr.mapTimeCorr["GPUT"].A1; + gps_utc_model.d_t_OT = hdr.mapTimeCorr["GPUT"].refSOW; + gps_utc_model.i_WN_T = hdr.mapTimeCorr["GPUT"].refWeek; + gps_utc_model.d_DeltaT_LS = hdr.leapSeconds; + gps_utc_model.i_WN_LSF = hdr.leapWeek; + gps_utc_model.i_DN = hdr.leapDay; + gps_utc_model.d_DeltaT_LSF = hdr.leapDelta; + + // Collect iono parameters from RINEX header + gps_iono.valid = (hdr.mapIonoCorr["GPSA"].param[0] == 0) ? false : true; + gps_iono.d_alpha0 = hdr.mapIonoCorr["GPSA"].param[0]; + gps_iono.d_alpha1 = hdr.mapIonoCorr["GPSA"].param[1]; + gps_iono.d_alpha2 = hdr.mapIonoCorr["GPSA"].param[2]; + gps_iono.d_alpha3 = hdr.mapIonoCorr["GPSA"].param[3]; + gps_iono.d_beta0 = hdr.mapIonoCorr["GPSB"].param[0]; + gps_iono.d_beta1 = hdr.mapIonoCorr["GPSB"].param[1]; + gps_iono.d_beta2 = hdr.mapIonoCorr["GPSB"].param[2]; + gps_iono.d_beta3 = hdr.mapIonoCorr["GPSB"].param[3]; + } + // Read navigation data while (rnffs >> rne) { @@ -185,7 +211,7 @@ int main(int argc, char** argv) return 1; } - // Write XML + // Write XML ephemeris if (i != 0) { std::ofstream ofs; @@ -201,10 +227,11 @@ int main(int argc, char** argv) } catch (std::exception& e) { - std::cerr << "Problem creating the XML file: " << e.what() << std::endl; + std::cerr << "Problem creating the XML file " << xml_filename << ": " << e.what() << std::endl; google::ShutDownCommandLineFlags(); return 1; } + std::cout << "Generated file: " << xml_filename << std::endl; } if (j != 0) { @@ -218,11 +245,53 @@ int main(int argc, char** argv) } catch (std::exception& e) { - std::cerr << "Problem creating the XML file: " << e.what() << std::endl; + std::cerr << "Problem creating the XML file " << xml_filename << ": " << e.what() << std::endl; google::ShutDownCommandLineFlags(); return 1; } + std::cout << "Generated file: " << xml_filename << std::endl; } + + // Write XML UTC + if (gps_utc_model.valid) + { + std::ofstream ofs3; + xml_filename = "gps_UTC.xml"; + try + { + ofs3.open(xml_filename.c_str(), std::ofstream::trunc | std::ofstream::out); + boost::archive::xml_oarchive xml(ofs3); + xml << boost::serialization::make_nvp("GNSS-SDR_gps_utc", gps_utc_model); + } + catch (std::exception& e) + { + std::cerr << "Problem creating the XML file " << xml_filename << ": " << e.what() << std::endl; + google::ShutDownCommandLineFlags(); + return 1; + } + std::cout << "Generated file: " << xml_filename << std::endl; + } + + // Write XML iono + if (gps_iono.valid) + { + std::ofstream ofs4; + xml_filename = "gps_iono.xml"; + try + { + ofs4.open(xml_filename.c_str(), std::ofstream::trunc | std::ofstream::out); + boost::archive::xml_oarchive xml(ofs4); + xml << boost::serialization::make_nvp("GNSS-SDR_gps_iono", gps_iono); + } + catch (std::exception& e) + { + std::cerr << "Problem creating the XML file " << xml_filename << ": " << e.what() << std::endl; + google::ShutDownCommandLineFlags(); + return 1; + } + std::cout << "Generated file: " << xml_filename << std::endl; + } + google::ShutDownCommandLineFlags(); return 0; }