1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 12:40:35 +00:00

Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into next

This commit is contained in:
Carles Fernandez 2018-10-25 16:48:51 +02:00
commit 336e00edaa
24 changed files with 674 additions and 218 deletions

View File

@ -29,6 +29,8 @@
*/ */
#include "rtklib_pvt_cc.h" #include "rtklib_pvt_cc.h"
#include "galileo_almanac.h"
#include "galileo_almanac_helper.h"
#include "display.h" #include "display.h"
#include <boost/archive/xml_oarchive.hpp> #include <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp> #include <boost/archive/xml_iarchive.hpp>
@ -50,11 +52,6 @@ namespace bc = boost::math;
namespace bc = boost::integer; namespace bc = boost::integer;
#endif #endif
//includes used by the observables serializarion (export observables for rtklib unit test)
#include <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
#include <boost/serialization/map.hpp>
using google::LogMessage; using google::LogMessage;
@ -160,6 +157,15 @@ void rtklib_pvt_cc::msg_handler_telemetry(pmt::pmt_t msg)
DLOG(INFO) << "New CNAV UTC record has arrived "; DLOG(INFO) << "New CNAV UTC record has arrived ";
} }
else if (pmt::any_ref(msg).type() == typeid(std::shared_ptr<Gps_Almanac>))
{
// ### GPS ALMANAC ###
std::shared_ptr<Gps_Almanac> gps_almanac;
gps_almanac = boost::any_cast<std::shared_ptr<Gps_Almanac>>(pmt::any_ref(msg));
d_ls_pvt->gps_almanac_map[gps_almanac->i_satellite_PRN] = *gps_almanac;
DLOG(INFO) << "New GPS almanac record has arrived ";
}
// **************** Galileo telemetry ******************** // **************** Galileo telemetry ********************
else if (pmt::any_ref(msg).type() == typeid(std::shared_ptr<Galileo_Ephemeris>)) else if (pmt::any_ref(msg).type() == typeid(std::shared_ptr<Galileo_Ephemeris>))
{ {
@ -189,14 +195,28 @@ void rtklib_pvt_cc::msg_handler_telemetry(pmt::pmt_t msg)
d_ls_pvt->galileo_utc_model = *galileo_utc_model; d_ls_pvt->galileo_utc_model = *galileo_utc_model;
DLOG(INFO) << "New UTC record has arrived "; DLOG(INFO) << "New UTC record has arrived ";
} }
else if (pmt::any_ref(msg).type() == typeid(std::shared_ptr<Galileo_Almanac_Helper>))
{
// ### Galileo Almanac ###
std::shared_ptr<Galileo_Almanac_Helper> galileo_almanac_helper;
galileo_almanac_helper = boost::any_cast<std::shared_ptr<Galileo_Almanac_Helper>>(pmt::any_ref(msg));
Galileo_Almanac sv1 = galileo_almanac_helper->get_almanac(1);
Galileo_Almanac sv2 = galileo_almanac_helper->get_almanac(2);
Galileo_Almanac sv3 = galileo_almanac_helper->get_almanac(3);
if (sv1.i_satellite_PRN != 0) d_ls_pvt->galileo_almanac_map[sv1.i_satellite_PRN] = sv1;
if (sv2.i_satellite_PRN != 0) d_ls_pvt->galileo_almanac_map[sv2.i_satellite_PRN] = sv2;
if (sv3.i_satellite_PRN != 0) d_ls_pvt->galileo_almanac_map[sv3.i_satellite_PRN] = sv3;
DLOG(INFO) << "New Galileo Almanac data have arrived ";
}
else if (pmt::any_ref(msg).type() == typeid(std::shared_ptr<Galileo_Almanac>)) else if (pmt::any_ref(msg).type() == typeid(std::shared_ptr<Galileo_Almanac>))
{ {
// ### Galileo Almanac ### // ### Galileo Almanac ###
std::shared_ptr<Galileo_Almanac> galileo_almanac; std::shared_ptr<Galileo_Almanac> galileo_alm;
galileo_almanac = boost::any_cast<std::shared_ptr<Galileo_Almanac>>(pmt::any_ref(msg)); galileo_alm = boost::any_cast<std::shared_ptr<Galileo_Almanac>>(pmt::any_ref(msg));
// update/insert new ephemeris record to the global ephemeris map // update/insert new almanac record to the global almanac map
d_ls_pvt->galileo_almanac = *galileo_almanac; d_ls_pvt->galileo_almanac_map[galileo_alm->i_satellite_PRN] = *galileo_alm;
DLOG(INFO) << "New Galileo Almanac has arrived ";
} }
// **************** GLONASS GNAV Telemetry ************************** // **************** GLONASS GNAV Telemetry **************************
@ -527,6 +547,50 @@ rtklib_pvt_cc::~rtklib_pvt_cc()
LOG(INFO) << "Failed to save Galileo UTC model parameters, not valid data"; LOG(INFO) << "Failed to save Galileo UTC model parameters, not valid data";
} }
// save GPS almanac to XML file
file_name = "gps_almanac.xml";
if (d_ls_pvt->gps_almanac_map.empty() == false)
{
std::ofstream ofs;
try
{
ofs.open(file_name.c_str(), std::ofstream::trunc | std::ofstream::out);
boost::archive::xml_oarchive xml(ofs);
xml << boost::serialization::make_nvp("GNSS-SDR_gps_almanac_map", d_ls_pvt->gps_almanac_map);
LOG(INFO) << "Saved GPS almanac map data";
}
catch (const std::exception& e)
{
LOG(WARNING) << e.what();
}
}
else
{
LOG(INFO) << "Failed to save GPS almanac, map is empty";
}
// Save Galileo almanac
file_name = "gal_almanac.xml";
if (d_ls_pvt->galileo_almanac_map.empty() == false)
{
std::ofstream ofs;
try
{
ofs.open(file_name.c_str(), std::ofstream::trunc | std::ofstream::out);
boost::archive::xml_oarchive xml(ofs);
xml << boost::serialization::make_nvp("GNSS-SDR_gal_almanac_map", d_ls_pvt->galileo_almanac_map);
LOG(INFO) << "Saved Galileo almanac data";
}
catch (std::exception& e)
{
LOG(WARNING) << e.what();
}
}
else
{
LOG(INFO) << "Failed to save Galileo almanac, not valid data";
}
// Save GPS CNAV UTC model parameters // Save GPS CNAV UTC model parameters
file_name = "gps_cnav_utc_model.xml"; file_name = "gps_cnav_utc_model.xml";
if (d_ls_pvt->gps_cnav_utc_model.valid) if (d_ls_pvt->gps_cnav_utc_model.valid)
@ -921,7 +985,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
if (galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.cend()) if (galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.cend())
{ {
rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time); rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time);
rp->rinex_nav_header(rp->navGalFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model, d_ls_pvt->galileo_almanac); rp->rinex_nav_header(rp->navGalFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model);
b_rinex_header_written = true; // do not write header anymore b_rinex_header_written = true; // do not write header anymore
} }
} }
@ -931,7 +995,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
if (galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.cend()) if (galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.cend())
{ {
rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, signal); rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, signal);
rp->rinex_nav_header(rp->navGalFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model, d_ls_pvt->galileo_almanac); rp->rinex_nav_header(rp->navGalFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model);
b_rinex_header_written = true; // do not write header anymore b_rinex_header_written = true; // do not write header anymore
} }
} }
@ -941,7 +1005,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
if (galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.cend()) if (galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.cend())
{ {
rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, signal); rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, signal);
rp->rinex_nav_header(rp->navGalFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model, d_ls_pvt->galileo_almanac); rp->rinex_nav_header(rp->navGalFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model);
b_rinex_header_written = true; // do not write header anymore b_rinex_header_written = true; // do not write header anymore
} }
} }
@ -961,7 +1025,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
{ {
std::string gal_signal("1B"); std::string gal_signal("1B");
rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, d_rx_time, gal_signal); rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, d_rx_time, gal_signal);
rp->rinex_nav_header(rp->navMixFile, d_ls_pvt->gps_iono, d_ls_pvt->gps_utc_model, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model, d_ls_pvt->galileo_almanac); rp->rinex_nav_header(rp->navMixFile, d_ls_pvt->gps_iono, d_ls_pvt->gps_utc_model, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model);
b_rinex_header_written = true; // do not write header anymore b_rinex_header_written = true; // do not write header anymore
} }
} }
@ -971,7 +1035,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
{ {
std::string gal_signal("5X"); std::string gal_signal("5X");
rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, d_rx_time, gal_signal); rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, d_rx_time, gal_signal);
rp->rinex_nav_header(rp->navMixFile, d_ls_pvt->gps_iono, d_ls_pvt->gps_utc_model, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model, d_ls_pvt->galileo_almanac); rp->rinex_nav_header(rp->navMixFile, d_ls_pvt->gps_iono, d_ls_pvt->gps_utc_model, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model);
b_rinex_header_written = true; // do not write header anymore b_rinex_header_written = true; // do not write header anymore
} }
} }
@ -981,7 +1045,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
{ {
std::string gal_signal("7X"); std::string gal_signal("7X");
rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, d_rx_time, gal_signal); rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, d_rx_time, gal_signal);
rp->rinex_nav_header(rp->navMixFile, d_ls_pvt->gps_iono, d_ls_pvt->gps_utc_model, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model, d_ls_pvt->galileo_almanac); rp->rinex_nav_header(rp->navMixFile, d_ls_pvt->gps_iono, d_ls_pvt->gps_utc_model, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model);
b_rinex_header_written = true; // do not write header anymore b_rinex_header_written = true; // do not write header anymore
} }
} }
@ -991,7 +1055,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
{ {
std::string gal_signal("1B 5X"); std::string gal_signal("1B 5X");
rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, gal_signal); rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, gal_signal);
rp->rinex_nav_header(rp->navGalFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model, d_ls_pvt->galileo_almanac); rp->rinex_nav_header(rp->navGalFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model);
b_rinex_header_written = true; // do not write header anymore b_rinex_header_written = true; // do not write header anymore
} }
} }
@ -1001,7 +1065,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
{ {
std::string gal_signal("1B 7X"); std::string gal_signal("1B 7X");
rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, gal_signal); rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, gal_signal);
rp->rinex_nav_header(rp->navGalFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model, d_ls_pvt->galileo_almanac); rp->rinex_nav_header(rp->navGalFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model);
b_rinex_header_written = true; // do not write header anymore b_rinex_header_written = true; // do not write header anymore
} }
} }
@ -1059,7 +1123,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
std::string glo_signal("1G"); std::string glo_signal("1G");
std::string gal_signal("1B"); std::string gal_signal("1B");
rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, glo_signal, gal_signal); rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, glo_signal, gal_signal);
rp->rinex_nav_header(rp->navMixFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model, d_ls_pvt->galileo_almanac, d_ls_pvt->glonass_gnav_utc_model, d_ls_pvt->glonass_gnav_almanac); rp->rinex_nav_header(rp->navMixFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model, d_ls_pvt->glonass_gnav_utc_model, d_ls_pvt->glonass_gnav_almanac);
b_rinex_header_written = true; // do not write header anymore b_rinex_header_written = true; // do not write header anymore
} }
} }
@ -1096,7 +1160,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
std::string glo_signal("2G"); std::string glo_signal("2G");
std::string gal_signal("1B"); std::string gal_signal("1B");
rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, glo_signal, gal_signal); rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, glo_signal, gal_signal);
rp->rinex_nav_header(rp->navMixFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model, d_ls_pvt->galileo_almanac, d_ls_pvt->glonass_gnav_utc_model, d_ls_pvt->glonass_gnav_almanac); rp->rinex_nav_header(rp->navMixFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model, d_ls_pvt->glonass_gnav_utc_model, d_ls_pvt->glonass_gnav_almanac);
b_rinex_header_written = true; // do not write header anymore b_rinex_header_written = true; // do not write header anymore
} }
} }
@ -1239,7 +1303,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
} }
if (!b_rinex_header_updated and (d_ls_pvt->galileo_utc_model.A0_6 != 0)) if (!b_rinex_header_updated and (d_ls_pvt->galileo_utc_model.A0_6 != 0))
{ {
rp->update_nav_header(rp->navGalFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model, d_ls_pvt->galileo_almanac); rp->update_nav_header(rp->navGalFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model);
rp->update_obs_header(rp->obsFile, d_ls_pvt->galileo_utc_model); rp->update_obs_header(rp->obsFile, d_ls_pvt->galileo_utc_model);
b_rinex_header_updated = true; b_rinex_header_updated = true;
} }
@ -1252,7 +1316,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
} }
if (!b_rinex_header_updated and (d_ls_pvt->galileo_utc_model.A0_6 != 0)) if (!b_rinex_header_updated and (d_ls_pvt->galileo_utc_model.A0_6 != 0))
{ {
rp->update_nav_header(rp->navGalFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model, d_ls_pvt->galileo_almanac); rp->update_nav_header(rp->navGalFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model);
rp->update_obs_header(rp->obsFile, d_ls_pvt->galileo_utc_model); rp->update_obs_header(rp->obsFile, d_ls_pvt->galileo_utc_model);
b_rinex_header_updated = true; b_rinex_header_updated = true;
} }
@ -1265,7 +1329,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
} }
if (!b_rinex_header_updated and (d_ls_pvt->galileo_utc_model.A0_6 != 0)) if (!b_rinex_header_updated and (d_ls_pvt->galileo_utc_model.A0_6 != 0))
{ {
rp->update_nav_header(rp->navGalFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model, d_ls_pvt->galileo_almanac); rp->update_nav_header(rp->navGalFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model);
rp->update_obs_header(rp->obsFile, d_ls_pvt->galileo_utc_model); rp->update_obs_header(rp->obsFile, d_ls_pvt->galileo_utc_model);
b_rinex_header_updated = true; b_rinex_header_updated = true;
} }
@ -1292,7 +1356,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
if (!b_rinex_header_updated and (d_ls_pvt->gps_utc_model.d_A0 != 0)) if (!b_rinex_header_updated and (d_ls_pvt->gps_utc_model.d_A0 != 0))
{ {
rp->update_obs_header(rp->obsFile, d_ls_pvt->gps_utc_model); rp->update_obs_header(rp->obsFile, d_ls_pvt->gps_utc_model);
rp->update_nav_header(rp->navMixFile, d_ls_pvt->gps_iono, d_ls_pvt->gps_utc_model, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model, d_ls_pvt->galileo_almanac); rp->update_nav_header(rp->navMixFile, d_ls_pvt->gps_iono, d_ls_pvt->gps_utc_model, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model);
b_rinex_header_updated = true; b_rinex_header_updated = true;
} }
} }
@ -1304,7 +1368,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
} }
if (!b_rinex_header_updated and (d_ls_pvt->galileo_utc_model.A0_6 != 0)) if (!b_rinex_header_updated and (d_ls_pvt->galileo_utc_model.A0_6 != 0))
{ {
rp->update_nav_header(rp->navGalFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model, d_ls_pvt->galileo_almanac); rp->update_nav_header(rp->navGalFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model);
rp->update_obs_header(rp->obsFile, d_ls_pvt->galileo_utc_model); rp->update_obs_header(rp->obsFile, d_ls_pvt->galileo_utc_model);
b_rinex_header_updated = true; b_rinex_header_updated = true;
} }
@ -1317,7 +1381,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
} }
if (!b_rinex_header_updated and (d_ls_pvt->galileo_utc_model.A0_6 != 0)) if (!b_rinex_header_updated and (d_ls_pvt->galileo_utc_model.A0_6 != 0))
{ {
rp->update_nav_header(rp->navGalFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model, d_ls_pvt->galileo_almanac); rp->update_nav_header(rp->navGalFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model);
rp->update_obs_header(rp->obsFile, d_ls_pvt->galileo_utc_model); rp->update_obs_header(rp->obsFile, d_ls_pvt->galileo_utc_model);
b_rinex_header_updated = true; b_rinex_header_updated = true;
} }
@ -1383,7 +1447,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
if (!b_rinex_header_updated and (d_ls_pvt->galileo_utc_model.A0_6 != 0)) if (!b_rinex_header_updated and (d_ls_pvt->galileo_utc_model.A0_6 != 0))
{ {
rp->update_obs_header(rp->obsFile, d_ls_pvt->galileo_utc_model); rp->update_obs_header(rp->obsFile, d_ls_pvt->galileo_utc_model);
rp->update_nav_header(rp->navMixFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model, d_ls_pvt->galileo_almanac, d_ls_pvt->glonass_gnav_utc_model, d_ls_pvt->glonass_gnav_almanac); rp->update_nav_header(rp->navMixFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model, d_ls_pvt->glonass_gnav_utc_model, d_ls_pvt->glonass_gnav_almanac);
b_rinex_header_updated = true; // do not write header anymore b_rinex_header_updated = true; // do not write header anymore
} }
} }
@ -1422,7 +1486,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
if (!b_rinex_header_updated && (d_ls_pvt->galileo_utc_model.A0_6 != 0)) if (!b_rinex_header_updated && (d_ls_pvt->galileo_utc_model.A0_6 != 0))
{ {
rp->update_obs_header(rp->obsFile, d_ls_pvt->galileo_utc_model); rp->update_obs_header(rp->obsFile, d_ls_pvt->galileo_utc_model);
rp->update_nav_header(rp->navMixFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model, d_ls_pvt->galileo_almanac, d_ls_pvt->glonass_gnav_utc_model, d_ls_pvt->glonass_gnav_almanac); rp->update_nav_header(rp->navMixFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model, d_ls_pvt->glonass_gnav_utc_model, d_ls_pvt->glonass_gnav_almanac);
b_rinex_header_updated = true; // do not write header anymore b_rinex_header_updated = true; // do not write header anymore
} }
} }

