1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-18 11:09:56 +00:00

bds b3i: Adding code to process BeiDou B3I signals

Adds code to perform acq and trk in BeiDou B3I signals. Stages of
telemetry decoding, observables computation and pvt use existing
code on the platform. Some further testing is required
This commit is contained in:
Damian Miralles 2019-01-25 15:43:00 -06:00
parent 5395b0bc3b
commit e78ba653e6
32 changed files with 2862 additions and 333 deletions

View File

@ -0,0 +1,81 @@
; This is a GNSS-SDR configuration file
; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/
; 5C is the channel identifier for BeiDou B2a, both the data signal and the pilot signal
[GNSS-SDR]
;######### GLOBAL OPTIONS ##################
;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second].
GNSS-SDR.internal_fs_sps=25000000
;######### SIGNAL_SOURCE CONFIG ############
SignalSource.implementation=File_Signal_Source
;SignalSource.filename=/home/dmiralles/Documents/gnss-sdr/src/tests/signal_samples/USRP_BDS_B2a_201805171115_fs_25e6_if0e3_ishort_200ms.bin
SignalSource.filename=/archive/USRP_BDS_B3I_201805171118_fs_25e6_if0e3_ishort.bin
SignalSource.item_type=ishort
SignalSource.sampling_frequency=25000000
SignalSource.samples=0
SignalSource.repeat=false
SignalSource.enable_throttle_control=false
;######### SIGNAL_CONDITIONER CONFIG ############
SignalConditioner.implementation=Signal_Conditioner
InputFilter.implementation=Pass_Through
DataTypeAdapter.implementation=Ishort_To_Complex
Resampler.implementation=Direct_Resampler
Resampler.sample_freq_in=25000000
Resampler.sample_freq_out=25000000
Resampler.item_type=gr_complex
;######### CHANNELS GLOBAL CONFIG ############
Channel.signal=B3
Channels.in_acquisition=1
Channels_B3.count=5;
Channel0.satellite = 21;
Channel1.satellite = 22;
Channel2.satellite = 27;
Channel3.satellite = 28;
Channel4.satellite = 30;
;######### ACQUISITION GLOBAL CONFIG ############
Acquisition_B3.implementation=BEIDOU_B3I_PCPS_Acquisition
Acquisition_B3.item_type=gr_complex
;Acquisition_B3.pfa=0.01
Acquisition_B3.threshold=0.00015
Acquisition_B3.doppler_max=10000
Acquisition_B3.doppler_step=100
Acquisition_B3.dump=false;
Acquisition_B3.dump_filename=/archive/bds_b3i_acq.dat
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.early_late_space_chips=0.5
Tracking_B3.pll_bw_hz=25.0;
Tracking_B3.dll_bw_hz=2.0;
Tracking_B3.dump=true;
Tracking_B3.dump_filename=/archive/bds_b3i_trk_ch_
;######### TELEMETRY DECODER GPS CONFIG ############
TelemetryDecoder_B3.implementation=BEIDOU_B3I_Telemetry_Decoder
TelemetryDecoder_B3.dump=true
TelemetryDecoder_B3.dump_filename=/archive/bds_b3i_tel_dec.dat
;######### OBSERVABLES CONFIG ############
Observables.implementation=Hybrid_Observables
Observables.dump=true;
Observables.dump_filename=/archive/bds_b2a_observables.dat
;######### PVT CONFIG ############
PVT.implementation=RTKLIB_PVT
PVT.averaging_depth=100
PVT.flag_averaging=true
PVT.output_rate_ms=10
PVT.display_rate_ms=500

View File

@ -179,6 +179,12 @@ RtklibPvt::RtklibPvt(ConfigurationInterface* configuration,
* 53 | Beidou B1I + GLONASS L1 C/A
* 54 | Beidou B1I + GPS L1 C/A + Galileo E1B
* 55 | Beidou B1I + GPS L1 C/A + GLONASS L1 C/A + Galileo E1B
* 56 | Beidou B1I + Beidou B3I
* Skipped previous values to avoid overlapping
* 60 | Beidou B3I
* 61 | Beidou B3I + GPS L2C
* 62 | Beidou B3I + GLONASS L2 C/A
* 63 | Beidou B3I + GPS L2C + GLONASS L2 C/A
*/
int gps_1C_count = configuration->property("Channels_1C.count", 0);
int gps_2S_count = configuration->property("Channels_2S.count", 0);
@ -189,48 +195,56 @@ RtklibPvt::RtklibPvt(ConfigurationInterface* configuration,
int glo_1G_count = configuration->property("Channels_1G.count", 0);
int glo_2G_count = configuration->property("Channels_2G.count", 0);
int bds_B1_count = configuration->property("Channels_B1.count", 0);
int bds_B3_count = configuration->property("Channels_B3.count", 0);
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0)) pvt_output_parameters.type_of_receiver = 1; // L1
if ((gps_1C_count == 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0)) pvt_output_parameters.type_of_receiver = 2;
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count != 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0)) pvt_output_parameters.type_of_receiver = 3; // L5
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0)) pvt_output_parameters.type_of_receiver = 4; // E1
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count != 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0)) pvt_output_parameters.type_of_receiver = 5; // E5a
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count != 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0)) pvt_output_parameters.type_of_receiver = 6;
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 1; // L1
if ((gps_1C_count == 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 2;
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count != 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 3; // L5
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 4; // E1
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count != 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 5; // E5a
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count != 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 6;
if ((gps_1C_count != 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0)) pvt_output_parameters.type_of_receiver = 7;
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count != 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0)) pvt_output_parameters.type_of_receiver = 8; // L1+L5
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0)) pvt_output_parameters.type_of_receiver = 9; // L1+E1
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count != 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0)) pvt_output_parameters.type_of_receiver = 10;
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count != 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0)) pvt_output_parameters.type_of_receiver = 11;
if ((gps_1C_count == 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0)) pvt_output_parameters.type_of_receiver = 12;
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count != 0) && (gal_1B_count == 0) && (gal_E5a_count != 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0)) pvt_output_parameters.type_of_receiver = 13; // L5+E5a
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count != 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0)) pvt_output_parameters.type_of_receiver = 14;
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count != 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0)) pvt_output_parameters.type_of_receiver = 15;
if ((gps_1C_count != 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 7;
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count != 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 8; // L1+L5
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 9; // L1+E1
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count != 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 10;
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count != 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 11;
if ((gps_1C_count == 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 12;
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count != 0) && (gal_1B_count == 0) && (gal_E5a_count != 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 13; // L5+E5a
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count != 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 14;
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count != 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 15;
//if( (gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0)) pvt_output_parameters.type_of_receiver = 16;
if ((gps_1C_count == 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count != 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0)) pvt_output_parameters.type_of_receiver = 17;
if ((gps_1C_count == 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count != 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0)) pvt_output_parameters.type_of_receiver = 18;
if ((gps_1C_count == 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count != 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 17;
if ((gps_1C_count == 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count != 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 18;
//if( (gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0)) pvt_output_parameters.type_of_receiver = 19;
//if( (gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0)) pvt_output_parameters.type_of_receiver = 20;
if ((gps_1C_count != 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0)) pvt_output_parameters.type_of_receiver = 21;
if ((gps_1C_count != 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 21;
//if( (gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count = 0)) pvt_output_parameters.type_of_receiver = 22;
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0) && (bds_B1_count == 0)) pvt_output_parameters.type_of_receiver = 23;
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count != 0) && (bds_B1_count == 0)) pvt_output_parameters.type_of_receiver = 24;
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0) && (glo_2G_count != 0) && (bds_B1_count == 0)) pvt_output_parameters.type_of_receiver = 25;
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0) && (glo_2G_count == 0) && (bds_B1_count == 0)) pvt_output_parameters.type_of_receiver = 26;
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0) && (glo_2G_count == 0) && (bds_B1_count == 0)) pvt_output_parameters.type_of_receiver = 27;
if ((gps_1C_count == 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0) && (glo_2G_count == 0) && (bds_B1_count == 0)) pvt_output_parameters.type_of_receiver = 28;
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count != 0) && (bds_B1_count == 0)) pvt_output_parameters.type_of_receiver = 29;
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count != 0) && (bds_B1_count == 0)) pvt_output_parameters.type_of_receiver = 30;
if ((gps_1C_count == 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count != 0) && (bds_B1_count == 0)) pvt_output_parameters.type_of_receiver = 31;
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 23;
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count != 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 24;
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0) && (glo_2G_count != 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 25;
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 26;
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 27;
if ((gps_1C_count == 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 28;
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count != 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 29;
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count != 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 30;
if ((gps_1C_count == 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count != 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 31;
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count != 0) && (gal_1B_count != 0) && (gal_E5a_count != 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0)) pvt_output_parameters.type_of_receiver = 32; // L1+E1+L5+E5a
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count != 0) && (gal_1B_count != 0) && (gal_E5a_count != 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 32; // L1+E1+L5+E5a
// BeiDou B1I Receiver
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count != 0)) pvt_output_parameters.type_of_receiver = 50;
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count != 0)) pvt_output_parameters.type_of_receiver = 51;
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count != 0)) pvt_output_parameters.type_of_receiver = 52;
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0) && (glo_2G_count == 0) && (bds_B1_count != 0)) pvt_output_parameters.type_of_receiver = 53;
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count != 0)) pvt_output_parameters.type_of_receiver = 54;
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0) && (glo_2G_count == 0) && (bds_B1_count != 0)) pvt_output_parameters.type_of_receiver = 55;
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count != 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 50;
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count != 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 51;
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count != 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 52;
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0) && (glo_2G_count == 0) && (bds_B1_count != 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 53;
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count != 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 54;
if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0) && (glo_2G_count == 0) && (bds_B1_count != 0) && (bds_B3_count == 0)) pvt_output_parameters.type_of_receiver = 55;
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count != 0) && (bds_B3_count != 0)) pvt_output_parameters.type_of_receiver = 56;
// BeiDou B3I Receiver
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count != 0)) pvt_output_parameters.type_of_receiver = 60;
if ((gps_1C_count != 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count != 0)) pvt_output_parameters.type_of_receiver = 61;
if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count != 0) && (bds_B1_count == 0) && (bds_B3_count != 0)) pvt_output_parameters.type_of_receiver = 62;
if ((gps_1C_count == 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0) && (glo_2G_count != 0) && (bds_B1_count == 0) && (bds_B3_count != 0)) pvt_output_parameters.type_of_receiver = 63;
// RTKLIB PVT solver options
// Settings 1
@ -256,9 +270,9 @@ RtklibPvt::RtklibPvt(ConfigurationInterface* configuration,
int num_bands = 0;
if ((gps_1C_count > 0) || (gal_1B_count > 0) || (glo_1G_count > 0) || (bds_B1_count > 0)) num_bands = 1;
if (((gps_1C_count > 0) || (gal_1B_count > 0) || (glo_1G_count > 0)) && ((gps_2S_count > 0) || (glo_2G_count > 0))) num_bands = 2;
if (((gps_1C_count > 0) || (gal_1B_count > 0) || (glo_1G_count > 0)) && ((gps_2S_count > 0) || (glo_2G_count > 0) || (bds_B1_count > 0))) num_bands = 2;
if (((gps_1C_count > 0) || (gal_1B_count > 0) || (glo_1G_count > 0)) && ((gal_E5a_count > 0) || (gal_E5b_count > 0) || (gps_L5_count > 0))) num_bands = 2;
if (((gps_1C_count > 0) || (gal_1B_count > 0) || (glo_1G_count > 0)) && ((gps_2S_count > 0) || (glo_2G_count > 0)) && ((gal_E5a_count > 0) || (gal_E5b_count > 0) || (gps_L5_count > 0))) num_bands = 3;
if (((gps_1C_count > 0) || (gal_1B_count > 0) || (glo_1G_count > 0)) && ((gps_2S_count > 0) || (glo_2G_count > 0) || (bds_B1_count > 0)) && ((gal_E5a_count > 0) || (gal_E5b_count > 0) || (gps_L5_count > 0))) num_bands = 3;
int number_of_frequencies = configuration->property(role + ".num_bands", num_bands); /* (1:L1, 2:L1+L2, 3:L1+L2+L5) */
if ((number_of_frequencies < 1) || (number_of_frequencies > 3))

View File

@ -172,6 +172,10 @@ Rinex_Printer::Rinex_Printer(int32_t conf_version, const std::string& base_path)
observationCode["COMPASS_E6_IQ"] = "6X";
observationCode["BEIDOU_B1_I"] = "1I";
observationCode["BEIDOU_B1_Q"] = "1Q";
observationCode["BEIDOU_B1_IQ"] = "1X";
observationCode["BEIDOU_B3_I"] = "6I";
observationCode["BEIDOU_B3_Q"] = "6Q";
observationCode["BEIDOU_B3_IQ"] = "6X";
observationType["PSEUDORANGE"] = "C";
observationType["CARRIER_PHASE"] = "L";

View File

@ -35,6 +35,7 @@ set(ACQ_ADAPTER_SOURCES
glonass_l1_ca_pcps_acquisition.cc
glonass_l2_ca_pcps_acquisition.cc
beidou_b1i_pcps_acquisition.cc
beidou_b3i_pcps_acquisition.cc
)
set(ACQ_ADAPTER_HEADERS
@ -54,6 +55,8 @@ set(ACQ_ADAPTER_HEADERS
galileo_e5a_pcps_acquisition.h
glonass_l1_ca_pcps_acquisition.h
glonass_l2_ca_pcps_acquisition.h
beidou_b1i_pcps_acquisition.h
beidou_b3i_pcps_acquisition.h
)
if(ENABLE_FPGA)

View File

@ -0,0 +1,341 @@
/*!
* \file beidou_b3i_pcps_acquisition.cc
* \brief Adapts a PCPS acquisition block to an AcquisitionInterface for
* BeiDou B3I signals
* \author Damian Miralles, 2019. dmiralles2009@gmail.com
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#include "beidou_b3i_pcps_acquisition.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;
BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition(
ConfigurationInterface* configuration,
std::string role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams)
{
Acq_Conf acq_parameters = Acq_Conf();
configuration_ = configuration;
std::string default_item_type = "gr_complex";
std::string default_dump_filename = "./data/acquisition.dat";
DLOG(INFO) << "role " << role;
item_type_ = configuration_->property(role + ".item_type", default_item_type);
long 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);
acq_parameters.dump = dump_;
blocking_ = configuration_->property(role + ".blocking", true);
acq_parameters.blocking = blocking_;
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max;
acq_parameters.doppler_max = doppler_max_;
sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 1);
acq_parameters.sampled_ms = sampled_ms_;
bit_transition_flag_ = configuration_->property(role + ".bit_transition_flag", false);
acq_parameters.bit_transition_flag = bit_transition_flag_;
use_CFAR_algorithm_flag_ = configuration_->property(role + ".use_CFAR_algorithm", true); //will be false in future versions
acq_parameters.use_CFAR_algorithm_flag = use_CFAR_algorithm_flag_;
max_dwells_ = configuration_->property(role + ".max_dwells", 1);
acq_parameters.max_dwells = max_dwells_;
dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
acq_parameters.dump_filename = dump_filename_;
//--- Find number of samples per spreading code -------------------------
code_length_ = static_cast<unsigned int>(std::round(static_cast<double>(fs_in_) / ( BEIDOU_B3I_CODE_RATE_HZ / BEIDOU_B3I_CODE_LENGTH_CHIPS)));
vector_length_ = code_length_ * sampled_ms_;
if (bit_transition_flag_)
{
vector_length_ *= 2;
}
code_ = new gr_complex[vector_length_];
if (item_type_.compare("cshort") == 0)
{
item_size_ = sizeof(lv_16sc_t);
}
else
{
item_size_ = sizeof(gr_complex);
}
acq_parameters.it_size = item_size_;
acq_parameters.sampled_ms = sampled_ms_;
acq_parameters.samples_per_ms = code_length_;
acq_parameters.samples_per_code = code_length_;
acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false);
acquisition_ = pcps_make_acquisition(acq_parameters);
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_);
DLOG(INFO) << "stream_to_vector(" << stream_to_vector_->unique_id() << ")";
if (item_type_.compare("cbyte") == 0)
{
cbyte_to_float_x2_ = make_complex_byte_to_float_x2();
float_to_complex_ = gr::blocks::float_to_complex::make();
}
channel_ = 0;
threshold_ = 0.0;
doppler_step_ = 0;
gnss_synchro_ = 0;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
}
if (out_streams_ > 0)
{
LOG(ERROR) << "This implementation does not provide an output stream";
}
}
BeidouB3iPcpsAcquisition::~BeidouB3iPcpsAcquisition()
{
delete[] code_;
}
void BeidouB3iPcpsAcquisition::stop_acquisition()
{
}
void BeidouB3iPcpsAcquisition::set_channel(unsigned int channel)
{
channel_ = channel;
acquisition_->set_channel(channel_);
}
void BeidouB3iPcpsAcquisition::set_threshold(float threshold)
{
float pfa = configuration_->property(role_ + ".pfa", 0.0);
if (pfa == 0.0)
{
threshold_ = threshold;
}
else
{
threshold_ = calculate_threshold(pfa);
}
DLOG(INFO) << "Channel " << channel_ << " Threshold = " << threshold_;
acquisition_->set_threshold(threshold_);
}
void BeidouB3iPcpsAcquisition::set_doppler_max(unsigned int doppler_max)
{
doppler_max_ = doppler_max;
acquisition_->set_doppler_max(doppler_max_);
}
void BeidouB3iPcpsAcquisition::set_doppler_step(unsigned int doppler_step)
{
doppler_step_ = doppler_step;
acquisition_->set_doppler_step(doppler_step_);
}
void BeidouB3iPcpsAcquisition::set_gnss_synchro(Gnss_Synchro* gnss_synchro)
{
gnss_synchro_ = gnss_synchro;
acquisition_->set_gnss_synchro(gnss_synchro_);
}
signed int BeidouB3iPcpsAcquisition::mag()
{
return acquisition_->mag();
}
void BeidouB3iPcpsAcquisition::init()
{
acquisition_->init();
set_local_code();
}
void BeidouB3iPcpsAcquisition::set_local_code()
{
std::complex<float>* code = new std::complex<float>[code_length_];
beidou_b3i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
for (unsigned int i = 0; i < sampled_ms_; i++)
{
memcpy(&(code_[i * code_length_]), code,
sizeof(gr_complex) * code_length_);
}
acquisition_->set_local_code(code_);
delete[] code;
}
void BeidouB3iPcpsAcquisition::reset()
{
acquisition_->set_active(true);
}
void BeidouB3iPcpsAcquisition::set_state(int state)
{
acquisition_->set_state(state);
}
float BeidouB3iPcpsAcquisition::calculate_threshold(float pfa)
{
//Calculate the threshold
unsigned int frequency_bins = 0;
/*
for (int doppler = (int)(-doppler_max_); doppler <= (int)doppler_max_; doppler += doppler_step_)
{
frequency_bins++;
}
*/
frequency_bins = (2 * doppler_max_ + doppler_step_) / doppler_step_;
DLOG(INFO) << "Channel " << channel_ << " Pfa = " << pfa;
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
double lambda = static_cast<double>(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}
void BeidouB3iPcpsAcquisition::connect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
{
// nothing to connect
}
else if (item_type_.compare("cshort") == 0)
{
// nothing to connect
}
else if (item_type_.compare("cbyte") == 0)
{
top_block->connect(cbyte_to_float_x2_, 0, float_to_complex_, 0);
top_block->connect(cbyte_to_float_x2_, 1, float_to_complex_, 1);
top_block->connect(float_to_complex_, 0, stream_to_vector_, 0);
}
else
{
LOG(WARNING) << item_type_ << " unknown acquisition item type";
}
}
void BeidouB3iPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
{
// nothing to disconnect
}
else if (item_type_.compare("cshort") == 0)
{
// nothing to disconnect
}
else if (item_type_.compare("cbyte") == 0)
{
// Since a byte-based acq implementation is not available,
// we just convert cshorts to gr_complex
top_block->disconnect(cbyte_to_float_x2_, 0, float_to_complex_, 0);
top_block->disconnect(cbyte_to_float_x2_, 1, float_to_complex_, 1);
top_block->disconnect(float_to_complex_, 0, stream_to_vector_, 0);
}
else
{
LOG(WARNING) << item_type_ << " unknown acquisition item type";
}
}
gr::basic_block_sptr BeidouB3iPcpsAcquisition::get_left_block()
{
if (item_type_.compare("gr_complex") == 0)
{
return acquisition_;
}
else if (item_type_.compare("cshort") == 0)
{
return acquisition_;
}
else if (item_type_.compare("cbyte") == 0)
{
return cbyte_to_float_x2_;
}
else
{
LOG(WARNING) << item_type_ << " unknown acquisition item type";
return nullptr;
}
}
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

