1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 12:10:34 +00:00

Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into tracking_debug

This commit is contained in:
Javier Arribas 2019-07-02 10:02:42 +02:00
commit 21f00d5172
70 changed files with 1507 additions and 1586 deletions

View File

@ -77,6 +77,57 @@ rtklib_pvt_gs_sptr rtklib_make_pvt_gs(uint32_t nchannels,
*/
class rtklib_pvt_gs : public gr::sync_block
{
public:
~rtklib_pvt_gs(); //!< Default destructor
/*!
* \brief Get latest set of GPS ephemeris from PVT block
*/
std::map<int, Gps_Ephemeris> get_gps_ephemeris_map() const;
/*!
* \brief Get latest set of GPS almanac from PVT block
*/
std::map<int, Gps_Almanac> get_gps_almanac_map() const;
/*!
* \brief Get latest set of Galileo ephemeris from PVT block
*/
std::map<int, Galileo_Ephemeris> get_galileo_ephemeris_map() const;
/*!
* \brief Get latest set of Galileo almanac from PVT block
*/
std::map<int, Galileo_Almanac> get_galileo_almanac_map() const;
/*!
* \brief Get latest set of BeiDou DNAV ephemeris from PVT block
*/
std::map<int, Beidou_Dnav_Ephemeris> get_beidou_dnav_ephemeris_map() const;
/*!
* \brief Get latest set of BeiDou DNAV almanac from PVT block
*/
std::map<int, Beidou_Dnav_Almanac> get_beidou_dnav_almanac_map() const;
/*!
* \brief Clear all ephemeris information and the almanacs for GPS and Galileo
*/
void clear_ephemeris();
/*!
* \brief Get the latest Position WGS84 [deg], Ground Velocity, Course over Ground, and UTC Time, if available
*/
bool get_latest_PVT(double* longitude_deg,
double* latitude_deg,
double* height_m,
double* ground_speed_kmh,
double* course_over_ground_deg,
time_t* UTC_time) const;
int work(int noutput_items, gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items); //!< PVT Signal Processing
private:
friend rtklib_pvt_gs_sptr rtklib_make_pvt_gs(uint32_t nchannels,
const Pvt_Conf& conf_,
@ -169,57 +220,6 @@ private:
bool d_show_local_time_zone;
std::string d_local_time_str;
boost::posix_time::time_duration d_utc_diff_time;
public:
~rtklib_pvt_gs(); //!< Default destructor
/*!
* \brief Get latest set of GPS ephemeris from PVT block
*/
std::map<int, Gps_Ephemeris> get_gps_ephemeris_map() const;
/*!
* \brief Get latest set of GPS almanac from PVT block
*/
std::map<int, Gps_Almanac> get_gps_almanac_map() const;
/*!
* \brief Get latest set of Galileo ephemeris from PVT block
*/
std::map<int, Galileo_Ephemeris> get_galileo_ephemeris_map() const;
/*!
* \brief Get latest set of Galileo almanac from PVT block
*/
std::map<int, Galileo_Almanac> get_galileo_almanac_map() const;
/*!
* \brief Get latest set of BeiDou DNAV ephemeris from PVT block
*/
std::map<int, Beidou_Dnav_Ephemeris> get_beidou_dnav_ephemeris_map() const;
/*!
* \brief Get latest set of BeiDou DNAV almanac from PVT block
*/
std::map<int, Beidou_Dnav_Almanac> get_beidou_dnav_almanac_map() const;
/*!
* \brief Clear all ephemeris information and the almanacs for GPS and Galileo
*/
void clear_ephemeris();
/*!
* \brief Get the latest Position WGS84 [deg], Ground Velocity, Course over Ground, and UTC Time, if available
*/
bool get_latest_PVT(double* longitude_deg,
double* latitude_deg,
double* height_m,
double* ground_speed_kmh,
double* course_over_ground_deg,
time_t* UTC_time) const;
int work(int noutput_items, gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items); //!< PVT Signal Processing
};
#endif

View File

@ -47,18 +47,18 @@ class Pvt_Solution;
*/
class GeoJSON_Printer
{
private:
std::ofstream geojson_file;
bool first_pos;
std::string filename_;
std::string geojson_base_path;
public:
GeoJSON_Printer(const std::string& base_path = ".");
~GeoJSON_Printer();
bool set_headers(const std::string& filename, bool time_tag_name = true);
bool print_position(const std::shared_ptr<Pvt_Solution>& position, bool print_average_values);
bool close_file();
private:
std::ofstream geojson_file;
bool first_pos;
std::string filename_;
std::string geojson_base_path;
};
#endif

View File

@ -47,19 +47,19 @@ class Rtklib_Solver;
*/
class Gpx_Printer
{
private:
std::ofstream gpx_file;
bool positions_printed;
std::string gpx_filename;
std::string indent;
std::string gpx_base_path;
public:
Gpx_Printer(const std::string& base_path = ".");
~Gpx_Printer();
bool set_headers(const std::string& filename, bool time_tag_name = true);
bool print_position(const std::shared_ptr<Rtklib_Solver>& position, bool print_average_values);
bool close_file();
private:
std::ofstream gpx_file;
bool positions_printed;
std::string gpx_filename;
std::string indent;
std::string gpx_base_path;
};
#endif

View File

@ -48,14 +48,6 @@
*/
class Hybrid_Ls_Pvt : public Ls_Pvt
{
private:
int count_valid_position;
bool d_flag_dump_enabled;
std::string d_dump_filename;
std::ofstream d_dump_file;
int d_nchannels; // Number of available channels for positioning
double d_galileo_current_time;
public:
Hybrid_Ls_Pvt(int nchannels, std::string dump_filename, bool flag_dump_to_file);
~Hybrid_Ls_Pvt();
@ -75,6 +67,14 @@ public:
Gps_CNAV_Iono gps_cnav_iono;
Gps_CNAV_Utc_Model gps_cnav_utc_model;
private:
int count_valid_position;
bool d_flag_dump_enabled;
std::string d_dump_filename;
std::ofstream d_dump_file;
int d_nchannels; // Number of available channels for positioning
double d_galileo_current_time;
};
#endif

View File

@ -46,6 +46,13 @@ class Rtklib_Solver;
*/
class Kml_Printer
{
public:
Kml_Printer(const std::string& base_path = std::string("."));
~Kml_Printer();
bool set_headers(const std::string& filename, bool time_tag_name = true);
bool print_position(const std::shared_ptr<Rtklib_Solver>& position, bool print_average_values);
bool close_file();
private:
std::ofstream kml_file;
std::ofstream tmp_file;
@ -55,13 +62,6 @@ private:
std::string tmp_file_str;
unsigned int point_id;
std::string indent;
public:
Kml_Printer(const std::string& base_path = std::string("."));
~Kml_Printer();
bool set_headers(const std::string& filename, bool time_tag_name = true);
bool print_position(const std::shared_ptr<Rtklib_Solver>& position, bool print_average_values);
bool close_file();
};
#endif

View File

@ -41,12 +41,6 @@
*/
class Ls_Pvt : public Pvt_Solution
{
private:
/*!
* \brief Computes the Lorentz inner product between two vectors
*/
double lorentz(const arma::vec& x, const arma::vec& y);
public:
Ls_Pvt();
@ -59,6 +53,12 @@ public:
* \brief Computes the Weighted Least Squares position solution
*/
arma::vec leastSquarePos(const arma::mat& satpos, const arma::vec& obs, const arma::vec& w_vec);
private:
/*!
* \brief Computes the Lorentz inner product between two vectors
*/
double lorentz(const arma::vec& x, const arma::vec& y);
};
#endif

View File

@ -44,32 +44,6 @@
*/
class Pvt_Solution
{
private:
double d_rx_dt_s; // RX time offset [s]
double d_latitude_d; // RX position Latitude WGS84 [deg]
double d_longitude_d; // RX position Longitude WGS84 [deg]
double d_height_m; // RX position height WGS84 [m]
double d_speed_over_ground_m_s; // RX speed over ground [m/s]
double d_course_over_ground_d; // RX course over ground [deg]
double d_avg_latitude_d; // Averaged latitude in degrees
double d_avg_longitude_d; // Averaged longitude in degrees
double d_avg_height_m; // Averaged height [m]
bool b_valid_position;
std::deque<double> d_hist_latitude_d;
std::deque<double> d_hist_longitude_d;
std::deque<double> d_hist_height_m;
bool d_flag_averaging;
int d_averaging_depth; // Length of averaging window
arma::vec d_rx_pos;
boost::posix_time::ptime d_position_UTC_time;
int d_valid_observations;
public:
Pvt_Solution();
@ -151,6 +125,33 @@ public:
* Translated to C++ by Carles Fernandez from a Matlab implementation by Kai Borre
*/
int tropo(double *ddr_m, double sinel, double hsta_km, double p_mb, double t_kel, double hum, double hp_km, double htkel_km, double hhum_km);
private:
double d_rx_dt_s; // RX time offset [s]
double d_latitude_d; // RX position Latitude WGS84 [deg]
double d_longitude_d; // RX position Longitude WGS84 [deg]
double d_height_m; // RX position height WGS84 [m]
double d_speed_over_ground_m_s; // RX speed over ground [m/s]
double d_course_over_ground_d; // RX course over ground [deg]
double d_avg_latitude_d; // Averaged latitude in degrees
double d_avg_longitude_d; // Averaged longitude in degrees
double d_avg_height_m; // Averaged height [m]
bool b_valid_position;
std::deque<double> d_hist_latitude_d;
std::deque<double> d_hist_longitude_d;
std::deque<double> d_hist_height_m;
bool d_flag_averaging;
int d_averaging_depth; // Length of averaging window
arma::vec d_rx_pos;
boost::posix_time::ptime d_position_UTC_time;
int d_valid_observations;
};
#endif

View File

@ -88,18 +88,6 @@
*/
class Rtklib_Solver : public Pvt_Solution
{
private:
rtk_t rtk_;
std::string d_dump_filename;
std::ofstream d_dump_file;
bool save_matfile();
bool d_flag_dump_enabled;
bool d_flag_dump_mat_enabled;
int d_nchannels; // Number of available channels for positioning
std::array<double, 4> dop_;
Monitor_Pvt monitor_pvt;
public:
Rtklib_Solver(int nchannels, std::string dump_filename, bool flag_dump_to_file, bool flag_dump_to_mat, const rtk_t& rtk);
~Rtklib_Solver();
@ -139,6 +127,17 @@ public:
std::map<int, Beidou_Dnav_Almanac> beidou_dnav_almanac_map;
int count_valid_position;
private:
rtk_t rtk_;
std::string d_dump_filename;
std::ofstream d_dump_file;
bool save_matfile();
bool d_flag_dump_enabled;
bool d_flag_dump_mat_enabled;
int d_nchannels; // Number of available channels for positioning
std::array<double, 4> dop_;
Monitor_Pvt monitor_pvt;
};
#endif

View File

@ -52,8 +52,8 @@ class galileo_e5a_noncoherentIQ_acquisition_caf_cc;
using galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr = boost::shared_ptr<galileo_e5a_noncoherentIQ_acquisition_caf_cc>;
galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr
galileo_e5a_noncoherentIQ_make_acquisition_caf_cc(unsigned int sampled_ms,
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, int64_t fs_in,
int samples_per_ms, int samples_per_code,
@ -72,88 +72,6 @@ galileo_e5a_noncoherentIQ_make_acquisition_caf_cc(unsigned int sampled_ms,
*/
class galileo_e5a_noncoherentIQ_acquisition_caf_cc : public gr::block
{
private:
friend 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, int64_t fs_in,
int samples_per_ms, int samples_per_code,
bool bit_transition_flag,
bool dump,
std::string dump_filename,
bool both_signal_components_,
int CAF_window_hz_,
int Zero_padding_);
galileo_e5a_noncoherentIQ_acquisition_caf_cc(
unsigned int sampled_ms,
unsigned int max_dwells,
unsigned int doppler_max, int64_t fs_in,
int samples_per_ms, int samples_per_code,
bool bit_transition_flag,
bool dump,
std::string dump_filename,
bool both_signal_components_,
int CAF_window_hz_,
int Zero_padding_);
void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift,
int doppler_offset);
float estimate_input_power(gr_complex* in);
std::weak_ptr<ChannelFsm> d_channel_fsm;
int64_t d_fs_in;
int d_samples_per_ms;
int d_sampled_ms;
int d_samples_per_code;
unsigned int d_doppler_resolution;
float d_threshold;
std::string d_satellite_str;
unsigned int d_doppler_max;
unsigned int d_doppler_step;
unsigned int d_max_dwells;
unsigned int d_well_count;
unsigned int d_fft_size;
uint64_t d_sample_counter;
gr_complex** d_grid_doppler_wipeoffs;
unsigned int d_num_doppler_bins;
gr_complex* d_fft_code_I_A;
gr_complex* d_fft_code_I_B;
gr_complex* d_fft_code_Q_A;
gr_complex* d_fft_code_Q_B;
gr_complex* d_inbuffer;
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
std::shared_ptr<gr::fft::fft_complex> d_ifft;
Gnss_Synchro* d_gnss_synchro;
unsigned int d_code_phase;
float d_doppler_freq;
float d_mag;
float* d_magnitudeIA;
float* d_magnitudeIB;
float* d_magnitudeQA;
float* d_magnitudeQB;
float d_input_power;
float d_test_statistics;
bool d_bit_transition_flag;
std::ofstream d_dump_file;
bool d_active;
int d_state;
bool d_dump;
bool d_both_signal_components;
// bool d_CAF_filter;
int d_CAF_window_hz;
float* d_CAF_vector;
float* d_CAF_vector_I;
float* d_CAF_vector_Q;
// double* d_CAF_vector;
// double* d_CAF_vector_I;
// double* d_CAF_vector_Q;
unsigned int d_channel;
std::string d_dump_filename;
unsigned int d_buffer_count;
unsigned int d_gr_stream_buffer;
public:
/*!
* \brief Default destructor.
@ -257,5 +175,85 @@ public:
int general_work(int noutput_items, gr_vector_int& ninput_items,
gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items);
private:
friend 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, int64_t fs_in,
int samples_per_ms, int samples_per_code,
bool bit_transition_flag,
bool dump,
std::string dump_filename,
bool both_signal_components_,
int CAF_window_hz_,
int Zero_padding_);
galileo_e5a_noncoherentIQ_acquisition_caf_cc(
unsigned int sampled_ms,
unsigned int max_dwells,
unsigned int doppler_max, int64_t fs_in,
int samples_per_ms, int samples_per_code,
bool bit_transition_flag,
bool dump,
std::string dump_filename,
bool both_signal_components_,
int CAF_window_hz_,
int Zero_padding_);
void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift,
int doppler_offset);
float estimate_input_power(gr_complex* in);
std::weak_ptr<ChannelFsm> d_channel_fsm;
int64_t d_fs_in;
int d_samples_per_ms;
int d_sampled_ms;
int d_samples_per_code;
unsigned int d_doppler_resolution;
float d_threshold;
std::string d_satellite_str;
unsigned int d_doppler_max;
unsigned int d_doppler_step;
unsigned int d_max_dwells;
unsigned int d_well_count;
unsigned int d_fft_size;
uint64_t d_sample_counter;
gr_complex** d_grid_doppler_wipeoffs;
unsigned int d_num_doppler_bins;
gr_complex* d_fft_code_I_A;
gr_complex* d_fft_code_I_B;
gr_complex* d_fft_code_Q_A;
gr_complex* d_fft_code_Q_B;
gr_complex* d_inbuffer;
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
std::shared_ptr<gr::fft::fft_complex> d_ifft;
Gnss_Synchro* d_gnss_synchro;
unsigned int d_code_phase;
float d_doppler_freq;
float d_mag;
float* d_magnitudeIA;
float* d_magnitudeIB;
float* d_magnitudeQA;
float* d_magnitudeQB;
float d_input_power;
float d_test_statistics;
bool d_bit_transition_flag;
std::ofstream d_dump_file;
bool d_active;
int d_state;
bool d_dump;
bool d_both_signal_components;
int d_CAF_window_hz;
float* d_CAF_vector;
float* d_CAF_vector_I;
float* d_CAF_vector_Q;
unsigned int d_channel;
std::string d_dump_filename;
unsigned int d_buffer_count;
unsigned int d_gr_stream_buffer;
};
#endif /* GALILEO_E5A_NONCOHERENT_IQ_ACQUISITION_CAF_CC_H_ */

View File

@ -62,67 +62,6 @@ galileo_pcps_8ms_make_acquisition_cc(uint32_t sampled_ms,
*/
class galileo_pcps_8ms_acquisition_cc : public gr::block
{
private:
friend galileo_pcps_8ms_acquisition_cc_sptr
galileo_pcps_8ms_make_acquisition_cc(
uint32_t sampled_ms,
uint32_t max_dwells,
uint32_t doppler_max,
int64_t fs_in,
int32_t samples_per_ms,
int32_t samples_per_code,
bool dump,
std::string dump_filename);
galileo_pcps_8ms_acquisition_cc(
uint32_t sampled_ms,
uint32_t max_dwells,
uint32_t doppler_max,
int64_t fs_in,
int32_t samples_per_ms,
int32_t samples_per_code,
bool dump,
std::string dump_filename);
void calculate_magnitudes(
gr_complex* fft_begin,
int32_t doppler_shift,
int32_t doppler_offset);
int64_t d_fs_in;
int32_t d_samples_per_ms;
int32_t d_samples_per_code;
uint32_t d_doppler_resolution;
float d_threshold;
std::string d_satellite_str;
uint32_t d_doppler_max;
uint32_t d_doppler_step;
uint32_t d_sampled_ms;
uint32_t d_max_dwells;
uint32_t d_well_count;
uint32_t d_fft_size;
uint64_t d_sample_counter;
gr_complex** d_grid_doppler_wipeoffs;
uint32_t d_num_doppler_bins;
gr_complex* d_fft_code_A;
gr_complex* d_fft_code_B;
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
std::shared_ptr<gr::fft::fft_complex> d_ifft;
Gnss_Synchro* d_gnss_synchro;
uint32_t d_code_phase;
float d_doppler_freq;
float d_mag;
float* d_magnitude;
float d_input_power;
float d_test_statistics;
std::ofstream d_dump_file;
bool d_active;
int32_t d_state;
bool d_dump;
uint32_t d_channel;
std::weak_ptr<ChannelFsm> d_channel_fsm;
std::string d_dump_filename;
public:
/*!
* \brief Default destructor.
@ -226,6 +165,67 @@ public:
int general_work(int noutput_items, gr_vector_int& ninput_items,
gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items);
private:
friend galileo_pcps_8ms_acquisition_cc_sptr
galileo_pcps_8ms_make_acquisition_cc(
uint32_t sampled_ms,
uint32_t max_dwells,
uint32_t doppler_max,
int64_t fs_in,
int32_t samples_per_ms,
int32_t samples_per_code,
bool dump,
std::string dump_filename);
galileo_pcps_8ms_acquisition_cc(
uint32_t sampled_ms,
uint32_t max_dwells,
uint32_t doppler_max,
int64_t fs_in,
int32_t samples_per_ms,
int32_t samples_per_code,
bool dump,
std::string dump_filename);
void calculate_magnitudes(
gr_complex* fft_begin,
int32_t doppler_shift,
int32_t doppler_offset);
int64_t d_fs_in;
int32_t d_samples_per_ms;
int32_t d_samples_per_code;
uint32_t d_doppler_resolution;
float d_threshold;
std::string d_satellite_str;
uint32_t d_doppler_max;
uint32_t d_doppler_step;
uint32_t d_sampled_ms;
uint32_t d_max_dwells;
uint32_t d_well_count;
uint32_t d_fft_size;
uint64_t d_sample_counter;
gr_complex** d_grid_doppler_wipeoffs;
uint32_t d_num_doppler_bins;
gr_complex* d_fft_code_A;
gr_complex* d_fft_code_B;
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
std::shared_ptr<gr::fft::fft_complex> d_ifft;
Gnss_Synchro* d_gnss_synchro;
uint32_t d_code_phase;
float d_doppler_freq;
float d_mag;
float* d_magnitude;
float d_input_power;
float d_test_statistics;
std::ofstream d_dump_file;
bool d_active;
int32_t d_state;
bool d_dump;
uint32_t d_channel;
std::weak_ptr<ChannelFsm> d_channel_fsm;
std::string d_dump_filename;
};
#endif /* GNSS_SDR_PCPS_8MS_ACQUISITION_CC_H_*/

View File

@ -134,10 +134,9 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
acq_parameters.max_dwells = 1; // Activation of acq_parameters.bit_transition_flag invalidates the value of acq_parameters.max_dwells
}
d_tmp_buffer = static_cast<float*>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
d_fft_codes = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
d_magnitude = static_cast<float*>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
d_input_signal = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
d_tmp_buffer = std::vector<float>(d_fft_size);
d_fft_codes = std::vector<std::complex<float>>(d_fft_size);
d_input_signal = std::vector<std::complex<float>>(d_fft_size);
// Direct FFT
d_fft_if = std::make_shared<gr::fft::fft_complex>(d_fft_size, true);
@ -146,18 +145,11 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
d_ifft = std::make_shared<gr::fft::fft_complex>(d_fft_size, false);
d_gnss_synchro = nullptr;
d_grid_doppler_wipeoffs = nullptr;
d_grid_doppler_wipeoffs_step_two = nullptr;
d_magnitude_grid = nullptr;
d_worker_active = false;
d_data_buffer = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_consumed_samples * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
d_data_buffer = std::vector<std::complex<float>>(d_consumed_samples);
if (d_cshort)
{
d_data_buffer_sc = static_cast<lv_16sc_t*>(volk_gnsssdr_malloc(d_consumed_samples * sizeof(lv_16sc_t), volk_gnsssdr_get_alignment()));
}
else
{
d_data_buffer_sc = nullptr;
d_data_buffer_sc = std::vector<lv_16sc_t>(d_consumed_samples);
}
grid_ = arma::fmat();
narrow_grid_ = arma::fmat();
@ -213,36 +205,7 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
}
pcps_acquisition::~pcps_acquisition()
{
if (d_num_doppler_bins > 0)
{
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]);
}
delete[] d_grid_doppler_wipeoffs;
delete[] d_magnitude_grid;
}
if (acq_parameters.make_2_steps)
{
for (uint32_t i = 0; i < d_num_doppler_bins_step2; i++)
{
volk_gnsssdr_free(d_grid_doppler_wipeoffs_step_two[i]);
}
delete[] d_grid_doppler_wipeoffs_step_two;
}
volk_gnsssdr_free(d_fft_codes);
volk_gnsssdr_free(d_magnitude);
volk_gnsssdr_free(d_tmp_buffer);
volk_gnsssdr_free(d_input_signal);
volk_gnsssdr_free(d_data_buffer);
if (d_cshort)
{
volk_gnsssdr_free(d_data_buffer_sc);
}
}
pcps_acquisition::~pcps_acquisition() = default;
void pcps_acquisition::set_resampler_latency(uint32_t latency_samples)
@ -286,7 +249,7 @@ void pcps_acquisition::set_local_code(std::complex<float>* code)
}
d_fft_if->execute(); // We need the FFT of local code
volk_32fc_conjugate_32fc(d_fft_codes, d_fft_if->get_outbuf(), d_fft_size);
volk_32fc_conjugate_32fc(d_fft_codes.data(), d_fft_if->get_outbuf(), d_fft_size);
}
@ -309,7 +272,7 @@ bool pcps_acquisition::is_fdma()
}
void pcps_acquisition::update_local_carrier(gr_complex* carrier_vector, int32_t correlator_length_samples, float freq)
void pcps_acquisition::update_local_carrier(gsl::span<gr_complex> carrier_vector, float freq)
{
float phase_step_rad;
if (acq_parameters.use_automatic_resampler)
@ -322,7 +285,7 @@ void pcps_acquisition::update_local_carrier(gr_complex* carrier_vector, int32_t
}
float _phase[1];
_phase[0] = 0.0;
volk_gnsssdr_s32f_sincos_32fc(carrier_vector, -phase_step_rad, _phase, correlator_length_samples);
volk_gnsssdr_s32f_sincos_32fc(carrier_vector.data(), -phase_step_rad, _phase, carrier_vector.length());
}
@ -342,27 +305,18 @@ void pcps_acquisition::init()
d_num_doppler_bins = static_cast<uint32_t>(std::ceil(static_cast<double>(static_cast<int32_t>(acq_parameters.doppler_max) - static_cast<int32_t>(-acq_parameters.doppler_max)) / static_cast<double>(d_doppler_step)));
// Create the carrier Doppler wipeoff signals
if (d_grid_doppler_wipeoffs == nullptr)
if (d_grid_doppler_wipeoffs.empty())
{
d_grid_doppler_wipeoffs = new gr_complex*[d_num_doppler_bins];
d_grid_doppler_wipeoffs = std::vector<std::vector<std::complex<float>>>(d_num_doppler_bins, std::vector<std::complex<float>>(d_fft_size));
}
if (acq_parameters.make_2_steps && (d_grid_doppler_wipeoffs_step_two == nullptr))
if (acq_parameters.make_2_steps && (d_grid_doppler_wipeoffs_step_two.empty()))
{
d_grid_doppler_wipeoffs_step_two = new gr_complex*[d_num_doppler_bins_step2];
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<gr_complex*>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
}
d_grid_doppler_wipeoffs_step_two = std::vector<std::vector<std::complex<float>>>(d_num_doppler_bins_step2, std::vector<std::complex<float>>(d_fft_size));
}
if (d_magnitude_grid == nullptr)
if (d_magnitude_grid.empty())
{
d_magnitude_grid = new float*[d_num_doppler_bins];
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
{
d_grid_doppler_wipeoffs[doppler_index] = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
d_magnitude_grid[doppler_index] = static_cast<float*>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
}
d_magnitude_grid = std::vector<std::vector<float>>(d_num_doppler_bins, std::vector<float>(d_fft_size));
}
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
@ -372,7 +326,7 @@ void pcps_acquisition::init()
d_magnitude_grid[doppler_index][k] = 0.0;
}
int32_t doppler = -static_cast<int32_t>(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);
update_local_carrier(gsl::span<gr_complex>(d_grid_doppler_wipeoffs[doppler_index].data(), d_fft_size), d_old_freq + doppler);
}
d_worker_active = false;
@ -391,7 +345,7 @@ void pcps_acquisition::update_grid_doppler_wipeoffs()
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
{
int32_t doppler = -static_cast<int32_t>(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);
update_local_carrier(gsl::span<gr_complex>(d_grid_doppler_wipeoffs[doppler_index].data(), d_fft_size), d_old_freq + doppler);
}
}
@ -401,7 +355,7 @@ void pcps_acquisition::update_grid_doppler_wipeoffs_step2()
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins_step2; doppler_index++)
{
float doppler = (static_cast<float>(doppler_index) - static_cast<float>(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);
update_local_carrier(gsl::span<gr_complex>(d_grid_doppler_wipeoffs_step_two[doppler_index].data(), d_fft_size), d_doppler_center_step_two + doppler);
}
}
@ -590,7 +544,7 @@ float pcps_acquisition::max_to_input_power_statistic(uint32_t& indext, int32_t&
// Find the correlation peak and the carrier frequency
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);
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_magnitude_grid[i].data(), d_fft_size);
if (d_magnitude_grid[i][tmp_intex_t] > grid_maximum)
{
grid_maximum = d_magnitude_grid[i][tmp_intex_t];
@ -627,7 +581,7 @@ float pcps_acquisition::first_vs_second_peak_statistic(uint32_t& indext, int32_t
// Find the correlation peak and the carrier frequency
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);
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_magnitude_grid[i].data(), d_fft_size);
if (d_magnitude_grid[i][tmp_intex_t] > firstPeak)
{
firstPeak = d_magnitude_grid[i][tmp_intex_t];
@ -661,7 +615,7 @@ float pcps_acquisition::first_vs_second_peak_statistic(uint32_t& indext, int32_t
}
int32_t idx = excludeRangeIndex1;
memcpy(d_tmp_buffer, d_magnitude_grid[index_doppler], d_fft_size);
memcpy(d_tmp_buffer.data(), d_magnitude_grid[index_doppler].data(), d_fft_size);
do
{
d_tmp_buffer[idx] = 0.0;
@ -674,7 +628,7 @@ float pcps_acquisition::first_vs_second_peak_statistic(uint32_t& indext, int32_t
while (idx != excludeRangeIndex2);
// Find the second highest correlation peak in the same freq. bin ---
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_tmp_buffer, d_fft_size);
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_tmp_buffer.data(), d_fft_size);
float secondPeak = d_tmp_buffer[tmp_intex_t];
// Compute the test statistics and compare to the threshold
@ -692,9 +646,9 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
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);
volk_gnsssdr_16ic_convert_32fc(d_data_buffer.data(), d_data_buffer_sc.data(), d_consumed_samples);
}
memcpy(d_input_signal, d_data_buffer, d_consumed_samples * sizeof(gr_complex));
memcpy(d_input_signal.data(), d_data_buffer.data(), d_consumed_samples * sizeof(gr_complex));
if (d_fft_size > d_consumed_samples)
{
for (uint32_t i = d_consumed_samples; i < d_fft_size; i++)
@ -702,7 +656,7 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
d_input_signal[i] = gr_complex(0.0, 0.0);
}
}
const gr_complex* in = d_input_signal; // Get the input samples pointer
const gr_complex* in = d_input_signal.data(); // Get the input samples pointer
d_input_power = 0.0;
d_mag = 0.0;
@ -720,8 +674,8 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
if (d_use_CFAR_algorithm_flag or acq_parameters.bit_transition_flag)
{
// Compute the input signal power estimation
volk_32fc_magnitude_squared_32f(d_tmp_buffer, in, d_fft_size);
volk_32f_accumulator_s32f(&d_input_power, d_tmp_buffer, d_fft_size);
volk_32fc_magnitude_squared_32f(d_tmp_buffer.data(), in, d_fft_size);
volk_32f_accumulator_s32f(&d_input_power, d_tmp_buffer.data(), d_fft_size);
d_input_power /= static_cast<float>(d_fft_size);
}
@ -731,14 +685,14 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
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);
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in, d_grid_doppler_wipeoffs[doppler_index].data(), d_fft_size);
// Perform the FFT-based convolution (parallel time search)
// Compute the FFT of the carrier wiped--off incoming signal
d_fft_if->execute();
// Multiply carrier wiped--off, Fourier transformed incoming signal with the local FFT'd code reference
volk_32fc_x2_multiply_32fc(d_ifft->get_inbuf(), d_fft_if->get_outbuf(), d_fft_codes, d_fft_size);
volk_32fc_x2_multiply_32fc(d_ifft->get_inbuf(), d_fft_if->get_outbuf(), d_fft_codes.data(), d_fft_size);
// Compute the inverse FFT
d_ifft->execute();
@ -747,17 +701,17 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
size_t offset = (acq_parameters.bit_transition_flag ? effective_fft_size : 0);
if (d_num_noncoherent_integrations_counter == 1)
{
volk_32fc_magnitude_squared_32f(d_magnitude_grid[doppler_index], d_ifft->get_outbuf() + offset, effective_fft_size);
volk_32fc_magnitude_squared_32f(d_magnitude_grid[doppler_index].data(), d_ifft->get_outbuf() + offset, effective_fft_size);
}
else
{
volk_32fc_magnitude_squared_32f(d_tmp_buffer, d_ifft->get_outbuf() + offset, effective_fft_size);
volk_32f_x2_add_32f(d_magnitude_grid[doppler_index], d_magnitude_grid[doppler_index], d_tmp_buffer, effective_fft_size);
volk_32fc_magnitude_squared_32f(d_tmp_buffer.data(), d_ifft->get_outbuf() + offset, effective_fft_size);
volk_32f_x2_add_32f(d_magnitude_grid[doppler_index].data(), d_magnitude_grid[doppler_index].data(), d_tmp_buffer.data(), effective_fft_size);
}
// Record results to file if required
if (d_dump and d_channel == d_dump_channel)
{
memcpy(grid_.colptr(doppler_index), d_magnitude_grid[doppler_index], sizeof(float) * effective_fft_size);
memcpy(grid_.colptr(doppler_index), d_magnitude_grid[doppler_index].data(), sizeof(float) * effective_fft_size);
}
}
@ -789,7 +743,7 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
{
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);
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in, d_grid_doppler_wipeoffs_step_two[doppler_index].data(), d_fft_size);
// Perform the FFT-based convolution (parallel time search)
// Compute the FFT of the carrier wiped--off incoming signal
@ -797,7 +751,7 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
// Multiply carrier wiped--off, Fourier transformed incoming signal
// with the local FFT'd code reference using SIMD operations with VOLK library
volk_32fc_x2_multiply_32fc(d_ifft->get_inbuf(), d_fft_if->get_outbuf(), d_fft_codes, d_fft_size);
volk_32fc_x2_multiply_32fc(d_ifft->get_inbuf(), d_fft_if->get_outbuf(), d_fft_codes.data(), d_fft_size);
// compute the inverse FFT
d_ifft->execute();
@ -805,17 +759,17 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
size_t offset = (acq_parameters.bit_transition_flag ? effective_fft_size : 0);
if (d_num_noncoherent_integrations_counter == 1)
{
volk_32fc_magnitude_squared_32f(d_magnitude_grid[doppler_index], d_ifft->get_outbuf() + offset, effective_fft_size);
volk_32fc_magnitude_squared_32f(d_magnitude_grid[doppler_index].data(), d_ifft->get_outbuf() + offset, effective_fft_size);
}
else
{
volk_32fc_magnitude_squared_32f(d_tmp_buffer, d_ifft->get_outbuf() + offset, effective_fft_size);
volk_32f_x2_add_32f(d_magnitude_grid[doppler_index], d_magnitude_grid[doppler_index], d_tmp_buffer, effective_fft_size);
volk_32fc_magnitude_squared_32f(d_tmp_buffer.data(), d_ifft->get_outbuf() + offset, effective_fft_size);
volk_32f_x2_add_32f(d_magnitude_grid[doppler_index].data(), d_magnitude_grid[doppler_index].data(), d_tmp_buffer.data(), effective_fft_size);
}
// Record results to file if required
if (d_dump and d_channel == d_dump_channel)
{
memcpy(narrow_grid_.colptr(doppler_index), d_magnitude_grid[doppler_index], sizeof(float) * effective_fft_size);
memcpy(narrow_grid_.colptr(doppler_index), d_magnitude_grid[doppler_index].data(), sizeof(float) * effective_fft_size);
}
}
// Compute the test statistic

