Working on the tests. Workaround to build with Xcode. Improving documentation, README and cmake files readability

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@444 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Carles Fernandez 2013-11-15 17:45:24 +00:00
parent 47c27fa056
commit 3595d60f99
22 changed files with 387 additions and 276 deletions

18
README
View File

@ -245,13 +245,9 @@ Tested versions: 10.8 (Mountain Lion) and 10.9 (Mavericks)
MAC OS X 10.9 Mavericks
---------------------------
If you still have not installed Xcode, do it now from the App Store (it's free). Once installed, open a terminal and type:
If you still have not installed Xcode, do it now from the App Store (it's free).
$ xcode-select --install
and follow the instructions in the screen.
Install Macports: https://distfiles.macports.org/MacPorts/MacPorts-2.2.1-10.9-Mavericks.pkg
Install Macports: http://www.macports.org/install.php
(if you are upgrading from a previous installation, please follow the migration rules at http://trac.macports.org/wiki/Migration)
@ -297,6 +293,14 @@ $ make
$ make install
This will create two executables at gnss-sdr/install, namely gnss-sdr and run_tests. The documentation can be built by:
$ make doc
and can be viewed doing:
$ open ../docs/html/index.html
MAC OS X 10.8 Mountain Lion
@ -318,7 +322,7 @@ Install X11 via XQuartz-2.7.4.dmg (needed by gnuradio-companion but not by GNSS-
Install GNU Radio:
$ sudo port install gnuradio +full
$ sudo port install gnuradio
Install other dependencies:

View File

@ -59,4 +59,11 @@ if(OPENCL_FOUND)
endif(OPENCL_FOUND)
add_library(gnss_sp_libs ${GNSS_SPLIBS_SOURCES})
target_link_libraries(gnss_sp_libs ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES} ${GNURADIO_FFT_LIBRARIES} ${GNURADIO_FILTER_LIBRARIES} ${OPT_LIBRARIES} gnss_rx)
target_link_libraries(gnss_sp_libs ${GNURADIO_RUNTIME_LIBRARIES}
${GNURADIO_BLOCKS_LIBRARIES}
${GNURADIO_FFT_LIBRARIES}
${GNURADIO_FILTER_LIBRARIES}
${OPT_LIBRARIES}
gnss_rx
)

View File

@ -31,4 +31,10 @@ include_directories(
)
add_library(signal_generator_adapters ${SIGNAL_GENERATOR_ADAPTER_SOURCES})
target_link_libraries(signal_generator_adapters gnss_sp_libs signal_generator_blocks ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES} ${GNURADIO_FILTER_LIBRARIES})
target_link_libraries(signal_generator_adapters gnss_sp_libs
signal_generator_blocks
${GNURADIO_RUNTIME_LIBRARIES}
${GNURADIO_BLOCKS_LIBRARIES}
${GNURADIO_FILTER_LIBRARIES}
)

View File

@ -73,8 +73,8 @@ SignalGenerator::SignalGenerator(ConfigurationInterface* configuration,
delay_chips.push_back(configuration->property("SignalSource.delay_chips_" + sat, 0));
}
// If Gallileo signal is present -> vector duration = 100 ms (25 * 4 ms)
// If there is only GPS signal (Gallileo signal not present) -> vector duration = 1 ms
// If Galileo signal is present -> vector duration = 100 ms (25 * 4 ms)
// If there is only GPS signal (Galileo signal not present) -> vector duration = 1 ms
unsigned int vector_length = 0;
if (std::find(system.begin(), system.end(), "E") != system.end())
{
@ -103,8 +103,7 @@ SignalGenerator::SignalGenerator(ConfigurationInterface* configuration,
else
{
LOG_AT_LEVEL(WARNING) << item_type_
<< " unrecognized item type for resampler";
LOG_AT_LEVEL(WARNING) << item_type_ << " unrecognized item type for resampler";
item_size_ = sizeof(short);
}

View File

@ -61,7 +61,7 @@ public:
}
/*!
* \brief Returns "SignalGenerator".
* \brief Returns "GNSSSignalGenerator".
*/
std::string implementation()
{
@ -77,7 +77,6 @@ public:
gr::basic_block_sptr get_left_block();
gr::basic_block_sptr get_right_block();
private:
std::string role_;
unsigned int in_stream_;
@ -90,7 +89,6 @@ private:
gr::blocks::vector_to_stream::sptr vector_to_stream_;
gr::blocks::file_sink::sptr file_sink_;
boost::shared_ptr<gr::msg_queue> queue_;
};
#endif /*GNSS_SDR_SIGNAL_GENERATOR_H_*/

View File

@ -30,6 +30,11 @@ include_directories(
)
add_library(signal_generator_blocks ${SIGNAL_GENERATOR_BLOCK_SOURCES})
target_link_libraries(signal_generator_blocks gnss_system_parameters ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_FFT_LIBRARIES} ${VOLK_LIBRARIES})
target_link_libraries(signal_generator_blocks gnss_system_parameters
${GNURADIO_RUNTIME_LIBRARIES}
${GNURADIO_FFT_LIBRARIES}
${VOLK_LIBRARIES}
)

View File

@ -5,7 +5,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2013 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -80,13 +80,13 @@ void signal_generator_c::init()
{
if (posix_memalign((void**)&complex_phase_, 16, vector_length_ * sizeof(gr_complex)) == 0){};
// True if Gallileo satellites are present
// True if Galileo satellites are present
bool gallileo_signal = std::find(system_.begin(), system_.end(), "E") != system_.end();
for (unsigned int sat = 0; sat < num_sats_; sat++)
{
start_phase_rad_.push_back(0);
current_data_bits_.push_back(gr_complex(1,0));
current_data_bits_.push_back(gr_complex(1, 0));
ms_counter_.push_back(0);
if (system_[sat] == "G")
@ -140,20 +140,20 @@ void signal_generator_c::generate_codes()
if (posix_memalign((void**)&(sampled_code_data_[sat]), 16,
vector_length_ * sizeof(gr_complex)) == 0){};
gr_complex code[8000];//[samples_per_code_[sat]];
gr_complex code[64000];//[samples_per_code_[sat]];
if (system_[sat] == "G")
{
// Generate one code-period of 1C signal
gps_l1_ca_code_gen_complex_sampled(code, PRN_[sat], fs_in_,
(int)GPS_L1_CA_CODE_LENGTH_CHIPS-delay_chips_[sat]);
(int)GPS_L1_CA_CODE_LENGTH_CHIPS - delay_chips_[sat]);
// Obtain the desired CN0 assuming that Pn = 1.
if (noise_flag_)
{
for (unsigned int i = 0; i < samples_per_code_[sat]; i++)
{
code[i] *= sqrt(pow(10,CN0_dB_[sat]/10)/BW_BB_);
code[i] *= sqrt(pow(10,CN0_dB_[sat] / 10) / BW_BB_);
}
}
@ -172,14 +172,14 @@ void signal_generator_c::generate_codes()
strcpy(signal, "1B");
galileo_e1_code_gen_complex_sampled(code, signal, cboc, PRN_[sat], fs_in_,
(int)Galileo_E1_B_CODE_LENGTH_CHIPS-delay_chips_[sat]);
(int)Galileo_E1_B_CODE_LENGTH_CHIPS - delay_chips_[sat]);
// Obtain the desired CN0 assuming that Pn = 1.
if (noise_flag_)
{
for (unsigned int i = 0; i < samples_per_code_[sat]; i++)
{
code[i] *= sqrt(pow(10,CN0_dB_[sat]/10)/BW_BB_/2);
code[i] *= sqrt(pow(10, CN0_dB_[sat] / 10) / BW_BB_ / 2);
}
}
@ -204,7 +204,7 @@ void signal_generator_c::generate_codes()
{
for (unsigned int i = 0; i < vector_length_; i++)
{
sampled_code_pilot_[sat][i] *= sqrt(pow(10,CN0_dB_[sat]/10)/BW_BB_/2);
sampled_code_pilot_[sat][i] *= sqrt(pow(10, CN0_dB_[sat] / 10) / BW_BB_ / 2);
}
}
}
@ -230,8 +230,7 @@ signal_generator_c::~signal_generator_c()
}
int
signal_generator_c::general_work (int noutput_items,
int signal_generator_c::general_work (int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
@ -249,7 +248,6 @@ signal_generator_c::general_work (int noutput_items,
for (unsigned int sat = 0; sat < num_sats_; sat++)
{
float phase_step_rad = -(float)GPS_TWO_PI*doppler_Hz_[sat] / (float)fs_in_;
fxp_nco(complex_phase_, vector_length_, start_phase_rad_[sat], phase_step_rad);
start_phase_rad_[sat] += vector_length_ * phase_step_rad;

View File

@ -42,8 +42,7 @@ class signal_generator_c;
* We use boost::shared_ptr's instead of raw pointers for all access
* to gr_blocks (and many other data structures). The shared_ptr gets
* us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid
* C++ / Python system.
* management issues.
*
* See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
*
@ -73,57 +72,57 @@ signal_make_generator_c (std::vector<std::string> system, const std::vector<unsi
class signal_generator_c : public gr::block
{
private:
// The friend declaration allows gen_source to
// access the private constructor.
// The friend declaration allows gen_source to
// access the private constructor.
/* Create the signal_generator_c object*/
friend signal_generator_c_sptr
signal_make_generator_c (std::vector<std::string> system, const std::vector<unsigned int> &PRN,
const std::vector<float> &CN0_dB, const std::vector<float> &doppler_Hz,
const std::vector<unsigned int> &delay_chips, bool data_flag, bool noise_flag,
unsigned int fs_in, unsigned int vector_length, float BW_BB);
/* Create the signal_generator_c object*/
friend signal_generator_c_sptr
signal_make_generator_c (std::vector<std::string> system, const std::vector<unsigned int> &PRN,
const std::vector<float> &CN0_dB, const std::vector<float> &doppler_Hz,
const std::vector<unsigned int> &delay_chips, bool data_flag, bool noise_flag,
unsigned int fs_in, unsigned int vector_length, float BW_BB);
signal_generator_c (std::vector<std::string> system, const std::vector<unsigned int> &PRN,
const std::vector<float> &CN0_dB, const std::vector<float> &doppler_Hz,
const std::vector<unsigned int> &delay_chips, bool data_flag, bool noise_flag,
unsigned int fs_in, unsigned int vector_length, float BW_BB);
signal_generator_c (std::vector<std::string> system, const std::vector<unsigned int> &PRN,
const std::vector<float> &CN0_dB, const std::vector<float> &doppler_Hz,
const std::vector<unsigned int> &delay_chips, bool data_flag, bool noise_flag,
unsigned int fs_in, unsigned int vector_length, float BW_BB);
void init();
void generate_codes();
void init();
void generate_codes();
std::vector<std::string> system_;
std::vector<unsigned int> PRN_;
std::vector<float> CN0_dB_;
std::vector<float> doppler_Hz_;
std::vector<unsigned int> delay_chips_;
bool data_flag_;
bool noise_flag_;
unsigned int fs_in_;
unsigned int num_sats_;
unsigned int vector_length_;
float BW_BB_;
std::vector<std::string> system_;
std::vector<unsigned int> PRN_;
std::vector<float> CN0_dB_;
std::vector<float> doppler_Hz_;
std::vector<unsigned int> delay_chips_;
bool data_flag_;
bool noise_flag_;
unsigned int fs_in_;
unsigned int num_sats_;
unsigned int vector_length_;
float BW_BB_;
std::vector<unsigned int> samples_per_code_;
std::vector<unsigned int> num_of_codes_per_vector_;
std::vector<unsigned int> data_bit_duration_ms_;
std::vector<unsigned int> ms_counter_;
std::vector<float> start_phase_rad_;
std::vector<gr_complex> current_data_bits_;
std::vector<unsigned int> samples_per_code_;
std::vector<unsigned int> num_of_codes_per_vector_;
std::vector<unsigned int> data_bit_duration_ms_;
std::vector<unsigned int> ms_counter_;
std::vector<float> start_phase_rad_;
std::vector<gr_complex> current_data_bits_;
boost::scoped_array<gr_complex*> sampled_code_data_;
boost::scoped_array<gr_complex*> sampled_code_pilot_;
gr::random* random_;
gr_complex* complex_phase_;
boost::scoped_array<gr_complex*> sampled_code_data_;
boost::scoped_array<gr_complex*> sampled_code_pilot_;
gr::random* random_;
gr_complex* complex_phase_;
public:
~signal_generator_c (); // public destructor
public:
~signal_generator_c (); // public destructor
// Where all the action really happens
// Where all the action really happens
int general_work (int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
int general_work (int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
};
#endif /* GNSS_SDR_SIGNAL_GENERATOR_C_H */

View File

@ -24,6 +24,7 @@ set(GNSS_RECEIVER_SOURCES
gnss_flowgraph.cc
in_memory_configuration.cc
)
include_directories(
$(CMAKE_CURRENT_SOURCE_DIR)
${CMAKE_SOURCE_DIR}/src/core/system_parameters
@ -90,12 +91,28 @@ endif( OPENCL_FOUND )
add_library(gnss_rx ${GNSS_RECEIVER_SOURCES})
target_link_libraries(gnss_rx ${Boost_LIBRARIES} ${ARMADILLO_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES} ${GNURADIO_FFT_LIBRARIES} ${GNURADIO_FILTER_LIBRARIES}
gnss_system_parameters gnss_sp_libs
signal_source_adapters datatype_adapters
input_filter_adapters
conditioner_adapters resampler_adapters
acq_adapters tracking_lib tracking_adapters
channel_adapters telemetry_decoder_adapters
obs_adapters pvt_adapters pvt_lib
out_adapters rx_core_lib)
target_link_libraries(gnss_rx ${Boost_LIBRARIES}
${ARMADILLO_LIBRARIES}
${GNURADIO_RUNTIME_LIBRARIES}
${GNURADIO_BLOCKS_LIBRARIES}
${GNURADIO_FFT_LIBRARIES}
${GNURADIO_FILTER_LIBRARIES}
gnss_system_parameters
gnss_sp_libs
signal_source_adapters
datatype_adapters
input_filter_adapters
conditioner_adapters
resampler_adapters
acq_adapters
tracking_lib
tracking_adapters
channel_adapters
telemetry_decoder_adapters
obs_adapters
pvt_adapters
pvt_lib
out_adapters
rx_core_lib
)

View File

@ -60,6 +60,11 @@ if(NOT GTEST_DIR_LOCAL)
set(GTEST_INCLUDE_DIRECTORIES ${GTEST_DIR}/include ${GTEST_DIR} ${GTEST_DIR}/src)
# Library
ExternalProject_Get_Property(gtest-${gtest_RELEASE} binary_dir)
if(MACOSX_MAVERICKS)
if(CMAKE_GENERATOR STREQUAL Xcode)
set(binary_dir "${binary_dir}/Debug")
endif(CMAKE_GENERATOR STREQUAL Xcode)
endif(MACOSX_MAVERICKS)
set(GTEST_LIBRARY_PATH "${binary_dir}/${CMAKE_FIND_LIBRARY_PREFIXES}gtest.a;${binary_dir}/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main.a")
set(GTEST_LIBRARY gtest-${gtest_RELEASE})
set(GTEST_LIBRARIES
@ -111,11 +116,12 @@ if(OS_IS_MACOSX)
# Tell the linker where the libraries installed by MacPorts are
set(MAC_LIBRARIES "-stdlib=libc++ -std=c++11")
else(MACOSX_MAVERICKS)
link_directories( /opt/local/lib ) # not very elegant, to be fixed
link_directories( /opt/local/lib ) # not very elegant, to be fixed. Needed?
endif(MACOSX_MAVERICKS)
endif(OS_IS_MACOSX)
add_executable(run_tests ${CMAKE_CURRENT_SOURCE_DIR}/test_main.cc)
target_link_libraries(run_tests ${MAC_LIBRARIES}
${Boost_LIBRARIES}
${GFLAGS_LIBS}
@ -128,7 +134,8 @@ target_link_libraries(run_tests ${MAC_LIBRARIES}
gnss_sp_libs
gnss_rx
signal_generator_blocks
)
signal_generator_adapters
)
install(TARGETS run_tests DESTINATION ${CMAKE_SOURCE_DIR}/install)

View File

@ -304,12 +304,19 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::wait_message()
gettimeofday(&tv, NULL);
begin = tv.tv_sec *1e6 + tv.tv_usec;
channel_internal_queue.wait_and_pop(message);
try
{
channel_internal_queue.wait_and_pop(message);
}
catch( boost::exception & e )
{
DLOG(FATAL) << "Boost exception: " << boost::diagnostic_information(e);
}
gettimeofday(&tv, NULL);
end = tv.tv_sec *1e6 + tv.tv_usec;
end = tv.tv_sec*1e6 + tv.tv_usec;
mean_acq_time_us += (end-begin);
mean_acq_time_us += (end - begin);
process_message();
}
@ -352,7 +359,7 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::process_message()
stop_queue();
top_block->stop();
std::cout << std::endl;
//std::cout << std::endl;
}
}
@ -468,7 +475,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
EXPECT_NO_THROW( {
top_block->run(); // Start threads and wait
}) << "Failure running he top_block."<< std::endl;
}) << "Failure running the top_block."<< std::endl;
if (i == 0)
{
@ -483,6 +490,11 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
{
EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 2=ACQ FAIL.";
}
ASSERT_NO_THROW( {
ch_thread.timed_join(boost::posix_time::seconds(1));
}) << "Failure while waiting the queue to stop" << std::endl;
}
delete acquisition;
@ -561,15 +573,19 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProb
if (i == 0)
{
std::cout << "Probability of detection = " << Pd << std::endl;
std::cout << "Probability of false alarm (satellite present) = " << Pfa_p << std::endl;
// std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
std::cout << "Estimated probability of detection = " << Pd << std::endl;
std::cout << "Estimated probability of false alarm (satellite present) = " << Pfa_p << std::endl;
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
}
else if (i == 1)
{
std::cout << "Probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
// std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
std::cout << "Estimated probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
}
ASSERT_NO_THROW( {
ch_thread.timed_join(boost::posix_time::seconds(1));
}) << "Failure while waiting the queue to stop" << std::endl;
}
delete acquisition;

View File

@ -135,7 +135,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::config_1()
gnss_synchro.Channel_ID = 0;
gnss_synchro.System = 'E';
std::string signal = "1C";
signal.copy(gnss_synchro.Signal,2,0);
signal.copy(gnss_synchro.Signal, 2, 0);
integration_time_ms = 4;
fs_in = 4e6;
@ -206,7 +206,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::config_2()
gnss_synchro.Channel_ID = 0;
gnss_synchro.System = 'E';
std::string signal = "1C";
signal.copy(gnss_synchro.Signal,2,0);
signal.copy(gnss_synchro.Signal, 2, 0);
integration_time_ms = 4;
fs_in = 4e6;
@ -307,14 +307,14 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::wait_message()
acquisition->reset();
gettimeofday(&tv, NULL);
begin = tv.tv_sec *1e6 + tv.tv_usec;
begin = tv.tv_sec*1e6 + tv.tv_usec;
channel_internal_queue.wait_and_pop(message);
gettimeofday(&tv, NULL);
end = tv.tv_sec *1e6 + tv.tv_usec;
end = tv.tv_sec*1e6 + tv.tv_usec;
mean_acq_time_us += (end-begin);
mean_acq_time_us += (end - begin);
process_message();
}
@ -345,19 +345,17 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::process_message()
if (realization_counter == num_of_realizations)
{
mse_delay /= num_of_realizations;
mse_doppler /= num_of_realizations;
mse_delay /= (double)num_of_realizations;
mse_doppler /= (double)num_of_realizations;
Pd = (double)correct_estimation_counter / (double)num_of_realizations;
Pfa_a = (double)detection_counter / (double)num_of_realizations;
Pfa_p = (double)(detection_counter-correct_estimation_counter) / (double)num_of_realizations;
mean_acq_time_us /= num_of_realizations;
mean_acq_time_us /= (double)num_of_realizations;
stop_queue();
top_block->stop();
std::cout << std::endl;
}
}
@ -366,6 +364,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::stop_queue()
stop = true;
}
TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, Instantiate)
{
config_1();
@ -374,6 +373,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, Instantiate)
delete config;
}
TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
{
int nsamples = floor(fs_in*integration_time_ms*1e-3);
@ -391,17 +391,17 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, 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);
}) << "Failure connecting the blocks of acquisition test."<< std::endl;
}) << "Failure connecting the blocks of acquisition test." << std::endl;
EXPECT_NO_THROW( {
gettimeofday(&tv, NULL);
begin = tv.tv_sec *1e6 + tv.tv_usec;
begin = tv.tv_sec*1e6 + tv.tv_usec;
top_block->run(); // Start threads and wait
gettimeofday(&tv, NULL);
end = tv.tv_sec *1e6 + tv.tv_usec;
}) << "Failure running he top_block."<< std::endl;
end = tv.tv_sec*1e6 + tv.tv_usec;
}) << "Failure running the top_block."<< std::endl;
std::cout << "Processed " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl;
std::cout << "Processed " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl;
delete acquisition;
delete config;
@ -439,7 +439,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
ASSERT_NO_THROW( {
acquisition->connect(top_block);
}) << "Failure connecting acquisition to the top_block."<< std::endl;
}) << "Failure connecting acquisition to the top_block." << std::endl;
acquisition->init();
@ -452,7 +452,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
}) << "Failure connecting the blocks of acquisition test." << std::endl;
// i = 0 --> sallite in acquisition is visible
// i = 0 --> satellite in acquisition is visible
// i = 1 --> satellite in acquisition is not visible
for (unsigned int i = 0; i < 2; i++)
{
@ -473,7 +473,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
EXPECT_NO_THROW( {
top_block->run(); // Start threads and wait
}) << "Failure running he top_block."<< std::endl;
}) << "Failure running the top_block."<< std::endl;
if (i == 0)
{
@ -487,12 +487,18 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
{
EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 2=ACQ FAIL.";
}
}
delete acquisition;
delete config;
}
TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProbabilities)
{
config_2();
@ -561,18 +567,18 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProbabi
EXPECT_NO_THROW( {
top_block->run(); // Start threads and wait
}) << "Failure running he top_block."<< std::endl;
}) << "Failure running the top_block."<< std::endl;
if (i == 0)
{
std::cout << "Probability of detection = " << Pd << std::endl;
std::cout << "Probability of false alarm (satellite present) = " << Pfa_p << std::endl;
// std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
std::cout << "Estimated probability of detection = " << Pd << std::endl;
std::cout << "Estimated probability of false alarm (satellite present) = " << Pfa_p << std::endl;
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
}
else if (i == 1)
{
std::cout << "Probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
// std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
std::cout << "Estimated probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
}
}

