diff --git a/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.cc index d07b367e4..f59bd49e1 100644 --- a/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.cc @@ -37,127 +37,46 @@ BeidouB1iDllPllTracking::BeidouB1iDllPllTracking( ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { - Dll_Pll_Conf trk_param = Dll_Pll_Conf(); + Dll_Pll_Conf trk_params = Dll_Pll_Conf(); DLOG(INFO) << "role " << role; - // ################# CONFIGURATION PARAMETERS ######################## - std::string default_item_type = "gr_complex"; - std::string item_type = configuration->property(role + ".item_type", default_item_type); - int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); - int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - trk_param.fs_in = fs_in; - bool dump = configuration->property(role + ".dump", false); - trk_param.dump = dump; - float pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0); - if (FLAGS_pll_bw_hz != 0.0) - { - pll_bw_hz = static_cast(FLAGS_pll_bw_hz); - } - trk_param.pll_bw_hz = pll_bw_hz; - float pll_bw_narrow_hz = configuration->property(role + ".pll_bw_narrow_hz", 20.0); - trk_param.pll_bw_narrow_hz = pll_bw_narrow_hz; - float dll_bw_narrow_hz = configuration->property(role + ".dll_bw_narrow_hz", 2.0); - trk_param.dll_bw_narrow_hz = dll_bw_narrow_hz; - float dll_bw_hz = configuration->property(role + ".dll_bw_hz", 2.0); - if (FLAGS_dll_bw_hz != 0.0) - { - dll_bw_hz = static_cast(FLAGS_dll_bw_hz); - } - trk_param.dll_bw_hz = dll_bw_hz; + trk_params.SetFromConfiguration(configuration, role); - int dll_filter_order = configuration->property(role + ".dll_filter_order", 2); - if (dll_filter_order < 1) + int vector_length = std::round(trk_params.fs_in / (BEIDOU_B1I_CODE_RATE_CPS / BEIDOU_B1I_CODE_LENGTH_CHIPS)); + trk_params.vector_length = vector_length; + if (trk_params.extend_correlation_symbols < 1) { - LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 1."; - dll_filter_order = 1; - } - if (dll_filter_order > 3) - { - LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 3."; - dll_filter_order = 3; - } - trk_param.dll_filter_order = dll_filter_order; - - int pll_filter_order = configuration->property(role + ".pll_filter_order", 3); - if (pll_filter_order < 2) - { - LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 2."; - pll_filter_order = 2; - } - if (pll_filter_order > 3) - { - LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 3."; - pll_filter_order = 3; - } - trk_param.pll_filter_order = pll_filter_order; - - if (pll_filter_order == 2) - { - trk_param.fll_filter_order = 1; - } - if (pll_filter_order == 3) - { - trk_param.fll_filter_order = 2; - } - - bool enable_fll_pull_in = configuration->property(role + ".enable_fll_pull_in", false); - trk_param.enable_fll_pull_in = enable_fll_pull_in; - float fll_bw_hz = configuration->property(role + ".fll_bw_hz", 35.0); - trk_param.fll_bw_hz = fll_bw_hz; - trk_param.pull_in_time_s = configuration->property(role + ".pull_in_time_s", trk_param.pull_in_time_s); - - float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5); - trk_param.early_late_space_chips = early_late_space_chips; - float early_late_space_narrow_chips = configuration->property(role + ".early_late_space_narrow_chips", 0.5); - trk_param.early_late_space_narrow_chips = early_late_space_narrow_chips; - std::string default_dump_filename = "./track_ch"; - std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); - trk_param.dump_filename = dump_filename; - int vector_length = std::round(fs_in / (BEIDOU_B1I_CODE_RATE_CPS / BEIDOU_B1I_CODE_LENGTH_CHIPS)); - trk_param.vector_length = vector_length; - int symbols_extended_correlator = configuration->property(role + ".extend_correlation_symbols", 1); - if (symbols_extended_correlator < 1) - { - symbols_extended_correlator = 1; + trk_params.extend_correlation_symbols = 1; std::cout << TEXT_RED << "WARNING: BEIDOU B1I. extend_correlation_symbols must be bigger than 1. Coherent integration has been set to 1 symbol (1 ms)" << TEXT_RESET << std::endl; } - else if (symbols_extended_correlator > 20) + else if (trk_params.extend_correlation_symbols > 20) { - symbols_extended_correlator = 20; + trk_params.extend_correlation_symbols = 20; std::cout << TEXT_RED << "WARNING: BEIDOU B1I. extend_correlation_symbols must be lower than 21. Coherent integration has been set to 20 symbols (20 ms)" << TEXT_RESET << std::endl; } - trk_param.extend_correlation_symbols = symbols_extended_correlator; - bool track_pilot = configuration->property(role + ".track_pilot", false); - if (track_pilot) + trk_params.track_pilot = configuration->property(role + ".track_pilot", false); + if (trk_params.track_pilot) { std::cout << TEXT_RED << "WARNING: BEIDOU B1I does not have pilot signal. Data tracking has been enabled" << TEXT_RESET << std::endl; + trk_params.track_pilot = false; } - if ((symbols_extended_correlator > 1) and (pll_bw_narrow_hz > pll_bw_hz or dll_bw_narrow_hz > dll_bw_hz)) + if ((trk_params.extend_correlation_symbols > 1) and (trk_params.pll_bw_narrow_hz > trk_params.pll_bw_hz or trk_params.dll_bw_narrow_hz > trk_params.dll_bw_hz)) { std::cout << TEXT_RED << "WARNING: BEIDOU B1I. PLL or DLL narrow tracking bandwidth is higher than wide tracking one" << TEXT_RESET << std::endl; } - trk_param.very_early_late_space_chips = 0.0; - trk_param.very_early_late_space_narrow_chips = 0.0; - trk_param.track_pilot = false; - trk_param.system = 'C'; + trk_params.system = 'C'; std::array sig_{'B', '1', '\0'}; - std::memcpy(trk_param.signal, sig_.data(), 3); + std::memcpy(trk_params.signal, sig_.data(), 3); - trk_param.cn0_samples = configuration->property(role + ".cn0_samples", trk_param.cn0_samples); - trk_param.cn0_min = configuration->property(role + ".cn0_min", trk_param.cn0_min); - trk_param.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param.max_code_lock_fail); - trk_param.max_carrier_lock_fail = configuration->property(role + ".max_carrier_lock_fail", trk_param.max_carrier_lock_fail); - trk_param.carrier_lock_th = configuration->property(role + ".carrier_lock_th", trk_param.carrier_lock_th); - - // ################# MAKE TRACKING GNURadio object ################### - if (item_type == "gr_complex") + // ################# Make a GNU Radio Tracking block object ################ + if (trk_params.item_type == "gr_complex") { item_size_ = sizeof(gr_complex); - tracking_ = dll_pll_veml_make_tracking(trk_param); + tracking_ = dll_pll_veml_make_tracking(trk_params); } else { item_size_ = sizeof(gr_complex); - LOG(WARNING) << item_type << " unknown tracking item type."; + LOG(WARNING) << trk_params.item_type << " unknown tracking item type."; } channel_ = 0; DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; diff --git a/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.cc index a63286af0..fcbd78590 100644 --- a/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.cc @@ -38,130 +38,37 @@ BeidouB3iDllPllTracking::BeidouB3iDllPllTracking( ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { - Dll_Pll_Conf trk_param = Dll_Pll_Conf(); + Dll_Pll_Conf trk_params = Dll_Pll_Conf(); DLOG(INFO) << "role " << role; - // ################# CONFIGURATION PARAMETERS ######################## - std::string default_item_type = "gr_complex"; - std::string item_type = configuration->property(role + ".item_type", default_item_type); - int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); - int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - trk_param.fs_in = fs_in; - bool dump = configuration->property(role + ".dump", false); - trk_param.dump = dump; - std::string default_dump_filename = "./track_ch"; - std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); - trk_param.dump_filename = dump_filename; - bool dump_mat = configuration->property(role + ".dump_mat", true); - trk_param.dump_mat = dump_mat; - trk_param.high_dyn = configuration->property(role + ".high_dyn", false); - if (configuration->property(role + ".smoother_length", 10) < 1) - { - trk_param.smoother_length = 1; - std::cout << TEXT_RED << "WARNING: BEIDOU B3I. smoother_length must be bigger than 0. It has been set to 1" << TEXT_RESET << std::endl; - } - else - { - trk_param.smoother_length = configuration->property(role + ".smoother_length", 10); - } - float pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0); - if (FLAGS_pll_bw_hz != 0.0) - { - pll_bw_hz = static_cast(FLAGS_pll_bw_hz); - } - trk_param.pll_bw_hz = pll_bw_hz; - float dll_bw_hz = configuration->property(role + ".dll_bw_hz", 2.0); - if (FLAGS_dll_bw_hz != 0.0) - { - dll_bw_hz = static_cast(FLAGS_dll_bw_hz); - } - trk_param.dll_bw_hz = dll_bw_hz; - float pll_bw_narrow_hz = configuration->property(role + ".pll_bw_narrow_hz", 2.0); - trk_param.pll_bw_narrow_hz = pll_bw_narrow_hz; - float dll_bw_narrow_hz = configuration->property(role + ".dll_bw_narrow_hz", 0.25); - trk_param.dll_bw_narrow_hz = dll_bw_narrow_hz; - float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5); - trk_param.early_late_space_chips = early_late_space_chips; + trk_params.SetFromConfiguration(configuration, role); - int dll_filter_order = configuration->property(role + ".dll_filter_order", 2); - if (dll_filter_order < 1) + int vector_length = std::round(static_cast(trk_params.fs_in) / (BEIDOU_B3I_CODE_RATE_CPS / BEIDOU_B3I_CODE_LENGTH_CHIPS)); + trk_params.vector_length = vector_length; + trk_params.track_pilot = configuration->property(role + ".track_pilot", false); + if (trk_params.extend_correlation_symbols < 1) { - LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 1."; - dll_filter_order = 1; - } - if (dll_filter_order > 3) - { - LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 3."; - dll_filter_order = 3; - } - trk_param.dll_filter_order = dll_filter_order; - - int pll_filter_order = configuration->property(role + ".pll_filter_order", 3); - if (pll_filter_order < 2) - { - LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 2."; - pll_filter_order = 2; - } - if (pll_filter_order > 3) - { - LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 3."; - pll_filter_order = 3; - } - trk_param.pll_filter_order = pll_filter_order; - - if (pll_filter_order == 2) - { - trk_param.fll_filter_order = 1; - } - if (pll_filter_order == 3) - { - trk_param.fll_filter_order = 2; - } - - bool enable_fll_pull_in = configuration->property(role + ".enable_fll_pull_in", false); - trk_param.enable_fll_pull_in = enable_fll_pull_in; - float fll_bw_hz = configuration->property(role + ".fll_bw_hz", 35.0); - trk_param.fll_bw_hz = fll_bw_hz; - trk_param.pull_in_time_s = configuration->property(role + ".pull_in_time_s", trk_param.pull_in_time_s); - - int vector_length = std::round(static_cast(fs_in) / (BEIDOU_B3I_CODE_RATE_CPS / BEIDOU_B3I_CODE_LENGTH_CHIPS)); - trk_param.vector_length = vector_length; - int symbols_extended_correlator = configuration->property(role + ".extend_correlation_symbols", 1); - float early_late_space_narrow_chips = configuration->property(role + ".early_late_space_narrow_chips", 0.5); - trk_param.early_late_space_narrow_chips = early_late_space_narrow_chips; - bool track_pilot = configuration->property(role + ".track_pilot", false); - if (symbols_extended_correlator < 1) - { - symbols_extended_correlator = 1; + trk_params.extend_correlation_symbols = 1; std::cout << TEXT_RED << "WARNING: BEIDOU B3I. extend_correlation_symbols must be bigger than 1. Coherent integration has been set to 1 symbol (1 ms)" << TEXT_RESET << std::endl; } - else if (symbols_extended_correlator > 20) + else if (trk_params.extend_correlation_symbols > 20) { - symbols_extended_correlator = 20; + trk_params.extend_correlation_symbols = 20; std::cout << TEXT_RED << "WARNING: BEIDOU B3I. extend_correlation_symbols must be lower than 21. Coherent integration has been set to 20 symbols (20 ms)" << TEXT_RESET << std::endl; } - trk_param.extend_correlation_symbols = symbols_extended_correlator; - trk_param.track_pilot = track_pilot; - trk_param.very_early_late_space_chips = 0.0; - trk_param.very_early_late_space_narrow_chips = 0.0; - trk_param.system = 'C'; + trk_params.system = 'C'; std::array sig_{'B', '3', '\0'}; - std::memcpy(trk_param.signal, sig_.data(), 3); - trk_param.cn0_samples = configuration->property(role + ".cn0_samples", trk_param.cn0_samples); - trk_param.cn0_min = configuration->property(role + ".cn0_min", trk_param.cn0_min); - trk_param.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param.max_code_lock_fail); - trk_param.max_carrier_lock_fail = configuration->property(role + ".max_carrier_lock_fail", trk_param.max_carrier_lock_fail); - trk_param.carrier_lock_th = configuration->property(role + ".carrier_lock_th", trk_param.carrier_lock_th); + std::memcpy(trk_params.signal, sig_.data(), 3); - // ################# MAKE TRACKING GNURadio object ################### - if (item_type == "gr_complex") + // ################# Make a GNU Radio Tracking block object ################ + if (trk_params.item_type == "gr_complex") { item_size_ = sizeof(gr_complex); - tracking_ = dll_pll_veml_make_tracking(trk_param); + tracking_ = dll_pll_veml_make_tracking(trk_params); } else { item_size_ = sizeof(gr_complex); - LOG(WARNING) << item_type << " unknown tracking item type."; + LOG(WARNING) << trk_params.item_type << " unknown tracking item type."; } channel_ = 0; DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; diff --git a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc index 5e659cb08..be318f970 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc @@ -36,146 +36,40 @@ GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking( ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { - Dll_Pll_Conf trk_param = Dll_Pll_Conf(); + Dll_Pll_Conf trk_params = Dll_Pll_Conf(); DLOG(INFO) << "role " << role; - // ################# CONFIGURATION PARAMETERS ######################## - std::string default_item_type = "gr_complex"; - std::string item_type = configuration->property(role + ".item_type", default_item_type); - int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); - int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - trk_param.fs_in = fs_in; - bool dump = configuration->property(role + ".dump", false); - trk_param.dump = dump; - std::string default_dump_filename = "./track_ch"; - std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); - trk_param.dump_filename = dump_filename; - bool dump_mat = configuration->property(role + ".dump_mat", true); - trk_param.dump_mat = dump_mat; - trk_param.high_dyn = configuration->property(role + ".high_dyn", false); - if (configuration->property(role + ".smoother_length", 10) < 1) - { - trk_param.smoother_length = 1; - std::cout << TEXT_RED << "WARNING: Gal. E1. smoother_length must be bigger than 0. It has been set to 1" << TEXT_RESET << std::endl; - } - else - { - trk_param.smoother_length = configuration->property(role + ".smoother_length", 10); - } - float pll_bw_hz = configuration->property(role + ".pll_bw_hz", 5.0); - if (FLAGS_pll_bw_hz != 0.0) - { - pll_bw_hz = static_cast(FLAGS_pll_bw_hz); - } - trk_param.pll_bw_hz = pll_bw_hz; - float dll_bw_hz = configuration->property(role + ".dll_bw_hz", 0.5); - if (FLAGS_dll_bw_hz != 0.0) - { - dll_bw_hz = static_cast(FLAGS_dll_bw_hz); - } - trk_param.dll_bw_hz = dll_bw_hz; - float pll_bw_narrow_hz = configuration->property(role + ".pll_bw_narrow_hz", 2.0); - trk_param.pll_bw_narrow_hz = pll_bw_narrow_hz; - float dll_bw_narrow_hz = configuration->property(role + ".dll_bw_narrow_hz", 0.25); - trk_param.dll_bw_narrow_hz = dll_bw_narrow_hz; + trk_params.SetFromConfiguration(configuration, role); - int dll_filter_order = configuration->property(role + ".dll_filter_order", 2); - if (dll_filter_order < 1) + if (trk_params.extend_correlation_symbols < 1) { - LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 1."; - dll_filter_order = 1; - } - if (dll_filter_order > 3) - { - LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 3."; - dll_filter_order = 3; - } - trk_param.dll_filter_order = dll_filter_order; - - int pll_filter_order = configuration->property(role + ".pll_filter_order", 3); - if (pll_filter_order < 2) - { - LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 2."; - pll_filter_order = 2; - } - if (pll_filter_order > 3) - { - LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 3."; - pll_filter_order = 3; - } - trk_param.pll_filter_order = pll_filter_order; - - if (pll_filter_order == 2) - { - trk_param.fll_filter_order = 1; - } - if (pll_filter_order == 3) - { - trk_param.fll_filter_order = 2; - } - - bool enable_fll_pull_in = configuration->property(role + ".enable_fll_pull_in", false); - trk_param.enable_fll_pull_in = enable_fll_pull_in; - - bool enable_fll_steady_state = configuration->property(role + ".enable_fll_steady_state", false); - trk_param.enable_fll_steady_state = enable_fll_steady_state; - - float fll_bw_hz = configuration->property(role + ".fll_bw_hz", 35.0); - trk_param.fll_bw_hz = fll_bw_hz; - trk_param.pull_in_time_s = configuration->property(role + ".pull_in_time_s", trk_param.pull_in_time_s); - - int extend_correlation_symbols = configuration->property(role + ".extend_correlation_symbols", 1); - float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.15); - trk_param.early_late_space_chips = early_late_space_chips; - float very_early_late_space_chips = configuration->property(role + ".very_early_late_space_chips", 0.5); - trk_param.very_early_late_space_chips = very_early_late_space_chips; - float early_late_space_narrow_chips = configuration->property(role + ".early_late_space_narrow_chips", 0.15); - trk_param.early_late_space_narrow_chips = early_late_space_narrow_chips; - float very_early_late_space_narrow_chips = configuration->property(role + ".very_early_late_space_narrow_chips", 0.5); - trk_param.very_early_late_space_narrow_chips = very_early_late_space_narrow_chips; - bool track_pilot = configuration->property(role + ".track_pilot", false); - if (extend_correlation_symbols < 1) - { - extend_correlation_symbols = 1; + trk_params.extend_correlation_symbols = 1; std::cout << TEXT_RED << "WARNING: Galileo E1. extend_correlation_symbols must be bigger than 0. Coherent integration has been set to 1 symbol (4 ms)" << TEXT_RESET << std::endl; } - else if (!track_pilot and extend_correlation_symbols > 1) + else if (!trk_params.track_pilot and trk_params.extend_correlation_symbols > 1) { - extend_correlation_symbols = 1; + trk_params.extend_correlation_symbols = 1; std::cout << TEXT_RED << "WARNING: Galileo E1. Extended coherent integration is not allowed when tracking the data component. Coherent integration has been set to 4 ms (1 symbol)" << TEXT_RESET << std::endl; } - if ((extend_correlation_symbols > 1) and (pll_bw_narrow_hz > pll_bw_hz or dll_bw_narrow_hz > dll_bw_hz)) + if ((trk_params.extend_correlation_symbols > 1) and (trk_params.pll_bw_narrow_hz > trk_params.pll_bw_hz or trk_params.dll_bw_narrow_hz > trk_params.dll_bw_hz)) { std::cout << TEXT_RED << "WARNING: Galileo E1. PLL or DLL narrow tracking bandwidth is higher than wide tracking one" << TEXT_RESET << std::endl; } - trk_param.track_pilot = track_pilot; - trk_param.extend_correlation_symbols = extend_correlation_symbols; - int vector_length = std::round(fs_in / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS)); - trk_param.vector_length = vector_length; - trk_param.system = 'E'; + int vector_length = std::round(trk_params.fs_in / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS)); + trk_params.vector_length = vector_length; + trk_params.system = 'E'; std::array sig_{'1', 'B', '\0'}; - std::memcpy(trk_param.signal, sig_.data(), 3); - trk_param.cn0_samples = configuration->property(role + ".cn0_samples", trk_param.cn0_samples); - trk_param.cn0_min = configuration->property(role + ".cn0_min", trk_param.cn0_min); - trk_param.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param.max_code_lock_fail); - trk_param.max_carrier_lock_fail = configuration->property(role + ".max_carrier_lock_fail", trk_param.max_carrier_lock_fail); - trk_param.carrier_lock_th = configuration->property(role + ".carrier_lock_th", trk_param.carrier_lock_th); + std::memcpy(trk_params.signal, sig_.data(), 3); - // tracking lock tests smoother parameters - trk_param.cn0_smoother_samples = configuration->property(role + ".cn0_smoother_samples", trk_param.cn0_smoother_samples); - trk_param.cn0_smoother_alpha = configuration->property(role + ".cn0_smoother_alpha", trk_param.cn0_smoother_alpha); - trk_param.carrier_lock_test_smoother_samples = configuration->property(role + ".carrier_lock_test_smoother_samples", trk_param.carrier_lock_test_smoother_samples); - trk_param.carrier_lock_test_smoother_alpha = configuration->property(role + ".carrier_lock_test_smoother_alpha", trk_param.carrier_lock_test_smoother_alpha); - - // ################# MAKE TRACKING GNURadio object ################### - if (item_type == "gr_complex") + // ################# Make a GNU Radio Tracking block object ################ + if (trk_params.item_type == "gr_complex") { item_size_ = sizeof(gr_complex); - tracking_ = dll_pll_veml_make_tracking(trk_param); + tracking_ = dll_pll_veml_make_tracking(trk_params); } else { item_size_ = sizeof(gr_complex); - LOG(WARNING) << item_type << " unknown tracking item type."; + LOG(WARNING) << trk_params.item_type << " unknown tracking item type."; } channel_ = 0; diff --git a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc index 8fedab0c3..bb5ca1837 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc @@ -38,148 +38,42 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga( ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { - Dll_Pll_Conf_Fpga trk_param_fpga = Dll_Pll_Conf_Fpga(); + Dll_Pll_Conf_Fpga trk_params_fpga = Dll_Pll_Conf_Fpga(); DLOG(INFO) << "role " << role; - //################# CONFIGURATION PARAMETERS ######################## - int32_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 12500000); - int32_t fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - trk_param_fpga.fs_in = fs_in; - bool dump = configuration->property(role + ".dump", false); - trk_param_fpga.dump = dump; - std::string default_dump_filename = "./track_ch"; - std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); - trk_param_fpga.dump_filename = dump_filename; - bool dump_mat = configuration->property(role + ".dump_mat", true); - trk_param_fpga.dump_mat = dump_mat; - trk_param_fpga.high_dyn = configuration->property(role + ".high_dyn", false); - if (configuration->property(role + ".smoother_length", 10) < 1) - { - trk_param_fpga.smoother_length = 1; - std::cout << TEXT_RED << "WARNING: Gal. E1. smoother_length must be bigger than 0. It has been set to 1" << TEXT_RESET << std::endl; - } - else - { - trk_param_fpga.smoother_length = configuration->property(role + ".smoother_length", 10); - } - float pll_bw_hz = configuration->property(role + ".pll_bw_hz", 5.0); - if (FLAGS_pll_bw_hz != 0.0) - { - pll_bw_hz = static_cast(FLAGS_pll_bw_hz); - } - trk_param_fpga.pll_bw_hz = pll_bw_hz; - float dll_bw_hz = configuration->property(role + ".dll_bw_hz", 0.5); - if (FLAGS_dll_bw_hz != 0.0) - { - dll_bw_hz = static_cast(FLAGS_dll_bw_hz); - } - trk_param_fpga.dll_bw_hz = dll_bw_hz; - float pll_bw_narrow_hz = configuration->property(role + ".pll_bw_narrow_hz", 2.0); - trk_param_fpga.pll_bw_narrow_hz = pll_bw_narrow_hz; - float dll_bw_narrow_hz = configuration->property(role + ".dll_bw_narrow_hz", 0.25); - trk_param_fpga.dll_bw_narrow_hz = dll_bw_narrow_hz; + trk_params_fpga.SetFromConfiguration(configuration, role); - int dll_filter_order = configuration->property(role + ".dll_filter_order", 2); - if (dll_filter_order < 1) + if (trk_params_fpga.extend_correlation_symbols < 1) { - LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 1."; - dll_filter_order = 1; - } - if (dll_filter_order > 3) - { - LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 3."; - dll_filter_order = 3; - } - trk_param_fpga.dll_filter_order = dll_filter_order; - - int pll_filter_order = configuration->property(role + ".pll_filter_order", 3); - if (pll_filter_order < 2) - { - LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 2."; - pll_filter_order = 2; - } - if (pll_filter_order > 3) - { - LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 3."; - pll_filter_order = 3; - } - trk_param_fpga.pll_filter_order = pll_filter_order; - - if (pll_filter_order == 2) - { - trk_param_fpga.fll_filter_order = 1; - } - if (pll_filter_order == 3) - { - trk_param_fpga.fll_filter_order = 2; - } - - bool enable_fll_pull_in = configuration->property(role + ".enable_fll_pull_in", false); - trk_param_fpga.enable_fll_pull_in = enable_fll_pull_in; - bool enable_fll_steady_state = configuration->property(role + ".enable_fll_steady_state", false); - trk_param_fpga.enable_fll_steady_state = enable_fll_steady_state; - float fll_bw_hz = configuration->property(role + ".fll_bw_hz", 35.0); - trk_param_fpga.fll_bw_hz = fll_bw_hz; - float pull_in_time_s = configuration->property(role + ".pull_in_time_s", trk_param_fpga.pull_in_time_s); - trk_param_fpga.pull_in_time_s = pull_in_time_s; - - int32_t extend_correlation_symbols = configuration->property(role + ".extend_correlation_symbols", 1); - float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.15); - trk_param_fpga.early_late_space_chips = early_late_space_chips; - float very_early_late_space_chips = configuration->property(role + ".very_early_late_space_chips", 0.5); - trk_param_fpga.very_early_late_space_chips = very_early_late_space_chips; - float early_late_space_narrow_chips = configuration->property(role + ".early_late_space_narrow_chips", 0.15); - trk_param_fpga.early_late_space_narrow_chips = early_late_space_narrow_chips; - float very_early_late_space_narrow_chips = configuration->property(role + ".very_early_late_space_narrow_chips", 0.5); - trk_param_fpga.very_early_late_space_narrow_chips = very_early_late_space_narrow_chips; - bool track_pilot = configuration->property(role + ".track_pilot", false); - if (extend_correlation_symbols < 1) - { - extend_correlation_symbols = 1; + trk_params_fpga.extend_correlation_symbols = 1; std::cout << TEXT_RED << "WARNING: Galileo E1. extend_correlation_symbols must be bigger than 0. Coherent integration has been set to 1 symbol (4 ms)" << TEXT_RESET << std::endl; } - else if (!track_pilot and extend_correlation_symbols > 1) + else if (!trk_params_fpga.track_pilot and trk_params_fpga.extend_correlation_symbols > 1) { - extend_correlation_symbols = 1; + trk_params_fpga.extend_correlation_symbols = 1; std::cout << TEXT_RED << "WARNING: Galileo E1. Extended coherent integration is not allowed when tracking the data component. Coherent integration has been set to 4 ms (1 symbol)" << TEXT_RESET << std::endl; } - if ((extend_correlation_symbols > 1) and (pll_bw_narrow_hz > pll_bw_hz or dll_bw_narrow_hz > dll_bw_hz)) + if ((trk_params_fpga.extend_correlation_symbols > 1) and (trk_params_fpga.pll_bw_narrow_hz > trk_params_fpga.pll_bw_hz or trk_params_fpga.dll_bw_narrow_hz > trk_params_fpga.dll_bw_hz)) { std::cout << TEXT_RED << "WARNING: Galileo E1. PLL or DLL narrow tracking bandwidth is higher than wide tracking one" << TEXT_RESET << std::endl; } - trk_param_fpga.track_pilot = track_pilot; - d_track_pilot = track_pilot; - trk_param_fpga.extend_correlation_symbols = extend_correlation_symbols; - int32_t vector_length = std::round(fs_in / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS)); - trk_param_fpga.vector_length = vector_length; - trk_param_fpga.system = 'E'; + d_track_pilot = trk_params_fpga.track_pilot; + int32_t vector_length = std::round(trk_params_fpga.fs_in / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS)); + trk_params_fpga.vector_length = vector_length; + trk_params_fpga.system = 'E'; std::array sig_{'1', 'B', '\0'}; - std::memcpy(trk_param_fpga.signal, sig_.data(), 3); - trk_param_fpga.cn0_samples = configuration->property(role + ".cn0_samples", trk_param_fpga.cn0_samples); - trk_param_fpga.cn0_min = configuration->property(role + ".cn0_min", trk_param_fpga.cn0_min); - trk_param_fpga.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param_fpga.max_code_lock_fail); - trk_param_fpga.max_carrier_lock_fail = configuration->property(role + ".max_carrier_lock_fail", trk_param_fpga.max_carrier_lock_fail); - trk_param_fpga.carrier_lock_th = configuration->property(role + ".carrier_lock_th", trk_param_fpga.carrier_lock_th); - - // tracking lock tests smoother parameters - trk_param_fpga.cn0_smoother_samples = configuration->property(role + ".cn0_smoother_samples", trk_param_fpga.cn0_smoother_samples); - trk_param_fpga.cn0_smoother_alpha = configuration->property(role + ".cn0_smoother_alpha", trk_param_fpga.cn0_smoother_alpha); - trk_param_fpga.carrier_lock_test_smoother_samples = configuration->property(role + ".carrier_lock_test_smoother_samples", trk_param_fpga.carrier_lock_test_smoother_samples); - trk_param_fpga.carrier_lock_test_smoother_alpha = configuration->property(role + ".carrier_lock_test_smoother_alpha", trk_param_fpga.carrier_lock_test_smoother_alpha); + std::memcpy(trk_params_fpga.signal, sig_.data(), 3); // FPGA configuration parameters - std::string default_device_name = "/dev/uio"; - std::string device_name = configuration->property(role + ".devicename", default_device_name); - trk_param_fpga.device_name = device_name; // obtain the number of the first uio device corresponding to a HW accelerator in the FPGA // that can be assigned to the tracking of the E1 signal - trk_param_fpga.dev_file_num = configuration->property(role + ".dev_file_num", 15); + trk_params_fpga.dev_file_num = configuration->property(role + ".dev_file_num", 15); // compute the number of tracking channels that have already been instantiated. The order in which // GNSS-SDR instantiates the tracking channels i L1, L2, L5, E1, E5a - trk_param_fpga.num_prev_assigned_ch = configuration->property("Channels_1C.count", 0) + - configuration->property("Channels_2S.count", 0) + - configuration->property("Channels_L5.count", 0); + trk_params_fpga.num_prev_assigned_ch = configuration->property("Channels_1C.count", 0) + + configuration->property("Channels_2S.count", 0) + + configuration->property("Channels_L5.count", 0); - //################# PRE-COMPUTE ALL THE CODES ################# + // ################# PRE-COMPUTE ALL THE CODES ################# uint32_t code_samples_per_chip = 2; d_ca_codes = static_cast(volk_gnsssdr_malloc(static_cast(GALILEO_E1_B_CODE_LENGTH_CHIPS) * code_samples_per_chip * GALILEO_E1_NUMBER_OF_CODES * sizeof(int32_t), volk_gnsssdr_get_alignment())); volk_gnsssdr::vector ca_codes_f(static_cast(GALILEO_E1_B_CODE_LENGTH_CHIPS) * code_samples_per_chip); @@ -189,10 +83,6 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga( if (d_track_pilot) { d_data_codes = static_cast(volk_gnsssdr_malloc((static_cast(GALILEO_E1_B_CODE_LENGTH_CHIPS)) * code_samples_per_chip * GALILEO_E1_NUMBER_OF_CODES * sizeof(int32_t), volk_gnsssdr_get_alignment())); - } - - if (d_track_pilot) - { data_codes_f.resize(static_cast(GALILEO_E1_B_CODE_LENGTH_CHIPS) * code_samples_per_chip, 0.0); } @@ -242,16 +132,16 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga( } } - trk_param_fpga.ca_codes = d_ca_codes; - trk_param_fpga.data_codes = d_data_codes; - trk_param_fpga.code_length_chips = GALILEO_E1_B_CODE_LENGTH_CHIPS; - trk_param_fpga.code_samples_per_chip = code_samples_per_chip; // 2 sample per chip - trk_param_fpga.extended_correlation_in_fpga = false; - trk_param_fpga.extend_fpga_integration_periods = 1; // (number of FPGA integrations that are combined in the SW) - trk_param_fpga.fpga_integration_period = 1; // (number of symbols that are effectively integrated in the FPGA) + trk_params_fpga.ca_codes = d_ca_codes; + trk_params_fpga.data_codes = d_data_codes; + trk_params_fpga.code_length_chips = GALILEO_E1_B_CODE_LENGTH_CHIPS; + trk_params_fpga.code_samples_per_chip = code_samples_per_chip; // 2 sample per chip + trk_params_fpga.extended_correlation_in_fpga = false; + trk_params_fpga.extend_fpga_integration_periods = 1; // (number of FPGA integrations that are combined in the SW) + trk_params_fpga.fpga_integration_period = 1; // (number of symbols that are effectively integrated in the FPGA) - //################# MAKE TRACKING GNURadio object ################### - tracking_fpga_sc = dll_pll_veml_make_tracking_fpga(trk_param_fpga); + // ################# MAKE TRACKING GNU Radio object ################### + tracking_fpga_sc = dll_pll_veml_make_tracking_fpga(trk_params_fpga); channel_ = 0; DLOG(INFO) << "tracking(" << tracking_fpga_sc->unique_id() << ")"; diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc index 2c16397f1..e9ef9c6ad 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc @@ -35,142 +35,40 @@ GalileoE5aDllPllTracking::GalileoE5aDllPllTracking( ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { - Dll_Pll_Conf trk_param = Dll_Pll_Conf(); + Dll_Pll_Conf trk_params = Dll_Pll_Conf(); DLOG(INFO) << "role " << role; - // ################# CONFIGURATION PARAMETERS ######################## - std::string default_item_type = "gr_complex"; - std::string item_type = configuration->property(role + ".item_type", default_item_type); - int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 12000000); - int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - trk_param.fs_in = fs_in; - bool dump = configuration->property(role + ".dump", false); - trk_param.dump = dump; - std::string default_dump_filename = "./track_ch"; - std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); - trk_param.dump_filename = dump_filename; - bool dump_mat = configuration->property(role + ".dump_mat", true); - trk_param.dump_mat = dump_mat; - trk_param.high_dyn = configuration->property(role + ".high_dyn", false); - if (configuration->property(role + ".smoother_length", 10) < 1) - { - trk_param.smoother_length = 1; - std::cout << TEXT_RED << "WARNING: Gal. E5a. smoother_length must be bigger than 0. It has been set to 1" << TEXT_RESET << std::endl; - } - else - { - trk_param.smoother_length = configuration->property(role + ".smoother_length", 10); - } - float pll_bw_hz = configuration->property(role + ".pll_bw_hz", 20.0); - if (FLAGS_pll_bw_hz != 0.0) - { - pll_bw_hz = static_cast(FLAGS_pll_bw_hz); - } - trk_param.pll_bw_hz = pll_bw_hz; - float dll_bw_hz = configuration->property(role + ".dll_bw_hz", 20.0); - if (FLAGS_dll_bw_hz != 0.0) - { - dll_bw_hz = static_cast(FLAGS_dll_bw_hz); - } - trk_param.dll_bw_hz = dll_bw_hz; + trk_params.SetFromConfiguration(configuration, role); - int dll_filter_order = configuration->property(role + ".dll_filter_order", 2); - if (dll_filter_order < 1) + int vector_length = std::round(trk_params.fs_in / (GALILEO_E5A_CODE_CHIP_RATE_CPS / GALILEO_E5A_CODE_LENGTH_CHIPS)); + trk_params.vector_length = vector_length; + if (trk_params.extend_correlation_symbols < 1) { - LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 1."; - dll_filter_order = 1; - } - if (dll_filter_order > 3) - { - LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 3."; - dll_filter_order = 3; - } - trk_param.dll_filter_order = dll_filter_order; - - int pll_filter_order = configuration->property(role + ".pll_filter_order", 3); - if (pll_filter_order < 2) - { - LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 2."; - pll_filter_order = 2; - } - if (pll_filter_order > 3) - { - LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 3."; - pll_filter_order = 3; - } - trk_param.pll_filter_order = pll_filter_order; - - if (pll_filter_order == 2) - { - trk_param.fll_filter_order = 1; - } - if (pll_filter_order == 3) - { - trk_param.fll_filter_order = 2; - } - - bool enable_fll_pull_in = configuration->property(role + ".enable_fll_pull_in", false); - trk_param.enable_fll_pull_in = enable_fll_pull_in; - bool enable_fll_steady_state = configuration->property(role + ".enable_fll_steady_state", false); - trk_param.enable_fll_steady_state = enable_fll_steady_state; - float fll_bw_hz = configuration->property(role + ".fll_bw_hz", 35.0); - trk_param.fll_bw_hz = fll_bw_hz; - trk_param.pull_in_time_s = configuration->property(role + ".pull_in_time_s", trk_param.pull_in_time_s); - - float pll_bw_narrow_hz = configuration->property(role + ".pll_bw_narrow_hz", 5.0); - trk_param.pll_bw_narrow_hz = pll_bw_narrow_hz; - float dll_bw_narrow_hz = configuration->property(role + ".dll_bw_narrow_hz", 2.0); - trk_param.dll_bw_narrow_hz = dll_bw_narrow_hz; - float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5); - trk_param.early_late_space_chips = early_late_space_chips; - int vector_length = std::round(fs_in / (GALILEO_E5A_CODE_CHIP_RATE_CPS / GALILEO_E5A_CODE_LENGTH_CHIPS)); - trk_param.vector_length = vector_length; - int extend_correlation_symbols = configuration->property(role + ".extend_correlation_symbols", 1); - float early_late_space_narrow_chips = configuration->property(role + ".early_late_space_narrow_chips", 0.5); - trk_param.early_late_space_narrow_chips = early_late_space_narrow_chips; - bool track_pilot = configuration->property(role + ".track_pilot", false); - if (extend_correlation_symbols < 1) - { - extend_correlation_symbols = 1; + trk_params.extend_correlation_symbols = 1; std::cout << TEXT_RED << "WARNING: Galileo E5a. extend_correlation_symbols must be bigger than 0. Coherent integration has been set to 1 symbol (1 ms)" << TEXT_RESET << std::endl; } - else if (!track_pilot and extend_correlation_symbols > GALILEO_E5A_I_SECONDARY_CODE_LENGTH) + else if (!trk_params.track_pilot and trk_params.extend_correlation_symbols > GALILEO_E5A_I_SECONDARY_CODE_LENGTH) { - extend_correlation_symbols = GALILEO_E5A_I_SECONDARY_CODE_LENGTH; + trk_params.extend_correlation_symbols = GALILEO_E5A_I_SECONDARY_CODE_LENGTH; std::cout << TEXT_RED << "WARNING: Galileo E5a. extend_correlation_symbols must be lower than 21 when tracking the data component. Coherent integration has been set to 20 symbols (20 ms)" << TEXT_RESET << std::endl; } - if ((extend_correlation_symbols > 1) and (pll_bw_narrow_hz > pll_bw_hz or dll_bw_narrow_hz > dll_bw_hz)) + if ((trk_params.extend_correlation_symbols > 1) and (trk_params.pll_bw_narrow_hz > trk_params.pll_bw_hz or trk_params.dll_bw_narrow_hz > trk_params.dll_bw_hz)) { std::cout << TEXT_RED << "WARNING: Galileo E5a. PLL or DLL narrow tracking bandwidth is higher than wide tracking one" << TEXT_RESET << std::endl; } - trk_param.extend_correlation_symbols = extend_correlation_symbols; - trk_param.track_pilot = track_pilot; - trk_param.very_early_late_space_chips = 0.0; - trk_param.very_early_late_space_narrow_chips = 0.0; - trk_param.system = 'E'; + trk_params.system = 'E'; std::array sig_{'5', 'X', '\0'}; - std::memcpy(trk_param.signal, sig_.data(), 3); - trk_param.cn0_samples = configuration->property(role + ".cn0_samples", trk_param.cn0_samples); - trk_param.cn0_min = configuration->property(role + ".cn0_min", trk_param.cn0_min); - trk_param.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param.max_code_lock_fail); - trk_param.max_carrier_lock_fail = configuration->property(role + ".max_carrier_lock_fail", trk_param.max_carrier_lock_fail); - trk_param.carrier_lock_th = configuration->property(role + ".carrier_lock_th", trk_param.carrier_lock_th); + std::memcpy(trk_params.signal, sig_.data(), 3); - // tracking lock tests smoother parameters - trk_param.cn0_smoother_samples = configuration->property(role + ".cn0_smoother_samples", trk_param.cn0_smoother_samples); - trk_param.cn0_smoother_alpha = configuration->property(role + ".cn0_smoother_alpha", trk_param.cn0_smoother_alpha); - trk_param.carrier_lock_test_smoother_samples = configuration->property(role + ".carrier_lock_test_smoother_samples", trk_param.carrier_lock_test_smoother_samples); - trk_param.carrier_lock_test_smoother_alpha = configuration->property(role + ".carrier_lock_test_smoother_alpha", trk_param.carrier_lock_test_smoother_alpha); - - // ################# MAKE TRACKING GNURadio object ################### - if (item_type == "gr_complex") + // ################# Make a GNU Radio Tracking block object ################ + if (trk_params.item_type == "gr_complex") { item_size_ = sizeof(gr_complex); - tracking_ = dll_pll_veml_make_tracking(trk_param); + tracking_ = dll_pll_veml_make_tracking(trk_params); } else { item_size_ = sizeof(gr_complex); - LOG(WARNING) << item_type << " unknown tracking item type."; + LOG(WARNING) << trk_params.item_type << " unknown tracking item type."; } channel_ = 0; DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc index d0a72d4c5..422df5487 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc @@ -33,150 +33,46 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga( ConfigurationInterface *configuration, const std::string &role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { - Dll_Pll_Conf_Fpga trk_param_fpga = Dll_Pll_Conf_Fpga(); + Dll_Pll_Conf_Fpga trk_params_fpga = Dll_Pll_Conf_Fpga(); DLOG(INFO) << "role " << role; - // ################# CONFIGURATION PARAMETERS ######################## - int32_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 12500000); - int32_t fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - trk_param_fpga.fs_in = fs_in; - bool dump = configuration->property(role + ".dump", false); - trk_param_fpga.dump = dump; - std::string default_dump_filename = "./track_ch"; - std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); - trk_param_fpga.dump_filename = dump_filename; - bool dump_mat = configuration->property(role + ".dump_mat", true); - trk_param_fpga.dump_mat = dump_mat; - trk_param_fpga.high_dyn = configuration->property(role + ".high_dyn", false); - if (configuration->property(role + ".smoother_length", 10) < 1) - { - trk_param_fpga.smoother_length = 1; - std::cout << TEXT_RED << "WARNING: Gal. E5a. smoother_length must be bigger than 0. It has been set to 1" << TEXT_RESET << std::endl; - } - else - { - trk_param_fpga.smoother_length = configuration->property(role + ".smoother_length", 10); - } - float pll_bw_hz = configuration->property(role + ".pll_bw_hz", 20.0); - if (FLAGS_pll_bw_hz != 0.0) - { - pll_bw_hz = static_cast(FLAGS_pll_bw_hz); - } - trk_param_fpga.pll_bw_hz = pll_bw_hz; - float dll_bw_hz = configuration->property(role + ".dll_bw_hz", 20.0); - if (FLAGS_dll_bw_hz != 0.0) - { - dll_bw_hz = static_cast(FLAGS_dll_bw_hz); - } - trk_param_fpga.dll_bw_hz = dll_bw_hz; + trk_params_fpga.SetFromConfiguration(configuration, role); - int dll_filter_order = configuration->property(role + ".dll_filter_order", 2); - if (dll_filter_order < 1) + int32_t vector_length = std::round(trk_params_fpga.fs_in / (GALILEO_E5A_CODE_CHIP_RATE_CPS / GALILEO_E5A_CODE_LENGTH_CHIPS)); + trk_params_fpga.vector_length = vector_length; + d_track_pilot = trk_params_fpga.track_pilot; + if (trk_params_fpga.extend_correlation_symbols < 1) { - LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 1."; - dll_filter_order = 1; - } - if (dll_filter_order > 3) - { - LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 3."; - dll_filter_order = 3; - } - trk_param_fpga.dll_filter_order = dll_filter_order; - - int pll_filter_order = configuration->property(role + ".pll_filter_order", 3); - if (pll_filter_order < 2) - { - LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 2."; - pll_filter_order = 2; - } - if (pll_filter_order > 3) - { - LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 3."; - pll_filter_order = 3; - } - trk_param_fpga.pll_filter_order = pll_filter_order; - - if (pll_filter_order == 2) - { - trk_param_fpga.fll_filter_order = 1; - } - if (pll_filter_order == 3) - { - trk_param_fpga.fll_filter_order = 2; - } - - bool enable_fll_pull_in = configuration->property(role + ".enable_fll_pull_in", false); - trk_param_fpga.enable_fll_pull_in = enable_fll_pull_in; - bool enable_fll_steady_state = configuration->property(role + ".enable_fll_steady_state", false); - trk_param_fpga.enable_fll_steady_state = enable_fll_steady_state; - float fll_bw_hz = configuration->property(role + ".fll_bw_hz", 35.0); - trk_param_fpga.fll_bw_hz = fll_bw_hz; - float pull_in_time_s = configuration->property(role + ".pull_in_time_s", trk_param_fpga.pull_in_time_s); - trk_param_fpga.pull_in_time_s = pull_in_time_s; - - float pll_bw_narrow_hz = configuration->property(role + ".pll_bw_narrow_hz", 5.0); - trk_param_fpga.pll_bw_narrow_hz = pll_bw_narrow_hz; - float dll_bw_narrow_hz = configuration->property(role + ".dll_bw_narrow_hz", 2.0); - trk_param_fpga.dll_bw_narrow_hz = dll_bw_narrow_hz; - float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5); - trk_param_fpga.early_late_space_chips = early_late_space_chips; - int32_t vector_length = std::round(fs_in / (GALILEO_E5A_CODE_CHIP_RATE_CPS / GALILEO_E5A_CODE_LENGTH_CHIPS)); - trk_param_fpga.vector_length = vector_length; - int32_t extend_correlation_symbols = configuration->property(role + ".extend_correlation_symbols", 1); - float early_late_space_narrow_chips = configuration->property(role + ".early_late_space_narrow_chips", 0.5); - trk_param_fpga.early_late_space_narrow_chips = early_late_space_narrow_chips; - bool track_pilot = configuration->property(role + ".track_pilot", false); - d_track_pilot = track_pilot; - if (extend_correlation_symbols < 1) - { - extend_correlation_symbols = 1; + trk_params_fpga.extend_correlation_symbols = 1; std::cout << TEXT_RED << "WARNING: Galileo E5a. extend_correlation_symbols must be bigger than 0. Coherent integration has been set to 1 symbol (1 ms)" << TEXT_RESET << std::endl; } - else if (!track_pilot and extend_correlation_symbols > GALILEO_E5A_I_SECONDARY_CODE_LENGTH) + else if (!trk_params_fpga.track_pilot and trk_params_fpga.extend_correlation_symbols > GALILEO_E5A_I_SECONDARY_CODE_LENGTH) { - extend_correlation_symbols = GALILEO_E5A_I_SECONDARY_CODE_LENGTH; + trk_params_fpga.extend_correlation_symbols = GALILEO_E5A_I_SECONDARY_CODE_LENGTH; std::cout << TEXT_RED << "WARNING: Galileo E5a. extend_correlation_symbols must be lower than 21 when tracking the data component. Coherent integration has been set to 20 symbols (20 ms)" << TEXT_RESET << std::endl; } - if ((extend_correlation_symbols > 1) and (pll_bw_narrow_hz > pll_bw_hz or dll_bw_narrow_hz > dll_bw_hz)) + if ((trk_params_fpga.extend_correlation_symbols > 1) and (trk_params_fpga.pll_bw_narrow_hz > trk_params_fpga.pll_bw_hz or trk_params_fpga.dll_bw_narrow_hz > trk_params_fpga.dll_bw_hz)) { std::cout << TEXT_RED << "WARNING: Galileo E5a. PLL or DLL narrow tracking bandwidth is higher than wide tracking one" << TEXT_RESET << std::endl; } - trk_param_fpga.extend_correlation_symbols = extend_correlation_symbols; - trk_param_fpga.track_pilot = track_pilot; - trk_param_fpga.very_early_late_space_chips = 0.0; - trk_param_fpga.very_early_late_space_narrow_chips = 0.0; - trk_param_fpga.system = 'E'; + trk_params_fpga.system = 'E'; std::array sig_{'5', 'X', '\0'}; - std::memcpy(trk_param_fpga.signal, sig_.data(), 3); - trk_param_fpga.cn0_samples = configuration->property(role + ".cn0_samples", trk_param_fpga.cn0_samples); - trk_param_fpga.cn0_min = configuration->property(role + ".cn0_min", trk_param_fpga.cn0_min); - trk_param_fpga.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param_fpga.max_code_lock_fail); - trk_param_fpga.max_carrier_lock_fail = configuration->property(role + ".max_carrier_lock_fail", trk_param_fpga.max_carrier_lock_fail); - trk_param_fpga.carrier_lock_th = configuration->property(role + ".carrier_lock_th", trk_param_fpga.carrier_lock_th); - - // tracking lock tests smoother parameters - trk_param_fpga.cn0_smoother_samples = configuration->property(role + ".cn0_smoother_samples", trk_param_fpga.cn0_smoother_samples); - trk_param_fpga.cn0_smoother_alpha = configuration->property(role + ".cn0_smoother_alpha", trk_param_fpga.cn0_smoother_alpha); - trk_param_fpga.carrier_lock_test_smoother_samples = configuration->property(role + ".carrier_lock_test_smoother_samples", trk_param_fpga.carrier_lock_test_smoother_samples); - trk_param_fpga.carrier_lock_test_smoother_alpha = configuration->property(role + ".carrier_lock_test_smoother_alpha", trk_param_fpga.carrier_lock_test_smoother_alpha); + std::memcpy(trk_params_fpga.signal, sig_.data(), 3); d_data_codes = nullptr; // FPGA configuration parameters - std::string default_device_name = "/dev/uio"; - std::string device_name = configuration->property(role + ".devicename", default_device_name); - trk_param_fpga.device_name = device_name; // obtain the number of the first uio device corresponding to a HW accelerator in the FPGA // that can be assigned to the tracking of the E5a signal - trk_param_fpga.dev_file_num = configuration->property(role + ".dev_file_num", 27); + trk_params_fpga.dev_file_num = configuration->property(role + ".dev_file_num", 27); // compute the number of tracking channels that have already been instantiated. The order in which // GNSS-SDR instantiates the tracking channels i L1, L2, L5, E1, E5a // However E5a can use the same tracking HW accelerators as L5 (but not simultaneously). // Therefore for the proper assignment of the FPGA tracking device file numbers to the E5a tracking channels, // the number of channels that have already been assigned to L5 must not be substracted to this channel number, // so they are not counted here. - trk_param_fpga.num_prev_assigned_ch = configuration->property("Channels_1C.count", 0) + - configuration->property("Channels_2S.count", 0) + - configuration->property("Channels_1B.count", 0); + trk_params_fpga.num_prev_assigned_ch = configuration->property("Channels_1C.count", 0) + + configuration->property("Channels_2S.count", 0) + + configuration->property("Channels_1B.count", 0); // ################# PRE-COMPUTE ALL THE CODES ################# uint32_t code_samples_per_chip = 1; @@ -186,7 +82,7 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga( d_ca_codes = static_cast(volk_gnsssdr_malloc(static_cast(code_length_chips) * code_samples_per_chip * GALILEO_E5A_NUMBER_OF_CODES * sizeof(int32_t), volk_gnsssdr_get_alignment())); - if (trk_param_fpga.track_pilot) + if (trk_params_fpga.track_pilot) { d_data_codes = static_cast(volk_gnsssdr_malloc((static_cast(code_length_chips)) * code_samples_per_chip * GALILEO_E5A_NUMBER_OF_CODES * sizeof(int32_t), volk_gnsssdr_get_alignment())); } @@ -196,7 +92,7 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga( std::array sig_a = {'5', 'X', '\0'}; galileo_e5_a_code_gen_complex_primary(aux_code, PRN, sig_a); - if (trk_param_fpga.track_pilot) + if (trk_params_fpga.track_pilot) { // The code is generated as a series of 1s and -1s. In order to store the values using only one bit, a -1 is stored as a 0 in the FPGA for (uint32_t s = 0; s < code_length_chips; s++) @@ -234,40 +130,40 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga( } } - trk_param_fpga.ca_codes = d_ca_codes; - trk_param_fpga.data_codes = d_data_codes; - trk_param_fpga.code_length_chips = code_length_chips; - trk_param_fpga.code_samples_per_chip = code_samples_per_chip; // 2 sample per chip + trk_params_fpga.ca_codes = d_ca_codes; + trk_params_fpga.data_codes = d_data_codes; + trk_params_fpga.code_length_chips = code_length_chips; + trk_params_fpga.code_samples_per_chip = code_samples_per_chip; // 2 sample per chip - trk_param_fpga.extended_correlation_in_fpga = false; // by default - trk_param_fpga.extend_fpga_integration_periods = 1; // (number of FPGA integrations that are combined in the SW) - trk_param_fpga.fpga_integration_period = 1; // (number of symbols that are effectively integrated in the FPGA) + trk_params_fpga.extended_correlation_in_fpga = false; // by default + trk_params_fpga.extend_fpga_integration_periods = 1; // (number of FPGA integrations that are combined in the SW) + trk_params_fpga.fpga_integration_period = 1; // (number of symbols that are effectively integrated in the FPGA) if (d_track_pilot) { - if (extend_correlation_symbols > 1) + if (trk_params_fpga.extend_correlation_symbols > 1) { - if (extend_correlation_symbols <= GALILEO_E5A_I_SECONDARY_CODE_LENGTH) + if (trk_params_fpga.extend_correlation_symbols <= GALILEO_E5A_I_SECONDARY_CODE_LENGTH) { - if ((GALILEO_E5A_I_SECONDARY_CODE_LENGTH % extend_correlation_symbols) == 0) + if ((GALILEO_E5A_I_SECONDARY_CODE_LENGTH % trk_params_fpga.extend_correlation_symbols) == 0) { - trk_param_fpga.extended_correlation_in_fpga = true; - trk_param_fpga.fpga_integration_period = extend_correlation_symbols; + trk_params_fpga.extended_correlation_in_fpga = true; + trk_params_fpga.fpga_integration_period = trk_params_fpga.extend_correlation_symbols; } } else { - if (extend_correlation_symbols % GALILEO_E5A_I_SECONDARY_CODE_LENGTH == 0) + if (trk_params_fpga.extend_correlation_symbols % GALILEO_E5A_I_SECONDARY_CODE_LENGTH == 0) { - trk_param_fpga.extended_correlation_in_fpga = true; - trk_param_fpga.extend_fpga_integration_periods = extend_correlation_symbols / GALILEO_E5A_I_SECONDARY_CODE_LENGTH; - trk_param_fpga.fpga_integration_period = GALILEO_E5A_I_SECONDARY_CODE_LENGTH; + trk_params_fpga.extended_correlation_in_fpga = true; + trk_params_fpga.extend_fpga_integration_periods = trk_params_fpga.extend_correlation_symbols / GALILEO_E5A_I_SECONDARY_CODE_LENGTH; + trk_params_fpga.fpga_integration_period = GALILEO_E5A_I_SECONDARY_CODE_LENGTH; } } } } // ################# MAKE TRACKING GNURadio object ################### - tracking_fpga_sc = dll_pll_veml_make_tracking_fpga(trk_param_fpga); + tracking_fpga_sc = dll_pll_veml_make_tracking_fpga(trk_params_fpga); channel_ = 0; DLOG(INFO) << "tracking(" << tracking_fpga_sc->unique_id() << ")"; diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc index 1c94bc3f6..ebc27d500 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc @@ -37,146 +37,47 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking( ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { - Dll_Pll_Conf trk_param = Dll_Pll_Conf(); + Dll_Pll_Conf trk_params = Dll_Pll_Conf(); DLOG(INFO) << "role " << role; - // ################# CONFIGURATION PARAMETERS ######################## - std::string default_item_type = "gr_complex"; - std::string item_type = configuration->property(role + ".item_type", default_item_type); - int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); - int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - trk_param.fs_in = fs_in; - trk_param.high_dyn = configuration->property(role + ".high_dyn", false); - if (configuration->property(role + ".smoother_length", 10) < 1) - { - trk_param.smoother_length = 1; - std::cout << TEXT_RED << "WARNING: GPS L1 C/A. smoother_length must be bigger than 0. It has been set to 1" << TEXT_RESET << std::endl; - } - else - { - trk_param.smoother_length = configuration->property(role + ".smoother_length", 10); - } - bool dump = configuration->property(role + ".dump", false); - trk_param.dump = dump; - std::string default_dump_filename = "./track_ch"; - std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); - trk_param.dump_filename = dump_filename; - bool dump_mat = configuration->property(role + ".dump_mat", true); - trk_param.dump_mat = dump_mat; - float pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0); - if (FLAGS_pll_bw_hz != 0.0) - { - pll_bw_hz = static_cast(FLAGS_pll_bw_hz); - } - trk_param.pll_bw_hz = pll_bw_hz; - float pll_bw_narrow_hz = configuration->property(role + ".pll_bw_narrow_hz", 20.0); - trk_param.pll_bw_narrow_hz = pll_bw_narrow_hz; - float dll_bw_narrow_hz = configuration->property(role + ".dll_bw_narrow_hz", 2.0); - trk_param.dll_bw_narrow_hz = dll_bw_narrow_hz; - float dll_bw_hz = configuration->property(role + ".dll_bw_hz", 2.0); - if (FLAGS_dll_bw_hz != 0.0) - { - dll_bw_hz = static_cast(FLAGS_dll_bw_hz); - } - trk_param.dll_bw_hz = dll_bw_hz; + trk_params.SetFromConfiguration(configuration, role); - int dll_filter_order = configuration->property(role + ".dll_filter_order", 2); - if (dll_filter_order < 1) + int vector_length = std::round(trk_params.fs_in / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS)); + trk_params.vector_length = vector_length; + if (trk_params.extend_correlation_symbols < 1) { - LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 1."; - dll_filter_order = 1; - } - if (dll_filter_order > 3) - { - LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 3."; - dll_filter_order = 3; - } - trk_param.dll_filter_order = dll_filter_order; - - int pll_filter_order = configuration->property(role + ".pll_filter_order", 3); - if (pll_filter_order < 2) - { - LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 2."; - pll_filter_order = 2; - } - if (pll_filter_order > 3) - { - LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 3."; - pll_filter_order = 3; - } - trk_param.pll_filter_order = pll_filter_order; - - if (pll_filter_order == 2) - { - trk_param.fll_filter_order = 1; - } - if (pll_filter_order == 3) - { - trk_param.fll_filter_order = 2; - } - - bool enable_fll_pull_in = configuration->property(role + ".enable_fll_pull_in", false); - trk_param.enable_fll_pull_in = enable_fll_pull_in; - bool enable_fll_steady_state = configuration->property(role + ".enable_fll_steady_state", false); - trk_param.enable_fll_steady_state = enable_fll_steady_state; - float fll_bw_hz = configuration->property(role + ".fll_bw_hz", 35.0); - trk_param.fll_bw_hz = fll_bw_hz; - trk_param.pull_in_time_s = configuration->property(role + ".pull_in_time_s", trk_param.pull_in_time_s); - - float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5); - trk_param.early_late_space_chips = early_late_space_chips; - float early_late_space_narrow_chips = configuration->property(role + ".early_late_space_narrow_chips", 0.5); - trk_param.early_late_space_narrow_chips = early_late_space_narrow_chips; - int vector_length = std::round(fs_in / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS)); - trk_param.vector_length = vector_length; - int symbols_extended_correlator = configuration->property(role + ".extend_correlation_symbols", 1); - if (symbols_extended_correlator < 1) - { - symbols_extended_correlator = 1; + trk_params.extend_correlation_symbols = 1; std::cout << TEXT_RED << "WARNING: GPS L1 C/A. extend_correlation_symbols must be bigger than 1. Coherent integration has been set to 1 symbol (1 ms)" << TEXT_RESET << std::endl; } - else if (symbols_extended_correlator > 20) + else if (trk_params.extend_correlation_symbols > 20) { - symbols_extended_correlator = 20; + trk_params.extend_correlation_symbols = 20; std::cout << TEXT_RED << "WARNING: GPS L1 C/A. extend_correlation_symbols must be lower than 21. Coherent integration has been set to 20 symbols (20 ms)" << TEXT_RESET << std::endl; } - trk_param.extend_correlation_symbols = symbols_extended_correlator; - bool track_pilot = configuration->property(role + ".track_pilot", false); - if (track_pilot) + trk_params.track_pilot = configuration->property(role + ".track_pilot", false); + if (trk_params.track_pilot) { + trk_params.track_pilot = false; std::cout << TEXT_RED << "WARNING: GPS L1 C/A does not have pilot signal. Data tracking has been enabled" << TEXT_RESET << std::endl; } - if ((symbols_extended_correlator > 1) and (pll_bw_narrow_hz > pll_bw_hz or dll_bw_narrow_hz > dll_bw_hz)) + if ((trk_params.extend_correlation_symbols > 1) and (trk_params.pll_bw_narrow_hz > trk_params.pll_bw_hz or trk_params.dll_bw_narrow_hz > trk_params.dll_bw_hz)) { std::cout << TEXT_RED << "WARNING: GPS L1 C/A. PLL or DLL narrow tracking bandwidth is higher than wide tracking one" << TEXT_RESET << std::endl; } - trk_param.very_early_late_space_chips = 0.0; - trk_param.very_early_late_space_narrow_chips = 0.0; - trk_param.track_pilot = false; - trk_param.system = 'G'; + + trk_params.system = 'G'; std::array sig_{'1', 'C', '\0'}; - std::memcpy(trk_param.signal, sig_.data(), 3); - trk_param.cn0_samples = configuration->property(role + ".cn0_samples", trk_param.cn0_samples); - trk_param.cn0_min = configuration->property(role + ".cn0_min", trk_param.cn0_min); - trk_param.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param.max_code_lock_fail); - trk_param.max_carrier_lock_fail = configuration->property(role + ".max_carrier_lock_fail", trk_param.max_carrier_lock_fail); - trk_param.carrier_lock_th = configuration->property(role + ".carrier_lock_th", trk_param.carrier_lock_th); + std::memcpy(trk_params.signal, sig_.data(), 3); - // tracking lock tests smoother parameters - trk_param.cn0_smoother_samples = configuration->property(role + ".cn0_smoother_samples", trk_param.cn0_smoother_samples); - trk_param.cn0_smoother_alpha = configuration->property(role + ".cn0_smoother_alpha", trk_param.cn0_smoother_alpha); - trk_param.carrier_lock_test_smoother_samples = configuration->property(role + ".carrier_lock_test_smoother_samples", trk_param.carrier_lock_test_smoother_samples); - trk_param.carrier_lock_test_smoother_alpha = configuration->property(role + ".carrier_lock_test_smoother_alpha", trk_param.carrier_lock_test_smoother_alpha); - - // ################# MAKE TRACKING GNURadio object ################### - if (item_type == "gr_complex") + // ################# Make a GNU Radio Tracking block object ################ + if (trk_params.item_type == "gr_complex") { item_size_ = sizeof(gr_complex); - tracking_ = dll_pll_veml_make_tracking(trk_param); + tracking_ = dll_pll_veml_make_tracking(trk_params); } else { item_size_ = sizeof(gr_complex); - LOG(WARNING) << item_type << " unknown tracking item type."; + LOG(WARNING) << trk_params.item_type << " unknown tracking item type."; } channel_ = 0; DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc index a7823dad5..490977909 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc @@ -38,145 +38,43 @@ GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga( ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { - Dll_Pll_Conf_Fpga trk_param_fpga = Dll_Pll_Conf_Fpga(); + Dll_Pll_Conf_Fpga trk_params_fpga = Dll_Pll_Conf_Fpga(); DLOG(INFO) << "role " << role; - // ################# CONFIGURATION PARAMETERS ######################## - int32_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 12500000); - int32_t fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - trk_param_fpga.fs_in = fs_in; - trk_param_fpga.high_dyn = configuration->property(role + ".high_dyn", false); - if (configuration->property(role + ".smoother_length", 10) < 1) - { - trk_param_fpga.smoother_length = 1; - std::cout << TEXT_RED << "WARNING: GPS L1 C/A. smoother_length must be bigger than 0. It has been set to 1" << TEXT_RESET << std::endl; - } - else - { - trk_param_fpga.smoother_length = configuration->property(role + ".smoother_length", 10); - } - bool dump = configuration->property(role + ".dump", false); - trk_param_fpga.dump = dump; - std::string default_dump_filename = "./track_ch"; - std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); - trk_param_fpga.dump_filename = dump_filename; - bool dump_mat = configuration->property(role + ".dump_mat", true); - trk_param_fpga.dump_mat = dump_mat; - float pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0); - if (FLAGS_pll_bw_hz != 0.0) - { - pll_bw_hz = static_cast(FLAGS_pll_bw_hz); - } - trk_param_fpga.pll_bw_hz = pll_bw_hz; - float pll_bw_narrow_hz = configuration->property(role + ".pll_bw_narrow_hz", 20.0); - trk_param_fpga.pll_bw_narrow_hz = pll_bw_narrow_hz; - float dll_bw_narrow_hz = configuration->property(role + ".dll_bw_narrow_hz", 2.0); - trk_param_fpga.dll_bw_narrow_hz = dll_bw_narrow_hz; - float dll_bw_hz = configuration->property(role + ".dll_bw_hz", 2.0); - if (FLAGS_dll_bw_hz != 0.0) - { - dll_bw_hz = static_cast(FLAGS_dll_bw_hz); - } - trk_param_fpga.dll_bw_hz = dll_bw_hz; + trk_params_fpga.SetFromConfiguration(configuration, role); - int dll_filter_order = configuration->property(role + ".dll_filter_order", 2); - if (dll_filter_order < 1) + int32_t vector_length = std::round(trk_params_fpga.fs_in / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS)); + trk_params_fpga.vector_length = vector_length; + if (trk_params_fpga.extend_correlation_symbols < 1) { - LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 1."; - dll_filter_order = 1; - } - if (dll_filter_order > 3) - { - LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 3."; - dll_filter_order = 3; - } - trk_param_fpga.dll_filter_order = dll_filter_order; - - int pll_filter_order = configuration->property(role + ".pll_filter_order", 3); - if (pll_filter_order < 2) - { - LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 2."; - pll_filter_order = 2; - } - if (pll_filter_order > 3) - { - LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 3."; - pll_filter_order = 3; - } - trk_param_fpga.pll_filter_order = pll_filter_order; - - if (pll_filter_order == 2) - { - trk_param_fpga.fll_filter_order = 1; - } - if (pll_filter_order == 3) - { - trk_param_fpga.fll_filter_order = 2; - } - - bool enable_fll_pull_in = configuration->property(role + ".enable_fll_pull_in", false); - trk_param_fpga.enable_fll_pull_in = enable_fll_pull_in; - bool enable_fll_steady_state = configuration->property(role + ".enable_fll_steady_state", false); - trk_param_fpga.enable_fll_steady_state = enable_fll_steady_state; - float fll_bw_hz = configuration->property(role + ".fll_bw_hz", 35.0); - trk_param_fpga.fll_bw_hz = fll_bw_hz; - float pull_in_time_s = configuration->property(role + ".pull_in_time_s", trk_param_fpga.pull_in_time_s); - trk_param_fpga.pull_in_time_s = pull_in_time_s; - - float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5); - trk_param_fpga.early_late_space_chips = early_late_space_chips; - float early_late_space_narrow_chips = configuration->property(role + ".early_late_space_narrow_chips", 0.5); - trk_param_fpga.early_late_space_narrow_chips = early_late_space_narrow_chips; - int32_t vector_length = std::round(fs_in / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS)); - trk_param_fpga.vector_length = vector_length; - int32_t symbols_extended_correlator = configuration->property(role + ".extend_correlation_symbols", 1); - if (symbols_extended_correlator < 1) - { - symbols_extended_correlator = 1; + trk_params_fpga.extend_correlation_symbols = 1; std::cout << TEXT_RED << "WARNING: GPS L1 C/A. extend_correlation_symbols must be bigger than 1. Coherent integration has been set to 1 symbol (1 ms)" << TEXT_RESET << std::endl; } - else if (symbols_extended_correlator > GPS_CA_BIT_DURATION_MS) + else if (trk_params_fpga.extend_correlation_symbols > GPS_CA_BIT_DURATION_MS) { - symbols_extended_correlator = GPS_CA_BIT_DURATION_MS; + trk_params_fpga.extend_correlation_symbols = GPS_CA_BIT_DURATION_MS; std::cout << TEXT_RED << "WARNING: GPS L1 C/A. extend_correlation_symbols must be lower than 21. Coherent integration has been set to 20 symbols (20 ms)" << TEXT_RESET << std::endl; } - trk_param_fpga.extend_correlation_symbols = symbols_extended_correlator; - bool track_pilot = configuration->property(role + ".track_pilot", false); - if (track_pilot) + trk_params_fpga.track_pilot = configuration->property(role + ".track_pilot", false); + if (trk_params_fpga.track_pilot) { + trk_params_fpga.track_pilot = false; std::cout << TEXT_RED << "WARNING: GPS L1 C/A does not have pilot signal. Data tracking has been enabled" << TEXT_RESET << std::endl; } - if ((symbols_extended_correlator > 1) and (pll_bw_narrow_hz > pll_bw_hz or dll_bw_narrow_hz > dll_bw_hz)) + if ((trk_params_fpga.extend_correlation_symbols > 1) and (trk_params_fpga.pll_bw_narrow_hz > trk_params_fpga.pll_bw_hz or trk_params_fpga.dll_bw_narrow_hz > trk_params_fpga.dll_bw_hz)) { std::cout << TEXT_RED << "WARNING: GPS L1 C/A. PLL or DLL narrow tracking bandwidth is higher than wide tracking one" << TEXT_RESET << std::endl; } - trk_param_fpga.very_early_late_space_chips = 0.0; - trk_param_fpga.very_early_late_space_narrow_chips = 0.0; - trk_param_fpga.track_pilot = false; - trk_param_fpga.system = 'G'; + trk_params_fpga.system = 'G'; std::array sig_{'1', 'C', '\0'}; - std::memcpy(trk_param_fpga.signal, sig_.data(), 3); - trk_param_fpga.cn0_samples = configuration->property(role + ".cn0_samples", trk_param_fpga.cn0_samples); - trk_param_fpga.cn0_min = configuration->property(role + ".cn0_min", trk_param_fpga.cn0_min); - trk_param_fpga.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param_fpga.max_code_lock_fail); - trk_param_fpga.max_carrier_lock_fail = configuration->property(role + ".max_carrier_lock_fail", trk_param_fpga.max_carrier_lock_fail); - trk_param_fpga.carrier_lock_th = configuration->property(role + ".carrier_lock_th", trk_param_fpga.carrier_lock_th); - - // tracking lock tests smoother parameters - trk_param_fpga.cn0_smoother_samples = configuration->property(role + ".cn0_smoother_samples", trk_param_fpga.cn0_smoother_samples); - trk_param_fpga.cn0_smoother_alpha = configuration->property(role + ".cn0_smoother_alpha", trk_param_fpga.cn0_smoother_alpha); - trk_param_fpga.carrier_lock_test_smoother_samples = configuration->property(role + ".carrier_lock_test_smoother_samples", trk_param_fpga.carrier_lock_test_smoother_samples); - trk_param_fpga.carrier_lock_test_smoother_alpha = configuration->property(role + ".carrier_lock_test_smoother_alpha", trk_param_fpga.carrier_lock_test_smoother_alpha); + std::memcpy(trk_params_fpga.signal, sig_.data(), 3); // FPGA configuration parameters - std::string default_device_name = "/dev/uio"; - std::string device_name = configuration->property(role + ".devicename", default_device_name); - trk_param_fpga.device_name = device_name; // obtain the number of the first uio device corresponding to a HW accelerator in the FPGA // that can be assigned to the tracking of the L1 signal - trk_param_fpga.dev_file_num = configuration->property(role + ".dev_file_num", 3); + trk_params_fpga.dev_file_num = configuration->property(role + ".dev_file_num", 3); // compute the number of tracking channels that have already been instantiated. The order in which // GNSS-SDR instantiates the tracking channels i L1, l2, L5, E1, E5a - trk_param_fpga.num_prev_assigned_ch = 0; + trk_params_fpga.num_prev_assigned_ch = 0; // ################# PRE-COMPUTE ALL THE CODES ################# d_ca_codes = static_cast(volk_gnsssdr_malloc(static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS * NUM_PRNs) * sizeof(int32_t), volk_gnsssdr_get_alignment())); @@ -196,27 +94,27 @@ GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga( d_ca_codes[(int32_t(GPS_L1_CA_CODE_LENGTH_CHIPS)) * (PRN - 1) + k] = tmp_value; } } - trk_param_fpga.ca_codes = d_ca_codes; - trk_param_fpga.code_length_chips = GPS_L1_CA_CODE_LENGTH_CHIPS; - trk_param_fpga.code_samples_per_chip = 1; // 1 sample per chip + trk_params_fpga.ca_codes = d_ca_codes; + trk_params_fpga.code_length_chips = GPS_L1_CA_CODE_LENGTH_CHIPS; + trk_params_fpga.code_samples_per_chip = 1; // 1 sample per chip - trk_param_fpga.extended_correlation_in_fpga = false; // by default - trk_param_fpga.extend_fpga_integration_periods = 1; // (number of FPGA integrations that are combined in the SW) - trk_param_fpga.fpga_integration_period = 1; // (number of symbols that are effectively integrated in the FPGA) - if (symbols_extended_correlator > 1) + trk_params_fpga.extended_correlation_in_fpga = false; // by default + trk_params_fpga.extend_fpga_integration_periods = 1; // (number of FPGA integrations that are combined in the SW) + trk_params_fpga.fpga_integration_period = 1; // (number of symbols that are effectively integrated in the FPGA) + if (trk_params_fpga.extend_correlation_symbols > 1) { - if (symbols_extended_correlator <= GPS_CA_BIT_DURATION_MS) + if (trk_params_fpga.extend_correlation_symbols <= GPS_CA_BIT_DURATION_MS) { - if ((GPS_CA_BIT_DURATION_MS % symbols_extended_correlator) == 0) + if ((GPS_CA_BIT_DURATION_MS % trk_params_fpga.extend_correlation_symbols) == 0) { - trk_param_fpga.extended_correlation_in_fpga = true; - trk_param_fpga.fpga_integration_period = symbols_extended_correlator; + trk_params_fpga.extended_correlation_in_fpga = true; + trk_params_fpga.fpga_integration_period = trk_params_fpga.extend_correlation_symbols; } } } - // ################# MAKE TRACKING GNURadio object ################### - tracking_fpga_sc = dll_pll_veml_make_tracking_fpga(trk_param_fpga); + // ################# MAKE TRACKING GNU Radio object ################### + tracking_fpga_sc = dll_pll_veml_make_tracking_fpga(trk_params_fpga); channel_ = 0; DLOG(INFO) << "tracking(" << tracking_fpga_sc->unique_id() << ")"; diff --git a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc index be6029ab4..3bcdcd4e5 100644 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc @@ -36,123 +36,37 @@ GpsL2MDllPllTracking::GpsL2MDllPllTracking( ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { - Dll_Pll_Conf trk_param = Dll_Pll_Conf(); + Dll_Pll_Conf trk_params = Dll_Pll_Conf(); DLOG(INFO) << "role " << role; - // ################# CONFIGURATION PARAMETERS ######################## - std::string default_item_type = "gr_complex"; - std::string item_type = configuration->property(role + ".item_type", default_item_type); - int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); - int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - trk_param.fs_in = fs_in; - bool dump = configuration->property(role + ".dump", false); - trk_param.dump = dump; - std::string default_dump_filename = "./track_ch"; - std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); - trk_param.dump_filename = dump_filename; - bool dump_mat = configuration->property(role + ".dump_mat", true); - trk_param.dump_mat = dump_mat; - float pll_bw_hz = configuration->property(role + ".pll_bw_hz", 2.0); - if (FLAGS_pll_bw_hz != 0.0) - { - pll_bw_hz = static_cast(FLAGS_pll_bw_hz); - } - trk_param.pll_bw_hz = pll_bw_hz; - float dll_bw_hz = configuration->property(role + ".dll_bw_hz", 0.75); - if (FLAGS_dll_bw_hz != 0.0) - { - dll_bw_hz = static_cast(FLAGS_dll_bw_hz); - } - trk_param.dll_bw_hz = dll_bw_hz; - float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5); - trk_param.early_late_space_chips = early_late_space_chips; - trk_param.early_late_space_narrow_chips = 0.0; + trk_params.SetFromConfiguration(configuration, role); - int dll_filter_order = configuration->property(role + ".dll_filter_order", 2); - if (dll_filter_order < 1) - { - LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 1."; - dll_filter_order = 1; - } - if (dll_filter_order > 3) - { - LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 3."; - dll_filter_order = 3; - } - trk_param.dll_filter_order = dll_filter_order; - - int pll_filter_order = configuration->property(role + ".pll_filter_order", 3); - if (pll_filter_order < 2) - { - LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 2."; - pll_filter_order = 2; - } - if (pll_filter_order > 3) - { - LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 3."; - pll_filter_order = 3; - } - trk_param.pll_filter_order = pll_filter_order; - - if (pll_filter_order == 2) - { - trk_param.fll_filter_order = 1; - } - if (pll_filter_order == 3) - { - trk_param.fll_filter_order = 2; - } - - bool enable_fll_pull_in = configuration->property(role + ".enable_fll_pull_in", false); - trk_param.enable_fll_pull_in = enable_fll_pull_in; - bool enable_fll_steady_state = configuration->property(role + ".enable_fll_steady_state", false); - trk_param.enable_fll_steady_state = enable_fll_steady_state; - float fll_bw_hz = configuration->property(role + ".fll_bw_hz", 35.0); - trk_param.fll_bw_hz = fll_bw_hz; - trk_param.pull_in_time_s = configuration->property(role + ".pull_in_time_s", trk_param.pull_in_time_s); - - int vector_length = std::round(static_cast(fs_in) / (static_cast(GPS_L2_M_CODE_RATE_CPS) / static_cast(GPS_L2_M_CODE_LENGTH_CHIPS))); - trk_param.vector_length = vector_length; - int symbols_extended_correlator = configuration->property(role + ".extend_correlation_symbols", 1); - if (symbols_extended_correlator != 1) + int vector_length = std::round(static_cast(trk_params.fs_in) / (static_cast(GPS_L2_M_CODE_RATE_CPS) / static_cast(GPS_L2_M_CODE_LENGTH_CHIPS))); + trk_params.vector_length = vector_length; + if (trk_params.extend_correlation_symbols != 1) { + trk_params.extend_correlation_symbols = 1; std::cout << TEXT_RED << "WARNING: Extended coherent integration is not allowed in GPS L2. Coherent integration has been set to 20 ms (1 symbol)" << TEXT_RESET << std::endl; } - trk_param.extend_correlation_symbols = 1; - bool track_pilot = configuration->property(role + ".track_pilot", false); - if (track_pilot) + trk_params.track_pilot = configuration->property(role + ".track_pilot", false); + if (trk_params.track_pilot) { + trk_params.track_pilot = false; std::cout << TEXT_RED << "WARNING: GPS L2 does not have pilot signal. Data tracking has been enabled" << TEXT_RESET << std::endl; } - trk_param.track_pilot = false; - trk_param.very_early_late_space_chips = 0.0; - trk_param.very_early_late_space_narrow_chips = 0.0; - trk_param.pll_bw_narrow_hz = 0.0; - trk_param.dll_bw_narrow_hz = 0.0; - trk_param.system = 'G'; + trk_params.system = 'G'; std::array sig_{'2', 'S', '\0'}; - std::memcpy(trk_param.signal, sig_.data(), 3); - trk_param.cn0_samples = configuration->property(role + ".cn0_samples", trk_param.cn0_samples); - trk_param.cn0_min = configuration->property(role + ".cn0_min", trk_param.cn0_min); - trk_param.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param.max_code_lock_fail); - trk_param.max_carrier_lock_fail = configuration->property(role + ".max_carrier_lock_fail", trk_param.max_carrier_lock_fail); - trk_param.carrier_lock_th = configuration->property(role + ".carrier_lock_th", trk_param.carrier_lock_th); + std::memcpy(trk_params.signal, sig_.data(), 3); - // tracking lock tests smoother parameters - trk_param.cn0_smoother_samples = configuration->property(role + ".cn0_smoother_samples", trk_param.cn0_smoother_samples); - trk_param.cn0_smoother_alpha = configuration->property(role + ".cn0_smoother_alpha", trk_param.cn0_smoother_alpha); - trk_param.carrier_lock_test_smoother_samples = configuration->property(role + ".carrier_lock_test_smoother_samples", trk_param.carrier_lock_test_smoother_samples); - trk_param.carrier_lock_test_smoother_alpha = configuration->property(role + ".carrier_lock_test_smoother_alpha", trk_param.carrier_lock_test_smoother_alpha); - - // ################# MAKE TRACKING GNURadio object ################### - if (item_type == "gr_complex") + // ################# Make a GNU Radio Tracking block object ################ + if (trk_params.item_type == "gr_complex") { item_size_ = sizeof(gr_complex); - tracking_ = dll_pll_veml_make_tracking(trk_param); + tracking_ = dll_pll_veml_make_tracking(trk_params); } else { item_size_ = sizeof(gr_complex); - LOG(WARNING) << item_type << " unknown tracking item type."; + LOG(WARNING) << trk_params.item_type << " unknown tracking item type."; } channel_ = 0; DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; diff --git a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc index a53c1c0c2..07e398275 100644 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc @@ -43,74 +43,35 @@ GpsL2MDllPllTrackingFpga::GpsL2MDllPllTrackingFpga( ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { - Dll_Pll_Conf_Fpga trk_param_fpga = Dll_Pll_Conf_Fpga(); + Dll_Pll_Conf_Fpga trk_params_fpga = Dll_Pll_Conf_Fpga(); DLOG(INFO) << "role " << role; - // ################# CONFIGURATION PARAMETERS ######################## - int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); - int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - trk_param_fpga.fs_in = fs_in; - bool dump = configuration->property(role + ".dump", false); - trk_param_fpga.dump = dump; - std::string default_dump_filename = "./track_ch"; - std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); - trk_param_fpga.dump_filename = dump_filename; - bool dump_mat = configuration->property(role + ".dump_mat", true); - trk_param_fpga.dump_mat = dump_mat; - float pll_bw_hz = configuration->property(role + ".pll_bw_hz", 2.0); - if (FLAGS_pll_bw_hz != 0.0) - { - pll_bw_hz = static_cast(FLAGS_pll_bw_hz); - } - trk_param_fpga.pll_bw_hz = pll_bw_hz; - float dll_bw_hz = configuration->property(role + ".dll_bw_hz", 0.75); - if (FLAGS_dll_bw_hz != 0.0) - { - dll_bw_hz = static_cast(FLAGS_dll_bw_hz); - } - trk_param_fpga.dll_bw_hz = dll_bw_hz; - float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5); - trk_param_fpga.early_late_space_chips = early_late_space_chips; - trk_param_fpga.early_late_space_narrow_chips = 0.0; - int vector_length = std::round(static_cast(fs_in) / (static_cast(GPS_L2_M_CODE_RATE_CPS) / static_cast(GPS_L2_M_CODE_LENGTH_CHIPS))); - trk_param_fpga.vector_length = vector_length; - int symbols_extended_correlator = configuration->property(role + ".extend_correlation_symbols", 1); - if (symbols_extended_correlator != 1) + trk_params_fpga.SetFromConfiguration(configuration, role); + + int vector_length = std::round(static_cast(trk_params_fpga.fs_in) / (static_cast(GPS_L2_M_CODE_RATE_CPS) / static_cast(GPS_L2_M_CODE_LENGTH_CHIPS))); + trk_params_fpga.vector_length = vector_length; + trk_params_fpga.extend_correlation_symbols = configuration->property(role + ".extend_correlation_symbols", 1); + if (trk_params_fpga.extend_correlation_symbols != 1) { + trk_params_fpga.extend_correlation_symbols = 1; std::cout << TEXT_RED << "WARNING: Extended coherent integration is not allowed in GPS L2. Coherent integration has been set to 20 ms (1 symbol)" << TEXT_RESET << std::endl; } - trk_param_fpga.extend_correlation_symbols = 1; - bool track_pilot = configuration->property(role + ".track_pilot", false); - if (track_pilot) + + trk_params_fpga.track_pilot = configuration->property(role + ".track_pilot", false); + if (trk_params_fpga.track_pilot) { + trk_params_fpga.track_pilot = false; std::cout << TEXT_RED << "WARNING: GPS L2 does not have pilot signal. Data tracking has been enabled" << TEXT_RESET << std::endl; } - trk_param_fpga.track_pilot = false; - trk_param_fpga.very_early_late_space_chips = 0.0; - trk_param_fpga.very_early_late_space_narrow_chips = 0.0; - trk_param_fpga.pll_bw_narrow_hz = 0.0; - trk_param_fpga.dll_bw_narrow_hz = 0.0; - trk_param_fpga.system = 'G'; + trk_params_fpga.system = 'G'; std::array sig_{'2', 'S', '\0'}; - std::memcpy(trk_param_fpga.signal, sig_.data(), 3); - trk_param_fpga.cn0_samples = configuration->property(role + ".cn0_samples", trk_param_fpga.cn0_samples); - trk_param_fpga.cn0_min = configuration->property(role + ".cn0_min", trk_param_fpga.cn0_min); - trk_param_fpga.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param_fpga.max_code_lock_fail); - trk_param_fpga.max_carrier_lock_fail = configuration->property(role + ".max_carrier_lock_fail", trk_param_fpga.max_carrier_lock_fail); - trk_param_fpga.carrier_lock_th = configuration->property(role + ".carrier_lock_th", trk_param_fpga.carrier_lock_th); - trk_param_fpga.cn0_smoother_samples = configuration->property(role + ".cn0_smoother_samples", trk_param_fpga.cn0_smoother_samples); - trk_param_fpga.cn0_smoother_alpha = configuration->property(role + ".cn0_smoother_alpha", trk_param_fpga.cn0_smoother_alpha); - trk_param_fpga.carrier_lock_test_smoother_samples = configuration->property(role + ".carrier_lock_test_smoother_samples", trk_param_fpga.carrier_lock_test_smoother_samples); - trk_param_fpga.carrier_lock_test_smoother_alpha = configuration->property(role + ".carrier_lock_test_smoother_alpha", trk_param_fpga.carrier_lock_test_smoother_alpha); + std::memcpy(trk_params_fpga.signal, sig_.data(), 3); // FPGA configuration parameters - std::string default_device_name = "/dev/uio"; - std::string device_name = configuration->property(role + ".devicename", default_device_name); - trk_param_fpga.device_name = device_name; // obtain the number of the first uio device file that is assigned to the FPGA L2 tracking multicorrelator HW accelerators - trk_param_fpga.dev_file_num = configuration->property(role + ".dev_file_num", 27); + trk_params_fpga.dev_file_num = configuration->property(role + ".dev_file_num", 27); // compute the number of tracking channels that have already been instantiated. The order in which // GNSS-SDR instantiates the tracking channels i L1, L2, L5, E1, E5a - trk_param_fpga.num_prev_assigned_ch = configuration->property("Channels_1C.count", 0); + trk_params_fpga.num_prev_assigned_ch = configuration->property("Channels_1C.count", 0); volk_gnsssdr::vector ca_codes_f(static_cast(GPS_L2_M_CODE_LENGTH_CHIPS), 0.0); // ################# PRE-COMPUTE ALL THE CODES ################# @@ -124,12 +85,12 @@ GpsL2MDllPllTrackingFpga::GpsL2MDllPllTrackingFpga( } } - trk_param_fpga.ca_codes = d_ca_codes; - trk_param_fpga.code_length_chips = GPS_L2_M_CODE_LENGTH_CHIPS; - trk_param_fpga.code_samples_per_chip = 1; // 1 sample per chip + trk_params_fpga.ca_codes = d_ca_codes; + trk_params_fpga.code_length_chips = GPS_L2_M_CODE_LENGTH_CHIPS; + trk_params_fpga.code_samples_per_chip = 1; // 1 sample per chip // ################# MAKE TRACKING GNU Radio object ################### - tracking_fpga_sc = dll_pll_veml_make_tracking_fpga(trk_param_fpga); + tracking_fpga_sc = dll_pll_veml_make_tracking_fpga(trk_params_fpga); channel_ = 0; DLOG(INFO) << "tracking(" << tracking_fpga_sc->unique_id() << ")"; diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc index 2093ce003..a0eebcfa2 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc @@ -36,143 +36,40 @@ GpsL5DllPllTracking::GpsL5DllPllTracking( ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { - Dll_Pll_Conf trk_param = Dll_Pll_Conf(); + Dll_Pll_Conf trk_params = Dll_Pll_Conf(); DLOG(INFO) << "role " << role; - // ################# CONFIGURATION PARAMETERS ######################## - std::string default_item_type = "gr_complex"; - std::string item_type = configuration->property(role + ".item_type", default_item_type); - int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); - int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - trk_param.fs_in = fs_in; - bool dump = configuration->property(role + ".dump", false); - trk_param.dump = dump; - std::string default_dump_filename = "./track_ch"; - std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); - trk_param.dump_filename = dump_filename; - bool dump_mat = configuration->property(role + ".dump_mat", true); - trk_param.dump_mat = dump_mat; - trk_param.high_dyn = configuration->property(role + ".high_dyn", false); - if (configuration->property(role + ".smoother_length", 10) < 1) - { - trk_param.smoother_length = 1; - std::cout << TEXT_RED << "WARNING: GPS L5. smoother_length must be bigger than 0. It has been set to 1" << TEXT_RESET << std::endl; - } - else - { - trk_param.smoother_length = configuration->property(role + ".smoother_length", 10); - } - float pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0); - if (FLAGS_pll_bw_hz != 0.0) - { - pll_bw_hz = static_cast(FLAGS_pll_bw_hz); - } - trk_param.pll_bw_hz = pll_bw_hz; - float dll_bw_hz = configuration->property(role + ".dll_bw_hz", 2.0); - if (FLAGS_dll_bw_hz != 0.0) - { - dll_bw_hz = static_cast(FLAGS_dll_bw_hz); - } - trk_param.dll_bw_hz = dll_bw_hz; - float pll_bw_narrow_hz = configuration->property(role + ".pll_bw_narrow_hz", 2.0); - trk_param.pll_bw_narrow_hz = pll_bw_narrow_hz; - float dll_bw_narrow_hz = configuration->property(role + ".dll_bw_narrow_hz", 0.25); - trk_param.dll_bw_narrow_hz = dll_bw_narrow_hz; - float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5); - trk_param.early_late_space_chips = early_late_space_chips; + trk_params.SetFromConfiguration(configuration, role); - int dll_filter_order = configuration->property(role + ".dll_filter_order", 2); - if (dll_filter_order < 1) + int vector_length = std::round(static_cast(trk_params.fs_in) / (static_cast(GPS_L5I_CODE_RATE_CPS) / static_cast(GPS_L5I_CODE_LENGTH_CHIPS))); + trk_params.vector_length = vector_length; + if (trk_params.extend_correlation_symbols < 1) { - LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 1."; - dll_filter_order = 1; - } - if (dll_filter_order > 3) - { - LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 3."; - dll_filter_order = 3; - } - trk_param.dll_filter_order = dll_filter_order; - - int pll_filter_order = configuration->property(role + ".pll_filter_order", 3); - if (pll_filter_order < 2) - { - LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 2."; - pll_filter_order = 2; - } - if (pll_filter_order > 3) - { - LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 3."; - pll_filter_order = 3; - } - trk_param.pll_filter_order = pll_filter_order; - - if (pll_filter_order == 2) - { - trk_param.fll_filter_order = 1; - } - if (pll_filter_order == 3) - { - trk_param.fll_filter_order = 2; - } - - bool enable_fll_pull_in = configuration->property(role + ".enable_fll_pull_in", false); - trk_param.enable_fll_pull_in = enable_fll_pull_in; - bool enable_fll_steady_state = configuration->property(role + ".enable_fll_steady_state", false); - trk_param.enable_fll_steady_state = enable_fll_steady_state; - float fll_bw_hz = configuration->property(role + ".fll_bw_hz", 35.0); - trk_param.fll_bw_hz = fll_bw_hz; - trk_param.pull_in_time_s = configuration->property(role + ".pull_in_time_s", trk_param.pull_in_time_s); - - int vector_length = std::round(static_cast(fs_in) / (static_cast(GPS_L5I_CODE_RATE_CPS) / static_cast(GPS_L5I_CODE_LENGTH_CHIPS))); - trk_param.vector_length = vector_length; - int extend_correlation_symbols = configuration->property(role + ".extend_correlation_symbols", 1); - float early_late_space_narrow_chips = configuration->property(role + ".early_late_space_narrow_chips", 0.5); - trk_param.early_late_space_narrow_chips = early_late_space_narrow_chips; - bool track_pilot = configuration->property(role + ".track_pilot", false); - if (extend_correlation_symbols < 1) - { - extend_correlation_symbols = 1; + trk_params.extend_correlation_symbols = 1; std::cout << TEXT_RED << "WARNING: GPS L5. extend_correlation_symbols must be bigger than 0. Coherent integration has been set to 1 symbol (1 ms)" << TEXT_RESET << std::endl; } - else if (!track_pilot and extend_correlation_symbols > GPS_L5I_NH_CODE_LENGTH) + else if (!trk_params.track_pilot and trk_params.extend_correlation_symbols > GPS_L5I_NH_CODE_LENGTH) { - extend_correlation_symbols = GPS_L5I_NH_CODE_LENGTH; + trk_params.extend_correlation_symbols = GPS_L5I_NH_CODE_LENGTH; std::cout << TEXT_RED << "WARNING: GPS L5. extend_correlation_symbols must be lower than 11 when tracking the data component. Coherent integration has been set to 10 symbols (10 ms)" << TEXT_RESET << std::endl; } - if ((extend_correlation_symbols > 1) and (pll_bw_narrow_hz > pll_bw_hz or dll_bw_narrow_hz > dll_bw_hz)) + if ((trk_params.extend_correlation_symbols > 1) and (trk_params.pll_bw_narrow_hz > trk_params.pll_bw_hz or trk_params.dll_bw_narrow_hz > trk_params.dll_bw_hz)) { std::cout << TEXT_RED << "WARNING: GPS L5. PLL or DLL narrow tracking bandwidth is higher than wide tracking one" << TEXT_RESET << std::endl; } - trk_param.extend_correlation_symbols = extend_correlation_symbols; - trk_param.track_pilot = track_pilot; - trk_param.very_early_late_space_chips = 0.0; - trk_param.very_early_late_space_narrow_chips = 0.0; - trk_param.system = 'G'; + trk_params.system = 'G'; std::array sig_{'L', '5', '\0'}; - std::memcpy(trk_param.signal, sig_.data(), 3); + std::memcpy(trk_params.signal, sig_.data(), 3); - trk_param.cn0_samples = configuration->property(role + ".cn0_samples", trk_param.cn0_samples); - trk_param.cn0_min = configuration->property(role + ".cn0_min", trk_param.cn0_min); - trk_param.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param.max_code_lock_fail); - trk_param.max_carrier_lock_fail = configuration->property(role + ".max_carrier_lock_fail", trk_param.max_carrier_lock_fail); - trk_param.carrier_lock_th = configuration->property(role + ".carrier_lock_th", trk_param.carrier_lock_th); - - // tracking lock tests smoother parameters - trk_param.cn0_smoother_samples = configuration->property(role + ".cn0_smoother_samples", trk_param.cn0_smoother_samples); - trk_param.cn0_smoother_alpha = configuration->property(role + ".cn0_smoother_alpha", trk_param.cn0_smoother_alpha); - trk_param.carrier_lock_test_smoother_samples = configuration->property(role + ".carrier_lock_test_smoother_samples", trk_param.carrier_lock_test_smoother_samples); - trk_param.carrier_lock_test_smoother_alpha = configuration->property(role + ".carrier_lock_test_smoother_alpha", trk_param.carrier_lock_test_smoother_alpha); - - // ################# MAKE TRACKING GNURadio object ################### - if (item_type == "gr_complex") + // ################# Make a GNU Radio Tracking block object ################ + if (trk_params.item_type == "gr_complex") { item_size_ = sizeof(gr_complex); - tracking_ = dll_pll_veml_make_tracking(trk_param); + tracking_ = dll_pll_veml_make_tracking(trk_params); } else { item_size_ = sizeof(gr_complex); - LOG(WARNING) << item_type << " unknown tracking item type."; + LOG(WARNING) << trk_params.item_type << " unknown tracking item type."; } channel_ = 0; DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc index 81438430c..d0d2a2996 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc @@ -40,143 +40,39 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga( ConfigurationInterface *configuration, const std::string &role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { - Dll_Pll_Conf_Fpga trk_param_fpga = Dll_Pll_Conf_Fpga(); + Dll_Pll_Conf_Fpga trk_params_fpga = Dll_Pll_Conf_Fpga(); DLOG(INFO) << "role " << role; - // ################# CONFIGURATION PARAMETERS ######################## - int32_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 12500000); - int32_t fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - trk_param_fpga.fs_in = fs_in; - bool dump = configuration->property(role + ".dump", false); - trk_param_fpga.dump = dump; - std::string default_dump_filename = "./track_ch"; - std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); - trk_param_fpga.dump_filename = dump_filename; - bool dump_mat = configuration->property(role + ".dump_mat", true); - trk_param_fpga.dump_mat = dump_mat; - trk_param_fpga.high_dyn = configuration->property(role + ".high_dyn", false); - if (configuration->property(role + ".smoother_length", 10) < 1) - { - trk_param_fpga.smoother_length = 1; - std::cout << TEXT_RED << "WARNING: GPS L5. smoother_length must be bigger than 0. It has been set to 1" << TEXT_RESET << std::endl; - } - else - { - trk_param_fpga.smoother_length = configuration->property(role + ".smoother_length", 10); - } - float pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0); - if (FLAGS_pll_bw_hz != 0.0) - { - pll_bw_hz = static_cast(FLAGS_pll_bw_hz); - } - trk_param_fpga.pll_bw_hz = pll_bw_hz; - float dll_bw_hz = configuration->property(role + ".dll_bw_hz", 2.0); - if (FLAGS_dll_bw_hz != 0.0) - { - dll_bw_hz = static_cast(FLAGS_dll_bw_hz); - } - trk_param_fpga.dll_bw_hz = dll_bw_hz; - float pll_bw_narrow_hz = configuration->property(role + ".pll_bw_narrow_hz", 2.0); - trk_param_fpga.pll_bw_narrow_hz = pll_bw_narrow_hz; - float dll_bw_narrow_hz = configuration->property(role + ".dll_bw_narrow_hz", 0.25); - trk_param_fpga.dll_bw_narrow_hz = dll_bw_narrow_hz; - float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5); - trk_param_fpga.early_late_space_chips = early_late_space_chips; + trk_params_fpga.SetFromConfiguration(configuration, role); - int dll_filter_order = configuration->property(role + ".dll_filter_order", 2); - if (dll_filter_order < 1) + int32_t vector_length = std::round(static_cast(trk_params_fpga.fs_in) / (static_cast(GPS_L5I_CODE_RATE_CPS) / static_cast(GPS_L5I_CODE_LENGTH_CHIPS))); + trk_params_fpga.vector_length = vector_length; + if (trk_params_fpga.extend_correlation_symbols < 1) { - LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 1."; - dll_filter_order = 1; - } - if (dll_filter_order > 3) - { - LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 3."; - dll_filter_order = 3; - } - trk_param_fpga.dll_filter_order = dll_filter_order; - - int pll_filter_order = configuration->property(role + ".pll_filter_order", 3); - if (pll_filter_order < 2) - { - LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 2."; - pll_filter_order = 2; - } - if (pll_filter_order > 3) - { - LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 3."; - pll_filter_order = 3; - } - trk_param_fpga.pll_filter_order = pll_filter_order; - - if (pll_filter_order == 2) - { - trk_param_fpga.fll_filter_order = 1; - } - if (pll_filter_order == 3) - { - trk_param_fpga.fll_filter_order = 2; - } - - bool enable_fll_pull_in = configuration->property(role + ".enable_fll_pull_in", false); - trk_param_fpga.enable_fll_pull_in = enable_fll_pull_in; - bool enable_fll_steady_state = configuration->property(role + ".enable_fll_steady_state", false); - trk_param_fpga.enable_fll_steady_state = enable_fll_steady_state; - float fll_bw_hz = configuration->property(role + ".fll_bw_hz", 35.0); - trk_param_fpga.fll_bw_hz = fll_bw_hz; - float pull_in_time_s = configuration->property(role + ".pull_in_time_s", trk_param_fpga.pull_in_time_s); - trk_param_fpga.pull_in_time_s = pull_in_time_s; - - int32_t vector_length = std::round(static_cast(fs_in) / (static_cast(GPS_L5I_CODE_RATE_CPS) / static_cast(GPS_L5I_CODE_LENGTH_CHIPS))); - trk_param_fpga.vector_length = vector_length; - int32_t extend_correlation_symbols = configuration->property(role + ".extend_correlation_symbols", 1); - float early_late_space_narrow_chips = configuration->property(role + ".early_late_space_narrow_chips", 0.5); - trk_param_fpga.early_late_space_narrow_chips = early_late_space_narrow_chips; - bool track_pilot = configuration->property(role + ".track_pilot", false); - if (extend_correlation_symbols < 1) - { - extend_correlation_symbols = 1; + trk_params_fpga.extend_correlation_symbols = 1; std::cout << TEXT_RED << "WARNING: GPS L5. extend_correlation_symbols must be bigger than 0. Coherent integration has been set to 1 symbol (1 ms)" << TEXT_RESET << std::endl; } - else if (!track_pilot and extend_correlation_symbols > GPS_L5I_NH_CODE_LENGTH) + else if (!trk_params_fpga.track_pilot and trk_params_fpga.extend_correlation_symbols > GPS_L5I_NH_CODE_LENGTH) { - extend_correlation_symbols = GPS_L5I_NH_CODE_LENGTH; + trk_params_fpga.extend_correlation_symbols = GPS_L5I_NH_CODE_LENGTH; std::cout << TEXT_RED << "WARNING: GPS L5. extend_correlation_symbols must be lower than 11 when tracking the data component. Coherent integration has been set to 10 symbols (10 ms)" << TEXT_RESET << std::endl; } - if ((extend_correlation_symbols > 1) and (pll_bw_narrow_hz > pll_bw_hz or dll_bw_narrow_hz > dll_bw_hz)) + if ((trk_params_fpga.extend_correlation_symbols > 1) and (trk_params_fpga.pll_bw_narrow_hz > trk_params_fpga.pll_bw_hz or trk_params_fpga.dll_bw_narrow_hz > trk_params_fpga.dll_bw_hz)) { std::cout << TEXT_RED << "WARNING: GPS L5. PLL or DLL narrow tracking bandwidth is higher than wide tracking one" << TEXT_RESET << std::endl; } - trk_param_fpga.extend_correlation_symbols = extend_correlation_symbols; - trk_param_fpga.track_pilot = track_pilot; - d_track_pilot = track_pilot; - trk_param_fpga.very_early_late_space_chips = 0.0; - trk_param_fpga.very_early_late_space_narrow_chips = 0.0; - trk_param_fpga.system = 'G'; + d_track_pilot = trk_params_fpga.track_pilot; + trk_params_fpga.system = 'G'; std::array sig_{'L', '5', '\0'}; - std::memcpy(trk_param_fpga.signal, sig_.data(), 3); - trk_param_fpga.cn0_samples = configuration->property(role + ".cn0_samples", trk_param_fpga.cn0_samples); - trk_param_fpga.cn0_min = configuration->property(role + ".cn0_min", trk_param_fpga.cn0_min); - trk_param_fpga.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param_fpga.max_code_lock_fail); - trk_param_fpga.max_carrier_lock_fail = configuration->property(role + ".max_carrier_lock_fail", trk_param_fpga.max_carrier_lock_fail); - trk_param_fpga.carrier_lock_th = configuration->property(role + ".carrier_lock_th", trk_param_fpga.carrier_lock_th); + std::memcpy(trk_params_fpga.signal, sig_.data(), 3); // FPGA configuration parameters - std::string default_device_name = "/dev/uio"; - std::string device_name = configuration->property(role + ".devicename", default_device_name); - trk_param_fpga.device_name = device_name; // obtain the number of the first uio device corresponding to a HW accelerator in the FPGA // that can be assigned to the tracking of the L5 signal - trk_param_fpga.dev_file_num = configuration->property(role + ".dev_file_num", 27); + trk_params_fpga.dev_file_num = configuration->property(role + ".dev_file_num", 27); // compute the number of tracking channels that have already been instantiated. The order in which // GNSS-SDR instantiates the tracking channels i L1, L2, L5, E1, E5a - trk_param_fpga.num_prev_assigned_ch = configuration->property("Channels_1C.count", 0) + - configuration->property("Channels_2S.count", 0); - - // tracking lock tests smoother parameters - trk_param_fpga.cn0_smoother_samples = configuration->property(role + ".cn0_smoother_samples", trk_param_fpga.cn0_smoother_samples); - trk_param_fpga.cn0_smoother_alpha = configuration->property(role + ".cn0_smoother_alpha", trk_param_fpga.cn0_smoother_alpha); - trk_param_fpga.carrier_lock_test_smoother_samples = configuration->property(role + ".carrier_lock_test_smoother_samples", trk_param_fpga.carrier_lock_test_smoother_samples); - trk_param_fpga.carrier_lock_test_smoother_alpha = configuration->property(role + ".carrier_lock_test_smoother_alpha", trk_param_fpga.carrier_lock_test_smoother_alpha); + trk_params_fpga.num_prev_assigned_ch = configuration->property("Channels_1C.count", 0) + + configuration->property("Channels_2S.count", 0); // ################# PRE-COMPUTE ALL THE CODES ################# uint32_t code_samples_per_chip = 1; @@ -185,7 +81,7 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga( volk_gnsssdr::vector data_code; volk_gnsssdr::vector tracking_code(code_length_chips, 0.0); - if (track_pilot) + if (d_track_pilot) { data_code.resize(code_length_chips, 0.0); } @@ -193,14 +89,14 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga( d_ca_codes = static_cast(volk_gnsssdr_malloc(static_cast(code_length_chips * NUM_PRNs) * sizeof(int32_t), volk_gnsssdr_get_alignment())); d_data_codes = nullptr; - if (track_pilot) + if (d_track_pilot) { d_data_codes = static_cast(volk_gnsssdr_malloc((static_cast(code_length_chips)) * NUM_PRNs * sizeof(int32_t), volk_gnsssdr_get_alignment())); } for (uint32_t PRN = 1; PRN <= NUM_PRNs; PRN++) { - if (track_pilot) + if (d_track_pilot) { gps_l5q_code_gen_float(tracking_code, PRN); gps_l5i_code_gen_float(data_code, PRN); @@ -243,40 +139,40 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga( } } - trk_param_fpga.ca_codes = d_ca_codes; - trk_param_fpga.data_codes = d_data_codes; - trk_param_fpga.code_length_chips = code_length_chips; - trk_param_fpga.code_samples_per_chip = code_samples_per_chip; // 2 sample per chip + trk_params_fpga.ca_codes = d_ca_codes; + trk_params_fpga.data_codes = d_data_codes; + trk_params_fpga.code_length_chips = code_length_chips; + trk_params_fpga.code_samples_per_chip = code_samples_per_chip; // 2 sample per chip - trk_param_fpga.extended_correlation_in_fpga = false; // by default - trk_param_fpga.extend_fpga_integration_periods = 1; // (number of FPGA integrations that are combined in the SW) - trk_param_fpga.fpga_integration_period = 1; // (number of symbols that are effectively integrated in the FPGA) + trk_params_fpga.extended_correlation_in_fpga = false; // by default + trk_params_fpga.extend_fpga_integration_periods = 1; // (number of FPGA integrations that are combined in the SW) + trk_params_fpga.fpga_integration_period = 1; // (number of symbols that are effectively integrated in the FPGA) if (d_track_pilot) { - if (extend_correlation_symbols > 1) + if (trk_params_fpga.extend_correlation_symbols > 1) { - if (extend_correlation_symbols <= GPS_L5I_NH_CODE_LENGTH) + if (trk_params_fpga.extend_correlation_symbols <= GPS_L5I_NH_CODE_LENGTH) { - if ((GPS_L5I_NH_CODE_LENGTH % extend_correlation_symbols) == 0) + if ((GPS_L5I_NH_CODE_LENGTH % trk_params_fpga.extend_correlation_symbols) == 0) { - trk_param_fpga.extended_correlation_in_fpga = true; - trk_param_fpga.fpga_integration_period = extend_correlation_symbols; + trk_params_fpga.extended_correlation_in_fpga = true; + trk_params_fpga.fpga_integration_period = trk_params_fpga.extend_correlation_symbols; } } else { - if (extend_correlation_symbols % GPS_L5I_NH_CODE_LENGTH == 0) + if (trk_params_fpga.extend_correlation_symbols % GPS_L5I_NH_CODE_LENGTH == 0) { - trk_param_fpga.extended_correlation_in_fpga = true; - trk_param_fpga.extend_fpga_integration_periods = extend_correlation_symbols / GPS_L5I_NH_CODE_LENGTH; - trk_param_fpga.fpga_integration_period = GPS_L5I_NH_CODE_LENGTH; + trk_params_fpga.extended_correlation_in_fpga = true; + trk_params_fpga.extend_fpga_integration_periods = trk_params_fpga.extend_correlation_symbols / GPS_L5I_NH_CODE_LENGTH; + trk_params_fpga.fpga_integration_period = GPS_L5I_NH_CODE_LENGTH; } } } } - // ################# MAKE TRACKING GNURadio object ################### - tracking_fpga_sc = dll_pll_veml_make_tracking_fpga(trk_param_fpga); + // ################# MAKE TRACKING GNU Radio object ################### + tracking_fpga_sc = dll_pll_veml_make_tracking_fpga(trk_params_fpga); channel_ = 0; DLOG(INFO) << "tracking(" << tracking_fpga_sc->unique_id() << ")"; diff --git a/src/algorithms/tracking/libs/CMakeLists.txt b/src/algorithms/tracking/libs/CMakeLists.txt index 679523593..ca85f3a2b 100644 --- a/src/algorithms/tracking/libs/CMakeLists.txt +++ b/src/algorithms/tracking/libs/CMakeLists.txt @@ -132,6 +132,11 @@ if(ENABLE_ARMA_NO_DEBUG) ) endif() +target_include_directories(tracking_libs + PUBLIC + ${CMAKE_SOURCE_DIR}/src/core/interfaces +) + if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) set_target_properties(tracking_libs diff --git a/src/algorithms/tracking/libs/dll_pll_conf.cc b/src/algorithms/tracking/libs/dll_pll_conf.cc index 613380808..9650b154c 100644 --- a/src/algorithms/tracking/libs/dll_pll_conf.cc +++ b/src/algorithms/tracking/libs/dll_pll_conf.cc @@ -18,9 +18,11 @@ * ------------------------------------------------------------------------- */ - #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" +#include "item_type_helpers.h" +#include + Dll_Pll_Conf::Dll_Pll_Conf() { @@ -46,14 +48,14 @@ Dll_Pll_Conf::Dll_Pll_Conf() dll_bw_hz = 2.0; pll_bw_narrow_hz = 5.0; dll_bw_narrow_hz = 0.75; - early_late_space_chips = 0.5; + early_late_space_chips = 0.25; very_early_late_space_chips = 0.5; early_late_space_narrow_chips = 0.1; - very_early_late_space_narrow_chips = 0.1; + very_early_late_space_narrow_chips = 0.5; slope = 1.0; spc = 0.5; y_intercept = 1.0; - extend_correlation_symbols = 5; + extend_correlation_symbols = 1; cn0_samples = FLAGS_cn0_samples; cn0_smoother_samples = 200; cn0_smoother_alpha = 0.002; @@ -63,10 +65,102 @@ Dll_Pll_Conf::Dll_Pll_Conf() max_carrier_lock_fail = FLAGS_max_carrier_lock_fail; max_code_lock_fail = FLAGS_max_lock_fail; carrier_lock_th = FLAGS_carrier_lock_th; + track_pilot = true; enable_doppler_correction = false; - track_pilot = false; system = 'G'; signal[0] = '1'; signal[1] = 'C'; signal[2] = '\0'; + item_type = "gr_complex"; +} + + +void Dll_Pll_Conf::SetFromConfiguration(ConfigurationInterface *configuration, + const std::string &role) +{ + item_type = configuration->property(role + ".item_type", item_type); + if (!item_type_valid(item_type)) + { + throw std::invalid_argument("Unknown item type: " + item_type); + } + + int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", fs_in); + fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); + high_dyn = configuration->property(role + ".high_dyn", high_dyn); + dump = configuration->property(role + ".dump", dump); + dump_filename = configuration->property(role + ".dump_filename", dump_filename); + dump_mat = configuration->property(role + ".dump_mat", dump_mat); + pll_bw_hz = configuration->property(role + ".pll_bw_hz", pll_bw_hz); + if (FLAGS_pll_bw_hz != 0.0) + { + pll_bw_hz = static_cast(FLAGS_pll_bw_hz); + } + pll_bw_narrow_hz = configuration->property(role + ".pll_bw_narrow_hz", pll_bw_narrow_hz); + dll_bw_narrow_hz = configuration->property(role + ".dll_bw_narrow_hz", dll_bw_narrow_hz); + dll_bw_hz = configuration->property(role + ".dll_bw_hz", dll_bw_hz); + if (FLAGS_dll_bw_hz != 0.0) + { + dll_bw_hz = static_cast(FLAGS_dll_bw_hz); + } + + dll_filter_order = configuration->property(role + ".dll_filter_order", dll_filter_order); + pll_filter_order = configuration->property(role + ".pll_filter_order", pll_filter_order); + if (dll_filter_order < 1) + { + LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 1."; + dll_filter_order = 1; + } + if (dll_filter_order > 3) + { + LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 3."; + dll_filter_order = 3; + } + if (pll_filter_order < 2) + { + LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 2."; + pll_filter_order = 2; + } + if (pll_filter_order > 3) + { + LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 3."; + pll_filter_order = 3; + } + + if (pll_filter_order == 2) + { + fll_filter_order = 1; + } + if (pll_filter_order == 3) + { + fll_filter_order = 2; + } + + enable_fll_pull_in = configuration->property(role + ".enable_fll_pull_in", enable_fll_pull_in); + enable_fll_steady_state = configuration->property(role + ".enable_fll_steady_state", enable_fll_steady_state); + fll_bw_hz = configuration->property(role + ".fll_bw_hz", fll_bw_hz); + pull_in_time_s = configuration->property(role + ".pull_in_time_s", pull_in_time_s); + bit_synchronization_time_limit_s = pull_in_time_s + 60; + early_late_space_chips = configuration->property(role + ".early_late_space_chips", early_late_space_chips); + early_late_space_narrow_chips = configuration->property(role + ".early_late_space_narrow_chips", early_late_space_narrow_chips); + very_early_late_space_chips = configuration->property(role + ".very_early_late_space_chips", very_early_late_space_chips); + very_early_late_space_narrow_chips = configuration->property(role + ".very_early_late_space_narrow_chips", very_early_late_space_narrow_chips); + extend_correlation_symbols = configuration->property(role + ".extend_correlation_symbols", extend_correlation_symbols); + track_pilot = configuration->property(role + ".track_pilot", track_pilot); + cn0_samples = configuration->property(role + ".cn0_samples", cn0_samples); + cn0_min = configuration->property(role + ".cn0_min", cn0_min); + max_code_lock_fail = configuration->property(role + ".max_lock_fail", max_code_lock_fail); + max_carrier_lock_fail = configuration->property(role + ".max_carrier_lock_fail", max_carrier_lock_fail); + carrier_lock_th = configuration->property(role + ".carrier_lock_th", carrier_lock_th); + + // tracking lock tests smoother parameters + cn0_smoother_samples = configuration->property(role + ".cn0_smoother_samples", cn0_smoother_samples); + cn0_smoother_alpha = configuration->property(role + ".cn0_smoother_alpha", cn0_smoother_alpha); + smoother_length = configuration->property(role + ".smoother_length", smoother_length); + if (smoother_length < 1) + { + smoother_length = 1; + LOG(WARNING) << "smoother_length must be bigger than 0. It has been set to 1"; + } + carrier_lock_test_smoother_samples = configuration->property(role + ".carrier_lock_test_smoother_samples", carrier_lock_test_smoother_samples); + carrier_lock_test_smoother_alpha = configuration->property(role + ".carrier_lock_test_smoother_alpha", carrier_lock_test_smoother_alpha); } diff --git a/src/algorithms/tracking/libs/dll_pll_conf.h b/src/algorithms/tracking/libs/dll_pll_conf.h index 18438d55d..1fa6e18b6 100644 --- a/src/algorithms/tracking/libs/dll_pll_conf.h +++ b/src/algorithms/tracking/libs/dll_pll_conf.h @@ -22,20 +22,24 @@ #ifndef GNSS_SDR_DLL_PLL_CONF_H #define GNSS_SDR_DLL_PLL_CONF_H +#include "configuration_interface.h" #include #include class Dll_Pll_Conf { public: + Dll_Pll_Conf(); + void SetFromConfiguration(ConfigurationInterface *configuration, const std::string &role); + /* DLL/PLL tracking configuration */ - int fll_filter_order; + int32_t fll_filter_order; bool enable_fll_pull_in; bool enable_fll_steady_state; - unsigned int pull_in_time_s; - unsigned int bit_synchronization_time_limit_s; - int pll_filter_order; - int dll_filter_order; + uint32_t pull_in_time_s; + uint32_t bit_synchronization_time_limit_s; + int32_t pll_filter_order; + int32_t dll_filter_order; double fs_in; uint32_t vector_length; bool dump; @@ -57,6 +61,7 @@ public: float y_intercept; int32_t extend_correlation_symbols; bool high_dyn; + std::string item_type; int32_t cn0_samples; int32_t cn0_smoother_samples; float cn0_smoother_alpha; @@ -71,8 +76,6 @@ public: bool enable_doppler_correction; char system; char signal[3]{}; - - Dll_Pll_Conf(); }; #endif diff --git a/src/algorithms/tracking/libs/dll_pll_conf_fpga.cc b/src/algorithms/tracking/libs/dll_pll_conf_fpga.cc index 48c3d975f..f80cd6523 100644 --- a/src/algorithms/tracking/libs/dll_pll_conf_fpga.cc +++ b/src/algorithms/tracking/libs/dll_pll_conf_fpga.cc @@ -22,7 +22,8 @@ #include "dll_pll_conf_fpga.h" #include "gnss_sdr_flags.h" -#include +#include + Dll_Pll_Conf_Fpga::Dll_Pll_Conf_Fpga() { @@ -44,18 +45,18 @@ Dll_Pll_Conf_Fpga::Dll_Pll_Conf_Fpga() fll_bw_hz = 35.0; pll_pull_in_bw_hz = 50.0; dll_pull_in_bw_hz = 3.0; - pll_bw_hz = 35.0; - dll_bw_hz = 2.0; - pll_bw_narrow_hz = 5.0; - dll_bw_narrow_hz = 0.75; - early_late_space_chips = 0.5; + pll_bw_hz = 5.0; + dll_bw_hz = 0.5; + pll_bw_narrow_hz = 2.0; + dll_bw_narrow_hz = 0.25; + early_late_space_chips = 0.25; very_early_late_space_chips = 0.5; - early_late_space_narrow_chips = 0.1; - very_early_late_space_narrow_chips = 0.1; + early_late_space_narrow_chips = 0.15; + very_early_late_space_narrow_chips = 0.5; slope = 1.0; spc = 0.5; y_intercept = 1.0; - extend_correlation_symbols = 5; + extend_correlation_symbols = 1; cn0_samples = FLAGS_cn0_samples; cn0_smoother_samples = 200; cn0_smoother_alpha = 0.002; @@ -67,7 +68,7 @@ Dll_Pll_Conf_Fpga::Dll_Pll_Conf_Fpga() carrier_lock_th = FLAGS_carrier_lock_th; // max_lock_fail = 50; enable_doppler_correction = false; - track_pilot = false; + track_pilot = true; system = 'G'; signal[0] = '1'; signal[1] = 'C'; @@ -83,3 +84,91 @@ Dll_Pll_Conf_Fpga::Dll_Pll_Conf_Fpga() extend_fpga_integration_periods = 1; fpga_integration_period = 0; } + + +void Dll_Pll_Conf_Fpga::SetFromConfiguration(ConfigurationInterface *configuration, + const std::string &role) +{ + int32_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 12500000); + fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); + high_dyn = configuration->property(role + ".high_dyn", high_dyn); + smoother_length = configuration->property(role + ".smoother_length", smoother_length); + if (smoother_length < 1) + { + smoother_length = 1; + LOG(WARNING) << "smoother_length must be bigger than 0. It has been set to 1"; + } + dump = configuration->property(role + ".dump", dump); + dump_mat = configuration->property(role + ".dump_mat", dump_mat); + dump_filename = configuration->property(role + ".dump_filename", dump_filename); + enable_fll_pull_in = configuration->property(role + ".enable_fll_pull_in", enable_fll_pull_in); + enable_fll_steady_state = configuration->property(role + ".enable_fll_steady_state", enable_fll_steady_state); + pull_in_time_s = configuration->property(role + ".pull_in_time_s", pull_in_time_s); + track_pilot = configuration->property(role + ".track_pilot", track_pilot); + bit_synchronization_time_limit_s = pull_in_time_s + 60; + dll_filter_order = configuration->property(role + ".dll_filter_order", dll_filter_order); + pll_filter_order = configuration->property(role + ".pll_filter_order", pll_filter_order); + if (dll_filter_order < 1) + { + LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 1."; + dll_filter_order = 1; + } + if (dll_filter_order > 3) + { + LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 3."; + dll_filter_order = 3; + } + if (pll_filter_order < 2) + { + LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 2."; + pll_filter_order = 2; + } + if (pll_filter_order > 3) + { + LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 3."; + pll_filter_order = 3; + } + if (pll_filter_order == 2) + { + fll_filter_order = 1; + } + if (pll_filter_order == 3) + { + fll_filter_order = 2; + } + fll_bw_hz = configuration->property(role + ".fll_bw_hz", fll_bw_hz); + pll_pull_in_bw_hz = 50.0; + dll_pull_in_bw_hz = 3.0; + pll_bw_hz = configuration->property(role + ".pll_bw_hz", pll_bw_hz); + if (FLAGS_pll_bw_hz != 0.0) + { + pll_bw_hz = static_cast(FLAGS_pll_bw_hz); + } + dll_bw_hz = configuration->property(role + ".dll_bw_hz", dll_bw_hz); + if (FLAGS_dll_bw_hz != 0.0) + { + dll_bw_hz = static_cast(FLAGS_dll_bw_hz); + } + pll_bw_narrow_hz = configuration->property(role + ".pll_bw_narrow_hz", pll_bw_narrow_hz); + dll_bw_narrow_hz = configuration->property(role + ".dll_bw_narrow_hz", dll_bw_narrow_hz); + early_late_space_chips = configuration->property(role + ".early_late_space_chips", early_late_space_chips); + very_early_late_space_chips = configuration->property(role + ".very_early_late_space_chips", very_early_late_space_chips); + early_late_space_narrow_chips = configuration->property(role + ".early_late_space_narrow_chips", early_late_space_narrow_chips); + very_early_late_space_narrow_chips = configuration->property(role + ".very_early_late_space_narrow_chips", very_early_late_space_narrow_chips); + extend_correlation_symbols = configuration->property(role + ".extend_correlation_symbols", extend_correlation_symbols); + cn0_samples = configuration->property(role + ".cn0_samples", cn0_samples); + + // tracking lock tests smoother parameters + cn0_smoother_samples = configuration->property(role + ".cn0_smoother_samples", cn0_smoother_samples); + cn0_smoother_alpha = configuration->property(role + ".cn0_smoother_alpha", cn0_smoother_alpha); + carrier_lock_test_smoother_alpha = configuration->property(role + ".carrier_lock_test_smoother_alpha", carrier_lock_test_smoother_alpha); + carrier_lock_test_smoother_samples = configuration->property(role + ".carrier_lock_test_smoother_samples", carrier_lock_test_smoother_samples); + + cn0_min = configuration->property(role + ".cn0_min", cn0_min); + max_carrier_lock_fail = configuration->property(role + ".max_carrier_lock_fail", max_carrier_lock_fail); + max_code_lock_fail = configuration->property(role + ".max_lock_fail", max_code_lock_fail); + carrier_lock_th = configuration->property(role + ".carrier_lock_th", carrier_lock_th); + // max_lock_fail = 50; + + device_name = configuration->property(role + ".devicename", device_name); +} diff --git a/src/algorithms/tracking/libs/dll_pll_conf_fpga.h b/src/algorithms/tracking/libs/dll_pll_conf_fpga.h index edb4a30c5..fabad6429 100644 --- a/src/algorithms/tracking/libs/dll_pll_conf_fpga.h +++ b/src/algorithms/tracking/libs/dll_pll_conf_fpga.h @@ -24,21 +24,24 @@ #ifndef GNSS_SDR_DLL_PLL_CONF_FPGA_H #define GNSS_SDR_DLL_PLL_CONF_FPGA_H +#include "configuration_interface.h" #include #include class Dll_Pll_Conf_Fpga { public: - /* DLL/PLL tracking configuration */ + Dll_Pll_Conf_Fpga(); + void SetFromConfiguration(ConfigurationInterface* configuration, const std::string& role); - int fll_filter_order; + /* DLL/PLL tracking configuration */ + int32_t fll_filter_order; bool enable_fll_pull_in; bool enable_fll_steady_state; - unsigned int pull_in_time_s; // signed integer, when pull in time is not yet reached it has to be compared against a negative number - unsigned int bit_synchronization_time_limit_s; - int pll_filter_order; - int dll_filter_order; + uint32_t pull_in_time_s; // signed integer, when pull in time is not yet reached it has to be compared against a negative number + uint32_t bit_synchronization_time_limit_s; + int32_t pll_filter_order; + int32_t dll_filter_order; double fs_in; uint32_t vector_length; @@ -88,8 +91,6 @@ public: bool extended_correlation_in_fpga; uint32_t extend_fpga_integration_periods; uint32_t fpga_integration_period; - - Dll_Pll_Conf_Fpga(); }; #endif