Improve constructors, remove unused members

This commit is contained in:
Carles Fernandez 2021-10-10 18:56:14 +02:00
parent 446b7cfbea
commit 3fc7a27cec
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
49 changed files with 291 additions and 396 deletions

View File

@ -34,7 +34,7 @@ BeidouB1iTelemetryDecoder::BeidouB1iTelemetryDecoder(
// make telemetry decoder object
telemetry_decoder_ = beidou_b1i_make_telemetry_decoder_gs(satellite_, tlm_parameters_);
DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")";
channel_ = 0;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";

View File

@ -49,8 +49,6 @@ public:
unsigned int in_streams,
unsigned int out_streams);
~BeidouB1iTelemetryDecoder() = default;
void connect(gr::top_block_sptr top_block) override;
void disconnect(gr::top_block_sptr top_block) override;
gr::basic_block_sptr get_left_block() override;
@ -86,7 +84,6 @@ private:
Gnss_Satellite satellite_;
Tlm_Conf tlm_parameters_;
std::string role_;
int channel_;
unsigned int in_streams_;
unsigned int out_streams_;
};

View File

@ -20,16 +20,19 @@
#include <glog/logging.h>
BeidouB3iTelemetryDecoder::BeidouB3iTelemetryDecoder(
const ConfigurationInterface *configuration, const std::string &role,
unsigned int in_streams, unsigned int out_streams)
: role_(role), in_streams_(in_streams), out_streams_(out_streams)
const ConfigurationInterface *configuration,
const std::string &role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams)
{
DLOG(INFO) << "role " << role;
tlm_parameters_.SetFromConfiguration(configuration, role);
// make telemetry decoder object
telemetry_decoder_ = beidou_b3i_make_telemetry_decoder_gs(satellite_, tlm_parameters_);
DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")";
channel_ = 0;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";

View File

@ -47,8 +47,6 @@ public:
const std::string &role, unsigned int in_streams,
unsigned int out_streams);
~BeidouB3iTelemetryDecoder() = default;
void connect(gr::top_block_sptr top_block) override;
void disconnect(gr::top_block_sptr top_block) override;
gr::basic_block_sptr get_left_block() override;
@ -81,7 +79,6 @@ private:
Gnss_Satellite satellite_;
Tlm_Conf tlm_parameters_;
std::string role_;
int channel_;
unsigned int in_streams_;
unsigned int out_streams_;
};

View File

@ -36,7 +36,7 @@ GalileoE1BTelemetryDecoder::GalileoE1BTelemetryDecoder(
// make telemetry decoder object
telemetry_decoder_ = galileo_make_telemetry_decoder_gs(satellite_, tlm_parameters_, 1); // unified galileo decoder set to INAV (frame_type=1)
DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")";
channel_ = 0;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";

View File

@ -50,8 +50,6 @@ public:
unsigned int in_streams,
unsigned int out_streams);
~GalileoE1BTelemetryDecoder() = default;
void connect(gr::top_block_sptr top_block) override;
void disconnect(gr::top_block_sptr top_block) override;
gr::basic_block_sptr get_left_block() override;
@ -89,7 +87,6 @@ private:
Gnss_Satellite satellite_;
Tlm_Conf tlm_parameters_;
std::string role_;
int channel_;
unsigned int in_streams_;
unsigned int out_streams_;
};

View File

@ -38,7 +38,7 @@ GalileoE5aTelemetryDecoder::GalileoE5aTelemetryDecoder(
// make telemetry decoder object
telemetry_decoder_ = galileo_make_telemetry_decoder_gs(satellite_, tlm_parameters_, 2); // unified galileo decoder set to FNAV (frame_type=2)
DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")";
channel_ = 0;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";

View File

@ -52,8 +52,6 @@ public:
unsigned int in_streams,
unsigned int out_streams);
~GalileoE5aTelemetryDecoder() = default;
void connect(gr::top_block_sptr top_block) override;
void disconnect(gr::top_block_sptr top_block) override;
gr::basic_block_sptr get_left_block() override;
@ -91,7 +89,6 @@ private:
Gnss_Satellite satellite_;
Tlm_Conf tlm_parameters_;
std::string role_;
int channel_;
unsigned int in_streams_;
unsigned int out_streams_;
};

View File

@ -36,7 +36,7 @@ GalileoE5bTelemetryDecoder::GalileoE5bTelemetryDecoder(
// make telemetry decoder object
telemetry_decoder_ = galileo_make_telemetry_decoder_gs(satellite_, tlm_parameters_, 1); // unified galileo decoder set to INAV (frame_type=1)
DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")";
channel_ = 0;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";

View File

@ -50,8 +50,6 @@ public:
unsigned int in_streams,
unsigned int out_streams);
~GalileoE5bTelemetryDecoder() = default;
/*!
* \brief Returns "Galileo_E5b_Telemetry_Decoder"
*/
@ -104,7 +102,6 @@ private:
Gnss_Satellite satellite_;
Tlm_Conf tlm_parameters_;
std::string role_;
int channel_;
unsigned int in_streams_;
unsigned int out_streams_;
};

View File

@ -35,7 +35,7 @@ GalileoE6TelemetryDecoder::GalileoE6TelemetryDecoder(
// make telemetry decoder object
telemetry_decoder_ = galileo_make_telemetry_decoder_gs(satellite_, tlm_parameters_, 3); // unified galileo decoder set to CNAV (frame_type=3)
DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")";
channel_ = 0;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";

View File

@ -49,8 +49,6 @@ public:
unsigned int in_streams,
unsigned int out_streams);
~GalileoE6TelemetryDecoder() = default;
/*!
* \brief Returns "Galileo_E6_Telemetry_Decoder"
*/
@ -103,7 +101,6 @@ private:
Gnss_Satellite satellite_;
Tlm_Conf tlm_parameters_;
std::string role_;
int channel_;
unsigned int in_streams_;
unsigned int out_streams_;
};

View File

@ -35,7 +35,7 @@ GlonassL1CaTelemetryDecoder::GlonassL1CaTelemetryDecoder(
// make telemetry decoder object
telemetry_decoder_ = glonass_l1_ca_make_telemetry_decoder_gs(satellite_, tlm_parameters_);
DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")";
channel_ = 0;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";

View File

@ -49,8 +49,6 @@ public:
unsigned int in_streams,
unsigned int out_streams);
~GlonassL1CaTelemetryDecoder() = default;
void connect(gr::top_block_sptr top_block) override;
void disconnect(gr::top_block_sptr top_block) override;
gr::basic_block_sptr get_left_block() override;
@ -85,7 +83,6 @@ private:
Gnss_Satellite satellite_;
Tlm_Conf tlm_parameters_;
std::string role_;
int channel_;
unsigned int in_streams_;
unsigned int out_streams_;
};

View File

@ -34,7 +34,7 @@ GlonassL2CaTelemetryDecoder::GlonassL2CaTelemetryDecoder(
// make telemetry decoder object
telemetry_decoder_ = glonass_l2_ca_make_telemetry_decoder_gs(satellite_, tlm_parameters_);
DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")";
channel_ = 0;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";

View File

@ -48,8 +48,6 @@ public:
unsigned int in_streams,
unsigned int out_streams);
~GlonassL2CaTelemetryDecoder() = default;
void connect(gr::top_block_sptr top_block) override;
void disconnect(gr::top_block_sptr top_block) override;
gr::basic_block_sptr get_left_block() override;
@ -84,7 +82,6 @@ private:
Gnss_Satellite satellite_;
Tlm_Conf tlm_parameters_;
std::string role_;
int channel_;
unsigned int in_streams_;
unsigned int out_streams_;
};

View File

