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

Fix building, apply formatting

This commit is contained in:
Carles Fernandez 2019-03-18 08:43:38 +01:00
parent 10910269f4
commit ed9aaf86ce
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
16 changed files with 1080 additions and 966 deletions

View File

@ -30,15 +30,14 @@
*/
#include "beidou_b3i_pcps_acquisition.h"
#include "Beidou_B3I.h"
#include "acq_conf.h"
#include "beidou_b3i_signal_processing.h"
#include "configuration_interface.h"
#include "gnss_sdr_flags.h"
#include "acq_conf.h"
#include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h>
#include "beidou_b3i_signal_processing.h"
#include "Beidou_B3I.h"
using google::LogMessage;
@ -59,7 +58,7 @@ BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition(
item_type_ = configuration_->property(role + ".item_type", default_item_type);
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
acq_parameters.fs_in = fs_in_;
dump_ = configuration_->property(role + ".dump", false);
@ -335,6 +334,7 @@ gr::basic_block_sptr BeidouB3iPcpsAcquisition::get_right_block()
return acquisition_;
}
void BeidouB3iPcpsAcquisition::set_resampler_latency(uint32_t latency_samples)
{
acquisition_->set_resampler_latency(latency_samples);

View File

@ -34,12 +34,13 @@
#include "acq_conf.h"
#include "acquisition_interface.h"
#include "complex_byte_to_float_x2.h"
#include "gnss_synchro.h"
#include "pcps_acquisition.h"
#include "complex_byte_to_float_x2.h"
#include <gnuradio/blocks/stream_to_vector.h>
#include <gnuradio/blocks/float_to_complex.h>
#include <gnuradio/blocks/stream_to_vector.h>
#include <volk_gnsssdr/volk_gnsssdr.h>
#include <cstdint>
#include <string>
@ -162,7 +163,7 @@ private:
unsigned int doppler_step_;
unsigned int sampled_ms_;
unsigned int max_dwells_;
long fs_in_;
int64_t fs_in_;
bool dump_;
bool blocking_;
std::string dump_filename_;

View File

@ -45,7 +45,7 @@ void beidou_b3i_code_gen_int(int* _dest, signed int _prn, unsigned int _chip_shi
bool feedback1, feedback2, aux;
uint32_t lcv, lcv2, delay;
int32_t prn_idx = _prn - 1;
// clang-format off
std::array<std::array<bool, 13>, 63> G2_register_shifted = {{
{{1,0,1,0,1,1,1,1,1,1,1,1,1,}}, {{1,1,1,1,0,0,0,1,0,1,0,1,1,}}, {{1,0,1,1,1,1,0,0,0,1,0,1,0,}}, {{1,1,1,1,1,1,1,1,1,1,0,1,1,}},
{{1,1,0,0,1,0,0,0,1,1,1,1,1,}}, {{1,0,0,1,0,0,1,1,0,0,1,0,0,}}, {{1,1,1,1,1,1,1,0,1,0,0,1,0,}}, {{1,1,1,0,1,1,1,1,1,1,1,0,1,}},
@ -63,7 +63,7 @@ void beidou_b3i_code_gen_int(int* _dest, signed int _prn, unsigned int _chip_shi
{{0,0,0,0,0,0,0,0,1,1,0,0,0,}}, {{1,0,0,0,0,0,0,0,0,0,1,0,0,}}, {{0,0,1,1,0,1,0,1,0,0,1,1,0,}}, {{1,0,1,1,0,0,1,0,0,0,1,1,0,}},
{{0,1,1,1,0,0,1,1,1,1,0,0,0,}}, {{0,0,1,0,1,1,1,0,0,1,0,1,0,}}, {{1,1,0,0,1,1,1,1,1,0,1,1,0,}}, {{1,0,0,1,0,0,1,0,0,0,1,0,1,}},
{{0,1,1,1,0,0,0,1,0,0,0,0,0,}}, {{0,0,1,1,0,0,1,0,0,0,0,1,0,}}, {{0,0,1,0,0,0,1,0,0,1,1,1,0,}}}};
// clang-format on
// A simple error check
if ((prn_idx < 0) || (prn_idx > 63))
return;
@ -81,7 +81,8 @@ void beidou_b3i_code_gen_int(int* _dest, signed int _prn, unsigned int _chip_shi
//feedback1 = (test_G1_register[0]+test_G1_register[2]+test_G1_register[3]+test_G1_register[12]) & 0x1;
feedback1 = (G1_register[0] + G1_register[9] + G1_register[10] + G1_register[12]) & 0x01;
feedback2 = (G2_register[0] + G2_register[1] + G2_register[3] + G2_register[4] +
G2_register[6]+G2_register[7]+G2_register[8]+G2_register[12]) & 0x01;
G2_register[6] + G2_register[7] + G2_register[8] + G2_register[12]) &
0x01;
for (lcv2 = 0; lcv2 < 12; lcv2++)
{
@ -119,7 +120,6 @@ void beidou_b3i_code_gen_int(int* _dest, signed int _prn, unsigned int _chip_shi
delay++;
delay %= _code_length;
}
}

View File

@ -7,7 +7,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -30,8 +30,8 @@
* -------------------------------------------------------------------------
*/
#ifndef BEIDOU_B3I_SDR_SIGNAL_PROCESSING_H_
#define BEIDOU_B3I_SDR_SIGNAL_PROCESSING_H_
#ifndef GNSS_SDR_BEIDOU_B3I_SIGNAL_PROCESSING_H_
#define GNSS_SDR_BEIDOU_B3I_SIGNAL_PROCESSING_H_
#include <complex>
#include <iostream>
@ -54,4 +54,4 @@ void beidou_b3i_code_gen_complex_sampled(std::complex<float>* _dest, unsigned in
//! Generates complex BeiDou B3I code for the desired SV ID and code shift
void beidou_b3i_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, int _fs, unsigned int _chip_shift);
#endif /* BEIDOU_B3I_SDR_SIGNAL_PROCESSING_H_ */
#endif /* GNSS_SDR_BEIDOU_B3I_SIGNAL_PROCESSING_H_ */

View File

@ -36,7 +36,8 @@
BeidouB3iTelemetryDecoder::BeidouB3iTelemetryDecoder(
ConfigurationInterface *configuration, std::string role,
unsigned int in_streams, unsigned int out_streams)
: role_(role), in_streams_(in_streams), out_streams_(out_streams) {
: role_(role), in_streams_(in_streams), out_streams_(out_streams)
{
std::string default_dump_filename = "./navigation.dat";
DLOG(INFO) << "role " << role;
dump_ = configuration->property(role + ".dump", false);
@ -46,39 +47,54 @@ BeidouB3iTelemetryDecoder::BeidouB3iTelemetryDecoder(
telemetry_decoder_ = beidou_b3i_make_telemetry_decoder_gs(satellite_, dump_);
DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")";
channel_ = 0;
if (in_streams_ > 1) {
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
}
if (out_streams_ > 1) {
if (out_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one output stream";
}
}
BeidouB3iTelemetryDecoder::~BeidouB3iTelemetryDecoder() = default;
void BeidouB3iTelemetryDecoder::set_satellite(const Gnss_Satellite &satellite) {
void BeidouB3iTelemetryDecoder::set_satellite(const Gnss_Satellite &satellite)
{
satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
telemetry_decoder_->set_satellite(satellite_);
DLOG(INFO) << "TELEMETRY DECODER: satellite set to " << satellite_;
}
void BeidouB3iTelemetryDecoder::connect(gr::top_block_sptr top_block) {
if (top_block) { /* top_block is not null */
void BeidouB3iTelemetryDecoder::connect(gr::top_block_sptr top_block)
{
if (top_block)
{ /* top_block is not null */
};
// Nothing to connect internally
DLOG(INFO) << "nothing to connect internally";
}
void BeidouB3iTelemetryDecoder::disconnect(gr::top_block_sptr top_block) {
if (top_block) { /* top_block is not null */
void BeidouB3iTelemetryDecoder::disconnect(gr::top_block_sptr top_block)
{
if (top_block)
{ /* top_block is not null */
};
// Nothing to disconnect
}
gr::basic_block_sptr BeidouB3iTelemetryDecoder::get_left_block() {
gr::basic_block_sptr BeidouB3iTelemetryDecoder::get_left_block()
{
return telemetry_decoder_;
}
gr::basic_block_sptr BeidouB3iTelemetryDecoder::get_right_block() {
gr::basic_block_sptr BeidouB3iTelemetryDecoder::get_right_block()
{
return telemetry_decoder_;
}

View File

@ -35,15 +35,17 @@
#include "beidou_b3i_telemetry_decoder_gs.h"
#include "gnss_satellite.h" // for Gnss_Satellite
#include "telemetry_decoder_interface.h"
#include <cstddef> // for size_t
#include <gnuradio/runtime_types.h> // for basic_block_sptr, top_block_sptr
#include <cstddef> // for size_t
#include <string>
class ConfigurationInterface;
/*!
* \brief This class implements a NAV data decoder for BEIDOU B1I
*/
class BeidouB3iTelemetryDecoder : public TelemetryDecoderInterface {
class BeidouB3iTelemetryDecoder : public TelemetryDecoderInterface
{
public:
BeidouB3iTelemetryDecoder(ConfigurationInterface *configuration,
std::string role, unsigned int in_streams,
@ -54,7 +56,8 @@ public:
inline std::string role() override { return role_; }
//! Returns "BEIDOU_B3I_Telemetry_Decoder"
inline std::string implementation() override {
inline std::string implementation() override
{
return "BEIDOU_B3I_Telemetry_Decoder";
}
@ -64,7 +67,8 @@ public:
gr::basic_block_sptr get_right_block() override;
void set_satellite(const Gnss_Satellite &satellite) override;
inline void set_channel(int channel) override {
inline void set_channel(int channel) override
{
telemetry_decoder_->set_channel(channel);
}

View File

@ -36,21 +36,22 @@
#include "beidou_dnav_iono.h"
#include "beidou_dnav_utc_model.h"
#include "gnss_synchro.h"
#include <cstdlib> // for abs
#include <exception> // for exception
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
#include <iostream> // for cout
#include <memory> // for shared_ptr, make_shared
#include <pmt/pmt.h> // for make_any
#include <pmt/pmt_sugar.h> // for mp
#include <volk_gnsssdr/volk_gnsssdr.h>
#include <cstdlib> // for abs
#include <exception> // for exception
#include <iostream> // for cout
#include <memory> // for shared_ptr, make_shared
#define CRC_ERROR_LIMIT 8
beidou_b3i_telemetry_decoder_gs_sptr
beidou_b3i_make_telemetry_decoder_gs(const Gnss_Satellite &satellite,
bool dump) {
bool dump)
{
return beidou_b3i_telemetry_decoder_gs_sptr(
new beidou_b3i_telemetry_decoder_gs(satellite, dump));
}
@ -59,7 +60,8 @@ beidou_b3i_telemetry_decoder_gs::beidou_b3i_telemetry_decoder_gs(
const Gnss_Satellite &satellite, bool dump)
: 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)))
{
// Ephemeris data port out
this->message_port_register_out(pmt::mp("telemetry"));
// initialize internal vars
@ -83,27 +85,37 @@ beidou_b3i_telemetry_decoder_gs::beidou_b3i_telemetry_decoder_gs(
BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * d_samples_per_symbol;
// Setting samples of secondary code
for (int32_t i = 0; i < BEIDOU_B3I_SECONDARY_CODE_LENGTH; i++) {
if (BEIDOU_B3I_SECONDARY_CODE.at(i) == '1') {
for (int32_t i = 0; i < BEIDOU_B3I_SECONDARY_CODE_LENGTH; i++)
{
if (BEIDOU_B3I_SECONDARY_CODE.at(i) == '1')
{
d_secondary_code_symbols[i] = 1;
} else {
}
else
{
d_secondary_code_symbols[i] = -1;
}
}
// Setting samples of preamble code
int32_t n = 0;
for (int32_t i = 0; i < d_symbols_per_preamble; i++) {
for (int32_t i = 0; i < d_symbols_per_preamble; i++)
{
int32_t m = 0;
if (BEIDOU_DNAV_PREAMBLE.at(i) == '1') {
for (uint32_t j = 0; j < d_samples_per_symbol; j++) {
if (BEIDOU_DNAV_PREAMBLE.at(i) == '1')
{
for (uint32_t j = 0; j < d_samples_per_symbol; j++)
{
d_preamble_samples[n] = d_secondary_code_symbols[m];
n++;
m++;
m = m % BEIDOU_B3I_SECONDARY_CODE_LENGTH;
}
} else {
for (uint32_t j = 0; j < d_samples_per_symbol; j++) {
}
else
{
for (uint32_t j = 0; j < d_samples_per_symbol; j++)
{
d_preamble_samples[n] = -d_secondary_code_symbols[m];
n++;
m++;
@ -132,31 +144,41 @@ beidou_b3i_telemetry_decoder_gs::beidou_b3i_telemetry_decoder_gs(
flag_SOW_set = false;
}
beidou_b3i_telemetry_decoder_gs::~beidou_b3i_telemetry_decoder_gs() {
beidou_b3i_telemetry_decoder_gs::~beidou_b3i_telemetry_decoder_gs()
{
volk_gnsssdr_free(d_preamble_samples);
volk_gnsssdr_free(d_secondary_code_symbols);
volk_gnsssdr_free(d_subframe_symbols);
if (d_dump_file.is_open() == true) {
try {
if (d_dump_file.is_open() == true)
{
try
{
d_dump_file.close();
} catch (const std::exception &ex) {
}
catch (const std::exception &ex)
{
LOG(WARNING) << "Exception in destructor closing the dump file "
<< ex.what();
}
}
}
void beidou_b3i_telemetry_decoder_gs::decode_bch15_11_01(const int32_t *bits,
int32_t *decbits) {
int32_t *decbits)
{
int32_t bit, err, reg[4] = {1, 1, 1, 1};
int32_t errind[15] = {14, 13, 10, 12, 6, 9, 4, 11, 0, 5, 7, 8, 1, 3, 2};
for (uint32_t i = 0; i < 15; i++) {
for (uint32_t i = 0; i < 15; i++)
{
decbits[i] = bits[i];
}
for (uint32_t i = 0; i < 15; i++) {
for (uint32_t i = 0; i < 15; i++)
{
bit = reg[3];
reg[3] = reg[2];
reg[2] = reg[1];
@ -167,24 +189,33 @@ void beidou_b3i_telemetry_decoder_gs::decode_bch15_11_01(const int32_t *bits,
err = errind[reg[0] + reg[1] * 2 + reg[2] * 4 + reg[3] * 8];
if (err > 0) {
if (err > 0)
{
decbits[err - 1] *= -1;
}
}
void beidou_b3i_telemetry_decoder_gs::decode_word(
int32_t word_counter, const double *enc_word_symbols,
int32_t *dec_word_symbols) {
int32_t *dec_word_symbols)
{
int32_t bitsbch[30], first_branch[15], second_branch[15];
if (word_counter == 1) {
for (uint32_t j = 0; j < 30; j++) {
if (word_counter == 1)
{
for (uint32_t j = 0; j < 30; j++)
{
dec_word_symbols[j] =
static_cast<int32_t>(enc_word_symbols[j] > 0) ? (1) : (-1);
}
} else {
for (uint32_t r = 0; r < 2; r++) {
for (uint32_t c = 0; c < 15; c++) {
}
else
{
for (uint32_t r = 0; r < 2; r++)
{
for (uint32_t c = 0; c < 15; c++)
{
bitsbch[r * 15 + c] =
static_cast<int32_t>(enc_word_symbols[c * 2 + r] > 0) ? (1) : (-1);
}
@ -193,50 +224,63 @@ void beidou_b3i_telemetry_decoder_gs::decode_word(
decode_bch15_11_01(&bitsbch[0], first_branch);
decode_bch15_11_01(&bitsbch[15], second_branch);
for (uint32_t j = 0; j < 11; j++) {
for (uint32_t j = 0; j < 11; j++)
{
dec_word_symbols[j] = first_branch[j];
dec_word_symbols[j + 11] = second_branch[j];
}
for (uint32_t j = 0; j < 4; j++) {
for (uint32_t j = 0; j < 4; j++)
{
dec_word_symbols[j + 22] = first_branch[11 + j];
dec_word_symbols[j + 26] = second_branch[11 + j];
}
}
}
void beidou_b3i_telemetry_decoder_gs::decode_subframe(double *frame_symbols) {
void beidou_b3i_telemetry_decoder_gs::decode_subframe(double *frame_symbols)
{
// 1. Transform from symbols to bits
std::string data_bits;
int32_t dec_word_bits[30];
// Decode each word in subframe
for (uint32_t ii = 0; ii < BEIDOU_DNAV_WORDS_SUBFRAME; ii++) {
for (uint32_t ii = 0; ii < BEIDOU_DNAV_WORDS_SUBFRAME; ii++)
{
// decode the word
decode_word((ii + 1), &frame_symbols[ii * 30], dec_word_bits);
// Save word to string format
for (uint32_t jj = 0; jj < (BEIDOU_DNAV_WORD_LENGTH_BITS); jj++) {
for (uint32_t jj = 0; jj < (BEIDOU_DNAV_WORD_LENGTH_BITS); jj++)
{
data_bits.push_back((dec_word_bits[jj] > 0) ? ('1') : ('0'));
}
}
if (d_satellite.get_PRN() > 0 and d_satellite.get_PRN() < 6) {
if (d_satellite.get_PRN() > 0 and d_satellite.get_PRN() < 6)
{
d_nav.d2_subframe_decoder(data_bits);
} else {
}
else
{
d_nav.d1_subframe_decoder(data_bits);
}
// 3. Check operation executed correctly
if (d_nav.flag_crc_test == true) {
if (d_nav.flag_crc_test == true)
{
LOG(INFO) << "BeiDou DNAV CRC correct in channel " << d_channel
<< " from satellite " << d_satellite;
} else {
}
else
{
LOG(INFO) << "BeiDou DNAV CRC error in channel " << d_channel
<< " from satellite " << d_satellite;
}
// 4. Push the new navigation data to the queues
if (d_nav.have_new_ephemeris() == true) {
if (d_nav.have_new_ephemeris() == true)
{
// get object for this SV (mandatory)
std::shared_ptr<Beidou_Dnav_Ephemeris> tmp_obj =
std::make_shared<Beidou_Dnav_Ephemeris>(d_nav.get_ephemeris());
@ -246,7 +290,8 @@ void beidou_b3i_telemetry_decoder_gs::decode_subframe(double *frame_symbols) {
std::cout << "New BEIDOU B3I DNAV message received in channel " << d_channel
<< ": ephemeris from satellite " << d_satellite << std::endl;
}
if (d_nav.have_new_utc_model() == true) {
if (d_nav.have_new_utc_model() == true)
{
// get object for this SV (mandatory)
std::shared_ptr<Beidou_Dnav_Utc_Model> tmp_obj =
std::make_shared<Beidou_Dnav_Utc_Model>(d_nav.get_utc_model());
@ -257,7 +302,8 @@ void beidou_b3i_telemetry_decoder_gs::decode_subframe(double *frame_symbols) {
<< d_channel << ": UTC model parameters from satellite "
<< d_satellite << std::endl;
}
if (d_nav.have_new_iono() == true) {
if (d_nav.have_new_iono() == true)
{
// get object for this SV (mandatory)
std::shared_ptr<Beidou_Dnav_Iono> tmp_obj =
std::make_shared<Beidou_Dnav_Iono>(d_nav.get_iono());
@ -268,7 +314,8 @@ void beidou_b3i_telemetry_decoder_gs::decode_subframe(double *frame_symbols) {
<< d_channel << ": Iono model parameters from satellite "
<< d_satellite << std::endl;
}
if (d_nav.have_new_almanac() == true) {
if (d_nav.have_new_almanac() == true)
{
// unsigned int slot_nbr = d_nav.i_alm_satellite_PRN;
// std::shared_ptr<Beidou_Dnav_Almanac> tmp_obj =
// std::make_shared<Beidou_Dnav_Almanac>(d_nav.get_almanac(slot_nbr));
@ -281,8 +328,10 @@ void beidou_b3i_telemetry_decoder_gs::decode_subframe(double *frame_symbols) {
}
}
void beidou_b3i_telemetry_decoder_gs::set_satellite(
const Gnss_Satellite &satellite) {
const Gnss_Satellite &satellite)
{
uint32_t sat_prn = 0;
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
DLOG(INFO) << "Setting decoder Finite State Machine to satellite "
@ -292,11 +341,11 @@ void beidou_b3i_telemetry_decoder_gs::set_satellite(
// Update satellite information for DNAV decoder
sat_prn = d_satellite.get_PRN();
d_nav.i_satellite_PRN = sat_prn;
d_nav.i_signal_type =
5; //!< BDS: data source (0:unknown,1:B1I,2:B1Q,3:B2I,4:B2Q,5:B3I,6:B3Q)
d_nav.i_signal_type = 5; // BDS: data source (0:unknown,1:B1I,2:B1Q,3:B2I,4:B2Q,5:B3I,6:B3Q)
// Update tel dec parameters for D2 NAV Messages
if (sat_prn > 0 and sat_prn < 6) {
if (sat_prn > 0 and sat_prn < 6)
{
// Clear values from previous declaration
volk_gnsssdr_free(d_preamble_samples);
volk_gnsssdr_free(d_secondary_code_symbols);
@ -317,14 +366,20 @@ void beidou_b3i_telemetry_decoder_gs::set_satellite(
// Setting samples of preamble code
int32_t n = 0;
for (int32_t i = 0; i < d_symbols_per_preamble; i++) {
if (BEIDOU_DNAV_PREAMBLE.at(i) == '1') {
for (uint32_t j = 0; j < d_samples_per_symbol; j++) {
for (int32_t i = 0; i < d_symbols_per_preamble; i++)
{
if (BEIDOU_DNAV_PREAMBLE.at(i) == '1')
{
for (uint32_t j = 0; j < d_samples_per_symbol; j++)
{
d_preamble_samples[n] = 1;
n++;
}
} else {
for (uint32_t j = 0; j < d_samples_per_symbol; j++) {
}
else
{
for (uint32_t j = 0; j < d_samples_per_symbol; j++)
{
d_preamble_samples[n] = -1;
n++;
}
@ -340,13 +395,17 @@ void beidou_b3i_telemetry_decoder_gs::set_satellite(
}
}
void beidou_b3i_telemetry_decoder_gs::set_channel(int32_t channel) {
void beidou_b3i_telemetry_decoder_gs::set_channel(int32_t channel)
{
d_channel = channel;
LOG(INFO) << "Navigation channel set to " << channel;
// ############# ENABLE DATA FILE LOG #################
if (d_dump == true) {
if (d_dump_file.is_open() == false) {
try {
if (d_dump == true)
{
if (d_dump_file.is_open() == false)
{
try
{
d_dump_filename = "telemetry";
d_dump_filename.append(std::to_string(d_channel));
d_dump_filename.append(".dat");
@ -355,7 +414,9 @@ void beidou_b3i_telemetry_decoder_gs::set_channel(int32_t channel) {
std::ios::out | std::ios::binary);
LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel
<< " Log file: " << d_dump_filename.c_str();
} catch (const std::ifstream::failure &e) {
}
catch (const std::ifstream::failure &e)
{
LOG(WARNING) << "channel " << d_channel
<< ": exception opening Beidou TLM dump file. "
<< e.what();
@ -364,37 +425,40 @@ void beidou_b3i_telemetry_decoder_gs::set_channel(int32_t channel) {
}
}
int beidou_b3i_telemetry_decoder_gs::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) {
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
int32_t corr_value = 0;
int32_t preamble_diff = 0;
auto **out = reinterpret_cast<Gnss_Synchro **>(
&output_items[0]); // Get the output buffer pointer
const auto **in = reinterpret_cast<const Gnss_Synchro **>(
&input_items[0]); // Get the input buffer pointer
auto **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); // Get the output buffer pointer
const auto **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]); // Get the input buffer pointer
Gnss_Synchro current_symbol; // structure to save the synchronization
// information and send the output object to the
// next block
// 1. Copy the current tracking output
current_symbol = in[0][0];
d_symbol_history.push_back(
current_symbol.Prompt_I); // add new symbol to the symbol queue
d_symbol_history.push_back(current_symbol.Prompt_I); // add new symbol to the symbol queue
d_sample_counter++; // count for the processed samples
consume_each(1);
d_flag_preamble = false;
if (d_symbol_history.size() > d_required_symbols) {
if (d_symbol_history.size() > d_required_symbols)
{
//******* preamble correlation ********
for (int32_t i = 0; i < d_samples_per_preamble; i++) {
for (int32_t i = 0; i < d_samples_per_preamble; i++)
{
if (d_symbol_history[i] < 0) // symbols clipping
{
corr_value -= d_preamble_samples[i];
} else {
}
else
{
corr_value += d_preamble_samples[i];
}
}
@ -403,7 +467,8 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
//******* frame sync ******************
if (d_stat == 0) // no preamble information
{
if (abs(corr_value) >= d_samples_per_preamble) {
if (abs(corr_value) >= d_samples_per_preamble)
{
// Record the preamble sample stamp
d_preamble_index = d_sample_counter;
LOG(INFO) << "Preamble detection for BEIDOU B3I SAT "
@ -411,42 +476,55 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
// Enter into frame pre-detection status
d_stat = 1;
}
} else if (d_stat == 1) // possible preamble lock
}
else if (d_stat == 1) // possible preamble lock
{
if (abs(corr_value) >= d_samples_per_preamble)
{
if (abs(corr_value) >= d_samples_per_preamble) {
// check preamble separation
preamble_diff = static_cast<int32_t>(d_sample_counter - d_preamble_index);
if (abs(preamble_diff - d_preamble_period_samples) == 0) {
if (abs(preamble_diff - d_preamble_period_samples) == 0)
{
// try to decode frame
LOG(INFO) << "Starting BeiDou DNAV frame decoding for BeiDou B3I SAT "
<< this->d_satellite;
d_preamble_index = d_sample_counter; // record the preamble sample stamp
d_stat = 2;
} else {
if (preamble_diff > d_preamble_period_samples) {
}
else
{
if (preamble_diff > d_preamble_period_samples)
{
d_stat = 0; // start again
}
DLOG(INFO) << "Failed BeiDou DNAV frame decoding for BeiDou B3I SAT "
<< this->d_satellite;
}
}
} else if (d_stat == 2) // preamble acquired
}
else if (d_stat == 2) // preamble acquired
{
if (d_sample_counter ==
d_preamble_index + static_cast<uint64_t>(d_preamble_period_samples)) {
d_preamble_index + static_cast<uint64_t>(d_preamble_period_samples))
{
//******* SAMPLES TO SYMBOLS *******
if (corr_value > 0) // normal PLL lock
{
int32_t k = 0;
for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++) {
for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++)
{
d_subframe_symbols[i] = 0;
// integrate samples into symbols
for (uint32_t m = 0; m < d_samples_per_symbol; m++) {
if (d_satellite.get_PRN() > 0 and d_satellite.get_PRN() < 6) {
for (uint32_t m = 0; m < d_samples_per_symbol; m++)
{
if (d_satellite.get_PRN() > 0 and d_satellite.get_PRN() < 6)
{
// because last symbol of the preamble is just received now!
d_subframe_symbols[i] +=
d_symbol_history.at(i * d_samples_per_symbol + m);
} else {
}
else
{
// because last symbol of the preamble is just received now!
d_subframe_symbols[i] +=
static_cast<float>(d_secondary_code_symbols[k]) *
@ -456,18 +534,24 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
}
}
}
} else // 180 deg. inverted carrier phase PLL lock
}
else // 180 deg. inverted carrier phase PLL lock
{
int32_t k = 0;
for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++) {
for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++)
{
d_subframe_symbols[i] = 0;
// integrate samples into symbols
for (uint32_t m = 0; m < d_samples_per_symbol; m++) {
if (d_satellite.get_PRN() > 0 and d_satellite.get_PRN() < 6) {
for (uint32_t m = 0; m < d_samples_per_symbol; m++)
{
if (d_satellite.get_PRN() > 0 and d_satellite.get_PRN() < 6)
{
// because last symbol of the preamble is just received now!
d_subframe_symbols[i] -=
d_symbol_history.at(i * d_samples_per_symbol + m);
} else {
}
else
{
// because last symbol of the preamble is just received now!
d_subframe_symbols[i] -=
static_cast<float>(d_secondary_code_symbols[k]) *
@ -482,21 +566,26 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
// call the decoder
decode_subframe(d_subframe_symbols);
if (d_nav.flag_crc_test == true) {
if (d_nav.flag_crc_test == true)
{
d_CRC_error_counter = 0;
d_flag_preamble = true; // valid preamble indicator (initialized to
// false every work())
d_preamble_index =
d_sample_counter; // record the preamble sample stamp (t_P)
if (!d_flag_frame_sync) {
if (!d_flag_frame_sync)
{
d_flag_frame_sync = true;
DLOG(INFO) << "BeiDou DNAV frame sync found for SAT "
<< this->d_satellite;
}
} else {
}
else
{
d_CRC_error_counter++;
d_preamble_index = d_sample_counter; // record the preamble sample stamp
if (d_CRC_error_counter > CRC_ERROR_LIMIT) {
if (d_CRC_error_counter > CRC_ERROR_LIMIT)
{
LOG(INFO) << "BeiDou DNAV frame sync lost for SAT "
<< this->d_satellite;
d_flag_frame_sync = false;
@ -519,44 +608,49 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
BEIDOU_B3I_CODE_PERIOD_MS);
flag_SOW_set = true;
d_nav.flag_new_SOW_available = false;
} else // if there is not a new preamble, we define the TOW of the current
}
else // if there is not a new preamble, we define the TOW of the current
// symbol
{
d_TOW_at_current_symbol_ms +=
static_cast<uint32_t>(BEIDOU_B3I_CODE_PERIOD_MS);
}
if (d_flag_frame_sync == true and flag_SOW_set == true) {
if (d_flag_frame_sync == true and flag_SOW_set == true)
{
current_symbol.Flag_valid_word = true;
} else {
}
else
{
current_symbol.Flag_valid_word = false;
}
current_symbol.PRN = this->d_satellite.get_PRN();
current_symbol.TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms;
if (d_dump == true) {
if (d_dump == true)
{
// MULTIPLEXED FILE RECORDING - Record results to file
try {
try
{
double tmp_double;
uint64_t tmp_ulong_int;
tmp_double = static_cast<double>(d_TOW_at_current_symbol_ms);
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
tmp_ulong_int = current_symbol.Tracking_sample_counter;
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int),
sizeof(uint64_t));
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t));
tmp_double = d_nav.d_SOW;
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
tmp_ulong_int = static_cast<uint64_t>(d_required_symbols);
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int),
sizeof(uint64_t));
} catch (const std::ifstream::failure &e) {
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t));
}
catch (const std::ifstream::failure &e)
{
LOG(WARNING) << "Exception writing observables dump file " << e.what();
}
}
// 3. Make the output (copy the object contents to the GNURadio reserved
// memory)
// 3. Make the output (copy the object contents to the GNURadio reserved memory)
*out[0] = current_symbol;
return 1;

View File

@ -35,10 +35,10 @@
#include "gnss_satellite.h"
#include <boost/circular_buffer.hpp>
#include <boost/shared_ptr.hpp> // for boost::shared_ptr
#include <cstdint>
#include <fstream>
#include <gnuradio/block.h> // for block
#include <gnuradio/types.h> // for gr_vector_const_void_star
#include <cstdint>
#include <fstream>
#include <string>
class beidou_b3i_telemetry_decoder_gs;
@ -54,7 +54,8 @@ beidou_b3i_make_telemetry_decoder_gs(const Gnss_Satellite &satellite,
* \brief This class implements a block that decodes the BeiDou DNAV data.
*
*/
class beidou_b3i_telemetry_decoder_gs : public gr::block {
class beidou_b3i_telemetry_decoder_gs : public gr::block
{
public:
~beidou_b3i_telemetry_decoder_gs(); //!< Class destructor
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
@ -101,15 +102,15 @@ private:
int32_t d_CRC_error_counter; // Number of failed CRC operations
bool flag_SOW_set; // Indicates when time of week is set
//!< Navigation Message variable
// Navigation Message variable
Beidou_Dnav_Navigation_Message d_nav;
//!< Values to populate gnss synchronization structure
// Values to populate gnss synchronization structure
uint32_t d_TOW_at_Preamble_ms;
uint32_t d_TOW_at_current_symbol_ms;
bool Flag_valid_word;
//!< Satellite Information and logging capacity
// Satellite Information and logging capacity
Gnss_Satellite d_satellite;
int32_t d_channel;
bool d_dump;

View File

@ -11,7 +11,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -34,13 +34,13 @@
* -------------------------------------------------------------------------
*/
#include "dll_pll_conf.h"
#include "beidou_b3i_dll_pll_tracking.h"
#include "configuration_interface.h"
#include "gnss_sdr_flags.h"
#include "display.h"
#include <glog/logging.h>
#include "Beidou_B3I.h"
#include "configuration_interface.h"
#include "display.h"
#include "dll_pll_conf.h"
#include "gnss_sdr_flags.h"
#include <glog/logging.h>
using google::LogMessage;
@ -151,6 +151,7 @@ void BeidouB3iDllPllTracking::start_tracking()
tracking_->start_tracking();
}
void BeidouB3iDllPllTracking::stop_tracking()
{
tracking_->stop_tracking();

View File

@ -11,7 +11,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -37,8 +37,8 @@
#ifndef GNSS_SDR_BEIDOU_B3I_DLL_PLL_TRACKING_H_
#define GNSS_SDR_BEIDOU_B3I_DLL_PLL_TRACKING_H_
#include "tracking_interface.h"
#include "dll_pll_veml_tracking.h"
#include "tracking_interface.h"
#include <string>
class ConfigurationInterface;

View File

@ -43,8 +43,8 @@
#include "Galileo_E1.h"
#include "Galileo_E5a.h"
#include "MATH_CONSTANTS.h"
#include "beidou_b3i_signal_processing.h"
#include "beidou_b1i_signal_processing.h"
#include "beidou_b3i_signal_processing.h"
#include "galileo_e1_signal_processing.h"
#include "galileo_e5_signal_processing.h"
#include "gnss_satellite.h"
@ -634,7 +634,6 @@ void dll_pll_veml_tracking::start_tracking()
d_symbol_history.resize(22); // Change fixed buffer size
d_symbol_history.clear();
}
}
else if (systemName == "Beidou" and signal_type == "B3")

View File

@ -1928,7 +1928,6 @@ void GNSSFlowgraph::set_signals_list()
available_BDS_B1_signals_.push_back(Gnss_Signal(
Gnss_Satellite(std::string("Beidou"), *available_gnss_prn_iter),
std::string("B1")));
}
}
@ -1944,7 +1943,6 @@ void GNSSFlowgraph::set_signals_list()
available_BDS_B3_signals_.push_back(Gnss_Signal(
Gnss_Satellite(std::string("Beidou"), *available_gnss_prn_iter),
std::string("B3")));
}
}
}

View File

@ -4,7 +4,7 @@
* \author Damian Miralles, 2019. dmiralles2009@gmail.com
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -31,10 +31,10 @@
#ifndef GNSS_SDR_BEIDOU_B3I_H_
#define GNSS_SDR_BEIDOU_B3I_H_
#include <vector>
#include "MATH_CONSTANTS.h"
#include <cstdint>
#include <utility> // std::pair
#include "MATH_CONSTANTS.h"
#include <vector>
// carrier and code frequencies
const double BEIDOU_B3I_FREQ_HZ = 1.268520e9; //!< BeiDou B3I [Hz]

View File

@ -31,10 +31,10 @@
#ifndef GNSS_SDR_BEIDOU_DNAV_H_
#define GNSS_SDR_BEIDOU_DNAV_H_
#include <vector>
#include "MATH_CONSTANTS.h"
#include <cstdint>
#include <utility>
#include "MATH_CONSTANTS.h"
#include <vector>
const double BEIDOU_DNAV_C_m_s = 299792458.0; //!< The speed of light, [m/s]
const double BEIDOU_DNAV_C_m_ms = 299792.4580; //!< The speed of light, [m/ms]