View File

@ -36,6 +36,7 @@
#include "galileo_navigation_message.h" #include "galileo_navigation_message.h"
#include "gps_navigation_message.h" #include "gps_navigation_message.h"
#include "gps_cnav_navigation_message.h" #include "gps_cnav_navigation_message.h"
#include "galileo_almanac.h"
#include "gnss_synchro.h" #include "gnss_synchro.h"
#include "rtklib_rtkcmn.h" #include "rtklib_rtkcmn.h"
#include <fstream> #include <fstream>

View File

@ -725,13 +725,13 @@ void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_CNAV_Iono& gps
} }
void Rinex_Printer::rinex_nav_header(std::fstream& out, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model, const Galileo_Almanac& galileo_almanac, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac) void Rinex_Printer::rinex_nav_header(std::fstream& out, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac)
{ {
if (glonass_gnav_almanac.i_satellite_freq_channel) if (glonass_gnav_almanac.i_satellite_freq_channel)
{ {
} //Avoid compiler warning } //Avoid compiler warning
//Avoid compiler warning, there is not time system correction between Galileo and GLONASS //Avoid compiler warning, there is not time system correction between Galileo and GLONASS
if (galileo_almanac.A_0G_10) if (galileo_utc_model.A_0G_10)
{ {
} }
std::string line; std::string line;
@ -839,7 +839,7 @@ void Rinex_Printer::rinex_nav_header(std::fstream& out, const Galileo_Iono& gali
} }
void Rinex_Printer::rinex_nav_header(std::fstream& out, const Galileo_Iono& iono, const Galileo_Utc_Model& utc_model, const Galileo_Almanac& galileo_almanac) void Rinex_Printer::rinex_nav_header(std::fstream& out, const Galileo_Iono& iono, const Galileo_Utc_Model& utc_model)
{ {
std::string line; std::string line;
@ -915,10 +915,10 @@ void Rinex_Printer::rinex_nav_header(std::fstream& out, const Galileo_Iono& iono
// -------- Line system time correction 2 // -------- Line system time correction 2
line.clear(); line.clear();
line += std::string("GPGA"); line += std::string("GPGA");
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_almanac.A_0G_10, 16, 2), 18); line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(utc_model.A_0G_10, 16, 2), 18);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_almanac.A_1G_10, 15, 2), 16); line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(utc_model.A_1G_10, 15, 2), 16);
line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(galileo_almanac.t_0G_10), 7); line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(utc_model.t_0G_10), 7);
line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(galileo_almanac.WN_0G_10), 5); line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(utc_model.WN_0G_10), 5);
line += std::string(10, ' '); line += std::string(10, ' ');
line += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20); line += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20);
Rinex_Printer::lengthCheck(line); Rinex_Printer::lengthCheck(line);
@ -1238,7 +1238,7 @@ void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_Iono& iono, co
} }
void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model, const Galileo_Almanac& galileo_almanac) void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model)
{ {
std::string line; std::string line;
@ -1327,10 +1327,10 @@ void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_Iono& gps_iono
// -------- Line system time correction 2 // -------- Line system time correction 2
line.clear(); line.clear();
line += std::string("GPGA"); line += std::string("GPGA");
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_almanac.A_0G_10, 16, 2), 18); line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_utc_model.A_0G_10, 16, 2), 18);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_almanac.A_1G_10, 15, 2), 16); line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_utc_model.A_1G_10, 15, 2), 16);
line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(galileo_almanac.t_0G_10), 7); line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(galileo_utc_model.t_0G_10), 7);
line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(galileo_almanac.WN_0G_10), 5); line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(galileo_utc_model.WN_0G_10), 5);
line += std::string(10, ' '); line += std::string(10, ' ');
line += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20); line += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20);
Rinex_Printer::lengthCheck(line); Rinex_Printer::lengthCheck(line);
@ -1552,7 +1552,7 @@ void Rinex_Printer::update_nav_header(std::fstream& out, const Glonass_Gnav_Utc_
} }
void Rinex_Printer::update_nav_header(std::fstream& out, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& utc_model, const Galileo_Almanac& galileo_almanac) void Rinex_Printer::update_nav_header(std::fstream& out, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& utc_model)
{ {
std::vector<std::string> data; std::vector<std::string> data;
std::string line_aux; std::string line_aux;
@ -1599,10 +1599,10 @@ void Rinex_Printer::update_nav_header(std::fstream& out, const Galileo_Iono& gal
else if ((line_str.find("GPGA", 0) != std::string::npos) && (line_str.find("TIME SYSTEM CORR", 59) != std::string::npos)) else if ((line_str.find("GPGA", 0) != std::string::npos) && (line_str.find("TIME SYSTEM CORR", 59) != std::string::npos))
{ {
line_aux += std::string("GPGA"); line_aux += std::string("GPGA");
line_aux += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_almanac.A_0G_10, 16, 2), 18); line_aux += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(utc_model.A_0G_10, 16, 2), 18);
line_aux += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_almanac.A_1G_10, 15, 2), 16); line_aux += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(utc_model.A_1G_10, 15, 2), 16);
line_aux += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(galileo_almanac.t_0G_10), 7); line_aux += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(utc_model.t_0G_10), 7);
line_aux += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(galileo_almanac.WN_0G_10), 5); line_aux += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(utc_model.WN_0G_10), 5);
line_aux += std::string(10, ' '); line_aux += std::string(10, ' ');
line_aux += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20); line_aux += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20);
data.push_back(line_aux); data.push_back(line_aux);
@ -1893,7 +1893,7 @@ void Rinex_Printer::update_nav_header(std::fstream& out, const Gps_CNAV_Utc_Mode
} }
void Rinex_Printer::update_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model, const Galileo_Almanac& galileo_almanac) void Rinex_Printer::update_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model)
{ {
std::vector<std::string> data; std::vector<std::string> data;
std::string line_aux; std::string line_aux;
@ -1975,10 +1975,10 @@ void Rinex_Printer::update_nav_header(std::fstream& out, const Gps_Iono& gps_ion
else if ((line_str.find("GPGA", 0) != std::string::npos) && (line_str.find("TIME SYSTEM CORR", 59) != std::string::npos)) else if ((line_str.find("GPGA", 0) != std::string::npos) && (line_str.find("TIME SYSTEM CORR", 59) != std::string::npos))
{ {
line_aux += std::string("GPGA"); line_aux += std::string("GPGA");
line_aux += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_almanac.A_0G_10, 16, 2), 18); line_aux += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_utc_model.A_0G_10, 16, 2), 18);
line_aux += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_almanac.A_1G_10, 15, 2), 16); line_aux += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_utc_model.A_1G_10, 15, 2), 16);
line_aux += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(galileo_almanac.t_0G_10), 7); line_aux += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(galileo_utc_model.t_0G_10), 7);
line_aux += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(galileo_almanac.WN_0G_10), 5); line_aux += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(galileo_utc_model.WN_0G_10), 5);
line_aux += std::string(10, ' '); line_aux += std::string(10, ' ');
line_aux += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20); line_aux += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20);
data.push_back(line_aux); data.push_back(line_aux);
@ -2239,13 +2239,13 @@ void Rinex_Printer::update_nav_header(std::fstream& out, const Gps_CNAV_Iono& gp
} }
void Rinex_Printer::update_nav_header(std::fstream& out, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model, const Galileo_Almanac& galileo_almanac, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac) void Rinex_Printer::update_nav_header(std::fstream& out, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac)
{ {
if (glonass_gnav_almanac.i_satellite_freq_channel) if (glonass_gnav_almanac.i_satellite_freq_channel)
{ {
} //Avoid compiler warning } //Avoid compiler warning
//Avoid compiler warning, there is not time system correction between Galileo and GLONASS //Avoid compiler warning, there is not time system correction between Galileo and GLONASS
if (galileo_almanac.A_0G_10) if (galileo_utc_model.A_0G_10)
{ {
} }
std::vector<std::string> data; std::vector<std::string> data;

View File

@ -106,12 +106,12 @@ public:
/*! /*!
* \brief Generates the Galileo Navigation Data header * \brief Generates the Galileo Navigation Data header
*/ */
void rinex_nav_header(std::fstream& out, const Galileo_Iono& iono, const Galileo_Utc_Model& utc_model, const Galileo_Almanac& galileo_almanac); void rinex_nav_header(std::fstream& out, const Galileo_Iono& iono, const Galileo_Utc_Model& utc_model);
/*! /*!
* \brief Generates the Mixed (GPS/Galileo) Navigation Data header * \brief Generates the Mixed (GPS/Galileo) Navigation Data header
*/ */
void rinex_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model, const Galileo_Almanac& galileo_almanac); void rinex_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model);
/*! /*!
* \brief Generates the GLONASS L1, L2 C/A Navigation Data header * \brief Generates the GLONASS L1, L2 C/A Navigation Data header
@ -121,7 +121,7 @@ public:
/*! /*!
* \brief Generates the Mixed (Galileo/GLONASS) Navigation Data header * \brief Generates the Mixed (Galileo/GLONASS) Navigation Data header
*/ */
void rinex_nav_header(std::fstream& out, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model, const Galileo_Almanac& galileo_almanac, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac); void rinex_nav_header(std::fstream& out, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac);
/*! /*!
* \brief Generates the Mixed (GPS L1 C/A/GLONASS L1, L2) Navigation Data header * \brief Generates the Mixed (GPS L1 C/A/GLONASS L1, L2) Navigation Data header
@ -318,9 +318,9 @@ public:
void update_nav_header(std::fstream& out, const Gps_CNAV_Utc_Model& utc_model, const Gps_CNAV_Iono& iono); void update_nav_header(std::fstream& out, const Gps_CNAV_Utc_Model& utc_model, const Gps_CNAV_Iono& iono);
void update_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model, const Galileo_Almanac& galileo_almanac); void update_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model);
void update_nav_header(std::fstream& out, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& utc_model, const Galileo_Almanac& galileo_almanac); void update_nav_header(std::fstream& out, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& utc_model);
void update_nav_header(std::fstream& out, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac); void update_nav_header(std::fstream& out, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac);
@ -328,7 +328,7 @@ public:
void update_nav_header(std::fstream& out, const Gps_CNAV_Iono& gps_cnav_iono, const Gps_CNAV_Utc_Model& gps_cnav_utc, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac); void update_nav_header(std::fstream& out, const Gps_CNAV_Iono& gps_cnav_iono, const Gps_CNAV_Utc_Model& gps_cnav_utc, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac);
void update_nav_header(std::fstream& out, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model, const Galileo_Almanac& galileo_almanac, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac); void update_nav_header(std::fstream& out, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac);
void update_obs_header(std::fstream& out, const Gps_Utc_Model& utc_model); void update_obs_header(std::fstream& out, const Gps_Utc_Model& utc_model);

View File

@ -60,6 +60,7 @@
#include "gps_navigation_message.h" #include "gps_navigation_message.h"
#include "gps_cnav_navigation_message.h" #include "gps_cnav_navigation_message.h"
#include "glonass_gnav_navigation_message.h" #include "glonass_gnav_navigation_message.h"
#include "galileo_almanac.h"
#include "gnss_synchro.h" #include "gnss_synchro.h"
#include "pvt_solution.h" #include "pvt_solution.h"
#include <fstream> #include <fstream>
@ -99,10 +100,11 @@ public:
Galileo_Utc_Model galileo_utc_model; Galileo_Utc_Model galileo_utc_model;
Galileo_Iono galileo_iono; Galileo_Iono galileo_iono;
Galileo_Almanac galileo_almanac; std::map<int, Galileo_Almanac> galileo_almanac_map;
Gps_Utc_Model gps_utc_model; Gps_Utc_Model gps_utc_model;
Gps_Iono gps_iono; Gps_Iono gps_iono;
std::map<int, Gps_Almanac> gps_almanac_map;
Gps_CNAV_Iono gps_cnav_iono; Gps_CNAV_Iono gps_cnav_iono;
Gps_CNAV_Utc_Model gps_cnav_utc_model; Gps_CNAV_Utc_Model gps_cnav_utc_model;

View File

@ -335,23 +335,18 @@ void galileo_telemetry_decoder_cc::decode_INAV_word(double *page_part_symbols, i
std::shared_ptr<Galileo_Utc_Model> tmp_obj = std::make_shared<Galileo_Utc_Model>(d_inav_nav.get_utc_model()); std::shared_ptr<Galileo_Utc_Model> tmp_obj = std::make_shared<Galileo_Utc_Model>(d_inav_nav.get_utc_model());
std::cout << "New Galileo E1 I/NAV message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite << std::endl; std::cout << "New Galileo E1 I/NAV message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite << std::endl;
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
delta_t = tmp_obj->A_0G_10 + tmp_obj->A_1G_10 * (static_cast<double>(d_TOW_at_current_symbol_ms) / 1000.0 - tmp_obj->t_0G_10 + 604800 * (fmod((d_inav_nav.WN_0 - tmp_obj->WN_0G_10), 64)));
DLOG(INFO) << "delta_t=" << delta_t << "[s]";
} }
if (d_inav_nav.have_new_almanac() == true) if (d_inav_nav.have_new_almanac() == true)
{ {
std::shared_ptr<Galileo_Almanac> tmp_obj = std::make_shared<Galileo_Almanac>(d_inav_nav.get_almanac()); std::shared_ptr<Galileo_Almanac_Helper> tmp_obj = std::make_shared<Galileo_Almanac_Helper>(d_inav_nav.get_almanac());
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
//debug //debug
std::cout << "Galileo E1 I/NAV almanac received in channel " << d_channel << " from satellite " << d_satellite << std::endl; std::cout << "Galileo E1 I/NAV almanac received in channel " << d_channel << " from satellite " << d_satellite << std::endl;
DLOG(INFO) << "GPS_to_Galileo time conversion:";
DLOG(INFO) << "A0G=" << tmp_obj->A_0G_10;
DLOG(INFO) << "A1G=" << tmp_obj->A_1G_10;
DLOG(INFO) << "T0G=" << tmp_obj->t_0G_10;
DLOG(INFO) << "WN_0G_10=" << tmp_obj->WN_0G_10;
DLOG(INFO) << "Current parameters:"; DLOG(INFO) << "Current parameters:";
DLOG(INFO) << "d_TOW_at_current_symbol_ms=" << d_TOW_at_current_symbol_ms; DLOG(INFO) << "d_TOW_at_current_symbol_ms=" << d_TOW_at_current_symbol_ms;
DLOG(INFO) << "d_nav.WN_0=" << d_inav_nav.WN_0; DLOG(INFO) << "d_nav.WN_0=" << d_inav_nav.WN_0;
delta_t = tmp_obj->A_0G_10 + tmp_obj->A_1G_10 * (static_cast<double>(d_TOW_at_current_symbol_ms) / 1000.0 - tmp_obj->t_0G_10 + 604800 * (fmod((d_inav_nav.WN_0 - tmp_obj->WN_0G_10), 64)));
DLOG(INFO) << "delta_t=" << delta_t << "[s]";
} }
} }

View File

@ -38,7 +38,7 @@
#include "galileo_navigation_message.h" #include "galileo_navigation_message.h"
#include "galileo_fnav_message.h" #include "galileo_fnav_message.h"
#include "galileo_ephemeris.h" #include "galileo_ephemeris.h"
#include "galileo_almanac.h" #include "galileo_almanac_helper.h"
#include "galileo_iono.h" #include "galileo_iono.h"
#include "galileo_utc_model.h" #include "galileo_utc_model.h"
#include "gnss_satellite.h" #include "gnss_satellite.h"

View File

@ -786,6 +786,100 @@ bool gnss_sdr_supl_client::save_gal_iono_xml(const std::string file_name, Galile
} }
bool gnss_sdr_supl_client::load_gps_almanac_xml(const std::string file_name)
{
std::ifstream ifs;
try
{
ifs.open(file_name.c_str(), std::ifstream::binary | std::ifstream::in);
boost::archive::xml_iarchive xml(ifs);
gps_almanac_map.clear();
xml >> boost::serialization::make_nvp("GNSS-SDR_gps_almanac_map", this->gps_almanac_map);
LOG(INFO) << "Loaded GPS almanac map data with " << this->gps_almanac_map.size() << " satellites";
}
catch (std::exception& e)
{
LOG(WARNING) << e.what() << "File: " << file_name;
return false;
}
return true;
}
bool gnss_sdr_supl_client::save_gps_almanac_xml(const std::string file_name, std::map<int, Gps_Almanac> gps_almanac_map)
{
if (gps_almanac_map.empty() == false)
{
std::ofstream ofs;
try
{
ofs.open(file_name.c_str(), std::ofstream::trunc | std::ofstream::out);
boost::archive::xml_oarchive xml(ofs);
xml << boost::serialization::make_nvp("GNSS-SDR_gps_almanac_map", gps_almanac_map);
LOG(INFO) << "Saved GPS almanac data";
}
catch (std::exception& e)
{
LOG(WARNING) << e.what();
return false;
}
}
else
{
LOG(WARNING) << "Failed to save GPS almanac, map is empty";
return false;
}
return true;
}
bool gnss_sdr_supl_client::load_gal_almanac_xml(const std::string file_name)
{
std::ifstream ifs;
try
{
ifs.open(file_name.c_str(), std::ifstream::binary | std::ifstream::in);
boost::archive::xml_iarchive xml(ifs);
gal_almanac_map.clear();
xml >> boost::serialization::make_nvp("GNSS-SDR_gal_almanac_map", this->gal_almanac_map);
LOG(INFO) << "Loaded Galileo almanac map data with " << this->gal_almanac_map.size() << " satellites";
}
catch (std::exception& e)
{
LOG(WARNING) << e.what() << "File: " << file_name;
return false;
}
return true;
}
bool gnss_sdr_supl_client::save_gal_almanac_xml(const std::string file_name, std::map<int, Galileo_Almanac> gal_almanac_map)
{
if (gal_almanac_map.empty() == false)
{
std::ofstream ofs;
try
{
ofs.open(file_name.c_str(), std::ofstream::trunc | std::ofstream::out);
boost::archive::xml_oarchive xml(ofs);
xml << boost::serialization::make_nvp("GNSS-SDR_gal_almanac_map", gal_almanac_map);
LOG(INFO) << "Saved Galileo almanac data";
}
catch (std::exception& e)
{
LOG(WARNING) << e.what();
return false;
}
}
else
{
LOG(WARNING) << "Failed to save Galileo almanac, map is empty";
return false;
}
return true;
}
bool gnss_sdr_supl_client::load_glo_utc_xml(const std::string file_name) bool gnss_sdr_supl_client::load_glo_utc_xml(const std::string file_name)
{ {
std::ifstream ifs; std::ifstream ifs;

View File

@ -51,6 +51,7 @@ extern "C"
#include "galileo_ephemeris.h" #include "galileo_ephemeris.h"
#include "galileo_utc_model.h" #include "galileo_utc_model.h"
#include "galileo_iono.h" #include "galileo_iono.h"
#include "galileo_almanac.h"
#include "glonass_gnav_ephemeris.h" #include "glonass_gnav_ephemeris.h"
#include "glonass_gnav_utc_model.h" #include "glonass_gnav_utc_model.h"
#include <boost/archive/xml_oarchive.hpp> #include <boost/archive/xml_oarchive.hpp>
@ -90,6 +91,7 @@ public:
// almanac map // almanac map
std::map<int, Gps_Almanac> gps_almanac_map; std::map<int, Gps_Almanac> gps_almanac_map;
std::map<int, Galileo_Almanac> gal_almanac_map;
// ionospheric model // ionospheric model
Gps_Iono gps_iono; Gps_Iono gps_iono;
@ -195,6 +197,26 @@ public:
*/ */
bool save_gal_utc_xml(const std::string file_name, Galileo_Utc_Model& utc); bool save_gal_utc_xml(const std::string file_name, Galileo_Utc_Model& utc);
/*!
* \brief Read Galileo almanac map from XML file
*/
bool load_gal_almanac_xml(const std::string file_name);
/*!
* \brief Save Galileo almanac map to XML file
*/
bool save_gal_almanac_xml(const std::string file_name, std::map<int, Galileo_Almanac> gal_almanac);
/*!
* \brief Read GPS almanac map from XML file
*/
bool load_gps_almanac_xml(const std::string file_name);
/*!
* \brief Save GPS almanac map to XML file
*/
bool save_gps_almanac_xml(const std::string file_name, std::map<int, Gps_Almanac> gps_almanac_map);
/*! /*!
* \brief Read iono from XML file * \brief Read iono from XML file
*/ */

View File

@ -234,6 +234,8 @@ bool ControlThread::read_assistance_from_XML()
std::string cnav_utc_xml_filename = configuration_->property("GNSS-SDR.SUPL_cnav_utc_model_xml", cnav_utc_default_xml_filename); std::string cnav_utc_xml_filename = configuration_->property("GNSS-SDR.SUPL_cnav_utc_model_xml", cnav_utc_default_xml_filename);
std::string eph_glo_xml_filename = configuration_->property("GNSS-SDR.SUPL_glo_ephemeris_xml", eph_glo_gnav_default_xml_filename); std::string eph_glo_xml_filename = configuration_->property("GNSS-SDR.SUPL_glo_ephemeris_xml", eph_glo_gnav_default_xml_filename);
std::string glo_utc_xml_filename = configuration_->property("GNSS-SDR.SUPL_glo_utc_model_xml", glo_utc_default_xml_filename); std::string glo_utc_xml_filename = configuration_->property("GNSS-SDR.SUPL_glo_utc_model_xml", glo_utc_default_xml_filename);
std::string gal_almanac_xml_filename = configuration_->property("GNSS-SDR.SUPL_gal_almanacl_xml", gal_almanac_default_xml_filename);
std::string gps_almanac_xml_filename = configuration_->property("GNSS-SDR.SUPL_gps_almanacl_xml", gps_almanac_default_xml_filename);
if (configuration_->property("GNSS-SDR.AGNSS_XML_enabled", false) == true) if (configuration_->property("GNSS-SDR.AGNSS_XML_enabled", false) == true)
{ {
@ -249,6 +251,7 @@ bool ControlThread::read_assistance_from_XML()
cnav_utc_xml_filename = configuration_->property("GNSS-SDR.AGNSS_cnav_utc_model_xml", cnav_utc_default_xml_filename); cnav_utc_xml_filename = configuration_->property("GNSS-SDR.AGNSS_cnav_utc_model_xml", cnav_utc_default_xml_filename);
eph_glo_xml_filename = configuration_->property("GNSS-SDR.AGNSS_glo_ephemeris_xml", eph_glo_gnav_default_xml_filename); eph_glo_xml_filename = configuration_->property("GNSS-SDR.AGNSS_glo_ephemeris_xml", eph_glo_gnav_default_xml_filename);
glo_utc_xml_filename = configuration_->property("GNSS-SDR.AGNSS_glo_utc_model_xml", glo_utc_default_xml_filename); glo_utc_xml_filename = configuration_->property("GNSS-SDR.AGNSS_glo_utc_model_xml", glo_utc_default_xml_filename);
gal_almanac_xml_filename = configuration_->property("GNSS-SDR.AGNSS_gal_almanacl_xml", gal_almanac_default_xml_filename);
} }
std::cout << "Trying to read GNSS ephemeris from XML file(s)..." << std::endl; std::cout << "Trying to read GNSS ephemeris from XML file(s)..." << std::endl;
@ -284,6 +287,20 @@ bool ControlThread::read_assistance_from_XML()
std::cout << "From XML file: Read GPS ionosphere model parameters." << std::endl; std::cout << "From XML file: Read GPS ionosphere model parameters." << std::endl;
ret = true; ret = true;
} }
if (supl_client_ephemeris_.load_gps_almanac_xml(gps_almanac_xml_filename) == true)
{
std::map<int, Gps_Almanac>::const_iterator gps_alm_iter;
for (gps_alm_iter = supl_client_ephemeris_.gps_almanac_map.cbegin();
gps_alm_iter != supl_client_ephemeris_.gps_almanac_map.cend();
gps_alm_iter++)
{
std::cout << "From XML file: Read GPS almanac for satellite " << Gnss_Satellite("GPS", gps_alm_iter->second.i_satellite_PRN) << std::endl;
std::shared_ptr<Gps_Almanac> tmp_obj = std::make_shared<Gps_Almanac>(gps_alm_iter->second);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
}
ret = true;
}
} }
if ((configuration_->property("Channels_1B.count", 0) > 0) or (configuration_->property("Channels_5X.count", 0) > 0)) if ((configuration_->property("Channels_1B.count", 0) > 0) or (configuration_->property("Channels_5X.count", 0) > 0))
@ -317,6 +334,20 @@ bool ControlThread::read_assistance_from_XML()
std::cout << "From XML file: Read Galileo UTC model parameters." << std::endl; std::cout << "From XML file: Read Galileo UTC model parameters." << std::endl;
ret = true; ret = true;
} }
if (supl_client_ephemeris_.load_gal_almanac_xml(gal_almanac_xml_filename) == true)
{
std::map<int, Galileo_Almanac>::const_iterator gal_alm_iter;
for (gal_alm_iter = supl_client_ephemeris_.gal_almanac_map.cbegin();
gal_alm_iter != supl_client_ephemeris_.gal_almanac_map.cend();
gal_alm_iter++)
{
std::cout << "From XML file: Read Galileo almanac for satellite " << Gnss_Satellite("Galileo", gal_alm_iter->second.i_satellite_PRN) << std::endl;
std::shared_ptr<Galileo_Almanac> tmp_obj = std::make_shared<Galileo_Almanac>(gal_alm_iter->second);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
}
ret = true;
}
} }
if ((configuration_->property("Channels_2S.count", 0) > 0) or (configuration_->property("Channels_L5.count", 0) > 0)) if ((configuration_->property("Channels_2S.count", 0) > 0) or (configuration_->property("Channels_L5.count", 0) > 0))

