mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-10-31 07:13:03 +00:00 
			
		
		
		
	GNSS SDR now uses the unified Gnss_Synchro class to exchange signal synchronization data between Acquisition, Tracking and Telemetry decoder blocks.
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@147 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
		| @@ -17,7 +17,7 @@ ControlThread.wait_for_flowgraph=false | ||||
| SignalSource.implementation=File_Signal_Source | ||||
|  | ||||
| ;#filename: path to file with the captured GNSS signal samples to be processed | ||||
| SignalSource.filename=/home/luis/Project/signals/cap2/agilent_cap2.dat | ||||
| SignalSource.filename=/media/DATALOGGER/signals/Agilent GPS Generator/cap2/agilent_cap2.dat | ||||
|  | ||||
| ;#item_type: Type and resolution for each of the signal samples. Use only gr_complex in this version. | ||||
| SignalSource.item_type=gr_complex | ||||
| @@ -130,6 +130,12 @@ Channel2.system=GPS | ||||
| Channel2.signal=1C | ||||
| Channel2.satellite=21 | ||||
|  | ||||
| ;######### CHANNEL 2 CONFIG ############ | ||||
|  | ||||
| Channel3.system=GPS | ||||
| Channel3.signal=1C | ||||
| Channel3.satellite=2 | ||||
|  | ||||
|  | ||||
| ;######### ACQUISITION GLOBAL CONFIG ############ | ||||
|  | ||||
| @@ -220,7 +226,7 @@ Acquisition7.doppler_step=250 | ||||
| ;######### TRACKING GLOBAL CONFIG ############ | ||||
|  | ||||
| ;#implementatiion: Selected tracking algorithm: [GPS_L1_CA_DLL_PLL_Tracking] or [GPS_L1_CA_DLL_FLL_PLL_Tracking] | ||||
| Tracking.implementation=GPS_L1_CA_DLL_PLL_Tracking | ||||
| Tracking.implementation=GPS_L1_CA_DLL_FLL_PLL_Tracking | ||||
|  | ||||
| ;#item_type: Type and resolution for each of the signal samples. Use only [gr_complex] in this version. | ||||
| Tracking.item_type=gr_complex | ||||
|   | ||||
| @@ -59,7 +59,6 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition( | ||||
|     item_type_ = configuration->property(role + ".item_type", | ||||
|             default_item_type); | ||||
|  | ||||
|     gnss_satellite_ = Gnss_Satellite(); | ||||
|     fs_in_ = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); | ||||
|     if_ = configuration->property(role + ".ifreq", 0); | ||||
|     dump_ = configuration->property(role + ".dump", false); | ||||
| @@ -94,15 +93,6 @@ GpsL1CaPcpsAcquisition::~GpsL1CaPcpsAcquisition() | ||||
| { | ||||
| } | ||||
|  | ||||
| void GpsL1CaPcpsAcquisition::set_satellite(Gnss_Satellite satellite) | ||||
| { | ||||
|     gnss_satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); | ||||
|  | ||||
|     if (item_type_.compare("gr_complex") == 0) | ||||
|     { | ||||
|         acquisition_cc_->set_satellite(gnss_satellite_); | ||||
|     } | ||||
| } | ||||
|  | ||||
| void GpsL1CaPcpsAcquisition::set_channel(unsigned int channel) | ||||
| { | ||||
| @@ -157,40 +147,11 @@ void GpsL1CaPcpsAcquisition::set_channel_queue( | ||||
|     } | ||||
| } | ||||
|  | ||||
| signed int GpsL1CaPcpsAcquisition::prn_code_phase() | ||||
| { | ||||
|  | ||||
|     if (item_type_.compare("gr_complex") == 0) | ||||
|     { | ||||
|         return acquisition_cc_->prn_code_phase(); | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         return 0; | ||||
|     } | ||||
| } | ||||
|  | ||||
| unsigned long int GpsL1CaPcpsAcquisition::get_sample_stamp() | ||||
| void GpsL1CaPcpsAcquisition::set_gnss_synchro(Gnss_Synchro* gnss_synchro) | ||||
| { | ||||
|     if (item_type_.compare("gr_complex") == 0) | ||||
|     { | ||||
|         return acquisition_cc_->get_sample_stamp(); | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         return 0; | ||||
|     } | ||||
| } | ||||
| float GpsL1CaPcpsAcquisition::doppler_freq_shift() | ||||
| { | ||||
|  | ||||
|     if (item_type_.compare("gr_complex") == 0) | ||||
|     { | ||||
|         return acquisition_cc_->doppler_freq(); | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         return 0; | ||||
|         acquisition_cc_->set_gnss_synchro(gnss_synchro); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -206,6 +167,12 @@ signed int GpsL1CaPcpsAcquisition::mag() | ||||
|     } | ||||
| } | ||||
|  | ||||
| void GpsL1CaPcpsAcquisition::init(){ | ||||
|     if (item_type_.compare("gr_complex") == 0) | ||||
|     { | ||||
|         acquisition_cc_->init(); | ||||
|     } | ||||
| } | ||||
| void GpsL1CaPcpsAcquisition::reset() | ||||
| { | ||||
|  | ||||
|   | ||||
| @@ -34,6 +34,7 @@ | ||||
| #ifndef GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_H_ | ||||
| #define GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_H_ | ||||
|  | ||||
| #include "gnss_synchro.h" | ||||
| #include "acquisition_interface.h" | ||||
| #include "gps_l1_ca_pcps_acquisition_cc.h" | ||||
| #include <gnuradio/gr_msg_queue.h> | ||||
| @@ -69,18 +70,14 @@ public: | ||||
|     gr_basic_block_sptr get_left_block(); | ||||
|     gr_basic_block_sptr get_right_block(); | ||||
|  | ||||
|     void set_synchro(Gnss_Synchro p_gnss_synchro); | ||||
|     void set_satellite(Gnss_Satellite satellite); | ||||
|     void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro); | ||||
|     void set_channel(unsigned int channel); | ||||
|     void set_threshold(float threshold); | ||||
|     void set_doppler_max(unsigned int doppler_max); | ||||
|     void set_doppler_step(unsigned int doppler_step); | ||||
|     void set_channel_queue(concurrent_queue<int> *channel_internal_queue); | ||||
|     signed int prn_code_phase(); | ||||
|     float doppler_freq_shift(); | ||||
|  | ||||
|     unsigned long int get_sample_stamp(); | ||||
|  | ||||
|     void init(); | ||||
|     signed int mag(); | ||||
|     void reset(); | ||||
|  | ||||
| @@ -93,8 +90,7 @@ private: | ||||
|     size_t item_size_; | ||||
|     std::string item_type_; | ||||
|     unsigned int vector_length_; | ||||
|     Gnss_Synchro* gnss_synchro_; | ||||
|     Gnss_Satellite gnss_satellite_; | ||||
|  | ||||
|     //unsigned int satellite_; | ||||
|     unsigned int channel_; | ||||
|     float threshold_; | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| project : build-dir ../../../../build ; | ||||
|  | ||||
| obj gps_l1_ca_gps_sdr_acquisition : gps_l1_ca_gps_sdr_acquisition.cc ; | ||||
| #obj gps_l1_ca_gps_sdr_acquisition : gps_l1_ca_gps_sdr_acquisition.cc ; | ||||
| obj gps_l1_ca_pcps_acquisition : gps_l1_ca_pcps_acquisition.cc ; | ||||
| obj gps_l1_ca_tong_pcps_acquisition : gps_l1_ca_tong_pcps_acquisition.cc ; | ||||
| #obj gps_l1_ca_tong_pcps_acquisition : gps_l1_ca_tong_pcps_acquisition.cc ; | ||||
| @@ -69,14 +69,12 @@ gps_l1_ca_pcps_acquisition_cc::gps_l1_ca_pcps_acquisition_cc( | ||||
|     d_samples_per_ms = samples_per_ms; | ||||
|     d_sampled_ms = sampled_ms; | ||||
|     d_doppler_max = doppler_max; | ||||
|     d_satellite = Gnss_Satellite(); | ||||
|     d_fft_size = d_sampled_ms * d_samples_per_ms; | ||||
|     //d_doppler_freq = 0.0; | ||||
|     //d_code_phase = 0; | ||||
|     d_mag = 0; | ||||
|     d_input_power = 0.0; | ||||
|  | ||||
|     d_gnss_synchro = new Gnss_Synchro(); | ||||
|  | ||||
|     d_sine_if = new gr_complex[d_fft_size]; | ||||
|  | ||||
| @@ -91,20 +89,10 @@ gps_l1_ca_pcps_acquisition_cc::gps_l1_ca_pcps_acquisition_cc( | ||||
|     d_dump = dump; | ||||
|     d_dump_filename = dump_filename; | ||||
|  | ||||
|     DLOG(INFO) << "fs in " << d_fs_in; | ||||
|     DLOG(INFO) << "samples per ms " << d_samples_per_ms; | ||||
|     DLOG(INFO) << "doppler max " << d_doppler_max; | ||||
|     DLOG(INFO) << "freq " << d_freq; | ||||
|     DLOG(INFO) << "satellite " << d_satellite; | ||||
|     DLOG(INFO) << "sampled_ms " << d_sampled_ms; | ||||
|     DLOG(INFO) << "fft_size " << d_fft_size; | ||||
|     DLOG(INFO) << "dump filename " << d_dump_filename; | ||||
|     DLOG(INFO) << "dump " << d_dump; | ||||
| } | ||||
|  | ||||
| gps_l1_ca_pcps_acquisition_cc::~gps_l1_ca_pcps_acquisition_cc() | ||||
| { | ||||
| 	delete d_gnss_synchro; | ||||
| 	delete[] d_sine_if; | ||||
| 	delete[] d_fft_codes; | ||||
| 	delete d_ifft; | ||||
| @@ -120,22 +108,20 @@ gps_l1_ca_pcps_acquisition_cc::~gps_l1_ca_pcps_acquisition_cc() | ||||
|  | ||||
|  | ||||
|  | ||||
| void gps_l1_ca_pcps_acquisition_cc::set_satellite(Gnss_Satellite satellite) | ||||
| void gps_l1_ca_pcps_acquisition_cc::init() | ||||
| { | ||||
|     d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); | ||||
|     // ¿qué diferencia hay con d_satellite=satellite; ? | ||||
|  | ||||
|     d_gnss_synchro->Acq_delay_samples=0.0; | ||||
|     d_gnss_synchro->Acq_doppler_hz=0.0; | ||||
|     d_gnss_synchro->Acq_samplestamp_samples=0; | ||||
|  | ||||
|     //d_code_phase = 0; | ||||
|     //d_doppler_freq = 0; | ||||
|     d_mag = 0.0; | ||||
|     d_input_power = 0.0; | ||||
|  | ||||
|     // Now the GPS codes are generated on the fly using a custom version of the GPS code generator | ||||
|     code_gen_complex_sampled(d_fft_if->get_inbuf(), satellite.get_PRN(), d_fs_in, 0); | ||||
|  | ||||
|  | ||||
|  | ||||
|     code_gen_complex_sampled(d_fft_if->get_inbuf(), d_gnss_synchro->PRN, d_fs_in, 0); | ||||
|  | ||||
|     d_fft_if->execute(); // We need the FFT of GPS C/A code | ||||
|     //Conjugate the local code | ||||
| @@ -213,7 +199,7 @@ int gps_l1_ca_pcps_acquisition_cc::general_work(int noutput_items, | ||||
|             unsigned int i; | ||||
|  | ||||
|             DLOG(INFO) << "Channel: " << d_channel | ||||
|                     << " , doing acquisition of satellite: " << d_satellite | ||||
|                     << " , doing acquisition of satellite: " << d_gnss_synchro->System << " "<< d_gnss_synchro->PRN | ||||
|                     << " ,sample stamp: " << d_sample_counter << ", threshold: " | ||||
|                     << d_threshold << ", doppler_max: " << d_doppler_max | ||||
|                     << ", doppler_step: " << d_doppler_step; | ||||
| @@ -294,10 +280,10 @@ int gps_l1_ca_pcps_acquisition_cc::general_work(int noutput_items, | ||||
|             if (d_test_statistics > d_threshold) | ||||
|                 { | ||||
|                     positive_acquisition = true; | ||||
|                     d_acq_sample_stamp = d_sample_counter; | ||||
|                     d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter; | ||||
|  | ||||
|                     DLOG(INFO) << "positive acquisition"; | ||||
|                     DLOG(INFO) << "satellite " << d_satellite; | ||||
|                     DLOG(INFO) << "satellite " << d_gnss_synchro->System << " "<< d_gnss_synchro->PRN; | ||||
|                     DLOG(INFO) << "sample_stamp " << d_sample_counter; | ||||
|                     DLOG(INFO) << "test statistics value " << d_test_statistics; | ||||
|                     DLOG(INFO) << "test statistics threshold " << d_threshold; | ||||
| @@ -309,7 +295,7 @@ int gps_l1_ca_pcps_acquisition_cc::general_work(int noutput_items, | ||||
|             else | ||||
|                 { | ||||
|                     DLOG(INFO) << "negative acquisition"; | ||||
|                     DLOG(INFO) << "satellite " << d_satellite; | ||||
|                     DLOG(INFO) << "satellite " << d_gnss_synchro->System << " "<< d_gnss_synchro->PRN; | ||||
|                     DLOG(INFO) << "sample_stamp " << d_sample_counter; | ||||
|                     DLOG(INFO) << "test statistics value " << d_test_statistics; | ||||
|                     DLOG(INFO) << "test statistics threshold " << d_threshold; | ||||
|   | ||||
| @@ -43,7 +43,6 @@ | ||||
| #include <boost/thread/mutex.hpp> | ||||
| #include <boost/thread/thread.hpp> | ||||
| #include "concurrent_queue.h" | ||||
| #include "gnss_satellite.h" | ||||
| #include "gnss_synchro.h" | ||||
|  | ||||
| class gps_l1_ca_pcps_acquisition_cc; | ||||
| @@ -79,7 +78,6 @@ private: | ||||
| 	long d_freq; | ||||
| 	int d_samples_per_ms; | ||||
| 	unsigned int d_doppler_resolution; | ||||
| 	Gnss_Satellite d_satellite; | ||||
| 	float d_threshold; | ||||
| 	std::string d_satellite_str; | ||||
| 	unsigned int d_doppler_max; | ||||
| @@ -87,7 +85,6 @@ private: | ||||
| 	unsigned int d_sampled_ms; | ||||
| 	unsigned int d_fft_size; | ||||
| 	unsigned long int d_sample_counter; | ||||
| 	unsigned long int d_acq_sample_stamp; | ||||
| 	gr_complex* d_sine_if; | ||||
|  | ||||
| 	gr_complex* d_fft_codes; | ||||
| @@ -120,25 +117,13 @@ public: | ||||
| 	{ | ||||
| 		d_gnss_synchro = p_gnss_synchro; | ||||
| 	} | ||||
| 	signed int prn_code_phase() | ||||
| 	{ | ||||
| 		return d_code_phase; | ||||
| 	} | ||||
| 	float doppler_freq() | ||||
| 	{ | ||||
| 		return d_doppler_freq; | ||||
| 	} | ||||
|  | ||||
| 	unsigned int mag() | ||||
| 	{ | ||||
| 		return d_mag; | ||||
| 	} | ||||
|  | ||||
| 	unsigned long int get_sample_stamp() | ||||
| 	{ | ||||
| 		return d_acq_sample_stamp; | ||||
| 	} | ||||
|  | ||||
| 	void set_satellite(Gnss_Satellite satellite); | ||||
| 	void init(); | ||||
|  | ||||
| 	void set_active(bool active) | ||||
| 	{ | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| project : build-dir ../../../../build ; | ||||
|  | ||||
| obj gps_l1_ca_gps_sdr_acquisition_cc : gps_l1_ca_gps_sdr_acquisition_cc.cc ; | ||||
| obj gps_l1_ca_gps_sdr_acquisition_ss : gps_l1_ca_gps_sdr_acquisition_ss.cc :  <toolset>darwin:<define>NO_SIMD <toolset>gcc:<define>USE_SIMD ; | ||||
| #obj gps_l1_ca_gps_sdr_acquisition_cc : gps_l1_ca_gps_sdr_acquisition_cc.cc ; | ||||
| #obj gps_l1_ca_gps_sdr_acquisition_ss : gps_l1_ca_gps_sdr_acquisition_ss.cc :  <toolset>darwin:<define>NO_SIMD <toolset>gcc:<define>USE_SIMD ; | ||||
| obj gps_l1_ca_pcps_acquisition_cc : gps_l1_ca_pcps_acquisition_cc.cc ; | ||||
| obj gps_l1_ca_tong_pcps_acquisition_cc : gps_l1_ca_tong_pcps_acquisition_cc.cc ; | ||||
| #obj gps_l1_ca_tong_pcps_acquisition_cc : gps_l1_ca_tong_pcps_acquisition_cc.cc ; | ||||
|   | ||||
| @@ -61,6 +61,11 @@ Channel::Channel(ConfigurationInterface *configuration, unsigned int channel, | ||||
|     trk_->set_channel(channel_); | ||||
|     nav_->set_channel(channel_); | ||||
|  | ||||
|     gnss_synchro_.Channel_ID=channel_; | ||||
|  | ||||
|     acq_->set_gnss_synchro(&gnss_synchro_); | ||||
|     trk_->set_gnss_synchro(&gnss_synchro_); | ||||
|  | ||||
|     acq_->set_threshold(configuration->property("Acquisition" | ||||
|             + boost::lexical_cast<std::string>(channel_) + ".threshold", 0.0)); | ||||
|     acq_->set_doppler_max(configuration->property("Acquisition" | ||||
| @@ -86,7 +91,6 @@ Channel::Channel(ConfigurationInterface *configuration, unsigned int channel, | ||||
|  | ||||
|     connected_ = false; | ||||
|     message_ = 0; | ||||
|     gnss_satellite_ = Gnss_Satellite(); | ||||
|     gnss_signal_ = Gnss_Signal(); | ||||
| } | ||||
|  | ||||
| @@ -98,7 +102,6 @@ Channel::~Channel() | ||||
|     delete trk_; | ||||
|     delete nav_; | ||||
|     delete pass_through_; | ||||
|     //delete gnss_satellite_; | ||||
| } | ||||
|  | ||||
|  | ||||
| @@ -124,11 +127,7 @@ void Channel::connect(gr_top_block_sptr top_block) | ||||
|     top_block->connect(pass_through_->get_right_block(), 0, | ||||
|             trk_->get_left_block(), 0); | ||||
|     DLOG(INFO) << "pass_through_ -> tracking"; | ||||
|     top_block->connect(trk_->get_right_block(), 0, nav_->get_left_block(), 0); // channel 1 | ||||
|     top_block->connect(trk_->get_right_block(), 1, nav_->get_left_block(), 1); // channel 2 | ||||
|     top_block->connect(trk_->get_right_block(), 2, nav_->get_left_block(), 2); // channel 3 | ||||
|     top_block->connect(trk_->get_right_block(), 3, nav_->get_left_block(), 3); // channel 4 | ||||
|     top_block->connect(trk_->get_right_block(), 4, nav_->get_left_block(), 4); // channel 5 | ||||
|     top_block->connect(trk_->get_right_block(), 0, nav_->get_left_block(), 0); | ||||
|     DLOG(INFO) << "tracking -> telemetry_decoder"; | ||||
|  | ||||
|     connected_ = true; | ||||
| @@ -171,10 +170,13 @@ gr_basic_block_sptr Channel::get_right_block() | ||||
|  | ||||
| void Channel::set_signal(Gnss_Signal gnss_signal) | ||||
| { | ||||
| 	gnss_satellite_ = gnss_signal.get_satellite(); | ||||
|     acq_->set_satellite(gnss_satellite_); | ||||
|     trk_->set_satellite(gnss_satellite_); | ||||
|     nav_->set_satellite(gnss_satellite_); | ||||
| 	Gnss_Satellite gnss_satellite; | ||||
| 	gnss_satellite = gnss_signal.get_satellite(); | ||||
| 	gnss_signal.get_signal().copy(gnss_synchro_.Signal,2,0); | ||||
| 	gnss_synchro_.PRN=gnss_signal.get_satellite().get_PRN(); | ||||
| 	gnss_synchro_.System=gnss_signal.get_satellite().get_system_short().c_str()[0]; | ||||
| 	acq_->init(); | ||||
|     nav_->set_satellite(gnss_satellite); | ||||
| } | ||||
|  | ||||
|  | ||||
| @@ -239,14 +241,14 @@ void Channel::process_channel_messages() | ||||
|     case 1: | ||||
|  | ||||
|         LOG_AT_LEVEL(INFO) << "Channel " << channel_ | ||||
|         << " ACQ SUCCESS satellite " << gnss_satellite_; | ||||
|         << " ACQ SUCCESS satellite " << gnss_synchro_.System << " "<< gnss_synchro_.PRN; | ||||
|         channel_fsm_.Event_gps_valid_acquisition(); | ||||
|         break; | ||||
|  | ||||
|     case 2: | ||||
|  | ||||
|         LOG_AT_LEVEL(INFO) << "Channel " << channel_ | ||||
|         << " ACQ FAILED satellite " << gnss_satellite_; | ||||
|         << " ACQ FAILED satellite " << gnss_synchro_.System << " "<< gnss_synchro_.PRN; | ||||
|         if (repeat_ == true) | ||||
|             { | ||||
|                 channel_fsm_.Event_gps_failed_acquisition_repeat(); | ||||
| @@ -259,7 +261,7 @@ void Channel::process_channel_messages() | ||||
|  | ||||
|     case 3: | ||||
|         LOG_AT_LEVEL(INFO) << "Channel " << channel_ | ||||
|         << " TRACKING FAILED satellite " << gnss_satellite_ | ||||
|         << " TRACKING FAILED satellite " << gnss_synchro_.System << " "<< gnss_synchro_.PRN | ||||
|         << ", reacquisition."; | ||||
|         channel_fsm_.Event_gps_failed_tracking(); | ||||
|         break; | ||||
|   | ||||
| @@ -42,6 +42,7 @@ | ||||
| #include "control_message_factory.h" | ||||
| #include "concurrent_queue.h" | ||||
| #include "gnss_signal.h" | ||||
| #include "gnss_synchro.h" | ||||
|  | ||||
|  | ||||
| class ConfigurationInterface; | ||||
| @@ -108,7 +109,8 @@ private: | ||||
|     std::string implementation_; | ||||
|  | ||||
|     unsigned int channel_; | ||||
|     Gnss_Satellite gnss_satellite_; | ||||
|  | ||||
|     Gnss_Synchro gnss_synchro_; | ||||
|     Gnss_Signal gnss_signal_; | ||||
|     bool connected_; | ||||
|     bool stop_; | ||||
|   | ||||
| @@ -191,16 +191,16 @@ void GpsL1CaChannelFsm::start_acquisition() | ||||
|  | ||||
| void GpsL1CaChannelFsm::start_tracking() | ||||
| { | ||||
|     LOG_AT_LEVEL(INFO) << "Channel " << channel_ | ||||
|             << " passing prn code phase " << acq_->prn_code_phase(); | ||||
|     LOG_AT_LEVEL(INFO) << "Channel " << channel_ | ||||
|             << " passing doppler freq shift " << acq_->doppler_freq_shift(); | ||||
|     LOG_AT_LEVEL(INFO) << "Channel " << channel_ | ||||
|             << " passing acquisition sample stamp " | ||||
|             << acq_->get_sample_stamp(); | ||||
|     trk_->set_prn_code_phase(acq_->prn_code_phase()); | ||||
|     trk_->set_doppler_freq_shift(acq_->doppler_freq_shift()); | ||||
|     trk_->set_acq_sample_stamp(acq_->get_sample_stamp()); | ||||
|     //LOG_AT_LEVEL(INFO) << "Channel " << channel_ | ||||
|             //<< " passing prn code phase " << acq_->prn_code_phase(); | ||||
|     //LOG_AT_LEVEL(INFO) << "Channel " << channel_ | ||||
|             //<< " passing doppler freq shift " << acq_->doppler_freq_shift(); | ||||
|     //LOG_AT_LEVEL(INFO) << "Channel " << channel_ | ||||
|             //<< " passing acquisition sample stamp " | ||||
|             //<< acq_->get_sample_stamp(); | ||||
|     //trk_->set_prn_code_phase(acq_->prn_code_phase()); | ||||
|     //trk_->set_doppler_freq_shift(acq_->doppler_freq_shift()); | ||||
|     //trk_->set_acq_sample_stamp(acq_->get_sample_stamp()); | ||||
|     trk_->start_tracking(); | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -33,6 +33,7 @@ | ||||
|  * \todo Clean this code and move the telemetry definitions to GPS_L1_CA system definitions file | ||||
|  */ | ||||
|  | ||||
| #include "gnss_synchro.h" | ||||
| #include "gps_l1_ca_telemetry_decoder_cc.h" | ||||
| #include <iostream> | ||||
| #include <sstream> | ||||
| @@ -70,9 +71,15 @@ 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(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned | ||||
|         int vector_length, gr_msg_queue_sptr queue, bool dump) : | ||||
|         gr_block ("gps_navigation_cc", gr_make_io_signature (5, 5, sizeof(double)), | ||||
| 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) : | ||||
|         gr_block ("gps_navigation_cc", gr_make_io_signature (1, 1, sizeof(Gnss_Synchro)), | ||||
|                 gr_make_io_signature(1, 1, sizeof(gnss_synchro))) | ||||
| { | ||||
|     // initialize internal vars | ||||
| @@ -112,6 +119,7 @@ gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(Gnss_Satellite sa | ||||
|     d_preamble_code_phase_seconds = 0; | ||||
|     d_stat = 0; | ||||
|     d_preamble_index = 0; | ||||
|     d_symbol_accumulator=0; | ||||
|     d_symbol_accumulator_counter = 0; | ||||
|     d_frame_bit_index = 0; | ||||
|  | ||||
| @@ -168,12 +176,16 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i | ||||
|     int preamble_diff; | ||||
|  | ||||
|     gnss_synchro gps_synchro; //structure to save the synchronization information | ||||
|  | ||||
|  | ||||
|     gnss_synchro **out = (gnss_synchro **) &output_items[0]; | ||||
|  | ||||
|  | ||||
|     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 Gnss_Synchro **in = (const Gnss_Synchro **)  &input_items[0]; //Get the input samples pointer | ||||
|     // ########### Output the tracking data to navigation and PVT ########## | ||||
|     // Output channel 0: Prompt correlator output Q | ||||
|     //	*out[0]=(double)d_Prompt.real(); | ||||
| @@ -204,7 +216,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i | ||||
|     //******* preamble correlation ******** | ||||
|     for (unsigned int i=0; i<d_samples_per_bit*8; i++) | ||||
|         { | ||||
|             if (in[1][i] < 0)	// symbols clipping | ||||
|             if (in[0][i].Prompt_Q < 0)	// symbols clipping | ||||
|                 { | ||||
|                     corr_value -= d_preambles_symbols[i]; | ||||
|                 } | ||||
| @@ -236,8 +248,8 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i | ||||
|                             d_GPS_FSM.Event_gps_word_preamble(); | ||||
|                             d_flag_preamble = true; | ||||
|                             d_preamble_index = d_sample_counter;  //record the preamble sample stamp (t_P) | ||||
|                             d_preamble_time_seconds = in[2][0] - d_preamble_duration_seconds; //record the PRN start sample index associated to the preamble | ||||
|                             d_preamble_code_phase_seconds = in[4][0]; | ||||
|                             d_preamble_time_seconds = in[0][0].Tracking_timestamp_secs - d_preamble_duration_seconds; //record the PRN start sample index associated to the preamble | ||||
|                             d_preamble_code_phase_seconds = in[0][0].Code_phase_secs; | ||||
|  | ||||
|                             if (!d_flag_frame_sync) | ||||
|                                 { | ||||
| @@ -265,7 +277,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i | ||||
|     //d_preamble_phase-=in[3][0]; | ||||
|     //******* SYMBOL TO BIT ******* | ||||
|  | ||||
|     d_symbol_accumulator += in[1][d_samples_per_bit*8 - 1]; // accumulate the input value in d_symbol_accumulator | ||||
|     d_symbol_accumulator += in[0][d_samples_per_bit*8 - 1].Prompt_Q; // accumulate the input value in d_symbol_accumulator | ||||
|     d_symbol_accumulator_counter++; | ||||
|     if (d_symbol_accumulator_counter == 20) | ||||
|         { | ||||
| @@ -329,9 +341,9 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i | ||||
|     gps_synchro.valid_word = (d_flag_frame_sync == true and d_flag_parity == true); | ||||
|     gps_synchro.flag_preamble = d_flag_preamble; | ||||
|     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[0][0].Tracking_timestamp_secs - d_preamble_duration_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[0][0].Code_phase_secs - d_preamble_code_phase_seconds)*1000.0; | ||||
|     gps_synchro.satellite_PRN = this->d_satellite.get_PRN(); | ||||
|     gps_synchro.channel_ID = d_channel; | ||||
|     *out[0] = gps_synchro; | ||||
|   | ||||
| @@ -100,7 +100,7 @@ private: | ||||
|   bool d_flag_frame_sync; | ||||
|  | ||||
|   // symbols | ||||
|   int d_symbol_accumulator; | ||||
|   double d_symbol_accumulator; | ||||
|   short int d_symbol_accumulator_counter; | ||||
|  | ||||
|   //bits and frame | ||||
|   | ||||
| @@ -102,8 +102,18 @@ GpsL1CaDllFllPllTracking::GpsL1CaDllFllPllTracking( | ||||
|     if (item_type.compare("gr_complex") == 0) | ||||
|     { | ||||
|         item_size_ = sizeof(gr_complex); | ||||
|         tracking_ = gps_l1_ca_dll_fll_pll_make_tracking_cc(satellite_, f_if, | ||||
|                 fs_in, vector_length, queue_, dump, dump_filename, order, fll_bw_hz, pll_bw_hz,dll_bw_hz,early_late_space_chips); | ||||
|         tracking_ = gps_l1_ca_dll_fll_pll_make_tracking_cc( | ||||
|         		f_if, | ||||
|                 fs_in, | ||||
|                 vector_length, | ||||
|                 queue_, | ||||
|                 dump, | ||||
|                 dump_filename, | ||||
|                 order, | ||||
|                 fll_bw_hz, | ||||
|                 pll_bw_hz, | ||||
|                 dll_bw_hz, | ||||
|                 early_late_space_chips); | ||||
|     } | ||||
|     else | ||||
|     { | ||||
| @@ -122,13 +132,6 @@ void GpsL1CaDllFllPllTracking::start_tracking() | ||||
|     tracking_->start_tracking(); | ||||
| } | ||||
|  | ||||
| void GpsL1CaDllFllPllTracking::set_satellite(Gnss_Satellite satellite) | ||||
| { | ||||
|     satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); | ||||
|     tracking_->set_satellite(satellite_); | ||||
|     DLOG(INFO) << "DLL - PLL/FLL Tracking block now tracks satellite " << satellite_; | ||||
| } | ||||
|  | ||||
| void GpsL1CaDllFllPllTracking::set_channel(unsigned int channel) | ||||
| { | ||||
|     channel_ = channel; | ||||
| @@ -143,21 +146,12 @@ void GpsL1CaDllFllPllTracking::set_channel_queue( | ||||
|     tracking_->set_channel_queue(channel_internal_queue_); | ||||
|  | ||||
| } | ||||
| void GpsL1CaDllFllPllTracking::set_prn_code_phase(signed int phase_samples) | ||||
|  | ||||
| void GpsL1CaDllFllPllTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) | ||||
| { | ||||
|     return tracking_->set_acq_code_phase((float)phase_samples); | ||||
|     return tracking_->set_gnss_synchro(p_gnss_synchro); | ||||
| } | ||||
|  | ||||
| void GpsL1CaDllFllPllTracking::set_doppler_freq_shift(float doppler_freq_hz) | ||||
| { | ||||
|     return tracking_->set_acq_doppler(doppler_freq_hz); | ||||
| } | ||||
|  | ||||
| void GpsL1CaDllFllPllTracking::set_acq_sample_stamp( | ||||
|         unsigned long int sample_stamp) | ||||
| { | ||||
|     return tracking_->set_acq_sample_stamp(sample_stamp); | ||||
| } | ||||
| void GpsL1CaDllFllPllTracking::connect(gr_top_block_sptr top_block) | ||||
| { | ||||
|     //nothing to connect, now the tracking uses gr_sync_decimator | ||||
|   | ||||
| @@ -76,14 +76,12 @@ public: | ||||
|     gr_basic_block_sptr get_left_block(); | ||||
|     gr_basic_block_sptr get_right_block(); | ||||
|  | ||||
|     void set_satellite(Gnss_Satellite satellite); | ||||
|     void set_channel(unsigned int channel); | ||||
|     void set_prn_code_phase(signed int phase_samples); | ||||
|     void set_doppler_freq_shift(float doppler_freq_hz); | ||||
|     void set_channel_queue(concurrent_queue<int> *channel_internal_queue); | ||||
|  | ||||
|     void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro); | ||||
|  | ||||
|     void start_tracking(); | ||||
|     void set_acq_sample_stamp(unsigned long int sample_stamp); | ||||
|  | ||||
|  | ||||
| private: | ||||
| @@ -91,7 +89,6 @@ private: | ||||
|     gps_l1_ca_dll_fll_pll_tracking_cc_sptr tracking_; | ||||
|     size_t item_size_; | ||||
|  | ||||
|     Gnss_Satellite satellite_; | ||||
|     unsigned int channel_; | ||||
|  | ||||
|     std::string role_; | ||||
|   | ||||
| @@ -92,8 +92,16 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking( | ||||
|     if (item_type.compare("gr_complex") == 0) | ||||
|         { | ||||
|             item_size_ = sizeof(gr_complex); | ||||
|             tracking_ = gps_l1_ca_dll_pll_make_tracking_cc(satellite_, f_if, | ||||
|                     fs_in, vector_length, queue_, dump, dump_filename, pll_bw_hz,dll_bw_hz,early_late_space_chips); | ||||
|             tracking_ = gps_l1_ca_dll_pll_make_tracking_cc( | ||||
|             		f_if, | ||||
|                     fs_in, | ||||
|                     vector_length, | ||||
|                     queue_, | ||||
|                     dump, | ||||
|                     dump_filename, | ||||
|                     pll_bw_hz, | ||||
|                     dll_bw_hz, | ||||
|                     early_late_space_chips); | ||||
|         } | ||||
|     else | ||||
|         { | ||||
| @@ -112,16 +120,6 @@ void GpsL1CaDllPllTracking::start_tracking() | ||||
|     tracking_->start_tracking(); | ||||
| } | ||||
|  | ||||
| /* | ||||
|  * Set satellite ID | ||||
|  */ | ||||
| void GpsL1CaDllPllTracking::set_satellite(Gnss_Satellite satellite) | ||||
| { | ||||
|     satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); | ||||
|     tracking_->set_satellite(satellite_); | ||||
|     DLOG(INFO) << "DLL - PLL Tracking block now tracks satellite " << satellite_; | ||||
| } | ||||
|  | ||||
| /* | ||||
|  * Set tracking channel unique ID | ||||
|  */ | ||||
| @@ -143,29 +141,9 @@ void GpsL1CaDllPllTracking::set_channel_queue( | ||||
|  | ||||
| } | ||||
|  | ||||
| /* | ||||
|  * Set acquisition code phase in samples | ||||
|  */ | ||||
| void GpsL1CaDllPllTracking::set_prn_code_phase(signed int phase_samples) | ||||
| void GpsL1CaDllPllTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) | ||||
| { | ||||
|     return tracking_->set_acq_code_phase((float)phase_samples); | ||||
| } | ||||
|  | ||||
| /* | ||||
|  * Set acquisition Doppler frequency in Hz. | ||||
|  */ | ||||
| void GpsL1CaDllPllTracking::set_doppler_freq_shift(float doppler_freq_hz) | ||||
| { | ||||
|     return tracking_->set_acq_doppler(doppler_freq_hz); | ||||
| } | ||||
|  | ||||
| /* | ||||
|  * Set acquisition sample stamp in samples, in order to detect the delay between acquisition and tracking | ||||
|  */ | ||||
| void GpsL1CaDllPllTracking::set_acq_sample_stamp( | ||||
|         unsigned long int sample_stamp) | ||||
| { | ||||
|     return tracking_->set_acq_sample_stamp(sample_stamp); | ||||
|     tracking_->set_gnss_synchro(p_gnss_synchro); | ||||
| } | ||||
|  | ||||
| void GpsL1CaDllPllTracking::connect(gr_top_block_sptr top_block) | ||||
|   | ||||
| @@ -78,10 +78,6 @@ public: | ||||
|     gr_basic_block_sptr get_left_block(); | ||||
|     gr_basic_block_sptr get_right_block(); | ||||
|  | ||||
|     /*! | ||||
|      * \brief Set satellite ID | ||||
|      */ | ||||
|     void set_satellite(Gnss_Satellite satellite); | ||||
|  | ||||
|     /*! | ||||
|      * \brief Set tracking channel unique ID | ||||
| @@ -89,14 +85,10 @@ public: | ||||
|     void set_channel(unsigned int channel); | ||||
|  | ||||
|     /*! | ||||
|      * \brief Set acquisition code phase in samples | ||||
|      * \brief Set acquisition/tracking common Gnss_Synchro object pointer | ||||
|      * to efficiently exchange synchronization data between acquisition and tracking blocks | ||||
|      */ | ||||
|     void set_prn_code_phase(signed int phase_samples); | ||||
|  | ||||
|     /*! | ||||
|      * \brief Set acquisition Doppler frequency in Hz. | ||||
|      */ | ||||
|     void set_doppler_freq_shift(float doppler_freq_hz); | ||||
|     void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro); | ||||
|  | ||||
|     /*! | ||||
|      * \brief Set tracking channel internal queue | ||||
| @@ -105,18 +97,11 @@ public: | ||||
|  | ||||
|     void start_tracking(); | ||||
|  | ||||
|     /*! | ||||
|      * \brief Set acquisition sample stamp in samples, in order to detect | ||||
|      * the delay between acquisition and tracking | ||||
|      */ | ||||
|     void set_acq_sample_stamp(unsigned long int sample_stamp); | ||||
|  | ||||
| private: | ||||
|  | ||||
|     gps_l1_ca_dll_pll_tracking_cc_sptr tracking_; | ||||
|     size_t item_size_; | ||||
|  | ||||
|     Gnss_Satellite satellite_; | ||||
|     unsigned int channel_; | ||||
|  | ||||
|     std::string role_; | ||||
|   | ||||
| @@ -34,6 +34,7 @@ | ||||
|  * ------------------------------------------------------------------------- | ||||
|  */ | ||||
|  | ||||
| #include "gnss_synchro.h" | ||||
| #include "gps_l1_ca_dll_fll_pll_tracking_cc.h" | ||||
| #include "gps_sdr_signal_processing.h" | ||||
| #include "GPS_L1_CA.h" | ||||
| @@ -63,12 +64,21 @@ | ||||
| using google::LogMessage; | ||||
|  | ||||
| gps_l1_ca_dll_fll_pll_tracking_cc_sptr | ||||
| gps_l1_ca_dll_fll_pll_make_tracking_cc(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned | ||||
|         int vector_length, gr_msg_queue_sptr queue, bool dump, std::string dump_filename, int order, | ||||
|         float fll_bw_hz, float pll_bw_hz, float dll_bw_hz, float early_late_space_chips) | ||||
| gps_l1_ca_dll_fll_pll_make_tracking_cc( | ||||
| 		long if_freq, | ||||
| 		long fs_in, | ||||
| 		unsigned | ||||
|         int vector_length, | ||||
|         gr_msg_queue_sptr queue, | ||||
|         bool dump, std::string dump_filename, | ||||
|         int order, | ||||
|         float fll_bw_hz, | ||||
|         float pll_bw_hz, | ||||
|         float dll_bw_hz, | ||||
|         float early_late_space_chips) | ||||
| { | ||||
|  | ||||
|     return gps_l1_ca_dll_fll_pll_tracking_cc_sptr(new Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc(satellite, if_freq, | ||||
|     return gps_l1_ca_dll_fll_pll_tracking_cc_sptr(new Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc(if_freq, | ||||
|             fs_in, vector_length, queue, dump, dump_filename, order, fll_bw_hz, pll_bw_hz,dll_bw_hz, | ||||
|             early_late_space_chips)); | ||||
| } | ||||
| @@ -82,21 +92,27 @@ void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::forecast (int noutput_items, gr_vector_i | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc(Gnss_Satellite satellite, | ||||
|         long if_freq, long fs_in, unsigned int vector_length, gr_msg_queue_sptr queue, bool dump, | ||||
|         std::string dump_filename, int order, float fll_bw_hz, float pll_bw_hz, float dll_bw_hz, | ||||
| Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc( | ||||
| 		long if_freq, | ||||
| 		long fs_in, | ||||
| 		unsigned int vector_length, | ||||
| 		gr_msg_queue_sptr queue, | ||||
| 		bool dump, | ||||
|         std::string dump_filename, | ||||
|         int order, | ||||
|         float fll_bw_hz, | ||||
|         float pll_bw_hz, | ||||
|         float dll_bw_hz, | ||||
|         float early_late_space_chips) : | ||||
|         gr_block ("Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc", gr_make_io_signature (1, 1, sizeof(gr_complex)), | ||||
|                 gr_make_io_signature(5, 5, sizeof(double))) | ||||
|                 gr_make_io_signature(1, 1, sizeof(Gnss_Synchro))) | ||||
| { | ||||
|     //gr_sync_decimator ("gps_l1_ca_dll_pll_tracking_cc", gr_make_io_signature (1, 1, sizeof(gr_complex)), | ||||
|     //		gr_make_io_signature(3, 3, sizeof(float)),vector_length) { | ||||
|     // initialize internal vars | ||||
|     d_queue = queue; | ||||
|     d_dump = dump; | ||||
|     d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); | ||||
|  | ||||
|     d_acquisition_gnss_synchro=NULL; | ||||
|  | ||||
|     d_if_freq = if_freq; | ||||
|     d_fs_in = fs_in; | ||||
|     d_vector_length = vector_length; | ||||
| @@ -154,6 +170,11 @@ void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::start_tracking() | ||||
|     /* | ||||
|      *  correct the code phase according to the delay between acq and trk | ||||
|      */ | ||||
|  | ||||
| 	d_acq_code_phase_samples = d_acquisition_gnss_synchro->Acq_delay_samples; | ||||
| 	d_acq_carrier_doppler_hz = d_acquisition_gnss_synchro->Acq_doppler_hz; | ||||
| 	d_acq_sample_stamp =  d_acquisition_gnss_synchro->Acq_samplestamp_samples; | ||||
|  | ||||
|     unsigned long int acq_trk_diff_samples; | ||||
|     float acq_trk_diff_seconds; | ||||
|     acq_trk_diff_samples = d_sample_counter - d_acq_sample_stamp;//-d_vector_length; | ||||
| @@ -194,7 +215,7 @@ void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::start_tracking() | ||||
|     d_FLL_wait = 1; | ||||
|  | ||||
|     // generate local reference ALWAYS starting at chip 1 (1 sample per chip) | ||||
|     code_gen_conplex(&d_ca_code[1], this->d_satellite.get_PRN(), 0); | ||||
|     code_gen_conplex(&d_ca_code[1], d_acquisition_gnss_synchro->PRN, 0); | ||||
|  | ||||
|     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]; | ||||
| @@ -211,8 +232,8 @@ void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::start_tracking() | ||||
|     d_code_phase_samples = d_acq_code_phase_samples; | ||||
|  | ||||
|     // DEBUG OUTPUT | ||||
|     std::cout << "Tracking start on channel " << d_channel << " for satellite " << this->d_satellite << std::endl; | ||||
|     DLOG(INFO) << "Start tracking for satellite " << this->d_satellite << " received "; | ||||
|     std::cout << "Tracking start on channel " << d_channel << " for satellite " << d_acquisition_gnss_synchro->System << " "<< d_acquisition_gnss_synchro->PRN  << std::endl; | ||||
|     DLOG(INFO) << "Start tracking for satellite " << d_acquisition_gnss_synchro->System << " "<< d_acquisition_gnss_synchro->PRN  << " received "; | ||||
|  | ||||
|     // enable tracking | ||||
|     d_pull_in = true; | ||||
| @@ -295,6 +316,7 @@ Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::~Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc() | ||||
| int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_int &ninput_items, | ||||
|         gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) | ||||
| { | ||||
|  | ||||
|     float code_error_chips = 0; | ||||
|     float correlation_time_s = 0; | ||||
|     float PLL_discriminator_hz = 0; | ||||
| @@ -325,9 +347,15 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto | ||||
|                     consume_each(samples_offset); //shift input to perform alignment with local replica | ||||
|                     return 1; | ||||
|                 } | ||||
|  | ||||
|         	// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder | ||||
|         	Gnss_Synchro current_synchro_data; | ||||
|             // Fill the acquisition data | ||||
|              current_synchro_data=*d_acquisition_gnss_synchro; | ||||
|  | ||||
|             // get the sample in and out pointers | ||||
|             const gr_complex* in = (gr_complex*) input_items[0]; //block input samples pointer | ||||
|             double **out = (double **) &output_items[0];         //block output streams pointer | ||||
|             Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];         //block output streams pointer | ||||
|  | ||||
|             // check for samples consistency (this should be done before in the receiver / here only if the source is a file) | ||||
|             for(int i=0; i<d_current_prn_length_samples; i++) | ||||
| @@ -448,21 +476,28 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto | ||||
|                         } | ||||
|                 } | ||||
|  | ||||
|             /*! | ||||
|              * \todo Output the CN0 | ||||
|              */ | ||||
|             // ########### Output the tracking data to navigation and PVT ########## | ||||
|             // Output channel 0: Prompt correlator output Q | ||||
|             *out[0] = (double)d_Prompt.real(); | ||||
|             // Output channel 1: Prompt correlator output I | ||||
|             *out[1] = (double)d_Prompt.imag(); | ||||
|             // Output channel 2: PRN absolute delay [s] | ||||
|             *out[2] = d_sample_counter_seconds; | ||||
|             // Output channel 3: d_acc_carrier_phase_rad [rad] | ||||
|             *out[3] = (double)d_acc_carrier_phase_rad; | ||||
|             // Output channel 4: PRN code phase [s] | ||||
|             *out[4] = (double)d_code_phase_samples * (1/(float)d_fs_in); | ||||
| //            // Output channel 0: Prompt correlator output Q | ||||
| //            *out[0] = (double)d_Prompt.real(); | ||||
| //            // Output channel 1: Prompt correlator output I | ||||
| //            *out[1] = (double)d_Prompt.imag(); | ||||
| //            // Output channel 2: PRN absolute delay [s] | ||||
| //            *out[2] = d_sample_counter_seconds; | ||||
| //            // Output channel 3: d_acc_carrier_phase_rad [rad] | ||||
| //            *out[3] = (double)d_acc_carrier_phase_rad; | ||||
| //            // Output channel 4: PRN code phase [s] | ||||
| //            *out[4] = (double)d_code_phase_samples * (1/(float)d_fs_in); | ||||
|  | ||||
|  | ||||
|             current_synchro_data.Prompt_I=(double)d_Prompt.real(); | ||||
|             current_synchro_data.Prompt_Q=(double)d_Prompt.imag(); | ||||
|             current_synchro_data.Tracking_timestamp_secs=d_sample_counter_seconds; | ||||
|             current_synchro_data.Carrier_phase_rads=(double)d_acc_carrier_phase_rad; | ||||
|             current_synchro_data.Code_phase_secs=(double)d_code_phase_samples * (1/(float)d_fs_in); | ||||
|             current_synchro_data.CN0_dB_hz=(double)d_CN0_SNV_dB_Hz; | ||||
|  | ||||
|  | ||||
|             *out[0] =current_synchro_data; | ||||
|             // ########## DEBUG OUTPUT | ||||
|             /*! | ||||
|              *  \todo The stop timer has to be moved to the signal source! | ||||
| @@ -474,7 +509,7 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto | ||||
|                         { | ||||
|                             d_last_seg = floor(d_sample_counter/d_fs_in); | ||||
|                             std::cout << "Current input signal time = " << d_last_seg << " [s]" << std::endl; | ||||
|                             std::cout << "Tracking CH " << d_channel <<  ": Satellite " << this->d_satellite << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl; | ||||
|                             std::cout << "Tracking CH " << d_channel <<  ": Satellite " << d_acquisition_gnss_synchro->System << " "<< d_acquisition_gnss_synchro->PRN  << ", 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; | ||||
|                             //if (d_last_seg==5) d_carrier_lock_fail_counter=500; //DEBUG: force unlock! | ||||
|                         } | ||||
| @@ -484,7 +519,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) | ||||
|                         { | ||||
|                             d_last_seg = floor(d_sample_counter/d_fs_in); | ||||
|                             std::cout << "Tracking CH " << d_channel <<  ": Satellite " << this->d_satellite << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl; | ||||
|                             std::cout << "Tracking CH " << d_channel <<  ": Satellite " << d_acquisition_gnss_synchro->System << " "<< d_acquisition_gnss_synchro->PRN  << ", 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; | ||||
|                         } | ||||
|                 } | ||||
| @@ -514,12 +549,14 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto | ||||
|         } | ||||
|     else | ||||
|         { | ||||
|             double **out = (double **) &output_items[0]; //block output streams pointer | ||||
|             *out[0] = 0; | ||||
|             *out[1] = 0; | ||||
|             *out[2] = 0; | ||||
|             *out[3] = 0; | ||||
|             *out[4] = 0; | ||||
| //            double **out = (double **) &output_items[0]; //block output streams pointer | ||||
| //            *out[0] = 0; | ||||
| //            *out[1] = 0; | ||||
| //            *out[2] = 0; | ||||
| //            *out[3] = 0; | ||||
| //            *out[4] = 0; | ||||
|     	     Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0]; //block output streams pointer | ||||
| 			*out[0]=*d_acquisition_gnss_synchro; | ||||
|         } | ||||
|  | ||||
|  | ||||
| @@ -583,35 +620,6 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::set_acq_code_phase(float code_phase) | ||||
| { | ||||
|     d_acq_code_phase_samples = code_phase; | ||||
|     DLOG(INFO) << "Tracking code phase set to " << d_acq_code_phase_samples; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::set_acq_doppler(float doppler) | ||||
| { | ||||
|     d_acq_carrier_doppler_hz = doppler; | ||||
|     DLOG(INFO) << "Tracking carrier doppler set to " << d_acq_carrier_doppler_hz; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::set_satellite(Gnss_Satellite satellite) | ||||
| { | ||||
|     d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); | ||||
|     DLOG(INFO) << "Tracking Satellite set to " << d_satellite; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::set_channel(unsigned int channel) | ||||
| { | ||||
|     d_channel = channel; | ||||
| @@ -639,15 +647,18 @@ void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::set_channel(unsigned int channel) | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::set_acq_sample_stamp(unsigned long int sample_stamp) | ||||
| { | ||||
|     d_acq_sample_stamp = sample_stamp; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::set_channel_queue(concurrent_queue<int> *channel_internal_queue) | ||||
| { | ||||
|     d_channel_internal_queue = channel_internal_queue; | ||||
| } | ||||
|  | ||||
| void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) | ||||
| { | ||||
| 	d_acquisition_gnss_synchro=p_gnss_synchro; | ||||
|  | ||||
|     //	Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); | ||||
|     //DLOG(INFO) << "Tracking code phase set to " << d_acq_code_phase_samples; | ||||
|     //DLOG(INFO) << "Tracking carrier doppler set to " << d_acq_carrier_doppler_hz; | ||||
|     //DLOG(INFO) << "Tracking Satellite set to " << d_satellite; | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -48,6 +48,7 @@ | ||||
| #include "gps_sdr_signal_processing.h" | ||||
| #include "gnss_satellite.h" | ||||
| #include "tracking_FLL_PLL_filter.h" | ||||
| #include "gnss_synchro.h" | ||||
|  | ||||
|  | ||||
| //#include "GPS_L1_CA.h" | ||||
| @@ -58,7 +59,7 @@ typedef boost::shared_ptr<Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc> | ||||
| gps_l1_ca_dll_fll_pll_tracking_cc_sptr; | ||||
|  | ||||
| gps_l1_ca_dll_fll_pll_tracking_cc_sptr | ||||
| gps_l1_ca_dll_fll_pll_make_tracking_cc(Gnss_Satellite satellite, | ||||
| gps_l1_ca_dll_fll_pll_make_tracking_cc( | ||||
|         long if_freq, | ||||
|         long fs_in, | ||||
|         unsigned int vector_length, | ||||
| @@ -82,15 +83,12 @@ public: | ||||
|  | ||||
|     ~Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc(); | ||||
|  | ||||
|     void set_satellite(Gnss_Satellite satellite); | ||||
|     void set_channel(unsigned int channel); | ||||
|     void set_acq_code_phase(float code_phase); | ||||
|     void set_acq_doppler(float doppler); | ||||
|     void start_tracking(); | ||||
|     void update_local_code(); | ||||
|     void update_local_carrier(); | ||||
|     void set_FLL_and_PLL_BW(float fll_bw_hz,float pll_bw_hz); | ||||
|     void set_acq_sample_stamp(unsigned long int sample_stamp); | ||||
|     void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro); | ||||
|     void set_channel_queue(concurrent_queue<int> *channel_internal_queue); | ||||
|  | ||||
|     /* | ||||
| @@ -113,7 +111,7 @@ public: | ||||
| private: | ||||
|  | ||||
|     friend gps_l1_ca_dll_fll_pll_tracking_cc_sptr | ||||
|     gps_l1_ca_dll_fll_pll_make_tracking_cc(Gnss_Satellite satellite, | ||||
|     gps_l1_ca_dll_fll_pll_make_tracking_cc( | ||||
|             long if_freq, | ||||
|             long fs_in, unsigned | ||||
|             int vector_length, | ||||
| @@ -126,7 +124,7 @@ private: | ||||
|             float dll_bw_hz, | ||||
|             float early_late_space_chips); | ||||
|  | ||||
|     Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc(Gnss_Satellite satellite, | ||||
|     Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc( | ||||
|             long if_freq, | ||||
|             long fs_in, unsigned | ||||
|             int vector_length, | ||||
| @@ -142,11 +140,11 @@ private: | ||||
|     void CN0_estimation_and_lock_detectors(); | ||||
|  | ||||
|     // class private vars | ||||
|     Gnss_Synchro *d_acquisition_gnss_synchro; | ||||
|     gr_msg_queue_sptr d_queue; | ||||
|     concurrent_queue<int> *d_channel_internal_queue; | ||||
|     unsigned int d_vector_length; | ||||
|     bool d_dump; | ||||
|     Gnss_Satellite d_satellite; | ||||
|     unsigned int d_channel; | ||||
|     int d_last_seg; | ||||
|     long d_if_freq; | ||||
|   | ||||
| @@ -34,6 +34,7 @@ | ||||
|  * ------------------------------------------------------------------------- | ||||
|  */ | ||||
|  | ||||
| #include "gnss_synchro.h" | ||||
| #include "gps_l1_ca_dll_pll_tracking_cc.h" | ||||
| #include "gps_sdr_signal_processing.h" | ||||
| #include "tracking_discriminators.h" | ||||
| @@ -63,11 +64,18 @@ | ||||
| using google::LogMessage; | ||||
|  | ||||
| gps_l1_ca_dll_pll_tracking_cc_sptr | ||||
| gps_l1_ca_dll_pll_make_tracking_cc(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned | ||||
| 			int vector_length, gr_msg_queue_sptr queue, bool dump, std::string dump_filename, | ||||
| 			float pll_bw_hz, float dll_bw_hz, float early_late_space_chips) | ||||
| gps_l1_ca_dll_pll_make_tracking_cc( | ||||
| 		long if_freq, | ||||
| 		long fs_in, | ||||
| 		unsigned int vector_length, | ||||
| 		gr_msg_queue_sptr queue, | ||||
| 		bool dump, | ||||
| 		std::string dump_filename, | ||||
| 		float pll_bw_hz, | ||||
| 		float dll_bw_hz, | ||||
| 		float early_late_space_chips) | ||||
| { | ||||
| 	return gps_l1_ca_dll_pll_tracking_cc_sptr(new Gps_L1_Ca_Dll_Pll_Tracking_cc(satellite, if_freq, | ||||
| 	return gps_l1_ca_dll_pll_tracking_cc_sptr(new Gps_L1_Ca_Dll_Pll_Tracking_cc(if_freq, | ||||
| 			fs_in, vector_length, queue, dump, dump_filename, pll_bw_hz, dll_bw_hz, early_late_space_chips)); | ||||
| } | ||||
|  | ||||
| @@ -81,10 +89,18 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::forecast (int noutput_items, | ||||
|  | ||||
|  | ||||
|  | ||||
| Gps_L1_Ca_Dll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Pll_Tracking_cc(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned | ||||
|         int vector_length, gr_msg_queue_sptr queue, bool dump, std::string dump_filename, float pll_bw_hz, float dll_bw_hz, float early_late_space_chips) : | ||||
| Gps_L1_Ca_Dll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Pll_Tracking_cc( | ||||
| 		long if_freq, | ||||
| 		long fs_in, | ||||
| 		unsigned int vector_length, | ||||
| 		gr_msg_queue_sptr queue, | ||||
| 		bool dump, | ||||
| 		std::string dump_filename, | ||||
| 		float pll_bw_hz, | ||||
| 		float dll_bw_hz, | ||||
| 		float early_late_space_chips) : | ||||
|         gr_block ("Gps_L1_Ca_Dll_Pll_Tracking_cc", gr_make_io_signature (1, 1, sizeof(gr_complex)), | ||||
|                 gr_make_io_signature(5, 5, sizeof(double))) | ||||
|                 gr_make_io_signature(1, 1, sizeof(Gnss_Synchro))) | ||||
| { | ||||
|  | ||||
|     //gr_sync_decimator ("Gps_L1_Ca_Dll_Pll_Tracking_cc", gr_make_io_signature (1, 1, sizeof(gr_complex)), | ||||
| @@ -92,7 +108,6 @@ Gps_L1_Ca_Dll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Pll_Tracking_cc(Gnss_Satellite sate | ||||
|     // initialize internal vars | ||||
|     d_queue = queue; | ||||
|     d_dump = dump; | ||||
|     d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); | ||||
|     d_if_freq = if_freq; | ||||
|     d_fs_in = fs_in; | ||||
|     d_vector_length = vector_length; | ||||
| @@ -151,6 +166,11 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::start_tracking() | ||||
|     /* | ||||
|      *  correct the code phase according to the delay between acq and trk | ||||
|      */ | ||||
|  | ||||
| 	d_acq_code_phase_samples = d_acquisition_gnss_synchro->Acq_delay_samples; | ||||
| 	d_acq_carrier_doppler_hz = d_acquisition_gnss_synchro->Acq_doppler_hz; | ||||
| 	d_acq_sample_stamp =  d_acquisition_gnss_synchro->Acq_samplestamp_samples; | ||||
|  | ||||
|     unsigned long int acq_trk_diff_samples; | ||||
|     float acq_trk_diff_seconds; | ||||
|     acq_trk_diff_samples = d_sample_counter - d_acq_sample_stamp;//-d_vector_length; | ||||
| @@ -197,7 +217,7 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::start_tracking() | ||||
|     d_code_loop_filter.initialize(d_acq_code_phase_samples); //initialize the code filter | ||||
|  | ||||
|     // 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], d_acquisition_gnss_synchro->PRN, 0); | ||||
|     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]; | ||||
|  | ||||
| @@ -211,8 +231,8 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::start_tracking() | ||||
|     d_code_phase_samples = d_acq_code_phase_samples; | ||||
|  | ||||
|     // DEBUG OUTPUT | ||||
|     std::cout << "Tracking start on channel " << d_channel << " for satellite " << this->d_satellite << std::endl; | ||||
|     DLOG(INFO) << "Start tracking for satellite " << this->d_satellite << " received" << std::endl; | ||||
|     std::cout << "Tracking start on channel " << d_channel << " for satellite " << d_acquisition_gnss_synchro->System << " "<< d_acquisition_gnss_synchro->PRN << std::endl; | ||||
|     DLOG(INFO) << "Start tracking for satellite " << d_acquisition_gnss_synchro->System << " "<< d_acquisition_gnss_synchro->PRN  << " received" << std::endl; | ||||
|  | ||||
|     // enable tracking | ||||
|     d_pull_in = true; | ||||
| @@ -347,8 +367,13 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_in | ||||
|                     return 1; | ||||
|                 } | ||||
|  | ||||
|         	// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder | ||||
|         	Gnss_Synchro current_synchro_data; | ||||
|             // Fill the acquisition data | ||||
|             current_synchro_data=*d_acquisition_gnss_synchro; | ||||
|  | ||||
|             const gr_complex* in = (gr_complex*) input_items[0]; //PRN start block alignement | ||||
|             double **out = (double **) &output_items[0]; | ||||
|             Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0]; | ||||
|  | ||||
|             // check for samples consistency | ||||
|             for(int i=0; i<d_current_prn_length_samples; i++) | ||||
| @@ -468,20 +493,26 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_in | ||||
|                     //std::cout<<"d_carrier_lock_fail_counter"<<d_carrier_lock_fail_counter<<"\r\n"; | ||||
|                 } | ||||
|  | ||||
|             /*! | ||||
|              * \todo Output the CN0 | ||||
|              */ | ||||
|             // ########### Output the tracking data to navigation and PVT ########## | ||||
|             // Output channel 0: Prompt correlator output Q | ||||
|             *out[0] = (double)d_Prompt.real(); | ||||
|             // Output channel 1: Prompt correlator output I | ||||
|             *out[1] = (double)d_Prompt.imag(); | ||||
|             // Output channel 2: PRN absolute delay [s] | ||||
|             *out[2] = d_sample_counter_seconds; | ||||
|             // Output channel 3: d_acc_carrier_phase_rad [rad] | ||||
|             *out[3] = (double)d_acc_carrier_phase_rad; | ||||
|             // Output channel 4: PRN code phase [s] | ||||
|             *out[4] = (double)d_code_phase_samples * (1 / (float)d_fs_in); | ||||
| //            // Output channel 0: Prompt correlator output Q | ||||
| //            *out[0] = (double)d_Prompt.real(); | ||||
| //            // Output channel 1: Prompt correlator output I | ||||
| //            *out[1] = (double)d_Prompt.imag(); | ||||
| //            // Output channel 2: PRN absolute delay [s] | ||||
| //            *out[2] = d_sample_counter_seconds; | ||||
| //            // Output channel 3: d_acc_carrier_phase_rad [rad] | ||||
| //            *out[3] = (double)d_acc_carrier_phase_rad; | ||||
| //            // Output channel 4: PRN code phase [s] | ||||
| //            *out[4] = (double)d_code_phase_samples * (1/(float)d_fs_in); | ||||
|  | ||||
|  | ||||
|             current_synchro_data.Prompt_I=(double)d_Prompt.real(); | ||||
|             current_synchro_data.Prompt_Q=(double)d_Prompt.imag(); | ||||
|             current_synchro_data.Tracking_timestamp_secs=d_sample_counter_seconds; | ||||
|             current_synchro_data.Carrier_phase_rads=(double)d_acc_carrier_phase_rad; | ||||
|             current_synchro_data.Code_phase_secs=(double)d_code_phase_samples * (1/(float)d_fs_in); | ||||
|             current_synchro_data.CN0_dB_hz=(double)d_CN0_SNV_dB_Hz; | ||||
|             *out[0]=current_synchro_data; | ||||
|  | ||||
|             // ########## DEBUG OUTPUT | ||||
|             /*! | ||||
| @@ -494,7 +525,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_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 << "Tracking CH " << d_channel <<  ": Satellite " << this->d_satellite << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl; | ||||
|                             std::cout << "Tracking CH " << d_channel <<  ": Satellite " << d_acquisition_gnss_synchro->System << " "<< d_acquisition_gnss_synchro->PRN  << ", 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; | ||||
|                             //if (d_last_seg==5) d_carrier_lock_fail_counter=500; //DEBUG: force unlock! | ||||
|                         } | ||||
| @@ -504,19 +535,32 @@ 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) | ||||
|                         { | ||||
|                             d_last_seg = floor(d_sample_counter / d_fs_in); | ||||
|                             std::cout << "Tracking CH " << d_channel <<  ": Satellite " << this->d_satellite << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl; | ||||
|                             std::cout << "Tracking CH " << d_channel <<  ": Satellite " << d_acquisition_gnss_synchro->System << " "<< d_acquisition_gnss_synchro->PRN << ", 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; | ||||
|                         } | ||||
|                 } | ||||
|         } | ||||
|     else | ||||
|         { | ||||
|             double **out = (double **) &output_items[0]; //block output streams pointer | ||||
|             *out[0] = 0; | ||||
|             *out[1] = 0; | ||||
|             *out[2] = 0; | ||||
|             *out[3] = 0; | ||||
|             *out[4] = 0; | ||||
| 			Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0]; //block output streams pointer | ||||
| 			//std::cout<<output_items.size()<<std::endl; | ||||
|         	// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder | ||||
|         	Gnss_Synchro current_synchro_data; | ||||
|         	//void* current_synchro_data_b; | ||||
|         	//char* p = (char*)malloc(sizeof(Gnss_Synchro)); | ||||
|         	//current_synchro_data_b= (void*) new (p) Gnss_Synchro(); | ||||
|         	//*((Gnss_Synchro*)current_synchro_data_b)=current_synchro_data; | ||||
|         	//free(p); | ||||
|             //current_synchro_data.Acq_delay_samples=d_acquisition_gnss_synchro->Acq_delay_samples; | ||||
|             //current_synchro_data.Acq_doppler_hz=d_acquisition_gnss_synchro->Acq_doppler_hz; | ||||
|             //current_synchro_data.Acq_samplestamp_samples=d_acquisition_gnss_synchro->Acq_samplestamp_samples; | ||||
|             //current_synchro_data.Signal=d_acquisition_gnss_synchro->Signal; //copy the object signal | ||||
| 			//std::cout<<noutput_items<<std::endl; | ||||
| 			//std::cout<<"size of sizeof(Gnss_Synchro)="<<sizeof(Gnss_Synchro)<<std::endl; | ||||
|  | ||||
| 			*out[0]=current_synchro_data; | ||||
|  | ||||
|  | ||||
|         } | ||||
|  | ||||
|     if(d_dump) | ||||
| @@ -581,41 +625,6 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_in | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| void Gps_L1_Ca_Dll_Pll_Tracking_cc::set_acq_code_phase(float code_phase) | ||||
| { | ||||
| 	d_acq_code_phase_samples = code_phase; | ||||
| 	LOG_AT_LEVEL(INFO) << "Tracking code phase set to " << d_acq_code_phase_samples; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| void Gps_L1_Ca_Dll_Pll_Tracking_cc::set_acq_doppler(float doppler) | ||||
| { | ||||
| 	d_acq_carrier_doppler_hz = doppler; | ||||
| 	LOG_AT_LEVEL(INFO) << "Tracking carrier doppler set to " << d_acq_carrier_doppler_hz; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| void Gps_L1_Ca_Dll_Pll_Tracking_cc::set_satellite(Gnss_Satellite satellite) | ||||
| { | ||||
| 	d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); | ||||
| 	LOG_AT_LEVEL(INFO) << "Tracking Satellite set to " << d_satellite; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| void Gps_L1_Ca_Dll_Pll_Tracking_cc::set_channel(unsigned int channel) | ||||
| { | ||||
|     d_channel = channel; | ||||
| @@ -643,15 +652,18 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::set_channel(unsigned int channel) | ||||
|  | ||||
|  | ||||
|  | ||||
| void Gps_L1_Ca_Dll_Pll_Tracking_cc::set_acq_sample_stamp(unsigned long int sample_stamp) | ||||
| { | ||||
|     d_acq_sample_stamp = sample_stamp; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| void Gps_L1_Ca_Dll_Pll_Tracking_cc::set_channel_queue(concurrent_queue<int> *channel_internal_queue) | ||||
| { | ||||
|     d_channel_internal_queue = channel_internal_queue; | ||||
| } | ||||
|  | ||||
| void Gps_L1_Ca_Dll_Pll_Tracking_cc::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) | ||||
| { | ||||
| 	d_acquisition_gnss_synchro=p_gnss_synchro; | ||||
|  | ||||
|     //	Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); | ||||
|     //DLOG(INFO) << "Tracking code phase set to " << d_acq_code_phase_samples; | ||||
|     //DLOG(INFO) << "Tracking carrier doppler set to " << d_acq_carrier_doppler_hz; | ||||
|     //DLOG(INFO) << "Tracking Satellite set to " << d_satellite; | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -46,6 +46,7 @@ | ||||
| #include "concurrent_queue.h" | ||||
| #include "gps_sdr_signal_processing.h" | ||||
| #include "gnss_satellite.h" | ||||
| #include "gnss_synchro.h" | ||||
| #include "tracking_2nd_DLL_filter.h" | ||||
| #include "tracking_2nd_PLL_filter.h" | ||||
|  | ||||
| @@ -56,7 +57,7 @@ typedef boost::shared_ptr<Gps_L1_Ca_Dll_Pll_Tracking_cc> | ||||
|         gps_l1_ca_dll_pll_tracking_cc_sptr; | ||||
|  | ||||
| gps_l1_ca_dll_pll_tracking_cc_sptr | ||||
| gps_l1_ca_dll_pll_make_tracking_cc(Gnss_Satellite satellite, long if_freq, | ||||
| gps_l1_ca_dll_pll_make_tracking_cc(long if_freq, | ||||
|                                    long fs_in, unsigned | ||||
|                                    int vector_length, | ||||
|                                    gr_msg_queue_sptr queue, | ||||
| @@ -77,12 +78,9 @@ public: | ||||
|  | ||||
|     ~Gps_L1_Ca_Dll_Pll_Tracking_cc(); | ||||
|  | ||||
|     void set_satellite(Gnss_Satellite satellite); | ||||
|     void set_channel(unsigned int channel); | ||||
|     void set_acq_code_phase(float code_phase); | ||||
|     void set_acq_doppler(float doppler); | ||||
|     void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro); | ||||
|     void start_tracking(); | ||||
|     void set_acq_sample_stamp(unsigned long int sample_stamp); | ||||
|     void set_channel_queue(concurrent_queue<int> *channel_internal_queue); | ||||
|  | ||||
|     /* | ||||
| @@ -105,7 +103,7 @@ public: | ||||
| private: | ||||
|  | ||||
|     friend gps_l1_ca_dll_pll_tracking_cc_sptr | ||||
|     gps_l1_ca_dll_pll_make_tracking_cc(Gnss_Satellite satellite, long if_freq, | ||||
|     gps_l1_ca_dll_pll_make_tracking_cc(long if_freq, | ||||
|             long fs_in, unsigned | ||||
|             int vector_length, | ||||
|             gr_msg_queue_sptr queue, | ||||
| @@ -115,7 +113,7 @@ private: | ||||
|             float dll_bw_hz, | ||||
|             float early_late_space_chips); | ||||
|  | ||||
|     Gps_L1_Ca_Dll_Pll_Tracking_cc(Gnss_Satellite satellite, long if_freq, | ||||
|     Gps_L1_Ca_Dll_Pll_Tracking_cc(long if_freq, | ||||
|             long fs_in, unsigned | ||||
|             int vector_length, | ||||
|             gr_msg_queue_sptr queue, | ||||
| @@ -132,7 +130,8 @@ private: | ||||
|     concurrent_queue<int> *d_channel_internal_queue; | ||||
|     unsigned int d_vector_length; | ||||
|     bool d_dump; | ||||
|     Gnss_Satellite d_satellite; | ||||
|  | ||||
|     Gnss_Synchro* d_acquisition_gnss_synchro; | ||||
|     unsigned int d_channel; | ||||
|     int d_last_seg; | ||||
|     long d_if_freq; | ||||
|   | ||||
| @@ -39,7 +39,7 @@ | ||||
| #define GNSS_SDR_ACQUISITION_INTERFACE_H_ | ||||
|  | ||||
| #include "gnss_block_interface.h" | ||||
| #include "gnss_satellite.h" | ||||
| #include "gnss_synchro.h" | ||||
|  | ||||
| template<typename Data>class concurrent_queue; | ||||
|  | ||||
| @@ -56,17 +56,15 @@ class AcquisitionInterface: public GNSSBlockInterface | ||||
| public: | ||||
|  | ||||
|     //virtual void set_active(bool active) = 0; | ||||
|     virtual void set_satellite(Gnss_Satellite sat) = 0; | ||||
| 	virtual void set_gnss_synchro(Gnss_Synchro* gnss_synchro) = 0; | ||||
|     virtual void set_channel(unsigned int channel) = 0; | ||||
|     virtual void set_threshold(float threshold) = 0; | ||||
|     virtual void set_doppler_max(unsigned int doppler_max) = 0; | ||||
|     virtual void set_doppler_step(unsigned int doppler_step) = 0; | ||||
|     virtual void set_channel_queue(concurrent_queue<int> *channel_internal_queue) = 0; | ||||
|     virtual signed int prn_code_phase() = 0; | ||||
|     virtual float doppler_freq_shift() = 0; | ||||
|     virtual void init() = 0; | ||||
|     virtual signed int mag() = 0; | ||||
|     virtual void reset() = 0; | ||||
|     virtual unsigned long int get_sample_stamp() = 0; | ||||
|  | ||||
| }; | ||||
|  | ||||
|   | ||||
| @@ -38,7 +38,7 @@ | ||||
| #define GNSS_SDR_TRACKING_INTERFACE_H_ | ||||
|  | ||||
| #include "gnss_block_interface.h" | ||||
| #include "gnss_satellite.h" | ||||
| #include "gnss_synchro.h" | ||||
|  | ||||
| template<typename Data>class concurrent_queue; | ||||
|  | ||||
| @@ -57,11 +57,8 @@ class TrackingInterface : public GNSSBlockInterface | ||||
| public: | ||||
|  | ||||
|     virtual void start_tracking() = 0; | ||||
|     virtual void set_satellite(Gnss_Satellite sat) = 0; | ||||
|     virtual void set_gnss_synchro(Gnss_Synchro* gnss_synchro) = 0; | ||||
|     virtual void set_channel(unsigned int channel) = 0; | ||||
|     virtual void set_prn_code_phase(signed int phase_samples) = 0; | ||||
|     virtual void set_doppler_freq_shift(float doppler_freq_hz) = 0; | ||||
|     virtual void set_acq_sample_stamp(unsigned long int sample_stamp) = 0; | ||||
|     virtual void set_channel_queue(concurrent_queue<int> *channel_internal_queue) = 0; | ||||
|  | ||||
| }; | ||||
|   | ||||
| @@ -254,21 +254,21 @@ GNSSBlockInterface* GNSSBlockFactory::GetBlock( | ||||
|  | ||||
|     // ACQUISITION BLOCKS --------------------------------------------------------- | ||||
|  | ||||
|     else if (implementation.compare("GPS_L1_CA_GPS_SDR_Acquisition") == 0) | ||||
|         { | ||||
|             block = new GpsL1CaGpsSdrAcquisition(configuration, role, in_streams, | ||||
|                     out_streams, queue); | ||||
|         } | ||||
| //    else if (implementation.compare("GPS_L1_CA_GPS_SDR_Acquisition") == 0) | ||||
| //        { | ||||
| //            block = new GpsL1CaGpsSdrAcquisition(configuration, role, in_streams, | ||||
| //                    out_streams, queue); | ||||
| //        } | ||||
|     else if (implementation.compare("GPS_L1_CA_PCPS_Acquisition") == 0) | ||||
|         { | ||||
|             block = new GpsL1CaPcpsAcquisition(configuration, role, in_streams, | ||||
|                     out_streams, queue); | ||||
|         } | ||||
|     else if (implementation.compare("GPS_L1_CA_TONG_PCPS_Acquisition") == 0) | ||||
|         { | ||||
|             block = new GpsL1CaTongPcpsAcquisition(configuration, role, | ||||
|                     in_streams, out_streams, queue); | ||||
|         } | ||||
| //    else if (implementation.compare("GPS_L1_CA_TONG_PCPS_Acquisition") == 0) | ||||
| //        { | ||||
| //            block = new GpsL1CaTongPcpsAcquisition(configuration, role, | ||||
| //                    in_streams, out_streams, queue); | ||||
| //        } | ||||
|  | ||||
|     // TRACKING BLOCKS ------------------------------------------------------------- | ||||
|  | ||||
|   | ||||
| @@ -63,6 +63,13 @@ Gnss_Satellite::~Gnss_Satellite() | ||||
| void Gnss_Satellite::reset() | ||||
| { | ||||
|     system_set = {"GPS", "GLONASS", "SBAS", "Galileo", "Compass"}; | ||||
|  | ||||
|     satelliteSystem["GPS"] = "G"; | ||||
|     satelliteSystem["GLONASS"] = "R"; | ||||
|     satelliteSystem["SBAS"] = "S"; | ||||
|     satelliteSystem["Galileo"] = "E"; | ||||
|     satelliteSystem["Compass"] = "C"; | ||||
|  | ||||
|     PRN = 0; | ||||
|     system = std::string(""); | ||||
|     block = std::string(""); | ||||
| @@ -219,6 +226,12 @@ std::string Gnss_Satellite::get_system() const | ||||
|     return system_; | ||||
| } | ||||
|  | ||||
| std::string Gnss_Satellite::get_system_short() const | ||||
| { | ||||
|     // Get the satellite system {"GPS", "GLONASS", "SBAS", "Galileo", "Compass"} | ||||
|  | ||||
|     return satelliteSystem.at(system); | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -35,7 +35,7 @@ | ||||
| #include <string> | ||||
| #include <set> | ||||
| #include <iostream> | ||||
|  | ||||
| #include <map> | ||||
| /* | ||||
|  * \brief This class represents a GNSS satellite. | ||||
|  * | ||||
| @@ -50,6 +50,7 @@ public: | ||||
|     ~Gnss_Satellite();                   //!< Default Destructor. | ||||
|     unsigned int get_PRN() const;              //!< Gets satellite's PRN | ||||
|     std::string get_system() const;            //!< Gets the satellite system {"GPS", "GLONASS", "SBAS", "Galileo", "Compass"} | ||||
|     std::string get_system_short() const;            //!< Gets the satellite system {"GPS", "GLONASS", "SBAS", "Galileo", "Compass"} | ||||
|     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 std::ostream& operator<<(std::ostream &, const Gnss_Satellite &); // operator<< for pretty printing | ||||
| @@ -57,6 +58,7 @@ public: | ||||
| private: | ||||
|     unsigned int PRN; | ||||
|     std::string system; | ||||
|     std::map<std::string,std::string> satelliteSystem; | ||||
|     std::string block; | ||||
|     signed int rf_link; | ||||
|     void set_system(std::string system);  // Sets the satellite system {"GPS", "GLONASS", "SBAS", "Galileo", "Compass"}. | ||||
|   | ||||
| @@ -33,6 +33,10 @@ | ||||
|  | ||||
| Gnss_Synchro::Gnss_Synchro() | ||||
| { | ||||
| 	// Satellite and signal info | ||||
| 	//System=" "; | ||||
| 	//Signal="  "; | ||||
| 	PRN=0; | ||||
| 	// Acquisition | ||||
| 	Acq_delay_samples=0.0; | ||||
| 	Acq_doppler_hz=0.0; | ||||
|   | ||||
| @@ -42,7 +42,11 @@ public: | ||||
| 	Gnss_Synchro(); | ||||
| 	~Gnss_Synchro(); | ||||
|  | ||||
| 	Gnss_Signal Signal; | ||||
| 	//Gnss_Signal Signal; | ||||
| 	// Satellite and signal info | ||||
| 	char System; | ||||
| 	char Signal[3]; | ||||
| 	unsigned int PRN; | ||||
| 	// Acquisition | ||||
| 	double Acq_delay_samples; | ||||
| 	double Acq_doppler_hz; | ||||
|   | ||||
| @@ -1,12 +1,12 @@ | ||||
| project : build-dir ../../build ; | ||||
| exe gnss-sdr : main.cc | ||||
| ../algorithms/acquisition/adapters//gps_l1_ca_gps_sdr_acquisition | ||||
| #../algorithms/acquisition/adapters//gps_l1_ca_gps_sdr_acquisition | ||||
| ../algorithms/acquisition/adapters//gps_l1_ca_pcps_acquisition | ||||
| ../algorithms/acquisition/adapters//gps_l1_ca_tong_pcps_acquisition | ||||
| ../algorithms/acquisition/gnuradio_blocks//gps_l1_ca_gps_sdr_acquisition_cc | ||||
| ../algorithms/acquisition/gnuradio_blocks//gps_l1_ca_gps_sdr_acquisition_ss | ||||
| #../algorithms/acquisition/adapters//gps_l1_ca_tong_pcps_acquisition | ||||
| #../algorithms/acquisition/gnuradio_blocks//gps_l1_ca_gps_sdr_acquisition_cc | ||||
| #../algorithms/acquisition/gnuradio_blocks//gps_l1_ca_gps_sdr_acquisition_ss | ||||
| ../algorithms/acquisition/gnuradio_blocks//gps_l1_ca_pcps_acquisition_cc | ||||
| ../algorithms/acquisition/gnuradio_blocks//gps_l1_ca_tong_pcps_acquisition_cc | ||||
| #../algorithms/acquisition/gnuradio_blocks//gps_l1_ca_tong_pcps_acquisition_cc | ||||
| ../algorithms/channel/adapters//channel | ||||
| ../algorithms/channel/libs//gps_l1_ca_channel_fsm | ||||
| ../algorithms/conditioner/adapters//direct_resampler_conditioner | ||||
|   | ||||
| @@ -1,13 +1,13 @@ | ||||
| project : build-dir ../../build ; | ||||
|  | ||||
| exe run_tests : test_main.cc  | ||||
| ../algorithms/acquisition/adapters//gps_l1_ca_gps_sdr_acquisition | ||||
| #../algorithms/acquisition/adapters//gps_l1_ca_gps_sdr_acquisition | ||||
| ../algorithms/acquisition/adapters//gps_l1_ca_pcps_acquisition | ||||
| ../algorithms/acquisition/adapters//gps_l1_ca_tong_pcps_acquisition | ||||
| ../algorithms/acquisition/gnuradio_blocks//gps_l1_ca_gps_sdr_acquisition_cc | ||||
| ../algorithms/acquisition/gnuradio_blocks//gps_l1_ca_gps_sdr_acquisition_ss | ||||
| #../algorithms/acquisition/adapters//gps_l1_ca_tong_pcps_acquisition | ||||
| #../algorithms/acquisition/gnuradio_blocks//gps_l1_ca_gps_sdr_acquisition_cc | ||||
| #../algorithms/acquisition/gnuradio_blocks//gps_l1_ca_gps_sdr_acquisition_ss | ||||
| ../algorithms/acquisition/gnuradio_blocks//gps_l1_ca_pcps_acquisition_cc | ||||
| ../algorithms/acquisition/gnuradio_blocks//gps_l1_ca_tong_pcps_acquisition_cc | ||||
| #../algorithms/acquisition/gnuradio_blocks//gps_l1_ca_tong_pcps_acquisition_cc | ||||
| ../algorithms/channel/adapters//channel | ||||
| ../algorithms/channel/libs//gps_l1_ca_channel_fsm | ||||
| ../algorithms/conditioner/adapters//direct_resampler_conditioner | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Javier Arribas
					Javier Arribas