@ -0,0 +1,178 @@
/*!
* \file beidou_b3i_pcps_acquisition.h
* \brief Adapts a PCPS acquisition block to an AcquisitionInterface for
* Beidou B3I signals
* \author Damian Miralles, 2019. dmiralles2009@gmail.com
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_BEIDOU_B3I_PCPS_ACQUISITION_H_
#define GNSS_SDR_BEIDOU_B3I_PCPS_ACQUISITION_H_
#include "acq_conf.h"
#include "acquisition_interface.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 <volk_gnsssdr/volk_gnsssdr.h>
#include <string>
class ConfigurationInterface;
/*!
* \brief This class adapts a PCPS acquisition block to an AcquisitionInterface
* for BeiDou B3I signals
*/
class BeidouB3iPcpsAcquisition : public AcquisitionInterface
{
public:
BeidouB3iPcpsAcquisition(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
unsigned int out_streams);
virtual ~BeidouB3iPcpsAcquisition();
inline std::string role() override
{
return role_;
}
/*!
* \brief Returns "BEIDOU_B1I_PCPS_Acquisition"
*/
inline std::string implementation() override
{
return "BEIDOU_B3I_PCPS_Acquisition";
}
inline size_t item_size() override
{
return item_size_;
}
void connect(gr::top_block_sptr top_block) override;
void disconnect(gr::top_block_sptr top_block) override;
gr::basic_block_sptr get_left_block() override;
gr::basic_block_sptr get_right_block() override;
/*!
* \brief Set acquisition/tracking common Gnss_Synchro object pointer
* to efficiently exchange synchronization data between acquisition and
* tracking blocks
*/
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) override;
/*!
* \brief Set acquisition channel unique ID
*/
void set_channel(unsigned int channel) override;
/*!
* \brief Set statistics threshold of PCPS algorithm
*/
void set_threshold(float threshold) override;
/*!
* \brief Set maximum Doppler off grid search
*/
void set_doppler_max(unsigned int doppler_max) override;
/*!
* \brief Set Doppler steps for the grid search
*/
void set_doppler_step(unsigned int doppler_step) override;
/*!
* \brief Initializes acquisition algorithm.
*/
void init() override;
/*!
* \brief Sets local code for GPS L1/CA PCPS acquisition algorithm.
*/
void set_local_code() override;
/*!
* \brief Returns the maximum peak of grid search
*/
signed int mag() override;
/*!
* \brief Restart acquisition algorithm
*/
void reset() override;
/*!
* \brief If state = 1, it forces the block to start acquiring from the first sample
*/
void set_state(int state) override;
/*!
* \brief Stop running acquisition
*/
void stop_acquisition() override;
/*!
* \brief Sets the resampler latency to account it in the acquisition code delay estimation
*/
void set_resampler_latency(uint32_t latency_samples) override;
private:
ConfigurationInterface* configuration_;
pcps_acquisition_sptr acquisition_;
gr::blocks::stream_to_vector::sptr stream_to_vector_;
gr::blocks::float_to_complex::sptr float_to_complex_;
complex_byte_to_float_x2_sptr cbyte_to_float_x2_;
size_t item_size_;
std::string item_type_;
unsigned int vector_length_;
unsigned int code_length_;
bool bit_transition_flag_;
bool use_CFAR_algorithm_flag_;
unsigned int channel_;
float threshold_;
unsigned int doppler_max_;
unsigned int doppler_step_;
unsigned int sampled_ms_;
unsigned int max_dwells_;
long fs_in_;
bool dump_;
bool blocking_;
std::string dump_filename_;
std::complex<float>* code_;
Gnss_Synchro* gnss_synchro_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
float calculate_threshold(float pfa);
};
#endif /* GNSS_SDR_BEIDOU_B3I_PCPS_ACQUISITION_H_ */

View File

@ -31,6 +31,7 @@ set(GNSS_SPLIBS_SOURCES
pass_through.cc
galileo_e5_signal_processing.cc
beidou_b1i_signal_processing.cc
beidou_b3i_signal_processing.cc
complex_byte_to_float_x2.cc
byte_x2_to_complex_byte.cc
cshort_to_float_x2.cc
@ -56,6 +57,7 @@ set(GNSS_SPLIBS_HEADERS
pass_through.h
galileo_e5_signal_processing.h
beidou_b1i_signal_processing.h
beidou_b1i_signal_processing.h
complex_byte_to_float_x2.h
byte_x2_to_complex_byte.h
cshort_to_float_x2.h

View File

@ -0,0 +1,194 @@
/*!
* \file beidou_b3i_signal_processing.cc
* \brief This class implements various functions for BeiDou B1I signal
* \author Damian Miralles, 2019. dmiralles2009@gmail.com
*
* Detailed description of the file here if needed.
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#include "beidou_b3i_signal_processing.h"
auto auxCeil = [](float x) { return static_cast<int>(static_cast<long>((x) + 1)); };
void beidou_b3i_code_gen_int(int* _dest, signed int _prn, unsigned int _chip_shift)
{
const unsigned int _code_length = 10230;
int8_t G1[_code_length];
int8_t G2[_code_length];
std::array<int8_t,13> G1_register = {{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}};
std::array<int8_t,13> G2_register = {{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}};
std::array<int8_t,13> G1_register_reset = {{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,1}};
int8_t feedback1, feedback2;
uint32_t lcv, lcv2;
int32_t prn_idx = _prn - 1;
std::array<std::array<int8_t, 13>, 63> G2_register_shifted = {{
{{-1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1}}, {{-1,-1,-1,-1,1,1,1,-1,1,-1,1,-1,-1}},
{{-1,1,-1,-1,-1,-1,1,1,1,-1,1,-1,1}}, {{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1}},
{{-1,-1,1,1,-1,1,1,1,-1,-1,-1,-1,-1}}, {{-1,1,1,-1,1,1,-1,-1,1,1,-1,1,1}},
{{-1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1}}, {{-1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,-1}},
{{-1,1,-1,1,1,1,1,1,1,1,1,-1,1}}, {{1,1,-1,1,1,1,1,1,-1,-1,1,-1,-1}},
{{-1,-1,-1,1,-1,1,-1,-1,-1,1,1,1,1}}, {{1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,1}},
{{1,-1,-1,1,1,-1,1,1,-1,1,-1,1,-1}}, {{1,-1,-1,-1,1,1,1,-1,1,1,-1,-1,1}},
{{-1,1,1,1,-1,-1,1,1,1,-1,1,1,-1}}, {{-1,-1,-1,1,1,1,-1,-1,-1,-1,-1,1,1}},
{{1,1,-1,1,1,-1,-1,1,1,1,-1,1,-1}}, {{1,1,1,1,1,-1,-1,-1,1,-1,-1,1,1}},
{{-1,1,1,1,-1,1,-1,1,-1,1,-1,-1,-1}}, {{1,1,1,-1,1,-1,-1,1,-1,-1,-1,-1,1}},
{{1,1,-1,1,1,1,1,-1,1,-1,-1,1,-1}}, {{1,1,-1,1,-1,-1,1,1,1,-1,1,-1,1}},
{{1,1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1}}, {{1,1,-1,-1,1,1,-1,-1,1,1,1,-1,1}},
{{1,1,-1,-1,-1,1,-1,1,1,-1,1,1,1}}, {{1,-1,1,1,-1,1,1,-1,1,-1,1,1,-1}},
{{-1,1,-1,-1,1,-1,-1,1,-1,1,1,-1,-1}}, {{-1,1,-1,1,-1,-1,-1,-1,1,1,1,-1,1}},
{{1,1,1,-1,1,-1,-1,-1,-1,1,-1,1,-1}}, {{1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}},
{{1,-1,-1,1,-1,-1,1,1,1,-1,-1,-1,-1}}, {{-1,1,-1,1,-1,-1,1,1,1,-1,1,1,-1}},
{{-1,1,1,-1,1,-1,1,-1,1,-1,1,-1,-1}}, {{-1,-1,1,1,-1,-1,1,-1,1,1,-1,1,-1}},
{{-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1}}, {{-1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,1,1}},
{{1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1}}, {{-1,-1,-1,1,-1,1,1,1,-1,1,1,1,1}},
{{-1,-1,1,-1,-1,-1,1,1,-1,1,1,1,1}}, {{-1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1,1}},
{{-1,1,1,1,1,1,1,-1,-1,1,-1,1,1}}, {{1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1}},
{{1,-1,-1,1,-1,-1,1,-1,-1,-1,-1,1,1}}, {{-1,-1,1,-1,1,1,-1,-1,-1,1,1,1,-1}},
{{1,1,-1,-1,-1,1,1,-1,1,1,1,-1,1}}, {{1,-1,1,-1,1,-1,-1,1,1,1,-1,1,-1}},
{{-1,1,1,-1,-1,-1,-1,-1,1,1,-1,-1,1}}, {{-1,-1,-1,-1,-1,1,-1,1,1,-1,1,1,1}},
{{1,1,1,1,-1,1,-1,1,1,-1,1,1,-1}}, {{-1,1,1,1,1,-1,1,-1,1,-1,-1,1,1}},
{{-1,-1,-1,-1,1,1,-1,1,1,-1,-1,1,1}}, {{1,-1,1,1,-1,-1,1,1,1,-1,-1,-1,-1}},
{{1,1,1,1,1,1,1,1,-1,-1,1,1,1}}, {{-1,1,1,1,1,1,1,1,1,1,-1,1,1}},
{{1,1,-1,-1,1,-1,1,-1,1,1,-1,-1,1}}, {{-1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1}},
{{1,-1,-1,-1,1,1,-1,-1,-1,-1,1,1,1}}, {{1,1,-1,1,-1,-1,-1,1,1,-1,1,-1,1}},
{{-1,-1,1,1,-1,-1,-1,-1,-1,1,-1,-1,1}}, {{-1,1,1,-1,1,1,-1,1,1,1,-1,1,-1}},
{{1,-1,-1,-1,1,1,1,-1,1,1,1,1,1}}, {{1,1,-1,-1,1,1,-1,1,1,1,1,-1,1}},
{{1,1,-1,1,1,1,-1,1,1,-1,-1,-1,1}}}};
/* A simple error check */
if ((prn_idx < 0) || (prn_idx > 64))
return;
/*Assign shifted G2 register based on prn number*/
G2_register = G2_register_shifted[prn_idx];
/* Generate G1 and G2 Register */
for (lcv = 0; lcv < _code_length; lcv++)
{
G1[lcv] = G1_register[12];
G2[lcv] = G2_register[12];
feedback1 = G1_register[0]*G1_register[2]*G1_register[3]*G1_register[12];
feedback2 = G2_register[0]*G2_register[4]*G2_register[5]*G2_register[6]*
G2_register[8]*G2_register[9]*G2_register[11]*G2_register[12];
for (lcv2 = 0; lcv2 < 12; lcv2++)
{
G1_register[lcv2 + 1] = G1_register[lcv2];
G2_register[lcv2 + 1] = G2_register[lcv2];
}
G1_register[0] = feedback1;
G2_register[0] = feedback2;
// Reset G1 register if sequence found
if(G1_register == G1_register_reset)
{
G1_register = {{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}};
}
// Generate ranging code
_dest[lcv] = static_cast<int>(-G1[lcv]*G2[lcv]);
}
}
void beidou_b3i_code_gen_float(float* _dest, signed int _prn, unsigned int _chip_shift)
{
unsigned int _code_length = 10230;
int b3i_code_int[10230];
beidou_b3i_code_gen_int(b3i_code_int, _prn, _chip_shift);
for (unsigned int ii = 0; ii < _code_length; ++ii)
{
_dest[ii] = static_cast<float>(b3i_code_int[ii]);
}
}
void beidou_b3i_code_gen_complex(std::complex<float>* _dest, signed int _prn, unsigned int _chip_shift)
{
unsigned int _code_length = 10230;
int b3i_code_int[10230];
beidou_b3i_code_gen_int(b3i_code_int, _prn, _chip_shift);
for (unsigned int ii = 0; ii < _code_length; ++ii)
{
_dest[ii] = std::complex<float>(static_cast<float>(b3i_code_int[ii]), 0.0f);
}
}
void beidou_b3i_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, int _fs, unsigned int _chip_shift)
{
// This function is based on the GNU software GPS for MATLAB in the Kay Borre book
std::complex<float> _code[10230];
signed int _samplesPerCode, _codeValueIndex;
float _ts;
float _tc;
float aux;
const signed int _codeFreqBasis = 10230000; //Hz
const signed int _codeLength = 10230;
//--- Find number of samples per spreading code ----------------------------
_samplesPerCode = static_cast<signed int>(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_b3i_code_gen_complex(_code, _prn, _chip_shift); //generate C/A code 1 sample per chip
for (signed int i = 0; i < _samplesPerCode; i++)
{
//=== Digitizing =======================================================
//--- Make index array to read C/A code values -------------------------
// The length of the index array depends on the sampling frequency -
// number of samples per millisecond (because one C/A code period is one
// millisecond).
// _codeValueIndex = ceil((_ts * ((float)i + 1)) / _tc) - 1;
aux = (_ts * (i + 1)) / _tc;
_codeValueIndex = auxCeil(aux) - 1;
//--- Make the digitized version of the C/A code -----------------------
// The "upsampled" code is made by selecting values form the CA code
// chip array (caCode) for the time instances of each sample.
if (i == _samplesPerCode - 1)
{
//--- Correct the last index (due to number rounding issues) -----------
_dest[i] = _code[_codeLength - 1];
}
else
{
_dest[i] = _code[_codeValueIndex]; //repeat the chip -> upsample
}
}
}

View File

@ -0,0 +1,56 @@
/*!
* \file beidou_b3i_signal_processing.h
* \brief This class implements various functions for BeiDou B3I signals
* \author Damian Miralles, 2019. dmiralles2009@gmail.com
*
* Detailed description of the file here if needed.
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#ifndef BEIDOU_B3I_SDR_SIGNAL_PROCESSING_H_
#define BEIDOU_B3I_SDR_SIGNAL_PROCESSING_H_
#include <complex>
#include <iostream>
#include <cstdint>
#include <array>
//!Generates int BeiDou B3I code for the desired SV ID and code shift
void beidou_b3i_code_gen_int(int* _dest, signed int _prn, unsigned int _chip_shift);
//!Generates float BeiDou B3I code for the desired SV ID and code shift
void beidou_b3i_code_gen_float(float* _dest, signed int _prn, unsigned int _chip_shift);
//!Generates complex BeiDou B3I code for the desired SV ID and code shift, and sampled to specific sampling frequency
void beidou_b3i_code_gen_complex(std::complex<float>* _dest, signed int _prn, unsigned int _chip_shift);
//! Generates N complex BeiDou B3I codes 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, unsigned int _ncodes);
//! 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_ */

View File

@ -27,6 +27,7 @@ set(TELEMETRY_DECODER_ADAPTER_SOURCES
glonass_l1_ca_telemetry_decoder.cc
glonass_l2_ca_telemetry_decoder.cc
beidou_b1i_telemetry_decoder.cc
beidou_b3i_telemetry_decoder.cc
)
set(TELEMETRY_DECODER_ADAPTER_HEADERS
@ -38,7 +39,8 @@ set(TELEMETRY_DECODER_ADAPTER_HEADERS
galileo_e5a_telemetry_decoder.h
glonass_l1_ca_telemetry_decoder.h
glonass_l2_ca_telemetry_decoder.h
beidou_b1i_telemetry_decoder.h
beidou_b1i_telemetry_decoder.h
beidou_b3i_telemetry_decoder.h
)
include_directories(

View File

@ -0,0 +1,112 @@
/*!
* \file beidou_b3i_telemetry_decoder.cc
* \brief Implementation of an adapter of a Beidou B1I NAV data decoder block
* to a TelemetryDecoderInterface
* \author Damian Miralles, 2019. dmiralles2009@gmail.com
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#include "beidou_b3i_telemetry_decoder.h"
#include "configuration_interface.h"
#include <gnuradio/io_signature.h>
#include <glog/logging.h>
#include "beidou_dnav_almanac.h"
#include "beidou_dnav_ephemeris.h"
#include "beidou_dnav_iono.h"
#include "beidou_dnav_utc_model.h"
using google::LogMessage;
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)
{
std::string default_dump_filename = "./navigation.dat";
DLOG(INFO) << "role " << role;
dump_ = configuration->property(role + ".dump", false);
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename);
// make telemetry decoder object
telemetry_decoder_ = beidou_b3i_make_telemetry_decoder_cc(satellite_, dump_); // TODO fix me
DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")";
channel_ = 0;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
}
if (out_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one output stream";
}
}
BeidouB3iTelemetryDecoder::~BeidouB3iTelemetryDecoder()
{
}
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 */
};
// 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 */
};
// Nothing to disconnect
}
gr::basic_block_sptr BeidouB3iTelemetryDecoder::get_left_block()
{
return telemetry_decoder_;
}
gr::basic_block_sptr BeidouB3iTelemetryDecoder::get_right_block()
{
return telemetry_decoder_;
}

