mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-16 12:12:57 +00:00
Make use of cstdint type names
This commit is contained in:
parent
a6b94eaccf
commit
21b5aeee9d
@ -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
|
||||
@ -32,26 +32,26 @@
|
||||
|
||||
#include "beidou_b1i_signal_processing.h"
|
||||
|
||||
auto auxCeil = [](float x) { return static_cast<int>(static_cast<long>((x) + 1)); };
|
||||
auto auxCeil = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); };
|
||||
|
||||
void beidou_b1i_code_gen_int(int* _dest, signed int _prn, unsigned int _chip_shift)
|
||||
void beidou_b1i_code_gen_int(int32_t* _dest, int32_t _prn, uint32_t _chip_shift)
|
||||
{
|
||||
const unsigned int _code_length = 2046;
|
||||
const uint32_t _code_length = 2046;
|
||||
bool G1[_code_length];
|
||||
bool G2[_code_length];
|
||||
bool G1_register[11] = {false, true, false, true, false, true, false, true, false, true, false};
|
||||
bool G2_register[11] = {false, true, false, true, false, true, false, true, false, true, false};
|
||||
bool feedback1, feedback2;
|
||||
bool aux;
|
||||
unsigned int lcv, lcv2;
|
||||
unsigned int delay;
|
||||
signed int prn_idx;
|
||||
uint32_t lcv, lcv2;
|
||||
uint32_t delay;
|
||||
int32_t prn_idx;
|
||||
/* G2 Delays as defined in GPS-ISD-200D */
|
||||
const signed int delays[33] = {712 /*PRN1*/, 1581, 1414, 1550, 581, 771, 1311, 1043, 1549, 359, 710, 1579, 1548, 1103, 579, 769, 358, 709, 1411, 1547,
|
||||
const int32_t delays[33] = {712 /*PRN1*/, 1581, 1414, 1550, 581, 771, 1311, 1043, 1549, 359, 710, 1579, 1548, 1103, 579, 769, 358, 709, 1411, 1547,
|
||||
1102, 578, 357, 1577, 1410, 1546, 1101, 707, 1576, 1409, 1545, 354 /*PRN32*/,
|
||||
705};
|
||||
const signed int phase1[37] = {1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 8, 8, 8, 9, 9, 10};
|
||||
const signed int phase2[37] = {3, 4, 5, 6, 8, 9, 10, 11, 7, 4, 5, 6, 8, 9, 10, 11, 5, 6, 8, 9, 10, 11, 6, 8, 9, 10, 11, 8, 9, 10, 11, 9, 10, 11, 10, 11, 11};
|
||||
const int32_t phase1[37] = {1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 8, 8, 8, 9, 9, 10};
|
||||
const int32_t phase2[37] = {3, 4, 5, 6, 8, 9, 10, 11, 7, 4, 5, 6, 8, 9, 10, 11, 5, 6, 8, 9, 10, 11, 6, 8, 9, 10, 11, 8, 9, 10, 11, 9, 10, 11, 10, 11, 11};
|
||||
|
||||
// compute delay array index for given PRN number
|
||||
prn_idx = _prn - 1;
|
||||
@ -110,28 +110,28 @@ void beidou_b1i_code_gen_int(int* _dest, signed int _prn, unsigned int _chip_shi
|
||||
}
|
||||
|
||||
|
||||
void beidou_b1i_code_gen_float(float* _dest, signed int _prn, unsigned int _chip_shift)
|
||||
void beidou_b1i_code_gen_float(float* _dest, int32_t _prn, uint32_t _chip_shift)
|
||||
{
|
||||
unsigned int _code_length = 2046;
|
||||
int b1i_code_int[_code_length];
|
||||
uint32_t _code_length = 2046;
|
||||
int32_t b1i_code_int[_code_length];
|
||||
|
||||
beidou_b1i_code_gen_int(b1i_code_int, _prn, _chip_shift);
|
||||
|
||||
for (unsigned int ii = 0; ii < _code_length; ++ii)
|
||||
for (uint32_t ii = 0; ii < _code_length; ++ii)
|
||||
{
|
||||
_dest[ii] = static_cast<float>(b1i_code_int[ii]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void beidou_b1i_code_gen_complex(std::complex<float>* _dest, signed int _prn, unsigned int _chip_shift)
|
||||
void beidou_b1i_code_gen_complex(std::complex<float>* _dest, int32_t _prn, uint32_t _chip_shift)
|
||||
{
|
||||
unsigned int _code_length = 2046;
|
||||
int b1i_code_int[_code_length];
|
||||
uint32_t _code_length = 2046;
|
||||
int32_t b1i_code_int[_code_length];
|
||||
|
||||
beidou_b1i_code_gen_int(b1i_code_int, _prn, _chip_shift);
|
||||
|
||||
for (unsigned int ii = 0; ii < _code_length; ++ii)
|
||||
for (uint32_t ii = 0; ii < _code_length; ++ii)
|
||||
{
|
||||
_dest[ii] = std::complex<float>(static_cast<float>(b1i_code_int[ii]), 0.0f);
|
||||
}
|
||||
@ -141,26 +141,26 @@ void beidou_b1i_code_gen_complex(std::complex<float>* _dest, signed int _prn, un
|
||||
/*
|
||||
* Generates complex GPS L1 C/A code for the desired SV ID and sampled to specific sampling frequency
|
||||
*/
|
||||
void beidou_b1i_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, int _fs, unsigned int _chip_shift)
|
||||
void beidou_b1i_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift)
|
||||
{
|
||||
// This function is based on the GNU software GPS for MATLAB in the Kay Borre book
|
||||
std::complex<float> _code[2046];
|
||||
signed int _samplesPerCode, _codeValueIndex;
|
||||
int32_t _samplesPerCode, _codeValueIndex;
|
||||
float _ts;
|
||||
float _tc;
|
||||
float aux;
|
||||
const signed int _codeFreqBasis = 2046000; //Hz
|
||||
const signed int _codeLength = 2046;
|
||||
const int32_t _codeFreqBasis = 2046000; //Hz
|
||||
const int32_t _codeLength = 2046;
|
||||
|
||||
//--- Find number of samples per spreading code ----------------------------
|
||||
_samplesPerCode = static_cast<signed int>(static_cast<double>(_fs) / static_cast<double>(_codeFreqBasis / _codeLength));
|
||||
_samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / static_cast<double>(_codeFreqBasis / _codeLength));
|
||||
|
||||
//--- Find time constants --------------------------------------------------
|
||||
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
|
||||
_tc = 1.0 / static_cast<float>(_codeFreqBasis); // C/A chip period in sec
|
||||
beidou_b1i_code_gen_complex(_code, _prn, _chip_shift); //generate C/A code 1 sample per chip
|
||||
|
||||
for (signed int i = 0; i < _samplesPerCode; i++)
|
||||
for (int32_t i = 0; i < _samplesPerCode; i++)
|
||||
{
|
||||
//=== Digitizing =======================================================
|
||||
|
||||
|
@ -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,25 +30,26 @@
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef BEIDOU_B1I_SDR_SIGNAL_PROCESSING_H_
|
||||
#define BEIDOU_B1I_SDR_SIGNAL_PROCESSING_H_
|
||||
#ifndef GNSS_SDR_BEIDOU_B1I_SDR_SIGNAL_PROCESSING_H_
|
||||
#define GNSS_SDR_BEIDOU_B1I_SDR_SIGNAL_PROCESSING_H_
|
||||
|
||||
#include <complex>
|
||||
#include <iostream>
|
||||
#include <cstdint>
|
||||
|
||||
//!Generates int GPS L1 C/A code for the desired SV ID and code shift
|
||||
void beidou_b1i_code_gen_int(int* _dest, signed int _prn, unsigned int _chip_shift);
|
||||
//! Generates int32_t GPS L1 C/A code for the desired SV ID and code shift
|
||||
void beidou_b1i_code_gen_int(int32_t* _dest, int32_t _prn, uint32_t _chip_shift);
|
||||
|
||||
//!Generates float GPS L1 C/A code for the desired SV ID and code shift
|
||||
void beidou_b1i_code_gen_float(float* _dest, signed int _prn, unsigned int _chip_shift);
|
||||
//! Generates float GPS L1 C/A code for the desired SV ID and code shift
|
||||
void beidou_b1i_code_gen_float(float* _dest, int32_t _prn, uint32_t _chip_shift);
|
||||
|
||||
//!Generates complex GPS L1 C/A code for the desired SV ID and code shift, and sampled to specific sampling frequency
|
||||
void beidou_b1i_code_gen_complex(std::complex<float>* _dest, signed int _prn, unsigned int _chip_shift);
|
||||
//! Generates complex GPS L1 C/A code for the desired SV ID and code shift, and sampled to specific sampling frequency
|
||||
void beidou_b1i_code_gen_complex(std::complex<float>* _dest, int32_t _prn, uint32_t _chip_shift);
|
||||
|
||||
//! Generates N complex GPS L1 C/A codes for the desired SV ID and code shift
|
||||
void beidou_b1i_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, int _fs, unsigned int _chip_shift, unsigned int _ncodes);
|
||||
void beidou_b1i_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift, uint32_t _ncodes);
|
||||
|
||||
//! Generates complex GPS L1 C/A code for the desired SV ID and code shift
|
||||
void beidou_b1i_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, int _fs, unsigned int _chip_shift);
|
||||
void beidou_b1i_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift);
|
||||
|
||||
#endif /* BEIDOU_B1I_SDR_SIGNAL_PROCESSING_H_ */
|
||||
|
@ -175,7 +175,7 @@ void Beidou_Dnav_Navigation_Message::reset()
|
||||
//Almanac
|
||||
d_Toa = 0;
|
||||
i_WN_A = 0;
|
||||
for (int i = 1; i < 36; i++)
|
||||
for (int32_t i = 1; i < 36; i++)
|
||||
{
|
||||
almanacHealth[i] = 0;
|
||||
}
|
||||
@ -208,25 +208,30 @@ void Beidou_Dnav_Navigation_Message::reset()
|
||||
|
||||
auto gnss_sat = Gnss_Satellite();
|
||||
std::string _system("Beidou");
|
||||
for (unsigned int i = 1; i < 36; i++)
|
||||
for (uint32_t i = 1; i < 36; i++)
|
||||
{
|
||||
satelliteBlock[i] = gnss_sat.what_block(_system, i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Beidou_Dnav_Navigation_Message::Beidou_Dnav_Navigation_Message()
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
void Beidou_Dnav_Navigation_Message::print_beidou_word_bytes(unsigned int BEIDOU_word)
|
||||
|
||||
void Beidou_Dnav_Navigation_Message::print_beidou_word_bytes(uint32_t BEIDOU_word)
|
||||
{
|
||||
std::cout << " Word =";
|
||||
std::cout << std::bitset<32>(BEIDOU_word);
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
bool Beidou_Dnav_Navigation_Message::read_navigation_bool(std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits, const std::vector<std::pair<int, int>>& parameter)
|
||||
|
||||
bool Beidou_Dnav_Navigation_Message::read_navigation_bool(
|
||||
std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits,
|
||||
const std::vector<std::pair<int32_t, int32_t>>& parameter)
|
||||
{
|
||||
bool value;
|
||||
|
||||
@ -241,15 +246,18 @@ bool Beidou_Dnav_Navigation_Message::read_navigation_bool(std::bitset<BEIDOU_DNA
|
||||
return value;
|
||||
}
|
||||
|
||||
unsigned long int Beidou_Dnav_Navigation_Message::read_navigation_unsigned(std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits, const std::vector<std::pair<int, int>>& parameter)
|
||||
|
||||
uint64_t Beidou_Dnav_Navigation_Message::read_navigation_unsigned(
|
||||
std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits,
|
||||
const std::vector<std::pair<int32_t, int32_t>>& parameter)
|
||||
{
|
||||
unsigned long int value = 0;
|
||||
int num_of_slices = parameter.size();
|
||||
for (int i = 0; i < num_of_slices; i++)
|
||||
uint64_t value = 0ULL;
|
||||
int32_t num_of_slices = parameter.size();
|
||||
for (int32_t i = 0; i < num_of_slices; i++)
|
||||
{
|
||||
for (int j = 0; j < parameter[i].second; j++)
|
||||
for (int32_t j = 0; j < parameter[i].second; j++)
|
||||
{
|
||||
value <<= 1; //shift left
|
||||
value <<= 1; // shift left
|
||||
if (bits[BEIDOU_DNAV_SUBFRAME_DATA_BITS - parameter[i].first - j] == 1)
|
||||
{
|
||||
value += 1; // insert the bit
|
||||
@ -259,30 +267,33 @@ unsigned long int Beidou_Dnav_Navigation_Message::read_navigation_unsigned(std::
|
||||
return value;
|
||||
}
|
||||
|
||||
signed long int Beidou_Dnav_Navigation_Message::read_navigation_signed(std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits, const std::vector<std::pair<int, int>>& parameter)
|
||||
|
||||
int64_t Beidou_Dnav_Navigation_Message::read_navigation_signed(
|
||||
std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits,
|
||||
const std::vector<std::pair<int32_t, int32_t>>& parameter)
|
||||
{
|
||||
signed long int value = 0;
|
||||
int num_of_slices = parameter.size();
|
||||
int64_t value = 0;
|
||||
int32_t num_of_slices = parameter.size();
|
||||
// Discriminate between 64 bits and 32 bits compiler
|
||||
int long_int_size_bytes = sizeof(signed long int);
|
||||
int32_t long_int_size_bytes = sizeof(int64_t);
|
||||
if (long_int_size_bytes == 8) // if a long int takes 8 bytes, we are in a 64 bits system
|
||||
{
|
||||
// read the MSB and perform the sign extension
|
||||
if (bits[BEIDOU_DNAV_SUBFRAME_DATA_BITS - parameter[0].first] == 1)
|
||||
{
|
||||
value ^= 0xFFFFFFFFFFFFFFFF; //64 bits variable
|
||||
value ^= 0xFFFFFFFFFFFFFFFF; // 64 bits variable
|
||||
}
|
||||
else
|
||||
{
|
||||
value &= 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < num_of_slices; i++)
|
||||
for (int32_t i = 0; i < num_of_slices; i++)
|
||||
{
|
||||
for (int j = 0; j < parameter[i].second; j++)
|
||||
for (int32_t j = 0; j < parameter[i].second; j++)
|
||||
{
|
||||
value <<= 1; //shift left
|
||||
value &= 0xFFFFFFFFFFFFFFFE; //reset the corresponding bit (for the 64 bits variable)
|
||||
value <<= 1; // shift left
|
||||
value &= 0xFFFFFFFFFFFFFFFE; // reset the corresponding bit (for the 64 bits variable)
|
||||
if (bits[BEIDOU_DNAV_SUBFRAME_DATA_BITS - parameter[i].first - j] == 1)
|
||||
{
|
||||
value += 1; // insert the bit
|
||||
@ -302,12 +313,12 @@ signed long int Beidou_Dnav_Navigation_Message::read_navigation_signed(std::bits
|
||||
value &= 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < num_of_slices; i++)
|
||||
for (int32_t i = 0; i < num_of_slices; i++)
|
||||
{
|
||||
for (int j = 0; j < parameter[i].second; j++)
|
||||
for (int32_t j = 0; j < parameter[i].second; j++)
|
||||
{
|
||||
value <<= 1; //shift left
|
||||
value &= 0xFFFFFFFE; //reset the corresponding bit
|
||||
value <<= 1; // shift left
|
||||
value &= 0xFFFFFFFE; // reset the corresponding bit
|
||||
if (bits[BEIDOU_DNAV_SUBFRAME_DATA_BITS - parameter[i].first - j] == 1)
|
||||
{
|
||||
value += 1; // insert the bit
|
||||
@ -318,6 +329,7 @@ signed long int Beidou_Dnav_Navigation_Message::read_navigation_signed(std::bits
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
double Beidou_Dnav_Navigation_Message::check_t(double time)
|
||||
{
|
||||
double corrTime;
|
||||
@ -334,6 +346,7 @@ double Beidou_Dnav_Navigation_Message::check_t(double time)
|
||||
return corrTime;
|
||||
}
|
||||
|
||||
|
||||
double Beidou_Dnav_Navigation_Message::sv_clock_correction(double transmitTime)
|
||||
{
|
||||
double dt;
|
||||
@ -343,6 +356,7 @@ double Beidou_Dnav_Navigation_Message::sv_clock_correction(double transmitTime)
|
||||
return correctedTime;
|
||||
}
|
||||
|
||||
|
||||
void Beidou_Dnav_Navigation_Message::satellitePosition(double transmitTime)
|
||||
{
|
||||
double tk;
|
||||
@ -384,7 +398,7 @@ void Beidou_Dnav_Navigation_Message::satellitePosition(double transmitTime)
|
||||
E = M;
|
||||
|
||||
// --- Iteratively compute eccentric anomaly ----------------------------
|
||||
for (int ii = 1; ii < 20; ii++)
|
||||
for (int32_t ii = 1; ii < 20; ii++)
|
||||
{
|
||||
E_old = E;
|
||||
E = M + d_eccentricity * sin(E);
|
||||
@ -437,9 +451,10 @@ void Beidou_Dnav_Navigation_Message::satellitePosition(double transmitTime)
|
||||
d_satvel_Z = d_satpos_Y * sin(i);
|
||||
}
|
||||
|
||||
int Beidou_Dnav_Navigation_Message::d1_subframe_decoder(std::string const& subframe)
|
||||
|
||||
int32_t Beidou_Dnav_Navigation_Message::d1_subframe_decoder(std::string const& subframe)
|
||||
{
|
||||
int subframe_ID = 0;
|
||||
int32_t subframe_ID = 0;
|
||||
std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> subframe_bits(subframe);
|
||||
|
||||
subframe_ID = static_cast<int>(read_navigation_unsigned(subframe_bits, D1_FRAID));
|
||||
@ -505,8 +520,6 @@ int Beidou_Dnav_Navigation_Message::d1_subframe_decoder(std::string const& subfr
|
||||
break;
|
||||
|
||||
case 2: // --- It is subframe 2 ---
|
||||
|
||||
|
||||
d_SOW_SF2 = static_cast<double>(read_navigation_unsigned(subframe_bits, D1_SOW));
|
||||
d_SOW = d_SOW_SF2; // Set transmission time
|
||||
|
||||
@ -541,7 +554,6 @@ int Beidou_Dnav_Navigation_Message::d1_subframe_decoder(std::string const& subfr
|
||||
break;
|
||||
|
||||
case 3: // --- It is subframe 3 ---
|
||||
|
||||
d_SOW_SF3 = static_cast<double>(read_navigation_unsigned(subframe_bits, D1_SOW));
|
||||
d_SOW = d_SOW_SF3; // Set transmission time
|
||||
|
||||
@ -615,7 +627,7 @@ int Beidou_Dnav_Navigation_Message::d1_subframe_decoder(std::string const& subfr
|
||||
break;
|
||||
|
||||
case 5: // --- It is subframe 5 ---
|
||||
int SV_page_5;
|
||||
int32_t SV_page_5;
|
||||
d_SOW_SF5 = static_cast<double>(read_navigation_unsigned(subframe_bits, D1_SOW));
|
||||
d_SOW = d_SOW_SF5; // Set transmission time
|
||||
|
||||
@ -731,10 +743,11 @@ int Beidou_Dnav_Navigation_Message::d1_subframe_decoder(std::string const& subfr
|
||||
return subframe_ID;
|
||||
}
|
||||
|
||||
int Beidou_Dnav_Navigation_Message::d2_subframe_decoder(std::string const& subframe)
|
||||
|
||||
int32_t Beidou_Dnav_Navigation_Message::d2_subframe_decoder(std::string const& subframe)
|
||||
{
|
||||
int subframe_ID = 0;
|
||||
int page_ID = 0;
|
||||
int32_t subframe_ID = 0;
|
||||
int32_t page_ID = 0;
|
||||
|
||||
std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> subframe_bits(subframe);
|
||||
|
||||
@ -920,6 +933,7 @@ int Beidou_Dnav_Navigation_Message::d2_subframe_decoder(std::string const& subfr
|
||||
return subframe_ID;
|
||||
}
|
||||
|
||||
|
||||
double Beidou_Dnav_Navigation_Message::utc_time(const double beidoutime_corrected) const
|
||||
{
|
||||
double t_utc;
|
||||
@ -927,12 +941,12 @@ double Beidou_Dnav_Navigation_Message::utc_time(const double beidoutime_correcte
|
||||
double Delta_t_UTC = d_DeltaT_LS + d_A0UTC + d_A1UTC * (beidoutime_corrected);
|
||||
|
||||
// Determine if the effectivity time of the leap second event is in the past
|
||||
int weeksToLeapSecondEvent = i_WN_LSF - i_BEIDOU_week;
|
||||
int32_t weeksToLeapSecondEvent = i_WN_LSF - i_BEIDOU_week;
|
||||
|
||||
if ((weeksToLeapSecondEvent) >= 0) // is not in the past
|
||||
{
|
||||
//Detect if the effectivity time and user's time is within six hours = 6 * 60 *60 = 21600 s
|
||||
int secondOfLeapSecondEvent = i_DN * 24 * 60 * 60;
|
||||
int32_t secondOfLeapSecondEvent = i_DN * 24 * 60 * 60;
|
||||
if (weeksToLeapSecondEvent > 0)
|
||||
{
|
||||
t_utc_daytime = fmod(beidoutime_corrected - Delta_t_UTC, 86400);
|
||||
@ -947,7 +961,7 @@ double Beidou_Dnav_Navigation_Message::utc_time(const double beidoutime_correcte
|
||||
{
|
||||
if ((beidoutime_corrected - secondOfLeapSecondEvent) < (5 / 4) * 24 * 60 * 60)
|
||||
{
|
||||
int W = fmod(beidoutime_corrected - Delta_t_UTC - 43200, 86400) + 43200;
|
||||
int32_t W = fmod(beidoutime_corrected - Delta_t_UTC - 43200, 86400) + 43200;
|
||||
t_utc_daytime = fmod(W, 86400 + d_DeltaT_LSF - d_DeltaT_LS);
|
||||
}
|
||||
else
|
||||
@ -967,6 +981,7 @@ double Beidou_Dnav_Navigation_Message::utc_time(const double beidoutime_correcte
|
||||
return t_utc;
|
||||
}
|
||||
|
||||
|
||||
Beidou_Dnav_Ephemeris Beidou_Dnav_Navigation_Message::get_ephemeris()
|
||||
{
|
||||
Beidou_Dnav_Ephemeris eph;
|
||||
@ -1064,6 +1079,7 @@ Beidou_Dnav_Ephemeris Beidou_Dnav_Navigation_Message::get_ephemeris()
|
||||
return eph;
|
||||
}
|
||||
|
||||
|
||||
Beidou_Dnav_Iono Beidou_Dnav_Navigation_Message::get_iono()
|
||||
{
|
||||
Beidou_Dnav_Iono iono;
|
||||
@ -1081,6 +1097,7 @@ Beidou_Dnav_Iono Beidou_Dnav_Navigation_Message::get_iono()
|
||||
return iono;
|
||||
}
|
||||
|
||||
|
||||
Beidou_Dnav_Utc_Model Beidou_Dnav_Navigation_Message::get_utc_model()
|
||||
{
|
||||
Beidou_Dnav_Utc_Model utc_model;
|
||||
@ -1105,6 +1122,7 @@ Beidou_Dnav_Utc_Model Beidou_Dnav_Navigation_Message::get_utc_model()
|
||||
return utc_model;
|
||||
}
|
||||
|
||||
|
||||
bool Beidou_Dnav_Navigation_Message::have_new_ephemeris() // Check if we have a new ephemeris stored in the galileo navigation class
|
||||
{
|
||||
if (i_satellite_PRN > 0 and i_satellite_PRN < 6)
|
||||
@ -1160,6 +1178,7 @@ bool Beidou_Dnav_Navigation_Message::have_new_ephemeris() // Check if we have a
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Beidou_Dnav_Navigation_Message::have_new_iono()
|
||||
{
|
||||
// the condition on flag_utc_model is added to have a time stamp for iono
|
||||
@ -1171,6 +1190,7 @@ bool Beidou_Dnav_Navigation_Message::have_new_iono()
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Beidou_Dnav_Navigation_Message::have_new_utc_model()
|
||||
{
|
||||
if (flag_d1_sf5_p9 == true and flag_d1_sf5_p10 == true)
|
||||
@ -1185,6 +1205,7 @@ bool Beidou_Dnav_Navigation_Message::have_new_utc_model()
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Beidou_Dnav_Navigation_Message::have_new_almanac()
|
||||
{
|
||||
if ((flag_d1_sf4 == true) and (flag_d1_sf5 == true))
|
||||
@ -1199,6 +1220,7 @@ bool Beidou_Dnav_Navigation_Message::have_new_almanac()
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Beidou_Dnav_Navigation_Message::satellite_validation()
|
||||
{
|
||||
bool flag_data_valid = false;
|
||||
|
@ -54,10 +54,10 @@
|
||||
class Beidou_Dnav_Navigation_Message
|
||||
{
|
||||
private:
|
||||
unsigned long int read_navigation_unsigned(std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits, const std::vector<std::pair<int, int>>& parameter);
|
||||
signed long int read_navigation_signed(std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits, const std::vector<std::pair<int, int>>& parameter);
|
||||
bool read_navigation_bool(std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits, const std::vector<std::pair<int, int>>& parameter);
|
||||
void print_beidou_word_bytes(unsigned int BEIDOU_word);
|
||||
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
|
||||
*
|
||||
@ -130,15 +130,15 @@ public:
|
||||
double d_OMEGA_DOT; //!< Rate of Right Ascension [semi-circles/s]
|
||||
//broadcast orbit 5
|
||||
double d_IDOT; //!< Rate of Inclination Angle [semi-circles/s]
|
||||
int i_BEIDOU_week; //!< BeiDou week number, aka WN [week]
|
||||
int32_t i_BEIDOU_week; //!< BeiDou week number, aka WN [week]
|
||||
//broadcast orbit 6
|
||||
int i_SV_accuracy; //!< User Range Accuracy (URA) index of the SV
|
||||
int i_SV_health;
|
||||
int32_t i_SV_accuracy; //!< User Range Accuracy (URA) index of the SV
|
||||
int32_t i_SV_health;
|
||||
double d_TGD1; //!< Estimated Group Delay Differential in B1 [s]
|
||||
double d_TGD2; //!< Estimated Group Delay Differential in B2 [s]
|
||||
double d_AODC; //!< Age of Data, Clock
|
||||
//broadcast orbit 7
|
||||
// int i_AODO; //!< Age of Data Offset (AODO) term for the navigation message correction table (NMCT) contained in subframe 4 (reference paragraph 20.3.3.5.1.9) [s]
|
||||
// int32_t i_AODO; //!< Age of Data Offset (AODO) term for the navigation message correction table (NMCT) contained in subframe 4 (reference paragraph 20.3.3.5.1.9) [s]
|
||||
|
||||
bool b_fit_interval_flag; //!< indicates the curve-fit interval used by the CS (Block II/IIA/IIR/IIR-M/IIF) and SS (Block IIIA) in determining the ephemeris parameters, as follows: 0 = 4 hours, 1 = greater than 4 hours.
|
||||
double d_spare1;
|
||||
@ -149,29 +149,29 @@ public:
|
||||
double d_A_f2; //!< Clock correction parameters. Coefficient 2 of code phase offset model [s/s^2]
|
||||
|
||||
// D2 NAV Message Decoding
|
||||
unsigned long int d_A_f1_msb_bits; //!< Clock correction parameters, D2 NAV MSB
|
||||
unsigned long int d_A_f1_lsb_bits; //!< Clock correction parameters, D2 NAV LSB
|
||||
unsigned long int d_Cuc_msb_bits; //!< Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude [rad]
|
||||
unsigned long int d_Cuc_lsb_bits; //!< Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude [rad]
|
||||
unsigned long int d_eccentricity_msb; //!< Eccentricity [dimensionless]
|
||||
unsigned long int d_eccentricity_lsb; //!< Eccentricity [dimensionless]
|
||||
unsigned long int d_Cic_msb_bits; //!< Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude [rad]
|
||||
unsigned long int d_Cic_lsb_bits; //!< Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude [rad]
|
||||
unsigned long int d_eccentricity_msb_bits; //!< Eccentricity [dimensionless]
|
||||
unsigned long int d_eccentricity_lsb_bits;
|
||||
unsigned long int d_i_0_msb_bits; //!< Inclination Angle at Reference Time [semi-circles]
|
||||
unsigned long int d_i_0_lsb_bits; //!< Inclination Angle at Reference Time [semi-circles]
|
||||
unsigned long int d_OMEGA_msb_bits; //!< Argument of Perigee [semi-cicles]
|
||||
unsigned long int d_OMEGA_lsb_bits; //!< Argument of Perigee [semi-cicles]
|
||||
unsigned long int d_OMEGA_DOT_msb_bits; //!< Rate of Right Ascension [semi-circles/s]
|
||||
unsigned long int d_OMEGA_DOT_lsb_bits; //!< Rate of Right Ascension [semi-circles/s]
|
||||
uint64_t d_A_f1_msb_bits; //!< Clock correction parameters, D2 NAV MSB
|
||||
uint64_t d_A_f1_lsb_bits; //!< Clock correction parameters, D2 NAV LSB
|
||||
uint64_t d_Cuc_msb_bits; //!< Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude [rad]
|
||||
uint64_t d_Cuc_lsb_bits; //!< Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude [rad]
|
||||
uint64_t d_eccentricity_msb; //!< Eccentricity [dimensionless]
|
||||
uint64_t d_eccentricity_lsb; //!< Eccentricity [dimensionless]
|
||||
uint64_t d_Cic_msb_bits; //!< Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude [rad]
|
||||
uint64_t d_Cic_lsb_bits; //!< Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude [rad]
|
||||
uint64_t d_eccentricity_msb_bits; //!< Eccentricity [dimensionless]
|
||||
uint64_t d_eccentricity_lsb_bits;
|
||||
uint64_t d_i_0_msb_bits; //!< Inclination Angle at Reference Time [semi-circles]
|
||||
uint64_t d_i_0_lsb_bits; //!< Inclination Angle at Reference Time [semi-circles]
|
||||
uint64_t d_OMEGA_msb_bits; //!< Argument of Perigee [semi-cicles]
|
||||
uint64_t d_OMEGA_lsb_bits; //!< Argument of Perigee [semi-cicles]
|
||||
uint64_t d_OMEGA_DOT_msb_bits; //!< Rate of Right Ascension [semi-circles/s]
|
||||
uint64_t d_OMEGA_DOT_lsb_bits; //!< Rate of Right Ascension [semi-circles/s]
|
||||
|
||||
// Almanac
|
||||
double d_Toa; //!< Almanac reference time [s]
|
||||
int i_WN_A; //!< Modulo 256 of the GPS week number to which the almanac reference time (d_Toa) is referenced
|
||||
std::map<int, int> almanacHealth; //!< Map that stores the health information stored in the almanac
|
||||
int32_t i_WN_A; //!< Modulo 256 of the GPS week number to which the almanac reference time (d_Toa) is referenced
|
||||
std::map<int32_t, int32_t> almanacHealth; //!< Map that stores the health information stored in the almanac
|
||||
|
||||
std::map<int, std::string> satelliteBlock; //!< Map that stores to which block the PRN belongs http://www.navcen.uscg.gov/?Do=constellationStatus
|
||||
std::map<int32_t, std::string> satelliteBlock; //!< Map that stores to which block the PRN belongs http://www.navcen.uscg.gov/?Do=constellationStatus
|
||||
|
||||
// Flags
|
||||
|
||||
@ -201,8 +201,8 @@ public:
|
||||
double d_satpos_Z; //!< Earth-fixed coordinate z of the satellite [m]. The direction of the IERS (International Earth Rotation and Reference Systems Service) Reference Pole (IRP).
|
||||
|
||||
// satellite identification info
|
||||
int i_channel_ID;
|
||||
unsigned int i_satellite_PRN;
|
||||
int32_t i_channel_ID;
|
||||
uint32_t i_satellite_PRN;
|
||||
|
||||
// time synchro
|
||||
double d_subframe_timestamp_ms; //[ms]
|
||||
@ -221,8 +221,8 @@ public:
|
||||
double d_A1UTC; //!< 1st order term of a model that relates GPS and UTC time (ref. 20.3.3.5.2.4 IS-GPS-200E) [s/s]
|
||||
double d_A0UTC; //!< Constant of a model that relates GPS and UTC time (ref. 20.3.3.5.2.4 IS-GPS-200E) [s]
|
||||
double d_DeltaT_LS; //!< delta time due to leap seconds [s]. Number of leap seconds since 6-Jan-1980 as transmitted by the GPS almanac.
|
||||
int i_WN_LSF; //!< Week number at the end of which the leap second becomes effective [weeks]
|
||||
int i_DN; //!< Day number (DN) at the end of which the leap second becomes effective [days]
|
||||
int32_t i_WN_LSF; //!< Week number at the end of which the leap second becomes effective [weeks]
|
||||
int32_t i_DN; //!< Day number (DN) at the end of which the leap second becomes effective [days]
|
||||
double d_DeltaT_LSF; //!< Scheduled future or recent past (relative to NAV message upload) value of the delta time due to leap seconds [s]
|
||||
double d_A1GPS;
|
||||
double d_A0GPS;
|
||||
@ -241,7 +241,7 @@ public:
|
||||
double d_OMEGA_DOT_ALMANAC;
|
||||
double d_OMEGA_ALMANAC;
|
||||
double d_M0_ALMANAC;
|
||||
int almanac_WN;
|
||||
int32_t almanac_WN;
|
||||
double d_toa2;
|
||||
|
||||
// Satellite velocity
|
||||
@ -272,12 +272,12 @@ public:
|
||||
/*!
|
||||
* \brief Decodes the BDS D1 NAV message
|
||||
*/
|
||||
int d1_subframe_decoder(std::string const& subframe);
|
||||
int32_t d1_subframe_decoder(std::string const& subframe);
|
||||
|
||||
/*!
|
||||
* \brief Decodes the BDS D2 NAV message
|
||||
*/
|
||||
int d2_subframe_decoder(std::string const& subframe);
|
||||
int32_t d2_subframe_decoder(std::string const& subframe);
|
||||
|
||||
/*!
|
||||
* \brief Computes the position of the satellite
|
||||
|
Loading…
Reference in New Issue
Block a user