View File

@ -180,6 +180,8 @@ private:
const std::string cnav_utc_default_xml_filename = "./gps_cnav_utc_model.xml"; const std::string cnav_utc_default_xml_filename = "./gps_cnav_utc_model.xml";
const std::string eph_glo_gnav_default_xml_filename = "./glo_gnav_ephemeris.xml"; const std::string eph_glo_gnav_default_xml_filename = "./glo_gnav_ephemeris.xml";
const std::string glo_utc_default_xml_filename = "./glo_utc_model.xml"; const std::string glo_utc_default_xml_filename = "./glo_utc_model.xml";
const std::string gal_almanac_default_xml_filename = "./gal_almanac.xml";
const std::string gps_almanac_default_xml_filename = "./gps_almanac.xml";
}; };
#endif /*GNSS_SDR_CONTROL_THREAD_H_*/ #endif /*GNSS_SDR_CONTROL_THREAD_H_*/

View File

@ -833,34 +833,42 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
DLOG(INFO) << "Channel " << who << " ACQ FAILED satellite " << channels_[who]->get_signal().get_satellite() << ", Signal " << channels_[who]->get_signal().get_signal_str(); DLOG(INFO) << "Channel " << who << " ACQ FAILED satellite " << channels_[who]->get_signal().get_satellite() << ", Signal " << channels_[who]->get_signal().get_signal_str();
if (sat == 0) if (sat == 0)
{ {
switch (mapStringValues_[channels_[who]->get_signal().get_signal_str()]) Gnss_Signal gs = channels_[who]->get_signal();
switch (mapStringValues_[gs.get_signal_str()])
{ {
case evGPS_1C: case evGPS_1C:
available_GPS_1C_signals_.push_back(channels_[who]->get_signal()); available_GPS_1C_signals_.remove(gs);
available_GPS_1C_signals_.push_back(gs);
break; break;
case evGPS_2S: case evGPS_2S:
available_GPS_2S_signals_.push_back(channels_[who]->get_signal()); available_GPS_2S_signals_.remove(gs);
available_GPS_2S_signals_.push_back(gs);
break; break;
case evGPS_L5: case evGPS_L5:
available_GPS_L5_signals_.push_back(channels_[who]->get_signal()); available_GPS_L5_signals_.remove(gs);
available_GPS_L5_signals_.push_back(gs);
break; break;
case evGAL_1B: case evGAL_1B:
available_GAL_1B_signals_.push_back(channels_[who]->get_signal()); available_GAL_1B_signals_.remove(gs);
available_GAL_1B_signals_.push_back(gs);
break; break;
case evGAL_5X: case evGAL_5X:
available_GAL_5X_signals_.push_back(channels_[who]->get_signal()); available_GAL_5X_signals_.remove(gs);
available_GAL_5X_signals_.push_back(gs);
break; break;
case evGLO_1G: case evGLO_1G:
available_GLO_1G_signals_.push_back(channels_[who]->get_signal()); available_GLO_1G_signals_.remove(gs);
available_GLO_1G_signals_.push_back(gs);
break; break;
case evGLO_2G: case evGLO_2G:
available_GLO_2G_signals_.push_back(channels_[who]->get_signal()); available_GLO_2G_signals_.remove(gs);
available_GLO_2G_signals_.push_back(gs);
break; break;
default: default:

View File

@ -30,6 +30,7 @@ set(SYSTEM_PARAMETERS_SOURCES
galileo_utc_model.cc galileo_utc_model.cc
galileo_ephemeris.cc galileo_ephemeris.cc
galileo_almanac.cc galileo_almanac.cc
galileo_almanac_helper.cc
galileo_iono.cc galileo_iono.cc
galileo_navigation_message.cc galileo_navigation_message.cc
sbas_ephemeris.cc sbas_ephemeris.cc
@ -59,6 +60,7 @@ set(SYSTEM_PARAMETERS_HEADERS
galileo_utc_model.h galileo_utc_model.h
galileo_ephemeris.h galileo_ephemeris.h
galileo_almanac.h galileo_almanac.h
galileo_almanac_helper.h
galileo_iono.h galileo_iono.h
galileo_navigation_message.h galileo_navigation_message.h
sbas_ephemeris.h sbas_ephemeris.h

View File

@ -1,7 +1,7 @@
/*! /*!
* \file galileo_almanac.cc * \file galileo_almanac.cc
* \brief Implementation of a Galileo ALMANAC storage * \brief Interface of a Galileo ALMANAC storage
* \author Javier Arribas, 2013. jarribas(at)cttc.es * \author Carles Fernandez, 2018. cfernandez(at)cttc.cat
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
@ -30,66 +30,23 @@
#include "galileo_almanac.h" #include "galileo_almanac.h"
Galileo_Almanac::Galileo_Almanac() Galileo_Almanac::Galileo_Almanac()
{ {
// Word type 7: Almanac for SVID1 (1/2), almanac reference time and almanac reference week number i_satellite_PRN = 0U;
IOD_a_7 = 0; d_Toa = 0.0;
WN_a_7 = 0.0; d_WNa = 0.0;
t0a_7 = 0.0; d_IODa = 0.0;
SVID1_7 = 0; d_Delta_i = 0.0;
DELTA_A_7 = 0.0; d_M_0 = 0.0;
e_7 = 0.0; d_e_eccentricity = 0.0;
omega_7 = 0.0; d_Delta_sqrt_A = 0.0;
delta_i_7 = 0.0; d_OMEGA0 = 0.0;
Omega0_7 = 0.0; d_OMEGA = 0.0;
Omega_dot_7 = 0.0; d_OMEGA_DOT = 0.0;
M0_7 = 0.0; d_A_f0 = 0.0;
d_A_f1 = 0.0;
// Word type 8: Almanac for SVID1 (2/2) and SVID2 (1/2) E5b_HS = 0.0;
IOD_a_8 = 0; E1B_HS = 0.0;
af0_8 = 0.0; E5a_HS = 0.0;
af1_8 = 0.0;
E5b_HS_8 = 0.0;
E1B_HS_8 = 0.0;
E5a_HS_8 = 0.0;
SVID2_8 = 0;
DELTA_A_8 = 0.0;
e_8 = 0.0;
omega_8 = 0.0;
delta_i_8 = 0.0;
Omega0_8 = 0.0;
Omega_dot_8 = 0.0;
// Word type 9: Almanac for SVID2 (2/2) and SVID3 (1/2)
IOD_a_9 = 0;
WN_a_9 = 0.0;
t0a_9 = 0.0;
M0_9 = 0.0;
af0_9 = 0.0;
af1_9 = 0.0;
E5b_HS_9 = 0.0;
E1B_HS_9 = 0.0;
E5a_HS_9 = 0.0;
SVID3_9 = 0;
DELTA_A_9 = 0.0;
e_9 = 0.0;
omega_9 = 0.0;
delta_i_9 = 0.0;
// Word type 10: Almanac for SVID3 (2/2)
IOD_a_10 = 0;
Omega0_10 = 0.0;
Omega_dot_10 = 0.0;
M0_10 = 0.0;
af0_10 = 0.0;
af1_10 = 0.0;
E5b_HS_10 = 0.0;
E1B_HS_10 = 0.0;
E5a_HS_10 = 0.0;
// GPS to Galileo GST conversion parameters
A_0G_10 = 0.0;
A_1G_10 = 0.0;
t_0G_10 = 0.0;
WN_0G_10 = 0.0;
} }

View File

@ -1,8 +1,8 @@
/*! /*!
* \file galileo_almanac.h * \file galileo_almanac.h
* \brief Interface of a Galileo ALMANAC storage * \brief Interface of a Galileo ALMANAC storage
* \author Javier Arribas, 2013. jarribas(at)cttc.es * \author Carles Fernandez, 2018. cfernandez(at)cttc.cat
* \author Mara Branzanti 2013. mara.branzanti(at)gmail.com *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors) * Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
@ -28,81 +28,65 @@
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*/ */
#ifndef GNSS_SDR_GALILEO_ALMANAC_H_ #ifndef GNSS_SDR_GALILEO_ALMANAC_H_
#define GNSS_SDR_GALILEO_ALMANAC_H_ #define GNSS_SDR_GALILEO_ALMANAC_H_
#include <boost/serialization/nvp.hpp>
#include <cstdint> #include <cstdint>
/*! /*!
* \brief This class is a storage for the GALILEO ALMANAC data as described in GALILEO ICD * \brief This class is a storage for the Galileo SV ALMANAC data
*
* See https://www.gsc-europa.eu/system/files/galileo_documents/Galileo_OS_SIS_ICD.pdf paragraph 5.1.10
*/ */
class Galileo_Almanac class Galileo_Almanac
{ {
public: public:
// Word type 7: Almanac for SVID1 (1/2), almanac reference time and almanac reference week number uint32_t i_satellite_PRN; //!< SV PRN NUMBER
int32_t IOD_a_7; double d_Toa;
double WN_a_7; double d_WNa;
double t0a_7; double d_IODa;
int32_t SVID1_7; double d_Delta_i;
double DELTA_A_7; double d_M_0; //!< Mean Anomaly at Reference Time [semi-circles]
double e_7; double d_e_eccentricity; //!< Eccentricity [dimensionless]
double omega_7; double d_Delta_sqrt_A; //!< Square Root of the Semi-Major Axis [sqrt(m)]
double delta_i_7; double d_OMEGA0; //!< Longitude of Ascending Node of Orbit Plane at Weekly Epoch [semi-circles]
double Omega0_7; double d_OMEGA; //!< Argument of Perigee [semi-cicles]
double Omega_dot_7; double d_OMEGA_DOT; //!< Rate of Right Ascension [semi-circles/s]
double M0_7; double d_A_f0; //!< Coefficient 0 of code phase offset model [s]
double d_A_f1; //!< Coefficient 1 of code phase offset model [s/s]
double E5b_HS;
double E1B_HS;
double E5a_HS;
// Word type 8: Almanac for SVID1 (2/2) and SVID2 (1/2) /*!
int32_t IOD_a_8; * Default constructor
double af0_8; */
double af1_8; Galileo_Almanac();
double E5b_HS_8;
double E1B_HS_8;
double E5a_HS_8;
int32_t SVID2_8;
double DELTA_A_8;
double e_8;
double omega_8;
double delta_i_8;
double Omega0_8;
double Omega_dot_8;
// Word type 9: Almanac for SVID2 (2/2) and SVID3 (1/2) template <class Archive>
int32_t IOD_a_9;
double WN_a_9;
double t0a_9;
double M0_9;
double af0_9;
double af1_9;
double E5b_HS_9;
double E1B_HS_9;
double E5a_HS_9;
int32_t SVID3_9;
double DELTA_A_9;
double e_9;
double omega_9;
double delta_i_9;
// Word type 10: Almanac for SVID3 (2/2) void serialize(Archive& ar, const unsigned int version)
int32_t IOD_a_10; {
double Omega0_10; if (version)
double Omega_dot_10; {
double M0_10; };
double af0_10; ar& BOOST_SERIALIZATION_NVP(i_satellite_PRN);
double af1_10; ar& BOOST_SERIALIZATION_NVP(d_Toa);
double E5b_HS_10; ar& BOOST_SERIALIZATION_NVP(d_WNa);
double E1B_HS_10; ar& BOOST_SERIALIZATION_NVP(d_IODa);
double E5a_HS_10; ar& BOOST_SERIALIZATION_NVP(d_Delta_i);
ar& BOOST_SERIALIZATION_NVP(d_M_0);
// GPS to Galileo GST conversion parameters ar& BOOST_SERIALIZATION_NVP(d_e_eccentricity);
double A_0G_10; ar& BOOST_SERIALIZATION_NVP(d_Delta_sqrt_A);
double A_1G_10; ar& BOOST_SERIALIZATION_NVP(d_OMEGA0);
double t_0G_10; ar& BOOST_SERIALIZATION_NVP(d_OMEGA);
double WN_0G_10; ar& BOOST_SERIALIZATION_NVP(d_OMEGA_DOT);
ar& BOOST_SERIALIZATION_NVP(d_A_f0);
Galileo_Almanac(); //!< Default constructor ar& BOOST_SERIALIZATION_NVP(d_A_f1);
ar& BOOST_SERIALIZATION_NVP(E5b_HS);
ar& BOOST_SERIALIZATION_NVP(E1B_HS);
ar& BOOST_SERIALIZATION_NVP(E5a_HS);
}
}; };
#endif #endif

View File

@ -0,0 +1,157 @@
/*!
* \file galileo_almanac_helper.cc
* \brief Implementation of a Galileo ALMANAC storage helper
* \author Javier Arribas, 2013. jarribas(at)cttc.es
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2018 (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 <https://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#include "galileo_almanac_helper.h"
Galileo_Almanac_Helper::Galileo_Almanac_Helper()
{
// Word type 7: Almanac for SVID1 (1/2), almanac reference time and almanac reference week number
IOD_a_7 = 0;
WN_a_7 = 0.0;
t0a_7 = 0.0;
SVID1_7 = 0;
DELTA_A_7 = 0.0;
e_7 = 0.0;
omega_7 = 0.0;
delta_i_7 = 0.0;
Omega0_7 = 0.0;
Omega_dot_7 = 0.0;
M0_7 = 0.0;
// Word type 8: Almanac for SVID1 (2/2) and SVID2 (1/2)
IOD_a_8 = 0;
af0_8 = 0.0;
af1_8 = 0.0;
E5b_HS_8 = 0.0;
E1B_HS_8 = 0.0;
E5a_HS_8 = 0.0;
SVID2_8 = 0;
DELTA_A_8 = 0.0;
e_8 = 0.0;
omega_8 = 0.0;
delta_i_8 = 0.0;
Omega0_8 = 0.0;
Omega_dot_8 = 0.0;
// Word type 9: Almanac for SVID2 (2/2) and SVID3 (1/2)
IOD_a_9 = 0;
WN_a_9 = 0.0;
t0a_9 = 0.0;
M0_9 = 0.0;
af0_9 = 0.0;
af1_9 = 0.0;
E5b_HS_9 = 0.0;
E1B_HS_9 = 0.0;
E5a_HS_9 = 0.0;
SVID3_9 = 0;
DELTA_A_9 = 0.0;
e_9 = 0.0;
omega_9 = 0.0;
delta_i_9 = 0.0;
// Word type 10: Almanac for SVID3 (2/2)
IOD_a_10 = 0;
Omega0_10 = 0.0;
Omega_dot_10 = 0.0;
M0_10 = 0.0;
af0_10 = 0.0;
af1_10 = 0.0;
E5b_HS_10 = 0.0;
E1B_HS_10 = 0.0;
E5a_HS_10 = 0.0;
}
Galileo_Almanac Galileo_Almanac_Helper::get_almanac(int i)
{
Galileo_Almanac galileo_almanac;
switch (i)
{
case 1:
galileo_almanac.i_satellite_PRN = this->SVID1_7;
galileo_almanac.d_Toa = this->t0a_7;
galileo_almanac.d_WNa = this->WN_a_7;
galileo_almanac.d_IODa = this->IOD_a_7;
galileo_almanac.d_Delta_i = this->delta_i_7;
galileo_almanac.d_M_0 = this->M0_7;
galileo_almanac.d_e_eccentricity = this->e_7;
galileo_almanac.d_Delta_sqrt_A = this->DELTA_A_7;
galileo_almanac.d_OMEGA0 = this->Omega0_7;
galileo_almanac.d_OMEGA = this->omega_7;
galileo_almanac.d_OMEGA_DOT = this->Omega_dot_7;
galileo_almanac.d_A_f0 = this->af0_8;
galileo_almanac.d_A_f1 = this->af1_8;
galileo_almanac.E5b_HS = this->E5b_HS_8;
galileo_almanac.E1B_HS = this->E1B_HS_8;
galileo_almanac.E5a_HS = this->E5a_HS_8;
break;
case 2:
galileo_almanac.i_satellite_PRN = this->SVID2_8;
galileo_almanac.d_Toa = this->t0a_9;
galileo_almanac.d_WNa = this->WN_a_9;
galileo_almanac.d_IODa = this->IOD_a_9;
galileo_almanac.d_Delta_i = this->delta_i_8;
galileo_almanac.d_M_0 = this->M0_9;
galileo_almanac.d_e_eccentricity = this->e_8;
galileo_almanac.d_Delta_sqrt_A = this->DELTA_A_8;
galileo_almanac.d_OMEGA0 = this->Omega0_8;
galileo_almanac.d_OMEGA = this->omega_8;
galileo_almanac.d_OMEGA_DOT = this->Omega_dot_8;
galileo_almanac.d_A_f0 = this->af0_9;
galileo_almanac.d_A_f1 = this->af1_9;
galileo_almanac.E5b_HS = this->E5b_HS_9;
galileo_almanac.E1B_HS = this->E1B_HS_9;
galileo_almanac.E5a_HS = this->E5a_HS_9;
break;
case 3:
galileo_almanac.i_satellite_PRN = this->SVID3_9;
galileo_almanac.d_Toa = this->t0a_9;
galileo_almanac.d_WNa = this->WN_a_9;
galileo_almanac.d_IODa = this->IOD_a_10;
galileo_almanac.d_Delta_i = this->delta_i_9;
galileo_almanac.d_M_0 = this->M0_10;
galileo_almanac.d_e_eccentricity = this->e_9;
galileo_almanac.d_Delta_sqrt_A = this->DELTA_A_9;
galileo_almanac.d_OMEGA0 = this->Omega0_10;
galileo_almanac.d_OMEGA = this->omega_9;
galileo_almanac.d_OMEGA_DOT = this->Omega_dot_10;
galileo_almanac.d_A_f0 = this->af0_10;
galileo_almanac.d_A_f1 = this->af1_10;
galileo_almanac.E5b_HS = this->E5b_HS_10;
galileo_almanac.E1B_HS = this->E1B_HS_10;
galileo_almanac.E5a_HS = this->E5a_HS_10;
break;
default:
break;
}
return galileo_almanac;
}

View File

@ -0,0 +1,104 @@
/*!
* \file galileo_almanac_helper.h
* \brief Interface of a Galileo ALMANAC storage helper
* \author Javier Arribas, 2013. jarribas(at)cttc.es
* \author Mara Branzanti 2013. mara.branzanti(at)gmail.com
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2018 (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 <https://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_GALILEO_ALMANAC_HELPER_H_
#define GNSS_SDR_GALILEO_ALMANAC_HELPER_H_
#include "galileo_almanac.h"
#include <cstdint>
/*!
* \brief This class is a storage for the GALILEO ALMANAC data as described in GALILEO ICD
*
* See https://www.gsc-europa.eu/system/files/galileo_documents/Galileo_OS_SIS_ICD.pdf paragraph 5.1.10
*/
class Galileo_Almanac_Helper
{
public:
// Word type 7: Almanac for SVID1 (1/2), almanac reference time and almanac reference week number
int32_t IOD_a_7;
double WN_a_7;
double t0a_7;
int32_t SVID1_7;
double DELTA_A_7;
double e_7;
double omega_7;
double delta_i_7;
double Omega0_7;
double Omega_dot_7;
double M0_7;
// Word type 8: Almanac for SVID1 (2/2) and SVID2 (1/2)
int32_t IOD_a_8;
double af0_8;
double af1_8;
double E5b_HS_8;
double E1B_HS_8;
double E5a_HS_8;
int32_t SVID2_8;
double DELTA_A_8;
double e_8;
double omega_8;
double delta_i_8;
double Omega0_8;
double Omega_dot_8;
// Word type 9: Almanac for SVID2 (2/2) and SVID3 (1/2)
int32_t IOD_a_9;
double WN_a_9;
double t0a_9;
double M0_9;
double af0_9;
double af1_9;
double E5b_HS_9;
double E1B_HS_9;
double E5a_HS_9;
int32_t SVID3_9;
double DELTA_A_9;
double e_9;
double omega_9;
double delta_i_9;
// Word type 10: Almanac for SVID3 (2/2)
int32_t IOD_a_10;
double Omega0_10;
double Omega_dot_10;
double M0_10;
double af0_10;
double af1_10;
double E5b_HS_10;
double E1B_HS_10;
double E5a_HS_10;
Galileo_Almanac_Helper(); //!< Default constructor
Galileo_Almanac get_almanac(int i);
};
#endif

View File

@ -630,9 +630,9 @@ Galileo_Utc_Model Galileo_Fnav_Message::get_utc_model()
} }
Galileo_Almanac Galileo_Fnav_Message::get_almanac() Galileo_Almanac_Helper Galileo_Fnav_Message::get_almanac()
{ {
Galileo_Almanac almanac; Galileo_Almanac_Helper almanac;
// FNAV equivalent of INAV Word type 7: Almanac for SVID1 (1/2), almanac reference time and almanac reference week number // FNAV equivalent of INAV Word type 7: Almanac for SVID1 (1/2), almanac reference time and almanac reference week number
almanac.IOD_a_7 = FNAV_IODa_5; almanac.IOD_a_7 = FNAV_IODa_5;
almanac.WN_a_7 = FNAV_WNa_5; almanac.WN_a_7 = FNAV_WNa_5;

View File

@ -40,7 +40,7 @@
#include "galileo_ephemeris.h" #include "galileo_ephemeris.h"
#include "galileo_iono.h" #include "galileo_iono.h"
#include "galileo_almanac.h" #include "galileo_almanac_helper.h"
#include "galileo_utc_model.h" #include "galileo_utc_model.h"
#include "Galileo_E5a.h" #include "Galileo_E5a.h"
#include <bitset> #include <bitset>
@ -66,7 +66,7 @@ public:
Galileo_Ephemeris get_ephemeris(); Galileo_Ephemeris get_ephemeris();
Galileo_Iono get_iono(); Galileo_Iono get_iono();
Galileo_Utc_Model get_utc_model(); Galileo_Utc_Model get_utc_model();
Galileo_Almanac get_almanac(); Galileo_Almanac_Helper get_almanac();
Galileo_Fnav_Message(); Galileo_Fnav_Message();

View File

@ -578,13 +578,18 @@ Galileo_Utc_Model Galileo_Navigation_Message::get_utc_model()
utc_model.DN_6 = DN_6; utc_model.DN_6 = DN_6;
utc_model.Delta_tLSF_6 = Delta_tLSF_6; utc_model.Delta_tLSF_6 = Delta_tLSF_6;
utc_model.flag_utc_model = flag_utc_model; utc_model.flag_utc_model = flag_utc_model;
// GPS to Galileo GST conversion parameters
utc_model.A_0G_10 = A_0G_10;
utc_model.A_1G_10 = A_1G_10;
utc_model.t_0G_10 = t_0G_10;
utc_model.WN_0G_10 = WN_0G_10;
return utc_model; return utc_model;
} }
Galileo_Almanac Galileo_Navigation_Message::get_almanac() Galileo_Almanac_Helper Galileo_Navigation_Message::get_almanac()
{ {
Galileo_Almanac almanac; Galileo_Almanac_Helper almanac;
// Word type 7: Almanac for SVID1 (1/2), almanac reference time and almanac reference week number // Word type 7: Almanac for SVID1 (1/2), almanac reference time and almanac reference week number
almanac.IOD_a_7 = IOD_a_7; almanac.IOD_a_7 = IOD_a_7;
almanac.WN_a_7 = WN_a_7; almanac.WN_a_7 = WN_a_7;
@ -637,12 +642,6 @@ Galileo_Almanac Galileo_Navigation_Message::get_almanac()
almanac.E5b_HS_10 = E5b_HS_10; almanac.E5b_HS_10 = E5b_HS_10;
almanac.E1B_HS_10 = E1B_HS_10; almanac.E1B_HS_10 = E1B_HS_10;
// GPS to Galileo GST conversion parameters
almanac.A_0G_10 = A_0G_10;
almanac.A_1G_10 = A_1G_10;
almanac.t_0G_10 = t_0G_10;
almanac.WN_0G_10 = WN_0G_10;
return almanac; return almanac;
} }

View File

@ -35,7 +35,7 @@
#include "galileo_ephemeris.h" #include "galileo_ephemeris.h"
#include "galileo_iono.h" #include "galileo_iono.h"
#include "galileo_almanac.h" #include "galileo_almanac_helper.h"
#include "galileo_utc_model.h" #include "galileo_utc_model.h"
#include "Galileo_E1.h" #include "Galileo_E1.h"
#include <bitset> #include <bitset>
@ -290,9 +290,9 @@ public:
Galileo_Utc_Model get_utc_model(); Galileo_Utc_Model get_utc_model();
/* /*
* \brief Returns a Galileo_Almanac object filled with the latest navigation data received * \brief Returns a Galileo_Almanac_Helper object filled with the latest navigation data received
*/ */
Galileo_Almanac get_almanac(); Galileo_Almanac_Helper get_almanac();
Galileo_Navigation_Message(); Galileo_Navigation_Message();
}; };

View File

@ -43,6 +43,11 @@ Galileo_Utc_Model::Galileo_Utc_Model()
DN_6 = 0.0; DN_6 = 0.0;
Delta_tLSF_6 = 0.0; Delta_tLSF_6 = 0.0;
flag_utc_model = false; flag_utc_model = false;
// GPS to Galileo GST conversion parameters
A_0G_10 = 0.0;
A_1G_10 = 0.0;
t_0G_10 = 0.0;
WN_0G_10 = 0.0;
} }

