diff --git a/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.cc index 7c83e218c..75a7bc5a1 100644 --- a/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.cc @@ -34,12 +34,20 @@ #include "configuration_interface.h" #include "gps_l1_ca_telemetry_decoder_cc.h" #include -//#include -//#include #include #include +#include "gps_ephemeris.h" +#include "gps_almanac.h" +#include "gps_iono.h" +#include "gps_utc_model.h" + extern concurrent_queue global_gps_nav_msg_queue; +extern concurrent_queue global_gps_ephemeris_queue; +extern concurrent_queue global_gps_iono_queue; +extern concurrent_queue global_gps_utc_model_queue; +extern concurrent_queue global_gps_almanac_queue; + using google::LogMessage; @@ -67,6 +75,10 @@ GpsL1CaTelemetryDecoder::GpsL1CaTelemetryDecoder(ConfigurationInterface* configu DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")"; // set the navigation msg queue; telemetry_decoder_->set_navigation_queue(&global_gps_nav_msg_queue); + telemetry_decoder_->set_ephemeris_queue(&global_gps_ephemeris_queue); + telemetry_decoder_->set_iono_queue(&global_gps_iono_queue); + telemetry_decoder_->set_almanac_queue(&global_gps_almanac_queue); + telemetry_decoder_->set_utc_model_queue(&global_gps_utc_model_queue); DLOG(INFO) << "global navigation message queue assigned to telemetry_decoder ("<< telemetry_decoder_->unique_id() << ")"; } diff --git a/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.h b/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.h index f19150c1e..0932fa57f 100644 --- a/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.h +++ b/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.h @@ -35,8 +35,10 @@ #include "telemetry_decoder_interface.h" #include "gps_l1_ca_telemetry_decoder_cc.h" + #include + class ConfigurationInterface; /*! diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.h index 41d0e7825..117120d16 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.h @@ -66,6 +66,11 @@ public: * \brief Set the navigation queue */ void set_navigation_queue(concurrent_queue *nav_queue){d_GPS_FSM.d_nav_queue=nav_queue;} + void set_ephemeris_queue(concurrent_queue *ephemeris_queue){d_GPS_FSM.d_ephemeris_queue=ephemeris_queue;} + void set_iono_queue(concurrent_queue *iono_queue){d_GPS_FSM.d_iono_queue=iono_queue;} + void set_almanac_queue(concurrent_queue *almanac_queue){d_GPS_FSM.d_almanac_queue=almanac_queue;} + void set_utc_model_queue(concurrent_queue *utc_model_queue){d_GPS_FSM.d_utc_model_queue=utc_model_queue;} + int general_work (int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); void forecast (int noutput_items, gr_vector_int &ninput_items_required); diff --git a/src/algorithms/telemetry_decoder/libs/CMakeLists.txt b/src/algorithms/telemetry_decoder/libs/CMakeLists.txt index 987498041..5cc415af5 100644 --- a/src/algorithms/telemetry_decoder/libs/CMakeLists.txt +++ b/src/algorithms/telemetry_decoder/libs/CMakeLists.txt @@ -30,4 +30,5 @@ include_directories( ${GNURADIO_GRUEL_INCLUDE_DIRS} ) -add_library(telemetry_decoder_lib ${TELEMETRY_DECODER_LIB_SOURCES}) \ No newline at end of file +add_library(telemetry_decoder_lib ${TELEMETRY_DECODER_LIB_SOURCES}) +target_link_libraries(telemetry_decoder_lib gnss_system_parameters) \ No newline at end of file diff --git a/src/algorithms/telemetry_decoder/libs/gps_l1_ca_subframe_fsm.cc b/src/algorithms/telemetry_decoder/libs/gps_l1_ca_subframe_fsm.cc index 084f1d868..a8127e854 100644 --- a/src/algorithms/telemetry_decoder/libs/gps_l1_ca_subframe_fsm.cc +++ b/src/algorithms/telemetry_decoder/libs/gps_l1_ca_subframe_fsm.cc @@ -250,7 +250,6 @@ void GpsL1CaSubframeFsm::gps_subframe_to_nav_msg() int subframe_ID; // NEW GPS SUBFRAME HAS ARRIVED! subframe_ID = d_nav.subframe_decoder(this->d_subframe); //decode the subframe - //std::cout<<"Detected PRN: " << d_nav.i_satellite_PRN << " for satellite " << std::cout << "NAVIGATION FSM: received subframe " << subframe_ID << " for satellite " << Gnss_Satellite(std::string("GPS"), i_satellite_PRN) << std::endl; d_nav.i_satellite_PRN = i_satellite_PRN; d_nav.i_channel_ID = i_channel_ID; @@ -259,31 +258,39 @@ void GpsL1CaSubframeFsm::gps_subframe_to_nav_msg() /*! * \todo change satellite validation to subframe 5 because it will have a complete set of ephemeris parameters */ -// if (subframe_ID == 3) -// { // if the subframe is the 5th, then -// if (d_nav.satellite_validation()) // if all the satellite ephemeris parameters are good, then -// { -// // Send the procesed satellite ephemeris packet -// d_nav_queue->push(d_nav); + if (d_nav.satellite_validation()==true) + { + // get ephemeris object for this SV (mandatory) +// Gps_Ephemeris ephemeris=d_nav.get_ephemeris(); +// d_ephemeris_queue->push(ephemeris); // -// } -// } - d_nav.satellite_validation(); - d_nav_queue->push(d_nav); - +// // get ionospheric parameters (if available) +// if (d_nav.flag_iono_valid==true) +// { +// Gps_Iono iono=d_nav.get_iono(); +// d_iono_queue->push(iono); +// } +// +// // get almanac (if available) +// //TODO: implement almanac reader in navigation_message +// +// // get UTC model +// if (d_nav.flag_utc_model_valid==true) +// { +// Gps_Utc_Model utc_model=d_nav.get_utc_model(); +// d_utc_model_queue->push(utc_model); +// +// } + // old nav queue + d_nav_queue->push(d_nav); + } } - - - void GpsL1CaSubframeFsm::Event_gps_word_valid() { this->process_event(Ev_gps_word_valid()); } - - - void GpsL1CaSubframeFsm::Event_gps_word_invalid() { this->process_event(Ev_gps_word_invalid()); diff --git a/src/algorithms/telemetry_decoder/libs/gps_l1_ca_subframe_fsm.h b/src/algorithms/telemetry_decoder/libs/gps_l1_ca_subframe_fsm.h index ce35703bf..190e06a99 100644 --- a/src/algorithms/telemetry_decoder/libs/gps_l1_ca_subframe_fsm.h +++ b/src/algorithms/telemetry_decoder/libs/gps_l1_ca_subframe_fsm.h @@ -46,6 +46,10 @@ #include #include "GPS_L1_CA.h" #include "gps_navigation_message.h" +#include "gps_ephemeris.h" +#include "gps_iono.h" +#include "gps_almanac.h" +#include "gps_utc_model.h" namespace sc = boost::statechart; namespace mpl = boost::mpl; @@ -71,10 +75,25 @@ public: unsigned int i_satellite_PRN; // ephemeris queue + concurrent_queue *d_ephemeris_queue; + // ionospheric parameters queue + concurrent_queue *d_iono_queue; + // UTC model parameters queue + concurrent_queue *d_utc_model_queue; + // Almanac queue + concurrent_queue *d_almanac_queue; + // Old navigation message queue concurrent_queue *d_nav_queue; // navigation message class Gps_Navigation_Message d_nav; + // GPS SV and System parameters + Gps_Ephemeris ephemeris; + Gps_Almanac almanac; + Gps_Utc_Model utc_model; + Gps_Iono iono; + + char d_subframe[GPS_SUBFRAME_LENGTH]; char d_GPS_frame_4bytes[GPS_WORD_LENGTH]; diff --git a/src/core/system_parameters/CMakeLists.txt b/src/core/system_parameters/CMakeLists.txt index 7c44ad9f4..d8de300b2 100644 --- a/src/core/system_parameters/CMakeLists.txt +++ b/src/core/system_parameters/CMakeLists.txt @@ -20,6 +20,10 @@ set(SYSTEM_PARAMETERS_SOURCES gnss_satellite.cc gnss_signal.cc gps_navigation_message.cc + gps_ephemeris.cc + gps_iono.cc + gps_almanac.cc + gps_utc_model.cc ) include_directories( diff --git a/src/core/system_parameters/gps_almanac.cc b/src/core/system_parameters/gps_almanac.cc new file mode 100644 index 000000000..b6e9c9c04 --- /dev/null +++ b/src/core/system_parameters/gps_almanac.cc @@ -0,0 +1,39 @@ +/*! + * \file gps_almanac.cc + * \brief Interface of a GPS ALMANAC storage + * + * See http://www.gps.gov/technical/icwg/IS-GPS-200E.pdf Appendix II + * \author Javier Arribas, 2013. jarribas(at)cttc.es + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2013 (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 . + * + * ------------------------------------------------------------------------- + */ + +#include "gps_almanac.h" + +Gps_Almanac::Gps_Almanac() +{ + +} + diff --git a/src/core/system_parameters/gps_almanac.h b/src/core/system_parameters/gps_almanac.h new file mode 100644 index 000000000..b0ef51123 --- /dev/null +++ b/src/core/system_parameters/gps_almanac.h @@ -0,0 +1,68 @@ +/*! + * \file gps_almanac.h + * \brief Interface of a GPS ALMANAC storage + * \author Javier Arribas, 2013. jarribas(at)cttc.es + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2013 (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 . + * + * ------------------------------------------------------------------------- + */ + + +#ifndef GNSS_SDR_GPS_ALMANAC_H_ +#define GNSS_SDR_GPS_ALMANAC_H_ + +#include "GPS_L1_CA.h" + + +/*! + * \brief This class is a storage for the GPS SV ALMANAC data as described in IS-GPS-200E + * + * See http://www.gps.gov/technical/icwg/IS-GPS-200E.pdf Appendix II + */ +class Gps_Almanac +{ +private: + +public: + + unsigned int i_satellite_PRN; // SV PRN NUMBER + double d_Delta_i; + double d_Toa; //!< Almanac data reference time of week (Ref. 20.3.3.4.3 IS-GPS-200E) [s] + double d_M_0; //!< Mean Anomaly at Reference Time [semi-circles] + double d_e_eccentricity; //!< Eccentricity [dimensionless] + double d_sqrt_A; //!< Square Root of the Semi-Major Axis [sqrt(m)] + double d_OMEGA0; //!< Longitude of Ascending Node of Orbit Plane at Weekly Epoch [semi-circles] + double d_OMEGA; //!< Argument of Perigee [semi-cicles] + double d_OMEGA_DOT; //!< Rate of Right Ascension [semi-circles/s] + int i_SV_health; // SV Health + 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] + + /*! + * Default constructor + */ + Gps_Almanac(); +}; + +#endif diff --git a/src/core/system_parameters/gps_ephemeris.cc b/src/core/system_parameters/gps_ephemeris.cc new file mode 100644 index 000000000..b74d305af --- /dev/null +++ b/src/core/system_parameters/gps_ephemeris.cc @@ -0,0 +1,39 @@ +/*! + * \file gps_ephemeris.cc + * \brief Interface of a GPS EPHEMERIS storage + * + * See http://www.gps.gov/technical/icwg/IS-GPS-200E.pdf Appendix II + * \author Javier Arribas, 2013. jarribas(at)cttc.es + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2013 (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 . + * + * ------------------------------------------------------------------------- + */ + +#include "gps_ephemeris.h" + +Gps_Ephemeris::Gps_Ephemeris() +{ + +} + diff --git a/src/core/system_parameters/gps_ephemeris.h b/src/core/system_parameters/gps_ephemeris.h new file mode 100644 index 000000000..a2024cabb --- /dev/null +++ b/src/core/system_parameters/gps_ephemeris.h @@ -0,0 +1,113 @@ +/*! + * \file gps_navigation_message.h + * \brief Interface of a GPS EPHEMERIS storage + * \author Javier Arribas, 2013. jarribas(at)cttc.es + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2013 (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 . + * + * ------------------------------------------------------------------------- + */ + + +#ifndef GNSS_SDR_GPS_EPHEMERIS_H_ +#define GNSS_SDR_GPS_EPHEMERIS_H_ + +#include +#include +#include "boost/assign.hpp" + +#include "GPS_L1_CA.h" + + +/*! + * \brief This class is a storage for the GPS SV ephemeris data as described in IS-GPS-200E + * + * See http://www.gps.gov/technical/icwg/IS-GPS-200E.pdf Appendix II + */ +class Gps_Ephemeris +{ +private: + +public: + + unsigned int i_satellite_PRN; // SV PRN NUMBER + double d_TOW; //!< Time of GPS Week of the ephemeris set (taken from subframes TOW) [s] + double d_Crs; //!< Amplitude of the Sine Harmonic Correction Term to the Orbit Radius [m] + double d_Delta_n; //!< Mean Motion Difference From Computed Value [semi-circles/s] + double d_M_0; //!< Mean Anomaly at Reference Time [semi-circles] + double d_Cuc; //!< Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude [rad] + double d_e_eccentricity; //!< Eccentricity [dimensionless] + double d_Cus; //!< Amplitude of the Sine Harmonic Correction Term to the Argument of Latitude [rad] + double d_sqrt_A; //!< Square Root of the Semi-Major Axis [sqrt(m)] + double d_Toe; //!< Ephemeris data reference time of week (Ref. 20.3.3.4.3 IS-GPS-200E) [s] + double d_Toc; //!< clock data reference time (Ref. 20.3.3.3.3.1 IS-GPS-200E) [s] + double d_Cic; //!< Amplitude of the Cosine Harmonic Correction Term to the Angle of Inclination [rad] + double d_OMEGA0; //!< Longitude of Ascending Node of Orbit Plane at Weekly Epoch [semi-circles] + double d_Cis; //!< Amplitude of the Sine Harmonic Correction Term to the Angle of Inclination [rad] + double d_i_0; //!< Inclination Angle at Reference Time [semi-circles] + double d_Crc; //!< Amplitude of the Cosine Harmonic Correction Term to the Orbit Radius [m] + double d_OMEGA; //!< Argument of Perigee [semi-cicles] + double d_OMEGA_DOT; //!< Rate of Right Ascension [semi-circles/s] + double d_IDOT; //!< Rate of Inclination Angle [semi-circles/s] + int i_code_on_L2; //!< If 1, P code ON in L2; if 2, C/A code ON in L2; + int i_GPS_week; //!< GPS week number, aka WN [week] + bool b_L2_P_data_flag; //!< When true, indicates that the NAV data stream was commanded OFF on the P-code of the L2 channel + int i_SV_accuracy; //!< User Range Accuracy (URA) index of the SV (reference paragraph 6.2.1) for the standard positioning service user (Ref 20.3.3.3.1.3 IS-GPS-200E) + int i_SV_health; + double d_TGD; //!< Estimated Group Delay Differential: L1-L2 correction term only for the benefit of "L1 P(Y)" or "L2 P(Y)" s users [s] + double d_IODC; //!< Issue of Data, Clock + int i_AODO; //!< Age of Data Offset (AODO) term for the navigation message correction table (NMCT) contained in subframe 4 (reference paragraph 20.3.3.5.1.9) [s] + + bool b_fit_interval_flag;//!< indicates the curve-fit interval used by the CS (Block II/IIA/IIR/IIR-M/IIF) and SS (Block IIIA) in determining the ephemeris parameters, as follows: 0 = 4 hours, 1 = greater than 4 hours. + double d_spare1; + double d_spare2; + + 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 d_A_f2; //!< Coefficient 2 of code phase offset model [s/s^2] + + + // Flags + + /*! \brief If true, enhanced level of integrity assurance. + * + * If false, indicates that the conveying signal is provided with the legacy level of integrity assurance. + * That is, the probability that the instantaneous URE of the conveying signal exceeds 4.42 times the upper bound + * value of the current broadcast URA index, for more than 5.2 seconds, without an accompanying alert, is less + * than 1E-5 per hour. If true, indicates that the conveying signal is provided with an enhanced level of + * integrity assurance. That is, the probability that the instantaneous URE of the conveying signal exceeds 5.73 + * times the upper bound value of the current broadcast URA index, for more than 5.2 seconds, without an + * accompanying alert, is less than 1E-8 per hour. + */ + bool b_integrity_status_flag; + bool b_alert_flag; //!< If true, indicates that the SV URA may be worse than indicated in d_SV_accuracy, use that SV at our own risk. + bool b_antispoofing_flag; //!< If true, the AntiSpoofing mode is ON in that SV + + + /*! + * Default constructor + */ + Gps_Ephemeris(); +}; + +#endif diff --git a/src/core/system_parameters/gps_iono.cc b/src/core/system_parameters/gps_iono.cc new file mode 100644 index 000000000..1ec73785a --- /dev/null +++ b/src/core/system_parameters/gps_iono.cc @@ -0,0 +1,40 @@ +/*! + * \file gps_iono.cc + * \brief Interface of a GPS IONOSPHERIC MODEL storage + * + * See http://www.gps.gov/technical/icwg/IS-GPS-200E.pdf Appendix II + * \author Javier Arribas, 2013. jarribas(at)cttc.es + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2013 (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 . + * + * ------------------------------------------------------------------------- + */ + +#include "gps_iono.h" + +Gps_Iono::Gps_Iono() +{ + valid=false; + +} + diff --git a/src/core/system_parameters/gps_iono.h b/src/core/system_parameters/gps_iono.h new file mode 100644 index 000000000..6aa0a11fd --- /dev/null +++ b/src/core/system_parameters/gps_iono.h @@ -0,0 +1,66 @@ +/*! + * \file gps_iono.h + * \brief Interface of a GPS IONOSPHERIC MODEL storage + * \author Javier Arribas, 2013. jarribas(at)cttc.es + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2013 (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 . + * + * ------------------------------------------------------------------------- + */ + + +#ifndef GNSS_SDR_GPS_IONO_H_ +#define GNSS_SDR_GPS_IONO_H_ + +#include "GPS_L1_CA.h" + + +/*! + * \brief This class is a storage for the GPS IONOSPHERIC data as described in IS-GPS-200E + * + * See http://www.gps.gov/technical/icwg/IS-GPS-200E.pdf Appendix II + */ +class Gps_Iono +{ +private: + +public: + + // valid flag + bool valid; + // Ionospheric parameters + double d_alpha0; //!< Coefficient 0 of a cubic equation representing the amplitude of the vertical delay [s] + double d_alpha1; //!< Coefficient 1 of a cubic equation representing the amplitude of the vertical delay [s/semi-circle] + double d_alpha2; //!< Coefficient 2 of a cubic equation representing the amplitude of the vertical delay [s(semi-circle)^2] + double d_alpha3; //!< Coefficient 3 of a cubic equation representing the amplitude of the vertical delay [s(semi-circle)^3] + double d_beta0; //!< Coefficient 0 of a cubic equation representing the period of the model [s] + double d_beta1; //!< Coefficient 1 of a cubic equation representing the period of the model [s/semi-circle] + double d_beta2; //!< Coefficient 2 of a cubic equation representing the period of the model [s(semi-circle)^2] + double d_beta3; //!< Coefficient 3 of a cubic equation representing the period of the model [s(semi-circle)^3] + /*! + * Default constructor + */ + Gps_Iono(); +}; + +#endif diff --git a/src/core/system_parameters/gps_navigation_message.cc b/src/core/system_parameters/gps_navigation_message.cc index e02ad33bf..2c78874c6 100644 --- a/src/core/system_parameters/gps_navigation_message.cc +++ b/src/core/system_parameters/gps_navigation_message.cc @@ -105,6 +105,8 @@ void Gps_Navigation_Message::reset() b_antispoofing_flag = false; // Ionosphere and UTC + flag_iono_valid=false; + flag_utc_model_valid=true; d_alpha0 = 0; d_alpha1 = 0; d_alpha2 = 0; @@ -591,6 +593,8 @@ int Gps_Navigation_Message::subframe_decoder(char *subframe) i_WN_LSF = (int)read_navigation_unsigned(subframe_bits, WN_LSF); i_DN = (int)read_navigation_unsigned(subframe_bits, DN);; // Right-justified ? d_DeltaT_LSF = (double)read_navigation_signed(subframe_bits, DELTAT_LSF); + flag_iono_valid=true; + flag_utc_model_valid=true; } if (SV_page == 25) @@ -731,8 +735,82 @@ double Gps_Navigation_Message::utc_time(double gpstime_corrected) +Gps_Ephemeris Gps_Navigation_Message::get_ephemeris() +{ + Gps_Ephemeris ephemeris; + ephemeris.i_satellite_PRN=i_satellite_PRN; + ephemeris.d_TOW=d_TOW; + ephemeris.d_Crs=d_Crs; + ephemeris.d_Delta_n=d_Delta_n; + ephemeris.d_M_0=d_M_0; + ephemeris.d_Cuc=d_Cuc; + ephemeris.d_e_eccentricity=d_e_eccentricity; + ephemeris.d_Cus=d_Cus; + ephemeris.d_sqrt_A=d_sqrt_A; + ephemeris.d_Toe=d_Toe; + ephemeris.d_Toc=d_Toc; + ephemeris.d_Cic=d_Cic; + ephemeris.d_OMEGA0=d_OMEGA0; + ephemeris.d_Cis=d_Cis; + ephemeris.d_i_0=d_i_0; + ephemeris.d_Crc=d_Crc; + ephemeris.d_OMEGA=d_OMEGA; + ephemeris.d_OMEGA_DOT=d_OMEGA_DOT; + ephemeris.d_IDOT=d_IDOT; + ephemeris.i_code_on_L2=i_code_on_L2; + ephemeris.i_GPS_week=i_GPS_week; + ephemeris.b_L2_P_data_flag=b_L2_P_data_flag; + ephemeris.i_SV_accuracy=i_SV_accuracy; + ephemeris.i_SV_health=i_SV_health; + ephemeris.d_TGD=d_TGD; + ephemeris.d_IODC=d_IODC; + ephemeris.i_AODO=i_AODO; + ephemeris.b_fit_interval_flag=b_fit_interval_flag; + ephemeris.d_spare1=d_spare1; + ephemeris.d_spare2=d_spare2; + ephemeris.d_A_f0=d_A_f0; + ephemeris.d_A_f1=d_A_f1; + ephemeris.d_A_f2=d_A_f2; + ephemeris.b_integrity_status_flag=b_integrity_status_flag; + ephemeris.b_alert_flag=b_alert_flag; + ephemeris.b_antispoofing_flag=b_antispoofing_flag; + return ephemeris; +} +Gps_Iono Gps_Navigation_Message::get_iono() +{ + Gps_Iono iono; + iono.d_alpha0=d_alpha0; + iono.d_alpha1=d_alpha1; + iono.d_alpha2=d_alpha2; + iono.d_alpha3=d_alpha3; + iono.d_beta0=d_beta0; + iono.d_beta1=d_beta1; + iono.d_beta2=d_beta2; + iono.d_beta3=d_beta3; + iono.valid=flag_iono_valid; + // TODO: Clear flag_utc_model_valid in order to not re-send the same information to the ionospheric parameters queue + return iono; +} + +Gps_Utc_Model Gps_Navigation_Message::get_utc_model() +{ + Gps_Utc_Model utc_model; + + utc_model.valid=flag_utc_model_valid; + // UTC parameters + utc_model.d_A1=d_A1; + utc_model.d_A0=d_A0; + utc_model.d_t_OT=d_t_OT; + utc_model.i_WN_T=i_WN_T; + utc_model.d_DeltaT_LS=d_DeltaT_LS; + utc_model.i_WN_LSF=i_WN_LSF; + utc_model.i_DN=i_DN; + utc_model.d_DeltaT_LSF=d_DeltaT_LSF; + // TODO: Clear flag_utc_model_valid in order to not re-send the same information to the ionospheric parameters queue + return utc_model; +} bool Gps_Navigation_Message::satellite_validation() { bool flag_data_valid = false; diff --git a/src/core/system_parameters/gps_navigation_message.h b/src/core/system_parameters/gps_navigation_message.h index a74257eaf..8776525ac 100644 --- a/src/core/system_parameters/gps_navigation_message.h +++ b/src/core/system_parameters/gps_navigation_message.h @@ -41,6 +41,11 @@ #include "boost/assign.hpp" #include #include "GPS_L1_CA.h" +#include "gps_ephemeris.h" +#include "gps_iono.h" +#include "gps_almanac.h" +#include "gps_utc_model.h" + /*! @@ -159,6 +164,7 @@ public: double d_subframe_timestamp_ms; //[ms] // Ionospheric parameters + bool flag_iono_valid; //!< If set, it indicates that the ionospheric parameters are filled (page 18 has arrived and decoded) double d_alpha0; //!< Coefficient 0 of a cubic equation representing the amplitude of the vertical delay [s] double d_alpha1; //!< Coefficient 1 of a cubic equation representing the amplitude of the vertical delay [s/semi-circle] double d_alpha2; //!< Coefficient 2 of a cubic equation representing the amplitude of the vertical delay [s(semi-circle)^2] @@ -169,6 +175,7 @@ public: double d_beta3; //!< Coefficient 3 of a cubic equation representing the period of the model [s(semi-circle)^3] // UTC parameters + bool flag_utc_model_valid; //!< If set, it indicates that the UTC model parameters are filled double d_A1; //!< 1st order term of a model that relates GPS and UTC time (ref. 20.3.3.5.2.4 IS-GPS-200E) [s/s] double d_A0; //!< Constant of a model that relates GPS and UTC time (ref. 20.3.3.5.2.4 IS-GPS-200E) [s] double d_t_OT; //!< Reference time for UTC data (reference 20.3.4.5 and 20.3.3.5.2.4 IS-GPS-200E) [s] @@ -186,6 +193,22 @@ public: // public functions void reset(); + /*! + * \brief Obtain a GPS SV Ephemeris class filled with current SV data + */ + Gps_Ephemeris get_ephemeris(); + + /*! + * \brief Obtain a GPS ionospheric correction parameters class filled with current SV data + */ + Gps_Iono get_iono(); + + /*! + * \brief Obtain a GPS UTC model parameters class filled with current SV data + */ + Gps_Utc_Model get_utc_model(); + + /*! * \brief Decodes the GPS NAV message */ diff --git a/src/core/system_parameters/gps_utc_model.cc b/src/core/system_parameters/gps_utc_model.cc new file mode 100644 index 000000000..44d2798ab --- /dev/null +++ b/src/core/system_parameters/gps_utc_model.cc @@ -0,0 +1,38 @@ +/* + * \file gps_utc_model.h + * \brief Interface of a GPS UTC MODEL storage + * \author Javier Arribas, 2013. jarribas(at)cttc.es + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2013 (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 . + * + * ------------------------------------------------------------------------- + */ + +#include "gps_utc_model.h" + +Gps_Utc_Model::Gps_Utc_Model() +{ + valid=false; + +} + diff --git a/src/core/system_parameters/gps_utc_model.h b/src/core/system_parameters/gps_utc_model.h new file mode 100644 index 000000000..aa674f641 --- /dev/null +++ b/src/core/system_parameters/gps_utc_model.h @@ -0,0 +1,66 @@ +/*! + * \file gps_utc_model.h + * \brief Interface of a GPS UTC MODEL storage + * \author Javier Arribas, 2013. jarribas(at)cttc.es + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2013 (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 . + * + * ------------------------------------------------------------------------- + */ + + +#ifndef GNSS_SDR_GPS_UTC_MODEL_H_ +#define GNSS_SDR_GPS_UTC_MODEL_H_ + +#include "GPS_L1_CA.h" + + +/*! + * \brief This class is a storage for the GPS UTC MODEL data as described in IS-GPS-200E + * + * See http://www.gps.gov/technical/icwg/IS-GPS-200E.pdf Appendix II + */ +class Gps_Utc_Model +{ +private: + +public: + + bool valid; + // UTC parameters + double d_A1; //!< 1st order term of a model that relates GPS and UTC time (ref. 20.3.3.5.2.4 IS-GPS-200E) [s/s] + double d_A0; //!< Constant of a model that relates GPS and UTC time (ref. 20.3.3.5.2.4 IS-GPS-200E) [s] + double d_t_OT; //!< Reference time for UTC data (reference 20.3.4.5 and 20.3.3.5.2.4 IS-GPS-200E) [s] + int i_WN_T; //!< UTC reference week number [weeks] + double d_DeltaT_LS; //!< delta time due to leap seconds [s]. Number of leap seconds since 6-Jan-1980 as transmitted by the GPS almanac. + int i_WN_LSF; //!< Week number at the end of which the leap second becomes effective [weeks] + int i_DN; //!< Day number (DN) at the end of which the leap second becomes effective [days] + double d_DeltaT_LSF; //!< Scheduled future or recent past (relative to NAV message upload) value of the delta time due to leap seconds [s] + + /*! + * Default constructor + */ + Gps_Utc_Model(); +}; + +#endif diff --git a/src/main/main.cc b/src/main/main.cc index 9bc4e859d..520c19cc3 100644 --- a/src/main/main.cc +++ b/src/main/main.cc @@ -45,6 +45,10 @@ #include #include "concurrent_queue.h" #include "gps_navigation_message.h" +#include "gps_ephemeris.h" +#include "gps_almanac.h" +#include "gps_iono.h" +#include "gps_utc_model.h" #include #include #include @@ -62,6 +66,11 @@ DECLARE_string(log_dir); * to the Observables modules */ concurrent_queue global_gps_nav_msg_queue; +concurrent_queue global_gps_ephemeris_queue; +concurrent_queue global_gps_iono_queue; +concurrent_queue global_gps_utc_model_queue; +concurrent_queue global_gps_almanac_queue; + int main(int argc, char** argv) { diff --git a/src/tests/single_test_main.cc b/src/tests/single_test_main.cc index 90a46bd48..8cfe13289 100644 --- a/src/tests/single_test_main.cc +++ b/src/tests/single_test_main.cc @@ -43,6 +43,10 @@ #include "gps_navigation_message.h" concurrent_queue global_gps_nav_msg_queue; +concurrent_queue global_gps_ephemeris_queue; +concurrent_queue global_gps_iono_queue; +concurrent_queue global_gps_utc_model_queue; +concurrent_queue global_gps_almanac_queue; int main(int argc, char **argv) { diff --git a/src/tests/test_main.cc b/src/tests/test_main.cc index 7d94143f7..33d2c4b32 100644 --- a/src/tests/test_main.cc +++ b/src/tests/test_main.cc @@ -70,6 +70,10 @@ concurrent_queue global_gps_nav_msg_queue; +concurrent_queue global_gps_ephemeris_queue; +concurrent_queue global_gps_iono_queue; +concurrent_queue global_gps_utc_model_queue; +concurrent_queue global_gps_almanac_queue; int main(int argc, char **argv)