1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-29 16:33:15 +00:00

Re-enabling OpelCL acquisition test

This commit is contained in:
Carles Fernandez 2016-04-30 11:33:52 +02:00
parent ef095aee66
commit db30910cf5
2 changed files with 66 additions and 3 deletions

View File

@ -51,6 +51,62 @@
#include "gen_signal_source.h"
#include "gnss_sdr_valve.h"
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx;
typedef boost::shared_ptr<GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx> GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_sptr;
GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_sptr GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_make(concurrent_queue<int>& queue);
class GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx : public gr::block
{
private:
friend GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_sptr GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_make(concurrent_queue<int>& queue);
void msg_handler_events(pmt::pmt_t msg);
GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx(concurrent_queue<int>& queue);
concurrent_queue<int>& channel_internal_queue;
public:
int rx_message;
~GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx(); //!< Default destructor
};
GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_sptr GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_make(concurrent_queue<int>& queue)
{
return GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_sptr(new GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx(queue));
}
void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx::msg_handler_events(pmt::pmt_t msg)
{
try
{
long int message = pmt::to_long(msg);
rx_message = message;
channel_internal_queue.push(rx_message);
}
catch(boost::bad_any_cast& e)
{
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
rx_message = 0;
}
}
GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx::GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx(concurrent_queue<int>& queue) :
gr::block("GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), channel_internal_queue(queue)
{
this->message_port_register_in(pmt::mp("events"));
this->set_msg_handler(pmt::mp("events"), boost::bind(&GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx::msg_handler_events, this, _1));
rx_message = 0;
}
GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx::~GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx()
{}
// ###########################################################
class GpsL1CaPcpsOpenClAcquisitionGSoC2013Test: public ::testing::Test
{
@ -77,6 +133,7 @@ protected:
void process_message();
void stop_queue();
concurrent_queue<int> channel_internal_queue;
gr::msg_queue::sptr queue;
gr::top_block_sptr top_block;
std::shared_ptr<GpsL1CaPcpsOpenClAcquisition> acquisition;
@ -372,6 +429,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ConnectAndRun)
config_1();
acquisition = std::make_shared<GpsL1CaPcpsOpenClAcquisition>(config.get(), "Acquisition", 1, 1, queue);
boost::shared_ptr<GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
ASSERT_NO_THROW( {
acquisition->connect(top_block);
@ -379,6 +437,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ConnectAndRun)
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
top_block->connect(source, 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"));
}) << "Failure connecting the blocks of acquisition test." << std::endl;
EXPECT_NO_THROW( {
@ -397,6 +456,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResults)
config_1();
acquisition = std::make_shared<GpsL1CaPcpsOpenClAcquisition>(config.get(), "Acquisition", 1, 1, queue);
boost::shared_ptr<GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
ASSERT_NO_THROW( {
acquisition->set_channel(1);
@ -431,6 +491,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResults)
signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue));
signal_source->connect(top_block);
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
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;
// i = 0 --> satellite in acquisition is visible
@ -477,6 +538,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResultsProbabilitie
config_2();
acquisition = std::make_shared<GpsL1CaPcpsOpenClAcquisition>(config.get(), "Acquisition", 1, 1, queue);
boost::shared_ptr<GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
ASSERT_NO_THROW( {
acquisition->set_channel(1);
@ -511,6 +573,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResultsProbabilitie
signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue));
signal_source->connect(top_block);
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
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;
std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl;

View File

@ -91,9 +91,9 @@ DECLARE_string(log_dir);
#include "gnss_block/gps_l2_m_pcps_acquisition_test.cc"
#include "gnss_block/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc"
//#include "gnss_block/gps_l1_ca_pcps_multithread_acquisition_gsoc2013_test.cc"
//#if OPENCL_BLOCKS_TEST
//#include "gnss_block/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc"
//#endif
#if OPENCL_BLOCKS_TEST
#include "gnss_block/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc"
#endif
#include "gnss_block/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc"
#include "gnss_block/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc"
#include "gnss_block/galileo_e1_pcps_ambiguous_acquisition_test.cc"