View File

@ -0,0 +1,95 @@
/*!
* \file beidou_b3i_telemetry_decoder.h
* \brief Interface of an adapter of a Beidou B3I NAV data decoder block
* to a TelemetryDecoderInterface
* \author Damian Miralles, 2019. dmiralles2009@gmail.com
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_BEIDOU_B3I_TELEMETRY_DECODER_H_
#define GNSS_SDR_BEIDOU_B3I_TELEMETRY_DECODER_H_
#include "telemetry_decoder_interface.h"
#include <string>
#include "beidou_b3i_telemetry_decoder_cc.h"
class ConfigurationInterface;
/*!
* \brief This class implements a NAV data decoder for BEIDOU B1I
*/
class BeidouB3iTelemetryDecoder : public TelemetryDecoderInterface
{
public:
BeidouB3iTelemetryDecoder(ConfigurationInterface* configuration,
std::string role,
unsigned int in_streams,
unsigned int out_streams);
virtual ~BeidouB3iTelemetryDecoder();
inline std::string role() override
{
return role_;
}
//! Returns "BEIDOU_B3I_Telemetry_Decoder"
inline std::string implementation() override
{
return "BEIDOU_B3I_Telemetry_Decoder";
}
void connect(gr::top_block_sptr top_block) override;
void disconnect(gr::top_block_sptr top_block) override;
gr::basic_block_sptr get_left_block() override;
gr::basic_block_sptr get_right_block() override;
void set_satellite(const Gnss_Satellite& satellite) override;
inline void set_channel(int channel) override { telemetry_decoder_->set_channel(channel); }
inline void reset() override
{
return;
}
inline size_t item_size() override
{
return 0;
}
private:
beidou_b3i_telemetry_decoder_cc_sptr telemetry_decoder_;
Gnss_Satellite satellite_;
int channel_;
bool dump_;
std::string dump_filename_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
};
#endif

View File