@ -34,7 +34,7 @@ GpsL1CaTelemetryDecoder::GpsL1CaTelemetryDecoder(
// make telemetry decoder object
telemetry_decoder_ = gps_l1_ca_make_telemetry_decoder_gs(satellite_, tlm_parameters_);
DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")";
channel_ = 0;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";

View File

@ -51,8 +51,6 @@ public:
unsigned int in_streams,
unsigned int out_streams);
~GpsL1CaTelemetryDecoder() = default;
void connect(gr::top_block_sptr top_block) override;
void disconnect(gr::top_block_sptr top_block) override;
gr::basic_block_sptr get_left_block() override;
@ -88,7 +86,6 @@ private:
Gnss_Satellite satellite_;
Tlm_Conf tlm_parameters_;
std::string role_;
int channel_;
unsigned int in_streams_;
unsigned int out_streams_;
};

View File

@ -34,7 +34,7 @@ GpsL2CTelemetryDecoder::GpsL2CTelemetryDecoder(
// make telemetry decoder object
telemetry_decoder_ = gps_l2c_make_telemetry_decoder_gs(satellite_, tlm_parameters_);
DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")";
channel_ = 0;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";

View File

@ -49,8 +49,6 @@ public:
unsigned int in_streams,
unsigned int out_streams);
~GpsL2CTelemetryDecoder() = default;
inline std::string role() override
{
return role_;
@ -86,7 +84,6 @@ private:
Gnss_Satellite satellite_;
Tlm_Conf tlm_parameters_;
std::string role_;
int channel_;
unsigned int in_streams_;
unsigned int out_streams_;
};

View File

@ -34,7 +34,7 @@ GpsL5TelemetryDecoder::GpsL5TelemetryDecoder(
// make telemetry decoder object
telemetry_decoder_ = gps_l5_make_telemetry_decoder_gs(satellite_, tlm_parameters_);
DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")";
channel_ = 0;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";

View File

@ -49,8 +49,6 @@ public:
unsigned int in_streams,
unsigned int out_streams);
~GpsL5TelemetryDecoder() = default;
inline std::string role() override
{
return role_;
@ -87,7 +85,6 @@ private:
Tlm_Conf tlm_parameters_;
std::string dump_filename_;
std::string role_;
int channel_;
unsigned int in_streams_;
unsigned int out_streams_;
};

View File

@ -35,7 +35,7 @@ SbasL1TelemetryDecoder::SbasL1TelemetryDecoder(
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename);
// make telemetry decoder object
telemetry_decoder_ = sbas_l1_make_telemetry_decoder_gs(satellite_, dump_); // TODO fix me
channel_ = 0;
DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")";
if (in_streams_ > 1)
{

View File

@ -47,8 +47,6 @@ public:
unsigned int in_streams,
unsigned int out_streams);
~SbasL1TelemetryDecoder() = default;
inline std::string role() override
{
return role_;
@ -86,7 +84,6 @@ private:
Gnss_Satellite satellite_;
std::string dump_filename_;
std::string role_;
int channel_;
unsigned int in_streams_;
unsigned int out_streams_;
bool dump_;

View File

@ -45,11 +45,36 @@ beidou_b1i_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_
return beidou_b1i_telemetry_decoder_gs_sptr(new beidou_b1i_telemetry_decoder_gs(satellite, conf));
}
beidou_b1i_telemetry_decoder_gs::beidou_b1i_telemetry_decoder_gs(
const Gnss_Satellite &satellite,
const Tlm_Conf &conf) : gr::block("beidou_b1i_telemetry_decoder_gs",
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))),
d_dump_filename(conf.dump_filename),
d_sample_counter(0),
d_preamble_index(0),
d_channel(0),
d_symbols_per_preamble(BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS),
d_samples_per_preamble(BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS),
d_preamble_period_samples(BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS),
d_CRC_error_counter(0),
d_required_symbols(BEIDOU_DNAV_SUBFRAME_SYMBOLS + BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS),
d_stat(0),
d_last_valid_preamble(0),
d_symbol_duration_ms(BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B1I_CODE_PERIOD_MS),
d_TOW_at_Preamble_ms(0U),
d_TOW_at_current_symbol_ms(0U),
d_flag_SOW_set(false),
d_flag_frame_sync(false),
d_flag_preamble(false),
d_flag_valid_word(false),
d_sent_tlm_failed_msg(false),
d_dump(conf.dump),
d_dump_mat(conf.dump_mat),
d_remove_dat(conf.remove_dat),
d_enable_navdata_monitor(conf.enable_navdata_monitor),
d_dump_crc_stats(conf.dump_crc_stats)
{
// prevent telemetry symbols accumulation in output buffers
this->set_max_noutput_items(1);
@ -57,7 +82,7 @@ beidou_b1i_telemetry_decoder_gs::beidou_b1i_telemetry_decoder_gs(
this->message_port_register_out(pmt::mp("telemetry"));
// Control messages to tracking block
this->message_port_register_out(pmt::mp("telemetry_to_trk"));
d_enable_navdata_monitor = conf.enable_navdata_monitor;
if (d_enable_navdata_monitor)
{
// register nav message monitor out
@ -66,19 +91,9 @@ beidou_b1i_telemetry_decoder_gs::beidou_b1i_telemetry_decoder_gs(
d_nav_msg_packet.signal = std::string("B1");
}
// initialize internal vars
d_dump_filename = conf.dump_filename;
d_dump = conf.dump;
d_dump_mat = conf.dump_mat;
d_remove_dat = conf.remove_dat;
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
LOG(INFO) << "Initializing BeiDou B1I Telemetry Decoding for satellite " << this->d_satellite;
d_symbol_duration_ms = BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B1I_CODE_PERIOD_MS;
d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
d_preamble_period_samples = BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS;
// Setting samples of preamble code
for (int32_t i = 0; i < d_symbols_per_preamble; i++)
{
@ -92,26 +107,8 @@ beidou_b1i_telemetry_decoder_gs::beidou_b1i_telemetry_decoder_gs(
}
}
d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS + d_samples_per_preamble;
d_symbol_history.set_capacity(d_required_symbols);
d_last_valid_preamble = 0;
d_sent_tlm_failed_msg = false;
d_flag_valid_word = false;
// Generic settings
d_sample_counter = 0;
d_stat = 0;
d_preamble_index = 0;
d_flag_frame_sync = false;
d_TOW_at_current_symbol_ms = 0U;
d_TOW_at_Preamble_ms = 0U;
Flag_valid_word = false;
d_CRC_error_counter = 0;
d_flag_preamble = false;
d_channel = 0;
flag_SOW_set = false;
d_dump_crc_stats = conf.dump_crc_stats;
d_dump_crc_stats = conf.dump_crc_stats;
if (d_dump_crc_stats)
{
// initialize the telemetry CRC statistics class
@ -531,7 +528,7 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_
DLOG(INFO) << "BeiDou DNAV frame sync lost for SAT " << this->d_satellite;
d_flag_frame_sync = false;
d_stat = 0;
flag_SOW_set = false;
d_flag_SOW_set = false;
}
}
}
@ -588,7 +585,7 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_
DLOG(INFO) << "BeiDou DNAV frame sync lost for SAT " << this->d_satellite;
d_flag_frame_sync = false;
d_stat = 0;
flag_SOW_set = false;
d_flag_SOW_set = false;
}
}
}
@ -604,7 +601,7 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_
const uint32_t last_d_TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms;
// compute new TOW
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + d_required_symbols * d_symbol_duration_ms;
flag_SOW_set = true;
d_flag_SOW_set = true;
d_nav.set_flag_new_SOW_available(false);
if (last_d_TOW_at_current_symbol_ms != 0 && abs(static_cast<int64_t>(d_TOW_at_current_symbol_ms) - int64_t(last_d_TOW_at_current_symbol_ms)) > static_cast<int64_t>(d_symbol_duration_ms))

View File

