mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-02-21 21:40:18 +00:00
Fix test
This commit is contained in:
parent
8316aa6892
commit
0c03d36093
@ -144,21 +144,21 @@ void GpsL1CaPcpsAcquisitionTest::init()
|
||||
config->set_property("Acquisition.coherent_integration_time_ms", "1");
|
||||
config->set_property("Acquisition.dump", "false");
|
||||
config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition");
|
||||
config->set_property("Acquisition.threshold", "0.001");
|
||||
config->set_property("Acquisition.threshold", "0.00001");
|
||||
config->set_property("Acquisition.doppler_max", "5000");
|
||||
config->set_property("Acquisition.doppler_step", "500");
|
||||
config->set_property("Acquisition.repeat_satellite", "false");
|
||||
config->set_property("Acquisition.pfa", "0.0");
|
||||
//config->set_property("Acquisition.pfa", "0.0");
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST_F(GpsL1CaPcpsAcquisitionTest, Instantiate)
|
||||
{
|
||||
init();
|
||||
boost::shared_ptr<GpsL1CaPcpsAcquisition> acquisition = boost::make_shared<GpsL1CaPcpsAcquisition>(config.get(), "Acquisition", 1, 1);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(GpsL1CaPcpsAcquisitionTest, ConnectAndRun)
|
||||
{
|
||||
int fs_in = 4000000;
|
||||
@ -194,6 +194,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ConnectAndRun)
|
||||
std::cout << "Processed " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults)
|
||||
{
|
||||
struct timeval tv;
|
||||
@ -203,9 +204,10 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults)
|
||||
|
||||
double expected_delay_samples = 524;
|
||||
double expected_doppler_hz = 1680;
|
||||
init();
|
||||
std::shared_ptr<GpsL1CaPcpsAcquisition> acquisition = std::make_shared<GpsL1CaPcpsAcquisition>(config.get(), "Acquisition", 1, 1);
|
||||
|
||||
init();
|
||||
|
||||
std::shared_ptr<GpsL1CaPcpsAcquisition> acquisition = std::make_shared<GpsL1CaPcpsAcquisition>(config.get(), "Acquisition", 1, 1);
|
||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionTest_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionTest_msg_rx_make();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
@ -217,15 +219,15 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults)
|
||||
}) << "Failure setting gnss_synchro." << std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
acquisition->set_threshold(0.1);
|
||||
acquisition->set_threshold(0.001);
|
||||
}) << "Failure setting threshold." << std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
acquisition->set_doppler_max(10000);
|
||||
acquisition->set_doppler_max(5000);
|
||||
}) << "Failure setting doppler_max." << std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
acquisition->set_doppler_step(250);
|
||||
acquisition->set_doppler_step(100);
|
||||
}) << "Failure setting doppler_step." << std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
@ -234,7 +236,6 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults)
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
std::string path = std::string(TEST_PATH);
|
||||
//std::string file = path + "signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.dat";
|
||||
std::string file = path + "signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
|
||||
const char * file_name = file.c_str();
|
||||
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false);
|
||||
@ -242,7 +243,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults)
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
||||
|
||||
|
||||
acquisition->set_local_code();
|
||||
acquisition->set_state(1); // Ensure that acquisition starts at the first sample
|
||||
acquisition->init();
|
||||
|
||||
@ -254,10 +255,8 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults)
|
||||
end = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
}) << "Failure running the top_block." << std::endl;
|
||||
|
||||
|
||||
unsigned long int nsamples = gnss_synchro.Acq_samplestamp_samples;
|
||||
std::cout << "Acquired " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl;
|
||||
|
||||
ASSERT_EQ(1, msg_rx->rx_message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
|
||||
|
||||
double delay_error_samples = std::abs(expected_delay_samples - gnss_synchro.Acq_delay_samples);
|
||||
@ -266,5 +265,4 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults)
|
||||
|
||||
EXPECT_LE(doppler_error_hz, 666) << "Doppler error exceeds the expected value: 666 Hz = 2/(3*integration period)";
|
||||
EXPECT_LT(delay_error_chips, 0.5) << "Delay error exceeds the expected value: 0.5 chips";
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user