mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 04:30:33 +00:00
Read Galileo almamac xml file if present
This commit is contained in:
parent
07d1a74f6b
commit
c4b2aa8cc4
@ -786,6 +786,53 @@ bool gnss_sdr_supl_client::save_gal_iono_xml(const std::string file_name, Galile
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
std::ifstream ifs;
|
||||
|
@ -51,6 +51,7 @@ extern "C"
|
||||
#include "galileo_ephemeris.h"
|
||||
#include "galileo_utc_model.h"
|
||||
#include "galileo_iono.h"
|
||||
#include "galileo_almanac.h"
|
||||
#include "glonass_gnav_ephemeris.h"
|
||||
#include "glonass_gnav_utc_model.h"
|
||||
#include <boost/archive/xml_oarchive.hpp>
|
||||
@ -90,6 +91,7 @@ public:
|
||||
|
||||
// almanac map
|
||||
std::map<int, Gps_Almanac> gps_almanac_map;
|
||||
std::map<int, Galileo_Almanac> gal_almanac_map;
|
||||
|
||||
// ionospheric model
|
||||
Gps_Iono gps_iono;
|
||||
@ -195,6 +197,16 @@ public:
|
||||
*/
|
||||
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 iono from XML file
|
||||
*/
|
||||
|
@ -234,6 +234,7 @@ 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 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 gal_almanac_xml_filename = configuration_->property("GNSS-SDR.SUPL_gal_almanacl_xml", gal_almanac_default_xml_filename);
|
||||
|
||||
if (configuration_->property("GNSS-SDR.AGNSS_XML_enabled", false) == true)
|
||||
{
|
||||
@ -249,6 +250,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);
|
||||
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);
|
||||
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;
|
||||
@ -317,6 +319,20 @@ bool ControlThread::read_assistance_from_XML()
|
||||
std::cout << "From XML file: Read Galileo UTC model parameters." << std::endl;
|
||||
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))
|
||||
|
@ -180,6 +180,7 @@ private:
|
||||
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 glo_utc_default_xml_filename = "./glo_utc_model.xml";
|
||||
const std::string gal_almanac_default_xml_filename = "./gal_almanac.xml";
|
||||
};
|
||||
|
||||
#endif /*GNSS_SDR_CONTROL_THREAD_H_*/
|
||||
|
Loading…
Reference in New Issue
Block a user