mirror of https://github.com/gnss-sdr/gnss-sdr
Tracking Classes are now upper case.
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@125 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
parent
69f9d8f902
commit
32690a7d59
|
@ -61,66 +61,80 @@ using google::LogMessage;
|
||||||
|
|
||||||
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(unsigned int satellite, long if_freq, long fs_in, unsigned
|
gps_l1_ca_dll_fll_pll_make_tracking_cc(unsigned int 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) {
|
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(satellite, if_freq,
|
||||||
fs_in, vector_length, queue, dump, dump_filename, order, fll_bw_hz, pll_bw_hz,dll_bw_hz,early_late_space_chips));
|
fs_in, vector_length, queue, dump, dump_filename, order, fll_bw_hz, pll_bw_hz,dll_bw_hz,
|
||||||
|
early_late_space_chips));
|
||||||
}
|
}
|
||||||
|
|
||||||
void gps_l1_ca_dll_fll_pll_tracking_cc::forecast (int noutput_items,
|
|
||||||
gr_vector_int &ninput_items_required){
|
|
||||||
|
|
||||||
|
void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::forecast (int noutput_items, gr_vector_int &ninput_items_required)
|
||||||
|
{
|
||||||
ninput_items_required[0] =d_vector_length*2; //set the required available samples in each call
|
ninput_items_required[0] =d_vector_length*2; //set the required available samples in each call
|
||||||
}
|
}
|
||||||
|
|
||||||
gps_l1_ca_dll_fll_pll_tracking_cc::gps_l1_ca_dll_fll_pll_tracking_cc(unsigned int 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) :
|
|
||||||
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))) {
|
Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc(unsigned int satellite,
|
||||||
//gr_sync_decimator ("gps_l1_ca_dll_pll_tracking_cc", gr_make_io_signature (1, 1, sizeof(gr_complex)),
|
long if_freq, long fs_in, unsigned int vector_length, gr_msg_queue_sptr queue, bool dump,
|
||||||
// gr_make_io_signature(3, 3, sizeof(float)),vector_length) {
|
std::string dump_filename, int order, float fll_bw_hz, float pll_bw_hz, float dll_bw_hz,
|
||||||
// initialize internal vars
|
float early_late_space_chips) :
|
||||||
d_queue = queue;
|
gr_block ("Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc", gr_make_io_signature (1, 1, sizeof(gr_complex)),
|
||||||
d_dump = dump;
|
gr_make_io_signature(5, 5, sizeof(double)))
|
||||||
d_satellite = satellite;
|
{
|
||||||
d_if_freq = if_freq;
|
//gr_sync_decimator ("gps_l1_ca_dll_pll_tracking_cc", gr_make_io_signature (1, 1, sizeof(gr_complex)),
|
||||||
d_fs_in = fs_in;
|
// gr_make_io_signature(3, 3, sizeof(float)),vector_length) {
|
||||||
d_vector_length = vector_length;
|
// initialize internal vars
|
||||||
d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips)
|
d_queue = queue;
|
||||||
|
d_dump = dump;
|
||||||
|
d_satellite = satellite;
|
||||||
|
d_if_freq = if_freq;
|
||||||
|
d_fs_in = fs_in;
|
||||||
|
d_vector_length = vector_length;
|
||||||
|
d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips)
|
||||||
d_dump_filename=dump_filename;
|
d_dump_filename=dump_filename;
|
||||||
|
|
||||||
// Initialize tracking variables ==========================================
|
// Initialize tracking variables ==========================================
|
||||||
d_carrier_loop_filter.set_params(fll_bw_hz,pll_bw_hz,order);
|
d_carrier_loop_filter.set_params(fll_bw_hz,pll_bw_hz,order);
|
||||||
|
|
||||||
// Get space for a vector with the C/A code replica sampled 1x/chip
|
// Get space for a vector with the C/A code replica sampled 1x/chip
|
||||||
d_ca_code=new gr_complex[(int)GPS_L1_CA_CODE_LENGTH_CHIPS+2];
|
d_ca_code = new gr_complex[(int)GPS_L1_CA_CODE_LENGTH_CHIPS+2];
|
||||||
// Get space for the resampled early / prompt / late local replicas
|
// Get space for the resampled early / prompt / late local replicas
|
||||||
d_early_code= new gr_complex[d_vector_length*2];
|
d_early_code = new gr_complex[d_vector_length*2];
|
||||||
d_prompt_code=new gr_complex[d_vector_length*2];
|
d_prompt_code =new gr_complex[d_vector_length*2];
|
||||||
d_late_code=new gr_complex[d_vector_length*2];
|
d_late_code =new gr_complex[d_vector_length*2];
|
||||||
// space for carrier wipeoff LO vector
|
// space for carrier wipeoff LO vector
|
||||||
d_carr_sign=new gr_complex[d_vector_length*2];
|
d_carr_sign = new gr_complex[d_vector_length*2];
|
||||||
|
|
||||||
// sample synchronization
|
// sample synchronization
|
||||||
d_sample_counter=0;
|
d_sample_counter = 0;
|
||||||
d_sample_counter_seconds=0;
|
d_sample_counter_seconds = 0;
|
||||||
d_acq_sample_stamp=0;
|
d_acq_sample_stamp = 0;
|
||||||
d_last_seg=0;// this is for debug output only
|
d_last_seg = 0;// this is for debug output only
|
||||||
|
|
||||||
d_enable_tracking=false;
|
d_enable_tracking = false;
|
||||||
|
|
||||||
d_current_prn_length_samples=(int)d_vector_length;
|
d_current_prn_length_samples = (int)d_vector_length;
|
||||||
|
|
||||||
// CN0 estimation and lock detector buffers
|
// CN0 estimation and lock detector buffers
|
||||||
d_cn0_estimation_counter=0;
|
d_cn0_estimation_counter = 0;
|
||||||
d_Prompt_buffer=new gr_complex[CN0_ESTIMATION_SAMPLES];
|
d_Prompt_buffer = new gr_complex[CN0_ESTIMATION_SAMPLES];
|
||||||
d_carrier_lock_test=1;
|
d_carrier_lock_test = 1;
|
||||||
d_CN0_SNV_dB_Hz=0;
|
d_CN0_SNV_dB_Hz = 0;
|
||||||
d_carrier_lock_fail_counter=0;
|
d_carrier_lock_fail_counter = 0;
|
||||||
d_carrier_lock_threshold=5;
|
d_carrier_lock_threshold = 5;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void gps_l1_ca_dll_fll_pll_tracking_cc::start_tracking(){
|
|
||||||
|
|
||||||
|
|
||||||
|
void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::start_tracking(){
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* correct the code phase according to the delay between acq and trk
|
* correct the code phase according to the delay between acq and trk
|
||||||
|
@ -193,7 +207,7 @@ void gps_l1_ca_dll_fll_pll_tracking_cc::start_tracking(){
|
||||||
std::cout<<"PULL-IN Doppler [Hz]= "<<d_carrier_doppler_hz<<" Code Phase correction [samples]="<<delay_correction_samples<<" PULL-IN Code Phase [samples]= "<<d_acq_code_phase_samples<<"\r\n";
|
std::cout<<"PULL-IN Doppler [Hz]= "<<d_carrier_doppler_hz<<" Code Phase correction [samples]="<<delay_correction_samples<<" PULL-IN Code Phase [samples]= "<<d_acq_code_phase_samples<<"\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void gps_l1_ca_dll_fll_pll_tracking_cc::update_local_code()
|
void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::update_local_code()
|
||||||
{
|
{
|
||||||
float tcode_chips;
|
float tcode_chips;
|
||||||
float rem_code_phase_chips;
|
float rem_code_phase_chips;
|
||||||
|
@ -217,7 +231,7 @@ void gps_l1_ca_dll_fll_pll_tracking_cc::update_local_code()
|
||||||
//d_code_phase_samples=d_code_phase_samples+(float)d_fs_in*GPS_L1_CA_CODE_LENGTH_CHIPS*(1/d_code_freq_hz-1/GPS_L1_CA_CODE_RATE_HZ);
|
//d_code_phase_samples=d_code_phase_samples+(float)d_fs_in*GPS_L1_CA_CODE_LENGTH_CHIPS*(1/d_code_freq_hz-1/GPS_L1_CA_CODE_RATE_HZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gps_l1_ca_dll_fll_pll_tracking_cc::update_local_carrier()
|
void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::update_local_carrier()
|
||||||
{
|
{
|
||||||
float phase, phase_step;
|
float phase, phase_step;
|
||||||
phase_step = (float)TWO_PI*d_carrier_doppler_hz/(float)d_fs_in;
|
phase_step = (float)TWO_PI*d_carrier_doppler_hz/(float)d_fs_in;
|
||||||
|
@ -230,7 +244,7 @@ void gps_l1_ca_dll_fll_pll_tracking_cc::update_local_carrier()
|
||||||
d_acc_carrier_phase_rad=d_acc_carrier_phase_rad+d_rem_carr_phase;
|
d_acc_carrier_phase_rad=d_acc_carrier_phase_rad+d_rem_carr_phase;
|
||||||
}
|
}
|
||||||
|
|
||||||
gps_l1_ca_dll_fll_pll_tracking_cc::~gps_l1_ca_dll_fll_pll_tracking_cc() {
|
Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::~Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc() {
|
||||||
d_dump_file.close();
|
d_dump_file.close();
|
||||||
delete[] d_ca_code;
|
delete[] d_ca_code;
|
||||||
delete[] d_early_code;
|
delete[] d_early_code;
|
||||||
|
@ -244,7 +258,7 @@ gps_l1_ca_dll_fll_pll_tracking_cc::~gps_l1_ca_dll_fll_pll_tracking_cc() {
|
||||||
* Notice that this is a class derived from gr_sync_decimator, so each of the ninput_items has vector_length samples
|
* Notice that this is a class derived from gr_sync_decimator, so each of the ninput_items has vector_length samples
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int gps_l1_ca_dll_fll_pll_tracking_cc::general_work (int noutput_items, gr_vector_int &ninput_items,
|
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) {
|
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) {
|
||||||
|
|
||||||
// if ((unsigned int)ninput_items[0]<(d_vector_length*2))
|
// if ((unsigned int)ninput_items[0]<(d_vector_length*2))
|
||||||
|
@ -527,22 +541,22 @@ 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) {
|
void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::set_acq_code_phase(float code_phase) {
|
||||||
d_acq_code_phase_samples=code_phase;
|
d_acq_code_phase_samples=code_phase;
|
||||||
LOG_AT_LEVEL(INFO) << "Tracking code phase set to " << d_acq_code_phase_samples;
|
LOG_AT_LEVEL(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) {
|
void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::set_acq_doppler(float doppler) {
|
||||||
d_acq_carrier_doppler_hz = doppler;
|
d_acq_carrier_doppler_hz = doppler;
|
||||||
LOG_AT_LEVEL(INFO) << "Tracking carrier doppler set to " << d_acq_carrier_doppler_hz;
|
LOG_AT_LEVEL(INFO) << "Tracking carrier doppler set to " << d_acq_carrier_doppler_hz;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gps_l1_ca_dll_fll_pll_tracking_cc::set_satellite(unsigned int satellite) {
|
void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::set_satellite(unsigned int satellite) {
|
||||||
d_satellite = satellite;
|
d_satellite = satellite;
|
||||||
LOG_AT_LEVEL(INFO) << "Tracking Satellite set to " << d_satellite;
|
LOG_AT_LEVEL(INFO) << "Tracking Satellite set to " << d_satellite;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gps_l1_ca_dll_fll_pll_tracking_cc::set_channel(unsigned int channel) {
|
void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::set_channel(unsigned int channel) {
|
||||||
d_channel = channel;
|
d_channel = channel;
|
||||||
LOG_AT_LEVEL(INFO) << "Tracking Channel set to " << d_channel;
|
LOG_AT_LEVEL(INFO) << "Tracking Channel set to " << d_channel;
|
||||||
// ############# ENABLE DATA FILE LOG #################
|
// ############# ENABLE DATA FILE LOG #################
|
||||||
|
@ -564,12 +578,12 @@ 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)
|
void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::set_acq_sample_stamp(unsigned long int sample_stamp)
|
||||||
{
|
{
|
||||||
d_acq_sample_stamp = 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)
|
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;
|
d_channel_internal_queue = channel_internal_queue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,8 +48,8 @@
|
||||||
#include <boost/thread/thread.hpp>
|
#include <boost/thread/thread.hpp>
|
||||||
#include "concurrent_queue.h"
|
#include "concurrent_queue.h"
|
||||||
|
|
||||||
class gps_l1_ca_dll_fll_pll_tracking_cc;
|
class Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc;
|
||||||
typedef boost::shared_ptr<gps_l1_ca_dll_fll_pll_tracking_cc>
|
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_tracking_cc_sptr
|
gps_l1_ca_dll_fll_pll_tracking_cc_sptr
|
||||||
|
@ -71,7 +71,7 @@ gps_l1_ca_dll_fll_pll_make_tracking_cc(unsigned int satellite,
|
||||||
/*!
|
/*!
|
||||||
* \brief This class implements a DLL and a FLL assisted PLL tracking loop block
|
* \brief This class implements a DLL and a FLL assisted PLL tracking loop block
|
||||||
*/
|
*/
|
||||||
class gps_l1_ca_dll_fll_pll_tracking_cc: public gr_block
|
class Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc: public gr_block
|
||||||
{
|
{
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -90,7 +90,7 @@ private:
|
||||||
float dll_bw_hz,
|
float dll_bw_hz,
|
||||||
float early_late_space_chips);
|
float early_late_space_chips);
|
||||||
|
|
||||||
gps_l1_ca_dll_fll_pll_tracking_cc(unsigned int satellite,
|
Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc(unsigned int satellite,
|
||||||
long if_freq,
|
long if_freq,
|
||||||
long fs_in, unsigned
|
long fs_in, unsigned
|
||||||
int vector_length,
|
int vector_length,
|
||||||
|
@ -149,7 +149,7 @@ private:
|
||||||
|
|
||||||
// FLL + PLL filter
|
// FLL + PLL filter
|
||||||
float d_FLL_discriminator_hz; // This is a class variable because FLL needs to have memory
|
float d_FLL_discriminator_hz; // This is a class variable because FLL needs to have memory
|
||||||
tracking_FLL_PLL_filter d_carrier_loop_filter;
|
Tracking_FLL_PLL_filter d_carrier_loop_filter;
|
||||||
float d_acc_carrier_phase_rad;
|
float d_acc_carrier_phase_rad;
|
||||||
|
|
||||||
unsigned long int d_sample_counter;
|
unsigned long int d_sample_counter;
|
||||||
|
@ -174,7 +174,7 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
~gps_l1_ca_dll_fll_pll_tracking_cc();
|
~Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc();
|
||||||
|
|
||||||
void set_satellite(unsigned int satellite);
|
void set_satellite(unsigned int satellite);
|
||||||
void set_channel(unsigned int channel);
|
void set_channel(unsigned int channel);
|
||||||
|
|
|
@ -64,15 +64,16 @@ using google::LogMessage;
|
||||||
|
|
||||||
gps_l1_ca_dll_pll_tracking_cc_sptr
|
gps_l1_ca_dll_pll_tracking_cc_sptr
|
||||||
gps_l1_ca_dll_pll_make_tracking_cc(unsigned int satellite, long if_freq, long fs_in, unsigned
|
gps_l1_ca_dll_pll_make_tracking_cc(unsigned int 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)
|
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(satellite, if_freq,
|
||||||
fs_in, vector_length, queue, dump, dump_filename, pll_bw_hz, dll_bw_hz, early_late_space_chips));
|
fs_in, vector_length, queue, dump, dump_filename, pll_bw_hz, dll_bw_hz, early_late_space_chips));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void gps_l1_ca_dll_pll_tracking_cc::forecast (int noutput_items,
|
void Gps_L1_Ca_Dll_Pll_Tracking_cc::forecast (int noutput_items,
|
||||||
gr_vector_int &ninput_items_required)
|
gr_vector_int &ninput_items_required)
|
||||||
{
|
{
|
||||||
ninput_items_required[0] = (int)d_vector_length*2; //set the required available samples in each call
|
ninput_items_required[0] = (int)d_vector_length*2; //set the required available samples in each call
|
||||||
|
@ -80,13 +81,13 @@ 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(unsigned int satellite, long if_freq, long fs_in, unsigned
|
Gps_L1_Ca_Dll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Pll_Tracking_cc(unsigned int 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) :
|
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_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(5, 5, sizeof(double)))
|
||||||
{
|
{
|
||||||
|
|
||||||
//gr_sync_decimator ("gps_l1_ca_dll_pll_tracking_cc", gr_make_io_signature (1, 1, sizeof(gr_complex)),
|
//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) {
|
// gr_make_io_signature(3, 3, sizeof(float)),vector_length) {
|
||||||
// initialize internal vars
|
// initialize internal vars
|
||||||
d_queue = queue;
|
d_queue = queue;
|
||||||
|
@ -145,7 +146,7 @@ gps_l1_ca_dll_pll_tracking_cc::gps_l1_ca_dll_pll_tracking_cc(unsigned int satell
|
||||||
d_carrier_lock_threshold = 5;
|
d_carrier_lock_threshold = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gps_l1_ca_dll_pll_tracking_cc::start_tracking()
|
void Gps_L1_Ca_Dll_Pll_Tracking_cc::start_tracking()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* correct the code phase according to the delay between acq and trk
|
* correct the code phase according to the delay between acq and trk
|
||||||
|
@ -224,7 +225,7 @@ void gps_l1_ca_dll_pll_tracking_cc::start_tracking()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void gps_l1_ca_dll_pll_tracking_cc::update_local_code()
|
void Gps_L1_Ca_Dll_Pll_Tracking_cc::update_local_code()
|
||||||
{
|
{
|
||||||
float tcode_chips;
|
float tcode_chips;
|
||||||
float rem_code_phase_chips;
|
float rem_code_phase_chips;
|
||||||
|
@ -258,7 +259,7 @@ void gps_l1_ca_dll_pll_tracking_cc::update_local_code()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void gps_l1_ca_dll_pll_tracking_cc::update_local_carrier()
|
void Gps_L1_Ca_Dll_Pll_Tracking_cc::update_local_carrier()
|
||||||
{
|
{
|
||||||
float phase_rad, phase_step_rad;
|
float phase_rad, phase_step_rad;
|
||||||
|
|
||||||
|
@ -276,7 +277,7 @@ void gps_l1_ca_dll_pll_tracking_cc::update_local_carrier()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
gps_l1_ca_dll_pll_tracking_cc::~gps_l1_ca_dll_pll_tracking_cc()
|
Gps_L1_Ca_Dll_Pll_Tracking_cc::~Gps_L1_Ca_Dll_Pll_Tracking_cc()
|
||||||
{
|
{
|
||||||
d_dump_file.close();
|
d_dump_file.close();
|
||||||
delete[] d_ca_code;
|
delete[] d_ca_code;
|
||||||
|
@ -296,7 +297,7 @@ gps_l1_ca_dll_pll_tracking_cc::~gps_l1_ca_dll_pll_tracking_cc()
|
||||||
* Notice that this is a class derived from gr_sync_decimator, so each of the ninput_items has vector_length samples
|
* Notice that this is a class derived from gr_sync_decimator, so each of the ninput_items has vector_length samples
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int gps_l1_ca_dll_pll_tracking_cc::general_work (int noutput_items, gr_vector_int &ninput_items,
|
int Gps_L1_Ca_Dll_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)
|
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -317,11 +318,12 @@ int gps_l1_ca_dll_pll_tracking_cc::general_work (int noutput_items, gr_vector_in
|
||||||
d_Prompt = gr_complex(0,0);
|
d_Prompt = gr_complex(0,0);
|
||||||
d_Late = gr_complex(0,0);
|
d_Late = gr_complex(0,0);
|
||||||
|
|
||||||
if (d_enable_tracking==true){
|
if (d_enable_tracking == true)
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
* Receiver signal alignment
|
* Receiver signal alignment
|
||||||
*/
|
*/
|
||||||
if (d_pull_in==true)
|
if (d_pull_in == true)
|
||||||
{
|
{
|
||||||
int samples_offset;
|
int samples_offset;
|
||||||
|
|
||||||
|
@ -332,13 +334,13 @@ int gps_l1_ca_dll_pll_tracking_cc::general_work (int noutput_items, gr_vector_in
|
||||||
acq_trk_shif_correction_samples = d_next_prn_length_samples - fmod((float)acq_to_trk_delay_samples, (float)d_next_prn_length_samples);
|
acq_trk_shif_correction_samples = d_next_prn_length_samples - fmod((float)acq_to_trk_delay_samples, (float)d_next_prn_length_samples);
|
||||||
//std::cout<<"acq_trk_shif_correction="<<acq_trk_shif_correction_samples<<"\r\n";
|
//std::cout<<"acq_trk_shif_correction="<<acq_trk_shif_correction_samples<<"\r\n";
|
||||||
#ifdef GNSS_SDR_USE_BOOST_ROUND
|
#ifdef GNSS_SDR_USE_BOOST_ROUND
|
||||||
samples_offset=round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
|
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
|
||||||
#else
|
#else
|
||||||
samples_offset=std::round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
|
samples_offset = std::round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
|
||||||
#endif
|
#endif
|
||||||
// /todo: Check if the sample counter sent to the next block as a time reference should be incremented AFTER sended or BEFORE
|
// /todo: Check if the sample counter sent to the next block as a time reference should be incremented AFTER sended or BEFORE
|
||||||
d_sample_counter_seconds = d_sample_counter_seconds + (((double)samples_offset) / (double)d_fs_in);
|
d_sample_counter_seconds = d_sample_counter_seconds + (((double)samples_offset) / (double)d_fs_in);
|
||||||
d_sample_counter =d_sample_counter + samples_offset; //count for the processed samples
|
d_sample_counter = d_sample_counter + samples_offset; //count for the processed samples
|
||||||
d_pull_in = false;
|
d_pull_in = false;
|
||||||
//std::cout<<" samples_offset="<<samples_offset<<"\r\n";
|
//std::cout<<" samples_offset="<<samples_offset<<"\r\n";
|
||||||
consume_each(samples_offset); //shift input to perform alignement with local replica
|
consume_each(samples_offset); //shift input to perform alignement with local replica
|
||||||
|
@ -349,16 +351,17 @@ int gps_l1_ca_dll_pll_tracking_cc::general_work (int noutput_items, gr_vector_in
|
||||||
double **out = (double **) &output_items[0];
|
double **out = (double **) &output_items[0];
|
||||||
|
|
||||||
// check for samples consistency
|
// check for samples consistency
|
||||||
for(int i=0; i<d_current_prn_length_samples; i++) {
|
for(int i=0; i<d_current_prn_length_samples; i++)
|
||||||
|
{
|
||||||
if (std::isnan(in[i].real()) == true or std::isnan(in[i].imag()) == true)// or std::isinf(in[i].real())==true or std::isinf(in[i].imag())==true)
|
if (std::isnan(in[i].real()) == true or std::isnan(in[i].imag()) == true)// or std::isinf(in[i].real())==true or std::isinf(in[i].imag())==true)
|
||||||
{
|
{
|
||||||
const int samples_available = ninput_items[0];
|
const int samples_available = ninput_items[0];
|
||||||
d_sample_counter = d_sample_counter + samples_available;
|
d_sample_counter = d_sample_counter + samples_available;
|
||||||
LOG_AT_LEVEL(WARNING) << "Detected NaN samples at sample number "<< d_sample_counter << std::endl;
|
LOG_AT_LEVEL(WARNING) << "Detected NaN samples at sample number " << d_sample_counter << std::endl;
|
||||||
consume_each(samples_available);
|
consume_each(samples_available);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Update the prn length based on code freq (variable) and
|
// Update the prn length based on code freq (variable) and
|
||||||
// sampling frequency (fixed)
|
// sampling frequency (fixed)
|
||||||
// variable code PRN sample block size
|
// variable code PRN sample block size
|
||||||
|
@ -373,14 +376,15 @@ int gps_l1_ca_dll_pll_tracking_cc::general_work (int noutput_items, gr_vector_in
|
||||||
/*!
|
/*!
|
||||||
* \todo Use SIMD-enabled correlators
|
* \todo Use SIMD-enabled correlators
|
||||||
*/
|
*/
|
||||||
for(int i=0; i<d_current_prn_length_samples; i++) {
|
for(int i=0; i<d_current_prn_length_samples; i++)
|
||||||
|
{
|
||||||
//Perform the carrier wipe-off
|
//Perform the carrier wipe-off
|
||||||
bb_signal_sample = in[i] * d_carr_sign[i];
|
bb_signal_sample = in[i] * d_carr_sign[i];
|
||||||
// Now get early, late, and prompt values for each
|
// Now get early, late, and prompt values for each
|
||||||
d_Early += bb_signal_sample * d_early_code[i];
|
d_Early += bb_signal_sample * d_early_code[i];
|
||||||
d_Prompt += bb_signal_sample * d_prompt_code[i];
|
d_Prompt += bb_signal_sample * d_prompt_code[i];
|
||||||
d_Late += bb_signal_sample * d_late_code[i];
|
d_Late += bb_signal_sample * d_late_code[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute PLL error and update carrier NCO -
|
// Compute PLL error and update carrier NCO -
|
||||||
carr_error = pll_cloop_two_quadrant_atan(d_Prompt) / (float)TWO_PI;
|
carr_error = pll_cloop_two_quadrant_atan(d_Prompt) / (float)TWO_PI;
|
||||||
|
@ -420,11 +424,11 @@ int gps_l1_ca_dll_pll_tracking_cc::general_work (int noutput_items, gr_vector_in
|
||||||
}
|
}
|
||||||
|
|
||||||
d_code_phase_samples = fmod(d_code_phase_samples, T_prn_true_samples);
|
d_code_phase_samples = fmod(d_code_phase_samples, T_prn_true_samples);
|
||||||
#ifdef GNSS_SDR_USE_BOOST_ROUND
|
#ifdef GNSS_SDR_USE_BOOST_ROUND
|
||||||
d_next_prn_length_samples = round(K_blk_samples); //round to a discrete samples
|
d_next_prn_length_samples = round(K_blk_samples); //round to a discrete samples
|
||||||
#else
|
#else
|
||||||
d_next_prn_length_samples = std::round(K_blk_samples); //round to a discrete samples
|
d_next_prn_length_samples = std::round(K_blk_samples); //round to a discrete samples
|
||||||
#endif
|
#endif
|
||||||
d_next_rem_code_phase_samples = K_blk_samples - d_next_prn_length_samples; //rounding error
|
d_next_rem_code_phase_samples = K_blk_samples - d_next_prn_length_samples; //rounding error
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -504,7 +508,7 @@ int gps_l1_ca_dll_pll_tracking_cc::general_work (int noutput_items, gr_vector_in
|
||||||
//std::cout<<"TRK CH "<<d_channel<<" Carrier_lock_test="<<d_carrier_lock_test<< std::endl;
|
//std::cout<<"TRK CH "<<d_channel<<" Carrier_lock_test="<<d_carrier_lock_test<< std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
double **out = (double **) &output_items[0]; //block output streams pointer
|
double **out = (double **) &output_items[0]; //block output streams pointer
|
||||||
|
@ -515,7 +519,8 @@ int gps_l1_ca_dll_pll_tracking_cc::general_work (int noutput_items, gr_vector_in
|
||||||
*out[4] = 0;
|
*out[4] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(d_dump) {
|
if(d_dump)
|
||||||
|
{
|
||||||
// MULTIPLEXED FILE RECORDING - Record results to file
|
// MULTIPLEXED FILE RECORDING - Record results to file
|
||||||
float prompt_I;
|
float prompt_I;
|
||||||
float prompt_Q;
|
float prompt_Q;
|
||||||
|
@ -566,7 +571,7 @@ int gps_l1_ca_dll_pll_tracking_cc::general_work (int noutput_items, gr_vector_in
|
||||||
{
|
{
|
||||||
std::cout << "Exception writing trk dump file " << e.what() << std::endl;
|
std::cout << "Exception writing trk dump file " << e.what() << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
consume_each(d_current_prn_length_samples); // this is necesary in gr_block derivates
|
consume_each(d_current_prn_length_samples); // this is necesary in gr_block derivates
|
||||||
d_sample_counter_seconds = d_sample_counter_seconds + ( ((double)d_current_prn_length_samples) / (double)d_fs_in );
|
d_sample_counter_seconds = d_sample_counter_seconds + ( ((double)d_current_prn_length_samples) / (double)d_fs_in );
|
||||||
|
@ -580,7 +585,7 @@ 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)
|
void Gps_L1_Ca_Dll_Pll_Tracking_cc::set_acq_code_phase(float code_phase)
|
||||||
{
|
{
|
||||||
d_acq_code_phase_samples = code_phase;
|
d_acq_code_phase_samples = code_phase;
|
||||||
LOG_AT_LEVEL(INFO) << "Tracking code phase set to " << d_acq_code_phase_samples;
|
LOG_AT_LEVEL(INFO) << "Tracking code phase set to " << d_acq_code_phase_samples;
|
||||||
|
@ -589,7 +594,9 @@ void gps_l1_ca_dll_pll_tracking_cc::set_acq_code_phase(float code_phase)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void gps_l1_ca_dll_pll_tracking_cc::set_acq_doppler(float doppler)
|
|
||||||
|
|
||||||
|
void Gps_L1_Ca_Dll_Pll_Tracking_cc::set_acq_doppler(float doppler)
|
||||||
{
|
{
|
||||||
d_acq_carrier_doppler_hz = doppler;
|
d_acq_carrier_doppler_hz = doppler;
|
||||||
LOG_AT_LEVEL(INFO) << "Tracking carrier doppler set to " << d_acq_carrier_doppler_hz;
|
LOG_AT_LEVEL(INFO) << "Tracking carrier doppler set to " << d_acq_carrier_doppler_hz;
|
||||||
|
@ -597,20 +604,26 @@ void gps_l1_ca_dll_pll_tracking_cc::set_acq_doppler(float doppler)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void gps_l1_ca_dll_pll_tracking_cc::set_satellite(unsigned int satellite)
|
|
||||||
|
|
||||||
|
void Gps_L1_Ca_Dll_Pll_Tracking_cc::set_satellite(unsigned int satellite)
|
||||||
{
|
{
|
||||||
d_satellite = satellite;
|
d_satellite = satellite;
|
||||||
LOG_AT_LEVEL(INFO) << "Tracking Satellite set to " << d_satellite;
|
LOG_AT_LEVEL(INFO) << "Tracking Satellite set to " << d_satellite;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gps_l1_ca_dll_pll_tracking_cc::set_channel(unsigned int channel)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Gps_L1_Ca_Dll_Pll_Tracking_cc::set_channel(unsigned int channel)
|
||||||
{
|
{
|
||||||
d_channel = channel;
|
d_channel = channel;
|
||||||
LOG_AT_LEVEL(INFO) << "Tracking Channel set to " << d_channel;
|
LOG_AT_LEVEL(INFO) << "Tracking Channel set to " << d_channel;
|
||||||
// ############# ENABLE DATA FILE LOG #################
|
// ############# ENABLE DATA FILE LOG #################
|
||||||
if (d_dump==true)
|
if (d_dump==true)
|
||||||
{
|
{
|
||||||
if (d_dump_file.is_open()==false)
|
if (d_dump_file.is_open() == false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -622,7 +635,7 @@ void gps_l1_ca_dll_pll_tracking_cc::set_channel(unsigned int channel)
|
||||||
}
|
}
|
||||||
catch (std::ifstream::failure e)
|
catch (std::ifstream::failure e)
|
||||||
{
|
{
|
||||||
std::cout << "channel "<< d_channel << " Exception opening trk dump file " << e.what() << std::endl;
|
std::cout << "channel " << d_channel << " Exception opening trk dump file " << e.what() << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -630,7 +643,7 @@ 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)
|
void Gps_L1_Ca_Dll_Pll_Tracking_cc::set_acq_sample_stamp(unsigned long int sample_stamp)
|
||||||
{
|
{
|
||||||
d_acq_sample_stamp = sample_stamp;
|
d_acq_sample_stamp = sample_stamp;
|
||||||
}
|
}
|
||||||
|
@ -638,7 +651,7 @@ void gps_l1_ca_dll_pll_tracking_cc::set_acq_sample_stamp(unsigned long int sampl
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void gps_l1_ca_dll_pll_tracking_cc::set_channel_queue(concurrent_queue<int> *channel_internal_queue)
|
void Gps_L1_Ca_Dll_Pll_Tracking_cc::set_channel_queue(concurrent_queue<int> *channel_internal_queue)
|
||||||
{
|
{
|
||||||
d_channel_internal_queue = channel_internal_queue;
|
d_channel_internal_queue = channel_internal_queue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,8 +48,8 @@
|
||||||
#include <boost/thread/thread.hpp>
|
#include <boost/thread/thread.hpp>
|
||||||
#include "concurrent_queue.h"
|
#include "concurrent_queue.h"
|
||||||
|
|
||||||
class gps_l1_ca_dll_pll_tracking_cc;
|
class Gps_L1_Ca_Dll_Pll_Tracking_cc;
|
||||||
typedef boost::shared_ptr<gps_l1_ca_dll_pll_tracking_cc>
|
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_tracking_cc_sptr
|
gps_l1_ca_dll_pll_tracking_cc_sptr
|
||||||
|
@ -68,7 +68,7 @@ gps_l1_ca_dll_pll_make_tracking_cc(unsigned int satellite, long if_freq,
|
||||||
/*!
|
/*!
|
||||||
* \brief This class implements a DLL + PLL tracking loop block
|
* \brief This class implements a DLL + PLL tracking loop block
|
||||||
*/
|
*/
|
||||||
class gps_l1_ca_dll_pll_tracking_cc: public gr_block
|
class Gps_L1_Ca_Dll_Pll_Tracking_cc: public gr_block
|
||||||
{
|
{
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -84,7 +84,7 @@ private:
|
||||||
float dll_bw_hz,
|
float dll_bw_hz,
|
||||||
float early_late_space_chips);
|
float early_late_space_chips);
|
||||||
|
|
||||||
gps_l1_ca_dll_pll_tracking_cc(unsigned int satellite, long if_freq,
|
Gps_L1_Ca_Dll_Pll_Tracking_cc(unsigned int satellite, long if_freq,
|
||||||
long fs_in, unsigned
|
long fs_in, unsigned
|
||||||
int vector_length,
|
int vector_length,
|
||||||
gr_msg_queue_sptr queue,
|
gr_msg_queue_sptr queue,
|
||||||
|
@ -128,8 +128,8 @@ private:
|
||||||
float d_rem_carr_phase_rad;
|
float d_rem_carr_phase_rad;
|
||||||
|
|
||||||
// PLL and DLL filter library
|
// PLL and DLL filter library
|
||||||
tracking_2nd_DLL_filter d_code_loop_filter;
|
Tracking_2nd_DLL_filter d_code_loop_filter;
|
||||||
tracking_2nd_PLL_filter d_carrier_loop_filter;
|
Tracking_2nd_PLL_filter d_carrier_loop_filter;
|
||||||
|
|
||||||
// acquisition
|
// acquisition
|
||||||
float d_acq_code_phase_samples;
|
float d_acq_code_phase_samples;
|
||||||
|
@ -168,7 +168,7 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
~gps_l1_ca_dll_pll_tracking_cc();
|
~Gps_L1_Ca_Dll_Pll_Tracking_cc();
|
||||||
|
|
||||||
void set_satellite(unsigned int satellite);
|
void set_satellite(unsigned int satellite);
|
||||||
void set_channel(unsigned int channel);
|
void set_channel(unsigned int channel);
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
#include "tracking_2nd_DLL_filter.h"
|
#include "tracking_2nd_DLL_filter.h"
|
||||||
|
|
||||||
|
|
||||||
void tracking_2nd_DLL_filter::calculate_lopp_coef(float* tau1,float* tau2, float lbw, float zeta, float k)
|
void Tracking_2nd_DLL_filter::calculate_lopp_coef(float* tau1,float* tau2, float lbw, float zeta, float k)
|
||||||
{
|
{
|
||||||
// Solve natural frequency
|
// Solve natural frequency
|
||||||
float Wn;
|
float Wn;
|
||||||
|
@ -50,16 +50,16 @@ void tracking_2nd_DLL_filter::calculate_lopp_coef(float* tau1,float* tau2, float
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void tracking_2nd_DLL_filter::set_DLL_BW(float dll_bw_hz)
|
void Tracking_2nd_DLL_filter::set_DLL_BW(float dll_bw_hz)
|
||||||
{
|
{
|
||||||
//Calculate filter coefficient values
|
//Calculate filter coefficient values
|
||||||
d_dllnoisebandwidth =dll_bw_hz;
|
d_dllnoisebandwidth = dll_bw_hz;
|
||||||
calculate_lopp_coef(&d_tau1_code, &d_tau2_code, d_dllnoisebandwidth, d_dlldampingratio, 1.0);// Calculate filter coefficient values
|
calculate_lopp_coef(&d_tau1_code, &d_tau2_code, d_dllnoisebandwidth, d_dlldampingratio, 1.0);// Calculate filter coefficient values
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void tracking_2nd_DLL_filter::initialize(float d_acq_code_phase_samples)
|
void Tracking_2nd_DLL_filter::initialize(float d_acq_code_phase_samples)
|
||||||
{
|
{
|
||||||
// code tracking loop parameters
|
// code tracking loop parameters
|
||||||
d_old_code_nco = 0.0;
|
d_old_code_nco = 0.0;
|
||||||
|
@ -68,7 +68,7 @@ void tracking_2nd_DLL_filter::initialize(float d_acq_code_phase_samples)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
float tracking_2nd_DLL_filter::get_code_nco(float DLL_discriminator)
|
float Tracking_2nd_DLL_filter::get_code_nco(float DLL_discriminator)
|
||||||
{
|
{
|
||||||
float code_nco;
|
float code_nco;
|
||||||
code_nco = d_old_code_nco + (d_tau2_code/d_tau1_code)*(DLL_discriminator - d_old_code_error) + DLL_discriminator * (d_pdi_code/d_tau1_code);
|
code_nco = d_old_code_nco + (d_tau2_code/d_tau1_code)*(DLL_discriminator - d_old_code_error) + DLL_discriminator * (d_pdi_code/d_tau1_code);
|
||||||
|
@ -79,12 +79,13 @@ float tracking_2nd_DLL_filter::get_code_nco(float DLL_discriminator)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tracking_2nd_DLL_filter::tracking_2nd_DLL_filter ()
|
Tracking_2nd_DLL_filter::Tracking_2nd_DLL_filter ()
|
||||||
{
|
{
|
||||||
d_pdi_code = 0.001;// Summation interval for code
|
d_pdi_code = 0.001;// Summation interval for code
|
||||||
d_dlldampingratio = 0.7;
|
d_dlldampingratio = 0.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
tracking_2nd_DLL_filter::~tracking_2nd_DLL_filter ()
|
|
||||||
|
Tracking_2nd_DLL_filter::~Tracking_2nd_DLL_filter ()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
* K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S. H. Jensen, A Software-Defined GPS and Galileo Receiver. A Single-Frequency Approach,
|
* K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S. H. Jensen, A Software-Defined GPS and Galileo Receiver. A Single-Frequency Approach,
|
||||||
* Birkhauser, 2007, Applied and Numerical Harmonic Analysis.
|
* Birkhauser, 2007, Applied and Numerical Harmonic Analysis.
|
||||||
*/
|
*/
|
||||||
class tracking_2nd_DLL_filter
|
class Tracking_2nd_DLL_filter
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
// PLL filter parameters
|
// PLL filter parameters
|
||||||
|
@ -58,12 +58,13 @@ private:
|
||||||
float d_old_code_nco;
|
float d_old_code_nco;
|
||||||
|
|
||||||
void calculate_lopp_coef(float* tau1,float* tau2, float lbw, float zeta, float k);
|
void calculate_lopp_coef(float* tau1,float* tau2, float lbw, float zeta, float k);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void set_DLL_BW(float dll_bw_hz); //! Set DLL loop bandwidth [Hz]
|
void set_DLL_BW(float dll_bw_hz); //! Set DLL loop bandwidth [Hz]
|
||||||
void initialize(float d_acq_code_phase_samples);
|
void initialize(float d_acq_code_phase_samples);
|
||||||
float get_code_nco(float DLL_discriminator);
|
float get_code_nco(float DLL_discriminator);
|
||||||
tracking_2nd_DLL_filter();
|
Tracking_2nd_DLL_filter();
|
||||||
~tracking_2nd_DLL_filter();
|
~Tracking_2nd_DLL_filter();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -37,45 +37,57 @@
|
||||||
#include "tracking_2nd_PLL_filter.h"
|
#include "tracking_2nd_PLL_filter.h"
|
||||||
|
|
||||||
|
|
||||||
void tracking_2nd_PLL_filter::calculate_lopp_coef(float* tau1,float* tau2, float lbw, float zeta, float k){
|
void Tracking_2nd_PLL_filter::calculate_lopp_coef(float* tau1,float* tau2, float lbw, float zeta, float k)
|
||||||
// Solve natural frequency
|
{
|
||||||
float Wn;
|
// Solve natural frequency
|
||||||
Wn = lbw*8*zeta / (4*zeta*zeta + 1);
|
float Wn;
|
||||||
// solve for t1 & t2
|
Wn = lbw*8*zeta / (4*zeta*zeta + 1);
|
||||||
*tau1 = k / (Wn * Wn);
|
// solve for t1 & t2
|
||||||
*tau2 = (2.0 * zeta) / Wn;
|
*tau1 = k / (Wn * Wn);
|
||||||
|
*tau2 = (2.0 * zeta) / Wn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tracking_2nd_PLL_filter::set_PLL_BW(float pll_bw_hz)
|
|
||||||
|
|
||||||
|
void Tracking_2nd_PLL_filter::set_PLL_BW(float pll_bw_hz)
|
||||||
{
|
{
|
||||||
//Calculate filter coefficient values
|
//Calculate filter coefficient values
|
||||||
d_pllnoisebandwidth=pll_bw_hz;
|
d_pllnoisebandwidth = pll_bw_hz;
|
||||||
calculate_lopp_coef(&d_tau1_carr, &d_tau2_carr, d_pllnoisebandwidth, d_plldampingratio,0.25);// Calculate filter coefficient values
|
calculate_lopp_coef(&d_tau1_carr, &d_tau2_carr, d_pllnoisebandwidth, d_plldampingratio, 0.25);// Calculate filter coefficient values
|
||||||
}
|
}
|
||||||
void tracking_2nd_PLL_filter::initialize(float d_acq_carrier_doppler_hz)
|
|
||||||
|
|
||||||
|
|
||||||
|
void Tracking_2nd_PLL_filter::initialize(float d_acq_carrier_doppler_hz)
|
||||||
{
|
{
|
||||||
// carrier/Costas loop parameters
|
// carrier/Costas loop parameters
|
||||||
d_old_carr_nco = 0.0;
|
d_old_carr_nco = 0.0;
|
||||||
d_old_carr_error = 0.0;
|
d_old_carr_error = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
float tracking_2nd_PLL_filter::get_carrier_nco(float PLL_discriminator)
|
|
||||||
|
|
||||||
|
|
||||||
|
float Tracking_2nd_PLL_filter::get_carrier_nco(float PLL_discriminator)
|
||||||
{
|
{
|
||||||
float carr_nco;
|
float carr_nco;
|
||||||
carr_nco = d_old_carr_nco+(d_tau2_carr/d_tau1_carr)*(PLL_discriminator - d_old_carr_error) + PLL_discriminator * (d_pdi_carr/d_tau1_carr);
|
carr_nco = d_old_carr_nco+(d_tau2_carr/d_tau1_carr)*(PLL_discriminator - d_old_carr_error) + PLL_discriminator * (d_pdi_carr/d_tau1_carr);
|
||||||
d_old_carr_nco = carr_nco;
|
d_old_carr_nco = carr_nco;
|
||||||
d_old_carr_error = PLL_discriminator;
|
d_old_carr_error = PLL_discriminator;
|
||||||
return carr_nco;
|
return carr_nco;
|
||||||
}
|
}
|
||||||
|
|
||||||
tracking_2nd_PLL_filter::tracking_2nd_PLL_filter ()
|
|
||||||
|
|
||||||
|
Tracking_2nd_PLL_filter::Tracking_2nd_PLL_filter ()
|
||||||
{
|
{
|
||||||
//--- PLL variables --------------------------------------------------------
|
//--- PLL variables --------------------------------------------------------
|
||||||
d_pdi_carr = 0.001;// Summation interval for carrier
|
d_pdi_carr = 0.001;// Summation interval for carrier
|
||||||
d_plldampingratio=0.65;
|
d_plldampingratio=0.65;
|
||||||
}
|
}
|
||||||
|
|
||||||
tracking_2nd_PLL_filter::~tracking_2nd_PLL_filter ()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Tracking_2nd_PLL_filter::~Tracking_2nd_PLL_filter ()
|
||||||
|
{}
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
* K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S. H. Jensen, A Software-Defined GPS and Galileo Receiver. A Single-Frequency Approach,
|
* K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S. H. Jensen, A Software-Defined GPS and Galileo Receiver. A Single-Frequency Approach,
|
||||||
* Birkhauser, 2007, Applied and Numerical Harmonic Analysis.
|
* Birkhauser, 2007, Applied and Numerical Harmonic Analysis.
|
||||||
*/
|
*/
|
||||||
class tracking_2nd_PLL_filter
|
class Tracking_2nd_PLL_filter
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
// PLL filter parameters
|
// PLL filter parameters
|
||||||
|
@ -63,8 +63,8 @@ public:
|
||||||
void set_PLL_BW(float pll_bw_hz); //! Set PLL loop bandwidth [Hz]
|
void set_PLL_BW(float pll_bw_hz); //! Set PLL loop bandwidth [Hz]
|
||||||
void initialize(float d_acq_carrier_doppler_hz);
|
void initialize(float d_acq_carrier_doppler_hz);
|
||||||
float get_carrier_nco(float PLL_discriminator);
|
float get_carrier_nco(float PLL_discriminator);
|
||||||
tracking_2nd_PLL_filter();
|
Tracking_2nd_PLL_filter();
|
||||||
~tracking_2nd_PLL_filter();
|
~Tracking_2nd_PLL_filter();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include "tracking_FLL_PLL_filter.h"
|
#include "tracking_FLL_PLL_filter.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
void tracking_FLL_PLL_filter::set_params(float fll_bw_hz,float pll_bw_hz, int order)
|
void Tracking_FLL_PLL_filter::set_params(float fll_bw_hz,float pll_bw_hz, int order)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Filter design (Kaplan 2nd ed., Pag. 181 Fig. 181)
|
* Filter design (Kaplan 2nd ed., Pag. 181 Fig. 181)
|
||||||
|
@ -54,31 +54,42 @@ void tracking_FLL_PLL_filter::set_params(float fll_bw_hz,float pll_bw_hz, int or
|
||||||
|
|
||||||
d_pll_w0f = fll_bw_hz/0.53;
|
d_pll_w0f = fll_bw_hz/0.53;
|
||||||
d_pll_w0f2 = d_pll_w0f*d_pll_w0f;
|
d_pll_w0f2 = d_pll_w0f*d_pll_w0f;
|
||||||
}else
|
}
|
||||||
{
|
else
|
||||||
/*
|
|
||||||
* 2nd order PLL with 1st order FLL assist
|
|
||||||
*/
|
|
||||||
d_pll_a2 = 1.414;
|
|
||||||
d_pll_w0p = pll_bw_hz/0.53;
|
|
||||||
d_pll_w0p2 = d_pll_w0p*d_pll_w0p;
|
|
||||||
d_pll_w0f = fll_bw_hz/0.25;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
void tracking_FLL_PLL_filter::initialize(float d_acq_carrier_doppler_hz)
|
|
||||||
{
|
|
||||||
if (d_order==3)
|
|
||||||
{
|
{
|
||||||
d_pll_x = 2.0*d_acq_carrier_doppler_hz;
|
/*
|
||||||
d_pll_w = 0;
|
* 2nd order PLL with 1st order FLL assist
|
||||||
}else{
|
*/
|
||||||
d_pll_w = d_acq_carrier_doppler_hz;
|
d_pll_a2 = 1.414;
|
||||||
d_pll_x = 0;
|
d_pll_w0p = pll_bw_hz/0.53;
|
||||||
|
d_pll_w0p2 = d_pll_w0p*d_pll_w0p;
|
||||||
|
d_pll_w0f = fll_bw_hz/0.25;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float tracking_FLL_PLL_filter::get_carrier_error(float FLL_discriminator, float PLL_discriminator, float correlation_time_s)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Tracking_FLL_PLL_filter::initialize(float d_acq_carrier_doppler_hz)
|
||||||
|
{
|
||||||
|
if (d_order==3)
|
||||||
|
{
|
||||||
|
d_pll_x = 2.0 * d_acq_carrier_doppler_hz;
|
||||||
|
d_pll_w = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d_pll_w = d_acq_carrier_doppler_hz;
|
||||||
|
d_pll_x = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
float Tracking_FLL_PLL_filter::get_carrier_error(float FLL_discriminator, float PLL_discriminator, float correlation_time_s)
|
||||||
{
|
{
|
||||||
float carrier_error_hz;
|
float carrier_error_hz;
|
||||||
if (d_order==3)
|
if (d_order==3)
|
||||||
|
@ -89,32 +100,32 @@ float tracking_FLL_PLL_filter::get_carrier_error(float FLL_discriminator, float
|
||||||
d_pll_w = d_pll_w + correlation_time_s * (d_pll_w0p3 * PLL_discriminator + d_pll_w0f2 * FLL_discriminator);
|
d_pll_w = d_pll_w + correlation_time_s * (d_pll_w0p3 * PLL_discriminator + d_pll_w0f2 * FLL_discriminator);
|
||||||
d_pll_x = d_pll_x + correlation_time_s * (0.5*d_pll_w + d_pll_a2 * d_pll_w0f * FLL_discriminator + d_pll_a3 * d_pll_w0p2 * PLL_discriminator);
|
d_pll_x = d_pll_x + correlation_time_s * (0.5*d_pll_w + d_pll_a2 * d_pll_w0f * FLL_discriminator + d_pll_a3 * d_pll_w0p2 * PLL_discriminator);
|
||||||
carrier_error_hz = 0.5*d_pll_x + d_pll_b3 * d_pll_w0p * PLL_discriminator;
|
carrier_error_hz = 0.5*d_pll_x + d_pll_b3 * d_pll_w0p * PLL_discriminator;
|
||||||
}else
|
}
|
||||||
{
|
else
|
||||||
/*
|
{
|
||||||
* 2nd order PLL with 1st order FLL assist
|
/*
|
||||||
*/
|
* 2nd order PLL with 1st order FLL assist
|
||||||
float pll_w_new;
|
*/
|
||||||
pll_w_new = d_pll_w + PLL_discriminator*d_pll_w0p2*correlation_time_s + FLL_discriminator*d_pll_w0f*correlation_time_s ;
|
float pll_w_new;
|
||||||
carrier_error_hz = 0.5*(pll_w_new + d_pll_w)+d_pll_a2 * d_pll_w0p*PLL_discriminator;
|
pll_w_new = d_pll_w + PLL_discriminator * d_pll_w0p2 * correlation_time_s + FLL_discriminator * d_pll_w0f * correlation_time_s ;
|
||||||
d_pll_w =pll_w_new;
|
carrier_error_hz = 0.5 * (pll_w_new + d_pll_w) + d_pll_a2 * d_pll_w0p * PLL_discriminator;
|
||||||
/*std::cout<<" d_pll_w = "<<carrier_error_hz<<
|
d_pll_w =pll_w_new;
|
||||||
|
/*std::cout<<" d_pll_w = "<<carrier_error_hz<<
|
||||||
", pll_w_new = "<<pll_w_new
|
", pll_w_new = "<<pll_w_new
|
||||||
<<", PLL_discriminator=" <<PLL_discriminator
|
<<", PLL_discriminator=" <<PLL_discriminator
|
||||||
<<" FLL_discriminator ="<<FLL_discriminator
|
<<" FLL_discriminator ="<<FLL_discriminator
|
||||||
<<" correlation_time_s = "<<correlation_time_s<<"\r\n";*/
|
<<" correlation_time_s = "<<correlation_time_s<<"\r\n";*/
|
||||||
}
|
}
|
||||||
|
|
||||||
return carrier_error_hz;
|
return carrier_error_hz;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tracking_FLL_PLL_filter::tracking_FLL_PLL_filter ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
tracking_FLL_PLL_filter::~tracking_FLL_PLL_filter ()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
Tracking_FLL_PLL_filter::Tracking_FLL_PLL_filter ()
|
||||||
|
{}
|
||||||
|
|
||||||
|
Tracking_FLL_PLL_filter::~Tracking_FLL_PLL_filter ()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
/*!
|
/*!
|
||||||
* \brief This class implements a hybrid FLL and PLL filter for tracking carrier loop
|
* \brief This class implements a hybrid FLL and PLL filter for tracking carrier loop
|
||||||
*/
|
*/
|
||||||
class tracking_FLL_PLL_filter
|
class Tracking_FLL_PLL_filter
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
// FLL + PLL filter parameters
|
// FLL + PLL filter parameters
|
||||||
|
@ -53,8 +53,8 @@ public:
|
||||||
void set_params(float fll_bw_hz,float pll_bw_hz, int order);
|
void set_params(float fll_bw_hz,float pll_bw_hz, int order);
|
||||||
void initialize(float d_acq_carrier_doppler_hz);
|
void initialize(float d_acq_carrier_doppler_hz);
|
||||||
float get_carrier_error(float FLL_discriminator, float PLL_discriminator, float correlation_time_s);
|
float get_carrier_error(float FLL_discriminator, float PLL_discriminator, float correlation_time_s);
|
||||||
tracking_FLL_PLL_filter();
|
Tracking_FLL_PLL_filter();
|
||||||
~tracking_FLL_PLL_filter();
|
~Tracking_FLL_PLL_filter();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue