1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-14 09:16:51 +00:00

Acquisition, Tracking and TelemetryDecoder blocks now use Gnss_Satellite class and have access to know what parameters have to use. Algorithms are not system-related anymore.

Some code cleaning and and enhancements in the output screen messages.

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@135 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Carles Fernandez 2012-01-20 23:28:11 +00:00
parent b72802a51f
commit 80af09f91f
20 changed files with 197 additions and 140 deletions

View File

@ -286,7 +286,9 @@ bool gps_l1_ca_ls_pvt::get_PVT(std::map<int,gnss_pseudorange> gnss_pseudoranges_
// Compute UTC time and print PVT solution // Compute UTC time and print PVT solution
boost::posix_time::time_duration t = boost::posix_time::seconds(utc + 604800*(double)GPS_week); boost::posix_time::time_duration t = boost::posix_time::seconds(utc + 604800*(double)GPS_week);
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
std::cout << "Position at " << boost::posix_time::to_simple_string(p_time) <<" is Lat = " << d_latitude_d << " [deg] Long = " << d_longitude_d << " [deg] Height= " << d_height_m << " [m]" << std::endl; std::cout << "Position at " << boost::posix_time::to_simple_string(p_time)
<< " is Lat = " << d_latitude_d << " [deg], Long = " << d_longitude_d
<< " [deg], Height= " << d_height_m << " [m]" << std::endl;
// ######## LOG FILE ######### // ######## LOG FILE #########
if(d_flag_dump_enabled == true) if(d_flag_dump_enabled == true)
{ {

View File

@ -173,7 +173,7 @@ void Channel::set_satellite(Gnss_Satellite satellite)
gnss_satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); gnss_satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
acq_->set_satellite(gnss_satellite_); acq_->set_satellite(gnss_satellite_);
trk_->set_satellite(gnss_satellite_); trk_->set_satellite(gnss_satellite_);
nav_->set_satellite(satellite.get_PRN()); nav_->set_satellite(gnss_satellite_);
} }

View File