@ -25,6 +25,7 @@ set(TELEMETRY_DECODER_GR_BLOCKS_SOURCES
glonass_l2_ca_telemetry_decoder_cc.cc
galileo_telemetry_decoder_cc.cc
beidou_b1i_telemetry_decoder_cc.cc
beidou_b3i_telemetry_decoder_cc.cc
)
set(TELEMETRY_DECODER_GR_BLOCKS_HEADERS
@ -36,6 +37,7 @@ set(TELEMETRY_DECODER_GR_BLOCKS_HEADERS
glonass_l2_ca_telemetry_decoder_cc.h
galileo_telemetry_decoder_cc.h
beidou_b1i_telemetry_decoder_cc.h
beidou_b3i_telemetry_decoder_cc.cc
)
include_directories(

View File

@ -182,6 +182,7 @@ void beidou_b1i_telemetry_decoder_cc::decode_bch15_11_01(int32_t *bits, int32_t
}
}
void beidou_b1i_telemetry_decoder_cc::decode_word(
int32_t word_counter,
double* enc_word_symbols,
@ -310,6 +311,7 @@ void beidou_b1i_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satell
// Update satellite information for DNAV decoder
sat_prn = d_satellite.get_PRN();
d_nav.i_satellite_PRN = sat_prn;
d_nav.i_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
if ( sat_prn > 0 and sat_prn < 6 )

View File

@ -42,6 +42,7 @@
#include "gnss_satellite.h"
#include "gnss_synchro.h"
#include "Beidou_B1I.h"
#include "Beidou_DNAV.h"
#include <gnuradio/block.h>
#include <fstream>
#include <string>

View File

@ -0,0 +1,594 @@
/*!
* \file beidou_b3i_telemetry_decoder_cc.cc
* \brief Implementation of an adapter of a BEIDOU B31 DNAV data decoder block
* to a TelemetryDecoderInterface
* \author Damian Miralles, 2019. dmiralles2009(at)gmail.com
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#include "beidou_b3i_telemetry_decoder_cc.h"
#include "control_message_factory.h"
#include "convolutional.h"
#include "display.h"
#include "gnss_synchro.h"
#include <boost/lexical_cast.hpp>
#include <gnuradio/io_signature.h>
#include <glog/logging.h>
#include <volk_gnsssdr/volk_gnsssdr.h>
#include <iostream>
#define CRC_ERROR_LIMIT 8
using google::LogMessage;
beidou_b3i_telemetry_decoder_cc_sptr
beidou_b3i_make_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump)
{
return beidou_b3i_telemetry_decoder_cc_sptr(new beidou_b3i_telemetry_decoder_cc(satellite, dump));
}
beidou_b3i_telemetry_decoder_cc::beidou_b3i_telemetry_decoder_cc(
const Gnss_Satellite &satellite,
bool dump) : gr::block("beidou_b3i_telemetry_decoder_cc",
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
d_dump = dump;
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
LOG(INFO) << "Initializing BeiDou B1i Telemetry Decoding for satellite "<< this->d_satellite;
d_samples_per_symbol = (BEIDOU_B3I_CODE_RATE_HZ / BEIDOU_B3I_CODE_LENGTH_CHIPS) / BEIDOU_D1NAV_SYMBOL_RATE_SPS;
d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS * d_samples_per_symbol;
d_secondary_code_symbols = static_cast<int32_t *>(volk_gnsssdr_malloc(BEIDOU_B3I_SECONDARY_CODE_LENGTH * sizeof(int32_t), volk_gnsssdr_get_alignment()));
d_preamble_samples = static_cast<int32_t *>(volk_gnsssdr_malloc(d_samples_per_preamble * sizeof(int32_t), volk_gnsssdr_get_alignment()));
d_preamble_period_samples = BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS*d_samples_per_symbol;
d_subframe_length_symbols = BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS;
// 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')
{
d_secondary_code_symbols[i] = 1;
}
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++)
{
int32_t m = 0;
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++)
{
d_preamble_samples[n] = -d_secondary_code_symbols[m];
n++;
m++;
m = m % BEIDOU_B3I_SECONDARY_CODE_LENGTH;
}
}
}
d_subframe_symbols = static_cast<double *>(volk_gnsssdr_malloc(d_subframe_length_symbols * sizeof(double), volk_gnsssdr_get_alignment()));
d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS*d_samples_per_symbol + d_samples_per_preamble;
// Generic settings
d_sample_counter = 0;
d_stat = 0;
d_preamble_index = 0;
d_flag_frame_sync = false;
d_TOW_at_current_symbol_ms = 0;
Flag_valid_word = false;
d_CRC_error_counter = 0;
d_flag_preamble = false;
d_channel = 0;
flag_SOW_set = false;
}
beidou_b3i_telemetry_decoder_cc::~beidou_b3i_telemetry_decoder_cc()
{
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
{
d_dump_file.close();
}
catch (const std::exception &ex)
{
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
}
}
}
void beidou_b3i_telemetry_decoder_cc::decode_bch15_11_01(int32_t *bits, int32_t *decbits)
{
int bit, err, reg[4] = {1, 1, 1, 1};
int errind[15] = {14, 13, 10, 12, 6, 9, 4, 11, 0, 5, 7, 8, 1, 3, 2};
for (unsigned int i = 0; i < 15; i++)
{
decbits[i] = bits[i];
}
for (unsigned int i = 0; i < 15; i++)
{
bit = reg[3];
reg[3] = reg[2];
reg[2] = reg[1];
reg[1] = reg[0];
reg[0] = bits[i] * bit;
reg[1] *= bit;
}
err = errind[reg[0] + reg[1]*2 + reg[2]*4 + reg[3]*8];
if (err > 0)
{
decbits[err - 1] *= -1;
}
}
void beidou_b3i_telemetry_decoder_cc::decode_word(
int32_t word_counter,
double* enc_word_symbols,
int32_t* dec_word_symbols)
{
int32_t bitsbch[30], first_branch[15], second_branch[15];
if (word_counter == 1)
{
for (unsigned int j = 0; j < 30; j++)
{
dec_word_symbols[j] = (int32_t)(enc_word_symbols[j] > 0) ? (1) : (-1);
}
}
else
{
for (unsigned int r = 0; r < 2; r++)
{
for (unsigned int c = 0; c < 15; c++)
{
bitsbch[r*15 + c] = (int32_t)(enc_word_symbols[c*2 + r] > 0) ? (1) : (-1);
}
}
decode_bch15_11_01(&bitsbch[0], first_branch);
decode_bch15_11_01(&bitsbch[15], second_branch);
for (unsigned int j = 0; j < 11; j++)
{
dec_word_symbols[j] = first_branch[j];
dec_word_symbols[j + 11] = second_branch[j];
}
for (unsigned int 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_cc::decode_subframe(double *frame_symbols, int32_t frame_length)
{
// 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++)
{
// 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++)
{
data_bits.push_back( (dec_word_bits[jj] > 0) ? ('1') : ('0') );
}
}
if ( d_satellite.get_PRN() > 0 and d_satellite.get_PRN() < 6 )
{
d_nav.d2_subframe_decoder(data_bits);
}
else
{
d_nav.d1_subframe_decoder(data_bits);
}
// 3. Check operation executed correctly
if (d_nav.flag_crc_test == true)
{
LOG(INFO) << "BeiDou DNAV CRC correct in channel " << d_channel << " from satellite " << d_satellite;
}
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)
{
// get object for this SV (mandatory)
std::shared_ptr<Beidou_Dnav_Ephemeris> tmp_obj = std::make_shared<Beidou_Dnav_Ephemeris>(d_nav.get_ephemeris());
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
LOG(INFO) << "BEIDOU DNAV Ephemeris have been received in channel" << d_channel << " from satellite " << d_satellite;
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)
{
// 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());
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
LOG(INFO) << "BEIDOU DNAV UTC Model have been received in channel" << d_channel << " from satellite " << d_satellite;
std::cout << "New BEIDOU B3I DNAV utc model message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite << std::endl;
}
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());
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
LOG(INFO) << "BEIDOU DNAV Iono have been received in channel" << d_channel << " from satellite " << d_satellite;
std::cout << "New BEIDOU B3I DNAV Iono message received in channel " << d_channel << ": Iono model parameters from satellite " << d_satellite << std::endl;
}
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));
// this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
LOG(INFO) << "BEIDOU DNAV Almanac have been received in channel" << d_channel << " from satellite " << d_satellite << std::endl;
std::cout << "New BEIDOU B3I DNAV almanac received in channel " << d_channel << " from satellite " << d_satellite << std::endl;
}
}
void beidou_b3i_telemetry_decoder_cc::set_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 " << d_satellite;
DLOG(INFO) << "Navigation Satellite set to " << d_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)
// Update tel dec parameters for D2 NAV Messages
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);
volk_gnsssdr_free(d_subframe_symbols);
d_samples_per_symbol = (BEIDOU_B3I_CODE_RATE_HZ / BEIDOU_B3I_CODE_LENGTH_CHIPS) / BEIDOU_D2NAV_SYMBOL_RATE_SPS;
d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS * d_samples_per_symbol;
d_secondary_code_symbols = nullptr;
d_preamble_samples = static_cast<int32_t *>(volk_gnsssdr_malloc(d_samples_per_preamble * sizeof(int32_t), volk_gnsssdr_get_alignment()));
d_preamble_period_samples = BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS*d_samples_per_symbol;
d_subframe_length_symbols = BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS;
// 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++)
{
d_preamble_samples[n] = 1;
n++;
}
}
else
{
for (uint32_t j = 0; j < d_samples_per_symbol; j++)
{
d_preamble_samples[n] = -1;
n++;
}
}
}
d_subframe_symbols = static_cast<double *>(volk_gnsssdr_malloc(d_subframe_length_symbols * sizeof(double), volk_gnsssdr_get_alignment()));
d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS*d_samples_per_symbol + d_samples_per_preamble;
}
}
void beidou_b3i_telemetry_decoder_cc::set_channel(int 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
{
d_dump_filename = "telemetry";
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
d_dump_filename.append(".dat");
d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
d_dump_file.open(d_dump_filename.c_str(), 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)
{
LOG(WARNING) << "channel " << d_channel << ": exception opening Beidou TLM dump file. " << e.what();
}
}
}
}
int beidou_b3i_telemetry_decoder_cc::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)
{
int32_t corr_value = 0;
int32_t preamble_diff = 0;
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); // Get the output buffer pointer
const Gnss_Synchro **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_sample_counter++; //count for the processed samples
consume_each(1);
d_flag_preamble = false;
if (d_symbol_history.size() > d_required_symbols)
{
//******* preamble correlation ********
for (int i = 0; i < d_samples_per_preamble; i++)
{
if (d_symbol_history.at(i) < 0) // symbols clipping
{
corr_value -= d_preamble_samples[i];
}
else
{
corr_value += d_preamble_samples[i];
}
}
}
//******* frame sync ******************
if (d_stat == 0) //no preamble information
{
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 " << this->d_satellite;
// Enter into frame pre-detection status
d_stat = 1;
}
}
else if (d_stat == 1) // possible preamble lock
{
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)
{
//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)
{
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
{
if (d_sample_counter == d_preamble_index + static_cast<uint64_t>(d_preamble_period_samples))
{
//******* SAMPLES TO SYMBOLS *******
if (corr_value > 0) //normal PLL lock
{
int k = 0;
for (uint32_t i = 0; i < d_subframe_length_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 )
{
// 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
{
// because last symbol of the preamble is just received now!
d_subframe_symbols[i] += static_cast<float>(d_secondary_code_symbols[k]) * d_symbol_history.at(i * d_samples_per_symbol + m);
k++;
k = k % BEIDOU_B3I_SECONDARY_CODE_LENGTH;
}
}
}
}
else //180 deg. inverted carrier phase PLL lock
{
int k = 0;
for (uint32_t i = 0; i < d_subframe_length_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 )
{
// 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
{
// because last symbol of the preamble is just received now!
d_subframe_symbols[i] -= static_cast<float>(d_secondary_code_symbols[k]) * d_symbol_history.at(i * d_samples_per_symbol + m);
k++;
k = k % BEIDOU_B3I_SECONDARY_CODE_LENGTH;
}
}
}
}
//call the decoder
decode_subframe(d_subframe_symbols, d_subframe_length_symbols);
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)
{
d_flag_frame_sync = true;
DLOG(INFO) << "BeiDou DNAV frame sync found for SAT " << this->d_satellite;
}
}
else
{
d_CRC_error_counter++;
d_preamble_index = d_sample_counter; //record the preamble sample stamp
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;
d_stat = 0;
flag_SOW_set = false;
}
}
}
}
// UPDATE GNSS SYNCHRO DATA
//2. Add the telemetry decoder information
if (this->d_flag_preamble == true and d_nav.flag_new_SOW_available == true)
//update TOW at the preamble instant
{
// Reporting sow as gps time of week
d_TOW_at_Preamble_ms = static_cast<uint32_t>((d_nav.d_SOW + 14) * 1000.0);
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>((d_required_symbols + 1) * 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 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)
{
current_symbol.Flag_valid_word = true;
}
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)
{
// MULTIPLEXED FILE RECORDING - Record results to file
try
{
double tmp_double;
unsigned long int tmp_ulong_int;
tmp_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(unsigned long int));
tmp_double = 0;
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
}
catch (const std::ifstream::failure &e)
{
LOG(WARNING) << "Exception writing observables dump file " << e.what();
}
}
// remove used symbols from history
if (d_symbol_history.size() > d_required_symbols)
{
d_symbol_history.pop_front();
}
//3. Make the output (copy the object contents to the GNURadio reserved memory)
*out[0] = current_symbol;
return 1;
}

View File

@ -0,0 +1,124 @@
/*!
* \file beidou_b3i_telemetry_decoder_cc.h
* \brief Implementation of an adapter of a BEIDOU BI1 DNAV data decoder block
* to a TelemetryDecoderInterface
* \author Damian Miralles, 2019. dmiralles2009(at)gmail.com
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_BEIDOU_B3I_TELEMETRY_DECODER_CC_H
#define GNSS_SDR_BEIDOU_B3I_TELEMETRY_DECODER_CC_H
#include "beidou_dnav_navigation_message.h"
#include "beidou_dnav_ephemeris.h"
#include "beidou_dnav_almanac.h"
#include "beidou_dnav_utc_model.h"
#include "gnss_satellite.h"
#include "gnss_synchro.h"
#include "Beidou_B3I.h"
#include "Beidou_DNAV.h"
#include <gnuradio/block.h>
#include <fstream>
#include <string>
class beidou_b3i_telemetry_decoder_cc;
typedef boost::shared_ptr<beidou_b3i_telemetry_decoder_cc> beidou_b3i_telemetry_decoder_cc_sptr;
beidou_b3i_telemetry_decoder_cc_sptr beidou_b3i_make_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
//!!!! edit
/*!
* \brief This class implements a block that decodes the GNAV data defined in BEIDOU ICD v5.1
* \note Code added as part of GSoC 2018 program
* \see <a href="http://russianspacesystems.ru/wp-content/uploads/2016/08/ICD_GLONASS_eng_v5.1.pdf">GLONASS ICD</a>
*
*/
class beidou_b3i_telemetry_decoder_cc : public gr::block
{
public:
~beidou_b3i_telemetry_decoder_cc(); //!< Class destructor
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
void set_channel(int channel); //!< Set receiver's channel
/*!
* \brief This is where all signal processing takes place
*/
int general_work(int noutput_items, gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
private:
friend beidou_b3i_telemetry_decoder_cc_sptr
beidou_b3i_make_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
beidou_b3i_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
void decode_subframe(double *symbols, int32_t frame_length);
void decode_word(int32_t word_counter, double* enc_word_symbols, int32_t* dec_word_symbols);
void decode_bch15_11_01(int32_t *bits, int32_t *decbits);
//!< Preamble decoding
unsigned short int d_preambles_symbols[BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS];
int32_t *d_preamble_samples;
int32_t *d_secondary_code_symbols;
uint32_t d_samples_per_symbol;
int32_t d_symbols_per_preamble;
int32_t d_samples_per_preamble;
int32_t d_preamble_period_samples;
double *d_subframe_symbols;
uint32_t d_subframe_length_symbols;
uint32_t d_required_symbols;
//!< Storage for incoming data
std::deque<float> d_symbol_history;
//!< Variables for internal functionality
uint64_t d_sample_counter; //!< Sample counter as an index (1,2,3,..etc) indicating number of samples processed
uint64_t d_preamble_index; //!< Index of sample number where preamble was found
uint32_t d_stat; //!< Status of decoder
bool d_flag_frame_sync; //!< Indicate when a frame sync is achieved
bool d_flag_preamble; //!< Flag indicating when preamble was found
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
Beidou_Dnav_Navigation_Message d_nav;
//!< 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
Gnss_Satellite d_satellite;
int32_t d_channel;
bool d_dump;
std::string d_dump_filename;
std::ofstream d_dump_file;
};
#endif

View File

@ -66,6 +66,7 @@ set(TRACKING_ADAPTER_SOURCES
glonass_l2_ca_dll_pll_tracking.cc
glonass_l2_ca_dll_pll_c_aid_tracking.cc
beidou_b1i_dll_pll_tracking.cc
beidou_b3i_dll_pll_tracking.cc
${OPT_TRACKING_ADAPTERS_SOURCES}
)
@ -84,6 +85,7 @@ set(TRACKING_ADAPTER_HEADERS
glonass_l2_ca_dll_pll_tracking.h
glonass_l2_ca_dll_pll_c_aid_tracking.h
beidou_b1i_dll_pll_tracking.h
beidou_b3i_dll_pll_tracking.h
${OPT_TRACKING_ADAPTERS_HEADERS}
)

View File

@ -0,0 +1,203 @@
/*!
* \file beidou_b3i_dll_pll_tracking.cc
* \brief Implementation of an adapter of a DLL+PLL tracking loop block
* for Beidou B3I to a TrackingInterface
* \author Damian Miralles, 2019. dmiralles2009(at)gmail.com
*
* Code DLL + carrier PLL according to the algorithms described in:
* K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen,
* A Software-Defined GPS and Galileo Receiver. A Single-Frequency
* Approach, Birkhauser, 2007
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#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"
using google::LogMessage;
BeidouB3iDllPllTracking::BeidouB3iDllPllTracking(
ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
{
Dll_Pll_Conf trk_param = Dll_Pll_Conf();
DLOG(INFO) << "role " << role;
//################# CONFIGURATION PARAMETERS ########################
std::string default_item_type = "gr_complex";
std::string item_type = configuration->property(role + ".item_type", default_item_type);
int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000);
int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
trk_param.fs_in = fs_in;
bool dump = configuration->property(role + ".dump", false);
trk_param.dump = dump;
float pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0);
if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz);
trk_param.pll_bw_hz = pll_bw_hz;
float pll_bw_narrow_hz = configuration->property(role + ".pll_bw_narrow_hz", 20.0);
trk_param.pll_bw_narrow_hz = pll_bw_narrow_hz;
float dll_bw_narrow_hz = configuration->property(role + ".dll_bw_narrow_hz", 2.0);
trk_param.dll_bw_narrow_hz = dll_bw_narrow_hz;
float dll_bw_hz = configuration->property(role + ".dll_bw_hz", 2.0);
if (FLAGS_dll_bw_hz != 0.0) dll_bw_hz = static_cast<float>(FLAGS_dll_bw_hz);
trk_param.dll_bw_hz = dll_bw_hz;
float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5);
trk_param.early_late_space_chips = early_late_space_chips;
float early_late_space_narrow_chips = configuration->property(role + ".early_late_space_narrow_chips", 0.5);
trk_param.early_late_space_narrow_chips = early_late_space_narrow_chips;
std::string default_dump_filename = "./track_ch";
std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename);
trk_param.dump_filename = dump_filename;
int vector_length = std::round(fs_in / (BEIDOU_B3I_CODE_RATE_HZ / BEIDOU_B3I_CODE_LENGTH_CHIPS));
trk_param.vector_length = vector_length;
int symbols_extended_correlator = configuration->property(role + ".extend_correlation_symbols", 1);
if (symbols_extended_correlator < 1)
{
symbols_extended_correlator = 1;
std::cout << TEXT_RED << "WARNING: BEIDOU B3I. extend_correlation_symbols must be bigger than 1. Coherent integration has been set to 1 symbol (1 ms)" << TEXT_RESET << std::endl;
}
else if (symbols_extended_correlator > 20)
{
symbols_extended_correlator = 20;
std::cout << TEXT_RED << "WARNING: BEIDOU B3I. extend_correlation_symbols must be lower than 21. Coherent integration has been set to 20 symbols (20 ms)" << TEXT_RESET << std::endl;
}
trk_param.extend_correlation_symbols = symbols_extended_correlator;
bool track_pilot = configuration->property(role + ".track_pilot", false);
if (track_pilot)
{
std::cout << TEXT_RED << "WARNING: BEIDOU B3I does not have pilot signal. Data tracking has been enabled" << TEXT_RESET << std::endl;
}
if ((symbols_extended_correlator > 1) and (pll_bw_narrow_hz > pll_bw_hz or dll_bw_narrow_hz > dll_bw_hz))
{
std::cout << TEXT_RED << "WARNING: BEIDOU B3I. PLL or DLL narrow tracking bandwidth is higher than wide tracking one" << TEXT_RESET << std::endl;
}
trk_param.very_early_late_space_chips = 0.0;
trk_param.very_early_late_space_narrow_chips = 0.0;
trk_param.track_pilot = false;
trk_param.system = 'C';
char sig_[3] = "B1";
std::memcpy(trk_param.signal, sig_, 3);
int cn0_samples = configuration->property(role + ".cn0_samples", 20);
if (FLAGS_cn0_samples != 20) cn0_samples = FLAGS_cn0_samples;
trk_param.cn0_samples = cn0_samples;
int cn0_min = configuration->property(role + ".cn0_min", 25);
if (FLAGS_cn0_min != 25) cn0_min = FLAGS_cn0_min;
trk_param.cn0_min = cn0_min;
int max_lock_fail = configuration->property(role + ".max_lock_fail", 50);
if (FLAGS_max_lock_fail != 50) max_lock_fail = FLAGS_max_lock_fail;
trk_param.max_lock_fail = max_lock_fail;
double carrier_lock_th = configuration->property(role + ".carrier_lock_th", 0.85);
if (FLAGS_carrier_lock_th != 0.85) carrier_lock_th = FLAGS_carrier_lock_th;
trk_param.carrier_lock_th = carrier_lock_th;
//################# MAKE TRACKING GNURadio object ###################
if (item_type.compare("gr_complex") == 0)
{
item_size_ = sizeof(gr_complex);
tracking_ = dll_pll_veml_make_tracking(trk_param);
}
else
{
item_size_ = sizeof(gr_complex);
LOG(WARNING) << item_type << " unknown tracking item type.";
}
channel_ = 0;
DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")";
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
}
if (out_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one output stream";
}
}
BeidouB3iDllPllTracking::~BeidouB3iDllPllTracking()
{
}
void BeidouB3iDllPllTracking::start_tracking()
{
tracking_->start_tracking();
}
void BeidouB3iDllPllTracking::stop_tracking()
{
tracking_->stop_tracking();
}
/*
* Set tracking channel unique ID
*/
void BeidouB3iDllPllTracking::set_channel(unsigned int channel)
{
channel_ = channel;
tracking_->set_channel(channel);
}
void BeidouB3iDllPllTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
{
tracking_->set_gnss_synchro(p_gnss_synchro);
}
void BeidouB3iDllPllTracking::connect(gr::top_block_sptr top_block)
{
if (top_block)
{ /* top_block is not null */
};
//nothing to connect, now the tracking uses gr_sync_decimator
}
void BeidouB3iDllPllTracking::disconnect(gr::top_block_sptr top_block)
{
if (top_block)
{ /* top_block is not null */
};
//nothing to disconnect, now the tracking uses gr_sync_decimator
}
gr::basic_block_sptr BeidouB3iDllPllTracking::get_left_block()
{
return tracking_;
}
gr::basic_block_sptr BeidouB3iDllPllTracking::get_right_block()
{
return tracking_;
}

View File

@ -0,0 +1,106 @@
/*!
* \file beidou_b3i_dll_pll_tracking.h
* \brief Interface of an adapter of a DLL+PLL tracking loop block
* for Beidou B3I to a TrackingInterface
* \author Damian Miralles, 2019. dmiralles2009(at)gmail.com
*
* Code DLL + carrier PLL according to the algorithms described in:
* K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen,
* A Software-Defined GPS and Galileo Receiver. A Single-Frequency
* Approach, Birkhauser, 2007
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#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 <string>
class ConfigurationInterface;
/*!
* \brief This class implements a code DLL + carrier PLL tracking loop
*/
class BeidouB3iDllPllTracking : public TrackingInterface
{
public:
BeidouB3iDllPllTracking(ConfigurationInterface* configuration,
std::string role,
unsigned int in_streams,
unsigned int out_streams);
virtual ~BeidouB3iDllPllTracking();
inline std::string role() override
{
return role_;
}
inline std::string implementation() override
{
return "BEIDOU_B3I_DLL_PLL_Tracking";
}
inline size_t item_size() override
{
return item_size_;
}
void connect(gr::top_block_sptr top_block) override;
void disconnect(gr::top_block_sptr top_block) override;
gr::basic_block_sptr get_left_block() override;
gr::basic_block_sptr get_right_block() override;
/*!
* \brief Set tracking channel unique ID
*/
void set_channel(unsigned int channel) override;
/*!
* \brief Set acquisition/tracking common Gnss_Synchro object pointer
* to efficiently exchange synchronization data between acquisition and tracking blocks
*/
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) override;
void start_tracking() override;
/*!
* \brief Stop running tracking
*/
void stop_tracking() override;
private:
dll_pll_veml_tracking_sptr tracking_;
size_t item_size_;
unsigned int channel_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
};
#endif // GNSS_SDR_BEIDOU_B3I_DLL_PLL_TRACKING_H_

View File

@ -41,11 +41,13 @@
#include "Galileo_E1.h"
#include "Galileo_E5a.h"
#include "Beidou_B1I.h"
#include "Beidou_B3I.h"
#include "MATH_CONSTANTS.h"
#include "control_message_factory.h"
#include "galileo_e1_signal_processing.h"
#include "galileo_e5_signal_processing.h"
#include "beidou_b1i_signal_processing.h"
#include "beidou_b3i_signal_processing.h"
#include "gnss_sdr_create_directory.h"
#include "gps_l2c_signal.h"
#include "gps_l5_signal.h"
@ -110,6 +112,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl
map_signal_pretty_name["5X"] = "E5a";
map_signal_pretty_name["L5"] = "L5";
map_signal_pretty_name["B1"] = "B1I";
map_signal_pretty_name["B3"] = "B3I";
signal_pretty_name = map_signal_pretty_name[signal_type];
@ -293,6 +296,22 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl
d_secondary_code_length = static_cast<unsigned int>(BEIDOU_B1I_SECONDARY_CODE_LENGTH);
d_secondary_code_string = const_cast<std::string *>(&BEIDOU_B1I_SECONDARY_CODE_STR);
}
else if (signal_type == "B3")
{
// GEO Satellites use different secondary code
d_signal_carrier_freq = BEIDOU_B3I_FREQ_HZ;
d_code_period = BEIDOU_B3I_CODE_PERIOD;
d_code_chip_rate = BEIDOU_B3I_CODE_RATE_HZ;
d_code_length_chips = static_cast<unsigned int>(BEIDOU_B3I_CODE_LENGTH_CHIPS);
d_symbols_per_bit = BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT;
d_correlation_length_ms = 1;
d_code_samples_per_chip = 1;
d_secondary = true;
trk_parameters.track_pilot = false;
interchange_iq = false;
d_secondary_code_length = static_cast<unsigned int>(BEIDOU_B3I_SECONDARY_CODE_LENGTH);
d_secondary_code_string = const_cast<std::string *>(&BEIDOU_B3I_SECONDARY_CODE_STR);
}
else
{
LOG(WARNING) << "Invalid Signal argument when instantiating tracking blocks";
@ -612,6 +631,47 @@ void dll_pll_veml_tracking::start_tracking()
}
else if (systemName == "Beidou" and signal_type == "B3")
{
beidou_b3i_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN, 0);
// Update secondary code settings for geo satellites
if(d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6)
{
d_symbols_per_bit = 2;
d_correlation_length_ms = 1;
d_code_samples_per_chip = 1;
d_secondary = false;
trk_parameters.track_pilot = false;
interchange_iq = false;
d_secondary_code_length = 0;
d_secondary_code_string = const_cast<std::string *>(&BEIDOU_B3I_D2_SECONDARY_CODE_STR);
// preamble bits to sampled symbols
d_preamble_length_symbols = 22;
d_preambles_symbols = static_cast<int32_t *>(volk_gnsssdr_malloc(22 * sizeof(int32_t), volk_gnsssdr_get_alignment()));
int32_t n = 0;
uint16_t preambles_bits[BEIDOU_B3I_PREAMBLE_LENGTH_BITS] = {1,1,1,0,0,0,1,0,0,1,0};
for (uint16_t preambles_bit : preambles_bits)
{
for (uint32_t j = 0; j < d_symbols_per_bit; j++)
{
if (preambles_bit == 1)
{
d_preambles_symbols[n] = 1;
}
else
{
d_preambles_symbols[n] = -1;
}
n++;
}
}
d_symbol_history.resize(22); // Change fixed buffer size
d_symbol_history.clear();
}
}
multicorrelator_cpu.set_local_code_and_taps(d_code_samples_per_chip * d_code_length_chips, d_tracking_code, d_local_code_shift_chips);
std::fill_n(d_correlator_outs, d_n_correlator_taps, gr_complex(0.0, 0.0));