@ -57,7 +57,7 @@ beidou_b1i_telemetry_decoder_gs_sptr beidou_b1i_make_telemetry_decoder_gs(
class beidou_b1i_telemetry_decoder_gs : public gr::block
{
public:
~beidou_b1i_telemetry_decoder_gs(); //!< Class destructor
~beidou_b1i_telemetry_decoder_gs() override; //!< Class destructor
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
void set_channel(int channel); //!< Set receiver's channel
void reset();
@ -66,7 +66,7 @@ public:
* \brief This is where all signal processing takes place
*/
int general_work(int noutput_items, gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) override;
private:
friend beidou_b1i_telemetry_decoder_gs_sptr beidou_b1i_make_telemetry_decoder_gs(
@ -115,13 +115,12 @@ private:
uint32_t d_TOW_at_Preamble_ms;
uint32_t d_TOW_at_current_symbol_ms;
bool flag_SOW_set; // Indicates when time of week is set
bool d_flag_SOW_set; // Indicates when time of week is set
bool d_flag_frame_sync; // Indicate when a frame sync is achieved
bool d_flag_preamble; // Flag indicating when preamble was found
bool d_flag_valid_word;
bool d_sent_tlm_failed_msg;
bool Flag_valid_word;
bool d_dump;
bool d_dump_mat;
bool d_remove_dat;

View File

@ -49,7 +49,31 @@ beidou_b3i_telemetry_decoder_gs::beidou_b3i_telemetry_decoder_gs(
const Gnss_Satellite &satellite, const Tlm_Conf &conf)
: gr::block("beidou_b3i_telemetry_decoder_gs",
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))),
d_dump_filename(conf.dump_filename),
d_sample_counter(0),
d_preamble_index(0),
d_required_symbols(BEIDOU_DNAV_SUBFRAME_SYMBOLS + BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS),
d_stat(0),
d_channel(0),
d_CRC_error_counter(0),
d_symbols_per_preamble(BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS),
d_samples_per_preamble(BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS),
d_preamble_period_samples(BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS),
d_last_valid_preamble(0),
d_symbol_duration_ms(BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B3I_CODE_PERIOD_MS),
d_TOW_at_Preamble_ms(0U),
d_TOW_at_current_symbol_ms(0U),
d_flag_SOW_set(false),
d_flag_frame_sync(false),
d_flag_preamble(false),
d_flag_valid_word(false),
d_sent_tlm_failed_msg(false),
d_dump(conf.dump),
d_dump_mat(conf.dump_mat),
d_remove_dat(conf.remove_dat),
d_enable_navdata_monitor(conf.enable_navdata_monitor),
d_dump_crc_stats(conf.dump_crc_stats)
{
// prevent telemetry symbols accumulation in output buffers
this->set_max_noutput_items(1);
@ -57,7 +81,7 @@ beidou_b3i_telemetry_decoder_gs::beidou_b3i_telemetry_decoder_gs(
this->message_port_register_out(pmt::mp("telemetry"));
// Control messages to tracking block
this->message_port_register_out(pmt::mp("telemetry_to_trk"));
d_enable_navdata_monitor = conf.enable_navdata_monitor;
if (d_enable_navdata_monitor)
{
// register nav message monitor out
@ -65,19 +89,10 @@ beidou_b3i_telemetry_decoder_gs::beidou_b3i_telemetry_decoder_gs(
d_nav_msg_packet.system = std::string("C");
d_nav_msg_packet.signal = std::string("B3");
}
// initialize internal vars
d_dump_filename = conf.dump_filename;
d_dump = conf.dump;
d_dump_mat = conf.dump_mat;
d_remove_dat = conf.remove_dat;
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
LOG(INFO) << "Initializing BeiDou B3I Telemetry Decoding for satellite " << this->d_satellite;
d_symbol_duration_ms = BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B3I_CODE_PERIOD_MS;
d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
d_preamble_period_samples = BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS;
// Setting samples of preamble code
for (int32_t i = 0; i < d_symbols_per_preamble; i++)
{
@ -91,25 +106,8 @@ beidou_b3i_telemetry_decoder_gs::beidou_b3i_telemetry_decoder_gs(
}
}
d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS + d_samples_per_preamble;
d_symbol_history.set_capacity(d_required_symbols);
d_last_valid_preamble = 0;
d_sent_tlm_failed_msg = false;
d_flag_valid_word = false;
// Generic settings
d_sample_counter = 0;
d_stat = 0;
d_preamble_index = 0;
d_flag_frame_sync = false;
d_TOW_at_current_symbol_ms = 0U;
d_TOW_at_Preamble_ms = 0U;
Flag_valid_word = false;
d_CRC_error_counter = 0;
d_flag_preamble = false;
d_channel = 0;
flag_SOW_set = false;
d_dump_crc_stats = conf.dump_crc_stats;
if (d_dump_crc_stats)
{
// initialize the telemetry CRC statistics class
@ -556,7 +554,7 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
<< this->d_satellite;
d_flag_frame_sync = false;
d_stat = 0;
flag_SOW_set = false;
d_flag_SOW_set = false;
}
}
}
@ -616,7 +614,7 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
<< this->d_satellite;
d_flag_frame_sync = false;
d_stat = 0;
flag_SOW_set = false;
d_flag_SOW_set = false;
}
}
}
@ -632,7 +630,7 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
const uint32_t last_d_TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms;
// compute new TOW
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + d_required_symbols * d_symbol_duration_ms;
flag_SOW_set = true;
d_flag_SOW_set = true;
d_nav.set_flag_new_SOW_available(false);
if (last_d_TOW_at_current_symbol_ms != 0 && abs(static_cast<int64_t>(d_TOW_at_current_symbol_ms) - int64_t(last_d_TOW_at_current_symbol_ms)) > static_cast<int64_t>(d_symbol_duration_ms))

View File