View File

@ -131,8 +131,16 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoCTest::wait_message()
{
while (!stop)
{
channel_internal_queue.wait_and_pop(message);
stop_queue();
try
{
channel_internal_queue.wait_and_pop(message);
stop_queue();
}
catch( boost::exception & e )
{
DLOG(FATAL) << "Boost exception: " << boost::diagnostic_information(e);
}
}
}
@ -176,14 +184,14 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ConnectAndRun)
EXPECT_NO_THROW( {
gettimeofday(&tv, NULL);
begin = tv.tv_sec *1000000 + tv.tv_usec;
begin = tv.tv_sec*1000000 + tv.tv_usec;
top_block->run(); // Start threads and wait
gettimeofday(&tv, NULL);
end = tv.tv_sec *1000000 + tv.tv_usec;
}) << "Failure running he top_block."<< std::endl;
end = tv.tv_sec*1000000 + tv.tv_usec;
}) << "Failure running the top_block."<< std::endl;
delete acquisition;
std::cout << "Processed " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl;
std::cout << "Processed " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl;
}
@ -225,31 +233,37 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ValidationOfResults)
ASSERT_NO_THROW( {
acquisition->connect(top_block);
}) << "Failure connecting acquisition to the top_block."<< std::endl;
}) << "Failure connecting acquisition to the top_block."< < std::endl;
ASSERT_NO_THROW( {
std::string file = "../src/tests/signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.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);
top_block->connect(file_source, 0, acquisition->get_left_block(), 0);
}) << "Failure connecting the blocks of acquisition test."<< std::endl;
}) << "Failure connecting the blocks of acquisition test." << std::endl;
ASSERT_NO_THROW( {
start_queue();
acquisition->init();
acquisition->reset();
}) << "Failure !!!" << std::endl;
EXPECT_NO_THROW( {
gettimeofday(&tv, NULL);
begin = tv.tv_sec *1000000 + tv.tv_usec;
begin = tv.tv_sec*1000000 + tv.tv_usec;
top_block->run(); // Start threads and wait
gettimeofday(&tv, NULL);
end = tv.tv_sec *1000000 + tv.tv_usec;
}) << "Failure running he top_block."<< std::endl;
end = tv.tv_sec*1000000 + tv.tv_usec;
}) << "Failure running the top_block."<< std::endl;
ch_thread.join();
ASSERT_NO_THROW( {
ch_thread.timed_join(boost::posix_time::seconds(1));
}) << "Failure while waiting the queue to stop" << std::endl;
unsigned long int nsamples = gnss_synchro.Acq_samplestamp_samples;
std::cout << "Acquired " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl;
std::cout << "Acquired " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl;
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";

