mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-29 02:14:51 +00:00
Merge branch 'rinex-l2' of https://github.com/carlesfernandez/gnss-sdr into next
This commit is contained in:
commit
f3d2a02169
@ -35,6 +35,7 @@
|
||||
#include <cstdlib> // for getenv()
|
||||
#include <iterator>
|
||||
#include <ostream>
|
||||
#include <set>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <boost/date_time/time_zone_base.hpp>
|
||||
@ -102,7 +103,7 @@ Rinex_Printer::Rinex_Printer()
|
||||
observationCode["GALILEO_E1_ABC"] = "1Z"; // "1Z" GALILEO E1 A+B+C
|
||||
observationCode["GALILEO_E5a_I"] = "5I"; // "5I" GALILEO E5a I (F/NAV OS)
|
||||
observationCode["GALILEO_E5a_Q"] = "5Q"; // "5Q" GALILEO E5a Q (no data)
|
||||
observationCode["GALILEO_E5aIQ"] = "5X"; // "5X" GALILEO E5a I+Q
|
||||
observationCode["GALILEO_E5a_IQ"] = "5X"; // "5X" GALILEO E5a I+Q
|
||||
observationCode["GALILEO_E5b_I"] = "7I"; // "7I" GALILEO E5b I
|
||||
observationCode["GALILEO_E5b_Q"] = "7Q"; // "7Q" GALILEO E5b Q
|
||||
observationCode["GALILEO_E5b_IQ"] = "7X"; // "7X" GALILEO E5b I+Q
|
||||
@ -2881,7 +2882,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream & out, const Gps_Ephemeris & e
|
||||
}
|
||||
|
||||
|
||||
void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& eph, const double d_TOW_first_observation)
|
||||
void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris& eph, const double d_TOW_first_observation, const std::string bands)
|
||||
{
|
||||
std::string line;
|
||||
version = 3;
|
||||
@ -3019,22 +3020,82 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris&
|
||||
|
||||
// -------- SYS / OBS TYPES
|
||||
// one line per available system
|
||||
unsigned int number_of_observations = 0;
|
||||
std::string signal_("1B");
|
||||
std::size_t found_1B = bands.find(signal_);
|
||||
if(found_1B != std::string::npos)
|
||||
{
|
||||
number_of_observations = number_of_observations + 4;
|
||||
}
|
||||
signal_ = "5X";
|
||||
std::size_t found_5X = bands.find(signal_);
|
||||
if(found_5X != std::string::npos)
|
||||
{
|
||||
number_of_observations = number_of_observations + 4;
|
||||
}
|
||||
|
||||
line.clear();
|
||||
signal_ = "7X";
|
||||
std::size_t found_7X = bands.find(signal_);
|
||||
if(found_7X != std::string::npos)
|
||||
{
|
||||
number_of_observations = number_of_observations + 4;
|
||||
}
|
||||
|
||||
line.clear();
|
||||
|
||||
line += satelliteSystem["Galileo"];
|
||||
line += std::string(2, ' ');
|
||||
line += Rinex_Printer::rightJustify("4", 3);
|
||||
line += std::string(1, ' ');
|
||||
line += observationType["PSEUDORANGE"];
|
||||
line += observationCode["GALILEO_E1_B"];
|
||||
line += std::string(1, ' ');
|
||||
line += observationType["CARRIER_PHASE"];
|
||||
line += observationCode["GALILEO_E1_B"];
|
||||
line += std::string(1, ' ');
|
||||
line += observationType["DOPPLER"];
|
||||
line += observationCode["GALILEO_E1_B"];
|
||||
line += std::string(1, ' ');
|
||||
line += observationType["SIGNAL_STRENGTH"];
|
||||
line += observationCode["GALILEO_E1_B"];
|
||||
line += Rinex_Printer::rightJustify(std::to_string(number_of_observations), 3);
|
||||
|
||||
if(found_1B != std::string::npos)
|
||||
{
|
||||
line += std::string(1, ' ');
|
||||
line += observationType["PSEUDORANGE"];
|
||||
line += observationCode["GALILEO_E1_B"];
|
||||
line += std::string(1, ' ');
|
||||
line += observationType["CARRIER_PHASE"];
|
||||
line += observationCode["GALILEO_E1_B"];
|
||||
line += std::string(1, ' ');
|
||||
line += observationType["DOPPLER"];
|
||||
line += observationCode["GALILEO_E1_B"];
|
||||
line += std::string(1, ' ');
|
||||
line += observationType["SIGNAL_STRENGTH"];
|
||||
line += observationCode["GALILEO_E1_B"];
|
||||
}
|
||||
|
||||
if(found_5X != std::string::npos)
|
||||
{
|
||||
line += std::string(1, ' ');
|
||||
line += observationType["PSEUDORANGE"];
|
||||
line += observationCode["GALILEO_E5a_IQ"];
|
||||
line += std::string(1, ' ');
|
||||
line += observationType["CARRIER_PHASE"];
|
||||
line += observationCode["GALILEO_E5a_IQ"];
|
||||
line += std::string(1, ' ');
|
||||
line += observationType["DOPPLER"];
|
||||
line += observationCode["GALILEO_E5a_IQ"];
|
||||
line += std::string(1, ' ');
|
||||
line += observationType["SIGNAL_STRENGTH"];
|
||||
line += observationCode["GALILEO_E5a_IQ"];
|
||||
}
|
||||
|
||||
if(found_7X != std::string::npos)
|
||||
{
|
||||
line += std::string(1, ' ');
|
||||
line += observationType["PSEUDORANGE"];
|
||||
line += observationCode["GALILEO_E5b_IQ"];
|
||||
line += std::string(1, ' ');
|
||||
line += observationType["CARRIER_PHASE"];
|
||||
line += observationCode["GALILEO_E5b_IQ"];
|
||||
line += std::string(1, ' ');
|
||||
line += observationType["DOPPLER"];
|
||||
line += observationCode["GALILEO_E5b_IQ"];
|
||||
line += std::string(1, ' ');
|
||||
line += observationType["SIGNAL_STRENGTH"];
|
||||
line += observationCode["GALILEO_E5b_IQ"];
|
||||
}
|
||||
|
||||
line += std::string(60-line.size(), ' ');
|
||||
line += Rinex_Printer::leftJustify("SYS / # / OBS TYPES", 20);
|
||||
Rinex_Printer::lengthCheck(line);
|
||||
@ -3048,7 +3109,6 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris&
|
||||
Rinex_Printer::lengthCheck(line);
|
||||
out << line << std::endl;
|
||||
|
||||
|
||||
// -------- TIME OF FIRST OBS
|
||||
line.clear();
|
||||
boost::posix_time::ptime p_galileo_time = Rinex_Printer::compute_Galileo_time(eph, d_TOW_first_observation);
|
||||
@ -4122,7 +4182,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ep
|
||||
// Add extra 0 if seconds are < 10
|
||||
if (seconds < 10)
|
||||
{
|
||||
line +=std::string(1, '0');
|
||||
line += std::string(1, '0');
|
||||
}
|
||||
line += Rinex_Printer::asString(seconds, 7);
|
||||
line += std::string(2, ' ');
|
||||
@ -4130,76 +4190,143 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ep
|
||||
line += std::string(1, '0');
|
||||
|
||||
//Number of satellites observed in current epoch
|
||||
int numSatellitesObserved = 0;
|
||||
|
||||
//Get maps with Galileo observations
|
||||
std::map<int, Gnss_Synchro> pseudorangesE1B;
|
||||
std::map<int, Gnss_Synchro> pseudorangesE5A;
|
||||
std::map<int, Gnss_Synchro> pseudorangesE5B;
|
||||
std::map<int, Gnss_Synchro>::const_iterator pseudoranges_iter;
|
||||
|
||||
for(pseudoranges_iter = pseudoranges.begin();
|
||||
pseudoranges_iter != pseudoranges.end();
|
||||
pseudoranges_iter++)
|
||||
{
|
||||
numSatellitesObserved++;
|
||||
std::string system_(&pseudoranges_iter->second.System, 1);
|
||||
std::string sig_(pseudoranges_iter->second.Signal);
|
||||
if((system_.compare("E") == 0) && (sig_.compare("1B") == 0))
|
||||
{
|
||||
pseudorangesE1B.insert(std::pair<int, Gnss_Synchro>(pseudoranges_iter->first, pseudoranges_iter->second));
|
||||
}
|
||||
if((system_.compare("E") == 0) && (sig_.compare("5X") == 0))
|
||||
{
|
||||
pseudorangesE5A.insert(std::pair<int, Gnss_Synchro>(pseudoranges_iter->first, pseudoranges_iter->second));
|
||||
}
|
||||
if((system_.compare("E") == 0) && (sig_.compare("7X") == 0))
|
||||
{
|
||||
pseudorangesE5B.insert(std::pair<int, Gnss_Synchro>(pseudoranges_iter->first, pseudoranges_iter->second));
|
||||
}
|
||||
}
|
||||
line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(numSatellitesObserved), 3);
|
||||
|
||||
std::multimap<unsigned int, Gnss_Synchro> total_map;
|
||||
std::multimap<unsigned int, Gnss_Synchro>::iterator total_iter;
|
||||
std::set<unsigned int> available_prns;
|
||||
std::set<unsigned int>::iterator it;
|
||||
for(pseudoranges_iter = pseudorangesE1B.begin();
|
||||
pseudoranges_iter != pseudorangesE1B.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_);
|
||||
}
|
||||
}
|
||||
|
||||
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_);
|
||||
}
|
||||
}
|
||||
|
||||
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_);
|
||||
}
|
||||
}
|
||||
|
||||
int numSatellitesObserved = available_prns.size();
|
||||
line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(numSatellitesObserved), 3);
|
||||
// Receiver clock offset (optional)
|
||||
//line += rightJustify(asString(clockOffset, 12), 15);
|
||||
|
||||
line += std::string(80 - line.size(), ' ');
|
||||
Rinex_Printer::lengthCheck(line);
|
||||
out << line << std::endl;
|
||||
|
||||
for(pseudoranges_iter = pseudoranges.begin();
|
||||
pseudoranges_iter != pseudoranges.end();
|
||||
pseudoranges_iter++)
|
||||
std::pair <std::multimap<unsigned int, Gnss_Synchro>::iterator, std::multimap<unsigned int, Gnss_Synchro>::iterator> ret;
|
||||
for(total_iter = total_map.begin();
|
||||
total_iter != total_map.end();
|
||||
total_iter++)
|
||||
{
|
||||
std::string lineObs;
|
||||
lineObs.clear();
|
||||
lineObs += satelliteSystem["Galileo"];
|
||||
if (static_cast<int>(pseudoranges_iter->first) < 10) lineObs += std::string(1, '0');
|
||||
lineObs += boost::lexical_cast<std::string>(static_cast<int>(pseudoranges_iter->first));
|
||||
if (static_cast<int>(total_iter->first) < 10) lineObs += std::string(1, '0');
|
||||
lineObs += boost::lexical_cast<std::string>(static_cast<int>(total_iter->first));
|
||||
//lineObs += std::string(2, ' ');
|
||||
lineObs += Rinex_Printer::rightJustify(asString(pseudoranges_iter->second.Pseudorange_m, 3), 14);
|
||||
ret = total_map.equal_range(total_iter->first);
|
||||
for (std::multimap<unsigned int, Gnss_Synchro>::iterator iter = ret.first; iter != ret.second; ++iter)
|
||||
{
|
||||
lineObs += Rinex_Printer::rightJustify(asString(iter->second.Pseudorange_m, 3), 14);
|
||||
|
||||
//Loss of lock indicator (LLI)
|
||||
int lli = 0; // Include in the observation!!
|
||||
if (lli == 0)
|
||||
{
|
||||
lineObs += std::string(1, ' ');
|
||||
}
|
||||
else
|
||||
{
|
||||
lineObs += Rinex_Printer::rightJustify(Rinex_Printer::asString<short>(lli), 1);
|
||||
//Loss of lock indicator (LLI)
|
||||
int lli = 0; // Include in the observation!!
|
||||
if (lli == 0)
|
||||
{
|
||||
lineObs += std::string(1, ' ');
|
||||
}
|
||||
else
|
||||
{
|
||||
lineObs += Rinex_Printer::rightJustify(Rinex_Printer::asString<short>(lli), 1);
|
||||
}
|
||||
|
||||
// Signal Strength Indicator (SSI)
|
||||
int ssi = Rinex_Printer::signalStrength(iter->second.CN0_dB_hz);
|
||||
lineObs += Rinex_Printer::rightJustify(Rinex_Printer::asString<int>(ssi), 1);
|
||||
|
||||
// Galileo CARRIER PHASE
|
||||
lineObs += Rinex_Printer::rightJustify(asString(iter->second.Carrier_phase_rads / (GALILEO_TWO_PI), 3), 14);
|
||||
if (lli == 0)
|
||||
{
|
||||
lineObs += std::string(1, ' ');
|
||||
}
|
||||
else
|
||||
{
|
||||
lineObs += Rinex_Printer::rightJustify(Rinex_Printer::asString<short>(lli), 1);
|
||||
}
|
||||
lineObs += Rinex_Printer::rightJustify(Rinex_Printer::asString<int>(ssi), 1);
|
||||
|
||||
// Galileo DOPPLER
|
||||
lineObs += Rinex_Printer::rightJustify(asString(iter->second.Carrier_Doppler_hz, 3), 14);
|
||||
if (lli == 0)
|
||||
{
|
||||
lineObs += std::string(1, ' ');
|
||||
}
|
||||
else
|
||||
{
|
||||
lineObs += Rinex_Printer::rightJustify(Rinex_Printer::asString<short>(lli), 1);
|
||||
}
|
||||
lineObs += Rinex_Printer::rightJustify(Rinex_Printer::asString<int>(ssi), 1);
|
||||
|
||||
// Galileo SIGNAL STRENGTH
|
||||
lineObs += Rinex_Printer::rightJustify(asString(iter->second.CN0_dB_hz, 3), 14);
|
||||
}
|
||||
|
||||
// Signal Strength Indicator (SSI)
|
||||
int ssi = Rinex_Printer::signalStrength(pseudoranges_iter->second.CN0_dB_hz);
|
||||
lineObs += Rinex_Printer::rightJustify(Rinex_Printer::asString<int>(ssi), 1);
|
||||
|
||||
// Galileo E1B PHASE
|
||||
lineObs += Rinex_Printer::rightJustify(asString(pseudoranges_iter->second.Carrier_phase_rads / (GALILEO_TWO_PI), 3), 14);
|
||||
if (lli == 0)
|
||||
{
|
||||
lineObs += std::string(1, ' ');
|
||||
}
|
||||
else
|
||||
{
|
||||
lineObs += Rinex_Printer::rightJustify(Rinex_Printer::asString<short>(lli), 1);
|
||||
}
|
||||
lineObs += Rinex_Printer::rightJustify(Rinex_Printer::asString<int>(ssi), 1);
|
||||
|
||||
// Galileo E1B DOPPLER
|
||||
lineObs += Rinex_Printer::rightJustify(asString(pseudoranges_iter->second.Carrier_Doppler_hz, 3), 14);
|
||||
if (lli == 0)
|
||||
{
|
||||
lineObs += std::string(1, ' ');
|
||||
}
|
||||
else
|
||||
{
|
||||
lineObs += Rinex_Printer::rightJustify(Rinex_Printer::asString<short>(lli), 1);
|
||||
}
|
||||
lineObs += Rinex_Printer::rightJustify(Rinex_Printer::asString<int>(ssi), 1);
|
||||
|
||||
// Galileo E1B SIGNAL STRENGTH
|
||||
lineObs += Rinex_Printer::rightJustify(asString(pseudoranges_iter->second.CN0_dB_hz, 3), 14);
|
||||
if (lineObs.size() < 80) lineObs += std::string(80 - lineObs.size(), ' ');
|
||||
out << lineObs << std::endl;
|
||||
}
|
||||
|
@ -127,9 +127,9 @@ public:
|
||||
void rinex_obs_header(std::fstream & out, const Gps_Ephemeris & eph, const Gps_CNAV_Ephemeris & eph_cnav, const double d_TOW_first_observation);
|
||||
|
||||
/*!
|
||||
* \brief Generates the Galileo Observation data header
|
||||
* \brief Generates the Galileo Observation data header. Example: bands("1B"), bands("1B 5X"), bands("5X"), ... Default: "1B".
|
||||
*/
|
||||
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, const std::string bands = "1B");
|
||||
|
||||
/*!
|
||||
* \brief Generates the Mixed (GPS/Galileo) Observation data header
|
||||
@ -235,6 +235,12 @@ public:
|
||||
std::map<std::string,std::string> observationCode; //<! GNSS observation descriptors
|
||||
std::string stringVersion; //<! RINEX version (2.10/2.11 or 3.01/3.02)
|
||||
|
||||
std::string navfilename;
|
||||
std::string obsfilename;
|
||||
std::string sbsfilename;
|
||||
std::string navGalfilename;
|
||||
std::string navMixfilename;
|
||||
|
||||
private:
|
||||
int version ; // RINEX version (2 for 2.10/2.11 and 3 for 3.01)
|
||||
int numberTypesObservations; // Number of available types of observable in the system. Should be public?
|
||||
@ -261,12 +267,6 @@ private:
|
||||
*/
|
||||
std::string createFilename(std::string type);
|
||||
|
||||
std::string navfilename;
|
||||
std::string obsfilename;
|
||||
std::string sbsfilename;
|
||||
std::string navGalfilename;
|
||||
std::string navMixfilename;
|
||||
|
||||
/*
|
||||
* Generates the data for the PGM / RUN BY / DATE line
|
||||
*/
|
||||
|
@ -122,7 +122,7 @@ DECLARE_string(log_dir);
|
||||
|
||||
#include "unit-tests/signal-processing-blocks/pvt/rtcm_test.cc"
|
||||
#include "unit-tests/signal-processing-blocks/pvt/rtcm_printer_test.cc"
|
||||
|
||||
#include "unit-tests/signal-processing-blocks/pvt/rinex_printer_test.cc"
|
||||
|
||||
// For GPS NAVIGATION (L1)
|
||||
concurrent_queue<Gps_Acq_Assist> global_gps_acq_assist_queue;
|
||||
|
@ -0,0 +1,233 @@
|
||||
/*!
|
||||
* \file rinex_printer_test.cc
|
||||
* \brief Implements Unit Tests for the Rinex_Printer class.
|
||||
* \author Carles Fernandez-Prades, 2016. cfernandez(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2016 (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 <string>
|
||||
#include "rinex_printer.h"
|
||||
|
||||
|
||||
TEST(Rinex_Printer_Test, GalileoObsHeader)
|
||||
{
|
||||
std::string line_aux;
|
||||
std::string line_str;
|
||||
bool no_more_finds = false;
|
||||
const Galileo_Ephemeris eph = Galileo_Ephemeris();
|
||||
|
||||
std::shared_ptr<Rinex_Printer> rp1;
|
||||
rp1 = std::make_shared<Rinex_Printer>();
|
||||
rp1->rinex_obs_header(rp1->obsFile, eph, 0.0);
|
||||
rp1->obsFile.seekp(0);
|
||||
|
||||
while(!rp1->obsFile.eof())
|
||||
{
|
||||
std::getline(rp1->obsFile, line_str);
|
||||
if(!no_more_finds)
|
||||
{
|
||||
if (line_str.find("SYS / # / OBS TYPES", 59) != std::string::npos)
|
||||
{
|
||||
no_more_finds = true;
|
||||
line_aux = std::string(line_str);
|
||||
}
|
||||
}
|
||||
}
|
||||
std::string expected_str("E 4 C1B L1B D1B S1B SYS / # / OBS TYPES ");
|
||||
EXPECT_EQ(0, expected_str.compare(line_aux));
|
||||
if(remove(rp1->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
||||
line_aux.clear();
|
||||
|
||||
std::shared_ptr<Rinex_Printer> rp2;
|
||||
rp2 = std::make_shared<Rinex_Printer>();
|
||||
std::string bands("1B 5X 7X");
|
||||
rp2->rinex_obs_header(rp2->obsFile, eph, 0.0, bands);
|
||||
rp2->obsFile.seekp(0);
|
||||
no_more_finds = false;
|
||||
while(!rp2->obsFile.eof())
|
||||
{
|
||||
std::getline(rp2->obsFile, line_str);
|
||||
if(!no_more_finds)
|
||||
{
|
||||
if (line_str.find("SYS / # / OBS TYPES", 59) != std::string::npos)
|
||||
{
|
||||
no_more_finds = true;
|
||||
line_aux = std::string(line_str);
|
||||
}
|
||||
}
|
||||
}
|
||||
std::string expected_str2("E 12 C1B L1B D1B S1B C5X L5X D5X S5X C7X L7X D7X S7X SYS / # / OBS TYPES ");
|
||||
EXPECT_EQ(0, expected_str2.compare(line_aux));
|
||||
|
||||
if(remove(rp2->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST(Rinex_Printer_Test, GalileoObsLog)
|
||||
{
|
||||
std::string line_aux;
|
||||
std::string line_str;
|
||||
bool no_more_finds = false;
|
||||
const Galileo_Ephemeris eph = Galileo_Ephemeris();
|
||||
|
||||
std::shared_ptr<Rinex_Printer> rp;
|
||||
rp = std::make_shared<Rinex_Printer>();
|
||||
rp->rinex_obs_header(rp->obsFile, eph, 0.0);
|
||||
|
||||
std::map<int,Gnss_Synchro> gnss_pseudoranges_map;
|
||||
|
||||
Gnss_Synchro gs1 = Gnss_Synchro();
|
||||
Gnss_Synchro gs2 = Gnss_Synchro();
|
||||
Gnss_Synchro gs3 = Gnss_Synchro();
|
||||
Gnss_Synchro gs4 = Gnss_Synchro();
|
||||
|
||||
std::string sys = "E";
|
||||
gs1.System = *sys.c_str();
|
||||
gs2.System = *sys.c_str();
|
||||
gs3.System = *sys.c_str();
|
||||
gs4.System = *sys.c_str();
|
||||
|
||||
std::string sig = "1B";
|
||||
std::memcpy((void*)gs1.Signal, sig.c_str(), 3);
|
||||
std::memcpy((void*)gs2.Signal, sig.c_str(), 3);
|
||||
std::memcpy((void*)gs3.Signal, sig.c_str(), 3);
|
||||
std::memcpy((void*)gs4.Signal, sig.c_str(), 3);
|
||||
|
||||
gs1.PRN = 3;
|
||||
gs2.PRN = 8;
|
||||
gs3.PRN = 10;
|
||||
gs4.PRN = 22;
|
||||
|
||||
gs4.Pseudorange_m = 22000000;
|
||||
gs4.Carrier_phase_rads = 23.4;
|
||||
gs4.Carrier_Doppler_hz = 1534;
|
||||
gs4.CN0_dB_hz = 42;
|
||||
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(1,gs1) );
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(2,gs2) );
|
||||
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->obsFile.seekp(0);
|
||||
|
||||
while(!rp->obsFile.eof())
|
||||
{
|
||||
std::getline(rp->obsFile, line_str);
|
||||
if(!no_more_finds)
|
||||
{
|
||||
if (line_str.find("E22", 0) != std::string::npos)
|
||||
{
|
||||
no_more_finds = true;
|
||||
line_aux = std::string(line_str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string expected_str("E22 22000000.000 7 3.724 7 1534.000 7 42.000 ");
|
||||
EXPECT_EQ(0, expected_str.compare(line_aux));
|
||||
|
||||
if(remove(rp->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
||||
}
|
||||
|
||||
TEST(Rinex_Printer_Test, GalileoObsLogDualBand)
|
||||
{
|
||||
std::string line_aux;
|
||||
std::string line_str;
|
||||
bool no_more_finds = false;
|
||||
const Galileo_Ephemeris eph = Galileo_Ephemeris();
|
||||
|
||||
std::shared_ptr<Rinex_Printer> rp;
|
||||
rp = std::make_shared<Rinex_Printer>();
|
||||
std::string bands("1B 5X");
|
||||
rp->rinex_obs_header(rp->obsFile, eph, 0.0, bands);
|
||||
|
||||
std::map<int,Gnss_Synchro> gnss_pseudoranges_map;
|
||||
|
||||
Gnss_Synchro gs1 = Gnss_Synchro();
|
||||
Gnss_Synchro gs2 = Gnss_Synchro();
|
||||
Gnss_Synchro gs3 = Gnss_Synchro();
|
||||
Gnss_Synchro gs4 = Gnss_Synchro();
|
||||
|
||||
std::string sys = "E";
|
||||
gs1.System = *sys.c_str();
|
||||
gs2.System = *sys.c_str();
|
||||
gs3.System = *sys.c_str();
|
||||
gs4.System = *sys.c_str();
|
||||
|
||||
std::string sig = "1B";
|
||||
std::memcpy((void*)gs1.Signal, sig.c_str(), 3);
|
||||
std::memcpy((void*)gs2.Signal, sig.c_str(), 3);
|
||||
|
||||
sig = "5X";
|
||||
std::memcpy((void*)gs3.Signal, sig.c_str(), 3);
|
||||
std::memcpy((void*)gs4.Signal, sig.c_str(), 3);
|
||||
|
||||
gs1.PRN = 3;
|
||||
gs2.PRN = 8;
|
||||
gs3.PRN = 3;
|
||||
gs4.PRN = 8;
|
||||
|
||||
gs2.Pseudorange_m = 22000002.1;
|
||||
gs2.Carrier_phase_rads = 45.4;
|
||||
gs2.Carrier_Doppler_hz = 321;
|
||||
gs2.CN0_dB_hz = 39;
|
||||
|
||||
gs4.Pseudorange_m = 22000000;
|
||||
gs4.Carrier_phase_rads = 23.4;
|
||||
gs4.Carrier_Doppler_hz = 1534;
|
||||
gs4.CN0_dB_hz = 42;
|
||||
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(1,gs1) );
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(2,gs2) );
|
||||
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->obsFile.seekp(0);
|
||||
|
||||
while(!rp->obsFile.eof())
|
||||
{
|
||||
std::getline(rp->obsFile, line_str);
|
||||
if(!no_more_finds)
|
||||
{
|
||||
if (line_str.find("E08", 0) != std::string::npos)
|
||||
{
|
||||
no_more_finds = true;
|
||||
line_aux = std::string(line_str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string expected_str("E08 22000002.100 6 7.226 6 321.000 6 39.000 22000000.000 7 3.724 7 1534.000 7 42.000");
|
||||
EXPECT_EQ(0, expected_str.compare(line_aux));
|
||||
|
||||
if(remove(rp->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user