View File

@ -68,6 +68,9 @@
#include "beidou_b1i_pcps_acquisition.h"
#include "beidou_b1i_dll_pll_tracking.h"
#include "beidou_b1i_telemetry_decoder.h"
#include "beidou_b3i_pcps_acquisition.h"
#include "beidou_b3i_dll_pll_tracking.h"
#include "beidou_b3i_telemetry_decoder.h"
#include "gnss_block_interface.h"
#include "gps_l1_ca_dll_pll_c_aid_tracking.h"
#include "gps_l1_ca_dll_pll_tracking.h"
@ -284,6 +287,7 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetObservables(std::shared
unsigned int Glonass_channels = configuration->property("Channels_1G.count", 0);
Glonass_channels += configuration->property("Channels_2G.count", 0);
unsigned int Beidou_channels = configuration->property("Channels_B1.count", 0);
Beidou_channels += configuration->property("Channels_B3.count", 0);
unsigned int extra_channels = 1; // For monitor channel sample counter
return GetBlock(configuration, "Observables", implementation,
Galileo_channels +
@ -311,6 +315,7 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetPVT(std::shared_ptr<Con
unsigned int Glonass_channels = configuration->property("Channels_1G.count", 0);
Glonass_channels += configuration->property("Channels_2G.count", 0);
unsigned int Beidou_channels = configuration->property("Channels_B1.count", 0);
Beidou_channels += configuration->property("Channels_B3.count", 0);
return GetBlock(configuration, "PVT", implementation,
Galileo_channels + GPS_channels + Glonass_channels + Beidou_channels, 0);
}
@ -851,6 +856,74 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetChannel_B1(
return channel_;
}
//********* BeiDou B3I CHANNEL *****************
std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetChannel_B3(
std::shared_ptr<ConfigurationInterface> configuration,
std::string acq, std::string trk, std::string tlm, int channel,
gr::msg_queue::sptr queue)
{
std::stringstream stream;
stream << channel;
std::string id = stream.str();
LOG(INFO) << "Instantiating Channel " << id << " with Acquisition Implementation: "
<< acq << ", Tracking Implementation: " << trk << ", Telemetry Decoder implementation: " << tlm;
std::string aux = configuration->property("Acquisition_B3" + std::to_string(channel) + ".implementation", std::string("W"));
std::string appendix1;
if (aux.compare("W") != 0)
{
appendix1 = std::to_string(channel);
}
else
{
appendix1 = "";
}
aux = configuration->property("Tracking_B3" + std::to_string(channel) + ".implementation", std::string("W"));
std::string appendix2;
if (aux.compare("W") != 0)
{
appendix2 = std::to_string(channel);
}
else
{
appendix2 = "";
}
aux = configuration->property("TelemetryDecoder_B3" + std::to_string(channel) + ".implementation", std::string("W"));
std::string appendix3;
if (aux.compare("W") != 0)
{
appendix3 = std::to_string(channel);
}
else
{
appendix3 = "";
}
// Automatically detect input data type
std::shared_ptr<InMemoryConfiguration> config;
config = std::make_shared<InMemoryConfiguration>();
std::string default_item_type = "gr_complex";
std::string acq_item_type = configuration->property("Acquisition_B3" + appendix1 + ".item_type", default_item_type);
std::string trk_item_type = configuration->property("Tracking_B3" + appendix2 + ".item_type", default_item_type);
if (acq_item_type != trk_item_type)
{
LOG(ERROR) << "Acquisition and Tracking blocks must have the same input data type!";
}
config->set_property("Channel.item_type", acq_item_type);
std::unique_ptr<AcquisitionInterface> acq_ = GetAcqBlock(configuration, "Acquisition_B3" + appendix1, acq, 1, 0);
std::unique_ptr<TrackingInterface> trk_ = GetTrkBlock(configuration, "Tracking_B3" + appendix2, trk, 1, 1);
std::unique_ptr<TelemetryDecoderInterface> tlm_ = GetTlmBlock(configuration, "TelemetryDecoder_B3" + appendix3, tlm, 1, 1);
std::unique_ptr<GNSSBlockInterface> channel_(new Channel(configuration.get(), channel,
std::move(acq_),
std::move(trk_),
std::move(tlm_),
"Channel", "B3", queue));
return channel_;
}
std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFactory::GetChannels(
std::shared_ptr<ConfigurationInterface> configuration, gr::msg_queue::sptr queue)
{
@ -869,6 +942,7 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
unsigned int Channels_5X_count = configuration->property("Channels_5X.count", 0);
unsigned int Channels_L5_count = configuration->property("Channels_L5.count", 0);
unsigned int Channels_B1_count = configuration->property("Channels_B1.count", 0);
unsigned int Channels_B3_count = configuration->property("Channels_B3.count", 0);
unsigned int total_channels = Channels_1C_count +
Channels_1B_count +
@ -877,7 +951,8 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
Channels_2G_count +
Channels_5X_count +
Channels_L5_count +
Channels_B1_count;
Channels_B1_count +
Channels_B3_count;
std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> channels(new std::vector<std::unique_ptr<GNSSBlockInterface>>(total_channels));
try
@ -1118,6 +1193,36 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
channel_absolute_id++;
}
//**************** BEIDOU B3I CHANNELS **********************
LOG(INFO) << "Getting " << Channels_B3_count << " BEIDOU B3I channels";
acquisition_implementation = configuration->property("Acquisition_B3.implementation", default_implementation);
tracking_implementation = configuration->property("Tracking_B3.implementation", default_implementation);
telemetry_decoder_implementation = configuration->property("TelemetryDecoder_B3.implementation", default_implementation);
for (unsigned int i = 0; i < Channels_B3_count; i++)
{
//(i.e. Acquisition_2G0.implementation=xxxx)
std::string acquisition_implementation_specific = configuration->property(
"Acquisition_B3" + std::to_string(channel_absolute_id) + ".implementation",
acquisition_implementation);
//(i.e. Tracking_2G0.implementation=xxxx)
std::string tracking_implementation_specific = configuration->property(
"Tracking_B3" + std::to_string(channel_absolute_id) + ".implementation",
tracking_implementation);
std::string telemetry_decoder_implementation_specific = configuration->property(
"TelemetryDecoder_B3" + std::to_string(channel_absolute_id) + ".implementation",
telemetry_decoder_implementation);
// Push back the channel to the vector of channels
channels->at(channel_absolute_id) = GetChannel_B3(configuration,
acquisition_implementation_specific,
tracking_implementation_specific,
telemetry_decoder_implementation_specific,
channel_absolute_id,
queue);
channel_absolute_id++;
}
}
catch (const std::exception &e)
{
@ -1602,6 +1707,12 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetBlock(
out_streams));
block = std::move(block_);
}
else if (implementation == "BEIDOU_B3I_PCPS_Acquisition")
{
std::unique_ptr<AcquisitionInterface> block_(new BeidouB3iPcpsAcquisition(configuration.get(), role, in_streams,
out_streams));
block = std::move(block_);
}
// TRACKING BLOCKS -------------------------------------------------------------
else if (implementation == "GPS_L1_CA_DLL_PLL_Tracking")
@ -1736,6 +1847,12 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetBlock(
out_streams));
block = std::move(block_);
}
else if (implementation == "BEIDOU_B3I_DLL_PLL_Tracking")
{
std::unique_ptr<GNSSBlockInterface> block_(new BeidouB3iDllPllTracking(configuration.get(), role, in_streams,
out_streams));
block = std::move(block_);
}
// TELEMETRY DECODERS ----------------------------------------------------------
else if (implementation == "GPS_L1_CA_Telemetry_Decoder")
{
@ -1791,6 +1908,12 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetBlock(
out_streams));
block = std::move(block_);
}
else if (implementation == "BEIDOU_B3I_Telemetry_Decoder")
{
std::unique_ptr<GNSSBlockInterface> block_(new BeidouB3iTelemetryDecoder(configuration.get(), role, in_streams,
out_streams));
block = std::move(block_);
}
// OBSERVABLES -----------------------------------------------------------------
else if ((implementation == "Hybrid_Observables") || (implementation == "GPS_L1_CA_Observables") || (implementation == "GPS_L2C_Observables") ||
@ -1986,7 +2109,12 @@ std::unique_ptr<AcquisitionInterface> GNSSBlockFactory::GetAcqBlock(
out_streams));
block = std::move(block_);
}
else if (implementation == "BEIDOU_B3I_PCPS_Acquisition")
{
std::unique_ptr<AcquisitionInterface> block_(new BeidouB3iPcpsAcquisition(configuration.get(), role, in_streams,
out_streams));
block = std::move(block_);
}
else
{
// Log fatal. This causes execution to stop.
@ -2137,6 +2265,12 @@ std::unique_ptr<TrackingInterface> GNSSBlockFactory::GetTrkBlock(
out_streams));
block = std::move(block_);
}
else if (implementation == "BEIDOU_B3I_DLL_PLL_Tracking")
{
std::unique_ptr<TrackingInterface> block_(new BeidouB3iDllPllTracking(configuration.get(), role, in_streams,
out_streams));
block = std::move(block_);
}
else
{
@ -2210,7 +2344,12 @@ std::unique_ptr<TelemetryDecoderInterface> GNSSBlockFactory::GetTlmBlock(
out_streams));
block = std::move(block_);
}
else if (implementation == "BEIDOU_B3I_Telemetry_Decoder")
{
std::unique_ptr<TelemetryDecoderInterface> block_(new BeidouB3iTelemetryDecoder(configuration.get(), role, in_streams,
out_streams));
block = std::move(block_);
}
else
{

View File

@ -110,6 +110,10 @@ private:
std::string acq, std::string trk, std::string tlm, int channel,
boost::shared_ptr<gr::msg_queue> queue);
std::unique_ptr<GNSSBlockInterface> GetChannel_B3(std::shared_ptr<ConfigurationInterface> configuration,
std::string acq, std::string trk, std::string tlm, int channel,
boost::shared_ptr<gr::msg_queue> queue);
std::unique_ptr<AcquisitionInterface> GetAcqBlock(
std::shared_ptr<ConfigurationInterface> configuration,
std::string role,

View File

@ -405,6 +405,9 @@ void GNSSFlowgraph::connect()
case evBDS_B1:
acq_fs = fs;
break;
case evBDS_B3:
acq_fs = fs;
break;
}
if (acq_fs < fs)
@ -606,6 +609,12 @@ void GNSSFlowgraph::connect()
available_BDS_B1_signals_.remove(signal_value);
break;
case evBDS_B3:
gnss_system = "Beidou";
signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal);
available_BDS_B3_signals_.remove(signal_value);
break;
default:
LOG(ERROR) << "This should not happen :-(";
gnss_system = "GPS";
@ -1024,8 +1033,14 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
break;
case evBDS_B1:
available_BDS_B1_signals_.push_back(channels_[who]->get_signal());
break;
available_BDS_B1_signals_.remove(gs);
available_BDS_B1_signals_.push_back(gs);
break;
case evBDS_B3:
available_BDS_B3_signals_.remove(gs);
available_BDS_B3_signals_.push_back(gs);
break;
default:
LOG(ERROR) << "This should not happen :-(";
@ -1099,6 +1114,10 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
available_BDS_B1_signals_.remove(channels_[who]->get_signal());
break;
case evBDS_B3:
available_BDS_B3_signals_.remove(channels_[who]->get_signal());
break;
default:
LOG(ERROR) << "This should not happen :-(";
break;
@ -1183,6 +1202,11 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
available_BDS_B1_signals_.push_back(channels_[who]->get_signal());
break;
case evBDS_B3:
available_BDS_B3_signals_.push_back(channels_[who]->get_signal());
break;
default:
LOG(ERROR) << "This should not happen :-(";
break;
@ -1236,6 +1260,16 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
available_GLO_2G_signals_.push_back(gs);
break;
case evBDS_B1:
available_BDS_B1_signals_.remove(gs);
available_BDS_B1_signals_.push_back(gs);
break;
case evBDS_B3:
available_BDS_B3_signals_.remove(gs);
available_BDS_B3_signals_.push_back(gs);
break;
default:
LOG(ERROR) << "This should not happen :-(";
break;
@ -1513,6 +1547,7 @@ void GNSSFlowgraph::init()
mapStringValues_["1G"] = evGLO_1G;
mapStringValues_["2G"] = evGLO_2G;
mapStringValues_["B1"] = evBDS_B1;
mapStringValues_["B3"] = evBDS_B3;
// fill the signals queue with the satellites ID's to be searched by the acquisition
set_signals_list();
@ -1561,7 +1596,8 @@ void GNSSFlowgraph::set_signals_list()
std::set<unsigned int> available_beidou_prn = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
30, 31, 32, 33, 34, 35, 36, 37};
30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63};
std::string sv_list = configuration_->property("Galileo.prns", std::string(""));
@ -1626,6 +1662,7 @@ void GNSSFlowgraph::set_signals_list()
available_glonass_prn = tmp_set;
}
}
sv_list = configuration_->property("Beidou.prns", std::string(""));
@ -1764,6 +1801,22 @@ void GNSSFlowgraph::set_signals_list()
}
}
if (configuration_->property("Channels_B3.count", 0) > 0)
{
/*
* Loop to create the list of BeiDou B1C signals
*/
for (available_gnss_prn_iter = available_beidou_prn.cbegin();
available_gnss_prn_iter != available_beidou_prn.cend();
available_gnss_prn_iter++)
{
available_BDS_B3_signals_.push_back(Gnss_Signal(
Gnss_Satellite(std::string("Beidou"), *available_gnss_prn_iter),
std::string("B3")));
}
}
}
@ -2002,20 +2055,44 @@ Gnss_Signal GNSSFlowgraph::search_next_signal(const std::string& searched_signal
}
if (tracked)
{
// In the near future Beidou B2a will be added
// if (configuration_->property("Channels_5C.count", 0) > 0)
// {
// for (unsigned int ch = 0; ch < channels_count_; ch++)
// {
// if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("5C") != 0)) untracked_satellite = false;
// }
// if (untracked_satellite)
// {
// Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "5C");
// available_BDS_5C_signals_.remove(gs);
// available_BDS_5C_signals_.push_front(gs);
// }
// }
if (configuration_->property("Channels_B3.count", 0) > 0)
{
for (unsigned int ch = 0; ch < channels_count_; ch++)
{
if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "2G")) untracked_satellite = false;
}
if (untracked_satellite)
{
Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "B3");
available_BDS_B3_signals_.remove(gs);
available_BDS_B3_signals_.push_front(gs);
}
}
}
break;
case evBDS_B3:
result = available_BDS_B3_signals_.front();
available_BDS_B3_signals_.pop_front();
if (!pop)
{
available_BDS_B3_signals_.push_back(result);
}
if (tracked)
{
if (configuration_->property("Channels_B1.count", 0) > 0)
{
for (unsigned int ch = 0; ch < channels_count_; ch++)
{
if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "2G")) untracked_satellite = false;
}
if (untracked_satellite)
{
Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "B1");
available_BDS_B1_signals_.remove(gs);
available_BDS_B1_signals_.push_front(gs);
}
}
}
break;