View File

@ -7,7 +7,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2013 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -53,88 +53,90 @@
class GalileoE1PcpsAmbiguousAcquisitionTest: public ::testing::Test
{
protected:
GalileoE1PcpsAmbiguousAcquisitionTest()
{
queue = gr::msg_queue::make(0);
top_block = gr::make_top_block("Acquisition test");
factory = new GNSSBlockFactory();
config = new InMemoryConfiguration();
item_size = sizeof(gr_complex);
stop = false;
message = 0;
}
GalileoE1PcpsAmbiguousAcquisitionTest()
{
queue = gr::msg_queue::make(0);
top_block = gr::make_top_block("Acquisition test");
factory = new GNSSBlockFactory();
config = new InMemoryConfiguration();
item_size = sizeof(gr_complex);
stop = false;
message = 0;
}
~GalileoE1PcpsAmbiguousAcquisitionTest()
{
delete factory;
delete config;
}
~GalileoE1PcpsAmbiguousAcquisitionTest()
{
delete factory;
delete config;
}
void init();
void start_queue();
void wait_message();
void stop_queue();
void init();
void start_queue();
void wait_message();
void stop_queue();
gr::msg_queue::sptr queue;
gr::top_block_sptr top_block;
GNSSBlockFactory* factory;
InMemoryConfiguration* config;
Gnss_Synchro gnss_synchro;
size_t item_size;
concurrent_queue<int> channel_internal_queue;
bool stop;
int message;
boost::thread ch_thread;
gr::msg_queue::sptr queue;
gr::top_block_sptr top_block;
GNSSBlockFactory* factory;
InMemoryConfiguration* config;
Gnss_Synchro gnss_synchro;
size_t item_size;
concurrent_queue<int> channel_internal_queue;
bool stop;
int message;
boost::thread ch_thread;
};
void GalileoE1PcpsAmbiguousAcquisitionTest::init()
{
gnss_synchro.Channel_ID = 0;
gnss_synchro.System = 'E';
std::string signal = "1C";
signal.copy(gnss_synchro.Signal, 2, 0);
gnss_synchro.PRN = 1;
gnss_synchro.Channel_ID = 0;
gnss_synchro.System = 'E';
std::string signal = "1C";
signal.copy(gnss_synchro.Signal, 2, 0);
gnss_synchro.PRN = 1;
config->set_property("GNSS-SDR.internal_fs_hz", "4000000");
config->set_property("Acquisition.item_type", "gr_complex");
config->set_property("Acquisition.if", "0");
config->set_property("GNSS-SDR.internal_fs_hz", "4000000");
config->set_property("Acquisition.item_type", "gr_complex");
config->set_property("Acquisition.if", "0");
config->set_property("Acquisition.coherent_integration_time_ms", "4");
config->set_property("Acquisition.dump", "false");
config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition");
config->set_property("Acquisition.threshold", "0.005");
config->set_property("Acquisition.doppler_max", "7000");
config->set_property("Acquisition.doppler_step", "125");
config->set_property("Acquisition.repeat_satellite", "false");
config->set_property("Acquisition1.cboc", "true");
config->set_property("Acquisition.dump", "false");
config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition");
config->set_property("Acquisition.threshold", "0.00001");
config->set_property("Acquisition.doppler_max", "7000");
config->set_property("Acquisition.doppler_step", "125");
config->set_property("Acquisition.repeat_satellite", "false");
config->set_property("Acquisition1.cboc", "true");
}
void GalileoE1PcpsAmbiguousAcquisitionTest::start_queue()
{
ch_thread = boost::thread(&GalileoE1PcpsAmbiguousAcquisitionTest::wait_message, this);
stop = false;
ch_thread = boost::thread(&GalileoE1PcpsAmbiguousAcquisitionTest::wait_message, this);
}
void GalileoE1PcpsAmbiguousAcquisitionTest::wait_message()
{
while (!stop)
{
channel_internal_queue.wait_and_pop(message);
stop_queue();
}
while (!stop)
{
channel_internal_queue.wait_and_pop(message);
stop_queue();
}
}
void GalileoE1PcpsAmbiguousAcquisitionTest::stop_queue()
{
stop = true;
stop = true;
}
TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, Instantiate)
{
init();
GalileoE1PcpsAmbiguousAcquisition *acquisition = new GalileoE1PcpsAmbiguousAcquisition(config, "Acquisition", 1, 1, queue);
delete acquisition;
init();
GalileoE1PcpsAmbiguousAcquisition *acquisition = new GalileoE1PcpsAmbiguousAcquisition(config, "Acquisition", 1, 1, queue);
delete acquisition;
}
@ -151,21 +153,19 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ConnectAndRun)
ASSERT_NO_THROW( {
acquisition->connect(top_block);
boost::shared_ptr<gr::analog::sig_source_c> source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
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);
}) << "Failure connecting the blocks of acquisition test."<< std::endl;
}) << "Failure connecting the blocks of acquisition test." << std::endl;
EXPECT_NO_THROW( {
gettimeofday(&tv, NULL);
begin = tv.tv_sec *1000000 + tv.tv_usec;
begin = tv.tv_sec*1000000 + tv.tv_usec;
top_block->run(); // Start threads and wait
gettimeofday(&tv, NULL);
end = tv.tv_sec *1000000 + tv.tv_usec;
}) << "Failure running he top_block."<< std::endl;
end = tv.tv_sec*1000000 + tv.tv_usec;
}) << "Failure running the top_block."<< std::endl;
delete acquisition;
std::cout << "Processed " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl;
@ -188,38 +188,39 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults)
ASSERT_NO_THROW( {
acquisition->set_gnss_synchro(&gnss_synchro);
}) << "Failure setting gnss_synchro."<< std::endl;
}) << "Failure setting gnss_synchro." << std::endl;
ASSERT_NO_THROW( {
acquisition->set_channel_queue(&channel_internal_queue);
}) << "Failure setting channel_internal_queue."<< std::endl;
}) << "Failure setting channel_internal_queue." << std::endl;
ASSERT_NO_THROW( {
acquisition->set_threshold(config->property("Acquisition.threshold", 0.0));
}) << "Failure setting threshold."<< std::endl;
}) << "Failure setting threshold." << std::endl;
ASSERT_NO_THROW( {
acquisition->set_doppler_max(config->property("Acquisition.doppler_max",
10000));
}) << "Failure setting doppler_max."<< std::endl;
acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000));
}) << "Failure setting doppler_max." << std::endl;
ASSERT_NO_THROW( {
acquisition->set_doppler_step(config->property("Acquisition.doppler_step",
500));
}) << "Failure setting doppler_step."<< std::endl;
acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500));
}) << "Failure setting doppler_step." << std::endl;
ASSERT_NO_THROW( {
acquisition->connect(top_block);
}) << "Failure connecting acquisition to the top_block."<< std::endl;
}) << "Failure connecting acquisition to the top_block." << std::endl;
ASSERT_NO_THROW( {
std::string file = "../src/tests/signal_samples/Galileo_E1_ID_1_Fs_4Msps_8ms.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);
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false);
top_block->connect(file_source, 0, acquisition->get_left_block(), 0);
}) << "Failure connecting the blocks of acquisition test."<< std::endl;
}) << "Failure connecting the blocks of acquisition test." << std::endl;
ASSERT_NO_THROW( {
start_queue();
}) << "Failure while starting the queue" << std::endl;
start_queue();
acquisition->init();
acquisition->reset();
@ -229,12 +230,14 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults)
top_block->run(); // Start threads and wait
gettimeofday(&tv, NULL);
end = tv.tv_sec *1000000 + tv.tv_usec;
}) << "Failure running he top_block."<< std::endl;
}) << "Failure running the top_block."<< std::endl;
ch_thread.join();
ASSERT_NO_THROW( {
ch_thread.timed_join(boost::posix_time::seconds(1));
}) << "Failure while waiting the queue to stop" << std::endl;
unsigned long int nsamples = gnss_synchro.Acq_samplestamp_samples;
std::cout << "Acquired " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl;
std::cout << "Acquired " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl;
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
double delay_error_samples = abs(expected_delay_samples - gnss_synchro.Acq_delay_samples);

