1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 12:40:35 +00:00

Improved sample counter block

This commit is contained in:
Javier Arribas 2018-07-26 19:19:23 +02:00
parent 09936dc37d
commit f162182ffe
2 changed files with 10 additions and 1 deletions

View File

@ -39,10 +39,12 @@
gnss_sdr_sample_counter::gnss_sdr_sample_counter(double _fs, size_t _size) : gr::sync_decimator("sample_counter", gnss_sdr_sample_counter::gnss_sdr_sample_counter(double _fs, size_t _size) : gr::sync_decimator("sample_counter",
gr::io_signature::make(1, 1, _size), gr::io_signature::make(1, 1, _size),
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)), gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
static_cast<unsigned int>(std::floor(_fs * 0.001))) static_cast<unsigned int>(std::round(_fs * 0.001)))
{ {
message_port_register_out(pmt::mp("sample_counter")); message_port_register_out(pmt::mp("sample_counter"));
set_max_noutput_items(1); set_max_noutput_items(1);
samples_per_output = std::round(_fs * 0.001);
sample_counter = 0;
current_T_rx_ms = 0; current_T_rx_ms = 0;
current_s = 0; current_s = 0;
current_m = 0; current_m = 0;
@ -69,6 +71,9 @@ int gnss_sdr_sample_counter::work(int noutput_items __attribute__((unused)),
{ {
Gnss_Synchro *out = reinterpret_cast<Gnss_Synchro *>(output_items[0]); Gnss_Synchro *out = reinterpret_cast<Gnss_Synchro *>(output_items[0]);
out[0] = Gnss_Synchro(); out[0] = Gnss_Synchro();
out[0].Flag_valid_symbol_output = false;
out[0].Flag_valid_word = false;
out[0].Channel_ID = -1;
if ((current_T_rx_ms % report_interval_ms) == 0) if ((current_T_rx_ms % report_interval_ms) == 0)
{ {
current_s++; current_s++;
@ -127,6 +132,8 @@ int gnss_sdr_sample_counter::work(int noutput_items __attribute__((unused)),
message_port_pub(pmt::mp("receiver_time"), pmt::from_double(static_cast<double>(current_T_rx_ms) / 1000.0)); message_port_pub(pmt::mp("receiver_time"), pmt::from_double(static_cast<double>(current_T_rx_ms) / 1000.0));
} }
} }
sample_counter += samples_per_output;
out[0].Tracking_sample_counter = sample_counter;
current_T_rx_ms++; current_T_rx_ms++;
return 1; return 1;
} }

View File

@ -45,6 +45,8 @@ class gnss_sdr_sample_counter : public gr::sync_decimator
{ {
private: private:
gnss_sdr_sample_counter(double _fs, size_t _size); gnss_sdr_sample_counter(double _fs, size_t _size);
unsigned int samples_per_output;
unsigned long int sample_counter;
long long int current_T_rx_ms; // Receiver time in ms since the beginning of the run long long int current_T_rx_ms; // Receiver time in ms since the beginning of the run
unsigned int current_s; // Receiver time in seconds, modulo 60 unsigned int current_s; // Receiver time in seconds, modulo 60
bool flag_m; // True if the receiver has been running for at least 1 minute bool flag_m; // True if the receiver has been running for at least 1 minute