2016-10-31 21:32:58 +00:00
|
|
|
/*!
|
|
|
|
* \file rinex_printer_test.cc
|
|
|
|
* \brief Implements Unit Tests for the Rinex_Printer class.
|
|
|
|
* \author Carles Fernandez-Prades, 2016. cfernandez(at)cttc.es
|
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*
|
2018-05-13 20:49:11 +00:00
|
|
|
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
|
2016-10-31 21:32:58 +00:00
|
|
|
*
|
|
|
|
* 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
|
2018-05-13 20:49:11 +00:00
|
|
|
* along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
|
2016-10-31 21:32:58 +00:00
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "rinex_printer.h"
|
2018-12-09 21:00:09 +00:00
|
|
|
#include <string>
|
2016-10-31 21:32:58 +00:00
|
|
|
|
|
|
|
|
2017-06-25 20:53:11 +00:00
|
|
|
TEST(RinexPrinterTest, GalileoObsHeader)
|
2016-10-31 21:32:58 +00:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
while (!rp1->obsFile.eof())
|
2016-10-31 21:32:58 +00:00
|
|
|
{
|
|
|
|
std::getline(rp1->obsFile, line_str);
|
2018-03-03 01:03:39 +00:00
|
|
|
if (!no_more_finds)
|
2016-10-31 21:32:58 +00:00
|
|
|
{
|
|
|
|
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));
|
2018-03-03 01:03:39 +00:00
|
|
|
if (remove(rp1->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
2016-10-31 21:32:58 +00:00
|
|
|
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;
|
2018-03-03 01:03:39 +00:00
|
|
|
while (!rp2->obsFile.eof())
|
2016-10-31 21:32:58 +00:00
|
|
|
{
|
|
|
|
std::getline(rp2->obsFile, line_str);
|
2018-03-03 01:03:39 +00:00
|
|
|
if (!no_more_finds)
|
2016-10-31 21:32:58 +00:00
|
|
|
{
|
|
|
|
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));
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
if (remove(rp2->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
2016-10-31 21:32:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-08-14 03:42:24 +00:00
|
|
|
TEST(RinexPrinterTest, GlonassObsHeader)
|
|
|
|
{
|
|
|
|
std::string line_aux;
|
|
|
|
std::string line_str;
|
|
|
|
bool no_more_finds = false;
|
|
|
|
const Glonass_Gnav_Ephemeris eph = Glonass_Gnav_Ephemeris();
|
|
|
|
|
|
|
|
std::shared_ptr<Rinex_Printer> rp1;
|
2017-12-26 17:29:09 +00:00
|
|
|
rp1 = std::make_shared<Rinex_Printer>(3);
|
|
|
|
const std::string bands = "1G";
|
|
|
|
rp1->rinex_obs_header(rp1->obsFile, eph, 0.0, bands);
|
2017-08-14 03:42:24 +00:00
|
|
|
rp1->obsFile.seekp(0);
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
while (!rp1->obsFile.eof())
|
2017-08-14 03:42:24 +00:00
|
|
|
{
|
|
|
|
std::getline(rp1->obsFile, line_str);
|
2018-03-03 01:03:39 +00:00
|
|
|
if (!no_more_finds)
|
2017-08-14 03:42:24 +00:00
|
|
|
{
|
|
|
|
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("R 4 C1C L1C D1C S1C SYS / # / OBS TYPES ");
|
|
|
|
EXPECT_EQ(0, expected_str.compare(line_aux));
|
2018-03-03 01:03:39 +00:00
|
|
|
if (remove(rp1->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
2017-08-14 03:42:24 +00:00
|
|
|
line_aux.clear();
|
|
|
|
}
|
2016-10-31 21:32:58 +00:00
|
|
|
|
2016-11-01 10:00:44 +00:00
|
|
|
|
2017-06-25 20:53:11 +00:00
|
|
|
TEST(RinexPrinterTest, MixedObsHeader)
|
2016-11-01 10:00:44 +00:00
|
|
|
{
|
|
|
|
std::string line_aux;
|
|
|
|
std::string line_aux2;
|
|
|
|
std::string line_str;
|
|
|
|
bool no_more_finds = false;
|
|
|
|
const Galileo_Ephemeris eph_gal = Galileo_Ephemeris();
|
|
|
|
const Gps_Ephemeris eph_gps = Gps_Ephemeris();
|
|
|
|
|
|
|
|
std::shared_ptr<Rinex_Printer> rp1;
|
|
|
|
rp1 = std::make_shared<Rinex_Printer>();
|
|
|
|
rp1->rinex_obs_header(rp1->obsFile, eph_gps, eph_gal, 0.0, "1B 5X");
|
|
|
|
rp1->obsFile.seekp(0);
|
|
|
|
int systems_found = 0;
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
while (!rp1->obsFile.eof())
|
2016-11-01 10:00:44 +00:00
|
|
|
{
|
|
|
|
std::getline(rp1->obsFile, line_str);
|
2018-03-03 01:03:39 +00:00
|
|
|
if (!no_more_finds)
|
2016-11-01 10:00:44 +00:00
|
|
|
{
|
|
|
|
if (line_str.find("SYS / # / OBS TYPES", 59) != std::string::npos)
|
|
|
|
{
|
|
|
|
systems_found++;
|
2018-03-03 01:03:39 +00:00
|
|
|
if (systems_found == 1)
|
2016-11-01 10:00:44 +00:00
|
|
|
{
|
|
|
|
line_aux = std::string(line_str);
|
|
|
|
}
|
2018-03-03 01:03:39 +00:00
|
|
|
if (systems_found == 2)
|
2016-11-01 10:00:44 +00:00
|
|
|
{
|
|
|
|
line_aux2 = std::string(line_str);
|
|
|
|
no_more_finds = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string expected_str("G 4 C1C L1C D1C S1C SYS / # / OBS TYPES ");
|
|
|
|
std::string expected_str2("E 8 C1B L1B D1B S1B C5X L5X D5X S5X SYS / # / OBS TYPES ");
|
|
|
|
EXPECT_EQ(0, expected_str.compare(line_aux));
|
|
|
|
EXPECT_EQ(0, expected_str2.compare(line_aux2));
|
2018-03-03 01:03:39 +00:00
|
|
|
if (remove(rp1->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
2016-11-01 10:00:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-08-14 03:42:24 +00:00
|
|
|
TEST(RinexPrinterTest, MixedObsHeaderGpsGlo)
|
|
|
|
{
|
|
|
|
std::string line_aux;
|
|
|
|
std::string line_aux2;
|
|
|
|
std::string line_str;
|
|
|
|
bool no_more_finds = false;
|
|
|
|
const Glonass_Gnav_Ephemeris eph_glo = Glonass_Gnav_Ephemeris();
|
|
|
|
const Gps_Ephemeris eph_gps = Gps_Ephemeris();
|
|
|
|
|
|
|
|
std::shared_ptr<Rinex_Printer> rp1;
|
|
|
|
rp1 = std::make_shared<Rinex_Printer>();
|
2018-01-24 18:08:08 +00:00
|
|
|
rp1->rinex_obs_header(rp1->obsFile, eph_gps, eph_glo, 0.0, "1G");
|
2017-08-14 03:42:24 +00:00
|
|
|
rp1->obsFile.seekp(0);
|
|
|
|
int systems_found = 0;
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
while (!rp1->obsFile.eof())
|
2017-08-14 03:42:24 +00:00
|
|
|
{
|
|
|
|
std::getline(rp1->obsFile, line_str);
|
2018-03-03 01:03:39 +00:00
|
|
|
if (!no_more_finds)
|
2017-08-14 03:42:24 +00:00
|
|
|
{
|
|
|
|
if (line_str.find("SYS / # / OBS TYPES", 59) != std::string::npos)
|
|
|
|
{
|
|
|
|
systems_found++;
|
2018-03-03 01:03:39 +00:00
|
|
|
if (systems_found == 1)
|
2017-08-14 03:42:24 +00:00
|
|
|
{
|
|
|
|
line_aux = std::string(line_str);
|
|
|
|
}
|
2018-03-03 01:03:39 +00:00
|
|
|
if (systems_found == 2)
|
2017-08-14 03:42:24 +00:00
|
|
|
{
|
|
|
|
line_aux2 = std::string(line_str);
|
|
|
|
no_more_finds = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string expected_str("G 4 C1C L1C D1C S1C SYS / # / OBS TYPES ");
|
2018-01-24 18:08:08 +00:00
|
|
|
std::string expected_str2("R 4 C1C L1C D1C S1C SYS / # / OBS TYPES ");
|
2017-08-14 03:42:24 +00:00
|
|
|
EXPECT_EQ(0, expected_str.compare(line_aux));
|
|
|
|
EXPECT_EQ(0, expected_str2.compare(line_aux2));
|
2018-03-03 01:03:39 +00:00
|
|
|
if (remove(rp1->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
2017-08-14 03:42:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-25 20:53:11 +00:00
|
|
|
TEST(RinexPrinterTest, GalileoObsLog)
|
2016-10-31 21:32:58 +00:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
std::map<int, Gnss_Synchro> gnss_pseudoranges_map;
|
2016-10-31 21:32:58 +00:00
|
|
|
|
|
|
|
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";
|
2017-08-19 18:05:52 +00:00
|
|
|
std::memcpy(static_cast<void*>(gs1.Signal), sig.c_str(), 3);
|
|
|
|
std::memcpy(static_cast<void*>(gs2.Signal), sig.c_str(), 3);
|
|
|
|
std::memcpy(static_cast<void*>(gs3.Signal), sig.c_str(), 3);
|
|
|
|
std::memcpy(static_cast<void*>(gs4.Signal), sig.c_str(), 3);
|
2016-10-31 21:32:58 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
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));
|
2016-10-31 21:32:58 +00:00
|
|
|
|
|
|
|
rp->log_rinex_obs(rp->obsFile, eph, 0.0, gnss_pseudoranges_map);
|
|
|
|
rp->obsFile.seekp(0);
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
while (!rp->obsFile.eof())
|
2016-10-31 21:32:58 +00:00
|
|
|
{
|
|
|
|
std::getline(rp->obsFile, line_str);
|
2018-03-03 01:03:39 +00:00
|
|
|
if (!no_more_finds)
|
2016-10-31 21:32:58 +00:00
|
|
|
{
|
|
|
|
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));
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
if (remove(rp->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
2016-10-31 21:32:58 +00:00
|
|
|
}
|
|
|
|
|
2016-11-01 12:01:35 +00:00
|
|
|
|
2017-08-14 03:42:24 +00:00
|
|
|
TEST(RinexPrinterTest, GlonassObsLog)
|
|
|
|
{
|
|
|
|
std::string line_aux;
|
|
|
|
std::string line_str;
|
|
|
|
bool no_more_finds = false;
|
|
|
|
const Glonass_Gnav_Ephemeris eph = Glonass_Gnav_Ephemeris();
|
|
|
|
|
|
|
|
std::shared_ptr<Rinex_Printer> rp;
|
|
|
|
rp = std::make_shared<Rinex_Printer>();
|
|
|
|
rp->rinex_obs_header(rp->obsFile, eph, 0.0);
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
std::map<int, Gnss_Synchro> gnss_pseudoranges_map;
|
2017-08-14 03:42:24 +00:00
|
|
|
|
|
|
|
Gnss_Synchro gs1 = Gnss_Synchro();
|
|
|
|
Gnss_Synchro gs2 = Gnss_Synchro();
|
|
|
|
Gnss_Synchro gs3 = Gnss_Synchro();
|
|
|
|
Gnss_Synchro gs4 = Gnss_Synchro();
|
|
|
|
|
|
|
|
std::string sys = "R";
|
|
|
|
gs1.System = *sys.c_str();
|
|
|
|
gs2.System = *sys.c_str();
|
|
|
|
gs3.System = *sys.c_str();
|
|
|
|
gs4.System = *sys.c_str();
|
|
|
|
|
|
|
|
std::string sig = "1C";
|
|
|
|
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;
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
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));
|
2017-08-14 03:42:24 +00:00
|
|
|
|
|
|
|
rp->log_rinex_obs(rp->obsFile, eph, 0.0, gnss_pseudoranges_map);
|
|
|
|
rp->obsFile.seekp(0);
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
while (!rp->obsFile.eof())
|
2017-08-14 03:42:24 +00:00
|
|
|
{
|
|
|
|
std::getline(rp->obsFile, line_str);
|
2018-03-03 01:03:39 +00:00
|
|
|
if (!no_more_finds)
|
2017-08-14 03:42:24 +00:00
|
|
|
{
|
|
|
|
if (line_str.find("R22", 0) != std::string::npos)
|
|
|
|
{
|
|
|
|
no_more_finds = true;
|
|
|
|
line_aux = std::string(line_str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string expected_str("R22 22000000.000 7 3.724 7 1534.000 7 42.000 ");
|
|
|
|
EXPECT_EQ(0, expected_str.compare(line_aux));
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
if (remove(rp->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
2017-08-14 03:42:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-25 20:53:11 +00:00
|
|
|
TEST(RinexPrinterTest, GpsObsLogDualBand)
|
2016-11-01 12:01:35 +00:00
|
|
|
{
|
|
|
|
std::string line_aux;
|
|
|
|
std::string line_str;
|
|
|
|
bool no_more_finds = false;
|
|
|
|
const Gps_Ephemeris eph_gps = Gps_Ephemeris();
|
|
|
|
const Gps_CNAV_Ephemeris eph_cnav = Gps_CNAV_Ephemeris();
|
|
|
|
|
|
|
|
std::shared_ptr<Rinex_Printer> rp;
|
|
|
|
rp = std::make_shared<Rinex_Printer>();
|
|
|
|
rp->rinex_obs_header(rp->obsFile, eph_gps, eph_cnav, 0.0);
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
std::map<int, Gnss_Synchro> gnss_pseudoranges_map;
|
2016-11-01 12:01:35 +00:00
|
|
|
|
|
|
|
Gnss_Synchro gs1 = Gnss_Synchro();
|
|
|
|
Gnss_Synchro gs2 = Gnss_Synchro();
|
|
|
|
Gnss_Synchro gs3 = Gnss_Synchro();
|
|
|
|
Gnss_Synchro gs4 = Gnss_Synchro();
|
|
|
|
|
|
|
|
std::string sys = "G";
|
|
|
|
gs1.System = *sys.c_str();
|
|
|
|
gs2.System = *sys.c_str();
|
|
|
|
gs3.System = *sys.c_str();
|
|
|
|
gs4.System = *sys.c_str();
|
|
|
|
|
|
|
|
std::string sig = "1C";
|
2017-08-19 18:05:52 +00:00
|
|
|
std::memcpy(static_cast<void*>(gs1.Signal), sig.c_str(), 3);
|
|
|
|
std::memcpy(static_cast<void*>(gs2.Signal), sig.c_str(), 3);
|
2016-11-01 12:01:35 +00:00
|
|
|
|
|
|
|
sig = "2S";
|
2017-08-19 18:05:52 +00:00
|
|
|
std::memcpy(static_cast<void*>(gs3.Signal), sig.c_str(), 3);
|
|
|
|
std::memcpy(static_cast<void*>(gs4.Signal), sig.c_str(), 3);
|
2016-11-01 12:01:35 +00:00
|
|
|
|
|
|
|
gs1.PRN = 3;
|
|
|
|
gs2.PRN = 8;
|
|
|
|
gs3.PRN = 7;
|
|
|
|
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;
|
|
|
|
|
2016-11-01 13:02:23 +00:00
|
|
|
gs3.Pseudorange_m = 22000007;
|
|
|
|
gs3.Carrier_phase_rads = -23.4;
|
|
|
|
gs3.Carrier_Doppler_hz = -1534;
|
|
|
|
gs3.CN0_dB_hz = 47;
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
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));
|
2016-11-01 12:01:35 +00:00
|
|
|
|
|
|
|
rp->log_rinex_obs(rp->obsFile, eph_gps, eph_cnav, 0.0, gnss_pseudoranges_map);
|
|
|
|
rp->obsFile.seekp(0);
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
while (!rp->obsFile.eof())
|
2016-11-01 12:01:35 +00:00
|
|
|
{
|
|
|
|
std::getline(rp->obsFile, line_str);
|
2018-03-03 01:03:39 +00:00
|
|
|
if (!no_more_finds)
|
2016-11-01 12:01:35 +00:00
|
|
|
{
|
|
|
|
if (line_str.find("G08", 0) != std::string::npos)
|
|
|
|
{
|
|
|
|
no_more_finds = true;
|
|
|
|
line_aux = std::string(line_str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string expected_str("G08 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));
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
if (remove(rp->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
2016-11-01 12:01:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-25 20:53:11 +00:00
|
|
|
TEST(RinexPrinterTest, GalileoObsLogDualBand)
|
2016-10-31 21:49:15 +00:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
std::map<int, Gnss_Synchro> gnss_pseudoranges_map;
|
2016-10-31 21:49:15 +00:00
|
|
|
|
|
|
|
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";
|
2017-08-19 18:05:52 +00:00
|
|
|
std::memcpy(static_cast<void*>(gs1.Signal), sig.c_str(), 3);
|
|
|
|
std::memcpy(static_cast<void*>(gs2.Signal), sig.c_str(), 3);
|
2016-10-31 21:49:15 +00:00
|
|
|
|
|
|
|
sig = "5X";
|
2017-08-19 18:05:52 +00:00
|
|
|
std::memcpy(static_cast<void*>(gs3.Signal), sig.c_str(), 3);
|
|
|
|
std::memcpy(static_cast<void*>(gs4.Signal), sig.c_str(), 3);
|
2016-10-31 21:49:15 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
2016-11-03 09:49:10 +00:00
|
|
|
gs3.Pseudorange_m = 22000003.3;
|
|
|
|
gs3.Carrier_phase_rads = 43.3;
|
|
|
|
gs3.Carrier_Doppler_hz = -321;
|
|
|
|
gs3.CN0_dB_hz = 40;
|
|
|
|
|
2016-10-31 21:49:15 +00:00
|
|
|
gs4.Pseudorange_m = 22000000;
|
|
|
|
gs4.Carrier_phase_rads = 23.4;
|
|
|
|
gs4.Carrier_Doppler_hz = 1534;
|
|
|
|
gs4.CN0_dB_hz = 42;
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
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));
|
2016-10-31 21:49:15 +00:00
|
|
|
|
2016-11-03 09:49:10 +00:00
|
|
|
rp->log_rinex_obs(rp->obsFile, eph, 0.0, gnss_pseudoranges_map, bands);
|
2016-10-31 21:49:15 +00:00
|
|
|
rp->obsFile.seekp(0);
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
while (!rp->obsFile.eof())
|
2016-10-31 21:49:15 +00:00
|
|
|
{
|
|
|
|
std::getline(rp->obsFile, line_str);
|
2018-03-03 01:03:39 +00:00
|
|
|
if (!no_more_finds)
|
2016-10-31 21:49:15 +00:00
|
|
|
{
|
|
|
|
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));
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
if (remove(rp->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
2016-10-31 21:49:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-25 20:53:11 +00:00
|
|
|
TEST(RinexPrinterTest, MixedObsLog)
|
2016-11-01 10:00:44 +00:00
|
|
|
{
|
|
|
|
std::string line_aux;
|
|
|
|
std::string line_str;
|
|
|
|
bool no_more_finds = false;
|
|
|
|
const Galileo_Ephemeris eph_gal = Galileo_Ephemeris();
|
|
|
|
const Gps_Ephemeris eph_gps = Gps_Ephemeris();
|
|
|
|
|
|
|
|
std::shared_ptr<Rinex_Printer> rp;
|
|
|
|
rp = std::make_shared<Rinex_Printer>();
|
|
|
|
rp->rinex_obs_header(rp->obsFile, eph_gps, eph_gal, 0.0, "1B 5X");
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
std::map<int, Gnss_Synchro> gnss_pseudoranges_map;
|
2016-11-01 10:00:44 +00:00
|
|
|
|
|
|
|
Gnss_Synchro gs1 = Gnss_Synchro();
|
|
|
|
Gnss_Synchro gs2 = Gnss_Synchro();
|
|
|
|
Gnss_Synchro gs3 = Gnss_Synchro();
|
|
|
|
Gnss_Synchro gs4 = Gnss_Synchro();
|
|
|
|
Gnss_Synchro gs5 = Gnss_Synchro();
|
|
|
|
Gnss_Synchro gs6 = Gnss_Synchro();
|
|
|
|
Gnss_Synchro gs7 = Gnss_Synchro();
|
|
|
|
Gnss_Synchro gs8 = Gnss_Synchro();
|
|
|
|
|
|
|
|
std::string sys = "G";
|
|
|
|
gs1.System = *sys.c_str();
|
|
|
|
gs2.System = *sys.c_str();
|
|
|
|
gs3.System = *sys.c_str();
|
|
|
|
gs4.System = *sys.c_str();
|
|
|
|
|
|
|
|
sys = "E";
|
|
|
|
gs5.System = *sys.c_str();
|
|
|
|
gs6.System = *sys.c_str();
|
|
|
|
gs7.System = *sys.c_str();
|
|
|
|
gs8.System = *sys.c_str();
|
|
|
|
|
|
|
|
std::string sig = "1C";
|
2017-08-19 18:05:52 +00:00
|
|
|
std::memcpy(static_cast<void*>(gs1.Signal), sig.c_str(), 3);
|
|
|
|
std::memcpy(static_cast<void*>(gs2.Signal), sig.c_str(), 3);
|
|
|
|
std::memcpy(static_cast<void*>(gs3.Signal), sig.c_str(), 3);
|
|
|
|
std::memcpy(static_cast<void*>(gs4.Signal), sig.c_str(), 3);
|
2016-11-01 10:00:44 +00:00
|
|
|
|
|
|
|
sig = "5X";
|
2017-08-19 18:05:52 +00:00
|
|
|
std::memcpy(static_cast<void*>(gs5.Signal), sig.c_str(), 3);
|
|
|
|
std::memcpy(static_cast<void*>(gs6.Signal), sig.c_str(), 3);
|
2016-11-01 10:00:44 +00:00
|
|
|
|
|
|
|
sig = "1B";
|
2017-08-19 18:05:52 +00:00
|
|
|
std::memcpy(static_cast<void*>(gs7.Signal), sig.c_str(), 3);
|
|
|
|
std::memcpy(static_cast<void*>(gs8.Signal), sig.c_str(), 3);
|
2016-11-01 10:00:44 +00:00
|
|
|
|
|
|
|
gs1.PRN = 3;
|
|
|
|
gs2.PRN = 8;
|
|
|
|
gs3.PRN = 14;
|
|
|
|
gs4.PRN = 16;
|
|
|
|
gs5.PRN = 3;
|
|
|
|
gs6.PRN = 16;
|
|
|
|
gs7.PRN = 14;
|
|
|
|
gs8.PRN = 16;
|
|
|
|
|
|
|
|
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 = 40;
|
|
|
|
|
|
|
|
gs6.Pseudorange_m = 22000000;
|
|
|
|
gs6.Carrier_phase_rads = 52.1;
|
|
|
|
gs6.Carrier_Doppler_hz = 1534;
|
|
|
|
gs6.CN0_dB_hz = 41;
|
|
|
|
|
|
|
|
gs8.Pseudorange_m = 22000000;
|
|
|
|
gs8.Carrier_phase_rads = 0.8;
|
|
|
|
gs8.Carrier_Doppler_hz = -20;
|
|
|
|
gs8.CN0_dB_hz = 42;
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
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));
|
|
|
|
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(5, gs5));
|
|
|
|
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(6, gs6));
|
|
|
|
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(7, gs7));
|
|
|
|
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(8, gs8));
|
2016-11-01 10:00:44 +00:00
|
|
|
|
|
|
|
rp->log_rinex_obs(rp->obsFile, eph_gps, eph_gal, 0.0, gnss_pseudoranges_map);
|
|
|
|
|
|
|
|
rp->obsFile.seekp(0);
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
while (!rp->obsFile.eof())
|
2016-11-01 10:00:44 +00:00
|
|
|
{
|
|
|
|
std::getline(rp->obsFile, line_str);
|
2018-03-03 01:03:39 +00:00
|
|
|
if (!no_more_finds)
|
2016-11-01 10:00:44 +00:00
|
|
|
{
|
|
|
|
if (line_str.find("E16", 0) != std::string::npos)
|
|
|
|
{
|
|
|
|
no_more_finds = true;
|
|
|
|
line_aux = std::string(line_str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
std::string expected_str("E16 22000000.000 7 0.127 7 -20.000 7 42.000 22000000.000 6 8.292 6 1534.000 6 41.000");
|
|
|
|
EXPECT_EQ(0, expected_str.compare(line_aux));
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
if (remove(rp->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
2016-11-01 10:00:44 +00:00
|
|
|
}
|
2017-08-14 03:42:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
TEST(RinexPrinterTest, MixedObsLogGpsGlo)
|
|
|
|
{
|
|
|
|
std::string line_aux;
|
|
|
|
std::string line_str;
|
|
|
|
bool no_more_finds = false;
|
|
|
|
const Glonass_Gnav_Ephemeris eph_glo = Glonass_Gnav_Ephemeris();
|
|
|
|
const Gps_Ephemeris eph_gps = Gps_Ephemeris();
|
|
|
|
|
|
|
|
std::shared_ptr<Rinex_Printer> rp;
|
|
|
|
rp = std::make_shared<Rinex_Printer>();
|
2018-01-24 18:08:08 +00:00
|
|
|
rp->rinex_obs_header(rp->obsFile, eph_gps, eph_glo, 0.0, "1G");
|
2017-08-14 03:42:24 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
std::map<int, Gnss_Synchro> gnss_pseudoranges_map;
|
2017-08-14 03:42:24 +00:00
|
|
|
|
|
|
|
Gnss_Synchro gs1 = Gnss_Synchro();
|
|
|
|
Gnss_Synchro gs2 = Gnss_Synchro();
|
|
|
|
Gnss_Synchro gs3 = Gnss_Synchro();
|
|
|
|
Gnss_Synchro gs4 = Gnss_Synchro();
|
|
|
|
Gnss_Synchro gs5 = Gnss_Synchro();
|
|
|
|
Gnss_Synchro gs6 = Gnss_Synchro();
|
|
|
|
Gnss_Synchro gs7 = Gnss_Synchro();
|
|
|
|
Gnss_Synchro gs8 = Gnss_Synchro();
|
|
|
|
|
|
|
|
std::string sys = "G";
|
|
|
|
gs1.System = *sys.c_str();
|
|
|
|
gs2.System = *sys.c_str();
|
|
|
|
gs3.System = *sys.c_str();
|
|
|
|
gs4.System = *sys.c_str();
|
|
|
|
|
|
|
|
sys = "R";
|
|
|
|
gs5.System = *sys.c_str();
|
|
|
|
gs6.System = *sys.c_str();
|
|
|
|
gs7.System = *sys.c_str();
|
|
|
|
gs8.System = *sys.c_str();
|
|
|
|
|
|
|
|
std::string sig = "1C";
|
|
|
|
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);
|
|
|
|
|
2018-01-24 18:08:08 +00:00
|
|
|
sig = "1G";
|
2017-08-14 03:42:24 +00:00
|
|
|
std::memcpy((void*)gs5.Signal, sig.c_str(), 3);
|
|
|
|
std::memcpy((void*)gs6.Signal, sig.c_str(), 3);
|
|
|
|
std::memcpy((void*)gs7.Signal, sig.c_str(), 3);
|
|
|
|
std::memcpy((void*)gs8.Signal, sig.c_str(), 3);
|
|
|
|
|
|
|
|
gs1.PRN = 3;
|
|
|
|
gs2.PRN = 8;
|
|
|
|
gs3.PRN = 14;
|
|
|
|
gs4.PRN = 16;
|
|
|
|
gs5.PRN = 3;
|
|
|
|
gs6.PRN = 16;
|
|
|
|
gs7.PRN = 14;
|
|
|
|
gs8.PRN = 16;
|
|
|
|
|
|
|
|
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 = 40;
|
|
|
|
|
|
|
|
gs6.Pseudorange_m = 22000000;
|
|
|
|
gs6.Carrier_phase_rads = 52.1;
|
|
|
|
gs6.Carrier_Doppler_hz = 1534;
|
|
|
|
gs6.CN0_dB_hz = 41;
|
|
|
|
|
|
|
|
gs8.Pseudorange_m = 22000000;
|
|
|
|
gs8.Carrier_phase_rads = 0.8;
|
|
|
|
gs8.Carrier_Doppler_hz = -20;
|
|
|
|
gs8.CN0_dB_hz = 42;
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
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));
|
|
|
|
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(5, gs5));
|
|
|
|
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(6, gs6));
|
|
|
|
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(7, gs7));
|
|
|
|
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(8, gs8));
|
2017-08-14 03:42:24 +00:00
|
|
|
|
|
|
|
rp->log_rinex_obs(rp->obsFile, eph_gps, eph_glo, 0.0, gnss_pseudoranges_map);
|
|
|
|
|
|
|
|
rp->obsFile.seekp(0);
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
while (!rp->obsFile.eof())
|
2017-08-14 03:42:24 +00:00
|
|
|
{
|
|
|
|
std::getline(rp->obsFile, line_str);
|
2018-03-03 01:03:39 +00:00
|
|
|
if (!no_more_finds)
|
2017-08-14 03:42:24 +00:00
|
|
|
{
|
|
|
|
if (line_str.find("R16", 0) != std::string::npos)
|
|
|
|
{
|
|
|
|
no_more_finds = true;
|
|
|
|
line_aux = std::string(line_str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-01-24 18:08:08 +00:00
|
|
|
|
|
|
|
std::string expected_str("R16 22000000.000 6 8.292 6 1534.000 6 41.000 22000000.000 7 0.127 7 -20.000 7 42.000");
|
2017-08-14 03:42:24 +00:00
|
|
|
EXPECT_EQ(0, expected_str.compare(line_aux));
|
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
if (remove(rp->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
2017-08-14 03:42:24 +00:00
|
|
|
}
|