View File

@ -485,6 +485,10 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResults)
{
EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 2=ACQ FAIL.";
}
ASSERT_NO_THROW( {
ch_thread.timed_join(boost::posix_time::seconds(1));
}) << "Failure while waiting the queue to stop" << std::endl;
}
delete acquisition;
@ -563,15 +567,18 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResultsProbabili
if (i == 0)
{
std::cout << "Probability of detection = " << Pd << std::endl;
std::cout << "Probability of false alarm (satellite present) = " << Pfa_p << std::endl;
// std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
std::cout << "Estimated probability of detection = " << Pd << std::endl;
std::cout << "Estimated probability of false alarm (satellite present) = " << Pfa_p << std::endl;
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
}
else if (i == 1)
{
std::cout << "Probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
// std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
}
ASSERT_NO_THROW( {
ch_thread.timed_join(boost::posix_time::seconds(1));
}) << "Failure while waiting the queue to stop" << std::endl;
}
delete acquisition;

View File

@ -471,7 +471,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
EXPECT_NO_THROW( {
top_block->run(); // Start threads and wait
}) << "Failure running he top_block."<< std::endl;
}) << "Failure running the top_block."<< std::endl;
if (i == 0)
{
@ -485,6 +485,10 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
{
EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 2=ACQ FAIL.";
}
ASSERT_NO_THROW( {
ch_thread.timed_join(boost::posix_time::seconds(1));
}) << "Failure while waiting the queue to stop" << std::endl;
}
delete acquisition;
@ -559,19 +563,22 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsPro
EXPECT_NO_THROW( {
top_block->run(); // Start threads and wait
}) << "Failure running he top_block."<< std::endl;
}) << "Failure running the top_block."<< std::endl;
if (i == 0)
{
std::cout << "Probability of detection = " << Pd << std::endl;
std::cout << "Probability of false alarm (satellite present) = " << Pfa_p << std::endl;
// std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
std::cout << "Estimated probability of detection = " << Pd << std::endl;
std::cout << "Estimated probability of false alarm (satellite present) = " << Pfa_p << std::endl;
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
}
else if (i == 1)
{
std::cout << "Probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
// std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
std::cout << "Estimated probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
}
ASSERT_NO_THROW( {
ch_thread.timed_join(boost::posix_time::seconds(1));
}) << "Failure while waiting the queue to stop" << std::endl;
}
delete acquisition;

