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

Merge branch 'vladisslav2011-beidou_prn_fix' into next

This commit is contained in:
Carles Fernandez 2022-07-15 17:00:21 +02:00
commit a2db5cd452
18 changed files with 154 additions and 139 deletions

View File

@ -463,7 +463,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
std::map<int, Glonass_Gnav_Ephemeris>::const_iterator glonass_gnav_ephemeris_iter; std::map<int, Glonass_Gnav_Ephemeris>::const_iterator glonass_gnav_ephemeris_iter;
std::map<int, Beidou_Dnav_Ephemeris>::const_iterator beidou_ephemeris_iter; std::map<int, Beidou_Dnav_Ephemeris>::const_iterator beidou_ephemeris_iter;
const Glonass_Gnav_Utc_Model gnav_utc = this->glonass_gnav_utc_model; const Glonass_Gnav_Utc_Model &gnav_utc = this->glonass_gnav_utc_model;
this->set_averaging_flag(flag_averaging); this->set_averaging_flag(flag_averaging);
@ -900,89 +900,89 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
if ((valid_obs + glo_valid_obs) > 3) if ((valid_obs + glo_valid_obs) > 3)
{ {
int result = 0; int result = 0;
nav_t nav_data{}; d_nav_data = {};
nav_data.eph = eph_data.data(); d_nav_data.eph = eph_data.data();
nav_data.geph = geph_data.data(); d_nav_data.geph = geph_data.data();
nav_data.n = valid_obs; d_nav_data.n = valid_obs;
nav_data.ng = glo_valid_obs; d_nav_data.ng = glo_valid_obs;
if (gps_iono.valid) if (gps_iono.valid)
{ {
nav_data.ion_gps[0] = gps_iono.alpha0; d_nav_data.ion_gps[0] = gps_iono.alpha0;
nav_data.ion_gps[1] = gps_iono.alpha1; d_nav_data.ion_gps[1] = gps_iono.alpha1;
nav_data.ion_gps[2] = gps_iono.alpha2; d_nav_data.ion_gps[2] = gps_iono.alpha2;
nav_data.ion_gps[3] = gps_iono.alpha3; d_nav_data.ion_gps[3] = gps_iono.alpha3;
nav_data.ion_gps[4] = gps_iono.beta0; d_nav_data.ion_gps[4] = gps_iono.beta0;
nav_data.ion_gps[5] = gps_iono.beta1; d_nav_data.ion_gps[5] = gps_iono.beta1;
nav_data.ion_gps[6] = gps_iono.beta2; d_nav_data.ion_gps[6] = gps_iono.beta2;
nav_data.ion_gps[7] = gps_iono.beta3; d_nav_data.ion_gps[7] = gps_iono.beta3;
} }
if (!(gps_iono.valid) and gps_cnav_iono.valid) if (!(gps_iono.valid) and gps_cnav_iono.valid)
{ {
nav_data.ion_gps[0] = gps_cnav_iono.alpha0; d_nav_data.ion_gps[0] = gps_cnav_iono.alpha0;
nav_data.ion_gps[1] = gps_cnav_iono.alpha1; d_nav_data.ion_gps[1] = gps_cnav_iono.alpha1;
nav_data.ion_gps[2] = gps_cnav_iono.alpha2; d_nav_data.ion_gps[2] = gps_cnav_iono.alpha2;
nav_data.ion_gps[3] = gps_cnav_iono.alpha3; d_nav_data.ion_gps[3] = gps_cnav_iono.alpha3;
nav_data.ion_gps[4] = gps_cnav_iono.beta0; d_nav_data.ion_gps[4] = gps_cnav_iono.beta0;
nav_data.ion_gps[5] = gps_cnav_iono.beta1; d_nav_data.ion_gps[5] = gps_cnav_iono.beta1;
nav_data.ion_gps[6] = gps_cnav_iono.beta2; d_nav_data.ion_gps[6] = gps_cnav_iono.beta2;
nav_data.ion_gps[7] = gps_cnav_iono.beta3; d_nav_data.ion_gps[7] = gps_cnav_iono.beta3;
} }
if (galileo_iono.ai0 != 0.0) if (galileo_iono.ai0 != 0.0)
{ {
nav_data.ion_gal[0] = galileo_iono.ai0; d_nav_data.ion_gal[0] = galileo_iono.ai0;
nav_data.ion_gal[1] = galileo_iono.ai1; d_nav_data.ion_gal[1] = galileo_iono.ai1;
nav_data.ion_gal[2] = galileo_iono.ai2; d_nav_data.ion_gal[2] = galileo_iono.ai2;
nav_data.ion_gal[3] = 0.0; d_nav_data.ion_gal[3] = 0.0;
} }
if (beidou_dnav_iono.valid) if (beidou_dnav_iono.valid)
{ {
nav_data.ion_cmp[0] = beidou_dnav_iono.alpha0; d_nav_data.ion_cmp[0] = beidou_dnav_iono.alpha0;
nav_data.ion_cmp[1] = beidou_dnav_iono.alpha1; d_nav_data.ion_cmp[1] = beidou_dnav_iono.alpha1;
nav_data.ion_cmp[2] = beidou_dnav_iono.alpha2; d_nav_data.ion_cmp[2] = beidou_dnav_iono.alpha2;
nav_data.ion_cmp[3] = beidou_dnav_iono.alpha3; d_nav_data.ion_cmp[3] = beidou_dnav_iono.alpha3;
nav_data.ion_cmp[4] = beidou_dnav_iono.beta0; d_nav_data.ion_cmp[4] = beidou_dnav_iono.beta0;
nav_data.ion_cmp[5] = beidou_dnav_iono.beta0; d_nav_data.ion_cmp[5] = beidou_dnav_iono.beta0;
nav_data.ion_cmp[6] = beidou_dnav_iono.beta0; d_nav_data.ion_cmp[6] = beidou_dnav_iono.beta0;
nav_data.ion_cmp[7] = beidou_dnav_iono.beta3; d_nav_data.ion_cmp[7] = beidou_dnav_iono.beta3;
} }
if (gps_utc_model.valid) if (gps_utc_model.valid)
{ {
nav_data.utc_gps[0] = gps_utc_model.A0; d_nav_data.utc_gps[0] = gps_utc_model.A0;
nav_data.utc_gps[1] = gps_utc_model.A1; d_nav_data.utc_gps[1] = gps_utc_model.A1;
nav_data.utc_gps[2] = gps_utc_model.tot; d_nav_data.utc_gps[2] = gps_utc_model.tot;
nav_data.utc_gps[3] = gps_utc_model.WN_T; d_nav_data.utc_gps[3] = gps_utc_model.WN_T;
nav_data.leaps = gps_utc_model.DeltaT_LS; d_nav_data.leaps = gps_utc_model.DeltaT_LS;
} }
if (!(gps_utc_model.valid) and gps_cnav_utc_model.valid) if (!(gps_utc_model.valid) and gps_cnav_utc_model.valid)
{ {
nav_data.utc_gps[0] = gps_cnav_utc_model.A0; d_nav_data.utc_gps[0] = gps_cnav_utc_model.A0;
nav_data.utc_gps[1] = gps_cnav_utc_model.A1; d_nav_data.utc_gps[1] = gps_cnav_utc_model.A1;
nav_data.utc_gps[2] = gps_cnav_utc_model.tot; d_nav_data.utc_gps[2] = gps_cnav_utc_model.tot;
nav_data.utc_gps[3] = gps_cnav_utc_model.WN_T; d_nav_data.utc_gps[3] = gps_cnav_utc_model.WN_T;
nav_data.leaps = gps_cnav_utc_model.DeltaT_LS; d_nav_data.leaps = gps_cnav_utc_model.DeltaT_LS;
} }
if (glonass_gnav_utc_model.valid) if (glonass_gnav_utc_model.valid)
{ {
nav_data.utc_glo[0] = glonass_gnav_utc_model.d_tau_c; // ?? d_nav_data.utc_glo[0] = glonass_gnav_utc_model.d_tau_c; // ??
nav_data.utc_glo[1] = 0.0; // ?? d_nav_data.utc_glo[1] = 0.0; // ??
nav_data.utc_glo[2] = 0.0; // ?? d_nav_data.utc_glo[2] = 0.0; // ??
nav_data.utc_glo[3] = 0.0; // ?? d_nav_data.utc_glo[3] = 0.0; // ??
} }
if (galileo_utc_model.A0 != 0.0) if (galileo_utc_model.A0 != 0.0)
{ {
nav_data.utc_gal[0] = galileo_utc_model.A0; d_nav_data.utc_gal[0] = galileo_utc_model.A0;
nav_data.utc_gal[1] = galileo_utc_model.A1; d_nav_data.utc_gal[1] = galileo_utc_model.A1;
nav_data.utc_gal[2] = galileo_utc_model.tot; d_nav_data.utc_gal[2] = galileo_utc_model.tot;
nav_data.utc_gal[3] = galileo_utc_model.WNot; d_nav_data.utc_gal[3] = galileo_utc_model.WNot;
nav_data.leaps = galileo_utc_model.Delta_tLS; d_nav_data.leaps = galileo_utc_model.Delta_tLS;
} }
if (beidou_dnav_utc_model.valid) if (beidou_dnav_utc_model.valid)
{ {
nav_data.utc_cmp[0] = beidou_dnav_utc_model.A0_UTC; d_nav_data.utc_cmp[0] = beidou_dnav_utc_model.A0_UTC;
nav_data.utc_cmp[1] = beidou_dnav_utc_model.A1_UTC; d_nav_data.utc_cmp[1] = beidou_dnav_utc_model.A1_UTC;
nav_data.utc_cmp[2] = 0.0; // ?? d_nav_data.utc_cmp[2] = 0.0; // ??
nav_data.utc_cmp[3] = 0.0; // ?? d_nav_data.utc_cmp[3] = 0.0; // ??
nav_data.leaps = beidou_dnav_utc_model.DeltaT_LS; d_nav_data.leaps = beidou_dnav_utc_model.DeltaT_LS;
} }
/* update carrier wave length using native function call in RTKlib */ /* update carrier wave length using native function call in RTKlib */
@ -990,11 +990,11 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
{ {
for (int j = 0; j < NFREQ; j++) for (int j = 0; j < NFREQ; j++)
{ {
nav_data.lam[i][j] = satwavelen(i + 1, d_rtklib_freq_index[j], &nav_data); d_nav_data.lam[i][j] = satwavelen(i + 1, d_rtklib_freq_index[j], &d_nav_data);
} }
} }
result = rtkpos(&d_rtk, d_obs_data.data(), valid_obs + glo_valid_obs, &nav_data); result = rtkpos(&d_rtk, d_obs_data.data(), valid_obs + glo_valid_obs, &d_nav_data);
if (result == 0) if (result == 0)
{ {
@ -1095,7 +1095,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
// TOW // TOW
d_monitor_pvt.TOW_at_current_symbol_ms = gnss_observables_map.cbegin()->second.TOW_at_current_symbol_ms; d_monitor_pvt.TOW_at_current_symbol_ms = gnss_observables_map.cbegin()->second.TOW_at_current_symbol_ms;
// WEEK // WEEK
d_monitor_pvt.week = adjgpsweek(nav_data.eph[0].week, this->is_pre_2009()); d_monitor_pvt.week = adjgpsweek(d_nav_data.eph[0].week, this->is_pre_2009());
// PVT GPS time // PVT GPS time
d_monitor_pvt.RX_time = gnss_observables_map.cbegin()->second.RX_time; d_monitor_pvt.RX_time = gnss_observables_map.cbegin()->second.RX_time;
// User clock offset [s] // User clock offset [s]
@ -1161,7 +1161,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
tmp_uint32 = gnss_observables_map.cbegin()->second.TOW_at_current_symbol_ms; tmp_uint32 = gnss_observables_map.cbegin()->second.TOW_at_current_symbol_ms;
d_dump_file.write(reinterpret_cast<char *>(&tmp_uint32), sizeof(uint32_t)); d_dump_file.write(reinterpret_cast<char *>(&tmp_uint32), sizeof(uint32_t));
// WEEK // WEEK
tmp_uint32 = adjgpsweek(nav_data.eph[0].week, this->is_pre_2009()); tmp_uint32 = adjgpsweek(d_nav_data.eph[0].week, this->is_pre_2009());
d_dump_file.write(reinterpret_cast<char *>(&tmp_uint32), sizeof(uint32_t)); d_dump_file.write(reinterpret_cast<char *>(&tmp_uint32), sizeof(uint32_t));
// PVT GPS time // PVT GPS time
tmp_double = gnss_observables_map.cbegin()->second.RX_time; tmp_double = gnss_observables_map.cbegin()->second.RX_time;

View File

@ -128,6 +128,7 @@ private:
std::string d_dump_filename; std::string d_dump_filename;
std::ofstream d_dump_file; std::ofstream d_dump_file;
rtk_t d_rtk{}; rtk_t d_rtk{};
nav_t d_nav_data{};
Monitor_Pvt d_monitor_pvt{}; Monitor_Pvt d_monitor_pvt{};
uint32_t d_type_of_rx; uint32_t d_type_of_rx;
bool d_flag_dump_enabled; bool d_flag_dump_enabled;

View File

@ -26,11 +26,9 @@ const auto AUX_CEIL = [](float x) { return static_cast<int32_t>(static_cast<int6
void beidou_b1i_code_gen_int(own::span<int32_t> dest, int32_t prn, uint32_t chip_shift) void beidou_b1i_code_gen_int(own::span<int32_t> dest, int32_t prn, uint32_t chip_shift)
{ {
constexpr uint32_t code_length = 2046; constexpr uint32_t code_length = 2046;
const std::array<int32_t, 33> delays = {712 /*PRN1*/, 1581, 1414, 1550, 581, 771, 1311, 1043, 1549, 359, 710, 1579, 1548, 1103, 579, 769, 358, 709, 1411, 1547, const std::array<int32_t, 63> phase1 = {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, 2, 3, 3, 3, 3, 3, 4, 4, 5, 5, 5, 5, 6, 8, 9, 9, 3, 5, 7, 4, 4, 5, 5, 5, 5, 6};
1102, 578, 357, 1577, 1410, 1546, 1101, 707, 1576, 1409, 1545, 354 /*PRN32*/, const std::array<int32_t, 63> phase2 = {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, 7, 4, 6, 8, 10, 11, 5, 9, 6, 8, 10, 11, 9, 9, 10, 11, 7, 7, 9, 5, 9, 6, 8, 10, 11, 9};
705}; const std::array<int32_t, 63> phase3 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3};
const std::array<int32_t, 37> phase1 = {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 std::array<int32_t, 37> phase2 = {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};
std::bitset<code_length> G1{}; std::bitset<code_length> G1{};
std::bitset<code_length> G2{}; std::bitset<code_length> G2{};
@ -50,7 +48,7 @@ void beidou_b1i_code_gen_int(own::span<int32_t> dest, int32_t prn, uint32_t chip
prn_idx = prn - 1; prn_idx = prn - 1;
// A simple error check // A simple error check
if ((prn_idx < 0) || (prn_idx > 32)) if ((prn_idx < 0) || (prn_idx > 62))
{ {
return; return;
} }
@ -59,7 +57,7 @@ void beidou_b1i_code_gen_int(own::span<int32_t> dest, int32_t prn, uint32_t chip
for (lcv = 0; lcv < code_length; lcv++) for (lcv = 0; lcv < code_length; lcv++)
{ {
G1[lcv] = G1_register[0]; G1[lcv] = G1_register[0];
G2[lcv] = G2_register[-(phase1[prn_idx] - 11)] xor G2_register[-(phase2[prn_idx] - 11)]; G2[lcv] = G2_register[-(phase1[prn_idx] - 11)] xor G2_register[-(phase2[prn_idx] - 11)] xor (phase3[prn_idx] ? G2_register[-(phase3[prn_idx] - 11)] : 0);
feedback1 = G1_register[0] xor G1_register[1] xor G1_register[2] xor G1_register[3] xor G1_register[4] xor G1_register[10]; feedback1 = G1_register[0] xor G1_register[1] xor G1_register[2] xor G1_register[3] xor G1_register[4] xor G1_register[10];
feedback2 = G2_register[0] xor G2_register[2] xor G2_register[3] xor G2_register[6] xor G2_register[7] xor G2_register[8] xor G2_register[9] xor G2_register[10]; feedback2 = G2_register[0] xor G2_register[2] xor G2_register[3] xor G2_register[6] xor G2_register[7] xor G2_register[8] xor G2_register[9] xor G2_register[10];
@ -75,7 +73,7 @@ void beidou_b1i_code_gen_int(own::span<int32_t> dest, int32_t prn, uint32_t chip
} }
// Set the delay // Set the delay
delay = code_length - delays[prn_idx] * 0; // ********************************* delay = code_length; // *********************************
delay += chip_shift; delay += chip_shift;
delay %= code_length; delay %= code_length;

View File

@ -202,7 +202,7 @@ const int NSYSQZS = 0;
#define ENABDS #define ENABDS
#ifdef ENABDS #ifdef ENABDS
const int MINPRNBDS = 1; //!< min satellite sat number of BeiDou const int MINPRNBDS = 1; //!< min satellite sat number of BeiDou
const int MAXPRNBDS = 37; //!< max satellite sat number of BeiDou const int MAXPRNBDS = 63; //!< max satellite sat number of BeiDou
const int NSATBDS = (MAXPRNBDS - MINPRNBDS + 1); //!< number of BeiDou satellites const int NSATBDS = (MAXPRNBDS - MINPRNBDS + 1); //!< number of BeiDou satellites
const int NSYSBDS = 1; const int NSYSBDS = 1;
#else #else

View File

@ -34,6 +34,7 @@
#include "rtklib_preceph.h" #include "rtklib_preceph.h"
#include "rtklib_rtkcmn.h" #include "rtklib_rtkcmn.h"
#include "rtklib_sbas.h" #include "rtklib_sbas.h"
#include <vector>
/* constants -----------------------------------------------------------------*/ /* constants -----------------------------------------------------------------*/
@ -284,7 +285,7 @@ void eph2pos(gtime_t time, const eph_t *eph, double *rs, double *dts,
cosi = cos(i); cosi = cos(i);
/* beidou geo satellite (ref [9]) */ /* beidou geo satellite (ref [9]) */
if (sys == SYS_BDS && prn <= 5) if (sys == SYS_BDS && (prn <= 5 || prn > 58))
{ {
O = eph->OMG0 + eph->OMGd * tk - omge * eph->toes; O = eph->OMG0 + eph->OMGd * tk - omge * eph->toes;
sinO = sin(O); sinO = sin(O);
@ -1023,7 +1024,7 @@ int satpos(gtime_t time, gtime_t teph, int sat, int ephopt,
void satposs(gtime_t teph, const obsd_t *obs, int n, const nav_t *nav, void satposs(gtime_t teph, const obsd_t *obs, int n, const nav_t *nav,
int ephopt, double *rs, double *dts, double *var, int *svh) int ephopt, double *rs, double *dts, double *var, int *svh)
{ {
gtime_t time[MAXOBS] = {}; std::vector<gtime_t> time(MAXOBS);
double dt; double dt;
double pr; double pr;
int i; int i;

View File

@ -39,6 +39,7 @@
#include "rtklib_ionex.h" #include "rtklib_ionex.h"
#include "rtklib_rtkcmn.h" #include "rtklib_rtkcmn.h"
#include <cstring> #include <cstring>
#include <vector>
/* get index -----------------------------------------------------------------*/ /* get index -----------------------------------------------------------------*/
int getindex(double value, const double *range) int getindex(double value, const double *range)
@ -425,8 +426,8 @@ void readtec(const char *file, nav_t *nav, int opt)
double hgts[3] = {0}; double hgts[3] = {0};
double rb = 0.0; double rb = 0.0;
double nexp = -1.0; double nexp = -1.0;
double dcb[MAXSAT] = {0}; std::vector<double> dcb(MAXSAT, 0);
double rms[MAXSAT] = {0}; std::vector<double> rms(MAXSAT, 0);
int i; int i;
int n; int n;
char *efiles[MAXEXFILE]; char *efiles[MAXEXFILE];
@ -463,7 +464,7 @@ void readtec(const char *file, nav_t *nav, int opt)
} }
/* read ionex header */ /* read ionex header */
if (readionexh(fp, lats, lons, hgts, &rb, &nexp, dcb, rms) <= 0.0) if (readionexh(fp, lats, lons, hgts, &rb, &nexp, dcb.data(), rms.data()) <= 0.0)
{ {
trace(2, "ionex file format error %s\n", efiles[i]); trace(2, "ionex file format error %s\n", efiles[i]);
fclose(fp); fclose(fp);

View File

@ -34,6 +34,7 @@
#include "rtklib_ionex.h" #include "rtklib_ionex.h"
#include "rtklib_sbas.h" #include "rtklib_sbas.h"
#include <cstring> #include <cstring>
#include <vector>
/* pseudorange measurement error variance ------------------------------------*/ /* pseudorange measurement error variance ------------------------------------*/
double varerr(const prcopt_t *opt, double el, int sys) double varerr(const prcopt_t *opt, double el, int sys)
@ -988,8 +989,8 @@ int pntpos(const obsd_t *obs, int n, const nav_t *nav,
double *resp; double *resp;
int i; int i;
int stat; int stat;
int vsat[MAXOBS] = {0}; std::vector<int> vsat(MAXOBS, 0);
int svh[MAXOBS]; std::vector<int> svh(MAXOBS, 0);
sol->stat = SOLQ_NONE; sol->stat = SOLQ_NONE;
@ -1019,20 +1020,20 @@ int pntpos(const obsd_t *obs, int n, const nav_t *nav,
opt_.tropopt = TROPOPT_SAAS; opt_.tropopt = TROPOPT_SAAS;
} }
/* satellite positions, velocities and clocks */ /* satellite positions, velocities and clocks */
satposs(sol->time, obs, n, nav, opt_.sateph, rs, dts, var, svh); satposs(sol->time, obs, n, nav, opt_.sateph, rs, dts, var, svh.data());
/* estimate receiver position with pseudorange */ /* estimate receiver position with pseudorange */
stat = estpos(obs, n, rs, dts, var, svh, nav, &opt_, sol, azel_, vsat, resp, msg); stat = estpos(obs, n, rs, dts, var, svh.data(), nav, &opt_, sol, azel_, vsat.data(), resp, msg);
/* raim fde */ /* raim fde */
if (!stat && n >= 6 && opt->posopt[4]) if (!stat && n >= 6 && opt->posopt[4])
{ {
stat = raim_fde(obs, n, rs, dts, var, svh, nav, &opt_, sol, azel_, vsat, resp, msg); stat = raim_fde(obs, n, rs, dts, var, svh.data(), nav, &opt_, sol, azel_, vsat.data(), resp, msg);
} }
/* estimate receiver velocity with doppler */ /* estimate receiver velocity with doppler */
if (stat) if (stat)
{ {
estvel(obs, n, rs, dts, nav, &opt_, sol, azel_, vsat); estvel(obs, n, rs, dts, nav, &opt_, sol, azel_, vsat.data());
} }
if (azel) if (azel)

View File

@ -38,6 +38,7 @@
#include "rtklib_sbas.h" #include "rtklib_sbas.h"
#include "rtklib_tides.h" #include "rtklib_tides.h"
#include <cstring> #include <cstring>
#include <vector>
/* wave length of LC (m) -----------------------------------------------------*/ /* wave length of LC (m) -----------------------------------------------------*/
double lam_LC(int i, int j, int k) double lam_LC(int i, int j, int k)
@ -351,7 +352,7 @@ int sel_amb(int *sat1, int *sat2, double *N, double *var, int n)
{ {
int i; int i;
int j; int j;
int flgs[MAXSAT] = {0}; std::vector<int> flgs(MAXSAT, 0);
int max_flg = 0; int max_flg = 0;
/* sort by variance */ /* sort by variance */
@ -372,7 +373,7 @@ int sel_amb(int *sat1, int *sat2, double *N, double *var, int n)
/* select linearly independent satellite pair */ /* select linearly independent satellite pair */
for (i = j = 0; i < n; i++) for (i = j = 0; i < n; i++)
{ {
if (!is_depend(sat1[i], sat2[i], flgs, &max_flg)) if (!is_depend(sat1[i], sat2[i], flgs.data(), &max_flg))
{ {
continue; continue;
} }
@ -546,7 +547,7 @@ int fix_amb_ILS(rtk_t *rtk, int *sat1, int *sat2, int *NW, int n)
int m = 0; int m = 0;
int info; int info;
int stat; int stat;
int flgs[MAXSAT] = {0}; std::vector<int> flgs(MAXSAT, 0);
int max_flg = 0; int max_flg = 0;
lam1 = LAM_CARR[0]; lam1 = LAM_CARR[0];
@ -565,7 +566,7 @@ int fix_amb_ILS(rtk_t *rtk, int *sat1, int *sat2, int *NW, int n)
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
{ {
/* check linear independency */ /* check linear independency */
if (!is_depend(sat1[i], sat2[i], flgs, &max_flg)) if (!is_depend(sat1[i], sat2[i], flgs.data(), &max_flg))
{ {
continue; continue;
} }
@ -1362,7 +1363,7 @@ void udbias_ppp(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav)
{ {
double meas[2]; double meas[2];
double var[2]; double var[2];
double bias[MAXOBS] = {0}; std::vector<double> bias(MAXOBS, 0.0);
double offset = 0.0; double offset = 0.0;
double pos[3] = {0}; double pos[3] = {0};
int i; int i;
@ -1562,7 +1563,7 @@ int res_ppp(int iter __attribute__((unused)), const obsd_t *obs, int n, const do
double dtdx[3]; double dtdx[3];
double dantr[NFREQ] = {0}; double dantr[NFREQ] = {0};
double dants[NFREQ] = {0}; double dants[NFREQ] = {0};
double var[MAXOBS * 2]; std::vector<double> var(MAXOBS * 2, 0.0);
double dtrp = 0.0; double dtrp = 0.0;
double vart = 0.0; double vart = 0.0;
double varm[2] = {0}; double varm[2] = {0};
@ -1781,7 +1782,7 @@ void pppos(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav)
int i; int i;
int nv; int nv;
int info; int info;
int svh[MAXOBS]; std::vector<int> svh(MAXOBS);
int stat = SOLQ_SINGLE; int stat = SOLQ_SINGLE;
trace(3, "pppos : nx=%d n=%d\n", rtk->nx, n); trace(3, "pppos : nx=%d n=%d\n", rtk->nx, n);
@ -1803,7 +1804,7 @@ void pppos(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav)
tracemat(4, rtk->x, 1, NR_PPP(opt), 13, 4); tracemat(4, rtk->x, 1, NR_PPP(opt), 13, 4);
/* satellite positions and clocks */ /* satellite positions and clocks */
satposs(obs[0].time, obs, n, nav, rtk->opt.sateph, rs, dts, var, svh); satposs(obs[0].time, obs, n, nav, rtk->opt.sateph, rs, dts, var, svh.data());
/* exclude measurements of eclipsing satellite */ /* exclude measurements of eclipsing satellite */
if (rtk->opt.posopt[3]) if (rtk->opt.posopt[3])
@ -1821,7 +1822,7 @@ void pppos(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav)
for (i = 0; i < rtk->opt.niter; i++) for (i = 0; i < rtk->opt.niter; i++)
{ {
/* phase and code residuals */ /* phase and code residuals */
if ((nv = res_ppp(i, obs, n, rs, dts, var, svh, nav, xp, rtk, v, H, R, azel)) <= 0) if ((nv = res_ppp(i, obs, n, rs, dts, var, svh.data(), nav, xp, rtk, v, H, R, azel)) <= 0)
{ {
break; break;
} }
@ -1842,7 +1843,7 @@ void pppos(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav)
if (stat == SOLQ_PPP) if (stat == SOLQ_PPP)
{ {
/* postfit residuals */ /* postfit residuals */
res_ppp(1, obs, n, rs, dts, var, svh, nav, xp, rtk, v, H, R, azel); res_ppp(1, obs, n, rs, dts, var, svh.data(), nav, xp, rtk, v, H, R, azel);
/* update state and covariance matrix */ /* update state and covariance matrix */
matcpy(rtk->x, xp, rtk->nx, 1); matcpy(rtk->x, xp, rtk->nx, 1);

View File

@ -43,6 +43,7 @@
#include "rtklib_preceph.h" #include "rtklib_preceph.h"
#include "rtklib_rtkcmn.h" #include "rtklib_rtkcmn.h"
#include <cstring> #include <cstring>
#include <vector>
/* satellite code to satellite system ----------------------------------------*/ /* satellite code to satellite system ----------------------------------------*/
int code2sys(char code) int code2sys(char code)
@ -390,7 +391,7 @@ void readsp3(const char *file, nav_t *nav, int opt)
int j; int j;
int n; int n;
int ns; int ns;
int sats[MAXSAT] = {}; std::vector<int> sats(MAXSAT);
char *efiles[MAXEXFILE]; char *efiles[MAXEXFILE];
char *ext; char *ext;
char type = ' '; char type = ' ';
@ -431,10 +432,10 @@ void readsp3(const char *file, nav_t *nav, int opt)
continue; continue;
} }
/* read sp3 header */ /* read sp3 header */
ns = readsp3h(fp, &time, &type, sats, bfact, tsys); ns = readsp3h(fp, &time, &type, sats.data(), bfact, tsys);
/* read sp3 body */ /* read sp3 body */
readsp3b(fp, type, sats, ns, bfact, tsys, j++, opt, nav); readsp3b(fp, type, sats.data(), ns, bfact, tsys, j++, opt, nav);
fclose(fp); fclose(fp);
} }

View File

@ -31,6 +31,7 @@
#include "rtklib_rtkcmn.h" #include "rtklib_rtkcmn.h"
#include <glog/logging.h> #include <glog/logging.h>
#include <array>
#include <cassert> #include <cassert>
#include <cstring> #include <cstring>
#include <dirent.h> #include <dirent.h>
@ -40,6 +41,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#include <vector>
const double GPST0[] = {1980, 1, 6, 0, 0, 0}; /* gps time reference */ const double GPST0[] = {1980, 1, 6, 0, 0, 0}; /* gps time reference */
@ -4496,7 +4498,7 @@ double satazel(const double *pos, const double *e, double *azel)
*-----------------------------------------------------------------------------*/ *-----------------------------------------------------------------------------*/
void dops(int ns, const double *azel, double elmin, double *dop) void dops(int ns, const double *azel, double elmin, double *dop)
{ {
double H[4 * MAXSAT]; std::vector<double> H(4 * MAXSAT);
double Q[16]; double Q[16];
double cosel; double cosel;
double sinel; double sinel;
@ -4525,7 +4527,7 @@ void dops(int ns, const double *azel, double elmin, double *dop)
return; return;
} }
matmul("NT", 4, 4, n, 1.0, H, H, 0.0, Q); matmul("NT", 4, 4, n, 1.0, H.data(), H.data(), 0.0, Q);
if (!matinv(Q, 4)) if (!matinv(Q, 4))
{ {
dop[0] = std::sqrt(Q[0] + Q[5] + Q[10] + Q[15]); /* GDOP */ dop[0] = std::sqrt(Q[0] + Q[5] + Q[10] + Q[15]); /* GDOP */
@ -5029,16 +5031,23 @@ void sunmoonpos(gtime_t tutc, const double *erpv, double *rsun,
*-----------------------------------------------------------------------------*/ *-----------------------------------------------------------------------------*/
void csmooth(obs_t *obs, int ns) void csmooth(obs_t *obs, int ns)
{ {
double Ps[2][MAXSAT][NFREQ] = {}; std::vector<std::array<double, NFREQ>> Ps[2];
double Lp[2][MAXSAT][NFREQ] = {}; std::vector<std::array<double, NFREQ>> Lp[2];
double dcp; double dcp;
int i; int i;
int j; int j;
int s; int s;
int r; int r;
int n[2][MAXSAT][NFREQ] = {}; std::vector<std::array<int, NFREQ>> n[2];
obsd_t *p; obsd_t *p;
Ps[0].resize(MAXSAT);
Ps[1].resize(MAXSAT);
Lp[0].resize(MAXSAT);
Lp[1].resize(MAXSAT);
n[0].resize(MAXSAT);
n[1].resize(MAXSAT);
trace(3, "csmooth: nobs=%d,ns=%d\n", obs->n, ns); trace(3, "csmooth: nobs=%d,ns=%d\n", obs->n, ns);
for (i = 0; i < obs->n; i++) for (i = 0; i < obs->n; i++)

View File

@ -37,6 +37,7 @@
#include "rtklib_tides.h" #include "rtklib_tides.h"
#include <cmath> #include <cmath>
#include <cstring> #include <cstring>
#include <vector>
static int resamb_WLNL(rtk_t *rtk __attribute((unused)), const obsd_t *obs __attribute((unused)), const int *sat __attribute((unused)), static int resamb_WLNL(rtk_t *rtk __attribute((unused)), const obsd_t *obs __attribute((unused)), const int *sat __attribute((unused)),
const int *iu __attribute((unused)), const int *ir __attribute((unused)), int ns __attribute__((unused)), const nav_t *nav __attribute((unused)), const int *iu __attribute((unused)), const int *ir __attribute((unused)), int ns __attribute__((unused)), const nav_t *nav __attribute((unused)),
@ -2029,7 +2030,7 @@ void restamb(rtk_t *rtk, const double *bias, int nb __attribute((unused)), doubl
int n; int n;
int m; int m;
int f; int f;
int index[MAXSAT]; std::vector<int> index(MAXSAT);
int nv = 0; int nv = 0;
int nf = NF_RTK(&rtk->opt); int nf = NF_RTK(&rtk->opt);
@ -2083,7 +2084,7 @@ void holdamb(rtk_t *rtk, const double *xa)
int m; int m;
int f; int f;
int info; int info;
int index[MAXSAT]; std::vector<int> index(MAXSAT);
int nb = rtk->nx - rtk->na; int nb = rtk->nx - rtk->na;
int nv = 0; int nv = 0;
int nf = NF_RTK(&rtk->opt); int nf = NF_RTK(&rtk->opt);
@ -2371,13 +2372,13 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr,
int ns; int ns;
int ny; int ny;
int nv; int nv;
int sat[MAXSAT]; std::vector<int> sat(MAXSAT);
int iu[MAXSAT]; std::vector<int> iu(MAXSAT);
int ir[MAXSAT]; std::vector<int> ir(MAXSAT);
int niter; int niter;
int info; int info;
int vflg[MAXOBS * NFREQ * 2 + 1]; std::vector<int> vflg(MAXOBS * NFREQ * 2 + 1);
int svh[MAXOBS * 2]; std::vector<int> svh(MAXOBS * 2);
int stat = rtk->opt.mode <= PMODE_DGPS ? SOLQ_DGPS : SOLQ_FLOAT; int stat = rtk->opt.mode <= PMODE_DGPS ? SOLQ_DGPS : SOLQ_FLOAT;
int nf = opt->ionoopt == IONOOPT_IFLC ? 1 : opt->nf; int nf = opt->ionoopt == IONOOPT_IFLC ? 1 : opt->nf;
@ -2401,10 +2402,10 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr,
} }
} }
/* satellite positions/clocks */ /* satellite positions/clocks */
satposs(time, obs, n, nav, opt->sateph, rs, dts, var, svh); satposs(time, obs, n, nav, opt->sateph, rs, dts, var, svh.data());
/* undifferenced residuals for base station */ /* undifferenced residuals for base station */
if (!zdres(1, obs + nu, nr, rs + nu * 6, dts + nu * 2, svh + nu, nav, rtk->rb, opt, 1, if (!zdres(1, obs + nu, nr, rs + nu * 6, dts + nu * 2, &svh[nu], nav, rtk->rb, opt, 1,
y + nu * nf * 2, e + nu * 3, azel + nu * 2)) y + nu * nf * 2, e + nu * 3, azel + nu * 2))
{ {
errmsg(rtk, "initial base station position error\n"); errmsg(rtk, "initial base station position error\n");
@ -2423,7 +2424,7 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr,
dt = intpres(time, obs + nu, nr, nav, rtk, y + nu * nf * 2); dt = intpres(time, obs + nu, nr, nav, rtk, y + nu * nf * 2);
} }
/* select common satellites between rover and base-station */ /* select common satellites between rover and base-station */
if ((ns = selsat(obs, azel, nu, nr, opt, sat, iu, ir)) <= 0) if ((ns = selsat(obs, azel, nu, nr, opt, sat.data(), iu.data(), ir.data())) <= 0)
{ {
errmsg(rtk, "no common satellite\n"); errmsg(rtk, "no common satellite\n");
@ -2436,7 +2437,7 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr,
return 0; return 0;
} }
/* temporal update of states */ /* temporal update of states */
udstate(rtk, obs, sat, iu, ir, ns, nav); udstate(rtk, obs, sat.data(), iu.data(), ir.data(), ns, nav);
trace(4, "x(0)="); trace(4, "x(0)=");
tracemat(4, rtk->x, 1, NR_RTK(opt), 13, 4); tracemat(4, rtk->x, 1, NR_RTK(opt), 13, 4);
@ -2458,14 +2459,14 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr,
for (i = 0; i < niter; i++) for (i = 0; i < niter; i++)
{ {
/* undifferenced residuals for rover */ /* undifferenced residuals for rover */
if (!zdres(0, obs, nu, rs, dts, svh, nav, xp, opt, 0, y, e, azel)) if (!zdres(0, obs, nu, rs, dts, svh.data(), nav, xp, opt, 0, y, e, azel))
{ {
errmsg(rtk, "rover initial position error\n"); errmsg(rtk, "rover initial position error\n");
stat = SOLQ_NONE; stat = SOLQ_NONE;
break; break;
} }
/* double-differenced residuals and partial derivatives */ /* double-differenced residuals and partial derivatives */
if ((nv = ddres(rtk, nav, dt, xp, Pp, sat, y, e, azel, iu, ir, ns, v, H, R, vflg)) < 1) if ((nv = ddres(rtk, nav, dt, xp, Pp, sat.data(), y, e, azel, iu.data(), ir.data(), ns, v, H, R, vflg.data())) < 1)
{ {
errmsg(rtk, "no double-differenced residual\n"); errmsg(rtk, "no double-differenced residual\n");
stat = SOLQ_NONE; stat = SOLQ_NONE;
@ -2482,13 +2483,13 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr,
trace(4, "x(%d)=", i + 1); trace(4, "x(%d)=", i + 1);
tracemat(4, xp, 1, NR_RTK(opt), 13, 4); tracemat(4, xp, 1, NR_RTK(opt), 13, 4);
} }
if (stat != SOLQ_NONE && zdres(0, obs, nu, rs, dts, svh, nav, xp, opt, 0, y, e, azel)) if (stat != SOLQ_NONE && zdres(0, obs, nu, rs, dts, svh.data(), nav, xp, opt, 0, y, e, azel))
{ {
/* post-fit residuals for float solution */ /* post-fit residuals for float solution */
nv = ddres(rtk, nav, dt, xp, Pp, sat, y, e, azel, iu, ir, ns, v, nullptr, R, vflg); nv = ddres(rtk, nav, dt, xp, Pp, sat.data(), y, e, azel, iu.data(), ir.data(), ns, v, nullptr, R, vflg.data());
/* validation of float solution */ /* validation of float solution */
if (valpos(rtk, v, R, vflg, nv, 4.0)) if (valpos(rtk, v, R, vflg.data(), nv, 4.0))
{ {
/* update state and covariance matrix */ /* update state and covariance matrix */
matcpy(rtk->x, xp, rtk->nx, 1); matcpy(rtk->x, xp, rtk->nx, 1);
@ -2526,7 +2527,7 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr,
/* resolve integer ambiguity by WL-NL */ /* resolve integer ambiguity by WL-NL */
if (stat != SOLQ_NONE && rtk->opt.modear == ARMODE_WLNL) if (stat != SOLQ_NONE && rtk->opt.modear == ARMODE_WLNL)
{ {
if (resamb_WLNL(rtk, obs, sat, iu, ir, ns, nav, azel)) if (resamb_WLNL(rtk, obs, sat.data(), iu.data(), ir.data(), ns, nav, azel))
{ {
stat = SOLQ_FIX; stat = SOLQ_FIX;
} }
@ -2534,7 +2535,7 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr,
/* resolve integer ambiguity by TCAR */ /* resolve integer ambiguity by TCAR */
else if (stat != SOLQ_NONE && rtk->opt.modear == ARMODE_TCAR) else if (stat != SOLQ_NONE && rtk->opt.modear == ARMODE_TCAR)
{ {
if (resamb_TCAR(rtk, obs, sat, iu, ir, ns, nav, azel)) if (resamb_TCAR(rtk, obs, sat.data(), iu.data(), ir.data(), ns, nav, azel))
{ {
stat = SOLQ_FIX; stat = SOLQ_FIX;
} }
@ -2542,13 +2543,13 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr,
/* resolve integer ambiguity by LAMBDA */ /* resolve integer ambiguity by LAMBDA */
else if (stat != SOLQ_NONE && resamb_LAMBDA(rtk, bias, xa) > 1) else if (stat != SOLQ_NONE && resamb_LAMBDA(rtk, bias, xa) > 1)
{ {
if (zdres(0, obs, nu, rs, dts, svh, nav, xa, opt, 0, y, e, azel)) if (zdres(0, obs, nu, rs, dts, svh.data(), nav, xa, opt, 0, y, e, azel))
{ {
/* post-fit reisiduals for fixed solution */ /* post-fit reisiduals for fixed solution */
nv = ddres(rtk, nav, dt, xa, nullptr, sat, y, e, azel, iu, ir, ns, v, nullptr, R, vflg); nv = ddres(rtk, nav, dt, xa, nullptr, sat.data(), y, e, azel, iu.data(), ir.data(), ns, v, nullptr, R, vflg.data());
/* validation of fixed solution */ /* validation of fixed solution */
if (valpos(rtk, v, R, vflg, nv, 4.0)) if (valpos(rtk, v, R, vflg.data(), nv, 4.0))
{ {
/* hold integer ambiguity */ /* hold integer ambiguity */
if (++rtk->nfix >= rtk->opt.minfix && if (++rtk->nfix >= rtk->opt.minfix &&

View File

@ -37,6 +37,7 @@
#include <cctype> #include <cctype>
#include <cmath> #include <cmath>
#include <cstring> #include <cstring>
#include <vector>
/* constants and macros ------------------------------------------------------*/ /* constants and macros ------------------------------------------------------*/
@ -1654,7 +1655,7 @@ int outnmea_gsa(unsigned char *buff, const sol_t *sol,
int sat; int sat;
int sys; int sys;
int nsat; int nsat;
int prn[MAXSAT]; std::vector<int> prn(MAXSAT);
char *p = reinterpret_cast<char *>(buff); char *p = reinterpret_cast<char *>(buff);
char *q; char *q;
char *s; char *s;
@ -1683,7 +1684,7 @@ int outnmea_gsa(unsigned char *buff, const sol_t *sol,
{ {
continue; continue;
} }
sys = satsys(sat, prn + nsat); sys = satsys(sat, &prn[nsat]);
if (sys != SYS_GPS && sys != SYS_SBS) if (sys != SYS_GPS && sys != SYS_SBS)
{ {
continue; continue;
@ -1728,7 +1729,7 @@ int outnmea_gsa(unsigned char *buff, const sol_t *sol,
{ {
continue; continue;
} }
if (satsys(sat, prn + nsat) != SYS_GLO) if (satsys(sat, &prn[nsat]) != SYS_GLO)
{ {
continue; continue;
} }
@ -1769,7 +1770,7 @@ int outnmea_gsa(unsigned char *buff, const sol_t *sol,
{ {
continue; continue;
} }
if (satsys(sat, prn + nsat) != SYS_GAL) if (satsys(sat, &prn[nsat]) != SYS_GAL)
{ {
continue; continue;
} }
@ -1809,7 +1810,7 @@ int outnmea_gsa(unsigned char *buff, const sol_t *sol,
{ {
continue; continue;
} }
if (satsys(sat, prn + nsat) != SYS_BDS) if (satsys(sat, &prn[nsat]) != SYS_BDS)
{ {
continue; continue;
} }
@ -1861,7 +1862,7 @@ int outnmea_gsv(unsigned char *buff, const sol_t *sol,
int prn; int prn;
int sys; int sys;
int nmsg; int nmsg;
int sats[MAXSAT]; std::vector<int> sats(MAXSAT);
char *p = reinterpret_cast<char *>(buff); char *p = reinterpret_cast<char *>(buff);
char *q; char *q;
char *s; char *s;

View File

@ -264,7 +264,7 @@ void beidou_b1i_telemetry_decoder_gs::decode_subframe(float *frame_symbols)
d_nav_msg_packet.nav_message = data_bits; d_nav_msg_packet.nav_message = data_bits;
} }
if (d_satellite.get_PRN() > 0 && d_satellite.get_PRN() < 6) if ((d_satellite.get_PRN() > 0 && d_satellite.get_PRN() < 6) || d_satellite.get_PRN() > 58)
{ {
d_nav.d2_subframe_decoder(data_bits); d_nav.d2_subframe_decoder(data_bits);
} }
@ -339,7 +339,7 @@ void beidou_b1i_telemetry_decoder_gs::set_satellite(const Gnss_Satellite &satell
d_nav.set_signal_type(1); // BDS: data source (0:unknown,1:B1I,2:B1Q,3:B2I,4:B2Q,5:B3I,6:B3Q) d_nav.set_signal_type(1); // 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 // Update tel dec parameters for D2 NAV Messages
if (sat_prn > 0 && sat_prn < 6) if ((sat_prn > 0 && sat_prn < 6) || sat_prn > 58)
{ {
d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS; d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS; d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;

View File

@ -356,7 +356,7 @@ void beidou_b3i_telemetry_decoder_gs::set_satellite(
d_nav.set_signal_type(5); // BDS: data source (0:unknown,1:B1I,2:B1Q,3:B2I,4:B2Q,5:B3I,6:B3Q) d_nav.set_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 // Update tel dec parameters for D2 NAV Messages
if (sat_prn > 0 && sat_prn < 6) if ((sat_prn > 0 && sat_prn < 6) || sat_prn > 58)
{ {
d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS; d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS; d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;

View File

@ -757,7 +757,7 @@ void dll_pll_veml_tracking::start_tracking()
{ {
beidou_b1i_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN, 0); beidou_b1i_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN, 0);
// GEO Satellites use different secondary code // GEO Satellites use different secondary code
if (d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6) if ((d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6) or (d_acquisition_gnss_synchro->PRN > 58))
{ {
d_symbols_per_bit = BEIDOU_B1I_GEO_TELEMETRY_SYMBOLS_PER_BIT; // todo: enable after fixing beidou symbol synchronization d_symbols_per_bit = BEIDOU_B1I_GEO_TELEMETRY_SYMBOLS_PER_BIT; // todo: enable after fixing beidou symbol synchronization
d_correlation_length_ms = 1; d_correlation_length_ms = 1;
@ -790,7 +790,7 @@ void dll_pll_veml_tracking::start_tracking()
{ {
beidou_b3i_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN, 0); beidou_b3i_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN, 0);
// Update secondary code settings for geo satellites // Update secondary code settings for geo satellites
if (d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6) if ((d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6) or (d_acquisition_gnss_synchro->PRN > 58))
{ {
d_symbols_per_bit = BEIDOU_B3I_GEO_TELEMETRY_SYMBOLS_PER_BIT; // todo: enable after fixing beidou symbol synchronization d_symbols_per_bit = BEIDOU_B3I_GEO_TELEMETRY_SYMBOLS_PER_BIT; // todo: enable after fixing beidou symbol synchronization
d_correlation_length_ms = 1; d_correlation_length_ms = 1;

View File

@ -732,7 +732,7 @@ void kf_vtl_tracking::start_tracking()
{ {
beidou_b1i_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN, 0); beidou_b1i_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN, 0);
// GEO Satellites use different secondary code // GEO Satellites use different secondary code
if (d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6) if ((d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6) or d_acquisition_gnss_synchro->PRN > 58)
{ {
d_symbols_per_bit = BEIDOU_B1I_GEO_TELEMETRY_SYMBOLS_PER_BIT; // todo: enable after fixing beidou symbol synchronization d_symbols_per_bit = BEIDOU_B1I_GEO_TELEMETRY_SYMBOLS_PER_BIT; // todo: enable after fixing beidou symbol synchronization
d_correlation_length_ms = 1; d_correlation_length_ms = 1;
@ -765,7 +765,7 @@ void kf_vtl_tracking::start_tracking()
{ {
beidou_b3i_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN, 0); beidou_b3i_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN, 0);
// Update secondary code settings for geo satellites // Update secondary code settings for geo satellites
if (d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6) if ((d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6) or d_acquisition_gnss_synchro->PRN > 58)
{ {
d_symbols_per_bit = BEIDOU_B3I_GEO_TELEMETRY_SYMBOLS_PER_BIT; // todo: enable after fixing beidou symbol synchronization d_symbols_per_bit = BEIDOU_B3I_GEO_TELEMETRY_SYMBOLS_PER_BIT; // todo: enable after fixing beidou symbol synchronization
d_correlation_length_ms = 1; d_correlation_length_ms = 1;

View File

@ -22,7 +22,7 @@ Beidou_Dnav_Ephemeris::Beidou_Dnav_Ephemeris()
{ {
auto gnss_sat = Gnss_Satellite(); auto gnss_sat = Gnss_Satellite();
const std::string _system("Beidou"); const std::string _system("Beidou");
for (unsigned int i = 1; i < 36; i++) for (unsigned int i = 1; i < 64; i++)
{ {
satelliteBlock[i] = gnss_sat.what_block(_system, i); satelliteBlock[i] = gnss_sat.what_block(_system, i);
} }

View File

@ -27,11 +27,11 @@ Beidou_Dnav_Navigation_Message::Beidou_Dnav_Navigation_Message()
{ {
auto gnss_sat = Gnss_Satellite(); auto gnss_sat = Gnss_Satellite();
const std::string _system("Beidou"); const std::string _system("Beidou");
for (uint32_t i = 1; i < 36; i++) for (uint32_t i = 1; i < 64; i++)
{ {
satelliteBlock[i] = gnss_sat.what_block(_system, i); satelliteBlock[i] = gnss_sat.what_block(_system, i);
} }
for (uint32_t i = 1; i < 36; i++) for (uint32_t i = 1; i < 64; i++)
{ {
almanacHealth[i] = 0; almanacHealth[i] = 0;
} }
@ -647,7 +647,7 @@ Beidou_Dnav_Ephemeris Beidou_Dnav_Navigation_Message::get_ephemeris() const
{ {
Beidou_Dnav_Ephemeris eph; Beidou_Dnav_Ephemeris eph;
if (i_satellite_PRN > 0 and i_satellite_PRN < 6) if ((i_satellite_PRN > 0 and i_satellite_PRN < 6) or i_satellite_PRN > 58)
{ {
std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> subframe_bits; std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> subframe_bits;
@ -785,7 +785,7 @@ Beidou_Dnav_Utc_Model Beidou_Dnav_Navigation_Message::get_utc_model()
bool Beidou_Dnav_Navigation_Message::have_new_ephemeris() // Check if we have a new ephemeris stored in the galileo navigation class 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) if ((i_satellite_PRN > 0 and i_satellite_PRN < 6) or i_satellite_PRN > 58)
{ {
if ((flag_sf1_p1 == true) and (flag_sf1_p2 == true) and (flag_sf1_p3 == true) and if ((flag_sf1_p1 == true) and (flag_sf1_p2 == true) and (flag_sf1_p3 == true) and
(flag_sf1_p4 == true) and (flag_sf1_p5 == true) and (flag_sf1_p6 == true) and (flag_sf1_p4 == true) and (flag_sf1_p5 == true) and (flag_sf1_p6 == true) and