mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-18 05:03:01 +00:00
bugfix: Fixing bugs with RINEX support
Fixes compilation errors. Modifies GLONASS GNAV Ephemeris object to contain fields relative to GPS time using the boost posix time object. Adds unit tests to check existent and recently added code
This commit is contained in:
parent
2d40780689
commit
d34ec96ad2
@ -188,9 +188,9 @@ void rtklib_pvt_cc::msg_handler_telemetry(pmt::pmt_t msg)
|
||||
glonass_gnav_eph = boost::any_cast<std::shared_ptr<Glonass_Gnav_Ephemeris>>(pmt::any_ref(msg));
|
||||
// TODO Add GLONASS with gps week number and tow,
|
||||
// insert new ephemeris record
|
||||
DLOG(INFO) << "GLONASS GNAV New Ephemeris record inserted in global map with TOW =" << glonass_gnav_eph->TOW_5
|
||||
<< ", GLONASS GNAV Week Number =" << glonass_gnav_eph->WN_5
|
||||
<< " and Ephemeris IOD = " << glonass_gnav_eph->IOD_ephemeris;
|
||||
DLOG(INFO) << "GLONASS GNAV New Ephemeris record inserted in global map with TOW =" << glonass_gnav_eph->d_TOW
|
||||
<< ", GLONASS GNAV Week Number =" << glonass_gnav_eph->d_WN
|
||||
<< " and Ephemeris IOD = " << glonass_gnav_eph->compute_GLONASS_time(glonass_gnav_eph->d_t_b);
|
||||
// update/insert new ephemeris record to the global ephemeris map
|
||||
d_ls_pvt->glonass_gnav_ephemeris_map[glonass_gnav_eph->i_satellite_PRN] = *glonass_gnav_eph;
|
||||
}
|
||||
@ -200,7 +200,7 @@ void rtklib_pvt_cc::msg_handler_telemetry(pmt::pmt_t msg)
|
||||
std::shared_ptr<Glonass_Gnav_Utc_Model> glonass_gnav_utc_model;
|
||||
glonass_gnav_utc_model = boost::any_cast<std::shared_ptr<Glonass_Gnav_Utc_Model>>(pmt::any_ref(msg));
|
||||
d_ls_pvt->glonass_gnav_utc_model = *glonass_gnav_utc_model;
|
||||
DLOG(INFO) << "New UTC record has arrived ";
|
||||
DLOG(INFO) << "New GLONASS GNAV UTC record has arrived ";
|
||||
}
|
||||
else if(pmt::any_ref(msg).type() == typeid(std::shared_ptr<Glonass_Gnav_Almanac>) )
|
||||
{
|
||||
@ -557,7 +557,7 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite
|
||||
{
|
||||
if(tmp_eph_iter_glo_gnav != d_ls_pvt->glonass_gnav_ephemeris_map.end())
|
||||
{
|
||||
d_rtcm_printer->lock_time(d_ls_pvt->glonass_gnav_ephemeris_map.find(in[i][epoch].PRN)->second, in[i][epoch].RX_time, in[i][epoch]); // keep track of locking time
|
||||
//d_rtcm_printer->lock_time(d_ls_pvt->glonass_gnav_ephemeris_map.find(in[i][epoch].PRN)->second, in[i][epoch].RX_time, in[i][epoch]); // keep track of locking time
|
||||
}
|
||||
}
|
||||
|
||||
@ -853,7 +853,8 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite
|
||||
if ((glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.cend()) && (galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.cend()) )
|
||||
{
|
||||
std::string glo_signal("1C");
|
||||
rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, glo_signal);
|
||||
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_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);
|
||||
b_rinex_header_written = true; // do not write header anymore
|
||||
}
|
||||
@ -1068,9 +1069,7 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite
|
||||
{
|
||||
if ((glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.end()) && (gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.end()) )
|
||||
{
|
||||
std::string glo_signal("1C");
|
||||
rp->log_rinex_obs(rp->obsFile, gps_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, glo_signal);
|
||||
|
||||
rp->log_rinex_obs(rp->obsFile, gps_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map);
|
||||
}
|
||||
if (!b_rinex_header_updated && (d_ls_pvt->gps_utc_model.d_A0 != 0))
|
||||
{
|
||||
@ -1081,10 +1080,10 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite
|
||||
}
|
||||
if(type_of_rx == 27) // Galileo E1B + GLONASS L1 C/A
|
||||
{
|
||||
if ((glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.end()) && (gal_ephemeris_iter != d_ls_pvt->gal_ephemeris_map.end()) )
|
||||
if ((glonass_gnav_ephemeris_iter != d_ls_pvt->glonass_gnav_ephemeris_map.end()) && (galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.end()) )
|
||||
{
|
||||
std::string glo_signal("1C");
|
||||
rp->log_rinex_obs(rp->obsFile, galileo_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, glo_signal);
|
||||
rp->log_rinex_obs(rp->obsFile, galileo_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map);
|
||||
|
||||
}
|
||||
if (!b_rinex_header_updated && (d_ls_pvt->galileo_utc_model.A0_6 != 0))
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -124,7 +124,7 @@ public:
|
||||
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);
|
||||
|
||||
/*!
|
||||
* \brief Generates the Mixed (GLONASS L1, L2/GPS L1 C/A) Navigation Data header
|
||||
* \brief Generates the Mixed (GPS L1 C/A/GLONASS L1, L2) Navigation Data header
|
||||
*/
|
||||
void rinex_nav_header(std::fstream & out, const Gps_Iono & gps_iono, const Gps_Utc_Model & gps_utc_model, const Glonass_Gnav_Utc_Model & glonass_gnav_utc_model, const Glonass_Gnav_Almanac & glonass_gnav_almanac);
|
||||
|
||||
@ -166,7 +166,7 @@ public:
|
||||
/*!
|
||||
* \brief Generates the Mixed (Galileo/GLONASS) Observation data header. Example: galileo_bands("1C"), galileo_bands("1B 5X"), galileo_bands("5X"), ... Default: "1B".
|
||||
*/
|
||||
void rinex_obs_header(std::fstream & out, const Galileo_Ephemeris & galileo_eph, const Glonass_Gnav_Ephemeris & glonass_gnav_eph, const double d_TOW_first_observation, const std::string glo_bands = "1C");
|
||||
void rinex_obs_header(std::fstream & out, const Galileo_Ephemeris & galileo_eph, const Glonass_Gnav_Ephemeris & glonass_gnav_eph, const double d_TOW_first_observation, const std::string galileo_bands = "1B", const std::string glo_bands = "1C");
|
||||
|
||||
/*!
|
||||
* \brief Generates the SBAS raw data header
|
||||
@ -218,6 +218,21 @@ public:
|
||||
*/
|
||||
void log_rinex_nav(std::fstream & out, const std::map<int, Gps_Ephemeris> & gps_eph_map, const std::map<int, Galileo_Ephemeris> & galileo_eph_map);
|
||||
|
||||
/*!
|
||||
* \brief Writes data from the GLONASS GNAV navigation message into the RINEX file
|
||||
*/
|
||||
void log_rinex_nav(std::fstream & out, const std::map<int, Glonass_Gnav_Ephemeris> & eph_map);
|
||||
|
||||
/*!
|
||||
* \brief Writes data from the Mixed (GPS/GLONASS GNAV) navigation message into the RINEX file
|
||||
*/
|
||||
void log_rinex_nav(std::fstream & out, const std::map<int, Gps_Ephemeris> & gps_eph_map, const std::map<int, Glonass_Gnav_Ephemeris> & glonass_gnav_eph_map);
|
||||
|
||||
/*!
|
||||
* \brief Writes data from the Mixed (Galileo/ GLONASS GNAV) navigation message into the RINEX file
|
||||
*/
|
||||
void log_rinex_nav(std::fstream & out, const std::map<int, Galileo_Ephemeris> & galileo_eph_map, const std::map<int, Glonass_Gnav_Ephemeris> & glonass_gnav_eph_map);
|
||||
|
||||
/*!
|
||||
* \brief Writes GPS L1 observables into the RINEX file
|
||||
*/
|
||||
@ -278,7 +293,7 @@ public:
|
||||
|
||||
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 Gps_Utc_Model & gps_utc, const Gps_Iono & gps_iono, 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_Iono & gps_iono, const Gps_Utc_Model & gps_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);
|
||||
|
||||
|
@ -126,6 +126,7 @@ bool rtklib_solver::get_PVT(const std::map<int,Gnss_Synchro> & gnss_observables_
|
||||
|
||||
obsd_t obs_data[MAXOBS];
|
||||
eph_t eph_data[MAXOBS];
|
||||
geph_t geph_data[MAXOBS];
|
||||
|
||||
for(gnss_observables_iter = gnss_observables_map.cbegin();
|
||||
gnss_observables_iter != gnss_observables_map.cend();
|
||||
@ -441,5 +442,5 @@ bool rtklib_solver::get_PVT(const std::map<int,Gnss_Synchro> & gnss_observables_
|
||||
}
|
||||
}
|
||||
}
|
||||
return this->is_valid_position();
|
||||
}
|
||||
return b_valid_position;
|
||||
}
|
||||
|
@ -68,53 +68,49 @@ geph_t eph_to_rtklib(const Glonass_Gnav_Ephemeris & glonass_gnav_eph)
|
||||
{
|
||||
geph_t rtklib_sat = {0, 0, 0, 0, 0, 0, {0, 0}, {0, 0}, {0.0, 0.0, 0.0}, {0.0, 0.0,
|
||||
0.0}, {0.0, 0.0, 0.0}, 0.0, 0.0, 0.0};
|
||||
gtime_t t_utc;
|
||||
struct tm utcinfo;
|
||||
|
||||
int iode; /* IODE (0-6 bit of tb field) */
|
||||
int frq; /* satellite frequency number */
|
||||
int svh,sva,age; /* satellite health, accuracy, age of operation */
|
||||
gtime_t toe; /* epoch of epherides (gpst) */
|
||||
gtime_t tof; /* message frame time (gpst) */
|
||||
double pos[3]; /* satellite position (ecef) (m) */
|
||||
double vel[3]; /* satellite velocity (ecef) (m/s) */
|
||||
double acc[3]; /* satellite acceleration (ecef) (m/s^2) */
|
||||
double taun,gamn; /* SV clock bias (s)/relative freq bias */
|
||||
double dtaun;
|
||||
rtklib_sat.sat = glonass_gnav_eph.i_satellite_slot_number; /* satellite number */
|
||||
rtklib_sat.iode = glonass_gnav_eph.d_t_b; /* IODE (0-6 bit of tb field) */
|
||||
rtklib_sat.frq = glonass_gnav_eph.i_satellite_freq_channel; /* satellite frequency number */
|
||||
rtklib_sat.svh = glonass_gnav_eph.d_l_n; /* satellite health*/
|
||||
rtklib_sat.sva = glonass_gnav_eph.d_F_T; /* satellite accuracy*/
|
||||
rtklib_sat.age = glonass_gnav_eph.d_E_n; /* satellite age*/
|
||||
rtklib_sat.pos[0] = glonass_gnav_eph.d_Xn*1000; /* satellite position (ecef) (m) */
|
||||
rtklib_sat.pos[1] = glonass_gnav_eph.d_Yn*1000; /* satellite position (ecef) (m) */
|
||||
rtklib_sat.pos[2] = glonass_gnav_eph.d_Zn*1000; /* satellite position (ecef) (m) */
|
||||
rtklib_sat.vel[0] = glonass_gnav_eph.d_VXn*1000; /* satellite velocity (ecef) (m/s) */
|
||||
rtklib_sat.vel[1] = glonass_gnav_eph.d_VYn*1000; /* satellite velocity (ecef) (m/s) */
|
||||
rtklib_sat.vel[2] = glonass_gnav_eph.d_VZn*1000; /* satellite velocity (ecef) (m/s) */
|
||||
rtklib_sat.acc[0] = glonass_gnav_eph.d_AXn*1000; /* satellite acceleration (ecef) (m/s^2) */
|
||||
rtklib_sat.acc[1] = glonass_gnav_eph.d_AYn*1000; /* satellite acceleration (ecef) (m/s^2) */
|
||||
rtklib_sat.acc[2] = glonass_gnav_eph.d_AZn*1000; /* satellite acceleration (ecef) (m/s^2) */
|
||||
rtklib_sat.taun = glonass_gnav_eph.d_tau_n; /* SV clock bias (s) */
|
||||
rtklib_sat.gamn = glonass_gnav_eph.d_gamma_n; /* SV relative freq bias */
|
||||
rtklib_sat.age = glonass_gnav_eph.d_Delta_tau_n; /* delay between L1 and L2 (s) */
|
||||
|
||||
rtklib_sat.sat = glonass_gnav_eph.i_satellite_PRN; /* satellite number */
|
||||
rtklib_sat.iode = glonass_gnav_eph.d_sqrt_A;
|
||||
rtklib_sat.frq = glonass_gnav_eph.;
|
||||
rtklib_sat.svh = glonass_gnav_eph.;
|
||||
rtklib_sat.sva = glonass_gnav_eph.
|
||||
rtklib_sat.age = glonass_gnav_eph.
|
||||
/* TODO: adjustment for week handover */
|
||||
utcinfo.tm_mon = 0;
|
||||
utcinfo.tm_mday = glonass_gnav_eph.d_D4Y;
|
||||
utcinfo.tm_year = glonass_gnav_eph.d_yr - 1900;
|
||||
utcinfo.tm_hour = 0;
|
||||
utcinfo.tm_min = 0;
|
||||
utcinfo.tm_sec = glonass_gnav_eph.d_t_b;
|
||||
t_utc.time = mktime(&utcinfo);
|
||||
t_utc.sec = 0.0;
|
||||
rtklib_sat.toe = utc2gpst(t_utc); /* epoch of epherides (gpst) */
|
||||
|
||||
rtklib_sat.toe = gpst2time(rtklib_sat.week, gps_eph.d_Toc);
|
||||
rtklib_sat.toc = gpst2time(rtklib_sat.week, gps_eph.d_TOW);
|
||||
utcinfo.tm_mon = 0;
|
||||
utcinfo.tm_mday = glonass_gnav_eph.d_D4Y;
|
||||
utcinfo.tm_year = glonass_gnav_eph.d_yr - 1900;
|
||||
utcinfo.tm_hour = 0;
|
||||
utcinfo.tm_min = 0;
|
||||
utcinfo.tm_sec = glonass_gnav_eph.d_t_k;
|
||||
t_utc.time = mktime(&utcinfo);
|
||||
t_utc.sec = 0.0;
|
||||
rtklib_sat.tof = utc2gpst(t_utc); /* message frame time (gpst) */
|
||||
|
||||
rtklib_sat.pos[0] = glonass_gnav_eph.d_Xn;
|
||||
rtklib_sat.pos[1] = glonass_gnav_eph.d_Yn;
|
||||
rtklib_sat.pos[2] = glonass_gnav_eph.d_Zn;
|
||||
|
||||
rtklib_sat.vel[0] = glonass_gnav_eph.d_VXn;
|
||||
rtklib_sat.vel[1] = glonass_gnav_eph.d_VYn;
|
||||
rtklib_sat.vel[2] = glonass_gnav_eph.d_VZn;
|
||||
|
||||
rtklib_sat.acc[0] = glonass_gnav_eph.d_AXn;
|
||||
rtklib_sat.acc[1] = glonass_gnav_eph.d_AYn;
|
||||
rtklib_sat.acc[2] = glonass_gnav_eph.d_AZn;
|
||||
|
||||
rtklib_sat.taun = glonass_gnav_eph.d_tau_n; /* SV clock bias (s) */
|
||||
rtklib_sat.gann = glonass_gnav_eph.d_gamma_n; /* SV relative freq bias */
|
||||
rtklib_sat.gann = glonass_gnav_eph.d_gamma_n;
|
||||
|
||||
/* adjustment for week handover */
|
||||
double tow, toc;
|
||||
tow = time2gpst(rtklib_sat.ttr, &rtklib_sat.week);
|
||||
toc = time2gpst(rtklib_sat.toc, NULL);
|
||||
if (rtklib_sat.toes < tow - 302400.0) {rtklib_sat.week++; tow -= 604800.0;}
|
||||
else if (rtklib_sat.toes > tow + 302400.0) {rtklib_sat.week--; tow += 604800.0;}
|
||||
rtklib_sat.toe = gpst2time(rtklib_sat.week, rtklib_sat.toes);
|
||||
rtklib_sat.toc = gpst2time(rtklib_sat.week, toc);
|
||||
rtklib_sat.ttr = gpst2time(rtklib_sat.week, tow);
|
||||
|
||||
return rtklib_sat;
|
||||
}
|
||||
|
@ -103,8 +103,8 @@ const int GLONASS_GNAV_PREAMBLE_PERIOD_SYMBOLS = 1700;
|
||||
const int GLONASS_GNAV_FRAME_BITS = 1725; //!< Number of chips per frame in the GNAV message 15 strings*(85 data bits + 30 time mark bits)[bits]
|
||||
const int GLONASS_GNAV_FRAME_SECONDS = 30; //!< Subframe duration [seconds]
|
||||
const int GLONASS_GNAV_FRAME_MS = 30000; //!< Subframe duration [seconds]
|
||||
const int GLONASS_GNAV_STRING_BITS = 115; //!< Number of bits per string in the GNAV message (85 data bits + 30 time mark bits) [bits]
|
||||
const int GLONASS_GNAV_HAMMING_CODE_BITS = 115; //!< Number of bits in hamming code sequence of GNAV message
|
||||
const int GLONASS_GNAV_STRING_BITS = 85; //!< Number of bits per string in the GNAV message (85 data bits + 30 time mark bits) [bits]
|
||||
const int GLONASS_GNAV_HAMMING_CODE_BITS = 8; //!< Number of bits in hamming code sequence of GNAV message
|
||||
|
||||
const std::vector<int> GLONASS_GNAV_CRC_I_INDEX {9, 10, 12, 13, 15, 17, 19, 20, 22, 24, 26, 28, 30, 32, 34, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84};
|
||||
const std::vector<int> GLONASS_GNAV_CRC_J_INDEX {9, 11, 12, 14, 15, 18, 19, 21, 22, 25, 26, 29, 30, 33, 34, 36, 37, 40, 41, 44, 45, 48, 49, 52, 53, 56, 57, 60, 61, 64, 65, 67, 68, 71, 72, 75, 76, 79, 80, 83, 84};
|
||||
@ -124,7 +124,9 @@ const std::vector<std::pair<int,int>> STRING_ID({{2,4}});
|
||||
const std::vector<std::pair<int,int>> KX({{78,8}});
|
||||
//STRING 1
|
||||
const std::vector<std::pair<int,int>> P1({{8,2}});
|
||||
const std::vector<std::pair<int,int>> T_K({{10,12}});
|
||||
const std::vector<std::pair<int,int>> T_K_HR({{10,5}});
|
||||
const std::vector<std::pair<int,int>> T_K_MIN({{10,6}});
|
||||
const std::vector<std::pair<int,int>> T_K_SEC({{10,1}});
|
||||
const std::vector<std::pair<int,int>> X_N_DOT ({{22,24}});
|
||||
const std::vector<std::pair<int,int>> X_N_DOT_DOT ({{46,5}});
|
||||
const std::vector<std::pair<int,int>> X_N({{51,27}});
|
||||
|
@ -53,6 +53,7 @@ Glonass_Gnav_Almanac::Glonass_Gnav_Almanac()
|
||||
d_KP = 0.0;
|
||||
d_tau_n_A = 0.0;
|
||||
d_C_n = 0.0;
|
||||
d_l_n = 0.0;
|
||||
}
|
||||
|
||||
void Glonass_Gnav_Almanac::satellite_position(double N_i, double t_i)
|
||||
|
@ -62,7 +62,8 @@ public:
|
||||
double d_M_n_A; //!< Type of satellite n_A [dimensionless]
|
||||
double d_KP; //!< Notification on forthcoming leap second correction of UTC [dimensionless]
|
||||
double d_tau_n_A; //!< Coarse value of d_n_A satellite time correction to GLONASS time at instant t_lambdan_A[s]
|
||||
double d_C_n; //!< Generalized “unhealthy flag” of n_A satellite at instant of almanac upload [dimensionless]
|
||||
double d_C_n; //!< Generalized “unhealthy flag” of n_A satellite at instant of almanac upload [dimensionless]
|
||||
double d_l_n; //!< Health flag for nth satellite; ln = 0 indicates the n-th satellite is helthy, ln = 1 indicates malfunction of this nth satellite [dimensionless]
|
||||
|
||||
// satellite positions
|
||||
double d_satpos_Xo; //!< Earth-fixed coordinate x of the satellite in PZ-90.02 coordinate system [km].
|
||||
@ -109,6 +110,7 @@ public:
|
||||
archive & make_nvp("d_KP", d_KP);
|
||||
archive & make_nvp("d_tau_n_A", d_tau_n_A);
|
||||
archive & make_nvp("d_C_n", d_C_n);
|
||||
archive & make_nvp("d_l_n", d_l_n);
|
||||
}
|
||||
|
||||
void satellite_position(double N_i, double t_i);
|
||||
|
@ -34,6 +34,8 @@
|
||||
|
||||
#include "glonass_gnav_ephemeris.h"
|
||||
#include <cmath>
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
|
||||
#include "GLONASS_L1_CA.h"
|
||||
#include "gnss_satellite.h"
|
||||
|
||||
@ -77,6 +79,16 @@ Glonass_Gnav_Ephemeris::Glonass_Gnav_Ephemeris()
|
||||
}
|
||||
|
||||
|
||||
boost::posix_time::ptime Glonass_Gnav_Ephemeris::compute_GLONASS_time(const double offset_time) const
|
||||
{
|
||||
boost::posix_time::time_duration t(0, 0, offset_time);
|
||||
boost::gregorian::date d(d_yr, 1, d_N_T);
|
||||
boost::posix_time::ptime glonass_time(d, t);
|
||||
|
||||
return glonass_time;
|
||||
}
|
||||
|
||||
|
||||
void Glonass_Gnav_Ephemeris::gravitational_perturbations()
|
||||
{
|
||||
double T = 0.0;
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <string>
|
||||
#include "boost/assign.hpp"
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
|
||||
|
||||
|
||||
@ -59,62 +60,68 @@ private:
|
||||
|
||||
void gravitational_perturbations();
|
||||
|
||||
double d_Jx_moon; //!< Moon gravitational perturbation
|
||||
double d_Jy_moon; //!< Moon gravitational perturbation
|
||||
double d_Jz_moon; //!< Moon gravitational perturbation
|
||||
double d_Jx_moon; //!< Moon gravitational perturbation
|
||||
double d_Jy_moon; //!< Moon gravitational perturbation
|
||||
double d_Jz_moon; //!< Moon gravitational perturbation
|
||||
|
||||
double d_Jx_sun; //!< Sun gravitational perturbation
|
||||
double d_Jy_sun; //!< Sun gravitational perturbation
|
||||
double d_Jz_sun; //!< Sun gravitational perturbation
|
||||
double d_Jx_sun; //!< Sun gravitational perturbation
|
||||
double d_Jy_sun; //!< Sun gravitational perturbation
|
||||
double d_Jz_sun; //!< Sun gravitational perturbation
|
||||
|
||||
public:
|
||||
int i_satellite_freq_channel; // SV Frequency Channel Number
|
||||
double d_m; //!< String number within frame [dimensionless]
|
||||
double d_t_k; //!< Time referenced to the beginning of the frame within the current day [hours, minutes, seconds]
|
||||
double d_t_b; //!< Index of a time interval within current day according to UTC(SU) + 03 hours 00 min. [minutes]
|
||||
double d_M; //!< Type of satellite transmitting navigation signal [dimensionless]
|
||||
double d_gamma_n; //!< Relative deviation of predicted carrier frequency value of n- satellite from nominal value at the instant tb [dimensionless]
|
||||
double d_tau_n; //!< Correction to the nth satellite time (tn) relative to GLONASS time (te),
|
||||
double d_m; //!< String number within frame [dimensionless]
|
||||
double d_t_k; //!< GLONASS Time (UTC(SU) + 3 h) referenced to the beginning of the frame within the current day [s]
|
||||
double d_t_b; //!< Reference ephemeris relative time in GLONASS Time (UTC(SU) + 3 h). Index of a time interval within current day according to UTC(SU) + 03 hours 00 min. [s]
|
||||
double d_M; //!< Type of satellite transmitting navigation signal [dimensionless]
|
||||
double d_gamma_n; //!< Relative deviation of predicted carrier frequency value of n- satellite from nominal value at the instant tb [dimensionless]
|
||||
double d_tau_n; //!< Correction to the nth satellite time (tn) relative to GLONASS time (te),
|
||||
double d_Xn; //!< Earth-fixed coordinate x of the satellite in PZ-90.02 coordinate system [km].
|
||||
double d_Yn; //!< Earth-fixed coordinate y of the satellite in PZ-90.02 coordinate system [km]
|
||||
double d_Zn; //!< Earth-fixed coordinate z of the satellite in PZ-90.02 coordinate system [km]
|
||||
double d_VXn; //!< Earth-fixed velocity coordinate x of the satellite in PZ-90.02 coordinate system [km/s]
|
||||
double d_VYn; //!< Earth-fixed velocity coordinate y of the satellite in PZ-90.02 coordinate system [km/s]
|
||||
double d_VZn; //!< Earth-fixed velocity coordinate z of the satellite in PZ-90.02 coordinate system [km/s]
|
||||
double d_AXn; //!< Earth-fixed acceleration coordinate x of the satellite in PZ-90.02 coordinate system [km/s^2]
|
||||
double d_AYn; //!< Earth-fixed acceleration coordinate y of the satellite in PZ-90.02 coordinate system [km/s^2]
|
||||
double d_AZn; //!< Earth-fixed acceleration coordinate z of the satellite in PZ-90.02 coordinate system [km/s^2]
|
||||
double d_B_n; //!< Health flag [dimensionless]
|
||||
double d_P; //!< Technological parameter of control segment, indication the satellite operation mode in respect of time parameters [dimensionless]
|
||||
double d_N_T; //!< Current date, calendar number of day within four-year interval starting from the 1-st of January in a leap year [days]
|
||||
double d_F_T; //!< Parameter that provides the predicted satellite user range accuracy at time tb [dimensionless]
|
||||
double d_n; //!< Index of the satellite transmitting given navigation signal. It corresponds to a slot number within GLONASS constellation
|
||||
double d_Delta_tau_n; //!< Time difference between navigation RF signal transmitted in L2 sub- band and aviation RF signal transmitted in L1 sub-band by nth satellite. [dimensionless]
|
||||
double d_E_n; //!< Characterises "age" of a current information [days]
|
||||
double d_P_1; //!< Flag of the immediate data updating [minutes]
|
||||
double d_P_2; //!< Flag of oddness ("1") or evenness ("0") of the value of (tb) [dimensionless]
|
||||
double d_P_3; //!< Flag indicating a number of satellites for which almanac is transmitted within given frame: "1" corresponds to 5 satellites and "0" corresponds to 4 satellites [dimensionless]
|
||||
double d_P_4; //!< Flag to show that ephemeris parameters are present. "1" indicates that updated ephemeris or frequency/time parameters have been uploaded by the control segment [dimensionless]
|
||||
double d_l_n; //!< Health flag for nth satellite; ln = 0 indicates the n-th satellite is helthy, ln = 1 indicates malfunction of this nth satellite [dimensionless]
|
||||
|
||||
// satellite positions
|
||||
double d_Xn; //!< Earth-fixed coordinate x of the satellite in PZ-90.02 coordinate system [km].
|
||||
double d_Yn; //!< Earth-fixed coordinate y of the satellite in PZ-90.02 coordinate system [km]
|
||||
double d_Zn; //!< Earth-fixed coordinate z of the satellite in PZ-90.02 coordinate system [km]
|
||||
// Satellite velocity
|
||||
double d_VXn; //!< Earth-fixed velocity coordinate x of the satellite in PZ-90.02 coordinate system [km/s]
|
||||
double d_VYn; //!< Earth-fixed velocity coordinate y of the satellite in PZ-90.02 coordinate system [km/s]
|
||||
double d_VZn; //!< Earth-fixed velocity coordinate z of the satellite in PZ-90.02 coordinate system [km/s]
|
||||
// Satellite acceleration
|
||||
double d_AXn; //!< Earth-fixed acceleration coordinate x of the satellite in PZ-90.02 coordinate system [km/s^2]
|
||||
double d_AYn; //!< Earth-fixed acceleration coordinate y of the satellite in PZ-90.02 coordinate system [km/s^2]
|
||||
double d_AZn; //!< Earth-fixed acceleration coordinate z of the satellite in PZ-90.02 coordinate system [km/s^2]
|
||||
// Inmediate deliverables of ephemris information
|
||||
int i_satellite_freq_channel; //!< SV Frequency Channel Number
|
||||
unsigned int i_satellite_PRN; //!< SV PRN NUMBER
|
||||
unsigned int i_satellite_slot_number; //!< SV PRN NUMBER
|
||||
double d_TOD; //!< Time of Day of the ephemeris set based in start of frame [s]
|
||||
double d_D4Y; //!< Day of Year after latest leap year (4 year interval)
|
||||
double d_yr; //!< Current year
|
||||
double d_satClkDrift; //!< GLONASS clock error
|
||||
double d_dtr; //!< relativistic clock correction term
|
||||
double d_iode; //!< Issue of data, ephemeris (Bit 0-6 of tb)
|
||||
double d_tau_c;
|
||||
double d_TOW; // tow of the start of frame
|
||||
double d_WN; // week number of the start of frame
|
||||
|
||||
double d_B_n; //!< Health flag [dimensionless]
|
||||
double d_P; //!< Technological parameter of control segment, indication the satellite operation mode in respect of time parameters [dimensionless]
|
||||
double d_N_T; //!< Current date, calendar number of day within four-year interval starting from the 1-st of January in a leap year [days]
|
||||
double d_F_T; //!< Parameter that provides the predicted satellite user range accuracy at time tb [dimensionless]
|
||||
double d_n; //!< Index of the satellite transmitting given navigation signal. It corresponds to a slot number within GLONASS constellation
|
||||
double d_Delta_tau_n; //!< Time difference between navigation RF signal transmitted in L2 sub- band and aviation RF signal transmitted in L1 sub-band by nth satellite. [dimensionless]
|
||||
double d_E_n; //!< Characterises "age" of a current information [days]
|
||||
double d_P_1; //!< Flag of the immediate data updating.
|
||||
double d_P_2; //!< Flag of oddness ("1") or evenness ("0") of the value of (tb) [dimensionless]
|
||||
double d_P_3; //!< Flag indicating a number of satellites for which almanac is transmitted within given frame: "1" corresponds to 5 satellites and "0" corresponds to 4 satellites [dimensionless]
|
||||
double d_P_4; //!< Flag to show that ephemeris parameters are present. "1" indicates that updated ephemeris or frequency/time parameters have been uploaded by the control segment [dimensionless]
|
||||
double d_l_n; //!< Health flag for nth satellite; ln = 0 indicates the n-th satellite is helthy, ln = 1 indicates malfunction of this nth satellite [dimensionless]
|
||||
// Need to add a way to compute the GPS week number and GPS TIME OF WEEK from GLONASS ephemeris
|
||||
|
||||
// clock terms derived from ephemeris data
|
||||
double d_satClkDrift; //!< GPS clock error
|
||||
double d_dtr; //!< relativistic clock correction term
|
||||
|
||||
// satellite positions
|
||||
// satellite positions after RK4 Integration
|
||||
double d_satpos_X; //!< Earth-fixed coordinate x of the satellite in PZ-90.02 coordinate system [km].
|
||||
double d_satpos_Y; //!< Earth-fixed coordinate y of the satellite in PZ-90.02 coordinate system [km]
|
||||
double d_satpos_Z; //!< Earth-fixed coordinate z of the satellite in PZ-90.02 coordinate system [km]
|
||||
// Satellite velocity
|
||||
// Satellite velocity after RK4 Integration
|
||||
double d_satvel_X; //!< Earth-fixed velocity coordinate x of the satellite in PZ-90.02 coordinate system [km/s]
|
||||
double d_satvel_Y; //!< Earth-fixed velocity coordinate y of the satellite in PZ-90.02 coordinate system [km/s]
|
||||
double d_satvel_Z; //!< Earth-fixed velocity coordinate z of the satellite in PZ-90.02 coordinate system [km/s]
|
||||
// Satellite acceleration
|
||||
// Satellite acceleration after RK4 Integration
|
||||
double d_satacc_X; //!< Earth-fixed acceleration coordinate x of the satellite in PZ-90.02 coordinate system [km/s^2]
|
||||
double d_satacc_Y; //!< Earth-fixed acceleration coordinate y of the satellite in PZ-90.02 coordinate system [km/s^2]
|
||||
double d_satacc_Z; //!< Earth-fixed acceleration coordinate z of the satellite in PZ-90.02 coordinate system [km/s^2]
|
||||
@ -136,6 +143,15 @@ public:
|
||||
archive & make_nvp("d_M", d_M); //!< Type of satellite transmitting navigation signal [dimensionless]
|
||||
archive & make_nvp("d_gamma_n", d_gamma_n); //!< Relative deviation of predicted carrier frequency value of n- satellite from nominal value at the instant tb [dimensionless]
|
||||
archive & make_nvp("d_tau_n", d_tau_n); //!< Correction to the nth satellite time (tn) relative to GLONASS time (te)
|
||||
archive & make_nvp("d_Xn", d_Xn); //!< Earth-fixed coordinate x of the satellite in PZ-90.02 coordinate system [km].
|
||||
archive & make_nvp("d_Yn", d_Yn); //!< Earth-fixed coordinate y of the satellite in PZ-90.02 coordinate system [km]
|
||||
archive & make_nvp("d_Zn", d_Zn); //!< Earth-fixed coordinate z of the satellite in PZ-90.02 coordinate system [km]
|
||||
archive & make_nvp("d_VXn", d_VXn); //!< Earth-fixed velocity coordinate x of the satellite in PZ-90.02 coordinate system [km/s]
|
||||
archive & make_nvp("d_VYn", d_VYn); //!< Earth-fixed velocity coordinate y of the satellite in PZ-90.02 coordinate system [km/s]
|
||||
archive & make_nvp("d_VZn", d_VZn); //!< Earth-fixed velocity coordinate z of the satellite in PZ-90.02 coordinate system [km/s]
|
||||
archive & make_nvp("d_AXn", d_AXn); //!< Earth-fixed acceleration coordinate x of the satellite in PZ-90.02 coordinate system [km/s^2]
|
||||
archive & make_nvp("d_AYn", d_AYn); //!< Earth-fixed acceleration coordinate y of the satellite in PZ-90.02 coordinate system [km/s^2]
|
||||
archive & make_nvp("d_AZn", d_AZn); //!< Earth-fixed acceleration coordinate z of the satellite in PZ-90.02 coordinate system [km/s^2]
|
||||
archive & make_nvp("d_B_n", d_B_n); //!< Health flag [dimensionless]
|
||||
archive & make_nvp("d_P", d_P); //!< Technological parameter of control segment, indication the satellite operation mode in respect of time parameters [dimensionless]
|
||||
archive & make_nvp("d_N_T", d_N_T); //!< Current date, calendar number of day within four-year interval starting from the 1-st of January in a leap year [days]
|
||||
@ -172,7 +188,7 @@ public:
|
||||
* \brief Sets (\a d_satClkDrift)and returns the clock drift in seconds according to the User Algorithm for SV Clock Correction
|
||||
* (IS-GPS-200E, 20.3.3.3.3.1)
|
||||
*/
|
||||
double sv_clock_drift(double transmitTime);
|
||||
double sv_clock_drift(double transmitTime, double timeCorrUTC);
|
||||
|
||||
/*!
|
||||
* \brief Sets (\a d_dtr) and returns the clock relativistic correction term in seconds according to the User Algorithm for SV Clock Correction
|
||||
@ -181,6 +197,12 @@ public:
|
||||
double sv_clock_relativistic_term(double transmitTime);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Computes the GLONASS System Time and returns a boost::posix_time::ptime object
|
||||
* \ param offset_time Is the start of day offset to compute the time
|
||||
*/
|
||||
boost::posix_time::ptime compute_GLONASS_time(const double offset_time) const;
|
||||
|
||||
/*!
|
||||
* Default constructor
|
||||
*/
|
||||
|
@ -104,7 +104,7 @@ Glonass_Gnav_Navigation_Message::Glonass_Gnav_Navigation_Message()
|
||||
}
|
||||
|
||||
|
||||
bool Glonass_Gnav_Navigation_Message::_CRC_test(std::bitset<GLONASS_GNAV_STRING_BITS> bits)
|
||||
bool Glonass_Gnav_Navigation_Message::CRC_test(std::bitset<GLONASS_GNAV_STRING_BITS> bits)
|
||||
{
|
||||
int sum_bits;
|
||||
int sum_hamming;
|
||||
@ -118,7 +118,7 @@ bool Glonass_Gnav_Navigation_Message::_CRC_test(std::bitset<GLONASS_GNAV_STRING_
|
||||
int C_Sigma = 0;
|
||||
|
||||
std::bitset<GLONASS_GNAV_STRING_BITS> data = std::bitset<GLONASS_GNAV_STRING_BITS>(bits.to_string(), 0, 77);
|
||||
std::bitset<GLONASS_GNAV_HAMMING_CODE_BITS> hamming_code = std::bitset<GLONASS_GNAV_STRING_BITS>(bits.to_string(), 77, 8);
|
||||
std::bitset<GLONASS_GNAV_HAMMING_CODE_BITS> hamming_code = std::bitset<GLONASS_GNAV_HAMMING_CODE_BITS>(bits.to_string(), 77, 8);
|
||||
|
||||
std::istringstream dsb = std::istringstream( data.to_string() );
|
||||
std::istringstream hcb = std::istringstream( hamming_code.to_string() );
|
||||
@ -345,13 +345,14 @@ unsigned int Glonass_Gnav_Navigation_Message::get_frame_number(unsigned int sate
|
||||
int Glonass_Gnav_Navigation_Message::string_decoder(char * frame_string)
|
||||
{
|
||||
int string_ID = 0;
|
||||
int frame_ID = 0;
|
||||
int J = 0;
|
||||
frame_ID = 0;
|
||||
|
||||
// UNPACK BYTES TO BITS AND REMOVE THE CRC REDUNDANCE
|
||||
std::bitset<GLONASS_GNAV_STRING_BITS> string_bits = std::bitset<GLONASS_GNAV_STRING_BITS>(std::string(frame_string));
|
||||
string_ID = static_cast<int>(read_navigation_unsigned(string_bits, STRING_ID));
|
||||
|
||||
_CRC_test(string_bits);
|
||||
CRC_test(string_bits);
|
||||
|
||||
// Decode all 15 string messages
|
||||
switch (string_ID)
|
||||
@ -359,11 +360,17 @@ int Glonass_Gnav_Navigation_Message::string_decoder(char * frame_string)
|
||||
case 1:
|
||||
//--- It is string 1 -----------------------------------------------
|
||||
gnav_ephemeris.d_P_1 = static_cast<double>(read_navigation_unsigned(string_bits, P1));
|
||||
gnav_ephemeris.d_t_k = static_cast<double>(read_navigation_unsigned(string_bits, T_K));
|
||||
gnav_ephemeris.d_VXn = static_cast<double>(read_navigation_signed(string_bits, X_N_DOT));
|
||||
gnav_ephemeris.d_AXn = static_cast<double>(read_navigation_signed(string_bits, X_N_DOT_DOT));
|
||||
gnav_ephemeris.d_Xn = static_cast<double>(read_navigation_signed(string_bits, X_N));
|
||||
gnav_ephemeris.d_t_k = static_cast<double>(read_navigation_unsigned(string_bits, T_K_HR)) * 3600 +
|
||||
static_cast<double>(read_navigation_unsigned(string_bits, T_K_MIN)) * 60 +
|
||||
static_cast<double>(read_navigation_unsigned(string_bits, T_K_SEC)) * 30;
|
||||
gnav_ephemeris.d_VXn = static_cast<double>(read_navigation_signed(string_bits, X_N_DOT)) * 2e-20;
|
||||
gnav_ephemeris.d_AXn = static_cast<double>(read_navigation_signed(string_bits, X_N_DOT_DOT)) * 2e-30;
|
||||
gnav_ephemeris.d_Xn = static_cast<double>(read_navigation_signed(string_bits, X_N)) * 2e-11;
|
||||
|
||||
if(gnav_ephemeris.d_P_1 != 0)
|
||||
{
|
||||
gnav_ephemeris.d_P_1 = (gnav_ephemeris.d_P_1 + 1)*15;
|
||||
}
|
||||
flag_ephemeris_str_1 = true;
|
||||
|
||||
break;
|
||||
@ -372,11 +379,12 @@ int Glonass_Gnav_Navigation_Message::string_decoder(char * frame_string)
|
||||
//--- It is string 2 -----------------------------------------------
|
||||
gnav_ephemeris.d_B_n = static_cast<double>(read_navigation_unsigned(string_bits, B_N));
|
||||
gnav_ephemeris.d_P_2 = static_cast<double>(read_navigation_unsigned(string_bits, P2));
|
||||
gnav_ephemeris.d_t_b = static_cast<double>(read_navigation_unsigned(string_bits, T_B));
|
||||
gnav_ephemeris.d_VYn = static_cast<double>(read_navigation_signed(string_bits, Y_N_DOT));
|
||||
gnav_ephemeris.d_AYn = static_cast<double>(read_navigation_signed(string_bits, Y_N_DOT_DOT));
|
||||
gnav_ephemeris.d_Yn = static_cast<double>(read_navigation_signed(string_bits, Y_N));
|
||||
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))* 2e-20;
|
||||
gnav_ephemeris.d_AYn = static_cast<double>(read_navigation_signed(string_bits, Y_N_DOT_DOT)) * 2e-30;
|
||||
gnav_ephemeris.d_Yn = static_cast<double>(read_navigation_signed(string_bits, Y_N)) * 2e-11;
|
||||
|
||||
gnav_ephemeris.d_iode = read_navigation_unsigned(string_bits, T_B);
|
||||
flag_ephemeris_str_2 = true;
|
||||
|
||||
break;
|
||||
@ -384,22 +392,21 @@ int Glonass_Gnav_Navigation_Message::string_decoder(char * frame_string)
|
||||
case 3:
|
||||
// --- It is string 3 ----------------------------------------------
|
||||
gnav_ephemeris.d_P_3 = static_cast<double>(read_navigation_unsigned(string_bits, P3));
|
||||
gnav_ephemeris.d_gamma_n = static_cast<double>(read_navigation_signed(string_bits, GAMMA_N));
|
||||
gnav_ephemeris.d_gamma_n = static_cast<double>(read_navigation_signed(string_bits, GAMMA_N)) * 2e-40;
|
||||
gnav_ephemeris.d_P = static_cast<double>(read_navigation_unsigned(string_bits, P));
|
||||
gnav_ephemeris.d_l_n = static_cast<double>(read_navigation_unsigned(string_bits, EPH_L_N));
|
||||
gnav_ephemeris.d_VZn = static_cast<double>(read_navigation_signed(string_bits, Z_N_DOT));
|
||||
gnav_ephemeris.d_AZn = static_cast<double>(read_navigation_signed(string_bits, Z_N_DOT_DOT));
|
||||
gnav_ephemeris.d_Zn = static_cast<double>(read_navigation_signed(string_bits, Z_N));
|
||||
gnav_ephemeris.d_VZn = static_cast<double>(read_navigation_signed(string_bits, Z_N_DOT)) * 2e-20;
|
||||
gnav_ephemeris.d_AZn = static_cast<double>(read_navigation_signed(string_bits, Z_N_DOT_DOT)) * 2e-30;
|
||||
gnav_ephemeris.d_Zn = static_cast<double>(read_navigation_signed(string_bits, Z_N)) * 2e-11;
|
||||
|
||||
flag_ephemeris_str_3 = true;
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
// --- It is subframe 4 --------------------------------------------
|
||||
// TODO signed vs unsigned reading from datasheet
|
||||
gnav_ephemeris.d_tau_n = static_cast<double>(read_navigation_unsigned(string_bits, TAU_N));
|
||||
gnav_ephemeris.d_Delta_tau_n = static_cast<double>(read_navigation_signed(string_bits, DELTA_TAU_N));
|
||||
// --- It is string 4 ----------------------------------------------
|
||||
gnav_ephemeris.d_tau_n = static_cast<double>(read_navigation_signed(string_bits, TAU_N)) * 2e-30;
|
||||
gnav_ephemeris.d_Delta_tau_n = static_cast<double>(read_navigation_signed(string_bits, DELTA_TAU_N)) * 2e-30;
|
||||
gnav_ephemeris.d_E_n = static_cast<double>(read_navigation_unsigned(string_bits, E_N));
|
||||
gnav_ephemeris.d_P_4 = static_cast<double>(read_navigation_unsigned(string_bits, P4));
|
||||
gnav_ephemeris.d_F_T = static_cast<double>(read_navigation_unsigned(string_bits, F_T));
|
||||
@ -407,33 +414,59 @@ int Glonass_Gnav_Navigation_Message::string_decoder(char * frame_string)
|
||||
gnav_ephemeris.d_n = static_cast<double>(read_navigation_unsigned(string_bits, N));
|
||||
gnav_ephemeris.d_M = static_cast<double>(read_navigation_unsigned(string_bits, M));
|
||||
|
||||
// Fill in ephemeris deliverables in the code
|
||||
gnav_ephemeris.i_satellite_slot_number = gnav_ephemeris.d_n;
|
||||
gnav_ephemeris.d_D4Y = gnav_ephemeris.d_N_T;
|
||||
|
||||
flag_ephemeris_str_4 = true;
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
// --- It is string 5 ----------------------------------------------
|
||||
// TODO signed vs unsigned reading from datasheet
|
||||
gnav_utc_model.d_N_A = static_cast<double>(read_navigation_unsigned(string_bits, N_A));
|
||||
gnav_utc_model.d_tau_c = static_cast<double>(read_navigation_unsigned(string_bits, TAU_C));
|
||||
gnav_utc_model.d_tau_c = static_cast<double>(read_navigation_signed(string_bits, TAU_C)) * 2e-31;
|
||||
gnav_utc_model.d_N_4 = static_cast<double>(read_navigation_unsigned(string_bits, N_4));
|
||||
gnav_utc_model.d_tau_c = static_cast<double>(read_navigation_unsigned(string_bits, TAU_C));
|
||||
gnav_utc_model.d_tau_gps = static_cast<double>(read_navigation_signed(string_bits, TAU_GPS)) * 2e-30;
|
||||
gnav_ephemeris.d_l_n = static_cast<double>(read_navigation_unsigned(string_bits, ALM_L_N));
|
||||
|
||||
// Compute Year and DoY based on Algorithm A3.11 of GLONASS ICD
|
||||
if(flag_ephemeris_str_4 == true)
|
||||
{
|
||||
//Current year number J in the four-year interval is calculated:
|
||||
if(gnav_ephemeris.d_N_T >= 1 && gnav_ephemeris.d_N_T <= 366)
|
||||
{
|
||||
J = 1;
|
||||
}
|
||||
else if ( gnav_ephemeris.d_N_T >= 367 && gnav_ephemeris.d_N_T <= 731)
|
||||
{
|
||||
J = 2;
|
||||
}
|
||||
else if (gnav_ephemeris.d_N_T >= 732 && gnav_ephemeris.d_N_T <= 1096)
|
||||
{
|
||||
J = 3;
|
||||
}
|
||||
else if (gnav_ephemeris.d_N_T >= 1097 && gnav_ephemeris.d_N_T <= 1461)
|
||||
{
|
||||
J = 4;
|
||||
}
|
||||
// 2). Current year in common form is calculated by the following formula:
|
||||
gnav_ephemeris.d_yr = 1996 + 4.0*(gnav_utc_model.d_N_4 - 1.0) + (J - 1.0);
|
||||
}
|
||||
break;
|
||||
|
||||
case 6:
|
||||
// --- It is string 6 ----------------------------------------------
|
||||
// TODO signed vs unsigned reading from datasheet
|
||||
i_satellite_slot_number = static_cast<double>(read_navigation_unsigned(string_bits, N_A));
|
||||
i_satellite_slot_number = static_cast<double>(read_navigation_unsigned(string_bits, n_A));
|
||||
frame_ID = get_frame_number(i_satellite_slot_number);
|
||||
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_C_n = static_cast<double>(read_navigation_unsigned(string_bits, C_N));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_M_n_A = static_cast<double>(read_navigation_unsigned(string_bits, M_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_n_A = static_cast<double>(read_navigation_unsigned(string_bits, N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_tau_n_A = static_cast<double>(read_navigation_unsigned(string_bits, TAU_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_lambda_n_A = static_cast<double>(read_navigation_unsigned(string_bits, LAMBDA_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_i_n_A = static_cast<double>(read_navigation_unsigned(string_bits, DELTA_I_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_epsilon_n_A = static_cast<double>(read_navigation_unsigned(string_bits, EPSILON_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_n_A = static_cast<double>(read_navigation_unsigned(string_bits, n_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_tau_n_A = static_cast<double>(read_navigation_unsigned(string_bits, TAU_N_A)) * 2e-18;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_lambda_n_A = static_cast<double>(read_navigation_signed(string_bits, LAMBDA_N_A)) * 2e-20;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_i_n_A = static_cast<double>(read_navigation_signed(string_bits, DELTA_I_N_A)) * 2e-20;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_epsilon_n_A = static_cast<double>(read_navigation_unsigned(string_bits, EPSILON_N_A)) * 2e-20;
|
||||
|
||||
flag_almanac_str_6 = true;
|
||||
|
||||
@ -443,14 +476,17 @@ int Glonass_Gnav_Navigation_Message::string_decoder(char * frame_string)
|
||||
// --- It is string 7 ----------------------------------------------
|
||||
if (flag_almanac_str_6 == true)
|
||||
{
|
||||
// TODO signed vs unsigned reading from datasheet
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_omega_n_A = static_cast<double>(read_navigation_unsigned(string_bits, OMEGA_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_t_lambda_n_A = static_cast<double>(read_navigation_unsigned(string_bits, T_LAMBDA_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A = static_cast<double>(read_navigation_unsigned(string_bits, DELTA_T_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A_dot = static_cast<double>(read_navigation_unsigned(string_bits, DELTA_T_DOT_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_H_n_A = static_cast<double>(read_navigation_unsigned(string_bits, H_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_omega_n_A = static_cast<double>(read_navigation_signed(string_bits, OMEGA_N_A)) * 2e-15;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_t_lambda_n_A = static_cast<double>(read_navigation_unsigned(string_bits, T_LAMBDA_N_A)) * 2e-5;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A = static_cast<double>(read_navigation_signed(string_bits, DELTA_T_N_A)) * 2e-9;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A_dot = static_cast<double>(read_navigation_signed(string_bits, DELTA_T_DOT_N_A)) * 2e-14;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_H_n_A = static_cast<double>(read_navigation_unsigned(string_bits, H_N_A)) - 32.0;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_l_n = static_cast<double>(read_navigation_unsigned(string_bits, ALM_L_N));
|
||||
|
||||
if(i_satellite_slot_number == gnav_ephemeris.i_satellite_slot_number)
|
||||
{
|
||||
gnav_ephemeris.i_satellite_freq_channel = gnav_almanac[i_satellite_slot_number - 1].d_H_n_A;
|
||||
}
|
||||
flag_almanac_str_7 = true;
|
||||
}
|
||||
|
||||
@ -458,15 +494,16 @@ int Glonass_Gnav_Navigation_Message::string_decoder(char * frame_string)
|
||||
break;
|
||||
case 8:
|
||||
// --- It is string 8 ----------------------------------------------
|
||||
// TODO signed vs unsigned reading from datasheet
|
||||
i_satellite_slot_number = static_cast<double>(read_navigation_unsigned(string_bits, N_A));
|
||||
i_satellite_slot_number = static_cast<double>(read_navigation_unsigned(string_bits, n_A));
|
||||
frame_ID = get_frame_number(i_satellite_slot_number);
|
||||
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_C_n = static_cast<double>(read_navigation_unsigned(string_bits, C_N));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_M_n_A = static_cast<double>(read_navigation_unsigned(string_bits, M_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_n_A = static_cast<double>(read_navigation_unsigned(string_bits, N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_tau_n_A = static_cast<double>(read_navigation_unsigned(string_bits, TAU_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_lambda_n_A = static_cast<double>(read_navigation_unsigned(string_bits, LAMBDA_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_i_n_A = static_cast<double>(read_navigation_unsigned(string_bits, DELTA_I_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_epsilon_n_A = static_cast<double>(read_navigation_unsigned(string_bits, EPSILON_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_n_A = static_cast<double>(read_navigation_unsigned(string_bits, n_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_tau_n_A = static_cast<double>(read_navigation_unsigned(string_bits, TAU_N_A)) * 2e-18;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_lambda_n_A = static_cast<double>(read_navigation_signed(string_bits, LAMBDA_N_A)) * 2e-20;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_i_n_A = static_cast<double>(read_navigation_signed(string_bits, DELTA_I_N_A)) * 2e-20;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_epsilon_n_A = static_cast<double>(read_navigation_unsigned(string_bits, EPSILON_N_A)) * 2e-20;
|
||||
|
||||
flag_almanac_str_8 = true;
|
||||
|
||||
@ -477,94 +514,95 @@ int Glonass_Gnav_Navigation_Message::string_decoder(char * frame_string)
|
||||
if (flag_almanac_str_8 == true)
|
||||
{
|
||||
// TODO signed vs unsigned reading from datasheet
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_omega_n_A = static_cast<double>(read_navigation_unsigned(string_bits, OMEGA_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_t_lambda_n_A = static_cast<double>(read_navigation_unsigned(string_bits, T_LAMBDA_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A = static_cast<double>(read_navigation_unsigned(string_bits, DELTA_T_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A_dot = static_cast<double>(read_navigation_unsigned(string_bits, DELTA_T_DOT_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_H_n_A = static_cast<double>(read_navigation_unsigned(string_bits, H_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_omega_n_A = static_cast<double>(read_navigation_signed(string_bits, OMEGA_N_A)) * 2e-15;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_t_lambda_n_A = static_cast<double>(read_navigation_unsigned(string_bits, T_LAMBDA_N_A)) * 2e-5;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A = static_cast<double>(read_navigation_signed(string_bits, DELTA_T_N_A)) * 2e-9;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A_dot = static_cast<double>(read_navigation_signed(string_bits, DELTA_T_DOT_N_A)) * 2e-14;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_H_n_A = static_cast<double>(read_navigation_unsigned(string_bits, H_N_A)) -32.0;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_l_n = static_cast<double>(read_navigation_unsigned(string_bits, ALM_L_N));
|
||||
|
||||
flag_almanac_str_9 = true;
|
||||
}
|
||||
case 10:
|
||||
// --- It is string 8 ----------------------------------------------
|
||||
// TODO signed vs unsigned reading from datasheet
|
||||
i_satellite_slot_number = static_cast<double>(read_navigation_unsigned(string_bits, N_A));
|
||||
// --- It is string 10 ---------------------------------------------
|
||||
i_satellite_slot_number = static_cast<double>(read_navigation_unsigned(string_bits, n_A));
|
||||
frame_ID = get_frame_number(i_satellite_slot_number);
|
||||
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_C_n = static_cast<double>(read_navigation_unsigned(string_bits, C_N));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_M_n_A = static_cast<double>(read_navigation_unsigned(string_bits, M_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_n_A = static_cast<double>(read_navigation_unsigned(string_bits, N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_tau_n_A = static_cast<double>(read_navigation_unsigned(string_bits, TAU_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_lambda_n_A = static_cast<double>(read_navigation_unsigned(string_bits, LAMBDA_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_i_n_A = static_cast<double>(read_navigation_unsigned(string_bits, DELTA_I_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_epsilon_n_A = static_cast<double>(read_navigation_unsigned(string_bits, EPSILON_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_n_A = static_cast<double>(read_navigation_unsigned(string_bits, n_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_tau_n_A = static_cast<double>(read_navigation_unsigned(string_bits, TAU_N_A)) * 2e-18;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_lambda_n_A = static_cast<double>(read_navigation_signed(string_bits, LAMBDA_N_A)) * 2e-20;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_i_n_A = static_cast<double>(read_navigation_signed(string_bits, DELTA_I_N_A)) * 2e-20;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_epsilon_n_A = static_cast<double>(read_navigation_unsigned(string_bits, EPSILON_N_A)) * 2e-20;
|
||||
|
||||
flag_almanac_str_10 = true;
|
||||
|
||||
break;
|
||||
|
||||
case 11:
|
||||
// --- It is string 9 ----------------------------------------------
|
||||
// --- It is string 11 ---------------------------------------------
|
||||
if (flag_almanac_str_10 == true)
|
||||
{
|
||||
// TODO signed vs unsigned reading from datasheet
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_omega_n_A = static_cast<double>(read_navigation_unsigned(string_bits, OMEGA_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_t_lambda_n_A = static_cast<double>(read_navigation_unsigned(string_bits, T_LAMBDA_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A = static_cast<double>(read_navigation_unsigned(string_bits, DELTA_T_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A_dot = static_cast<double>(read_navigation_unsigned(string_bits, DELTA_T_DOT_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_H_n_A = static_cast<double>(read_navigation_unsigned(string_bits, H_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_omega_n_A = static_cast<double>(read_navigation_signed(string_bits, OMEGA_N_A)) * 2e-15;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_t_lambda_n_A = static_cast<double>(read_navigation_unsigned(string_bits, T_LAMBDA_N_A)) * 2e-5;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A = static_cast<double>(read_navigation_signed(string_bits, DELTA_T_N_A)) * 2e-9;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A_dot = static_cast<double>(read_navigation_signed(string_bits, DELTA_T_DOT_N_A)) * 2e-14;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_H_n_A = static_cast<double>(read_navigation_unsigned(string_bits, H_N_A)) - 32.0;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_l_n = static_cast<double>(read_navigation_unsigned(string_bits, ALM_L_N));
|
||||
|
||||
flag_almanac_str_11 = true;
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
// --- It is string 8 ----------------------------------------------
|
||||
// TODO signed vs unsigned reading from datasheet
|
||||
i_satellite_slot_number = static_cast<double>(read_navigation_unsigned(string_bits, N_A));
|
||||
// --- It is string 12 ---------------------------------------------
|
||||
i_satellite_slot_number = static_cast<double>(read_navigation_unsigned(string_bits, n_A));
|
||||
frame_ID = get_frame_number(i_satellite_slot_number);
|
||||
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_C_n = static_cast<double>(read_navigation_unsigned(string_bits, C_N));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_M_n_A = static_cast<double>(read_navigation_unsigned(string_bits, M_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_n_A = static_cast<double>(read_navigation_unsigned(string_bits, N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_tau_n_A = static_cast<double>(read_navigation_unsigned(string_bits, TAU_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_lambda_n_A = static_cast<double>(read_navigation_unsigned(string_bits, LAMBDA_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_i_n_A = static_cast<double>(read_navigation_unsigned(string_bits, DELTA_I_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_epsilon_n_A = static_cast<double>(read_navigation_unsigned(string_bits, EPSILON_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_n_A = static_cast<double>(read_navigation_unsigned(string_bits, n_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_tau_n_A = static_cast<double>(read_navigation_unsigned(string_bits, TAU_N_A)) * 2e-18;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_lambda_n_A = static_cast<double>(read_navigation_signed(string_bits, LAMBDA_N_A)) * 2e-20;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_i_n_A = static_cast<double>(read_navigation_signed(string_bits, DELTA_I_N_A)) * 2e-20;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_epsilon_n_A = static_cast<double>(read_navigation_unsigned(string_bits, EPSILON_N_A)) * 2e-20;
|
||||
|
||||
flag_almanac_str_12 = true;
|
||||
|
||||
break;
|
||||
|
||||
case 13:
|
||||
// --- It is string 9 ----------------------------------------------
|
||||
// --- It is string 13 ---------------------------------------------
|
||||
if (flag_almanac_str_12 == true)
|
||||
{
|
||||
// TODO signed vs unsigned reading from datasheet
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_omega_n_A = static_cast<double>(read_navigation_unsigned(string_bits, OMEGA_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_t_lambda_n_A = static_cast<double>(read_navigation_unsigned(string_bits, T_LAMBDA_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A = static_cast<double>(read_navigation_unsigned(string_bits, DELTA_T_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A_dot = static_cast<double>(read_navigation_unsigned(string_bits, DELTA_T_DOT_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_H_n_A = static_cast<double>(read_navigation_unsigned(string_bits, H_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_omega_n_A = static_cast<double>(read_navigation_signed(string_bits, OMEGA_N_A)) * 2e-15;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_t_lambda_n_A = static_cast<double>(read_navigation_unsigned(string_bits, T_LAMBDA_N_A)) * 2e-5;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A = static_cast<double>(read_navigation_signed(string_bits, DELTA_T_N_A)) * 2e-9;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A_dot = static_cast<double>(read_navigation_signed(string_bits, DELTA_T_DOT_N_A)) * 2e-14;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_H_n_A = static_cast<double>(read_navigation_unsigned(string_bits, H_N_A)) - 32.0;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_l_n = static_cast<double>(read_navigation_unsigned(string_bits, ALM_L_N));
|
||||
|
||||
flag_almanac_str_13 = true;
|
||||
}
|
||||
case 14:
|
||||
// --- It is string 8 ----------------------------------------------
|
||||
if( frame_number == 5)
|
||||
// --- It is string 14 ---------------------------------------------
|
||||
if( frame_ID == 5)
|
||||
{
|
||||
gnav_utc_model.d_B1 = static_cast<double>(read_navigation_unsigned(string_bits, B1));
|
||||
gnav_utc_model.d_B2 = static_cast<double>(read_navigation_unsigned(string_bits, B2));
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO signed vs unsigned reading from datasheet
|
||||
i_satellite_slot_number = static_cast<double>(read_navigation_unsigned(string_bits, N_A));
|
||||
i_satellite_slot_number = static_cast<double>(read_navigation_unsigned(string_bits, n_A));
|
||||
frame_ID = get_frame_number(i_satellite_slot_number);
|
||||
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_C_n = static_cast<double>(read_navigation_unsigned(string_bits, C_N));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_M_n_A = static_cast<double>(read_navigation_unsigned(string_bits, M_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_n_A = static_cast<double>(read_navigation_unsigned(string_bits, N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_tau_n_A = static_cast<double>(read_navigation_unsigned(string_bits, TAU_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_lambda_n_A = static_cast<double>(read_navigation_unsigned(string_bits, LAMBDA_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_i_n_A = static_cast<double>(read_navigation_unsigned(string_bits, DELTA_I_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_epsilon_n_A = static_cast<double>(read_navigation_unsigned(string_bits, EPSILON_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_n_A = static_cast<double>(read_navigation_unsigned(string_bits, n_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_tau_n_A = static_cast<double>(read_navigation_unsigned(string_bits, TAU_N_A)) * 2e-18;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_lambda_n_A = static_cast<double>(read_navigation_signed(string_bits, LAMBDA_N_A)) * 2e-20;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_i_n_A = static_cast<double>(read_navigation_signed(string_bits, DELTA_I_N_A)) * 2e-20;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_epsilon_n_A = static_cast<double>(read_navigation_unsigned(string_bits, EPSILON_N_A)) * 2e-20;
|
||||
|
||||
flag_almanac_str_14 = true;
|
||||
}
|
||||
@ -574,14 +612,13 @@ int Glonass_Gnav_Navigation_Message::string_decoder(char * frame_string)
|
||||
|
||||
case 15:
|
||||
// --- It is string 9 ----------------------------------------------
|
||||
if (frame_number != 5 and flag_almanac_str_14 == true )
|
||||
if (frame_ID != 5 and flag_almanac_str_14 == true )
|
||||
{
|
||||
// TODO signed vs unsigned reading from datasheet
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_omega_n_A = static_cast<double>(read_navigation_unsigned(string_bits, OMEGA_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_t_lambda_n_A = static_cast<double>(read_navigation_unsigned(string_bits, T_LAMBDA_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A = static_cast<double>(read_navigation_unsigned(string_bits, DELTA_T_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A_dot = static_cast<double>(read_navigation_unsigned(string_bits, DELTA_T_DOT_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_H_n_A = static_cast<double>(read_navigation_unsigned(string_bits, H_N_A));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_omega_n_A = static_cast<double>(read_navigation_signed(string_bits, OMEGA_N_A)) * 2e-15;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_t_lambda_n_A = static_cast<double>(read_navigation_unsigned(string_bits, T_LAMBDA_N_A)) * 2e-5;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A = static_cast<double>(read_navigation_signed(string_bits, DELTA_T_N_A)) * 2e-9;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_Delta_T_n_A_dot = static_cast<double>(read_navigation_signed(string_bits, DELTA_T_DOT_N_A)) * 2e-14;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_H_n_A = static_cast<double>(read_navigation_unsigned(string_bits, H_N_A)) - 32.0;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_l_n = static_cast<double>(read_navigation_unsigned(string_bits, ALM_L_N));
|
||||
|
||||
flag_almanac_str_15 = true;
|
||||
@ -631,7 +668,6 @@ bool Glonass_Gnav_Navigation_Message::have_new_ephemeris() //Check if we have a
|
||||
//if all ephemeris pages have the same IOD, then they belong to the same block
|
||||
if ((gnav_ephemeris.d_t_b == 0) )
|
||||
{
|
||||
std::cout << "Ephemeris (1, 2, 3, 4) have been received and belong to the same batch" << std::endl;
|
||||
flag_ephemeris_str_1 = false;// clear the flag
|
||||
flag_ephemeris_str_2 = false;// clear the flag
|
||||
flag_ephemeris_str_3 = false;// clear the flag
|
||||
|
@ -58,13 +58,10 @@ private:
|
||||
unsigned long int read_navigation_unsigned(std::bitset<GLONASS_GNAV_STRING_BITS> bits, const std::vector<std::pair<int,int>> parameter);
|
||||
signed long int read_navigation_signed(std::bitset<GLONASS_GNAV_STRING_BITS> bits, const std::vector<std::pair<int,int>> parameter);
|
||||
bool read_navigation_bool(std::bitset<GLONASS_GNAV_STRING_BITS> bits, const std::vector<std::pair<int,int>> parameter);
|
||||
bool _CRC_test(std::bitset<GLONASS_GNAV_STRING_BITS> bits);
|
||||
|
||||
unsigned int get_frame_number(unsigned int satellite_slot_number);
|
||||
|
||||
public:
|
||||
bool flag_CRC_test;
|
||||
unsigned int frame_number;
|
||||
unsigned int frame_ID;
|
||||
|
||||
Glonass_Gnav_Ephemeris gnav_ephemeris; //!< Ephemeris information decoded
|
||||
Glonass_Gnav_Utc_Model gnav_utc_model; //!< UTC model information
|
||||
@ -117,6 +114,10 @@ public:
|
||||
double d_dtr; // Relativistic clock correction term
|
||||
double d_satClkDrift; // Satellite clock drift
|
||||
|
||||
bool CRC_test(std::bitset<GLONASS_GNAV_STRING_BITS> bits);
|
||||
|
||||
unsigned int get_frame_number(unsigned int satellite_slot_number);
|
||||
|
||||
/*!
|
||||
* \brief Reset GLONASS GNAV Navigation Information
|
||||
*/
|
||||
@ -160,7 +161,7 @@ public:
|
||||
/*!
|
||||
* \brief Computes the Coordinated Universal Time (UTC) and returns it in [s]
|
||||
*/
|
||||
double utc_time(const double gpstime_corrected) const;
|
||||
double utc_time(const double glonasstime_corrected) const;
|
||||
|
||||
/*!
|
||||
* Default constructor
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
double d_tau_c; //!< GLONASS time scale correction to UTC(SU) time. [s]
|
||||
double d_tau_gps; //!< Correction to GPS time to GLONASS time [day]
|
||||
double d_N_4; //!< Four year interval number starting from 1996 [4 year interval]
|
||||
double d_N_A; //!< Calendar day number within the four-year period beginning since the leap year [days]
|
||||
double d_N_A; //!< Calendar day number within the four-year period beginning since the leap year for Almanac data [days]
|
||||
double d_B1; //!< Coefficient to determine DeltaUT1 [s]
|
||||
double d_B2; //!< Coefficient to determine DeltaUT1 [s/msd]
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <string>
|
||||
#include "boost/assign.hpp"
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user