View File

@ -185,6 +185,7 @@ private:
std::list<Gnss_Signal> available_GLO_1G_signals_;
std::list<Gnss_Signal> available_GLO_2G_signals_;
std::list<Gnss_Signal> available_BDS_B1_signals_;
std::list<Gnss_Signal> available_BDS_B3_signals_;
enum StringValue
{
evGPS_1C,
@ -195,7 +196,8 @@ private:
evGAL_5X,
evGLO_1G,
evGLO_2G,
evBDS_B1
evBDS_B1,
evBDS_B3
};
std::map<std::string, StringValue> mapStringValues_;

View File

@ -57,26 +57,6 @@ const int BEIDOU_B1I_SECONDARY_CODE_LENGTH = 20;
const std::string BEIDOU_B1I_SECONDARY_CODE = "00000100110101001110";
const std::string BEIDOU_B1I_SECONDARY_CODE_STR = "00000100110101001110";
const std::string BEIDOU_B1I_D2_SECONDARY_CODE_STR = "00";
/*!
* \brief Maximum Time-Of-Arrival (TOA) difference between satellites for a receiver operated on Earth surface is 20 ms
*
* According to the GPS orbit model described in [1] Pag. 32.
* It should be taken into account to set the buffer size for the PRN start timestamp in the pseudoranges block.
* [1] J. Bao-Yen Tsui, Fundamentals of Global Positioning System Receivers. A Software Approach, John Wiley & Sons,
* Inc., Hoboken, NJ, 2nd edition, 2005.
*/
const double BEIDOU_MAX_TOA_DELAY_MS = 20; //******************
//#define NAVIGATION_SOLUTION_RATE_MS 1000 // this cannot go here
const double BEIDOU_STARTOFFSET_ms = 68.802; //**************[ms] Initial sign. travel time (this cannot go here)
// OBSERVABLE HISTORY DEEP FOR INTERPOLATION
const int BEIDOU_B1I_HISTORY_DEEP = 100; // ****************
// NAVIGATION MESSAGE DEMODULATION AND DECODING
const int BEIDOU_B1I_PREAMBLE_LENGTH_BITS = 11;
const int BEIDOU_B1I_PREAMBLE_LENGTH_SYMBOLS = 220; // **************
const double BEIDOU_B1I_PREAMBLE_DURATION_S = 0.220;
@ -91,256 +71,5 @@ const int BEIDOU_SUBFRAME_SECONDS = 6; //!< Subframe duration [s
const int BEIDOU_SUBFRAME_MS = 6000; //!< Subframe duration [miliseconds]
const int BEIDOU_WORD_BITS = 30; //!< Number of bits per word in the NAV message [bits]
const std::string BEIDOU_DNAV_PREAMBLE = "11100010010";
const int BEIDOU_DNAV_PREAMBLE_LENGTH_BITS = 11;
const int BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS = 11; // **************
const double BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS = 300;
const double BEIDOU_DNAV_SUBFRAME_SYMBOLS = 300;
const double BEIDOU_DNAV_DATA_BITS = 300;
const double BEIDOU_DNAV_WORDS_SUBFRAME = 10;
const double BEIDOU_DNAV_WORD_LENGTH_BITS = 30;
const double BEIDOU_D1NAV_SYMBOL_RATE_SPS = 50;
const double BEIDOU_D2NAV_SYMBOL_RATE_SPS = 500;
const double BEIDOU_B1I_PREAMBLE_PERIOD_SYMBOLS = 300;
// BEIDOU D1 NAVIGATION MESSAGE STRUCTURE
// GENERAL
const std::vector<std::pair<int,int> > D1_PRE( { {1,11} } );
const std::vector<std::pair<int,int> > D1_FRAID( { {16,3} } );
const std::vector<std::pair<int,int> > D1_SOW( { {19,8},{31,12} } );
const std::vector<std::pair<int,int> > D1_PNUM( { {44,7} } );
// DNAV SCALE FACTORS
// EPH
const double D1_TOC_LSB = TWO_P3;
const double D1_TGD1_LSB = 0.1e-9;
const double D1_TGD2_LSB = 0.1e-9;
const double D1_ALPHA0_LSB = TWO_N30;
const double D1_ALPHA1_LSB = TWO_N27;
const double D1_ALPHA2_LSB = TWO_N24;
const double D1_ALPHA3_LSB = TWO_N24;
const double D1_BETA0_LSB = TWO_P11;
const double D1_BETA1_LSB = TWO_P14;
const double D1_BETA2_LSB = TWO_P16;
const double D1_BETA3_LSB = TWO_P16;
const double D1_A2_LSB = TWO_N66;
const double D1_A0_LSB = TWO_N33;
const double D1_A1_LSB = TWO_N50;
const double D1_DELTA_N_LSB = PI_TWO_N43;
const double D1_CUC_LSB = TWO_N31;
const double D1_M0_LSB = PI_TWO_N31;
const double D1_E_LSB = TWO_N33;
const double D1_CUS_LSB = TWO_N31;
const double D1_CRC_LSB = TWO_N6;
const double D1_CRS_LSB = TWO_N6;
const double D1_SQRT_A_LSB = TWO_N19;
const double D1_TOE_LSB = TWO_P3;
const double D1_I0_LSB = PI_TWO_N31;
const double D1_CIC_LSB = TWO_N31;
const double D1_OMEGA_DOT_LSB = PI_TWO_N43;
const double D1_CIS_LSB = TWO_N31;
const double D1_IDOT_LSB = PI_TWO_N43;
const double D1_OMEGA0_LSB = PI_TWO_N31;
const double D1_OMEGA_LSB = PI_TWO_N31;
//ALM
const double D1_SQRT_A_ALMANAC_LSB = TWO_N11;
const double D1_A1_ALMANAC_LSB = TWO_N38;
const double D1_A0_ALMANAC_LSB = TWO_N20;
const double D1_OMEGA0_ALMANAC_LSB = PI_TWO_N23;
const double D1_E_ALMANAC_LSB = TWO_N21;
const double D1_DELTA_I_LSB = PI_TWO_N19;
const double D1_TOA_LSB = TWO_P12;
const double D1_OMEGA_DOT_ALMANAC_LSB = PI_TWO_N38;
const double D1_OMEGA_ALMANAC_LSB = PI_TWO_N23;
const double D1_M0_ALMANAC_LSB = PI_TWO_N23;
const double D1_A0GPS_LSB = 0.1e-9;
const double D1_A1GPS_LSB = 0.1e-9;
const double D1_A0GAL_LSB = 0.1e-9;
const double D1_A1GAL_LSB = 0.1e-9;
const double D1_A0GLO_LSB = 0.1e-9;
const double D1_A1GLO_LSB = 0.1e-9;
const double D1_A0UTC_LSB = TWO_N30;
const double D1_A1UTC_LSB = TWO_N50;
// SUBFRAME 1
const std::vector<std::pair<int,int> > D1_SAT_H1( { {43,1} } );
const std::vector<std::pair<int,int> > D1_AODC( { {44,5} } );
const std::vector<std::pair<int,int> > D1_URAI( { {49,4} } );
const std::vector<std::pair<int,int> > D1_WN( { {61,13} } );
const std::vector<std::pair<int,int> > D1_TOC( { {74,9},{91,8} } );
const std::vector<std::pair<int,int> > D1_TGD1( { {99,10} } );
const std::vector<std::pair<int,int> > D1_TGD2( { {121,6} } );
const std::vector<std::pair<int,int> > D1_ALPHA0( { {127,8} } );
const std::vector<std::pair<int,int> > D1_ALPHA1( { {135,8} } );
const std::vector<std::pair<int,int> > D1_ALPHA2( { {151,8} } );
const std::vector<std::pair<int,int> > D1_ALPHA3( { {159,8} } );
const std::vector<std::pair<int,int> > D1_BETA0( { {167,6}, {181,2} } );
const std::vector<std::pair<int,int> > D1_BETA1( { {183,8} } );
const std::vector<std::pair<int,int> > D1_BETA2( { {191,8} } );
const std::vector<std::pair<int,int> > D1_BETA3( { {199,4},{211,4} } );
const std::vector<std::pair<int,int> > D1_A2( { {215,11} } );
const std::vector<std::pair<int,int> > D1_A0( { {226,7},{241,17} } );
const std::vector<std::pair<int,int> > D1_A1( { {258,5},{271,17} } );
const std::vector<std::pair<int,int> > D1_AODE( { {288,5} } );
//SUBFRAME 2
const std::vector<std::pair<int,int> > D1_DELTA_N( { {43,10},{61,6} } );
const std::vector<std::pair<int,int> > D1_CUC( { {67,16},{91,2} } );
const std::vector<std::pair<int,int> > D1_M0( { {93,20}, {121,12} } );
const std::vector<std::pair<int,int> > D1_E( { {133,10},{151,22} } );
const std::vector<std::pair<int,int> > D1_CUS( { {181,18} } );
const std::vector<std::pair<int,int> > D1_CRC( { {199,4},{211,14} } );
const std::vector<std::pair<int,int> > D1_CRS( { {225,8},{241,10} } );
const std::vector<std::pair<int,int> > D1_SQRT_A( { {251,12},{271,20} } );
const std::vector<std::pair<int,int> > D1_TOE_SF2( { {291,2} } );
//SUBFRAME 3
const std::vector<std::pair<int,int> > D1_TOE_SF3( { {43,10},{61,5} } );
const std::vector<std::pair<int,int> > D1_I0( { {66,17},{91,15} } );
const std::vector<std::pair<int,int> > D1_CIC( { {106,7},{121,11} } );
const std::vector<std::pair<int,int> > D1_OMEGA_DOT( { {132,11},{151,13} } );
const std::vector<std::pair<int,int> > D1_CIS( { {164,9},{181,9} } );
const std::vector<std::pair<int,int> > D1_IDOT( { {190,13},{211,1} } );
const std::vector<std::pair<int,int> > D1_OMEGA0( { {212,21},{241,11} } );
const std::vector<std::pair<int,int> > D1_OMEGA( { {252,11},{271,21} } );
//SUBFRAME 4 AND PAGES 1 THROUGH 6 IN SUBFRAME 5
const std::vector<std::pair<int,int> > D1_SQRT_A_ALMANAC( { {51,2},{61,22} } );
const std::vector<std::pair<int,int> > D1_A1_ALMANAC( { {91,11} } );
const std::vector<std::pair<int,int> > D1_A0_ALMANAC( { {102,11} } );
const std::vector<std::pair<int,int> > D1_OMEGA0_ALMANAC( { {121,22},{151,2} } );
const std::vector<std::pair<int,int> > D1_E_ALMANAC( { {153,17} } );
const std::vector<std::pair<int,int> > D1_DELTA_I( { {170,3},{181,13} } );
const std::vector<std::pair<int,int> > D1_TOA( { {194,8} } );
const std::vector<std::pair<int,int> > D1_OMEGA_DOT_ALMANAC( { {202,1}, {211,16} } );
const std::vector<std::pair<int,int> > D1_OMEGA_ALMANAC( { {227,6},{241,18} } );
const std::vector<std::pair<int,int> > D1_M0_ALMANAC( { {259,4},{271,20} } );
//SUBFRAME 5 PAGE 7
const std::vector<std::pair<int,int> > D1_HEA1( { {51,2},{61,7} } );
const std::vector<std::pair<int,int> > D1_HEA2( { {68,9} } );
const std::vector<std::pair<int,int> > D1_HEA3( { {77,6},{91,3} } );
const std::vector<std::pair<int,int> > D1_HEA4( { {94,9} } );
const std::vector<std::pair<int,int> > D1_HEA5( { {103,9} } );
const std::vector<std::pair<int,int> > D1_HEA6( { {112,1},{121,8} } );
const std::vector<std::pair<int,int> > D1_HEA7( { {129,9} } );
const std::vector<std::pair<int,int> > D1_HEA8( { {138,5},{151,4} } );
const std::vector<std::pair<int,int> > D1_HEA9( { {155,9} } );
const std::vector<std::pair<int,int> > D1_HEA10( { {164,9} } );
const std::vector<std::pair<int,int> > D1_HEA11( { {181,9} } );
const std::vector<std::pair<int,int> > D1_HEA12( { {190,9} } );
const std::vector<std::pair<int,int> > D1_HEA13( { {199,4},{211,5} } );
const std::vector<std::pair<int,int> > D1_HEA14( { {216,9} } );
const std::vector<std::pair<int,int> > D1_HEA15( { {225,8},{241,1} } );
const std::vector<std::pair<int,int> > D1_HEA16( { {242,9} } );
const std::vector<std::pair<int,int> > D1_HEA17( { {251,9} } );
const std::vector<std::pair<int,int> > D1_HEA18( { {260,3},{271,6} } );
const std::vector<std::pair<int,int> > D1_HEA19( { {277,9} } );
//SUBFRAME 5 PAGE 8
const std::vector<std::pair<int,int> > D1_HEA20( { {51,2},{61,7} } );
const std::vector<std::pair<int,int> > D1_HEA21( { {68,9} } );
const std::vector<std::pair<int,int> > D1_HEA22( { {77,6},{91,3} } );
const std::vector<std::pair<int,int> > D1_HEA23( { {94,9} } );
const std::vector<std::pair<int,int> > D1_HEA24( { {103,9} } );
const std::vector<std::pair<int,int> > D1_HEA25( { {112,1},{121,8} } );
const std::vector<std::pair<int,int> > D1_HEA26( { {129,9} } );
const std::vector<std::pair<int,int> > D1_HEA27( { {138,5},{151,4} } );
const std::vector<std::pair<int,int> > D1_HEA28( { {155,9} } );
const std::vector<std::pair<int,int> > D1_HEA29( { {164,9} } );
const std::vector<std::pair<int,int> > D1_HEA30( { {181,9} } );
const std::vector<std::pair<int,int> > D1_WNA( { {190,8} } );
const std::vector<std::pair<int,int> > D1_TOA2( { {198,5},{211,3} } );
//SUBFRAME 5 PAGE 9
const std::vector<std::pair<int,int> > D1_A0GPS( { {97,14} } );
const std::vector<std::pair<int,int> > D1_A1GPS( { {111,2},{121,14} } );
const std::vector<std::pair<int,int> > D1_A0GAL( { {135,8},{151,6} } );
const std::vector<std::pair<int,int> > D1_A1GAL( { {157,16} } );
const std::vector<std::pair<int,int> > D1_A0GLO( { {181,14} } );
const std::vector<std::pair<int,int> > D1_A1GLO( { {195,8},{211,8} } );
//SUBFRAME 5 PAGE 10
const std::vector<std::pair<int,int> > D1_DELTA_T_LS( { {51,2},{61,6} } );
const std::vector<std::pair<int,int> > D1_DELTA_T_LSF( { {67,8} } );
const std::vector<std::pair<int,int> > D1_WN_LSF( { {75,8} } );
const std::vector<std::pair<int,int> > D1_A0UTC( { {91,22},{121,10} } );
const std::vector<std::pair<int,int> > D1_A1UTC( { {131,12},{151,12} } );
const std::vector<std::pair<int,int> > D1_DN( { {163,8} } );
// D2 NAV Message Decoding Information
const std::vector<std::pair<int,int> > D2_PRE( { {1,11} } );
const std::vector<std::pair<int,int> > D2_FRAID( { {16,3} } );
const std::vector<std::pair<int,int> > D2_SOW( { {19,8},{31,12} } );
const std::vector<std::pair<int,int> > D2_PNUM( { {43,4} } );
// D2 NAV, SUBFRAME 1, PAGE 1
const std::vector<std::pair<int,int> > D2_SAT_H1( { {47,1} } );
const std::vector<std::pair<int,int> > D2_AODC( { {48,5} } );
const std::vector<std::pair<int,int> > D2_URAI( { {61,4} } );
const std::vector<std::pair<int,int> > D2_WN( { {65,13} } );
const std::vector<std::pair<int,int> > D2_TOC( { {78,5},{91,12} } );
const std::vector<std::pair<int,int> > D2_TGD1( { {103,10} } );
const std::vector<std::pair<int,int> > D2_TGD2( { {121,10} } );
// D2 NAV, SUBFRAME 1, PAGE 2
const std::vector<std::pair<int,int> > D2_ALPHA0( { {47,6}, {61,2} } );
const std::vector<std::pair<int,int> > D2_ALPHA1( { {63,8} } );
const std::vector<std::pair<int,int> > D2_ALPHA2( { {71,8} } );
const std::vector<std::pair<int,int> > D2_ALPHA3( { {79,4}, {91,4} } );
const std::vector<std::pair<int,int> > D2_BETA0( { {95,8} } );
const std::vector<std::pair<int,int> > D2_BETA1( { {103,8} } );
const std::vector<std::pair<int,int> > D2_BETA2( { {111,2}, {121,6} } );
const std::vector<std::pair<int,int> > D2_BETA3( { {127,8} } );
// D2 NAV, SUBFRAME 1, PAGE 3
const std::vector<std::pair<int,int> > D2_A0( { {101,12},{121,12} } );
const std::vector<std::pair<int,int> > D2_A1_MSB( { {133,4} } );
const std::vector<std::pair<int,int> > D2_A1_LSB( { {47,6}, {61, 12} } );
const std::vector<std::pair<int,int> > D2_A1( { {279,22} } );
// D2 NAV, SUBFRAME 1, PAGE 4
const std::vector<std::pair<int,int> > D2_A2( { {73,10}, {91,1} } );
const std::vector<std::pair<int,int> > D2_AODE( { {92,5} } );
const std::vector<std::pair<int,int> > D2_DELTA_N( { {97,16} } );
const std::vector<std::pair<int,int> > D2_CUC_MSB( { {121,14} } );
const std::vector<std::pair<int,int> > D2_CUC_LSB( { {47,4} } );
const std::vector<std::pair<int,int> > D2_CUC( { {283,18} } );
// D2 NAV, SUBFRAME 1, PAGE 5
const std::vector<std::pair<int,int> > D2_M0( { {51,2}, {61,22}, {91,8} } );
const std::vector<std::pair<int,int> > D2_CUS( { {99,14}, {121, 4} } );
const std::vector<std::pair<int,int> > D2_E_MSB( { {125,10} } );
// D2 NAV, SUBFRAME 1, PAGE 6
const std::vector<std::pair<int,int> > D2_E_LSB( { {47,6}, {61, 16} } );
const std::vector<std::pair<int,int> > D2_SQRT_A( { {77,6},{91,22}, {121,4} } );
const std::vector<std::pair<int,int> > D2_CIC_MSB( { {125,10} } );
const std::vector<std::pair<int,int> > D2_CIC_LSB( { {47,6}, {61,2} } );
const std::vector<std::pair<int,int> > D2_CIC( { {283,18} } );
// D2 NAV, SUBFRAME 1, PAGE 7
const std::vector<std::pair<int,int> > D2_CIS( { {63,18} } );
const std::vector<std::pair<int,int> > D2_TOE( { {81,2},{91,15} } );
const std::vector<std::pair<int,int> > D2_I0_MSB( { {106,7},{121,14} } );
const std::vector<std::pair<int,int> > D2_I0_LSB( { {47,6},{61,5} } );
const std::vector<std::pair<int,int> > D2_I0( { {269,32} } );
// D2 NAV, SUBFRAME 1, PAGE 8
const std::vector<std::pair<int,int> > D2_CRC( { {66,17},{91,1} } );
const std::vector<std::pair<int,int> > D2_CRS( { {92,18} } );
const std::vector<std::pair<int,int> > D2_OMEGA_DOT_MSB( { {110,3},{121,16} } );
const std::vector<std::pair<int,int> > D2_OMEGA_DOT_LSB( { {47,5} } );
const std::vector<std::pair<int,int> > D2_OMEGA_DOT( { {277,24} } );
// D2 NAV, SUBFRAME 1, PAGE 9
const std::vector<std::pair<int,int> > D2_OMEGA0( { {52,1},{61,22},{91,9} } );
const std::vector<std::pair<int,int> > D2_OMEGA_MSB( { {100,13},{121,14} } );
const std::vector<std::pair<int,int> > D2_OMEGA_LSB( { {47,5} } );
const std::vector<std::pair<int,int> > D2_OMEGA( { {269,32} } );
// D2 NAV, SUBFRAME 1, PAGE 10
const std::vector<std::pair<int,int> > D2_IDOT( { {52,1},{61,13} } );
#endif /* GNSS_SDR_BEIDOU_B1I_H_ */

