mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-08-09 15:35:27 +00:00
Add constellation diagram plot
This commit is contained in:
parent
ac99ba5b75
commit
2c3ada26f2
@ -490,10 +490,13 @@ public:
|
||||
Gnuplot& plotfile_xy(const std::string &filename,
|
||||
const unsigned int column_x = 1,
|
||||
const unsigned int column_y = 2,
|
||||
const std::string &title = "");
|
||||
const std::string &title = "",
|
||||
const unsigned int decimate = 1);
|
||||
/// from data
|
||||
template<typename X, typename Y>
|
||||
Gnuplot& plot_xy(const X& x, const Y& y, const std::string &title = "");
|
||||
Gnuplot& plot_xy(const X& x, const Y& y,
|
||||
const std::string &title = "",
|
||||
const unsigned int decimate = 1);
|
||||
|
||||
/// plot x,y pairs with dy errorbars: x y dy
|
||||
/// from file
|
||||
@ -724,7 +727,7 @@ Gnuplot& Gnuplot::plot_x(const X& x, const std::string &title)
|
||||
/// Plots a 2d graph from a list of doubles: x y
|
||||
//
|
||||
template<typename X, typename Y>
|
||||
Gnuplot& Gnuplot::plot_xy(const X& x, const Y& y, const std::string &title)
|
||||
Gnuplot& Gnuplot::plot_xy(const X& x, const Y& y, const std::string &title, const unsigned int decimate)
|
||||
{
|
||||
if (x.size() == 0 || y.size() == 0)
|
||||
{
|
||||
@ -752,7 +755,7 @@ Gnuplot& Gnuplot::plot_xy(const X& x, const Y& y, const std::string &title)
|
||||
tmp.flush();
|
||||
tmp.close();
|
||||
|
||||
plotfile_xy(name, 1, 2, title);
|
||||
plotfile_xy(name, 1, 2, title, decimate);
|
||||
|
||||
return *this;
|
||||
}
|
||||
@ -1483,7 +1486,8 @@ Gnuplot& Gnuplot::plotfile_x(const std::string &filename,
|
||||
Gnuplot& Gnuplot::plotfile_xy(const std::string &filename,
|
||||
const unsigned int column_x,
|
||||
const unsigned int column_y,
|
||||
const std::string &title)
|
||||
const std::string &title,
|
||||
const unsigned int decimate)
|
||||
{
|
||||
//
|
||||
// check if file exists
|
||||
@ -1499,7 +1503,7 @@ Gnuplot& Gnuplot::plotfile_xy(const std::string &filename,
|
||||
else
|
||||
cmdstr << "plot ";
|
||||
|
||||
cmdstr << "\"" << filename << "\" using " << column_x << ":" << column_y;
|
||||
cmdstr << "\"" << filename << "\" using " << column_x << ":" << column_y << " every " << std::to_string(decimate);
|
||||
|
||||
if (title == "")
|
||||
cmdstr << " notitle ";
|
||||
|
@ -39,4 +39,6 @@
|
||||
DEFINE_string(gnuplot_executable, "", "Gnuplot binary path");
|
||||
#endif
|
||||
|
||||
DEFINE_int32(plot_decimate, 1, "Decimate plots");
|
||||
|
||||
#endif
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
//#include <memory>
|
||||
#include <unistd.h>
|
||||
#include <vector>
|
||||
#include <armadillo>
|
||||
@ -50,8 +51,6 @@
|
||||
#include "tracking_interface.h"
|
||||
#include "in_memory_configuration.h"
|
||||
#include "gnss_synchro.h"
|
||||
//#include "gps_l1_ca_dll_pll_tracking.h"
|
||||
#include "gps_l1_ca_dll_pll_c_aid_tracking.h"
|
||||
#include "tracking_true_obs_reader.h"
|
||||
#include "tracking_dump_reader.h"
|
||||
#include "signal_generator_flags.h"
|
||||
@ -127,6 +126,8 @@ public:
|
||||
std::string p4;
|
||||
std::string p5;
|
||||
|
||||
std::string implementation = "GPS_L1_CA_DLL_PLL_Tracking"; //"GPS_L1_CA_DLL_PLL_C_Aid_Tracking";
|
||||
|
||||
const int baseband_sampling_freq = FLAGS_fs_gen_sps;
|
||||
|
||||
std::string filename_rinex_obs = FLAGS_filename_rinex_obs;
|
||||
@ -222,14 +223,14 @@ void GpsL1CADllPllTrackingTest::configure_receiver()
|
||||
|
||||
config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq));
|
||||
// Set Tracking
|
||||
config->set_property("Tracking_1C.implementation", "GPS_L1_CA_DLL_PLL_Tracking");
|
||||
config->set_property("Tracking_1C.implementation", implementation);
|
||||
config->set_property("Tracking_1C.item_type", "gr_complex");
|
||||
config->set_property("Tracking_1C.if", "0");
|
||||
config->set_property("Tracking_1C.dump", "true");
|
||||
config->set_property("Tracking_1C.dump_filename", "./tracking_ch_");
|
||||
config->set_property("Tracking_1C.pll_bw_hz", "30.0");
|
||||
config->set_property("Tracking_1C.pll_bw_hz", "20.0");
|
||||
config->set_property("Tracking_1C.dll_bw_hz", "2.0");
|
||||
config->set_property("Tracking_1C.early_late_space_chips", "0.5");
|
||||
config->set_property("Tracking_1C.extend_correlation_ms", "1");
|
||||
config->set_property("Tracking_1C.dump", "true");
|
||||
config->set_property("Tracking_1C.dump_filename", "./tracking_ch_");
|
||||
}
|
||||
|
||||
|
||||
@ -383,18 +384,17 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
||||
}) << "Failure opening true observables file" << std::endl;
|
||||
|
||||
top_block = gr::make_top_block("Tracking test");
|
||||
//std::shared_ptr<TrackingInterface> tracking = std::make_shared<GpsL1CaDllPllTracking>(config.get(), "Tracking_1C", 1, 1);
|
||||
std::shared_ptr<TrackingInterface> tracking = std::make_shared<GpsL1CaDllPllCAidTracking>(config.get(), "Tracking_1C", 1, 1);
|
||||
|
||||
std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(config, "Tracking_1C", implementation, 1, 1);
|
||||
std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(trk_);//std::make_shared<GpsL1CaDllPllCAidTracking>(config.get(), "Tracking_1C", 1, 1);
|
||||
|
||||
boost::shared_ptr<GpsL1CADllPllTrackingTest_msg_rx> msg_rx = GpsL1CADllPllTrackingTest_msg_rx_make();
|
||||
|
||||
// load acquisition data based on the first epoch of the true observations
|
||||
ASSERT_NO_THROW({
|
||||
if (true_obs_data.read_binary_obs() == false)
|
||||
{
|
||||
throw std::exception();
|
||||
};
|
||||
}) << "Failure reading true observables file" << std::endl;
|
||||
ASSERT_EQ(true_obs_data.read_binary_obs(), true)
|
||||
<< "Failure reading true tracking dump file." << std::endl
|
||||
<< "Maybe sat PRN #" + std::to_string(FLAGS_test_satellite_PRN) +
|
||||
" is not available?";
|
||||
|
||||
//restart the epoch counter
|
||||
true_obs_data.restart();
|
||||
@ -479,6 +479,8 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
||||
std::vector<double> prompt;
|
||||
std::vector<double> early;
|
||||
std::vector<double> late;
|
||||
std::vector<double> promptI;
|
||||
std::vector<double> promptQ;
|
||||
|
||||
epoch_counter = 0;
|
||||
while(trk_dump.read_binary_obs())
|
||||
@ -495,6 +497,8 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
||||
prompt.push_back(trk_dump.abs_P);
|
||||
early.push_back(trk_dump.abs_E);
|
||||
late.push_back(trk_dump.abs_L);
|
||||
promptI.push_back(trk_dump.prompt_I);
|
||||
promptQ.push_back(trk_dump.prompt_Q);
|
||||
}
|
||||
|
||||
//Align initial measurements and cut the tracking pull-in transitory
|
||||
@ -544,12 +548,25 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
||||
g1.set_xlabel("Time [s]");
|
||||
g1.set_ylabel("Correlators' output");
|
||||
g1.cmd("set key box opaque");
|
||||
g1.plot_xy( timevec, prompt, "Prompt");
|
||||
g1.plot_xy( timevec, early, "Early");
|
||||
g1.plot_xy( timevec, late, "Late");
|
||||
unsigned int decimate = static_cast<unsigned int>(FLAGS_plot_decimate);
|
||||
g1.plot_xy( timevec, prompt, "Prompt", decimate);
|
||||
g1.plot_xy( timevec, early, "Early", decimate);
|
||||
g1.plot_xy( timevec, late, "Late", decimate);
|
||||
g1.savetops("Correlators_outputs");
|
||||
g1.savetopdf("Correlators_outputs", 18);
|
||||
g1.showonscreen(); // window output
|
||||
|
||||
Gnuplot g2("points");
|
||||
g2.set_title("Constellation diagram (satellite PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
||||
g2.set_grid();
|
||||
g2.set_xlabel("Inphase");
|
||||
g2.set_ylabel("Quadrature");
|
||||
g2.cmd("set size ratio -1");
|
||||
g2.plot_xy( promptI, promptQ);
|
||||
g2.savetops("Constellation");
|
||||
g2.savetopdf("Constellation", 18);
|
||||
g2.showonscreen(); // window output
|
||||
|
||||
}
|
||||
catch (GnuplotException ge)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user