mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-10-30 23:03:05 +00:00 
			
		
		
		
	Merge branch 'next' of https://github.com/carlesfernandez/gnss-sdr into next
This commit is contained in:
		| @@ -95,102 +95,102 @@ public: | ||||
|     /*! | ||||
|      *  \brief Generates the GPS Navigation Data header | ||||
|      */ | ||||
|     void rinex_nav_header(std::fstream& out, const Gps_Iono& iono, const Gps_Utc_Model& utc_model); | ||||
|     void rinex_nav_header(std::fstream & out, const Gps_Iono & iono, const Gps_Utc_Model & utc_model); | ||||
|  | ||||
|     /*! | ||||
|      *  \brief Generates the Galileo Navigation Data header | ||||
|      */ | ||||
|     void rinex_nav_header(std::fstream& out, const Galileo_Iono& iono, const Galileo_Utc_Model& utc_model, const Galileo_Almanac& galileo_almanac); | ||||
|     void rinex_nav_header(std::fstream & out, const Galileo_Iono & iono, const Galileo_Utc_Model & utc_model, const Galileo_Almanac & galileo_almanac); | ||||
|  | ||||
|     /*! | ||||
|      *  \brief Generates the Mixed (GPS/Galileo) Navigation Data header | ||||
|      */ | ||||
|     void rinex_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model, const Galileo_Almanac& galileo_almanac); | ||||
|     void rinex_nav_header(std::fstream & out, const Gps_Iono & gps_iono, const Gps_Utc_Model & gps_utc_model, const Galileo_Iono & galileo_iono, const Galileo_Utc_Model & galileo_utc_model, const Galileo_Almanac & galileo_almanac); | ||||
|  | ||||
|     /*! | ||||
|      *  \brief Generates the GPS Observation data header | ||||
|      */ | ||||
|     void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph, const double d_TOW_first_observation); | ||||
|     void rinex_obs_header(std::fstream & out, const Gps_Ephemeris & eph, const double d_TOW_first_observation); | ||||
|  | ||||
|     /*! | ||||
|      *  \brief Generates the Galileo Observation data header | ||||
|      */ | ||||
|     void rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& eph, const double d_TOW_first_observation); | ||||
|     void rinex_obs_header(std::fstream & out, const Galileo_Ephemeris & eph, const double d_TOW_first_observation); | ||||
|  | ||||
|     /*! | ||||
|      *  \brief Generates the Mixed (GPS/Galileo) Observation data header | ||||
|      */ | ||||
|     void rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps_eph, const Galileo_Ephemeris& galileo_eph, const double d_TOW_first_observation); | ||||
|     void rinex_obs_header(std::fstream & out, const Gps_Ephemeris & gps_eph, const Galileo_Ephemeris & galileo_eph, const double d_TOW_first_observation); | ||||
|  | ||||
|     /*! | ||||
|      *  \brief Generates the SBAS raw data header | ||||
|      */ | ||||
|     void rinex_sbs_header(std::fstream& out); | ||||
|     void rinex_sbs_header(std::fstream & out); | ||||
|  | ||||
|     /*! | ||||
|      *  \brief Computes the UTC time and returns a boost::posix_time::ptime object | ||||
|      */ | ||||
|     boost::posix_time::ptime compute_UTC_time(const Gps_Navigation_Message& nav_msg); | ||||
|     boost::posix_time::ptime compute_UTC_time(const Gps_Navigation_Message & nav_msg); | ||||
|  | ||||
|     /*! | ||||
|      *  \brief Computes the GPS time and returns a boost::posix_time::ptime object | ||||
|      */ | ||||
|     boost::posix_time::ptime compute_GPS_time(const Gps_Ephemeris& eph, const double obs_time); | ||||
|     boost::posix_time::ptime compute_GPS_time(const Gps_Ephemeris & eph, const double obs_time); | ||||
|  | ||||
|     /*! | ||||
|      *  \brief Computes the Galileo time and returns a boost::posix_time::ptime object | ||||
|      */ | ||||
|     boost::posix_time::ptime compute_Galileo_time(const Galileo_Ephemeris& eph, const double obs_time); | ||||
|     boost::posix_time::ptime compute_Galileo_time(const Galileo_Ephemeris & eph, const double obs_time); | ||||
|  | ||||
|     /*! | ||||
|      *  \brief Writes data from the GPS navigation message into the RINEX file | ||||
|      */ | ||||
|     void log_rinex_nav(std::fstream& out, const std::map<int, Gps_Ephemeris>& eph_map); | ||||
|     void log_rinex_nav(std::fstream & out, const std::map<int, Gps_Ephemeris> & eph_map); | ||||
|  | ||||
|     /*! | ||||
|      *  \brief Writes data from the Galileo navigation message into the RINEX file | ||||
|      */ | ||||
|     void log_rinex_nav(std::fstream& out, const std::map<int, Galileo_Ephemeris>& eph_map); | ||||
|     void log_rinex_nav(std::fstream & out, const std::map<int, Galileo_Ephemeris> & eph_map); | ||||
|  | ||||
|     /*! | ||||
|      *  \brief Writes data from the Mixed (GPS/Galileo) 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, Galileo_Ephemeris>& galileo_eph_map); | ||||
|     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 GPS observables into the RINEX file | ||||
|      */ | ||||
|     void log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, double obs_time, const std::map<int, Gnss_Synchro>& pseudoranges); | ||||
|     void log_rinex_obs(std::fstream & out, const Gps_Ephemeris & eph, double obs_time, const std::map<int, Gnss_Synchro> & pseudoranges); | ||||
|  | ||||
|     /*! | ||||
|      *  \brief Writes Galileo observables into the RINEX file | ||||
|      */ | ||||
|     void log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& eph, double obs_time, const std::map<int, Gnss_Synchro>& pseudoranges); | ||||
|     void log_rinex_obs(std::fstream & out, const Galileo_Ephemeris & eph, double obs_time, const std::map<int, Gnss_Synchro> & pseudoranges); | ||||
|  | ||||
|     /*! | ||||
|      *  \brief Writes Galileo observables into the RINEX file | ||||
|      */ | ||||
|     void log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_eph, const Galileo_Ephemeris& galileo_eph, const double gps_obs_time, const std::map<int, Gnss_Synchro>& pseudoranges); | ||||
|     void log_rinex_obs(std::fstream & out, const Gps_Ephemeris & gps_eph, const Galileo_Ephemeris & galileo_eph, const double gps_obs_time, const std::map<int, Gnss_Synchro> & pseudoranges); | ||||
|  | ||||
|     /*! | ||||
|      * \brief Represents GPS time in the date time format. Leap years are considered, but leap seconds are not. | ||||
|      */ | ||||
|     void to_date_time(int gps_week, int gps_tow, int &year, int &month, int &day, int &hour, int &minute, int &second); | ||||
|     void to_date_time(int gps_week, int gps_tow, int & year, int & month, int & day, int & hour, int & minute, int & second); | ||||
|  | ||||
|     /*! | ||||
|      *  \brief Writes raw SBAS messages into the RINEX file | ||||
|      */ | ||||
|     void log_rinex_sbs(std::fstream& out, const Sbas_Raw_Msg& sbs_message); | ||||
|     void log_rinex_sbs(std::fstream & out, const Sbas_Raw_Msg & sbs_message); | ||||
|  | ||||
|     void update_nav_header(std::fstream& out, const Gps_Utc_Model& gps_utc, const Gps_Iono& gps_iono); | ||||
|     void update_nav_header(std::fstream & out, const Gps_Utc_Model & gps_utc, const Gps_Iono & gps_iono); | ||||
|  | ||||
|     void update_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model, const Galileo_Almanac& galileo_almanac); | ||||
|     void update_nav_header(std::fstream & out, const Gps_Iono & gps_iono, const Gps_Utc_Model & gps_utc_model, const Galileo_Iono & galileo_iono, const Galileo_Utc_Model & galileo_utc_model, const Galileo_Almanac& galileo_almanac); | ||||
|  | ||||
|     void update_nav_header(std::fstream& out, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& utc_model, const Galileo_Almanac& galileo_almanac); | ||||
|     void update_nav_header(std::fstream & out, const Galileo_Iono & galileo_iono, const Galileo_Utc_Model & utc_model, const Galileo_Almanac & galileo_almanac); | ||||
|  | ||||
|     void update_obs_header(std::fstream& out, const Gps_Utc_Model& utc_model); | ||||
|     void update_obs_header(std::fstream & out, const Gps_Utc_Model & utc_model); | ||||
|  | ||||
|     void update_obs_header(std::fstream& out, const Galileo_Utc_Model& galileo_utc_model); | ||||
|     void update_obs_header(std::fstream & out, const Galileo_Utc_Model & galileo_utc_model); | ||||
|  | ||||
|     std::map<std::string,std::string> satelliteSystem; //<! GPS, GLONASS, SBAS payload, Galileo or Compass | ||||
|     std::map<std::string,std::string> observationType; //<! PSEUDORANGE, CARRIER_PHASE, DOPPLER, SIGNAL_STRENGTH | ||||
| @@ -237,7 +237,7 @@ private: | ||||
|     /* | ||||
|      *  Checks that the line is 80 characters length | ||||
|      */ | ||||
|     void lengthCheck(const std::string& line); | ||||
|     void lengthCheck(const std::string & line); | ||||
|  | ||||
|     /* | ||||
|      * If the string is bigger than length, truncate it from the right. | ||||
| @@ -252,7 +252,7 @@ private: | ||||
|      * \param[in] length new desired length of string. | ||||
|      * \param[in] pad character to pad string with (blank by default). | ||||
|      * \return a reference to \a s.  */ | ||||
|     inline std::string& leftJustify(std::string& s, | ||||
|     inline std::string & leftJustify(std::string & s, | ||||
|             const std::string::size_type length, | ||||
|             const char pad = ' '); | ||||
|  | ||||
| @@ -269,10 +269,12 @@ private: | ||||
|      * \param[in] length new desired length of string. | ||||
|      * \param[in] pad character to pad string with (blank by default). | ||||
|      * \return a reference to \a s.  */ | ||||
|     inline std::string leftJustify(const std::string& s, | ||||
|     inline std::string leftJustify(const std::string & s, | ||||
|             const std::string::size_type length, | ||||
|             const char pad = ' ') | ||||
|     { std::string t(s); return leftJustify(t, length, pad); } | ||||
|     { | ||||
|         std::string t(s); return leftJustify(t, length, pad); | ||||
|     } | ||||
|  | ||||
|  | ||||
|     /* | ||||
| @@ -281,7 +283,7 @@ private: | ||||
|      * requested length (\a length), it is padded on the left with | ||||
|      * the pad character (\a pad). The default pad | ||||
|      * character is a blank. */ | ||||
|     inline std::string& rightJustify(std::string& s, | ||||
|     inline std::string & rightJustify(std::string & s, | ||||
|             const std::string::size_type length, | ||||
|             const char pad = ' '); | ||||
|  | ||||
| @@ -291,11 +293,12 @@ private: | ||||
|      * requested length (\a length), it is padded on the left with | ||||
|      * the pad character (\a pad). The default pad | ||||
|      * character is a blank.*/ | ||||
|     inline std::string rightJustify(const std::string& s, | ||||
|     inline std::string rightJustify(const std::string & s, | ||||
|             const std::string::size_type length, | ||||
|             const char pad = ' ') | ||||
|     { std::string t(s); return rightJustify(t, length, pad); } | ||||
|  | ||||
|     { | ||||
|         std::string t(s); return rightJustify(t, length, pad); | ||||
|     } | ||||
|  | ||||
|  | ||||
|     /* | ||||
| @@ -308,15 +311,13 @@ private: | ||||
|      * exponentials above three characters in length.  If false, it removes | ||||
|      * that check. | ||||
|      */ | ||||
|     inline std::string doub2sci(const double& d, | ||||
|     inline std::string doub2sci(const double & d, | ||||
|             const std::string::size_type length, | ||||
|             const std::string::size_type expLen, | ||||
|             const bool showSign = true, | ||||
|             const bool checkSwitch = true); | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|     /* | ||||
|      * Convert scientific notation to FORTRAN notation. | ||||
|      * As an example, the string "1.5636E5" becomes " .15636D6". | ||||
| @@ -331,16 +332,13 @@ private: | ||||
|      * produce an exponential with an E instead of a D, and always have a leading | ||||
|      * zero.  For example -> 0.87654E-0004 or -0.1234E00005. | ||||
|      */ | ||||
|     inline std::string& sci2for(std::string& aStr, | ||||
|     inline std::string & sci2for(std::string & aStr, | ||||
|             const std::string::size_type startPos = 0, | ||||
|             const std::string::size_type length = std::string::npos, | ||||
|             const std::string::size_type expLen = 3, | ||||
|             const bool checkSwitch = true); | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|     /* | ||||
|      * Convert double precision floating point to a string | ||||
|      * containing the number in FORTRAN notation. | ||||
| @@ -353,7 +351,7 @@ private: | ||||
|      * that check. | ||||
|      * @return a string containing \a d in FORTRAN notation. | ||||
|      */ | ||||
|     inline std::string doub2for(const double& d, | ||||
|     inline std::string doub2for(const double & d, | ||||
|             const std::string::size_type length, | ||||
|             const std::string::size_type expLen, | ||||
|             const bool checkSwitch = true); | ||||
| @@ -364,8 +362,10 @@ private: | ||||
|      * @param s string containing a number. | ||||
|      * @return double representation of string. | ||||
|      */ | ||||
|     inline double asDouble(const std::string& s) | ||||
|     { return strtod(s.c_str(), 0); } | ||||
|     inline double asDouble(const std::string & s) | ||||
|     { | ||||
|         return strtod(s.c_str(), 0); | ||||
|     } | ||||
|  | ||||
|  | ||||
|     inline int toInt(std::string bitString, int sLength); | ||||
| @@ -375,8 +375,10 @@ private: | ||||
|      * @param s string containing a number. | ||||
|      * @return long integer representation of string. | ||||
|      */ | ||||
|     inline long asInt(const std::string& s) | ||||
|     { return strtol(s.c_str(), 0, 10); } | ||||
|     inline long asInt(const std::string & s) | ||||
|     { | ||||
|         return strtol(s.c_str(), 0, 10); | ||||
|     } | ||||
|  | ||||
|  | ||||
|     /* | ||||
| @@ -398,14 +400,15 @@ private: | ||||
|     inline std::string asString(const long double x, | ||||
|             const std::string::size_type precision = 21); | ||||
|  | ||||
|  | ||||
|     /* | ||||
|      * Convert any old object to a string. | ||||
|      * The class must have stream operators defined. | ||||
|      * @param x object to turn into a string. | ||||
|      * @return string representation of \a x. | ||||
|      */ | ||||
|     template <class X> | ||||
|     inline std::string asString(const X x); | ||||
|     template <class X> inline std::string asString(const X x); | ||||
|  | ||||
|     inline std::string asFixWidthString(const int x, const int width, char fill_digit); | ||||
| }; | ||||
|  | ||||
| @@ -413,11 +416,10 @@ private: | ||||
|  | ||||
| // Implementation of inline functions (modified versions from GPSTk http://www.gpstk.org) | ||||
|  | ||||
| inline std::string& Rinex_Printer::leftJustify(std::string& s, | ||||
| inline std::string & Rinex_Printer::leftJustify(std::string & s, | ||||
|         const std::string::size_type length, | ||||
|         const char pad) | ||||
| { | ||||
|  | ||||
|     if(length < s.length()) | ||||
|         { | ||||
|             s = s.substr(0, length); | ||||
| @@ -432,7 +434,7 @@ inline std::string& Rinex_Printer::leftJustify(std::string& s, | ||||
|  | ||||
| // if the string is bigger than length, truncate it from the left. | ||||
| // otherwise, add pad characters to its left. | ||||
| inline std::string& Rinex_Printer::rightJustify(std::string& s, | ||||
| inline std::string & Rinex_Printer::rightJustify(std::string & s, | ||||
|         const std::string::size_type length, | ||||
|         const char pad) | ||||
| { | ||||
| @@ -449,14 +451,11 @@ inline std::string& Rinex_Printer::rightJustify(std::string& s, | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| inline std::string Rinex_Printer::doub2for(const double& d, | ||||
| inline std::string Rinex_Printer::doub2for(const double & d, | ||||
|         const std::string::size_type length, | ||||
|         const std::string::size_type expLen, | ||||
|         const bool checkSwitch) | ||||
| { | ||||
|  | ||||
|     short exponentLength = expLen; | ||||
|  | ||||
|     /* Validate the assumptions regarding the input arguments */ | ||||
| @@ -467,11 +466,10 @@ inline std::string Rinex_Printer::doub2for(const double& d, | ||||
|     sci2for(toReturn, 0, length, exponentLength, checkSwitch); | ||||
|  | ||||
|     return toReturn; | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| inline std::string Rinex_Printer::doub2sci(const double& d, | ||||
| inline std::string Rinex_Printer::doub2sci(const double & d, | ||||
|         const std::string::size_type length, | ||||
|         const std::string::size_type expLen, | ||||
|         const bool showSign, | ||||
| @@ -501,7 +499,8 @@ inline std::string Rinex_Printer::doub2sci(const double& d, | ||||
|     return toReturn; | ||||
| } | ||||
|  | ||||
| inline std::string& Rinex_Printer::sci2for(std::string& aStr, | ||||
|  | ||||
| inline std::string & Rinex_Printer::sci2for(std::string & aStr, | ||||
|         const std::string::size_type startPos, | ||||
|         const std::string::size_type length, | ||||
|         const std::string::size_type expLen, | ||||
| @@ -518,7 +517,7 @@ inline std::string& Rinex_Printer::sci2for(std::string& aStr, | ||||
|     // Check for decimal place within specified boundaries | ||||
|     if ((idx == 0) || (idx >= (startPos + length - expLen - 1))) | ||||
|         { | ||||
|             //StringException e("sci2for: no decimal point in string"); | ||||
|             // Error: no decimal point in string | ||||
|         } | ||||
|  | ||||
|     // Here, account for the possibility that there are | ||||
| @@ -530,8 +529,8 @@ inline std::string& Rinex_Printer::sci2for(std::string& aStr, | ||||
|         { | ||||
|             redoexp = true; | ||||
|             // Swap digit and decimal. | ||||
|             aStr[idx] = aStr[idx - 1]; | ||||
|             aStr[idx - 1] = '.'; | ||||
|             aStr[static_cast<unsigned int>(idx)] = aStr[static_cast<unsigned int>(idx - 1)]; | ||||
|             aStr[static_cast<unsigned int>(idx - 1)] = '.'; | ||||
|             // Only add one to the exponent if the number is non-zero | ||||
|             if (asDouble(aStr.substr(startPos, length)) != 0.0) | ||||
|                 expAdd = 1; | ||||
| @@ -543,8 +542,7 @@ inline std::string& Rinex_Printer::sci2for(std::string& aStr, | ||||
|             idx = aStr.find('E', startPos); | ||||
|             if (idx == std::string::npos) | ||||
|                 { | ||||
|                     //StringException e("sci2for:no 'e' or 'E' in string"); | ||||
|                     //GPSTK_THROW(e); | ||||
|                     // Error: no 'e' or 'E' in string"; | ||||
|                 } | ||||
|         } | ||||
|  | ||||
| @@ -598,8 +596,6 @@ inline std::string asString(const long double x, const std::string::size_type pr | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| inline std::string Rinex_Printer::asString(const double x, const std::string::size_type precision) | ||||
| { | ||||
|     std::ostringstream ss; | ||||
| @@ -612,29 +608,30 @@ inline std::string Rinex_Printer::asFixWidthString(const int x, const int width, | ||||
| { | ||||
|     std::ostringstream ss; | ||||
|     ss << std::setfill(fill_digit) << std::setw(width) << x; | ||||
|     //std::cout << "asFixWidthString(): x=" << x << " width=" << width << " fill_digit=" << fill_digit << " ss=" << ss.str() << std::endl; | ||||
|     return ss.str().substr(ss.str().size() - width); | ||||
| } | ||||
|  | ||||
| inline long asInt(const std::string& s) | ||||
|     { return strtol(s.c_str(), 0, 10); } | ||||
|  | ||||
| inline long asInt(const std::string & s) | ||||
| { | ||||
|     return strtol(s.c_str(), 0, 10); | ||||
| } | ||||
|  | ||||
|  | ||||
| inline int Rinex_Printer::toInt(std::string bitString, int sLength) | ||||
| { | ||||
|     int tempInt; | ||||
|     int num = 0; | ||||
|     for(int i=0; i < sLength; i++) | ||||
|     for(int i = 0; i < sLength; i++) | ||||
|     { | ||||
|         tempInt = bitString[i]-'0'; | ||||
|         num |= (1 << (sLength-1-i)) * tempInt; | ||||
|         num |= (1 << (sLength - 1 - i)) * tempInt; | ||||
|     } | ||||
|     return num; | ||||
| } | ||||
|  | ||||
|  | ||||
| template<class X> | ||||
| inline std::string Rinex_Printer::asString(const X x) | ||||
| template<class X> inline std::string Rinex_Printer::asString(const X x) | ||||
| { | ||||
|     std::ostringstream ss; | ||||
|     ss << x; | ||||
|   | ||||
| @@ -116,6 +116,11 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit | ||||
|             d_fft_code_Q_A = static_cast<gr_complex*>(volk_malloc(d_fft_size * sizeof(gr_complex), volk_get_alignment())); | ||||
|             d_magnitudeQA = static_cast<float*>(volk_malloc(d_fft_size * sizeof(float), volk_get_alignment())); | ||||
|         } | ||||
|     else | ||||
|         { | ||||
|             d_fft_code_Q_A = 0; | ||||
|             d_magnitudeQA = 0; | ||||
|         } | ||||
|     // IF COHERENT INTEGRATION TIME > 1 | ||||
|     if (d_sampled_ms > 1) | ||||
|         { | ||||
| @@ -126,6 +131,11 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit | ||||
|                     d_fft_code_Q_B = static_cast<gr_complex*>(volk_malloc(d_fft_size * sizeof(gr_complex), volk_get_alignment())); | ||||
|                     d_magnitudeQB = static_cast<float*>(volk_malloc(d_fft_size * sizeof(float), volk_get_alignment())); | ||||
|                 } | ||||
|             else | ||||
|                 { | ||||
|                     d_fft_code_Q_B = 0; | ||||
|                     d_magnitudeQB = 0; | ||||
|                 } | ||||
|         } | ||||
|  | ||||
|     // Direct FFT | ||||
| @@ -147,6 +157,7 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit | ||||
|     d_doppler_freq = 0; | ||||
|     d_test_statistics = 0; | ||||
|     d_channel_internal_queue = 0; | ||||
|     d_CAF_vector = 0; | ||||
|     d_CAF_vector_I = 0; | ||||
|     d_CAF_vector_Q = 0; | ||||
|     d_channel = 0; | ||||
|   | ||||
| @@ -16,8 +16,7 @@ | ||||
| # along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>. | ||||
| # | ||||
|  | ||||
| set(TRACKING_LIB_SOURCES  | ||||
|      cordic.cc     | ||||
| set(TRACKING_LIB_SOURCES    | ||||
|      correlator.cc | ||||
|      lock_detectors.cc | ||||
|      tcp_communication.cc | ||||
|   | ||||
| @@ -1,194 +0,0 @@ | ||||
| /*! | ||||
|  * \file cordic.cc | ||||
|  * \brief Implementation of the CORDIC (COordinate Rotation DIgital Computer) algorithm. | ||||
|  * This implementation is NOT OPTIMIZED, only for demonstration purposes | ||||
|  * \author Carles Fernandez-Prades, 2012. cfernandez(at)cttc.es | ||||
|  * | ||||
|  * This is a modified implementation of the one found at | ||||
|  * http://www.dspguru.com/dsp/faqs/cordic | ||||
|  * | ||||
|  * ------------------------------------------------------------------------- | ||||
|  * | ||||
|  * Copyright (C) 2010-2015  (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 <http://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * ------------------------------------------------------------------------- | ||||
|  */ | ||||
|  | ||||
| #include <stdlib.h> | ||||
| //#include <math.h> | ||||
| #include <cmath> | ||||
| #include "cordic.h" | ||||
|  | ||||
|  | ||||
|  | ||||
| const double HALF_PI = 3.1415926535898 / 2; | ||||
| const int INVALID_K = -1; | ||||
|  | ||||
|  | ||||
|  | ||||
| Cordic::Cordic(int max_L) | ||||
| { | ||||
|     double K, dummy; | ||||
|     int L; | ||||
|     //mp_cordic_table = (CORDIC_TABLE *) calloc(max_L + 1, sizeof(CORDIC_TABLE)); | ||||
|     mp_cordic_table = (CORDIC_TABLE *) malloc((max_L + 1) * sizeof(CORDIC_TABLE)); | ||||
|     if (!mp_cordic_table) | ||||
|         { | ||||
|              /* failed to calloc table */ | ||||
|         } | ||||
|  | ||||
|     K = 1.0; | ||||
|     for (L = 0; L <= max_L; L++) | ||||
|         { | ||||
|             mp_cordic_table[L].K = K; | ||||
|             mp_cordic_table[L].phase_rads = (double) atan(K); | ||||
|             K *= 0.5; | ||||
|         } | ||||
|  | ||||
|     m_max_L = max_L; | ||||
|  | ||||
|     /* get m_mag_scale by getting the cordic magnitude with m_mag_scale = 1.0 */ | ||||
|     m_mag_scale = 1.0; | ||||
|     Cordic::cordic_get_mag_phase(1.0, 0.0, m_mag_scale, dummy); | ||||
|     m_mag_scale = 1.0 / m_mag_scale; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| Cordic::~Cordic () | ||||
| { | ||||
|     free(mp_cordic_table); | ||||
|     m_max_L = INVALID_K; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| void Cordic::cordic_get_mag_phase(double I, double Q, double &p_mag, double &p_phase_rads) | ||||
| { | ||||
|     int L; | ||||
|     double tmp_I, K, phase_rads, acc_phase_rads; | ||||
|  | ||||
|     if (I < 0) | ||||
|         { | ||||
|             /* rotate by an initial +/- 90 degrees */ | ||||
|             tmp_I = I; | ||||
|             if (Q > 0.0) | ||||
|                 { | ||||
|                     I = Q;           /* subtract 90 degrees */ | ||||
|                     Q = -tmp_I; | ||||
|                     acc_phase_rads = -HALF_PI; | ||||
|                 } | ||||
|             else | ||||
|                 { | ||||
|                     I = -Q;          /* add 90 degrees */ | ||||
|                     Q = tmp_I; | ||||
|                     acc_phase_rads = HALF_PI; | ||||
|                 } | ||||
|         } | ||||
|     else | ||||
|         { | ||||
|             acc_phase_rads = 0.0; | ||||
|         } | ||||
|  | ||||
|     /* rotate using "1 + jK" factors */ | ||||
|     for (L = 0; L <= m_max_L; L++) | ||||
|         { | ||||
|             K = mp_cordic_table[L].K; | ||||
|             phase_rads = mp_cordic_table[L].phase_rads; | ||||
|             tmp_I = I; | ||||
|             if (Q >= 0.0) | ||||
|                 { | ||||
|                     /* phase is positive: do negative rotation */ | ||||
|                     I += Q * K; | ||||
|                     Q -= tmp_I * K; | ||||
|                     acc_phase_rads -= phase_rads; | ||||
|                 } | ||||
|             else | ||||
|                 { | ||||
|                     /* phase is negative: do positive rotation */ | ||||
|                     I -= Q * K; | ||||
|                     Q += tmp_I * K; | ||||
|                     acc_phase_rads += phase_rads; | ||||
|                 } | ||||
|         } | ||||
|  | ||||
|     p_phase_rads = -acc_phase_rads; | ||||
|     p_mag = I * m_mag_scale; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| void Cordic::cordic_get_cos_sin(double desired_phase_rads, double &p_cos, double &p_sin) | ||||
| { | ||||
|     double I, Q, tmp_I; | ||||
|     double acc_phase_rads, phase_rads, K; | ||||
|     int L; | ||||
|  | ||||
|     /* start with +90, -90, or 0 degrees */ | ||||
|     if (desired_phase_rads > HALF_PI) | ||||
|         { | ||||
|             I = 0.0; | ||||
|             Q = 1.0; | ||||
|             acc_phase_rads = HALF_PI; | ||||
|         } | ||||
|     else if (desired_phase_rads < -HALF_PI) | ||||
|         { | ||||
|             I = 0.0; | ||||
|             Q = -1.0; | ||||
|             acc_phase_rads = -HALF_PI; | ||||
|         } | ||||
|     else | ||||
|         { | ||||
|             I = 1.0; | ||||
|             Q = 0.0; | ||||
|             acc_phase_rads = 0.0; | ||||
|         } | ||||
|  | ||||
|     /* rotate using "1 + jK" factors */ | ||||
|     for (L = 0; L <= m_max_L; L++) | ||||
|         { | ||||
|             K = mp_cordic_table[L].K; | ||||
|             phase_rads = mp_cordic_table[L].phase_rads; | ||||
|             tmp_I = I; | ||||
|             if (desired_phase_rads - acc_phase_rads < 0.0) | ||||
|                 { | ||||
|                     /* do negative rotation */ | ||||
|                     I += Q * K; | ||||
|                     Q -= tmp_I * K; | ||||
|                     acc_phase_rads -= phase_rads; | ||||
|                 } | ||||
|             else | ||||
|                 { | ||||
|                     /* do positive rotation */ | ||||
|                     I -= Q * K; | ||||
|                     Q += tmp_I * K; | ||||
|                     acc_phase_rads += phase_rads; | ||||
|                 } | ||||
|         } | ||||
|  | ||||
|     p_cos = I * m_mag_scale; | ||||
|     p_sin = Q * m_mag_scale; | ||||
| } | ||||
| @@ -1,80 +0,0 @@ | ||||
| /*! | ||||
|  * \file cordic.h | ||||
|  * \brief Interface of the CORDIC (COordinate Rotation DIgital Computer) algorithm. | ||||
|  * \author Carles Fernandez-Prades, 2012. cfernandez(at)cttc.es | ||||
|  * | ||||
|  * | ||||
|  * ------------------------------------------------------------------------- | ||||
|  * | ||||
|  * Copyright (C) 2010-2015  (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 <http://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * ------------------------------------------------------------------------- | ||||
|  */ | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| #ifndef GNSS_SDR_CORDIC_H_ | ||||
| #define GNSS_SDR_CORDIC_H_ | ||||
|  | ||||
| typedef struct tagCORDIC_TABLE { | ||||
|     double K; | ||||
|     double phase_rads; | ||||
| } CORDIC_TABLE; | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Implementation of the CORDIC (COordinate Rotation DIgital Computer) algorithm. | ||||
|  * This implementation is NOT OPTIMIZED, only for demonstration purposes | ||||
|  */ | ||||
| class Cordic | ||||
| { | ||||
| public: | ||||
|     /*! | ||||
|      * \brief construct the CORDIC table which will be of size "largest_k + 1". | ||||
|      */ | ||||
|     Cordic(int largest_k); | ||||
|  | ||||
|     /*! | ||||
|      * \brief Frees the CORDIC table's memory | ||||
|      */ | ||||
|     ~Cordic(); | ||||
|  | ||||
|     /*! | ||||
|      * \brief Calculates the magnitude and phase of "I + jQ".  p_phase_rads is in radians | ||||
|      */ | ||||
|     void cordic_get_mag_phase(double I, double Q, double &p_mag, double &p_phase_rads); | ||||
|     /* calculate the magnitude and phase of "I + jQ".  phase is in radians */ | ||||
|  | ||||
|     /*! | ||||
|      * \brief Calculates the cosine and sine of the desired phase in radians | ||||
|      */ | ||||
|     void cordic_get_cos_sin(double desired_phase_rads, double &p_cos, double &p_sin); | ||||
|  | ||||
| private: | ||||
|  | ||||
|     CORDIC_TABLE *mp_cordic_table; | ||||
|     int m_max_L; | ||||
|     double m_mag_scale; | ||||
|  | ||||
| }; | ||||
|  | ||||
| #endif | ||||
| @@ -723,7 +723,7 @@ int Sbas_Telemetry_Data::decode_sbstype9(const sbsmsg_t *msg, nav_t *nav) | ||||
|     seph.af1 = getbits(msg->msg, 218, 8)*P2_39/2.0; | ||||
|  | ||||
|     i = msg->prn-MINPRNSBS; | ||||
|     if (!nav->seph || std::abs(nav->seph[i].t0 - seph.t0) < 1E-3) | ||||
|     if (std::abs(nav->seph[i].t0 - seph.t0) < 1E-3) | ||||
|         { /* not change */ | ||||
|             VLOG(FLOW) << "<<T>> no change in ephemeris -> won't parse"; | ||||
|             return 0; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Carles Fernandez
					Carles Fernandez