@ -81,6 +81,14 @@ GpsL1CaTelemetryDecoder::~GpsL1CaTelemetryDecoder()
{} {}
void GpsL1CaTelemetryDecoder::set_satellite(Gnss_Satellite satellite)
{
satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
telemetry_decoder_->set_satellite(satellite_);
DLOG(INFO) << "TELEMETRY DECODER: satellite set to " << satellite_;
}
void GpsL1CaTelemetryDecoder::connect(gr_top_block_sptr top_block) void GpsL1CaTelemetryDecoder::connect(gr_top_block_sptr top_block)
{ {
// Nothing to connect internally // Nothing to connect internally

View File

@ -69,7 +69,7 @@ public:
gr_basic_block_sptr get_left_block(); gr_basic_block_sptr get_left_block();
gr_basic_block_sptr get_right_block(); gr_basic_block_sptr get_right_block();
void set_satellite(int satellite){telemetry_decoder_->set_satellite(satellite);}; void set_satellite(Gnss_Satellite satellite);
void set_channel(int channel){telemetry_decoder_->set_channel(channel);}; void set_channel(int channel){telemetry_decoder_->set_channel(channel);};
void reset() void reset()
@ -85,7 +85,7 @@ private:
gps_l1_ca_telemetry_decoder_cc_sptr telemetry_decoder_; gps_l1_ca_telemetry_decoder_cc_sptr telemetry_decoder_;
int satellite_; Gnss_Satellite satellite_;
int channel_; int channel_;
unsigned int vector_length_; unsigned int vector_length_;
std::string item_type_; std::string item_type_;

View File

@ -50,7 +50,7 @@ using google::LogMessage;
* \todo name and move the magic numbers to GPS_L1_CA.h * \todo name and move the magic numbers to GPS_L1_CA.h
*/ */
gps_l1_ca_telemetry_decoder_cc_sptr gps_l1_ca_telemetry_decoder_cc_sptr
gps_l1_ca_make_telemetry_decoder_cc(unsigned int satellite, long if_freq, long fs_in, unsigned gps_l1_ca_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned
int vector_length, gr_msg_queue_sptr queue, bool dump) int vector_length, gr_msg_queue_sptr queue, bool dump)
{ {
@ -70,7 +70,7 @@ void gps_l1_ca_telemetry_decoder_cc::forecast (int noutput_items, gr_vector_int
gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(unsigned int satellite, long if_freq, long fs_in, unsigned gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned
int vector_length, gr_msg_queue_sptr queue, bool dump) : int vector_length, gr_msg_queue_sptr queue, bool dump) :
gr_block ("gps_navigation_cc", gr_make_io_signature (5, 5, sizeof(double)), gr_block ("gps_navigation_cc", gr_make_io_signature (5, 5, sizeof(double)),
gr_make_io_signature(1, 1, sizeof(gnss_synchro))) gr_make_io_signature(1, 1, sizeof(gnss_synchro)))
@ -78,7 +78,8 @@ gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(unsigned int sate
// initialize internal vars // initialize internal vars
d_queue = queue; d_queue = queue;
d_dump = dump; d_dump = dump;
d_satellite = satellite; d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
DLOG(INFO) << "TELEMETRY PROCESSING: satellite " << d_satellite;
d_vector_length = vector_length; d_vector_length = vector_length;
d_samples_per_bit = ( GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS ) / GPS_CA_TELEMETRY_RATE_BITS_SECOND; d_samples_per_bit = ( GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS ) / GPS_CA_TELEMETRY_RATE_BITS_SECOND;
d_fs_in = fs_in; d_fs_in = fs_in;
@ -170,6 +171,8 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i
gnss_synchro **out = (gnss_synchro **) &output_items[0]; gnss_synchro **out = (gnss_synchro **) &output_items[0];
d_sample_counter++; //count for the processed samples d_sample_counter++; //count for the processed samples
DLOG(INFO) << "Sample counter: " << d_sample_counter;
const double **in = (const double **) &input_items[0]; //Get the input samples pointer const double **in = (const double **) &input_items[0]; //Get the input samples pointer
// ########### Output the tracking data to navigation and PVT ########## // ########### Output the tracking data to navigation and PVT ##########
// Output channel 0: Prompt correlator output Q // Output channel 0: Prompt correlator output Q
@ -219,7 +222,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i
{ {
d_GPS_FSM.Event_gps_word_preamble(); d_GPS_FSM.Event_gps_word_preamble();
d_preamble_index = d_sample_counter;//record the preamble sample stamp d_preamble_index = d_sample_counter;//record the preamble sample stamp
std::cout << "Preamble detection for SAT " << d_satellite << std::endl; std::cout << "Preamble detection for SAT " << this->d_satellite << std::endl;
d_symbol_accumulator = 0; //sync the symbol to bits integrator d_symbol_accumulator = 0; //sync the symbol to bits integrator
d_symbol_accumulator_counter = 0; d_symbol_accumulator_counter = 0;
d_frame_bit_index = 8; d_frame_bit_index = 8;
@ -239,7 +242,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i
if (!d_flag_frame_sync) if (!d_flag_frame_sync)
{ {
d_flag_frame_sync = true; d_flag_frame_sync = true;
std::cout <<" Frame sync SAT " << d_satellite << " with preamble start at " << d_preamble_time_seconds << " [s]" << std::endl; std::cout <<" Frame sync SAT " << this->d_satellite << " with preamble start at " << d_preamble_time_seconds << " [s]" << std::endl;
} }
} }
} }
@ -320,26 +323,27 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i
// output the frame // output the frame
consume_each(1); //one by one consume_each(1); //one by one
DLOG(INFO) << "TELEMETRY PROCESSED for satellite " << this->d_satellite;
//! \todo This has to be documented!!!!
//! \todo This has to be documented and included in the header!!!!
gps_synchro.valid_word = (d_flag_frame_sync == true and d_flag_parity == true); gps_synchro.valid_word = (d_flag_frame_sync == true and d_flag_parity == true);
gps_synchro.flag_preamble = d_flag_preamble; gps_synchro.flag_preamble = d_flag_preamble;
gps_synchro.preamble_delay_ms = d_preamble_time_seconds*1000.0; gps_synchro.preamble_delay_ms = d_preamble_time_seconds*1000.0;
gps_synchro.prn_delay_ms = (in[2][0] - d_preamble_duration_seconds)*1000.0; gps_synchro.prn_delay_ms = (in[2][0] - d_preamble_duration_seconds)*1000.0;
gps_synchro.preamble_code_phase_ms = d_preamble_code_phase_seconds*1000.0; gps_synchro.preamble_code_phase_ms = d_preamble_code_phase_seconds*1000.0;
gps_synchro.preamble_code_phase_correction_ms = (in[4][0] - d_preamble_code_phase_seconds)*1000.0; gps_synchro.preamble_code_phase_correction_ms = (in[4][0] - d_preamble_code_phase_seconds)*1000.0;
gps_synchro.satellite_PRN = d_satellite; gps_synchro.satellite_PRN = this->d_satellite.get_PRN();
gps_synchro.channel_ID = d_channel; gps_synchro.channel_ID = d_channel;
*out[0] = gps_synchro; *out[0] = gps_synchro;
return 1; return 1;
} }
void gps_l1_ca_telemetry_decoder_cc::set_satellite(int satellite) void gps_l1_ca_telemetry_decoder_cc::set_satellite(Gnss_Satellite satellite)
{ {
d_satellite = satellite; d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
d_GPS_FSM.i_satellite_PRN = satellite; LOG_AT_LEVEL(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite;
d_GPS_FSM.i_satellite_PRN = d_satellite.get_PRN();
LOG_AT_LEVEL(INFO) << "Navigation Satellite set to " << d_satellite; LOG_AT_LEVEL(INFO) << "Navigation Satellite set to " << d_satellite;
} }

View File

@ -40,6 +40,7 @@
#include <gnuradio/gr_block.h> #include <gnuradio/gr_block.h>
#include <gnuradio/gr_msg_queue.h> #include <gnuradio/gr_msg_queue.h>
//#include <gnuradio/gr_sync_block.h> //#include <gnuradio/gr_sync_block.h>
#include "gnss_satellite.h"
@ -48,7 +49,7 @@ class gps_l1_ca_telemetry_decoder_cc;
typedef boost::shared_ptr<gps_l1_ca_telemetry_decoder_cc> gps_l1_ca_telemetry_decoder_cc_sptr; typedef boost::shared_ptr<gps_l1_ca_telemetry_decoder_cc> gps_l1_ca_telemetry_decoder_cc_sptr;
gps_l1_ca_telemetry_decoder_cc_sptr gps_l1_ca_telemetry_decoder_cc_sptr
gps_l1_ca_make_telemetry_decoder_cc(unsigned int satellite, long if_freq, long fs_in, unsigned gps_l1_ca_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned
int vector_length, gr_msg_queue_sptr queue, bool dump); int vector_length, gr_msg_queue_sptr queue, bool dump);
/*! /*!
@ -61,8 +62,8 @@ public:
~gps_l1_ca_telemetry_decoder_cc(); ~gps_l1_ca_telemetry_decoder_cc();
void set_satellite(int satellite); //!< Set satellite PRN void set_satellite(Gnss_Satellite satellite); //!< Set satellite PRN
void set_channel(int channel); //!< Set receiver's channel void set_channel(int channel); //!< Set receiver's channel
/*! /*!
* \brief Set the navigation queue * \brief Set the navigation queue
@ -78,10 +79,10 @@ public:
private: private:
friend gps_l1_ca_telemetry_decoder_cc_sptr friend gps_l1_ca_telemetry_decoder_cc_sptr
gps_l1_ca_make_telemetry_decoder_cc(unsigned int satellite, long if_freq, long fs_in,unsigned gps_l1_ca_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in,unsigned
int vector_length, gr_msg_queue_sptr queue, bool dump); int vector_length, gr_msg_queue_sptr queue, bool dump);
gps_l1_ca_telemetry_decoder_cc(unsigned int satellite, long if_freq, long fs_in,unsigned gps_l1_ca_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in,unsigned
int vector_length, gr_msg_queue_sptr queue, bool dump); int vector_length, gr_msg_queue_sptr queue, bool dump);
bool gps_word_parityCheck(unsigned int gpsword); bool gps_word_parityCheck(unsigned int gpsword);
@ -120,7 +121,7 @@ private:
gr_msg_queue_sptr d_queue; gr_msg_queue_sptr d_queue;
unsigned int d_vector_length; unsigned int d_vector_length;
bool d_dump; bool d_dump;
int d_satellite; Gnss_Satellite d_satellite;
int d_channel; int d_channel;
//std::deque<double> d_prn_start_sample_history; //std::deque<double> d_prn_start_sample_history;

View File

@ -214,7 +214,7 @@ GpsL1CaSubframeFsm::GpsL1CaSubframeFsm()
void GpsL1CaSubframeFsm::gps_word_to_subframe(int position) void GpsL1CaSubframeFsm::gps_word_to_subframe(int position)
{ {
// insert the word in the correct position of the subframe // insert the word in the correct position of the subframe
std::memcpy(&d_subframe[position*GPS_WORD_LENGTH],&d_GPS_frame_4bytes,sizeof(char)*GPS_WORD_LENGTH); std::memcpy(&d_subframe[position*GPS_WORD_LENGTH], &d_GPS_frame_4bytes, sizeof(char)*GPS_WORD_LENGTH);
} }
@ -225,19 +225,20 @@ void GpsL1CaSubframeFsm::gps_subframe_to_nav_msg()
{ {
int subframe_ID; int subframe_ID;
// NEW GPS SUBFRAME HAS ARRIVED! // NEW GPS SUBFRAME HAS ARRIVED!
subframe_ID=d_nav.subframe_decoder(this->d_subframe); //decode the subframe subframe_ID = d_nav.subframe_decoder(this->d_subframe); //decode the subframe
std::cout<<"NAVIGATION FSM: received subframe "<<subframe_ID<<" for satellite "<<d_nav.i_satellite_PRN<<std::endl; //std::cout<<"Detected PRN: " << d_nav.i_satellite_PRN << " for satellite " <<
d_nav.i_satellite_PRN=i_satellite_PRN; std::cout << "NAVIGATION FSM: received subframe " << subframe_ID << " for satellite " << Gnss_Satellite(std::string("GPS"), i_satellite_PRN) << std::endl;
d_nav.i_channel_ID=i_channel_ID; d_nav.i_satellite_PRN = i_satellite_PRN;
if (subframe_ID==1) d_nav.i_channel_ID = i_channel_ID;
if (subframe_ID == 1)
{ {
d_nav.d_subframe1_timestamp_ms=this->d_preamble_time_ms; d_nav.d_subframe1_timestamp_ms = this->d_preamble_time_ms;
//std::cout<<"NAVIGATION FSM: set subframe 1 preamble timestamp for satellite "<<d_nav.i_satellite_PRN<<std::endl; //std::cout<<"NAVIGATION FSM: set subframe 1 preamble timestamp for satellite "<<d_nav.i_satellite_PRN<<std::endl;
} }
/*! /*!
* \todo change satellite validation to subframe 5 because it will have a complete set of ephemeris parameters * \todo change satellite validation to subframe 5 because it will have a complete set of ephemeris parameters
*/ */
if (subframe_ID==3) if (subframe_ID == 3)
{ // if the subframe is the 5th, then { // if the subframe is the 5th, then
if (d_nav.satellite_validation()) // if all the satellite ephemeris parameters are good, then if (d_nav.satellite_validation()) // if all the satellite ephemeris parameters are good, then
{ {

View File

@ -71,7 +71,7 @@ public:
// channel and satellite info // channel and satellite info
int i_channel_ID; int i_channel_ID;
int i_satellite_PRN; unsigned int i_satellite_PRN;
// ephemeris queue // ephemeris queue
concurrent_queue<Gps_Navigation_Message> *d_nav_queue; concurrent_queue<Gps_Navigation_Message> *d_nav_queue;

View File

@ -125,8 +125,8 @@ void GpsL1CaDllFllPllTracking::start_tracking()
void GpsL1CaDllFllPllTracking::set_satellite(Gnss_Satellite satellite) void GpsL1CaDllFllPllTracking::set_satellite(Gnss_Satellite satellite)
{ {
satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
tracking_->set_satellite(satellite); tracking_->set_satellite(satellite_);
DLOG(INFO) << "satellite set to " << satellite_; DLOG(INFO) << "DLL - PLL/FLL Tracking block now tracks satellite " << satellite_;
} }
void GpsL1CaDllFllPllTracking::set_channel(unsigned int channel) void GpsL1CaDllFllPllTracking::set_channel(unsigned int channel)

View File

@ -118,8 +118,8 @@ void GpsL1CaDllPllTracking::start_tracking()
void GpsL1CaDllPllTracking::set_satellite(Gnss_Satellite satellite) void GpsL1CaDllPllTracking::set_satellite(Gnss_Satellite satellite)
{ {
satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
tracking_->set_satellite(satellite); tracking_->set_satellite(satellite_);
DLOG(INFO) << "satellite set to " << satellite_; DLOG(INFO) << "DLL - PLL Tracking block now tracks satellite " << satellite_;
} }
/* /*

View File

@ -189,7 +189,7 @@ void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::start_tracking()
d_FLL_wait = 1; d_FLL_wait = 1;
// generate local reference ALWAYS starting at chip 1 (1 sample per chip) // generate local reference ALWAYS starting at chip 1 (1 sample per chip)
code_gen_conplex(&d_ca_code[1], d_satellite.get_PRN(), 0); code_gen_conplex(&d_ca_code[1], this->d_satellite.get_PRN(), 0);
d_ca_code[0] = d_ca_code[(int)GPS_L1_CA_CODE_LENGTH_CHIPS]; d_ca_code[0] = d_ca_code[(int)GPS_L1_CA_CODE_LENGTH_CHIPS];
d_ca_code[(int)GPS_L1_CA_CODE_LENGTH_CHIPS + 1] = d_ca_code[1]; d_ca_code[(int)GPS_L1_CA_CODE_LENGTH_CHIPS + 1] = d_ca_code[1];
@ -496,8 +496,8 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
if (floor(d_sample_counter/d_fs_in) != d_last_seg) if (floor(d_sample_counter/d_fs_in) != d_last_seg)
{ {
d_last_seg = floor(d_sample_counter/d_fs_in); d_last_seg = floor(d_sample_counter/d_fs_in);
std::cout << "Current input signal time=" << d_last_seg << " [s]" << std::endl; std::cout << "Current input signal time = " << d_last_seg << " [s]" << std::endl;
std::cout << "Tracking CH "<< d_channel << " CN0=" << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl; std::cout << "Tracking CH " << d_channel << ": Satellite " << this->d_satellite << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl;
//std::cout<<"TRK CH "<<d_channel<<" Carrier_lock_test="<<d_carrier_lock_test<< std::endl; //std::cout<<"TRK CH "<<d_channel<<" Carrier_lock_test="<<d_carrier_lock_test<< std::endl;
//if (d_last_seg==5) d_carrier_lock_fail_counter=500; //DEBUG: force unlock! //if (d_last_seg==5) d_carrier_lock_fail_counter=500; //DEBUG: force unlock!
} }
@ -507,7 +507,7 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
if (floor(d_sample_counter/d_fs_in) != d_last_seg) if (floor(d_sample_counter/d_fs_in) != d_last_seg)
{ {
d_last_seg = floor(d_sample_counter/d_fs_in); d_last_seg = floor(d_sample_counter/d_fs_in);
std::cout << "Tracking CH " << d_channel << " CN0=" << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl; std::cout << "Tracking CH " << d_channel << ": Satellite " << this->d_satellite << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl;
//std::cout<<"TRK CH "<<d_channel<<" Carrier_lock_test="<<d_carrier_lock_test<< std::endl; //std::cout<<"TRK CH "<<d_channel<<" Carrier_lock_test="<<d_carrier_lock_test<< std::endl;
} }
} }

View File

@ -493,8 +493,8 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_in
if (floor(d_sample_counter / d_fs_in) != d_last_seg) if (floor(d_sample_counter / d_fs_in) != d_last_seg)
{ {
d_last_seg = floor(d_sample_counter / d_fs_in); d_last_seg = floor(d_sample_counter / d_fs_in);
std::cout << "Current input signal time=" << d_last_seg << " [s]" << std::endl; std::cout << "Current input signal time = " << d_last_seg << " [s]" << std::endl;
std::cout << "Tracking CH " << d_channel << " CN0=" << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl; std::cout << "Tracking CH " << d_channel << ": Satellite " << this->d_satellite << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl;
//std::cout<<"TRK CH "<<d_channel<<" Carrier_lock_test="<<d_carrier_lock_test<< std::endl; //std::cout<<"TRK CH "<<d_channel<<" Carrier_lock_test="<<d_carrier_lock_test<< std::endl;
//if (d_last_seg==5) d_carrier_lock_fail_counter=500; //DEBUG: force unlock! //if (d_last_seg==5) d_carrier_lock_fail_counter=500; //DEBUG: force unlock!
} }
@ -504,7 +504,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_in
if (floor(d_sample_counter / d_fs_in) != d_last_seg) if (floor(d_sample_counter / d_fs_in) != d_last_seg)
{ {
d_last_seg = floor(d_sample_counter / d_fs_in); d_last_seg = floor(d_sample_counter / d_fs_in);
std::cout << "Tracking CH "<< d_channel << " CN0=" << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl; std::cout << "Tracking CH " << d_channel << ": Satellite " << this->d_satellite << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl;
//std::cout<<"TRK CH "<<d_channel<<" Carrier_lock_test="<<d_carrier_lock_test<< std::endl; //std::cout<<"TRK CH "<<d_channel<<" Carrier_lock_test="<<d_carrier_lock_test<< std::endl;
} }
} }

View File

@ -7,7 +7,7 @@
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
* *
* GNSS-SDR is a software defined Global Navigation * GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver * Satellite Systems receiver
@ -30,11 +30,6 @@
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*/ */
/*!
* \brief High optimized vector correlator class
*
*/
#include <iostream> #include <iostream>
#include <gnuradio/gr_block.h> #include <gnuradio/gr_block.h>
#include "correlator.h" #include "correlator.h"
@ -52,6 +47,8 @@ unsigned long correlator::next_power_2(unsigned long v)
} }
void correlator::Carrier_wipeoff_and_EPL_generic(int signal_length_samples,const gr_complex* input, gr_complex* carrier,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code,gr_complex* E_out, gr_complex* P_out, gr_complex* L_out) void correlator::Carrier_wipeoff_and_EPL_generic(int signal_length_samples,const gr_complex* input, gr_complex* carrier,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code,gr_complex* E_out, gr_complex* P_out, gr_complex* L_out)
{ {
gr_complex bb_signal_sample(0,0); gr_complex bb_signal_sample(0,0);
@ -62,7 +59,7 @@ void correlator::Carrier_wipeoff_and_EPL_generic(int signal_length_samples,const
*P_out=0; *P_out=0;
*L_out=0; *L_out=0;
// perform Early, Prompt and Late correlation // perform Early, Prompt and Late correlation
for(int i=0; i<signal_length_samples; i++) for(int i=0; i<signal_length_samples; ++i)
{ {
//Perform the carrier wipe-off //Perform the carrier wipe-off
bb_signal_sample = input[i] * carrier[i]; bb_signal_sample = input[i] * carrier[i];
@ -74,97 +71,120 @@ void correlator::Carrier_wipeoff_and_EPL_generic(int signal_length_samples,const
} }
void correlator::Carrier_wipeoff_and_EPL_volk(int signal_length_samples,const gr_complex* input, gr_complex* carrier,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code,gr_complex* E_out, gr_complex* P_out, gr_complex* L_out) void correlator::Carrier_wipeoff_and_EPL_volk(int signal_length_samples,const gr_complex* input, gr_complex* carrier,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code,gr_complex* E_out, gr_complex* P_out, gr_complex* L_out)
{ {
gr_complex* bb_signal; gr_complex* bb_signal;
gr_complex* input_aligned; gr_complex* input_aligned;
//gr_complex* carrier_aligned; //gr_complex* carrier_aligned;
// signal_length_samples=next_power_2(signal_length_samples); // signal_length_samples=next_power_2(signal_length_samples);
//std::cout<<"length="<<signal_length_samples<<std::endl; //std::cout<<"length="<<signal_length_samples<<std::endl;
//long int new_length=next_power_2(signal_length_samples); //long int new_length=next_power_2(signal_length_samples);
posix_memalign((void**)&bb_signal, 16, signal_length_samples*sizeof(gr_complex)); posix_memalign((void**)&bb_signal, 16, signal_length_samples * sizeof(gr_complex));
posix_memalign((void**)&input_aligned, 16, signal_length_samples*sizeof(gr_complex)); posix_memalign((void**)&input_aligned, 16, signal_length_samples * sizeof(gr_complex));
//posix_memalign((void**)&carrier_aligned, 16, new_length*sizeof(gr_complex)); //posix_memalign((void**)&carrier_aligned, 16, new_length*sizeof(gr_complex));
memcpy(input_aligned,input,signal_length_samples*sizeof(gr_complex)); memcpy(input_aligned,input,signal_length_samples*sizeof(gr_complex));
//memcpy(carrier_aligned,carrier,signal_length_samples*sizeof(gr_complex)); //memcpy(carrier_aligned,carrier,signal_length_samples*sizeof(gr_complex));
volk_32fc_x2_multiply_32fc_a_manual(bb_signal, input_aligned, carrier, signal_length_samples, volk_32fc_x2_multiply_32fc_a_best_arch.c_str()); volk_32fc_x2_multiply_32fc_a_manual(bb_signal, input_aligned, carrier, signal_length_samples, volk_32fc_x2_multiply_32fc_a_best_arch.c_str());
volk_32fc_x2_dot_prod_32fc_a_manual(E_out, bb_signal, E_code, signal_length_samples*sizeof(gr_complex), volk_32fc_x2_dot_prod_32fc_a_best_arch.c_str()); volk_32fc_x2_dot_prod_32fc_a_manual(E_out, bb_signal, E_code, signal_length_samples * sizeof(gr_complex), volk_32fc_x2_dot_prod_32fc_a_best_arch.c_str());
volk_32fc_x2_dot_prod_32fc_a_manual(P_out, bb_signal, P_code, signal_length_samples*sizeof(gr_complex), volk_32fc_x2_dot_prod_32fc_a_best_arch.c_str()); volk_32fc_x2_dot_prod_32fc_a_manual(P_out, bb_signal, P_code, signal_length_samples * sizeof(gr_complex), volk_32fc_x2_dot_prod_32fc_a_best_arch.c_str());
volk_32fc_x2_dot_prod_32fc_a_manual(L_out, bb_signal, L_code, signal_length_samples*sizeof(gr_complex), volk_32fc_x2_dot_prod_32fc_a_best_arch.c_str()); volk_32fc_x2_dot_prod_32fc_a_manual(L_out, bb_signal, L_code, signal_length_samples * sizeof(gr_complex), volk_32fc_x2_dot_prod_32fc_a_best_arch.c_str());
free(bb_signal); free(bb_signal);
free(input_aligned); free(input_aligned);
//free(carrier_aligned); //free(carrier_aligned);
} }
void correlator::cpu_arch_test_volk_32fc_x2_dot_prod_32fc_a() void correlator::cpu_arch_test_volk_32fc_x2_dot_prod_32fc_a()
{ {
// //
struct volk_func_desc desc=volk_32fc_x2_dot_prod_32fc_a_get_func_desc(); struct volk_func_desc desc=volk_32fc_x2_dot_prod_32fc_a_get_func_desc();
std::vector<std::string> arch_list; std::vector<std::string> arch_list;
for(int i = 0; i < desc.n_archs; i++) { for(int i = 0; i < desc.n_archs; ++i)
//if(!(archs[i+1] & volk_get_lvarch())) continue; //this arch isn't available on this pc {
arch_list.push_back(std::string(desc.indices[i])); //if(!(archs[i+1] & volk_get_lvarch())) continue; //this arch isn't available on this pc
} arch_list.push_back(std::string(desc.indices[i]));
}
//first let's get a list of available architectures for the test //first let's get a list of available architectures for the test
if(arch_list.size() < 2) { if(arch_list.size() < 2)
std::cout << "no architectures to test" << std::endl; {
this->volk_32fc_x2_dot_prod_32fc_a_best_arch="generic"; std::cout << "no architectures to test" << std::endl;
}else{ this->volk_32fc_x2_dot_prod_32fc_a_best_arch = "generic";
std::cout << "Detected architectures in this machine for volk_32fc_x2_dot_prod_32fc_a:" << std::endl; }
for (unsigned int i=0;i<arch_list.size();i++) else
{ {
std::cout<<"Arch "<<i<<":"<<arch_list.at(i)<< std::endl; std::cout << "Detected architectures in this machine for volk_32fc_x2_dot_prod_32fc_a:" << std::endl;
} for (unsigned int i=0; i<arch_list.size(); ++i)
// TODO: Make a test to find the best architecture {
this->volk_32fc_x2_dot_prod_32fc_a_best_arch=arch_list.at(arch_list.size()-1); std::cout << "Arch " << i << ":" << arch_list.at(i) << std::endl;
} }
// TODO: Make a test to find the best architecture
this->volk_32fc_x2_dot_prod_32fc_a_best_arch = arch_list.at(arch_list.size() - 1);
}
} }
void correlator::cpu_arch_test_volk_32fc_x2_multiply_32fc_a() void correlator::cpu_arch_test_volk_32fc_x2_multiply_32fc_a()
{ {
// //
struct volk_func_desc desc=volk_32fc_x2_multiply_32fc_a_get_func_desc(); struct volk_func_desc desc = volk_32fc_x2_multiply_32fc_a_get_func_desc();
std::vector<std::string> arch_list; std::vector<std::string> arch_list;
for(int i = 0; i < desc.n_archs; i++) { for(int i = 0; i < desc.n_archs; ++i)
//if(!(archs[i+1] & volk_get_lvarch())) continue; //this arch isn't available on this pc {
arch_list.push_back(std::string(desc.indices[i])); //if(!(archs[i+1] & volk_get_lvarch())) continue; //this arch isn't available on this pc
} arch_list.push_back(std::string(desc.indices[i]));
}
this->volk_32fc_x2_multiply_32fc_a_best_arch="generic"; this->volk_32fc_x2_multiply_32fc_a_best_arch = "generic";
//first let's get a list of available architectures for the test //first let's get a list of available architectures for the test
if(arch_list.size() < 2) { if(arch_list.size() < 2)
std::cout << "no architectures to test" << std::endl; {
}else{ std::cout << "no architectures to test" << std::endl;
std::cout << "Detected architectures in this machine for volk_32fc_x2_multiply_32fc_a:" << std::endl; }
for (unsigned int i=0;i<arch_list.size();i++) else
{ {
std::cout<<"Arch "<<i<<":"<<arch_list.at(i)<< std::endl; std::cout << "Detected architectures in this machine for volk_32fc_x2_multiply_32fc_a:" << std::endl;
if (arch_list.at(i).compare("sse3")==1) for (unsigned int i=0; i < arch_list.size(); ++i)
{ {
// TODO: Make a test to find the best architecture std::cout << "Arch " << i << ":" << arch_list.at(i) << std::endl;
this->volk_32fc_x2_multiply_32fc_a_best_arch="sse3"; if (arch_list.at(i).compare("sse3") == 1)
} {
} // TODO: Make a test to find the best architecture
this->volk_32fc_x2_multiply_32fc_a_best_arch = "sse3";
} }
}
}
} }
correlator::correlator () correlator::correlator ()
{ {
cpu_arch_test_volk_32fc_x2_dot_prod_32fc_a(); cpu_arch_test_volk_32fc_x2_dot_prod_32fc_a();
cpu_arch_test_volk_32fc_x2_multiply_32fc_a(); cpu_arch_test_volk_32fc_x2_multiply_32fc_a();
} }
correlator::~correlator () correlator::~correlator ()
{} {}

View File

@ -1,13 +1,14 @@
/*! /*!
* \file correlator.h * \file correlator.h
* \brief High optimized vector correlator class * \brief High optimized vector correlator class
* \author Javier Arribas, 2011. jarribas(at)cttc.es * \author Javier Arribas, 2012. jarribas(at)cttc.es
* *
* Class that implements a high optimized vector correlator class. * Class that implements a high optimized vector correlator class
* using the volk library
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
* *
* GNSS-SDR is a software defined Global Navigation * GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver * Satellite Systems receiver
@ -30,29 +31,30 @@
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*/ */
#ifndef CORRELATOR_H_ #ifndef GNSS_SDR_CORRELATOR_H_
#define CORRELATOR_H_ #define GNSS_SDR_CORRELATOR_H_
#include <volk/volk.h>
#include <gnuradio/gr_block.h>
/*! /*!
* \brief High optimized vector correlator class * \brief High optimized vector correlator class
* *
*/ */
#include <volk/volk.h>
#include <gnuradio/gr_block.h>
class correlator class correlator
{ {
public:
void Carrier_wipeoff_and_EPL_generic(int signal_length_samples,const gr_complex* input, gr_complex* carrier,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code,gr_complex* E_out, gr_complex* P_out, gr_complex* L_out);
void Carrier_wipeoff_and_EPL_volk(int signal_length_samples,const gr_complex* input, gr_complex* carrier,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code,gr_complex* E_out, gr_complex* P_out, gr_complex* L_out);
correlator();
~correlator();
private: private:
std::string volk_32fc_x2_multiply_32fc_a_best_arch; std::string volk_32fc_x2_multiply_32fc_a_best_arch;
std::string volk_32fc_x2_dot_prod_32fc_a_best_arch; std::string volk_32fc_x2_dot_prod_32fc_a_best_arch;
unsigned long next_power_2(unsigned long v);
unsigned long next_power_2(unsigned long v); void cpu_arch_test_volk_32fc_x2_dot_prod_32fc_a();
void cpu_arch_test_volk_32fc_x2_dot_prod_32fc_a(); void cpu_arch_test_volk_32fc_x2_multiply_32fc_a();
void cpu_arch_test_volk_32fc_x2_multiply_32fc_a();
public:
void Carrier_wipeoff_and_EPL_generic(int signal_length_samples,const gr_complex* input, gr_complex* carrier,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code,gr_complex* E_out, gr_complex* P_out, gr_complex* L_out);
void Carrier_wipeoff_and_EPL_volk(int signal_length_samples,const gr_complex* input, gr_complex* carrier,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code,gr_complex* E_out, gr_complex* P_out, gr_complex* L_out);
correlator();
~correlator();
}; };
#endif #endif

View File

@ -38,6 +38,7 @@
#define GNSS_SDR_TELEMETRY_DECODER_INTERFACE_H_ #define GNSS_SDR_TELEMETRY_DECODER_INTERFACE_H_
#include "gnss_block_interface.h" #include "gnss_block_interface.h"
#include "gnss_satellite.h"
/*! /*!
* \brief This abstract class represents an interface to a navigation GNSS block. * \brief This abstract class represents an interface to a navigation GNSS block.
@ -53,7 +54,7 @@ class TelemetryDecoderInterface : public GNSSBlockInterface
public: public:
virtual void reset() = 0; virtual void reset() = 0;
virtual void set_satellite(int satellite) = 0; virtual void set_satellite(Gnss_Satellite sat) = 0;
virtual void set_channel(int channel) = 0; virtual void set_channel(int channel) = 0;
}; };

View File

@ -347,7 +347,7 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
break; break;
} }
DLOG(INFO) << "available channels " DLOG(INFO) << "Number of available satellites: "
<< available_GPS_satellites_IDs_->size(); << available_GPS_satellites_IDs_->size();
} }
@ -355,15 +355,13 @@ void GNSSFlowgraph::set_configuration(ConfigurationInterface* configuration)
{ {
if (running_) if (running_)
{ {
LOG_AT_LEVEL(WARNING) LOG_AT_LEVEL(WARNING) << "Unable to update configuration while flowgraph running";
<< "Unable to update configuration while flowgraph running";
return; return;
} }
if (connected_) if (connected_)
{ {
LOG_AT_LEVEL(WARNING) LOG_AT_LEVEL(WARNING) << "Unable to update configuration while flowgraph connected";
<< "Unable to update configuration while flowgraph connected";
} }
configuration_ = configuration; configuration_ = configuration;

View File

@ -33,6 +33,7 @@
#define GNSS_SDR_GPS_L1_CA_H_ #define GNSS_SDR_GPS_L1_CA_H_
#include <complex> #include <complex>
#include <gnss_satellite.h>
// Physical constants // Physical constants
const double GPS_C_m_s = 299792458.0; //!< The speed of light, [m/s] const double GPS_C_m_s = 299792458.0; //!< The speed of light, [m/s]
@ -120,7 +121,7 @@ typedef struct gnss_pseudorange
{ {
double pseudorange_m; double pseudorange_m;
double timestamp_ms; double timestamp_ms;
int SV_ID; unsigned int SV_ID;
bool valid; bool valid;
} gnss_pseudorange; } gnss_pseudorange;

View File

@ -92,6 +92,24 @@ bool operator== (const Gnss_Satellite &sat1, const Gnss_Satellite &sat2)
return equal; return equal;
} }
/*
Gnss_Satellite& Gnss_Satellite::operator=(const Gnss_Satellite &rhs) {
// Only do assignment if RHS is a different object from this.
if (this != &rhs) {
// Deallocate, allocate new space, copy values...
const std::string system_ = rhs.get_system();
const unsigned int PRN_ = rhs.get_PRN();
const std::string block_ = rhs.get_block();
// const signed int rf_link_ = 0;
this->set_system(system_);
this->set_PRN(PRN_);
this->set_block(system_, PRN_);
//this.rf_link = rf_link_;
}
return *this;
}*/
void Gnss_Satellite::set_system(std::string system_) void Gnss_Satellite::set_system(std::string system_)
{ {
@ -104,7 +122,7 @@ void Gnss_Satellite::set_system(std::string system_)
} }
else else
{ {
LOG_AT_LEVEL(ERROR) << "System " << system_ << " is not defined {GPS, GLONASS, SBAS, Galileo, Compass}"; DLOG(INFO) << "System " << system_ << " is not defined {GPS, GLONASS, SBAS, Galileo, Compass}. Initialization?";
system = std::string(""); system = std::string("");
} }
} }
@ -117,14 +135,14 @@ void Gnss_Satellite::set_PRN(unsigned int PRN_)
// Set satellite's PRN // Set satellite's PRN
if (system.compare("") == 0) if (system.compare("") == 0)
{ {
LOG_AT_LEVEL(ERROR) << "Trying to define PRN while system is not defined"; DLOG(INFO) << "Trying to define PRN while system is not defined";
PRN = 0; PRN = 0;
} }
if (system.compare("GPS") == 0) if (system.compare("GPS") == 0)
{ {
if (PRN_ < 1 or PRN > 32) if (PRN_ < 1 or PRN > 32)
{ {
LOG_AT_LEVEL(ERROR) << "This PRN is not defined"; DLOG(INFO) << "This PRN is not defined";
PRN = 0; PRN = 0;
} }
else else
@ -136,7 +154,7 @@ void Gnss_Satellite::set_PRN(unsigned int PRN_)
{ {
if (PRN_ < 1 or PRN > 24) if (PRN_ < 1 or PRN > 24)
{ {
LOG_AT_LEVEL(ERROR) << "This PRN is not defined"; DLOG(INFO) << "This PRN is not defined";
PRN = 0; PRN = 0;
} }
else else
@ -153,7 +171,7 @@ void Gnss_Satellite::set_PRN(unsigned int PRN_)
else if (PRN_ == 126){ PRN = PRN_; } // EGNOS IOR-W currently used by Industry to perform various tests on the system. else if (PRN_ == 126){ PRN = PRN_; } // EGNOS IOR-W currently used by Industry to perform various tests on the system.
else else
{ {
LOG_AT_LEVEL(ERROR) << "This PRN is not defined"; DLOG(INFO) << "This PRN is not defined";
PRN = 0; PRN = 0;
} }
} }
@ -165,13 +183,13 @@ void Gnss_Satellite::set_PRN(unsigned int PRN_)
} }
else else
{ {
LOG_AT_LEVEL(ERROR) << "This PRN is not defined"; DLOG(INFO) << "This PRN is not defined";
PRN = 0; PRN = 0;
} }
} }
else else
{ {
LOG_AT_LEVEL(ERROR) << "System " << system << " is not defined"; DLOG(INFO) << "System " << system << " is not defined";
PRN = 0; PRN = 0;
} }
} }

