From 3f0a7ef4fa9f3a57233602653abe4f7c8657002e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 4 Jul 2018 13:05:44 +0200 Subject: [PATCH 1/9] Extend acquisition performance test to other implementations. set_state(int state) is now amandatory member for acquisition adapters --- ...alileo_e1_pcps_8ms_ambiguous_acquisition.h | 6 ++--- .../galileo_e1_pcps_ambiguous_acquisition.h | 2 +- ...leo_e1_pcps_cccwsr_ambiguous_acquisition.h | 7 +++--- ..._e1_pcps_quicksync_ambiguous_acquisition.h | 6 ++--- ...lileo_e1_pcps_tong_ambiguous_acquisition.h | 7 +++--- ...lileo_e5a_noncoherent_iq_acquisition_caf.h | 4 +-- .../adapters/galileo_e5a_pcps_acquisition.h | 2 +- .../adapters/glonass_l1_ca_pcps_acquisition.h | 2 +- .../adapters/glonass_l2_ca_pcps_acquisition.h | 2 +- .../adapters/gps_l1_ca_pcps_acquisition.h | 2 +- ...gps_l1_ca_pcps_acquisition_fine_doppler.cc | 8 +++++- .../gps_l1_ca_pcps_acquisition_fine_doppler.h | 8 ++++-- .../gps_l1_ca_pcps_acquisition_fpga.h | 2 +- .../gps_l1_ca_pcps_assisted_acquisition.h | 4 +-- .../gps_l1_ca_pcps_opencl_acquisition.h | 6 ++--- .../gps_l1_ca_pcps_quicksync_acquisition.h | 7 +++--- .../gps_l1_ca_pcps_tong_acquisition.h | 6 ++--- .../adapters/gps_l2_m_pcps_acquisition.h | 2 +- .../adapters/gps_l5i_pcps_acquisition.h | 2 +- .../pcps_acquisition_fine_doppler_cc.cc | 24 ++++++++++++++++++ .../pcps_acquisition_fine_doppler_cc.h | 7 ++++++ src/core/interfaces/acquisition_interface.h | 1 + .../gps_l1_acq_performance_test.cc | 25 ++++++++++++++++--- 23 files changed, 99 insertions(+), 43 deletions(-) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h index e603665dc..83917420c 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h @@ -32,12 +32,11 @@ #ifndef GNSS_SDR_GALILEO_E1_PCPS_8MS_AMBIGUOUS_ACQUISITION_H_ #define GNSS_SDR_GALILEO_E1_PCPS_8MS_AMBIGUOUS_ACQUISITION_H_ -#include -#include #include "gnss_synchro.h" #include "acquisition_interface.h" #include "galileo_pcps_8ms_acquisition_cc.h" - +#include +#include class ConfigurationInterface; @@ -123,6 +122,7 @@ public: * \brief Restart acquisition algorithm */ void reset() override; + void set_state(int state) override{}; private: ConfigurationInterface* configuration_; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h index 9dfe42e9d..56f79774d 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h @@ -130,7 +130,7 @@ public: /*! * \brief If state = 1, it forces the block to start acquiring from the first sample */ - void set_state(int state); + void set_state(int state) override; private: ConfigurationInterface* configuration_; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.h index 45888040c..54b5ee54e 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.h @@ -32,12 +32,11 @@ #ifndef GNSS_SDR_GALILEO_E1_PCPS_CCCWSR_AMBIGUOUS_ACQUISITION_H_ #define GNSS_SDR_GALILEO_E1_PCPS_CCCWSR_AMBIGUOUS_ACQUISITION_H_ -#include -#include #include "gnss_synchro.h" #include "acquisition_interface.h" #include "pcps_cccwsr_acquisition_cc.h" - +#include +#include class ConfigurationInterface; @@ -124,7 +123,7 @@ public: /*! * \brief If state = 1, it forces the block to start acquiring from the first sample */ - void set_state(int state); + void set_state(int state) override; private: ConfigurationInterface* configuration_; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.h index b46fe2986..5bfa06ca2 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.h @@ -32,11 +32,11 @@ #ifndef GNSS_SDR_GALILEO_E1_PCPS_QUICKSYNC_AMBIGUOUS_ACQUISITION_H_ #define GNSS_SDR_GALILEO_E1_PCPS_QUICKSYNC_AMBIGUOUS_ACQUISITION_H_ -#include -#include #include "gnss_synchro.h" #include "acquisition_interface.h" #include "pcps_quicksync_acquisition_cc.h" +#include +#include class ConfigurationInterface; @@ -127,7 +127,7 @@ public: /*! * \brief If state = 1, it forces the block to start acquiring from the first sample */ - void set_state(int state); + void set_state(int state) override; private: ConfigurationInterface* configuration_; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.h index ad74c02e8..a47a22329 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.h @@ -32,12 +32,11 @@ #ifndef GNSS_SDR_GALILEO_E1_PCPS_TONG_AMBIGUOUS_ACQUISITION_H_ #define GNSS_SDR_GALILEO_E1_PCPS_TONG_AMBIGUOUS_ACQUISITION_H_ -#include -#include #include "gnss_synchro.h" #include "acquisition_interface.h" #include "pcps_tong_acquisition_cc.h" - +#include +#include class ConfigurationInterface; @@ -127,7 +126,7 @@ public: /*! * \brief If state = 1, it forces the block to start acquiring from the first sample */ - void set_state(int state); + void set_state(int state) override; private: ConfigurationInterface* configuration_; diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.h b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.h index 6b333fbbe..823bdc1ff 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.h +++ b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.h @@ -38,10 +38,10 @@ #ifndef GALILEO_E5A_NONCOHERENT_IQ_ACQUISITION_CAF_H_ #define GALILEO_E5A_NONCOHERENT_IQ_ACQUISITION_CAF_H_ -#include #include "gnss_synchro.h" #include "acquisition_interface.h" #include "galileo_e5a_noncoherent_iq_acquisition_caf_cc.h" +#include class ConfigurationInterface; @@ -129,7 +129,7 @@ public: * first available sample. * \param state - int=1 forces start of acquisition */ - void set_state(int state); + void set_state(int state) override; private: ConfigurationInterface* configuration_; diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.h index 807a307b2..ebea0a5e6 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.h @@ -121,7 +121,7 @@ public: * first available sample. * \param state - int=1 forces start of acquisition */ - void set_state(int state); + void set_state(int state) override; private: float calculate_threshold(float pfa); diff --git a/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.h b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.h index ac8295d09..8a956e045 100644 --- a/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.h @@ -130,7 +130,7 @@ public: /*! * \brief If state = 1, it forces the block to start acquiring from the first sample */ - void set_state(int state); + void set_state(int state) override; private: ConfigurationInterface* configuration_; diff --git a/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.h b/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.h index 54b15f5be..73162f6f3 100644 --- a/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.h @@ -129,7 +129,7 @@ public: /*! * \brief If state = 1, it forces the block to start acquiring from the first sample */ - void set_state(int state); + void set_state(int state) override; private: ConfigurationInterface* configuration_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h index 1ac26a80a..a5ad9ef67 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h @@ -134,7 +134,7 @@ public: /*! * \brief If state = 1, it forces the block to start acquiring from the first sample */ - void set_state(int state); + void set_state(int state) override; private: ConfigurationInterface* configuration_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc index 30193cb32..88f3c8cdc 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc @@ -33,11 +33,11 @@ */ #include "gps_l1_ca_pcps_acquisition_fine_doppler.h" -#include #include "gps_sdr_signal_processing.h" #include "GPS_L1_CA.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" +#include using google::LogMessage; @@ -161,6 +161,12 @@ void GpsL1CaPcpsAcquisitionFineDoppler::reset() } +void GpsL1CaPcpsAcquisitionFineDoppler::set_state(int state) +{ + acquisition_cc_->set_state(state); +} + + void GpsL1CaPcpsAcquisitionFineDoppler::connect(boost::shared_ptr top_block) { if (top_block) diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.h index 74bcd28a4..a61d833e7 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.h @@ -34,11 +34,10 @@ #ifndef GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_FINE_DOPPLER_H_ #define GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_FINE_DOPPLER_H_ -#include #include "gnss_synchro.h" #include "acquisition_interface.h" #include "pcps_acquisition_fine_doppler_cc.h" - +#include class ConfigurationInterface; @@ -122,6 +121,11 @@ public: */ void reset() override; + /*! + * \brief If state = 1, it forces the block to start acquiring from the first sample + */ + void set_state(int state) override; + private: pcps_acquisition_fine_doppler_cc_sptr acquisition_cc_; size_t item_size_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h index b658942d5..9fac921d1 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h @@ -132,7 +132,7 @@ public: /*! * \brief If state = 1, it forces the block to start acquiring from the first sample */ - void set_state(int state); + void set_state(int state) override; private: ConfigurationInterface* configuration_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h index 905d3525a..0cdfd3077 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h @@ -34,11 +34,10 @@ #ifndef GNSS_SDR_GPS_L1_CA_PCPS_ASSISTED_ACQUISITION_H_ #define GNSS_SDR_GPS_L1_CA_PCPS_ASSISTED_ACQUISITION_H_ -#include #include "gnss_synchro.h" #include "acquisition_interface.h" #include "pcps_assisted_acquisition_cc.h" - +#include class ConfigurationInterface; @@ -121,6 +120,7 @@ public: * \brief Restart acquisition algorithm */ void reset() override; + void set_state(int state) override{}; private: pcps_assisted_acquisition_cc_sptr acquisition_cc_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.h index 854c6c0f6..900b65ed3 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.h @@ -32,12 +32,11 @@ #ifndef GNSS_SDR_GPS_L1_CA_PCPS_OPENCL_ACQUISITION_H_ #define GNSS_SDR_GPS_L1_CA_PCPS_OPENCL_ACQUISITION_H_ -#include -#include #include "gnss_synchro.h" #include "acquisition_interface.h" #include "pcps_opencl_acquisition_cc.h" - +#include +#include class ConfigurationInterface; @@ -123,6 +122,7 @@ public: * \brief Restart acquisition algorithm */ void reset() override; + void set_state(int state) override{}; private: ConfigurationInterface* configuration_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.h index 590890039..f38ee7055 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.h @@ -33,13 +33,12 @@ #ifndef GNSS_SDR_GPS_L1_CA_PCPS_QUICKSYNC_ACQUISITION_H_ #define GNSS_SDR_GPS_L1_CA_PCPS_QUICKSYNC_ACQUISITION_H_ -#include -#include #include "gnss_synchro.h" #include "acquisition_interface.h" #include "pcps_quicksync_acquisition_cc.h" #include "configuration_interface.h" - +#include +#include class ConfigurationInterface; @@ -129,7 +128,7 @@ public: /*! * \brief If state = 1, it forces the block to start acquiring from the first sample */ - void set_state(int state); + void set_state(int state) override; private: ConfigurationInterface* configuration_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.h index 1e63f5801..b09f6cde0 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.h @@ -32,12 +32,12 @@ #ifndef GNSS_SDR_GPS_L1_CA_TONG_ACQUISITION_H_ #define GNSS_SDR_GPS_L1_CA_TONG_ACQUISITION_H_ -#include -#include #include "gnss_synchro.h" #include "acquisition_interface.h" #include "pcps_tong_acquisition_cc.h" #include "configuration_interface.h" +#include +#include class ConfigurationInterface; @@ -127,7 +127,7 @@ public: /*! * \brief If state = 1, it forces the block to start acquiring from the first sample */ - void set_state(int state); + void set_state(int state) override; private: ConfigurationInterface* configuration_; diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.h b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.h index f0b8a807d..ec4257aee 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.h @@ -132,7 +132,7 @@ public: /*! * \brief If state = 1, it forces the block to start acquiring from the first sample */ - void set_state(int state); + void set_state(int state) override; private: ConfigurationInterface* configuration_; diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.h b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.h index 4a0f0a571..01d15def8 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.h @@ -132,7 +132,7 @@ public: /*! * \brief If state = 1, it forces the block to start acquiring from the first sample */ - void set_state(int state); + void set_state(int state) override; private: ConfigurationInterface* configuration_; 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 c9b31b134..963bfffcf 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 @@ -424,6 +424,30 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler(gr_vector_const_void_star } +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 + d_state = state; + if (d_state == 1) + { + d_gnss_synchro->Acq_delay_samples = 0.0; + d_gnss_synchro->Acq_doppler_hz = 0.0; + d_gnss_synchro->Acq_samplestamp_samples = 0; + d_well_count = 0; + d_input_power = 0.0; + d_test_statistics = 0.0; + d_active = true; + } + else if (d_state == 0) + { + } + else + { + LOG(ERROR) << "State can only be set to 0 or 1"; + } +} + + int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items, gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items, gr_vector_void_star &output_items __attribute__((unused))) diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.h index d34121910..2afcbd3e4 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.h @@ -214,6 +214,13 @@ public: */ void set_doppler_step(unsigned int doppler_step); + /*! + * \brief If set to 1, ensures that acquisition starts at the + * first available sample. + * \param state - int=1 forces start of acquisition + */ + void set_state(int state); + /*! * \brief Parallel Code Phase Search Acquisition signal processing. */ diff --git a/src/core/interfaces/acquisition_interface.h b/src/core/interfaces/acquisition_interface.h index 10668b071..dcf140a5f 100644 --- a/src/core/interfaces/acquisition_interface.h +++ b/src/core/interfaces/acquisition_interface.h @@ -61,6 +61,7 @@ public: virtual void set_doppler_step(unsigned int doppler_step) = 0; virtual void init() = 0; virtual void set_local_code() = 0; + virtual void set_state(int state) = 0; virtual signed int mag() = 0; virtual void reset() = 0; }; 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 a92c228b9..f5923d343 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 @@ -33,6 +33,8 @@ #include "signal_generator_flags.h" #include "tracking_true_obs_reader.h" #include "true_observables_reader.h" +#include "gps_l1_ca_pcps_acquisition.h" +#include "gps_l1_ca_pcps_acquisition_fine_doppler.h" #include "display.h" #include "gnuplot_i.h" #include @@ -42,6 +44,7 @@ DEFINE_string(config_file_ptest, std::string(""), "File containing alternative configuration parameters for the acquisition performance test."); DEFINE_string(acq_test_input_file, std::string(""), "File containing raw signal data, must be in int8_t format. The signal generator will not be used."); +DEFINE_string(acq_test_implementation, std::string("GPS_L1_CA_PCPS_Acquisition"), "Acquisition block implementation under test"); DEFINE_int32(acq_test_doppler_max, 5000, "Maximum Doppler, in Hz"); DEFINE_int32(acq_test_doppler_step, 125, "Doppler step, in Hz."); @@ -200,7 +203,6 @@ protected: { } - std::vector cn0_vector; std::vector pfa_vector; @@ -223,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; @@ -235,7 +237,7 @@ protected: int message; boost::thread ch_thread; - std::string implementation = "GPS_L1_CA_PCPS_Acquisition"; + std::string implementation = FLAGS_acq_test_implementation; const double baseband_sampling_freq = static_cast(FLAGS_fs_gen_sps); const int coherent_integration_time_ms = FLAGS_acq_test_coherent_time_ms; @@ -457,8 +459,23 @@ 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) + { + 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) + { + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 0); + } + else + { + bool aux = false; + EXPECT_EQ(true, aux); + } + } - acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 0); acquisition->set_gnss_synchro(&gnss_synchro); acquisition->set_channel(0); acquisition->set_local_code(); From 5842da980f79c05ea712e0025cb649bb7087da16 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 4 Jul 2018 18:24:10 +0200 Subject: [PATCH 2/9] Remove unused variable --- .../gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc | 1 - 1 file changed, 1 deletion(-) 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 45c6620be..126716e86 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 @@ -455,7 +455,6 @@ void pcps_acquisition_fine_doppler_cc::set_state(int state) d_gnss_synchro->Acq_doppler_hz = 0.0; d_gnss_synchro->Acq_samplestamp_samples = 0; d_well_count = 0; - d_input_power = 0.0; d_test_statistics = 0.0; d_active = true; } From d14d4ccdbcb16bc33fd8aa9343a575a92622f31b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 5 Jul 2018 10:51:23 +0200 Subject: [PATCH 3/9] 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(); From cabf419e76435d660ac90da9eab9d36e629ed020 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 5 Jul 2018 19:02:15 +0200 Subject: [PATCH 4/9] Add Alvaro to the list of contributors --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index da4b589f9..2dd1239cb 100644 --- a/AUTHORS +++ b/AUTHORS @@ -40,6 +40,7 @@ Antonio Ramos antonio.ramosdet@gmail.com Developer Marc Majoral marc.majoral@cttc.cat Developer Jordi Vilà-Valls jordi.vila@cttc.cat Consultant Pau Closas pau.closas@northeastern.edu Consultant +Álvaro Cebrián Juan acebrianjuan@gmail.com Contributor Andres Cecilia Luque a.cecilia.luque@gmail.com Contributor Anthony Arnold anthony.arnold@uqconnect.edu.au Contributor Carlos Avilés carlos.avilesr@googlemail.com Contributor From d9f6d41eed8757d700b2bfe686169b3987156e79 Mon Sep 17 00:00:00 2001 From: Javier Arribas Date: Thu, 5 Jul 2018 20:19:29 +0200 Subject: [PATCH 5/9] Fix crash of PCPS acquisition fine doppler on some systems --- .../pcps_acquisition_fine_doppler_cc.cc | 57 ++++++++++++++----- .../pcps_acquisition_fine_doppler_cc.h | 11 +++- 2 files changed, 51 insertions(+), 17 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 7e1ffa903..d55065a4c 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 @@ -133,6 +133,12 @@ void pcps_acquisition_fine_doppler_cc::set_doppler_step(unsigned int doppler_ste { d_grid_data[i] = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment())); } + + if (d_dump) + { + grid_ = arma::fmat(d_fft_size, d_num_doppler_points, arma::fill::zeros); + } + update_carrier_wipeoff(); } @@ -181,11 +187,6 @@ void pcps_acquisition_fine_doppler_cc::init() d_gnss_synchro->Acq_doppler_hz = 0.0; d_gnss_synchro->Acq_samplestamp_samples = 0; d_state = 0; - - if (d_dump) - { - grid_ = arma::fmat(d_fft_size, d_num_doppler_points, arma::fill::zeros); - } } @@ -261,7 +262,6 @@ double pcps_acquisition_fine_doppler_cc::compute_CAF() } } - // -- - Find 1 chip wide code phase exclude range around the peak uint32_t samplesPerChip = ceil(GPS_L1_CA_CHIP_PERIOD * static_cast(this->d_fs_in)); int32_t excludeRangeIndex1 = index_time - samplesPerChip; @@ -364,7 +364,6 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler() //int fft_size_extended = nextPowerOf2(signal_samples * zero_padding_factor); int fft_size_extended = signal_samples * zero_padding_factor; gr::fft::fft_complex *fft_operator = new gr::fft::fft_complex(fft_size_extended, true); - //zero padding the entire vector std::fill_n(fft_operator->get_inbuf(), fft_size_extended, gr_complex(0.0, 0.0)); @@ -386,7 +385,6 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler() memcpy(&code_replica[(n + 1) * d_fft_size], code_replica, d_fft_size * sizeof(gr_complex)); } //2. Perform code wipe-off - volk_32fc_x2_multiply_32fc(fft_operator->get_inbuf(), d_10_ms_buffer, code_replica, signal_samples); // 3. Perform the FFT (zero padded!) @@ -402,8 +400,8 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler() //case even int counter = 0; + float* fftFreqBins= new float[fft_size_extended]; - float fftFreqBins[fft_size_extended]; std::fill_n(fftFreqBins, fft_size_extended, 0.0); for (int k = 0; k < (fft_size_extended / 2); k++) @@ -414,8 +412,9 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler() for (int k = fft_size_extended / 2; k > 0; k--) { - fftFreqBins[counter] = ((-static_cast(d_fs_in) / 2) * static_cast(k)) / (static_cast(fft_size_extended) / 2.0); + fftFreqBins[counter] = ((-static_cast(d_fs_in) / 2.0) * static_cast(k)) / (static_cast(fft_size_extended) / 2.0); counter++; + } // 5. Update the Doppler estimation in Hz @@ -434,9 +433,11 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler() delete fft_operator; volk_gnsssdr_free(code_replica); volk_gnsssdr_free(p_tmp_vector); + delete[] fftFreqBins; return d_fft_size; } + // Called by gnuradio to enable drivers, etc for i/o devices. bool pcps_acquisition_fine_doppler_cc::start() { @@ -444,6 +445,32 @@ bool pcps_acquisition_fine_doppler_cc::start() return true; } + +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 + d_state = state; + + if (d_state == 1) + { + d_gnss_synchro->Acq_delay_samples = 0.0; + d_gnss_synchro->Acq_doppler_hz = 0.0; + d_gnss_synchro->Acq_samplestamp_samples = 0; + d_well_count = 0; + d_test_statistics = 0.0; + d_active = true; + reset_grid(); + } + else if (d_state == 0) + { + } + else + { + LOG(ERROR) << "State can only be set to 0 or 1"; + } +} + + int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items, gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items, gr_vector_void_star &output_items __attribute__((unused))) @@ -466,6 +493,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(); @@ -478,6 +506,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) @@ -499,10 +528,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/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.h index 7788e12d6..69a5ff2cc 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.h @@ -51,12 +51,12 @@ #include "gnss_synchro.h" #include "acq_conf.h" +#include #include #include #include #include #include -#include class pcps_acquisition_fine_doppler_cc; @@ -70,7 +70,6 @@ pcps_make_acquisition_fine_doppler_cc(const Acq_Conf& conf_); * \brief This class implements a Parallel Code Phase Search Acquisition. * */ - class pcps_acquisition_fine_doppler_cc : public gr::block { private: @@ -131,7 +130,6 @@ private: long int d_dump_number; unsigned int d_dump_channel; - public: /*! * \brief Default destructor. @@ -212,6 +210,13 @@ public: */ void set_doppler_step(unsigned int doppler_step); + /*! + * \brief If set to 1, ensures that acquisition starts at the + * first available sample. + * \param state - int=1 forces start of acquisition + */ + void set_state(int state); + /*! * \brief Parallel Code Phase Search Acquisition signal processing. */ From 6055200440ee3f18f2c8245d930ac6caff273e0e Mon Sep 17 00:00:00 2001 From: Javier Arribas Date: Thu, 5 Jul 2018 20:26:37 +0200 Subject: [PATCH 6/9] Code cleaning --- .../pcps_acquisition_fine_doppler_cc.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 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 d55065a4c..aab717adb 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 @@ -493,7 +493,6 @@ 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(); @@ -506,7 +505,6 @@ 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) @@ -528,10 +526,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; From bad8b25ce7456d9fac750c229ca205443467b965 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 5 Jul 2018 21:30:33 +0200 Subject: [PATCH 7/9] Fix warning of unused parameter --- .../adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h | 2 +- .../acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h | 2 +- .../acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h index 83917420c..5658aa06c 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h @@ -122,7 +122,7 @@ public: * \brief Restart acquisition algorithm */ void reset() override; - void set_state(int state) override{}; + void set_state(int state __attribute__((unused))) override{}; private: ConfigurationInterface* configuration_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h index 0cdfd3077..83218aac4 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h @@ -120,7 +120,7 @@ public: * \brief Restart acquisition algorithm */ void reset() override; - void set_state(int state) override{}; + void set_state(int state __attribute__((unused))) override{}; private: pcps_assisted_acquisition_cc_sptr acquisition_cc_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.h index 900b65ed3..7d3e7b58e 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.h @@ -122,7 +122,7 @@ public: * \brief Restart acquisition algorithm */ void reset() override; - void set_state(int state) override{}; + void set_state(int state __attribute__((unused))) override{}; private: ConfigurationInterface* configuration_; From 5ef6157fc1e522b34dcbe3d169275928237fe055 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 5 Jul 2018 21:31:38 +0200 Subject: [PATCH 8/9] Store acquisition results only when there is a decision --- .../pcps_acquisition_fine_doppler_cc.cc | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 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 aab717adb..629f53c75 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 @@ -400,7 +400,7 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler() //case even int counter = 0; - float* fftFreqBins= new float[fft_size_extended]; + float *fftFreqBins = new float[fft_size_extended]; std::fill_n(fftFreqBins, fft_size_extended, 0.0); @@ -414,7 +414,6 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler() { fftFreqBins[counter] = ((-static_cast(d_fs_in) / 2.0) * static_cast(k)) / (static_cast(fft_size_extended) / 2.0); counter++; - } // 5. Update the Doppler estimation in Hz @@ -525,11 +524,6 @@ int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items, d_state = 5; //negative acquisition } 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); - } d_sample_counter += d_fft_size; // sample counter consume_each(d_fft_size); break; @@ -562,6 +556,11 @@ int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items, DLOG(INFO) << "doppler " << d_gnss_synchro->Acq_doppler_hz; d_positive_acq = 1; d_active = false; + // Record results to file if required + if (d_dump and d_channel == d_dump_channel) + { + dump_results(d_fft_size); + } // Send message to channel port //0=STOP_CHANNEL 1=ACQ_SUCCEES 2=ACQ_FAIL this->message_port_pub(pmt::mp("events"), pmt::from_long(1)); d_state = 0; @@ -581,6 +580,11 @@ int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items, DLOG(INFO) << "doppler " << d_gnss_synchro->Acq_doppler_hz; d_positive_acq = 0; d_active = false; + // Record results to file if required + if (d_dump and d_channel == d_dump_channel) + { + dump_results(d_fft_size); + } // Send message to channel port //0=STOP_CHANNEL 1=ACQ_SUCCEES 2=ACQ_FAIL this->message_port_pub(pmt::mp("events"), pmt::from_long(2)); d_state = 0; From c10d457ae520600c47267db771ed8e330cc5a408 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 5 Jul 2018 21:33:08 +0200 Subject: [PATCH 9/9] Accept two types of algorithms --- .../gps_l1_acq_performance_test.cc | 35 +++++++++++++------ 1 file changed, 24 insertions(+), 11 deletions(-) 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 26d622850..164dd96b4 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 @@ -44,7 +44,7 @@ DEFINE_string(config_file_ptest, std::string(""), "File containing alternative configuration parameters for the acquisition performance test."); DEFINE_string(acq_test_input_file, std::string(""), "File containing raw signal data, must be in int8_t format. The signal generator will not be used."); -DEFINE_string(acq_test_implementation, std::string("GPS_L1_CA_PCPS_Acquisition"), "Acquisition block implementation under test"); +DEFINE_string(acq_test_implementation, std::string("GPS_L1_CA_PCPS_Acquisition"), "Acquisition block implementation under test. Alternative: GPS_L1_CA_PCPS_Acquisition_Fine_Doppler"); DEFINE_int32(acq_test_doppler_max, 5000, "Maximum Doppler, in Hz"); DEFINE_int32(acq_test_doppler_step, 125, "Doppler step, in Hz."); @@ -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,7 +298,6 @@ void AcquisitionPerformanceTest::wait_message() while (!stop) { channel_internal_queue.wait_and_pop(message); - std::cout << "messahe received" << std::endl; process_message(); } } @@ -308,7 +307,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) { @@ -463,7 +462,7 @@ int AcquisitionPerformanceTest::run_receiver() boost::shared_ptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); 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 { @@ -479,14 +478,14 @@ 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->init(); + acquisition->set_local_code(); + + acquisition->set_state(1); // Ensure that acquisition starts at the first sample acquisition->connect(top_block); acquisition->reset(); @@ -554,6 +553,14 @@ void AcquisitionPerformanceTest::plot_results() Gnuplot::set_GNUPlotPath(gnuplot_path); Gnuplot g1("linespoints"); + if (FLAGS_show_plots) + { + g1.showonscreen(); // window output + } + else + { + g1.disablescreen(); + } g1.cmd("set font \"Times,18\""); g1.set_title("Receiver Operating Characteristic for GPS L1 C/A acquisition"); g1.cmd("set label 1 \"" + std::string("Coherent integration time: ") + std::to_string(config->property("Acquisition_1C.coherent_integration_time_ms", 1)) + " ms, Non-coherent integrations: " + std::to_string(config->property("Acquisition_1C.max_dwells", 1)) + " \" at screen 0.12, 0.83 font \"Times,16\""); @@ -580,9 +587,16 @@ void AcquisitionPerformanceTest::plot_results() g1.set_legend(); g1.savetops("ROC"); g1.savetopdf("ROC", 18); - if (FLAGS_show_plots) g1.showonscreen(); // window output Gnuplot g2("linespoints"); + if (FLAGS_show_plots) + { + g2.showonscreen(); // window output + } + else + { + g2.disablescreen(); + } g2.cmd("set font \"Times,18\""); g2.set_title("Receiver Operating Characteristic for GPS L1 C/A valid acquisition"); g2.cmd("set label 1 \"" + std::string("Coherent integration time: ") + std::to_string(config->property("Acquisition_1C.coherent_integration_time_ms", 1)) + " ms, Non-coherent integrations: " + std::to_string(config->property("Acquisition_1C.max_dwells", 1)) + " \" at screen 0.12, 0.83 font \"Times,16\""); @@ -609,7 +623,6 @@ void AcquisitionPerformanceTest::plot_results() g2.set_legend(); g2.savetops("ROC-valid-detection"); g2.savetopdf("ROC-valid-detection", 18); - if (FLAGS_show_plots) g2.showonscreen(); // window output } catch (const GnuplotException& ge) {