@ -54,7 +54,7 @@ beidou_b3i_telemetry_decoder_gs_sptr beidou_b3i_make_telemetry_decoder_gs(
class beidou_b3i_telemetry_decoder_gs : public gr::block
{
public:
~beidou_b3i_telemetry_decoder_gs(); //!< Class destructor
~beidou_b3i_telemetry_decoder_gs() override; //!< Class destructor
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
void set_channel(int channel); //!< Set receiver's channel
void reset();
@ -64,7 +64,7 @@ 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);
gr_vector_void_star &output_items) override;
private:
friend beidou_b3i_telemetry_decoder_gs_sptr beidou_b3i_make_telemetry_decoder_gs(
@ -112,12 +112,11 @@ private:
uint32_t d_TOW_at_Preamble_ms;
uint32_t d_TOW_at_current_symbol_ms;
bool flag_SOW_set; // Indicates when time of week is set
bool d_flag_SOW_set; // Indicates when time of week is set
bool d_flag_frame_sync; // Indicate when a frame sync is achieved
bool d_flag_preamble; // Flag indicating when preamble was found
bool d_flag_valid_word;
bool d_sent_tlm_failed_msg;
bool Flag_valid_word;
bool d_dump;
bool d_dump_mat;
bool d_remove_dat;

View File

@ -58,7 +58,33 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs(
const Gnss_Satellite &satellite,
const Tlm_Conf &conf,
int frame_type) : gr::block("galileo_telemetry_decoder_gs", gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))),
d_dump_filename(conf.dump_filename),
d_delta_t(0),
d_sample_counter(0ULL),
d_preamble_index(0ULL),
d_last_valid_preamble(0),
d_frame_type(frame_type),
d_CRC_error_counter(0),
d_channel(0),
d_flag_even_word_arrived(0),
d_stat(0),
d_TOW_at_Preamble_ms(0),
d_TOW_at_current_symbol_ms(0),
d_band('1'),
d_sent_tlm_failed_msg(false),
d_flag_frame_sync(false),
d_flag_PLL_180_deg_phase_locked(false),
d_flag_preamble(false),
d_dump(conf.dump),
d_dump_mat(conf.dump_mat),
d_remove_dat(conf.remove_dat),
d_first_eph_sent(false),
d_cnav_dummy_page(false),
d_print_cnav_page(true),
d_enable_navdata_monitor(conf.enable_navdata_monitor),
d_dump_crc_stats(conf.dump_crc_stats),
d_enable_reed_solomon_inav(false)
{
// prevent telemetry symbols accumulation in output buffers
this->set_max_noutput_items(1);
@ -68,24 +94,14 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs(
this->message_port_register_out(pmt::mp("telemetry_to_trk"));
// register Gal E6 messages HAS out
this->message_port_register_out(pmt::mp("E6_HAS_from_TLM"));
d_enable_navdata_monitor = conf.enable_navdata_monitor;
if (d_enable_navdata_monitor)
{
// register nav message monitor out
this->message_port_register_out(pmt::mp("Nav_msg_from_TLM"));
}
d_last_valid_preamble = 0;
d_sent_tlm_failed_msg = false;
d_band = '1';
// initialize internal vars
d_dump_filename = conf.dump_filename;
d_dump = conf.dump;
d_dump_mat = conf.dump_mat;
d_remove_dat = conf.remove_dat;
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
d_frame_type = frame_type;
d_enable_reed_solomon_inav = false;
// Viterbi decoder vars
const int32_t nn = 2; // Coding rate 1/n
@ -95,7 +111,6 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs(
DLOG(INFO) << "Initializing GALILEO UNIFIED TELEMETRY DECODER";
d_dump_crc_stats = conf.dump_crc_stats;
if (d_dump_crc_stats)
{
// initialize the telemetry CRC statistics class
@ -106,6 +121,7 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs(
{
d_Tlm_CRC_Stats = nullptr;
}
switch (d_frame_type)
{
case 1: // INAV
@ -216,27 +232,10 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs(
}
}
}
d_sample_counter = 0ULL;
d_stat = 0;
d_preamble_index = 0ULL;
d_flag_frame_sync = false;
d_flag_parity = false;
d_TOW_at_current_symbol_ms = 0;
d_TOW_at_Preamble_ms = 0;
d_delta_t = 0;
d_CRC_error_counter = 0;
flag_even_word_arrived = 0;
d_flag_preamble = false;
d_channel = 0;
d_flag_PLL_180_deg_phase_locked = false;
d_symbol_history.set_capacity(d_required_symbols + 1);
d_cnav_dummy_page = false;
d_print_cnav_page = true;
d_inav_nav.init_PRN(d_satellite.get_PRN());
d_first_eph_sent = false;
// Instantiate the Viterbi decoder
d_viterbi = std::make_unique<Viterbi_Decoder>(KK, nn, d_datalength, g_encoder);
@ -300,7 +299,6 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in
// 2. Viterbi decoder
// 2.1 Take into account the NOT gate in G2 polynomial (Galileo ICD Figure 13, FEC encoder)
// 2.2 Take into account the possible inversion of the polarity due to PLL lock at 180º
for (int32_t i = 0; i < frame_length; i++)
{
if ((i + 1) % 2 == 0)
@ -335,7 +333,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in
if (page_part_bits[0] == 1)
{
// DECODE COMPLETE WORD (even + odd) and TEST CRC
d_inav_nav.split_page(page_String, flag_even_word_arrived);
d_inav_nav.split_page(page_String, d_flag_even_word_arrived);
if (d_inav_nav.get_flag_CRC_test() == true)
{
if (d_band == '1')
@ -358,13 +356,13 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in
DLOG(INFO) << "Galileo E5b CRC error in channel " << d_channel << " from satellite " << d_satellite;
}
}
flag_even_word_arrived = 0;
d_flag_even_word_arrived = 0;
}
else
{
// STORE HALF WORD (even page)
d_inav_nav.split_page(page_String, flag_even_word_arrived);
flag_even_word_arrived = 1;
d_inav_nav.split_page(page_String, d_flag_even_word_arrived);
d_flag_even_word_arrived = 1;
}
// 4. Push the new navigation data to the queues
@ -452,7 +450,6 @@ void galileo_telemetry_decoder_gs::decode_FNAV_word(float *page_symbols, int32_t
// 2. Viterbi decoder
// 2.1 Take into account the NOT gate in G2 polynomial (Galileo ICD Figure 13, FEC encoder)
// 2.2 Take into account the possible inversion of the polarity due to PLL lock at 180 degrees
for (int32_t i = 0; i < frame_length; i++)
{
if ((i + 1) % 2 == 0)

View File

@ -59,17 +59,16 @@ galileo_telemetry_decoder_gs_sptr galileo_make_telemetry_decoder_gs(
class galileo_telemetry_decoder_gs : public gr::block
{
public:
~galileo_telemetry_decoder_gs();
~galileo_telemetry_decoder_gs() override;
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
void set_channel(int32_t channel); //!< Set receiver's channel
void reset();
int32_t flag_even_word_arrived;
/*!
* \brief This is where all signal processing takes place
*/
int general_work(int noutput_items, gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) override;
private:
@ -119,6 +118,7 @@ private:
int32_t d_preamble_period_symbols;
int32_t d_CRC_error_counter;
int32_t d_channel;
int32_t d_flag_even_word_arrived;
uint32_t d_PRN_code_period_ms;
uint32_t d_required_symbols;
@ -133,7 +133,6 @@ private:
bool d_sent_tlm_failed_msg;
bool d_flag_frame_sync;
bool d_flag_PLL_180_deg_phase_locked;
bool d_flag_parity;
bool d_flag_preamble;
bool d_dump;
bool d_dump_mat;

View File

@ -46,7 +46,22 @@ glonass_l1_ca_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, const T
glonass_l1_ca_telemetry_decoder_gs::glonass_l1_ca_telemetry_decoder_gs(
const Gnss_Satellite &satellite,
const Tlm_Conf &conf) : gr::block("glonass_l1_ca_telemetry_decoder_gs", gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))),
d_dump_filename(conf.dump_filename),
d_preamble_time_samples(0),
d_TOW_at_current_symbol(0),
d_sample_counter(0ULL),
d_preamble_index(0ULL),
d_stat(0),
d_CRC_error_counter(0),
d_channel(0),
d_flag_frame_sync(false),
d_flag_preamble(false),
d_dump(conf.dump),
d_dump_mat(conf.dump_mat),
d_remove_dat(conf.remove_dat),
d_enable_navdata_monitor(conf.enable_navdata_monitor),
d_dump_crc_stats(conf.dump_crc_stats)
{
// prevent telemetry symbols accumulation in output buffers
this->set_max_noutput_items(1);
@ -54,7 +69,7 @@ glonass_l1_ca_telemetry_decoder_gs::glonass_l1_ca_telemetry_decoder_gs(
this->message_port_register_out(pmt::mp("telemetry"));
// Control messages to tracking block
this->message_port_register_out(pmt::mp("telemetry_to_trk"));
d_enable_navdata_monitor = conf.enable_navdata_monitor;
if (d_enable_navdata_monitor)
{
// register nav message monitor out
@ -62,11 +77,7 @@ glonass_l1_ca_telemetry_decoder_gs::glonass_l1_ca_telemetry_decoder_gs(
d_nav_msg_packet.system = std::string("R");
d_nav_msg_packet.signal = std::string("1G");
}
// initialize internal vars
d_dump_filename = conf.dump_filename;
d_dump = conf.dump;
d_dump_mat = conf.dump_mat;
d_remove_dat = conf.remove_dat;
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
LOG(INFO) << "Initializing GLONASS L1 CA TELEMETRY DECODING";
@ -89,21 +100,7 @@ glonass_l1_ca_telemetry_decoder_gs::glonass_l1_ca_telemetry_decoder_gs(
}
d_symbol_history.set_capacity(GLONASS_GNAV_STRING_SYMBOLS);
d_sample_counter = 0ULL;
d_stat = 0;
d_preamble_index = 0ULL;
d_flag_frame_sync = false;
d_flag_parity = false;
d_TOW_at_current_symbol = 0;
Flag_valid_word = false;
delta_t = 0;
d_CRC_error_counter = 0;
d_flag_preamble = false;
d_channel = 0;
flag_TOW_set = false;
d_preamble_time_samples = 0;
d_dump_crc_stats = conf.dump_crc_stats;
if (d_dump_crc_stats)
{
// initialize the telemetry CRC statistics class

View File

@ -59,18 +59,16 @@ glonass_l1_ca_telemetry_decoder_gs_sptr glonass_l1_ca_make_telemetry_decoder_gs(
class glonass_l1_ca_telemetry_decoder_gs : public gr::block
{
public:
~glonass_l1_ca_telemetry_decoder_gs(); //!< Class destructor
~glonass_l1_ca_telemetry_decoder_gs() override; //!< Class destructor
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
void set_channel(int32_t channel); //!< Set receiver's channel
inline void reset()
{
return;
}
inline void reset() {};
/*!
* \brief This is where all signal processing takes place
*/
int general_work(int noutput_items, gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) override;
private:
friend glonass_l1_ca_telemetry_decoder_gs_sptr glonass_l1_ca_make_telemetry_decoder_gs(
@ -106,7 +104,6 @@ private:
double d_preamble_time_samples;
double d_TOW_at_current_symbol;
double delta_t; // GPS-GLONASS time offset
// Variables for internal functionality
uint64_t d_sample_counter; // Sample counter as an index (1,2,3,..etc) indicating number of samples processed
@ -117,10 +114,7 @@ private:
int32_t d_channel;
bool d_flag_frame_sync; // Indicate when a frame sync is achieved
bool d_flag_parity; // Flag indicating when parity check was achieved (crc check)
bool d_flag_preamble; // Flag indicating when preamble was found
bool flag_TOW_set; // Indicates when time of week is set
bool Flag_valid_word;
bool d_dump;
bool d_dump_mat;
bool d_remove_dat;

View File

@ -46,7 +46,22 @@ glonass_l2_ca_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, const T
glonass_l2_ca_telemetry_decoder_gs::glonass_l2_ca_telemetry_decoder_gs(
const Gnss_Satellite &satellite,
const Tlm_Conf &conf) : gr::block("glonass_l2_ca_telemetry_decoder_gs", gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))),
d_dump_filename(conf.dump_filename),
d_preamble_time_samples(0),
d_TOW_at_current_symbol(0),
d_sample_counter(0ULL),
d_preamble_index(0ULL),
d_stat(0),
d_CRC_error_counter(0),
d_channel(0),
d_flag_frame_sync(false),
d_flag_preamble(false),
d_dump(conf.dump),
d_dump_mat(conf.dump_mat),
d_remove_dat(conf.remove_dat),
d_enable_navdata_monitor(conf.enable_navdata_monitor),
d_dump_crc_stats(conf.dump_crc_stats)
{
// prevent telemetry symbols accumulation in output buffers
this->set_max_noutput_items(1);
@ -54,7 +69,7 @@ glonass_l2_ca_telemetry_decoder_gs::glonass_l2_ca_telemetry_decoder_gs(
this->message_port_register_out(pmt::mp("telemetry"));
// Control messages to tracking block
this->message_port_register_out(pmt::mp("telemetry_to_trk"));
d_enable_navdata_monitor = conf.enable_navdata_monitor;
if (d_enable_navdata_monitor)
{
// register nav message monitor out
@ -62,11 +77,7 @@ glonass_l2_ca_telemetry_decoder_gs::glonass_l2_ca_telemetry_decoder_gs(
d_nav_msg_packet.system = std::string("R");
d_nav_msg_packet.signal = std::string("2G");
}
// initialize internal vars
d_dump_filename = conf.dump_filename;
d_dump = conf.dump;
d_dump_mat = conf.dump_mat;
d_remove_dat = conf.remove_dat;
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
LOG(INFO) << "Initializing GLONASS L2 CA TELEMETRY DECODING";
@ -89,20 +100,6 @@ glonass_l2_ca_telemetry_decoder_gs::glonass_l2_ca_telemetry_decoder_gs(
}
d_symbol_history.set_capacity(GLONASS_GNAV_STRING_SYMBOLS);
d_sample_counter = 0ULL;
d_stat = 0;
d_preamble_index = 0ULL;
d_flag_frame_sync = false;
d_flag_parity = false;
d_TOW_at_current_symbol = 0;
Flag_valid_word = false;
delta_t = 0;
d_CRC_error_counter = 0;
d_flag_preamble = false;
d_channel = 0;
flag_TOW_set = false;
d_preamble_time_samples = 0;
d_dump_crc_stats = conf.dump_crc_stats;
if (d_dump_crc_stats)
{

View File

@ -57,18 +57,16 @@ glonass_l2_ca_telemetry_decoder_gs_sptr glonass_l2_ca_make_telemetry_decoder_gs(
class glonass_l2_ca_telemetry_decoder_gs : public gr::block
{
public:
~glonass_l2_ca_telemetry_decoder_gs(); //!< Class destructor
~glonass_l2_ca_telemetry_decoder_gs() override; //!< Class destructor
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
void set_channel(int32_t channel); //!< Set receiver's channel
inline void reset()
{
return;
}
inline void reset() {};
/*!
* \brief This is where all signal processing takes place
*/
int general_work(int noutput_items, gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) override;
private:
friend glonass_l2_ca_telemetry_decoder_gs_sptr glonass_l2_ca_make_telemetry_decoder_gs(
@ -99,7 +97,6 @@ private:
std::ofstream d_dump_file;
double d_preamble_time_samples;
double delta_t; // GPS-GLONASS time offset
double d_TOW_at_current_symbol;
uint64_t d_sample_counter; // Sample counter as an index (1,2,3,..etc) indicating number of samples processed
@ -109,11 +106,8 @@ private:
int32_t d_CRC_error_counter; // Number of failed CRC operations
int32_t d_channel;
bool Flag_valid_word;
bool d_flag_frame_sync; // Indicate when a frame sync is achieved
bool d_flag_parity; // Flag indicating when parity check was achieved (crc check)
bool d_flag_preamble; // Flag indicating when preamble was found
bool flag_TOW_set; // Indicates when time of week is set
bool d_dump;
bool d_dump_mat;
bool d_remove_dat;

View File

@ -61,16 +61,39 @@ gps_l1_ca_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_C
gps_l1_ca_telemetry_decoder_gs::gps_l1_ca_telemetry_decoder_gs(
const Gnss_Satellite &satellite,
const Tlm_Conf &conf) : gr::block("gps_navigation_gs", gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))),
d_dump_filename(conf.dump_filename),
d_sample_counter(0ULL),
d_preamble_index(0ULL),
d_last_valid_preamble(0),
d_bits_per_preamble(GPS_CA_PREAMBLE_LENGTH_BITS),
d_samples_per_preamble(GPS_CA_PREAMBLE_LENGTH_BITS),
d_preamble_period_symbols(GPS_SUBFRAME_BITS),
d_CRC_error_counter(0),
d_channel(0),
d_required_symbols(GPS_SUBFRAME_BITS),
d_prev_GPS_frame_4bytes(0),
d_stat(0),
d_TOW_at_Preamble_ms(0),
d_TOW_at_current_symbol_ms(0),
d_flag_frame_sync(false),
d_flag_preamble(false),
d_sent_tlm_failed_msg(false),
d_flag_PLL_180_deg_phase_locked(false),
d_flag_TOW_set(false),
d_dump(conf.dump),
d_dump_mat(conf.dump_mat),
d_remove_dat(conf.remove_dat),
d_enable_navdata_monitor(conf.enable_navdata_monitor),
d_dump_crc_stats(conf.dump_crc_stats)
{
// prevent telemetry symbols accumulation in output buffers
this->set_max_noutput_items(1);
// Ephemeris data port out
this->message_port_register_out(pmt::mp("telemetry"));
// Control messages to tracking block
this->message_port_register_out(pmt::mp("telemetry_to_trk"));
d_enable_navdata_monitor = conf.enable_navdata_monitor;
if (d_enable_navdata_monitor)
{
// register nav message monitor out
@ -79,25 +102,11 @@ gps_l1_ca_telemetry_decoder_gs::gps_l1_ca_telemetry_decoder_gs(
d_nav_msg_packet.signal = std::string("1C");
}
d_last_valid_preamble = 0;
d_sent_tlm_failed_msg = false;
// initialize internal vars
d_dump_filename = conf.dump_filename;
d_dump = conf.dump;
d_dump_mat = conf.dump_mat;
d_remove_dat = conf.remove_dat;
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
DLOG(INFO) << "Initializing GPS L1 TELEMETRY DECODER";
d_bits_per_preamble = GPS_CA_PREAMBLE_LENGTH_BITS;
d_samples_per_preamble = d_bits_per_preamble;
d_preamble_period_symbols = GPS_SUBFRAME_BITS;
// set the preamble
d_required_symbols = GPS_SUBFRAME_BITS;
// preamble bits to sampled symbols
d_frame_length_symbols = GPS_SUBFRAME_BITS * GPS_CA_TELEMETRY_SYMBOLS_PER_BIT;
d_max_symbols_without_valid_frame = d_required_symbols * 20; // rise alarm 120 segs without valid tlm
int32_t n = 0;
for (int32_t i = 0; i < d_bits_per_preamble; i++)
@ -113,24 +122,9 @@ gps_l1_ca_telemetry_decoder_gs::gps_l1_ca_telemetry_decoder_gs(
n++;
}
}
d_sample_counter = 0ULL;
d_stat = 0;
d_preamble_index = 0ULL;
d_flag_frame_sync = false;
d_flag_parity = false;
d_TOW_at_current_symbol_ms = 0;
d_TOW_at_Preamble_ms = 0;
d_CRC_error_counter = 0;
d_flag_preamble = false;
d_channel = 0;
d_flag_TOW_set = false;
d_flag_PLL_180_deg_phase_locked = false;
d_prev_GPS_frame_4bytes = 0;
d_symbol_history.set_capacity(d_required_symbols);
d_dump_crc_stats = conf.dump_crc_stats;
if (d_dump_crc_stats)
{
// initialize the telemetry CRC statistics class

View File

@ -55,7 +55,7 @@ gps_l1_ca_telemetry_decoder_gs_sptr gps_l1_ca_make_telemetry_decoder_gs(
class gps_l1_ca_telemetry_decoder_gs : public gr::block
{
public:
~gps_l1_ca_telemetry_decoder_gs();
~gps_l1_ca_telemetry_decoder_gs() override;
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
void set_channel(int channel); //!< Set receiver's channel
void reset();
@ -64,7 +64,7 @@ public:
* \brief This is where all signal processing takes place
*/
int general_work(int noutput_items, gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) override;
private:
friend gps_l1_ca_telemetry_decoder_gs_sptr gps_l1_ca_make_telemetry_decoder_gs(
@ -99,7 +99,6 @@ private:
int32_t d_channel;
uint32_t d_required_symbols;
uint32_t d_frame_length_symbols;
uint32_t d_prev_GPS_frame_4bytes;
uint32_t d_max_symbols_without_valid_frame;
uint32_t d_stat;
@ -107,7 +106,6 @@ private:
uint32_t d_TOW_at_current_symbol_ms;
bool d_flag_frame_sync;
bool d_flag_parity;
bool d_flag_preamble;
bool d_sent_tlm_failed_msg;
bool d_flag_PLL_180_deg_phase_locked;

View File

@ -47,7 +47,21 @@ gps_l2c_telemetry_decoder_gs::gps_l2c_telemetry_decoder_gs(
const Gnss_Satellite &satellite,
const Tlm_Conf &conf) : gr::block("gps_l2c_telemetry_decoder_gs",
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))),
d_dump_filename(conf.dump_filename),
d_TOW_at_current_symbol(0),
d_TOW_at_Preamble(0),
d_sample_counter(0),
d_last_valid_preamble(0),
d_channel(0),
d_dump(conf.dump),
d_sent_tlm_failed_msg(false),
d_flag_PLL_180_deg_phase_locked(false),
d_flag_valid_word(false),
d_dump_mat(conf.dump_mat),
d_remove_dat(conf.remove_dat),
d_enable_navdata_monitor(conf.enable_navdata_monitor),
d_dump_crc_stats(conf.dump_crc_stats)
{
// prevent telemetry symbols accumulation in output buffers
this->set_max_noutput_items(1);
@ -55,7 +69,7 @@ gps_l2c_telemetry_decoder_gs::gps_l2c_telemetry_decoder_gs(
this->message_port_register_out(pmt::mp("telemetry"));
// Control messages to tracking block
this->message_port_register_out(pmt::mp("telemetry_to_trk"));
d_enable_navdata_monitor = conf.enable_navdata_monitor;
if (d_enable_navdata_monitor)
{
// register nav message monitor out
@ -64,32 +78,14 @@ gps_l2c_telemetry_decoder_gs::gps_l2c_telemetry_decoder_gs(
d_nav_msg_packet.signal = std::string("2S");
}
d_last_valid_preamble = 0;
d_sent_tlm_failed_msg = false;
d_max_symbols_without_valid_frame = GPS_L2_CNAV_DATA_PAGE_BITS * GPS_L2_SYMBOLS_PER_BIT * 5; // rise alarm if 5 consecutive subframes have no valid CRC
// initialize internal vars
d_dump_filename = conf.dump_filename;
d_dump = conf.dump;
d_dump_mat = conf.dump_mat;
d_remove_dat = conf.remove_dat;
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
DLOG(INFO) << "GPS L2C M TELEMETRY PROCESSING: satellite " << d_satellite;
// set_output_multiple (1);
d_channel = 0;
d_flag_valid_word = false;
d_TOW_at_current_symbol = 0;
d_TOW_at_Preamble = 0;
d_state = 0; // initial state
d_crc_error_count = 0;
// initialize the CNAV frame decoder (libswiftcnav)
cnav_msg_decoder_init(&d_cnav_decoder);
d_sample_counter = 0;
d_flag_PLL_180_deg_phase_locked = false;
d_dump_crc_stats = conf.dump_crc_stats;
if (d_dump_crc_stats)
{
// initialize the telemetry CRC statistics class

View File

@ -56,7 +56,7 @@ gps_l2c_telemetry_decoder_gs_sptr gps_l2c_make_telemetry_decoder_gs(
class gps_l2c_telemetry_decoder_gs : public gr::block
{
public:
~gps_l2c_telemetry_decoder_gs();
~gps_l2c_telemetry_decoder_gs() override;
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
void set_channel(int32_t channel); //!< Set receiver's channel
void reset();
@ -65,7 +65,7 @@ public:
* \brief This is where all signal processing takes place
*/
int general_work(int noutput_items, gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) override;
private:
friend gps_l2c_telemetry_decoder_gs_sptr gps_l2c_make_telemetry_decoder_gs(
@ -93,8 +93,6 @@ private:
uint64_t d_last_valid_preamble;
int32_t d_channel;
int32_t d_state;
int32_t d_crc_error_count;
uint32_t d_max_symbols_without_valid_frame;

View File

@ -32,7 +32,6 @@
#include <cstdlib> // for std::llabs
#include <exception> // for std::exception
#include <iostream> // for std::cout
#include <memory> // for shared_ptr, make_shared
gps_l5_telemetry_decoder_gs_sptr
gps_l5_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_Conf &conf)
@ -45,7 +44,21 @@ gps_l5_telemetry_decoder_gs::gps_l5_telemetry_decoder_gs(
const Gnss_Satellite &satellite,
const Tlm_Conf &conf) : gr::block("gps_l5_telemetry_decoder_gs",
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))),
d_dump_filename(conf.dump_filename),
d_sample_counter(0),
d_last_valid_preamble(0),
d_channel(0),
d_TOW_at_current_symbol_ms(0U),
d_TOW_at_Preamble_ms(0U),
d_flag_PLL_180_deg_phase_locked(false),
d_flag_valid_word(false),
d_sent_tlm_failed_msg(false),
d_dump(conf.dump),
d_dump_mat(conf.dump_mat),
d_remove_dat(conf.remove_dat),
d_enable_navdata_monitor(conf.enable_navdata_monitor),
d_dump_crc_stats(conf.dump_crc_stats)
{
// prevent telemetry symbols accumulation in output buffers
this->set_max_noutput_items(1);
@ -53,7 +66,7 @@ gps_l5_telemetry_decoder_gs::gps_l5_telemetry_decoder_gs(
this->message_port_register_out(pmt::mp("telemetry"));
// Control messages to tracking block
this->message_port_register_out(pmt::mp("telemetry_to_trk"));
d_enable_navdata_monitor = conf.enable_navdata_monitor;
if (d_enable_navdata_monitor)
{
// register nav message monitor out
@ -62,28 +75,14 @@ gps_l5_telemetry_decoder_gs::gps_l5_telemetry_decoder_gs(
d_nav_msg_packet.signal = std::string("L5");
}
d_last_valid_preamble = 0;
d_sent_tlm_failed_msg = false;
d_max_symbols_without_valid_frame = GPS_L5_CNAV_DATA_PAGE_BITS * GPS_L5_SYMBOLS_PER_BIT * 10; // rise alarm if 20 consecutive subframes have no valid CRC
// initialize internal vars
d_dump_filename = conf.dump_filename;
d_dump = conf.dump;
d_dump_mat = conf.dump_mat;
d_remove_dat = conf.remove_dat;
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
DLOG(INFO) << "GPS L5 TELEMETRY PROCESSING: satellite " << d_satellite;
d_channel = 0;
d_flag_valid_word = false;
d_TOW_at_current_symbol_ms = 0U;
d_TOW_at_Preamble_ms = 0U;
// initialize the CNAV frame decoder (libswiftcnav)
cnav_msg_decoder_init(&d_cnav_decoder);
d_sample_counter = 0;
d_flag_PLL_180_deg_phase_locked = false;
d_dump_crc_stats = conf.dump_crc_stats;
if (d_dump_crc_stats)
{
// initialize the telemetry CRC statistics class

View File

@ -58,12 +58,12 @@ gps_l5_telemetry_decoder_gs_sptr gps_l5_make_telemetry_decoder_gs(
class gps_l5_telemetry_decoder_gs : public gr::block
{
public:
~gps_l5_telemetry_decoder_gs();
~gps_l5_telemetry_decoder_gs() override;
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
void set_channel(int32_t channel); //!< Set receiver's channel
void reset();
int general_work(int noutput_items, gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) override;
private:
friend gps_l5_telemetry_decoder_gs_sptr gps_l5_make_telemetry_decoder_gs(

View File

@ -45,7 +45,10 @@ sbas_l1_telemetry_decoder_gs::sbas_l1_telemetry_decoder_gs(
const Gnss_Satellite &satellite,
bool dump) : gr::block("sbas_l1_telemetry_decoder_gs",
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))),
d_dump(dump),
d_channel(0),
d_block_size(D_SAMPLES_PER_SYMBOL * D_SYMBOLS_PER_BIT * D_BLOCK_SIZE_IN_BITS)
{
// prevent telemetry symbols accumulation in output buffers
this->set_max_noutput_items(1);
@ -54,11 +57,9 @@ sbas_l1_telemetry_decoder_gs::sbas_l1_telemetry_decoder_gs(
// Control messages to tracking block
this->message_port_register_out(pmt::mp("telemetry_to_trk"));
// initialize internal vars
d_dump = dump;
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
LOG(INFO) << "SBAS L1 TELEMETRY PROCESSING: satellite " << d_satellite;
d_block_size = D_SAMPLES_PER_SYMBOL * D_SYMBOLS_PER_BIT * D_BLOCK_SIZE_IN_BITS;
d_channel = 0;
set_output_multiple(1);
}
@ -96,8 +97,6 @@ void sbas_l1_telemetry_decoder_gs::set_channel(int32_t channel)
// ### helper class for sample alignment ###
sbas_l1_telemetry_decoder_gs::Sample_Aligner::Sample_Aligner()
{
d_n_smpls_in_history = 3;
d_iir_par = 0.05;
reset();
}
@ -175,13 +174,11 @@ bool sbas_l1_telemetry_decoder_gs::Sample_Aligner::get_symbols(const std::vector
sbas_l1_telemetry_decoder_gs::Symbol_Aligner_And_Decoder::Symbol_Aligner_And_Decoder()
{
// convolutional code properties
d_KK = 7;
const int32_t nn = 2;
std::array<int32_t, nn> g_encoder{121, 91};
d_vd1 = std::make_shared<Viterbi_Decoder_Sbas>(g_encoder.data(), d_KK, nn);
d_vd2 = std::make_shared<Viterbi_Decoder_Sbas>(g_encoder.data(), d_KK, nn);
d_past_symbol = 0;
}

View File

@ -54,19 +54,16 @@ sbas_l1_telemetry_decoder_gs_sptr sbas_l1_make_telemetry_decoder_gs(
class sbas_l1_telemetry_decoder_gs : public gr::block
{
public:
~sbas_l1_telemetry_decoder_gs();
~sbas_l1_telemetry_decoder_gs() override;
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
void set_channel(int32_t channel); //!< Set receiver's channel
inline void reset()
{
return;
}
inline void reset(){};
/*!
* \brief This is where all signal processing takes place
*/
int general_work(int noutput_items, gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) override;
private:
friend sbas_l1_telemetry_decoder_gs_sptr sbas_l1_make_telemetry_decoder_gs(
@ -100,7 +97,7 @@ private:
{
public:
Sample_Aligner();
~Sample_Aligner() = default;
//~Sample_Aligner() = default;
void reset();
/*
* samples length must be a multiple of two
@ -109,8 +106,8 @@ private:
bool get_symbols(const std::vector<double> &samples, std::vector<double> &symbols);
private:
int32_t d_n_smpls_in_history;
double d_iir_par;
int32_t d_n_smpls_in_history{3};
double d_iir_par{0.05};
double d_corr_paired{};
double d_corr_shifted{};
bool d_aligned{};
@ -122,15 +119,15 @@ private:
{
public:
Symbol_Aligner_And_Decoder();
~Symbol_Aligner_And_Decoder() = default;
//~Symbol_Aligner_And_Decoder() = default;
void reset();
bool get_bits(const std::vector<double> &symbols, std::vector<int32_t> &bits);
private:
int32_t d_KK;
int32_t d_KK{7};
std::shared_ptr<Viterbi_Decoder_Sbas> d_vd1;
std::shared_ptr<Viterbi_Decoder_Sbas> d_vd2;
double d_past_symbol;
double d_past_symbol{0};
} d_symbol_aligner_and_decoder;

View File

@ -17,16 +17,6 @@
#include "tlm_conf.h"
Tlm_Conf::Tlm_Conf()
{
dump = false;
dump_mat = false;
remove_dat = false;
enable_reed_solomon = false;
dump_crc_stats = false;
enable_navdata_monitor = false;
}
void Tlm_Conf::SetFromConfiguration(const ConfigurationInterface *configuration,
const std::string &role)

View File

@ -30,18 +30,18 @@
class Tlm_Conf
{
public:
Tlm_Conf();
Tlm_Conf() = default;
void SetFromConfiguration(const ConfigurationInterface *configuration, const std::string &role);
std::string dump_filename;
bool dump;
bool dump_mat;
bool remove_dat;
bool enable_reed_solomon; // for INAV message in Galileo E1B
bool dump_crc_stats; // telemetry CRC statistics
bool enable_navdata_monitor;
std::string dump_crc_stats_filename;
bool dump{false};
bool dump_mat{false};
bool remove_dat{false};
bool enable_reed_solomon{false}; // for INAV message in Galileo E1B
bool dump_crc_stats{false}; // telemetry CRC statistics
bool enable_navdata_monitor{false};
};

View File

@ -20,16 +20,7 @@
#include <glog/logging.h>
#include <iomanip> // for std::setw()
#include <iostream> // for cerr, cout
#include <utility> // for atd::move
Tlm_CRC_Stats::Tlm_CRC_Stats()
{
enable_crc_stats = false;
num_crc_ok = 0;
num_crc_not_ok = 0;
channel = 0;
}
#include <utility> // for std::move
void Tlm_CRC_Stats::initialize(std::string dump_crc_stats_filename_)

View File

@ -32,7 +32,7 @@
class Tlm_CRC_Stats
{
public:
Tlm_CRC_Stats();
Tlm_CRC_Stats() = default;
~Tlm_CRC_Stats();
@ -52,13 +52,12 @@ public:
void update_CRC_stats(bool CRC);
private:
bool enable_crc_stats;
uint32_t num_crc_ok;
uint32_t num_crc_not_ok;
int32_t channel;
std::ofstream d_dump_file;
std::string d_dump_crc_stats_filename;
uint32_t num_crc_ok{0};
uint32_t num_crc_not_ok{0};
int32_t channel{0};
bool enable_crc_stats{false};
};

View File

@ -18,21 +18,23 @@
#include <volk_gnsssdr/volk_gnsssdr.h> // for volk_gnsssdr_32f_index_max_32u
#include <algorithm> // for std::copy
Viterbi_Decoder::Viterbi_Decoder(int32_t KK, int32_t nn, int32_t LL, const std::array<int32_t, 2>& g)
Viterbi_Decoder::Viterbi_Decoder(int32_t KK,
int32_t nn,
int32_t LL,
const std::array<int32_t, 2>& g) : d_g(g),
d_KK(KK),
d_nn(nn),
d_LL(LL),
d_mm(KK - 1),
d_states(1 << d_mm), // 2^d_mm
d_number_symbols(1 << nn) // 2^d_nn
{
d_KK = KK;
d_nn = nn;
d_LL = LL;
d_mm = d_KK - 1;
d_states = 1 << d_mm; // 2^d_mm
d_number_symbols = 1 << d_nn; // 2^d_nn
d_prev_section = std::vector<float>(d_states, -d_MAXLOG);
d_next_section = std::vector<float>(d_states, -d_MAXLOG);
d_rec_array = std::vector<float>(d_nn);
d_metric_c = std::vector<float>(d_number_symbols);
d_prev_bit = std::vector<int32_t>(d_states * (d_LL + d_mm));
d_prev_state = std::vector<int32_t>(d_states * (d_LL + d_mm));
d_g = g;
d_out0 = std::vector<int32_t>(d_states);
d_out1 = std::vector<int32_t>(d_states);
d_state0 = std::vector<int32_t>(d_states);

View File

@ -30,16 +30,15 @@
const float MAXLOG = 1e7; /* Define infinity */
Viterbi_Decoder_Sbas::Viterbi_Decoder_Sbas(const int g_encoder[], const int KK, const int nn)
Viterbi_Decoder_Sbas::Viterbi_Decoder_Sbas(const int g_encoder[],
int KK,
int nn) : d_KK(KK), // Constraint Length
d_nn(nn), // Coding rate 1/n
d_mm(KK - 1),
d_states(static_cast<int>(1U << (KK - 1))), // 2^mm
d_number_symbols(static_cast<int>(1U << nn)), // 2^nn
d_trellis_state_is_initialised(false)
{
d_nn = nn; // Coding rate 1/n
d_KK = KK; // Constraint Length
// derived code properties
d_mm = d_KK - 1;
d_states = static_cast<int>(1U << d_mm); /* 2^mm */
d_number_symbols = static_cast<int>(1U << d_nn); /* 2^nn */
/* create appropriate transition matrices (trellis) */
d_out0 = std::vector<int>(d_states);
d_out1 = std::vector<int>(d_states);
@ -50,7 +49,6 @@ Viterbi_Decoder_Sbas::Viterbi_Decoder_Sbas(const int g_encoder[], const int KK,
nsc_transit(d_out1.data(), d_state1.data(), 1, g_encoder, d_KK, d_nn);
// initialise trellis state
d_trellis_state_is_initialised = false;
Viterbi_Decoder_Sbas::init_trellis_state();
}
@ -69,7 +67,7 @@ void Viterbi_Decoder_Sbas::reset()
Output parameters:
output_u_int[] Hard decisions on the data bits (without the mm zero-tail-bits)
*/
float Viterbi_Decoder_Sbas::decode_block(const double input_c[], int output_u_int[], const int LL)
float Viterbi_Decoder_Sbas::decode_block(const double input_c[], int output_u_int[], int LL)
{
VLOG(FLOW) << "decode_block(): LL=" << LL;
@ -89,9 +87,9 @@ float Viterbi_Decoder_Sbas::decode_block(const double input_c[], int output_u_in
float Viterbi_Decoder_Sbas::decode_continuous(const double sym[],
const int traceback_depth,
int traceback_depth,
int bits[],
const int nbits_requested,
int nbits_requested,
int& nbits_decoded)
{
VLOG(FLOW) << "decode_continuous(): nbits_requested=" << nbits_requested;
@ -425,27 +423,25 @@ int Viterbi_Decoder_Sbas::parity_counter(int symbol, int length)
// prev helper class
Viterbi_Decoder_Sbas::Prev::Prev(int states, int t)
Viterbi_Decoder_Sbas::Prev::Prev(int states, int t) : num_states(states),
t(t),
refcount(1)
{
this->t = t;
num_states = states;
state = std::vector<int>(num_states);
v_bit = std::vector<int>(num_states);
v_metric = std::vector<float>(num_states);
refcount = 1;
}
// copy constructor
Viterbi_Decoder_Sbas::Prev::Prev(const Prev& prev)
Viterbi_Decoder_Sbas::Prev::Prev(const Prev& prev) : num_states(prev.num_states),
v_metric(prev.v_metric),
state(prev.state),
v_bit(prev.v_bit),
t(prev.t),
refcount(prev.refcount)
{
refcount = prev.refcount;
refcount++;
t = prev.t;
state = prev.state;
num_states = prev.num_states;
v_bit = prev.v_bit;
v_metric = prev.v_metric;
VLOG(LMORE) << "Prev("
<< "?"
<< ", " << t << ")"

View File

@ -34,8 +34,8 @@
class Viterbi_Decoder_Sbas
{
public:
Viterbi_Decoder_Sbas(const int g_encoder[], const int KK, const int nn);
~Viterbi_Decoder_Sbas() = default;
Viterbi_Decoder_Sbas(const int g_encoder[], int KK, int nn);
void reset();
/*!
@ -46,10 +46,10 @@ public:
*
* \return output_u_int[] Hard decisions on the data bits (without the mm zero-tail-bits)
*/
float decode_block(const double input_c[], int* output_u_int, const int LL);
float decode_block(const double input_c[], int* output_u_int, int LL);
float decode_continuous(const double sym[], const int traceback_depth, int bits[],
const int nbits_requested, int& nbits_decoded);
float decode_continuous(const double sym[], int traceback_depth, int bits[],
int nbits_requested, int& nbits_decoded);
private:
class Prev