View File

@ -47,9 +47,9 @@
#include "gnss_synchro.h"
#include "gps_l1_ca_pcps_acquisition.h"
#include "signal_generator.h"
#include "signal_generator.cc"
//#include "signal_generator.cc"
#include "signal_generator_c.h"
#include "signal_generator_c.cc"
//#include "signal_generator_c.cc"
#include "fir_filter.h"
#include "gen_signal_source.h"
#include "gnss_sdr_valve.h"
@ -352,8 +352,6 @@ void GpsL1CaPcpsAcquisitionGSoC2013Test::process_message()
stop_queue();
top_block->stop();
std::cout << std::endl;
}
}
@ -561,14 +559,13 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResultsProbabilities)
if (i == 0)
{
std::cout << "Probability of detection = " << Pd << std::endl;
std::cout << "Probability of false alarm (satellite present) = " << Pfa_p << std::endl;
// std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
}
std::cout << "Estimated probability of detection = " << Pd << std::endl;
std::cout << "Estimated probability of false alarm (satellite present) = " << Pfa_p << std::endl;
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl; }
else if (i == 1)
{
std::cout << "Probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
// std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
std::cout << "Estimated probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
}
}

View File

@ -53,7 +53,7 @@ class GpsL1CaPcpsAcquisitionTest: public ::testing::Test
{
protected:
GpsL1CaPcpsAcquisitionTest()
{
{
queue = gr::msg_queue::make(0);
top_block = gr::make_top_block("Acquisition test");
factory = new GNSSBlockFactory();
@ -61,7 +61,7 @@ protected:
item_size = sizeof(gr_complex);
stop = false;
message = 0;
}
}
~GpsL1CaPcpsAcquisitionTest()
{
@ -92,8 +92,8 @@ void GpsL1CaPcpsAcquisitionTest::init()
gnss_synchro.Channel_ID = 0;
gnss_synchro.System = 'G';
std::string signal = "1C";
signal.copy(gnss_synchro.Signal,2,0);
gnss_synchro.PRN=1;
signal.copy(gnss_synchro.Signal, 2, 0);
gnss_synchro.PRN = 1;
config->set_property("GNSS-SDR.internal_fs_hz", "4000000");
config->set_property("Acquisition.item_type", "gr_complex");
@ -101,7 +101,7 @@ 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.005");
config->set_property("Acquisition.threshold", "0.000");
config->set_property("Acquisition.doppler_max", "7200");
config->set_property("Acquisition.doppler_step", "600");
config->set_property("Acquisition.repeat_satellite", "false");
@ -167,7 +167,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ConnectAndRun)
}) << "Failure running the top_block."<< std::endl;
delete acquisition;
std::cout << "Processed " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl;
std::cout << "Processed " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl;
}
@ -183,36 +183,34 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults)
ASSERT_NO_THROW( {
acquisition->set_channel(1);
}) << "Failure setting channel."<< std::endl;
}) << "Failure setting channel." << std::endl;
ASSERT_NO_THROW( {
acquisition->set_gnss_synchro(&gnss_synchro);
}) << "Failure setting gnss_synchro."<< std::endl;
}) << "Failure setting gnss_synchro." << std::endl;
ASSERT_NO_THROW( {
acquisition->set_channel_queue(&channel_internal_queue);
}) << "Failure setting channel_internal_queue."<< std::endl;
}) << "Failure setting channel_internal_queue." << std::endl;
ASSERT_NO_THROW( {
acquisition->set_threshold(config->property("Acquisition.threshold", 0.0));
}) << "Failure setting threshold."<< std::endl;
}) << "Failure setting threshold." << std::endl;
ASSERT_NO_THROW( {
acquisition->set_doppler_max(config->property("Acquisition.doppler_max",
10000));
}) << "Failure setting doppler_max."<< std::endl;
acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000));
}) << "Failure setting doppler_max." << std::endl;
ASSERT_NO_THROW( {
acquisition->set_doppler_step(config->property("Acquisition.doppler_step",
500));
}) << "Failure setting doppler_step."<< std::endl;
acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500));
}) << "Failure setting doppler_step." << std::endl;
ASSERT_NO_THROW( {
acquisition->connect(top_block);
}) << "Failure connecting acquisition to the top_block."<< std::endl;
}) << "Failure connecting acquisition to the top_block." << std::endl;
ASSERT_NO_THROW( {
std::string file = "../src/tests/signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
std::string file = "../src/tests/signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.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);
top_block->connect(file_source, 0, acquisition->get_left_block(), 0);
@ -225,16 +223,16 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults)
EXPECT_NO_THROW( {
gettimeofday(&tv, NULL);
begin = tv.tv_sec *1000000 + tv.tv_usec;
begin = tv.tv_sec*1000000 + tv.tv_usec;
top_block->run(); // Start threads and wait
gettimeofday(&tv, NULL);
end = tv.tv_sec *1000000 + tv.tv_usec;
}) << "Failure running he top_block."<< std::endl;
end = tv.tv_sec*1000000 + tv.tv_usec;
}) << "Failure running the top_block."<< std::endl;
ch_thread.join();
ch_thread.timed_join(boost::posix_time::seconds(1));
unsigned long int nsamples = gnss_synchro.Acq_samplestamp_samples;
std::cout << "Acquired " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl;
std::cout << "Acquired " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl;
ASSERT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";

