From d14d4ccdbcb16bc33fd8aa9343a575a92622f31b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 5 Jul 2018 10:51:23 +0200 Subject: [PATCH] Add work --- .../pcps_acquisition_fine_doppler_cc.cc | 14 ++++++++----- .../gps_l1_acq_performance_test.cc | 21 +++++++++++-------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc index 126716e86..7894ab48b 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc @@ -447,8 +447,9 @@ bool pcps_acquisition_fine_doppler_cc::start() void pcps_acquisition_fine_doppler_cc::set_state(int state) { - gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler + //gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler d_state = state; + if (d_state == 1) { d_gnss_synchro->Acq_delay_samples = 0.0; @@ -457,6 +458,7 @@ void pcps_acquisition_fine_doppler_cc::set_state(int state) d_well_count = 0; d_test_statistics = 0.0; d_active = true; + reset_grid(); } else if (d_state == 0) { @@ -490,6 +492,7 @@ int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items, switch (d_state) { case 0: // S0. StandBy + std::cout << "S0."; if (d_active == true) { reset_grid(); @@ -502,6 +505,7 @@ int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items, } break; case 1: // S1. ComputeGrid + std::cout << "S1."; compute_and_accumulate_grid(input_items); d_well_count++; if (d_well_count >= d_max_dwells) @@ -523,10 +527,10 @@ int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items, } d_n_samples_in_buffer = 0; // Record results to file if required - if (d_dump and d_channel == d_dump_channel) - { - dump_results(d_fft_size); - } + //if (d_dump and d_channel == d_dump_channel) + // { + // dump_results(d_fft_size); + // } d_sample_counter += d_fft_size; // sample counter consume_each(d_fft_size); break; diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_acq_performance_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_acq_performance_test.cc index f5923d343..26d622850 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_acq_performance_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_acq_performance_test.cc @@ -225,7 +225,7 @@ protected: gr::msg_queue::sptr queue; gr::top_block_sptr top_block; - std::shared_ptr acquisition; + std::shared_ptr acquisition; std::shared_ptr config; std::shared_ptr config_f; Gnss_Synchro gnss_synchro; @@ -298,6 +298,7 @@ void AcquisitionPerformanceTest::wait_message() while (!stop) { channel_internal_queue.wait_and_pop(message); + std::cout << "messahe received" << std::endl; process_message(); } } @@ -307,7 +308,7 @@ void AcquisitionPerformanceTest::process_message() { measurement_counter++; acquisition->reset(); - acquisition->set_state(1); + //acquisition->set_state(1); std::cout << "Progress: " << round(static_cast(measurement_counter) / static_cast(num_of_measurements) * 100.0) << "% \r" << std::flush; if (measurement_counter == num_of_measurements) { @@ -381,6 +382,7 @@ int AcquisitionPerformanceTest::configure_receiver(double cn0, float pfa, unsign config->set_property("Acquisition_1C.implementation", implementation); config->set_property("Acquisition_1C.item_type", "gr_complex"); config->set_property("Acquisition_1C.doppler_max", std::to_string(doppler_max)); + config->set_property("Acquisition_1C.doppler_min", std::to_string(-doppler_max)); config->set_property("Acquisition_1C.doppler_step", std::to_string(doppler_step)); config->set_property("Acquisition_1C.threshold", std::to_string(pfa)); @@ -459,13 +461,13 @@ int AcquisitionPerformanceTest::run_receiver() int nsamples = floor(config->property("GNSS-SDR.internal_fs_sps", 2000000) * generated_signal_duration_s); boost::shared_ptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); - if (FLAGS_acq_test_implementation.compare("GPS_L1_CA_PCPS_Acquisition") == 0) + if (implementation.compare("GPS_L1_CA_PCPS_Acquisition") == 0) { - acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 0); + //acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 0); } else { - if (FLAGS_acq_test_implementation.compare("GPS_L1_CA_PCPS_Acquisition_Fine_Doppler") == 0) + if (implementation.compare("GPS_L1_CA_PCPS_Acquisition_Fine_Doppler") == 0) { acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 0); } @@ -477,20 +479,21 @@ int AcquisitionPerformanceTest::run_receiver() } acquisition->set_gnss_synchro(&gnss_synchro); + + acquisition->init(); acquisition->set_channel(0); acquisition->set_local_code(); acquisition->set_doppler_max(config->property("Acquisition_1C.doppler_max", 10000)); acquisition->set_doppler_step(config->property("Acquisition_1C.doppler_step", 500)); acquisition->set_threshold(config->property("Acquisition_1C.threshold", 0.0)); - acquisition->set_state(1); // Ensure that acquisition starts at the first sample + //acquisition->set_state(1); // Ensure that acquisition starts at the first sample acquisition->connect(top_block); - top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); - - acquisition->init(); + acquisition->reset(); top_block->connect(file_source, 0, gr_interleaved_char_to_complex, 0); top_block->connect(gr_interleaved_char_to_complex, 0, valve, 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0); + top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); start_queue();