View File

@ -0,0 +1,56 @@
/*!
* \file Beidou_B3I.h
* \brief Defines system parameters for BeiDou B3I signal and DNAV data
* \author Damian Miralles, 2019. dmiralles2009@gmail.com
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_BEIDOU_B3I_H_
#define GNSS_SDR_BEIDOU_B3I_H_
#include <vector>
#include <utility> // std::pair
#include "MATH_CONSTANTS.h"
// carrier and code frequencies
const double BEIDOU_B3I_FREQ_HZ = 1.268520e9; //!< b1I [Hz]
const double BEIDOU_B3I_CODE_RATE_HZ = 10.23e6; //!< beidou b1I code rate [chips/s]
const double BEIDOU_B3I_CODE_LENGTH_CHIPS = 10230.0; //!< beidou b1I code length [chips]
const double BEIDOU_B3I_CODE_PERIOD = 0.001; //!< beidou b1I code period [seconds]
const unsigned int BEIDOU_B3I_CODE_PERIOD_MS = 1; //!< GPS L1 C/A code period [ms]
const int BEIDOU_B3I_SECONDARY_CODE_LENGTH = 20;
const std::string BEIDOU_B3I_SECONDARY_CODE = "00000100110101001110";
const std::string BEIDOU_B3I_SECONDARY_CODE_STR = "00000100110101001110";
const std::string BEIDOU_B3I_D2_SECONDARY_CODE_STR = "00";
const int BEIDOU_B3I_PREAMBLE_LENGTH_BITS = 11;
const int BEIDOU_B3I_PREAMBLE_LENGTH_SYMBOLS = 220; // **************
const double BEIDOU_B3I_PREAMBLE_DURATION_S = 0.220;
const int BEIDOU_B3I_PREAMBLE_DURATION_MS = 220;
const int BEIDOU_B3I_TELEMETRY_RATE_BITS_SECOND = 50; //!< D1 NAV message bit rate [bits/s]
const int BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT = 20; // *************
const int BEIDOU_B3I_TELEMETRY_RATE_SYMBOLS_SECOND = BEIDOU_B3I_TELEMETRY_RATE_BITS_SECOND*BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT; //************!< NAV message bit rate [symbols/s]
#endif /* GNSS_SDR_BEIDOU_B3I_H_ */

View File