View File

@ -54,6 +54,10 @@
#include "gen_signal_source.h"
#include "gnss_sdr_valve.h"
#include "boost/shared_ptr.hpp"
#include "signal_generator.h"
#include "signal_generator.cc"
#include "signal_generator_c.h"
#include "signal_generator_c.cc"
class GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test: public ::testing::Test

View File

@ -7,7 +7,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2013 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -47,9 +47,7 @@
#include "gnss_synchro.h"
#include "gps_l1_ca_pcps_opencl_acquisition.h"
#include "signal_generator.h"
//#include "signal_generator.cc"
#include "signal_generator_c.h"
//#include "signal_generator_c.cc"
#include "fir_filter.h"
#include "gen_signal_source.h"
#include "gnss_sdr_valve.h"
@ -203,7 +201,7 @@ void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::config_2()
gnss_synchro.Channel_ID = 0;
gnss_synchro.System = 'G';
std::string signal = "1C";
signal.copy(gnss_synchro.Signal,2,0);
signal.copy(gnss_synchro.Signal, 2, 0);
integration_time_ms = 1;
fs_in = 4e6;
@ -213,7 +211,7 @@ void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::config_2()
max_doppler_error_hz = 2/(3*integration_time_ms*1e-3);
max_delay_error_chips = 0.50;
num_of_realizations = 100;
num_of_realizations = 10; // Change here the number of realizations
config = new InMemoryConfiguration();
@ -322,7 +320,7 @@ void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::process_message()
detection_counter++;
// The term -5 is here to correct the additional delay introduced by the FIR filter
double delay_error_chips = abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples-5)*1023.0/((double)fs_in*1e-3));
double delay_error_chips = abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples- 5 )*1023.0/((double)fs_in*1e-3));
double doppler_error_hz = abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz);
mse_delay += std::pow(delay_error_chips, 2);
@ -398,7 +396,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ConnectAndRun)
end = tv.tv_sec *1e6 + tv.tv_usec;
}) << "Failure running the top_block."<< std::endl;
std::cout << "Processed " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl;
std::cout << "Processed " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl;
delete acquisition;
delete config;
@ -470,7 +468,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResults)
EXPECT_NO_THROW( {
top_block->run(); // Start threads and wait
}) << "Failure running he top_block."<< std::endl;
}) << "Failure running the top_block."<< std::endl;
if (i == 0)
{
@ -559,18 +557,18 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResultsProbabilitie
EXPECT_NO_THROW( {
top_block->run(); // Start threads and wait
}) << "Failure running he top_block."<< std::endl;
}) << "Failure running the top_block."<< std::endl;
if (i == 0)
{
std::cout << "Probability of detection = " << Pd << std::endl;
std::cout << "Probability of false alarm (satellite present) = " << Pfa_p << std::endl;
// std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
std::cout << "Estimated probability of detection = " << Pd << std::endl;
std::cout << "Estimated probability of false alarm (satellite present) = " << Pfa_p << std::endl;
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
}
else if (i == 1)
{
std::cout << "Probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
// std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
std::cout << "Estimated probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
}
}

