Adding RINEX observation file for Galileo

This commit is contained in:
Carles Fernandez 2014-09-01 13:03:24 +02:00
parent 8e70de41ed
commit 12f2b73d44
3 changed files with 106 additions and 16 deletions

View File

@ -199,12 +199,12 @@ int galileo_e1_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_it
rp->log_rinex_nav(rp->navGalFile, d_ls_pvt->galileo_ephemeris_map);
d_last_sample_nav_output = d_sample_counter;
}
// std::map<int, Galileo_Ephemeris>::iterator galileo_ephemeris_iter;
// galileo_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.begin();
// if (galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.end())
// {
// rp->log_rinex_obs(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, gnss_pseudoranges_map);
// }
std::map<int, Galileo_Ephemeris>::iterator galileo_ephemeris_iter;
galileo_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.begin();
if (galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.end())
{
rp->log_rinex_obs(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, gnss_pseudoranges_map);
}
}
}
}

View File

@ -341,7 +341,6 @@ std::string Rinex_Printer::getLocalTime()
if (version == 3)
{
//line += std::string(1, ' ');
line += boost::gregorian::to_iso_string(today);
line += std::string(1, ' ');
line += strmHour.str();
@ -1767,15 +1766,7 @@ void Rinex_Printer::log_rinex_obs(std::ofstream& out, Gps_Ephemeris eph, double
{
lineObs += Rinex_Printer::rightJustify(Rinex_Printer::asString<short>(lli), 1);
}
int ssi=signalStrength(54.0); // TODO: include estimated signal strength
if (ssi == 0)
{
lineObs += std::string(1, ' ');
}
else
{
lineObs += Rinex_Printer::rightJustify(Rinex_Printer::asString<short>(ssi), 1);
}
lineObs += Rinex_Printer::rightJustify(asString(pseudoranges_iter->second.CN0_dB_hz, 3), 14);
if (lineObs.size() < 80) lineObs += std::string(80 - lineObs.size(), ' ');
out << lineObs << std::endl;
}
@ -1784,6 +1775,103 @@ void Rinex_Printer::log_rinex_obs(std::ofstream& out, Gps_Ephemeris eph, double
void Rinex_Printer::log_rinex_obs(std::ofstream& out, Galileo_Ephemeris eph, double obs_time, std::map<int,Gnss_Synchro> pseudoranges)
{
// RINEX observations timestamps are Galileo timestamps.
std::string line;
boost::posix_time::ptime p_galileo_time = Rinex_Printer::compute_Galileo_time(eph, obs_time);
std::string timestring = boost::posix_time::to_iso_string(p_galileo_time);
//double utc_t = nav_msg.utc_time(nav_msg.sv_clock_correction(obs_time));
//double gps_t = eph.sv_clock_correction(obs_time);
double galileo_t = obs_time;
std::string month (timestring, 4, 2);
std::string day (timestring, 6, 2);
std::string hour (timestring, 9, 2);
std::string minutes (timestring, 11, 2);
std::string year (timestring, 0, 4);
line += std::string(1, '>');
line += std::string(1, ' ');
line += year;
line += std::string(1, ' ');
line += month;
line += std::string(1, ' ');
line += day;
line += std::string(1, ' ');
line += hour;
line += std::string(1, ' ');
line += minutes;
line += std::string(1, ' ');
double seconds=fmod(galileo_t, 60);
// Add extra 0 if seconds are < 10
if (seconds<10)
{
line +=std::string(1, '0');
}
line += Rinex_Printer::asString(seconds, 7);
line += std::string(2, ' ');
// Epoch flag 0: OK 1: power failure between previous and current epoch <1: Special event
line += std::string(1, '0');
//Number of satellites observed in current epoch
int numSatellitesObserved = 0;
std::map<int,Gnss_Synchro>::iterator pseudoranges_iter;
for(pseudoranges_iter = pseudoranges.begin();
pseudoranges_iter != pseudoranges.end();
pseudoranges_iter++)
{
numSatellitesObserved++;
}
line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(numSatellitesObserved), 3);
// Receiver clock offset (optional)
//line += rightJustify(asString(clockOffset, 12), 15);
line += std::string(80 - line.size(), ' ');
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
for(pseudoranges_iter = pseudoranges.begin();
pseudoranges_iter != pseudoranges.end();
pseudoranges_iter++)
{
std::string lineObs;
lineObs.clear();
lineObs += satelliteSystem["Galileo"];
if ((int)pseudoranges_iter->first < 10) lineObs += std::string(1, '0');
lineObs += boost::lexical_cast<std::string>((int)pseudoranges_iter->first);
//lineObs += std::string(2, ' ');
lineObs += Rinex_Printer::rightJustify(asString(pseudoranges_iter->second.Pseudorange_m, 3), 14);
//Loss of lock indicator (LLI)
int lli = 0; // Include in the observation!!
if (lli == 0)
{
lineObs += std::string(1, ' ');
}
else
{
lineObs += Rinex_Printer::rightJustify(Rinex_Printer::asString<short>(lli), 1);
}
// Galileo E1B PHASE
lineObs += Rinex_Printer::rightJustify(asString(pseudoranges_iter->second.Carrier_phase_rads/(2*GALILEO_PI), 3), 14);
// Galileo E1B DOPPLER
lineObs += Rinex_Printer::rightJustify(asString(pseudoranges_iter->second.Carrier_Doppler_hz, 3), 14);
// Galileo E1B SIGNAL STRENGTH
lineObs += Rinex_Printer::rightJustify(asString(pseudoranges_iter->second.CN0_dB_hz, 3), 14);
if (lineObs.size() < 80) lineObs += std::string(80 - lineObs.size(), ' ');
out << lineObs << std::endl;
}
// }
}
// represents GPS time (week, TOW) in the date time format of the Gregorian calendar.
// -> Leap years are considered, but leap seconds not.
void Rinex_Printer::to_date_time(int gps_week, int gps_tow, int &year, int &month, int &day, int &hour, int &minute, int &second)

View File

@ -130,6 +130,8 @@ public:
*/
void log_rinex_obs(std::ofstream& out, Gps_Ephemeris eph, double obs_time, std::map<int,Gnss_Synchro> pseudoranges);
void log_rinex_obs(std::ofstream& out, Galileo_Ephemeris eph, double obs_time, std::map<int,Gnss_Synchro> pseudoranges);
/*!
* \brief Represents GPS time in the date time format. Leap years are considered, but leap seconds are not.
*/