View File

@ -53,6 +53,13 @@ public:
double DN_6; double DN_6;
double Delta_tLSF_6; double Delta_tLSF_6;
bool flag_utc_model; bool flag_utc_model;
// GPS to Galileo GST conversion parameters
double A_0G_10;
double A_1G_10;
double t_0G_10;
double WN_0G_10;
//double TOW_6; //double TOW_6;
double GST_to_UTC_time(double t_e, int WN); //!< GST-UTC Conversion Algorithm and Parameters double GST_to_UTC_time(double t_e, int WN); //!< GST-UTC Conversion Algorithm and Parameters
/*! /*!

View File

@ -32,6 +32,7 @@
#ifndef GNSS_SDR_GPS_ALMANAC_H_ #ifndef GNSS_SDR_GPS_ALMANAC_H_
#define GNSS_SDR_GPS_ALMANAC_H_ #define GNSS_SDR_GPS_ALMANAC_H_
#include <boost/serialization/nvp.hpp>
#include <cstdint> #include <cstdint>
/*! /*!
@ -59,6 +60,27 @@ public:
* Default constructor * Default constructor
*/ */
Gps_Almanac(); Gps_Almanac();
template <class Archive>
void serialize(Archive& ar, const unsigned int version)
{
if (version)
{
};
ar& BOOST_SERIALIZATION_NVP(i_satellite_PRN);
ar& BOOST_SERIALIZATION_NVP(d_Delta_i);
ar& BOOST_SERIALIZATION_NVP(d_Toa);
ar& BOOST_SERIALIZATION_NVP(d_M_0);
ar& BOOST_SERIALIZATION_NVP(d_e_eccentricity);
ar& BOOST_SERIALIZATION_NVP(d_sqrt_A);
ar& BOOST_SERIALIZATION_NVP(d_OMEGA0);
ar& BOOST_SERIALIZATION_NVP(d_OMEGA);
ar& BOOST_SERIALIZATION_NVP(d_OMEGA_DOT);
ar& BOOST_SERIALIZATION_NVP(i_SV_health);
ar& BOOST_SERIALIZATION_NVP(d_A_f0);
ar& BOOST_SERIALIZATION_NVP(d_A_f1);
}
}; };
#endif #endif