View File

@ -307,9 +307,9 @@ void GpsL1CaPcpsTongAcquisitionGSoC2013Test::wait_message()
channel_internal_queue.wait_and_pop(message);
gettimeofday(&tv, NULL);
end = tv.tv_sec *1e6 + tv.tv_usec;
end = tv.tv_sec*1e6 + tv.tv_usec;
mean_acq_time_us += (end-begin);
mean_acq_time_us += (end - begin);
process_message();
}
@ -395,7 +395,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ConnectAndRun)
end = tv.tv_sec *1e6 + tv.tv_usec;
}) << "Failure running the top_block."<< std::endl;
std::cout << "Processed " << nsamples << " samples in " << (end-begin) << " microseconds" << std::endl;
std::cout << "Processed " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl;
delete acquisition;
delete config;
}
@ -466,7 +466,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResults)
EXPECT_NO_THROW( {
top_block->run(); // Start threads and wait
}) << "Failure running he top_block."<< std::endl;
}) << "Failure running the top_block."<< std::endl;
if (i == 0)
{
@ -555,18 +555,18 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResultsProbabilities)
EXPECT_NO_THROW( {
top_block->run(); // Start threads and wait
}) << "Failure running he top_block."<< std::endl;
}) << "Failure running the top_block."<< std::endl;
if (i == 0)
{
std::cout << "Probability of detection = " << Pd << std::endl;
std::cout << "Probability of false alarm (satellite present) = " << Pfa_p << std::endl;
// std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
std::cout << "Estimated probability of detection = " << Pd << std::endl;
std::cout << "Estimated probability of false alarm (satellite present) = " << Pfa_p << std::endl;
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
}
else if (i == 1)
{
std::cout << "Probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
// std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
std::cout << "Estimated probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
}
}