@ -0,0 +1,292 @@
/*!
* \file Beidou_B3I.h
* \brief Defines system parameters for BeiDou DNAV data processing
* \author Damian Miralles, 2018. dmiralles2009@gmail.com
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_BEIDOU_DNAV_H_
#define GNSS_SDR_BEIDOU_DNAV_H_
#include <vector>
#include <utility>
#include "MATH_CONSTANTS.h"
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]
const double BEIDOU_DNAV_PI = 3.1415926535898; //!< Pi
const double BEIDOU_DNAV_TWO_PI = 6.283185307179586;//!< 2Pi
const int BEIDOU_DNAV_PREAMBLE_LENGTH_BITS = 11;
const int BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS = 11; // **************
const double BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS = 300;
const double BEIDOU_DNAV_SUBFRAME_SYMBOLS = 300;
const double BEIDOU_DNAV_DATA_BITS = 300;
const double BEIDOU_DNAV_WORDS_SUBFRAME = 10;
const double BEIDOU_DNAV_WORD_LENGTH_BITS = 30;
const double BEIDOU_D1NAV_SYMBOL_RATE_SPS = 50;
const double BEIDOU_D2NAV_SYMBOL_RATE_SPS = 500;
const std::string BEIDOU_DNAV_PREAMBLE = "11100010010";
// BEIDOU D1 NAVIGATION MESSAGE STRUCTURE
// GENERAL
const std::vector<std::pair<int,int> > D1_PRE( { {1,11} } );
const std::vector<std::pair<int,int> > D1_FRAID( { {16,3} } );
const std::vector<std::pair<int,int> > D1_SOW( { {19,8},{31,12} } );
const std::vector<std::pair<int,int> > D1_PNUM( { {44,7} } );
// DNAV SCALE FACTORS
// EPH
const double D1_TOC_LSB = TWO_P3;
const double D1_TGD1_LSB = 0.1e-9;
const double D1_TGD2_LSB = 0.1e-9;
const double D1_ALPHA0_LSB = TWO_N30;
const double D1_ALPHA1_LSB = TWO_N27;
const double D1_ALPHA2_LSB = TWO_N24;
const double D1_ALPHA3_LSB = TWO_N24;
const double D1_BETA0_LSB = TWO_P11;
const double D1_BETA1_LSB = TWO_P14;
const double D1_BETA2_LSB = TWO_P16;
const double D1_BETA3_LSB = TWO_P16;
const double D1_A2_LSB = TWO_N66;
const double D1_A0_LSB = TWO_N33;
const double D1_A1_LSB = TWO_N50;
const double D1_DELTA_N_LSB = PI_TWO_N43;
const double D1_CUC_LSB = TWO_N31;
const double D1_M0_LSB = PI_TWO_N31;
const double D1_E_LSB = TWO_N33;
const double D1_CUS_LSB = TWO_N31;
const double D1_CRC_LSB = TWO_N6;
const double D1_CRS_LSB = TWO_N6;
const double D1_SQRT_A_LSB = TWO_N19;
const double D1_TOE_LSB = TWO_P3;
const double D1_I0_LSB = PI_TWO_N31;
const double D1_CIC_LSB = TWO_N31;
const double D1_OMEGA_DOT_LSB = PI_TWO_N43;
const double D1_CIS_LSB = TWO_N31;
const double D1_IDOT_LSB = PI_TWO_N43;
const double D1_OMEGA0_LSB = PI_TWO_N31;
const double D1_OMEGA_LSB = PI_TWO_N31;
//ALM
const double D1_SQRT_A_ALMANAC_LSB = TWO_N11;
const double D1_A1_ALMANAC_LSB = TWO_N38;
const double D1_A0_ALMANAC_LSB = TWO_N20;
const double D1_OMEGA0_ALMANAC_LSB = PI_TWO_N23;
const double D1_E_ALMANAC_LSB = TWO_N21;
const double D1_DELTA_I_LSB = PI_TWO_N19;
const double D1_TOA_LSB = TWO_P12;
const double D1_OMEGA_DOT_ALMANAC_LSB = PI_TWO_N38;
const double D1_OMEGA_ALMANAC_LSB = PI_TWO_N23;
const double D1_M0_ALMANAC_LSB = PI_TWO_N23;
const double D1_A0GPS_LSB = 0.1e-9;
const double D1_A1GPS_LSB = 0.1e-9;
const double D1_A0GAL_LSB = 0.1e-9;
const double D1_A1GAL_LSB = 0.1e-9;
const double D1_A0GLO_LSB = 0.1e-9;
const double D1_A1GLO_LSB = 0.1e-9;
const double D1_A0UTC_LSB = TWO_N30;
const double D1_A1UTC_LSB = TWO_N50;
// SUBFRAME 1
const std::vector<std::pair<int,int> > D1_SAT_H1( { {43,1} } );
const std::vector<std::pair<int,int> > D1_AODC( { {44,5} } );
const std::vector<std::pair<int,int> > D1_URAI( { {49,4} } );
const std::vector<std::pair<int,int> > D1_WN( { {61,13} } );
const std::vector<std::pair<int,int> > D1_TOC( { {74,9},{91,8} } );
const std::vector<std::pair<int,int> > D1_TGD1( { {99,10} } );
const std::vector<std::pair<int,int> > D1_TGD2( { {121,6} } );
const std::vector<std::pair<int,int> > D1_ALPHA0( { {127,8} } );
const std::vector<std::pair<int,int> > D1_ALPHA1( { {135,8} } );
const std::vector<std::pair<int,int> > D1_ALPHA2( { {151,8} } );
const std::vector<std::pair<int,int> > D1_ALPHA3( { {159,8} } );
const std::vector<std::pair<int,int> > D1_BETA0( { {167,6}, {181,2} } );
const std::vector<std::pair<int,int> > D1_BETA1( { {183,8} } );
const std::vector<std::pair<int,int> > D1_BETA2( { {191,8} } );
const std::vector<std::pair<int,int> > D1_BETA3( { {199,4},{211,4} } );
const std::vector<std::pair<int,int> > D1_A2( { {215,11} } );
const std::vector<std::pair<int,int> > D1_A0( { {226,7},{241,17} } );
const std::vector<std::pair<int,int> > D1_A1( { {258,5},{271,17} } );
const std::vector<std::pair<int,int> > D1_AODE( { {288,5} } );
//SUBFRAME 2
const std::vector<std::pair<int,int> > D1_DELTA_N( { {43,10},{61,6} } );
const std::vector<std::pair<int,int> > D1_CUC( { {67,16},{91,2} } );
const std::vector<std::pair<int,int> > D1_M0( { {93,20}, {121,12} } );
const std::vector<std::pair<int,int> > D1_E( { {133,10},{151,22} } );
const std::vector<std::pair<int,int> > D1_CUS( { {181,18} } );
const std::vector<std::pair<int,int> > D1_CRC( { {199,4},{211,14} } );
const std::vector<std::pair<int,int> > D1_CRS( { {225,8},{241,10} } );
const std::vector<std::pair<int,int> > D1_SQRT_A( { {251,12},{271,20} } );
const std::vector<std::pair<int,int> > D1_TOE_SF2( { {291,2} } );
//SUBFRAME 3
const std::vector<std::pair<int,int> > D1_TOE_SF3( { {43,10},{61,5} } );
const std::vector<std::pair<int,int> > D1_I0( { {66,17},{91,15} } );
const std::vector<std::pair<int,int> > D1_CIC( { {106,7},{121,11} } );
const std::vector<std::pair<int,int> > D1_OMEGA_DOT( { {132,11},{151,13} } );
const std::vector<std::pair<int,int> > D1_CIS( { {164,9},{181,9} } );
const std::vector<std::pair<int,int> > D1_IDOT( { {190,13},{211,1} } );
const std::vector<std::pair<int,int> > D1_OMEGA0( { {212,21},{241,11} } );
const std::vector<std::pair<int,int> > D1_OMEGA( { {252,11},{271,21} } );
//SUBFRAME 4 AND PAGES 1 THROUGH 6 IN SUBFRAME 5
const std::vector<std::pair<int,int> > D1_SQRT_A_ALMANAC( { {51,2},{61,22} } );
const std::vector<std::pair<int,int> > D1_A1_ALMANAC( { {91,11} } );
const std::vector<std::pair<int,int> > D1_A0_ALMANAC( { {102,11} } );
const std::vector<std::pair<int,int> > D1_OMEGA0_ALMANAC( { {121,22},{151,2} } );
const std::vector<std::pair<int,int> > D1_E_ALMANAC( { {153,17} } );
const std::vector<std::pair<int,int> > D1_DELTA_I( { {170,3},{181,13} } );
const std::vector<std::pair<int,int> > D1_TOA( { {194,8} } );
const std::vector<std::pair<int,int> > D1_OMEGA_DOT_ALMANAC( { {202,1}, {211,16} } );
const std::vector<std::pair<int,int> > D1_OMEGA_ALMANAC( { {227,6},{241,18} } );
const std::vector<std::pair<int,int> > D1_M0_ALMANAC( { {259,4},{271,20} } );
//SUBFRAME 5 PAGE 7
const std::vector<std::pair<int,int> > D1_HEA1( { {51,2},{61,7} } );
const std::vector<std::pair<int,int> > D1_HEA2( { {68,9} } );
const std::vector<std::pair<int,int> > D1_HEA3( { {77,6},{91,3} } );
const std::vector<std::pair<int,int> > D1_HEA4( { {94,9} } );
const std::vector<std::pair<int,int> > D1_HEA5( { {103,9} } );
const std::vector<std::pair<int,int> > D1_HEA6( { {112,1},{121,8} } );
const std::vector<std::pair<int,int> > D1_HEA7( { {129,9} } );
const std::vector<std::pair<int,int> > D1_HEA8( { {138,5},{151,4} } );
const std::vector<std::pair<int,int> > D1_HEA9( { {155,9} } );
const std::vector<std::pair<int,int> > D1_HEA10( { {164,9} } );
const std::vector<std::pair<int,int> > D1_HEA11( { {181,9} } );
const std::vector<std::pair<int,int> > D1_HEA12( { {190,9} } );
const std::vector<std::pair<int,int> > D1_HEA13( { {199,4},{211,5} } );
const std::vector<std::pair<int,int> > D1_HEA14( { {216,9} } );
const std::vector<std::pair<int,int> > D1_HEA15( { {225,8},{241,1} } );
const std::vector<std::pair<int,int> > D1_HEA16( { {242,9} } );
const std::vector<std::pair<int,int> > D1_HEA17( { {251,9} } );
const std::vector<std::pair<int,int> > D1_HEA18( { {260,3},{271,6} } );
const std::vector<std::pair<int,int> > D1_HEA19( { {277,9} } );
//SUBFRAME 5 PAGE 8
const std::vector<std::pair<int,int> > D1_HEA20( { {51,2},{61,7} } );
const std::vector<std::pair<int,int> > D1_HEA21( { {68,9} } );
const std::vector<std::pair<int,int> > D1_HEA22( { {77,6},{91,3} } );
const std::vector<std::pair<int,int> > D1_HEA23( { {94,9} } );
const std::vector<std::pair<int,int> > D1_HEA24( { {103,9} } );
const std::vector<std::pair<int,int> > D1_HEA25( { {112,1},{121,8} } );
const std::vector<std::pair<int,int> > D1_HEA26( { {129,9} } );
const std::vector<std::pair<int,int> > D1_HEA27( { {138,5},{151,4} } );
const std::vector<std::pair<int,int> > D1_HEA28( { {155,9} } );
const std::vector<std::pair<int,int> > D1_HEA29( { {164,9} } );
const std::vector<std::pair<int,int> > D1_HEA30( { {181,9} } );
const std::vector<std::pair<int,int> > D1_WNA( { {190,8} } );
const std::vector<std::pair<int,int> > D1_TOA2( { {198,5},{211,3} } );
//SUBFRAME 5 PAGE 9
const std::vector<std::pair<int,int> > D1_A0GPS( { {97,14} } );
const std::vector<std::pair<int,int> > D1_A1GPS( { {111,2},{121,14} } );
const std::vector<std::pair<int,int> > D1_A0GAL( { {135,8},{151,6} } );
const std::vector<std::pair<int,int> > D1_A1GAL( { {157,16} } );
const std::vector<std::pair<int,int> > D1_A0GLO( { {181,14} } );
const std::vector<std::pair<int,int> > D1_A1GLO( { {195,8},{211,8} } );
//SUBFRAME 5 PAGE 10
const std::vector<std::pair<int,int> > D1_DELTA_T_LS( { {51,2},{61,6} } );
const std::vector<std::pair<int,int> > D1_DELTA_T_LSF( { {67,8} } );
const std::vector<std::pair<int,int> > D1_WN_LSF( { {75,8} } );
const std::vector<std::pair<int,int> > D1_A0UTC( { {91,22},{121,10} } );
const std::vector<std::pair<int,int> > D1_A1UTC( { {131,12},{151,12} } );
const std::vector<std::pair<int,int> > D1_DN( { {163,8} } );
// D2 NAV Message Decoding Information
const std::vector<std::pair<int,int> > D2_PRE( { {1,11} } );
const std::vector<std::pair<int,int> > D2_FRAID( { {16,3} } );
const std::vector<std::pair<int,int> > D2_SOW( { {19,8},{31,12} } );
const std::vector<std::pair<int,int> > D2_PNUM( { {43,4} } );
// D2 NAV, SUBFRAME 1, PAGE 1
const std::vector<std::pair<int,int> > D2_SAT_H1( { {47,1} } );
const std::vector<std::pair<int,int> > D2_AODC( { {48,5} } );
const std::vector<std::pair<int,int> > D2_URAI( { {61,4} } );
const std::vector<std::pair<int,int> > D2_WN( { {65,13} } );
const std::vector<std::pair<int,int> > D2_TOC( { {78,5},{91,12} } );
const std::vector<std::pair<int,int> > D2_TGD1( { {103,10} } );
const std::vector<std::pair<int,int> > D2_TGD2( { {121,10} } );
// D2 NAV, SUBFRAME 1, PAGE 2
const std::vector<std::pair<int,int> > D2_ALPHA0( { {47,6}, {61,2} } );
const std::vector<std::pair<int,int> > D2_ALPHA1( { {63,8} } );
const std::vector<std::pair<int,int> > D2_ALPHA2( { {71,8} } );
const std::vector<std::pair<int,int> > D2_ALPHA3( { {79,4}, {91,4} } );
const std::vector<std::pair<int,int> > D2_BETA0( { {95,8} } );
const std::vector<std::pair<int,int> > D2_BETA1( { {103,8} } );
const std::vector<std::pair<int,int> > D2_BETA2( { {111,2}, {121,6} } );
const std::vector<std::pair<int,int> > D2_BETA3( { {127,8} } );
// D2 NAV, SUBFRAME 1, PAGE 3
const std::vector<std::pair<int,int> > D2_A0( { {101,12},{121,12} } );
const std::vector<std::pair<int,int> > D2_A1_MSB( { {133,4} } );
const std::vector<std::pair<int,int> > D2_A1_LSB( { {47,6}, {61, 12} } );
const std::vector<std::pair<int,int> > D2_A1( { {279,22} } );
// D2 NAV, SUBFRAME 1, PAGE 4
const std::vector<std::pair<int,int> > D2_A2( { {73,10}, {91,1} } );
const std::vector<std::pair<int,int> > D2_AODE( { {92,5} } );
const std::vector<std::pair<int,int> > D2_DELTA_N( { {97,16} } );
const std::vector<std::pair<int,int> > D2_CUC_MSB( { {121,14} } );
const std::vector<std::pair<int,int> > D2_CUC_LSB( { {47,4} } );
const std::vector<std::pair<int,int> > D2_CUC( { {283,18} } );
// D2 NAV, SUBFRAME 1, PAGE 5
const std::vector<std::pair<int,int> > D2_M0( { {51,2}, {61,22}, {91,8} } );
const std::vector<std::pair<int,int> > D2_CUS( { {99,14}, {121, 4} } );
const std::vector<std::pair<int,int> > D2_E_MSB( { {125,10} } );
// D2 NAV, SUBFRAME 1, PAGE 6
const std::vector<std::pair<int,int> > D2_E_LSB( { {47,6}, {61, 16} } );
const std::vector<std::pair<int,int> > D2_SQRT_A( { {77,6},{91,22}, {121,4} } );
const std::vector<std::pair<int,int> > D2_CIC_MSB( { {125,10} } );
const std::vector<std::pair<int,int> > D2_CIC_LSB( { {47,6}, {61,2} } );
const std::vector<std::pair<int,int> > D2_CIC( { {283,18} } );
// D2 NAV, SUBFRAME 1, PAGE 7
const std::vector<std::pair<int,int> > D2_CIS( { {63,18} } );
const std::vector<std::pair<int,int> > D2_TOE( { {81,2},{91,15} } );
const std::vector<std::pair<int,int> > D2_I0_MSB( { {106,7},{121,14} } );
const std::vector<std::pair<int,int> > D2_I0_LSB( { {47,6},{61,5} } );
const std::vector<std::pair<int,int> > D2_I0( { {269,32} } );
// D2 NAV, SUBFRAME 1, PAGE 8
const std::vector<std::pair<int,int> > D2_CRC( { {66,17},{91,1} } );
const std::vector<std::pair<int,int> > D2_CRS( { {92,18} } );
const std::vector<std::pair<int,int> > D2_OMEGA_DOT_MSB( { {110,3},{121,16} } );
const std::vector<std::pair<int,int> > D2_OMEGA_DOT_LSB( { {47,5} } );
const std::vector<std::pair<int,int> > D2_OMEGA_DOT( { {277,24} } );
// D2 NAV, SUBFRAME 1, PAGE 9
const std::vector<std::pair<int,int> > D2_OMEGA0( { {52,1},{61,22},{91,9} } );
const std::vector<std::pair<int,int> > D2_OMEGA_MSB( { {100,13},{121,14} } );
const std::vector<std::pair<int,int> > D2_OMEGA_LSB( { {47,5} } );
const std::vector<std::pair<int,int> > D2_OMEGA( { {269,32} } );
// D2 NAV, SUBFRAME 1, PAGE 10
const std::vector<std::pair<int,int> > D2_IDOT( { {52,1},{61,13} } );
#endif /* GNSS_SDR_BEIDOU_DNAV_H_ */

View File

@ -97,6 +97,8 @@ set(SYSTEM_PARAMETERS_HEADERS
GPS_L2C.h
GPS_L5.h
Beidou_B1I.h
Beidou_B3I.h
Beidou_DNAV.h
MATH_CONSTANTS.h
)

View File

@ -146,6 +146,7 @@ void Beidou_Dnav_Navigation_Message::reset()
// info
i_channel_ID = 0;
i_satellite_PRN = 0;
i_signal_type = 0;
// time synchro
d_subframe_timestamp_ms = 0;
@ -985,7 +986,7 @@ Beidou_Dnav_Ephemeris Beidou_Dnav_Navigation_Message::get_ephemeris()
eph.i_SV_accuracy = i_SV_accuracy;
eph.i_SV_health = i_SV_health;
eph.i_BEIDOU_week = i_BEIDOU_week;
eph.i_sig_type = 1;
eph.i_sig_type = i_signal_type;
eph.i_nav_type = 2;
eph.d_TOW = d_SOW;
@ -1034,7 +1035,7 @@ Beidou_Dnav_Ephemeris Beidou_Dnav_Navigation_Message::get_ephemeris()
eph.i_SV_accuracy = i_SV_accuracy;
eph.i_SV_health = i_SV_health;
eph.i_BEIDOU_week = i_BEIDOU_week;
eph.i_sig_type = 1;
eph.i_sig_type = i_signal_type;
eph.i_nav_type = 1; // MEO/IGSO
eph.d_TOW = d_SOW;

View File

@ -44,6 +44,8 @@
#include "beidou_dnav_iono.h"
#include "beidou_dnav_utc_model.h"
#include "Beidou_B1I.h"
#include "Beidou_B3I.h"
#include "Beidou_DNAV.h"
@ -203,6 +205,7 @@ public:
// satellite identification info
int i_channel_ID;
unsigned int i_signal_type; //!< BDS: data source (0:unknown,1:B1I,2:B1Q,3:B2I,4:B2Q,5:B3I,6:B3Q)
unsigned int i_satellite_PRN;
// time synchro

View File

@ -226,7 +226,7 @@ void Gnss_Satellite::set_PRN(uint32_t PRN_)
}
else if (system == "Beidou")
{
if (PRN_ < 1 or PRN_ > 37)
if (PRN_ < 1 or PRN_ > 63)
{
DLOG(INFO) << "This PRN is not defined";
PRN = 0;
@ -616,11 +616,47 @@ std::string Gnss_Satellite::what_block(const std::string& system_, uint32_t PRN_
block_ = std::string("Unknown(Simulated)");
}
}
if (system_.compare("Beidou") == 0)
if (system_ == "Beidou")
{
// Check https://en.wikipedia.org/wiki/List_of_BeiDou_satellites
switch ( PRN_ )
{
case 1:
block_ = std::string("Compass-G1"); //!<GEO 140.0°E; launched 2010/01/16
break;
case 2:
block_ = std::string("Compass-G6"); //!<GEO 80°E; launched 2012/10/25
break;
case 3:
block_ = std::string("Compass-G7"); //!<GEO 110.5°E; launched 2016/06/12
break;
case 4:
block_ = std::string("Compass-G4"); //!<GEO 160.0°E; launched 2010/10/31
break;
case 5:
block_ = std::string("Compass-G5"); //!<GEO 58.75°E; launched 2012/02/24
break;
case 6:
block_ = std::string("Compass-IGS01"); //!<55° inclination IGSO 118°E; launched 2010/07/31
break;
case 7:
block_ = std::string("Compass-IGS02"); //!<55° inclination IGSO 118°E; launched 2010/12/17
break;
case 8:
block_ = std::string("Compass-IGS03"); //!<55° inclination IGSO 118°E; launched 2011/04/09
break;
case 9:
block_ = std::string("Compass-IGS04"); //!<55° inclination IGSO 95°E; launched 2011/07/27
break;
case 10:
block_ = std::string("Compass-IGS05"); //!<55° inclination IGSO 118°E; launched 2011/12/01
break;
case 11:
block_ = std::string("Compass-M3"); //!<Slot A07; launched 2012/04/29
break;
case 12:
block_ = std::string("Compass-M4"); //!<Slot A08; launched 2012/04/29
break;
case 19:
block_ = std::string("BEIDOU-3 M1"); //!<Slot B-7; launched 2017/11/05
break;
@ -663,6 +699,18 @@ std::string Gnss_Satellite::what_block(const std::string& system_, uint32_t PRN_
case 33:
block_ = std::string("BEIDOU 3M14"); //!<Slot B-3; launched 2018/09/19
break;
case 34:
block_ = std::string("BEIDOU 3M15"); //!<Slot B-3; launched 2018/10/15
break;
case 35:
block_ = std::string("BEIDOU 3M16"); //!<Slot B-3; launched 2018/10/15
break;
case 36:
block_ = std::string("BEIDOU 3M17"); //!<Slot B-3; launched 2018/11/18
break;
case 37:
block_ = std::string("BEIDOU 3M18"); //!<Slot B-3; launched 2018/11/18
break;
default:
block_ = std::string("Unknown(Simulated)");
}