From 2517e7bb31b267c2a321a1f439bfccb41b3dbed8 Mon Sep 17 00:00:00 2001 From: Javier Arribas Date: Fri, 10 Aug 2018 11:53:40 +0200 Subject: [PATCH 1/2] Replacing software sample counter with hardware sample counter if FPGA is enabled. Fix a compilation bug when ENABLE_FPGA is selected --- .../gps_l1_ca_pcps_acquisition_fpga.cc | 2 +- src/algorithms/libs/CMakeLists.txt | 1 + .../libs/gnss_sdr_fpga_sample_counter.cc | 171 ++++++++++++++++++ .../libs/gnss_sdr_fpga_sample_counter.h | 73 ++++++++ src/core/receiver/gnss_flowgraph.cc | 27 ++- src/core/receiver/gnss_flowgraph.h | 8 +- src/tests/CMakeLists.txt | 10 +- 7 files changed, 266 insertions(+), 26 deletions(-) create mode 100644 src/algorithms/libs/gnss_sdr_fpga_sample_counter.cc create mode 100644 src/algorithms/libs/gnss_sdr_fpga_sample_counter.h diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc index a8e2a3f17..f9625bae5 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc @@ -60,7 +60,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000); long fs_in = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); acq_parameters.fs_in = fs_in; - acq_parameters.samples_per_chip = static_cast(ceil(GPS_L1_CA_CHIP_PERIOD * static_cast(acq_parameters.fs_in))); + acq_parameters.samples_per_code = static_cast(ceil(GPS_L1_CA_CHIP_PERIOD * static_cast(acq_parameters.fs_in))); doppler_max_ = configuration_->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max; acq_parameters.doppler_max = doppler_max_; diff --git a/src/algorithms/libs/CMakeLists.txt b/src/algorithms/libs/CMakeLists.txt index bdce5d1cf..306a755cf 100644 --- a/src/algorithms/libs/CMakeLists.txt +++ b/src/algorithms/libs/CMakeLists.txt @@ -40,6 +40,7 @@ if(ENABLE_FPGA) conjugate_cc.cc conjugate_sc.cc conjugate_ic.cc + gnss_sdr_fpga_sample_counter.cc ) else(ENABLE_FPGA) set(GNSS_SPLIBS_SOURCES diff --git a/src/algorithms/libs/gnss_sdr_fpga_sample_counter.cc b/src/algorithms/libs/gnss_sdr_fpga_sample_counter.cc new file mode 100644 index 000000000..661275538 --- /dev/null +++ b/src/algorithms/libs/gnss_sdr_fpga_sample_counter.cc @@ -0,0 +1,171 @@ +/*! + * \file gnss_sdr_fpga_sample_counter.cc + * \brief Simple block to report the current receiver time based on the output of the tracking or telemetry blocks + * \author Javier Arribas 2018. jarribas(at)cttc.es + * + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors) + * + * GNSS-SDR is a software defined Global Navigation + * Satellite Systems receiver + * + * This file is part of GNSS-SDR. + * + * GNSS-SDR is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GNSS-SDR is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNSS-SDR. If not, see . + * + * ------------------------------------------------------------------------- + */ + +#include "gnss_sdr_fpga_sample_counter.h" +#include "gnss_synchro.h" +#include +#include +#include +#include + +gnss_sdr_fpga_sample_counter::gnss_sdr_fpga_sample_counter(double _fs, int _interval_ms) : gr::block("fpga_fpga_sample_counter", + gr::io_signature::make(0, 0, 0), + gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) +{ + message_port_register_out(pmt::mp("fpga_sample_counter")); + set_max_noutput_items(1); + interval_ms = _interval_ms; + fs = _fs; + samples_per_output = std::round(fs * static_cast(interval_ms) / 1e3); + //todo: Load here the hardware counter register with this amount of samples. It should produde an + //interrupt every samples_per_output count. + //The hardware timmer must keep always interrupting the PS. It must not wait for the interrupt to + //be served. + + sample_counter = 0; + current_T_rx_ms = 0; + current_s = 0; + current_m = 0; + current_h = 0; + current_days = 0; + report_interval_ms = 1000; // default reporting 1 second + flag_enable_send_msg = false; // enable it for reporting time with asynchronous message + flag_m = false; + flag_h = false; + flag_days = false; +} + + +gnss_sdr_fpga_sample_counter_sptr gnss_sdr_make_fpga_sample_counter(double _fs, int _interval_ms) +{ + gnss_sdr_fpga_sample_counter_sptr fpga_sample_counter_(new gnss_sdr_fpga_sample_counter(_fs, _interval_ms)); + return fpga_sample_counter_; +} + + +// Called by gnuradio to enable drivers, etc for i/o devices. +bool gnss_sdr_fpga_sample_counter::start() +{ + //todo: place here the RE-INITIALIZATION routines. This function will be called by GNURadio at every start of the flowgraph. + // return true if everything is ok. + return true; +} + +// Called by GNURadio to disable drivers, etc for i/o devices. +bool gnss_sdr_fpga_sample_counter::stop() +{ + //todo: place here the routines to stop the associated hardware (if needed).This function will be called by GNURadio at every stop of the flowgraph. + // return true if everything is ok. + return true; +} + + +int gnss_sdr_fpga_sample_counter::general_work(int noutput_items __attribute__((unused)), + __attribute__((unused)) gr_vector_int &ninput_items, + __attribute__((unused)) gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + //todo: Call here a function that waits for an interrupt. Do not open a thread, + //it must be a simple call to a BLOCKING function. + // The function will return the actual absolute sample count of the internal counter of the timmer. + // store the sample count in class member sample_counter + // Possible problem: what happen if the PS is overloaded and gnuradio does not call this function + // with the sufficient rate to catch all the interrupts in the counter. To be evaluated later. + + + Gnss_Synchro *out = reinterpret_cast(output_items[0]); + out[0] = Gnss_Synchro(); + out[0].Flag_valid_symbol_output = false; + out[0].Flag_valid_word = false; + out[0].Channel_ID = -1; + out[0].fs = fs; + if ((current_T_rx_ms % report_interval_ms) == 0) + { + current_s++; + if ((current_s % 60) == 0) + { + current_s = 0; + current_m++; + flag_m = true; + if ((current_m % 60) == 0) + { + current_m = 0; + current_h++; + flag_h = true; + if ((current_h % 24) == 0) + { + current_h = 0; + current_days++; + flag_days = true; + } + } + } + + if (flag_days) + { + std::string day; + if (current_days == 1) + { + day = " day "; + } + else + { + day = " days "; + } + std::cout << "Current receiver time: " << current_days << day << current_h << " h " << current_m << " min " << current_s << " s" << std::endl; + } + else + { + if (flag_h) + { + std::cout << "Current receiver time: " << current_h << " h " << current_m << " min " << current_s << " s" << std::endl; + } + else + { + if (flag_m) + { + std::cout << "Current receiver time: " << current_m << " min " << current_s << " s" << std::endl; + } + else + { + std::cout << "Current receiver time: " << current_s << " s" << std::endl; + } + } + } + if (flag_enable_send_msg) + { + message_port_pub(pmt::mp("receiver_time"), pmt::from_double(static_cast(current_T_rx_ms) / 1000.0)); + } + } + out[0].Tracking_sample_counter = sample_counter; + current_T_rx_ms = (sample_counter * 1000) / samples_per_output; + return 1; +} diff --git a/src/algorithms/libs/gnss_sdr_fpga_sample_counter.h b/src/algorithms/libs/gnss_sdr_fpga_sample_counter.h new file mode 100644 index 000000000..684feaffa --- /dev/null +++ b/src/algorithms/libs/gnss_sdr_fpga_sample_counter.h @@ -0,0 +1,73 @@ +/*! + * \file gnss_sdr_fpga_sample_counter.h + * \brief Simple block to report the current receiver time based on the output of the tracking or telemetry blocks + * \author Javier Arribas 2018. jarribas(at)cttc.es + * + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors) + * + * GNSS-SDR is a software defined Global Navigation + * Satellite Systems receiver + * + * This file is part of GNSS-SDR. + * + * GNSS-SDR is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GNSS-SDR is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNSS-SDR. If not, see . + * + * ------------------------------------------------------------------------- + */ +#ifndef GNSS_SDR_FPGA_sample_counter_H_ +#define GNSS_SDR_FPGA_sample_counter_H_ + +#include +#include + + +class gnss_sdr_fpga_sample_counter; + +typedef boost::shared_ptr gnss_sdr_fpga_sample_counter_sptr; + +gnss_sdr_fpga_sample_counter_sptr gnss_sdr_make_fpga_sample_counter(double _fs, int _interval_ms); + +class gnss_sdr_fpga_sample_counter : public gr::block +{ +private: + gnss_sdr_fpga_sample_counter(double _fs, int _interval_ms); + bool start(); + bool stop(); + unsigned int samples_per_output; + double fs; + unsigned long long int sample_counter; + int interval_ms; + long long int current_T_rx_ms; // Receiver time in ms since the beginning of the run + unsigned int current_s; // Receiver time in seconds, modulo 60 + bool flag_m; // True if the receiver has been running for at least 1 minute + unsigned int current_m; // Receiver time in minutes, modulo 60 + bool flag_h; // True if the receiver has been running for at least 1 hour + unsigned int current_h; // Receiver time in hours, modulo 24 + bool flag_days; // True if the receiver has been running for at least 1 day + unsigned int current_days; // Receiver time in days since the beginning of the run + int report_interval_ms; + bool flag_enable_send_msg; + +public: + friend gnss_sdr_fpga_sample_counter_sptr gnss_sdr_make_fpga_sample_counter(double _fs, int _interval_ms); + int general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif /*GNSS_SDR_FPGA_sample_counter_H_*/ diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index d8a1e6332..3793709f7 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -292,22 +292,23 @@ void GNSSFlowgraph::connect() } else { - //create a software-defined 1kHz gnss_synchro pulse for the observables block + //create a hardware-defined gnss_synchro pulse for the observables block try { - //null source - null_source_ = gr::blocks::null_source::make(sizeof(Gnss_Synchro)); - //throttle to observable interval + double fs = static_cast(configuration_->property("GNSS-SDR.internal_fs_sps", 0)); + if (fs == 0.0) + { + LOG(WARNING) << "Set GNSS-SDR.internal_fs_sps in configuration file"; + std::cout << "Set GNSS-SDR.internal_fs_sps in configuration file" << std::endl; + throw(std::invalid_argument("Set GNSS-SDR.internal_fs_sps in configuration")); + } int observable_interval_ms = static_cast(configuration_->property("GNSS-SDR.observable_interval_ms", 20)); - throttle_ = gr::blocks::throttle::make(sizeof(Gnss_Synchro), std::round(1.0 / static_cast(observable_interval_ms))); // 1000 samples per second (1kHz) - time_counter_ = gnss_sdr_make_time_counter(); - top_block_->connect(null_source_, 0, throttle_, 0); - top_block_->connect(throttle_, 0, time_counter_, 0); - top_block_->connect(time_counter_, 0, observables_->get_left_block(), channels_count_); + ch_out_fpga_sample_counter = gnss_sdr_make_fpga_sample_counter(fs, observable_interval_ms); + top_block_->connect(ch_out_fpga_sample_counter, 0, observables_->get_left_block(), channels_count_); //extra port for the sample counter pulse } catch (const std::exception& e) { - LOG(WARNING) << "Can't connect sample counter"; + LOG(WARNING) << "Can't connect FPGA sample counter"; LOG(ERROR) << e.what(); top_block_->disconnect_all(); return; @@ -633,13 +634,11 @@ void GNSSFlowgraph::disconnect() { try { - top_block_->disconnect(null_source_, 0, throttle_, 0); - top_block_->disconnect(throttle_, 0, time_counter_, 0); - top_block_->disconnect(time_counter_, 0, observables_->get_left_block(), channels_count_); + top_block_->disconnect(ch_out_fpga_sample_counter, 0, observables_->get_left_block(), channels_count_); } catch (const std::exception& e) { - LOG(WARNING) << "Can't connect sample counter"; + LOG(WARNING) << "Can't connect FPGA sample counter"; LOG(ERROR) << e.what(); top_block_->disconnect_all(); return; diff --git a/src/core/receiver/gnss_flowgraph.h b/src/core/receiver/gnss_flowgraph.h index 00a6ced4e..49b25eef4 100644 --- a/src/core/receiver/gnss_flowgraph.h +++ b/src/core/receiver/gnss_flowgraph.h @@ -43,8 +43,6 @@ #include "gnss_synchro_monitor.h" #include #include -#include -#include #include #include #include @@ -54,7 +52,7 @@ #include #if ENABLE_FPGA -#include "gnss_sdr_time_counter.h" +#include "gnss_sdr_fpga_sample_counter.h" #endif class GNSSBlockInterface; @@ -157,10 +155,8 @@ private: std::vector> channels_; gnss_sdr_sample_counter_sptr ch_out_sample_counter; #if ENABLE_FPGA - gnss_sdr_time_counter_sptr time_counter_; + gnss_sdr_fpga_sample_counter_sptr ch_out_fpga_sample_counter; #endif - gr::blocks::null_source::sptr null_source_; - gr::blocks::throttle::sptr throttle_; gr::top_block_sptr top_block_; gr::msg_queue::sptr queue_; diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index ac70b816e..2469bc33a 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -211,7 +211,7 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA) find_package(GPSTK) if(NOT GPSTK_FOUND OR ENABLE_OWN_GPSTK) message(STATUS "GPSTk v${GNSSSDR_GPSTK_LOCAL_VERSION} will be automatically downloaded and built when doing 'make'.") - if(NOT ENABLE_FPGA) + # if(NOT ENABLE_FPGA) if(CMAKE_VERSION VERSION_LESS 3.2) ExternalProject_Add( gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION} @@ -245,10 +245,10 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA) add_definitions(-DGPSTK_BINDIR="${GPSTK_BINDIR}") set(gpstk_libs gpstk) set(OWN_GPSTK True) - else(NOT ENABLE_FPGA) - message(STATUS "GPSTk has not been found, try to install it on target.") - message(STATUS "Some extra tests requiring GPSTk will not be built.") - endif(NOT ENABLE_FPGA) +# else(NOT ENABLE_FPGA) +# message(STATUS "GPSTk has not been found, try to install it on target.") +# message(STATUS "Some extra tests requiring GPSTk will not be built.") +# endif(NOT ENABLE_FPGA) else(NOT GPSTK_FOUND OR ENABLE_OWN_GPSTK) set(gpstk_libs ${GPSTK_LIBRARIES}) set(GPSTK_INCLUDE_DIRS ${GPSTK_INCLUDE_DIR}) From 6b1611b3a9ec4f3afdad5793f52c71b6373df9e1 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 10 Aug 2018 20:34:03 +0200 Subject: [PATCH 2/2] Replace unsigned long int by uint64_t and long int by int64_t. Fixes #199 --- ...o_e5a_noncoherent_iq_acquisition_caf_cc.cc | 4 +- ...eo_e5a_noncoherent_iq_acquisition_caf_cc.h | 10 +- .../galileo_pcps_8ms_acquisition_cc.h | 2 +- .../gnuradio_blocks/pcps_acquisition.cc | 60 ++-- .../gnuradio_blocks/pcps_acquisition.h | 48 +-- .../pcps_acquisition_fine_doppler_cc.h | 6 +- .../gnuradio_blocks/pcps_acquisition_fpga.h | 2 +- .../pcps_assisted_acquisition_cc.h | 2 +- .../pcps_cccwsr_acquisition_cc.h | 2 +- .../pcps_opencl_acquisition_cc.cc | 4 +- .../pcps_opencl_acquisition_cc.h | 4 +- .../pcps_quicksync_acquisition_cc.h | 2 +- .../pcps_tong_acquisition_cc.h | 2 +- src/algorithms/channel/adapters/channel.cc | 4 +- .../channel/libs/channel_msg_receiver_cc.cc | 3 +- .../libs/gnss_sdr_fpga_sample_counter.cc | 10 +- .../libs/gnss_sdr_fpga_sample_counter.h | 32 +- .../libs/gnss_sdr_sample_counter.cc | 10 +- src/algorithms/libs/gnss_sdr_sample_counter.h | 31 +- src/algorithms/libs/gnss_sdr_time_counter.h | 22 +- .../gnuradio_blocks/hybrid_observables_cc.cc | 18 +- .../gnuradio_blocks/hybrid_observables_cc.h | 4 +- .../galileo_e1b_telemetry_decoder_cc.cc | 4 +- .../galileo_e1b_telemetry_decoder_cc.h | 4 +- .../galileo_e5a_telemetry_decoder_cc.cc | 4 +- .../galileo_e5a_telemetry_decoder_cc.h | 4 +- .../glonass_l1_ca_telemetry_decoder_cc.cc | 4 +- .../glonass_l1_ca_telemetry_decoder_cc.h | 18 +- .../glonass_l2_ca_telemetry_decoder_cc.cc | 4 +- .../glonass_l2_ca_telemetry_decoder_cc.h | 18 +- .../gps_l1_ca_telemetry_decoder_cc.cc | 4 +- .../gps_l1_ca_telemetry_decoder_cc.h | 2 +- .../gps_l2c_telemetry_decoder_cc.cc | 4 +- .../gps_l5_telemetry_decoder_cc.cc | 4 +- .../gnuradio_blocks/dll_pll_veml_tracking.cc | 24 +- .../gnuradio_blocks/dll_pll_veml_tracking.h | 4 +- .../dll_pll_veml_tracking_fpga.cc | 18 +- .../dll_pll_veml_tracking_fpga.h | 6 +- .../galileo_e1_tcp_connector_tracking_cc.cc | 6 +- .../galileo_e1_tcp_connector_tracking_cc.h | 12 +- ...glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc | 28 +- .../glonass_l1_ca_dll_pll_c_aid_tracking_cc.h | 12 +- ...glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc | 29 +- .../glonass_l1_ca_dll_pll_c_aid_tracking_sc.h | 14 +- .../glonass_l1_ca_dll_pll_tracking_cc.cc | 24 +- .../glonass_l1_ca_dll_pll_tracking_cc.h | 14 +- ...glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc | 28 +- .../glonass_l2_ca_dll_pll_c_aid_tracking_cc.h | 12 +- ...glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc | 29 +- .../glonass_l2_ca_dll_pll_c_aid_tracking_sc.h | 14 +- .../glonass_l2_ca_dll_pll_tracking_cc.cc | 24 +- .../glonass_l2_ca_dll_pll_tracking_cc.h | 14 +- .../gps_l1_ca_dll_pll_c_aid_tracking_cc.cc | 28 +- .../gps_l1_ca_dll_pll_c_aid_tracking_cc.h | 12 +- .../gps_l1_ca_dll_pll_c_aid_tracking_sc.cc | 29 +- .../gps_l1_ca_dll_pll_c_aid_tracking_sc.h | 12 +- .../gps_l1_ca_dll_pll_tracking_gpu_cc.cc | 12 +- .../gps_l1_ca_dll_pll_tracking_gpu_cc.h | 14 +- .../gps_l1_ca_tcp_connector_tracking_cc.cc | 10 +- .../gps_l1_ca_tcp_connector_tracking_cc.h | 12 +- .../system_parameters/galileo_fnav_message.cc | 10 +- .../system_parameters/galileo_fnav_message.h | 5 +- .../galileo_navigation_message.cc | 14 +- .../galileo_navigation_message.h | 11 +- .../glonass_gnav_navigation_message.cc | 10 +- .../glonass_gnav_navigation_message.h | 5 +- src/core/system_parameters/gnss_synchro.h | 40 +-- .../gps_cnav_navigation_message.cc | 10 +- .../gps_cnav_navigation_message.h | 5 +- .../gps_navigation_message.cc | 306 +++++++++--------- .../gps_navigation_message.h | 5 +- src/core/system_parameters/rtcm.cc | 110 +++---- src/core/system_parameters/rtcm.h | 13 +- src/utils/front-end-cal/main.cc | 13 +- 74 files changed, 682 insertions(+), 672 deletions(-) diff --git a/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc index 64b64b193..4c2d47217 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc @@ -48,7 +48,7 @@ using google::LogMessage; galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr galileo_e5a_noncoherentIQ_make_acquisition_caf_cc( unsigned int sampled_ms, unsigned int max_dwells, - unsigned int doppler_max, long fs_in, + unsigned int doppler_max, int64_t fs_in, int samples_per_ms, int samples_per_code, bool bit_transition_flag, bool dump, @@ -67,7 +67,7 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit unsigned int sampled_ms, unsigned int max_dwells, unsigned int doppler_max, - long fs_in, + int64_t fs_in, int samples_per_ms, int samples_per_code, bool bit_transition_flag, diff --git a/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.h b/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.h index c60b2ac82..2ebe9a8e5 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.h @@ -52,7 +52,7 @@ typedef boost::shared_ptr galileo_ galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr galileo_e5a_noncoherentIQ_make_acquisition_caf_cc(unsigned int sampled_ms, unsigned int max_dwells, - unsigned int doppler_max, long fs_in, + unsigned int doppler_max, int64_t fs_in, int samples_per_ms, int samples_per_code, bool bit_transition_flag, bool dump, @@ -74,7 +74,7 @@ private: galileo_e5a_noncoherentIQ_make_acquisition_caf_cc( unsigned int sampled_ms, unsigned int max_dwells, - unsigned int doppler_max, long fs_in, + unsigned int doppler_max, int64_t fs_in, int samples_per_ms, int samples_per_code, bool bit_transition_flag, bool dump, @@ -86,7 +86,7 @@ private: galileo_e5a_noncoherentIQ_acquisition_caf_cc( unsigned int sampled_ms, unsigned int max_dwells, - unsigned int doppler_max, long fs_in, + unsigned int doppler_max, int64_t fs_in, int samples_per_ms, int samples_per_code, bool bit_transition_flag, bool dump, @@ -99,7 +99,7 @@ private: int doppler_offset); float estimate_input_power(gr_complex* in); - long d_fs_in; + int64_t d_fs_in; int d_samples_per_ms; int d_sampled_ms; int d_samples_per_code; @@ -111,7 +111,7 @@ private: unsigned int d_max_dwells; unsigned int d_well_count; unsigned int d_fft_size; - unsigned long int d_sample_counter; + uint64_t d_sample_counter; gr_complex** d_grid_doppler_wipeoffs; unsigned int d_num_doppler_bins; gr_complex* d_fft_code_I_A; diff --git a/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.h b/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.h index c104c3814..dc00681a3 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.h @@ -83,7 +83,7 @@ private: unsigned int d_max_dwells; unsigned int d_well_count; unsigned int d_fft_size; - unsigned long int d_sample_counter; + uint64_t d_sample_counter; gr_complex** d_grid_doppler_wipeoffs; unsigned int d_num_doppler_bins; gr_complex* d_fft_code_A; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc index 5beb35253..bb5d79b29 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc @@ -156,7 +156,7 @@ pcps_acquisition::~pcps_acquisition() { if (d_num_doppler_bins > 0) { - for (unsigned int i = 0; i < d_num_doppler_bins; i++) + for (uint32_t i = 0; i < d_num_doppler_bins; i++) { volk_gnsssdr_free(d_grid_doppler_wipeoffs[i]); volk_gnsssdr_free(d_magnitude_grid[i]); @@ -166,7 +166,7 @@ pcps_acquisition::~pcps_acquisition() } if (acq_parameters.make_2_steps) { - for (unsigned int i = 0; i < d_num_doppler_bins_step2; i++) + for (uint32_t i = 0; i < d_num_doppler_bins_step2; i++) { volk_gnsssdr_free(d_grid_doppler_wipeoffs_step_two[i]); } @@ -202,7 +202,7 @@ void pcps_acquisition::set_local_code(std::complex* code) gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler if (acq_parameters.bit_transition_flag) { - int offset = d_fft_size / 2; + int32_t offset = d_fft_size / 2; std::fill_n(d_fft_if->get_inbuf(), offset, gr_complex(0.0, 0.0)); memcpy(d_fft_if->get_inbuf() + offset, code, sizeof(gr_complex) * offset); } @@ -246,7 +246,7 @@ bool pcps_acquisition::is_fdma() } -void pcps_acquisition::update_local_carrier(gr_complex* carrier_vector, int correlator_length_samples, float freq) +void pcps_acquisition::update_local_carrier(gr_complex* carrier_vector, int32_t correlator_length_samples, float freq) { float phase_step_rad = GPS_TWO_PI * freq / static_cast(acq_parameters.fs_in); float _phase[1]; @@ -268,29 +268,29 @@ void pcps_acquisition::init() d_mag = 0.0; d_input_power = 0.0; - d_num_doppler_bins = static_cast(std::ceil(static_cast(static_cast(acq_parameters.doppler_max) - static_cast(-acq_parameters.doppler_max)) / static_cast(d_doppler_step))); + d_num_doppler_bins = static_cast(std::ceil(static_cast(static_cast(acq_parameters.doppler_max) - static_cast(-acq_parameters.doppler_max)) / static_cast(d_doppler_step))); // Create the carrier Doppler wipeoff signals d_grid_doppler_wipeoffs = new gr_complex*[d_num_doppler_bins]; if (acq_parameters.make_2_steps) { d_grid_doppler_wipeoffs_step_two = new gr_complex*[d_num_doppler_bins_step2]; - for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins_step2; doppler_index++) + for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins_step2; doppler_index++) { d_grid_doppler_wipeoffs_step_two[doppler_index] = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment())); } } d_magnitude_grid = new float*[d_num_doppler_bins]; - for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++) + for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++) { d_grid_doppler_wipeoffs[doppler_index] = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_magnitude_grid[doppler_index] = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment())); - for (unsigned k = 0; k < d_fft_size; k++) + for (uint32_t k = 0; k < d_fft_size; k++) { d_magnitude_grid[doppler_index][k] = 0.0; } - int doppler = -static_cast(acq_parameters.doppler_max) + d_doppler_step * doppler_index; + int32_t doppler = -static_cast(acq_parameters.doppler_max) + d_doppler_step * doppler_index; update_local_carrier(d_grid_doppler_wipeoffs[doppler_index], d_fft_size, d_old_freq + doppler); } @@ -298,7 +298,7 @@ void pcps_acquisition::init() if (acq_parameters.dump) { - unsigned int effective_fft_size = (acq_parameters.bit_transition_flag ? (d_fft_size / 2) : d_fft_size); + uint32_t effective_fft_size = (acq_parameters.bit_transition_flag ? (d_fft_size / 2) : d_fft_size); grid_ = arma::fmat(effective_fft_size, d_num_doppler_bins, arma::fill::zeros); narrow_grid_ = arma::fmat(effective_fft_size, d_num_doppler_bins_step2, arma::fill::zeros); } @@ -307,9 +307,9 @@ void pcps_acquisition::init() void pcps_acquisition::update_grid_doppler_wipeoffs() { - for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++) + for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++) { - int doppler = -static_cast(acq_parameters.doppler_max) + d_doppler_step * doppler_index; + int32_t doppler = -static_cast(acq_parameters.doppler_max) + d_doppler_step * doppler_index; update_local_carrier(d_grid_doppler_wipeoffs[doppler_index], d_fft_size, d_old_freq + doppler); } } @@ -317,7 +317,7 @@ void pcps_acquisition::update_grid_doppler_wipeoffs() void pcps_acquisition::update_grid_doppler_wipeoffs_step2() { - for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins_step2; doppler_index++) + for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins_step2; doppler_index++) { float doppler = (static_cast(doppler_index) - static_cast(floor(d_num_doppler_bins_step2 / 2.0))) * acq_parameters.doppler_step2; update_local_carrier(d_grid_doppler_wipeoffs_step_two[doppler_index], d_fft_size, d_doppler_center_step_two + doppler); @@ -325,7 +325,7 @@ void pcps_acquisition::update_grid_doppler_wipeoffs_step2() } -void pcps_acquisition::set_state(int state) +void pcps_acquisition::set_state(int32_t state) { gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler d_state = state; @@ -385,7 +385,7 @@ void pcps_acquisition::send_negative_acquisition() } -void pcps_acquisition::dump_results(int effective_fft_size) +void pcps_acquisition::dump_results(int32_t effective_fft_size) { d_dump_number++; std::string filename = acq_parameters.dump_filename; @@ -488,16 +488,16 @@ void pcps_acquisition::dump_results(int effective_fft_size) } -float pcps_acquisition::max_to_input_power_statistic(uint32_t& indext, int& doppler, float input_power, unsigned int num_doppler_bins, int doppler_max, int doppler_step) +float pcps_acquisition::max_to_input_power_statistic(uint32_t& indext, int32_t& doppler, float input_power, uint32_t num_doppler_bins, int32_t doppler_max, int32_t doppler_step) { float grid_maximum = 0.0; - unsigned int index_doppler = 0; + uint32_t index_doppler = 0; uint32_t tmp_intex_t = 0; uint32_t index_time = 0; float fft_normalization_factor = static_cast(d_fft_size) * static_cast(d_fft_size); // Find the correlation peak and the carrier frequency - for (unsigned int i = 0; i < num_doppler_bins; i++) + for (uint32_t i = 0; i < num_doppler_bins; i++) { volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_magnitude_grid[i], d_fft_size); if (d_magnitude_grid[i][tmp_intex_t] > grid_maximum) @@ -522,19 +522,19 @@ float pcps_acquisition::max_to_input_power_statistic(uint32_t& indext, int& dopp } -float pcps_acquisition::first_vs_second_peak_statistic(uint32_t& indext, int& doppler, unsigned int num_doppler_bins, int doppler_max, int doppler_step) +float pcps_acquisition::first_vs_second_peak_statistic(uint32_t& indext, int32_t& doppler, uint32_t num_doppler_bins, int32_t doppler_max, int32_t doppler_step) { // Look for correlation peaks in the results // Find the highest peak and compare it to the second highest peak // The second peak is chosen not closer than 1 chip to the highest peak float firstPeak = 0.0; - unsigned int index_doppler = 0; + uint32_t index_doppler = 0; uint32_t tmp_intex_t = 0; uint32_t index_time = 0; // Find the correlation peak and the carrier frequency - for (unsigned int i = 0; i < num_doppler_bins; i++) + for (uint32_t i = 0; i < num_doppler_bins; i++) { volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_magnitude_grid[i], d_fft_size); if (d_magnitude_grid[i][tmp_intex_t] > firstPeak) @@ -588,14 +588,14 @@ float pcps_acquisition::first_vs_second_peak_statistic(uint32_t& indext, int& do } -void pcps_acquisition::acquisition_core(unsigned long int samp_count) +void pcps_acquisition::acquisition_core(uint64_t samp_count) { gr::thread::scoped_lock lk(d_setlock); // Initialize acquisition algorithm - int doppler = 0; + int32_t doppler = 0; uint32_t indext = 0; - int effective_fft_size = (acq_parameters.bit_transition_flag ? d_fft_size / 2 : d_fft_size); + int32_t effective_fft_size = (acq_parameters.bit_transition_flag ? d_fft_size / 2 : d_fft_size); if (d_cshort) { volk_gnsssdr_16ic_convert_32fc(d_data_buffer, d_data_buffer_sc, d_consumed_samples); @@ -603,7 +603,7 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count) memcpy(d_input_signal, d_data_buffer, d_consumed_samples * sizeof(gr_complex)); if (d_fft_size > d_consumed_samples) { - for (unsigned int i = d_consumed_samples; i < d_fft_size; i++) + for (uint32_t i = d_consumed_samples; i < d_fft_size; i++) { d_input_signal[i] = gr_complex(0.0, 0.0); } @@ -634,7 +634,7 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count) // Doppler frequency grid loop if (!d_step_two) { - for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++) + for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++) { // Remove Doppler volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in, d_grid_doppler_wipeoffs[doppler_index], d_fft_size); @@ -682,7 +682,7 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count) } else { - for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins_step2; doppler_index++) + for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins_step2; doppler_index++) { volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in, d_grid_doppler_wipeoffs_step_two[doppler_index], d_fft_size); @@ -814,9 +814,9 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count) d_num_noncoherent_integrations_counter = 0; d_positive_acq = 0; // Reset grid - for (unsigned int i = 0; i < d_num_doppler_bins; i++) + for (uint32_t i = 0; i < d_num_doppler_bins; i++) { - for (unsigned k = 0; k < d_fft_size; k++) + for (uint32_t k = 0; k < d_fft_size; k++) { d_magnitude_grid[i][k] = 0.0; } @@ -879,7 +879,7 @@ int pcps_acquisition::general_work(int noutput_items __attribute__((unused)), } case 1: { - unsigned int buff_increment; + uint32_t buff_increment; if (d_cshort) { const lv_16sc_t* in = reinterpret_cast(input_items[0]); // Get the input samples pointer diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h index 382a76faf..c97daef96 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h @@ -82,21 +82,21 @@ private: pcps_acquisition(const Acq_Conf& conf_); - void update_local_carrier(gr_complex* carrier_vector, int correlator_length_samples, float freq); + void update_local_carrier(gr_complex* carrier_vector, int32_t correlator_length_samples, float freq); void update_grid_doppler_wipeoffs(); void update_grid_doppler_wipeoffs_step2(); bool is_fdma(); - void acquisition_core(unsigned long int samp_count); + void acquisition_core(uint64_t samp_count); void send_negative_acquisition(); void send_positive_acquisition(); - void dump_results(int effective_fft_size); + void dump_results(int32_t effective_fft_size); - float first_vs_second_peak_statistic(uint32_t& indext, int& doppler, unsigned int num_doppler_bins, int doppler_max, int doppler_step); - float max_to_input_power_statistic(uint32_t& indext, int& doppler, float input_power, unsigned int num_doppler_bins, int doppler_max, int doppler_step); + float first_vs_second_peak_statistic(uint32_t& indext, int32_t& doppler, uint32_t num_doppler_bins, int32_t doppler_max, int32_t doppler_step); + float max_to_input_power_statistic(uint32_t& indext, int32_t& doppler, float input_power, uint32_t num_doppler_bins, int32_t doppler_max, int32_t doppler_step); Acq_Conf acq_parameters; bool d_active; @@ -104,7 +104,7 @@ private: bool d_cshort; bool d_step_two; bool d_use_CFAR_algorithm_flag; - int d_positive_acq; + int32_t d_positive_acq; float d_threshold; float d_mag; float d_input_power; @@ -114,16 +114,16 @@ private: float* d_tmp_buffer; gr_complex* d_input_signal; uint32_t d_samplesPerChip; - long d_old_freq; - int d_state; - unsigned int d_channel; - unsigned int d_doppler_step; + int64_t d_old_freq; + int32_t d_state; + uint32_t d_channel; + uint32_t d_doppler_step; float d_doppler_center_step_two; - unsigned int d_num_noncoherent_integrations_counter; - unsigned int d_fft_size; - unsigned int d_consumed_samples; - unsigned int d_num_doppler_bins; - unsigned long int d_sample_counter; + uint32_t d_num_noncoherent_integrations_counter; + uint32_t d_fft_size; + uint32_t d_consumed_samples; + uint32_t d_num_doppler_bins; + uint64_t d_sample_counter; gr_complex** d_grid_doppler_wipeoffs; gr_complex** d_grid_doppler_wipeoffs_step_two; gr_complex* d_fft_codes; @@ -134,10 +134,10 @@ private: Gnss_Synchro* d_gnss_synchro; arma::fmat grid_; arma::fmat narrow_grid_; - unsigned int d_num_doppler_bins_step2; - long int d_dump_number; - unsigned int d_dump_channel; - unsigned int d_buffer_count; + uint32_t d_num_doppler_bins_step2; + int64_t d_dump_number; + uint32_t d_dump_channel; + uint32_t d_buffer_count; public: ~pcps_acquisition(); @@ -156,7 +156,7 @@ public: /*! * \brief Returns the maximum peak of grid search. */ - inline unsigned int mag() const + inline uint32_t mag() const { return d_mag; } @@ -188,13 +188,13 @@ public: * first available sample. * \param state - int=1 forces start of acquisition */ - void set_state(int state); + void set_state(int32_t state); /*! * \brief Set acquisition channel unique ID * \param channel - receiver channel. */ - inline void set_channel(unsigned int channel) + inline void set_channel(uint32_t channel) { gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler d_channel = channel; @@ -215,7 +215,7 @@ public: * \brief Set maximum Doppler grid search * \param doppler_max - Maximum Doppler shift considered in the grid search [Hz]. */ - inline void set_doppler_max(unsigned int doppler_max) + inline void set_doppler_max(uint32_t doppler_max) { gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler acq_parameters.doppler_max = doppler_max; @@ -225,7 +225,7 @@ public: * \brief Set Doppler steps for the grid search * \param doppler_step - Frequency bin of the search grid [Hz]. */ - inline void set_doppler_step(unsigned int doppler_step) + inline void set_doppler_step(uint32_t doppler_step) { gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler d_doppler_step = doppler_step; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.h index 4bdf583d5..6c34ad565 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.h @@ -98,7 +98,7 @@ private: int d_num_doppler_points; int d_doppler_step; unsigned int d_fft_size; - unsigned long int d_sample_counter; + uint64_t d_sample_counter; gr_complex* d_carrier; gr_complex* d_fft_codes; gr_complex* d_10_ms_buffer; @@ -124,8 +124,8 @@ private: std::string d_dump_filename; - arma::fmat grid_; - long int d_dump_number; + arma ::fmat grid_; + int64_t d_dump_number; unsigned int d_dump_channel; public: diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h index 1ee9a773a..3555e5df1 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h @@ -113,7 +113,7 @@ private: unsigned int d_doppler_step; unsigned int d_fft_size; unsigned int d_num_doppler_bins; - unsigned long int d_sample_counter; + uint64_t d_sample_counter; Gnss_Synchro* d_gnss_synchro; std::shared_ptr acquisition_fpga; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.h index 932cd05e0..70b73f715 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.h @@ -112,7 +112,7 @@ private: int d_doppler_step; unsigned int d_sampled_ms; unsigned int d_fft_size; - unsigned long int d_sample_counter; + uint64_t d_sample_counter; gr_complex* d_carrier; gr_complex* d_fft_codes; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.h index 56a5f6050..00348daa9 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.h @@ -88,7 +88,7 @@ private: unsigned int d_max_dwells; unsigned int d_well_count; unsigned int d_fft_size; - unsigned long int d_sample_counter; + uint64_t d_sample_counter; gr_complex** d_grid_doppler_wipeoffs; unsigned int d_num_doppler_bins; gr_complex* d_fft_code_data; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc index 0f90c2c38..ad09acde1 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc @@ -387,7 +387,7 @@ void pcps_opencl_acquisition_cc::acquisition_core_volk() float magt = 0.0; float fft_normalization_factor = static_cast(d_fft_size) * static_cast(d_fft_size); gr_complex *in = d_in_buffer[d_well_count]; - unsigned long int samplestamp = d_sample_counter_buffer[d_well_count]; + uint64_t samplestamp = d_sample_counter_buffer[d_well_count]; d_input_power = 0.0; d_mag = 0.0; @@ -510,7 +510,7 @@ void pcps_opencl_acquisition_cc::acquisition_core_opencl() float magt = 0.0; float fft_normalization_factor = (static_cast(d_fft_size_pow2) * static_cast(d_fft_size)); //This works, but I am not sure why. gr_complex *in = d_in_buffer[d_well_count]; - unsigned long int samplestamp = d_sample_counter_buffer[d_well_count]; + uint64_t samplestamp = d_sample_counter_buffer[d_well_count]; d_input_power = 0.0; d_mag = 0.0; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.h index e70a8d342..df6947f47 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.h @@ -121,7 +121,7 @@ private: unsigned int d_fft_size; unsigned int d_fft_size_pow2; int* d_max_doppler_indexs; - unsigned long int d_sample_counter; + uint64_t d_sample_counter; gr_complex** d_grid_doppler_wipeoffs; unsigned int d_num_doppler_bins; gr_complex* d_fft_codes; @@ -144,7 +144,7 @@ private: std::string d_dump_filename; gr_complex* d_zero_vector; gr_complex** d_in_buffer; - std::vector d_sample_counter_buffer; + std::vector d_sample_counter_buffer; unsigned int d_in_dwell_count; cl::Platform d_cl_platform; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.h index 8310b90ad..56f363dbf 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.h @@ -127,7 +127,7 @@ private: unsigned int d_max_dwells; unsigned int d_well_count; unsigned int d_fft_size; - unsigned long int d_sample_counter; + uint64_t d_sample_counter; gr_complex** d_grid_doppler_wipeoffs; unsigned int d_num_doppler_bins; gr_complex* d_fft_codes; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.h index dc231fac0..7508fb42c 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.h @@ -108,7 +108,7 @@ private: unsigned int d_tong_max_val; unsigned int d_tong_max_dwells; unsigned int d_fft_size; - unsigned long int d_sample_counter; + uint64_t d_sample_counter; gr_complex** d_grid_doppler_wipeoffs; unsigned int d_num_doppler_bins; gr_complex* d_fft_codes; diff --git a/src/algorithms/channel/adapters/channel.cc b/src/algorithms/channel/adapters/channel.cc index 480212e3a..154f75a4d 100644 --- a/src/algorithms/channel/adapters/channel.cc +++ b/src/algorithms/channel/adapters/channel.cc @@ -34,7 +34,7 @@ #include "gnss_sdr_flags.h" #include #include - +#include using google::LogMessage; @@ -66,7 +66,7 @@ Channel::Channel(ConfigurationInterface* configuration, unsigned int channel, // Provide a warning to the user about the change of parameter name if (channel_ == 0) { - long int deprecation_warning = configuration->property("GNSS-SDR.internal_fs_hz", 0); + int64_t deprecation_warning = configuration->property("GNSS-SDR.internal_fs_hz", 0); if (deprecation_warning != 0) { std::cout << "WARNING: The global parameter name GNSS-SDR.internal_fs_hz has been DEPRECATED." << std::endl; diff --git a/src/algorithms/channel/libs/channel_msg_receiver_cc.cc b/src/algorithms/channel/libs/channel_msg_receiver_cc.cc index ca4105f8e..f77f8c883 100644 --- a/src/algorithms/channel/libs/channel_msg_receiver_cc.cc +++ b/src/algorithms/channel/libs/channel_msg_receiver_cc.cc @@ -33,6 +33,7 @@ #include #include #include +#include using google::LogMessage; @@ -48,7 +49,7 @@ void channel_msg_receiver_cc::msg_handler_events(pmt::pmt_t msg) bool result = false; try { - long int message = pmt::to_long(msg); + int64_t message = pmt::to_long(msg); switch (message) { case 1: // positive acquisition diff --git a/src/algorithms/libs/gnss_sdr_fpga_sample_counter.cc b/src/algorithms/libs/gnss_sdr_fpga_sample_counter.cc index 661275538..fd5709ceb 100644 --- a/src/algorithms/libs/gnss_sdr_fpga_sample_counter.cc +++ b/src/algorithms/libs/gnss_sdr_fpga_sample_counter.cc @@ -36,9 +36,9 @@ #include #include -gnss_sdr_fpga_sample_counter::gnss_sdr_fpga_sample_counter(double _fs, int _interval_ms) : gr::block("fpga_fpga_sample_counter", - gr::io_signature::make(0, 0, 0), - gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) +gnss_sdr_fpga_sample_counter::gnss_sdr_fpga_sample_counter(double _fs, int32_t _interval_ms) : gr::block("fpga_fpga_sample_counter", + gr::io_signature::make(0, 0, 0), + gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) { message_port_register_out(pmt::mp("fpga_sample_counter")); set_max_noutput_items(1); @@ -64,7 +64,7 @@ gnss_sdr_fpga_sample_counter::gnss_sdr_fpga_sample_counter(double _fs, int _inte } -gnss_sdr_fpga_sample_counter_sptr gnss_sdr_make_fpga_sample_counter(double _fs, int _interval_ms) +gnss_sdr_fpga_sample_counter_sptr gnss_sdr_make_fpga_sample_counter(double _fs, int32_t _interval_ms) { gnss_sdr_fpga_sample_counter_sptr fpga_sample_counter_(new gnss_sdr_fpga_sample_counter(_fs, _interval_ms)); return fpga_sample_counter_; @@ -79,6 +79,7 @@ bool gnss_sdr_fpga_sample_counter::start() return true; } + // Called by GNURadio to disable drivers, etc for i/o devices. bool gnss_sdr_fpga_sample_counter::stop() { @@ -100,7 +101,6 @@ int gnss_sdr_fpga_sample_counter::general_work(int noutput_items __attribute__(( // Possible problem: what happen if the PS is overloaded and gnuradio does not call this function // with the sufficient rate to catch all the interrupts in the counter. To be evaluated later. - Gnss_Synchro *out = reinterpret_cast(output_items[0]); out[0] = Gnss_Synchro(); out[0].Flag_valid_symbol_output = false; diff --git a/src/algorithms/libs/gnss_sdr_fpga_sample_counter.h b/src/algorithms/libs/gnss_sdr_fpga_sample_counter.h index 684feaffa..4ea9397ae 100644 --- a/src/algorithms/libs/gnss_sdr_fpga_sample_counter.h +++ b/src/algorithms/libs/gnss_sdr_fpga_sample_counter.h @@ -33,37 +33,37 @@ #include #include - +#include class gnss_sdr_fpga_sample_counter; typedef boost::shared_ptr gnss_sdr_fpga_sample_counter_sptr; -gnss_sdr_fpga_sample_counter_sptr gnss_sdr_make_fpga_sample_counter(double _fs, int _interval_ms); +gnss_sdr_fpga_sample_counter_sptr gnss_sdr_make_fpga_sample_counter(double _fs, int32_t _interval_ms); class gnss_sdr_fpga_sample_counter : public gr::block { private: - gnss_sdr_fpga_sample_counter(double _fs, int _interval_ms); + gnss_sdr_fpga_sample_counter(double _fs, int32_t _interval_ms); bool start(); bool stop(); - unsigned int samples_per_output; + uint32_t samples_per_output; double fs; - unsigned long long int sample_counter; - int interval_ms; - long long int current_T_rx_ms; // Receiver time in ms since the beginning of the run - unsigned int current_s; // Receiver time in seconds, modulo 60 - bool flag_m; // True if the receiver has been running for at least 1 minute - unsigned int current_m; // Receiver time in minutes, modulo 60 - bool flag_h; // True if the receiver has been running for at least 1 hour - unsigned int current_h; // Receiver time in hours, modulo 24 - bool flag_days; // True if the receiver has been running for at least 1 day - unsigned int current_days; // Receiver time in days since the beginning of the run - int report_interval_ms; + uint64_t sample_counter; + int32_t interval_ms; + int64_t current_T_rx_ms; // Receiver time in ms since the beginning of the run + uint32_t current_s; // Receiver time in seconds, modulo 60 + bool flag_m; // True if the receiver has been running for at least 1 minute + uint32_t current_m; // Receiver time in minutes, modulo 60 + bool flag_h; // True if the receiver has been running for at least 1 hour + uint32_t current_h; // Receiver time in hours, modulo 24 + bool flag_days; // True if the receiver has been running for at least 1 day + uint32_t current_days; // Receiver time in days since the beginning of the run + int32_t report_interval_ms; bool flag_enable_send_msg; public: - friend gnss_sdr_fpga_sample_counter_sptr gnss_sdr_make_fpga_sample_counter(double _fs, int _interval_ms); + friend gnss_sdr_fpga_sample_counter_sptr gnss_sdr_make_fpga_sample_counter(double _fs, int32_t _interval_ms); int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, diff --git a/src/algorithms/libs/gnss_sdr_sample_counter.cc b/src/algorithms/libs/gnss_sdr_sample_counter.cc index b05f17906..9fdc7e00e 100644 --- a/src/algorithms/libs/gnss_sdr_sample_counter.cc +++ b/src/algorithms/libs/gnss_sdr_sample_counter.cc @@ -36,10 +36,10 @@ #include #include -gnss_sdr_sample_counter::gnss_sdr_sample_counter(double _fs, int _interval_ms, size_t _size) : gr::sync_decimator("sample_counter", - gr::io_signature::make(1, 1, _size), - gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)), - static_cast(std::round(_fs * static_cast(_interval_ms) / 1e3))) +gnss_sdr_sample_counter::gnss_sdr_sample_counter(double _fs, int32_t _interval_ms, size_t _size) : gr::sync_decimator("sample_counter", + gr::io_signature::make(1, 1, _size), + gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)), + static_cast(std::round(_fs * static_cast(_interval_ms) / 1e3))) { message_port_register_out(pmt::mp("sample_counter")); set_max_noutput_items(1); @@ -60,7 +60,7 @@ gnss_sdr_sample_counter::gnss_sdr_sample_counter(double _fs, int _interval_ms, s } -gnss_sdr_sample_counter_sptr gnss_sdr_make_sample_counter(double _fs, int _interval_ms, size_t _size) +gnss_sdr_sample_counter_sptr gnss_sdr_make_sample_counter(double _fs, int32_t _interval_ms, size_t _size) { gnss_sdr_sample_counter_sptr sample_counter_(new gnss_sdr_sample_counter(_fs, _interval_ms, _size)); return sample_counter_; diff --git a/src/algorithms/libs/gnss_sdr_sample_counter.h b/src/algorithms/libs/gnss_sdr_sample_counter.h index 5ff72951f..90c05cb28 100644 --- a/src/algorithms/libs/gnss_sdr_sample_counter.h +++ b/src/algorithms/libs/gnss_sdr_sample_counter.h @@ -33,35 +33,36 @@ #include #include +#include class gnss_sdr_sample_counter; typedef boost::shared_ptr gnss_sdr_sample_counter_sptr; -gnss_sdr_sample_counter_sptr gnss_sdr_make_sample_counter(double _fs, int _interval_ms, size_t _size); +gnss_sdr_sample_counter_sptr gnss_sdr_make_sample_counter(double _fs, int32_t _interval_ms, size_t _size); class gnss_sdr_sample_counter : public gr::sync_decimator { private: - gnss_sdr_sample_counter(double _fs, int _interval_ms, size_t _size); - unsigned int samples_per_output; + gnss_sdr_sample_counter(double _fs, int32_t _interval_ms, size_t _size); + uint32_t samples_per_output; double fs; - unsigned long long int sample_counter; - int interval_ms; - long long int current_T_rx_ms; // Receiver time in ms since the beginning of the run - unsigned int current_s; // Receiver time in seconds, modulo 60 - bool flag_m; // True if the receiver has been running for at least 1 minute - unsigned int current_m; // Receiver time in minutes, modulo 60 - bool flag_h; // True if the receiver has been running for at least 1 hour - unsigned int current_h; // Receiver time in hours, modulo 24 - bool flag_days; // True if the receiver has been running for at least 1 day - unsigned int current_days; // Receiver time in days since the beginning of the run - int report_interval_ms; + uint64_t sample_counter; + int32_t interval_ms; + int64_t current_T_rx_ms; // Receiver time in ms since the beginning of the run + uint32_t current_s; // Receiver time in seconds, modulo 60 + bool flag_m; // True if the receiver has been running for at least 1 minute + uint32_t current_m; // Receiver time in minutes, modulo 60 + bool flag_h; // True if the receiver has been running for at least 1 hour + uint32_t current_h; // Receiver time in hours, modulo 24 + bool flag_days; // True if the receiver has been running for at least 1 day + uint32_t current_days; // Receiver time in days since the beginning of the run + int32_t report_interval_ms; bool flag_enable_send_msg; public: - friend gnss_sdr_sample_counter_sptr gnss_sdr_make_sample_counter(double _fs, int _interval_ms, size_t _size); + friend gnss_sdr_sample_counter_sptr gnss_sdr_make_sample_counter(double _fs, int32_t _interval_ms, size_t _size); int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); diff --git a/src/algorithms/libs/gnss_sdr_time_counter.h b/src/algorithms/libs/gnss_sdr_time_counter.h index 91261e37d..12cc8094b 100644 --- a/src/algorithms/libs/gnss_sdr_time_counter.h +++ b/src/algorithms/libs/gnss_sdr_time_counter.h @@ -33,7 +33,7 @@ #include #include - +#include class gnss_sdr_time_counter; @@ -45,20 +45,20 @@ class gnss_sdr_time_counter : public gr::block { private: gnss_sdr_time_counter(); - long long int current_T_rx_ms; // Receiver time in ms since the beginning of the run - unsigned int current_s; // Receiver time in seconds, modulo 60 - bool flag_m; // True if the receiver has been running for at least 1 minute - unsigned int current_m; // Receiver time in minutes, modulo 60 - bool flag_h; // True if the receiver has been running for at least 1 hour - unsigned int current_h; // Receiver time in hours, modulo 24 - bool flag_days; // True if the receiver has been running for at least 1 day - unsigned int current_days; // Receiver time in days since the beginning of the run - int report_interval_ms; + int64_t current_T_rx_ms; // Receiver time in ms since the beginning of the run + uint32_t current_s; // Receiver time in seconds, modulo 60 + bool flag_m; // True if the receiver has been running for at least 1 minute + uint32_t current_m; // Receiver time in minutes, modulo 60 + bool flag_h; // True if the receiver has been running for at least 1 hour + uint32_t current_h; // Receiver time in hours, modulo 24 + bool flag_days; // True if the receiver has been running for at least 1 day + uint32_t current_days; // Receiver time in days since the beginning of the run + int32_t report_interval_ms; public: friend gnss_sdr_time_counter_sptr gnss_sdr_make_time_counter(); int general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), - gr_vector_const_void_star &input_items __attribute__((unused)), gr_vector_void_star &output_items); + gr_vector_const_void_star &input_items __attribute__((unused)), gr_vector_void_star &output_items); }; #endif /*GNSS_SDR_SAMPLE_COUNTER_H_*/ diff --git a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc index a2ef3e1c7..d18285db5 100644 --- a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc +++ b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc @@ -134,11 +134,11 @@ int hybrid_observables_cc::save_matfile() return 1; } // count number of epochs and rewind - long int num_epoch = 0; + int64_t num_epoch = 0; if (dump_file.is_open()) { size = dump_file.tellg(); - num_epoch = static_cast(size) / static_cast(epoch_size_bytes); + num_epoch = static_cast(size) / static_cast(epoch_size_bytes); dump_file.seekg(0, std::ios::beg); } else @@ -168,7 +168,7 @@ int hybrid_observables_cc::save_matfile() { if (dump_file.is_open()) { - for (long int i = 0; i < num_epoch; i++) + for (int64_t i = 0; i < num_epoch; i++) { for (unsigned int chan = 0; chan < d_nchannels_out; chan++) { @@ -216,7 +216,7 @@ int hybrid_observables_cc::save_matfile() double *PRN_aux = new double[d_nchannels_out * num_epoch]; double *Flag_valid_pseudorange_aux = new double[d_nchannels_out * num_epoch]; unsigned int k = 0; - for (long int j = 0; j < num_epoch; j++) + for (int64_t j = 0; j < num_epoch; j++) { for (unsigned int i = 0; i < d_nchannels_out; i++) { @@ -241,7 +241,7 @@ int hybrid_observables_cc::save_matfile() } filename.append(".mat"); matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - if (reinterpret_cast(matfp) != NULL) + if (reinterpret_cast(matfp) != NULL) { size_t dims[2] = {static_cast(d_nchannels_out), static_cast(num_epoch)}; matvar = Mat_VarCreate("RX_time", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, RX_time_aux, MAT_F_DONT_COPY_DATA); @@ -308,14 +308,14 @@ double hybrid_observables_cc::compute_T_rx_s(const Gnss_Synchro &a) return ((static_cast(a.Tracking_sample_counter) + a.Code_phase_samples) / static_cast(a.fs)); } -bool hybrid_observables_cc::interp_trk_obs(Gnss_Synchro &interpolated_obs, const unsigned int &ch, const unsigned long int &rx_clock) +bool hybrid_observables_cc::interp_trk_obs(Gnss_Synchro &interpolated_obs, const unsigned int &ch, const uint64_t &rx_clock) { int nearest_element = -1; - long int abs_diff; - long int old_abs_diff = std::numeric_limits::max(); + int64_t abs_diff; + int64_t old_abs_diff = std::numeric_limits::max(); for (unsigned int i = 0; i < d_gnss_synchro_history->size(ch); i++) { - abs_diff = labs(static_cast(rx_clock) - static_cast(d_gnss_synchro_history->at(ch, i).Tracking_sample_counter)); + abs_diff = labs(static_cast(rx_clock) - static_cast(d_gnss_synchro_history->at(ch, i).Tracking_sample_counter)); if (old_abs_diff > abs_diff) { old_abs_diff = abs_diff; diff --git a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.h b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.h index a5ffddcd9..61294cc70 100644 --- a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.h +++ b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.h @@ -66,14 +66,14 @@ private: hybrid_make_observables_cc(unsigned int nchannels_in, unsigned int nchannels_out, bool dump, std::string dump_filename); hybrid_observables_cc(unsigned int nchannels_in, unsigned int nchannels_out, bool dump, std::string dump_filename); bool interpolate_data(Gnss_Synchro& out, const unsigned int& ch, const double& ti); - bool interp_trk_obs(Gnss_Synchro& interpolated_obs, const unsigned int& ch, const unsigned long int& rx_clock); + bool interp_trk_obs(Gnss_Synchro& interpolated_obs, const unsigned int& ch, const uint64_t& rx_clock); double compute_T_rx_s(const Gnss_Synchro& a); void compute_pranges(std::vector& data); void update_TOW(std::vector& data); int save_matfile(); //time history - boost::circular_buffer d_Rx_clock_buffer; + boost::circular_buffer d_Rx_clock_buffer; //Tracking observable history Gnss_circular_deque* d_gnss_synchro_history; unsigned int T_rx_clock_step_samples; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.cc index 2e4256b42..6b6e76a2a 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.cc @@ -474,11 +474,11 @@ int galileo_e1b_telemetry_decoder_cc::general_work(int noutput_items __attribute try { double tmp_double; - unsigned long int tmp_ulong_int; + uint64_t tmp_ulong_int; tmp_double = static_cast(d_TOW_at_current_symbol_ms) / 1000.0; d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); tmp_ulong_int = current_symbol.Tracking_sample_counter; - d_dump_file.write(reinterpret_cast(&tmp_ulong_int), sizeof(unsigned long int)); + d_dump_file.write(reinterpret_cast(&tmp_ulong_int), sizeof(uint64_t)); tmp_double = static_cast(d_TOW_at_Preamble_ms) / 1000.0; d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.h index 36803eccf..061855994 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.h @@ -89,8 +89,8 @@ private: std::deque d_symbol_history; - long unsigned int d_sample_counter; - long unsigned int d_preamble_index; + uint64_t d_sample_counter; + uint64_t d_preamble_index; unsigned int d_stat; bool d_flag_frame_sync; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e5a_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e5a_telemetry_decoder_cc.cc index a4ef0da6e..e9a96343b 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e5a_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e5a_telemetry_decoder_cc.cc @@ -487,11 +487,11 @@ int galileo_e5a_telemetry_decoder_cc::general_work(int noutput_items __attribute try { double tmp_double; - unsigned long int tmp_ulong_int; + uint64_t tmp_ulong_int; tmp_double = static_cast(d_TOW_at_current_symbol_ms) / 1000.0; d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); tmp_ulong_int = current_sample.Tracking_sample_counter; - d_dump_file.write(reinterpret_cast(&tmp_ulong_int), sizeof(unsigned long int)); + d_dump_file.write(reinterpret_cast(&tmp_ulong_int), sizeof(uint64_t)); tmp_double = static_cast(d_TOW_at_Preamble_ms) / 1000.0; d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e5a_telemetry_decoder_cc.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e5a_telemetry_decoder_cc.h index 5416af8f5..88f7b49fa 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e5a_telemetry_decoder_cc.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e5a_telemetry_decoder_cc.h @@ -94,8 +94,8 @@ private: int d_symbol_counter; int corr_value; unsigned int required_symbols; - long unsigned int d_sample_counter; - long unsigned int d_preamble_index; + uint64_t d_sample_counter; + uint64_t d_preamble_index; bool d_flag_frame_sync; bool d_flag_preamble; bool d_dump; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc index 4c246e90c..5244a0fed 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.cc @@ -423,11 +423,11 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu try { double tmp_double; - unsigned long int tmp_ulong_int; + uint64_t tmp_ulong_int; tmp_double = d_TOW_at_current_symbol; d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); tmp_ulong_int = current_symbol.Tracking_sample_counter; - d_dump_file.write(reinterpret_cast(&tmp_ulong_int), sizeof(unsigned long int)); + d_dump_file.write(reinterpret_cast(&tmp_ulong_int), sizeof(uint64_t)); tmp_double = 0; d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.h index fd3d8d5d8..ff16a10d2 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_cc.h @@ -91,15 +91,15 @@ private: std::deque d_symbol_history; //!< Variables for internal functionality - long unsigned int d_sample_counter; //!< Sample counter as an index (1,2,3,..etc) indicating number of samples processed - long unsigned int d_preamble_index; //!< Index of sample number where preamble was found - unsigned int d_stat; //!< Status of decoder - bool d_flag_frame_sync; //!< Indicate when a frame sync is achieved - bool d_flag_parity; //!< Flag indicating when parity check was achieved (crc check) - bool d_flag_preamble; //!< Flag indicating when preamble was found - int d_CRC_error_counter; //!< Number of failed CRC operations - bool flag_TOW_set; //!< Indicates when time of week is set - double delta_t; //!< GPS-GLONASS time offset + uint64_t d_sample_counter; //!< Sample counter as an index (1,2,3,..etc) indicating number of samples processed + uint64_t d_preamble_index; //!< Index of sample number where preamble was found + unsigned int d_stat; //!< Status of decoder + bool d_flag_frame_sync; //!< Indicate when a frame sync is achieved + bool d_flag_parity; //!< Flag indicating when parity check was achieved (crc check) + bool d_flag_preamble; //!< Flag indicating when preamble was found + int d_CRC_error_counter; //!< Number of failed CRC operations + bool flag_TOW_set; //!< Indicates when time of week is set + double delta_t; //!< GPS-GLONASS time offset //!< Navigation Message variable Glonass_Gnav_Navigation_Message d_nav; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_cc.cc index bf4181fb9..7e9f03258 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_cc.cc @@ -423,11 +423,11 @@ int glonass_l2_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu try { double tmp_double; - unsigned long int tmp_ulong_int; + uint64_t tmp_ulong_int; tmp_double = d_TOW_at_current_symbol; d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); tmp_ulong_int = current_symbol.Tracking_sample_counter; - d_dump_file.write(reinterpret_cast(&tmp_ulong_int), sizeof(unsigned long int)); + d_dump_file.write(reinterpret_cast(&tmp_ulong_int), sizeof(uint64_t)); tmp_double = 0; d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_cc.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_cc.h index bad3ad62f..e55699856 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_cc.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_cc.h @@ -89,15 +89,15 @@ private: std::deque d_symbol_history; //!< Variables for internal functionality - long unsigned int d_sample_counter; //!< Sample counter as an index (1,2,3,..etc) indicating number of samples processed - long unsigned int d_preamble_index; //!< Index of sample number where preamble was found - unsigned int d_stat; //!< Status of decoder - bool d_flag_frame_sync; //!< Indicate when a frame sync is achieved - bool d_flag_parity; //!< Flag indicating when parity check was achieved (crc check) - bool d_flag_preamble; //!< Flag indicating when preamble was found - int d_CRC_error_counter; //!< Number of failed CRC operations - bool flag_TOW_set; //!< Indicates when time of week is set - double delta_t; //!< GPS-GLONASS time offset + uint64_t d_sample_counter; //!< Sample counter as an index (1,2,3,..etc) indicating number of samples processed + uint64_t d_preamble_index; //!< Index of sample number where preamble was found + unsigned int d_stat; //!< Status of decoder + bool d_flag_frame_sync; //!< Indicate when a frame sync is achieved + bool d_flag_parity; //!< Flag indicating when parity check was achieved (crc check) + bool d_flag_preamble; //!< Flag indicating when preamble was found + int d_CRC_error_counter; //!< Number of failed CRC operations + bool flag_TOW_set; //!< Indicates when time of week is set + double delta_t; //!< GPS-GLONASS time offset //!< Navigation Message variable Glonass_Gnav_Navigation_Message d_nav; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc index b07b467f6..07bd802cb 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc @@ -457,11 +457,11 @@ int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__ try { double tmp_double; - unsigned long int tmp_ulong_int; + uint64_t tmp_ulong_int; tmp_double = static_cast(d_TOW_at_current_symbol_ms) / 1000.0; d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); tmp_ulong_int = current_symbol.Tracking_sample_counter; - d_dump_file.write(reinterpret_cast(&tmp_ulong_int), sizeof(unsigned long int)); + d_dump_file.write(reinterpret_cast(&tmp_ulong_int), sizeof(uint64_t)); tmp_double = static_cast(d_TOW_at_Preamble_ms) / 1000.0; d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.h index ce35078eb..d7e6bd21a 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.h @@ -97,7 +97,7 @@ private: Gnss_Satellite d_satellite; int d_channel; - unsigned long int d_preamble_time_samples; + uint64_t d_preamble_time_samples; unsigned int d_TOW_at_Preamble_ms; unsigned int d_TOW_at_current_symbol_ms; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_cc.cc index 5cc385207..69f23bcf2 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_cc.cc @@ -210,11 +210,11 @@ int gps_l2c_telemetry_decoder_cc::general_work(int noutput_items __attribute__(( try { double tmp_double; - unsigned long int tmp_ulong_int; + uint64_t tmp_ulong_int; tmp_double = d_TOW_at_current_symbol; d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); tmp_ulong_int = current_synchro_data.Tracking_sample_counter; - d_dump_file.write(reinterpret_cast(&tmp_ulong_int), sizeof(unsigned long int)); + d_dump_file.write(reinterpret_cast(&tmp_ulong_int), sizeof(uint64_t)); tmp_double = d_TOW_at_Preamble; d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_cc.cc index ca050a575..425cfdc1d 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_cc.cc @@ -266,11 +266,11 @@ int gps_l5_telemetry_decoder_cc::general_work(int noutput_items __attribute__((u try { double tmp_double; - unsigned long int tmp_ulong_int; + uint64_t tmp_ulong_int; tmp_double = static_cast(d_TOW_at_current_symbol_ms) / 1000.0; d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); tmp_ulong_int = current_synchro_data.Tracking_sample_counter; - d_dump_file.write(reinterpret_cast(&tmp_ulong_int), sizeof(unsigned long int)); + d_dump_file.write(reinterpret_cast(&tmp_ulong_int), sizeof(uint64_t)); tmp_double = static_cast(d_TOW_at_Preamble_ms) / 1000.0; d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); } diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc index 4362e87b3..491ab3ed3 100755 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc @@ -414,7 +414,7 @@ void dll_pll_veml_tracking::start_tracking() d_acq_carrier_doppler_hz = d_acquisition_gnss_synchro->Acq_doppler_hz; d_acq_sample_stamp = d_acquisition_gnss_synchro->Acq_samplestamp_samples; - long int acq_trk_diff_samples = static_cast(d_sample_counter) - static_cast(d_acq_sample_stamp); + int64_t acq_trk_diff_samples = static_cast(d_sample_counter) - static_cast(d_acq_sample_stamp); double acq_trk_diff_seconds = static_cast(acq_trk_diff_samples) / trk_parameters.fs_in; DLOG(INFO) << "Number of samples between Acquisition and Tracking = " << acq_trk_diff_samples; DLOG(INFO) << "Number of seconds between Acquisition and Tracking = " << acq_trk_diff_seconds; @@ -869,7 +869,7 @@ void dll_pll_veml_tracking::log_data(bool integrating) float tmp_VE, tmp_E, tmp_P, tmp_L, tmp_VL; float tmp_float; double tmp_double; - unsigned long int tmp_long_int; + uint64_t tmp_long_int; if (trk_parameters.track_pilot) { if (interchange_iq) @@ -937,7 +937,7 @@ void dll_pll_veml_tracking::log_data(bool integrating) d_dump_file.write(reinterpret_cast(&prompt_Q), sizeof(float)); // PRN start sample stamp tmp_long_int = d_sample_counter + d_current_prn_length_samples; - d_dump_file.write(reinterpret_cast(&tmp_long_int), sizeof(unsigned long int)); + d_dump_file.write(reinterpret_cast(&tmp_long_int), sizeof(uint64_t)); // accumulated carrier phase tmp_float = d_acc_carrier_phase_rad; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); @@ -984,7 +984,7 @@ int dll_pll_veml_tracking::save_matfile() std::ifstream::pos_type size; int number_of_double_vars = 1; int number_of_float_vars = 17; - int epoch_size_bytes = sizeof(unsigned long int) + sizeof(double) * number_of_double_vars + + int epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars + sizeof(float) * number_of_float_vars + sizeof(unsigned int); std::ifstream dump_file; dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); @@ -998,11 +998,11 @@ int dll_pll_veml_tracking::save_matfile() return 1; } // count number of epochs and rewind - long int num_epoch = 0; + int64_t num_epoch = 0; if (dump_file.is_open()) { size = dump_file.tellg(); - num_epoch = static_cast(size) / static_cast(epoch_size_bytes); + num_epoch = static_cast(size) / static_cast(epoch_size_bytes); dump_file.seekg(0, std::ios::beg); } else @@ -1016,7 +1016,7 @@ int dll_pll_veml_tracking::save_matfile() float *abs_VL = new float[num_epoch]; float *Prompt_I = new float[num_epoch]; float *Prompt_Q = new float[num_epoch]; - unsigned long int *PRN_start_sample_count = new unsigned long int[num_epoch]; + uint64_t *PRN_start_sample_count = new uint64_t[num_epoch]; float *acc_carrier_phase_rad = new float[num_epoch]; float *carrier_doppler_hz = new float[num_epoch]; float *code_freq_chips = new float[num_epoch]; @@ -1034,7 +1034,7 @@ int dll_pll_veml_tracking::save_matfile() { if (dump_file.is_open()) { - for (long int i = 0; i < num_epoch; i++) + for (int64_t i = 0; i < num_epoch; i++) { dump_file.read(reinterpret_cast(&abs_VE[i]), sizeof(float)); dump_file.read(reinterpret_cast(&abs_E[i]), sizeof(float)); @@ -1043,7 +1043,7 @@ int dll_pll_veml_tracking::save_matfile() dump_file.read(reinterpret_cast(&abs_VL[i]), sizeof(float)); dump_file.read(reinterpret_cast(&Prompt_I[i]), sizeof(float)); dump_file.read(reinterpret_cast(&Prompt_Q[i]), sizeof(float)); - dump_file.read(reinterpret_cast(&PRN_start_sample_count[i]), sizeof(unsigned long int)); + dump_file.read(reinterpret_cast(&PRN_start_sample_count[i]), sizeof(uint64_t)); dump_file.read(reinterpret_cast(&acc_carrier_phase_rad[i]), sizeof(float)); dump_file.read(reinterpret_cast(&carrier_doppler_hz[i]), sizeof(float)); dump_file.read(reinterpret_cast(&code_freq_chips[i]), sizeof(float)); @@ -1093,7 +1093,7 @@ int dll_pll_veml_tracking::save_matfile() filename.erase(filename.length() - 4, 4); filename.append(".mat"); matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - if (reinterpret_cast(matfp) != NULL) + if (reinterpret_cast(matfp) != NULL) { size_t dims[2] = {1, static_cast(num_epoch)}; matvar = Mat_VarCreate("abs_VE", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_VE, 0); @@ -1255,7 +1255,7 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused) case 1: // Pull-in { // Signal alignment (skip samples until the incoming signal is aligned with local replica) - unsigned long int acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp; + uint64_t acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp; double acq_trk_shif_correction_samples = static_cast(d_current_prn_length_samples) - std::fmod(static_cast(acq_to_trk_delay_samples), static_cast(d_current_prn_length_samples)); int samples_offset = std::round(d_acq_code_phase_samples + acq_trk_shif_correction_samples); if (samples_offset < 0) @@ -1566,7 +1566,7 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused) d_sample_counter += d_current_prn_length_samples; if (current_synchro_data.Flag_valid_symbol_output) { - current_synchro_data.fs = static_cast(trk_parameters.fs_in); + current_synchro_data.fs = static_cast(trk_parameters.fs_in); current_synchro_data.Tracking_sample_counter = d_sample_counter; *out[0] = current_synchro_data; return 1; diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.h b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.h index b57bc2200..bd6f4dabe 100755 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.h +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.h @@ -177,8 +177,8 @@ private: // PRN period in samples int d_current_prn_length_samples; // processing samples counters - unsigned long int d_sample_counter; - unsigned long int d_acq_sample_stamp; + uint64_t d_sample_counter; + uint64_t d_acq_sample_stamp; // CN0 estimation and lock detector int d_cn0_estimation_counter; diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc index 6dd2af0f7..b6d2816e1 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc @@ -842,7 +842,7 @@ void dll_pll_veml_tracking_fpga::log_data(bool integrating) d_dump_file.write(reinterpret_cast(&prompt_I), sizeof(float)); d_dump_file.write(reinterpret_cast(&prompt_Q), sizeof(float)); // PRN start sample stamp - d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(unsigned long int)); + d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(uint64_t)); // accumulated carrier phase tmp_float = d_acc_carrier_phase_rad; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); @@ -889,7 +889,7 @@ int dll_pll_veml_tracking_fpga::save_matfile() std::ifstream::pos_type size; int number_of_double_vars = 1; int number_of_float_vars = 17; - int epoch_size_bytes = sizeof(unsigned long int) + sizeof(double) * number_of_double_vars + + int epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars + sizeof(float) * number_of_float_vars + sizeof(unsigned int); std::ifstream dump_file; dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); @@ -903,11 +903,11 @@ int dll_pll_veml_tracking_fpga::save_matfile() return 1; } // count number of epochs and rewind - long int num_epoch = 0; + int64_t num_epoch = 0; if (dump_file.is_open()) { size = dump_file.tellg(); - num_epoch = static_cast(size) / static_cast(epoch_size_bytes); + num_epoch = static_cast(size) / static_cast(epoch_size_bytes); dump_file.seekg(0, std::ios::beg); } else @@ -921,7 +921,7 @@ int dll_pll_veml_tracking_fpga::save_matfile() float *abs_VL = new float[num_epoch]; float *Prompt_I = new float[num_epoch]; float *Prompt_Q = new float[num_epoch]; - unsigned long int *PRN_start_sample_count = new unsigned long int[num_epoch]; + uint64_t *PRN_start_sample_count = new uint64_t[num_epoch]; float *acc_carrier_phase_rad = new float[num_epoch]; float *carrier_doppler_hz = new float[num_epoch]; float *code_freq_chips = new float[num_epoch]; @@ -939,7 +939,7 @@ int dll_pll_veml_tracking_fpga::save_matfile() { if (dump_file.is_open()) { - for (long int i = 0; i < num_epoch; i++) + for (int64_t i = 0; i < num_epoch; i++) { dump_file.read(reinterpret_cast(&abs_VE[i]), sizeof(float)); dump_file.read(reinterpret_cast(&abs_E[i]), sizeof(float)); @@ -948,7 +948,7 @@ int dll_pll_veml_tracking_fpga::save_matfile() dump_file.read(reinterpret_cast(&abs_VL[i]), sizeof(float)); dump_file.read(reinterpret_cast(&Prompt_I[i]), sizeof(float)); dump_file.read(reinterpret_cast(&Prompt_Q[i]), sizeof(float)); - dump_file.read(reinterpret_cast(&PRN_start_sample_count[i]), sizeof(unsigned long int)); + dump_file.read(reinterpret_cast(&PRN_start_sample_count[i]), sizeof(uint64_t)); dump_file.read(reinterpret_cast(&acc_carrier_phase_rad[i]), sizeof(float)); dump_file.read(reinterpret_cast(&carrier_doppler_hz[i]), sizeof(float)); dump_file.read(reinterpret_cast(&code_freq_chips[i]), sizeof(float)); @@ -998,7 +998,7 @@ int dll_pll_veml_tracking_fpga::save_matfile() filename.erase(filename.length() - 4, 4); filename.append(".mat"); matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - if (reinterpret_cast(matfp) != NULL) + if (reinterpret_cast(matfp) != NULL) { size_t dims[2] = {1, static_cast(num_epoch)}; matvar = Mat_VarCreate("abs_VE", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_VE, 0); @@ -1464,7 +1464,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un } if (current_synchro_data.Flag_valid_symbol_output) { - current_synchro_data.fs = static_cast(trk_parameters.fs_in); + current_synchro_data.fs = static_cast(trk_parameters.fs_in); current_synchro_data.Tracking_sample_counter = d_sample_counter + d_current_prn_length_samples; *out[0] = current_synchro_data; return 1; diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.h b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.h index 09efbd9b7..c52d8db28 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.h +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.h @@ -201,8 +201,8 @@ private: // PRN period in samples int d_current_prn_length_samples; // processing samples counters - unsigned long int d_sample_counter; - unsigned long int d_acq_sample_stamp; + uint64_t d_sample_counter; + uint64_t d_acq_sample_stamp; // CN0 estimation and lock detector int d_cn0_estimation_counter; @@ -219,7 +219,7 @@ private: // extra int d_correlation_length_samples; int d_next_prn_length_samples; - unsigned long int d_sample_counter_next; + uint64_t d_sample_counter_next; unsigned int d_pull_in = 0; }; diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc index acb0021c0..2569f3a8b 100644 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc @@ -60,7 +60,7 @@ using google::LogMessage; galileo_e1_tcp_connector_tracking_cc_sptr galileo_e1_tcp_connector_make_tracking_cc( - long fs_in, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -86,7 +86,7 @@ void Galileo_E1_Tcp_Connector_Tracking_cc::forecast(int noutput_items, Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc( - long fs_in, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -498,7 +498,7 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attri d_dump_file.write(reinterpret_cast(&prompt_I), sizeof(float)); d_dump_file.write(reinterpret_cast(&prompt_Q), sizeof(float)); // PRN start sample stamp - d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(unsigned long int)); + d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(uint64_t)); // accumulated carrier phase tmp_float = d_acc_carrier_phase_rad; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.h index 1e92e711a..788820adf 100644 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.h @@ -55,7 +55,7 @@ typedef boost::shared_ptr galileo_e1_tcp_c galileo_e1_tcp_connector_tracking_cc_sptr galileo_e1_tcp_connector_make_tracking_cc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz, @@ -85,7 +85,7 @@ public: private: friend galileo_e1_tcp_connector_tracking_cc_sptr galileo_e1_tcp_connector_make_tracking_cc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz, @@ -95,7 +95,7 @@ private: size_t port_ch0); Galileo_E1_Tcp_Connector_Tracking_cc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz, @@ -115,7 +115,7 @@ private: Gnss_Synchro *d_acquisition_gnss_synchro; unsigned int d_channel; - long d_fs_in; + int64_t d_fs_in; int d_correlation_length_samples; int d_n_correlator_taps; @@ -161,8 +161,8 @@ private: int d_next_prn_length_samples; //processing samples counters - unsigned long int d_sample_counter; - unsigned long int d_acq_sample_stamp; + uint64_t d_sample_counter; + uint64_t d_acq_sample_stamp; // CN0 estimation and lock detector int d_cn0_estimation_counter; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc index 7e71810f9..6e9b84bec 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc @@ -62,7 +62,7 @@ using google::LogMessage; glonass_l1_ca_dll_pll_c_aid_tracking_cc_sptr glonass_l1_ca_dll_pll_c_aid_make_tracking_cc( - long fs_in, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -102,7 +102,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::msg_handler_preamble_index(pmt::pm glonass_l1_ca_dll_pll_c_aid_tracking_cc::glonass_l1_ca_dll_pll_c_aid_tracking_cc( - long fs_in, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -211,7 +211,7 @@ glonass_l1_ca_dll_pll_c_aid_tracking_cc::glonass_l1_ca_dll_pll_c_aid_tracking_cc d_glonass_freq_ch = 0; - //set_min_output_buffer((long int)300); + //set_min_output_buffer((int64_t)300); } @@ -224,9 +224,9 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::start_tracking() d_acq_carrier_doppler_hz = d_acquisition_gnss_synchro->Acq_doppler_hz; d_acq_sample_stamp = d_acquisition_gnss_synchro->Acq_samplestamp_samples; - long int acq_trk_diff_samples; + int64_t acq_trk_diff_samples; double acq_trk_diff_seconds; - acq_trk_diff_samples = static_cast(d_sample_counter) - static_cast(d_acq_sample_stamp); //-d_vector_length; + acq_trk_diff_samples = static_cast(d_sample_counter) - static_cast(d_acq_sample_stamp); //-d_vector_length; DLOG(INFO) << "Number of samples between Acquisition and Tracking =" << acq_trk_diff_samples; acq_trk_diff_seconds = static_cast(acq_trk_diff_samples) / static_cast(d_fs_in); // Doppler effect @@ -354,7 +354,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile() std::ifstream::pos_type size; int number_of_double_vars = 11; int number_of_float_vars = 5; - int epoch_size_bytes = sizeof(unsigned long int) + sizeof(double) * number_of_double_vars + + int epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars + sizeof(float) * number_of_float_vars + sizeof(unsigned int); std::ifstream dump_file; dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); @@ -368,11 +368,11 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile() return 1; } // count number of epochs and rewind - long int num_epoch = 0; + int64_t num_epoch = 0; if (dump_file.is_open()) { size = dump_file.tellg(); - num_epoch = static_cast(size) / static_cast(epoch_size_bytes); + num_epoch = static_cast(size) / static_cast(epoch_size_bytes); dump_file.seekg(0, std::ios::beg); } else @@ -384,7 +384,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile() float *abs_L = new float[num_epoch]; float *Prompt_I = new float[num_epoch]; float *Prompt_Q = new float[num_epoch]; - unsigned long int *PRN_start_sample_count = new unsigned long int[num_epoch]; + uint64_t *PRN_start_sample_count = new uint64_t[num_epoch]; double *acc_carrier_phase_rad = new double[num_epoch]; double *carrier_doppler_hz = new double[num_epoch]; double *code_freq_chips = new double[num_epoch]; @@ -402,14 +402,14 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile() { if (dump_file.is_open()) { - for (long int i = 0; i < num_epoch; i++) + for (int64_t i = 0; i < num_epoch; i++) { dump_file.read(reinterpret_cast(&abs_E[i]), sizeof(float)); dump_file.read(reinterpret_cast(&abs_P[i]), sizeof(float)); dump_file.read(reinterpret_cast(&abs_L[i]), sizeof(float)); dump_file.read(reinterpret_cast(&Prompt_I[i]), sizeof(float)); dump_file.read(reinterpret_cast(&Prompt_Q[i]), sizeof(float)); - dump_file.read(reinterpret_cast(&PRN_start_sample_count[i]), sizeof(unsigned long int)); + dump_file.read(reinterpret_cast(&PRN_start_sample_count[i]), sizeof(uint64_t)); dump_file.read(reinterpret_cast(&acc_carrier_phase_rad[i]), sizeof(double)); dump_file.read(reinterpret_cast(&carrier_doppler_hz[i]), sizeof(double)); dump_file.read(reinterpret_cast(&code_freq_chips[i]), sizeof(double)); @@ -457,7 +457,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile() filename.erase(filename.length() - 4, 4); filename.append(".mat"); matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - if (reinterpret_cast(matfp) != NULL) + if (reinterpret_cast(matfp) != NULL) { size_t dims[2] = {1, static_cast(num_epoch)}; matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0); @@ -652,7 +652,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at bool enable_dll_pll; if (d_enable_extended_integration == true) { - long int symbol_diff = round(1000.0 * ((static_cast(d_sample_counter) + d_rem_code_phase_samples) / static_cast(d_fs_in) - d_preamble_timestamp_s)); + int64_t symbol_diff = round(1000.0 * ((static_cast(d_sample_counter) + d_rem_code_phase_samples) / static_cast(d_fs_in) - d_preamble_timestamp_s)); if (symbol_diff > 0 and symbol_diff % d_extend_correlation_ms == 0) { // compute coherent integration and enable tracking loop @@ -880,7 +880,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at d_dump_file.write(reinterpret_cast(&prompt_I), sizeof(float)); d_dump_file.write(reinterpret_cast(&prompt_Q), sizeof(float)); // PRN start sample stamp - d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(unsigned long int)); + d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(uint64_t)); // accumulated carrier phase tmp_float = d_acc_carrier_phase_cycles * GLONASS_TWO_PI; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.h index 9c692d726..3315f75d9 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.h @@ -58,7 +58,7 @@ typedef boost::shared_ptr glonass_l1_ca_dll_pll_c_aid_tracking_cc_sptr glonass_l1_ca_dll_pll_c_aid_make_tracking_cc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz, @@ -89,7 +89,7 @@ public: private: friend glonass_l1_ca_dll_pll_c_aid_tracking_cc_sptr glonass_l1_ca_dll_pll_c_aid_make_tracking_cc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz, @@ -100,7 +100,7 @@ private: float early_late_space_chips); glonass_l1_ca_dll_pll_c_aid_tracking_cc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz, @@ -117,7 +117,7 @@ private: Gnss_Synchro* d_acquisition_gnss_synchro; unsigned int d_channel; - long d_fs_in; + int64_t d_fs_in; double d_glonass_freq_ch; double d_early_late_spc_chips; @@ -176,8 +176,8 @@ private: int d_correlation_length_samples; //processing samples counters - unsigned long int d_sample_counter; - unsigned long int d_acq_sample_stamp; + uint64_t d_sample_counter; + uint64_t d_acq_sample_stamp; // CN0 estimation and lock detector int d_cn0_estimation_counter; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc index c00de2486..34a46a02b 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc @@ -37,7 +37,6 @@ */ #include "glonass_l1_ca_dll_pll_c_aid_tracking_sc.h" -#include "gnss_synchro.h" #include "glonass_l1_signal_processing.h" #include "GLONASS_L1_L2_CA.h" #include "tracking_discriminators.h" @@ -61,7 +60,7 @@ using google::LogMessage; glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr glonass_l1_ca_dll_pll_c_aid_make_tracking_sc( - long fs_in, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -100,7 +99,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::msg_handler_preamble_index(pmt::pm } glonass_l1_ca_dll_pll_c_aid_tracking_sc::glonass_l1_ca_dll_pll_c_aid_tracking_sc( - long fs_in, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -208,7 +207,7 @@ glonass_l1_ca_dll_pll_c_aid_tracking_sc::glonass_l1_ca_dll_pll_c_aid_tracking_sc d_carrier_doppler_old_hz = 0.0; d_glonass_freq_ch = 0; - //set_min_output_buffer((long int)300); + //set_min_output_buffer((int64_t)300); } @@ -221,9 +220,9 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking() d_acq_carrier_doppler_hz = d_acquisition_gnss_synchro->Acq_doppler_hz; d_acq_sample_stamp = d_acquisition_gnss_synchro->Acq_samplestamp_samples; - long int acq_trk_diff_samples; + int64_t acq_trk_diff_samples; double acq_trk_diff_seconds; - acq_trk_diff_samples = static_cast(d_sample_counter) - static_cast(d_acq_sample_stamp); //-d_vector_length; + acq_trk_diff_samples = static_cast(d_sample_counter) - static_cast(d_acq_sample_stamp); //-d_vector_length; DLOG(INFO) << "Number of samples between Acquisition and Tracking =" << acq_trk_diff_samples; acq_trk_diff_seconds = static_cast(acq_trk_diff_samples) / static_cast(d_fs_in); // Doppler effect @@ -309,7 +308,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile() std::ifstream::pos_type size; int number_of_double_vars = 11; int number_of_float_vars = 5; - int epoch_size_bytes = sizeof(unsigned long int) + sizeof(double) * number_of_double_vars + + int epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars + sizeof(float) * number_of_float_vars + sizeof(unsigned int); std::ifstream dump_file; dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); @@ -323,11 +322,11 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile() return 1; } // count number of epochs and rewind - long int num_epoch = 0; + int64_t num_epoch = 0; if (dump_file.is_open()) { size = dump_file.tellg(); - num_epoch = static_cast(size) / static_cast(epoch_size_bytes); + num_epoch = static_cast(size) / static_cast(epoch_size_bytes); dump_file.seekg(0, std::ios::beg); } else @@ -339,7 +338,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile() float *abs_L = new float[num_epoch]; float *Prompt_I = new float[num_epoch]; float *Prompt_Q = new float[num_epoch]; - unsigned long int *PRN_start_sample_count = new unsigned long int[num_epoch]; + uint64_t *PRN_start_sample_count = new uint64_t[num_epoch]; double *acc_carrier_phase_rad = new double[num_epoch]; double *carrier_doppler_hz = new double[num_epoch]; double *code_freq_chips = new double[num_epoch]; @@ -357,14 +356,14 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile() { if (dump_file.is_open()) { - for (long int i = 0; i < num_epoch; i++) + for (int64_t i = 0; i < num_epoch; i++) { dump_file.read(reinterpret_cast(&abs_E[i]), sizeof(float)); dump_file.read(reinterpret_cast(&abs_P[i]), sizeof(float)); dump_file.read(reinterpret_cast(&abs_L[i]), sizeof(float)); dump_file.read(reinterpret_cast(&Prompt_I[i]), sizeof(float)); dump_file.read(reinterpret_cast(&Prompt_Q[i]), sizeof(float)); - dump_file.read(reinterpret_cast(&PRN_start_sample_count[i]), sizeof(unsigned long int)); + dump_file.read(reinterpret_cast(&PRN_start_sample_count[i]), sizeof(uint64_t)); dump_file.read(reinterpret_cast(&acc_carrier_phase_rad[i]), sizeof(double)); dump_file.read(reinterpret_cast(&carrier_doppler_hz[i]), sizeof(double)); dump_file.read(reinterpret_cast(&code_freq_chips[i]), sizeof(double)); @@ -412,7 +411,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile() filename.erase(filename.length() - 4, 4); filename.append(".mat"); matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - if (reinterpret_cast(matfp) != NULL) + if (reinterpret_cast(matfp) != NULL) { size_t dims[2] = {1, static_cast(num_epoch)}; matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0); @@ -644,7 +643,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at bool enable_dll_pll; if (d_enable_extended_integration == true) { - long int symbol_diff = round(1000.0 * ((static_cast(d_sample_counter) + d_rem_code_phase_samples) / static_cast(d_fs_in) - d_preamble_timestamp_s)); + int64_t symbol_diff = round(1000.0 * ((static_cast(d_sample_counter) + d_rem_code_phase_samples) / static_cast(d_fs_in) - d_preamble_timestamp_s)); if (symbol_diff > 0 and symbol_diff % d_extend_correlation_ms == 0) { // compute coherent integration and enable tracking loop @@ -870,7 +869,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at d_dump_file.write(reinterpret_cast(&prompt_I), sizeof(float)); d_dump_file.write(reinterpret_cast(&prompt_Q), sizeof(float)); // PRN start sample stamp - d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(unsigned long int)); + d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(uint64_t)); // accumulated carrier phase tmp_float = d_acc_carrier_phase_cycles * GLONASS_TWO_PI; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.h b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.h index d91066ab5..72b0597ef 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.h +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.h @@ -59,7 +59,7 @@ typedef boost::shared_ptr glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr glonass_l1_ca_dll_pll_c_aid_make_tracking_sc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz, @@ -90,7 +90,7 @@ public: private: friend glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr glonass_l1_ca_dll_pll_c_aid_make_tracking_sc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz, @@ -101,7 +101,7 @@ private: float early_late_space_chips); glonass_l1_ca_dll_pll_c_aid_tracking_sc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz, @@ -118,8 +118,8 @@ private: Gnss_Synchro* d_acquisition_gnss_synchro; unsigned int d_channel; - long d_fs_in; - long d_glonass_freq_ch; + int64_t d_fs_in; + int64_t d_glonass_freq_ch; double d_early_late_spc_chips; int d_n_correlator_taps; @@ -179,8 +179,8 @@ private: int d_correlation_length_samples; //processing samples counters - unsigned long int d_sample_counter; - unsigned long int d_acq_sample_stamp; + uint64_t d_sample_counter; + uint64_t d_acq_sample_stamp; // CN0 estimation and lock detector int d_cn0_estimation_counter; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc index 2d25c448e..9b940f87d 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc @@ -59,7 +59,7 @@ using google::LogMessage; glonass_l1_ca_dll_pll_tracking_cc_sptr glonass_l1_ca_dll_pll_make_tracking_cc( - long fs_in, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -83,7 +83,7 @@ void Glonass_L1_Ca_Dll_Pll_Tracking_cc::forecast(int noutput_items, Glonass_L1_Ca_Dll_Pll_Tracking_cc::Glonass_L1_Ca_Dll_Pll_Tracking_cc( - long fs_in, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -182,9 +182,9 @@ void Glonass_L1_Ca_Dll_Pll_Tracking_cc::start_tracking() d_acq_carrier_doppler_hz = d_acquisition_gnss_synchro->Acq_doppler_hz; d_acq_sample_stamp = d_acquisition_gnss_synchro->Acq_samplestamp_samples; - long int acq_trk_diff_samples; + int64_t acq_trk_diff_samples; double acq_trk_diff_seconds; - acq_trk_diff_samples = static_cast(d_sample_counter) - static_cast(d_acq_sample_stamp); //-d_vector_length; + acq_trk_diff_samples = static_cast(d_sample_counter) - static_cast(d_acq_sample_stamp); //-d_vector_length; DLOG(INFO) << "Number of samples between Acquisition and Tracking =" << acq_trk_diff_samples; acq_trk_diff_seconds = static_cast(acq_trk_diff_samples) / static_cast(d_fs_in); // Doppler effect @@ -306,7 +306,7 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::save_matfile() std::ifstream::pos_type size; int number_of_double_vars = 11; int number_of_float_vars = 5; - int epoch_size_bytes = sizeof(unsigned long int) + sizeof(double) * number_of_double_vars + + int epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars + sizeof(float) * number_of_float_vars + sizeof(unsigned int); std::ifstream dump_file; dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); @@ -320,11 +320,11 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::save_matfile() return 1; } // count number of epochs and rewind - long int num_epoch = 0; + int64_t num_epoch = 0; if (dump_file.is_open()) { size = dump_file.tellg(); - num_epoch = static_cast(size) / static_cast(epoch_size_bytes); + num_epoch = static_cast(size) / static_cast(epoch_size_bytes); dump_file.seekg(0, std::ios::beg); } else @@ -336,7 +336,7 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::save_matfile() float *abs_L = new float[num_epoch]; float *Prompt_I = new float[num_epoch]; float *Prompt_Q = new float[num_epoch]; - unsigned long int *PRN_start_sample_count = new unsigned long int[num_epoch]; + uint64_t *PRN_start_sample_count = new uint64_t[num_epoch]; double *acc_carrier_phase_rad = new double[num_epoch]; double *carrier_doppler_hz = new double[num_epoch]; double *code_freq_chips = new double[num_epoch]; @@ -354,14 +354,14 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::save_matfile() { if (dump_file.is_open()) { - for (long int i = 0; i < num_epoch; i++) + for (int64_t i = 0; i < num_epoch; i++) { dump_file.read(reinterpret_cast(&abs_E[i]), sizeof(float)); dump_file.read(reinterpret_cast(&abs_P[i]), sizeof(float)); dump_file.read(reinterpret_cast(&abs_L[i]), sizeof(float)); dump_file.read(reinterpret_cast(&Prompt_I[i]), sizeof(float)); dump_file.read(reinterpret_cast(&Prompt_Q[i]), sizeof(float)); - dump_file.read(reinterpret_cast(&PRN_start_sample_count[i]), sizeof(unsigned long int)); + dump_file.read(reinterpret_cast(&PRN_start_sample_count[i]), sizeof(uint64_t)); dump_file.read(reinterpret_cast(&acc_carrier_phase_rad[i]), sizeof(double)); dump_file.read(reinterpret_cast(&carrier_doppler_hz[i]), sizeof(double)); dump_file.read(reinterpret_cast(&code_freq_chips[i]), sizeof(double)); @@ -409,7 +409,7 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::save_matfile() filename.erase(filename.length() - 4, 4); filename.append(".mat"); matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - if (reinterpret_cast(matfp) != NULL) + if (reinterpret_cast(matfp) != NULL) { size_t dims[2] = {1, static_cast(num_epoch)}; matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0); @@ -722,7 +722,7 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut d_dump_file.write(reinterpret_cast(&prompt_I), sizeof(float)); d_dump_file.write(reinterpret_cast(&prompt_Q), sizeof(float)); // PRN start sample stamp - d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(unsigned long int)); + d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(uint64_t)); // accumulated carrier phase tmp_float = d_acc_carrier_phase_rad; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.h index 26adc852a..4b306e69d 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.h @@ -55,7 +55,7 @@ typedef boost::shared_ptr glonass_l1_ca_dll_pll_tracking_cc_sptr glonass_l1_ca_dll_pll_make_tracking_cc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz, @@ -83,7 +83,7 @@ public: private: friend glonass_l1_ca_dll_pll_tracking_cc_sptr glonass_l1_ca_dll_pll_make_tracking_cc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz, @@ -91,7 +91,7 @@ private: float early_late_space_chips); Glonass_L1_Ca_Dll_Pll_Tracking_cc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz, @@ -105,8 +105,8 @@ private: Gnss_Synchro* d_acquisition_gnss_synchro; unsigned int d_channel; - long d_fs_in; - long d_glonass_freq_ch; + int64_t d_fs_in; + int64_t d_glonass_freq_ch; double d_early_late_spc_chips; @@ -144,8 +144,8 @@ private: int d_current_prn_length_samples; //processing samples counters - unsigned long int d_sample_counter; - unsigned long int d_acq_sample_stamp; + uint64_t d_sample_counter; + uint64_t d_acq_sample_stamp; // CN0 estimation and lock detector int d_cn0_estimation_counter; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc index 370366ed4..0b92d8541 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc @@ -59,7 +59,7 @@ using google::LogMessage; glonass_l2_ca_dll_pll_c_aid_tracking_cc_sptr glonass_l2_ca_dll_pll_c_aid_make_tracking_cc( - long fs_in, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -99,7 +99,7 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_cc::msg_handler_preamble_index(pmt::pm glonass_l2_ca_dll_pll_c_aid_tracking_cc::glonass_l2_ca_dll_pll_c_aid_tracking_cc( - long fs_in, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -208,7 +208,7 @@ glonass_l2_ca_dll_pll_c_aid_tracking_cc::glonass_l2_ca_dll_pll_c_aid_tracking_cc d_glonass_freq_ch = 0; - //set_min_output_buffer((long int)300); + //set_min_output_buffer((int64_t)300); } @@ -221,9 +221,9 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_cc::start_tracking() d_acq_carrier_doppler_hz = d_acquisition_gnss_synchro->Acq_doppler_hz; d_acq_sample_stamp = d_acquisition_gnss_synchro->Acq_samplestamp_samples; - long int acq_trk_diff_samples; + int64_t acq_trk_diff_samples; double acq_trk_diff_seconds; - acq_trk_diff_samples = static_cast(d_sample_counter) - static_cast(d_acq_sample_stamp); //-d_vector_length; + acq_trk_diff_samples = static_cast(d_sample_counter) - static_cast(d_acq_sample_stamp); //-d_vector_length; DLOG(INFO) << "Number of samples between Acquisition and Tracking =" << acq_trk_diff_samples; acq_trk_diff_seconds = static_cast(acq_trk_diff_samples) / static_cast(d_fs_in); // Doppler effect @@ -351,7 +351,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::save_matfile() std::ifstream::pos_type size; int number_of_double_vars = 11; int number_of_float_vars = 5; - int epoch_size_bytes = sizeof(unsigned long int) + sizeof(double) * number_of_double_vars + + int epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars + sizeof(float) * number_of_float_vars + sizeof(unsigned int); std::ifstream dump_file; dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); @@ -365,11 +365,11 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::save_matfile() return 1; } // count number of epochs and rewind - long int num_epoch = 0; + int64_t num_epoch = 0; if (dump_file.is_open()) { size = dump_file.tellg(); - num_epoch = static_cast(size) / static_cast(epoch_size_bytes); + num_epoch = static_cast(size) / static_cast(epoch_size_bytes); dump_file.seekg(0, std::ios::beg); } else @@ -381,7 +381,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::save_matfile() float *abs_L = new float[num_epoch]; float *Prompt_I = new float[num_epoch]; float *Prompt_Q = new float[num_epoch]; - unsigned long int *PRN_start_sample_count = new unsigned long int[num_epoch]; + uint64_t *PRN_start_sample_count = new uint64_t[num_epoch]; double *acc_carrier_phase_rad = new double[num_epoch]; double *carrier_doppler_hz = new double[num_epoch]; double *code_freq_chips = new double[num_epoch]; @@ -399,14 +399,14 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::save_matfile() { if (dump_file.is_open()) { - for (long int i = 0; i < num_epoch; i++) + for (int64_t i = 0; i < num_epoch; i++) { dump_file.read(reinterpret_cast(&abs_E[i]), sizeof(float)); dump_file.read(reinterpret_cast(&abs_P[i]), sizeof(float)); dump_file.read(reinterpret_cast(&abs_L[i]), sizeof(float)); dump_file.read(reinterpret_cast(&Prompt_I[i]), sizeof(float)); dump_file.read(reinterpret_cast(&Prompt_Q[i]), sizeof(float)); - dump_file.read(reinterpret_cast(&PRN_start_sample_count[i]), sizeof(unsigned long int)); + dump_file.read(reinterpret_cast(&PRN_start_sample_count[i]), sizeof(uint64_t)); dump_file.read(reinterpret_cast(&acc_carrier_phase_rad[i]), sizeof(double)); dump_file.read(reinterpret_cast(&carrier_doppler_hz[i]), sizeof(double)); dump_file.read(reinterpret_cast(&code_freq_chips[i]), sizeof(double)); @@ -454,7 +454,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::save_matfile() filename.erase(filename.length() - 4, 4); filename.append(".mat"); matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - if (reinterpret_cast(matfp) != NULL) + if (reinterpret_cast(matfp) != NULL) { size_t dims[2] = {1, static_cast(num_epoch)}; matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0); @@ -649,7 +649,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at bool enable_dll_pll; if (d_enable_extended_integration == true) { - long int symbol_diff = round(1000.0 * ((static_cast(d_sample_counter) + d_rem_code_phase_samples) / static_cast(d_fs_in) - d_preamble_timestamp_s)); + int64_t symbol_diff = round(1000.0 * ((static_cast(d_sample_counter) + d_rem_code_phase_samples) / static_cast(d_fs_in) - d_preamble_timestamp_s)); if (symbol_diff > 0 and symbol_diff % d_extend_correlation_ms == 0) { // compute coherent integration and enable tracking loop @@ -877,7 +877,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at d_dump_file.write(reinterpret_cast(&prompt_I), sizeof(float)); d_dump_file.write(reinterpret_cast(&prompt_Q), sizeof(float)); // PRN start sample stamp - d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(unsigned long int)); + d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(uint64_t)); // accumulated carrier phase tmp_float = d_acc_carrier_phase_cycles * GLONASS_TWO_PI; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.h index c5cf8403f..c36e97e27 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.h @@ -56,7 +56,7 @@ typedef boost::shared_ptr glonass_l2_ca_dll_pll_c_aid_tracking_cc_sptr glonass_l2_ca_dll_pll_c_aid_make_tracking_cc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz, @@ -87,7 +87,7 @@ public: private: friend glonass_l2_ca_dll_pll_c_aid_tracking_cc_sptr glonass_l2_ca_dll_pll_c_aid_make_tracking_cc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz, @@ -98,7 +98,7 @@ private: float early_late_space_chips); glonass_l2_ca_dll_pll_c_aid_tracking_cc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz, @@ -115,7 +115,7 @@ private: Gnss_Synchro* d_acquisition_gnss_synchro; unsigned int d_channel; - long d_fs_in; + int64_t d_fs_in; double d_glonass_freq_ch; double d_early_late_spc_chips; @@ -174,8 +174,8 @@ private: int d_correlation_length_samples; //processing samples counters - unsigned long int d_sample_counter; - unsigned long int d_acq_sample_stamp; + uint64_t d_sample_counter; + uint64_t d_acq_sample_stamp; // CN0 estimation and lock detector int d_cn0_estimation_counter; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc index dd3032eac..093bbc220 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc @@ -35,7 +35,6 @@ */ #include "glonass_l2_ca_dll_pll_c_aid_tracking_sc.h" -#include "gnss_synchro.h" #include "glonass_l2_signal_processing.h" #include "tracking_discriminators.h" #include "lock_detectors.h" @@ -59,7 +58,7 @@ using google::LogMessage; glonass_l2_ca_dll_pll_c_aid_tracking_sc_sptr glonass_l2_ca_dll_pll_c_aid_make_tracking_sc( - long fs_in, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -98,7 +97,7 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_sc::msg_handler_preamble_index(pmt::pm } glonass_l2_ca_dll_pll_c_aid_tracking_sc::glonass_l2_ca_dll_pll_c_aid_tracking_sc( - long fs_in, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -206,7 +205,7 @@ glonass_l2_ca_dll_pll_c_aid_tracking_sc::glonass_l2_ca_dll_pll_c_aid_tracking_sc d_carrier_doppler_old_hz = 0.0; d_glonass_freq_ch = 0; - //set_min_output_buffer((long int)300); + //set_min_output_buffer((int64_t)300); } @@ -219,9 +218,9 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_sc::start_tracking() d_acq_carrier_doppler_hz = d_acquisition_gnss_synchro->Acq_doppler_hz; d_acq_sample_stamp = d_acquisition_gnss_synchro->Acq_samplestamp_samples; - long int acq_trk_diff_samples; + int64_t acq_trk_diff_samples; double acq_trk_diff_seconds; - acq_trk_diff_samples = static_cast(d_sample_counter) - static_cast(d_acq_sample_stamp); //-d_vector_length; + acq_trk_diff_samples = static_cast(d_sample_counter) - static_cast(d_acq_sample_stamp); //-d_vector_length; DLOG(INFO) << "Number of samples between Acquisition and Tracking =" << acq_trk_diff_samples; acq_trk_diff_seconds = static_cast(acq_trk_diff_samples) / static_cast(d_fs_in); // Doppler effect @@ -307,7 +306,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::save_matfile() std::ifstream::pos_type size; int number_of_double_vars = 11; int number_of_float_vars = 5; - int epoch_size_bytes = sizeof(unsigned long int) + sizeof(double) * number_of_double_vars + + int epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars + sizeof(float) * number_of_float_vars + sizeof(unsigned int); std::ifstream dump_file; dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); @@ -321,11 +320,11 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::save_matfile() return 1; } // count number of epochs and rewind - long int num_epoch = 0; + int64_t num_epoch = 0; if (dump_file.is_open()) { size = dump_file.tellg(); - num_epoch = static_cast(size) / static_cast(epoch_size_bytes); + num_epoch = static_cast(size) / static_cast(epoch_size_bytes); dump_file.seekg(0, std::ios::beg); } else @@ -337,7 +336,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::save_matfile() float *abs_L = new float[num_epoch]; float *Prompt_I = new float[num_epoch]; float *Prompt_Q = new float[num_epoch]; - unsigned long int *PRN_start_sample_count = new unsigned long int[num_epoch]; + uint64_t *PRN_start_sample_count = new uint64_t[num_epoch]; double *acc_carrier_phase_rad = new double[num_epoch]; double *carrier_doppler_hz = new double[num_epoch]; double *code_freq_chips = new double[num_epoch]; @@ -355,14 +354,14 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::save_matfile() { if (dump_file.is_open()) { - for (long int i = 0; i < num_epoch; i++) + for (int64_t i = 0; i < num_epoch; i++) { dump_file.read(reinterpret_cast(&abs_E[i]), sizeof(float)); dump_file.read(reinterpret_cast(&abs_P[i]), sizeof(float)); dump_file.read(reinterpret_cast(&abs_L[i]), sizeof(float)); dump_file.read(reinterpret_cast(&Prompt_I[i]), sizeof(float)); dump_file.read(reinterpret_cast(&Prompt_Q[i]), sizeof(float)); - dump_file.read(reinterpret_cast(&PRN_start_sample_count[i]), sizeof(unsigned long int)); + dump_file.read(reinterpret_cast(&PRN_start_sample_count[i]), sizeof(uint64_t)); dump_file.read(reinterpret_cast(&acc_carrier_phase_rad[i]), sizeof(double)); dump_file.read(reinterpret_cast(&carrier_doppler_hz[i]), sizeof(double)); dump_file.read(reinterpret_cast(&code_freq_chips[i]), sizeof(double)); @@ -410,7 +409,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::save_matfile() filename.erase(filename.length() - 4, 4); filename.append(".mat"); matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - if (reinterpret_cast(matfp) != NULL) + if (reinterpret_cast(matfp) != NULL) { size_t dims[2] = {1, static_cast(num_epoch)}; matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0); @@ -642,7 +641,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at bool enable_dll_pll; if (d_enable_extended_integration == true) { - long int symbol_diff = round(1000.0 * ((static_cast(d_sample_counter) + d_rem_code_phase_samples) / static_cast(d_fs_in) - d_preamble_timestamp_s)); + int64_t symbol_diff = round(1000.0 * ((static_cast(d_sample_counter) + d_rem_code_phase_samples) / static_cast(d_fs_in) - d_preamble_timestamp_s)); if (symbol_diff > 0 and symbol_diff % d_extend_correlation_ms == 0) { // compute coherent integration and enable tracking loop @@ -868,7 +867,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at d_dump_file.write(reinterpret_cast(&prompt_I), sizeof(float)); d_dump_file.write(reinterpret_cast(&prompt_Q), sizeof(float)); // PRN start sample stamp - d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(unsigned long int)); + d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(uint64_t)); // accumulated carrier phase tmp_float = d_acc_carrier_phase_cycles * GLONASS_TWO_PI; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.h b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.h index f986ccd4c..dc702b1f4 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.h +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.h @@ -57,7 +57,7 @@ typedef boost::shared_ptr glonass_l2_ca_dll_pll_c_aid_tracking_sc_sptr glonass_l2_ca_dll_pll_c_aid_make_tracking_sc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz, @@ -88,7 +88,7 @@ public: private: friend glonass_l2_ca_dll_pll_c_aid_tracking_sc_sptr glonass_l2_ca_dll_pll_c_aid_make_tracking_sc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz, @@ -99,7 +99,7 @@ private: float early_late_space_chips); glonass_l2_ca_dll_pll_c_aid_tracking_sc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz, @@ -116,8 +116,8 @@ private: Gnss_Synchro* d_acquisition_gnss_synchro; unsigned int d_channel; - long d_fs_in; - long d_glonass_freq_ch; + int64_t d_fs_in; + int64_t d_glonass_freq_ch; double d_early_late_spc_chips; int d_n_correlator_taps; @@ -177,8 +177,8 @@ private: int d_correlation_length_samples; //processing samples counters - unsigned long int d_sample_counter; - unsigned long int d_acq_sample_stamp; + uint64_t d_sample_counter; + uint64_t d_acq_sample_stamp; // CN0 estimation and lock detector int d_cn0_estimation_counter; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc index bb6adb024..0a1bd8d43 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc @@ -59,7 +59,7 @@ using google::LogMessage; glonass_l2_ca_dll_pll_tracking_cc_sptr glonass_l2_ca_dll_pll_make_tracking_cc( - long fs_in, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -83,7 +83,7 @@ void Glonass_L2_Ca_Dll_Pll_Tracking_cc::forecast(int noutput_items, Glonass_L2_Ca_Dll_Pll_Tracking_cc::Glonass_L2_Ca_Dll_Pll_Tracking_cc( - long fs_in, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -182,9 +182,9 @@ void Glonass_L2_Ca_Dll_Pll_Tracking_cc::start_tracking() d_acq_carrier_doppler_hz = d_acquisition_gnss_synchro->Acq_doppler_hz; d_acq_sample_stamp = d_acquisition_gnss_synchro->Acq_samplestamp_samples; - long int acq_trk_diff_samples; + int64_t acq_trk_diff_samples; double acq_trk_diff_seconds; - acq_trk_diff_samples = static_cast(d_sample_counter) - static_cast(d_acq_sample_stamp); //-d_vector_length; + acq_trk_diff_samples = static_cast(d_sample_counter) - static_cast(d_acq_sample_stamp); //-d_vector_length; DLOG(INFO) << "Number of samples between Acquisition and Tracking =" << acq_trk_diff_samples; acq_trk_diff_seconds = static_cast(acq_trk_diff_samples) / static_cast(d_fs_in); // Doppler effect @@ -306,7 +306,7 @@ int Glonass_L2_Ca_Dll_Pll_Tracking_cc::save_matfile() std::ifstream::pos_type size; int number_of_double_vars = 11; int number_of_float_vars = 5; - int epoch_size_bytes = sizeof(unsigned long int) + sizeof(double) * number_of_double_vars + + int epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars + sizeof(float) * number_of_float_vars + sizeof(unsigned int); std::ifstream dump_file; dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); @@ -320,11 +320,11 @@ int Glonass_L2_Ca_Dll_Pll_Tracking_cc::save_matfile() return 1; } // count number of epochs and rewind - long int num_epoch = 0; + int64_t num_epoch = 0; if (dump_file.is_open()) { size = dump_file.tellg(); - num_epoch = static_cast(size) / static_cast(epoch_size_bytes); + num_epoch = static_cast(size) / static_cast(epoch_size_bytes); dump_file.seekg(0, std::ios::beg); } else @@ -336,7 +336,7 @@ int Glonass_L2_Ca_Dll_Pll_Tracking_cc::save_matfile() float *abs_L = new float[num_epoch]; float *Prompt_I = new float[num_epoch]; float *Prompt_Q = new float[num_epoch]; - unsigned long int *PRN_start_sample_count = new unsigned long int[num_epoch]; + uint64_t *PRN_start_sample_count = new uint64_t[num_epoch]; double *acc_carrier_phase_rad = new double[num_epoch]; double *carrier_doppler_hz = new double[num_epoch]; double *code_freq_chips = new double[num_epoch]; @@ -354,14 +354,14 @@ int Glonass_L2_Ca_Dll_Pll_Tracking_cc::save_matfile() { if (dump_file.is_open()) { - for (long int i = 0; i < num_epoch; i++) + for (int64_t i = 0; i < num_epoch; i++) { dump_file.read(reinterpret_cast(&abs_E[i]), sizeof(float)); dump_file.read(reinterpret_cast(&abs_P[i]), sizeof(float)); dump_file.read(reinterpret_cast(&abs_L[i]), sizeof(float)); dump_file.read(reinterpret_cast(&Prompt_I[i]), sizeof(float)); dump_file.read(reinterpret_cast(&Prompt_Q[i]), sizeof(float)); - dump_file.read(reinterpret_cast(&PRN_start_sample_count[i]), sizeof(unsigned long int)); + dump_file.read(reinterpret_cast(&PRN_start_sample_count[i]), sizeof(uint64_t)); dump_file.read(reinterpret_cast(&acc_carrier_phase_rad[i]), sizeof(double)); dump_file.read(reinterpret_cast(&carrier_doppler_hz[i]), sizeof(double)); dump_file.read(reinterpret_cast(&code_freq_chips[i]), sizeof(double)); @@ -409,7 +409,7 @@ int Glonass_L2_Ca_Dll_Pll_Tracking_cc::save_matfile() filename.erase(filename.length() - 4, 4); filename.append(".mat"); matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - if (reinterpret_cast(matfp) != NULL) + if (reinterpret_cast(matfp) != NULL) { size_t dims[2] = {1, static_cast(num_epoch)}; matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0); @@ -722,7 +722,7 @@ int Glonass_L2_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut d_dump_file.write(reinterpret_cast(&prompt_I), sizeof(float)); d_dump_file.write(reinterpret_cast(&prompt_Q), sizeof(float)); // PRN start sample stamp - d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(unsigned long int)); + d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(uint64_t)); // accumulated carrier phase tmp_float = d_acc_carrier_phase_rad; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.h index 63598dfd0..bd06dbf4f 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.h @@ -53,7 +53,7 @@ typedef boost::shared_ptr glonass_l2_ca_dll_pll_tracking_cc_sptr glonass_l2_ca_dll_pll_make_tracking_cc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz, @@ -81,7 +81,7 @@ public: private: friend glonass_l2_ca_dll_pll_tracking_cc_sptr glonass_l2_ca_dll_pll_make_tracking_cc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz, @@ -89,7 +89,7 @@ private: float early_late_space_chips); Glonass_L2_Ca_Dll_Pll_Tracking_cc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz, @@ -103,8 +103,8 @@ private: Gnss_Synchro* d_acquisition_gnss_synchro; unsigned int d_channel; - long d_fs_in; - long d_glonass_freq_ch; + int64_t d_fs_in; + int64_t d_glonass_freq_ch; double d_early_late_spc_chips; @@ -142,8 +142,8 @@ private: int d_current_prn_length_samples; //processing samples counters - unsigned long int d_sample_counter; - unsigned long int d_acq_sample_stamp; + uint64_t d_sample_counter; + uint64_t d_acq_sample_stamp; // CN0 estimation and lock detector int d_cn0_estimation_counter; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.cc index 7407c792e..76d7745c8 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.cc @@ -51,7 +51,7 @@ using google::LogMessage; gps_l1_ca_dll_pll_c_aid_tracking_cc_sptr gps_l1_ca_dll_pll_c_aid_make_tracking_cc( - long fs_in, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -91,7 +91,7 @@ void gps_l1_ca_dll_pll_c_aid_tracking_cc::msg_handler_preamble_index(pmt::pmt_t gps_l1_ca_dll_pll_c_aid_tracking_cc::gps_l1_ca_dll_pll_c_aid_tracking_cc( - long fs_in, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -195,7 +195,7 @@ gps_l1_ca_dll_pll_c_aid_tracking_cc::gps_l1_ca_dll_pll_c_aid_tracking_cc( d_code_error_filt_chips_s = 0.0; d_carr_phase_error_secs_Ti = 0.0; d_preamble_timestamp_s = 0.0; - //set_min_output_buffer((long int)300); + //set_min_output_buffer((int64_t)300); } @@ -208,9 +208,9 @@ void gps_l1_ca_dll_pll_c_aid_tracking_cc::start_tracking() d_acq_carrier_doppler_hz = d_acquisition_gnss_synchro->Acq_doppler_hz; d_acq_sample_stamp = d_acquisition_gnss_synchro->Acq_samplestamp_samples; - long int acq_trk_diff_samples; + int64_t acq_trk_diff_samples; double acq_trk_diff_seconds; - acq_trk_diff_samples = static_cast(d_sample_counter) - static_cast(d_acq_sample_stamp); //-d_vector_length; + acq_trk_diff_samples = static_cast(d_sample_counter) - static_cast(d_acq_sample_stamp); //-d_vector_length; DLOG(INFO) << "Number of samples between Acquisition and Tracking =" << acq_trk_diff_samples; acq_trk_diff_seconds = static_cast(acq_trk_diff_samples) / static_cast(d_fs_in); // Doppler effect @@ -333,7 +333,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile() std::ifstream::pos_type size; int number_of_double_vars = 11; int number_of_float_vars = 5; - int epoch_size_bytes = sizeof(unsigned long int) + sizeof(double) * number_of_double_vars + + int epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars + sizeof(float) * number_of_float_vars + sizeof(unsigned int); std::ifstream dump_file; dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); @@ -347,11 +347,11 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile() return 1; } // count number of epochs and rewind - long int num_epoch = 0; + int64_t num_epoch = 0; if (dump_file.is_open()) { size = dump_file.tellg(); - num_epoch = static_cast(size) / static_cast(epoch_size_bytes); + num_epoch = static_cast(size) / static_cast(epoch_size_bytes); dump_file.seekg(0, std::ios::beg); } else @@ -363,7 +363,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile() float *abs_L = new float[num_epoch]; float *Prompt_I = new float[num_epoch]; float *Prompt_Q = new float[num_epoch]; - unsigned long int *PRN_start_sample_count = new unsigned long int[num_epoch]; + uint64_t *PRN_start_sample_count = new uint64_t[num_epoch]; double *acc_carrier_phase_rad = new double[num_epoch]; double *carrier_doppler_hz = new double[num_epoch]; double *code_freq_chips = new double[num_epoch]; @@ -381,14 +381,14 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile() { if (dump_file.is_open()) { - for (long int i = 0; i < num_epoch; i++) + for (int64_t i = 0; i < num_epoch; i++) { dump_file.read(reinterpret_cast(&abs_E[i]), sizeof(float)); dump_file.read(reinterpret_cast(&abs_P[i]), sizeof(float)); dump_file.read(reinterpret_cast(&abs_L[i]), sizeof(float)); dump_file.read(reinterpret_cast(&Prompt_I[i]), sizeof(float)); dump_file.read(reinterpret_cast(&Prompt_Q[i]), sizeof(float)); - dump_file.read(reinterpret_cast(&PRN_start_sample_count[i]), sizeof(unsigned long int)); + dump_file.read(reinterpret_cast(&PRN_start_sample_count[i]), sizeof(uint64_t)); dump_file.read(reinterpret_cast(&acc_carrier_phase_rad[i]), sizeof(double)); dump_file.read(reinterpret_cast(&carrier_doppler_hz[i]), sizeof(double)); dump_file.read(reinterpret_cast(&code_freq_chips[i]), sizeof(double)); @@ -436,7 +436,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile() filename.erase(filename.length() - 4, 4); filename.append(".mat"); matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - if (reinterpret_cast(matfp) != NULL) + if (reinterpret_cast(matfp) != NULL) { size_t dims[2] = {1, static_cast(num_epoch)}; matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0); @@ -631,7 +631,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __attrib bool enable_dll_pll; if (d_enable_extended_integration == true) { - long int symbol_diff = round(1000.0 * ((static_cast(d_sample_counter) + d_rem_code_phase_samples) / static_cast(d_fs_in) - d_preamble_timestamp_s)); + int64_t symbol_diff = round(1000.0 * ((static_cast(d_sample_counter) + d_rem_code_phase_samples) / static_cast(d_fs_in) - d_preamble_timestamp_s)); if (symbol_diff > 0 and symbol_diff % d_extend_correlation_ms == 0) { // compute coherent integration and enable tracking loop @@ -858,7 +858,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __attrib d_dump_file.write(reinterpret_cast(&prompt_I), sizeof(float)); d_dump_file.write(reinterpret_cast(&prompt_Q), sizeof(float)); // PRN start sample stamp - d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(unsigned long int)); + d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(uint64_t)); // accumulated carrier phase tmp_float = d_acc_carrier_phase_cycles * GPS_TWO_PI; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.h index 1b6d9e12e..b950e070c 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.h @@ -56,7 +56,7 @@ typedef boost::shared_ptr gps_l1_ca_dll_pll_c_aid_tracking_cc_sptr gps_l1_ca_dll_pll_c_aid_make_tracking_cc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz, @@ -87,7 +87,7 @@ public: private: friend gps_l1_ca_dll_pll_c_aid_tracking_cc_sptr gps_l1_ca_dll_pll_c_aid_make_tracking_cc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz, @@ -98,7 +98,7 @@ private: float early_late_space_chips); gps_l1_ca_dll_pll_c_aid_tracking_cc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz, @@ -114,7 +114,7 @@ private: Gnss_Synchro* d_acquisition_gnss_synchro; unsigned int d_channel; - long d_fs_in; + int64_t d_fs_in; double d_early_late_spc_chips; int d_n_correlator_taps; @@ -170,8 +170,8 @@ private: int d_correlation_length_samples; //processing samples counters - unsigned long int d_sample_counter; - unsigned long int d_acq_sample_stamp; + uint64_t d_sample_counter; + uint64_t d_acq_sample_stamp; // CN0 estimation and lock detector int d_cn0_estimation_counter; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.cc index 644616b28..0e09d1e5d 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.cc @@ -29,7 +29,6 @@ */ #include "gps_l1_ca_dll_pll_c_aid_tracking_sc.h" -#include "gnss_synchro.h" #include "gps_sdr_signal_processing.h" #include "tracking_discriminators.h" #include "lock_detectors.h" @@ -52,7 +51,7 @@ using google::LogMessage; gps_l1_ca_dll_pll_c_aid_tracking_sc_sptr gps_l1_ca_dll_pll_c_aid_make_tracking_sc( - long fs_in, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -91,7 +90,7 @@ void gps_l1_ca_dll_pll_c_aid_tracking_sc::msg_handler_preamble_index(pmt::pmt_t } gps_l1_ca_dll_pll_c_aid_tracking_sc::gps_l1_ca_dll_pll_c_aid_tracking_sc( - long fs_in, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -195,7 +194,7 @@ gps_l1_ca_dll_pll_c_aid_tracking_sc::gps_l1_ca_dll_pll_c_aid_tracking_sc( d_code_error_filt_chips_Ti = 0.0; d_preamble_timestamp_s = 0.0; d_carr_phase_error_secs_Ti = 0.0; - //set_min_output_buffer((long int)300); + //set_min_output_buffer((int64_t)300); } @@ -208,9 +207,9 @@ void gps_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking() d_acq_carrier_doppler_hz = d_acquisition_gnss_synchro->Acq_doppler_hz; d_acq_sample_stamp = d_acquisition_gnss_synchro->Acq_samplestamp_samples; - long int acq_trk_diff_samples; + int64_t acq_trk_diff_samples; double acq_trk_diff_seconds; - acq_trk_diff_samples = static_cast(d_sample_counter) - static_cast(d_acq_sample_stamp); //-d_vector_length; + acq_trk_diff_samples = static_cast(d_sample_counter) - static_cast(d_acq_sample_stamp); //-d_vector_length; DLOG(INFO) << "Number of samples between Acquisition and Tracking =" << acq_trk_diff_samples; acq_trk_diff_seconds = static_cast(acq_trk_diff_samples) / static_cast(d_fs_in); // Doppler effect @@ -336,7 +335,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile() std::ifstream::pos_type size; int number_of_double_vars = 11; int number_of_float_vars = 5; - int epoch_size_bytes = sizeof(unsigned long int) + sizeof(double) * number_of_double_vars + + int epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars + sizeof(float) * number_of_float_vars + sizeof(unsigned int); std::ifstream dump_file; dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); @@ -350,11 +349,11 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile() return 1; } // count number of epochs and rewind - long int num_epoch = 0; + int64_t num_epoch = 0; if (dump_file.is_open()) { size = dump_file.tellg(); - num_epoch = static_cast(size) / static_cast(epoch_size_bytes); + num_epoch = static_cast(size) / static_cast(epoch_size_bytes); dump_file.seekg(0, std::ios::beg); } else @@ -366,7 +365,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile() float *abs_L = new float[num_epoch]; float *Prompt_I = new float[num_epoch]; float *Prompt_Q = new float[num_epoch]; - unsigned long int *PRN_start_sample_count = new unsigned long int[num_epoch]; + uint64_t *PRN_start_sample_count = new uint64_t[num_epoch]; double *acc_carrier_phase_rad = new double[num_epoch]; double *carrier_doppler_hz = new double[num_epoch]; double *code_freq_chips = new double[num_epoch]; @@ -384,14 +383,14 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile() { if (dump_file.is_open()) { - for (long int i = 0; i < num_epoch; i++) + for (int64_t i = 0; i < num_epoch; i++) { dump_file.read(reinterpret_cast(&abs_E[i]), sizeof(float)); dump_file.read(reinterpret_cast(&abs_P[i]), sizeof(float)); dump_file.read(reinterpret_cast(&abs_L[i]), sizeof(float)); dump_file.read(reinterpret_cast(&Prompt_I[i]), sizeof(float)); dump_file.read(reinterpret_cast(&Prompt_Q[i]), sizeof(float)); - dump_file.read(reinterpret_cast(&PRN_start_sample_count[i]), sizeof(unsigned long int)); + dump_file.read(reinterpret_cast(&PRN_start_sample_count[i]), sizeof(uint64_t)); dump_file.read(reinterpret_cast(&acc_carrier_phase_rad[i]), sizeof(double)); dump_file.read(reinterpret_cast(&carrier_doppler_hz[i]), sizeof(double)); dump_file.read(reinterpret_cast(&code_freq_chips[i]), sizeof(double)); @@ -439,7 +438,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile() filename.erase(filename.length() - 4, 4); filename.append(".mat"); matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - if (reinterpret_cast(matfp) != NULL) + if (reinterpret_cast(matfp) != NULL) { size_t dims[2] = {1, static_cast(num_epoch)}; matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E, 0); @@ -634,7 +633,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __attrib bool enable_dll_pll; if (d_enable_extended_integration == true) { - long int symbol_diff = round(1000.0 * ((static_cast(d_sample_counter) + d_rem_code_phase_samples) / static_cast(d_fs_in) - d_preamble_timestamp_s)); + int64_t symbol_diff = round(1000.0 * ((static_cast(d_sample_counter) + d_rem_code_phase_samples) / static_cast(d_fs_in) - d_preamble_timestamp_s)); if (symbol_diff > 0 and symbol_diff % d_extend_correlation_ms == 0) { // compute coherent integration and enable tracking loop @@ -860,7 +859,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __attrib d_dump_file.write(reinterpret_cast(&prompt_I), sizeof(float)); d_dump_file.write(reinterpret_cast(&prompt_Q), sizeof(float)); // PRN start sample stamp - d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(unsigned long int)); + d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(uint64_t)); // accumulated carrier phase tmp_float = d_acc_carrier_phase_cycles * GPS_TWO_PI; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.h b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.h index 5da13feb4..ab725eb27 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.h +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.h @@ -57,7 +57,7 @@ typedef boost::shared_ptr gps_l1_ca_dll_pll_c_aid_tracking_sc_sptr gps_l1_ca_dll_pll_c_aid_make_tracking_sc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz, @@ -88,7 +88,7 @@ public: private: friend gps_l1_ca_dll_pll_c_aid_tracking_sc_sptr gps_l1_ca_dll_pll_c_aid_make_tracking_sc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz, @@ -99,7 +99,7 @@ private: float early_late_space_chips); gps_l1_ca_dll_pll_c_aid_tracking_sc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float pll_bw_hz, @@ -116,7 +116,7 @@ private: Gnss_Synchro* d_acquisition_gnss_synchro; unsigned int d_channel; - long d_fs_in; + int64_t d_fs_in; double d_early_late_spc_chips; int d_n_correlator_taps; @@ -174,8 +174,8 @@ private: int d_correlation_length_samples; //processing samples counters - unsigned long int d_sample_counter; - unsigned long int d_acq_sample_stamp; + uint64_t d_sample_counter; + uint64_t d_acq_sample_stamp; // CN0 estimation and lock detector int d_cn0_estimation_counter; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc index 77ac57a0e..0b4f665f8 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc @@ -49,7 +49,7 @@ using google::LogMessage; gps_l1_ca_dll_pll_tracking_gpu_cc_sptr gps_l1_ca_dll_pll_make_tracking_gpu_cc( - long fs_in, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -73,7 +73,7 @@ void Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::forecast(int noutput_items, Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc( - long fs_in, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -163,7 +163,7 @@ Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc( d_rem_code_phase_chips = 0.0; d_code_phase_step_chips = 0.0; d_carrier_phase_step_rad = 0.0; - //set_min_output_buffer((long int)300); + //set_min_output_buffer((int64_t)300); } @@ -176,9 +176,9 @@ void Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::start_tracking() d_acq_carrier_doppler_hz = d_acquisition_gnss_synchro->Acq_doppler_hz; d_acq_sample_stamp = d_acquisition_gnss_synchro->Acq_samplestamp_samples; - long int acq_trk_diff_samples; + int64_t acq_trk_diff_samples; double acq_trk_diff_seconds; - acq_trk_diff_samples = static_cast(d_sample_counter) - static_cast(d_acq_sample_stamp); //-d_vector_length; + acq_trk_diff_samples = static_cast(d_sample_counter) - static_cast(d_acq_sample_stamp); //-d_vector_length; DLOG(INFO) << "Number of samples between Acquisition and Tracking =" << acq_trk_diff_samples; acq_trk_diff_seconds = static_cast(acq_trk_diff_samples) / static_cast(d_fs_in); //doppler effect @@ -516,7 +516,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work(int noutput_items __attribut d_dump_file.write(reinterpret_cast(&prompt_I), sizeof(float)); d_dump_file.write(reinterpret_cast(&prompt_Q), sizeof(float)); // PRN start sample stamp - d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(unsigned long int)); + d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(uint64_t)); // accumulated carrier phase tmp_float = d_acc_carrier_phase_cycles * GPS_TWO_PI; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.h b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.h index 85c07a1b4..5134bcaf2 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.h @@ -53,7 +53,7 @@ typedef boost::shared_ptr gps_l1_ca_dll_pll_tracking_gpu_cc_sptr gps_l1_ca_dll_pll_make_tracking_gpu_cc( - long fs_in, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -82,7 +82,7 @@ public: private: friend gps_l1_ca_dll_pll_tracking_gpu_cc_sptr gps_l1_ca_dll_pll_make_tracking_gpu_cc( - long fs_in, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -91,7 +91,7 @@ private: float early_late_space_chips); Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc( - long fs_in, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -108,8 +108,8 @@ private: Gnss_Synchro *d_acquisition_gnss_synchro; unsigned int d_channel; - long d_if_freq; - long d_fs_in; + int64_t d_if_freq; + int64_t d_fs_in; double d_early_late_spc_chips; int d_n_correlator_taps; @@ -153,8 +153,8 @@ private: int d_correlation_length_samples; //processing samples counters - unsigned long int d_sample_counter; - unsigned long int d_acq_sample_stamp; + uint64_t d_sample_counter; + uint64_t d_acq_sample_stamp; // CN0 estimation and lock detector int d_cn0_estimation_counter; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc index c99990cfc..927a3a9e9 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc @@ -58,7 +58,7 @@ using google::LogMessage; gps_l1_ca_tcp_connector_tracking_cc_sptr gps_l1_ca_tcp_connector_make_tracking_cc( - long fs_in, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -81,7 +81,7 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::forecast(int noutput_items, Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc( - long fs_in, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -186,9 +186,9 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::start_tracking() d_acq_carrier_doppler_hz = d_acquisition_gnss_synchro->Acq_doppler_hz; d_acq_sample_stamp = d_acquisition_gnss_synchro->Acq_samplestamp_samples; - long int acq_trk_diff_samples; + int64_t acq_trk_diff_samples; float acq_trk_diff_seconds; - acq_trk_diff_samples = static_cast(d_sample_counter) - static_cast(d_acq_sample_stamp); + acq_trk_diff_samples = static_cast(d_sample_counter) - static_cast(d_acq_sample_stamp); std::cout << "acq_trk_diff_samples=" << acq_trk_diff_samples << std::endl; acq_trk_diff_seconds = static_cast(acq_trk_diff_samples) / static_cast(d_fs_in); //doppler effect @@ -535,7 +535,7 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attrib d_dump_file.write(reinterpret_cast(&prompt_I), sizeof(float)); d_dump_file.write(reinterpret_cast(&prompt_Q), sizeof(float)); // PRN start sample stamp - d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(unsigned long int)); + d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(uint64_t)); // accumulated carrier phase tmp_float = d_acc_carrier_phase_rad; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.h index 089df2be2..e21789370 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.h @@ -52,7 +52,7 @@ typedef boost::shared_ptr gps_l1_ca_tcp_con gps_l1_ca_tcp_connector_tracking_cc_sptr gps_l1_ca_tcp_connector_make_tracking_cc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float early_late_space_chips, @@ -84,14 +84,14 @@ public: private: friend gps_l1_ca_tcp_connector_tracking_cc_sptr gps_l1_ca_tcp_connector_make_tracking_cc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float early_late_space_chips, size_t port_ch0); Gps_L1_Ca_Tcp_Connector_Tracking_cc( - long fs_in, unsigned int vector_length, + int64_t fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float early_late_space_chips, @@ -104,7 +104,7 @@ private: Gnss_Synchro *d_acquisition_gnss_synchro; unsigned int d_channel; - long d_fs_in; + int64_t d_fs_in; int d_correlation_length_samples; int d_n_correlator_taps; double d_early_late_spc_chips; @@ -147,8 +147,8 @@ private: double d_sample_counter_seconds; //processing samples counters - unsigned long int d_sample_counter; - unsigned long int d_acq_sample_stamp; + uint64_t d_sample_counter; + uint64_t d_acq_sample_stamp; // CN0 estimation and lock detector int d_cn0_estimation_counter; diff --git a/src/core/system_parameters/galileo_fnav_message.cc b/src/core/system_parameters/galileo_fnav_message.cc index b0c17fa7d..644357701 100644 --- a/src/core/system_parameters/galileo_fnav_message.cc +++ b/src/core/system_parameters/galileo_fnav_message.cc @@ -450,9 +450,9 @@ void Galileo_Fnav_Message::decode_page(std::string data) } -unsigned long int Galileo_Fnav_Message::read_navigation_unsigned(std::bitset bits, const std::vector> parameter) +uint64_t Galileo_Fnav_Message::read_navigation_unsigned(std::bitset bits, const std::vector> parameter) { - unsigned long int value = 0; + uint64_t value = 0; int num_of_slices = parameter.size(); for (int i = 0; i < num_of_slices; i++) { @@ -469,12 +469,12 @@ unsigned long int Galileo_Fnav_Message::read_navigation_unsigned(std::bitset bits, const std::vector> parameter) +int64_t Galileo_Fnav_Message::read_navigation_signed(std::bitset bits, const std::vector> parameter) { - signed long int value = 0; + int64_t value = 0; int num_of_slices = parameter.size(); // Discriminate between 64 bits and 32 bits compiler - int long_int_size_bytes = sizeof(signed long int); + int long_int_size_bytes = sizeof(int64_t); if (long_int_size_bytes == 8) // if a long int takes 8 bytes, we are in a 64 bits system { // read the MSB and perform the sign extension diff --git a/src/core/system_parameters/galileo_fnav_message.h b/src/core/system_parameters/galileo_fnav_message.h index 4f043d5d8..bbcc68a29 100644 --- a/src/core/system_parameters/galileo_fnav_message.h +++ b/src/core/system_parameters/galileo_fnav_message.h @@ -45,6 +45,7 @@ #include "Galileo_E5a.h" #include // for boost::uint16_t #include +#include #include #include #include @@ -213,8 +214,8 @@ public: private: bool _CRC_test(std::bitset bits, boost::uint32_t checksum); void decode_page(std::string data); - unsigned long int read_navigation_unsigned(std::bitset bits, const std::vector> parameter); - signed long int read_navigation_signed(std::bitset bits, const std::vector> parameter); + uint64_t read_navigation_unsigned(std::bitset bits, const std::vector> parameter); + int64_t read_navigation_signed(std::bitset bits, const std::vector> parameter); std::string omega0_1; //std::string omega0_2; diff --git a/src/core/system_parameters/galileo_navigation_message.cc b/src/core/system_parameters/galileo_navigation_message.cc index 95edb4bd5..13de3e5f2 100644 --- a/src/core/system_parameters/galileo_navigation_message.cc +++ b/src/core/system_parameters/galileo_navigation_message.cc @@ -258,9 +258,9 @@ bool Galileo_Navigation_Message::CRC_test(std::bitset b } -unsigned long int Galileo_Navigation_Message::read_navigation_unsigned(std::bitset bits, const std::vector > parameter) +uint64_t Galileo_Navigation_Message::read_navigation_unsigned(std::bitset bits, const std::vector > parameter) { - unsigned long int value = 0; + uint64_t value = 0; int num_of_slices = parameter.size(); for (int i = 0; i < num_of_slices; i++) { @@ -277,9 +277,9 @@ unsigned long int Galileo_Navigation_Message::read_navigation_unsigned(std::bits } -unsigned long int Galileo_Navigation_Message::read_page_type_unsigned(std::bitset bits, const std::vector > parameter) +uint64_t Galileo_Navigation_Message::read_page_type_unsigned(std::bitset bits, const std::vector > parameter) { - unsigned long int value = 0; + uint64_t value = 0; int num_of_slices = parameter.size(); for (int i = 0; i < num_of_slices; i++) { @@ -296,12 +296,12 @@ unsigned long int Galileo_Navigation_Message::read_page_type_unsigned(std::bitse } -signed long int Galileo_Navigation_Message::read_navigation_signed(std::bitset bits, const std::vector > parameter) +int64_t Galileo_Navigation_Message::read_navigation_signed(std::bitset bits, const std::vector > parameter) { - signed long int value = 0; + int64_t value = 0; int num_of_slices = parameter.size(); // Discriminate between 64 bits and 32 bits compiler - int long_int_size_bytes = sizeof(signed long int); + int long_int_size_bytes = sizeof(int64_t); if (long_int_size_bytes == 8) // if a long int takes 8 bytes, we are in a 64 bits system { // read the MSB and perform the sign extension diff --git a/src/core/system_parameters/galileo_navigation_message.h b/src/core/system_parameters/galileo_navigation_message.h index 2108a1568..4eddb5e77 100644 --- a/src/core/system_parameters/galileo_navigation_message.h +++ b/src/core/system_parameters/galileo_navigation_message.h @@ -38,8 +38,9 @@ #include "galileo_almanac.h" #include "galileo_utc_model.h" #include "Galileo_E1.h" -#include // for boost::uint32_t +//#include // for boost::uint32_t #include +#include #include #include #include @@ -54,12 +55,12 @@ class Galileo_Navigation_Message { private: - bool CRC_test(std::bitset bits, boost::uint32_t checksum); + bool CRC_test(std::bitset bits, uint32_t checksum); bool read_navigation_bool(std::bitset bits, const std::vector > parameter); //void print_galileo_word_bytes(unsigned int GPS_word); - unsigned long int read_navigation_unsigned(std::bitset bits, const std::vector > parameter); - unsigned long int read_page_type_unsigned(std::bitset bits, const std::vector > parameter); - signed long int read_navigation_signed(std::bitset bits, const std::vector > parameter); + uint64_t read_navigation_unsigned(std::bitset bits, const std::vector > parameter); + uint64_t read_page_type_unsigned(std::bitset bits, const std::vector > parameter); + int64_t read_navigation_signed(std::bitset bits, const std::vector > parameter); public: int Page_type_time_stamp; diff --git a/src/core/system_parameters/glonass_gnav_navigation_message.cc b/src/core/system_parameters/glonass_gnav_navigation_message.cc index 469c42ae3..4233632e3 100644 --- a/src/core/system_parameters/glonass_gnav_navigation_message.cc +++ b/src/core/system_parameters/glonass_gnav_navigation_message.cc @@ -228,9 +228,9 @@ bool Glonass_Gnav_Navigation_Message::read_navigation_bool(std::bitset bits, const std::vector> parameter) +uint64_t Glonass_Gnav_Navigation_Message::read_navigation_unsigned(std::bitset bits, const std::vector> parameter) { - unsigned long int value = 0; + uint64_t value = 0; int num_of_slices = parameter.size(); for (int i = 0; i < num_of_slices; i++) { @@ -247,10 +247,10 @@ unsigned long int Glonass_Gnav_Navigation_Message::read_navigation_unsigned(std: } -signed long int Glonass_Gnav_Navigation_Message::read_navigation_signed(std::bitset bits, const std::vector> parameter) +int64_t Glonass_Gnav_Navigation_Message::read_navigation_signed(std::bitset bits, const std::vector> parameter) { - signed long int value = 0; - signed long int sign = 0; + int64_t value = 0; + int64_t sign = 0; int num_of_slices = parameter.size(); // read the MSB and perform the sign extension if (bits[GLONASS_GNAV_STRING_BITS - parameter[0].first] == 1) diff --git a/src/core/system_parameters/glonass_gnav_navigation_message.h b/src/core/system_parameters/glonass_gnav_navigation_message.h index 54fe5219b..cbb42b468 100644 --- a/src/core/system_parameters/glonass_gnav_navigation_message.h +++ b/src/core/system_parameters/glonass_gnav_navigation_message.h @@ -40,6 +40,7 @@ #include "glonass_gnav_utc_model.h" #include "GLONASS_L1_L2_CA.h" #include +#include /*! @@ -50,8 +51,8 @@ class Glonass_Gnav_Navigation_Message { private: - unsigned long int read_navigation_unsigned(std::bitset bits, const std::vector> parameter); - signed long int read_navigation_signed(std::bitset bits, const std::vector> parameter); + uint64_t read_navigation_unsigned(std::bitset bits, const std::vector> parameter); + int64_t read_navigation_signed(std::bitset bits, const std::vector> parameter); bool read_navigation_bool(std::bitset bits, const std::vector> parameter); public: diff --git a/src/core/system_parameters/gnss_synchro.h b/src/core/system_parameters/gnss_synchro.h index c9cd0ee0c..31b9b65f7 100644 --- a/src/core/system_parameters/gnss_synchro.h +++ b/src/core/system_parameters/gnss_synchro.h @@ -33,7 +33,7 @@ #define GNSS_SDR_GNSS_SYNCHRO_H_ #include "gnss_signal.h" - +#include /*! * \brief This is the class that contains the information that is shared @@ -43,31 +43,31 @@ class Gnss_Synchro { public: // Satellite and signal info - char System; //!< Set by Channel::set_signal(Gnss_Signal gnss_signal) - char Signal[3]; //!< Set by Channel::set_signal(Gnss_Signal gnss_signal) - unsigned int PRN; //!< Set by Channel::set_signal(Gnss_Signal gnss_signal) - int Channel_ID; //!< Set by Channel constructor + char System; //!< Set by Channel::set_signal(Gnss_Signal gnss_signal) + char Signal[3]; //!< Set by Channel::set_signal(Gnss_Signal gnss_signal) + uint32_t PRN; //!< Set by Channel::set_signal(Gnss_Signal gnss_signal) + int32_t Channel_ID; //!< Set by Channel constructor // Acquisition - double Acq_delay_samples; //!< Set by Acquisition processing block - double Acq_doppler_hz; //!< Set by Acquisition processing block - unsigned long int Acq_samplestamp_samples; //!< Set by Acquisition processing block - bool Flag_valid_acquisition; //!< Set by Acquisition processing block + double Acq_delay_samples; //!< Set by Acquisition processing block + double Acq_doppler_hz; //!< Set by Acquisition processing block + uint64_t Acq_samplestamp_samples; //!< Set by Acquisition processing block + bool Flag_valid_acquisition; //!< Set by Acquisition processing block //Tracking - long int fs; //!< Set by Tracking processing block - double Prompt_I; //!< Set by Tracking processing block - double Prompt_Q; //!< Set by Tracking processing block - double CN0_dB_hz; //!< Set by Tracking processing block - double Carrier_Doppler_hz; //!< Set by Tracking processing block - double Carrier_phase_rads; //!< Set by Tracking processing block - double Code_phase_samples; //!< Set by Tracking processing block - unsigned long int Tracking_sample_counter; //!< Set by Tracking processing block + int64_t fs; //!< Set by Tracking processing block + double Prompt_I; //!< Set by Tracking processing block + double Prompt_Q; //!< Set by Tracking processing block + double CN0_dB_hz; //!< Set by Tracking processing block + double Carrier_Doppler_hz; //!< Set by Tracking processing block + double Carrier_phase_rads; //!< Set by Tracking processing block + double Code_phase_samples; //!< Set by Tracking processing block + uint64_t Tracking_sample_counter; //!< Set by Tracking processing block bool Flag_valid_symbol_output; //!< Set by Tracking processing block - int correlation_length_ms; //!< Set by Tracking processing block + int32_t correlation_length_ms; //!< Set by Tracking processing block //Telemetry Decoder - bool Flag_valid_word; //!< Set by Telemetry Decoder processing block - unsigned int TOW_at_current_symbol_ms; //!< Set by Telemetry Decoder processing block + bool Flag_valid_word; //!< Set by Telemetry Decoder processing block + uint32_t TOW_at_current_symbol_ms; //!< Set by Telemetry Decoder processing block // Observables double Pseudorange_m; //!< Set by Observables processing block diff --git a/src/core/system_parameters/gps_cnav_navigation_message.cc b/src/core/system_parameters/gps_cnav_navigation_message.cc index 8371b19f2..cf7ed0a2a 100644 --- a/src/core/system_parameters/gps_cnav_navigation_message.cc +++ b/src/core/system_parameters/gps_cnav_navigation_message.cc @@ -88,9 +88,9 @@ bool Gps_CNAV_Navigation_Message::read_navigation_bool(std::bitset bits, const std::vector> parameter) +uint64_t Gps_CNAV_Navigation_Message::read_navigation_unsigned(std::bitset bits, const std::vector> parameter) { - unsigned long int value = 0; + uint64_t value = 0; int num_of_slices = parameter.size(); for (int i = 0; i < num_of_slices; i++) { @@ -107,12 +107,12 @@ unsigned long int Gps_CNAV_Navigation_Message::read_navigation_unsigned(std::bit } -signed long int Gps_CNAV_Navigation_Message::read_navigation_signed(std::bitset bits, const std::vector> parameter) +int64_t Gps_CNAV_Navigation_Message::read_navigation_signed(std::bitset bits, const std::vector> parameter) { - signed long int value = 0; + int64_t value = 0; int num_of_slices = parameter.size(); // Discriminate between 64 bits and 32 bits compiler - int long_int_size_bytes = sizeof(signed long int); + int long_int_size_bytes = sizeof(int64_t); if (long_int_size_bytes == 8) // if a long int takes 8 bytes, we are in a 64 bits system { // read the MSB and perform the sign extension diff --git a/src/core/system_parameters/gps_cnav_navigation_message.h b/src/core/system_parameters/gps_cnav_navigation_message.h index 4cf7dceeb..e5205f9dd 100644 --- a/src/core/system_parameters/gps_cnav_navigation_message.h +++ b/src/core/system_parameters/gps_cnav_navigation_message.h @@ -38,6 +38,7 @@ #include "gps_cnav_iono.h" #include "gps_cnav_utc_model.h" #include +#include #include #include #include @@ -55,8 +56,8 @@ class Gps_CNAV_Navigation_Message { private: - unsigned long int read_navigation_unsigned(std::bitset bits, const std::vector> parameter); - signed long int read_navigation_signed(std::bitset bits, const std::vector> parameter); + uint64_t read_navigation_unsigned(std::bitset bits, const std::vector> parameter); + int64_t read_navigation_signed(std::bitset bits, const std::vector> parameter); bool read_navigation_bool(std::bitset bits, const std::vector> parameter); Gps_CNAV_Ephemeris ephemeris_record; diff --git a/src/core/system_parameters/gps_navigation_message.cc b/src/core/system_parameters/gps_navigation_message.cc index 7d7fd298f..2a5955b1f 100644 --- a/src/core/system_parameters/gps_navigation_message.cc +++ b/src/core/system_parameters/gps_navigation_message.cc @@ -176,9 +176,9 @@ bool Gps_Navigation_Message::read_navigation_bool(std::bitset } -unsigned long int Gps_Navigation_Message::read_navigation_unsigned(std::bitset bits, const std::vector> parameter) +uint64_t Gps_Navigation_Message::read_navigation_unsigned(std::bitset bits, const std::vector> parameter) { - unsigned long int value = 0; + uint64_t value = 0; int num_of_slices = parameter.size(); for (int i = 0; i < num_of_slices; i++) { @@ -195,12 +195,12 @@ unsigned long int Gps_Navigation_Message::read_navigation_unsigned(std::bitset bits, const std::vector> parameter) +int64_t Gps_Navigation_Message::read_navigation_signed(std::bitset bits, const std::vector> parameter) { - signed long int value = 0; + int64_t value = 0; int num_of_slices = parameter.size(); // Discriminate between 64 bits and 32 bits compiler - int long_int_size_bytes = sizeof(signed long int); + int long_int_size_bytes = sizeof(int64_t); if (long_int_size_bytes == 8) // if a long int takes 8 bytes, we are in a 64 bits system { // read the MSB and perform the sign extension @@ -279,114 +279,116 @@ int Gps_Navigation_Message::subframe_decoder(char *subframe) // Decode all 5 sub-frames switch (subframe_ID) - { - //--- Decode the sub-frame id ------------------------------------------ - // ICD (IS-GPS-200E Appendix II). http://www.losangeles.af.mil/shared/media/document/AFD-100813-045.pdf - case 1: - //--- It is subframe 1 ------------------------------------- - // Compute the time of week (TOW) of the first sub-frames in the array ==== - // The transmitted TOW is actual TOW of the next subframe - // (the variable subframe at this point contains bits of the last subframe). - //TOW = bin2dec(subframe(31:47)) * 6; - d_TOW_SF1 = static_cast(read_navigation_unsigned(subframe_bits, TOW)); - //we are in the first subframe (the transmitted TOW is the start time of the next subframe) ! - d_TOW_SF1 = d_TOW_SF1 * 6.0; - d_TOW = d_TOW_SF1; // Set transmission time - b_integrity_status_flag = read_navigation_bool(subframe_bits, INTEGRITY_STATUS_FLAG); - b_alert_flag = read_navigation_bool(subframe_bits, ALERT_FLAG); - b_antispoofing_flag = read_navigation_bool(subframe_bits, ANTI_SPOOFING_FLAG); - i_GPS_week = static_cast(read_navigation_unsigned(subframe_bits, GPS_WEEK)); - i_SV_accuracy = static_cast(read_navigation_unsigned(subframe_bits, SV_ACCURACY)); // (20.3.3.3.1.3) - i_SV_health = static_cast(read_navigation_unsigned(subframe_bits, SV_HEALTH)); - b_L2_P_data_flag = read_navigation_bool(subframe_bits, L2_P_DATA_FLAG); // - i_code_on_L2 = static_cast(read_navigation_unsigned(subframe_bits, CA_OR_P_ON_L2)); - d_TGD = static_cast(read_navigation_signed(subframe_bits, T_GD)); - d_TGD = d_TGD * T_GD_LSB; - d_IODC = static_cast(read_navigation_unsigned(subframe_bits, IODC)); - d_Toc = static_cast(read_navigation_unsigned(subframe_bits, T_OC)); - d_Toc = d_Toc * T_OC_LSB; - d_A_f0 = static_cast(read_navigation_signed(subframe_bits, A_F0)); - d_A_f0 = d_A_f0 * A_F0_LSB; - d_A_f1 = static_cast(read_navigation_signed(subframe_bits, A_F1)); - d_A_f1 = d_A_f1 * A_F1_LSB; - d_A_f2 = static_cast(read_navigation_signed(subframe_bits, A_F2)); - d_A_f2 = d_A_f2 * A_F2_LSB; + { + //--- Decode the sub-frame id ------------------------------------------ + // ICD (IS-GPS-200E Appendix II). http://www.losangeles.af.mil/shared/media/document/AFD-100813-045.pdf + case 1: + //--- It is subframe 1 ------------------------------------- + // Compute the time of week (TOW) of the first sub-frames in the array ==== + // The transmitted TOW is actual TOW of the next subframe + // (the variable subframe at this point contains bits of the last subframe). + //TOW = bin2dec(subframe(31:47)) * 6; + d_TOW_SF1 = static_cast(read_navigation_unsigned(subframe_bits, TOW)); + //we are in the first subframe (the transmitted TOW is the start time of the next subframe) ! + d_TOW_SF1 = d_TOW_SF1 * 6.0; + d_TOW = d_TOW_SF1; // Set transmission time + b_integrity_status_flag = read_navigation_bool(subframe_bits, INTEGRITY_STATUS_FLAG); + b_alert_flag = read_navigation_bool(subframe_bits, ALERT_FLAG); + b_antispoofing_flag = read_navigation_bool(subframe_bits, ANTI_SPOOFING_FLAG); + i_GPS_week = static_cast(read_navigation_unsigned(subframe_bits, GPS_WEEK)); + i_SV_accuracy = static_cast(read_navigation_unsigned(subframe_bits, SV_ACCURACY)); // (20.3.3.3.1.3) + i_SV_health = static_cast(read_navigation_unsigned(subframe_bits, SV_HEALTH)); + b_L2_P_data_flag = read_navigation_bool(subframe_bits, L2_P_DATA_FLAG); // + i_code_on_L2 = static_cast(read_navigation_unsigned(subframe_bits, CA_OR_P_ON_L2)); + d_TGD = static_cast(read_navigation_signed(subframe_bits, T_GD)); + d_TGD = d_TGD * T_GD_LSB; + d_IODC = static_cast(read_navigation_unsigned(subframe_bits, IODC)); + d_Toc = static_cast(read_navigation_unsigned(subframe_bits, T_OC)); + d_Toc = d_Toc * T_OC_LSB; + d_A_f0 = static_cast(read_navigation_signed(subframe_bits, A_F0)); + d_A_f0 = d_A_f0 * A_F0_LSB; + d_A_f1 = static_cast(read_navigation_signed(subframe_bits, A_F1)); + d_A_f1 = d_A_f1 * A_F1_LSB; + d_A_f2 = static_cast(read_navigation_signed(subframe_bits, A_F2)); + d_A_f2 = d_A_f2 * A_F2_LSB; break; - case 2: //--- It is subframe 2 ------------------- - d_TOW_SF2 = static_cast(read_navigation_unsigned(subframe_bits, TOW)); - d_TOW_SF2 = d_TOW_SF2 * 6.0; - d_TOW = d_TOW_SF2; // Set transmission time - b_integrity_status_flag = read_navigation_bool(subframe_bits, INTEGRITY_STATUS_FLAG); - b_alert_flag = read_navigation_bool(subframe_bits, ALERT_FLAG); - b_antispoofing_flag = read_navigation_bool(subframe_bits, ANTI_SPOOFING_FLAG); - d_IODE_SF2 = static_cast(read_navigation_unsigned(subframe_bits, IODE_SF2)); - d_Crs = static_cast(read_navigation_signed(subframe_bits, C_RS)); - d_Crs = d_Crs * C_RS_LSB; - d_Delta_n = static_cast(read_navigation_signed(subframe_bits, DELTA_N)); - d_Delta_n = d_Delta_n * DELTA_N_LSB; - d_M_0 = static_cast(read_navigation_signed(subframe_bits, M_0)); - d_M_0 = d_M_0 * M_0_LSB; - d_Cuc = static_cast(read_navigation_signed(subframe_bits, C_UC)); - d_Cuc = d_Cuc * C_UC_LSB; - d_e_eccentricity = static_cast(read_navigation_unsigned(subframe_bits, E)); - d_e_eccentricity = d_e_eccentricity * E_LSB; - d_Cus = static_cast(read_navigation_signed(subframe_bits, C_US)); - d_Cus = d_Cus * C_US_LSB; - d_sqrt_A = static_cast(read_navigation_unsigned(subframe_bits, SQRT_A)); - d_sqrt_A = d_sqrt_A * SQRT_A_LSB; - d_Toe = static_cast(read_navigation_unsigned(subframe_bits, T_OE)); - d_Toe = d_Toe * T_OE_LSB; - b_fit_interval_flag = read_navigation_bool(subframe_bits, FIT_INTERVAL_FLAG); - i_AODO = static_cast(read_navigation_unsigned(subframe_bits, AODO)); - i_AODO = i_AODO * AODO_LSB; + case 2: //--- It is subframe 2 ------------------- + d_TOW_SF2 = static_cast(read_navigation_unsigned(subframe_bits, TOW)); + d_TOW_SF2 = d_TOW_SF2 * 6.0; + d_TOW = d_TOW_SF2; // Set transmission time + b_integrity_status_flag = read_navigation_bool(subframe_bits, INTEGRITY_STATUS_FLAG); + b_alert_flag = read_navigation_bool(subframe_bits, ALERT_FLAG); + b_antispoofing_flag = read_navigation_bool(subframe_bits, ANTI_SPOOFING_FLAG); + d_IODE_SF2 = static_cast(read_navigation_unsigned(subframe_bits, IODE_SF2)); + d_Crs = static_cast(read_navigation_signed(subframe_bits, C_RS)); + d_Crs = d_Crs * C_RS_LSB; + d_Delta_n = static_cast(read_navigation_signed(subframe_bits, DELTA_N)); + d_Delta_n = d_Delta_n * DELTA_N_LSB; + d_M_0 = static_cast(read_navigation_signed(subframe_bits, M_0)); + d_M_0 = d_M_0 * M_0_LSB; + d_Cuc = static_cast(read_navigation_signed(subframe_bits, C_UC)); + d_Cuc = d_Cuc * C_UC_LSB; + d_e_eccentricity = static_cast(read_navigation_unsigned(subframe_bits, E)); + d_e_eccentricity = d_e_eccentricity * E_LSB; + d_Cus = static_cast(read_navigation_signed(subframe_bits, C_US)); + d_Cus = d_Cus * C_US_LSB; + d_sqrt_A = static_cast(read_navigation_unsigned(subframe_bits, SQRT_A)); + d_sqrt_A = d_sqrt_A * SQRT_A_LSB; + d_Toe = static_cast(read_navigation_unsigned(subframe_bits, T_OE)); + d_Toe = d_Toe * T_OE_LSB; + b_fit_interval_flag = read_navigation_bool(subframe_bits, FIT_INTERVAL_FLAG); + i_AODO = static_cast(read_navigation_unsigned(subframe_bits, AODO)); + i_AODO = i_AODO * AODO_LSB; break; - case 3: // --- It is subframe 3 ------------------------------------- - d_TOW_SF3 = static_cast(read_navigation_unsigned(subframe_bits, TOW)); - d_TOW_SF3 = d_TOW_SF3 * 6.0; - d_TOW = d_TOW_SF3; // Set transmission time - b_integrity_status_flag = read_navigation_bool(subframe_bits, INTEGRITY_STATUS_FLAG); - b_alert_flag = read_navigation_bool(subframe_bits, ALERT_FLAG); - b_antispoofing_flag = read_navigation_bool(subframe_bits, ANTI_SPOOFING_FLAG); - d_Cic = static_cast(read_navigation_signed(subframe_bits, C_IC)); - d_Cic = d_Cic * C_IC_LSB; - d_OMEGA0 = static_cast(read_navigation_signed(subframe_bits, OMEGA_0)); - d_OMEGA0 = d_OMEGA0 * OMEGA_0_LSB; - d_Cis = static_cast(read_navigation_signed(subframe_bits, C_IS)); - d_Cis = d_Cis * C_IS_LSB; - d_i_0 = static_cast(read_navigation_signed(subframe_bits, I_0)); - d_i_0 = d_i_0 * I_0_LSB; - d_Crc = static_cast(read_navigation_signed(subframe_bits, C_RC)); - d_Crc = d_Crc * C_RC_LSB; - d_OMEGA = static_cast(read_navigation_signed(subframe_bits, OMEGA)); - d_OMEGA = d_OMEGA * OMEGA_LSB; - d_OMEGA_DOT = static_cast(read_navigation_signed(subframe_bits, OMEGA_DOT)); - d_OMEGA_DOT = d_OMEGA_DOT * OMEGA_DOT_LSB; - d_IODE_SF3 = static_cast(read_navigation_unsigned(subframe_bits, IODE_SF3)); - d_IDOT = static_cast(read_navigation_signed(subframe_bits, I_DOT)); - d_IDOT = d_IDOT * I_DOT_LSB; + case 3: // --- It is subframe 3 ------------------------------------- + d_TOW_SF3 = static_cast(read_navigation_unsigned(subframe_bits, TOW)); + d_TOW_SF3 = d_TOW_SF3 * 6.0; + d_TOW = d_TOW_SF3; // Set transmission time + b_integrity_status_flag = read_navigation_bool(subframe_bits, INTEGRITY_STATUS_FLAG); + b_alert_flag = read_navigation_bool(subframe_bits, ALERT_FLAG); + b_antispoofing_flag = read_navigation_bool(subframe_bits, ANTI_SPOOFING_FLAG); + d_Cic = static_cast(read_navigation_signed(subframe_bits, C_IC)); + d_Cic = d_Cic * C_IC_LSB; + d_OMEGA0 = static_cast(read_navigation_signed(subframe_bits, OMEGA_0)); + d_OMEGA0 = d_OMEGA0 * OMEGA_0_LSB; + d_Cis = static_cast(read_navigation_signed(subframe_bits, C_IS)); + d_Cis = d_Cis * C_IS_LSB; + d_i_0 = static_cast(read_navigation_signed(subframe_bits, I_0)); + d_i_0 = d_i_0 * I_0_LSB; + d_Crc = static_cast(read_navigation_signed(subframe_bits, C_RC)); + d_Crc = d_Crc * C_RC_LSB; + d_OMEGA = static_cast(read_navigation_signed(subframe_bits, OMEGA)); + d_OMEGA = d_OMEGA * OMEGA_LSB; + d_OMEGA_DOT = static_cast(read_navigation_signed(subframe_bits, OMEGA_DOT)); + d_OMEGA_DOT = d_OMEGA_DOT * OMEGA_DOT_LSB; + d_IODE_SF3 = static_cast(read_navigation_unsigned(subframe_bits, IODE_SF3)); + d_IDOT = static_cast(read_navigation_signed(subframe_bits, I_DOT)); + d_IDOT = d_IDOT * I_DOT_LSB; break; - case 4: // --- It is subframe 4 ---------- Almanac, ionospheric model, UTC parameters, SV health (PRN: 25-32) - int SV_data_ID; - int SV_page; - d_TOW_SF4 = static_cast(read_navigation_unsigned(subframe_bits, TOW)); - d_TOW_SF4 = d_TOW_SF4 * 6.0; - d_TOW = d_TOW_SF4; // Set transmission time - b_integrity_status_flag = read_navigation_bool(subframe_bits, INTEGRITY_STATUS_FLAG); - b_alert_flag = read_navigation_bool(subframe_bits, ALERT_FLAG); - b_antispoofing_flag = read_navigation_bool(subframe_bits, ANTI_SPOOFING_FLAG); - SV_data_ID = static_cast(read_navigation_unsigned(subframe_bits, SV_DATA_ID)); - SV_page = static_cast(read_navigation_unsigned(subframe_bits, SV_PAGE)); - if (SV_page > 24 && SV_page < 33) // Page 4 (from Table 20-V. Data IDs and SV IDs in Subframes 4 and 5, IS-GPS-200H, page 110) - { - //! \TODO read almanac - if(SV_data_ID){} - } + case 4: // --- It is subframe 4 ---------- Almanac, ionospheric model, UTC parameters, SV health (PRN: 25-32) + int SV_data_ID; + int SV_page; + d_TOW_SF4 = static_cast(read_navigation_unsigned(subframe_bits, TOW)); + d_TOW_SF4 = d_TOW_SF4 * 6.0; + d_TOW = d_TOW_SF4; // Set transmission time + b_integrity_status_flag = read_navigation_bool(subframe_bits, INTEGRITY_STATUS_FLAG); + b_alert_flag = read_navigation_bool(subframe_bits, ALERT_FLAG); + b_antispoofing_flag = read_navigation_bool(subframe_bits, ANTI_SPOOFING_FLAG); + SV_data_ID = static_cast(read_navigation_unsigned(subframe_bits, SV_DATA_ID)); + SV_page = static_cast(read_navigation_unsigned(subframe_bits, SV_PAGE)); + if (SV_page > 24 && SV_page < 33) // Page 4 (from Table 20-V. Data IDs and SV IDs in Subframes 4 and 5, IS-GPS-200H, page 110) + { + //! \TODO read almanac + if (SV_data_ID) + { + } + } if (SV_page == 52) // Page 13 (from Table 20-V. Data IDs and SV IDs in Subframes 4 and 5, IS-GPS-200H, page 110) { @@ -447,53 +449,55 @@ int Gps_Navigation_Message::subframe_decoder(char *subframe) break; - case 5://--- It is subframe 5 -----------------almanac health (PRN: 1-24) and Almanac reference week number and time. - int SV_data_ID_5; - int SV_page_5; - d_TOW_SF5 = static_cast(read_navigation_unsigned(subframe_bits, TOW)); - d_TOW_SF5 = d_TOW_SF5 * 6.0; - d_TOW = d_TOW_SF5; // Set transmission time - b_integrity_status_flag = read_navigation_bool(subframe_bits, INTEGRITY_STATUS_FLAG); - b_alert_flag = read_navigation_bool(subframe_bits, ALERT_FLAG); - b_antispoofing_flag = read_navigation_bool(subframe_bits, ANTI_SPOOFING_FLAG); - SV_data_ID_5 = static_cast(read_navigation_unsigned(subframe_bits, SV_DATA_ID)); - SV_page_5 = static_cast(read_navigation_unsigned(subframe_bits, SV_PAGE)); - if (SV_page_5 < 25) - { - //! \TODO read almanac - if(SV_data_ID_5){} - } - if (SV_page_5 == 51) // Page 25 (from Table 20-V. Data IDs and SV IDs in Subframes 4 and 5, IS-GPS-200H, page 110) - { - d_Toa = static_cast(read_navigation_unsigned(subframe_bits, T_OA)); - d_Toa = d_Toa * T_OA_LSB; - i_WN_A = static_cast(read_navigation_unsigned(subframe_bits, WN_A)); - almanacHealth[1] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV1)); - almanacHealth[2] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV2)); - almanacHealth[3] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV3)); - almanacHealth[4] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV4)); - almanacHealth[5] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV5)); - almanacHealth[6] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV6)); - almanacHealth[7] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV7)); - almanacHealth[8] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV8)); - almanacHealth[9] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV9)); - almanacHealth[10] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV10)); - almanacHealth[11] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV11)); - almanacHealth[12] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV12)); - almanacHealth[13] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV13)); - almanacHealth[14] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV14)); - almanacHealth[15] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV15)); - almanacHealth[16] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV16)); - almanacHealth[17] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV17)); - almanacHealth[18] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV18)); - almanacHealth[19] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV19)); - almanacHealth[20] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV20)); - almanacHealth[21] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV21)); - almanacHealth[22] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV22)); - almanacHealth[23] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV23)); - almanacHealth[24] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV24)); - } - break; + case 5: //--- It is subframe 5 -----------------almanac health (PRN: 1-24) and Almanac reference week number and time. + int SV_data_ID_5; + int SV_page_5; + d_TOW_SF5 = static_cast(read_navigation_unsigned(subframe_bits, TOW)); + d_TOW_SF5 = d_TOW_SF5 * 6.0; + d_TOW = d_TOW_SF5; // Set transmission time + b_integrity_status_flag = read_navigation_bool(subframe_bits, INTEGRITY_STATUS_FLAG); + b_alert_flag = read_navigation_bool(subframe_bits, ALERT_FLAG); + b_antispoofing_flag = read_navigation_bool(subframe_bits, ANTI_SPOOFING_FLAG); + SV_data_ID_5 = static_cast(read_navigation_unsigned(subframe_bits, SV_DATA_ID)); + SV_page_5 = static_cast(read_navigation_unsigned(subframe_bits, SV_PAGE)); + if (SV_page_5 < 25) + { + //! \TODO read almanac + if (SV_data_ID_5) + { + } + } + if (SV_page_5 == 51) // Page 25 (from Table 20-V. Data IDs and SV IDs in Subframes 4 and 5, IS-GPS-200H, page 110) + { + d_Toa = static_cast(read_navigation_unsigned(subframe_bits, T_OA)); + d_Toa = d_Toa * T_OA_LSB; + i_WN_A = static_cast(read_navigation_unsigned(subframe_bits, WN_A)); + almanacHealth[1] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV1)); + almanacHealth[2] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV2)); + almanacHealth[3] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV3)); + almanacHealth[4] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV4)); + almanacHealth[5] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV5)); + almanacHealth[6] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV6)); + almanacHealth[7] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV7)); + almanacHealth[8] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV8)); + almanacHealth[9] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV9)); + almanacHealth[10] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV10)); + almanacHealth[11] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV11)); + almanacHealth[12] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV12)); + almanacHealth[13] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV13)); + almanacHealth[14] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV14)); + almanacHealth[15] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV15)); + almanacHealth[16] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV16)); + almanacHealth[17] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV17)); + almanacHealth[18] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV18)); + almanacHealth[19] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV19)); + almanacHealth[20] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV20)); + almanacHealth[21] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV21)); + almanacHealth[22] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV22)); + almanacHealth[23] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV23)); + almanacHealth[24] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV24)); + } + break; default: break; diff --git a/src/core/system_parameters/gps_navigation_message.h b/src/core/system_parameters/gps_navigation_message.h index ba3312efa..12c3836c9 100644 --- a/src/core/system_parameters/gps_navigation_message.h +++ b/src/core/system_parameters/gps_navigation_message.h @@ -39,6 +39,7 @@ #include "gps_almanac.h" #include "gps_utc_model.h" #include +#include #include #include #include @@ -53,8 +54,8 @@ class Gps_Navigation_Message { private: - unsigned long int read_navigation_unsigned(std::bitset bits, const std::vector> parameter); - signed long int read_navigation_signed(std::bitset bits, const std::vector> parameter); + uint64_t read_navigation_unsigned(std::bitset bits, const std::vector> parameter); + int64_t read_navigation_signed(std::bitset bits, const std::vector> parameter); bool read_navigation_bool(std::bitset bits, const std::vector> parameter); void print_gps_word_bytes(unsigned int GPS_word); diff --git a/src/core/system_parameters/rtcm.cc b/src/core/system_parameters/rtcm.cc index 8f337f802..e8df287fa 100644 --- a/src/core/system_parameters/rtcm.cc +++ b/src/core/system_parameters/rtcm.cc @@ -195,7 +195,7 @@ std::string Rtcm::bin_to_binary_data(const std::string& s) const { s_aux.assign(s, 0, remainder); boost::dynamic_bitset<> rembits(s_aux); - unsigned long int n = rembits.to_ulong(); + uint64_t n = rembits.to_ulong(); c[0] = static_cast(n); k++; } @@ -270,7 +270,7 @@ std::string Rtcm::hex_to_bin(const std::string& s) const std::string s_lower = boost::to_upper_copy(ss.str()); for (unsigned int i = 0; i < s.length(); i++) { - unsigned long int n; + uint64_t n; std::istringstream(s_lower.substr(i, 1)) >> std::hex >> n; std::bitset<4> bs(n); s_aux += bs.to_string(); @@ -279,26 +279,26 @@ std::string Rtcm::hex_to_bin(const std::string& s) const } -unsigned long int Rtcm::bin_to_uint(const std::string& s) const +uint64_t Rtcm::bin_to_uint(const std::string& s) const { if (s.length() > 32) { - LOG(WARNING) << "Cannot convert to a unsigned long int"; + LOG(WARNING) << "Cannot convert to a uint64_t"; return 0; } - unsigned long int reading = strtoul(s.c_str(), NULL, 2); + uint64_t reading = strtoul(s.c_str(), NULL, 2); return reading; } -long int Rtcm::bin_to_int(const std::string& s) const +int64_t Rtcm::bin_to_int(const std::string& s) const { if (s.length() > 32) { - LOG(WARNING) << "Cannot convert to a long int"; + LOG(WARNING) << "Cannot convert to a int64_t"; return 0; } - long int reading; + int64_t reading; // Handle negative numbers if (s.substr(0, 1).compare("0")) @@ -316,15 +316,15 @@ long int Rtcm::bin_to_int(const std::string& s) const } -long int Rtcm::bin_to_sint(const std::string& s) const +int64_t Rtcm::bin_to_sint(const std::string& s) const { if (s.length() > 32) { - LOG(WARNING) << "Cannot convert to a long int"; + LOG(WARNING) << "Cannot convert to a int64_t"; return 0; } - long int reading; - long int sign; + int64_t reading; + int64_t sign; // Check for sign bit as defined RTCM doc if (s.substr(0, 1).compare("0") == 0) @@ -343,7 +343,7 @@ long int Rtcm::bin_to_sint(const std::string& s) const } // Find the sign for glonass data fields (neg = 1, pos = 0) -static inline unsigned long glo_sgn(double val) +static inline uint64_t glo_sgn(double val) { if (val < 0) return 1; // If value is negative return 1 if (val == 0) return 0; // Positive or equal to zero return 0 @@ -360,7 +360,7 @@ double Rtcm::bin_to_double(const std::string& s) const return 0; } - long long int reading_int; + int64_t reading_int; // Handle negative numbers if (s.substr(0, 1).compare("0")) @@ -382,26 +382,26 @@ double Rtcm::bin_to_double(const std::string& s) const } -unsigned long int Rtcm::hex_to_uint(const std::string& s) const +uint64_t Rtcm::hex_to_uint(const std::string& s) const { if (s.length() > 32) { - LOG(WARNING) << "Cannot convert to a unsigned long int"; + LOG(WARNING) << "Cannot convert to a uint64_t"; return 0; } - unsigned long int reading = strtoul(s.c_str(), NULL, 16); + uint64_t reading = strtoul(s.c_str(), NULL, 16); return reading; } -long int Rtcm::hex_to_int(const std::string& s) const +int64_t Rtcm::hex_to_int(const std::string& s) const { if (s.length() > 32) { - LOG(WARNING) << "Cannot convert to a long int"; + LOG(WARNING) << "Cannot convert to a int64_t"; return 0; } - long int reading = strtol(s.c_str(), NULL, 16); + int64_t reading = strtol(s.c_str(), NULL, 16); return reading; } @@ -3560,7 +3560,7 @@ int Rtcm::set_DF003(unsigned int ref_station_ID) int Rtcm::set_DF004(double obs_time) { // TOW in milliseconds from the beginning of the GPS week, measured in GPS time - unsigned long int tow = static_cast(std::round(obs_time * 1000)); + uint64_t tow = static_cast(std::round(obs_time * 1000)); if (tow > 604799999) { LOG(WARNING) << "To large TOW! Set to the last millisecond of the week"; @@ -3651,7 +3651,7 @@ int Rtcm::set_DF010(bool code_indicator) int Rtcm::set_DF011(const Gnss_Synchro& gnss_synchro) { double ambiguity = std::floor(gnss_synchro.Pseudorange_m / 299792.458); - unsigned long int gps_L1_pseudorange = static_cast(std::round((gnss_synchro.Pseudorange_m - ambiguity * 299792.458) / 0.02)); + uint64_t gps_L1_pseudorange = static_cast(std::round((gnss_synchro.Pseudorange_m - ambiguity * 299792.458) / 0.02)); DF011 = std::bitset<24>(gps_L1_pseudorange); return 0; } @@ -3665,7 +3665,7 @@ int Rtcm::set_DF012(const Gnss_Synchro& gnss_synchro) double gps_L1_pseudorange_c = gps_L1_pseudorange * 0.02 + ambiguity * 299792.458; double L1_phaserange_c = gnss_synchro.Carrier_phase_rads / GPS_TWO_PI; double L1_phaserange_c_r = std::fmod(L1_phaserange_c - gps_L1_pseudorange_c / lambda + 1500.0, 3000.0) - 1500.0; - long int gps_L1_phaserange_minus_L1_pseudorange = static_cast(std::round(L1_phaserange_c_r * lambda / 0.0005)); + int64_t gps_L1_phaserange_minus_L1_pseudorange = static_cast(std::round(L1_phaserange_c_r * lambda / 0.0005)); DF012 = std::bitset<20>(gps_L1_phaserange_minus_L1_pseudorange); return 0; } @@ -3792,7 +3792,7 @@ int Rtcm::set_DF024(bool galileo_indicator) int Rtcm::set_DF025(double antenna_ECEF_X_m) { - long long int ant_ref_x = static_cast(std::round(antenna_ECEF_X_m * 10000)); + int64_t ant_ref_x = static_cast(std::round(antenna_ECEF_X_m * 10000)); DF025 = std::bitset<38>(ant_ref_x); return 0; } @@ -3800,7 +3800,7 @@ int Rtcm::set_DF025(double antenna_ECEF_X_m) int Rtcm::set_DF026(double antenna_ECEF_Y_m) { - long long int ant_ref_y = static_cast(std::round(antenna_ECEF_Y_m * 10000)); + int64_t ant_ref_y = static_cast(std::round(antenna_ECEF_Y_m * 10000)); DF026 = std::bitset<38>(ant_ref_y); return 0; } @@ -3808,7 +3808,7 @@ int Rtcm::set_DF026(double antenna_ECEF_Y_m) int Rtcm::set_DF027(double antenna_ECEF_Z_m) { - long long int ant_ref_z = static_cast(std::round(antenna_ECEF_Z_m * 10000)); + int64_t ant_ref_z = static_cast(std::round(antenna_ECEF_Z_m * 10000)); DF027 = std::bitset<38>(ant_ref_z); return 0; } @@ -3832,7 +3832,7 @@ int Rtcm::set_DF031(unsigned int antenna_setup_id) int Rtcm::set_DF034(double obs_time) { // TOW in milliseconds from the beginning of the GLONASS day, measured in GLONASS time - unsigned long int tk = static_cast(std::round(obs_time * 1000)); + uint64_t tk = static_cast(std::round(obs_time * 1000)); if (tk > 86400999) { LOG(WARNING) << "To large GLONASS Epoch Time (tk)! Set to the last millisecond of the day"; @@ -3943,7 +3943,7 @@ int Rtcm::set_DF040(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) int Rtcm::set_DF041(const Gnss_Synchro& gnss_synchro) { double ambiguity = std::floor(gnss_synchro.Pseudorange_m / 599584.92); - unsigned long int glonass_L1_pseudorange = static_cast(std::round((gnss_synchro.Pseudorange_m - ambiguity * 599584.92) / 0.02)); + uint64_t glonass_L1_pseudorange = static_cast(std::round((gnss_synchro.Pseudorange_m - ambiguity * 599584.92) / 0.02)); DF041 = std::bitset<25>(glonass_L1_pseudorange); return 0; } @@ -3957,7 +3957,7 @@ int Rtcm::set_DF042(const Gnss_Synchro& gnss_synchro) double glonass_L1_pseudorange_c = glonass_L1_pseudorange * 0.02 + ambiguity * 299792.458; double L1_phaserange_c = gnss_synchro.Carrier_phase_rads / GLONASS_TWO_PI; double L1_phaserange_c_r = std::fmod(L1_phaserange_c - glonass_L1_pseudorange_c / lambda + 1500.0, 3000.0) - 1500.0; - long int glonass_L1_phaserange_minus_L1_pseudorange = static_cast(std::round(L1_phaserange_c_r * lambda / 0.0005)); + int64_t glonass_L1_phaserange_minus_L1_pseudorange = static_cast(std::round(L1_phaserange_c_r * lambda / 0.0005)); DF042 = std::bitset<20>(glonass_L1_phaserange_minus_L1_pseudorange); return 0; } @@ -4058,7 +4058,7 @@ int Rtcm::set_DF050(const Gnss_Synchro& gnss_synchro) int Rtcm::set_DF051(const Gps_Ephemeris& gps_eph, double obs_time) { const double gps_t = obs_time; - boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast((gps_t + 604800 * static_cast(gps_eph.i_GPS_week % 1024)) * 1000)); + boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast((gps_t + 604800 * static_cast(gps_eph.i_GPS_week % 1024)) * 1000)); boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); std::string now_ptime = to_iso_string(p_time); std::string today_ptime = now_ptime.substr(0, 8); @@ -4072,14 +4072,14 @@ int Rtcm::set_DF051(const Gps_Ephemeris& gps_eph, double obs_time) int Rtcm::set_DF052(const Gps_Ephemeris& gps_eph, double obs_time) { const double gps_t = obs_time; - boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast((gps_t + 604800 * static_cast(gps_eph.i_GPS_week % 1024)) * 1000)); + boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast((gps_t + 604800 * static_cast(gps_eph.i_GPS_week % 1024)) * 1000)); boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); std::string now_ptime = to_iso_string(p_time); std::string hours = now_ptime.substr(9, 2); std::string minutes = now_ptime.substr(11, 2); std::string seconds = now_ptime.substr(13, 8); //boost::gregorian::date d(boost::gregorian::from_undelimited_string(today_ptime)); - long unsigned int seconds_of_day = boost::lexical_cast(hours) * 60 * 60 + boost::lexical_cast(minutes) * 60 + boost::lexical_cast(seconds); + uint64_t seconds_of_day = boost::lexical_cast(hours) * 60 * 60 + boost::lexical_cast(minutes) * 60 + boost::lexical_cast(seconds); DF052 = std::bitset<17>(seconds_of_day); return 0; } @@ -4159,7 +4159,7 @@ int Rtcm::set_DF083(const Gps_Ephemeris& gps_eph) int Rtcm::set_DF084(const Gps_Ephemeris& gps_eph) { - long int af0 = static_cast(std::round(gps_eph.d_A_f0 / A_F0_LSB)); + int64_t af0 = static_cast(std::round(gps_eph.d_A_f0 / A_F0_LSB)); DF084 = std::bitset<22>(af0); return 0; } @@ -4191,7 +4191,7 @@ int Rtcm::set_DF087(const Gps_Ephemeris& gps_eph) int Rtcm::set_DF088(const Gps_Ephemeris& gps_eph) { - long int m0 = static_cast(std::round(gps_eph.d_M_0 / M_0_LSB)); + int64_t m0 = static_cast(std::round(gps_eph.d_M_0 / M_0_LSB)); DF088 = std::bitset<32>(m0); return 0; } @@ -4206,7 +4206,7 @@ int Rtcm::set_DF089(const Gps_Ephemeris& gps_eph) int Rtcm::set_DF090(const Gps_Ephemeris& gps_eph) { - unsigned long int ecc = static_cast(std::round(gps_eph.d_e_eccentricity / E_LSB)); + uint64_t ecc = static_cast(std::round(gps_eph.d_e_eccentricity / E_LSB)); DF090 = std::bitset<32>(ecc); return 0; } @@ -4222,7 +4222,7 @@ int Rtcm::set_DF091(const Gps_Ephemeris& gps_eph) int Rtcm::set_DF092(const Gps_Ephemeris& gps_eph) { - unsigned long int sqr_a = static_cast(std::round(gps_eph.d_sqrt_A / SQRT_A_LSB)); + uint64_t sqr_a = static_cast(std::round(gps_eph.d_sqrt_A / SQRT_A_LSB)); DF092 = std::bitset<32>(sqr_a); return 0; } @@ -4246,7 +4246,7 @@ int Rtcm::set_DF094(const Gps_Ephemeris& gps_eph) int Rtcm::set_DF095(const Gps_Ephemeris& gps_eph) { - long int Omega0 = static_cast(std::round(gps_eph.d_OMEGA0 / OMEGA_0_LSB)); + int64_t Omega0 = static_cast(std::round(gps_eph.d_OMEGA0 / OMEGA_0_LSB)); DF095 = std::bitset<32>(Omega0); return 0; } @@ -4262,7 +4262,7 @@ int Rtcm::set_DF096(const Gps_Ephemeris& gps_eph) int Rtcm::set_DF097(const Gps_Ephemeris& gps_eph) { - long int i0 = static_cast(std::round(gps_eph.d_i_0 / I_0_LSB)); + int64_t i0 = static_cast(std::round(gps_eph.d_i_0 / I_0_LSB)); DF097 = std::bitset<32>(i0); return 0; } @@ -4278,7 +4278,7 @@ int Rtcm::set_DF098(const Gps_Ephemeris& gps_eph) int Rtcm::set_DF099(const Gps_Ephemeris& gps_eph) { - long int omega = static_cast(std::round(gps_eph.d_OMEGA / OMEGA_LSB)); + int64_t omega = static_cast(std::round(gps_eph.d_OMEGA / OMEGA_LSB)); DF099 = std::bitset<32>(omega); return 0; } @@ -4286,7 +4286,7 @@ int Rtcm::set_DF099(const Gps_Ephemeris& gps_eph) int Rtcm::set_DF100(const Gps_Ephemeris& gps_eph) { - long int omegadot = static_cast(std::round(gps_eph.d_OMEGA_DOT / OMEGA_DOT_LSB)); + int64_t omegadot = static_cast(std::round(gps_eph.d_OMEGA_DOT / OMEGA_DOT_LSB)); DF100 = std::bitset<24>(omegadot); return 0; } @@ -4636,7 +4636,7 @@ int Rtcm::set_DF137(const Gps_Ephemeris& gps_eph) int Rtcm::set_DF248(double obs_time) { // TOW in milliseconds from the beginning of the Galileo week, measured in Galileo time - unsigned long int tow = static_cast(std::round(obs_time * 1000)); + uint64_t tow = static_cast(std::round(obs_time * 1000)); if (tow > 604799999) { LOG(WARNING) << "To large TOW! Set to the last millisecond of the week"; @@ -4722,7 +4722,7 @@ int Rtcm::set_DF294(const Galileo_Ephemeris& gal_eph) int Rtcm::set_DF295(const Galileo_Ephemeris& gal_eph) { - long int af1 = static_cast(std::round(gal_eph.af1_4 / FNAV_af1_1_LSB)); + int64_t af1 = static_cast(std::round(gal_eph.af1_4 / FNAV_af1_1_LSB)); DF295 = std::bitset<21>(af1); return 0; } @@ -4730,7 +4730,7 @@ int Rtcm::set_DF295(const Galileo_Ephemeris& gal_eph) int Rtcm::set_DF296(const Galileo_Ephemeris& gal_eph) { - long int af0 = static_cast(std::round(gal_eph.af0_4 / FNAV_af0_1_LSB)); + int64_t af0 = static_cast(std::round(gal_eph.af0_4 / FNAV_af0_1_LSB)); DF296 = std::bitset<31>(af0); return 0; } @@ -4754,7 +4754,7 @@ int Rtcm::set_DF298(const Galileo_Ephemeris& gal_eph) int Rtcm::set_DF299(const Galileo_Ephemeris& gal_eph) { - long int m0 = static_cast(std::round(gal_eph.M0_1 / FNAV_M0_2_LSB)); + int64_t m0 = static_cast(std::round(gal_eph.M0_1 / FNAV_M0_2_LSB)); DF299 = std::bitset<32>(m0); return 0; } @@ -4770,7 +4770,7 @@ int Rtcm::set_DF300(const Galileo_Ephemeris& gal_eph) int Rtcm::set_DF301(const Galileo_Ephemeris& gal_eph) { - unsigned long int ecc = static_cast(std::round(gal_eph.e_1 / FNAV_e_2_LSB)); + uint64_t ecc = static_cast(std::round(gal_eph.e_1 / FNAV_e_2_LSB)); DF301 = std::bitset<32>(ecc); return 0; } @@ -4786,7 +4786,7 @@ int Rtcm::set_DF302(const Galileo_Ephemeris& gal_eph) int Rtcm::set_DF303(const Galileo_Ephemeris& gal_eph) { - unsigned long int sqr_a = static_cast(std::round(gal_eph.A_1 / FNAV_a12_2_LSB)); + uint64_t sqr_a = static_cast(std::round(gal_eph.A_1 / FNAV_a12_2_LSB)); DF303 = std::bitset<32>(sqr_a); return 0; } @@ -4810,7 +4810,7 @@ int Rtcm::set_DF305(const Galileo_Ephemeris& gal_eph) int Rtcm::set_DF306(const Galileo_Ephemeris& gal_eph) { - long int Omega0 = static_cast(std::round(gal_eph.OMEGA_0_2 / FNAV_omega0_2_LSB)); + int64_t Omega0 = static_cast(std::round(gal_eph.OMEGA_0_2 / FNAV_omega0_2_LSB)); DF306 = std::bitset<32>(Omega0); return 0; } @@ -4826,7 +4826,7 @@ int Rtcm::set_DF307(const Galileo_Ephemeris& gal_eph) int Rtcm::set_DF308(const Galileo_Ephemeris& gal_eph) { - long int i0 = static_cast(std::round(gal_eph.i_0_2 / FNAV_i0_3_LSB)); + int64_t i0 = static_cast(std::round(gal_eph.i_0_2 / FNAV_i0_3_LSB)); DF308 = std::bitset<32>(i0); return 0; } @@ -4850,7 +4850,7 @@ int Rtcm::set_DF310(const Galileo_Ephemeris& gal_eph) int Rtcm::set_DF311(const Galileo_Ephemeris& gal_eph) { - long int Omegadot = static_cast(std::round(gal_eph.OMEGA_dot_3 / FNAV_omegadot_2_LSB)); + int64_t Omegadot = static_cast(std::round(gal_eph.OMEGA_dot_3 / FNAV_omegadot_2_LSB)); DF311 = std::bitset<24>(Omegadot); return 0; } @@ -5226,7 +5226,7 @@ int Rtcm::set_DF401(const Gnss_Synchro& gnss_synchro) double meters_to_miliseconds = GPS_C_m_s * 0.001; double rough_range_m = std::round(gnss_synchro.Pseudorange_m / meters_to_miliseconds / TWO_N10) * meters_to_miliseconds * TWO_N10; double phrng_m; - long int fine_phaserange; + int64_t fine_phaserange; double lambda = 0.0; std::string sig_(gnss_synchro.Signal); @@ -5284,7 +5284,7 @@ int Rtcm::set_DF401(const Gnss_Synchro& gnss_synchro) } else { - fine_phaserange = static_cast(std::round(phrng_m / meters_to_miliseconds / TWO_N29)); + fine_phaserange = static_cast(std::round(phrng_m / meters_to_miliseconds / TWO_N29)); } DF401 = std::bitset<22>(fine_phaserange); @@ -5397,7 +5397,7 @@ int Rtcm::set_DF405(const Gnss_Synchro& gnss_synchro) double meters_to_miliseconds = GPS_C_m_s * 0.001; double rough_range_m = std::round(gnss_synchro.Pseudorange_m / meters_to_miliseconds / TWO_N10) * meters_to_miliseconds * TWO_N10; double psrng_s; - long int fine_pseudorange; + int64_t fine_pseudorange; psrng_s = gnss_synchro.Pseudorange_m - rough_range_m; @@ -5411,7 +5411,7 @@ int Rtcm::set_DF405(const Gnss_Synchro& gnss_synchro) } else { - fine_pseudorange = static_cast(std::round(psrng_s / meters_to_miliseconds / TWO_N29)); + fine_pseudorange = static_cast(std::round(psrng_s / meters_to_miliseconds / TWO_N29)); } DF405 = std::bitset<20>(fine_pseudorange); return 0; @@ -5420,7 +5420,7 @@ int Rtcm::set_DF405(const Gnss_Synchro& gnss_synchro) int Rtcm::set_DF406(const Gnss_Synchro& gnss_synchro) { - long int fine_phaserange_ex; + int64_t fine_phaserange_ex; double meters_to_miliseconds = GPS_C_m_s * 0.001; double rough_range_m = std::round(gnss_synchro.Pseudorange_m / meters_to_miliseconds / TWO_N10) * meters_to_miliseconds * TWO_N10; double phrng_m; @@ -5479,7 +5479,7 @@ int Rtcm::set_DF406(const Gnss_Synchro& gnss_synchro) } else { - fine_phaserange_ex = static_cast(std::round(phrng_m / meters_to_miliseconds / TWO_N31)); + fine_phaserange_ex = static_cast(std::round(phrng_m / meters_to_miliseconds / TWO_N31)); } DF406 = std::bitset<24>(fine_phaserange_ex); diff --git a/src/core/system_parameters/rtcm.h b/src/core/system_parameters/rtcm.h index d97ed6e24..59ce86a7b 100644 --- a/src/core/system_parameters/rtcm.h +++ b/src/core/system_parameters/rtcm.h @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -347,8 +348,8 @@ public: std::string bin_to_binary_data(const std::string& s) const; // #include #include +#include #include // for ctime #include #include @@ -123,7 +124,7 @@ void FrontEndCal_msg_rx::msg_handler_events(pmt::pmt_t msg) { try { - long int message = pmt::to_long(msg); + int64_t message = pmt::to_long(msg); rx_message = message; channel_internal_queue.push(rx_message); } @@ -204,7 +205,7 @@ bool front_end_capture(std::shared_ptr configuration) sink = gr::blocks::file_sink::make(sizeof(gr_complex), "tmp_capture.dat"); //--- Find number of samples per spreading code --- - long fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", 2048000); + int64_t fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", 2048000); int samples_per_code = round(fs_in_ / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)); int nsamples = samples_per_code * 50; @@ -234,7 +235,7 @@ bool front_end_capture(std::shared_ptr configuration) } -static time_t utc_time(int week, long tow) +static time_t utc_time(int week, int64_t tow) { time_t t; @@ -350,7 +351,7 @@ int main(int argc, char** argv) signal.copy(gnss_synchro->Signal, 2, 0); gnss_synchro->PRN = 1; - long fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", 2048000); + int64_t fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", 2048000); configuration->set_property("Acquisition.max_dwells", "10"); GNSSBlockFactory block_factory; @@ -480,11 +481,11 @@ int main(int argc, char** argv) Eph_map = global_gps_ephemeris_map.get_map_copy(); current_TOW = Eph_map.begin()->second.d_TOW; - time_t t = utc_time(Eph_map.begin()->second.i_GPS_week, (long int)current_TOW); + time_t t = utc_time(Eph_map.begin()->second.i_GPS_week, (int64_t)current_TOW); fprintf(stdout, "Reference Time:\n"); fprintf(stdout, " GPS Week: %d\n", Eph_map.begin()->second.i_GPS_week); - fprintf(stdout, " GPS TOW: %ld %lf\n", (long int)current_TOW, (long int)current_TOW * 0.08); + fprintf(stdout, " GPS TOW: %ld %lf\n", (int64_t)current_TOW, (int64_t)current_TOW * 0.08); fprintf(stdout, " ~ UTC: %s", ctime(&t)); std::cout << "Current TOW obtained from SUPL assistance = " << current_TOW << std::endl; }