View File

@ -54,6 +54,27 @@ concurrent_map<Gps_Ephemeris> global_gps_ephemeris_map;
concurrent_map<Gps_Iono> global_gps_iono_map;
concurrent_map<Gps_Utc_Model> global_gps_utc_model_map;
concurrent_queue<Galileo_Ephemeris> global_galileo_ephemeris_queue;
concurrent_queue<Galileo_Iono> global_galileo_iono_queue;
concurrent_queue<Galileo_Utc_Model> global_galileo_utc_model_queue;
concurrent_queue<Galileo_Almanac> global_galileo_almanac_queue;
concurrent_map<Galileo_Ephemeris> global_galileo_ephemeris_map;
concurrent_map<Galileo_Iono> global_galileo_iono_map;
concurrent_map<Galileo_Utc_Model> global_galileo_utc_model_map;
concurrent_map<Galileo_Almanac> global_galileo_almanac_map;
concurrent_queue<Sbas_Raw_Msg> global_sbas_raw_msg_queue;
concurrent_queue<Sbas_Ionosphere_Correction> global_sbas_iono_queue;
concurrent_queue<Sbas_Satellite_Correction> global_sbas_sat_corr_queue;
concurrent_queue<Sbas_Ephemeris> global_sbas_ephemeris_queue;
concurrent_map<Sbas_Ionosphere_Correction> global_sbas_iono_map;
concurrent_map<Sbas_Satellite_Correction> global_sbas_sat_corr_map;
concurrent_map<Sbas_Ephemeris> global_sbas_ephemeris_map;
int main(int argc, char **argv)
{
google::ParseCommandLineFlags(&argc, &argv, true);