38 #ifndef GNSS_SDR_RINEX_PRINTER_H 39 #define GNSS_SDR_RINEX_PRINTER_H 41 #include <boost/date_time/posix_time/posix_time.hpp> 89 const std::string& base_path =
".",
90 const std::string& base_name =
"-");
168 const std::map<int, Gnss_Synchro>& gnss_observables_map,
171 bool flag_write_RINEX_obs_output);
177 const std::map<int32_t, Gps_Ephemeris>& new_eph);
183 const std::map<int32_t, Gps_CNAV_Ephemeris>& new_cnav_eph);
189 const std::map<int32_t, Galileo_Ephemeris>& new_gal_eph);
195 const std::map<int32_t, Glonass_Gnav_Ephemeris>& new_glo_eph);
201 const std::map<int32_t, Beidou_Dnav_Ephemeris>& new_bds_eph);
213 return d_rinex_header_written;
221 return output_navfilename;
237 void rinex_obs_header(std::fstream& out,
239 double d_TOW_first_observation);
244 void rinex_obs_header(std::fstream& out,
246 double d_TOW_first_observation,
247 const std::string& gps_bands =
"2S");
252 void rinex_obs_header(std::fstream& out,
255 double d_TOW_first_observation,
256 const std::string& gps_bands =
"1C 2S");
262 void rinex_obs_header(std::fstream& out,
264 double d_TOW_first_observation,
265 const std::string& bands =
"1B");
272 void rinex_obs_header(std::fstream& out,
275 double d_TOW_first_observation,
276 const std::string& galileo_bands =
"1B");
282 void rinex_obs_header(std::fstream& out,
286 double d_TOW_first_observation,
287 const std::string& gps_bands =
"1C 2S",
288 const std::string& galileo_bands =
"1B");
294 void rinex_obs_header(std::fstream& out,
297 double d_TOW_first_observation,
298 const std::string& gps_bands =
"2S",
299 const std::string& galileo_bands =
"1B");
305 void rinex_obs_header(std::fstream& out,
307 double d_TOW_first_observation,
308 const std::string& bands =
"1G");
314 void rinex_obs_header(std::fstream& out,
317 double d_TOW_first_observation,
318 const std::string& glonass_bands =
"1C");
324 void rinex_obs_header(std::fstream& out,
327 double d_TOW_first_observation,
328 const std::string& galileo_bands =
"1B",
329 const std::string& glonass_bands =
"1C");
335 void rinex_obs_header(std::fstream& out,
338 double d_TOW_first_observation,
339 const std::string& glonass_bands =
"1G");
344 void rinex_obs_header(std::fstream& out,
346 double d_TOW_first_observation,
347 const std::string& bands);
352 void rinex_sbs_header(std::fstream& out)
const;
357 void log_rinex_obs(std::fstream& out,
360 const std::map<int32_t, Gnss_Synchro>& observables)
const;
365 void log_rinex_obs(std::fstream& out,
368 const std::map<int32_t, Gnss_Synchro>& observables)
const;
373 void log_rinex_obs(std::fstream& out,
377 const std::map<int32_t, Gnss_Synchro>& observables,
378 bool triple_band =
false)
const;
384 void log_rinex_obs(std::fstream& out,
387 const std::map<int32_t, Gnss_Synchro>& observables,
388 const std::string& galileo_bands =
"1B")
const;
393 void log_rinex_obs(std::fstream& out,
397 const std::map<int32_t, Gnss_Synchro>& observables)
const;
402 void log_rinex_obs(std::fstream& out,
406 const std::map<int32_t, Gnss_Synchro>& observables)
const;
411 void log_rinex_obs(std::fstream& out,
416 const std::map<int32_t, Gnss_Synchro>& observables,
417 bool triple_band =
false)
const;
423 void log_rinex_obs(std::fstream& out,
426 const std::map<int32_t, Gnss_Synchro>& observables,
427 const std::string& glonass_bands =
"1C")
const;
432 void log_rinex_obs(std::fstream& out,
436 const std::map<int32_t, Gnss_Synchro>& observables)
const;
441 void log_rinex_obs(std::fstream& out,
445 const std::map<int32_t, Gnss_Synchro>& observables)
const;
450 void log_rinex_obs(std::fstream& out,
453 double galileo_obs_time,
454 const std::map<int32_t, Gnss_Synchro>& observables)
const;
459 void log_rinex_obs(std::fstream& out,
462 const std::map<int32_t, Gnss_Synchro>& observables,
463 const std::string& bds_bands)
const;
468 void rinex_nav_header(std::fstream& out,
476 void rinex_nav_header(std::fstream& out,
483 void rinex_nav_header(std::fstream& out,
490 void rinex_nav_header(std::fstream& out,
500 void rinex_nav_header(std::fstream& out,
509 void rinex_nav_header(std::fstream& out,
516 void rinex_nav_header(std::fstream& out,
525 void rinex_nav_header(std::fstream& out,
535 void rinex_nav_header(std::fstream& out,
544 void rinex_nav_header(std::fstream& out,
551 void rinex_nav_header(std::fstream& out,
561 void rinex_nav_header(std::fstream& out,
570 void rinex_nav_header(std::fstream& out,
578 void rinex_nav_header(std::fstream& out,
587 void log_rinex_nav(std::fstream& out,
588 const std::map<int32_t, Gps_Ephemeris>& eph_map)
const;
593 void log_rinex_nav(std::fstream& out,
594 const std::map<int32_t, Gps_CNAV_Ephemeris>& eph_map);
599 void log_rinex_nav(std::fstream& out,
600 const std::map<int32_t, Galileo_Ephemeris>& eph_map)
const;
605 void log_rinex_nav(std::fstream& out,
606 const std::map<int32_t, Gps_Ephemeris>& gps_eph_map,
607 const std::map<int32_t, Galileo_Ephemeris>& galileo_eph_map);
612 void log_rinex_nav(std::fstream& out,
613 const std::map<int32_t, Gps_CNAV_Ephemeris>& gps_cnav_eph_map,
614 const std::map<int32_t, Galileo_Ephemeris>& galileo_eph_map);
619 void log_rinex_nav(std::fstream& out,
620 const std::map<int32_t, Glonass_Gnav_Ephemeris>& eph_map)
const;
625 void log_rinex_nav(std::fstream& out,
626 const std::map<int32_t, Gps_Ephemeris>& gps_eph_map,
627 const std::map<int32_t, Glonass_Gnav_Ephemeris>& glonass_gnav_eph_map)
const;
632 void log_rinex_nav(std::fstream& out,
633 const std::map<int32_t, Gps_CNAV_Ephemeris>& gps_cnav_eph_map,
634 const std::map<int32_t, Glonass_Gnav_Ephemeris>& glonass_gnav_eph_map);
639 void log_rinex_nav(std::fstream& out,
640 const std::map<int32_t, Galileo_Ephemeris>& galileo_eph_map,
641 const std::map<int32_t, Glonass_Gnav_Ephemeris>& glonass_gnav_eph_map);
646 void log_rinex_nav(std::fstream& out,
647 const std::map<int32_t, Beidou_Dnav_Ephemeris>& eph_map)
const;
666 boost::posix_time::ptime compute_GPS_time(
const Gps_Ephemeris& eph,
double obs_time)
const;
671 boost::posix_time::ptime compute_GPS_time(
const Gps_CNAV_Ephemeris& eph,
double obs_time)
const;
676 boost::posix_time::ptime compute_Galileo_time(
const Galileo_Ephemeris& eph,
double obs_time)
const;
697 void to_date_time(
int gps_week,
711 void update_nav_header(std::fstream& out,
715 void update_nav_header(std::fstream& out,
719 void update_nav_header(std::fstream& out,
726 void update_nav_header(std::fstream& out,
732 void update_nav_header(std::fstream& out,
736 void update_nav_header(std::fstream& out,
740 void update_nav_header(std::fstream& out,
747 void update_nav_header(std::fstream& out,
753 void update_nav_header(std::fstream& out,
759 void update_nav_header(std::fstream& out,
763 void update_obs_header(std::fstream& out,
766 void update_obs_header(std::fstream& out,
769 void update_obs_header(std::fstream& out,
772 void update_obs_header(std::fstream& out,
775 void update_obs_header(std::fstream& out,
781 int signalStrength(
double snr)
const;
799 std::string createFilename(
const std::string& type,
const std::string& base_name)
const;
804 std::string getLocalTime()
const;
809 void lengthCheck(
const std::string& line)
const;
824 inline std::string& leftJustify(std::string& s,
825 std::string::size_type length,
826 char pad =
' ')
const;
841 inline std::string leftJustify(
const std::string& s,
842 std::string::size_type length,
843 char pad =
' ')
const 846 return leftJustify(t, length, pad);
856 inline std::string& rightJustify(std::string& s,
857 std::string::size_type length,
858 char pad =
' ')
const;
866 inline std::string rightJustify(
const std::string& s,
867 std::string::size_type length,
868 char pad =
' ')
const 871 return rightJustify(t, length, pad);
885 inline std::string doub2sci(
double d,
886 std::string::size_type length,
887 std::string::size_type expLen,
888 bool showSign =
true,
889 bool checkSwitch =
true)
const;
906 inline std::string& sci2for(std::string& aStr,
907 std::string::size_type startPos = 0,
908 std::string::size_type length = std::string::npos,
909 std::string::size_type expLen = 3,
910 bool checkSwitch =
true)
const;
925 inline std::string doub2for(
double d,
926 std::string::size_type length,
927 std::string::size_type expLen,
928 bool checkSwitch =
true)
const;
936 inline double asDouble(
const std::string& s)
const 938 return strtod(s.c_str(),
nullptr);
942 inline int toInt(
const std::string& bitString,
int sLength)
const;
949 inline int64_t asInt(
const std::string& s)
const 951 return strtol(s.c_str(),
nullptr, 10);
961 inline std::string asString(
double x,
962 std::string::size_type precision = 17)
const;
971 inline std::string asString(
long double x,
972 std::string::size_type precision = 21)
const;
982 inline std::string asString(
const X x)
const;
984 inline std::string asFixWidthString(
int x,
int width,
char fill_digit)
const;
986 std::map<std::string, std::string> satelliteSystem;
987 std::map<std::string, std::string> observationType;
988 std::map<std::string, std::string> observationCode;
990 std::fstream obsFile;
991 std::fstream navFile;
992 std::fstream sbsFile;
993 std::fstream navGalFile;
994 std::fstream navGloFile;
995 std::fstream navBdsFile;
996 std::fstream navMixFile;
998 std::string navfilename;
999 std::string obsfilename;
1000 std::string sbsfilename;
1001 std::string navGalfilename;
1002 std::string navGlofilename;
1003 std::string navBdsfilename;
1004 std::string navMixfilename;
1005 std::vector<std::string> output_navfilename;
1007 std::string d_stringVersion;
1009 double d_fake_cnav_iode;
1011 int d_numberTypesObservations;
1012 bool d_rinex_header_updated;
1013 bool d_rinex_header_written;
1014 bool d_pre_2009_file;
1020 inline std::string& Rinex_Printer::leftJustify(std::string& s,
1021 std::string::size_type length,
1024 if (length < s.length())
1026 s = s.substr(0, length);
1030 s.append(length - s.length(), pad);
1038 inline std::string& Rinex_Printer::rightJustify(std::string& s,
1039 std::string::size_type length,
1042 if (length < s.length())
1044 s = s.substr(s.length() - length, std::string::npos);
1048 s.insert(static_cast<std::string::size_type>(0), length - s.length(), pad);
1054 inline std::string Rinex_Printer::doub2for(
double d,
1055 std::string::size_type length,
1056 std::string::size_type expLen,
1057 bool checkSwitch)
const 1059 int16_t exponentLength = expLen;
1062 if (exponentLength < 0)
1067 if (exponentLength > 3 && checkSwitch)
1072 std::string toReturn = doub2sci(d, length, exponentLength,
true, checkSwitch);
1073 sci2for(toReturn, 0, length, exponentLength, checkSwitch);
1079 inline std::string Rinex_Printer::doub2sci(
double d,
1080 std::string::size_type length,
1081 std::string::size_type expLen,
1083 bool checkSwitch)
const 1085 std::string toReturn;
1086 int16_t exponentLength = expLen;
1089 if (exponentLength < 0)
1094 if (exponentLength > 3 && checkSwitch)
1099 std::stringstream c;
1100 c.setf(std::ios::scientific, std::ios::floatfield);
1113 c.precision(length - 3 - exponentLength - 1 - expSize);
1120 inline std::string& Rinex_Printer::sci2for(std::string& aStr,
1121 std::string::size_type startPos,
1122 std::string::size_type length,
1123 std::string::size_type expLen,
1124 bool checkSwitch)
const 1126 std::string::size_type idx = aStr.find(
'.', startPos);
1132 bool redoexp = !checkSwitch;
1135 if ((idx <= 0) || (idx >= (startPos + length - expLen - 1)))
1150 aStr[idx] = aStr[idx - 1];
1151 aStr[idx - 1] =
'.';
1153 if (asDouble(aStr.substr(startPos, length)) != 0.0)
1159 idx = aStr.find(
'e', startPos);
1160 if (idx == std::string::npos)
1162 idx = aStr.find(
'E', startPos);
1163 if (idx == std::string::npos)
1182 exp = aStr.substr(idx + 1, std::string::npos);
1186 aStr.erase(idx + 1);
1197 aStr += Rinex_Printer::rightJustify(asString(iexp), expLen,
'0');
1204 aStr.insert(static_cast<std::string::size_type>(0), 1,
' ');
1210 aStr.insert(static_cast<std::string::size_type>(1), 1,
'0');
1217 inline std::string asString(
long double x, std::string::size_type precision)
1219 std::ostringstream ss;
1220 ss << std::fixed << std::setprecision(precision) << x;
1225 inline std::string Rinex_Printer::asString(
double x, std::string::size_type precision)
const 1227 std::ostringstream ss;
1228 ss << std::fixed << std::setprecision(precision) << x;
1233 inline std::string Rinex_Printer::asFixWidthString(
int x,
int width,
char fill_digit)
const 1235 std::ostringstream ss;
1236 ss << std::setfill(fill_digit) << std::setw(width) << x;
1237 return ss.str().substr(ss.str().size() - width);
1241 inline int64_t asInt(
const std::string& s)
1243 return strtol(s.c_str(),
nullptr, 10);
1247 inline int Rinex_Printer::toInt(
const std::string& bitString,
int sLength)
const 1251 for (
int i = 0; i < sLength; i++)
1253 tempInt = bitString[i] -
'0';
1254 num |= (1 << (sLength - 1 - i)) * tempInt;
1261 inline std::string Rinex_Printer::asString(
const X x)
const 1263 std::ostringstream ss;
1271 #endif // GNSS_SDR_RINEX_PRINTER_H This class is a storage for the GPS IONOSPHERIC data as described in IS-GPS-200M. ...
std::string get_obsfilename() const
Returns name of RINEX observation file.
This is a storage class for the GPS CNAV ephemeris data as described in IS-GPS-200M.
This class is a storage for the BeiDou DNAV UTC Model.
This class is a storage and orbital model functions for the GPS SV ephemeris data as described in IS-...
bool is_rinex_header_written() const
Returns true is the RINEX file headers are already written.
Rinex_Printer(int version=0, const std::string &base_path=".", const std::string &base_name="-")
Constructor. Creates GNSS Navigation and Observables RINEX files.
This class is a storage for the BEIDOU IONOSPHERIC data as described in ICD v2.1. ...
Class that handles the generation of Receiver INdependent EXchange format (RINEX) files...
void print_rinex_annotation(const Rtklib_Solver *pvt_solver, const std::map< int, Gnss_Synchro > &gnss_observables_map, double rx_time, int type_of_rx, bool flag_write_RINEX_obs_output)
Print RINEX annotation. If it is the first annotation, it also prints the RINEX headers for navigatio...
This class is a storage and orbital model functions for the GLONASS SV ephemeris data as described in...
This class implements a PVT solution based on RTKLIB.
~Rinex_Printer()
Destructor. Removes created files if empty.
This is a storage class for the Beidou SV ephemeris data as described in BeiDou Navigation Satellite ...
This is the class that contains the information that is shared by the processing blocks.
void log_rinex_nav_gal_nav(int type_of_rx, const std::map< int32_t, Galileo_Ephemeris > &new_gal_eph)
Print RINEX annotation for Galileo NAV message.
void log_rinex_nav_gps_cnav(int type_of_rx, const std::map< int32_t, Gps_CNAV_Ephemeris > &new_cnav_eph)
Print RINEX annotation for GPS CNAV message.
void log_rinex_nav_gps_nav(int type_of_rx, const std::map< int32_t, Gps_Ephemeris > &new_eph)
Print RINEX annotation for GPS NAV message.
This class is a storage for the GPS UTC MODEL data as described in in IS-GPS-200M.
This class decodes a GPS NAV Data message as described in IS-GPS-200M.
This class is a storage for the GALILEO IONOSPHERIC data as described in Galileo ICD paragraph 5...
void set_pre_2009_file(bool pre_2009_file)
Set processing for signals older than 2009.
This class is a storage and orbital model functions for the Galileo SV ephemeris data as described in...
This class is a storage for the GLONASS GNAV UTC MODEL data as described in GLONASS ICD (Edition 5...
This class is a storage for the GPS UTC MODEL data as described in IS-GPS-200M.
This class is a storage for the GLONASS SV ALMANAC data as described GLONASS ICD (Edition 5...
void log_rinex_nav_glo_gnav(int type_of_rx, const std::map< int32_t, Glonass_Gnav_Ephemeris > &new_glo_eph)
Print RINEX annotation for Glonass GNAV message.
This class is a storage for the GALILEO UTC MODEL data as described in Galileo ICD https://www...
std::vector< std::string > get_navfilename() const
Returns name of RINEX navigation file(s)
This class is a storage for the GPS IONOSPHERIC data as described in IS-GPS-200M. ...
void log_rinex_nav_bds_dnav(int type_of_rx, const std::map< int32_t, Beidou_Dnav_Ephemeris > &new_bds_eph)
Print RINEX annotation for BeiDou DNAV message.