View File

@ -61,18 +61,25 @@
#include <gnuradio/thread/thread.h> // for scoped_lock
#include <gnuradio/types.h> // for gr_vector_const_void_star
#include <volk/volk_complex.h> // for lv_16sc_t
#include <complex>
#include <cstdint>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#if HAS_SPAN
#include <span>
namespace gsl = std;
#else
#include <gsl/gsl>
#endif
class Gnss_Synchro;
class pcps_acquisition;
using pcps_acquisition_sptr = boost::shared_ptr<pcps_acquisition>;
pcps_acquisition_sptr
pcps_make_acquisition(const Acq_Conf& conf_);
pcps_acquisition_sptr pcps_make_acquisition(const Acq_Conf& conf_);
/*!
* \brief This class implements a Parallel Code Phase Search Acquisition.
@ -82,75 +89,6 @@ pcps_make_acquisition(const Acq_Conf& conf_);
*/
class pcps_acquisition : public gr::block
{
private:
friend pcps_acquisition_sptr
pcps_make_acquisition(const Acq_Conf& conf_);
pcps_acquisition(const Acq_Conf& conf_);
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(uint64_t samp_count);
void send_negative_acquisition();
void send_positive_acquisition();
void dump_results(int32_t effective_fft_size);
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);
bool start();
Acq_Conf acq_parameters;
bool d_active;
bool d_worker_active;
bool d_cshort;
bool d_step_two;
bool d_use_CFAR_algorithm_flag;
int32_t d_positive_acq;
float d_threshold;
float d_mag;
float d_input_power;
float d_test_statistics;
float* d_magnitude;
float** d_magnitude_grid;
float* d_tmp_buffer;
gr_complex* d_input_signal;
uint32_t d_samplesPerChip;
int64_t d_old_freq;
int32_t d_state;
uint32_t d_channel;
std::weak_ptr<ChannelFsm> d_channel_fsm;
uint32_t d_doppler_step;
float d_doppler_center_step_two;
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;
gr_complex* d_data_buffer;
lv_16sc_t* d_data_buffer_sc;
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
std::shared_ptr<gr::fft::fft_complex> d_ifft;
Gnss_Synchro* d_gnss_synchro;
arma::fmat grid_;
arma::fmat narrow_grid_;
uint32_t d_num_doppler_bins_step2;
int64_t d_dump_number;
uint32_t d_dump_channel;
uint32_t d_buffer_count;
bool d_dump;
std::string d_dump_filename;
public:
~pcps_acquisition();
@ -250,7 +188,6 @@ public:
d_doppler_step = doppler_step;
}
void set_resampler_latency(uint32_t latency_samples);
/*!
@ -259,6 +196,63 @@ public:
int general_work(int noutput_items, gr_vector_int& ninput_items,
gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items);
private:
friend pcps_acquisition_sptr pcps_make_acquisition(const Acq_Conf& conf_);
pcps_acquisition(const Acq_Conf& conf_);
bool d_active;
bool d_worker_active;
bool d_cshort;
bool d_step_two;
bool d_use_CFAR_algorithm_flag;
bool d_dump;
int32_t d_state;
int32_t d_positive_acq;
uint32_t d_channel;
uint32_t d_samplesPerChip;
uint32_t d_doppler_step;
uint32_t d_num_noncoherent_integrations_counter;
uint32_t d_fft_size;
uint32_t d_consumed_samples;
uint32_t d_num_doppler_bins;
uint32_t d_num_doppler_bins_step2;
uint32_t d_dump_channel;
uint32_t d_buffer_count;
uint64_t d_sample_counter;
int64_t d_dump_number;
int64_t d_old_freq;
float d_threshold;
float d_mag;
float d_input_power;
float d_test_statistics;
float d_doppler_center_step_two;
std::string d_dump_filename;
std::vector<std::vector<float>> d_magnitude_grid;
std::vector<float> d_tmp_buffer;
std::vector<std::complex<float>> d_input_signal;
std::vector<std::vector<std::complex<float>>> d_grid_doppler_wipeoffs;
std::vector<std::vector<std::complex<float>>> d_grid_doppler_wipeoffs_step_two;
std::vector<std::complex<float>> d_fft_codes;
std::vector<std::complex<float>> d_data_buffer;
std::vector<lv_16sc_t> d_data_buffer_sc;
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
std::shared_ptr<gr::fft::fft_complex> d_ifft;
std::weak_ptr<ChannelFsm> d_channel_fsm;
Acq_Conf acq_parameters;
Gnss_Synchro* d_gnss_synchro;
arma::fmat grid_;
arma::fmat narrow_grid_;
void update_local_carrier(gsl::span<gr_complex> carrier_vector, float freq);
void update_grid_doppler_wipeoffs();
void update_grid_doppler_wipeoffs_step2();
void acquisition_core(uint64_t samp_count);
void send_negative_acquisition();
void send_positive_acquisition();
void dump_results(int32_t effective_fft_size);
bool is_fdma();
bool start();
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);
};
#endif /* GNSS_SDR_PCPS_ACQUISITION_H_*/

