Major changes in flowgraph, configuration file and channel. Added gnss_signal class.

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@146 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Luis Esteve 2012-01-27 11:58:55 +00:00
parent 22925909fd
commit ec57e48f4e
13 changed files with 642 additions and 529 deletions

View File

@ -17,8 +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=/media/DATALOGGER/Barcelona _ctae_cttc_logs/gps/ctae-cttc1_df16_tram5.dat
SignalSource.filename=/home/luis/Project/signals/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
@ -48,10 +47,90 @@ SignalConditioner.sample_freq_in=4000000
SignalConditioner.sample_freq_out=4000000
SignalConditioner.dump=false
;######### CHANNELS CONFIGURATION CONFIG ############
;#count: Number of avalable satellite channels.
;######### CHANNELS GLOBAL CONFIG ############
;#count: Number of available satellite channels.
Channels.count=4
;######### CHANNEL 0 CONFIG ############
;#system: GPS, GLONASS, GALILEO, SBAS or COMPASS
;#if the option is disabled by default is assigned GPS
Channel0.system=GPS
;#signal:
;# "1C" GPS L1 C/A
;# "1P" GPS L1 P
;# "1W" GPS L1 Z-tracking and similar (AS on)
;# "1Y" GPS L1 Y
;# "1M" GPS L1 M
;# "1N" GPS L1 codeless
;# "2C" GPS L2 C/A
;# "2D" GPS L2 L1(C/A)+(P2-P1) semi-codeless
;# "2S" GPS L2 L2C (M)
;# "2L" GPS L2 L2C (L)
;# "2X" GPS L2 L2C (M+L)
;# "2P" GPS L2 P
;# "2W" GPS L2 Z-tracking and similar (AS on)
;# "2Y" GPS L2 Y
;# "2M" GPS GPS L2 M
;# "2N" GPS L2 codeless
;# "5I" GPS L5 I
;# "5Q" GPS L5 Q
;# "5X" GPS L5 I+Q
;# "1C" GLONASS G1 C/A
;# "1P" GLONASS G1 P
;# "2C" GLONASS G2 C/A (Glonass M)
;# "2P" GLONASS G2 P
;# "1A" GALILEO E1 A (PRS)
;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL)
;# "1C" GALILEO E1 C (no data)
;# "1X" GALILEO E1 B+C
;# "1Z" GALILEO E1 A+B+C
;# "5I" GALILEO E5a I (F/NAV OS)
;# "5Q" GALILEO E5a Q (no data)
;# "5X" GALILEO E5a I+Q
;# "7I" GALILEO E5b I
;# "7Q" GALILEO E5b Q
;# "7X" GALILEO E5b I+Q
;# "8I" GALILEO E5 I
;# "8Q" GALILEO E5 Q
;# "8X" GALILEO E5 I+Q
;# "6A" GALILEO E6 A
;# "6B" GALILEO E6 B
;# "6C" GALILEO E6 C
;# "6X" GALILEO E6 B+C
;# "6Z" GALILEO E6 A+B+C
;# "1C" SBAS L1 C/A
;# "5I" SBAS L5 I
;# "5Q" SBAS L5 Q
;# "5X" SBAS L5 I+Q
;# "2I" COMPASS E2 I
;# "2Q" COMPASS E2 Q
;# "2X" COMPASS E2 IQ
;# "7I" COMPASS E5b I
;# "7Q" COMPASS E5b Q
;# "7X" COMPASS E5b IQ
;# "6I" COMPASS E6 I
;# "6Q" COMPASS E6 Q
;# "6X" COMPASS E6 IQ
;#if the option is disabled by default is assigned "1C" GPS L1 C/A
Channel0.signal=1C
;#satellite: Satellite PRN ID for this channel. Disable this option to random search
Channel0.satellite=1
;######### CHANNEL 1 CONFIG ############
Channel1.system=GPS
Channel1.signal=1C
Channel1.satellite=14
;######### CHANNEL 2 CONFIG ############
Channel2.system=GPS
Channel2.signal=1C
Channel2.satellite=21
;######### ACQUISITION GLOBAL CONFIG ############
;#dump: Enable or disable the acquisition internal data file logging [true] or [false]
@ -63,6 +142,7 @@ Acquisition.dump_filename=./acq_dump.dat
;#item_type: Type and resolution for each of the signal samples. Use only gr_complex in this version.
Acquisition.item_type=gr_complex
;#if: Signal intermediate frequency in [Hz]
Acquisition.if=0
@ -76,7 +156,7 @@ Acquisition.sampled_ms=1
Acquisition0.implementation=GPS_L1_CA_PCPS_Acquisition
;#threshold: Acquisition threshold
Acquisition0.threshold=60
Acquisition0.threshold=70
;#doppler_max: Maximum expected Doppler shift [Hz]
Acquisition0.doppler_max=10000
@ -84,43 +164,36 @@ Acquisition0.doppler_max=10000
;#doppler_max: Doppler step in the grid search [Hz]
Acquisition0.doppler_step=250
;#satellite: Satellite PRN ID for this channel. Disable this option to random search
;Acquisition0.satellite=14
;#repeat_satellite: Use only jointly with the satellte PRN ID option.
;#Enable repeat_satellite to keep searching the same satellite during the runtime.
;Acquisition0.repeat_satellite=true
;######### ACQUISITION CH 1 CONFIG ############
Acquisition1.implementation=GPS_L1_CA_PCPS_Acquisition
Acquisition1.threshold=40
Acquisition1.threshold=70
Acquisition1.doppler_max=10000
Acquisition1.doppler_step=250
;Acquisition1.satellite=32
;Acquisition1.repeat_satellite=true
;######### ACQUISITION CH 2 CONFIG ############
Acquisition2.implementation=GPS_L1_CA_PCPS_Acquisition
Acquisition2.threshold=40
Acquisition2.threshold=70
Acquisition2.doppler_max=10000
Acquisition2.doppler_step=250
;Acquisition2.satellite=11
;Acquisition2.repeat_satellite=true
;######### ACQUISITION CH 3 CONFIG ############
Acquisition3.implementation=GPS_L1_CA_PCPS_Acquisition
Acquisition3.threshold=40
Acquisition3.threshold=70
Acquisition3.doppler_max=10000
Acquisition3.doppler_step=250
;Acquisition3.satellite=1
;Acquisition3.repeat_satellite=true
;######### ACQUISITION CH 4 CONFIG ############
Acquisition4.implementation=GPS_L1_CA_PCPS_Acquisition
Acquisition4.threshold=40
Acquisition4.threshold=70
Acquisition4.doppler_max=10000
Acquisition4.doppler_step=250
;Acquisition4.satellite=31
;Acquisition4.repeat_satellite=true
;######### ACQUISITION CH 5 CONFIG ############
@ -128,29 +201,26 @@ Acquisition5.implementation=GPS_L1_CA_PCPS_Acquisition
Acquisition5.threshold=70
Acquisition5.doppler_max=10000
Acquisition5.doppler_step=250
;Acquisition5.satellite=20
;Acquisition5.repeat_satellite=true
;######### ACQUISITION CH 6 CONFIG ############
Acquisition6.implementation=GPS_L1_CA_PCPS_Acquisition
Acquisition6.threshold=60
Acquisition6.threshold=70
Acquisition6.doppler_max=10000
Acquisition6.doppler_step=250
;Acquisition6.satellite=22
;Acquisition6.repeat_satellite=true
;######### ACQUISITION CH 7 CONFIG ############
Acquisition7.implementation=GPS_L1_CA_PCPS_Acquisition
Acquisition7.threshold=60
Acquisition7.threshold=70
Acquisition7.doppler_max=10000
Acquisition7.doppler_step=250
;Acquisition7.satellite=23
;Acquisition7.repeat_satellite=true
;######### 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_FLL_PLL_Tracking
Tracking.implementation=GPS_L1_CA_DLL_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
@ -220,4 +290,4 @@ PVT.dump_filename=./PVT
;# Receiver output filter: Leave this block disabled in this version
OutputFilter.implementation=Null_Sink_Output_Filter
OutputFilter.filename=data/gnss-sdr.dat
OutputFilter.item_type=gr_complex
OutputFilter.item_type=gr_complex

