1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-12 19:20:32 +00:00

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

This commit is contained in:
Carles Fernandez 2017-11-03 16:18:54 +01:00
commit a8005b5652
6 changed files with 34 additions and 117 deletions

View File

@ -67,7 +67,7 @@ Observables.dump_filename=/archive/glo_observables.dat
;######### PVT CONFIG ############
PVT.implementation=RTKLIB_PVT
PVT.positioning_mode=PPP_Static
PVT.positioning_mode=Single
PVT.output_rate_ms=100
PVT.display_rate_ms=500
PVT.trop_model=Saastamoinen

View File

@ -91,7 +91,7 @@ geph_t eph_to_rtklib(const Glonass_Gnav_Ephemeris & glonass_gnav_eph, const Glon
rtklib_sat.age = static_cast<int>(glonass_gnav_eph.d_Delta_tau_n); /* delay between L1 and L2 (s) */
// Time expressed in GPS Time but using RTKLib format
glonass_gnav_eph.glot_to_gpst(glonass_gnav_eph.d_tod, gnav_clock_model.d_tau_c, gnav_clock_model.d_tau_gps, &week, &sec);
glonass_gnav_eph.glot_to_gpst(glonass_gnav_eph.d_t_b, gnav_clock_model.d_tau_c, gnav_clock_model.d_tau_gps, &week, &sec);
adj_week = adjgpsweek(static_cast<int>(week));
rtklib_sat.toe = gpst2time(adj_week, sec);

View File

@ -355,7 +355,7 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attrib
if (this->d_flag_preamble == true and d_nav.flag_TOW_new == true)
//update TOW at the preamble instant
{
d_TOW_at_current_symbol = floor((d_nav.gnav_ephemeris.d_TOW - GLONASS_GNAV_PREAMBLE_DURATION_S)*1000)/1000;
d_TOW_at_current_symbol = floor((d_nav.gnav_ephemeris.d_TOW-GLONASS_GNAV_PREAMBLE_DURATION_S)*1000)/1000;
d_nav.flag_TOW_new = false;
}

View File

@ -140,6 +140,7 @@ void Glonass_Gnav_Ephemeris::glot_to_gpst(double tod_offset, double glot2utc_cor
sec_of_day = static_cast<double>((glonass_time.time_of_day()).total_seconds());
total_sec = days*86400 + sec_of_day;
// GLONASST already includes leap second addition or deletion
for (i = 0; GLONASS_LEAP_SECONDS[i][0]>0; i++)
{
if (d_yr >= GLONASS_LEAP_SECONDS[i][0])

View File

@ -315,78 +315,6 @@ unsigned int Glonass_Gnav_Navigation_Message::get_frame_number(unsigned int sate
return frame_ID;
}
double Glonass_Gnav_Navigation_Message::get_WN()
{
double WN = 0.0;
double days = 0.0;
double total_sec = 0.0;
int i = 0;
boost::gregorian::date gps_epoch { 1980, 1, 6 };
// Map to UTC
boost::gregorian::date glo_date(gnav_ephemeris.d_yr, 1, 1);
boost::gregorian::days d2(gnav_ephemeris.d_N_T-1);
glo_date = glo_date + d2;
boost::posix_time::time_duration t(-6, 0, 0);
boost::posix_time::ptime glo_time(glo_date, t);
boost::gregorian::date utc_date = glo_time.date();
days = static_cast<double>((utc_date - gps_epoch).days());
total_sec = days*86400;
for (i = 0; GLONASS_LEAP_SECONDS[i][0]>0; i++)
{
if (GLONASS_LEAP_SECONDS[i][0] == gnav_ephemeris.d_yr)
{
// We add the leap second when going from utc to gpst
total_sec += GLONASS_LEAP_SECONDS[i][6];
}
}
WN = floor(total_sec/604800);
return WN;
}
double Glonass_Gnav_Navigation_Message::get_TOW()
{
double TOD = 0.0;
double TOW = 0.0;
double dayofweek = 0.0;
double utcsu2utc = 3*3600;
double glot2utcsu = 3*3600;
int i = 0;
// tk is relative to UTC(SU) + 3.00 hrs, so we need to convert to utc and add corrections
// tk plus 10 sec is the true tod since get_TOW is called when in str5
TOD = (gnav_ephemeris.d_t_k + 10) - glot2utcsu - utcsu2utc;// + gnav_utc_model.d_tau_c + gnav_utc_model.d_tau_gps;
boost::gregorian::date glo_date(gnav_ephemeris.d_yr, 1, 1);
boost::gregorian::days d2(gnav_ephemeris.d_N_T);
glo_date = glo_date + d2;
dayofweek = static_cast<double>(glo_date.day_of_week());
TOW = TOD + dayofweek*86400;
for (i = 0; GLONASS_LEAP_SECONDS[i][0]>0; i++)
{
if (gnav_ephemeris.d_yr >= GLONASS_LEAP_SECONDS[i][0])
{
// We add the leap second when going from utc to gpst
TOW += fabs(GLONASS_LEAP_SECONDS[i][6]);
}
}
// Compute the arithmetic modules to wrap around range
TOW = TOW - 604800*floor(TOW/604800);
return TOW;
}
int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
{
@ -426,7 +354,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
{
gnav_ephemeris.d_B_n = static_cast<double>(read_navigation_unsigned(string_bits, B_N));
gnav_ephemeris.d_P_2 = static_cast<bool>(read_navigation_bool(string_bits, P2));
gnav_ephemeris.d_t_b = static_cast<double>(read_navigation_unsigned(string_bits, T_B)) * gnav_ephemeris.d_P_1 * 60;
gnav_ephemeris.d_t_b = static_cast<double>(read_navigation_unsigned(string_bits, T_B)) * 15 * 60;
gnav_ephemeris.d_VYn = static_cast<double>(read_navigation_signed(string_bits, Y_N_DOT)) * TWO_N20;
gnav_ephemeris.d_AYn = static_cast<double>(read_navigation_signed(string_bits, Y_N_DOT_DOT)) * TWO_N30;
gnav_ephemeris.d_Yn = static_cast<double>(read_navigation_signed(string_bits, Y_N)) * TWO_N11;
@ -759,15 +687,6 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
}
double Glonass_Gnav_Navigation_Message::utc_time(const double glonass_time_corrected) const
{
double t_utc;
t_utc = glonass_time_corrected + 3*3600 + gnav_utc_model.d_tau_c;
return t_utc;
}
Glonass_Gnav_Ephemeris Glonass_Gnav_Navigation_Message::get_ephemeris()
{
return gnav_ephemeris;
@ -814,9 +733,9 @@ bool Glonass_Gnav_Navigation_Message::have_new_ephemeris() //Check if we have a
bool Glonass_Gnav_Navigation_Message::have_new_utc_model() // Check if we have a new utc data set stored in the galileo navigation class
{
if (flag_utc_model_valid == true)
if (flag_utc_model_str_5 == true)
{
flag_utc_model_valid = false; // clear the flag
flag_utc_model_str_5 = false; // clear the flag
return true;
}
else

View File

@ -65,7 +65,6 @@ public:
unsigned int d_string_ID;
bool flag_update_slot_number;
// satellite identification info
int i_channel_ID;
unsigned int i_satellite_PRN;
@ -102,17 +101,25 @@ public:
bool flag_TOW_set; //!< Flag indicating when the TOW has been set
bool flag_TOW_new; //!< Flag indicating when a new TOW has been computed
// Clock terms
double d_satClkCorr; // Satellite clock error
double d_dtr; // Relativistic clock correction term
double d_satClkDrift; // Satellite clock drift
double d_satClkCorr; //!< Satellite clock error
double d_dtr; //!< Relativistic clock correction term
double d_satClkDrift; //!< Satellite clock drift
// Data update parameters
double d_previous_tb;
double d_previous_Na[GLONASS_L1_CA_NBR_SATS];
double d_previous_tb; //!< Previous iode for the Glonass_Gnav_Ephemeris object. Used to determine when new data arrives
double d_previous_Na[GLONASS_L1_CA_NBR_SATS]; //!< Previous time for almanac of the Glonass_Gnav_Almanac object
/*!
* \brief Compute CRC for GLONASS GNAV strings
* \param bits Bits of the string message where to compute CRC
*/
bool CRC_test(std::bitset<GLONASS_GNAV_STRING_BITS> bits);
/*!
* \brief Computes the frame number being decoded given the satellite slot number
* \param satellite_slot_number [in] Satellite slot number identifier
* \returns Frame number being decoded, 0 if operation was not successful.
*/
unsigned int get_frame_number(unsigned int satellite_slot_number);
/*!
@ -130,45 +137,35 @@ public:
*/
Glonass_Gnav_Utc_Model get_utc_model();
/*
* \brief Returns a Galileo_Almanac object filled with the latest navigation data received
/*!
* \brief Returns a Glonass_Gnav_Almanac object filled with the latest navigation data received
* \param satellite_slot_number Slot number identifier for the satellite
* \returns Returns the Glonass_Gnav_Almanac object for the input slot number
*/
Glonass_Gnav_Almanac get_almanac(unsigned int satellite_slot_number);
/*
* \brief Returns true if new Ephemeris has arrived. The flag is set to false when the function is executed
/*!
* \brief Returns true if a new Glonass_Gnav_Ephemeris object has arrived.
*/
bool have_new_ephemeris();
/*
* \brief Returns true if new UTC model has arrived. The flag is set to false when the function is executed
/*!
* \brief Returns true if new Glonass_Gnav_Utc_Model object has arrived
*/
bool have_new_utc_model();
/*
* \brief Returns true if new UTC model has arrived. The flag is set to false when the function is executed
/*!
* \brief Returns true if new Glonass_Gnav_Almanac object has arrived.
*/
bool have_new_almanac();
/*!
* \brief Decodes the GLONASS GNAV string
* \param frame_string [in] is the string message within the parsed frame
* \returns Returns the ID of the decoded string
*/
int string_decoder(std::string frame_string);
/*!
* \brief Gets the time of week in GPS Time
* \details This converts from GLONASS Time to GPS Time of Week based on the
* start of frame
*/
double get_TOW();
double get_WN();
/*!
* \brief Computes the Coordinated Universal Time (UTC) and returns it in [s]
*/
double utc_time(const double glonasstime_corrected) const;
/*!
* Default constructor
*/