View File

@ -138,8 +138,6 @@ pcps_acquisition_fine_doppler_cc::pcps_acquisition_fine_doppler_cc(const Acq_Con
d_threshold = 0;
d_num_doppler_points = 0;
d_doppler_step = 0;
d_grid_data = nullptr;
d_grid_doppler_wipeoffs = nullptr;
d_gnss_synchro = nullptr;
d_code_phase = 0;
d_doppler_freq = 0;
@ -176,11 +174,7 @@ void pcps_acquisition_fine_doppler_cc::set_doppler_step(unsigned int doppler_ste
d_num_doppler_points = floor(std::abs(2 * d_config_doppler_max) / d_doppler_step);
d_grid_data = new float *[d_num_doppler_points];
for (int i = 0; i < d_num_doppler_points; i++)
{
d_grid_data[i] = static_cast<float *>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
}
d_grid_data = std::vector<std::vector<float>>(d_num_doppler_points, std::vector<float>(d_fft_size));
if (d_dump)
{
@ -191,25 +185,12 @@ void pcps_acquisition_fine_doppler_cc::set_doppler_step(unsigned int doppler_ste
}
void pcps_acquisition_fine_doppler_cc::free_grid_memory()
{
for (int i = 0; i < d_num_doppler_points; i++)
{
volk_gnsssdr_free(d_grid_data[i]);
delete[] d_grid_doppler_wipeoffs[i];
}
delete d_grid_data;
delete d_grid_doppler_wipeoffs;
}
pcps_acquisition_fine_doppler_cc::~pcps_acquisition_fine_doppler_cc()
{
volk_gnsssdr_free(d_carrier);
volk_gnsssdr_free(d_fft_codes);
volk_gnsssdr_free(d_magnitude);
volk_gnsssdr_free(d_10_ms_buffer);
free_grid_memory();
}
@ -265,17 +246,16 @@ void pcps_acquisition_fine_doppler_cc::update_carrier_wipeoff()
// create the carrier Doppler wipeoff signals
int doppler_hz;
float phase_step_rad;
d_grid_doppler_wipeoffs = new gr_complex *[d_num_doppler_points];
d_grid_doppler_wipeoffs = std::vector<std::vector<std::complex<float>>>(d_num_doppler_points, std::vector<std::complex<float>>(d_fft_size));
for (int doppler_index = 0; doppler_index < d_num_doppler_points; doppler_index++)
{
doppler_hz = d_doppler_step * doppler_index - d_config_doppler_max;
// doppler search steps
// compute the carrier doppler wipe-off signal and store it
phase_step_rad = static_cast<float>(GPS_TWO_PI) * doppler_hz / static_cast<float>(d_fs_in);
d_grid_doppler_wipeoffs[doppler_index] = new gr_complex[d_fft_size];
float _phase[1];
_phase[0] = 0;
volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index], -phase_step_rad, _phase, d_fft_size);
volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index].data(), -phase_step_rad, _phase, d_fft_size);
}
}
@ -293,7 +273,7 @@ double pcps_acquisition_fine_doppler_cc::compute_CAF()
//--- Find the correlation peak and the carrier frequency --------------
for (int i = 0; i < d_num_doppler_points; i++)
{
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_grid_data[i], d_fft_size);
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_grid_data[i].data(), d_fft_size);
if (d_grid_data[i][tmp_intex_t] > firstPeak)
{
firstPeak = d_grid_data[i][tmp_intex_t];
@ -304,7 +284,7 @@ double pcps_acquisition_fine_doppler_cc::compute_CAF()
// Record results to file if required
if (d_dump and d_channel == d_dump_channel)
{
memcpy(grid_.colptr(i), d_grid_data[i], sizeof(float) * d_fft_size);
memcpy(grid_.colptr(i), d_grid_data[i].data(), sizeof(float) * d_fft_size);
}
}
@ -336,7 +316,7 @@ double pcps_acquisition_fine_doppler_cc::compute_CAF()
while (idx != excludeRangeIndex2);
//--- Find the second highest correlation peak in the same freq. bin ---
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_grid_data[index_doppler], d_fft_size);
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_grid_data[index_doppler].data(), d_fft_size);
float secondPeak = d_grid_data[index_doppler][tmp_intex_t];
// 5- Compute the test statistics and compare to the threshold
@ -382,7 +362,7 @@ int pcps_acquisition_fine_doppler_cc::compute_and_accumulate_grid(gr_vector_cons
{
// doppler search steps
// Perform the carrier wipe-off
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in, d_grid_doppler_wipeoffs[doppler_index], d_fft_size);
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in, d_grid_doppler_wipeoffs[doppler_index].data(), d_fft_size);
// 3- Perform the FFT-based convolution (parallel time search)
// Compute the FFT of the carrier wiped--off incoming signal
@ -398,7 +378,7 @@ int pcps_acquisition_fine_doppler_cc::compute_and_accumulate_grid(gr_vector_cons
// save the grid matrix delay file
volk_32fc_magnitude_squared_32f(p_tmp_vector, d_ifft->get_outbuf(), d_fft_size);
//accumulate grid values
volk_32f_x2_add_32f(d_grid_data[doppler_index], d_grid_data[doppler_index], p_tmp_vector, d_fft_size);
volk_32f_x2_add_32f(d_grid_data[doppler_index].data(), d_grid_data[doppler_index].data(), p_tmp_vector, d_fft_size);
}
volk_gnsssdr_free(p_tmp_vector);
@ -422,7 +402,7 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler()
int signal_samples = prn_replicas * d_fft_size;
//int fft_size_extended = nextPowerOf2(signal_samples * zero_padding_factor);
int fft_size_extended = signal_samples * zero_padding_factor;
auto *fft_operator = new gr::fft::fft_complex(fft_size_extended, true);
auto fft_operator = std::make_shared<gr::fft::fft_complex>(fft_size_extended, true);
//zero padding the entire vector
std::fill_n(fft_operator->get_inbuf(), fft_size_extended, gr_complex(0.0, 0.0));
@ -459,9 +439,7 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler()
//case even
int counter = 0;
auto *fftFreqBins = new float[fft_size_extended];
std::fill_n(fftFreqBins, fft_size_extended, 0.0);
auto fftFreqBins = std::vector<float>(fft_size_extended);
for (int k = 0; k < (fft_size_extended / 2); k++)
{
@ -488,10 +466,8 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler()
}
// free memory!!
delete fft_operator;
volk_gnsssdr_free(code_replica);
volk_gnsssdr_free(p_tmp_vector);
delete[] fftFreqBins;
return d_fft_size;
}

View File

@ -61,13 +61,13 @@
#include <memory>
#include <string>
#include <utility>
#include <vector>
class pcps_acquisition_fine_doppler_cc;
using pcps_acquisition_fine_doppler_cc_sptr = boost::shared_ptr<pcps_acquisition_fine_doppler_cc>;
pcps_acquisition_fine_doppler_cc_sptr
pcps_make_acquisition_fine_doppler_cc(const Acq_Conf& conf_);
pcps_acquisition_fine_doppler_cc_sptr pcps_make_acquisition_fine_doppler_cc(const Acq_Conf& conf_);
/*!
* \brief This class implements a Parallel Code Phase Search Acquisition.
@ -75,63 +75,6 @@ pcps_make_acquisition_fine_doppler_cc(const Acq_Conf& conf_);
*/
class pcps_acquisition_fine_doppler_cc : public gr::block
{
private:
friend pcps_acquisition_fine_doppler_cc_sptr
pcps_make_acquisition_fine_doppler_cc(const Acq_Conf& conf_);
pcps_acquisition_fine_doppler_cc(const Acq_Conf& conf_);
int compute_and_accumulate_grid(gr_vector_const_void_star& input_items);
int estimate_Doppler();
float estimate_input_power(gr_vector_const_void_star& input_items);
double compute_CAF();
void reset_grid();
void update_carrier_wipeoff();
void free_grid_memory();
bool start();
Acq_Conf acq_parameters;
int64_t d_fs_in;
int d_samples_per_ms;
int d_max_dwells;
int d_gnuradio_forecast_samples;
float d_threshold;
std::string d_satellite_str;
int d_config_doppler_max;
int d_num_doppler_points;
int d_doppler_step;
unsigned int d_fft_size;
uint64_t d_sample_counter;
gr_complex* d_carrier;
gr_complex* d_fft_codes;
gr_complex* d_10_ms_buffer;
float* d_magnitude;
float** d_grid_data;
gr_complex** d_grid_doppler_wipeoffs;
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
std::shared_ptr<gr::fft::fft_complex> d_ifft;
Gnss_Synchro* d_gnss_synchro;
unsigned int d_code_phase;
float d_doppler_freq;
float d_test_statistics;
int d_positive_acq;
int d_state;
bool d_active;
int d_well_count;
int d_n_samples_in_buffer;
bool d_dump;
unsigned int d_channel;
std::weak_ptr<ChannelFsm> d_channel_fsm;
std::string d_dump_filename;
arma::fmat grid_;
int64_t d_dump_number;
unsigned int d_dump_channel;
public:
/*!
* \brief Default destructor.
@ -227,15 +170,6 @@ public:
*/
void set_state(int state);
/*!
* \brief Parallel Code Phase Search Acquisition signal processing.
*/
int general_work(int noutput_items, gr_vector_int& ninput_items,
gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items);
void forecast(int noutput_items, gr_vector_int& ninput_items_required);
/*!
* \brief Obtains the next power of 2 greater or equal to the input parameter
* \param n - Integer value to obtain the next power of 2.
@ -243,6 +177,64 @@ public:
unsigned int nextPowerOf2(unsigned int n);
void dump_results(int effective_fft_size);
void forecast(int noutput_items, gr_vector_int& ninput_items_required);
/*!
* \brief Parallel Code Phase Search Acquisition signal processing.
*/
int general_work(int noutput_items, gr_vector_int& ninput_items,
gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items);
private:
friend pcps_acquisition_fine_doppler_cc_sptr
pcps_make_acquisition_fine_doppler_cc(const Acq_Conf& conf_);
pcps_acquisition_fine_doppler_cc(const Acq_Conf& conf_);
int compute_and_accumulate_grid(gr_vector_const_void_star& input_items);
int estimate_Doppler();
float estimate_input_power(gr_vector_const_void_star& input_items);
double compute_CAF();
void reset_grid();
void update_carrier_wipeoff();
bool start();
Acq_Conf acq_parameters;
int64_t d_fs_in;
int d_samples_per_ms;
int d_max_dwells;
int d_gnuradio_forecast_samples;
float d_threshold;
std::string d_satellite_str;
int d_config_doppler_max;
int d_num_doppler_points;
int d_doppler_step;
unsigned int d_fft_size;
uint64_t d_sample_counter;
gr_complex* d_carrier;
gr_complex* d_fft_codes;
gr_complex* d_10_ms_buffer;
float* d_magnitude;
std::vector<std::vector<float>> d_grid_data;
std::vector<std::vector<std::complex<float>>> d_grid_doppler_wipeoffs;
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
std::shared_ptr<gr::fft::fft_complex> d_ifft;
Gnss_Synchro* d_gnss_synchro;
unsigned int d_code_phase;
float d_doppler_freq;
float d_test_statistics;
int d_positive_acq;
int d_state;
bool d_active;
int d_well_count;
int d_n_samples_in_buffer;
bool d_dump;
unsigned int d_channel;
std::weak_ptr<ChannelFsm> d_channel_fsm;
std::string d_dump_filename;
arma::fmat grid_;
int64_t d_dump_number;
unsigned int d_dump_channel;
};
#endif /* pcps_acquisition_fine_doppler_cc*/

View File

@ -34,7 +34,6 @@
#include "pcps_acquisition_fpga.h"
#include "gnss_synchro.h"
//#include <boost/chrono.hpp>
#include <glog/logging.h>
#include <cmath> // for ceil
#include <iostream> // for operator<<
@ -87,6 +86,7 @@ pcps_acquisition_fpga::pcps_acquisition_fpga(pcpsconf_fpga_t conf_)
pcps_acquisition_fpga::~pcps_acquisition_fpga() = default;
void pcps_acquisition_fpga::set_local_code()
{
acquisition_fpga->set_local_code(d_gnss_synchro->PRN);
@ -174,6 +174,7 @@ void pcps_acquisition_fpga::send_negative_acquisition()
}
}
void pcps_acquisition_fpga::acquisition_core(uint32_t num_doppler_bins, uint32_t doppler_step, int32_t doppler_min)
{
uint32_t indext = 0U;

View File

@ -78,8 +78,7 @@ class pcps_acquisition_fpga;
using pcps_acquisition_fpga_sptr = boost::shared_ptr<pcps_acquisition_fpga>;
pcps_acquisition_fpga_sptr
pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_);
pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_);
/*!
* \brief This class implements a Parallel Code Phase Search Acquisition that uses the FPGA.
@ -89,49 +88,6 @@ pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_);
*/
class pcps_acquisition_fpga
{
private:
friend pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_);
pcps_acquisition_fpga(pcpsconf_fpga_t conf_);
void send_negative_acquisition();
void send_positive_acquisition();
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);
void acquisition_core(uint32_t num_doppler_bins, uint32_t doppler_step, int32_t doppler_max);
pcpsconf_fpga_t acq_parameters;
bool d_active;
float d_threshold;
float d_mag;
float d_input_power;
uint32_t d_doppler_index;
float d_test_statistics;
int32_t d_state;
uint32_t d_channel;
std::weak_ptr<ChannelFsm> d_channel_fsm;
uint32_t d_doppler_step;
uint32_t d_doppler_max;
uint32_t d_fft_size;
uint32_t d_num_doppler_bins;
uint64_t d_sample_counter;
Gnss_Synchro* d_gnss_synchro;
std::shared_ptr<Fpga_Acquisition> acquisition_fpga;
//float d_downsampling_factor;
uint32_t d_downsampling_factor;
uint32_t d_select_queue_Fpga;
uint32_t d_total_block_exp;
bool d_make_2_steps;
uint32_t d_num_doppler_bins_step2;
float d_doppler_step2;
float d_doppler_center_step_two;
uint32_t d_max_num_acqs;
public:
~pcps_acquisition_fpga();
@ -229,6 +185,39 @@ public:
* \brief This funciton triggers a HW reset of the FPGA PL.
*/
void reset_acquisition(void);
private:
friend pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_);
pcps_acquisition_fpga(pcpsconf_fpga_t conf_);
bool d_active;
bool d_make_2_steps;
uint32_t d_doppler_index;
uint32_t d_channel;
uint32_t d_doppler_step;
uint32_t d_doppler_max;
uint32_t d_fft_size;
uint32_t d_num_doppler_bins;
uint32_t d_downsampling_factor;
uint32_t d_select_queue_Fpga;
uint32_t d_total_block_exp;
uint32_t d_num_doppler_bins_step2;
uint32_t d_max_num_acqs;
int32_t d_state;
uint64_t d_sample_counter;
float d_threshold;
float d_mag;
float d_input_power;
float d_test_statistics;
float d_doppler_step2;
float d_doppler_center_step_two;
pcpsconf_fpga_t acq_parameters;
Gnss_Synchro* d_gnss_synchro;
std::shared_ptr<Fpga_Acquisition> acquisition_fpga;
std::weak_ptr<ChannelFsm> d_channel_fsm;
void send_negative_acquisition();
void send_positive_acquisition();
void acquisition_core(uint32_t num_doppler_bins, uint32_t doppler_step, int32_t doppler_max);
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);
};
#endif /* GNSS_SDR_PCPS_ACQUISITION_FPGA_H_*/

View File