View File

@ -53,12 +53,13 @@ public:
std::string get_block() const; //!< Gets the satellite block. If GPS, returns {"IIA", "IIR", "IIR-M", "IIF"} std::string get_block() const; //!< Gets the satellite block. If GPS, returns {"IIA", "IIR", "IIR-M", "IIF"}
friend bool operator== (const Gnss_Satellite &, const Gnss_Satellite &); // operator== for comparison friend bool operator== (const Gnss_Satellite &, const Gnss_Satellite &); // operator== for comparison
friend std::ostream& operator<<(std::ostream &, const Gnss_Satellite &); // operator<< for pretty printing friend std::ostream& operator<<(std::ostream &, const Gnss_Satellite &); // operator<< for pretty printing
//Gnss_Satellite& operator=(const Gnss_Satellite &);
private: private:
unsigned int PRN; unsigned int PRN;
std::string system; std::string system;
std::string block; std::string block;
signed int rf_link; signed int rf_link;
void set_system(std::string system); // Sets the satellite system {"GPS", "GLONASS", "SBAS", "Galileo", "Compass"}. Returns 1 if success. void set_system(std::string system); // Sets the satellite system {"GPS", "GLONASS", "SBAS", "Galileo", "Compass"}.
void set_PRN(unsigned int PRN); // Sets satellite's PRN void set_PRN(unsigned int PRN); // Sets satellite's PRN
void set_block(std::string system_, unsigned int PRN_ ); void set_block(std::string system_, unsigned int PRN_ );
std::set<std::string> system_set; // = {"GPS", "GLONASS", "SBAS", "Galileo", "Compass"}; std::set<std::string> system_set; // = {"GPS", "GLONASS", "SBAS", "Galileo", "Compass"};

View File

@ -152,7 +152,7 @@ public:
// satellite identification info // satellite identification info
int i_channel_ID; int i_channel_ID;
int i_satellite_PRN; unsigned int i_satellite_PRN;
// time synchro // time synchro
double d_subframe1_timestamp_ms; //[ms] double d_subframe1_timestamp_ms; //[ms]