mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-10-31 15:23:04 +00:00 
			
		
		
		
	Add work on Galileo observables RINEX printer
This commit is contained in:
		| @@ -599,10 +599,10 @@ int hybrid_pvt_cc::general_work (int noutput_items __attribute__((unused)), gr_v | ||||
|                                                 { | ||||
|                                                     rp->log_rinex_nav(rp->navMixFile, d_ls_pvt->gps_ephemeris_map, d_ls_pvt->galileo_ephemeris_map); | ||||
|                                                 } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|                                             if((type_of_rx == 14) || (type_of_rx == 15)) //  Galileo E1B + Galileo E5a | ||||
|                                                 { | ||||
|                                                   rp->log_rinex_nav(rp->navGalFile, d_ls_pvt->galileo_ephemeris_map); | ||||
|                                                 } | ||||
|  | ||||
|                                             d_last_sample_nav_output = d_sample_counter; | ||||
|                                         } | ||||
| @@ -610,6 +610,7 @@ int hybrid_pvt_cc::general_work (int noutput_items __attribute__((unused)), gr_v | ||||
|                                     gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.begin(); | ||||
|                                     gps_cnav_ephemeris_iter = d_ls_pvt->gps_cnav_ephemeris_map.begin(); | ||||
|  | ||||
|                                     // Log observables into the RINEX file | ||||
|                                     if(type_of_rx == 1) // GPS L1 C/A only | ||||
|                                         { | ||||
|                                             if (gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.end()) | ||||
| @@ -636,11 +637,37 @@ int hybrid_pvt_cc::general_work (int noutput_items __attribute__((unused)), gr_v | ||||
|                                                     b_rinex_header_updated = true; | ||||
|                                                 } | ||||
|                                         } | ||||
|                                     if((type_of_rx == 4) || (type_of_rx == 5)  || (type_of_rx == 6)) // Galileo single freq | ||||
|                                     if(type_of_rx == 4) // Galileo E1B only | ||||
|                                         { | ||||
|                                             if (galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.end()) | ||||
|                                                 { | ||||
|                                                     rp->log_rinex_obs(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, gnss_observables_map); | ||||
|                                                     rp->log_rinex_obs(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, gnss_observables_map, "1B"); | ||||
|                                                 } | ||||
|                                             if (!b_rinex_header_updated && (d_ls_pvt->galileo_utc_model.A0_6 != 0)) | ||||
|                                                 { | ||||
|                                                     rp->update_nav_header(rp->navGalFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model, d_ls_pvt->galileo_almanac); | ||||
|                                                     rp->update_obs_header(rp->obsFile, d_ls_pvt->galileo_utc_model); | ||||
|                                                     b_rinex_header_updated = true; | ||||
|                                                 } | ||||
|                                         } | ||||
|                                     if(type_of_rx == 5) // Galileo E5a only | ||||
|                                         { | ||||
|                                             if (galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.end()) | ||||
|                                                 { | ||||
|                                                     rp->log_rinex_obs(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, gnss_observables_map, "5X"); | ||||
|                                                 } | ||||
|                                             if (!b_rinex_header_updated && (d_ls_pvt->galileo_utc_model.A0_6 != 0)) | ||||
|                                                 { | ||||
|                                                     rp->update_nav_header(rp->navGalFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model, d_ls_pvt->galileo_almanac); | ||||
|                                                     rp->update_obs_header(rp->obsFile, d_ls_pvt->galileo_utc_model); | ||||
|                                                     b_rinex_header_updated = true; | ||||
|                                                 } | ||||
|                                         } | ||||
|                                     if(type_of_rx == 6) // Galileo E5b only | ||||
|                                         { | ||||
|                                             if (galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.end()) | ||||
|                                                 { | ||||
|                                                     rp->log_rinex_obs(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, gnss_observables_map, "7X"); | ||||
|                                                 } | ||||
|                                             if (!b_rinex_header_updated && (d_ls_pvt->galileo_utc_model.A0_6 != 0)) | ||||
|                                                 { | ||||
| @@ -675,7 +702,32 @@ int hybrid_pvt_cc::general_work (int noutput_items __attribute__((unused)), gr_v | ||||
|                                                     b_rinex_header_updated = true; | ||||
|                                                 } | ||||
|                                         } | ||||
|  | ||||
|                                     if(type_of_rx == 14) // Galileo E1B + Galileo E5a | ||||
|                                         { | ||||
|                                             if (galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.end()) | ||||
|                                                 { | ||||
|                                                     rp->log_rinex_obs(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, gnss_observables_map, "1B 5X"); | ||||
|                                                 } | ||||
|                                             if (!b_rinex_header_updated && (d_ls_pvt->galileo_utc_model.A0_6 != 0)) | ||||
|                                                 { | ||||
|                                                     rp->update_nav_header(rp->navGalFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model, d_ls_pvt->galileo_almanac); | ||||
|                                                     rp->update_obs_header(rp->obsFile, d_ls_pvt->galileo_utc_model); | ||||
|                                                     b_rinex_header_updated = true; | ||||
|                                                 } | ||||
|                                         } | ||||
|                                     if(type_of_rx == 15) // Galileo E1B + Galileo E5b | ||||
|                                         { | ||||
|                                             if (galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.end()) | ||||
|                                                 { | ||||
|                                                     rp->log_rinex_obs(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, gnss_observables_map, "1B 7X"); | ||||
|                                                 } | ||||
|                                             if (!b_rinex_header_updated && (d_ls_pvt->galileo_utc_model.A0_6 != 0)) | ||||
|                                                 { | ||||
|                                                     rp->update_nav_header(rp->navGalFile, d_ls_pvt->galileo_iono, d_ls_pvt->galileo_utc_model, d_ls_pvt->galileo_almanac); | ||||
|                                                     rp->update_obs_header(rp->obsFile, d_ls_pvt->galileo_utc_model); | ||||
|                                                     b_rinex_header_updated = true; | ||||
|                                                 } | ||||
|                                         } | ||||
|                                 } | ||||
|  | ||||
|                             // ####################### RTCM MESSAGES ################# | ||||
| @@ -856,5 +908,3 @@ int hybrid_pvt_cc::general_work (int noutput_items __attribute__((unused)), gr_v | ||||
|     consume_each(1); //one by one | ||||
|     return 1; | ||||
| } | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -4191,7 +4191,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream & out, const Gps_Ephemeris & eph, | ||||
| } | ||||
|  | ||||
|  | ||||
| void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& eph, double obs_time, const std::map<int,Gnss_Synchro>& pseudoranges) | ||||
| void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& eph, double obs_time, const std::map<int,Gnss_Synchro>& pseudoranges, const std::string galileo_bands) | ||||
| { | ||||
|     // RINEX observations timestamps are Galileo timestamps. | ||||
|     // See http://gage14.upc.es/gLAB/HTML/Observation_Rinex_v3.01.html | ||||
| @@ -4260,10 +4260,15 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ep | ||||
|                     pseudorangesE5B.insert(std::pair<int, Gnss_Synchro>(pseudoranges_iter->first, pseudoranges_iter->second)); | ||||
|                 } | ||||
|         } | ||||
|     std::size_t found_1B = galileo_bands.find("1B"); | ||||
|     std::size_t found_E5a = galileo_bands.find("5X"); | ||||
|     std::size_t found_E5b = galileo_bands.find("7X"); | ||||
|  | ||||
|     std::multimap<unsigned int, Gnss_Synchro> total_map; | ||||
|     std::set<unsigned int> available_prns; | ||||
|     std::set<unsigned int>::iterator it; | ||||
|     if(found_1B != std::string::npos) | ||||
|     { | ||||
|         for(pseudoranges_iter = pseudorangesE1B.begin(); | ||||
|                 pseudoranges_iter != pseudorangesE1B.end(); | ||||
|                 pseudoranges_iter++) | ||||
| @@ -4276,33 +4281,84 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ep | ||||
|                         available_prns.insert(prn_); | ||||
|                     } | ||||
|             } | ||||
|  | ||||
|     } | ||||
|     if(found_E5a != std::string::npos) | ||||
|     { | ||||
|         for(pseudoranges_iter = pseudorangesE5A.begin(); | ||||
|                 pseudoranges_iter != pseudorangesE5A.end(); | ||||
|                 pseudoranges_iter++) | ||||
|             { | ||||
|                 unsigned int prn_ = pseudoranges_iter->second.PRN; | ||||
|             total_map.insert(std::pair<unsigned int, Gnss_Synchro>(prn_, pseudoranges_iter->second)); | ||||
|                 it = available_prns.find(prn_); | ||||
|                 if(it == available_prns.end()) | ||||
|                     { | ||||
|                         available_prns.insert(prn_); | ||||
|                         if(found_1B != std::string::npos) | ||||
|                         { | ||||
|                             Gnss_Synchro gs = Gnss_Synchro(); | ||||
|                             std::string sys = "E"; | ||||
|                             gs.System = *sys.c_str(); | ||||
|                             std::string sig = "1B"; | ||||
|                             std::memcpy((void*)gs.Signal, sig.c_str(), 3); | ||||
|                             gs.PRN = prn_; | ||||
|                             total_map.insert(std::pair<unsigned int, Gnss_Synchro>(prn_, gs)); | ||||
|                         } | ||||
|                     } | ||||
|  | ||||
|                 total_map.insert(std::pair<unsigned int, Gnss_Synchro>(prn_, pseudoranges_iter->second)); | ||||
|             } | ||||
|     } | ||||
|     if(found_E5b != std::string::npos) | ||||
|     { | ||||
|         for(pseudoranges_iter = pseudorangesE5B.begin(); | ||||
|                 pseudoranges_iter != pseudorangesE5B.end(); | ||||
|                 pseudoranges_iter++) | ||||
|             { | ||||
|                 unsigned int prn_ = pseudoranges_iter->second.PRN; | ||||
|             total_map.insert(std::pair<unsigned int, Gnss_Synchro>(prn_, pseudoranges_iter->second)); | ||||
|                 it = available_prns.find(prn_); | ||||
|                 if(it == available_prns.end()) | ||||
|                     { | ||||
|                         available_prns.insert(prn_); | ||||
|                         if(found_1B != std::string::npos) | ||||
|                         { | ||||
|                             Gnss_Synchro gs = Gnss_Synchro(); | ||||
|                             std::string sys = "E"; | ||||
|                             gs.System = *sys.c_str(); | ||||
|                             std::string sig = "1B"; | ||||
|                             std::memcpy((void*)gs.Signal, sig.c_str(), 3); | ||||
|                             gs.PRN = prn_; | ||||
|                             total_map.insert(std::pair<unsigned int, Gnss_Synchro>(prn_, gs)); | ||||
|                         } | ||||
|                         if(found_E5a != std::string::npos) | ||||
|                         { | ||||
|                             Gnss_Synchro gs = Gnss_Synchro(); | ||||
|                             std::string sys = "E"; | ||||
|                             gs.System = *sys.c_str(); | ||||
|                             std::string sig = "5X"; | ||||
|                             std::memcpy((void*)gs.Signal, sig.c_str(), 3); | ||||
|                             gs.PRN = prn_; | ||||
|                             total_map.insert(std::pair<unsigned int, Gnss_Synchro>(prn_, gs)); | ||||
|                         } | ||||
|                     } | ||||
|                 else | ||||
|                     { | ||||
|                         // if 5X is listed but empty | ||||
|                         if(found_E5a != std::string::npos) | ||||
|                             { | ||||
|                                 if( (total_map.count(prn_)) == 1) | ||||
|                                 { | ||||
|                                     Gnss_Synchro gs = Gnss_Synchro(); | ||||
|                                     std::string sys = "E"; | ||||
|                                     gs.System = *sys.c_str(); | ||||
|                                     std::string sig = "5X"; | ||||
|                                     std::memcpy((void*)gs.Signal, sig.c_str(), 3); | ||||
|                                     gs.PRN = prn_; | ||||
|                                     total_map.insert(std::pair<unsigned int, Gnss_Synchro>(prn_, gs)); | ||||
|                                 } | ||||
|                             } | ||||
|                     } | ||||
|                 total_map.insert(std::pair<unsigned int, Gnss_Synchro>(prn_, pseudoranges_iter->second)); | ||||
|             } | ||||
|     } | ||||
|  | ||||
|     int numSatellitesObserved = available_prns.size(); | ||||
|     line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(numSatellitesObserved), 3); | ||||
|     // Receiver clock offset (optional) | ||||
|   | ||||
| @@ -197,9 +197,9 @@ public: | ||||
|     void log_rinex_obs(std::fstream & out, const Gps_Ephemeris & eph, const Gps_CNAV_Ephemeris & eph_cnav, double obs_time, const std::map<int, Gnss_Synchro> & pseudoranges); | ||||
|  | ||||
|     /*! | ||||
|      *  \brief Writes Galileo observables into the RINEX file | ||||
|      *  \brief Writes Galileo observables into the RINEX file. Example: galileo_bands("1B"), galileo_bands("1B 5X"), galileo_bands("5X"), ... Default: "1B". | ||||
|      */ | ||||
|     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, const std::string galileo_bands = "1B"); | ||||
|  | ||||
|     /*! | ||||
|      *  \brief Writes Mixed GPS / Galileo observables into the RINEX file | ||||
|   | ||||
| @@ -326,6 +326,11 @@ TEST(Rinex_Printer_Test, GalileoObsLogDualBand) | ||||
|     gs2.Carrier_Doppler_hz = 321; | ||||
|     gs2.CN0_dB_hz = 39; | ||||
|  | ||||
|     gs3.Pseudorange_m = 22000003.3; | ||||
|     gs3.Carrier_phase_rads = 43.3; | ||||
|     gs3.Carrier_Doppler_hz = -321; | ||||
|     gs3.CN0_dB_hz = 40; | ||||
|  | ||||
|     gs4.Pseudorange_m = 22000000; | ||||
|     gs4.Carrier_phase_rads = 23.4; | ||||
|     gs4.Carrier_Doppler_hz = 1534; | ||||
| @@ -336,7 +341,7 @@ TEST(Rinex_Printer_Test, GalileoObsLogDualBand) | ||||
|     gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(3,gs3) ); | ||||
|     gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(4,gs4) ); | ||||
|  | ||||
|     rp->log_rinex_obs(rp->obsFile, eph, 0.0, gnss_pseudoranges_map); | ||||
|     rp->log_rinex_obs(rp->obsFile, eph, 0.0, gnss_pseudoranges_map, bands); | ||||
|     rp->obsFile.seekp(0); | ||||
|  | ||||
|     while(!rp->obsFile.eof()) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Carles Fernandez
					Carles Fernandez