@ -97,8 +97,6 @@ pcps_assisted_acquisition_cc::pcps_assisted_acquisition_cc(
d_doppler_min = 0;
d_num_doppler_points = 0;
d_doppler_step = 0;
d_grid_data = nullptr;
d_grid_doppler_wipeoffs = nullptr;
d_gnss_synchro = nullptr;
d_code_phase = 0;
d_doppler_freq = 0;
@ -114,17 +112,6 @@ void pcps_assisted_acquisition_cc::set_doppler_step(uint32_t doppler_step)
}
void pcps_assisted_acquisition_cc::free_grid_memory()
{
for (int32_t i = 0; i < d_num_doppler_points; i++)
{
delete[] d_grid_data[i];
delete[] d_grid_doppler_wipeoffs[i];
}
delete d_grid_data;
}
pcps_assisted_acquisition_cc::~pcps_assisted_acquisition_cc()
{
volk_gnsssdr_free(d_carrier);
@ -234,26 +221,21 @@ void pcps_assisted_acquisition_cc::redefine_grid()
// Create the search grid array
d_num_doppler_points = floor(std::abs(d_doppler_max - d_doppler_min) / d_doppler_step);
d_grid_data = new float *[d_num_doppler_points];
for (int32_t i = 0; i < d_num_doppler_points; i++)
{
d_grid_data[i] = new float[d_fft_size];
}
d_grid_data = std::vector<std::vector<float>>(d_num_doppler_points, std::vector<float>(d_fft_size));
// create the carrier Doppler wipeoff signals
int32_t doppler_hz;
float phase_step_rad;
d_grid_doppler_wipeoffs = new gr_complex *[d_num_doppler_points];
d_grid_doppler_wipeoffs = std::vector<std::vector<std::complex<float>>>(d_num_doppler_points, std::vector<std::complex<float>>(d_fft_size));
for (int32_t doppler_index = 0; doppler_index < d_num_doppler_points; doppler_index++)
{
doppler_hz = d_doppler_min + d_doppler_step * doppler_index;
// doppler search steps
// compute the carrier doppler wipe-off signal and store it
phase_step_rad = static_cast<float>(GPS_TWO_PI) * doppler_hz / static_cast<float>(d_fs_in);
d_grid_doppler_wipeoffs[doppler_index] = new gr_complex[d_fft_size];
float _phase[1];
_phase[0] = 0;
volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index], -phase_step_rad, _phase, d_fft_size);
volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index].data(), -phase_step_rad, _phase, d_fft_size);
}
}
@ -268,7 +250,7 @@ double pcps_assisted_acquisition_cc::search_maximum()
for (int32_t i = 0; i < d_num_doppler_points; i++)
{
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_grid_data[i], d_fft_size);
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_grid_data[i].data(), d_fft_size);
if (d_grid_data[i][tmp_intex_t] > magt)
{
magt = d_grid_data[i][index_time];
@ -300,7 +282,7 @@ double pcps_assisted_acquisition_cc::search_maximum()
<< "_" << d_gnss_synchro->Signal << "_sat_"
<< d_gnss_synchro->PRN << "_doppler_" << d_gnss_synchro->Acq_doppler_hz << ".dat";
d_dump_file.open(filename.str().c_str(), std::ios::out | std::ios::binary);
d_dump_file.write(reinterpret_cast<char *>(d_grid_data[index_doppler]), n); //write directly |abs(x)|^2 in this Doppler bin?
d_dump_file.write(reinterpret_cast<char *>(d_grid_data[index_doppler].data()), n); //write directly |abs(x)|^2 in this Doppler bin?
d_dump_file.close();
}
@ -343,7 +325,7 @@ int32_t pcps_assisted_acquisition_cc::compute_and_accumulate_grid(gr_vector_cons
{
// doppler search steps
// Perform the carrier wipe-off
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in, d_grid_doppler_wipeoffs[doppler_index], d_fft_size);
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in, d_grid_doppler_wipeoffs[doppler_index].data(), d_fft_size);
// 3- Perform the FFT-based convolution (parallel time search)
// Compute the FFT of the carrier wiped--off incoming signal
d_fft_if->execute();
@ -357,8 +339,8 @@ int32_t pcps_assisted_acquisition_cc::compute_and_accumulate_grid(gr_vector_cons
// save the grid matrix delay file
volk_32fc_magnitude_squared_32f(p_tmp_vector, d_ifft->get_outbuf(), d_fft_size);
const float *old_vector = d_grid_data[doppler_index];
volk_32f_x2_add_32f(d_grid_data[doppler_index], old_vector, p_tmp_vector, d_fft_size);
const float *old_vector = d_grid_data[doppler_index].data();
volk_32f_x2_add_32f(d_grid_data[doppler_index].data(), old_vector, p_tmp_vector, d_fft_size);
}
volk_gnsssdr_free(p_tmp_vector);
return d_fft_size;
@ -439,7 +421,6 @@ int pcps_assisted_acquisition_cc::general_work(int noutput_items,
consume_each(ninput_items[0]);
break;
case 4: // RedefineGrid
free_grid_memory();
redefine_grid();
reset_grid();
d_sample_counter += static_cast<uint64_t>(ninput_items[0]); // sample counter
@ -458,7 +439,6 @@ int pcps_assisted_acquisition_cc::general_work(int noutput_items,
d_active = false;
// Send message to channel port //0=STOP_CHANNEL 1=ACQ_SUCCESS 2=ACQ_FAIL
this->message_port_pub(pmt::mp("events"), pmt::from_long(1));
free_grid_memory();
// consume samples to not block the GNU Radio flowgraph
d_sample_counter += static_cast<uint64_t>(ninput_items[0]); // sample counter
consume_each(ninput_items[0]);
@ -476,7 +456,6 @@ int pcps_assisted_acquisition_cc::general_work(int noutput_items,
d_active = false;
// Send message to channel port //0=STOP_CHANNEL 1=ACQ_SUCCESS 2=ACQ_FAIL
this->message_port_pub(pmt::mp("events"), pmt::from_long(2));
free_grid_memory();
// consume samples to not block the GNU Radio flowgraph
d_sample_counter += static_cast<uint64_t>(ninput_items[0]); // sample counter
consume_each(ninput_items[0]);

View File

@ -57,13 +57,13 @@
#include <memory>
#include <string>
#include <utility>
#include <vector>
class pcps_assisted_acquisition_cc;
using pcps_assisted_acquisition_cc_sptr = boost::shared_ptr<pcps_assisted_acquisition_cc>;
pcps_assisted_acquisition_cc_sptr
pcps_make_assisted_acquisition_cc(
pcps_assisted_acquisition_cc_sptr pcps_make_assisted_acquisition_cc(
int32_t max_dwells,
uint32_t sampled_ms,
int32_t doppler_max,
@ -80,69 +80,6 @@ pcps_make_assisted_acquisition_cc(
*/
class pcps_assisted_acquisition_cc : public gr::block
{
private:
friend pcps_assisted_acquisition_cc_sptr
pcps_make_assisted_acquisition_cc(int32_t max_dwells, uint32_t sampled_ms,
int32_t doppler_max, int32_t doppler_min, int64_t fs_in,
int32_t samples_per_ms, bool dump,
std::string dump_filename);
pcps_assisted_acquisition_cc(int32_t max_dwells, uint32_t sampled_ms,
int32_t doppler_max, int32_t doppler_min, int64_t fs_in,
int32_t samples_per_ms, bool dump,
std::string dump_filename);
void calculate_magnitudes(gr_complex* fft_begin, int32_t doppler_shift,
int32_t doppler_offset);
int32_t compute_and_accumulate_grid(gr_vector_const_void_star& input_items);
float estimate_input_power(gr_vector_const_void_star& input_items);
double search_maximum();
void get_assistance();
void reset_grid();
void redefine_grid();
void free_grid_memory();
int64_t d_fs_in;
int32_t d_samples_per_ms;
int32_t d_max_dwells;
uint32_t d_doppler_resolution;
int32_t d_gnuradio_forecast_samples;
float d_threshold;
std::string d_satellite_str;
int32_t d_doppler_max;
int32_t d_doppler_min;
int32_t d_config_doppler_max;
int32_t d_config_doppler_min;
int32_t d_num_doppler_points;
int32_t d_doppler_step;
uint32_t d_sampled_ms;
uint32_t d_fft_size;
uint64_t d_sample_counter;
gr_complex* d_carrier;
gr_complex* d_fft_codes;
float** d_grid_data;
gr_complex** d_grid_doppler_wipeoffs;
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
std::shared_ptr<gr::fft::fft_complex> d_ifft;
Gnss_Synchro* d_gnss_synchro;
uint32_t d_code_phase;
float d_doppler_freq;
float d_input_power;
float d_test_statistics;
std::ofstream d_dump_file;
int32_t d_state;
bool d_active;
bool d_disable_assist;
int32_t d_well_count;
bool d_dump;
uint32_t d_channel;
std::weak_ptr<ChannelFsm> d_channel_fsm;
std::string d_dump_filename;
public:
/*!
* \brief Default destructor.
@ -238,6 +175,68 @@ public:
gr_vector_void_star& output_items);
void forecast(int noutput_items, gr_vector_int& ninput_items_required);
private:
friend pcps_assisted_acquisition_cc_sptr
pcps_make_assisted_acquisition_cc(int32_t max_dwells, uint32_t sampled_ms,
int32_t doppler_max, int32_t doppler_min, int64_t fs_in,
int32_t samples_per_ms, bool dump,
std::string dump_filename);
pcps_assisted_acquisition_cc(int32_t max_dwells, uint32_t sampled_ms,
int32_t doppler_max, int32_t doppler_min, int64_t fs_in,
int32_t samples_per_ms, bool dump,
std::string dump_filename);
void calculate_magnitudes(gr_complex* fft_begin, int32_t doppler_shift,
int32_t doppler_offset);
int32_t compute_and_accumulate_grid(gr_vector_const_void_star& input_items);
float estimate_input_power(gr_vector_const_void_star& input_items);
double search_maximum();
void get_assistance();
void reset_grid();
void redefine_grid();
int64_t d_fs_in;
int32_t d_samples_per_ms;
int32_t d_max_dwells;
uint32_t d_doppler_resolution;
int32_t d_gnuradio_forecast_samples;
float d_threshold;
std::string d_satellite_str;
int32_t d_doppler_max;
int32_t d_doppler_min;
int32_t d_config_doppler_max;
int32_t d_config_doppler_min;
int32_t d_num_doppler_points;
int32_t d_doppler_step;
uint32_t d_sampled_ms;
uint32_t d_fft_size;
uint64_t d_sample_counter;
gr_complex* d_carrier;
gr_complex* d_fft_codes;
std::vector<std::vector<float>> d_grid_data;
std::vector<std::vector<std::complex<float>>> d_grid_doppler_wipeoffs;
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
std::shared_ptr<gr::fft::fft_complex> d_ifft;
Gnss_Synchro* d_gnss_synchro;
uint32_t d_code_phase;
float d_doppler_freq;
float d_input_power;
float d_test_statistics;
std::ofstream d_dump_file;
int32_t d_state;
bool d_active;
bool d_disable_assist;
int32_t d_well_count;
bool d_dump;
uint32_t d_channel;
std::weak_ptr<ChannelFsm> d_channel_fsm;
std::string d_dump_filename;
};
#endif /* GNSS_SDR_PCPS_assisted_acquisition_cc_H_*/

View File

@ -52,8 +52,7 @@ class pcps_cccwsr_acquisition_cc;
using pcps_cccwsr_acquisition_cc_sptr = boost::shared_ptr<pcps_cccwsr_acquisition_cc>;
pcps_cccwsr_acquisition_cc_sptr
pcps_cccwsr_make_acquisition_cc(
pcps_cccwsr_acquisition_cc_sptr pcps_cccwsr_make_acquisition_cc(
uint32_t sampled_ms,
uint32_t max_dwells,
uint32_t doppler_max,
@ -69,59 +68,6 @@ pcps_cccwsr_make_acquisition_cc(
*/
class pcps_cccwsr_acquisition_cc : public gr::block
{
private:
friend pcps_cccwsr_acquisition_cc_sptr
pcps_cccwsr_make_acquisition_cc(uint32_t sampled_ms, uint32_t max_dwells,
uint32_t doppler_max, int64_t fs_in,
int32_t samples_per_ms, int32_t samples_per_code,
bool dump, std::string dump_filename);
pcps_cccwsr_acquisition_cc(uint32_t sampled_ms, uint32_t max_dwells,
uint32_t doppler_max, int64_t fs_in,
int32_t samples_per_ms, int32_t samples_per_code,
bool dump, std::string dump_filename);
void calculate_magnitudes(gr_complex* fft_begin, int32_t doppler_shift,
int32_t doppler_offset);
int64_t d_fs_in;
int32_t d_samples_per_ms;
int32_t d_samples_per_code;
uint32_t d_doppler_resolution;
float d_threshold;
std::string d_satellite_str;
uint32_t d_doppler_max;
uint32_t d_doppler_step;
uint32_t d_sampled_ms;
uint32_t d_max_dwells;
uint32_t d_well_count;
uint32_t d_fft_size;
uint64_t d_sample_counter;
gr_complex** d_grid_doppler_wipeoffs;
uint32_t d_num_doppler_bins;
gr_complex* d_fft_code_data;
gr_complex* d_fft_code_pilot;
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
std::shared_ptr<gr::fft::fft_complex> d_ifft;
Gnss_Synchro* d_gnss_synchro;
uint32_t d_code_phase;
float d_doppler_freq;
float d_mag;
float* d_magnitude;
gr_complex* d_data_correlation;
gr_complex* d_pilot_correlation;
gr_complex* d_correlation_plus;
gr_complex* d_correlation_minus;
float d_input_power;
float d_test_statistics;
std::ofstream d_dump_file;
bool d_active;
int32_t d_state;
bool d_dump;
uint32_t d_channel;
std::weak_ptr<ChannelFsm> d_channel_fsm;
std::string d_dump_filename;
public:
/*!
* \brief Default destructor.
@ -226,6 +172,59 @@ public:
int general_work(int noutput_items, gr_vector_int& ninput_items,
gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items);
private:
friend pcps_cccwsr_acquisition_cc_sptr
pcps_cccwsr_make_acquisition_cc(uint32_t sampled_ms, uint32_t max_dwells,
uint32_t doppler_max, int64_t fs_in,
int32_t samples_per_ms, int32_t samples_per_code,
bool dump, std::string dump_filename);
pcps_cccwsr_acquisition_cc(uint32_t sampled_ms, uint32_t max_dwells,
uint32_t doppler_max, int64_t fs_in,
int32_t samples_per_ms, int32_t samples_per_code,
bool dump, std::string dump_filename);
void calculate_magnitudes(gr_complex* fft_begin, int32_t doppler_shift,
int32_t doppler_offset);
int64_t d_fs_in;
int32_t d_samples_per_ms;
int32_t d_samples_per_code;
uint32_t d_doppler_resolution;
float d_threshold;
std::string d_satellite_str;
uint32_t d_doppler_max;
uint32_t d_doppler_step;
uint32_t d_sampled_ms;
uint32_t d_max_dwells;
uint32_t d_well_count;
uint32_t d_fft_size;
uint64_t d_sample_counter;
gr_complex** d_grid_doppler_wipeoffs;
uint32_t d_num_doppler_bins;
gr_complex* d_fft_code_data;
gr_complex* d_fft_code_pilot;
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
std::shared_ptr<gr::fft::fft_complex> d_ifft;
Gnss_Synchro* d_gnss_synchro;
uint32_t d_code_phase;
float d_doppler_freq;
float d_mag;
float* d_magnitude;
gr_complex* d_data_correlation;
gr_complex* d_pilot_correlation;
gr_complex* d_correlation_plus;
gr_complex* d_correlation_minus;
float d_input_power;
float d_test_statistics;
std::ofstream d_dump_file;
bool d_active;
int32_t d_state;
bool d_dump;
uint32_t d_channel;
std::weak_ptr<ChannelFsm> d_channel_fsm;
std::string d_dump_filename;
};
#endif /* GNSS_SDR_PCPS_CCCWSR_ACQUISITION_CC_H_*/

View File

@ -54,11 +54,11 @@
#define CL_SILENCE_DEPRECATION
#include "channel_fsm.h"
#include "gnss_synchro.h"
#include "opencl/cl.hpp"
#include "opencl/fft_internal.h"
#include <gnuradio/block.h>
#include <gnuradio/fft/fft.h>
#include <gnuradio/gr_complex.h>
#include "opencl/cl.hpp"
#include <cstdint>
#include <fstream>
#include <string>
@ -68,10 +68,13 @@ class pcps_opencl_acquisition_cc;
typedef boost::shared_ptr<pcps_opencl_acquisition_cc> pcps_opencl_acquisition_cc_sptr;
pcps_opencl_acquisition_cc_sptr
pcps_make_opencl_acquisition_cc(uint32_t sampled_ms, uint32_t max_dwells,
uint32_t doppler_max, int64_t fs_in,
int samples_per_ms, int samples_per_code,
pcps_opencl_acquisition_cc_sptr pcps_make_opencl_acquisition_cc(
uint32_t sampled_ms,
uint32_t max_dwells,
uint32_t doppler_max,
int64_t fs_in,
int samples_per_ms,
int samples_per_code,
bool bit_transition_flag,
bool dump,
std::string dump_filename);
@ -84,83 +87,6 @@ pcps_make_opencl_acquisition_cc(uint32_t sampled_ms, uint32_t max_dwells,
*/
class pcps_opencl_acquisition_cc : public gr::block
{
private:
friend pcps_opencl_acquisition_cc_sptr
pcps_make_opencl_acquisition_cc(uint32_t sampled_ms, uint32_t max_dwells,
uint32_t doppler_max, int64_t fs_in,
int samples_per_ms, int samples_per_code,
bool bit_transition_flag,
bool dump,
std::string dump_filename);
pcps_opencl_acquisition_cc(uint32_t sampled_ms, uint32_t max_dwells,
uint32_t doppler_max, int64_t fs_in,
int samples_per_ms, int samples_per_code,
bool bit_transition_flag,
bool dump,
std::string dump_filename);
void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift,
int doppler_offset);
int init_opencl_environment(const std::string& kernel_filename);
int64_t d_fs_in;
int d_samples_per_ms;
int d_samples_per_code;
uint32_t d_doppler_resolution;
float d_threshold;
std::string d_satellite_str;
uint32_t d_doppler_max;
uint32_t d_doppler_step;
uint32_t d_sampled_ms;
uint32_t d_max_dwells;
uint32_t d_well_count;
uint32_t d_fft_size;
uint32_t d_fft_size_pow2;
int* d_max_doppler_indexs;
uint64_t d_sample_counter;
gr_complex** d_grid_doppler_wipeoffs;
uint32_t d_num_doppler_bins;
gr_complex* d_fft_codes;
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
std::shared_ptr<gr::fft::fft_complex> d_ifft;
Gnss_Synchro* d_gnss_synchro;
uint32_t d_code_phase;
float d_doppler_freq;
float d_mag;
float* d_magnitude;
float d_input_power;
float d_test_statistics;
bool d_bit_transition_flag;
std::ofstream d_dump_file;
bool d_active;
int d_state;
bool d_core_working;
bool d_dump;
uint32_t d_channel;
std::string d_dump_filename;
gr_complex* d_zero_vector;
gr_complex** d_in_buffer;
std::vector<uint64_t> d_sample_counter_buffer;
uint32_t d_in_dwell_count;
cl::Platform d_cl_platform;
cl::Device d_cl_device;
cl::Context d_cl_context;
cl::Program d_cl_program;
cl::Buffer* d_cl_buffer_in;
cl::Buffer* d_cl_buffer_fft_codes;
cl::Buffer* d_cl_buffer_1;
cl::Buffer* d_cl_buffer_2;
cl::Buffer* d_cl_buffer_magnitude;
cl::Buffer** d_cl_buffer_grid_doppler_wipeoffs;
cl::CommandQueue* d_cl_queue;
clFFT_Plan d_cl_fft_plan;
cl_int d_cl_fft_batch_size;
std::weak_ptr<ChannelFsm> d_channel_fsm;
int d_opencl;
public:
/*!
* \brief Default destructor.
@ -229,6 +155,7 @@ public:
{
d_channel_fsm = channel_fsm;
}
/*!
* \brief Set statistics threshold of PCPS algorithm.
* \param threshold - Threshold for signal detection (check \ref Navitec2012,
@ -267,6 +194,10 @@ public:
return ready;
}
void acquisition_core_volk();
void acquisition_core_opencl();
/*!
* \brief Parallel Code Phase Search Acquisition signal processing.
*/
@ -274,9 +205,82 @@ public:
gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items);
void acquisition_core_volk();
private:
friend pcps_opencl_acquisition_cc_sptr
pcps_make_opencl_acquisition_cc(uint32_t sampled_ms, uint32_t max_dwells,
uint32_t doppler_max, int64_t fs_in,
int samples_per_ms, int samples_per_code,
bool bit_transition_flag,
bool dump,
std::string dump_filename);
void acquisition_core_opencl();
pcps_opencl_acquisition_cc(uint32_t sampled_ms, uint32_t max_dwells,
uint32_t doppler_max, int64_t fs_in,
int samples_per_ms, int samples_per_code,
bool bit_transition_flag,
bool dump,
std::string dump_filename);
void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift,
int doppler_offset);
int init_opencl_environment(const std::string& kernel_filename);
int64_t d_fs_in;
int d_samples_per_ms;
int d_samples_per_code;
uint32_t d_doppler_resolution;
float d_threshold;
std::string d_satellite_str;
uint32_t d_doppler_max;
uint32_t d_doppler_step;
uint32_t d_sampled_ms;
uint32_t d_max_dwells;
uint32_t d_well_count;
uint32_t d_fft_size;
uint32_t d_fft_size_pow2;
int* d_max_doppler_indexs;
uint64_t d_sample_counter;
gr_complex** d_grid_doppler_wipeoffs;
uint32_t d_num_doppler_bins;
gr_complex* d_fft_codes;
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
std::shared_ptr<gr::fft::fft_complex> d_ifft;
Gnss_Synchro* d_gnss_synchro;
uint32_t d_code_phase;
float d_doppler_freq;
float d_mag;
float* d_magnitude;
float d_input_power;
float d_test_statistics;
bool d_bit_transition_flag;
std::ofstream d_dump_file;
bool d_active;
int d_state;
bool d_core_working;
bool d_dump;
uint32_t d_channel;
std::string d_dump_filename;
gr_complex* d_zero_vector;
gr_complex** d_in_buffer;
std::vector<uint64_t> d_sample_counter_buffer;
uint32_t d_in_dwell_count;
std::weak_ptr<ChannelFsm> d_channel_fsm;
int d_opencl;
cl::Platform d_cl_platform;
cl::Device d_cl_device;
cl::Context d_cl_context;
cl::Program d_cl_program;
cl::Buffer* d_cl_buffer_in;
cl::Buffer* d_cl_buffer_fft_codes;
cl::Buffer* d_cl_buffer_1;
cl::Buffer* d_cl_buffer_2;
cl::Buffer* d_cl_buffer_magnitude;
cl::Buffer** d_cl_buffer_grid_doppler_wipeoffs;
cl::CommandQueue* d_cl_queue;
clFFT_Plan d_cl_fft_plan;
cl_int d_cl_fft_batch_size;
};
#endif

View File

@ -67,8 +67,7 @@ class pcps_quicksync_acquisition_cc;
using pcps_quicksync_acquisition_cc_sptr = boost::shared_ptr<pcps_quicksync_acquisition_cc>;
pcps_quicksync_acquisition_cc_sptr
pcps_quicksync_make_acquisition_cc(
pcps_quicksync_acquisition_cc_sptr pcps_quicksync_make_acquisition_cc(
uint32_t folding_factor,
uint32_t sampled_ms,
uint32_t max_dwells,
@ -89,71 +88,6 @@ pcps_quicksync_make_acquisition_cc(
*/
class pcps_quicksync_acquisition_cc : public gr::block
{
private:
friend pcps_quicksync_acquisition_cc_sptr
pcps_quicksync_make_acquisition_cc(uint32_t folding_factor,
uint32_t sampled_ms, uint32_t max_dwells,
uint32_t doppler_max, int64_t fs_in,
int32_t samples_per_ms, int32_t samples_per_code,
bool bit_transition_flag,
bool dump,
std::string dump_filename);
pcps_quicksync_acquisition_cc(uint32_t folding_factor,
uint32_t sampled_ms, uint32_t max_dwells,
uint32_t doppler_max, int64_t fs_in,
int32_t samples_per_ms, int32_t samples_per_code,
bool bit_transition_flag,
bool dump,
std::string dump_filename);
void calculate_magnitudes(gr_complex* fft_begin, int32_t doppler_shift,
int32_t doppler_offset);
gr_complex* d_code;
uint32_t d_folding_factor; // also referred in the paper as 'p'
float* d_corr_acumulator;
uint32_t* d_possible_delay;
float* d_corr_output_f;
float* d_magnitude_folded;
gr_complex* d_signal_folded;
gr_complex* d_code_folded;
float d_noise_floor_power;
int64_t d_fs_in;
int32_t d_samples_per_ms;
int32_t d_samples_per_code;
uint32_t d_doppler_resolution;
float d_threshold;
std::string d_satellite_str;
uint32_t d_doppler_max;
uint32_t d_doppler_step;
uint32_t d_sampled_ms;
uint32_t d_max_dwells;
uint32_t d_well_count;
uint32_t d_fft_size;
uint64_t d_sample_counter;
gr_complex** d_grid_doppler_wipeoffs;
uint32_t d_num_doppler_bins;
gr_complex* d_fft_codes;
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
std::shared_ptr<gr::fft::fft_complex> d_ifft;
Gnss_Synchro* d_gnss_synchro;
uint32_t d_code_phase;
float d_doppler_freq;
float d_mag;
float* d_magnitude;
float d_input_power;
float d_test_statistics;
bool d_bit_transition_flag;
std::ofstream d_dump_file;
bool d_active;
int32_t d_state;
bool d_dump;
uint32_t d_channel;
std::weak_ptr<ChannelFsm> d_channel_fsm;
std::string d_dump_filename;
public:
/*!
* \brief Default destructor.
@ -257,6 +191,70 @@ public:
int general_work(int noutput_items, gr_vector_int& ninput_items,
gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items);
private:
friend pcps_quicksync_acquisition_cc_sptr
pcps_quicksync_make_acquisition_cc(uint32_t folding_factor,
uint32_t sampled_ms, uint32_t max_dwells,
uint32_t doppler_max, int64_t fs_in,
int32_t samples_per_ms, int32_t samples_per_code,
bool bit_transition_flag,
bool dump,
std::string dump_filename);
pcps_quicksync_acquisition_cc(uint32_t folding_factor,
uint32_t sampled_ms, uint32_t max_dwells,
uint32_t doppler_max, int64_t fs_in,
int32_t samples_per_ms, int32_t samples_per_code,
bool bit_transition_flag,
bool dump,
std::string dump_filename);
void calculate_magnitudes(gr_complex* fft_begin, int32_t doppler_shift,
int32_t doppler_offset);
gr_complex* d_code;
uint32_t d_folding_factor; // also referred in the paper as 'p'
float* d_corr_acumulator;
uint32_t* d_possible_delay;
float* d_corr_output_f;
float* d_magnitude_folded;
gr_complex* d_signal_folded;
gr_complex* d_code_folded;
float d_noise_floor_power;
int64_t d_fs_in;
int32_t d_samples_per_ms;
int32_t d_samples_per_code;
uint32_t d_doppler_resolution;
float d_threshold;
std::string d_satellite_str;
uint32_t d_doppler_max;
uint32_t d_doppler_step;
uint32_t d_sampled_ms;
uint32_t d_max_dwells;
uint32_t d_well_count;
uint32_t d_fft_size;
uint64_t d_sample_counter;
gr_complex** d_grid_doppler_wipeoffs;
uint32_t d_num_doppler_bins;
gr_complex* d_fft_codes;
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
std::shared_ptr<gr::fft::fft_complex> d_ifft;
Gnss_Synchro* d_gnss_synchro;
uint32_t d_code_phase;
float d_doppler_freq;
float d_mag;
float* d_magnitude;
float d_input_power;
float d_test_statistics;
bool d_bit_transition_flag;
std::ofstream d_dump_file;
bool d_active;
int32_t d_state;
bool d_dump;
uint32_t d_channel;
std::weak_ptr<ChannelFsm> d_channel_fsm;
std::string d_dump_filename;
};
#endif /* GNSS_SDR_PCPS_ACQUISITION_CC_H_*/
#endif /* GNSS_SDR_PCPS_QUICKSYNC_ACQUISITION_CC_H_ */

View File

@ -65,8 +65,7 @@ class pcps_tong_acquisition_cc;
using pcps_tong_acquisition_cc_sptr = boost::shared_ptr<pcps_tong_acquisition_cc>;
pcps_tong_acquisition_cc_sptr
pcps_tong_make_acquisition_cc(
pcps_tong_acquisition_cc_sptr pcps_tong_make_acquisition_cc(
uint32_t sampled_ms,
uint32_t doppler_max,
int64_t fs_in,
@ -84,60 +83,6 @@ pcps_tong_make_acquisition_cc(
*/
class pcps_tong_acquisition_cc : public gr::block
{
private:
friend pcps_tong_acquisition_cc_sptr
pcps_tong_make_acquisition_cc(uint32_t sampled_ms, uint32_t doppler_max,
int64_t fs_in, int32_t samples_per_ms,
int32_t samples_per_code, uint32_t tong_init_val,
uint32_t tong_max_val, uint32_t tong_max_dwells,
bool dump, std::string dump_filename);
pcps_tong_acquisition_cc(uint32_t sampled_ms, uint32_t doppler_max,
int64_t fs_in, int32_t samples_per_ms,
int32_t samples_per_code, uint32_t tong_init_val,
uint32_t tong_max_val, uint32_t tong_max_dwells,
bool dump, std::string dump_filename);
void calculate_magnitudes(gr_complex* fft_begin, int32_t doppler_shift,
int32_t doppler_offset);
int64_t d_fs_in;
int32_t d_samples_per_ms;
int32_t d_samples_per_code;
uint32_t d_doppler_resolution;
float d_threshold;
std::string d_satellite_str;
uint32_t d_doppler_max;
uint32_t d_doppler_step;
uint32_t d_sampled_ms;
uint32_t d_dwell_count;
uint32_t d_tong_count;
uint32_t d_tong_init_val;
uint32_t d_tong_max_val;
uint32_t d_tong_max_dwells;
uint32_t d_fft_size;
uint64_t d_sample_counter;
gr_complex** d_grid_doppler_wipeoffs;
uint32_t d_num_doppler_bins;
gr_complex* d_fft_codes;
float** d_grid_data;
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
std::shared_ptr<gr::fft::fft_complex> d_ifft;
Gnss_Synchro* d_gnss_synchro;
uint32_t d_code_phase;
float d_doppler_freq;
float d_mag;
float* d_magnitude;
float d_input_power;
float d_test_statistics;
std::ofstream d_dump_file;
bool d_active;
int32_t d_state;
bool d_dump;
uint32_t d_channel;
std::weak_ptr<ChannelFsm> d_channel_fsm;
std::string d_dump_filename;
public:
/*!
* \brief Default destructor.
@ -241,6 +186,60 @@ public:
int general_work(int noutput_items, gr_vector_int& ninput_items,
gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items);
private:
friend pcps_tong_acquisition_cc_sptr
pcps_tong_make_acquisition_cc(uint32_t sampled_ms, uint32_t doppler_max,
int64_t fs_in, int32_t samples_per_ms,
int32_t samples_per_code, uint32_t tong_init_val,
uint32_t tong_max_val, uint32_t tong_max_dwells,
bool dump, std::string dump_filename);
pcps_tong_acquisition_cc(uint32_t sampled_ms, uint32_t doppler_max,
int64_t fs_in, int32_t samples_per_ms,
int32_t samples_per_code, uint32_t tong_init_val,
uint32_t tong_max_val, uint32_t tong_max_dwells,
bool dump, std::string dump_filename);
void calculate_magnitudes(gr_complex* fft_begin, int32_t doppler_shift,
int32_t doppler_offset);
int64_t d_fs_in;
int32_t d_samples_per_ms;
int32_t d_samples_per_code;
uint32_t d_doppler_resolution;
float d_threshold;
std::string d_satellite_str;
uint32_t d_doppler_max;
uint32_t d_doppler_step;
uint32_t d_sampled_ms;
uint32_t d_dwell_count;
uint32_t d_tong_count;
uint32_t d_tong_init_val;
uint32_t d_tong_max_val;
uint32_t d_tong_max_dwells;
uint32_t d_fft_size;
uint64_t d_sample_counter;
gr_complex** d_grid_doppler_wipeoffs;
uint32_t d_num_doppler_bins;
gr_complex* d_fft_codes;
float** d_grid_data;
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
std::shared_ptr<gr::fft::fft_complex> d_ifft;
Gnss_Synchro* d_gnss_synchro;
uint32_t d_code_phase;
float d_doppler_freq;
float d_mag;
float* d_magnitude;
float d_input_power;
float d_test_statistics;
std::ofstream d_dump_file;
bool d_active;
int32_t d_state;
bool d_dump;
uint32_t d_channel;
std::weak_ptr<ChannelFsm> d_channel_fsm;
std::string d_dump_filename;
};
#endif /* GNSS_SDR_PCPS_TONG_ACQUISITION_CC_H_ */

View File

@ -47,15 +47,15 @@ channel_msg_receiver_cc_sptr channel_msg_receiver_make_cc(std::shared_ptr<Channe
*/
class channel_msg_receiver_cc : public gr::block
{
public:
~channel_msg_receiver_cc(); //!< Default destructor
private:
std::shared_ptr<ChannelFsm> d_channel_fsm;
bool d_repeat; // todo: change FSM to include repeat value
friend channel_msg_receiver_cc_sptr channel_msg_receiver_make_cc(std::shared_ptr<ChannelFsm> channel_fsm, bool repeat);
void msg_handler_events(pmt::pmt_t msg);
channel_msg_receiver_cc(std::shared_ptr<ChannelFsm> channel_fsm, bool repeat);
public:
~channel_msg_receiver_cc(); //!< Default destructor
};
#endif

View File

@ -47,15 +47,14 @@ interleaved_byte_to_complex_byte_sptr make_interleaved_byte_to_complex_byte();
*/
class interleaved_byte_to_complex_byte : public gr::sync_decimator
{
private:
friend interleaved_byte_to_complex_byte_sptr make_interleaved_byte_to_complex_byte();
public:
interleaved_byte_to_complex_byte();
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
private:
friend interleaved_byte_to_complex_byte_sptr make_interleaved_byte_to_complex_byte();
interleaved_byte_to_complex_byte();
};
#endif

View File

@ -46,15 +46,14 @@ interleaved_byte_to_complex_short_sptr make_interleaved_byte_to_complex_short();
*/
class interleaved_byte_to_complex_short : public gr::sync_decimator
{
private:
friend interleaved_byte_to_complex_short_sptr make_interleaved_byte_to_complex_short();
public:
interleaved_byte_to_complex_short();
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
private:
friend interleaved_byte_to_complex_short_sptr make_interleaved_byte_to_complex_short();
interleaved_byte_to_complex_short();
};
#endif
#endif // GNSS_SDR_INTERLEAVED_BYTE_TO_COMPLEX_SHORT_H_

View File

@ -46,15 +46,14 @@ interleaved_short_to_complex_short_sptr make_interleaved_short_to_complex_short(
*/
class interleaved_short_to_complex_short : public gr::sync_decimator
{
private:
friend interleaved_short_to_complex_short_sptr make_interleaved_short_to_complex_short();
public:
interleaved_short_to_complex_short();
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
private:
friend interleaved_short_to_complex_short_sptr make_interleaved_short_to_complex_short();
interleaved_short_to_complex_short();
};
#endif
#endif // GNSS_SDR_INTERLEAVED_SHORT_TO_COMPLEX_SHORT_H_

View File

@ -43,17 +43,15 @@ beamformer_sptr make_beamformer();
*/
class beamformer : public gr::sync_block
{
private:
friend beamformer_sptr
make_beamformer_sptr();
gr_complex *weight_vector;
public:
beamformer();
~beamformer();
int work(int noutput_items, gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
private:
friend beamformer_sptr make_beamformer_sptr();
gr_complex *weight_vector;
};
#endif

View File

@ -47,9 +47,19 @@ notch_sptr make_notch_filter(float pfa, float p_c_factor,
/*!
* \brief This class implements a real-time software-defined multi state notch filter
*/
class Notch : public gr::block
{
public:
Notch(float pfa, float p_c_factor, int32_t length_, int32_t n_segments_est, int32_t n_segments_reset);
~Notch();
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
int general_work(int noutput_items, gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
private:
float pfa;
float noise_pow_est;
@ -67,17 +77,6 @@ private:
float *angle_;
float *power_spect;
std::unique_ptr<gr::fft::fft_complex> d_fft;
public:
Notch(float pfa, float p_c_factor, int32_t length_, int32_t n_segments_est, int32_t n_segments_reset);
~Notch();
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
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_NOTCH_H_
#endif // GNSS_SDR_NOTCH_H_

View File

@ -46,9 +46,19 @@ notch_lite_sptr make_notch_filter_lite(float p_c_factor, float pfa, int32_t leng
/*!
* \brief This class implements a real-time software-defined multi state notch filter light version
*/
class NotchLite : public gr::block
{
public:
NotchLite(float p_c_factor, float pfa, int32_t length_, int32_t n_segments_est, int32_t n_segments_reset, int32_t n_segments_coeff);
~NotchLite();
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
int general_work(int noutput_items, gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
private:
int32_t length_;
int32_t n_segments;
@ -70,17 +80,6 @@ private:
float angle2;
float *power_spect;
std::unique_ptr<gr::fft::fft_complex> d_fft;
public:
NotchLite(float p_c_factor, float pfa, int32_t length_, int32_t n_segments_est, int32_t n_segments_reset, int32_t n_segments_coeff);
~NotchLite();
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
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_NOTCH_LITE_H_
#endif // GNSS_SDR_NOTCH_LITE_H_

View File

@ -44,6 +44,16 @@ pulse_blanking_cc_sptr make_pulse_blanking_cc(float pfa, int32_t length_, int32_
class pulse_blanking_cc : public gr::block
{
public:
pulse_blanking_cc(float pfa, int32_t length_, int32_t n_segments_est, int32_t n_segments_reset);
~pulse_blanking_cc();
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
int general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
private:
int32_t length_;
int32_t n_segments;
@ -55,16 +65,6 @@ private:
float thres_;
float pfa;
gr_complex *zeros_;
public:
pulse_blanking_cc(float pfa, int32_t length_, int32_t n_segments_est, int32_t n_segments_reset);
~pulse_blanking_cc();
int general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
};
#endif
#endif // GNSS_SDR_PULSE_BLANKING_H_

View File

@ -38,9 +38,10 @@
class direct_resampler_conditioner_cb;
using direct_resampler_conditioner_cb_sptr = boost::shared_ptr<direct_resampler_conditioner_cb>;
direct_resampler_conditioner_cb_sptr
direct_resampler_make_conditioner_cb(double sample_freq_in,
direct_resampler_conditioner_cb_sptr direct_resampler_make_conditioner_cb(
double sample_freq_in,
double sample_freq_out);
/*!
* \brief This class implements a direct resampler conditioner for std::complex<signed char>
*
@ -48,20 +49,6 @@ direct_resampler_make_conditioner_cb(double sample_freq_in,
*/
class direct_resampler_conditioner_cb : public gr::block
{
private:
friend direct_resampler_conditioner_cb_sptr
direct_resampler_make_conditioner_cb(double sample_freq_in,
double sample_freq_out);
double d_sample_freq_in;
double d_sample_freq_out;
uint32_t d_phase;
uint32_t d_lphase;
uint32_t d_phase_step;
direct_resampler_conditioner_cb(double sample_freq_in,
double sample_freq_out);
public:
~direct_resampler_conditioner_cb();
@ -80,6 +67,21 @@ public:
int general_work(int noutput_items, gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
private:
friend direct_resampler_conditioner_cb_sptr direct_resampler_make_conditioner_cb(
double sample_freq_in,
double sample_freq_out);
direct_resampler_conditioner_cb(
double sample_freq_in,
double sample_freq_out);
double d_sample_freq_in;
double d_sample_freq_out;
uint32_t d_phase;
uint32_t d_lphase;
uint32_t d_phase_step;
};
#endif /* GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_CS_H */

View File

@ -43,9 +43,11 @@
#include <volk/volk.h>
class direct_resampler_conditioner_cc;
using direct_resampler_conditioner_cc_sptr = boost::shared_ptr<direct_resampler_conditioner_cc>;
direct_resampler_conditioner_cc_sptr
direct_resampler_make_conditioner_cc(double sample_freq_in,
direct_resampler_conditioner_cc_sptr direct_resampler_make_conditioner_cc(
double sample_freq_in,
double sample_freq_out);
/*!
@ -55,18 +57,6 @@ direct_resampler_make_conditioner_cc(double sample_freq_in,
*/
class direct_resampler_conditioner_cc : public gr::block
{
private:
friend direct_resampler_conditioner_cc_sptr
direct_resampler_make_conditioner_cc(double sample_freq_in,
double sample_freq_out);
double d_sample_freq_in; //! Specifies the sampling frequency of the input signal
double d_sample_freq_out; //! Specifies the sampling frequency of the output signal
uint32_t d_phase;
uint32_t d_lphase;
uint32_t d_phase_step;
direct_resampler_conditioner_cc(double sample_freq_in,
double sample_freq_out);
public:
~direct_resampler_conditioner_cc();
inline unsigned int sample_freq_in() const
@ -84,6 +74,21 @@ public:
int general_work(int noutput_items, gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
private:
friend direct_resampler_conditioner_cc_sptr direct_resampler_make_conditioner_cc(
double sample_freq_in,
double sample_freq_out);
direct_resampler_conditioner_cc(
double sample_freq_in,
double sample_freq_out);
double d_sample_freq_in; // Sampling frequency of the input signal
double d_sample_freq_out; // Sampling frequency of the output signal
uint32_t d_phase;
uint32_t d_lphase;
uint32_t d_phase_step;
};
#endif /* GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_CC_H */

View File

@ -38,9 +38,10 @@
class direct_resampler_conditioner_cs;
using direct_resampler_conditioner_cs_sptr = boost::shared_ptr<direct_resampler_conditioner_cs>;
direct_resampler_conditioner_cs_sptr
direct_resampler_make_conditioner_cs(double sample_freq_in,
direct_resampler_conditioner_cs_sptr direct_resampler_make_conditioner_cs(
double sample_freq_in,
double sample_freq_out);
/*!
* \brief This class implements a direct resampler conditioner for std::complex<short>
*
@ -48,20 +49,6 @@ direct_resampler_make_conditioner_cs(double sample_freq_in,
*/
class direct_resampler_conditioner_cs : public gr::block
{
private:
friend direct_resampler_conditioner_cs_sptr
direct_resampler_make_conditioner_cs(double sample_freq_in,
double sample_freq_out);
double d_sample_freq_in;
double d_sample_freq_out;
uint32_t d_phase;
uint32_t d_lphase;
uint32_t d_phase_step;
direct_resampler_conditioner_cs(double sample_freq_in,
double sample_freq_out);
public:
~direct_resampler_conditioner_cs();
@ -80,6 +67,21 @@ public:
int general_work(int noutput_items, gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
private:
friend direct_resampler_conditioner_cs_sptr direct_resampler_make_conditioner_cs(
double sample_freq_in,
double sample_freq_out);
direct_resampler_conditioner_cs(
double sample_freq_in,
double sample_freq_out);
double d_sample_freq_in;
double d_sample_freq_out;
uint32_t d_phase;
uint32_t d_lphase;
uint32_t d_phase_step;
};
#endif /* GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_CS_H */

View File

@ -60,11 +60,19 @@ using signal_generator_c_sptr = boost::shared_ptr<signal_generator_c>;
* constructor is private. signal_make_generator_c is the public
* interface for creating new instances.
*/
signal_generator_c_sptr
signal_make_generator_c(std::vector<std::string> signal1, std::vector<std::string> system, const std::vector<unsigned int> &PRN,
const std::vector<float> &CN0_dB, const std::vector<float> &doppler_Hz,
const std::vector<unsigned int> &delay_chips, const std::vector<unsigned int> &delay_sec, bool data_flag, bool noise_flag,
unsigned int fs_in, unsigned int vector_length, float BW_BB);
signal_generator_c_sptr signal_make_generator_c(
std::vector<std::string> signal1,
std::vector<std::string> system,
const std::vector<unsigned int> &PRN,
const std::vector<float> &CN0_dB,
const std::vector<float> &doppler_Hz,
const std::vector<unsigned int> &delay_chips,
const std::vector<unsigned int> &delay_sec,
bool data_flag,
bool noise_flag,
unsigned int fs_in,
unsigned int vector_length,
float BW_BB);
/*!
* \brief This class generates synthesized GNSS signal.
@ -74,23 +82,46 @@ signal_make_generator_c(std::vector<std::string> signal1, std::vector<std::strin
*/
class signal_generator_c : public gr::block
{
public:
~signal_generator_c(); // public destructor
// Where all the action really happens
int general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
private:
// The friend declaration allows gen_source to
// access the private constructor.
friend signal_generator_c_sptr signal_make_generator_c(
std::vector<std::string> signal1,
std::vector<std::string> system,
const std::vector<unsigned int> &PRN,
const std::vector<float> &CN0_dB,
const std::vector<float> &doppler_Hz,
const std::vector<unsigned int> &delay_chips,
const std::vector<unsigned int> &delay_sec,
bool data_flag,
bool noise_flag,
unsigned int fs_in,
unsigned int vector_length,
float BW_BB);
/* Create the signal_generator_c object*/
friend signal_generator_c_sptr
signal_make_generator_c(std::vector<std::string> signal1, std::vector<std::string> system, const std::vector<unsigned int> &PRN,
const std::vector<float> &CN0_dB, const std::vector<float> &doppler_Hz,
const std::vector<unsigned int> &delay_chips, const std::vector<unsigned int> &delay_sec, bool data_flag, bool noise_flag,
unsigned int fs_in, unsigned int vector_length, float BW_BB);
signal_generator_c(std::vector<std::string> signal1, std::vector<std::string> system, const std::vector<unsigned int> &PRN,
std::vector<float> CN0_dB, std::vector<float> doppler_Hz,
std::vector<unsigned int> delay_chips, std::vector<unsigned int> delay_sec, bool data_flag, bool noise_flag,
unsigned int fs_in, unsigned int vector_length, float BW_BB);
signal_generator_c(
std::vector<std::string> signal1,
std::vector<std::string> system,
const std::vector<unsigned int> &PRN,
std::vector<float> CN0_dB,
std::vector<float> doppler_Hz,
std::vector<unsigned int> delay_chips,
std::vector<unsigned int> delay_sec,
bool data_flag,
bool noise_flag,
unsigned int fs_in,
unsigned int vector_length,
float BW_BB);
void init();
void generate_codes();
std::vector<std::string> signal_;
@ -106,7 +137,6 @@ private:
unsigned int num_sats_;
unsigned int vector_length_;
float BW_BB_;
std::vector<unsigned int> samples_per_code_;
std::vector<unsigned int> num_of_codes_per_vector_;
std::vector<unsigned int> data_bit_duration_ms_;
@ -116,28 +146,15 @@ private:
std::vector<signed int> current_data_bit_int_;
std::vector<signed int> data_modulation_;
std::vector<signed int> pilot_modulation_;
boost::scoped_array<gr_complex *> sampled_code_data_;
boost::scoped_array<gr_complex *> sampled_code_pilot_;
//gr::random *random_;
gr_complex *complex_phase_;
unsigned int work_counter_;
std::random_device r;
std::default_random_engine e1;
std::default_random_engine e2;
std::uniform_int_distribution<int> uniform_dist;
std::normal_distribution<float> normal_dist;
public:
~signal_generator_c(); // public destructor
// Where all the action really happens
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_SIGNAL_GENERATOR_C_H */

View File

@ -45,42 +45,6 @@
class Gr_Complex_Ip_Packet_Source : virtual public gr::sync_block
{
private:
boost::mutex d_mutex;
pcap_t *descr; //ethernet pcap device descriptor
char *fifo_buff;
int fifo_read_ptr;
int fifo_write_ptr;
int fifo_items;
int d_sock_raw;
int d_udp_port;
struct sockaddr_in si_me;
std::string d_src_device;
std::string d_origin_address;
int d_udp_payload_size;
bool d_fifo_full;
int d_n_baseband_channels;
int d_wire_sample_type;
int d_bytes_per_sample;
size_t d_item_size;
bool d_IQ_swap;
boost::thread *d_pcap_thread;
/*!
* \brief
* Opens the ethernet device using libpcap raw capture mode
* If any of these fail, the fuction retuns the error and exits.
*/
bool open();
void demux_samples(gr_vector_void_star output_items, int num_samples_readed);
void my_pcap_loop_thread(pcap_t *pcap_handle);
void pcap_callback(u_char *args, const struct pcap_pkthdr *pkthdr, const u_char *packet);
static void static_pcap_callback(u_char *args, const struct pcap_pkthdr *pkthdr, const u_char *packet);
public:
typedef boost::shared_ptr<Gr_Complex_Ip_Packet_Source> sptr;
static sptr make(std::string src_device,
@ -101,15 +65,46 @@ public:
bool IQ_swap_);
~Gr_Complex_Ip_Packet_Source();
// Called by gnuradio to enable drivers, etc for i/o devices.
bool start();
// Called by gnuradio to disable drivers, etc for i/o devices.
bool stop();
// Where all the action really happens
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
// Called by gnuradio to enable drivers, etc for i/o devices.
bool start();
// Called by gnuradio to disable drivers, etc for i/o devices.
bool stop();
private:
boost::mutex d_mutex;
pcap_t *descr; //ethernet pcap device descriptor
char *fifo_buff;
int fifo_read_ptr;
int fifo_write_ptr;
int fifo_items;
int d_sock_raw;
int d_udp_port;
struct sockaddr_in si_me;
std::string d_src_device;
std::string d_origin_address;
int d_udp_payload_size;
bool d_fifo_full;
int d_n_baseband_channels;
int d_wire_sample_type;
int d_bytes_per_sample;
size_t d_item_size;
bool d_IQ_swap;
boost::thread *d_pcap_thread;
void demux_samples(gr_vector_void_star output_items, int num_samples_readed);
void my_pcap_loop_thread(pcap_t *pcap_handle);
void pcap_callback(u_char *args, const struct pcap_pkthdr *pkthdr, const u_char *packet);
static void static_pcap_callback(u_char *args, const struct pcap_pkthdr *pkthdr, const u_char *packet);
/*
* Opens the ethernet device using libpcap raw capture mode
* If any of these fail, the fuction retuns the error and exits.
*/
bool open();
};
#endif /* GNSS_SDR_GR_COMPLEX_IP_PACKET_SOURCE_H */

View File

@ -42,16 +42,34 @@ class labsat23_source;
using labsat23_source_sptr = boost::shared_ptr<labsat23_source>;
labsat23_source_sptr labsat23_make_source_sptr(const char *signal_file_basename, int channel_selector, gr::msg_queue::sptr queue);
labsat23_source_sptr labsat23_make_source_sptr(
const char *signal_file_basename,
int channel_selector,
gr::msg_queue::sptr queue);
/*!
* \brief This class implements conversion between Labsat2 and 3 format byte packet samples to gr_complex
*/
class labsat23_source : public gr::block
{
public:
~labsat23_source();
int general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
private:
friend labsat23_source_sptr labsat23_make_source_sptr(const char *signal_file_basename, int channel_selector, gr::msg_queue::sptr queue);
labsat23_source(const char *signal_file_basename, int channel_selector, gr::msg_queue::sptr queue);
friend labsat23_source_sptr labsat23_make_source_sptr(
const char *signal_file_basename,
int channel_selector,
gr::msg_queue::sptr queue);
labsat23_source(const char *signal_file_basename,
int channel_selector,
gr::msg_queue::sptr queue);
std::string generate_filename();
void decode_samples_one_channel(int16_t input_short, gr_complex *out, int type);
int getBit(uint8_t byte, int position);
@ -65,13 +83,6 @@ private:
uint8_t d_ref_clock;
uint8_t d_bits_per_sample;
gr::msg_queue::sptr d_queue;
public:
~labsat23_source();
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

View File

@ -75,7 +75,8 @@ class unpack_2bit_samples;
using unpack_2bit_samples_sptr = boost::shared_ptr<unpack_2bit_samples>;
unpack_2bit_samples_sptr make_unpack_2bit_samples(bool big_endian_bytes,
unpack_2bit_samples_sptr make_unpack_2bit_samples(
bool big_endian_bytes,
size_t item_size,
bool big_endian_items,
bool reverse_interleaving = false);
@ -87,12 +88,25 @@ unpack_2bit_samples_sptr make_unpack_2bit_samples(bool big_endian_bytes,
*/
class unpack_2bit_samples : public gr::sync_interpolator
{
private:
friend unpack_2bit_samples_sptr
make_unpack_2bit_samples_sptr(bool big_endian_bytes,
public:
~unpack_2bit_samples();
unpack_2bit_samples(bool big_endian_bytes,
size_t item_size,
bool big_endian_items,
bool reverse_interleaving);
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
private:
friend unpack_2bit_samples_sptr make_unpack_2bit_samples_sptr(
bool big_endian_bytes,
size_t item_size,
bool big_endian_items,
bool reverse_interleaving);
bool big_endian_bytes_;
size_t item_size_;
bool big_endian_items_;
@ -100,18 +114,6 @@ private:
bool swap_endian_bytes_;
bool reverse_interleaving_;
std::vector<int8_t> work_buffer_;
public:
unpack_2bit_samples(bool big_endian_bytes,
size_t item_size,
bool big_endian_items,
bool reverse_interleaving);
~unpack_2bit_samples();
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
};
#endif

View File

@ -49,15 +49,15 @@ unpack_byte_2bit_cpx_samples_sptr make_unpack_byte_2bit_cpx_samples();
*/
class unpack_byte_2bit_cpx_samples : public gr::sync_interpolator
{
private:
friend unpack_byte_2bit_cpx_samples_sptr make_unpack_byte_2bit_cpx_samples_sptr();
public:
unpack_byte_2bit_cpx_samples();
~unpack_byte_2bit_cpx_samples();
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
private:
friend unpack_byte_2bit_cpx_samples_sptr make_unpack_byte_2bit_cpx_samples_sptr();
};
#endif

View File

@ -45,16 +45,15 @@ unpack_byte_2bit_samples_sptr make_unpack_byte_2bit_samples();
*/
class unpack_byte_2bit_samples : public gr::sync_interpolator
{
private:
friend unpack_byte_2bit_samples_sptr
make_unpack_byte_2bit_samples_sptr();
public:
unpack_byte_2bit_samples();
~unpack_byte_2bit_samples();
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
private:
friend unpack_byte_2bit_samples_sptr make_unpack_byte_2bit_samples_sptr();
};
#endif

View File

@ -47,15 +47,15 @@ unpack_byte_4bit_samples_sptr make_unpack_byte_4bit_samples();
*/
class unpack_byte_4bit_samples : public gr::sync_interpolator
{
private:
friend unpack_byte_4bit_samples_sptr make_unpack_byte_4bit_samples_sptr();
public:
unpack_byte_4bit_samples();
~unpack_byte_4bit_samples();
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
private:
friend unpack_byte_4bit_samples_sptr make_unpack_byte_4bit_samples_sptr();
};
#endif

View File

@ -45,16 +45,15 @@ unpack_intspir_1bit_samples_sptr make_unpack_intspir_1bit_samples();
*/
class unpack_intspir_1bit_samples : public gr::sync_interpolator
{
private:
friend unpack_intspir_1bit_samples_sptr
make_unpack_intspir_1bit_samples_sptr();
public:
unpack_intspir_1bit_samples();
~unpack_intspir_1bit_samples();
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
private:
friend unpack_intspir_1bit_samples_sptr make_unpack_intspir_1bit_samples_sptr();
};
#endif

View File

@ -41,11 +41,13 @@
#include <cstddef> // for size_t
#include <cstdint>
boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item,
boost::shared_ptr<gr::block> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
gr::msg_queue::sptr queue);
boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item,
boost::shared_ptr<gr::block> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
gr::msg_queue::sptr queue,
bool stop_flowgraph);
@ -56,10 +58,25 @@ boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item,
*/
class Gnss_Sdr_Valve : public gr::sync_block
{
friend boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item,
public:
void open_valve();
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
Gnss_Sdr_Valve(size_t sizeof_stream_item,
uint64_t nitems,
gr::msg_queue::sptr queue, bool stop_flowgraph);
private:
friend boost::shared_ptr<gr::block> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
gr::msg_queue::sptr queue);
friend boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item,
friend boost::shared_ptr<gr::block> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
gr::msg_queue::sptr queue,
bool stop_flowgraph);
@ -69,16 +86,6 @@ class Gnss_Sdr_Valve : public gr::sync_block
gr::msg_queue::sptr d_queue;
bool d_stop_flowgraph;
bool d_open_valve;
public:
Gnss_Sdr_Valve(size_t sizeof_stream_item,
uint64_t nitems,
gr::msg_queue::sptr queue, bool stop_flowgraph);
void open_valve();
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
};
#endif /*GNSS_SDR_GNSS_SDR_VALVE_H_*/

View File

@ -41,11 +41,6 @@
*/
class Rtl_Tcp_Dongle_Info
{
private:
char magic_[4]{};
uint32_t tuner_type_;
uint32_t tuner_gain_count_;
public:
enum
{
@ -77,6 +72,11 @@ public:
{
return tuner_gain_count_;
}
private:
char magic_[4]{};
uint32_t tuner_type_;
uint32_t tuner_gain_count_;
};

View File

@ -271,7 +271,7 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga(
}
}
delete[] ca_codes_f;
volk_gnsssdr_free(ca_codes_f);
if (d_track_pilot)
{
volk_gnsssdr_free(data_codes_f);
@ -289,10 +289,10 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga(
GalileoE1DllPllVemlTrackingFpga::~GalileoE1DllPllVemlTrackingFpga()
{
delete[] d_ca_codes;
volk_gnsssdr_free(d_ca_codes);
if (d_track_pilot)
{
delete[] d_data_codes;
volk_gnsssdr_free(d_data_codes);
}
}

View File

@ -273,10 +273,10 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga(
GalileoE5aDllPllTrackingFpga::~GalileoE5aDllPllTrackingFpga()
{
delete[] d_ca_codes;
volk_gnsssdr_free(d_ca_codes);
if (d_track_pilot)
{
delete[] d_data_codes;
volk_gnsssdr_free(d_data_codes);
}
}

View File

@ -239,7 +239,7 @@ GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga(
GpsL1CaDllPllTrackingFpga::~GpsL1CaDllPllTrackingFpga()
{
delete[] d_ca_codes;
volk_gnsssdr_free(d_ca_codes);
}

View File

@ -47,6 +47,15 @@
*/
class Tracking_2nd_DLL_filter
{
public:
void set_DLL_BW(float dll_bw_hz); //!< Set DLL filter bandwidth [Hz]
void set_pdi(float pdi_code); //!< Set Summation interval for code [s]
void initialize(); //!< Start tracking with acquisition information
float get_code_nco(float DLL_discriminator); //!< Numerically controlled oscillator
Tracking_2nd_DLL_filter(float pdi_code);
Tracking_2nd_DLL_filter();
~Tracking_2nd_DLL_filter();
private:
// PLL filter parameters
float d_tau1_code = 0.0;
@ -57,15 +66,6 @@ private:
float d_old_code_error = 0.0;
float d_old_code_nco = 0.0;
void calculate_lopp_coef(float* tau1, float* tau2, float lbw, float zeta, float k);
public:
void set_DLL_BW(float dll_bw_hz); //! Set DLL filter bandwidth [Hz]
void set_pdi(float pdi_code); //! Set Summation interval for code [s]
void initialize(); //! Start tracking with acquisition information
float get_code_nco(float DLL_discriminator); //! Numerically controlled oscillator
Tracking_2nd_DLL_filter(float pdi_code);
Tracking_2nd_DLL_filter();
~Tracking_2nd_DLL_filter();
};
#endif

View File

@ -46,28 +46,25 @@
*/
class Tracking_2nd_PLL_filter
{
private:
// PLL filter parameters
float d_tau1_carr = 0.0;
float d_tau2_carr = 0.0;
float d_pdi_carr = 0.0;
float d_pllnoisebandwidth = 0.0;
float d_plldampingratio = 0.0;
float d_old_carr_error = 0.0;
float d_old_carr_nco = 0.0;
void calculate_lopp_coef(float* tau1, float* tau2, float lbw, float zeta, float k);
public:
void set_PLL_BW(float pll_bw_hz); //! Set PLL loop bandwidth [Hz]
void set_pdi(float pdi_carr); //! Set Summation interval for code [s]
void set_PLL_BW(float pll_bw_hz); //!< Set PLL loop bandwidth [Hz]
void set_pdi(float pdi_carr); //!< Set Summation interval for code [s]
void initialize();
float get_carrier_nco(float PLL_discriminator);
Tracking_2nd_PLL_filter(float pdi_carr);
Tracking_2nd_PLL_filter();
~Tracking_2nd_PLL_filter();
private:
// PLL filter parameters
float d_tau1_carr = 0.0;
float d_tau2_carr = 0.0;
float d_pdi_carr = 0.0;
float d_pllnoisebandwidth = 0.0;
float d_plldampingratio = 0.0;
float d_old_carr_error = 0.0;
float d_old_carr_nco = 0.0;
void calculate_lopp_coef(float* tau1, float* tau2, float lbw, float zeta, float k);
};
#endif

View File

@ -36,6 +36,13 @@
*/
class Tracking_FLL_PLL_filter
{
public:
void set_params(float fll_bw_hz, float pll_bw_hz, int order);
void initialize(float d_acq_carrier_doppler_hz);
float get_carrier_error(float FLL_discriminator, float PLL_discriminator, float correlation_time_s);
Tracking_FLL_PLL_filter();
~Tracking_FLL_PLL_filter();
private:
// FLL + PLL filter parameters
int d_order;
@ -49,13 +56,6 @@ private:
float d_pll_w0p2;
float d_pll_b3;
float d_pll_w0p;
public:
void set_params(float fll_bw_hz, float pll_bw_hz, int order);
void initialize(float d_acq_carrier_doppler_hz);
float get_carrier_error(float FLL_discriminator, float PLL_discriminator, float correlation_time_s);
Tracking_FLL_PLL_filter();
~Tracking_FLL_PLL_filter();
};
#endif

View File

@ -43,6 +43,27 @@
*/
class Tracking_loop_filter
{
public:
float get_noise_bandwidth(void) const;
float get_update_interval(void) const;
bool get_include_last_integrator(void) const;
int get_order(void) const;
void set_noise_bandwidth(float noise_bandwidth);
void set_update_interval(float update_interval);
void set_include_last_integrator(bool include_last_integrator);
void set_order(int loop_order);
void initialize(float initial_output = 0.0);
float apply(float current_input);
Tracking_loop_filter(float update_interval, float noise_bandwidth,
int loop_order = 2,
bool include_last_integrator = false);
Tracking_loop_filter();
~Tracking_loop_filter();
private:
// Store the last inputs and outputs:
std::vector<float> d_inputs;
@ -71,27 +92,6 @@ private:
// Compute the filter coefficients:
void update_coefficients(void);
public:
float get_noise_bandwidth(void) const;
float get_update_interval(void) const;
bool get_include_last_integrator(void) const;
int get_order(void) const;
void set_noise_bandwidth(float noise_bandwidth);
void set_update_interval(float update_interval);
void set_include_last_integrator(bool include_last_integrator);
void set_order(int loop_order);
void initialize(float initial_output = 0.0);
float apply(float current_input);
Tracking_loop_filter(float update_interval, float noise_bandwidth,
int loop_order = 2,
bool include_last_integrator = false);
Tracking_loop_filter();
~Tracking_loop_filter();
};
#endif

View File

@ -47,6 +47,13 @@ gnss_sdr_fpga_sample_counter_sptr gnss_sdr_make_fpga_sample_counter(double _fs,
class gnss_sdr_fpga_sample_counter : public gr::block
{
public:
~gnss_sdr_fpga_sample_counter();
int general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
private:
friend gnss_sdr_fpga_sample_counter_sptr gnss_sdr_make_fpga_sample_counter(double _fs, int32_t _interval_ms);
gnss_sdr_fpga_sample_counter(double _fs, int32_t _interval_ms);
@ -80,13 +87,6 @@ private:
volatile uint32_t *map_base; // driver memory map
std::string device_name = "/dev/uio2"; // HW device name
bool is_open;
public:
~gnss_sdr_fpga_sample_counter();
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_GNSS_SDR_FPGA_SAMPLE_COUNTER_H_

View File

@ -50,9 +50,22 @@ gnss_sdr_sample_counter_sptr gnss_sdr_make_sample_counter(
class gnss_sdr_sample_counter : public gr::sync_decimator
{
public:
~gnss_sdr_sample_counter();
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
private:
friend gnss_sdr_sample_counter_sptr gnss_sdr_make_sample_counter(double _fs, int32_t _interval_ms, size_t _size);
gnss_sdr_sample_counter(double _fs, int32_t _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);
gnss_sdr_sample_counter(double _fs,
int32_t _interval_ms,
size_t _size);
uint32_t samples_per_output;
double fs;
uint64_t sample_counter;
@ -67,12 +80,6 @@ private:
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:
~gnss_sdr_sample_counter();
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
};
#endif /*GNSS_SDR_GNSS_SDR_SAMPLE_COUNTER_H_*/

View File

@ -39,10 +39,10 @@
#include <glog/logging.h>
#include <pugixml.hpp>
#include <cmath> // for pow
#include <cstring> // for strcpy
#include <exception> // for exception
#include <iostream> // for cerr
#include <utility> // for pair
#include <vector>
Gnss_Sdr_Supl_Client::Gnss_Sdr_Supl_Client()
{
@ -173,14 +173,16 @@ int Gnss_Sdr_Supl_Client::get_assistance(int i_mcc, int i_mns, int i_lac, int i_
supl_set_gsm_cell(&ctx, mcc, mns, lac, ci);
// PERFORM SUPL COMMUNICATION
char* cstr = new char[server_name.length() + 1];
strcpy(cstr, server_name.c_str());
std::vector<char> cstr(server_name.length() + 1);
for (int i = 0; i != server_name.length(); ++i)
{
cstr[i] = static_cast<char>(server_name[i]);
}
int err;
ctx.p.request = request; // select assistance info request from a pre-defined set
//std::cout<<"mcc="<<mcc<<"mns="<<mns<<"lac="<<lac<<"ci="<<ci<<std::endl;
err = supl_get_assist(&ctx, cstr, &assist);
err = supl_get_assist(&ctx, cstr.data(), &assist);
if (err == 0)
{
read_supl_data();
@ -196,7 +198,6 @@ int Gnss_Sdr_Supl_Client::get_assistance(int i_mcc, int i_mns, int i_lac, int i_
*/
supl_close(&ctx);
}
delete[] cstr;
return err;
}

View File

@ -62,19 +62,10 @@ extern "C"
*/
class Gnss_Sdr_Supl_Client
{
private:
// GSM CELL INFO
int mcc;
int mns;
int lac;
int ci;
// assistance protocol structure
supl_ctx_t ctx{};
// assistance data
supl_assist_t assist{};
bool read_gal_almanac_from_gsa(const std::string& file_name);
public:
Gnss_Sdr_Supl_Client();
~Gnss_Sdr_Supl_Client();
// SUPL SERVER INFO
std::string server_name;
int server_port;
@ -113,6 +104,7 @@ public:
* \return Error code -> 0 no errors.
*/
int get_assistance(int i_mcc, int i_mns, int i_lac, int i_ci);
/*
* \brief Read the received SUPL data and stores it into the corresponding class members (gps_ephemeris_map, gps_almanac_map, gps_iono, gps_time, gps_utc, gps_acq_map, and gps_ref_loc)
*
@ -270,8 +262,17 @@ public:
*/
void print_assistance();
Gnss_Sdr_Supl_Client();
~Gnss_Sdr_Supl_Client();
private:
// GSM CELL INFO
int mcc;
int mns;
int lac;
int ci;
// assistance protocol structure
supl_ctx_t ctx{};
// assistance data
supl_assist_t assist{};
bool read_gal_almanac_from_gsa(const std::string& file_name);
};
#endif

View File

@ -45,6 +45,13 @@ gnss_sdr_time_counter_sptr gnss_sdr_make_time_counter();
class gnss_sdr_time_counter : public gr::block
{
public:
~gnss_sdr_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);
private:
gnss_sdr_time_counter();
int64_t current_T_rx_ms; // Receiver time in ms since the beginning of the run
@ -57,11 +64,6 @@ private:
uint32_t current_days; // Receiver time in days since the beginning of the run
int32_t report_interval_ms;
friend gnss_sdr_time_counter_sptr gnss_sdr_make_time_counter();
public:
~gnss_sdr_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);
};
#endif /*GNSS_SDR_GNSS_SDR_SAMPLE_COUNTER_H_*/

View File

@ -60,6 +60,12 @@ gnss_synchro_monitor_sptr gnss_synchro_make_monitor(unsigned int n_channels,
*/
class gnss_synchro_monitor : public gr::sync_block
{
public:
~gnss_synchro_monitor(); //!< Default destructor
int work(int noutput_items, gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items);
private:
friend gnss_synchro_monitor_sptr gnss_synchro_make_monitor(unsigned int n_channels,
int decimation_factor,
@ -77,12 +83,6 @@ private:
int d_decimation_factor;
std::unique_ptr<Gnss_Synchro_Udp_Sink> udp_sink_ptr;
int count;
public:
~gnss_synchro_monitor(); //!< Default destructor
int work(int noutput_items, gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items);
};
#endif

View File

@ -46,10 +46,6 @@ template <typename Data>
class Concurrent_Map
{
typedef typename std::map<int, Data>::iterator Data_iterator; // iterator is scope dependent
private:
std::map<int, Data> the_map;
boost::mutex the_mutex;
public:
void write(int key, Data const& data)
{
@ -97,6 +93,10 @@ public:
lock.unlock();
return false;
}
private:
std::map<int, Data> the_map;
boost::mutex the_mutex;
};
#endif

View File

@ -45,11 +45,6 @@ template <typename Data>
*/
class Concurrent_Queue
{
private:
std::queue<Data> the_queue;
mutable boost::mutex the_mutex;
boost::condition_variable the_condition_variable;
public:
void push(Data const& data)
{
@ -87,5 +82,10 @@ public:
popped_value = the_queue.front();
the_queue.pop();
}
private:
std::queue<Data> the_queue;
mutable boost::mutex the_mutex;
boost::condition_variable the_condition_variable;
};
#endif

View File

@ -44,18 +44,13 @@
*/
class Beidou_Dnav_Ephemeris
{
private:
/*
* Accounts for the beginning or end of week crossover
*
* See paragraph 20.3.3.3.3.1 (IS-GPS-200E)
* \param[in] - time in seconds
* \param[out] - corrected time, in seconds
*/
double check_t(double time);
public:
unsigned int i_satellite_PRN; // SV PRN NUMBER
/*!
* Default constructor
*/
Beidou_Dnav_Ephemeris();
unsigned int i_satellite_PRN; //!< SV PRN NUMBER
double d_TOW; //!< Time of BEIDOU Week of the ephemeris set (taken from subframes TOW) [s]
double d_Crs; //!< Amplitude of the Sine Harmonic Correction Term to the Orbit Radius [m]
double d_Delta_n; //!< Mean Motion Difference From Computed Value [semi-circles/s]
@ -124,6 +119,25 @@ public:
std::map<int, std::string> satelliteBlock; //!< Map that stores to which block the PRN belongs http://www.navcen.uscg.gov/?Do=constellationStatus
/*!
* \brief Compute the ECEF SV coordinates and ECEF velocity
* Implementation of Table 20-IV (IS-GPS-200E)
* and compute the clock bias term including relativistic effect (return value)
*/
double satellitePosition(double transmitTime);
/*!
* \brief Sets (\a d_satClkDrift)and returns the clock drift in seconds according to the User Algorithm for SV Clock Correction
* (IS-GPS-200E, 20.3.3.3.3.1)
*/
double sv_clock_drift(double transmitTime);
/*!
* \brief Sets (\a d_dtr) and returns the clock relativistic correction term in seconds according to the User Algorithm for SV Clock Correction
* (IS-GPS-200E, 20.3.3.3.3.1)
*/
double sv_clock_relativistic_term(double transmitTime);
template <class Archive>
/*!
@ -177,30 +191,15 @@ public:
archive& make_nvp("b_antispoofing_flag", b_antispoofing_flag); //!< If true, the AntiSpoofing mode is ON in that SV
}
/*!
* \brief Compute the ECEF SV coordinates and ECEF velocity
* Implementation of Table 20-IV (IS-GPS-200E)
* and compute the clock bias term including relativistic effect (return value)
private:
/*
* Accounts for the beginning or end of week crossover
*
* See paragraph 20.3.3.3.3.1 (IS-GPS-200E)
* \param[in] - time in seconds
* \param[out] - corrected time, in seconds
*/
double satellitePosition(double transmitTime);
/*!
* \brief Sets (\a d_satClkDrift)and returns the clock drift in seconds according to the User Algorithm for SV Clock Correction
* (IS-GPS-200E, 20.3.3.3.3.1)
*/
double sv_clock_drift(double transmitTime);
/*!
* \brief Sets (\a d_dtr) and returns the clock relativistic correction term in seconds according to the User Algorithm for SV Clock Correction
* (IS-GPS-200E, 20.3.3.3.3.1)
*/
double sv_clock_relativistic_term(double transmitTime);
/*!
* Default constructor
*/
Beidou_Dnav_Ephemeris();
double check_t(double time);
};
#endif

View File

@ -54,19 +54,6 @@
*/
class Beidou_Dnav_Navigation_Message
{
private:
uint64_t read_navigation_unsigned(std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
int64_t read_navigation_signed(std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
bool read_navigation_bool(std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
void print_beidou_word_bytes(uint32_t BEIDOU_word);
/*
* Accounts for the beginning or end of week crossover
*
* \param[in] - time in seconds
* \param[out] - corrected time, in seconds
*/
double check_t(double time);
public:
/*!
* Default constructor
@ -321,6 +308,20 @@ public:
* \brief Returns true if new UTC model has arrived. The flag is set to false when the function is executed
*/
bool have_new_almanac();
private:
uint64_t read_navigation_unsigned(std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
int64_t read_navigation_signed(std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
bool read_navigation_bool(std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
void print_beidou_word_bytes(uint32_t BEIDOU_word);
/*
* Accounts for the beginning or end of week crossover
*
* \param[in] - time in seconds
* \param[out] - corrected time, in seconds
*/
double check_t(double time);
};
#endif

View File

@ -52,14 +52,9 @@
*/
class Galileo_Navigation_Message
{
private:
bool CRC_test(std::bitset<GALILEO_DATA_FRAME_BITS> bits, uint32_t checksum);
bool read_navigation_bool(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t> >& parameter);
uint64_t read_navigation_unsigned(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t> >& parameter);
uint64_t read_page_type_unsigned(std::bitset<GALILEO_PAGE_TYPE_BITS> bits, const std::vector<std::pair<int32_t, int32_t> >& parameter);
int64_t read_navigation_signed(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t> >& parameter);
public:
Galileo_Navigation_Message();
int32_t Page_type_time_stamp;
int32_t flag_even_word;
std::string page_Even;
@ -293,7 +288,12 @@ public:
*/
Galileo_Almanac_Helper get_almanac();
Galileo_Navigation_Message();
private:
bool CRC_test(std::bitset<GALILEO_DATA_FRAME_BITS> bits, uint32_t checksum);
bool read_navigation_bool(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t> >& parameter);
uint64_t read_navigation_unsigned(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t> >& parameter);
uint64_t read_page_type_unsigned(std::bitset<GALILEO_PAGE_TYPE_BITS> bits, const std::vector<std::pair<int32_t, int32_t> >& parameter);
int64_t read_navigation_signed(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t> >& parameter);
};
#endif /* GALILEO_NAVIGATION_MESSAGE_H_ */

View File

@ -46,17 +46,12 @@
*/
class Glonass_Gnav_Ephemeris
{
private:
/*
* Accounts for the beginning or end of week crossover
*
* See paragraph 20.3.3.3.3.1 (IS-GPS-200E)
* \param[in] - time in seconds
* \param[out] - corrected time, in seconds
*/
double check_t(double time);
public:
/*!
* Default constructor
*/
Glonass_Gnav_Ephemeris();
double d_m; //!< String number within frame [dimensionless]
double d_t_k; //!< GLONASS Time (UTC(SU) + 3 h) referenced to the beginning of the frame within the current day [s]
double d_t_b; //!< Reference ephemeris relative time in GLONASS Time (UTC(SU) + 3 h). Index of a time interval within current day according to UTC(SU) + 03 hours 00 min. [s]
@ -100,6 +95,38 @@ public:
double d_WN; //!< GLONASST IN GPST week number of the start of frame
double d_tod; //!< Time of Day since ephemeris where decoded
/*!
* \brief Sets (\a d_satClkDrift)and returns the clock drift in seconds according to the User Algorithm for SV Clock Correction
* (IS-GPS-200E, 20.3.3.3.3.1)
*/
double sv_clock_drift(double transmitTime, double timeCorrUTC);
/*!
* \brief Computes the GLONASS System Time and returns a boost::posix_time::ptime object
* \ param offset_time Is the start of day offset to compute the time
*/
boost::posix_time::ptime compute_GLONASS_time(const double offset_time) const;
/*!
* \brief Converts from GLONASST to UTC
* \details The function simply adjust for the 6 hrs offset between GLONASST and UTC
* \param[in] offset_time Is the start of day offset
* \param[in] glot2utc_corr Correction from GLONASST to UTC
* \returns UTC time as a boost::posix_time::ptime object
*/
boost::posix_time::ptime glot_to_utc(const double offset_time, const double glot2utc_corr) const;
/*!
* \brief Converts from GLONASST to GPST
* \details Converts from GLONASST to GPST in time of week (TOW) and week number (WN) format
* \param[in] tod_offset Is the start of day offset
* \param[in] glot2utc_corr Correction from GLONASST to UTC
* \param[in] glot2gpst_corr Correction from GLONASST to GPST
* \param[out] WN Week Number, not in mod(1024) format
* \param[out] TOW Time of Week in seconds of week
*/
void glot_to_gpst(double tod_offset, double glot2utc_corr, double glot2gpst_corr, double* WN, double* TOW) const;
template <class Archive>
/*!
@ -145,42 +172,15 @@ public:
archive& make_nvp("d_l5th_n", d_l5th_n); //!< Health flag for nth satellite; ln = 0 indicates the n-th satellite is helthy, ln = 1 indicates malfunction of this nth satellite [dimensionless]
}
/*!
* \brief Sets (\a d_satClkDrift)and returns the clock drift in seconds according to the User Algorithm for SV Clock Correction
* (IS-GPS-200E, 20.3.3.3.3.1)
private:
/*
* Accounts for the beginning or end of week crossover
*
* See paragraph 20.3.3.3.3.1 (IS-GPS-200E)
* \param[in] - time in seconds
* \param[out] - corrected time, in seconds
*/
double sv_clock_drift(double transmitTime, double timeCorrUTC);
/*!
* \brief Computes the GLONASS System Time and returns a boost::posix_time::ptime object
* \ param offset_time Is the start of day offset to compute the time
*/
boost::posix_time::ptime compute_GLONASS_time(const double offset_time) const;
/*!
* \brief Converts from GLONASST to UTC
* \details The function simply adjust for the 6 hrs offset between GLONASST and UTC
* \param[in] offset_time Is the start of day offset
* \param[in] glot2utc_corr Correction from GLONASST to UTC
* \returns UTC time as a boost::posix_time::ptime object
*/
boost::posix_time::ptime glot_to_utc(const double offset_time, const double glot2utc_corr) const;
/*!
* \brief Converts from GLONASST to GPST
* \details Converts from GLONASST to GPST in time of week (TOW) and week number (WN) format
* \param[in] tod_offset Is the start of day offset
* \param[in] glot2utc_corr Correction from GLONASST to UTC
* \param[in] glot2gpst_corr Correction from GLONASST to GPST
* \param[out] WN Week Number, not in mod(1024) format
* \param[out] TOW Time of Week in seconds of week
*/
void glot_to_gpst(double tod_offset, double glot2utc_corr, double glot2gpst_corr, double* WN, double* TOW) const;
/*!
* Default constructor
*/
Glonass_Gnav_Ephemeris();
double check_t(double time);
};
#endif

View File

@ -41,9 +41,9 @@
#include "glonass_gnav_utc_model.h"
#include <bitset>
#include <cstdint>
#include <string>
#include <utility> // for pair
#include <vector> // for vector
#include <string>
/*!
@ -53,12 +53,12 @@
*/
class Glonass_Gnav_Navigation_Message
{
private:
uint64_t read_navigation_unsigned(std::bitset<GLONASS_GNAV_STRING_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
int64_t read_navigation_signed(std::bitset<GLONASS_GNAV_STRING_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
bool read_navigation_bool(std::bitset<GLONASS_GNAV_STRING_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
public:
/*!
* Default constructor
*/
Glonass_Gnav_Navigation_Message();
bool flag_CRC_test;
uint32_t d_frame_ID;
uint32_t d_string_ID;
@ -164,10 +164,10 @@ public:
*/
int32_t string_decoder(const std::string& frame_string);
/*!
* Default constructor
*/
Glonass_Gnav_Navigation_Message();
private:
uint64_t read_navigation_unsigned(std::bitset<GLONASS_GNAV_STRING_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
int64_t read_navigation_signed(std::bitset<GLONASS_GNAV_STRING_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
bool read_navigation_bool(std::bitset<GLONASS_GNAV_STRING_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
};
#endif

View File

@ -45,6 +45,11 @@
class Glonass_Gnav_Utc_Model
{
public:
/*!
* Default constructor
*/
Glonass_Gnav_Utc_Model();
bool valid;
// Clock Parameters
double d_tau_c; //!< GLONASS time scale correction to UTC(SU) time. [s]
@ -54,6 +59,12 @@ public:
double d_B1; //!< Coefficient to determine DeltaUT1 [s]
double d_B2; //!< Coefficient to determine DeltaUT1 [s/msd]
/*!
* \brief Computes the Coordinated Universal Time (UTC) and
* returns it in [s] (GLONASS ICD (Edition 5.1) Section 3.3.3 GLONASS Time)
*/
double utc_time(double glonass_time_corrected);
template <class Archive>
/*!
* \brief Serialize is a boost standard method to be called by the boost XML serialization. Here is used to save the almanac data on disk file.
@ -72,17 +83,6 @@ public:
archive& make_nvp("d_B1", d_B1);
archive& make_nvp("d_B2", d_B2);
}
/*!
* Default constructor
*/
Glonass_Gnav_Utc_Model();
/*!
* \brief Computes the Coordinated Universal Time (UTC) and
* returns it in [s] (GLONASS ICD (Edition 5.1) Section 3.3.3 GLONASS Time)
*/
double utc_time(double glonass_time_corrected);
};
#endif

View File

@ -43,10 +43,6 @@
*/
class Gnss_Signal
{
private:
Gnss_Satellite satellite;
std::string signal;
public:
Gnss_Signal();
Gnss_Signal(const std::string& signal_);
@ -57,6 +53,10 @@ public:
friend bool operator==(const Gnss_Signal& /*sig1*/, const Gnss_Signal& /*sig2*/); //!< operator== for comparison
friend std::ostream& operator<<(std::ostream& /*out*/, const Gnss_Signal& /*sig*/); //!< operator<< for pretty printing
private:
Gnss_Satellite satellite;
std::string signal;
};
#endif

View File

@ -43,10 +43,12 @@
*/
class Gps_CNAV_Ephemeris
{
private:
double check_t(double time);
public:
/*!
* Default constructor
*/
Gps_CNAV_Ephemeris();
uint32_t i_satellite_PRN; // SV PRN NUMBER
// Message Types 10 and 11 Parameters (1 of 2)
@ -122,6 +124,24 @@ public:
double d_satvel_Y; //!< Earth-fixed velocity coordinate y of the satellite [m]
double d_satvel_Z; //!< Earth-fixed velocity coordinate z of the satellite [m]
/*!
* \brief Compute the ECEF SV coordinates and ECEF velocity
* Implementation of Table 20-IV (IS-GPS-200E)
*/
double satellitePosition(double transmitTime);
/*!
* \brief Sets (\a d_satClkDrift)and returns the clock drift in seconds according to the User Algorithm for SV Clock Correction
* (IS-GPS-200E, 20.3.3.3.3.1)
*/
double sv_clock_drift(double transmitTime);
/*!
* \brief Sets (\a d_dtr) and returns the clock relativistic correction term in seconds according to the User Algorithm for SV Clock Correction
* (IS-GPS-200E, 20.3.3.3.3.1)
*/
double sv_clock_relativistic_term(double transmitTime);
template <class Archive>
/*!
@ -170,27 +190,8 @@ public:
archive& make_nvp("b_antispoofing_flag", b_antispoofing_flag); //!< If true, the AntiSpoofing mode is ON in that SV
}
/*!
* \brief Compute the ECEF SV coordinates and ECEF velocity
* Implementation of Table 20-IV (IS-GPS-200E)
*/
double satellitePosition(double transmitTime);
/*!
* \brief Sets (\a d_satClkDrift)and returns the clock drift in seconds according to the User Algorithm for SV Clock Correction
* (IS-GPS-200E, 20.3.3.3.3.1)
*/
double sv_clock_drift(double transmitTime);
/*!
* \brief Sets (\a d_dtr) and returns the clock relativistic correction term in seconds according to the User Algorithm for SV Clock Correction
* (IS-GPS-200E, 20.3.3.3.3.1)
*/
double sv_clock_relativistic_term(double transmitTime);
/*!
* Default constructor
*/
Gps_CNAV_Ephemeris();
private:
double check_t(double time);
};
#endif

View File

@ -55,16 +55,12 @@
*/
class Gps_CNAV_Navigation_Message
{
private:
uint64_t read_navigation_unsigned(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
int64_t read_navigation_signed(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
bool read_navigation_bool(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
Gps_CNAV_Ephemeris ephemeris_record;
Gps_CNAV_Iono iono_record;
Gps_CNAV_Utc_Model utc_model_record;
public:
/*!
* Default constructor
*/
Gps_CNAV_Navigation_Message();
int32_t d_TOW;
bool b_flag_ephemeris_1;
bool b_flag_ephemeris_2;
@ -122,10 +118,14 @@ public:
*/
bool have_new_ephemeris();
/*!
* Default constructor
*/
Gps_CNAV_Navigation_Message();
private:
uint64_t read_navigation_unsigned(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
int64_t read_navigation_signed(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
bool read_navigation_bool(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
Gps_CNAV_Ephemeris ephemeris_record;
Gps_CNAV_Iono iono_record;
Gps_CNAV_Utc_Model utc_model_record;
};
#endif

View File

@ -46,17 +46,12 @@
*/
class Gps_Ephemeris
{
private:
/*
* Accounts for the beginning or end of week crossover
*
* See paragraph 20.3.3.3.3.1 (IS-GPS-200E)
* \param[in] - time in seconds
* \param[out] - corrected time, in seconds
*/
double check_t(double time);
public:
/*!
* Default constructor
*/
Gps_Ephemeris();
uint32_t i_satellite_PRN; // SV PRN NUMBER
int32_t d_TOW; //!< Time of GPS Week of the ephemeris set (taken from subframes TOW) [s]
double d_Crs; //!< Amplitude of the Sine Harmonic Correction Term to the Orbit Radius [m]
@ -127,6 +122,25 @@ public:
std::map<int, std::string> satelliteBlock; //!< Map that stores to which block the PRN belongs http://www.navcen.uscg.gov/?Do=constellationStatus
/*!
* \brief Compute the ECEF SV coordinates and ECEF velocity
* Implementation of Table 20-IV (IS-GPS-200E)
* and compute the clock bias term including relativistic effect (return value)
*/
double satellitePosition(double transmitTime);
/*!
* \brief Sets (\a d_satClkDrift)and returns the clock drift in seconds according to the User Algorithm for SV Clock Correction
* (IS-GPS-200E, 20.3.3.3.3.1)
*/
double sv_clock_drift(double transmitTime);
/*!
* \brief Sets (\a d_dtr) and returns the clock relativistic correction term in seconds according to the User Algorithm for SV Clock Correction
* (IS-GPS-200E, 20.3.3.3.3.1)
*/
double sv_clock_relativistic_term(double transmitTime);
template <class Archive>
/*!
@ -182,29 +196,15 @@ public:
archive& make_nvp("b_antispoofing_flag", b_antispoofing_flag); //!< If true, the AntiSpoofing mode is ON in that SV
}
/*!
* \brief Compute the ECEF SV coordinates and ECEF velocity
* Implementation of Table 20-IV (IS-GPS-200E)
* and compute the clock bias term including relativistic effect (return value)
private:
/*
* Accounts for the beginning or end of week crossover
*
* See paragraph 20.3.3.3.3.1 (IS-GPS-200E)
* \param[in] - time in seconds
* \param[out] - corrected time, in seconds
*/
double satellitePosition(double transmitTime);
/*!
* \brief Sets (\a d_satClkDrift)and returns the clock drift in seconds according to the User Algorithm for SV Clock Correction
* (IS-GPS-200E, 20.3.3.3.3.1)
*/
double sv_clock_drift(double transmitTime);
/*!
* \brief Sets (\a d_dtr) and returns the clock relativistic correction term in seconds according to the User Algorithm for SV Clock Correction
* (IS-GPS-200E, 20.3.3.3.3.1)
*/
double sv_clock_relativistic_term(double transmitTime);
/*!
* Default constructor
*/
Gps_Ephemeris();
double check_t(double time);
};
#endif

View File

@ -52,13 +52,12 @@
*/
class Gps_Navigation_Message
{
private:
uint64_t read_navigation_unsigned(std::bitset<GPS_SUBFRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
int64_t read_navigation_signed(std::bitset<GPS_SUBFRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
bool read_navigation_bool(std::bitset<GPS_SUBFRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
void print_gps_word_bytes(uint32_t GPS_word);
public:
/*!
* Default constructor
*/
Gps_Navigation_Message();
bool b_valid_ephemeris_set_flag; // flag indicating that this ephemeris set have passed the validation check
// broadcast orbit 1
int32_t d_TOW; //!< Time of GPS Week of the ephemeris set (taken from subframes TOW) [s]
@ -208,10 +207,11 @@ public:
bool satellite_validation();
/*!
* Default constructor
*/
Gps_Navigation_Message();
private:
uint64_t read_navigation_unsigned(std::bitset<GPS_SUBFRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
int64_t read_navigation_signed(std::bitset<GPS_SUBFRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
bool read_navigation_bool(std::bitset<GPS_SUBFRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
void print_gps_word_bytes(uint32_t GPS_word);
};
#endif

View File

@ -43,10 +43,8 @@ class Sbas_Ephemeris
public:
void print(std::ostream &out);
int i_prn; //!< PRN number
//gtime_t t0; // reference epoch time (GPST)
int i_t0;
//gtime_t tof; // time of message frame (GPST)
double d_tof;
int i_t0; //!< Reference epoch time (GPST)
double d_tof; //!< Time of message frame (GPST)
int i_sv_ura; //!< SV accuracy (URA index), not standardized
bool b_sv_do_not_use; //!< Health status (false:do not use / true:usable)
double d_pos[3]; //!< Satellite position (m) (ECEF)