From a5b0d58746f6d412a43af8d019a7cab0d6cb2ea9 Mon Sep 17 00:00:00 2001 From: Gastd Date: Wed, 29 Mar 2017 12:15:57 -0300 Subject: [PATCH 01/11] Add glonass svn in signals list --- src/core/receiver/gnss_flowgraph.cc | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 138140d34..23827ba70 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -573,6 +573,12 @@ void GNSSFlowgraph::set_signals_list() 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36}; + /* + * Only 24 operational + */ + std::set available_glonass_prn = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27}; + std::string sv_list = configuration_->property("Galileo.prns", std::string("") ); if( sv_list.length() > 0 ) @@ -621,6 +627,22 @@ void GNSSFlowgraph::set_signals_list() } } + sv_list = configuration_->property("Glonass.prns", std::string("") ); + + if( sv_list.length() > 0 ) + { + // Reset the available prns: + std::set< unsigned int > tmp_set; + boost::tokenizer<> tok( sv_list ); + std::transform( tok.begin(), tok.end(), std::inserter( tmp_set, tmp_set.begin() ), + boost::lexical_cast ); + + if( tmp_set.size() > 0 ) + { + available_glonass_prn = tmp_set; + } + } + if (configuration_->property("Channels_1C.count", 0) > 0 ) { /* @@ -691,6 +713,20 @@ void GNSSFlowgraph::set_signals_list() *available_gnss_prn_iter), std::string("5X"))); } } + + if (configuration_->property("Channels_1G.count", 0) > 0 ) + { + /* + * Loop to create the list of GLONASS L1 C/A signals + */ + for (available_gnss_prn_iter = available_glonass_prn.begin(); + available_gnss_prn_iter != available_glonass_prn.end(); + available_gnss_prn_iter++) + { + available_GNSS_signals_.push_back(Gnss_Signal(Gnss_Satellite(std::string("Glonass"), + *available_gnss_prn_iter), std::string("5X"))); + } + } /* * Ordering the list of signals from configuration file */ @@ -704,6 +740,7 @@ void GNSSFlowgraph::set_signals_list() std::string gnss_system; if((gnss_signal.compare("1C") == 0) or (gnss_signal.compare("2S") == 0) ) gnss_system = "GPS"; if((gnss_signal.compare("1B") == 0) or (gnss_signal.compare("5X") == 0) ) gnss_system = "Galileo"; + if((gnss_signal.compare("1G") == 0)/* or (gnss_signal.compare("") == 0)*/) gnss_system = "Glonass"; unsigned int sat = configuration_->property("Channel" + boost::lexical_cast(i) + ".satellite", 0); LOG(INFO) << "Channel " << i << " system " << gnss_system << ", signal " << gnss_signal <<", sat "< Date: Wed, 29 Mar 2017 15:09:19 -0300 Subject: [PATCH 02/11] fix glonass signal string --- src/core/receiver/gnss_flowgraph.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 23827ba70..8ef37b7c3 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -724,7 +724,7 @@ void GNSSFlowgraph::set_signals_list() available_gnss_prn_iter++) { available_GNSS_signals_.push_back(Gnss_Signal(Gnss_Satellite(std::string("Glonass"), - *available_gnss_prn_iter), std::string("5X"))); + *available_gnss_prn_iter), std::string("1G"))); } } /* From 1acd107d51b9e6bea98faac2adcc9cf46c3178e7 Mon Sep 17 00:00:00 2001 From: Gastd Date: Thu, 30 Mar 2017 09:44:47 -0300 Subject: [PATCH 03/11] Add code for C/A signal generation for glonass --- src/algorithms/libs/CMakeLists.txt | 1 + .../libs/glonass_l1_signal_processing.cc | 131 ++++++++++++++++++ .../libs/glonass_l1_signal_processing.h | 47 +++++++ 3 files changed, 179 insertions(+) create mode 100644 src/algorithms/libs/glonass_l1_signal_processing.cc create mode 100644 src/algorithms/libs/glonass_l1_signal_processing.h diff --git a/src/algorithms/libs/CMakeLists.txt b/src/algorithms/libs/CMakeLists.txt index f0a62912f..7a42ad90e 100644 --- a/src/algorithms/libs/CMakeLists.txt +++ b/src/algorithms/libs/CMakeLists.txt @@ -23,6 +23,7 @@ set(GNSS_SPLIBS_SOURCES gnss_sdr_valve.cc gnss_signal_processing.cc gps_sdr_signal_processing.cc + glonass_l1_signal_processing.cc pass_through.cc galileo_e5_signal_processing.cc complex_byte_to_float_x2.cc diff --git a/src/algorithms/libs/glonass_l1_signal_processing.cc b/src/algorithms/libs/glonass_l1_signal_processing.cc new file mode 100644 index 000000000..ff3ab5a2d --- /dev/null +++ b/src/algorithms/libs/glonass_l1_signal_processing.cc @@ -0,0 +1,131 @@ +/*! + * \file glonass_l1_signal_processing.cc + * \brief This class implements various functions for GLONASS L1 CA signals + * \author Javier Arribas, 2011. jarribas(at)cttc.es + * + * Detailed description of the file here if needed. + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors) + * + * GNSS-SDR is a software defined Global Navigation + * Satellite Systems receiver + * + * This file is part of GNSS-SDR. + * + * GNSS-SDR is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GNSS-SDR is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNSS-SDR. If not, see . + * + * ------------------------------------------------------------------------- + */ + +#include "glonass_l1_signal_processing.h" + +auto auxCeil = [](float x){ return static_cast(static_cast((x)+1)); }; + +void glonass_l1_ca_code_gen_complex(std::complex* _dest/*, signed int _prn, unsigned int _chip_shift*/) +{ + const unsigned int _code_length = 511; + bool G1[_code_length]; + bool G1_register[9]; + bool feedback1; + bool aux; + unsigned int lcv, lcv2; + + for(lcv = 0; lcv < 9; lcv++) + { + G1_register[lcv] = 1; + } + + /* Generate G1 Register */ + for(lcv = 0; lcv < _code_length; lcv++) + { + G1[lcv] = G1_register[2]; + + feedback1 = G1_register[4]^G1_register[0]; + + for(lcv2 = 0; lcv2 < 8; lcv2++) + { + G1_register[lcv2] = G1_register[lcv2 + 1]; + } + + G1_register[8] = feedback1; + } + + /* Generate PRN from G1 Register */ + for(lcv = 0; lcv < _code_length; lcv++) + { + aux = G1[lcv]; + if(aux == true) + { + _dest[lcv] = std::complex(1, 0); + } + else + { + _dest[lcv] = std::complex(-1, 0); + } + } +} + + +/* + * Generates complex GLONASS L1 C/A code for the desired SV ID and sampled to specific sampling frequency + */ +void glonass_l1_ca_code_gen_complex_sampled(std::complex* _dest, unsigned int _prn, signed int _fs, unsigned int _chip_shift) +{ + // This function is based on the GNU software GPS for MATLAB in the Kay Borre book + std::complex _code[511]; + signed int _samplesPerCode, _codeValueIndex; + float _ts; + float _tc; + float aux; + const signed int _codeFreqBasis = 511000; //Hz + const signed int _codeLength = 511; + + //--- Find number of samples per spreading code ---------------------------- + _samplesPerCode = static_cast(static_cast(_fs) / static_cast(_codeFreqBasis / _codeLength)); + + //--- Find time constants -------------------------------------------------- + _ts = 1.0 / static_cast(_fs); // Sampling period in sec + _tc = 1.0 / static_cast(_codeFreqBasis); // C/A chip period in sec + glonass_l1_ca_code_gen_complex(_code); //generate C/A code 1 sample per chip + + for (signed int i = 0; i < _samplesPerCode; i++) + { + //=== Digitizing ======================================================= + + //--- Make index array to read C/A code values ------------------------- + // The length of the index array depends on the sampling frequency - + // number of samples per millisecond (because one C/A code period is one + // millisecond). + + // _codeValueIndex = ceil((_ts * ((float)i + 1)) / _tc) - 1; + aux = (_ts * (i + 1)) / _tc; + _codeValueIndex = auxCeil( aux ) - 1; + + //--- Make the digitized version of the C/A code ----------------------- + // The "upsampled" code is made by selecting values form the CA code + // chip array (caCode) for the time instances of each sample. + if (i == _samplesPerCode - 1) + { + //--- Correct the last index (due to number rounding issues) ----------- + _dest[i] = _code[_codeLength - 1]; + + } + else + { + _dest[i] = _code[_codeValueIndex]; //repeat the chip -> upsample + } + } +} diff --git a/src/algorithms/libs/glonass_l1_signal_processing.h b/src/algorithms/libs/glonass_l1_signal_processing.h new file mode 100644 index 000000000..b181d68ae --- /dev/null +++ b/src/algorithms/libs/glonass_l1_signal_processing.h @@ -0,0 +1,47 @@ +/*! + * \file glonass_l1_signal_processing.h + * \brief This class implements various functions for GLONASS L1 CA signals + * \author Gabriel Araujo, 2017. gabriel.araujo(at)ieee.org + * + * Detailed description of the file here if needed. + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors) + * + * GNSS-SDR is a software defined Global Navigation + * Satellite Systems receiver + * + * This file is part of GNSS-SDR. + * + * GNSS-SDR is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GNSS-SDR is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNSS-SDR. If not, see . + * + * ------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_GPS_SDR_SIGNAL_PROCESSING_H_ +#define GNSS_SDR_GPS_SDR_SIGNAL_PROCESSING_H_ + +#include + +//!Generates complex GLONASS L1 C/A code for the desired SV ID and code shift, and sampled to specific sampling frequency +void glonass_l1_ca_code_gen_complex(std::complex* _dest/*, signed int _prn, unsigned int _chip_shift*/); + +//! Generates N complex GLONASS L1 C/A codes for the desired SV ID and code shift +void glonass_l1_ca_code_gen_complex_sampled(std::complex* _dest, unsigned int _prn, signed int _fs, unsigned int _chip_shift, unsigned int _ncodes); + +//! Generates complex GLONASS L1 C/A code for the desired SV ID and code shift +void glonass_l1_ca_code_gen_complex_sampled(std::complex* _dest, unsigned int _prn, signed int _fs, unsigned int _chip_shift); + +#endif /* GNSS_SDR_GPS_SDR_SIGNAL_PROCESSING_H_ */ From 3f0b10f3ef7bd02cae06924e78191037f413ecd0 Mon Sep 17 00:00:00 2001 From: Gastd Date: Thu, 1 Jun 2017 20:41:57 -0300 Subject: [PATCH 04/11] Add Glonass_L1_CA.h with Glonass L1 CA parameters --- .../gnuradio_blocks/pcps_acquisition_cc.cc | 1 + .../gnuradio_blocks/pcps_acquisition_cc.h | 1 + src/core/system_parameters/Glonass_L1_CA.h | 63 +++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 src/core/system_parameters/Glonass_L1_CA.h diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc index c7910ff97..01fd3fe57 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc @@ -41,6 +41,7 @@ #include #include "control_message_factory.h" #include "GPS_L1_CA.h" //GPS_TWO_PI +#include "Glonass_L1_CA.h" //GLONASS_TWO_PI using google::LogMessage; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.h index a0ab23131..bea0170ea 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.h @@ -56,6 +56,7 @@ #include #include #include "gnss_synchro.h" +#include "Glonass_L1_CA.h" //GLONASS_TWO_PI class pcps_acquisition_cc; diff --git a/src/core/system_parameters/Glonass_L1_CA.h b/src/core/system_parameters/Glonass_L1_CA.h new file mode 100644 index 000000000..f6391c56b --- /dev/null +++ b/src/core/system_parameters/Glonass_L1_CA.h @@ -0,0 +1,63 @@ +#ifndef GNSS_SDR_GLONASS_L1_CA_H_ +#define GNSS_SDR_GLONASS_L1_CA_H_ + +#include +#include // std::pair +#include "MATH_CONSTANTS.h" + +// Physical constants +const double GLONASS_C_m_s = 299792458.0; //!< The speed of light, [m/s] +const double GLONASS_C_m_ms = 299792.4580; //!< The speed of light, [m/ms] +const double GLONASS_PI = 3.1415926535898; //!< Pi as (NOT) defined in ICD-GLONASS-2008 +const double GLONASS_TWO_PI = 6.283185307179586;//!< 2Pi as (NOT) defined in ICD-GLONASS-2008 +const double GLONASS_OMEGA_EARTH_DOT = 7.292115e-5; //!< Earth rotation rate, [rad/s] +const double GLONASS_GM = 3.986004418e14; //!< Universal gravitational constant times the mass of the Earth, [m^3/s^2] +// const double F = -4.442807633e-10; //!< Constant, [s/(m)^(1/2)] + +// Geodesic constants and parameters +const double fMa = 0.35e9; //!< The Gravitational constant of atmosphere, [m^3/s^2] +const double SEMI_MAJOR_AXIS = 6378136; //!< The Semi-major axis, [m] +const double FLATTENING = 1/298.25784; //!< The Orbital Flattening +const double EQUATORIAL_GRAVITY = 978032.84; //!< The Equatorial acceleration of gravity, [mGal] +const double GRAVITY_CORRECTION = 0.87; //!< The Correction to acceleration of gravity at sea-level due to Atmosphere, [mGal] +const double SECOND_HARMONIC = 1082625.75e-9; //!< Second zonal harmonic of the geopotential (J_2^0) +const double FOURTH_HARMONIC = -2370.89e-9; //!< Fourth zonal harmonic of the geopotential (J_4^0) +const double SIXTH_HARMONIC = 6.08e-9; //!< Sixth zonal harmonic of the geopotential (J_6^0) +const double EIGHTH_HARMONIC = 1.40e-11; //!< Eighth zonal harmonic of the geopotential (J_8^0) +const double NORMAL_POTENCIAL = 62636861.4; //!< The Normal potential at surface of common terrestrial ellipsoid (U_0), [m^2/s^2] + + +// carrier and code frequencies +const double GLONASS_L1_FREQ_HZ = 1.602e9; //!< L1 [Hz] +const double GLONASS_L1_CA_CODE_RATE_HZ = 0.511e6; //!< GLONASS L1 C/A code rate [chips/s] +const double GLONASS_L1_CA_CODE_LENGTH_CHIPS = 511.0; //!< GLONASS L1 C/A code length [chips] +const double GLONASS_L1_CA_CODE_PERIOD = 0.001; //!< GLONASS L1 C/A code period [seconds] +const double GLONASS_L1_CA_CHIP_PERIOD = 1.9569e-06; //!< GLONASS L1 C/A chip period [seconds] + +// GLONASS SV's orbital slots +const short int GLONASS_PRN[24] = { 1, //Plane 1 + -4, //Plane 1 + 5, //Plane 1 + 6, //Plane 1 + 1, //Plane 1 + -4, //Plane 1 + 5, //Plane 1 + 6, //Plane 1 + -2, //Plane 2 + -7, //Plane 2 + 0, //Plane 2 + -1, //Plane 2 + -2, //Plane 2 + -7, //Plane 2 + 0, //Plane 2 + -1, //Plane 2 + 4, //Plane 3 + -3, //Plane 3 + 3, //Plane 3 + 2, //Plane 3 + 4, //Plane 3 + -3, //Plane 3 + 3, //Plane 3 + 2}; //Plane 3 + +#endif /* GNSS_SDR_GLONASS_L1_CA_H_ */ From e291d95658d21cd8fbc2fc1ef032524f3e9c638c Mon Sep 17 00:00:00 2001 From: Gastd Date: Thu, 1 Jun 2017 20:45:16 -0300 Subject: [PATCH 05/11] Add pcps acquisition adapter for glonass l1 ca signal --- .../acquisition/adapters/CMakeLists.txt | 1 + .../glonass_l1_ca_pcps_acquisition.cc | 366 ++++++++++++++++++ .../adapters/glonass_l1_ca_pcps_acquisition.h | 138 +++++++ 3 files changed, 505 insertions(+) create mode 100644 src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc create mode 100644 src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.h diff --git a/src/algorithms/acquisition/adapters/CMakeLists.txt b/src/algorithms/acquisition/adapters/CMakeLists.txt index 1ead04df8..b2395dc6d 100644 --- a/src/algorithms/acquisition/adapters/CMakeLists.txt +++ b/src/algorithms/acquisition/adapters/CMakeLists.txt @@ -31,6 +31,7 @@ set(ACQ_ADAPTER_SOURCES galileo_e1_pcps_tong_ambiguous_acquisition.cc galileo_e1_pcps_8ms_ambiguous_acquisition.cc galileo_e5a_noncoherent_iq_acquisition_caf.cc + glonass_l1_ca_pcps_acquisition.cc ) diff --git a/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc new file mode 100644 index 000000000..a8e25b151 --- /dev/null +++ b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc @@ -0,0 +1,366 @@ +#include "glonass_l1_ca_pcps_acquisition.h" +#include +#include +#include "glonass_l1_signal_processing.h" +#include "Glonass_L1_CA.h" +#include "configuration_interface.h" + + +using google::LogMessage; +GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition( + ConfigurationInterface* configuration, std::string role, + unsigned int in_streams, unsigned int out_streams) : + role_(role), in_streams_(in_streams), out_streams_(out_streams) +{ + configuration_ = configuration; + std::string default_item_type = "gr_complex"; + std::string default_dump_filename = "./data/acquisition.dat"; + + DLOG(INFO) << "role " << role; + + item_type_ = configuration_->property(role + ".item_type", default_item_type); + + fs_in_ = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000); + if_ = configuration_->property(role + ".if", 0); + dump_ = configuration_->property(role + ".dump", false); + doppler_max_ = configuration_->property(role + ".doppler_max", 5000); + sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 1); + + bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false); + use_CFAR_algorithm_flag_=configuration_->property(role + ".use_CFAR_algorithm", true); //will be false in future versions + + max_dwells_ = configuration_->property(role + ".max_dwells", 1); + + dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename); + + //--- Find number of samples per spreading code ------------------------- + code_length_ = round(fs_in_ / (GLONASS_L1_CA_CODE_RATE_HZ / GLONASS_L1_CA_CODE_LENGTH_CHIPS)); + + LOG(ERROR) << "fs_in_ " << fs_in_; + LOG(ERROR) << "code_length_ " << code_length_; + + vector_length_ = code_length_ * sampled_ms_; + + LOG(ERROR) << "vector_length_ " << vector_length_; + + + if( bit_transition_flag_ ) + { + vector_length_ *= 2; + } + + code_ = new gr_complex[vector_length_]; + + if (item_type_.compare("cshort") == 0 ) + { + item_size_ = sizeof(lv_16sc_t); + acquisition_sc_ = pcps_make_acquisition_sc(sampled_ms_, max_dwells_, + doppler_max_, if_, fs_in_, code_length_, code_length_, + bit_transition_flag_, use_CFAR_algorithm_flag_, dump_, dump_filename_); + DLOG(INFO) << "acquisition(" << acquisition_sc_->unique_id() << ")"; + + }else{ + item_size_ = sizeof(gr_complex); + acquisition_cc_ = pcps_make_acquisition_cc(sampled_ms_, max_dwells_, + doppler_max_, if_, fs_in_, code_length_, code_length_, + bit_transition_flag_, use_CFAR_algorithm_flag_, dump_, dump_filename_); + DLOG(INFO) << "acquisition(" << acquisition_cc_->unique_id() << ")"; + } + + stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_); + DLOG(INFO) << "stream_to_vector(" << stream_to_vector_->unique_id() << ")"; + + if (item_type_.compare("cbyte") == 0) + { + cbyte_to_float_x2_ = make_complex_byte_to_float_x2(); + float_to_complex_ = gr::blocks::float_to_complex::make(); + } + + channel_ = 0; + threshold_ = 0.0; + doppler_step_ = 0; + gnss_synchro_ = 0; +} + + +GlonassL1CaPcpsAcquisition::~GlonassL1CaPcpsAcquisition() +{ + delete[] code_; +} + + +void GlonassL1CaPcpsAcquisition::set_channel(unsigned int channel) +{ + channel_ = channel; + if (item_type_.compare("cshort") == 0) + { + acquisition_sc_->set_channel(channel_); + } + else + { + acquisition_cc_->set_channel(channel_); + } +} + + +void GlonassL1CaPcpsAcquisition::set_threshold(float threshold) +{ + float pfa = configuration_->property(role_ + ".pfa", 0.0); + + if(pfa == 0.0) + { + threshold_ = threshold; + } + else + { + threshold_ = calculate_threshold(pfa); + } + + DLOG(INFO) << "Channel " << channel_ << " Threshold = " << threshold_; + + + if (item_type_.compare("cshort") == 0) + { + acquisition_sc_->set_threshold(threshold_); + } + else + { + acquisition_cc_->set_threshold(threshold_); + } +} + + +void GlonassL1CaPcpsAcquisition::set_doppler_max(unsigned int doppler_max) +{ + doppler_max_ = doppler_max; + + if (item_type_.compare("cshort") == 0) + { + acquisition_sc_->set_doppler_max(doppler_max_); + } + else + { + acquisition_cc_->set_doppler_max(doppler_max_); + } +} + + +void GlonassL1CaPcpsAcquisition::set_doppler_step(unsigned int doppler_step) +{ + doppler_step_ = doppler_step; + + if (item_type_.compare("cshort") == 0) + { + acquisition_sc_->set_doppler_step(doppler_step_); + } + else + { + acquisition_cc_->set_doppler_step(doppler_step_); + } +} + + +void GlonassL1CaPcpsAcquisition::set_gnss_synchro(Gnss_Synchro* gnss_synchro) +{ + gnss_synchro_ = gnss_synchro; + + if (item_type_.compare("cshort") == 0) + { + acquisition_sc_->set_gnss_synchro(gnss_synchro_); + } + else + { + acquisition_cc_->set_gnss_synchro(gnss_synchro_); + } +} + + +signed int GlonassL1CaPcpsAcquisition::mag() +{ + if (item_type_.compare("cshort") == 0) + { + return acquisition_sc_->mag(); + } + else + { + return acquisition_cc_->mag(); + } +} + + +void GlonassL1CaPcpsAcquisition::init() +{ + if (item_type_.compare("cshort") == 0) + { + acquisition_sc_->init(); + } + else + { + acquisition_cc_->init(); + } + + set_local_code(); +} + + +void GlonassL1CaPcpsAcquisition::set_local_code() +{ + + std::complex* code = new std::complex[code_length_]; + + glonass_l1_ca_code_gen_complex_sampled(code,/* gnss_synchro_->PRN,*/ fs_in_, 0); + + for (unsigned int i = 0; i < sampled_ms_; i++) + { + memcpy(&(code_[i*code_length_]), code, + sizeof(gr_complex)*code_length_); + } + + if (item_type_.compare("cshort") == 0) + { + acquisition_sc_->set_local_code(code_); + } + else + { + acquisition_cc_->set_local_code(code_); + } + + delete[] code; +} + + +void GlonassL1CaPcpsAcquisition::reset() +{ + if (item_type_.compare("cshort") == 0) + { + acquisition_sc_->set_active(true); + } + else + { + acquisition_cc_->set_active(true); + } +} + + +void GlonassL1CaPcpsAcquisition::set_state(int state) +{ + if (item_type_.compare("cshort") == 0) + { + acquisition_sc_->set_state(state); + } + else + { + acquisition_cc_->set_state(state); + } +} + + +float GlonassL1CaPcpsAcquisition::calculate_threshold(float pfa) +{ + //Calculate the threshold + unsigned int frequency_bins = 0; + /* + for (int doppler = (int)(-doppler_max_); doppler <= (int)doppler_max_; doppler += doppler_step_) + { + frequency_bins++; + } + */ + + frequency_bins = (2*doppler_max_ + doppler_step_)/doppler_step_; + + DLOG(INFO) << "Channel " << channel_ << " Pfa = " << pfa; + unsigned int ncells = vector_length_ * frequency_bins; + double exponent = 1 / static_cast(ncells); + double val = pow(1.0 - pfa, exponent); + double lambda = double(vector_length_); + boost::math::exponential_distribution mydist (lambda); + float threshold = (float)quantile(mydist,val); + + return threshold; +} + + +void GlonassL1CaPcpsAcquisition::connect(gr::top_block_sptr top_block) +{ + if (item_type_.compare("gr_complex") == 0) + { + top_block->connect(stream_to_vector_, 0, acquisition_cc_, 0); + } + else if (item_type_.compare("cshort") == 0) + { + top_block->connect(stream_to_vector_, 0, acquisition_sc_, 0); + } + else if (item_type_.compare("cbyte") == 0) + { + top_block->connect(cbyte_to_float_x2_, 0, float_to_complex_, 0); + top_block->connect(cbyte_to_float_x2_, 1, float_to_complex_, 1); + top_block->connect(float_to_complex_, 0, stream_to_vector_, 0); + top_block->connect(stream_to_vector_, 0, acquisition_cc_, 0); + } + else + { + LOG(WARNING) << item_type_ << " unknown acquisition item type"; + } +} + + +void GlonassL1CaPcpsAcquisition::disconnect(gr::top_block_sptr top_block) +{ + if (item_type_.compare("gr_complex") == 0) + { + top_block->disconnect(stream_to_vector_, 0, acquisition_cc_, 0); + } + else if (item_type_.compare("cshort") == 0) + { + top_block->disconnect(stream_to_vector_, 0, acquisition_sc_, 0); + } + else if (item_type_.compare("cbyte") == 0) + { + // Since a byte-based acq implementation is not available, + // we just convert cshorts to gr_complex + top_block->disconnect(cbyte_to_float_x2_, 0, float_to_complex_, 0); + top_block->disconnect(cbyte_to_float_x2_, 1, float_to_complex_, 1); + top_block->disconnect(float_to_complex_, 0, stream_to_vector_, 0); + top_block->disconnect(stream_to_vector_, 0, acquisition_cc_, 0); + } + else + { + LOG(WARNING) << item_type_ << " unknown acquisition item type"; + } +} + + +gr::basic_block_sptr GlonassL1CaPcpsAcquisition::get_left_block() +{ + if (item_type_.compare("gr_complex") == 0) + { + return stream_to_vector_; + } + else if (item_type_.compare("cshort") == 0) + { + return stream_to_vector_; + } + else if (item_type_.compare("cbyte") == 0) + { + return cbyte_to_float_x2_; + } + else + { + LOG(WARNING) << item_type_ << " unknown acquisition item type"; + return nullptr; + } +} + + +gr::basic_block_sptr GlonassL1CaPcpsAcquisition::get_right_block() +{ + if (item_type_.compare("cshort") == 0) + { + return acquisition_sc_; + } + else + { + return acquisition_cc_; + } +} + diff --git a/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.h b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.h new file mode 100644 index 000000000..2cc43c90f --- /dev/null +++ b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.h @@ -0,0 +1,138 @@ + +#ifndef GNSS_SDR_GLONASS_L1_CA_PCPS_ACQUISITION_H_ +#define GNSS_SDR_GLONASS_L1_CA_PCPS_ACQUISITION_H_ + +#include +#include +#include +#include "gnss_synchro.h" +#include "acquisition_interface.h" +#include "pcps_acquisition_cc.h" +#include "pcps_acquisition_sc.h" +#include "complex_byte_to_float_x2.h" +#include + + + +class ConfigurationInterface; + +/*! + * \brief This class adapts a PCPS acquisition block to an AcquisitionInterface + * for GPS L1 C/A signals + */ +class GlonassL1CaPcpsAcquisition: public AcquisitionInterface +{ +public: + GlonassL1CaPcpsAcquisition(ConfigurationInterface* configuration, + std::string role, unsigned int in_streams, + unsigned int out_streams); + + virtual ~GlonassL1CaPcpsAcquisition(); + + std::string role() + { + return role_; + } + + /*! + * \brief Returns "GLONASS_L1_CA_PCPS_Acquisition" + */ + std::string implementation() + { + return "GLONASS_L1_CA_PCPS_Acquisition"; + } + size_t item_size() + { + return item_size_; + } + + void connect(gr::top_block_sptr top_block); + void disconnect(gr::top_block_sptr top_block); + gr::basic_block_sptr get_left_block(); + gr::basic_block_sptr get_right_block(); + + /*! + * \brief Set acquisition/tracking common Gnss_Synchro object pointer + * to efficiently exchange synchronization data between acquisition and + * tracking blocks + */ + void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro); + + /*! + * \brief Set acquisition channel unique ID + */ + void set_channel(unsigned int channel); + + /*! + * \brief Set statistics threshold of PCPS algorithm + */ + void set_threshold(float threshold); + + /*! + * \brief Set maximum Doppler off grid search + */ + void set_doppler_max(unsigned int doppler_max); + + /*! + * \brief Set Doppler steps for the grid search + */ + void set_doppler_step(unsigned int doppler_step); + + /*! + * \brief Initializes acquisition algorithm. + */ + void init(); + + /*! + * \brief Sets local code for GPS L1/CA PCPS acquisition algorithm. + */ + void set_local_code(); + + /*! + * \brief Returns the maximum peak of grid search + */ + signed int mag(); + + /*! + * \brief Restart acquisition algorithm + */ + void reset(); + + /*! + * \brief If state = 1, it forces the block to start acquiring from the first sample + */ + void set_state(int state); + +private: + ConfigurationInterface* configuration_; + pcps_acquisition_cc_sptr acquisition_cc_; + pcps_acquisition_sc_sptr acquisition_sc_; + gr::blocks::stream_to_vector::sptr stream_to_vector_; + gr::blocks::float_to_complex::sptr float_to_complex_; + complex_byte_to_float_x2_sptr cbyte_to_float_x2_; + size_t item_size_; + std::string item_type_; + unsigned int vector_length_; + unsigned int code_length_; + bool bit_transition_flag_; + bool use_CFAR_algorithm_flag_; + unsigned int channel_; + float threshold_; + unsigned int doppler_max_; + unsigned int doppler_step_; + unsigned int sampled_ms_; + unsigned int max_dwells_; + long fs_in_; + long if_; + bool dump_; + std::string dump_filename_; + std::complex * code_; + Gnss_Synchro * gnss_synchro_; + std::string role_; + unsigned int in_streams_; + unsigned int out_streams_; + + float calculate_threshold(float pfa); +}; + +#endif /* GNSS_SDR_GLONASS_L1_CA_PCPS_ACQUISITION_H_ */ From 34b813d84df5b48f1873e833c603e528064f88d4 Mon Sep 17 00:00:00 2001 From: Gastd Date: Thu, 1 Jun 2017 20:49:44 -0300 Subject: [PATCH 06/11] Add chip shift to glonass ca code --- src/algorithms/libs/glonass_l1_signal_processing.cc | 8 +++++--- src/algorithms/libs/glonass_l1_signal_processing.h | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/algorithms/libs/glonass_l1_signal_processing.cc b/src/algorithms/libs/glonass_l1_signal_processing.cc index ff3ab5a2d..d19b349ab 100644 --- a/src/algorithms/libs/glonass_l1_signal_processing.cc +++ b/src/algorithms/libs/glonass_l1_signal_processing.cc @@ -34,7 +34,7 @@ auto auxCeil = [](float x){ return static_cast(static_cast((x)+1)); }; -void glonass_l1_ca_code_gen_complex(std::complex* _dest/*, signed int _prn, unsigned int _chip_shift*/) +void glonass_l1_ca_code_gen_complex(std::complex* _dest,/* signed int _prn,*/ unsigned int _chip_shift) { const unsigned int _code_length = 511; bool G1[_code_length]; @@ -76,13 +76,15 @@ void glonass_l1_ca_code_gen_complex(std::complex* _dest/*, signed int _pr _dest[lcv] = std::complex(-1, 0); } } + + /* TODO: Implement the chip shifting*/ } /* * Generates complex GLONASS L1 C/A code for the desired SV ID and sampled to specific sampling frequency */ -void glonass_l1_ca_code_gen_complex_sampled(std::complex* _dest, unsigned int _prn, signed int _fs, unsigned int _chip_shift) +void glonass_l1_ca_code_gen_complex_sampled(std::complex* _dest,/* unsigned int _prn,*/ signed int _fs, unsigned int _chip_shift) { // This function is based on the GNU software GPS for MATLAB in the Kay Borre book std::complex _code[511]; @@ -99,7 +101,7 @@ void glonass_l1_ca_code_gen_complex_sampled(std::complex* _dest, unsigned //--- Find time constants -------------------------------------------------- _ts = 1.0 / static_cast(_fs); // Sampling period in sec _tc = 1.0 / static_cast(_codeFreqBasis); // C/A chip period in sec - glonass_l1_ca_code_gen_complex(_code); //generate C/A code 1 sample per chip + glonass_l1_ca_code_gen_complex(_code, _chip_shift); //generate C/A code 1 sample per chip for (signed int i = 0; i < _samplesPerCode; i++) { diff --git a/src/algorithms/libs/glonass_l1_signal_processing.h b/src/algorithms/libs/glonass_l1_signal_processing.h index b181d68ae..40fcd6ad1 100644 --- a/src/algorithms/libs/glonass_l1_signal_processing.h +++ b/src/algorithms/libs/glonass_l1_signal_processing.h @@ -36,12 +36,12 @@ #include //!Generates complex GLONASS L1 C/A code for the desired SV ID and code shift, and sampled to specific sampling frequency -void glonass_l1_ca_code_gen_complex(std::complex* _dest/*, signed int _prn, unsigned int _chip_shift*/); +void glonass_l1_ca_code_gen_complex(std::complex* _dest, /*signed int _prn,*/ unsigned int _chip_shift); //! Generates N complex GLONASS L1 C/A codes for the desired SV ID and code shift -void glonass_l1_ca_code_gen_complex_sampled(std::complex* _dest, unsigned int _prn, signed int _fs, unsigned int _chip_shift, unsigned int _ncodes); +void glonass_l1_ca_code_gen_complex_sampled(std::complex* _dest,/* unsigned int _prn,*/ signed int _fs, unsigned int _chip_shift, unsigned int _ncodes); //! Generates complex GLONASS L1 C/A code for the desired SV ID and code shift -void glonass_l1_ca_code_gen_complex_sampled(std::complex* _dest, unsigned int _prn, signed int _fs, unsigned int _chip_shift); +void glonass_l1_ca_code_gen_complex_sampled(std::complex* _dest,/* unsigned int _prn,*/ signed int _fs, unsigned int _chip_shift); #endif /* GNSS_SDR_GPS_SDR_SIGNAL_PROCESSING_H_ */ From a1d683a8ca7f721b815fe6912b1fab5b24997a0c Mon Sep 17 00:00:00 2001 From: Gastd Date: Thu, 1 Jun 2017 20:50:12 -0300 Subject: [PATCH 07/11] fix ifndef include --- src/algorithms/libs/glonass_l1_signal_processing.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/algorithms/libs/glonass_l1_signal_processing.h b/src/algorithms/libs/glonass_l1_signal_processing.h index 40fcd6ad1..891febcb9 100644 --- a/src/algorithms/libs/glonass_l1_signal_processing.h +++ b/src/algorithms/libs/glonass_l1_signal_processing.h @@ -30,8 +30,8 @@ * ------------------------------------------------------------------------- */ -#ifndef GNSS_SDR_GPS_SDR_SIGNAL_PROCESSING_H_ -#define GNSS_SDR_GPS_SDR_SIGNAL_PROCESSING_H_ +#ifndef GNSS_SDR_GLONASS_SDR_SIGNAL_PROCESSING_H_ +#define GNSS_SDR_GLONASS_SDR_SIGNAL_PROCESSING_H_ #include @@ -44,4 +44,4 @@ void glonass_l1_ca_code_gen_complex_sampled(std::complex* _dest,/* unsign //! Generates complex GLONASS L1 C/A code for the desired SV ID and code shift void glonass_l1_ca_code_gen_complex_sampled(std::complex* _dest,/* unsigned int _prn,*/ signed int _fs, unsigned int _chip_shift); -#endif /* GNSS_SDR_GPS_SDR_SIGNAL_PROCESSING_H_ */ +#endif /* GNSS_SDR_GLONASS_SDR_SIGNAL_PROCESSING_H_ */ From 2d9fe6a0671df011f80c1c05cbe1ac27d9942941 Mon Sep 17 00:00:00 2001 From: Gastd Date: Thu, 1 Jun 2017 20:53:17 -0300 Subject: [PATCH 08/11] Add Glonass L1 C/A channel to the block factory --- src/core/receiver/gnss_block_factory.cc | 116 +++++++++++++++++++++++- src/core/receiver/gnss_block_factory.h | 4 + 2 files changed, 119 insertions(+), 1 deletion(-) diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 9e4a4d478..b000d3392 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -78,6 +78,7 @@ #include "galileo_e1_pcps_cccwsr_ambiguous_acquisition.h" #include "galileo_e1_pcps_quicksync_ambiguous_acquisition.h" #include "galileo_e5a_noncoherent_iq_acquisition_caf.h" +#include "glonass_l1_ca_pcps_acquisition.h" #include "gps_l1_ca_dll_pll_tracking.h" #include "gps_l1_ca_dll_pll_c_aid_tracking.h" #include "gps_l1_ca_tcp_connector_tracking.h" @@ -514,6 +515,74 @@ std::unique_ptr GNSSBlockFactory::GetChannel_5X( return channel_; } +//********* GLONASS L1 C/A CHANNEL ***************** +std::unique_ptr GNSSBlockFactory::GetChannel_1G( + std::shared_ptr configuration, + std::string acq, std::string trk, std::string tlm, int channel, + boost::shared_ptr queue) +{ + std::stringstream stream; + stream << channel; + std::string id = stream.str(); + LOG(INFO) << "Instantiating Channel " << channel << " with Acquisition Implementation: " + << acq << ", Tracking Implementation: " << trk << ", Telemetry Decoder implementation: " << tlm; + + std::string aux = configuration->property("Acquisition_1G" + boost::lexical_cast(channel) + ".implementation", std::string("W")); + std::string appendix1; + if(aux.compare("W") != 0) + { + appendix1 = boost::lexical_cast(channel); + } + else + { + appendix1 = ""; + } + aux = configuration->property("Tracking_1G" + boost::lexical_cast(channel) + ".implementation", std::string("W")); + std::string appendix2; + if(aux.compare("W") != 0) + { + appendix2 = boost::lexical_cast(channel); + } + else + { + appendix2 = ""; + } + aux = configuration->property("TelemetryDecoder_1G" + boost::lexical_cast(channel) + ".implementation", std::string("W")); + std::string appendix3; + if(aux.compare("W") != 0) + { + appendix3 = boost::lexical_cast(channel); + } + else + { + appendix3 = ""; + } + // Automatically detect input data type + std::shared_ptr config; + config = std::make_shared(); + std::string default_item_type = "gr_complex"; + std::string acq_item_type = configuration->property("Acquisition_1G" + appendix1 + ".item_type", default_item_type); + std::string trk_item_type = configuration->property("Tracking_1G" + appendix2 + ".item_type", default_item_type); + if(acq_item_type.compare(trk_item_type)) + { + LOG(ERROR) << "Acquisition and Tracking blocks must have the same input data type!"; + } + config->set_property("Channel.item_type", acq_item_type); + + std::unique_ptr pass_through_ = GetBlock(config, "Channel", "Pass_Through", 1, 1, queue); + std::unique_ptr acq_ = GetAcqBlock(configuration, "Acquisition_1G" + appendix1, acq, 1, 0); + std::unique_ptr trk_ = GetTrkBlock(configuration, "Tracking_1G"+ appendix2, trk, 1, 1); + std::unique_ptr tlm_ = GetTlmBlock(configuration, "TelemetryDecoder_1G" + appendix3, tlm, 1, 1); + + std::unique_ptr channel_(new Channel(configuration.get(), channel, std::move(pass_through_), + std::move(acq_), + std::move(trk_), + std::move(tlm_), + "Channel", "1G", queue)); + + return channel_; +} + std::unique_ptr>> GNSSBlockFactory::GetChannels( std::shared_ptr configuration, boost::shared_ptr queue) @@ -529,11 +598,13 @@ std::unique_ptr>> GNSSBlockFacto unsigned int Channels_2S_count = configuration->property("Channels_2S.count", 0); unsigned int Channels_1B_count = configuration->property("Channels_1B.count", 0); unsigned int Channels_5X_count = configuration->property("Channels_5X.count", 0); + unsigned int Channels_1G_count = configuration->property("Channels_1G.count", 0); unsigned int total_channels = Channels_1C_count + Channels_2S_count + Channels_1B_count + - Channels_5X_count; + Channels_5X_count + + Channels_1G_count; std::unique_ptr>> channels(new std::vector>(total_channels)); //**************** GPS L1 C/A CHANNELS ********************** @@ -657,6 +728,37 @@ std::unique_ptr>> GNSSBlockFacto channel_absolute_id++; } + + //**************** GLONASS L1 C/A CHANNELS ********************** + LOG(INFO) << "Getting " << Channels_1G_count << " GLONASS L1 C/A channels"; + acquisition_implementation = configuration->property("Acquisition_1G.implementation", default_implementation); + tracking_implementation = configuration->property("Tracking_1G.implementation", default_implementation); + telemetry_decoder_implementation = configuration->property("TelemetryDecoder_1G.implementation", default_implementation); + + for (unsigned int i = 0; i < Channels_1G_count; i++) + { + //(i.e. Acquisition_1G0.implementation=xxxx) + std::string acquisition_implementation_specific = configuration->property( + "Acquisition_1G" + boost::lexical_cast(channel_absolute_id) + ".implementation", + acquisition_implementation); + //(i.e. Tracking_1G0.implementation=xxxx) + std::string tracking_implementation_specific = configuration->property( + "Tracking_1G" + boost::lexical_cast(channel_absolute_id) + ".implementation", + tracking_implementation); + std::string telemetry_decoder_implementation_specific = configuration->property( + "TelemetryDecoder_1G" + boost::lexical_cast(channel_absolute_id) + ".implementation", + telemetry_decoder_implementation); + + // Push back the channel to the vector of channels + channels->at(channel_absolute_id) = std::move(GetChannel_1G(configuration, + acquisition_implementation_specific, + tracking_implementation_specific, + telemetry_decoder_implementation_specific, + channel_absolute_id, + queue)); + channel_absolute_id++; + } + return channels; } @@ -976,6 +1078,12 @@ std::unique_ptr GNSSBlockFactory::GetBlock( out_streams)); block = std::move(block_); } + else if (implementation.compare("GLONASS_L1_CA_PCPS_Acquisition") == 0) + { + std::unique_ptr block_(new GlonassL1CaPcpsAcquisition(configuration.get(), role, in_streams, + out_streams)); + block = std::move(block_); + } @@ -1228,6 +1336,12 @@ std::unique_ptr GNSSBlockFactory::GetAcqBlock( out_streams)); block = std::move(block_); } + else if (implementation.compare("GLONASS_L1_CA_PCPS_Acquisition") == 0) + { + std::unique_ptr block_(new GlonassL1CaPcpsAcquisition(configuration.get(), role, in_streams, + out_streams)); + block = std::move(block_); + } else { // Log fatal. This causes execution to stop. diff --git a/src/core/receiver/gnss_block_factory.h b/src/core/receiver/gnss_block_factory.h index 13c614ee8..6dd6ae11f 100644 --- a/src/core/receiver/gnss_block_factory.h +++ b/src/core/receiver/gnss_block_factory.h @@ -94,6 +94,10 @@ private: std::string acq, std::string trk, std::string tlm, int channel, boost::shared_ptr queue); + std::unique_ptr GetChannel_1G(std::shared_ptr configuration, + std::string acq, std::string trk, std::string tlm, int channel, + boost::shared_ptr queue); + std::unique_ptr GetAcqBlock( std::shared_ptr configuration, std::string role, From 60ac371f534d415ccad01fff4e16f674114020d6 Mon Sep 17 00:00:00 2001 From: Gastd Date: Thu, 1 Jun 2017 20:56:01 -0300 Subject: [PATCH 09/11] Only 24 SV's available --- src/core/receiver/gnss_flowgraph.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 8ef37b7c3..3c981643e 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -556,7 +556,8 @@ void GNSSFlowgraph::set_signals_list() unsigned int total_channels = configuration_->property("Channels_1C.count", 0) + configuration_->property("Channels_2S.count", 0) + configuration_->property("Channels_1B.count", 0) + - configuration_->property("Channels_5X.count", 0); + configuration_->property("Channels_5X.count", 0) + + configuration_->property("Channels_1G.count", 0); /* * Loop to create the list of GNSS Signals @@ -577,7 +578,7 @@ void GNSSFlowgraph::set_signals_list() * Only 24 operational */ std::set available_glonass_prn = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27}; + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24}; std::string sv_list = configuration_->property("Galileo.prns", std::string("") ); From 14e501ffec6932bf0cd8ca2ff5ddcd1a48306931 Mon Sep 17 00:00:00 2001 From: Gastd Date: Thu, 1 Jun 2017 20:57:48 -0300 Subject: [PATCH 10/11] Change the if frequency to the FDMA channel to be searched --- .../acquisition/gnuradio_blocks/pcps_acquisition_cc.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.h index bea0170ea..38eb7f98c 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.h @@ -145,6 +145,12 @@ public: void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) { d_gnss_synchro = p_gnss_synchro; + // Dealing with FDMA system + if(d_gnss_synchro->System == 'R') + { + d_freq += 0.5625e6 * GLONASS_PRN[d_gnss_synchro->PRN+1]; + std::cout << "d_freq " << d_freq << std::endl; + } } /*! From c381e10dc3b71a0a762b27c06ac828557d2ddf4e Mon Sep 17 00:00:00 2001 From: Gastd Date: Thu, 1 Jun 2017 20:58:59 -0300 Subject: [PATCH 11/11] Change Glonass string --- src/core/system_parameters/gnss_satellite.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/system_parameters/gnss_satellite.cc b/src/core/system_parameters/gnss_satellite.cc index c56bbe52d..2970447d1 100644 --- a/src/core/system_parameters/gnss_satellite.cc +++ b/src/core/system_parameters/gnss_satellite.cc @@ -61,9 +61,9 @@ Gnss_Satellite::~Gnss_Satellite() void Gnss_Satellite::reset() { - system_set = {"GPS", "GLONASS", "SBAS", "Galileo", "Beidou"}; + system_set = {"GPS", "Glonass", "SBAS", "Galileo", "Beidou"}; satelliteSystem["GPS"] = "G"; - satelliteSystem["GLONASS"] = "R"; + satelliteSystem["Glonass"] = "R"; satelliteSystem["SBAS"] = "S"; satelliteSystem["Galileo"] = "E"; satelliteSystem["Beidou"] = "C"; @@ -120,7 +120,7 @@ Gnss_Satellite& Gnss_Satellite::operator=(const Gnss_Satellite &rhs) { void Gnss_Satellite::set_system(const std::string& system_) { - // Set the satellite system {"GPS", "GLONASS", "SBAS", "Galileo", "Compass"} + // Set the satellite system {"GPS", "Glonass", "SBAS", "Galileo", "Compass"} std::set::iterator it = system_set.find(system_); if(it != system_set.end()) @@ -129,7 +129,7 @@ void Gnss_Satellite::set_system(const std::string& system_) } else { - DLOG(INFO) << "System " << system_ << " is not defined {GPS, GLONASS, SBAS, Galileo, Beidou}. Initialization?"; + DLOG(INFO) << "System " << system_ << " is not defined {GPS, Glonass, SBAS, Galileo, Beidou}. Initialization?"; system = std::string(""); } } @@ -220,7 +220,7 @@ unsigned int Gnss_Satellite::get_PRN() const std::string Gnss_Satellite::get_system() const { - // Get the satellite system {"GPS", "GLONASS", "SBAS", "Galileo", "Beidou"} + // Get the satellite system {"GPS", "Glonass", "SBAS", "Galileo", "Beidou"} std::string system_; system_ = system; return system_;