View File

@ -47,10 +47,90 @@ SignalConditioner.sample_freq_in=4000000
SignalConditioner.sample_freq_out=4000000
SignalConditioner.dump=false
;######### CHANNELS CONFIGURATION CONFIG ############
;#count: Number of avalable satellite channels.
;######### CHANNELS GLOBAL CONFIG ############
;#count: Number of available satellite channels.
Channels.count=4
;######### CHANNEL 0 CONFIG ############
;#system: GPS, GLONASS, GALILEO, SBAS or COMPASS
;#if the option is disabled by default is assigned GPS
Channel0.system=GPS
;#signal:
;# "1C" GPS L1 C/A
;# "1P" GPS L1 P
;# "1W" GPS L1 Z-tracking and similar (AS on)
;# "1Y" GPS L1 Y
;# "1M" GPS L1 M
;# "1N" GPS L1 codeless
;# "2C" GPS L2 C/A
;# "2D" GPS L2 L1(C/A)+(P2-P1) semi-codeless
;# "2S" GPS L2 L2C (M)
;# "2L" GPS L2 L2C (L)
;# "2X" GPS L2 L2C (M+L)
;# "2P" GPS L2 P
;# "2W" GPS L2 Z-tracking and similar (AS on)
;# "2Y" GPS L2 Y
;# "2M" GPS GPS L2 M
;# "2N" GPS L2 codeless
;# "5I" GPS L5 I
;# "5Q" GPS L5 Q
;# "5X" GPS L5 I+Q
;# "1C" GLONASS G1 C/A
;# "1P" GLONASS G1 P
;# "2C" GLONASS G2 C/A (Glonass M)
;# "2P" GLONASS G2 P
;# "1A" GALILEO E1 A (PRS)
;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL)
;# "1C" GALILEO E1 C (no data)
;# "1X" GALILEO E1 B+C
;# "1Z" GALILEO E1 A+B+C
;# "5I" GALILEO E5a I (F/NAV OS)
;# "5Q" GALILEO E5a Q (no data)
;# "5X" GALILEO E5a I+Q
;# "7I" GALILEO E5b I
;# "7Q" GALILEO E5b Q
;# "7X" GALILEO E5b I+Q
;# "8I" GALILEO E5 I
;# "8Q" GALILEO E5 Q
;# "8X" GALILEO E5 I+Q
;# "6A" GALILEO E6 A
;# "6B" GALILEO E6 B
;# "6C" GALILEO E6 C
;# "6X" GALILEO E6 B+C
;# "6Z" GALILEO E6 A+B+C
;# "1C" SBAS L1 C/A
;# "5I" SBAS L5 I
;# "5Q" SBAS L5 Q
;# "5X" SBAS L5 I+Q
;# "2I" COMPASS E2 I
;# "2Q" COMPASS E2 Q
;# "2X" COMPASS E2 IQ
;# "7I" COMPASS E5b I
;# "7Q" COMPASS E5b Q
;# "7X" COMPASS E5b IQ
;# "6I" COMPASS E6 I
;# "6Q" COMPASS E6 Q
;# "6X" COMPASS E6 IQ
;#if the option is disabled by default is assigned "1C" GPS L1 C/A
Channel0.signal=1C
;#satellite: Satellite PRN ID for this channel. Disable this option to random search
Channel0.satellite=1
;######### CHANNEL 1 CONFIG ############
Channel1.system=GPS
Channel1.signal=1C
Channel1.satellite=14
;######### CHANNEL 2 CONFIG ############
Channel2.system=GPS
Channel2.signal=1C
Channel2.satellite=21
;######### ACQUISITION GLOBAL CONFIG ############
;#dump: Enable or disable the acquisition internal data file logging [true] or [false]
@ -84,9 +164,6 @@ Acquisition0.doppler_max=10000
;#doppler_max: Doppler step in the grid search [Hz]
Acquisition0.doppler_step=250
;#satellite: Satellite PRN ID for this channel. Disable this option to random search
;Acquisition0.satellite=14
;#repeat_satellite: Use only jointly with the satellte PRN ID option.
;#Enable repeat_satellite to keep searching the same satellite during the runtime.
;Acquisition0.repeat_satellite=true
@ -96,7 +173,6 @@ Acquisition1.implementation=GPS_L1_CA_PCPS_Acquisition
Acquisition1.threshold=70
Acquisition1.doppler_max=10000
Acquisition1.doppler_step=250
;Acquisition1.satellite=32
;Acquisition1.repeat_satellite=true
;######### ACQUISITION CH 2 CONFIG ############
@ -104,7 +180,6 @@ Acquisition2.implementation=GPS_L1_CA_PCPS_Acquisition
Acquisition2.threshold=70
Acquisition2.doppler_max=10000
Acquisition2.doppler_step=250
;Acquisition2.satellite=11
;Acquisition2.repeat_satellite=true
;######### ACQUISITION CH 3 CONFIG ############
@ -112,7 +187,6 @@ Acquisition3.implementation=GPS_L1_CA_PCPS_Acquisition
Acquisition3.threshold=70
Acquisition3.doppler_max=10000
Acquisition3.doppler_step=250
;Acquisition3.satellite=1
;Acquisition3.repeat_satellite=true
;######### ACQUISITION CH 4 CONFIG ############
@ -120,7 +194,6 @@ Acquisition4.implementation=GPS_L1_CA_PCPS_Acquisition
Acquisition4.threshold=70
Acquisition4.doppler_max=10000
Acquisition4.doppler_step=250
;Acquisition4.satellite=31
;Acquisition4.repeat_satellite=true
;######### ACQUISITION CH 5 CONFIG ############
@ -128,7 +201,6 @@ Acquisition5.implementation=GPS_L1_CA_PCPS_Acquisition
Acquisition5.threshold=70
Acquisition5.doppler_max=10000
Acquisition5.doppler_step=250
;Acquisition5.satellite=20
;Acquisition5.repeat_satellite=true
;######### ACQUISITION CH 6 CONFIG ############
@ -136,7 +208,6 @@ Acquisition6.implementation=GPS_L1_CA_PCPS_Acquisition
Acquisition6.threshold=70
Acquisition6.doppler_max=10000
Acquisition6.doppler_step=250
;Acquisition6.satellite=22
;Acquisition6.repeat_satellite=true
;######### ACQUISITION CH 7 CONFIG ############
@ -144,7 +215,6 @@ Acquisition7.implementation=GPS_L1_CA_PCPS_Acquisition
Acquisition7.threshold=70
Acquisition7.doppler_max=10000
Acquisition7.doppler_step=250
;Acquisition7.satellite=23
;Acquisition7.repeat_satellite=true
;######### TRACKING GLOBAL CONFIG ############

View File

@ -69,6 +69,7 @@ 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_channel(unsigned int channel);
void set_threshold(float threshold);
@ -92,6 +93,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_;

View File

@ -71,11 +71,13 @@ gps_l1_ca_pcps_acquisition_cc::gps_l1_ca_pcps_acquisition_cc(
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_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];
d_fft_codes = (gr_complex*)malloc(sizeof(gr_complex) * d_samples_per_ms);
@ -102,11 +104,13 @@ gps_l1_ca_pcps_acquisition_cc::gps_l1_ca_pcps_acquisition_cc(
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;
delete d_fft_if;
if (d_dump)
{
d_dump_file.close();
@ -119,8 +123,11 @@ gps_l1_ca_pcps_acquisition_cc::~gps_l1_ca_pcps_acquisition_cc()
void gps_l1_ca_pcps_acquisition_cc::set_satellite(Gnss_Satellite satellite)
{
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
d_code_phase = 0;
d_doppler_freq = 0;
// ¿qué diferencia hay con d_satellite=satellite; ?
d_gnss_synchro->Acq_delay_samples=0.0;
d_gnss_synchro->Acq_doppler_hz=0.0;
//d_code_phase = 0;
//d_doppler_freq = 0;
d_mag = 0.0;
d_input_power = 0.0;
@ -135,9 +142,6 @@ void gps_l1_ca_pcps_acquisition_cc::set_satellite(Gnss_Satellite satellite)
//TODO Optimize it ! try conj()
for (unsigned int i = 0; i < d_fft_size; i++)
{
//d_fft_codes[i] = std::complex<float>(
// d_fft_if->get_outbuf()[i].real(),
// -d_fft_if->get_outbuf()[i].imag());
d_fft_codes[i] = std::complex<float>(conj(d_fft_if->get_outbuf()[i]));
d_fft_codes[i] = d_fft_codes[i] / (float)d_fft_size; //to correct the scale factor introduced by FFTW
}
@ -160,12 +164,6 @@ void gps_l1_ca_pcps_acquisition_cc::set_satellite(Gnss_Satellite satellite)
signed int gps_l1_ca_pcps_acquisition_cc::prn_code_phase()
{
return d_code_phase;
}
int gps_l1_ca_pcps_acquisition_cc::general_work(int noutput_items,
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
@ -193,8 +191,10 @@ int gps_l1_ca_pcps_acquisition_cc::general_work(int noutput_items,
//restart acquisition variables
d_code_phase = 0;
d_doppler_freq = 0;
d_gnss_synchro->Acq_delay_samples=0.0;
d_gnss_synchro->Acq_doppler_hz=0.0;
//d_code_phase = 0;
//d_doppler_freq = 0;
d_mag = 0.0;
d_input_power = 0.0;
@ -278,8 +278,10 @@ int gps_l1_ca_pcps_acquisition_cc::general_work(int noutput_items,
if (d_mag < magt)
{
d_mag = magt;
d_code_phase = indext;
d_doppler_freq = doppler;
d_gnss_synchro->Acq_delay_samples= (double)indext;
d_gnss_synchro->Acq_doppler_hz= (double)doppler;
//d_code_phase = indext;
//d_doppler_freq = doppler;
}
}
@ -299,8 +301,8 @@ int gps_l1_ca_pcps_acquisition_cc::general_work(int noutput_items,
DLOG(INFO) << "sample_stamp " << d_sample_counter;
DLOG(INFO) << "test statistics value " << d_test_statistics;
DLOG(INFO) << "test statistics threshold " << d_threshold;
DLOG(INFO) << "code phase " << d_code_phase;
DLOG(INFO) << "doppler " << d_doppler_freq;
DLOG(INFO) << "code phase " << d_gnss_synchro->Acq_delay_samples;
DLOG(INFO) << "doppler " << d_gnss_synchro->Acq_doppler_hz;
DLOG(INFO) << "magnitude " << d_mag;
DLOG(INFO) << "input signal power " << d_input_power;
}
@ -311,8 +313,8 @@ int gps_l1_ca_pcps_acquisition_cc::general_work(int noutput_items,
DLOG(INFO) << "sample_stamp " << d_sample_counter;
DLOG(INFO) << "test statistics value " << d_test_statistics;
DLOG(INFO) << "test statistics threshold " << d_threshold;
DLOG(INFO) << "code phase " << d_code_phase;
DLOG(INFO) << "doppler " << d_doppler_freq;
DLOG(INFO) << "code phase " << d_gnss_synchro->Acq_delay_samples;
DLOG(INFO) << "doppler " << d_gnss_synchro->Acq_doppler_hz;
DLOG(INFO) << "magnitude " << d_mag;
DLOG(INFO) << "input signal power " << d_input_power;
}

View File

@ -44,128 +44,135 @@
#include <boost/thread/thread.hpp>
#include "concurrent_queue.h"
#include "gnss_satellite.h"
#include "gnss_synchro.h"
class gps_l1_ca_pcps_acquisition_cc;
typedef boost::shared_ptr<gps_l1_ca_pcps_acquisition_cc>
gps_l1_ca_pcps_acquisition_cc_sptr;
gps_l1_ca_pcps_acquisition_cc_sptr;
gps_l1_ca_pcps_acquisition_cc_sptr
gps_l1_ca_pcps_make_acquisition_cc(unsigned int sampled_ms,
unsigned int doppler_max, long freq, long fs_in, int samples_per_ms,
gr_msg_queue_sptr queue, bool dump, std::string dump_filename);
unsigned int doppler_max, long freq, long fs_in, int samples_per_ms,
gr_msg_queue_sptr queue, bool dump, std::string dump_filename);
/*!
* \brief This class implements a PCPS acquisition block for GPS L1 C/A
*/
class gps_l1_ca_pcps_acquisition_cc: public gr_block
{
class gps_l1_ca_pcps_acquisition_cc: public gr_block {
private:
friend gps_l1_ca_pcps_acquisition_cc_sptr
gps_l1_ca_pcps_make_acquisition_cc(unsigned int sampled_ms,
unsigned int doppler_max, long freq, long fs_in,
int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
std::string dump_filename);
friend gps_l1_ca_pcps_acquisition_cc_sptr
gps_l1_ca_pcps_make_acquisition_cc(unsigned int sampled_ms,
unsigned int doppler_max, long freq, long fs_in,
int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
std::string dump_filename);
gps_l1_ca_pcps_acquisition_cc(unsigned int sampled_ms,
unsigned int doppler_max, long freq, long fs_in,
int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
std::string dump_filename);
gps_l1_ca_pcps_acquisition_cc(unsigned int sampled_ms,
unsigned int doppler_max, long freq, long fs_in,
int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
std::string dump_filename);
void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift,
int doppler_offset);
void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift,
int doppler_offset);
long d_fs_in;
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;
unsigned int d_doppler_step;
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;
long d_fs_in;
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;
unsigned int d_doppler_step;
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;
gr_complex* d_fft_codes;
gri_fft_complex* d_fft_if;
gri_fft_complex* d_fft_if;
gri_fft_complex* d_ifft;
gri_fft_complex* d_ifft;
unsigned int d_code_phase;
float d_doppler_freq;
float d_mag;
float d_input_power;
float d_test_statistics;
Gnss_Synchro *d_gnss_synchro;
unsigned int d_code_phase;
float d_doppler_freq;
float d_mag;
float d_input_power;
float d_test_statistics;
gr_msg_queue_sptr d_queue;
concurrent_queue<int> *d_channel_internal_queue;
std::ofstream d_dump_file;
gr_msg_queue_sptr d_queue;
concurrent_queue<int> *d_channel_internal_queue;
std::ofstream d_dump_file;
bool d_active;
bool d_dump;
unsigned int d_channel;
std::string d_dump_filename;
bool d_active;
bool d_dump;
unsigned int d_channel;
std::string d_dump_filename;
public:
~gps_l1_ca_pcps_acquisition_cc();
~gps_l1_ca_pcps_acquisition_cc();
signed int prn_code_phase();
float doppler_freq()
{
return d_doppler_freq;
}
unsigned int mag()
{
return d_mag;
}
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
{
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;
}
unsigned long int get_sample_stamp()
{
return d_acq_sample_stamp;
}
void set_satellite(Gnss_Satellite satellite);
void set_satellite(Gnss_Satellite satellite);
void set_active(bool active)
{
d_active = active;
}
void set_active(bool active)
{
d_active = active;
}
void set_channel(unsigned int channel)
{
d_channel = channel;
}
void set_channel(unsigned int channel)
{
d_channel = channel;
}
void set_threshold(float threshold)
{
d_threshold = threshold;
}
void set_threshold(float threshold)
{
d_threshold = threshold;
}
void set_doppler_max(unsigned int doppler_max)
{
d_doppler_max = doppler_max;
}
void set_doppler_max(unsigned int doppler_max)
{
d_doppler_max = doppler_max;
}
void set_doppler_step(unsigned int doppler_step)
{
d_doppler_step = doppler_step;
}
void set_doppler_step(unsigned int doppler_step)
{
d_doppler_step = doppler_step;
}
void set_channel_queue(concurrent_queue<int> *channel_internal_queue)
{
d_channel_internal_queue = channel_internal_queue;
}
void set_channel_queue(concurrent_queue<int> *channel_internal_queue)
{
d_channel_internal_queue = channel_internal_queue;
}
int general_work(int noutput_items, gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
int general_work(int noutput_items, gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
};
#endif /* GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_CC_H*/

View File

@ -87,6 +87,7 @@ Channel::Channel(ConfigurationInterface *configuration, unsigned int channel,
connected_ = false;
message_ = 0;
gnss_satellite_ = Gnss_Satellite();
gnss_signal_ = Gnss_Signal();
}
@ -168,9 +169,9 @@ gr_basic_block_sptr Channel::get_right_block()
void Channel::set_satellite(Gnss_Satellite satellite)
void Channel::set_signal(Gnss_Signal gnss_signal)
{
gnss_satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
gnss_satellite_ = gnss_signal.get_satellite();
acq_->set_satellite(gnss_satellite_);
trk_->set_satellite(gnss_satellite_);
nav_->set_satellite(gnss_satellite_);

View File

@ -41,6 +41,7 @@
#include "gps_l1_ca_channel_fsm.h"
#include "control_message_factory.h"
#include "concurrent_queue.h"
#include "gnss_signal.h"
class ConfigurationInterface;
@ -78,7 +79,7 @@ public:
size_t item_size(){ return 0; }
Gnss_Satellite get_satellite() const { return gnss_satellite_; }
Gnss_Signal get_signal() const { return gnss_signal_; }
AcquisitionInterface* acquisition(){ return acq_; }
@ -87,7 +88,7 @@ public:
TelemetryDecoderInterface* telemetry(){ return nav_; }
void start_acquisition();
void set_satellite(Gnss_Satellite satellite);
void set_signal(Gnss_Signal gnss_signal_);
void start();
/*!
@ -108,6 +109,7 @@ private:
unsigned int channel_;
Gnss_Satellite gnss_satellite_;
Gnss_Signal gnss_signal_;
bool connected_;
bool stop_;
int message_;

View File

@ -38,7 +38,7 @@
#define GNSS_SDR_CHANNEL_INTERFACE_H_
#include "gnss_block_interface.h"
#include "gnss_satellite.h"
#include "gnss_signal.h"
/*!
* \brief This abstract class represents an interface to a channel GNSS block.
@ -53,9 +53,9 @@ class ChannelInterface: public GNSSBlockInterface
public:
virtual Gnss_Satellite get_satellite() const = 0;
virtual Gnss_Signal get_signal() const = 0;
virtual void start_acquisition() = 0;
virtual void set_satellite(Gnss_Satellite) = 0;
virtual void set_signal(Gnss_Signal) = 0;
virtual void start() = 0;
virtual void stop() = 0;
};

View File

@ -44,278 +44,224 @@
#include "channel_interface.h"
#include "gnss_block_factory.h"
using google::LogMessage;
GNSSFlowgraph::GNSSFlowgraph(ConfigurationInterface *configuration,
gr_msg_queue_sptr queue)
{
connected_ = false;
running_ = false;
configuration_ = configuration;
blocks_ = new std::vector<GNSSBlockInterface*>();
block_factory_ = new GNSSBlockFactory();
queue_ = queue;
available_GPS_satellites_IDs_ = new std::list<Gnss_Satellite>();
gr_msg_queue_sptr queue) {
connected_ = false;
running_ = false;
configuration_ = configuration;
blocks_ = new std::vector<GNSSBlockInterface*>();
block_factory_ = new GNSSBlockFactory();
queue_ = queue;
//available_GNSS_signals_ = new std::list<Gnss_Satellite>();
init();
init();
}
GNSSFlowgraph::~GNSSFlowgraph()
{
GNSSFlowgraph::~GNSSFlowgraph() {
delete block_factory_;
delete block_factory_;
for (unsigned int i = 0; i < blocks_->size(); i++)
{
delete blocks_->at(i);
}
blocks_->clear();
for (unsigned int i = 0; i < blocks_->size(); i++) {
delete blocks_->at(i);
}
blocks_->clear();
delete blocks_;
delete blocks_;
}
void GNSSFlowgraph::start()
{
if (running_)
{
LOG_AT_LEVEL(WARNING) << "Already running";
return;
}
void GNSSFlowgraph::start() {
if (running_) {
LOG_AT_LEVEL(WARNING) << "Already running";
return;
}
try
{
top_block_->start();
}
catch (std::exception& e)
{
LOG_AT_LEVEL(ERROR) << "Unable to start flowgraph";
LOG_AT_LEVEL(ERROR) << e.what();
return;
}
try {
top_block_->start();
} catch (std::exception& e) {
LOG_AT_LEVEL(ERROR) << "Unable to start flowgraph";
LOG_AT_LEVEL(ERROR) << e.what();
return;
}
running_ = true;
running_ = true;
}
void GNSSFlowgraph::stop()
{
for (unsigned int i = 0; i < channels_count_; i++)
{
channel(i)->stop();
}
DLOG(INFO) << "Threads finished. Return to main program.";
top_block_->stop();
running_ = false;
void GNSSFlowgraph::stop() {
for (unsigned int i = 0; i < channels_count_; i++) {
channel(i)->stop();
}
DLOG(INFO) << "Threads finished. Return to main program.";
top_block_->stop();
running_ = false;
}
void GNSSFlowgraph::connect()
{
/* Connects the blocks in the flowgraph
*
* Signal Source > Signal conditioner >> Channels >> Observables >> PVT > Output filter
*/
DLOG(INFO) << "Connecting flowgraph";
if (connected_)
{
LOG_AT_LEVEL(WARNING) << "flowgraph already connected";
return;
}
void GNSSFlowgraph::connect() {
/* Connects the blocks in the flowgraph
*
* Signal Source > Signal conditioner >> Channels >> Observables >> PVT > Output filter
*/
DLOG(INFO) << "Connecting flowgraph";
if (connected_) {
LOG_AT_LEVEL(WARNING) << "flowgraph already connected";
return;
}
try {
signal_source()->connect(top_block_);
} catch (std::exception& e) {
LOG_AT_LEVEL(ERROR) << "Can't connect signal source block internally";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
try
{
signal_source()->connect(top_block_);
}
catch (std::exception& e)
{
LOG_AT_LEVEL(ERROR) << "Can't connect signal source block internally";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
// Signal Source > Signal conditioner >
try {
signal_conditioner()->connect(top_block_);
} catch (std::exception& e) {
LOG_AT_LEVEL(ERROR)
<< "Can't connect signal conditioner block internally";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
// Signal Source > Signal conditioner >
try
{
signal_conditioner()->connect(top_block_);
}
catch (std::exception& e)
{
LOG_AT_LEVEL(ERROR)
<< "Can't connect signal conditioner block internally";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
for (unsigned int i = 0; i < channels_count_; i++) {
try {
channel(i)->connect(top_block_);
} catch (std::exception& e) {
LOG_AT_LEVEL(ERROR) << "Can't connect channel " << i
<< " internally";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
}
try {
observables()->connect(top_block_);
} catch (std::exception& e) {
LOG_AT_LEVEL(ERROR) << "Can't connect observables block internally";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
for (unsigned int i = 0; i < channels_count_; i++)
{
try
{
channel(i)->connect(top_block_);
}
catch (std::exception& e)
{
LOG_AT_LEVEL(ERROR) << "Can't connect channel " << i
<< " internally";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
}
// Signal Source > Signal conditioner >> Channels >> Observables > PVT
try {
pvt()->connect(top_block_);
} catch (std::exception& e) {
LOG_AT_LEVEL(ERROR) << "Can't connect PVT block internally";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
// Signal Source > Signal conditioner >> Channels >> Observables > PVT > Output Filter
try {
output_filter()->connect(top_block_);
} catch (std::exception& e) {
LOG_AT_LEVEL(ERROR) << "Can't connect output filter block internally";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
try
{
observables()->connect(top_block_);
}
catch (std::exception& e)
{
LOG_AT_LEVEL(ERROR) << "Can't connect observables block internally";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
DLOG(INFO) << "blocks connected internally";
// Signal Source > Signal conditioner >> Channels >> Observables > PVT
try
{
pvt()->connect(top_block_);
}
catch (std::exception& e)
{
LOG_AT_LEVEL(ERROR) << "Can't connect PVT block internally";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
// Signal Source > Signal conditioner >
try {
top_block_->connect(signal_source()->get_right_block(), 0,
signal_conditioner()->get_left_block(), 0);
} catch (std::exception& e) {
LOG_AT_LEVEL(ERROR)
<< "Can't connect signal source to signal conditioner";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
DLOG(INFO) << "Signal source connected to signal conditioner";
// Signal Source > Signal conditioner >> Channels >> Observables > PVT > Output Filter
try
{
output_filter()->connect(top_block_);
}
catch (std::exception& e)
{
LOG_AT_LEVEL(ERROR) << "Can't connect output filter block internally";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
// Signal Source > Signal conditioner >> channels_count_ number of Channels in parallel
for (unsigned int i = 0; i < channels_count_; i++) {
try {
top_block_->connect(signal_conditioner()->get_right_block(), 0,
channel(i)->get_left_block(), 0);
} catch (std::exception& e) {
LOG_AT_LEVEL(ERROR)
<< "Can't connect signal conditioner to channel " << i;
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
DLOG(INFO) << "blocks connected internally";
DLOG(INFO) << "signal conditioner connected to channel " << i;
// Signal Source > Signal conditioner >
try
{
top_block_->connect(signal_source()->get_right_block(), 0,
signal_conditioner()->get_left_block(), 0);
}
catch (std::exception& e)
{
LOG_AT_LEVEL(ERROR)
<< "Can't connect signal source to signal conditioner";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
DLOG(INFO) << "Signal source connected to signal conditioner";
// Signal Source > Signal conditioner >> Channels >> Observables
try {
top_block_->connect(channel(i)->get_right_block(), 0,
observables()->get_left_block(), i);
} catch (std::exception& e) {
LOG_AT_LEVEL(ERROR) << "Can't connect channel " << i
<< " to observables";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
// Signal Source > Signal conditioner >> channels_count_ number of Channels in parallel
for (unsigned int i = 0; i < channels_count_; i++)
{
try
{
top_block_->connect(signal_conditioner()->get_right_block(), 0,
channel(i)->get_left_block(), 0);
}
catch (std::exception& e)
{
LOG_AT_LEVEL(ERROR)
<< "Can't connect signal conditioner to channel " << i;
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
channel(i)->set_signal(available_GNSS_signals_.front());
std::cout << "Channel " << i << " assigned to "
<< available_GNSS_signals_.front() << std::endl;
available_GNSS_signals_.pop_front();
channel(i)->start();
//channel(i)->start_acquisition();
DLOG(INFO) << "signal conditioner connected to channel " << i;
DLOG(INFO) << "Channel " << i
<< " connected to observables and ready for acquisition";
}
/*
* Connect the observables output of each channel to the PVT block
*/
try {
for (unsigned int i = 0; i < channels_count_; i++) {
top_block_->connect(observables()->get_right_block(), i,
pvt()->get_left_block(), i);
}
} catch (std::exception& e) {
LOG_AT_LEVEL(ERROR) << "Can't connect observables to PVT";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
// Signal Source > Signal conditioner >> Channels >> Observables
try
{
top_block_->connect(channel(i)->get_right_block(), 0,
observables()->get_left_block(), i);
}
catch (std::exception& e)
{
LOG_AT_LEVEL(ERROR) << "Can't connect channel " << i
<< " to observables";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
try {
top_block_->connect(pvt()->get_right_block(), 0,
output_filter()->get_left_block(), 0);
} catch (std::exception& e) {
LOG_AT_LEVEL(ERROR) << "Can't connect PVT to output filter";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
channel(i)->set_satellite(available_GPS_satellites_IDs_->front());
std::cout << "Channel " << i << " satellite "
<< available_GPS_satellites_IDs_->front() << std::endl;
available_GPS_satellites_IDs_->pop_front();
channel(i)->start();
//channel(i)->start_acquisition();
DLOG(INFO) << "PVT connected to output filter";
DLOG(INFO) << "Channel " << i
<< " connected to observables and ready for acquisition";
}
/*
* Connect the observables output of each channel to the PVT block
*/
try
{
for (unsigned int i = 0; i < channels_count_; i++)
{
top_block_->connect(observables()->get_right_block(), i,
pvt()->get_left_block(), i);
}
}
catch (std::exception& e)
{
LOG_AT_LEVEL(ERROR) << "Can't connect observables to PVT";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
try
{
top_block_->connect(pvt()->get_right_block(), 0,
output_filter()->get_left_block(), 0);
}
catch (std::exception& e)
{
LOG_AT_LEVEL(ERROR) << "Can't connect PVT to output filter";
LOG_AT_LEVEL(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
DLOG(INFO) << "PVT connected to output filter";
connected_ = true;
DLOG(INFO) << "Flowgraph connected";
top_block_->dump();
connected_ = true;
DLOG(INFO) << "Flowgraph connected";
top_block_->dump();
}
void GNSSFlowgraph::wait()
{
if (!running_)
{
LOG_AT_LEVEL(WARNING) << "Can't apply wait. Flowgraph is not running";
return;
}
top_block_->wait();
DLOG(INFO) << "Flowgraph finished calculations";
running_ = false;
void GNSSFlowgraph::wait() {
if (!running_) {
LOG_AT_LEVEL(WARNING) << "Can't apply wait. Flowgraph is not running";
return;
}
top_block_->wait();
DLOG(INFO) << "Flowgraph finished calculations";
running_ = false;
}
/*
@ -324,179 +270,168 @@ void GNSSFlowgraph::wait()
* \param[in] who Who generated the action
* \param[in] what What is the action 0: acquisition failed
*/
void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
{
DLOG(INFO) << "received " << what << " from " << who;
void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) {
DLOG(INFO) << "received " << what << " from " << who;
switch (what)
{
case 0:
switch (what) {
case 0:
LOG_AT_LEVEL(INFO) << "Channel " << who
<< " ACQ FAILED satellite " << channel(who)->get_satellite();
available_GPS_satellites_IDs_->push_back(
channel(who)->get_satellite());
channel(who)->set_satellite(
available_GPS_satellites_IDs_->front());
available_GPS_satellites_IDs_->pop_front();
channel(who)->start_acquisition();
break;
// TODO: Tracking messages
LOG_AT_LEVEL(INFO) << "Channel " << who << " ACQ FAILED satellite "
<< channel(who)->get_signal().get_satellite();
available_GNSS_signals_.push_back(channel(who)->get_signal());
channel(who)->set_signal(available_GNSS_signals_.front());
available_GNSS_signals_.pop_front();
channel(who)->start_acquisition();
break;
// TODO: Tracking messages
default:
break;
}
default:
break;
}
DLOG(INFO) << "Number of available satellites: "
<< available_GPS_satellites_IDs_->size();
DLOG(INFO) << "Number of available satellites: "
<< available_GNSS_signals_.size();
}
void GNSSFlowgraph::set_configuration(ConfigurationInterface* configuration)
{
if (running_)
{
LOG_AT_LEVEL(WARNING) << "Unable to update configuration while flowgraph running";
return;
}
void GNSSFlowgraph::set_configuration(ConfigurationInterface* configuration) {
if (running_) {
LOG_AT_LEVEL(WARNING)
<< "Unable to update configuration while flowgraph running";
return;
}
if (connected_)
{
LOG_AT_LEVEL(WARNING) << "Unable to update configuration while flowgraph connected";
}
if (connected_) {
LOG_AT_LEVEL(WARNING)
<< "Unable to update configuration while flowgraph connected";
}
configuration_ = configuration;
configuration_ = configuration;
}
GNSSBlockInterface* GNSSFlowgraph::signal_source()
{
return blocks_->at(0);
GNSSBlockInterface* GNSSFlowgraph::signal_source() {
return blocks_->at(0);
}
GNSSBlockInterface* GNSSFlowgraph::signal_conditioner()
{
return blocks_->at(1);
GNSSBlockInterface* GNSSFlowgraph::signal_conditioner() {
return blocks_->at(1);
}
ChannelInterface* GNSSFlowgraph::channel(unsigned int index)
{
return (ChannelInterface*)blocks_->at(index + 5);
ChannelInterface* GNSSFlowgraph::channel(unsigned int index) {
return (ChannelInterface*) blocks_->at(index + 5);
}
GNSSBlockInterface* GNSSFlowgraph::observables()
{
return blocks_->at(2);
GNSSBlockInterface* GNSSFlowgraph::observables() {
return blocks_->at(2);
}
GNSSBlockInterface* GNSSFlowgraph::pvt()
{
return blocks_->at(3);
GNSSBlockInterface* GNSSFlowgraph::pvt() {
return blocks_->at(3);
}
GNSSBlockInterface* GNSSFlowgraph::output_filter()
{
return blocks_->at(4);
GNSSBlockInterface* GNSSFlowgraph::output_filter() {
return blocks_->at(4);
}
void GNSSFlowgraph::init() {
/*
* Instantiates the receiver blocks
*/
blocks_->push_back(block_factory_->GetSignalSource(configuration_, queue_));
blocks_->push_back(block_factory_->GetSignalConditioner(configuration_,
queue_));
blocks_->push_back(block_factory_->GetObservables(configuration_, queue_));
blocks_->push_back(block_factory_->GetPVT(configuration_, queue_));
blocks_->push_back(block_factory_->GetOutputFilter(configuration_, queue_));
std::vector<GNSSBlockInterface*>* channels = block_factory_->GetChannels(
configuration_, queue_);
channels_count_ = channels->size();
void GNSSFlowgraph::init()
{
/*
* Instantiates the receiver blocks
*/
blocks_->push_back(
block_factory_->GetSignalSource(configuration_, queue_));
blocks_->push_back(block_factory_->GetSignalConditioner(configuration_,
queue_));
blocks_->push_back(block_factory_->GetObservables(configuration_, queue_));
blocks_->push_back(block_factory_->GetPVT(configuration_, queue_));
blocks_->push_back(
block_factory_->GetOutputFilter(configuration_, queue_));
for (unsigned int i = 0; i < channels_count_; i++) {
blocks_->push_back(channels->at(i));
}
std::vector<GNSSBlockInterface*>* channels = block_factory_->GetChannels(
configuration_, queue_);
top_block_ = gr_make_top_block("GNSSFlowgraph");
channels_count_ = channels->size();
delete channels;
for (unsigned int i = 0; i < channels_count_; i++)
{
blocks_->push_back(channels->at(i));
}
// fill the available_GNSS_signals_ queue with the satellites ID's to be searched by the acquisition
top_block_ = gr_make_top_block("GNSSFlowgraph");
set_signals_list();
delete channels;
applied_actions_ = 0;
// fill the available_GPS_satellites_IDs_ queue with the satellites ID's to be searched by the acquisition
set_satellites_list();
applied_actions_ = 0;
DLOG(INFO) << "Blocks instantiated. " << channels_count_
<< " channels.";
DLOG(INFO) << "Blocks instantiated. " << channels_count_ << " channels.";
}
void GNSSFlowgraph::set_satellites_list()
{
void GNSSFlowgraph::set_signals_list() {
/*
* Sets a sequential list of satellites (1...32)
*/
/*
* Sets a sequential list of satellites (1...32)
*/
/*
* \TODO Describe GNSS satellites more nicely, with RINEX notation
* See http://igscb.jpl.nasa.gov/igscb/data/format/rinex301.pdf (page 5)
*/
std::set<unsigned int> available_gps_prn = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23 , 25, 26, 27, 28, 29, 30,
31, 32};
/*
* \TODO Describe GNSS satellites more nicely, with RINEX notation
* See http://igscb.jpl.nasa.gov/igscb/data/format/rinex301.pdf (page 5)
*/
std::set<unsigned int> available_gps_prn = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28,
29, 30, 31, 32 };
std::set<unsigned int>::iterator available_gps_prn_iter;
Gnss_Signal signal_value;
/*
* Loop to create the list of GNSS Signals
* To add signals from other systems, add another loop 'for'
*/
for (available_gps_prn_iter = available_gps_prn.begin(); available_gps_prn_iter
!= available_gps_prn.end(); available_gps_prn_iter++) {
signal_value = Gnss_Signal(Gnss_Satellite(std::string("GPS"), *available_gps_prn_iter),std::string("1C"));
available_GNSS_signals_.push_back(signal_value);
}
std::list<Gnss_Signal>::iterator gnss_it =
available_GNSS_signals_.begin();
for (unsigned int i = 0; i < channels_count_; i++) {
std::string default_system = "GPS";
std::string default_signal = "1C";
std::string gnss_system = (configuration_->property("Channel"
+ boost::lexical_cast<std::string>(i) + ".system",
default_system));
std::string gnss_signal = (configuration_->property("Channel"
+ boost::lexical_cast<std::string>(i) + ".signal",
default_signal));
unsigned int sat = configuration_->property("Channel"
+ boost::lexical_cast<std::string>(i) + ".satellite", 0);
std::set<unsigned int>::iterator available_gps_prn_iter;
if ((sat == 0) || (sat == gnss_it->get_satellite().get_PRN())) // 0 = not PRN in configuration file
{
gnss_it++;
} else {
signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat),gnss_signal);
available_GNSS_signals_.remove(signal_value);
available_GNSS_signals_.insert(gnss_it, signal_value);
}
for (available_gps_prn_iter = available_gps_prn.begin();
available_gps_prn_iter != available_gps_prn.end();
available_gps_prn_iter++)
{
sv = Gnss_Satellite(std::string("GPS"), *available_gps_prn_iter);
available_GPS_satellites_IDs_->push_back(sv);
}
std::list<Gnss_Satellite>::iterator it =
available_GPS_satellites_IDs_->begin();
for (unsigned int i = 0; i < channels_count_; i++)
{
unsigned int sat = configuration_->property("Acquisition" + boost::lexical_cast<std::string>(i) + ".satellite", 0);
if ((sat == 0) || (sat == it->get_PRN())) // 0 = not PRN in configuration file
{
it++;
}
else
{
sv = Gnss_Satellite(std::string("GPS"), it->get_PRN());
available_GPS_satellites_IDs_->remove(sv);
available_GPS_satellites_IDs_->insert(it, sv);
}
}
// std::cout << "Satellite queue: ";
// for (std::list<unsigned int>::iterator it =
// available_GPS_satellites_IDs_->begin(); it
// != available_GPS_satellites_IDs_->end(); it++)
// {
// std::cout << *it << ", ";
// }
// std::cout << std::endl;
}
std::cout << "Signal queue: " << std::endl;
for (std::list<Gnss_Signal>::iterator it =
available_GNSS_signals_.begin(); it
!= available_GNSS_signals_.end(); it++) {
std::cout << *it << std::endl;
}
}
void GNSSFlowgraph::apply_action(unsigned int what)
{
DLOG(INFO) << "Applied action " << what << " to flowgraph";
applied_actions_++;
void GNSSFlowgraph::apply_action(unsigned int what) {
DLOG(INFO) << "Applied action " << what << " to flowgraph";
applied_actions_++;
}

View File

@ -41,7 +41,7 @@
#include <gnuradio/gr_top_block.h>
#include <gnuradio/gr_msg_queue.h>
#include "GPS_L1_CA.h"
#include "gnss_satellite.h"
#include "gnss_signal.h"
class GNSSBlockInterface;
class ChannelInterface;
@ -117,7 +117,7 @@ private:
void init();
void apply_action(unsigned int what);
void set_satellites_list();
void set_signals_list();
bool connected_;
bool running_;
@ -134,10 +134,8 @@ private:
gr_top_block_sptr top_block_;
gr_msg_queue_sptr queue_;
std::list<Gnss_Satellite>* available_GPS_satellites_IDs_;
std::queue<unsigned int>* available_Galileo_satellites_IDs_;
std::list<Gnss_Signal> available_GNSS_signals_;
Gnss_Satellite sv;
};
#endif /*GNSS_SDR_GNSS_FLOWGRAPH_H_*/

View File

@ -43,12 +43,33 @@ Gnss_Signal::~Gnss_Signal()
{
}
std::string Gnss_Signal::get_signal()
std::string Gnss_Signal::get_signal() const
{
return this->signal;
}
Gnss_Satellite Gnss_Signal::get_satellite()
Gnss_Satellite Gnss_Signal::get_satellite() const
{
return this->satellite;
}
std::ostream& operator<<(std::ostream &out, const Gnss_Signal &sig) // output
{
//std::string psystem = sat::get_system()
out << sig.get_satellite() << " Signal " << sig.get_signal() ;
return out;
}
bool operator== (const Gnss_Signal &sig1, const Gnss_Signal &sig2)
{
bool equal = false;
if (sig1.get_satellite() == sig2.get_satellite())
{
if (sig1.get_signal() == (sig2.get_signal()))
{
equal = true;
}
}
return equal;
}

View File

@ -49,8 +49,11 @@ public:
Gnss_Signal();
Gnss_Signal(Gnss_Satellite satellite_,std::string signal_);
~Gnss_Signal();
std::string get_signal();
Gnss_Satellite get_satellite();
std::string get_signal() const;
Gnss_Satellite get_satellite() const;
friend bool operator== (const Gnss_Signal &, const Gnss_Signal &); // operator== for comparison
friend std::ostream& operator<<(std::ostream &, const Gnss_Signal &); // operator<< for pretty printing
};
#endif

View File

@ -55,6 +55,8 @@ exe run_tests : test_main.cc
../core/receiver//gnss_flowgraph
../core/system_parameters//gps_navigation_message
../core/system_parameters//gnss_satellite
../core/system_parameters//gnss_signal
../core/system_parameters//gnss_synchro
../..//gflags
../..//glog
../..//gnuradio-core