diff --git a/conf/gnss-sdr_BDS_B1I_byte.conf b/conf/gnss-sdr_BDS_B1I_byte.conf index 4d515b0a4..ce522bca0 100644 --- a/conf/gnss-sdr_BDS_B1I_byte.conf +++ b/conf/gnss-sdr_BDS_B1I_byte.conf @@ -89,7 +89,7 @@ Tracking_B1.implementation=BEIDOU_B1I_DLL_PLL_Tracking Tracking_B1.item_type=gr_complex Tracking_B1.pll_bw_hz=25.0; Tracking_B1.dll_bw_hz=2.50; -Tracking_B1.dump=true; +Tracking_B1.dump=false; Tracking_B1.dump_filename=./epl_tracking_ch_ diff --git a/conf/gnss-sdr_BDS_B3I_byte.conf b/conf/gnss-sdr_BDS_B3I_byte.conf index 2adfdad31..45eb7df3a 100644 --- a/conf/gnss-sdr_BDS_B3I_byte.conf +++ b/conf/gnss-sdr_BDS_B3I_byte.conf @@ -16,7 +16,7 @@ ControlThread.wait_for_flowgraph=false ;######### SIGNAL_SOURCE CONFIG ############ SignalSource.implementation=File_Signal_Source -SignalSource.filename=/home/dmiralles/Documents/GNSS-Metadata-Standard/install/BdsB3IStr01.dat +SignalSource.filename=/home/dmiralles/Documents/gnss-metadata-standard/install/BdsB3IStr01.dat SignalSource.item_type=byte SignalSource.sampling_frequency=50000000 SignalSource.samples=0 @@ -54,52 +54,46 @@ Resampler.item_type=gr_complex ;######### CHANNELS GLOBAL CONFIG ############ -Channels_B3.count=13 -Channels.in_acquisition=1 +Channels_B3.count=10 +Channels.in_acquisition=10 Channel.signal=B3 Channel0.satellite = 6; -Channel1.satellite = 7; -Channel2.satellite = 9; -Channel3.satellite = 16; -Channel4.satellite = 18; +Channel1.satellite = 23; +Channel2.satellite = 16; +Channel3.satellite = 18; +Channel4.satellite = 7; Channel5.satellite = 1; Channel6.satellite = 2; Channel7.satellite = 3; Channel8.satellite = 4; Channel9.satellite = 5; -Channel10.satellite = 23; -Channel11.satellite = 25; -Channel12.satellite = 32; ;######### ACQUISITION GLOBAL CONFIG ############ Acquisition_B3.implementation=BEIDOU_B3I_PCPS_Acquisition Acquisition_B3.item_type=gr_complex -Acquisition_B3.coherent_integration_time_ms=1 -Acquisition_B3.max_dwells = 1 -Acquisition_B3.threshold=0.00035 -;Acquisition_B3.pfa=0.0000001; +Acquisition_B3.coherent_integration_time_ms=3 +Acquisition_B3.max_dwells = 2 +Acquisition_B3.threshold=0.0004 Acquisition_B3.doppler_max=10000 -Acquisition_B3.doppler_step=50 -Acquisition_B3.dump=true +Acquisition_B3.doppler_step=100 +Acquisition_B3.dump=false Acquisition_B3.dump_filename=./bds_acq -Acquisition_B3.blocking=false; -Acquisition_B3.use_CFAR_algorithm=true; -Acquisition_B3.bit_transition_flag = false; - ;######### TRACKING GLOBAL CONFIG ############ Tracking_B3.implementation=BEIDOU_B3I_DLL_PLL_Tracking Tracking_B3.item_type=gr_complex -Tracking_B3.pll_bw_hz=25.0; -Tracking_B3.dll_bw_hz=2.50; -Tracking_B3.dump=true; +Tracking_B3.pll_bw_hz=40.0; +Tracking_B3.dll_bw_hz=4.0; +Tracking_B3.pll_bw_narrow_hz=20.0; +Tracking_B3.dll_bw_narrow_hz=3.0; +Tracking_B3.dump=false; Tracking_B3.dump_filename=./epl_tracking_ch_ ;######### TELEMETRY DECODER GPS CONFIG ############ TelemetryDecoder_B3.implementation=BEIDOU_B3I_Telemetry_Decoder -TelemetryDecoder_B3.dump=false +TelemetryDecoder_B3.dump=true ;######### OBSERVABLES CONFIG ############ diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index 7318e87b5..a3ea0d911 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -1801,6 +1801,15 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item b_rinex_header_written = true; // do not write header anymore } + break; + case 60: // BDS B1I only + if (beidou_dnav_ephemeris_iter != d_pvt_solver->beidou_dnav_ephemeris_map.cend()) + { + rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B3"); + rp->rinex_nav_header(rp->navFile, d_pvt_solver->beidou_dnav_iono, d_pvt_solver->beidou_dnav_utc_model); + b_rinex_header_written = true; // do not write header anymore + } + break; default: break; diff --git a/src/algorithms/PVT/libs/rtklib_solver.cc b/src/algorithms/PVT/libs/rtklib_solver.cc index 5ee330eb4..1a81af22d 100644 --- a/src/algorithms/PVT/libs/rtklib_solver.cc +++ b/src/algorithms/PVT/libs/rtklib_solver.cc @@ -53,6 +53,7 @@ #include "rtklib_solver.h" #include "Beidou_B1I.h" +#include "Beidou_B3I.h" #include "GLONASS_L1_L2_CA.h" #include "GPS_L1_CA.h" #include "Galileo_E1.h" @@ -833,6 +834,47 @@ bool Rtklib_Solver::get_PVT(const std::map &gnss_observables_ DLOG(INFO) << "No ephemeris data for SV " << gnss_observables_iter->first; } } + // BeiDou B3 + if (sig_ == "B3") + { + beidou_ephemeris_iter = beidou_dnav_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (beidou_ephemeris_iter != beidou_dnav_ephemeris_map.cend()) + { + bool found_B1I_obs = false; + for (int i = 0; i < valid_obs; i++) + { + if (eph_data[i].sat == (static_cast(gnss_observables_iter->second.PRN + NSATGPS + NSATGLO + NSATGAL + NSATQZS))) + { + obs_data[i + glo_valid_obs] = insert_obs_to_rtklib(obs_data[i + glo_valid_obs], + gnss_observables_iter->second, + beidou_ephemeris_iter->second.i_BEIDOU_week + 1356, + 1); // Band 3 (L2/G2/B3) + found_B1I_obs = true; + break; + } + } + if (!found_B1I_obs) + { + // insert BeiDou B3I obs as new obs and also insert its ephemeris + // convert ephemeris from GNSS-SDR class to RTKLIB structure + eph_data[valid_obs] = eph_to_rtklib(beidou_ephemeris_iter->second); + // convert observation from GNSS-SDR class to RTKLIB structure + auto default_code_ = static_cast(CODE_NONE); + obsd_t newobs = {{0, 0}, '0', '0', {}, {}, + {default_code_, default_code_, default_code_}, + {}, {0.0, 0.0, 0.0}, {}}; + obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs, + gnss_observables_iter->second, + beidou_ephemeris_iter->second.i_BEIDOU_week + 1356, + 1); // Band 2 (L2/G2) + valid_obs++; + } + } + else // the ephemeris are not available for this SV + { + DLOG(INFO) << "No ephemeris data for SV " << gnss_observables_iter->second.PRN; + } + } break; } diff --git a/src/algorithms/PVT/libs/rtklib_solver.h b/src/algorithms/PVT/libs/rtklib_solver.h index 929097de8..6457d28d6 100644 --- a/src/algorithms/PVT/libs/rtklib_solver.h +++ b/src/algorithms/PVT/libs/rtklib_solver.h @@ -118,7 +118,7 @@ public: std::map gps_ephemeris_map; //!< Map storing new GPS_Ephemeris std::map gps_cnav_ephemeris_map; //!< Map storing new GPS_CNAV_Ephemeris std::map glonass_gnav_ephemeris_map; //!< Map storing new GLONASS GNAV Ephemeris - std::map beidou_dnav_ephemeris_map; //!< Map storing new GLONASS GNAV Ephmeris + std::map beidou_dnav_ephemeris_map; //!< Map storing new BeiDou DNAV Ephmeris Galileo_Utc_Model galileo_utc_model; Galileo_Iono galileo_iono; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc index be245a931..6ef46b9e5 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc @@ -119,8 +119,8 @@ beidou_b1i_telemetry_decoder_gs::beidou_b1i_telemetry_decoder_gs( d_subframe_symbols = static_cast(volk_gnsssdr_malloc(BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(double), volk_gnsssdr_get_alignment())); d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS * d_samples_per_symbol + d_samples_per_preamble; - d_symbol_history.set_capacity(d_required_symbols + 1); + // Generic settings d_sample_counter = 0; d_stat = 0; @@ -351,6 +351,7 @@ void beidou_b1i_telemetry_decoder_gs::set_satellite(const Gnss_Satellite &satell d_subframe_symbols = static_cast(volk_gnsssdr_malloc(BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(double), volk_gnsssdr_get_alignment())); d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS * d_samples_per_symbol + d_samples_per_preamble; + d_symbol_history.set_capacity(d_required_symbols + 1); } } @@ -576,6 +577,8 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_ d_dump_file.write(reinterpret_cast(&tmp_ulong_int), sizeof(uint64_t)); tmp_double = d_nav.d_SOW; d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); + tmp_ulong_int = static_cast(d_required_symbols); + d_dump_file.write(reinterpret_cast(&tmp_ulong_int), sizeof(uint64_t)); } catch (const std::ifstream::failure &e) { diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc index 8621b635c..924ec7bde 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc @@ -353,6 +353,7 @@ void beidou_b3i_telemetry_decoder_gs::set_satellite(const Gnss_Satellite &satell d_subframe_symbols = static_cast(volk_gnsssdr_malloc(BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(double), volk_gnsssdr_get_alignment())); d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS*d_samples_per_symbol + d_samples_per_preamble; + d_symbol_history.set_capacity(d_required_symbols + 1); } } diff --git a/src/utils/matlab/gps_l1_ca_telemetry_plot_sample.m b/src/utils/matlab/gps_l1_ca_telemetry_plot_sample.m index fb2e956ca..8d2881b96 100644 --- a/src/utils/matlab/gps_l1_ca_telemetry_plot_sample.m +++ b/src/utils/matlab/gps_l1_ca_telemetry_plot_sample.m @@ -26,15 +26,37 @@ % ------------------------------------------------------------------------- % -%close all; - +close all;clear; samplingFreq = 25000000; %[Hz] channels=[0:9]; -path='/home/dmiralles/Documents/gnss-sdr/'; +path='/home/dmiralles/Documents/gnss-sdr-bds_b1i_v2/'; addpath('libs/'); clear PRN_absolute_sample_start; for N=1:1:length(channels) telemetry_log_path=[path 'telemetry' num2str(channels(N)) '.dat']; - GNSS_telemetry(N)= gps_l1_ca_read_telemetry_dump(telemetry_log_path); + GNSS_telemetry_v2(N)= gps_l1_ca_read_telemetry_dump(telemetry_log_path); end +%% Plotting values +%--- Plot results +figure; +plot(GNSS_telemetry_v2(6).tracking_sample_counter, ... + GNSS_telemetry_v2(6).tow_current_symbol_ms, 'b+'); +hold on; +grid on; +plot(GNSS_telemetry_v2(1).tracking_sample_counter, ... + GNSS_telemetry_v2(1).tow_current_symbol_ms, 'ro'); +xlabel('TRK Sampling Counter'); +ylabel('Current Symbol TOW'); +legend('BDS-1', 'BDS-6'); + +figure; +plot(GNSS_telemetry_v2(6).tracking_sample_counter, ... + GNSS_telemetry_v2(6).tow, 'b+'); +hold on; +grid on; +plot(GNSS_telemetry_v2(1).tracking_sample_counter, ... + GNSS_telemetry_v2(1).tow, 'ro'); +xlabel('TRK Sampling Counter'); +ylabel('Decoded Nav TOW'); +legend('BDS-1', 'BDS-6'); diff --git a/src/utils/matlab/libs/gps_l1_ca_read_telemetry_dump.m b/src/utils/matlab/libs/gps_l1_ca_read_telemetry_dump.m index c5e4b71d3..8b88dfbdc 100644 --- a/src/utils/matlab/libs/gps_l1_ca_read_telemetry_dump.m +++ b/src/utils/matlab/libs/gps_l1_ca_read_telemetry_dump.m @@ -32,7 +32,7 @@ function [telemetry] = gps_l1_ca_read_telemetry_dump (filename, count) %% m = nargchk (1,2,nargin); -num_double_vars=3; +num_double_vars=4; double_size_bytes=8; skip_bytes_each_read=double_size_bytes*num_double_vars; bytes_shift=0; @@ -56,6 +56,9 @@ else telemetry.tow = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes); bytes_shift=bytes_shift+double_size_bytes; fseek(f,bytes_shift,'bof'); % move to next interleaved + telemetry.required_symbols = fread (f, count, 'uint64',skip_bytes_each_read-double_size_bytes); + bytes_shift=bytes_shift+double_size_bytes; + fseek(f,bytes_shift,'bof'); % move to next interleaved fclose (f);