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

Merge branch 'next' of https://github.com/mmajoral/gnss-sdr into fpga_extended_coherent_integration

This commit is contained in:
Marc Majoral 2019-07-18 11:35:34 +02:00
commit dd996bc2e2
115 changed files with 2278 additions and 2030 deletions

View File

@ -403,7 +403,7 @@ set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master")
set(GNSSSDR_GPSTK_LOCAL_VERSION "2.10.6") set(GNSSSDR_GPSTK_LOCAL_VERSION "2.10.6")
set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.16") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.16")
set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.9") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.9")
set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "3.8.0") set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "3.9.0")
if(CMAKE_VERSION VERSION_LESS "3.0.2") # Fix for CentOS 7 if(CMAKE_VERSION VERSION_LESS "3.0.2") # Fix for CentOS 7
set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.1") set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.1")

View File

@ -1,274 +0,0 @@
; This is a GNSS-SDR configuration file
; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/
; You can define your own receiver and invoke it by doing
; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf
;
[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
Receiver.sources_count=2
;######### CONTROL_THREAD CONFIG ############
ControlThread.wait_for_flowgraph=false
;######### SIGNAL_SOURCE CONFIG ############
;# Signal Source config for GPS, Galileo signals
SignalSource0.implementation=File_Signal_Source
SignalSource0.filename=/home/dmiralles/Documents/GNSS-Metadata-Standard/install/GPSL1-GalileoE1.dat
SignalSource0.item_type=byte
SignalSource0.sampling_frequency=25000000
SignalSource0.samples=0
SignalSource0.repeat=false
SignalSource0.dump=false
SignalSource0.enable_throttle_control=false
;# Signal Source config for BDS signals
SignalSource1.implementation=File_Signal_Source
SignalSource1.filename=/home/dmiralles/Documents/GNSS-Metadata-Standard/install/BdsB1IStr01.dat
SignalSource1.item_type=byte
SignalSource1.sampling_frequency=25000000
SignalSource1.samples=0
SignalSource1.repeat=false
SignalSource1.dump=false
SignalSource1.enable_throttle_control=false
;######### SIGNAL_CONDITIONER CONFIG ############
;# Signal Conditioner config for GPS, Galileo signals
SignalConditioner0.implementation=Signal_Conditioner
DataTypeAdapter0.implementation=Byte_To_Short
InputFilter0.implementation=Freq_Xlating_Fir_Filter
InputFilter0.input_item_type=short
InputFilter0.output_item_type=gr_complex
InputFilter0.taps_item_type=float
InputFilter0.number_of_taps=5
InputFilter0.number_of_bands=2
InputFilter0.band1_begin=0.0
InputFilter0.band1_end=0.70
InputFilter0.band2_begin=0.80
InputFilter0.band2_end=1.0
InputFilter0.ampl1_begin=1.0
InputFilter0.ampl1_end=1.0
InputFilter0.ampl2_begin=0.0
InputFilter0.ampl2_end=0.0
InputFilter0.band1_error=1.0
InputFilter0.band2_error=1.0
InputFilter0.filter_type=bandpass
InputFilter0.grid_density=16
InputFilter0.sampling_frequency=25000000
InputFilter0.IF=6250000
Resampler0.implementation=Pass_Through
Resampler0.sample_freq_in=25000000
Resampler0.sample_freq_out=25000000
Resampler0.item_type=gr_complex
;# Signal Conditioner config for BDS signals
SignalConditioner1.implementation=Signal_Conditioner
DataTypeAdapter1.implementation=Byte_To_Short
InputFilter1.implementation=Freq_Xlating_Fir_Filter
InputFilter1.input_item_type=short
InputFilter1.output_item_type=gr_complex
InputFilter1.taps_item_type=float
InputFilter1.number_of_taps=5
InputFilter1.number_of_bands=2
InputFilter1.band1_begin=0.0
InputFilter1.band1_end=0.70
InputFilter1.band2_begin=0.80
InputFilter1.band2_end=1.0
InputFilter1.ampl1_begin=1.0
InputFilter1.ampl1_end=1.0
InputFilter1.ampl2_begin=0.0
InputFilter1.ampl2_end=0.0
InputFilter1.band1_error=1.0
InputFilter1.band2_error=1.0
InputFilter1.filter_type=bandpass
InputFilter1.grid_density=16
InputFilter1.sampling_frequency=25000000
InputFilter1.IF=6250000
Resampler1.implementation=Pass_Through
Resampler1.sample_freq_in=25000000
Resampler1.sample_freq_out=25000000
Resampler1.item_type=gr_complex
;######### CHANNELS GLOBAL CONFIG ############
Channels_1C.count=7
Channels_1B.count=7
Channels_B1.count=10
Channels.in_acquisition=10
;# Preparing collection for GPS satellites
Channel0.RF_channel_ID=0
Channel1.RF_channel_ID=0
Channel2.RF_channel_ID=0
Channel3.RF_channel_ID=0
Channel4.RF_channel_ID=0
Channel5.RF_channel_ID=0
Channel6.RF_channel_ID=0
Channel0.signal=1C
Channel0.satellite = 2
Channel1.signal=1C
Channel1.satellite = 5
Channel2.signal=1C
Channel2.satellite = 6
Channel3.signal=1C
Channel3.satellite = 7
Channel4.signal=1C
Channel4.satellite = 13
Channel5.signal=1C
Channel5.satellite = 19
Channel6.signal=1C
Channel6.satellite = 29
;# Preparing collection for Galileo satellites
Channel7.RF_channel_ID=0
Channel8.RF_channel_ID=0
Channel9.RF_channel_ID=0
Channel10.RF_channel_ID=0
Channel11.RF_channel_ID=0
Channel12.RF_channel_ID=0
Channel13.RF_channel_ID=0
Channel7.signal=1B
Channel7.satellite = 2
Channel8.signal=1B
Channel8.satellite = 5
Channel9.signal=1B
Channel9.satellite = 6
Channel10.signal=1B
Channel10.satellite = 7
Channel11.signal=1B
Channel11.satellite = 13
Channel12.signal=1B
Channel12.satellite = 19
Channel13.signal=1B
Channel13.satellite = 29
;# Preparing collection for BDS satellites
Channel14.RF_channel_ID=1
Channel15.RF_channel_ID=1
Channel16.RF_channel_ID=1
Channel17.RF_channel_ID=1
Channel18.RF_channel_ID=1
Channel19.RF_channel_ID=1
Channel20.RF_channel_ID=1
Channel21.RF_channel_ID=1
Channel22.RF_channel_ID=1
Channel23.RF_channel_ID=1
Channel14.signal=B1
Channel14.satellite = 6
Channel15.signal=B1
Channel15.satellite = 8
Channel16.signal=B1
Channel16.satellite = 9
Channel17.signal=B1
Channel17.satellite = 13
Channel18.signal=B1
Channel18.satellite = 17
Channel19.signal=B1
Channel19.satellite = 1
Channel20.signal=B1
Channel20.satellite = 2
Channel21.signal=B1
Channel21.satellite = 3
Channel22.signal=B1
Channel22.satellite = 4
Channel23.signal=B1
Channel23.satellite = 5
;######### ACQUISITION GLOBAL CONFIG ############
;# Acquisition config for BDS signals
Acquisition_B1.implementation=BEIDOU_B1I_PCPS_Acquisition
Acquisition_B1.item_type=gr_complex
Acquisition_B1.coherent_integration_time_ms=1
Acquisition_B1.threshold=0.0038
Acquisition_B1.doppler_max=15000
Acquisition_B1.doppler_step=100
Acquisition_B1.dump=true
Acquisition_B1.dump_filename=/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/bds_b1i_acq
Acquisition_B1.blocking=false;
Acquisition_B1.use_CFAR_algorithm=true;
Acquisition_B1.bit_transition_flag = false;
;# Acquisition config for GPS signals
Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition
Acquisition_1C.item_type=gr_complex
Acquisition_1C.coherent_integration_time_ms=1
Acquisition_1C.threshold=0.0038
Acquisition_1C.doppler_max=15000
Acquisition_1C.doppler_step=100
Acquisition_1C.dump=true
Acquisition_1C.dump_filename=/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/gps_l1ca_acq
Acquisition_1C.blocking=false;
Acquisition_1C.use_CFAR_algorithm=true;
Acquisition_1C.bit_transition_flag = false;
;# Acquisition config for Galileo signals
Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition
Acquisition_1B.item_type=gr_complex
Acquisition_1B.coherent_integration_time_ms=4
Acquisition_1B.threshold=0.0038
Acquisition_1B.doppler_max=15000
Acquisition_1B.doppler_step=100
Acquisition_1B.dump=true
Acquisition_1B.dump_filename=/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/gal_e1b_acq
Acquisition_1B.blocking=false;
Acquisition_1B.use_CFAR_algorithm=true;
Acquisition_1B.bit_transition_flag = false;
;######### TRACKING GLOBAL CONFIG ############
Tracking_B1.implementation=BEIDOU_B1I_DLL_PLL_Tracking
Tracking_B1.item_type=gr_complex
Tracking_B1.pll_bw_hz=25.0;
Tracking_B1.dll_bw_hz=2.50;
Tracking_B1.dump=true;
Tracking_B1.dump_filename=/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/bds_b1i_trk_ch_
Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking
Tracking_1C.item_type=gr_complex
Tracking_1C.pll_bw_hz=25.0;
Tracking_1C.dll_bw_hz=2.50;
Tracking_1C.dump=true;
Tracking_1C.dump_filename=/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/gps_l1ca_trk_ch_
Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking
Tracking_1B.item_type=gr_complex
Tracking_1B.pll_bw_hz=25.0;
Tracking_1B.dll_bw_hz=2.50;
Tracking_1B.dump=true;
Tracking_1B.dump_filename=/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/gal_e1b_trk_ch_
;######### TELEMETRY DECODER GPS CONFIG ############
TelemetryDecoder_B1.implementation=BEIDOU_B1I_Telemetry_Decoder
TelemetryDecoder_B1.dump=false
TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder
TelemetryDecoder_1C.dump=false
TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder
TelemetryDecoder_1B.dump=false
;######### OBSERVABLES CONFIG ############
Observables.implementation=Hybrid_Observables
Observables.dump=true
Observables.dump_filename=./observables.dat
;######### PVT CONFIG ############
PVT.implementation=RTKLIB_PVT
PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic
PVT.iono_model=OFF ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX
PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad
PVT.output_rate_ms=100
PVT.display_rate_ms=500
PVT.dump=true
PVT.dump_filename = /home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/pvt_l1
PVT.kml_output_enabled = false;
PVT.xml_output_enabled = false;
PVT.gpx_output_enabled = false;
PVT.rinex_output_enabled = false;
PVT.rtcm_output_enabled = false;
PVT.nmea_output_enabled = false;
PVT.geojson_output_enabled = false;

View File

@ -1,265 +0,0 @@
; This is a GNSS-SDR configuration file
; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/
; You can define your own receiver and invoke it by doing
; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf
;
[GNSS-SDR]
;######### GLOBAL OPTIONS ##################
;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second].
GNSS-SDR.internal_fs_sps=10000000
Receiver.sources_count=2
;######### CONTROL_THREAD CONFIG ############
ControlThread.wait_for_flowgraph=false
;######### SIGNAL_SOURCE CONFIG ############
;# Signal Source config for GPS, Galileo signals
SignalSource0.implementation=File_Signal_Source
SignalSource0.filename=/archive/BDS3_datasets/long/20180713_211400_3.dat
SignalSource0.item_type=ibyte
SignalSource0.sampling_frequency=10000000
SignalSource0.samples=0
SignalSource0.repeat=false
SignalSource0.dump=false
SignalSource0.enable_throttle_control=false
;# Signal Source config for BDS signals
SignalSource1.implementation=File_Signal_Source
SignalSource1.filename=/archive/BDS3_datasets/long/20180713_211400_1.dat
SignalSource1.item_type=ibyte
SignalSource1.sampling_frequency=10000000
SignalSource1.samples=0
SignalSource1.repeat=false
SignalSource1.dump=false
SignalSource1.enable_throttle_control=false
;######### SIGNAL_CONDITIONER CONFIG ############
;# Signal Conditioner config for GPS, Galileo signals
SignalConditioner0.implementation=Signal_Conditioner
DataTypeAdapter0.implementation=Ibyte_To_Complex
InputFilter0.implementation=Freq_Xlating_Fir_Filter
InputFilter0.input_item_type=gr_complex
InputFilter0.output_item_type=gr_complex
InputFilter0.taps_item_type=float
InputFilter0.number_of_taps=5
InputFilter0.number_of_bands=2
InputFilter0.band1_begin=0.0
InputFilter0.band1_end=0.70
InputFilter0.band2_begin=0.80
InputFilter0.band2_end=1.0
InputFilter0.ampl1_begin=1.0
InputFilter0.ampl1_end=1.0
InputFilter0.ampl2_begin=0.0
InputFilter0.ampl2_end=0.0
InputFilter0.band1_error=1.0
InputFilter0.band2_error=1.0
InputFilter0.filter_type=bandpass
InputFilter0.grid_density=16
InputFilter0.sampling_frequency=10000000
InputFilter0.IF=420000
Resampler0.implementation=Pass_Through
Resampler0.sample_freq_in=10000000
Resampler0.sample_freq_out=10000000
Resampler0.item_type=gr_complex
;# Signal Conditioner config for BDS signals
SignalConditioner1.implementation=Signal_Conditioner
DataTypeAdapter1.implementation=Ibyte_To_Complex
InputFilter1.implementation=Freq_Xlating_Fir_Filter
InputFilter1.input_item_type=gr_complex
InputFilter1.output_item_type=gr_complex
InputFilter1.taps_item_type=float
InputFilter1.number_of_taps=5
InputFilter1.number_of_bands=2
InputFilter1.band1_begin=0.0
InputFilter1.band1_end=0.70
InputFilter1.band2_begin=0.80
InputFilter1.band2_end=1.0
InputFilter1.ampl1_begin=1.0
InputFilter1.ampl1_end=1.0
InputFilter1.ampl2_begin=0.0
InputFilter1.ampl2_end=0.0
InputFilter1.band1_error=1.0
InputFilter1.band2_error=1.0
InputFilter1.filter_type=bandpass
InputFilter1.grid_density=16
InputFilter1.sampling_frequency=10000000
InputFilter1.IF=1098000
Resampler1.implementation=Pass_Through
Resampler1.sample_freq_in=10000000
Resampler1.sample_freq_out=10000000
Resampler1.item_type=gr_complex
;######### CHANNELS GLOBAL CONFIG ############
Channels_1C.count=7
Channels_1B.count=7
Channels_B1.count=4
Channels.in_acquisition=18
;# Preparing collection for GPS satellites
Channel0.RF_channel_ID=0
Channel1.RF_channel_ID=0
Channel2.RF_channel_ID=0
Channel3.RF_channel_ID=0
Channel4.RF_channel_ID=0
Channel5.RF_channel_ID=0
Channel6.RF_channel_ID=0
Channel0.signal=1C
Channel0.satellite = 2
Channel1.signal=1C
Channel1.satellite = 5
Channel2.signal=1C
Channel2.satellite = 25
Channel3.signal=1C
Channel3.satellite = 31
Channel4.signal=1C
Channel4.satellite = 24
Channel5.signal=1C
Channel5.satellite = 6
Channel6.signal=1C
Channel6.satellite = 29
;# Preparing collection for Galileo satellites
Channel7.RF_channel_ID=0
Channel8.RF_channel_ID=0
Channel9.RF_channel_ID=0
Channel10.RF_channel_ID=0
Channel11.RF_channel_ID=0
Channel12.RF_channel_ID=0
Channel13.RF_channel_ID=0
Channel7.signal=1B
Channel7.satellite = 30
Channel8.signal=1B
Channel8.satellite = 21
Channel9.signal=1B
Channel9.satellite = 5
Channel10.signal=1B
Channel10.satellite = 3
Channel11.signal=1B
Channel11.satellite = 27
Channel12.signal=1B
Channel12.satellite = 9
Channel13.signal=1B
Channel13.satellite = 10
;# Preparing collection for BDS satellites
Channel14.RF_channel_ID=1
Channel15.RF_channel_ID=1
Channel16.RF_channel_ID=1
Channel17.RF_channel_ID=1
Channel18.RF_channel_ID=1
Channel19.RF_channel_ID=1
Channel20.RF_channel_ID=1
Channel21.RF_channel_ID=1
Channel22.RF_channel_ID=1
Channel23.RF_channel_ID=1
Channel14.signal=B1
Channel14.satellite = 29
Channel15.signal=B1
Channel15.satellite = 19
Channel16.signal=B1
Channel16.satellite = 20
Channel17.signal=B1
Channel17.satellite = 30
;######### ACQUISITION GLOBAL CONFIG ############
;# Acquisition config for BDS signals
Acquisition_B1.implementation=BEIDOU_B1I_PCPS_Acquisition
Acquisition_B1.item_type=gr_complex
Acquisition_B1.coherent_integration_time_ms=1
Acquisition_B1.threshold=0.0005
Acquisition_B1.doppler_max=15000
Acquisition_B1.doppler_step=100
Acquisition_B1.dump=false
Acquisition_B1.dump_filename=/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/bds_b1i_acq
Acquisition_B1.blocking=false;
Acquisition_B1.use_CFAR_algorithm=true;
Acquisition_B1.bit_transition_flag = false;
;# Acquisition config for GPS signals
Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition
Acquisition_1C.item_type=gr_complex
Acquisition_1C.coherent_integration_time_ms=1
Acquisition_1C.threshold=0.0005
Acquisition_1C.doppler_max=15000
Acquisition_1C.doppler_step=100
Acquisition_1C.dump=true
Acquisition_1C.dump_filename=/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/gps_l1ca_acq
Acquisition_1C.blocking=false;
Acquisition_1C.use_CFAR_algorithm=true;
Acquisition_1C.bit_transition_flag = false;
;# Acquisition config for Galileo signals
Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition
Acquisition_1B.item_type=gr_complex
Acquisition_1B.coherent_integration_time_ms=4
Acquisition_1B.threshold=0.0015
Acquisition_1B.doppler_max=15000
Acquisition_1B.doppler_step=100
Acquisition_1B.dump=true
Acquisition_1B.dump_filename=/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/gal_e1b_acq
Acquisition_1B.blocking=false;
Acquisition_1B.use_CFAR_algorithm=true;
Acquisition_1B.bit_transition_flag = false;
;######### TRACKING GLOBAL CONFIG ############
Tracking_B1.implementation=BEIDOU_B1I_DLL_PLL_Tracking
Tracking_B1.item_type=gr_complex
Tracking_B1.pll_bw_hz=25.0;
Tracking_B1.dll_bw_hz=2.50;
Tracking_B1.dump=true;
Tracking_B1.dump_filename=/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/bds_b1i_trk_ch_
Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking
Tracking_1C.item_type=gr_complex
Tracking_1C.pll_bw_hz=25.0;
Tracking_1C.dll_bw_hz=2.50;
Tracking_1C.dump=true;
Tracking_1C.dump_filename=/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/gps_l1ca_trk_ch_
Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking
Tracking_1B.item_type=gr_complex
Tracking_1B.pll_bw_hz=25.0;
Tracking_1B.dll_bw_hz=2.50;
Tracking_1B.dump=true;
Tracking_1B.dump_filename=/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/gal_e1b_trk_ch_
;######### TELEMETRY DECODER GPS CONFIG ############
TelemetryDecoder_B1.implementation=BEIDOU_B1I_Telemetry_Decoder
TelemetryDecoder_B1.dump=true
TelemetryDecoder_B1.dump_filename = ./bds_tel_dec
TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder
TelemetryDecoder_1C.dump=true
TelemetryDecoder_1C.dump_filename=./gps_tel_dec
TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder
TelemetryDecoder_1B.dump=false
;######### OBSERVABLES CONFIG ############
Observables.implementation=Hybrid_Observables
Observables.dump=true
Observables.dump_filename=./observables.dat
;######### PVT CONFIG ############
PVT.implementation=RTKLIB_PVT
PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic
PVT.iono_model=OFF ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX
PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad
PVT.output_rate_ms=100
PVT.display_rate_ms=500
PVT.dump=true
PVT.dump_filename = /home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/pvt_l1
PVT.kml_output_enabled = false;
PVT.xml_output_enabled = false;
PVT.gpx_output_enabled = false;
PVT.rinex_output_enabled = false;
PVT.rtcm_output_enabled = false;
PVT.nmea_output_enabled = false;
PVT.geojson_output_enabled = false;

View File

@ -16,7 +16,7 @@ ControlThread.wait_for_flowgraph=false
;######### SIGNAL_SOURCE CONFIG ############ ;######### SIGNAL_SOURCE CONFIG ############
SignalSource.implementation=File_Signal_Source SignalSource.implementation=File_Signal_Source
SignalSource.filename=/home/dmiralles/Documents/gnss-metadata-standard/install/BdsB1IStr01.dat SignalSource.filename=/archive/BDS3_datasets/BdsB1IStr01.dat
SignalSource.item_type=byte SignalSource.item_type=byte
SignalSource.sampling_frequency=25000000 SignalSource.sampling_frequency=25000000
SignalSource.samples=0 SignalSource.samples=0
@ -91,25 +91,25 @@ Tracking_B1.implementation=BEIDOU_B1I_DLL_PLL_Tracking
Tracking_B1.item_type=gr_complex Tracking_B1.item_type=gr_complex
Tracking_B1.pll_bw_hz=25.0; Tracking_B1.pll_bw_hz=25.0;
Tracking_B1.dll_bw_hz=2.50; Tracking_B1.dll_bw_hz=2.50;
Tracking_B1.dump=true; Tracking_B1.dump=false;
Tracking_B1.dump_filename=./epl_tracking_ch_ Tracking_B1.dump_filename=./epl_tracking_ch_
;######### TELEMETRY DECODER GPS CONFIG ############ ;######### TELEMETRY DECODER GPS CONFIG ############
TelemetryDecoder_B1.implementation=BEIDOU_B1I_Telemetry_Decoder TelemetryDecoder_B1.implementation=BEIDOU_B1I_Telemetry_Decoder
TelemetryDecoder_B1.dump=true TelemetryDecoder_B1.dump=false
;######### OBSERVABLES CONFIG ############ ;######### OBSERVABLES CONFIG ############
Observables.implementation=Hybrid_Observables Observables.implementation=Hybrid_Observables
Observables.dump=true Observables.dump=false
Observables.dump_filename=./observables.dat Observables.dump_filename=./observables.dat
;######### PVT CONFIG ############ ;######### PVT CONFIG ############
PVT.implementation=RTKLIB_PVT PVT.implementation=RTKLIB_PVT
PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic
PVT.iono_model=OFF ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX
PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad
PVT.output_rate_ms=100 PVT.output_rate_ms=100
PVT.display_rate_ms=500 PVT.display_rate_ms=500
@ -121,3 +121,6 @@ PVT.flag_rtcm_server=false
PVT.flag_rtcm_tty_port=false PVT.flag_rtcm_tty_port=false
PVT.rtcm_dump_devname=/dev/pts/1 PVT.rtcm_dump_devname=/dev/pts/1
PVT.dump=true PVT.dump=true
PVT.rinex_version=3
PVT.rinex_output_enabled=true
PVT.gpx_output_enabled=true

View File

@ -1,127 +0,0 @@
; This is a GNSS-SDR configuration file
; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/
; You can define your own receiver and invoke it by doing
; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf
;
[GNSS-SDR]
;######### GLOBAL OPTIONS ##################
;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second].
GNSS-SDR.internal_fs_sps=10000000
;######### CONTROL_THREAD CONFIG ############
ControlThread.wait_for_flowgraph=false
;######### SIGNAL_SOURCE CONFIG ############
SignalSource.implementation=File_Signal_Source
SignalSource.filename=/archive/BDS3_datasets/long/20180713_211400_1.dat
SignalSource.item_type=ibyte
SignalSource.sampling_frequency=10000000
SignalSource.samples=0
SignalSource.repeat=false
SignalSource.dump=false
SignalSource.enable_throttle_control=false
;######### SIGNAL_CONDITIONER CONFIG ############
SignalConditioner.implementation=Signal_Conditioner
DataTypeAdapter.implementation=Ibyte_To_Complex
InputFilter.implementation=Freq_Xlating_Fir_Filter
InputFilter.input_item_type=gr_complex
InputFilter.output_item_type=gr_complex
InputFilter.taps_item_type=float
InputFilter.number_of_taps=5
InputFilter.number_of_bands=2
InputFilter.band1_begin=0.0
InputFilter.band1_end=0.70
InputFilter.band2_begin=0.80
InputFilter.band2_end=1.0
InputFilter.ampl1_begin=1.0
InputFilter.ampl1_end=1.0
InputFilter.ampl2_begin=0.0
InputFilter.ampl2_end=0.0
InputFilter.band1_error=1.0
InputFilter.band2_error=1.0
InputFilter.filter_type=bandpass
InputFilter.grid_density=16
InputFilter.sampling_frequency=10000000
InputFilter.IF=1098000
Resampler.implementation=Pass_Through
Resampler.sample_freq_in=10000000
Resampler.sample_freq_out=10000000
Resampler.item_type=gr_complex
;######### CHANNELS GLOBAL CONFIG ############
Channels_B1.count=4
Channels.in_acquisition=1
Channel.signal=B1
Channel0.satellite = 29;
Channel1.satellite = 19;
Channel2.satellite = 20;
Channel3.satellite = 30;
;Channel0.satellite = 6;
;Channel1.satellite = 8;
;Channel2.satellite = 9;
;Channel3.satellite = 13;
;Channel4.satellite = 17;
;Channel5.satellite = 1;
;Channel6.satellite = 2;
;Channel7.satellite = 3;
;Channel8.satellite = 4;
;Channel9.satellite = 5;
;######### ACQUISITION GLOBAL CONFIG ############
Acquisition_B1.implementation=BEIDOU_B1I_PCPS_Acquisition
Acquisition_B1.item_type=gr_complex
Acquisition_B1.coherent_integration_time_ms=1
Acquisition_B1.threshold=0.0004
;Acquisition_B1.pfa=0.0000001;
Acquisition_B1.doppler_max=10000
Acquisition_B1.doppler_step=50
Acquisition_B1.dump=true
Acquisition_B1.dump_filename=./bds_acq
Acquisition_B1.blocking=false;
Acquisition_B1.use_CFAR_algorithm=true;
Acquisition_B1.bit_transition_flag = false;
;######### TRACKING GLOBAL CONFIG ############
Tracking_B1.implementation=BEIDOU_B1I_DLL_PLL_Tracking
Tracking_B1.item_type=gr_complex
Tracking_B1.pll_bw_hz=25.0;
Tracking_B1.dll_bw_hz=2.50;
Tracking_B1.dump=true;
Tracking_B1.dump_filename=./epl_tracking_ch_
;######### TELEMETRY DECODER GPS CONFIG ############
TelemetryDecoder_B1.implementation=BEIDOU_B1I_Telemetry_Decoder
TelemetryDecoder_B1.dump=false
;######### OBSERVABLES CONFIG ############
Observables.implementation=Hybrid_Observables
Observables.dump=true
Observables.dump_filename=./observables.dat
;######### PVT CONFIG ############
PVT.implementation=RTKLIB_PVT
PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic
PVT.iono_model=OFF ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX
PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad
PVT.output_rate_ms=100
PVT.display_rate_ms=500
PVT.dump_filename=./PVT
PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea;
PVT.flag_nmea_tty_port=false;
PVT.nmea_dump_devname=/dev/pts/4
PVT.flag_rtcm_server=false
PVT.flag_rtcm_tty_port=false
PVT.rtcm_dump_devname=/dev/pts/1
PVT.dump=true

View File

@ -16,7 +16,7 @@ ControlThread.wait_for_flowgraph=false
;######### SIGNAL_SOURCE CONFIG ############ ;######### SIGNAL_SOURCE CONFIG ############
SignalSource.implementation=File_Signal_Source SignalSource.implementation=File_Signal_Source
SignalSource.filename=/home/dmiralles/Documents/gnss-metadata-standard/install/BdsB3IStr01.dat SignalSource.filename=/archive/BDS3_datasets/BdsB3IStr01.dat
SignalSource.item_type=byte SignalSource.item_type=byte
SignalSource.sampling_frequency=50000000 SignalSource.sampling_frequency=50000000
SignalSource.samples=0 SignalSource.samples=0
@ -93,22 +93,21 @@ Tracking_B3.dll_bw_narrow_hz=3.0;
Tracking_B3.dump=false; Tracking_B3.dump=false;
Tracking_B3.dump_filename=./epl_tracking_ch_ Tracking_B3.dump_filename=./epl_tracking_ch_
;######### TELEMETRY DECODER GPS CONFIG ############ ;######### TELEMETRY DECODER GPS CONFIG ############
TelemetryDecoder_B3.implementation=BEIDOU_B3I_Telemetry_Decoder TelemetryDecoder_B3.implementation=BEIDOU_B3I_Telemetry_Decoder
TelemetryDecoder_B3.dump=true TelemetryDecoder_B3.dump=false
;######### OBSERVABLES CONFIG ############ ;######### OBSERVABLES CONFIG ############
Observables.implementation=Hybrid_Observables Observables.implementation=Hybrid_Observables
Observables.dump=true Observables.dump=false
Observables.dump_filename=./observables.dat Observables.dump_filename=./observables.dat
;######### PVT CONFIG ############ ;######### PVT CONFIG ############
PVT.implementation=RTKLIB_PVT PVT.implementation=RTKLIB_PVT
PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic
PVT.iono_model=OFF ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX
PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad
PVT.output_rate_ms=100 PVT.output_rate_ms=100
PVT.display_rate_ms=500 PVT.display_rate_ms=500

View File

@ -180,18 +180,25 @@ Rtklib_Pvt::Rtklib_Pvt(ConfigurationInterface* configuration,
* *
* *
* Skipped previous values to avoid overlapping * Skipped previous values to avoid overlapping
* 50 | Beidou B1I * 500 | BeiDou B1I
* 51 | Beidou B1I + GPS L1 C/A * 501 | BeiDou B1I + GPS L1 C/A
* 52 | Beidou B1I + Galileo E1B * 502 | BeiDou B1I + Galileo E1B
* 53 | Beidou B1I + GLONASS L1 C/A * 503 | BeiDou B1I + GLONASS L1 C/A
* 54 | Beidou B1I + GPS L1 C/A + Galileo E1B * 504 | BeiDou B1I + GPS L1 C/A + Galileo E1B
* 55 | Beidou B1I + GPS L1 C/A + GLONASS L1 C/A + Galileo E1B * 505 | BeiDou B1I + GPS L1 C/A + GLONASS L1 C/A + Galileo E1B
* 56 | Beidou B1I + Beidou B3I * 506 | BeiDou B1I + Beidou B3I
* Skipped previous values to avoid overlapping * Skipped previous values to avoid overlapping
* 60 | Beidou B3I * 600 | BeiDou B3I
* 61 | Beidou B3I + GPS L2C * 601 | BeiDou B3I + GPS L2C
* 62 | Beidou B3I + GLONASS L2 C/A * 602 | BeiDou B3I + GLONASS L2 C/A
* 63 | Beidou B3I + GPS L2C + GLONASS L2 C/A * 603 | BeiDou B3I + GPS L2C + GLONASS L2 C/A
* 604 | BeiDou B3I + GPS L1 C/A
* 605 | BeiDou B3I + Galileo E1B
* 606 | BeiDou B3I + GLONASS L1 C/A
* 607 | BeiDou B3I + GPS L1 C/A + Galileo E1B
* 608 | BeiDou B3I + GPS L1 C/A + Galileo E1B + BeiDou B1I
* 609 | BeiDou B3I + GPS L1 C/A + Galileo E1B + GLONASS L1 C/A
* 610 | BeiDou B3I + GPS L1 C/A + Galileo E1B + GLONASS L1 C/A + BeiDou B1I
*/ */
int gps_1C_count = configuration->property("Channels_1C.count", 0); int gps_1C_count = configuration->property("Channels_1C.count", 0);
int gps_2S_count = configuration->property("Channels_2S.count", 0); int gps_2S_count = configuration->property("Channels_2S.count", 0);
@ -330,48 +337,48 @@ Rtklib_Pvt::Rtklib_Pvt(ConfigurationInterface* configuration,
// BeiDou B1I Receiver // 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) && (bds_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) && (bds_B3_count == 0))
{ {
pvt_output_parameters.type_of_receiver = 50; // Beidou B1I pvt_output_parameters.type_of_receiver = 500; // Beidou B1I
} }
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)) 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; // Beidou B1I + GPS L1 C/A pvt_output_parameters.type_of_receiver = 501; // Beidou B1I + GPS L1 C/A
} }
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)) 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; // Beidou B1I + Galileo E1B pvt_output_parameters.type_of_receiver = 502; // Beidou B1I + Galileo E1B
} }
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)) 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; // Beidou B1I + GLONASS L1 C/A pvt_output_parameters.type_of_receiver = 503; // Beidou B1I + GLONASS L1 C/A
} }
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)) 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; // Beidou B1I + GPS L1 C/A + Galileo E1B pvt_output_parameters.type_of_receiver = 504; // Beidou B1I + GPS L1 C/A + Galileo E1B
} }
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)) 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; // Beidou B1I + GPS L1 C/A + GLONASS L1 C/A + Galileo E1B pvt_output_parameters.type_of_receiver = 505; // Beidou B1I + GPS L1 C/A + GLONASS L1 C/A + Galileo E1B
} }
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)) 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 B1I + Beidou B3I pvt_output_parameters.type_of_receiver = 506; // Beidou B1I + Beidou B3I
} }
// BeiDou B3I Receiver // 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)) 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; // Beidou B3I pvt_output_parameters.type_of_receiver = 600; // Beidou B3I
} }
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)) 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; // Beidou B3I + GPS L2C pvt_output_parameters.type_of_receiver = 601; // Beidou B3I + GPS L2C
} }
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)) 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; // Beidou B3I + GLONASS L2 C/A pvt_output_parameters.type_of_receiver = 602; // Beidou B3I + GLONASS L2 C/A
} }
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)) 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; // Beidou B3I + GPS L2C + GLONASS L2 C/A pvt_output_parameters.type_of_receiver = 603; // Beidou B3I + GPS L2C + GLONASS L2 C/A
} }
// RTKLIB PVT solver options // RTKLIB PVT solver options

View File

@ -1416,7 +1416,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
new_bds_eph[bds_dnav_eph->i_satellite_PRN] = *bds_dnav_eph; new_bds_eph[bds_dnav_eph->i_satellite_PRN] = *bds_dnav_eph;
switch (type_of_rx) switch (type_of_rx)
{ {
case 50: // BDS B1I only case 500: // BDS B1I only
rp->log_rinex_nav(rp->navFile, new_bds_eph); rp->log_rinex_nav(rp->navFile, new_bds_eph);
break; break;
default: default:
@ -2178,7 +2178,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
b_rinex_header_written = true; // do not write header anymore b_rinex_header_written = true; // do not write header anymore
} }
break; break;
case 50: // BDS B1I only case 500: // BDS B1I only
if (beidou_dnav_ephemeris_iter != d_pvt_solver->beidou_dnav_ephemeris_map.cend()) if (beidou_dnav_ephemeris_iter != d_pvt_solver->beidou_dnav_ephemeris_map.cend())
{ {
rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B1"); rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B1");
@ -2188,7 +2188,68 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
} }
break; break;
case 60: // BDS B1I only case 501: // BeiDou B1I + GPS L1 C/A
if ((gps_ephemeris_iter != d_pvt_solver->gps_ephemeris_map.cend()) and (beidou_dnav_ephemeris_iter != d_pvt_solver->beidou_dnav_ephemeris_map.cend()))
{
std::string bds_signal("B1");
//rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, beidou_dnav_ephemeris_iter->second, d_rx_time, bds_signal);
//rp->rinex_nav_header(rp->navMixFile, d_pvt_solver->gps_iono, d_pvt_solver->gps_utc_model, gps_ephemeris_iter->second, d_pvt_solver->beidou_dnav_iono, d_pvt_solver->beidou_dnav_utc_model);
b_rinex_header_written = true; // do not write header anymore
}
break;
case 502: // BeiDou B1I + Galileo E1B
if ((galileo_ephemeris_iter != d_pvt_solver->galileo_ephemeris_map.cend()) and (beidou_dnav_ephemeris_iter != d_pvt_solver->beidou_dnav_ephemeris_map.cend()))
{
std::string bds_signal("B1");
std::string gal_signal("1B");
//rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, beidou_dnav_ephemeris_iter->second, d_rx_time, gal_signal, bds_signal);
//rp->rinex_nav_header(rp->navMixFile, d_pvt_solver->galileo_iono, d_pvt_solver->galileo_utc_model, d_pvt_solver->beidou_dnav_iono, d_pvt_solver->beidou_dnav_utc_model);
b_rinex_header_written = true; // do not write header anymore
}
break;
case 503: // BeiDou B1I + GLONASS L1 C/A
if (beidou_dnav_ephemeris_iter != d_pvt_solver->beidou_dnav_ephemeris_map.cend())
{
//rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B1");
//rp->rinex_nav_header(rp->navFile, d_pvt_solver->beidou_dnav_iono, d_pvt_solver->beidou_dnav_utc_model);
//rp->log_rinex_nav(rp->navFile, d_pvt_solver->beidou_dnav_ephemeris_map);
b_rinex_header_written = true; // do not write header anymore
}
break;
case 504: // BeiDou B1I + GPS L1 C/A + Galileo E1B
if (beidou_dnav_ephemeris_iter != d_pvt_solver->beidou_dnav_ephemeris_map.cend())
{
//rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B1");
//rp->rinex_nav_header(rp->navFile, d_pvt_solver->beidou_dnav_iono, d_pvt_solver->beidou_dnav_utc_model);
//rp->log_rinex_nav(rp->navFile, d_pvt_solver->beidou_dnav_ephemeris_map);
b_rinex_header_written = true; // do not write header anymore
}
break;
case 505: // BeiDou B1I + GPS L1 C/A + GLONASS L1 C/A + Galileo E1B
if (beidou_dnav_ephemeris_iter != d_pvt_solver->beidou_dnav_ephemeris_map.cend())
{
//rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B1");
//rp->rinex_nav_header(rp->navFile, d_pvt_solver->beidou_dnav_iono, d_pvt_solver->beidou_dnav_utc_model);
//rp->log_rinex_nav(rp->navFile, d_pvt_solver->beidou_dnav_ephemeris_map);
b_rinex_header_written = true; // do not write header anymore
}
break;
case 506: // BeiDou B1I + Beidou B3I
if (beidou_dnav_ephemeris_iter != d_pvt_solver->beidou_dnav_ephemeris_map.cend())
{
//rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B1");
//rp->rinex_nav_header(rp->navFile, d_pvt_solver->beidou_dnav_iono, d_pvt_solver->beidou_dnav_utc_model);
//rp->log_rinex_nav(rp->navFile, d_pvt_solver->beidou_dnav_ephemeris_map);
b_rinex_header_written = true; // do not write header anymore
}
break;
case 600: // BDS B3I only
if (beidou_dnav_ephemeris_iter != d_pvt_solver->beidou_dnav_ephemeris_map.cend()) if (beidou_dnav_ephemeris_iter != d_pvt_solver->beidou_dnav_ephemeris_map.cend())
{ {
rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B3"); rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B3");
@ -2196,6 +2257,33 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
b_rinex_header_written = true; // do not write header anymore b_rinex_header_written = true; // do not write header anymore
} }
break;
case 601: // BeiDou B3I + GPS L2C
if (beidou_dnav_ephemeris_iter != d_pvt_solver->beidou_dnav_ephemeris_map.cend())
{
rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B3");
//rp->rinex_nav_header(rp->navFile, d_pvt_solver->beidou_dnav_iono, d_pvt_solver->beidou_dnav_utc_model);
b_rinex_header_written = true; // do not write header anymore
}
break;
case 602: // BeiDou B3I + GLONASS L2 C/A
if (beidou_dnav_ephemeris_iter != d_pvt_solver->beidou_dnav_ephemeris_map.cend())
{
rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B3");
//rp->rinex_nav_header(rp->navFile, d_pvt_solver->beidou_dnav_iono, d_pvt_solver->beidou_dnav_utc_model);
b_rinex_header_written = true; // do not write header anymore
}
break;
case 603: // BeiDou B3I + GPS L2C + GLONASS L2 C/A
if (beidou_dnav_ephemeris_iter != d_pvt_solver->beidou_dnav_ephemeris_map.cend())
{
rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B3");
//rp->rinex_nav_header(rp->navFile, d_pvt_solver->beidou_dnav_iono, d_pvt_solver->beidou_dnav_utc_model);
b_rinex_header_written = true; // do not write header anymore
}
break; break;
default: default:
break; break;
@ -2506,7 +2594,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
} }
} }
break; break;
case 50: // BDS B1I only case 500: // BDS B1I only
if (beidou_dnav_ephemeris_iter != d_pvt_solver->beidou_dnav_ephemeris_map.cend()) if (beidou_dnav_ephemeris_iter != d_pvt_solver->beidou_dnav_ephemeris_map.cend())
{ {
rp->log_rinex_obs(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, gnss_observables_map, "B1"); rp->log_rinex_obs(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, gnss_observables_map, "B1");

View File

@ -34,7 +34,6 @@
#include "pvt_solution.h" #include "pvt_solution.h"
#include <boost/date_time/posix_time/posix_time.hpp> #include <boost/date_time/posix_time/posix_time.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <cstdio> // for remove
#include <ctime> // for tm #include <ctime> // for tm
#include <exception> // for exception #include <exception> // for exception
#include <iomanip> // for operator<< #include <iomanip> // for operator<<
@ -240,7 +239,8 @@ bool GeoJSON_Printer::close_file()
// if nothing is written, erase the file // if nothing is written, erase the file
if (first_pos == true) if (first_pos == true)
{ {
if (remove(filename_.c_str()) != 0) errorlib::error_code ec;
if (!fs::remove(fs::path(filename_), ec))
{ {
LOG(INFO) << "Error deleting temporary file"; LOG(INFO) << "Error deleting temporary file";
} }

View File

@ -34,7 +34,6 @@
#include "rtklib_solver.h" #include "rtklib_solver.h"
#include <boost/date_time/posix_time/posix_time.hpp> #include <boost/date_time/posix_time/posix_time.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <cstdio> // for remove
#include <ctime> // for tm #include <ctime> // for tm
#include <exception> // for exception #include <exception> // for exception
#include <iomanip> // for operator<< #include <iomanip> // for operator<<
@ -251,7 +250,8 @@ Gpx_Printer::~Gpx_Printer()
} }
if (!positions_printed) if (!positions_printed)
{ {
if (remove(gpx_filename.c_str()) != 0) errorlib::error_code ec;
if (!fs::remove(fs::path(gpx_filename), ec))
{ {
LOG(INFO) << "Error deleting temporary GPX file"; LOG(INFO) << "Error deleting temporary GPX file";
} }

View File

@ -34,9 +34,7 @@
#include "rtklib_solver.h" #include "rtklib_solver.h"
#include <boost/date_time/posix_time/posix_time.hpp> #include <boost/date_time/posix_time/posix_time.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <cstdio> // for remove
#include <cstdlib> // for mkstemp #include <cstdlib> // for mkstemp
#include <cstring> // for strncpy
#include <ctime> // for tm #include <ctime> // for tm
#include <exception> // for exception #include <exception> // for exception
#include <iostream> // for cout, cerr #include <iostream> // for cout, cerr
@ -366,7 +364,8 @@ Kml_Printer::~Kml_Printer()
} }
if (!positions_printed) if (!positions_printed)
{ {
if (remove(kml_filename.c_str()) != 0) errorlib::error_code ec;
if (!fs::remove(fs::path(kml_filename), ec))
{ {
LOG(INFO) << "Error deleting temporary KML file"; LOG(INFO) << "Error deleting temporary KML file";
} }

View File

@ -37,6 +37,7 @@
#include "rtklib_solution.h" #include "rtklib_solution.h"
#include "rtklib_solver.h" #include "rtklib_solver.h"
#include <glog/logging.h> #include <glog/logging.h>
#include <array>
#include <cstdint> #include <cstdint>
#include <exception> #include <exception>
#include <fcntl.h> #include <fcntl.h>
@ -133,6 +134,7 @@ Nmea_Printer::Nmea_Printer(const std::string& filename, bool flag_nmea_output_fi
Nmea_Printer::~Nmea_Printer() Nmea_Printer::~Nmea_Printer()
{ {
auto pos = nmea_file_descriptor.tellp();
try try
{ {
if (nmea_file_descriptor.is_open()) if (nmea_file_descriptor.is_open())
@ -148,6 +150,14 @@ Nmea_Printer::~Nmea_Printer()
{ {
std::cerr << e.what() << '\n'; std::cerr << e.what() << '\n';
} }
if (pos == 0)
{
errorlib::error_code ec;
if (!fs::remove(fs::path(nmea_filename), ec))
{
std::cerr << "Problem removing NMEA temporary file: " << nmea_filename << '\n';
}
}
try try
{ {
close_serial(); close_serial();
@ -428,9 +438,9 @@ std::string Nmea_Printer::get_GPRMC()
{ {
// Sample -> $GPRMC,161229.487,A,3723.2475,N,12158.3416,W,0.13,309.62,120598,*10 // Sample -> $GPRMC,161229.487,A,3723.2475,N,12158.3416,W,0.13,309.62,120598,*10
std::stringstream sentence_str; std::stringstream sentence_str;
unsigned char buff[1024] = {0}; std::array<unsigned char, 1024> buff{};
outnmea_rmc(buff, &d_PVT_data->pvt_sol); outnmea_rmc(buff.data(), &d_PVT_data->pvt_sol);
sentence_str << buff; sentence_str << buff.data();
return sentence_str.str(); return sentence_str.str();
} }
@ -440,9 +450,9 @@ std::string Nmea_Printer::get_GPGSA()
// $GPGSA,A,3,07,02,26,27,09,04,15, , , , , ,1.8,1.0,1.5*33 // $GPGSA,A,3,07,02,26,27,09,04,15, , , , , ,1.8,1.0,1.5*33
// GSA-GNSS DOP and Active Satellites // GSA-GNSS DOP and Active Satellites
std::stringstream sentence_str; std::stringstream sentence_str;
unsigned char buff[1024] = {0}; std::array<unsigned char, 1024> buff{};
outnmea_gsa(buff, &d_PVT_data->pvt_sol, d_PVT_data->pvt_ssat.data()); outnmea_gsa(buff.data(), &d_PVT_data->pvt_sol, d_PVT_data->pvt_ssat.data());
sentence_str << buff; sentence_str << buff.data();
return sentence_str.str(); return sentence_str.str();
} }
@ -453,9 +463,9 @@ std::string Nmea_Printer::get_GPGSV()
// $GPGSV,2,1,07,07,79,048,42,02,51,062,43,26,36,256,42,27,27,138,42*71 // $GPGSV,2,1,07,07,79,048,42,02,51,062,43,26,36,256,42,27,27,138,42*71
// Notice that NMEA 2.1 only supports 12 channels // Notice that NMEA 2.1 only supports 12 channels
std::stringstream sentence_str; std::stringstream sentence_str;
unsigned char buff[1024] = {0}; std::array<unsigned char, 1024> buff{};
outnmea_gsv(buff, &d_PVT_data->pvt_sol, d_PVT_data->pvt_ssat.data()); outnmea_gsv(buff.data(), &d_PVT_data->pvt_sol, d_PVT_data->pvt_ssat.data());
sentence_str << buff; sentence_str << buff.data();
return sentence_str.str(); return sentence_str.str();
} }
@ -463,9 +473,9 @@ std::string Nmea_Printer::get_GPGSV()
std::string Nmea_Printer::get_GPGGA() std::string Nmea_Printer::get_GPGGA()
{ {
std::stringstream sentence_str; std::stringstream sentence_str;
unsigned char buff[1024] = {0}; std::array<unsigned char, 1024> buff{};
outnmea_gga(buff, &d_PVT_data->pvt_sol); outnmea_gga(buff.data(), &d_PVT_data->pvt_sol);
sentence_str << buff; sentence_str << buff.data();
return sentence_str.str(); return sentence_str.str();
// $GPGGA,104427.591,5920.7009,N,01803.2938,E,1,05,3.3,78.2,M,23.2,M,0.0,0000*4A // $GPGGA,104427.591,5920.7009,N,01803.2938,E,1,05,3.3,78.2,M,23.2,M,0.0,0000*4A
} }

View File

@ -33,6 +33,7 @@
#include "GPS_L1_CA.h" #include "GPS_L1_CA.h"
#include "geofunctions.h" #include "geofunctions.h"
#include <glog/logging.h> #include <glog/logging.h>
#include <array>
Pvt_Solution::Pvt_Solution() Pvt_Solution::Pvt_Solution()
@ -97,8 +98,8 @@ int Pvt_Solution::cart2geo(double X, double Y, double Z, int elipsoid_selection)
4. World Geodetic System 1984 4. World Geodetic System 1984
*/ */
const double a[5] = {6378388.0, 6378160.0, 6378135.0, 6378137.0, 6378137.0}; const std::array<double, 5> a = {6378388.0, 6378160.0, 6378135.0, 6378137.0, 6378137.0};
const double f[5] = {1.0 / 297.0, 1.0 / 298.247, 1.0 / 298.26, 1.0 / 298.257222101, 1.0 / 298.257223563}; const std::array<double, 5> f = {1.0 / 297.0, 1.0 / 298.247, 1.0 / 298.26, 1.0 / 298.257222101, 1.0 / 298.257223563};
double lambda = atan2(Y, X); double lambda = atan2(Y, X);
double ex2 = (2.0 - f[elipsoid_selection]) * f[elipsoid_selection] / ((1.0 - f[elipsoid_selection]) * (1.0 - f[elipsoid_selection])); double ex2 = (2.0 - f[elipsoid_selection]) * f[elipsoid_selection] / ((1.0 - f[elipsoid_selection]) * (1.0 - f[elipsoid_selection]));

View File

@ -29,7 +29,7 @@
*/ */
#include "rinex_printer.h" #include "rinex_printer.h"
#include "Beidou_B1I.h" #include "Beidou_DNAV.h"
#include "GLONASS_L1_L2_CA.h" #include "GLONASS_L1_L2_CA.h"
#include "GPS_L1_CA.h" #include "GPS_L1_CA.h"
#include "Galileo_E1.h" #include "Galileo_E1.h"
@ -55,8 +55,8 @@
#include <boost/date_time/time_zone_base.hpp> #include <boost/date_time/time_zone_base.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <algorithm> // for min and max #include <algorithm> // for min and max
#include <cmath> // for floor #include <array>
#include <cstring> // for memcpy #include <cmath> // for floor
#include <exception> #include <exception>
#include <iostream> // for cout #include <iostream> // for cout
#include <iterator> #include <iterator>
@ -267,51 +267,59 @@ Rinex_Printer::~Rinex_Printer()
std::cerr << e.what() << '\n'; std::cerr << e.what() << '\n';
} }
// If nothing written, erase the files. // If nothing written, erase the files.
if (posn == 0) if (posn == 0)
{ {
if (remove(navfilename.c_str()) != 0) errorlib::error_code ec;
if (!fs::remove(fs::path(navfilename), ec))
{ {
LOG(INFO) << "Error deleting temporary file"; LOG(INFO) << "Error deleting temporary file";
} }
} }
if (poso == 0) if (poso == 0)
{ {
if (remove(obsfilename.c_str()) != 0) errorlib::error_code ec;
if (!fs::remove(fs::path(obsfilename), ec))
{ {
LOG(INFO) << "Error deleting temporary file"; LOG(INFO) << "Error deleting temporary file";
} }
} }
if (poss == 0) if (poss == 0)
{ {
if (remove(sbsfilename.c_str()) != 0) errorlib::error_code ec;
if (!fs::remove(fs::path(sbsfilename), ec))
{ {
LOG(INFO) << "Error deleting temporary file"; LOG(INFO) << "Error deleting temporary file";
} }
} }
if (posng == 0) if (posng == 0)
{ {
if (remove(navGalfilename.c_str()) != 0) errorlib::error_code ec;
if (!fs::remove(fs::path(navGalfilename), ec))
{ {
LOG(INFO) << "Error deleting temporary file"; LOG(INFO) << "Error deleting temporary file";
} }
} }
if (posmn == 0) if (posmn == 0)
{ {
if (remove(navMixfilename.c_str()) != 0) errorlib::error_code ec;
if (!fs::remove(fs::path(navMixfilename), ec))
{ {
LOG(INFO) << "Error deleting temporary file"; LOG(INFO) << "Error deleting temporary file";
} }
} }
if (posnr == 0) if (posnr == 0)
{ {
if (remove(navGlofilename.c_str()) != 0) errorlib::error_code ec;
if (!fs::remove(fs::path(navGlofilename), ec))
{ {
LOG(INFO) << "Error deleting temporary file"; LOG(INFO) << "Error deleting temporary file";
} }
} }
if (posnc == 0) if (posnc == 0)
{ {
if (remove(navBdsfilename.c_str()) != 0) errorlib::error_code ec;
if (!fs::remove(fs::path(navBdsfilename), ec))
{ {
LOG(INFO) << "Error deleting temporary file"; LOG(INFO) << "Error deleting temporary file";
} }
@ -424,11 +432,11 @@ std::string Rinex_Printer::getLocalTime()
line += std::string("GNSS-SDR"); line += std::string("GNSS-SDR");
line += std::string(12, ' '); line += std::string(12, ' ');
std::string username; std::string username;
char c_username[20] = {0}; std::array<char, 20> c_username{};
int32_t nGet = getlogin_r(c_username, sizeof(c_username) - 1); int32_t nGet = getlogin_r(c_username.data(), sizeof(c_username) - 1);
if (nGet == 0) if (nGet == 0)
{ {
username = c_username; username = c_username.data();
} }
else else
{ {
@ -1787,7 +1795,6 @@ void Rinex_Printer::rinex_nav_header(std::fstream& out, const Beidou_Dnav_Iono&
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(iono.d_alpha3, 10, 2), 12); line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(iono.d_alpha3, 10, 2), 12);
line += std::string(7, ' '); line += std::string(7, ' ');
line += Rinex_Printer::leftJustify("IONOSPHERIC CORR", 20); line += Rinex_Printer::leftJustify("IONOSPHERIC CORR", 20);
Rinex_Printer::lengthCheck(line); Rinex_Printer::lengthCheck(line);
out << line << std::endl; out << line << std::endl;
@ -1801,7 +1808,6 @@ void Rinex_Printer::rinex_nav_header(std::fstream& out, const Beidou_Dnav_Iono&
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(iono.d_beta3, 10, 2), 12); line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(iono.d_beta3, 10, 2), 12);
line += std::string(7, ' '); line += std::string(7, ' ');
line += Rinex_Printer::leftJustify("IONOSPHERIC CORR", 20); line += Rinex_Printer::leftJustify("IONOSPHERIC CORR", 20);
Rinex_Printer::lengthCheck(line); Rinex_Printer::lengthCheck(line);
out << line << std::endl; out << line << std::endl;
@ -1812,7 +1818,6 @@ void Rinex_Printer::rinex_nav_header(std::fstream& out, const Beidou_Dnav_Iono&
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(utc_model.d_A1_UTC, 15, 2), 16); line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(utc_model.d_A1_UTC, 15, 2), 16);
line += std::string(22, ' '); line += std::string(22, ' ');
line += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20); line += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20);
Rinex_Printer::lengthCheck(line); Rinex_Printer::lengthCheck(line);
out << line << std::endl; out << line << std::endl;
@ -1837,6 +1842,535 @@ void Rinex_Printer::rinex_nav_header(std::fstream& out, const Beidou_Dnav_Iono&
} }
void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Gps_Ephemeris& gps_eph, const Beidou_Dnav_Iono& bds_dnav_iono, const Beidou_Dnav_Utc_Model& bds_dnav_utc_model)
{
std::string line;
// -------- Line 1
line = std::string(5, ' ');
line += stringVersion;
line += std::string(11, ' ');
line += std::string("N: GNSS NAV DATA");
line += std::string(4, ' ');
line += std::string("M: MIXED");
line += std::string(12, ' ');
line += std::string("RINEX VERSION / TYPE");
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line 2
line.clear();
line += Rinex_Printer::getLocalTime();
line += std::string("PGM / RUN BY / DATE");
line += std::string(1, ' ');
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line COMMENT
line.clear();
line += Rinex_Printer::leftJustify("GNSS NAVIGATION MESSAGE FILE GENERATED BY GNSS-SDR", 60);
line += Rinex_Printer::leftJustify("COMMENT", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line COMMENT
line.clear();
std::string gnss_sdr_version(GNSS_SDR_VERSION);
line += "GNSS-SDR VERSION ";
line += Rinex_Printer::leftJustify(gnss_sdr_version, 43);
line += Rinex_Printer::leftJustify("COMMENT", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line COMMENT
line.clear();
line += Rinex_Printer::leftJustify("See https://gnss-sdr.org", 60);
line += Rinex_Printer::leftJustify("COMMENT", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line ionospheric info 1, only version 3 supported
line.clear();
line += std::string("BDSA");
line += std::string(1, ' ');
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_alpha0, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_alpha1, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_alpha2, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_alpha3, 10, 2), 12);
line += std::string(7, ' ');
line += Rinex_Printer::leftJustify("IONOSPHERIC CORR", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line ionospheric info 2
line.clear();
line += std::string("BDSB");
line += std::string(1, ' ');
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_beta0, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_beta1, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_beta2, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_beta3, 10, 2), 12);
line += std::string(7, ' ');
line += Rinex_Printer::leftJustify("IONOSPHERIC CORR", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line ionospheric info 2
line.clear();
line += std::string("GPSA");
line += std::string(1, ' ');
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_iono.d_alpha0, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_iono.d_alpha1, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_iono.d_alpha2, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_iono.d_alpha3, 10, 2), 12);
line += std::string(7, ' ');
line += Rinex_Printer::leftJustify("IONOSPHERIC CORR", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line 5 system time correction
line.clear();
line += std::string("BDUT");
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_utc_model.d_A0_UTC, 16, 2), 18);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_utc_model.d_A1_UTC, 15, 2), 16);
line += std::string(22, ' ');
line += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line system time correction 3
line.clear();
line += std::string("GPUT");
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_utc_model.d_A0, 16, 2), 18);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_utc_model.d_A1, 15, 2), 16);
line += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.d_t_OT), 7);
if (gps_eph.i_GPS_week < 512)
{
if (gps_utc_model.i_WN_T == 0)
{
line += Rinex_Printer::rightJustify(std::to_string(gps_eph.i_GPS_week + 2048), 5); // valid from 2019 to 2029
}
else
{
line += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.i_WN_T + (gps_eph.i_GPS_week / 256) * 256 + 2048), 5); // valid from 2019 to 2029
}
}
else
{
if (gps_utc_model.i_WN_T == 0)
{
line += Rinex_Printer::rightJustify(std::to_string(gps_eph.i_GPS_week + 1024), 5); // valid from 2009 to 2019
}
else
{
line += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.i_WN_T + (gps_eph.i_GPS_week / 256) * 256 + 1024), 5); // valid from 2009 to 2019
}
}
line += std::string(10, ' ');
line += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line 6 leap seconds
// For leap second information, see http://www.endruntechnologies.com/leap.htm
line.clear();
line += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.d_DeltaT_LS), 6);
line += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.d_DeltaT_LSF), 6);
line += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.i_WN_LSF), 6);
line += Rinex_Printer::rightJustify(std::to_string(gps_utc_model.i_DN), 6);
line += std::string(36, ' ');
line += Rinex_Printer::leftJustify("LEAP SECONDS", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- End of Header
line.clear();
line += std::string(60, ' ');
line += Rinex_Printer::leftJustify("END OF HEADER", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
}
void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_CNAV_Iono& gps_cnav_iono, const Gps_CNAV_Utc_Model& gps_cnav_utc_model, const Beidou_Dnav_Iono& bds_dnav_iono, const Beidou_Dnav_Utc_Model& bds_dnav_utc_model)
{
std::string line;
stringVersion = "3.02";
version = 3;
// -------- Line 1
line = std::string(5, ' ');
line += stringVersion;
line += std::string(11, ' ');
line += std::string("N: GNSS NAV DATA");
line += std::string(4, ' ');
line += std::string("M: MIXED");
line += std::string(12, ' ');
line += std::string("RINEX VERSION / TYPE");
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line 2
line.clear();
line += Rinex_Printer::getLocalTime();
line += std::string("PGM / RUN BY / DATE");
line += std::string(1, ' ');
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line COMMENT
line.clear();
line += Rinex_Printer::leftJustify("GNSS NAVIGATION MESSAGE FILE GENERATED BY GNSS-SDR", 60);
line += Rinex_Printer::leftJustify("COMMENT", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line COMMENT
line.clear();
std::string gnss_sdr_version(GNSS_SDR_VERSION);
line += "GNSS-SDR VERSION ";
line += Rinex_Printer::leftJustify(gnss_sdr_version, 43);
line += Rinex_Printer::leftJustify("COMMENT", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line COMMENT
line.clear();
line += Rinex_Printer::leftJustify("See https://gnss-sdr.org", 60);
line += Rinex_Printer::leftJustify("COMMENT", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line ionospheric info 1, only version 3 supported
line.clear();
line += std::string("BDSA");
line += std::string(1, ' ');
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_alpha0, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_alpha1, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_alpha2, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_alpha3, 10, 2), 12);
line += std::string(7, ' ');
line += Rinex_Printer::leftJustify("IONOSPHERIC CORR", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line ionospheric info 2
line.clear();
line += std::string("BDSB");
line += std::string(1, ' ');
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_beta0, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_beta1, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_beta2, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_beta3, 10, 2), 12);
line += std::string(7, ' ');
line += Rinex_Printer::leftJustify("IONOSPHERIC CORR", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line ionospheric info 1
line.clear();
line += std::string("GPSA");
line += std::string(1, ' ');
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_cnav_iono.d_alpha0, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_cnav_iono.d_alpha1, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_cnav_iono.d_alpha2, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_cnav_iono.d_alpha3, 10, 2), 12);
line += std::string(7, ' ');
line += Rinex_Printer::leftJustify("IONOSPHERIC CORR", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line 5 system time correction
line.clear();
line += std::string("BDUT");
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_utc_model.d_A0_UTC, 16, 2), 18);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_utc_model.d_A1_UTC, 15, 2), 16);
line += std::string(22, ' ');
line += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line system time correction 3
line.clear();
line += std::string("GPUT");
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_cnav_utc_model.d_A0, 16, 2), 18);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_cnav_utc_model.d_A1, 15, 2), 16);
line += Rinex_Printer::rightJustify(std::to_string(gps_cnav_utc_model.d_t_OT), 7);
line += Rinex_Printer::rightJustify(std::to_string(gps_cnav_utc_model.i_WN_T), 5);
line += std::string(10, ' ');
line += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line 6 leap seconds
// For leap second information, see http://www.endruntechnologies.com/leap.htm
line.clear();
line += Rinex_Printer::rightJustify(std::to_string(gps_cnav_utc_model.d_DeltaT_LS), 6);
line += Rinex_Printer::rightJustify(std::to_string(gps_cnav_utc_model.d_DeltaT_LSF), 6);
line += Rinex_Printer::rightJustify(std::to_string(gps_cnav_utc_model.i_WN_LSF), 6);
line += Rinex_Printer::rightJustify(std::to_string(gps_cnav_utc_model.i_DN), 6);
line += std::string(36, ' ');
line += Rinex_Printer::leftJustify("LEAP SECONDS", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- End of Header
line.clear();
line += std::string(60, ' ');
line += Rinex_Printer::leftJustify("END OF HEADER", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
}
void Rinex_Printer::rinex_nav_header(std::fstream& out, const Glonass_Gnav_Utc_Model& glo_gnav_utc_model, const Beidou_Dnav_Iono& bds_dnav_iono, const Beidou_Dnav_Utc_Model& bds_dnav_utc_model)
{
std::string line;
// -------- Line 1
line = std::string(5, ' ');
line += stringVersion;
line += std::string(11, ' ');
line += std::string("N: GNSS NAV DATA");
line += std::string(4, ' ');
line += std::string("M: MIXED");
line += std::string(12, ' ');
line += std::string("RINEX VERSION / TYPE");
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line 2
line.clear();
line += Rinex_Printer::getLocalTime();
line += std::string("PGM / RUN BY / DATE");
line += std::string(1, ' ');
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line COMMENT
line.clear();
line += Rinex_Printer::leftJustify("GNSS NAVIGATION MESSAGE FILE GENERATED BY GNSS-SDR", 60);
line += Rinex_Printer::leftJustify("COMMENT", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line COMMENT
line.clear();
std::string gnss_sdr_version(GNSS_SDR_VERSION);
line += "GNSS-SDR VERSION ";
line += Rinex_Printer::leftJustify(gnss_sdr_version, 43);
line += Rinex_Printer::leftJustify("COMMENT", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line COMMENT
line.clear();
line += Rinex_Printer::leftJustify("See https://gnss-sdr.org", 60);
line += Rinex_Printer::leftJustify("COMMENT", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line ionospheric info 1, only version 3 supported
line.clear();
line += std::string("BDSA");
line += std::string(1, ' ');
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_alpha0, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_alpha1, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_alpha2, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_alpha3, 10, 2), 12);
line += std::string(7, ' ');
line += Rinex_Printer::leftJustify("IONOSPHERIC CORR", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line ionospheric info 2
line.clear();
line += std::string("BDSB");
line += std::string(1, ' ');
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_beta0, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_beta1, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_beta2, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_beta3, 10, 2), 12);
line += std::string(7, ' ');
line += Rinex_Printer::leftJustify("IONOSPHERIC CORR", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line 5 system time correction
line.clear();
line += std::string("BDUT");
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_utc_model.d_A0_UTC, 16, 2), 18);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_utc_model.d_A1_UTC, 15, 2), 16);
line += std::string(22, ' ');
line += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line system time correction 1
line.clear();
line += std::string("GLUT");
line += std::string(1, ' ');
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(glo_gnav_utc_model.d_tau_c, 16, 2), 17);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(0.0, 15, 2), 16);
line += Rinex_Printer::rightJustify(std::to_string(0.0), 7);
line += Rinex_Printer::rightJustify(std::to_string(0.0), 5);
line += std::string(10, ' ');
line += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line 6 leap seconds
// For leap second information, see http://www.endruntechnologies.com/leap.htm
line.clear();
line += Rinex_Printer::rightJustify(std::to_string(bds_dnav_utc_model.d_DeltaT_LS), 6);
line += Rinex_Printer::rightJustify(std::to_string(bds_dnav_utc_model.d_DeltaT_LSF), 6);
line += Rinex_Printer::rightJustify(std::to_string(bds_dnav_utc_model.i_WN_LSF), 6);
line += Rinex_Printer::rightJustify(std::to_string(bds_dnav_utc_model.i_DN), 6);
line += std::string(36, ' ');
line += Rinex_Printer::leftJustify("LEAP SECONDS", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- End of Header
line.clear();
line += std::string(60, ' ');
line += Rinex_Printer::leftJustify("END OF HEADER", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
}
void Rinex_Printer::rinex_nav_header(std::fstream& out, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model, const Beidou_Dnav_Iono& bds_dnav_iono, const Beidou_Dnav_Utc_Model& bds_dnav_utc_model)
{
std::string line;
// -------- Line 1
line = std::string(5, ' ');
line += stringVersion;
line += std::string(11, ' ');
line += std::string("N: GNSS NAV DATA");
line += std::string(4, ' ');
line += std::string("M: MIXED");
line += std::string(12, ' ');
line += std::string("RINEX VERSION / TYPE");
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line 2
line.clear();
line += Rinex_Printer::getLocalTime();
line += std::string("PGM / RUN BY / DATE");
line += std::string(1, ' ');
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line COMMENT
line.clear();
line += Rinex_Printer::leftJustify("GNSS NAVIGATION MESSAGE FILE GENERATED BY GNSS-SDR", 60);
line += Rinex_Printer::leftJustify("COMMENT", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line COMMENT
line.clear();
std::string gnss_sdr_version(GNSS_SDR_VERSION);
line += "GNSS-SDR VERSION ";
line += Rinex_Printer::leftJustify(gnss_sdr_version, 43);
line += Rinex_Printer::leftJustify("COMMENT", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line COMMENT
line.clear();
line += Rinex_Printer::leftJustify("See https://gnss-sdr.org", 60);
line += Rinex_Printer::leftJustify("COMMENT", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line ionospheric info 1
line.clear();
line += std::string("GAL ");
line += std::string(1, ' ');
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_iono.ai0_5, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_iono.ai1_5, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_iono.ai2_5, 10, 2), 12);
double zero = 0.0;
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(zero, 10, 2), 12);
line += std::string(7, ' ');
line += Rinex_Printer::leftJustify("IONOSPHERIC CORR", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line ionospheric info 1, only version 3 supported
line.clear();
line += std::string("BDSA");
line += std::string(1, ' ');
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_alpha0, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_alpha1, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_alpha2, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_alpha3, 10, 2), 12);
line += std::string(7, ' ');
line += Rinex_Printer::leftJustify("IONOSPHERIC CORR", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line ionospheric info 2
line.clear();
line += std::string("BDSB");
line += std::string(1, ' ');
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_beta0, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_beta1, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_beta2, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_iono.d_beta3, 10, 2), 12);
line += std::string(7, ' ');
line += Rinex_Printer::leftJustify("IONOSPHERIC CORR", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line system time correction
line.clear();
line += std::string("GAUT");
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_utc_model.A0_6, 16, 2), 18);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_utc_model.A1_6, 15, 2), 16);
line += Rinex_Printer::rightJustify(std::to_string(galileo_utc_model.t0t_6), 7);
line += Rinex_Printer::rightJustify(std::to_string(galileo_utc_model.WNot_6), 5);
line += std::string(10, ' ');
line += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line system time correction 1
// -------- Line 5 system time correction
line.clear();
line += std::string("BDUT");
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_utc_model.d_A0_UTC, 16, 2), 18);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(bds_dnav_utc_model.d_A1_UTC, 15, 2), 16);
line += std::string(22, ' ');
line += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- Line 6 leap seconds
// For leap second information, see http://www.endruntechnologies.com/leap.htm
line.clear();
line += Rinex_Printer::rightJustify(std::to_string(galileo_utc_model.Delta_tLS_6), 6);
line += Rinex_Printer::rightJustify(std::to_string(galileo_utc_model.Delta_tLSF_6), 6);
line += Rinex_Printer::rightJustify(std::to_string(galileo_utc_model.WN_LSF_6), 6);
line += Rinex_Printer::rightJustify(std::to_string(galileo_utc_model.DN_6), 6);
line += std::string(36, ' ');
line += Rinex_Printer::leftJustify("LEAP SECONDS", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
// -------- End of Header
line.clear();
line += std::string(60, ' ');
line += Rinex_Printer::leftJustify("END OF HEADER", 20);
Rinex_Printer::lengthCheck(line);
out << line << std::endl;
}
void Rinex_Printer::rinex_sbs_header(std::fstream& out) void Rinex_Printer::rinex_sbs_header(std::fstream& out)
{ {
std::string line; std::string line;
@ -1857,11 +2391,11 @@ void Rinex_Printer::rinex_sbs_header(std::fstream& out)
line.clear(); line.clear();
line += Rinex_Printer::leftJustify("GNSS-SDR", 20); line += Rinex_Printer::leftJustify("GNSS-SDR", 20);
std::string username; std::string username;
char c_username[20] = {0}; std::array<char, 20> c_username{};
int32_t nGet = getlogin_r(c_username, sizeof(c_username) - 1); int32_t nGet = getlogin_r(c_username.data(), sizeof(c_username) - 1);
if (nGet == 0) if (nGet == 0)
{ {
username = c_username; username = c_username.data();
} }
else else
{ {
@ -4301,11 +4835,11 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Glonass_Gnav_Ephem
// -------- Line OBSERVER / AGENCY // -------- Line OBSERVER / AGENCY
line.clear(); line.clear();
std::string username; std::string username;
char c_username[20] = {0}; std::array<char, 20> c_username{};
int32_t nGet = getlogin_r(c_username, sizeof(c_username) - 1); int32_t nGet = getlogin_r(c_username.data(), sizeof(c_username) - 1);
if (nGet == 0) if (nGet == 0)
{ {
username = c_username; username = c_username.data();
} }
else else
{ {
@ -4627,11 +5161,11 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps
// -------- Line OBSERVER / AGENCY // -------- Line OBSERVER / AGENCY
line.clear(); line.clear();
std::string username; std::string username;
char c_username[20] = {0}; std::array<char, 20> c_username{};
int32_t nGet = getlogin_r(c_username, sizeof(c_username) - 1); int32_t nGet = getlogin_r(c_username.data(), sizeof(c_username) - 1);
if (nGet == 0) if (nGet == 0)
{ {
username = c_username; username = c_username.data();
} }
else else
{ {
@ -4982,11 +5516,11 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris
// -------- Line OBSERVER / AGENCY // -------- Line OBSERVER / AGENCY
line.clear(); line.clear();
std::string username; std::string username;
char c_username[20] = {0}; std::array<char, 20> c_username{};
int32_t nGet = getlogin_r(c_username, sizeof(c_username) - 1); int32_t nGet = getlogin_r(c_username.data(), sizeof(c_username) - 1);
if (nGet == 0) if (nGet == 0)
{ {
username = c_username; username = c_username.data();
} }
else else
{ {
@ -5291,11 +5825,11 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris&
// -------- Line OBSERVER / AGENCY // -------- Line OBSERVER / AGENCY
line.clear(); line.clear();
std::string username; std::string username;
char c_username[20] = {0}; std::array<char, 20> c_username{};
int32_t nGet = getlogin_r(c_username, sizeof(c_username) - 1); int32_t nGet = getlogin_r(c_username.data(), sizeof(c_username) - 1);
if (nGet == 0) if (nGet == 0)
{ {
username = c_username; username = c_username.data();
} }
else else
{ {
@ -5614,11 +6148,11 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph
// -------- Line OBSERVER / AGENCY // -------- Line OBSERVER / AGENCY
line.clear(); line.clear();
std::string username; std::string username;
char c_username[20] = {0}; std::array<char, 20> c_username{};
int32_t nGet = getlogin_r(c_username, sizeof(c_username) - 1); int32_t nGet = getlogin_r(c_username.data(), sizeof(c_username) - 1);
if (nGet == 0) if (nGet == 0)
{ {
username = c_username; username = c_username.data();
} }
else else
{ {
@ -5871,11 +6405,11 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris
// -------- Line OBSERVER / AGENCY // -------- Line OBSERVER / AGENCY
line.clear(); line.clear();
std::string username; std::string username;
char c_username[20] = {0}; std::array<char, 20> c_username{};
int32_t nGet = getlogin_r(c_username, sizeof(c_username) - 1); int32_t nGet = getlogin_r(c_username.data(), sizeof(c_username) - 1);
if (nGet == 0) if (nGet == 0)
{ {
username = c_username; username = c_username.data();
} }
else else
{ {
@ -6122,11 +6656,11 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph
// -------- Line OBSERVER / AGENCY // -------- Line OBSERVER / AGENCY
line.clear(); line.clear();
std::string username; std::string username;
char c_username[20] = {0}; std::array<char, 20> c_username{};
int32_t nGet = getlogin_r(c_username, sizeof(c_username) - 1); int32_t nGet = getlogin_r(c_username.data(), sizeof(c_username) - 1);
if (nGet == 0) if (nGet == 0)
{ {
username = c_username; username = c_username.data();
} }
else else
{ {
@ -6403,11 +6937,11 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps
// -------- Line OBSERVER / AGENCY // -------- Line OBSERVER / AGENCY
line.clear(); line.clear();
std::string username; std::string username;
char c_username[20] = {0}; std::array<char, 20> c_username{};
int32_t nGet = getlogin_r(c_username, sizeof(c_username) - 1); int32_t nGet = getlogin_r(c_username.data(), sizeof(c_username) - 1);
if (nGet == 0) if (nGet == 0)
{ {
username = c_username; username = c_username.data();
} }
else else
{ {
@ -6749,11 +7283,11 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris
// -------- Line OBSERVER / AGENCY // -------- Line OBSERVER / AGENCY
line.clear(); line.clear();
std::string username; std::string username;
char c_username[20] = {0}; std::array<char, 20> c_username{};
int32_t nGet = getlogin_r(c_username, sizeof(c_username) - 1); int32_t nGet = getlogin_r(c_username.data(), sizeof(c_username) - 1);
if (nGet == 0) if (nGet == 0)
{ {
username = c_username; username = c_username.data();
} }
else else
{ {
@ -7067,11 +7601,11 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris&
// -------- Line OBSERVER / AGENCY // -------- Line OBSERVER / AGENCY
line.clear(); line.clear();
std::string username; std::string username;
char c_username[20] = {0}; std::array<char, 20> c_username{};
int32_t nGet = getlogin_r(c_username, sizeof(c_username) - 1); int32_t nGet = getlogin_r(c_username.data(), sizeof(c_username) - 1);
if (nGet == 0) if (nGet == 0)
{ {
username = c_username; username = c_username.data();
} }
else else
{ {
@ -7334,11 +7868,11 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps
// -------- Line OBSERVER / AGENCY // -------- Line OBSERVER / AGENCY
line.clear(); line.clear();
std::string username; std::string username;
char c_username[20] = {0}; std::array<char, 20> c_username{};
int32_t nGet = getlogin_r(c_username, sizeof(c_username) - 1); int32_t nGet = getlogin_r(c_username.data(), sizeof(c_username) - 1);
if (nGet == 0) if (nGet == 0)
{ {
username = c_username; username = c_username.data();
} }
else else
{ {
@ -7616,11 +8150,11 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Beidou_Dnav_Epheme
// -------- Line OBSERVER / AGENCY // -------- Line OBSERVER / AGENCY
line.clear(); line.clear();
std::string username; std::string username;
char c_username[20] = {0}; std::array<char, 20> c_username{};
int32_t nGet = getlogin_r(c_username, sizeof(c_username) - 1); int32_t nGet = getlogin_r(c_username.data(), sizeof(c_username) - 1);
if (nGet == 0) if (nGet == 0)
{ {
username = c_username; username = c_username.data();
} }
else else
{ {
@ -9645,10 +10179,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, c
if ((total_mmap.count(mmap_iter->second.PRN)) == 1 && (mmap_iter->second.PRN != 0)) if ((total_mmap.count(mmap_iter->second.PRN)) == 1 && (mmap_iter->second.PRN != 0))
{ {
Gnss_Synchro gs = Gnss_Synchro(); Gnss_Synchro gs = Gnss_Synchro();
std::string sys = "G"; gs.System = 'G';
gs.System = *sys.c_str(); gs.Signal[0] = '2';
std::string sig = "2S"; gs.Signal[1] = 'S';
std::memcpy(static_cast<void*>(gs.Signal), sig.c_str(), 3); gs.Signal[2] = '\0';
gs.PRN = mmap_iter->second.PRN; gs.PRN = mmap_iter->second.PRN;
total_mmap.insert(std::pair<uint32_t, Gnss_Synchro>(mmap_iter->second.PRN, gs)); total_mmap.insert(std::pair<uint32_t, Gnss_Synchro>(mmap_iter->second.PRN, gs));
} }
@ -9875,10 +10409,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ep
if (found_1B != std::string::npos) if (found_1B != std::string::npos)
{ {
Gnss_Synchro gs = Gnss_Synchro(); Gnss_Synchro gs = Gnss_Synchro();
std::string sys = "E"; gs.System = 'E';
gs.System = *sys.c_str(); gs.Signal[0] = '1';
std::string sig = "1B"; gs.Signal[1] = 'B';
std::memcpy(static_cast<void*>(gs.Signal), sig.c_str(), 3); gs.Signal[2] = '\0';
gs.PRN = prn_; gs.PRN = prn_;
total_map.insert(std::pair<uint32_t, Gnss_Synchro>(prn_, gs)); total_map.insert(std::pair<uint32_t, Gnss_Synchro>(prn_, gs));
} }
@ -9900,20 +10434,20 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ep
if (found_1B != std::string::npos) if (found_1B != std::string::npos)
{ {
Gnss_Synchro gs = Gnss_Synchro(); Gnss_Synchro gs = Gnss_Synchro();
std::string sys = "E"; gs.System = 'E';
gs.System = *sys.c_str(); gs.Signal[0] = '1';
std::string sig = "1B"; gs.Signal[1] = 'B';
std::memcpy(static_cast<void*>(gs.Signal), sig.c_str(), 3); gs.Signal[2] = '\0';
gs.PRN = prn_; gs.PRN = prn_;
total_map.insert(std::pair<uint32_t, Gnss_Synchro>(prn_, gs)); total_map.insert(std::pair<uint32_t, Gnss_Synchro>(prn_, gs));
} }
if (found_E5a != std::string::npos) if (found_E5a != std::string::npos)
{ {
Gnss_Synchro gs = Gnss_Synchro(); Gnss_Synchro gs = Gnss_Synchro();
std::string sys = "E"; gs.System = 'E';
gs.System = *sys.c_str(); gs.Signal[0] = '5';
std::string sig = "5X"; gs.Signal[1] = 'X';
std::memcpy(static_cast<void*>(gs.Signal), sig.c_str(), 3); gs.Signal[2] = '\0';
gs.PRN = prn_; gs.PRN = prn_;
total_map.insert(std::pair<uint32_t, Gnss_Synchro>(prn_, gs)); total_map.insert(std::pair<uint32_t, Gnss_Synchro>(prn_, gs));
} }
@ -9926,10 +10460,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ep
if ((total_map.count(prn_)) == 1) if ((total_map.count(prn_)) == 1)
{ {
Gnss_Synchro gs = Gnss_Synchro(); Gnss_Synchro gs = Gnss_Synchro();
std::string sys = "E"; gs.System = 'E';
gs.System = *sys.c_str(); gs.Signal[0] = '5';
std::string sig = "5X"; gs.Signal[1] = 'X';
std::memcpy(static_cast<void*>(gs.Signal), sig.c_str(), 3); gs.Signal[2] = '\0';
gs.PRN = prn_; gs.PRN = prn_;
total_map.insert(std::pair<uint32_t, Gnss_Synchro>(prn_, gs)); total_map.insert(std::pair<uint32_t, Gnss_Synchro>(prn_, gs));
} }
@ -10995,10 +11529,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Beidou_Dnav_Ephemeris
if (found_B1 != std::string::npos) if (found_B1 != std::string::npos)
{ {
Gnss_Synchro gs = Gnss_Synchro(); Gnss_Synchro gs = Gnss_Synchro();
std::string sys = "C"; gs.System = 'C';
gs.System = *sys.c_str(); gs.Signal[0] = 'B';
std::string sig = "B1"; gs.Signal[1] = '1';
std::memcpy(static_cast<void*>(gs.Signal), sig.c_str(), 3); gs.Signal[2] = '\0';
gs.PRN = prn_; gs.PRN = prn_;
total_map.insert(std::pair<uint32_t, Gnss_Synchro>(prn_, gs)); total_map.insert(std::pair<uint32_t, Gnss_Synchro>(prn_, gs));
} }
@ -11045,7 +11579,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Beidou_Dnav_Ephemeris
lineObs += Rinex_Printer::rightJustify(Rinex_Printer::asString<int32_t>(ssi), 1); lineObs += Rinex_Printer::rightJustify(Rinex_Printer::asString<int32_t>(ssi), 1);
// CARRIER PHASE // CARRIER PHASE
lineObs += Rinex_Printer::rightJustify(asString(iter->second.Carrier_phase_rads / (BEIDOU_TWO_PI), 3), 14); lineObs += Rinex_Printer::rightJustify(asString(iter->second.Carrier_phase_rads / (BEIDOU_DNAV_TWO_PI), 3), 14);
if (lli == 0) if (lli == 0)
{ {
lineObs += std::string(1, ' '); lineObs += std::string(1, ' ');
@ -11077,7 +11611,7 @@ void Rinex_Printer::to_date_time(int32_t gps_week, int32_t gps_tow, int& year, i
{ {
// represents GPS time (week, TOW) in the date time format of the Gregorian calendar. // represents GPS time (week, TOW) in the date time format of the Gregorian calendar.
// -> Leap years are considered, but leap seconds are not. // -> Leap years are considered, but leap seconds are not.
int32_t days_per_month[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; std::array<int32_t, 12> days_per_month{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
// seconds in a not leap year // seconds in a not leap year
const int32_t secs_per_day = 24 * 60 * 60; const int32_t secs_per_day = 24 * 60 * 60;

View File

@ -149,8 +149,31 @@ public:
*/ */
void rinex_nav_header(std::fstream& out, const Gps_CNAV_Iono& gps_iono, const Gps_CNAV_Utc_Model& gps_utc_model, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac); void rinex_nav_header(std::fstream& out, const Gps_CNAV_Iono& gps_iono, const Gps_CNAV_Utc_Model& gps_utc_model, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac);
/*!
* \brief Generates the BDS B1I or B3I Navigation Data header
*/
void rinex_nav_header(std::fstream& out, const Beidou_Dnav_Iono& iono, const Beidou_Dnav_Utc_Model& utc_model); void rinex_nav_header(std::fstream& out, const Beidou_Dnav_Iono& iono, const Beidou_Dnav_Utc_Model& utc_model);
/*!
* \brief Generates the Mixed GPS L1,L5 + BDS B1I, B3I Navigation Data header
*/
void rinex_nav_header(std::fstream& out, const Gps_Iono& gps_lnav_iono, const Gps_Utc_Model& gps_lnav_utc_model, const Gps_Ephemeris& eph, const Beidou_Dnav_Iono& bds_dnav_iono, const Beidou_Dnav_Utc_Model& bds_dnav_utc_model);
/*!
* \brief Generates the Mixed GPS L2C + BDS B1I, B3I Navigation Data header
*/
void rinex_nav_header(std::fstream& out, const Gps_CNAV_Iono& gps_cnav_iono, const Gps_CNAV_Utc_Model& gps_cnav_utc_model, const Beidou_Dnav_Iono& bds_dnav_iono, const Beidou_Dnav_Utc_Model& bds_dnav_utc_model);
/*!
* \brief Generates the Mixed GLONASS L1,L2 + BDS B1I, B3I Navigation Data header
*/
void rinex_nav_header(std::fstream& out, const Glonass_Gnav_Utc_Model& glo_gnav_utc_model, const Beidou_Dnav_Iono& bds_dnav_iono, const Beidou_Dnav_Utc_Model& bds_dnav_utc_model);
/*!
* \brief Generates the Mixed (Galileo/BDS B1I, B3I) Navigation Data header
*/
void rinex_nav_header(std::fstream& out, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model, const Beidou_Dnav_Iono& bds_dnav_iono, const Beidou_Dnav_Utc_Model& bds_dnav_utc_model);
/*! /*!
* \brief Generates the GPS Observation data header * \brief Generates the GPS Observation data header
*/ */

View File

@ -38,6 +38,7 @@
#include <boost/crc.hpp> #include <boost/crc.hpp>
#include <boost/date_time/gregorian/gregorian.hpp> #include <boost/date_time/gregorian/gregorian.hpp>
#include <boost/dynamic_bitset.hpp> #include <boost/dynamic_bitset.hpp>
#include <boost/exception/diagnostic_information.hpp>
#include <algorithm> // for std::reverse #include <algorithm> // for std::reverse
#include <chrono> // std::chrono::seconds #include <chrono> // std::chrono::seconds
#include <cmath> // for std::fmod #include <cmath> // for std::fmod

View File

@ -34,12 +34,12 @@
#include "concurrent_queue.h" #include "concurrent_queue.h"
#include "galileo_ephemeris.h"
#include "glonass_gnav_ephemeris.h"
#include "glonass_gnav_utc_model.h"
#include "gnss_synchro.h" #include "gnss_synchro.h"
#include <galileo_ephemeris.h> #include "gps_cnav_ephemeris.h"
#include <gps_ephemeris.h> #include "gps_ephemeris.h"
#include <gps_cnav_ephemeris.h>
#include <glonass_gnav_ephemeris.h>
#include <glonass_gnav_utc_model.h>
#include <boost/asio.hpp> #include <boost/asio.hpp>
#include <boost/date_time/posix_time/posix_time.hpp> #include <boost/date_time/posix_time/posix_time.hpp>
#include <glog/logging.h> #include <glog/logging.h>
@ -48,6 +48,7 @@
#include <cstdint> #include <cstdint>
#include <cstring> // for memcpy #include <cstring> // for memcpy
#include <deque> #include <deque>
#include <list>
#include <map> #include <map>
#include <memory> #include <memory>
#include <set> #include <set>

View File

@ -39,8 +39,8 @@
#include "gps_cnav_ephemeris.h" #include "gps_cnav_ephemeris.h"
#include "gps_ephemeris.h" #include "gps_ephemeris.h"
#include "rtcm.h" #include "rtcm.h"
#include <boost/exception/diagnostic_information.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <cstdio> // for remove
#include <ctime> // for tm #include <ctime> // for tm
#include <exception> // for exception #include <exception> // for exception
#include <fcntl.h> // for O_RDWR #include <fcntl.h> // for O_RDWR
@ -221,7 +221,8 @@ Rtcm_Printer::~Rtcm_Printer()
} }
if (pos == 0) if (pos == 0)
{ {
if (remove(rtcm_filename.c_str()) != 0) errorlib::error_code ec;
if (!fs::remove(fs::path(rtcm_filename), ec))
{ {
LOG(INFO) << "Error deleting temporary RTCM file"; LOG(INFO) << "Error deleting temporary RTCM file";
} }

View File

@ -54,6 +54,7 @@
#include "rtklib_solver.h" #include "rtklib_solver.h"
#include "Beidou_B1I.h" #include "Beidou_B1I.h"
#include "Beidou_B3I.h" #include "Beidou_B3I.h"
#include "Beidou_DNAV.h"
#include "GLONASS_L1_L2_CA.h" #include "GLONASS_L1_L2_CA.h"
#include "GPS_L1_CA.h" #include "GPS_L1_CA.h"
#include "Galileo_E1.h" #include "Galileo_E1.h"
@ -66,6 +67,25 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#if HAS_STD_FILESYSTEM
#include <system_error>
namespace errorlib = std;
#if HAS_STD_FILESYSTEM_EXPERIMENTAL
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#else
#include <filesystem>
namespace fs = std::filesystem;
#endif
#else
#include <boost/filesystem/operations.hpp> // for create_directories, exists
#include <boost/filesystem/path.hpp> // for path, operator<<
#include <boost/filesystem/path_traits.hpp> // for filesystem
#include <boost/system/error_code.hpp> // for error_code
namespace fs = boost::filesystem;
namespace errorlib = boost::system;
#endif
Rtklib_Solver::Rtklib_Solver(int nchannels, std::string dump_filename, bool flag_dump_to_file, bool flag_dump_to_mat, const rtk_t &rtk) Rtklib_Solver::Rtklib_Solver(int nchannels, std::string dump_filename, bool flag_dump_to_file, bool flag_dump_to_mat, const rtk_t &rtk)
{ {
@ -217,116 +237,116 @@ bool Rtklib_Solver::save_matfile()
matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
if (reinterpret_cast<int64_t *>(matfp) != nullptr) if (reinterpret_cast<int64_t *>(matfp) != nullptr)
{ {
size_t dims[2] = {1, static_cast<size_t>(num_epoch)}; std::array<size_t, 2> dims{1, static_cast<size_t>(num_epoch)};
matvar = Mat_VarCreate("TOW_at_current_symbol_ms", MAT_C_UINT32, MAT_T_UINT32, 2, dims, TOW_at_current_symbol_ms.data(), 0); matvar = Mat_VarCreate("TOW_at_current_symbol_ms", MAT_C_UINT32, MAT_T_UINT32, 2, dims.data(), TOW_at_current_symbol_ms.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("week", MAT_C_UINT32, MAT_T_UINT32, 2, dims, week.data(), 0); matvar = Mat_VarCreate("week", MAT_C_UINT32, MAT_T_UINT32, 2, dims.data(), week.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("RX_time", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, RX_time.data(), 0); matvar = Mat_VarCreate("RX_time", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), RX_time.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("user_clk_offset", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, user_clk_offset.data(), 0); matvar = Mat_VarCreate("user_clk_offset", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), user_clk_offset.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("pos_x", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, pos_x.data(), 0); matvar = Mat_VarCreate("pos_x", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), pos_x.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("pos_y", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, pos_y.data(), 0); matvar = Mat_VarCreate("pos_y", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), pos_y.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("pos_z", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, pos_z.data(), 0); matvar = Mat_VarCreate("pos_z", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), pos_z.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("vel_x", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, vel_x.data(), 0); matvar = Mat_VarCreate("vel_x", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), vel_x.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("vel_y", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, vel_y.data(), 0); matvar = Mat_VarCreate("vel_y", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), vel_y.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("vel_z", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, vel_z.data(), 0); matvar = Mat_VarCreate("vel_z", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), vel_z.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("cov_xx", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_xx.data(), 0); matvar = Mat_VarCreate("cov_xx", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), cov_xx.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("cov_yy", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_yy.data(), 0); matvar = Mat_VarCreate("cov_yy", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), cov_yy.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("cov_zz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_zz.data(), 0); matvar = Mat_VarCreate("cov_zz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), cov_zz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("cov_xy", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_xy.data(), 0); matvar = Mat_VarCreate("cov_xy", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), cov_xy.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("cov_yz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_yz.data(), 0); matvar = Mat_VarCreate("cov_yz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), cov_yz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("cov_zx", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, cov_zx.data(), 0); matvar = Mat_VarCreate("cov_zx", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), cov_zx.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("latitude", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, latitude.data(), 0); matvar = Mat_VarCreate("latitude", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), latitude.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("longitude", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, longitude.data(), 0); matvar = Mat_VarCreate("longitude", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), longitude.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("height", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, height.data(), 0); matvar = Mat_VarCreate("height", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), height.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("valid_sats", MAT_C_UINT8, MAT_T_UINT8, 2, dims, valid_sats.data(), 0); matvar = Mat_VarCreate("valid_sats", MAT_C_UINT8, MAT_T_UINT8, 2, dims.data(), valid_sats.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("solution_status", MAT_C_UINT8, MAT_T_UINT8, 2, dims, solution_status.data(), 0); matvar = Mat_VarCreate("solution_status", MAT_C_UINT8, MAT_T_UINT8, 2, dims.data(), solution_status.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("solution_type", MAT_C_UINT8, MAT_T_UINT8, 2, dims, solution_type.data(), 0); matvar = Mat_VarCreate("solution_type", MAT_C_UINT8, MAT_T_UINT8, 2, dims.data(), solution_type.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("AR_ratio_factor", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, AR_ratio_factor.data(), 0); matvar = Mat_VarCreate("AR_ratio_factor", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), AR_ratio_factor.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("AR_ratio_threshold", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, AR_ratio_threshold.data(), 0); matvar = Mat_VarCreate("AR_ratio_threshold", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), AR_ratio_threshold.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("gdop", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, gdop.data(), 0); matvar = Mat_VarCreate("gdop", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), gdop.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("pdop", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, pdop.data(), 0); matvar = Mat_VarCreate("pdop", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), pdop.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("hdop", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, hdop.data(), 0); matvar = Mat_VarCreate("hdop", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), hdop.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("vdop", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, vdop.data(), 0); matvar = Mat_VarCreate("vdop", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), vdop.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
} }
@ -340,6 +360,7 @@ Rtklib_Solver::~Rtklib_Solver()
{ {
if (d_dump_file.is_open() == true) if (d_dump_file.is_open() == true)
{ {
auto pos = d_dump_file.tellp();
try try
{ {
d_dump_file.close(); d_dump_file.close();
@ -348,6 +369,15 @@ Rtklib_Solver::~Rtklib_Solver()
{ {
LOG(WARNING) << "Exception in destructor closing the RTKLIB dump file " << ex.what(); LOG(WARNING) << "Exception in destructor closing the RTKLIB dump file " << ex.what();
} }
if (pos == 0)
{
errorlib::error_code ec;
if (!fs::remove(fs::path(d_dump_filename), ec))
{
std::cerr << "Problem removing temporary file " << d_dump_filename << '\n';
}
d_flag_dump_mat_enabled = false;
}
} }
if (d_flag_dump_mat_enabled) if (d_flag_dump_mat_enabled)
{ {
@ -413,8 +443,8 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
int glo_valid_obs = 0; // GLONASS L1/L2 valid observations counter int glo_valid_obs = 0; // GLONASS L1/L2 valid observations counter
std::array<obsd_t, MAXOBS> obs_data{}; std::array<obsd_t, MAXOBS> obs_data{};
std::array<eph_t, MAXOBS> eph_data{}; std::vector<eph_t> eph_data(MAXOBS);
std::array<geph_t, MAXOBS> geph_data{}; std::vector<geph_t> geph_data(MAXOBS);
// Workaround for NAV/CNAV clash problem // Workaround for NAV/CNAV clash problem
bool gps_dual_band = false; bool gps_dual_band = false;
@ -730,7 +760,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
obsd_t newobs = {{0, 0}, '0', '0', {}, {}, {}, {}, {}, {}}; obsd_t newobs = {{0, 0}, '0', '0', {}, {}, {}, {}, {}, {}};
obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs, obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
gnss_observables_iter->second, gnss_observables_iter->second,
beidou_ephemeris_iter->second.i_BEIDOU_week + 1356, beidou_ephemeris_iter->second.i_BEIDOU_week + BEIDOU_DNAV_BDT2GPST_WEEK_NUM_OFFSET,
0); 0);
valid_obs++; valid_obs++;
} }
@ -752,8 +782,8 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
{ {
obs_data[i + glo_valid_obs] = insert_obs_to_rtklib(obs_data[i + glo_valid_obs], obs_data[i + glo_valid_obs] = insert_obs_to_rtklib(obs_data[i + glo_valid_obs],
gnss_observables_iter->second, gnss_observables_iter->second,
beidou_ephemeris_iter->second.i_BEIDOU_week + 1356, beidou_ephemeris_iter->second.i_BEIDOU_week + BEIDOU_DNAV_BDT2GPST_WEEK_NUM_OFFSET,
1); // Band 3 (L2/G2/B3) 2); // Band 3 (L2/G2/B3)
found_B1I_obs = true; found_B1I_obs = true;
break; break;
} }
@ -770,8 +800,8 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
{}, {0.0, 0.0, 0.0}, {}}; {}, {0.0, 0.0, 0.0}, {}};
obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs, obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
gnss_observables_iter->second, gnss_observables_iter->second,
beidou_ephemeris_iter->second.i_BEIDOU_week + 1356, beidou_ephemeris_iter->second.i_BEIDOU_week + BEIDOU_DNAV_BDT2GPST_WEEK_NUM_OFFSET,
1); // Band 2 (L2/G2) 2); // Band 2 (L2/G2)
valid_obs++; valid_obs++;
} }
} }
@ -797,28 +827,93 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
if ((valid_obs + glo_valid_obs) > 3) if ((valid_obs + glo_valid_obs) > 3)
{ {
int result = 0; int result = 0;
int sat = 0; nav_t nav_data{};
nav_t nav_data;
nav_data.eph = eph_data.data(); nav_data.eph = eph_data.data();
nav_data.geph = geph_data.data(); nav_data.geph = geph_data.data();
nav_data.n = valid_obs; nav_data.n = valid_obs;
nav_data.ng = glo_valid_obs; nav_data.ng = glo_valid_obs;
if (gps_iono.valid)
for (auto &i : nav_data.lam)
{ {
i[0] = SPEED_OF_LIGHT / FREQ1; // L1/E1 nav_data.ion_gps[0] = gps_iono.d_alpha0;
i[1] = SPEED_OF_LIGHT / FREQ2; // L2 nav_data.ion_gps[1] = gps_iono.d_alpha1;
i[2] = SPEED_OF_LIGHT / FREQ5; // L5/E5 nav_data.ion_gps[2] = gps_iono.d_alpha2;
nav_data.ion_gps[3] = gps_iono.d_alpha3;
// Keep update on sat number nav_data.ion_gps[4] = gps_iono.d_beta0;
sat++; nav_data.ion_gps[5] = gps_iono.d_beta1;
if (sat > NSYSGPS + NSYSGLO + NSYSGAL + NSYSQZS and sat < NSYSGPS + NSYSGLO + NSYSGAL + NSYSQZS + NSYSBDS) nav_data.ion_gps[6] = gps_iono.d_beta2;
{ nav_data.ion_gps[7] = gps_iono.d_beta3;
i[0] = SPEED_OF_LIGHT / FREQ1_BDS; // B1I
i[1] = SPEED_OF_LIGHT / FREQ3_BDS; // B3I
i[2] = SPEED_OF_LIGHT / FREQ5; // L5/E5
}
} }
if (!(gps_iono.valid) and gps_cnav_iono.valid)
{
nav_data.ion_gps[0] = gps_cnav_iono.d_alpha0;
nav_data.ion_gps[1] = gps_cnav_iono.d_alpha1;
nav_data.ion_gps[2] = gps_cnav_iono.d_alpha2;
nav_data.ion_gps[3] = gps_cnav_iono.d_alpha3;
nav_data.ion_gps[4] = gps_cnav_iono.d_beta0;
nav_data.ion_gps[5] = gps_cnav_iono.d_beta1;
nav_data.ion_gps[6] = gps_cnav_iono.d_beta2;
nav_data.ion_gps[7] = gps_cnav_iono.d_beta3;
}
if (galileo_iono.ai0_5 != 0.0)
{
nav_data.ion_gal[0] = galileo_iono.ai0_5;
nav_data.ion_gal[1] = galileo_iono.ai1_5;
nav_data.ion_gal[2] = galileo_iono.ai2_5;
nav_data.ion_gal[3] = 0.0;
}
if (beidou_dnav_iono.valid)
{
nav_data.ion_cmp[0] = beidou_dnav_iono.d_alpha0;
nav_data.ion_cmp[1] = beidou_dnav_iono.d_alpha1;
nav_data.ion_cmp[2] = beidou_dnav_iono.d_alpha2;
nav_data.ion_cmp[3] = beidou_dnav_iono.d_alpha3;
nav_data.ion_cmp[4] = beidou_dnav_iono.d_beta0;
nav_data.ion_cmp[5] = beidou_dnav_iono.d_beta0;
nav_data.ion_cmp[6] = beidou_dnav_iono.d_beta0;
nav_data.ion_cmp[7] = beidou_dnav_iono.d_beta3;
}
if (gps_utc_model.valid)
{
nav_data.utc_gps[0] = gps_utc_model.d_A0;
nav_data.utc_gps[1] = gps_utc_model.d_A1;
nav_data.utc_gps[2] = gps_utc_model.d_t_OT;
nav_data.utc_gps[3] = gps_utc_model.i_WN_T;
nav_data.leaps = gps_utc_model.d_DeltaT_LS;
}
if (!(gps_utc_model.valid) and gps_cnav_utc_model.valid)
{
nav_data.utc_gps[0] = gps_cnav_utc_model.d_A0;
nav_data.utc_gps[1] = gps_cnav_utc_model.d_A1;
nav_data.utc_gps[2] = gps_cnav_utc_model.d_t_OT;
nav_data.utc_gps[3] = gps_cnav_utc_model.i_WN_T;
nav_data.leaps = gps_cnav_utc_model.d_DeltaT_LS;
}
if (glonass_gnav_utc_model.valid)
{
nav_data.utc_glo[0] = glonass_gnav_utc_model.d_tau_c; // ??
nav_data.utc_glo[1] = 0.0; // ??
nav_data.utc_glo[2] = 0.0; // ??
nav_data.utc_glo[3] = 0.0; // ??
}
if (galileo_utc_model.A0_6 != 0.0)
{
nav_data.utc_gal[0] = galileo_utc_model.A0_6;
nav_data.utc_gal[1] = galileo_utc_model.A1_6;
nav_data.utc_gal[2] = galileo_utc_model.t0t_6;
nav_data.utc_gal[3] = galileo_utc_model.WNot_6;
nav_data.leaps = galileo_utc_model.Delta_tLS_6;
}
if (beidou_dnav_utc_model.valid)
{
nav_data.utc_cmp[0] = beidou_dnav_utc_model.d_A0_UTC;
nav_data.utc_cmp[1] = beidou_dnav_utc_model.d_A1_UTC;
nav_data.utc_cmp[2] = 0.0; // ??
nav_data.utc_cmp[3] = 0.0; // ??
nav_data.leaps = beidou_dnav_utc_model.d_DeltaT_LS;
}
/* update carrier wave length using native function call in RTKlib */
uniqnav(&nav_data);
result = rtkpos(&rtk_, obs_data.data(), valid_obs + glo_valid_obs, &nav_data); result = rtkpos(&rtk_, obs_data.data(), valid_obs + glo_valid_obs, &nav_data);
@ -883,11 +978,11 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
// compute Ground speed and COG // compute Ground speed and COG
double ground_speed_ms = 0.0; double ground_speed_ms = 0.0;
double pos[3]; std::array<double, 3> pos{};
double enuv[3]; std::array<double, 3> enuv{};
ecef2pos(pvt_sol.rr, pos); ecef2pos(pvt_sol.rr, pos.data());
ecef2enu(pos, &pvt_sol.rr[3], enuv); ecef2enu(pos.data(), &pvt_sol.rr[3], enuv.data());
this->set_speed_over_ground(norm_rtk(enuv, 2)); this->set_speed_over_ground(norm_rtk(enuv.data(), 2));
double new_cog; double new_cog;
if (ground_speed_ms >= 1.0) if (ground_speed_ms >= 1.0)
{ {

View File

@ -203,7 +203,6 @@ signed int GalileoE1Pcps8msAmbiguousAcquisition::mag()
void GalileoE1Pcps8msAmbiguousAcquisition::init() void GalileoE1Pcps8msAmbiguousAcquisition::init()
{ {
acquisition_cc_->init(); acquisition_cc_->init();
//set_local_code();
} }
@ -215,8 +214,10 @@ void GalileoE1Pcps8msAmbiguousAcquisition::set_local_code()
"Acquisition" + std::to_string(channel_) + ".cboc", false); "Acquisition" + std::to_string(channel_) + ".cboc", false);
std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]}; std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
std::array<char, 3> Signal_; std::array<char, 3> Signal_{};
std::memcpy(Signal_.data(), gnss_synchro_->Signal, 3); Signal_[0] = gnss_synchro_->Signal[0];
Signal_[1] = gnss_synchro_->Signal[1];
Signal_[2] = '\0';
galileo_e1_code_gen_complex_sampled(gsl::span<std::complex<float>>(code, code_length_), Signal_, galileo_e1_code_gen_complex_sampled(gsl::span<std::complex<float>>(code, code_length_), Signal_,
cboc, gnss_synchro_->PRN, fs_in_, 0, false); cboc, gnss_synchro_->PRN, fs_in_, 0, false);

View File

@ -232,7 +232,6 @@ signed int GalileoE1PcpsAmbiguousAcquisition::mag()
void GalileoE1PcpsAmbiguousAcquisition::init() void GalileoE1PcpsAmbiguousAcquisition::init()
{ {
acquisition_->init(); acquisition_->init();
//set_local_code();
} }
@ -246,7 +245,7 @@ void GalileoE1PcpsAmbiguousAcquisition::set_local_code()
if (acquire_pilot_ == true) if (acquire_pilot_ == true)
{ {
//set local signal generator to Galileo E1 pilot component (1C) // set local signal generator to Galileo E1 pilot component (1C)
std::array<char, 3> pilot_signal = {{'1', 'C', '\0'}}; std::array<char, 3> pilot_signal = {{'1', 'C', '\0'}};
if (acq_parameters_.use_automatic_resampler) if (acq_parameters_.use_automatic_resampler)
{ {
@ -261,8 +260,10 @@ void GalileoE1PcpsAmbiguousAcquisition::set_local_code()
} }
else else
{ {
std::array<char, 3> Signal_; std::array<char, 3> Signal_{};
std::memcpy(Signal_.data(), gnss_synchro_->Signal, 3); Signal_[0] = gnss_synchro_->Signal[0];
Signal_[1] = gnss_synchro_->Signal[1];
Signal_[2] = '\0';
if (acq_parameters_.use_automatic_resampler) if (acq_parameters_.use_automatic_resampler)
{ {
galileo_e1_code_gen_complex_sampled(code_span, Signal_, galileo_e1_code_gen_complex_sampled(code_span, Signal_,

View File

@ -76,7 +76,7 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui
This may be a bug, but acquisition also work by variying the folding factor at va- This may be a bug, but acquisition also work by variying the folding factor at va-
lues different that the expressed in the paper. In adition, it is important to point lues different that the expressed in the paper. In adition, it is important to point
out that by making the folding factor smaller we were able to get QuickSync work with out that by making the folding factor smaller we were able to get QuickSync work with
Galileo. Future work should be directed to test this asumption statistically.*/ Galileo. Future work should be directed to test this assumption statistically.*/
//folding_factor_ = static_cast<unsigned int>(ceil(sqrt(log2(code_length_)))); //folding_factor_ = static_cast<unsigned int>(ceil(sqrt(log2(code_length_))));
folding_factor_ = configuration_->property(role + ".folding_factor", 2); folding_factor_ = configuration_->property(role + ".folding_factor", 2);
@ -237,7 +237,6 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::mag()
void GalileoE1PcpsQuickSyncAmbiguousAcquisition::init() void GalileoE1PcpsQuickSyncAmbiguousAcquisition::init()
{ {
acquisition_cc_->init(); acquisition_cc_->init();
//set_local_code();
} }
@ -249,8 +248,10 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_local_code()
"Acquisition" + std::to_string(channel_) + ".cboc", false); "Acquisition" + std::to_string(channel_) + ".cboc", false);
std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]}; std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
std::array<char, 3> Signal_; std::array<char, 3> Signal_{};
std::memcpy(Signal_.data(), gnss_synchro_->Signal, 3); Signal_[0] = gnss_synchro_->Signal[0];
Signal_[1] = gnss_synchro_->Signal[1];
Signal_[2] = '\0';
galileo_e1_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.get(), code_length_), Signal_, galileo_e1_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.get(), code_length_), Signal_,
cboc, gnss_synchro_->PRN, fs_in_, 0, false); cboc, gnss_synchro_->PRN, fs_in_, 0, false);

View File

@ -207,7 +207,6 @@ signed int GalileoE1PcpsTongAmbiguousAcquisition::mag()
void GalileoE1PcpsTongAmbiguousAcquisition::init() void GalileoE1PcpsTongAmbiguousAcquisition::init()
{ {
acquisition_cc_->init(); acquisition_cc_->init();
//set_local_code();
} }
@ -219,8 +218,10 @@ void GalileoE1PcpsTongAmbiguousAcquisition::set_local_code()
"Acquisition" + std::to_string(channel_) + ".cboc", false); "Acquisition" + std::to_string(channel_) + ".cboc", false);
std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]}; std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
std::array<char, 3> Signal_; std::array<char, 3> Signal_{};
std::memcpy(Signal_.data(), gnss_synchro_->Signal, 3); Signal_[0] = gnss_synchro_->Signal[0];
Signal_[1] = gnss_synchro_->Signal[1];
Signal_[2] = '\0';
galileo_e1_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.get(), code_length_), Signal_, galileo_e1_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.get(), code_length_), Signal_,
cboc, gnss_synchro_->PRN, fs_in_, 0, false); cboc, gnss_synchro_->PRN, fs_in_, 0, false);

View File

@ -234,7 +234,7 @@ void GalileoE5aPcpsAcquisition::init()
void GalileoE5aPcpsAcquisition::set_local_code() void GalileoE5aPcpsAcquisition::set_local_code()
{ {
std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]}; std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
std::array<char, 3> signal_; std::array<char, 3> signal_{};
signal_[0] = '5'; signal_[0] = '5';
signal_[2] = '\0'; signal_[2] = '\0';

View File

@ -56,8 +56,9 @@
#include <volk/volk.h> #include <volk/volk.h>
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <algorithm> // for fill_n, min #include <algorithm> // for fill_n, min
#include <cmath> // for floor, fmod, rint, ceil #include <array>
#include <cstring> // for memcpy #include <cmath> // for floor, fmod, rint, ceil
#include <cstring> // for memcpy
#include <iostream> #include <iostream>
#include <map> #include <map>
@ -455,56 +456,56 @@ void pcps_acquisition::dump_results(int32_t effective_fft_size)
} }
else else
{ {
size_t dims[2] = {static_cast<size_t>(effective_fft_size), static_cast<size_t>(d_num_doppler_bins)}; std::array<size_t, 2> dims{static_cast<size_t>(effective_fft_size), static_cast<size_t>(d_num_doppler_bins)};
matvar_t* matvar = Mat_VarCreate("acq_grid", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, grid_.memptr(), 0); matvar_t* matvar = Mat_VarCreate("acq_grid", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), grid_.memptr(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
dims[0] = static_cast<size_t>(1); dims[0] = static_cast<size_t>(1);
dims[1] = static_cast<size_t>(1); dims[1] = static_cast<size_t>(1);
matvar = Mat_VarCreate("doppler_max", MAT_C_INT32, MAT_T_INT32, 1, dims, &acq_parameters.doppler_max, 0); matvar = Mat_VarCreate("doppler_max", MAT_C_INT32, MAT_T_INT32, 1, dims.data(), &acq_parameters.doppler_max, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("doppler_step", MAT_C_INT32, MAT_T_INT32, 1, dims, &d_doppler_step, 0); matvar = Mat_VarCreate("doppler_step", MAT_C_INT32, MAT_T_INT32, 1, dims.data(), &d_doppler_step, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("d_positive_acq", MAT_C_INT32, MAT_T_INT32, 1, dims, &d_positive_acq, 0); matvar = Mat_VarCreate("d_positive_acq", MAT_C_INT32, MAT_T_INT32, 1, dims.data(), &d_positive_acq, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
auto aux = static_cast<float>(d_gnss_synchro->Acq_doppler_hz); auto aux = static_cast<float>(d_gnss_synchro->Acq_doppler_hz);
matvar = Mat_VarCreate("acq_doppler_hz", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &aux, 0); matvar = Mat_VarCreate("acq_doppler_hz", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims.data(), &aux, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
aux = static_cast<float>(d_gnss_synchro->Acq_delay_samples); aux = static_cast<float>(d_gnss_synchro->Acq_delay_samples);
matvar = Mat_VarCreate("acq_delay_samples", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &aux, 0); matvar = Mat_VarCreate("acq_delay_samples", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims.data(), &aux, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("test_statistic", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &d_test_statistics, 0); matvar = Mat_VarCreate("test_statistic", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims.data(), &d_test_statistics, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("threshold", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &d_threshold, 0); matvar = Mat_VarCreate("threshold", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims.data(), &d_threshold, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("input_power", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &d_input_power, 0); matvar = Mat_VarCreate("input_power", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims.data(), &d_input_power, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("sample_counter", MAT_C_UINT64, MAT_T_UINT64, 1, dims, &d_sample_counter, 0); matvar = Mat_VarCreate("sample_counter", MAT_C_UINT64, MAT_T_UINT64, 1, dims.data(), &d_sample_counter, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 1, dims, &d_gnss_synchro->PRN, 0); matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 1, dims.data(), &d_gnss_synchro->PRN, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("num_dwells", MAT_C_INT32, MAT_T_INT32, 1, dims, &d_num_noncoherent_integrations_counter, 0); matvar = Mat_VarCreate("num_dwells", MAT_C_INT32, MAT_T_INT32, 1, dims.data(), &d_num_noncoherent_integrations_counter, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
@ -512,18 +513,18 @@ void pcps_acquisition::dump_results(int32_t effective_fft_size)
{ {
dims[0] = static_cast<size_t>(effective_fft_size); dims[0] = static_cast<size_t>(effective_fft_size);
dims[1] = static_cast<size_t>(d_num_doppler_bins_step2); dims[1] = static_cast<size_t>(d_num_doppler_bins_step2);
matvar = Mat_VarCreate("acq_grid_narrow", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, narrow_grid_.memptr(), 0); matvar = Mat_VarCreate("acq_grid_narrow", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), narrow_grid_.memptr(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
dims[0] = static_cast<size_t>(1); dims[0] = static_cast<size_t>(1);
dims[1] = static_cast<size_t>(1); dims[1] = static_cast<size_t>(1);
matvar = Mat_VarCreate("doppler_step_narrow", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &acq_parameters.doppler_step2, 0); matvar = Mat_VarCreate("doppler_step_narrow", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims.data(), &acq_parameters.doppler_step2, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
aux = d_doppler_center_step_two - static_cast<float>(floor(d_num_doppler_bins_step2 / 2.0)) * acq_parameters.doppler_step2; aux = d_doppler_center_step_two - static_cast<float>(floor(d_num_doppler_bins_step2 / 2.0)) * acq_parameters.doppler_step2;
matvar = Mat_VarCreate("doppler_grid_narrow_min", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &aux, 0); matvar = Mat_VarCreate("doppler_grid_narrow_min", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims.data(), &aux, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
} }

View File

@ -49,6 +49,7 @@
#include <volk/volk.h> #include <volk/volk.h>
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <algorithm> // std::rotate, std::fill_n #include <algorithm> // std::rotate, std::fill_n
#include <array>
#include <sstream> #include <sstream>
#if HAS_STD_FILESYSTEM #if HAS_STD_FILESYSTEM
@ -512,7 +513,7 @@ int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items,
{ {
/*! /*!
* TODO: High sensitivity acquisition algorithm: * TODO: High sensitivity acquisition algorithm:
* State Mechine: * State Machine:
* S0. StandBy. If d_active==1 -> S1 * S0. StandBy. If d_active==1 -> S1
* S1. ComputeGrid. Perform the FFT acqusition doppler and delay grid. * S1. ComputeGrid. Perform the FFT acqusition doppler and delay grid.
* Accumulate the search grid matrix (#doppler_bins x #fft_size) * Accumulate the search grid matrix (#doppler_bins x #fft_size)
@ -673,52 +674,52 @@ void pcps_acquisition_fine_doppler_cc::dump_results(int effective_fft_size)
} }
else else
{ {
size_t dims[2] = {static_cast<size_t>(effective_fft_size), static_cast<size_t>(d_num_doppler_points)}; std::array<size_t, 2> dims{static_cast<size_t>(effective_fft_size), static_cast<size_t>(d_num_doppler_points)};
matvar_t *matvar = Mat_VarCreate("acq_grid", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, grid_.memptr(), 0); matvar_t *matvar = Mat_VarCreate("acq_grid", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), grid_.memptr(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
dims[0] = static_cast<size_t>(1); dims[0] = static_cast<size_t>(1);
dims[1] = static_cast<size_t>(1); dims[1] = static_cast<size_t>(1);
matvar = Mat_VarCreate("doppler_max", MAT_C_INT32, MAT_T_INT32, 1, dims, &d_config_doppler_max, 0); matvar = Mat_VarCreate("doppler_max", MAT_C_INT32, MAT_T_INT32, 1, dims.data(), &d_config_doppler_max, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("doppler_step", MAT_C_INT32, MAT_T_INT32, 1, dims, &d_doppler_step, 0); matvar = Mat_VarCreate("doppler_step", MAT_C_INT32, MAT_T_INT32, 1, dims.data(), &d_doppler_step, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("d_positive_acq", MAT_C_INT32, MAT_T_INT32, 1, dims, &d_positive_acq, 0); matvar = Mat_VarCreate("d_positive_acq", MAT_C_INT32, MAT_T_INT32, 1, dims.data(), &d_positive_acq, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
auto aux = static_cast<float>(d_gnss_synchro->Acq_doppler_hz); auto aux = static_cast<float>(d_gnss_synchro->Acq_doppler_hz);
matvar = Mat_VarCreate("acq_doppler_hz", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &aux, 0); matvar = Mat_VarCreate("acq_doppler_hz", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims.data(), &aux, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
aux = static_cast<float>(d_gnss_synchro->Acq_delay_samples); aux = static_cast<float>(d_gnss_synchro->Acq_delay_samples);
matvar = Mat_VarCreate("acq_delay_samples", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &aux, 0); matvar = Mat_VarCreate("acq_delay_samples", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims.data(), &aux, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("test_statistic", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &d_test_statistics, 0); matvar = Mat_VarCreate("test_statistic", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims.data(), &d_test_statistics, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("threshold", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &d_threshold, 0); matvar = Mat_VarCreate("threshold", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims.data(), &d_threshold, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
aux = 0.0; aux = 0.0;
matvar = Mat_VarCreate("input_power", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &aux, 0); matvar = Mat_VarCreate("input_power", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims.data(), &aux, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("sample_counter", MAT_C_UINT64, MAT_T_UINT64, 1, dims, &d_sample_counter, 0); matvar = Mat_VarCreate("sample_counter", MAT_C_UINT64, MAT_T_UINT64, 1, dims.data(), &d_sample_counter, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 1, dims, &d_gnss_synchro->PRN, 0); matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 1, dims.data(), &d_gnss_synchro->PRN, 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);

View File

@ -182,7 +182,7 @@ public:
} }
/*! /*!
* \brief This funciton triggers a HW reset of the FPGA PL. * \brief This function triggers a HW reset of the FPGA PL.
*/ */
void reset_acquisition(void); void reset_acquisition(void);

View File

@ -353,7 +353,7 @@ int pcps_assisted_acquisition_cc::general_work(int noutput_items,
{ {
/*! /*!
* TODO: High sensitivity acquisition algorithm: * TODO: High sensitivity acquisition algorithm:
* State Mechine: * State Machine:
* S0. StandBy. If d_active==1 -> S1 * S0. StandBy. If d_active==1 -> S1
* S1. GetAssist. Define search grid with assistance information. Reset grid matrix -> S2 * S1. GetAssist. Define search grid with assistance information. Reset grid matrix -> S2
* S2. ComputeGrid. Perform the FFT acqusition doppler and delay grid. * S2. ComputeGrid. Perform the FFT acqusition doppler and delay grid.

View File

@ -34,6 +34,7 @@
#include <gnuradio/io_signature.h> #include <gnuradio/io_signature.h>
#include <volk/volk.h> #include <volk/volk.h>
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <array>
#include <cmath> #include <cmath>
#include <exception> #include <exception>
#include <sstream> #include <sstream>
@ -311,26 +312,26 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
case 1: case 1:
{ {
/* initialize acquisition implementing the QuickSync algorithm*/ // initialize acquisition implementing the QuickSync algorithm
//DLOG(INFO) << "START CASE 1"; //DLOG(INFO) << "START CASE 1";
int32_t doppler; int32_t doppler;
uint32_t indext = 0; uint32_t indext = 0;
float magt = 0.0; float magt = 0.0;
const auto* in = reinterpret_cast<const gr_complex*>(input_items[0]); //Get the input samples pointer const auto* in = reinterpret_cast<const gr_complex*>(input_items[0]); // Get the input samples pointer
auto* in_temp = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_samples_per_code * d_folding_factor * sizeof(gr_complex), volk_gnsssdr_get_alignment())); auto* in_temp = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_samples_per_code * d_folding_factor * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
auto* in_temp_folded = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment())); auto* in_temp_folded = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
/*Create a signal to store a signal of size 1ms, to perform correlation // Create a signal to store a signal of size 1ms, to perform correlation
in time. No folding on this data is required*/ // in time. No folding on this data is required
auto* in_1code = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_samples_per_code * sizeof(gr_complex), volk_gnsssdr_get_alignment())); auto* in_1code = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_samples_per_code * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
/*Stores the values of the correlation output between the local code // Stores the values of the correlation output between the local code
and the signal with doppler shift corrected */ // and the signal with doppler shift corrected
auto* corr_output = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_samples_per_code * sizeof(gr_complex), volk_gnsssdr_get_alignment())); auto* corr_output = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_samples_per_code * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
/*Stores a copy of the folded version of the signal.This is used for // Stores a copy of the folded version of the signal.This is used for
the FFT operations in future steps of execution*/ // the FFT operations in future steps of execution*/
// gr_complex in_folded[d_fft_size]; // gr_complex in_folded[d_fft_size];
float fft_normalization_factor = static_cast<float>(d_fft_size) * static_cast<float>(d_fft_size); float fft_normalization_factor = static_cast<float>(d_fft_size) * static_cast<float>(d_fft_size);
@ -354,35 +355,34 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
<< d_samples_per_code * d_folding_factor; << d_samples_per_code * d_folding_factor;
/* 1- Compute the input signal power estimation. This operation is // 1- Compute the input signal power estimation. This operation is
being performed in a signal of size nxp */ // being performed in a signal of size nxp
volk_32fc_magnitude_squared_32f(d_magnitude, in, d_samples_per_code * d_folding_factor); volk_32fc_magnitude_squared_32f(d_magnitude, in, d_samples_per_code * d_folding_factor);
volk_32f_accumulator_s32f(&d_input_power, d_magnitude, d_samples_per_code * d_folding_factor); volk_32f_accumulator_s32f(&d_input_power, d_magnitude, d_samples_per_code * d_folding_factor);
d_input_power /= static_cast<float>(d_samples_per_code * d_folding_factor); d_input_power /= static_cast<float>(d_samples_per_code * d_folding_factor);
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++) for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
{ {
/*Ensure that the signal is going to start with all samples // Ensure that the signal is going to start with all samples
at zero. This is done to avoid over acumulation when performing // at zero. This is done to avoid over acumulation when performing
the folding process to be stored in d_fft_if->get_inbuf()*/ // the folding process to be stored in d_fft_if->get_inbuf()
d_signal_folded = new gr_complex[d_fft_size](); d_signal_folded = new gr_complex[d_fft_size]();
memcpy(d_fft_if->get_inbuf(), d_signal_folded, sizeof(gr_complex) * (d_fft_size)); memcpy(d_fft_if->get_inbuf(), d_signal_folded, sizeof(gr_complex) * (d_fft_size));
/*Doppler search steps and then multiplication of the incoming // Doppler search steps and then multiplication of the incoming
signal with the doppler wipeoffs to eliminate frequency offset // signal with the doppler wipeoffs to eliminate frequency offset
*/
doppler = -static_cast<int32_t>(d_doppler_max) + d_doppler_step * doppler_index; doppler = -static_cast<int32_t>(d_doppler_max) + d_doppler_step * doppler_index;
/*Perform multiplication of the incoming signal with the // Perform multiplication of the incoming signal with the
complex exponential vector. This removes the frequency doppler // complex exponential vector. This removes the frequency doppler
shift offset*/ // shift offset
volk_32fc_x2_multiply_32fc(in_temp, in, volk_32fc_x2_multiply_32fc(in_temp, in,
d_grid_doppler_wipeoffs[doppler_index], d_grid_doppler_wipeoffs[doppler_index],
d_samples_per_code * d_folding_factor); d_samples_per_code * d_folding_factor);
/*Perform folding of the carrier wiped-off incoming signal. Since // Perform folding of the carrier wiped-off incoming signal. Since
superlinear method is being used the folding factor in the // superlinear method is being used the folding factor in the
incoming raw data signal is of d_folding_factor^2*/ // incoming raw data signal is of d_folding_factor^2
for (int32_t i = 0; i < static_cast<int32_t>(d_folding_factor * d_folding_factor); i++) for (int32_t i = 0; i < static_cast<int32_t>(d_folding_factor * d_folding_factor); i++)
{ {
std::transform((in_temp + i * d_fft_size), std::transform((in_temp + i * d_fft_size),
@ -392,28 +392,26 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
std::plus<gr_complex>()); std::plus<gr_complex>());
} }
/* 3- Perform the FFT-based convolution (parallel time search) // 3- Perform the FFT-based convolution (parallel time search)
Compute the FFT of the carrier wiped--off incoming signal*/ // Compute the FFT of the carrier wiped--off incoming signal
d_fft_if->execute(); d_fft_if->execute();
/*Multiply carrier wiped--off, Fourier transformed incoming // Multiply carrier wiped--off, Fourier transformed incoming
signal with the local FFT'd code reference using SIMD // signal with the local FFT'd code reference using SIMD
operations with VOLK library*/ // operations with VOLK library
volk_32fc_x2_multiply_32fc(d_ifft->get_inbuf(), volk_32fc_x2_multiply_32fc(d_ifft->get_inbuf(),
d_fft_if->get_outbuf(), d_fft_codes, d_fft_size); d_fft_if->get_outbuf(), d_fft_codes, d_fft_size);
/* compute the inverse FFT of the aliased signal*/ // compute the inverse FFT of the aliased signal
d_ifft->execute(); d_ifft->execute();
/* Compute the magnitude and get the maximum value with its // Compute the magnitude and get the maximum value with its
index position*/ // index position
volk_32fc_magnitude_squared_32f(d_magnitude_folded, volk_32fc_magnitude_squared_32f(d_magnitude_folded,
d_ifft->get_outbuf(), d_fft_size); d_ifft->get_outbuf(), d_fft_size);
/* Normalize the maximum value to correct the scale factor // Normalize the maximum value to correct the scale factor
introduced by FFTW*/ // introduced by FFTW
//volk_32f_s32f_multiply_32f_a(d_magnitude_folded,d_magnitude_folded,
// (1 / (fft_normalization_factor * fft_normalization_factor)), d_fft_size);
volk_gnsssdr_32f_index_max_32u(&indext, d_magnitude_folded, d_fft_size); volk_gnsssdr_32f_index_max_32u(&indext, d_magnitude_folded, d_fft_size);
magt = d_magnitude_folded[indext] / (fft_normalization_factor * fft_normalization_factor); magt = d_magnitude_folded[indext] / (fft_normalization_factor * fft_normalization_factor);
@ -425,19 +423,18 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
{ {
d_mag = magt; d_mag = magt;
/* In case that d_bit_transition_flag = true, we compare the potentially // In case that d_bit_transition_flag = true, we compare the potentially
new maximum test statistics (d_mag/d_input_power) with the value in // new maximum test statistics (d_mag/d_input_power) with the value in
d_test_statistics. When the second dwell is being processed, the value // d_test_statistics. When the second dwell is being processed, the value
of d_mag/d_input_power could be lower than d_test_statistics (i.e, // of d_mag/d_input_power could be lower than d_test_statistics (i.e,
the maximum test statistics in the previous dwell is greater than // the maximum test statistics in the previous dwell is greater than
current d_mag/d_input_power). Note that d_test_statistics is not // current d_mag/d_input_power). Note that d_test_statistics is not
restarted between consecutive dwells in multidwell operation.*/ // restarted between consecutive dwells in multidwell operation.
if (d_test_statistics < (d_mag / d_input_power) || !d_bit_transition_flag) if (d_test_statistics < (d_mag / d_input_power) || !d_bit_transition_flag)
{ {
uint32_t detected_delay_samples_folded = 0; uint32_t detected_delay_samples_folded = 0;
detected_delay_samples_folded = (indext % d_samples_per_code); detected_delay_samples_folded = (indext % d_samples_per_code);
gr_complex complex_acumulator[100]; std::array<gr_complex, 100> complex_acumulator{};
//gr_complex complex_acumulator[d_folding_factor];
for (int32_t i = 0; i < static_cast<int32_t>(d_folding_factor); i++) for (int32_t i = 0; i < static_cast<int32_t>(d_folding_factor); i++)
{ {
@ -446,16 +443,16 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
for (int32_t i = 0; i < static_cast<int32_t>(d_folding_factor); i++) for (int32_t i = 0; i < static_cast<int32_t>(d_folding_factor); i++)
{ {
/*Copy a signal of 1 code length into suggested buffer. // Copy a signal of 1 code length into suggested buffer.
The copied signal must have doppler effect corrected*/ // The copied signal must have doppler effect corrected*/
memcpy(in_1code, &in_temp[d_possible_delay[i]], memcpy(in_1code, &in_temp[d_possible_delay[i]],
sizeof(gr_complex) * (d_samples_per_code)); sizeof(gr_complex) * (d_samples_per_code));
/*Perform multiplication of the unmodified local // Perform multiplication of the unmodified local
generated code with the incoming signal with doppler // generated code with the incoming signal with doppler
effect corrected and accumulates its value. This // effect corrected and accumulates its value. This
is indeed correlation in time for an specific value // is indeed correlation in time for an specific value
of a shift*/ // of a shift
volk_32fc_x2_multiply_32fc(corr_output, in_1code, d_code, d_samples_per_code); volk_32fc_x2_multiply_32fc(corr_output, in_1code, d_code, d_samples_per_code);
for (int32_t j = 0; j < d_samples_per_code; j++) for (int32_t j = 0; j < d_samples_per_code; j++)
@ -463,28 +460,27 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
complex_acumulator[i] += (corr_output[j]); complex_acumulator[i] += (corr_output[j]);
} }
} }
/*Obtain maximun value of correlation given the possible delay selected */ // Obtain maximum value of correlation given the possible delay selected
volk_32fc_magnitude_squared_32f(d_corr_output_f, complex_acumulator, d_folding_factor); volk_32fc_magnitude_squared_32f(d_corr_output_f, complex_acumulator.data(), d_folding_factor);
volk_gnsssdr_32f_index_max_32u(&indext, d_corr_output_f, d_folding_factor); volk_gnsssdr_32f_index_max_32u(&indext, d_corr_output_f, d_folding_factor);
/*Now save the real code phase in the gnss_syncro block for use in other stages*/ // Now save the real code phase in the gnss_syncro block for use in other stages
d_gnss_synchro->Acq_delay_samples = static_cast<double>(d_possible_delay[indext]); d_gnss_synchro->Acq_delay_samples = static_cast<double>(d_possible_delay[indext]);
d_gnss_synchro->Acq_doppler_hz = static_cast<double>(doppler); d_gnss_synchro->Acq_doppler_hz = static_cast<double>(doppler);
d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter; d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter;
d_gnss_synchro->Acq_doppler_step = d_doppler_step; d_gnss_synchro->Acq_doppler_step = d_doppler_step;
/* 5- Compute the test statistics and compare to the threshold d_test_statistics = 2 * d_fft_size * d_mag / d_input_power;*/ // 5- Compute the test statistics and compare to the threshold d_test_statistics = 2 * d_fft_size * d_mag / d_input_power;
d_test_statistics = d_mag / d_input_power; d_test_statistics = d_mag / d_input_power;
//delete complex_acumulator;
} }
} }
// Record results to file if required // Record results to file if required
if (d_dump) if (d_dump)
{ {
/*Since QuickSYnc performs a folded correlation in frequency by means // Since QuickSYnc performs a folded correlation in frequency by means
of the FFT, it is essential to also keep the values obtained from the // of the FFT, it is essential to also keep the values obtained from the
possible delay to show how it is maximize*/ // possible delay to show how it is maximize
std::stringstream filename; std::stringstream filename;
std::streamsize n = sizeof(float) * (d_fft_size); // complex file write std::streamsize n = sizeof(float) * (d_fft_size); // complex file write
filename.str(""); filename.str("");
@ -492,7 +488,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
<< "_" << d_gnss_synchro->Signal << "_sat_" << "_" << d_gnss_synchro->Signal << "_sat_"
<< d_gnss_synchro->PRN << "_doppler_" << doppler << ".dat"; << d_gnss_synchro->PRN << "_doppler_" << doppler << ".dat";
d_dump_file.open(filename.str().c_str(), std::ios::out | std::ios::binary); d_dump_file.open(filename.str().c_str(), std::ios::out | std::ios::binary);
d_dump_file.write(reinterpret_cast<char*>(d_magnitude_folded), n); //write directly |abs(x)|^2 in this Doppler bin? d_dump_file.write(reinterpret_cast<char*>(d_magnitude_folded), n); // write directly |abs(x)|^2 in this Doppler bin?
d_dump_file.close(); d_dump_file.close();
} }
} }

View File

@ -1,7 +1,7 @@
/*! /*!
* \file acq_conf.cc * \file acq_conf.cc
* \brief Class that contains all the configuration parameters for generic * \brief Class that contains all the configuration parameters for generic
* acquisition block based on the PCPS algoritm. * acquisition block based on the PCPS algorithm.
* \author Carles Fernandez, 2018. cfernandez(at)cttc.es * \author Carles Fernandez, 2018. cfernandez(at)cttc.es
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------

View File

@ -1,7 +1,7 @@
/*! /*!
* \file acq_conf.h * \file acq_conf.h
* \brief Class that contains all the configuration parameters for generic * \brief Class that contains all the configuration parameters for generic
* acquisition block based on the PCPS algoritm. * acquisition block based on the PCPS algorithm.
* \author Carles Fernandez, 2018. cfernandez(at)cttc.es * \author Carles Fernandez, 2018. cfernandez(at)cttc.es
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------

View File

@ -121,7 +121,7 @@ private:
int32_t d_fd; // driver descriptor int32_t d_fd; // driver descriptor
volatile uint32_t *d_map_base; // driver memory map volatile uint32_t *d_map_base; // driver memory map
uint32_t *d_all_fft_codes; // memory that contains all the code ffts uint32_t *d_all_fft_codes; // memory that contains all the code ffts
uint32_t d_vector_length; // number of samples incluing padding and number of ms uint32_t d_vector_length; // number of samples including padding and number of ms
uint32_t d_excludelimit; uint32_t d_excludelimit;
uint32_t d_nsamples_total; // number of samples including padding uint32_t d_nsamples_total; // number of samples including padding
uint32_t d_nsamples; // number of samples not including padding uint32_t d_nsamples; // number of samples not including padding

View File

@ -37,7 +37,6 @@
#include "telemetry_decoder_interface.h" #include "telemetry_decoder_interface.h"
#include "tracking_interface.h" #include "tracking_interface.h"
#include <glog/logging.h> #include <glog/logging.h>
#include <cstring> // for memcpy
#include <utility> // for std::move #include <utility> // for std::move
@ -209,9 +208,9 @@ void Channel::set_signal(const Gnss_Signal& gnss_signal)
std::lock_guard<std::mutex> lk(mx); std::lock_guard<std::mutex> lk(mx);
gnss_signal_ = gnss_signal; gnss_signal_ = gnss_signal;
std::string str_aux = gnss_signal_.get_signal_str(); std::string str_aux = gnss_signal_.get_signal_str();
const char* str = str_aux.c_str(); // get a C style null terminated string gnss_synchro_.Signal[0] = str_aux[0];
std::memcpy(static_cast<void*>(gnss_synchro_.Signal), str, 3); // copy string into synchro char array: 2 char + null gnss_synchro_.Signal[1] = str_aux[1];
gnss_synchro_.Signal[2] = 0; // make sure that string length is only two characters gnss_synchro_.Signal[2] = '\0'; // make sure that string length is only two characters
gnss_synchro_.PRN = gnss_signal_.get_satellite().get_PRN(); gnss_synchro_.PRN = gnss_signal_.get_satellite().get_PRN();
gnss_synchro_.System = gnss_signal_.get_satellite().get_system_short().c_str()[0]; gnss_synchro_.System = gnss_signal_.get_satellite().get_system_short().c_str()[0];
acq_->set_local_code(); acq_->set_local_code();

View File

@ -31,51 +31,50 @@
*/ */
#include "beidou_b1i_signal_processing.h" #include "beidou_b1i_signal_processing.h"
#include <array>
#include <bitset>
#include <string>
auto auxCeil = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); }; auto auxCeil = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); };
void beidou_b1i_code_gen_int(gsl::span<int32_t> _dest, int32_t _prn, uint32_t _chip_shift) void beidou_b1i_code_gen_int(gsl::span<int32_t> _dest, int32_t _prn, uint32_t _chip_shift)
{ {
const uint32_t _code_length = 2046; const uint32_t _code_length = 2046;
bool G1[_code_length]; std::bitset<_code_length> G1{};
bool G2[_code_length]; std::bitset<_code_length> G2{};
bool G1_register[11] = {false, true, false, true, false, true, false, true, false, true, false};
bool G2_register[11] = {false, true, false, true, false, true, false, true, false, true, false}; std::bitset<11> G1_register(std::string("01010101010"));
std::bitset<11> G2_register(std::string("01010101010"));
bool feedback1, feedback2; bool feedback1, feedback2;
bool aux; bool aux;
uint32_t lcv, lcv2; uint32_t lcv, lcv2;
uint32_t delay; uint32_t delay;
int32_t prn_idx; int32_t prn_idx;
/* G2 Delays as defined in GPS-ISD-200D */
const int32_t delays[33] = {712 /*PRN1*/, 1581, 1414, 1550, 581, 771, 1311, 1043, 1549, 359, 710, 1579, 1548, 1103, 579, 769, 358, 709, 1411, 1547, const std::array<int32_t, 33> delays = {712 /*PRN1*/, 1581, 1414, 1550, 581, 771, 1311, 1043, 1549, 359, 710, 1579, 1548, 1103, 579, 769, 358, 709, 1411, 1547,
1102, 578, 357, 1577, 1410, 1546, 1101, 707, 1576, 1409, 1545, 354 /*PRN32*/, 1102, 578, 357, 1577, 1410, 1546, 1101, 707, 1576, 1409, 1545, 354 /*PRN32*/,
705}; 705};
const int32_t phase1[37] = {1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 8, 8, 8, 9, 9, 10}; const std::array<int32_t, 37> phase1 = {1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 8, 8, 8, 9, 9, 10};
const int32_t phase2[37] = {3, 4, 5, 6, 8, 9, 10, 11, 7, 4, 5, 6, 8, 9, 10, 11, 5, 6, 8, 9, 10, 11, 6, 8, 9, 10, 11, 8, 9, 10, 11, 9, 10, 11, 10, 11, 11}; const std::array<int32_t, 37> phase2 = {3, 4, 5, 6, 8, 9, 10, 11, 7, 4, 5, 6, 8, 9, 10, 11, 5, 6, 8, 9, 10, 11, 6, 8, 9, 10, 11, 8, 9, 10, 11, 9, 10, 11, 10, 11, 11};
// compute delay array index for given PRN number // compute delay array index for given PRN number
prn_idx = _prn - 1; prn_idx = _prn - 1;
/* A simple error check */ // A simple error check
if ((prn_idx < 0) || (prn_idx > 32)) if ((prn_idx < 0) || (prn_idx > 32))
{ {
return; return;
} }
/*for (lcv = 0; lcv < 11; lcv++) // Generate G1 & G2 Register
{
G1_register[lcv] = 1;
G2_register[lcv] = 1;
}*/
/* Generate G1 & G2 Register */
for (lcv = 0; lcv < _code_length; lcv++) for (lcv = 0; lcv < _code_length; lcv++)
{ {
G1[lcv] = G1_register[0]; G1[lcv] = G1_register[0];
G2[lcv] = G2_register[-(phase1[prn_idx] - 11)] ^ G2_register[-(phase2[prn_idx] - 11)]; G2[lcv] = G2_register[-(phase1[prn_idx] - 11)] ^ G2_register[-(phase2[prn_idx] - 11)];
feedback1 = (G1_register[0] + G1_register[1] + G1_register[2] + G1_register[3] + G1_register[4] + G1_register[10]) & 0x1; feedback1 = G1_register[0] xor G1_register[1] xor G1_register[2] xor G1_register[3] xor G1_register[4] xor G1_register[10];
feedback2 = (G2_register[0] + G2_register[2] + G2_register[3] + G2_register[6] + G2_register[7] + G2_register[8] + G2_register[9] + G2_register[10]) & 0x1; feedback2 = G2_register[0] xor G2_register[2] xor G2_register[3] xor G2_register[6] xor G2_register[7] xor G2_register[8] xor G2_register[9] xor G2_register[10];
for (lcv2 = 0; lcv2 < 10; lcv2++) for (lcv2 = 0; lcv2 < 10; lcv2++)
{ {
@ -87,12 +86,12 @@ void beidou_b1i_code_gen_int(gsl::span<int32_t> _dest, int32_t _prn, uint32_t _c
G2_register[10] = feedback2; G2_register[10] = feedback2;
} }
/* Set the delay */ // Set the delay
delay = _code_length - delays[prn_idx] * 0; //********************************** delay = _code_length - delays[prn_idx] * 0; //**********************************
delay += _chip_shift; delay += _chip_shift;
delay %= _code_length; delay %= _code_length;
/* Generate PRN from G1 and G2 Registers */ // Generate PRN from G1 and G2 Registers
for (lcv = 0; lcv < _code_length; lcv++) for (lcv = 0; lcv < _code_length; lcv++)
{ {
aux = G1[(lcv + _chip_shift) % _code_length] ^ G2[delay]; aux = G1[(lcv + _chip_shift) % _code_length] ^ G2[delay];
@ -106,7 +105,6 @@ void beidou_b1i_code_gen_int(gsl::span<int32_t> _dest, int32_t _prn, uint32_t _c
} }
delay++; delay++;
//std::cout << _dest[lcv] << " ";
delay %= _code_length; delay %= _code_length;
} }
} }
@ -114,10 +112,10 @@ void beidou_b1i_code_gen_int(gsl::span<int32_t> _dest, int32_t _prn, uint32_t _c
void beidou_b1i_code_gen_float(gsl::span<float> _dest, int32_t _prn, uint32_t _chip_shift) void beidou_b1i_code_gen_float(gsl::span<float> _dest, int32_t _prn, uint32_t _chip_shift)
{ {
uint32_t _code_length = 2046; const uint32_t _code_length = 2046;
int32_t b1i_code_int[_code_length]; std::array<int32_t, _code_length> b1i_code_int{};
beidou_b1i_code_gen_int(gsl::span<int32_t>(b1i_code_int, _code_length), _prn, _chip_shift); beidou_b1i_code_gen_int(gsl::span<int32_t>(b1i_code_int.data(), _code_length), _prn, _chip_shift);
for (uint32_t ii = 0; ii < _code_length; ++ii) for (uint32_t ii = 0; ii < _code_length; ++ii)
{ {
@ -128,10 +126,10 @@ void beidou_b1i_code_gen_float(gsl::span<float> _dest, int32_t _prn, uint32_t _c
void beidou_b1i_code_gen_complex(gsl::span<std::complex<float>> _dest, int32_t _prn, uint32_t _chip_shift) void beidou_b1i_code_gen_complex(gsl::span<std::complex<float>> _dest, int32_t _prn, uint32_t _chip_shift)
{ {
uint32_t _code_length = 2046; const uint32_t _code_length = 2046;
int32_t b1i_code_int[_code_length]; std::array<int32_t, _code_length> b1i_code_int{};
beidou_b1i_code_gen_int(gsl::span<int32_t>(b1i_code_int, _code_length), _prn, _chip_shift); beidou_b1i_code_gen_int(gsl::span<int32_t>(b1i_code_int.data(), _code_length), _prn, _chip_shift);
for (uint32_t ii = 0; ii < _code_length; ++ii) for (uint32_t ii = 0; ii < _code_length; ++ii)
{ {
@ -146,21 +144,22 @@ void beidou_b1i_code_gen_complex(gsl::span<std::complex<float>> _dest, int32_t _
void beidou_b1i_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift) void beidou_b1i_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift)
{ {
// This function is based on the GNU software GPS for MATLAB in the Kay Borre book // This function is based on the GNU software GPS for MATLAB in the Kay Borre book
std::complex<float> _code[2046]; std::array<std::complex<float>, 2046> _code{};
int32_t _samplesPerCode, _codeValueIndex; int32_t _samplesPerCode, _codeValueIndex;
float _ts; float _ts;
float _tc; float _tc;
float aux; float aux;
const int32_t _codeFreqBasis = 2046000; //Hz const int32_t _codeFreqBasis = 2046000; // Hz
const int32_t _codeLength = 2046; const int32_t _codeLength = 2046;
//--- Find number of samples per spreading code ---------------------------- //--- Find number of samples per spreading code ----------------------------
_samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / static_cast<double>(_codeFreqBasis / _codeLength)); _samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / static_cast<double>(_codeFreqBasis / _codeLength));
//--- Find time constants -------------------------------------------------- //--- Find time constants --------------------------------------------------
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec _ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
_tc = 1.0 / static_cast<float>(_codeFreqBasis); // C/A chip period in sec _tc = 1.0 / static_cast<float>(_codeFreqBasis); // C/A chip period in sec
beidou_b1i_code_gen_complex(_code, _prn, _chip_shift); //generate C/A code 1 sample per chip
beidou_b1i_code_gen_complex(_code, _prn, _chip_shift); // generate C/A code 1 sample per chip
for (int32_t i = 0; i < _samplesPerCode; i++) for (int32_t i = 0; i < _samplesPerCode; i++)
{ {

View File

@ -31,85 +31,91 @@
*/ */
#include "beidou_b3i_signal_processing.h" #include "beidou_b3i_signal_processing.h"
#include <array>
#include <bitset>
#include <string>
auto auxCeil = [](float x) { return static_cast<int>(static_cast<long>((x) + 1)); }; auto auxCeil = [](float x) { return static_cast<int>(static_cast<long>((x) + 1)); };
void beidou_b3i_code_gen_int(gsl::span<int> _dest, signed int _prn, unsigned int _chip_shift) void beidou_b3i_code_gen_int(gsl::span<int> _dest, signed int _prn, unsigned int _chip_shift)
{ {
const unsigned int _code_length = 10230; const unsigned int _code_length = 10230;
bool G1[_code_length]; std::bitset<_code_length> G1{};
bool G2[_code_length]; std::bitset<_code_length> G2{};
std::array<bool, 13> G1_register = {{true, true, true, true, true, true, true, true, true, true, true, true, true}}; auto G1_register = std::move(std::bitset<13>{}.set()); // All true
std::array<bool, 13> G2_register = {{true, true, true, true, true, true, true, true, true, true, true, true, true}}; auto G2_register = std::move(std::bitset<13>{}.set()); // All true
std::array<bool, 13> G1_register_reset = {{false, false, true, true, true, true, true, true, true, true, true, true, true}}; auto G1_register_reset = std::move(std::bitset<13>{}.set());
G1_register_reset.reset(0);
G1_register_reset.reset(1); // {false, false, true, true, true, true, true, true, true, true, true, true, true};
bool feedback1, feedback2, aux; bool feedback1, feedback2, aux;
uint32_t lcv, lcv2, delay; uint32_t lcv, lcv2, delay;
int32_t prn_idx = _prn - 1; int32_t prn_idx = _prn - 1;
std::array<std::array<bool, 13>, 63> G2_register_shifted = const std::array<std::bitset<13>, 63> G2_register_shifted =
{{{{true, false, true, false, true, true, true, true, true, true, true, true, true}}, {std::bitset<13>(std::string("1010111111111")),
{{true, true, true, true, false, false, false, true, false, true, false, true, true}}, std::bitset<13>(std::string("1111000101011")),
{{true, false, true, true, true, true, false, false, false, true, false, true, false}}, std::bitset<13>(std::string("1011110001010")),
{{true, true, true, true, true, true, true, true, true, true, false, true, true}}, std::bitset<13>(std::string("1111111111011")),
{{true, true, false, false, true, false, false, false, true, true, true, true, true}}, std::bitset<13>(std::string("1100100011111")),
{{true, false, false, true, false, false, true, true, false, false, true, false, false}}, std::bitset<13>(std::string("1001001100100")),
{{true, true, true, true, true, true, true, false, true, false, false, true, false}}, std::bitset<13>(std::string("1111111010010")),
{{true, true, true, false, true, true, true, true, true, true, true, false, true}}, std::bitset<13>(std::string("1110111111101")),
{{true, false, true, false, false, false, false, false, false, false, false, true, false}}, std::bitset<13>(std::string("1010000000010")),
{{false, false, true, false, false, false, false, false, true, true, false, true, true}}, std::bitset<13>(std::string("0010000011011")),
{{true, true, true, false, true, false, true, true, true, false, false, false, false}}, std::bitset<13>(std::string("1110101110000")),
{{false, false, true, false, true, true, false, false, true, true, true, true, false}}, std::bitset<13>(std::string("0010110011110")),
{{false, true, true, false, false, true, false, false, true, false, true, false, true}}, std::bitset<13>(std::string("0110010010101")),
{{false, true, true, true, false, false, false, true, false, false, true, true, false}}, std::bitset<13>(std::string("0111000100110")),
{{true, false, false, false, true, true, false, false, false, true, false, false, true}}, std::bitset<13>(std::string("1000110001001")),
{{true, true, true, false, false, false, true, true, true, true, true, false, false}}, std::bitset<13>(std::string("1110001111100")),
{{false, false, true, false, false, true, true, false, false, false, true, false, true}}, std::bitset<13>(std::string("0010011000101")),
{{false, false, false, false, false, true, true, true, false, true, true, false, false}}, std::bitset<13>(std::string("0000011101100")),
{{true, false, false, false, true, false, true, false, true, false, true, true, true}}, std::bitset<13>(std::string("1000101010111")),
{{false, false, false, true, false, true, true, false, true, true, true, true, false}}, std::bitset<13>(std::string("0001011011110")),
{{false, false, true, false, false, false, false, true, false, true, true, false, true}}, std::bitset<13>(std::string("0010000101101")),
{{false, false, true, false, true, true, false, false, false, true, false, true, false}}, std::bitset<13>(std::string("0010110001010")),
{{false, false, false, true, false, true, true, false, false, true, true, true, true}}, std::bitset<13>(std::string("0001011001111")),
{{false, false, true, true, false, false, true, true, false, false, false, true, false}}, std::bitset<13>(std::string("0011001100010")),
{{false, false, true, true, true, false, true, false, false, true, false, false, false}}, std::bitset<13>(std::string("0011101001000")),
{{false, true, false, false, true, false, false, true, false, true, false, false, true}}, std::bitset<13>(std::string("0100100101001")),
{{true, false, true, true, false, true, true, false, true, false, false, true, true}}, std::bitset<13>(std::string("1011011010011")),
{{true, false, true, false, true, true, true, true, false, false, false, true, false}}, std::bitset<13>(std::string("1010111100010")),
{{false, false, false, true, false, true, true, true, true, false, true, false, true}}, std::bitset<13>(std::string("0001011110101")),
{{false, true, true, true, true, true, true, true, true, true, true, true, true}}, std::bitset<13>(std::string("0111111111111")),
{{false, true, true, false, true, true, false, false, false, true, true, true, true}}, std::bitset<13>(std::string("0110110001111")),
{{true, false, true, false, true, true, false, false, false, true, false, false, true}}, std::bitset<13>(std::string("1010110001001")),
{{true, false, false, true, false, true, false, true, false, true, false, true, true}}, std::bitset<13>(std::string("1001010101011")),
{{true, true, false, false, true, true, false, true, false, false, true, false, true}}, std::bitset<13>(std::string("1100110100101")),
{{true, true, false, true, false, false, true, false, true, true, true, false, true}}, std::bitset<13>(std::string("1101001011101")),
{{true, true, true, true, true, false, true, true, true, false, true, false, false}}, std::bitset<13>(std::string("1111101110100")),
{{false, false, true, false, true, false, true, true, false, false, true, true, true}}, std::bitset<13>(std::string("0010101100111")),
{{true, true, true, false, true, false, false, false, true, false, false, false, false}}, std::bitset<13>(std::string("1110100010000")),
{{true, true, false, true, true, true, false, false, true, false, false, false, false}}, std::bitset<13>(std::string("1101110010000")),
{{true, true, false, true, false, true, true, false, false, true, true, true, false}}, std::bitset<13>(std::string("1101011001110")),
{{true, false, false, false, false, false, false, true, true, false, true, false, false}}, std::bitset<13>(std::string("1000000110100")),
{{false, true, false, true, true, true, true, false, true, true, false, false, true}}, std::bitset<13>(std::string("0101111011001")),
{{false, true, true, false, true, true, false, true, true, true, true, false, false}}, std::bitset<13>(std::string("0110110111100")),
{{true, true, false, true, false, false, true, true, true, false, false, false, true}}, std::bitset<13>(std::string("1101001110001")),
{{false, false, true, true, true, false, false, true, false, false, false, true, false}}, std::bitset<13>(std::string("0011100100010")),
{{false, true, false, true, false, true, true, false, false, false, true, false, true}}, std::bitset<13>(std::string("0101011000101")),
{{true, false, false, true, true, true, true, true, false, false, true, true, false}}, std::bitset<13>(std::string("1001111100110")),
{{true, true, true, true, true, false, true, false, false, true, false, false, false}}, std::bitset<13>(std::string("1111101001000")),
{{false, false, false, false, true, false, true, false, false, true, false, false, true}}, std::bitset<13>(std::string("0000101001001")),
{{true, false, false, false, false, true, false, true, false, true, true, false, false}}, std::bitset<13>(std::string("1000010101100")),
{{true, true, true, true, false, false, true, false, false, true, true, false, false}}, std::bitset<13>(std::string("1111001001100")),
{{false, true, false, false, true, true, false, false, false, true, true, true, true}}, std::bitset<13>(std::string("0100110001111")),
{{false, false, false, false, false, false, false, false, true, true, false, false, false}}, std::bitset<13>(std::string("0000000011000")),
{{true, false, false, false, false, false, false, false, false, false, true, false, false}}, std::bitset<13>(std::string("1000000000100")),
{{false, false, true, true, false, true, false, true, false, false, true, true, false}}, std::bitset<13>(std::string("0011010100110")),
{{true, false, true, true, false, false, true, false, false, false, true, true, false}}, std::bitset<13>(std::string("1011001000110")),
{{false, true, true, true, false, false, true, true, true, true, false, false, false}}, std::bitset<13>(std::string("0111001111000")),
{{false, false, true, false, true, true, true, false, false, true, false, true, false}}, std::bitset<13>(std::string("0010111001010")),
{{true, true, false, false, true, true, true, true, true, false, true, true, false}}, std::bitset<13>(std::string("1100111110110")),
{{true, false, false, true, false, false, true, false, false, false, true, false, true}}, std::bitset<13>(std::string("1001001000101")),
{{false, true, true, true, false, false, false, true, false, false, false, false, false}}, std::bitset<13>(std::string("0111000100000")),
{{false, false, true, true, false, false, true, false, false, false, false, true, false}}, std::bitset<13>(std::string("0011001000010")),
{{false, false, true, false, false, false, true, false, false, true, true, true, false}}}}; std::bitset<13>(std::string("0010001001110"))};
// A simple error check // A simple error check
if ((prn_idx < 0) || (prn_idx > 63)) if ((prn_idx < 0) || (prn_idx > 63))
@ -119,7 +125,6 @@ void beidou_b3i_code_gen_int(gsl::span<int> _dest, signed int _prn, unsigned int
// Assign shifted G2 register based on prn number // Assign shifted G2 register based on prn number
G2_register = G2_register_shifted[prn_idx]; G2_register = G2_register_shifted[prn_idx];
std::reverse(G2_register.begin(), G2_register.end());
// Generate G1 and G2 Register // Generate G1 and G2 Register
for (lcv = 0; lcv < _code_length; lcv++) for (lcv = 0; lcv < _code_length; lcv++)
@ -127,11 +132,9 @@ void beidou_b3i_code_gen_int(gsl::span<int> _dest, signed int _prn, unsigned int
G1[lcv] = G1_register[0]; G1[lcv] = G1_register[0];
G2[lcv] = G2_register[0]; G2[lcv] = G2_register[0];
//feedback1 = (test_G1_register[0]+test_G1_register[2]+test_G1_register[3]+test_G1_register[12]) & 0x1; feedback1 = G1_register[0] xor G1_register[9] xor G1_register[10] xor G1_register[12];
feedback1 = (G1_register[0] + G1_register[9] + G1_register[10] + G1_register[12]) & 0x01; feedback2 = G2_register[0] xor G2_register[1] xor G2_register[3] xor G2_register[4] xor
feedback2 = (G2_register[0] + G2_register[1] + G2_register[3] + G2_register[4] + G2_register[6] xor G2_register[7] xor G2_register[8] xor G2_register[12];
G2_register[6] + G2_register[7] + G2_register[8] + G2_register[12]) &
0x01;
for (lcv2 = 0; lcv2 < 12; lcv2++) for (lcv2 = 0; lcv2 < 12; lcv2++)
{ {
@ -145,7 +148,7 @@ void beidou_b3i_code_gen_int(gsl::span<int> _dest, signed int _prn, unsigned int
// Reset G1 register if sequence found // Reset G1 register if sequence found
if (G1_register == G1_register_reset) if (G1_register == G1_register_reset)
{ {
G1_register = {{true, true, true, true, true, true, true, true, true, true, true, true, true}}; G1_register = std::move(std::bitset<13>{}.set()); // All true
} }
} }
@ -153,10 +156,10 @@ void beidou_b3i_code_gen_int(gsl::span<int> _dest, signed int _prn, unsigned int
delay += _chip_shift; delay += _chip_shift;
delay %= _code_length; delay %= _code_length;
/* Generate PRN from G1 and G2 Registers */ // Generate PRN from G1 and G2 Registers
for (lcv = 0; lcv < _code_length; lcv++) for (lcv = 0; lcv < _code_length; lcv++)
{ {
aux = (G1[(lcv + _chip_shift) % _code_length] + G2[delay]) & 0x01; aux = G1[(lcv + _chip_shift) % _code_length] xor G2[delay];
if (aux == true) if (aux == true)
{ {
_dest[lcv] = 1; _dest[lcv] = 1;
@ -174,8 +177,8 @@ void beidou_b3i_code_gen_int(gsl::span<int> _dest, signed int _prn, unsigned int
void beidou_b3i_code_gen_float(gsl::span<float> _dest, signed int _prn, unsigned int _chip_shift) void beidou_b3i_code_gen_float(gsl::span<float> _dest, signed int _prn, unsigned int _chip_shift)
{ {
unsigned int _code_length = 10230; const unsigned int _code_length = 10230;
int b3i_code_int[10230]; std::array<int, _code_length> b3i_code_int{};
beidou_b3i_code_gen_int(b3i_code_int, _prn, _chip_shift); beidou_b3i_code_gen_int(b3i_code_int, _prn, _chip_shift);
@ -188,8 +191,8 @@ void beidou_b3i_code_gen_float(gsl::span<float> _dest, signed int _prn, unsigned
void beidou_b3i_code_gen_complex(gsl::span<std::complex<float>> _dest, signed int _prn, unsigned int _chip_shift) void beidou_b3i_code_gen_complex(gsl::span<std::complex<float>> _dest, signed int _prn, unsigned int _chip_shift)
{ {
unsigned int _code_length = 10230; const unsigned int _code_length = 10230;
int b3i_code_int[10230]; std::array<int, _code_length> b3i_code_int{};
beidou_b3i_code_gen_int(b3i_code_int, _prn, _chip_shift); beidou_b3i_code_gen_int(b3i_code_int, _prn, _chip_shift);
@ -203,12 +206,12 @@ void beidou_b3i_code_gen_complex(gsl::span<std::complex<float>> _dest, signed in
void beidou_b3i_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, unsigned int _prn, int _fs, unsigned int _chip_shift) void beidou_b3i_code_gen_complex_sampled(gsl::span<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 // This function is based on the GNU software GPS for MATLAB in the Kay Borre book
std::complex<float> _code[10230]; std::array<std::complex<float>, 10230> _code{};
signed int _samplesPerCode, _codeValueIndex; signed int _samplesPerCode, _codeValueIndex;
float _ts; float _ts;
float _tc; float _tc;
float aux; float aux;
const signed int _codeFreqBasis = 10230000; //Hz const signed int _codeFreqBasis = 10230000; // Hz
const signed int _codeLength = 10230; const signed int _codeLength = 10230;
//--- Find number of samples per spreading code ---------------------------- //--- Find number of samples per spreading code ----------------------------
@ -217,7 +220,7 @@ void beidou_b3i_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, u
//--- Find time constants -------------------------------------------------- //--- Find time constants --------------------------------------------------
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec _ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
_tc = 1.0 / static_cast<float>(_codeFreqBasis); // C/A chip 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 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++) for (signed int i = 0; i < _samplesPerCode; i++)
{ {

View File

@ -34,6 +34,7 @@
#include "Galileo_E1.h" #include "Galileo_E1.h"
#include "gnss_signal_processing.h" #include "gnss_signal_processing.h"
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <array>
#include <memory> #include <memory>
#include <string> #include <string>
@ -110,8 +111,8 @@ void galileo_e1_code_gen_sinboc11_float(gsl::span<float> _dest, const std::array
{ {
std::string _galileo_signal = _Signal.data(); std::string _galileo_signal = _Signal.data();
const auto _codeLength = static_cast<uint32_t>(GALILEO_E1_B_CODE_LENGTH_CHIPS); const auto _codeLength = static_cast<uint32_t>(GALILEO_E1_B_CODE_LENGTH_CHIPS);
int32_t primary_code_E1_chips[4092]; // _codeLength not accepted by Clang std::array<int32_t, 4092> primary_code_E1_chips{}; // _codeLength not accepted by Clang
galileo_e1_code_gen_int(primary_code_E1_chips, _Signal, _prn); //generate Galileo E1 code, 1 sample per chip galileo_e1_code_gen_int(gsl::span<int32_t>(primary_code_E1_chips.data(), 4092), _Signal, _prn); //generate Galileo E1 code, 1 sample per chip
for (uint32_t i = 0; i < _codeLength; i++) for (uint32_t i = 0; i < _codeLength; i++)
{ {
_dest[2 * i] = static_cast<float>(primary_code_E1_chips[i]); _dest[2 * i] = static_cast<float>(primary_code_E1_chips[i]);
@ -127,13 +128,13 @@ void galileo_e1_gen_float(gsl::span<float> _dest, gsl::span<int> _prn, const std
const float alpha = sqrt(10.0 / 11.0); const float alpha = sqrt(10.0 / 11.0);
const float beta = sqrt(1.0 / 11.0); const float beta = sqrt(1.0 / 11.0);
int32_t sinboc_11[12 * 4092] = {0}; // _codeLength not accepted by Clang std::array<int32_t, 12 * 4092> sinboc_11{};
int32_t sinboc_61[12 * 4092] = {0}; std::array<int32_t, 12 * 4092> sinboc_61{};
gsl::span<int32_t> sinboc_11_(sinboc_11, _codeLength); gsl::span<int32_t> sinboc_11_(sinboc_11.data(), _codeLength);
gsl::span<int32_t> sinboc_61_(sinboc_61, _codeLength); gsl::span<int32_t> sinboc_61_(sinboc_61.data(), _codeLength);
galileo_e1_sinboc_11_gen_int(sinboc_11_, _prn); //generate sinboc(1,1) 12 samples per chip galileo_e1_sinboc_11_gen_int(sinboc_11_, _prn); // generate sinboc(1,1) 12 samples per chip
galileo_e1_sinboc_61_gen_int(sinboc_61_, _prn); //generate sinboc(6,1) 12 samples per chip galileo_e1_sinboc_61_gen_int(sinboc_61_, _prn); // generate sinboc(6,1) 12 samples per chip
if (_galileo_signal.rfind("1B") != std::string::npos && _galileo_signal.length() >= 2) if (_galileo_signal.rfind("1B") != std::string::npos && _galileo_signal.length() >= 2)
{ {

View File

@ -35,6 +35,7 @@
#include "Galileo_E5a.h" #include "Galileo_E5a.h"
#include "gnss_signal_processing.h" #include "gnss_signal_processing.h"
#include <gnuradio/gr_complex.h> #include <gnuradio/gr_complex.h>
#include <array>
#include <memory> #include <memory>
@ -42,7 +43,7 @@ void galileo_e5_a_code_gen_complex_primary(gsl::span<std::complex<float>> _dest,
{ {
uint32_t prn = _prn - 1; uint32_t prn = _prn - 1;
uint32_t index = 0; uint32_t index = 0;
int32_t a[4]; std::array<int32_t, 4> a{};
if ((_prn < 1) || (_prn > 50)) if ((_prn < 1) || (_prn > 50))
{ {
return; return;
@ -81,7 +82,7 @@ void galileo_e5_a_code_gen_complex_primary(gsl::span<std::complex<float>> _dest,
} }
else if (_Signal[0] == '5' && _Signal[1] == 'X') else if (_Signal[0] == '5' && _Signal[1] == 'X')
{ {
int32_t b[4]; std::array<int32_t, 4> b{};
for (size_t i = 0; i < GALILEO_E5A_I_PRIMARY_CODE[prn].length() - 1; i++) for (size_t i = 0; i < GALILEO_E5A_I_PRIMARY_CODE[prn].length() - 1; i++)
{ {
hex_to_binary_converter(a, GALILEO_E5A_I_PRIMARY_CODE[prn].at(i)); hex_to_binary_converter(a, GALILEO_E5A_I_PRIMARY_CODE[prn].at(i));

View File

@ -30,6 +30,7 @@
*/ */
#include "geofunctions.h" #include "geofunctions.h"
#include <array>
#include <cmath> // for sin, cos, sqrt, abs, pow #include <cmath> // for sin, cos, sqrt, abs, pow
const double STRP_PI = 3.1415926535898; // Pi as defined in IS-GPS-200E const double STRP_PI = 3.1415926535898; // Pi as defined in IS-GPS-200E
@ -302,7 +303,9 @@ double mstokph(double MetersPerSeconds)
arma::vec CTM_to_Euler(const arma::mat &C) arma::vec CTM_to_Euler(const arma::mat &C)
{ {
// Calculate Euler angles using (2.23) // Calculate Euler angles using (2.23)
arma::mat CTM(C); arma::mat CTM = {{C(0, 0), C(0, 1), C(0, 2)},
{C(1, 0), C(1, 1), C(1, 2)},
{C(2, 0), C(2, 1), C(2, 2)}};
arma::vec eul = arma::zeros(3, 1); arma::vec eul = arma::zeros(3, 1);
eul(0) = atan2(CTM(1, 2), CTM(2, 2)); // roll eul(0) = atan2(CTM(1, 2), CTM(2, 2)); // roll
if (CTM(0, 2) < -1.0) if (CTM(0, 2) < -1.0)
@ -348,8 +351,8 @@ arma::mat Euler_to_CTM(const arma::vec &eul)
arma::vec cart2geo(const arma::vec &XYZ, int elipsoid_selection) arma::vec cart2geo(const arma::vec &XYZ, int elipsoid_selection)
{ {
const double a[5] = {6378388.0, 6378160.0, 6378135.0, 6378137.0, 6378137.0}; const std::array<double, 5> a{6378388.0, 6378160.0, 6378135.0, 6378137.0, 6378137.0};
const double f[5] = {1.0 / 297.0, 1.0 / 298.247, 1.0 / 298.26, 1.0 / 298.257222101, 1.0 / 298.257223563}; const std::array<double, 5> f{1.0 / 297.0, 1.0 / 298.247, 1.0 / 298.26, 1.0 / 298.257222101, 1.0 / 298.257223563};
double lambda = atan2(XYZ[1], XYZ[0]); double lambda = atan2(XYZ[1], XYZ[0]);
double ex2 = (2.0 - f[elipsoid_selection]) * f[elipsoid_selection] / ((1.0 - f[elipsoid_selection]) * (1.0 - f[elipsoid_selection])); double ex2 = (2.0 - f[elipsoid_selection]) * f[elipsoid_selection] / ((1.0 - f[elipsoid_selection]) * (1.0 - f[elipsoid_selection]));

View File

@ -31,14 +31,15 @@
*/ */
#include "glonass_l1_signal_processing.h" #include "glonass_l1_signal_processing.h"
#include <array>
auto auxCeil = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); }; auto auxCeil = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); };
void glonass_l1_ca_code_gen_complex(gsl::span<std::complex<float>> _dest, /* int32_t _prn,*/ uint32_t _chip_shift) void glonass_l1_ca_code_gen_complex(gsl::span<std::complex<float>> _dest, /* int32_t _prn,*/ uint32_t _chip_shift)
{ {
const uint32_t _code_length = 511; const uint32_t _code_length = 511;
bool G1[_code_length]; std::array<bool, _code_length> G1{};
bool G1_register[9]; std::array<bool, 9> G1_register{};
bool feedback1; bool feedback1;
bool aux; bool aux;
uint32_t delay; uint32_t delay;
@ -107,21 +108,22 @@ void glonass_l1_ca_code_gen_complex(gsl::span<std::complex<float>> _dest, /* int
void glonass_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, /* uint32_t _prn,*/ int32_t _fs, uint32_t _chip_shift) void glonass_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, /* uint32_t _prn,*/ int32_t _fs, uint32_t _chip_shift)
{ {
// This function is based on the GNU software GPS for MATLAB in the Kay Borre book // This function is based on the GNU software GPS for MATLAB in the Kay Borre book
std::complex<float> _code[511]; std::array<std::complex<float>, 511> _code{};
int32_t _samplesPerCode, _codeValueIndex; int32_t _samplesPerCode, _codeValueIndex;
float _ts; float _ts;
float _tc; float _tc;
float aux; float aux;
const int32_t _codeFreqBasis = 511000; //Hz const int32_t _codeFreqBasis = 511000; // Hz
const int32_t _codeLength = 511; const int32_t _codeLength = 511;
//--- Find number of samples per spreading code ---------------------------- //--- Find number of samples per spreading code ----------------------------
_samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / static_cast<double>(_codeFreqBasis / _codeLength)); _samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / static_cast<double>(_codeFreqBasis / _codeLength));
//--- Find time constants -------------------------------------------------- //--- Find time constants --------------------------------------------------
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec _ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
_tc = 1.0 / static_cast<float>(_codeFreqBasis); // C/A chip period in sec _tc = 1.0 / static_cast<float>(_codeFreqBasis); // C/A chip period in sec
glonass_l1_ca_code_gen_complex(gsl::span<std::complex<float>>(_code, 511), _chip_shift); //generate C/A code 1 sample per chip
glonass_l1_ca_code_gen_complex(gsl::span<std::complex<float>>(_code.data(), 511), _chip_shift); // generate C/A code 1 sample per chip
for (int32_t i = 0; i < _samplesPerCode; i++) for (int32_t i = 0; i < _samplesPerCode; i++)
{ {

View File

@ -31,14 +31,15 @@
*/ */
#include "glonass_l2_signal_processing.h" #include "glonass_l2_signal_processing.h"
#include <array>
auto auxCeil = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); }; auto auxCeil = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); };
void glonass_l2_ca_code_gen_complex(gsl::span<std::complex<float>> _dest, /* int32_t _prn,*/ uint32_t _chip_shift) void glonass_l2_ca_code_gen_complex(gsl::span<std::complex<float>> _dest, /* int32_t _prn,*/ uint32_t _chip_shift)
{ {
const uint32_t _code_length = 511; const uint32_t _code_length = 511;
bool G1[_code_length]; std::array<bool, _code_length> G1{};
bool G1_register[9]; std::array<bool, 9> G1_register{};
bool feedback1; bool feedback1;
bool aux; bool aux;
uint32_t delay; uint32_t delay;
@ -107,21 +108,22 @@ void glonass_l2_ca_code_gen_complex(gsl::span<std::complex<float>> _dest, /* int
void glonass_l2_ca_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, /* uint32_t _prn,*/ int32_t _fs, uint32_t _chip_shift) void glonass_l2_ca_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, /* uint32_t _prn,*/ int32_t _fs, uint32_t _chip_shift)
{ {
// This function is based on the GNU software GPS for MATLAB in the Kay Borre book // This function is based on the GNU software GPS for MATLAB in the Kay Borre book
std::complex<float> _code[511]; std::array<std::complex<float>, 511> _code{};
int32_t _samplesPerCode, _codeValueIndex; int32_t _samplesPerCode, _codeValueIndex;
float _ts; float _ts;
float _tc; float _tc;
float aux; float aux;
const int32_t _codeFreqBasis = 511000; //Hz const int32_t _codeFreqBasis = 511000; // Hz
const int32_t _codeLength = 511; const int32_t _codeLength = 511;
//--- Find number of samples per spreading code ---------------------------- //--- Find number of samples per spreading code ----------------------------
_samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / static_cast<double>(_codeFreqBasis / _codeLength)); _samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / static_cast<double>(_codeFreqBasis / _codeLength));
//--- Find time constants -------------------------------------------------- //--- Find time constants --------------------------------------------------
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec _ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
_tc = 1.0 / static_cast<float>(_codeFreqBasis); // C/A chip period in sec _tc = 1.0 / static_cast<float>(_codeFreqBasis); // C/A chip period in sec
glonass_l2_ca_code_gen_complex(gsl::span<std::complex<float>>(_code, 511), _chip_shift); //generate C/A code 1 sample per chip
glonass_l2_ca_code_gen_complex(gsl::span<std::complex<float>>(_code.data(), 511), _chip_shift); // generate C/A code 1 sample per chip
for (int32_t i = 0; i < _samplesPerCode; i++) for (int32_t i = 0; i < _samplesPerCode; i++)
{ {

View File

@ -83,7 +83,10 @@ bool gnss_sdr_create_directory(const std::string& foldername)
errorlib::error_code ec; errorlib::error_code ec;
os_test_file.close(); os_test_file.close();
fs::remove(test_file, ec); if (!fs::remove(test_file, ec))
{
return false;
}
if (static_cast<bool>(ec)) if (static_cast<bool>(ec))
{ {
return false; return false;

View File

@ -36,19 +36,19 @@
#include <memory> #include <memory>
int32_t gps_l2c_m_shift(int32_t x) uint32_t gps_l2c_m_shift(uint32_t x)
{ {
return static_cast<int32_t>((x >> 1) ^ ((x & 1) * 0445112474)); return static_cast<uint32_t>((x >> 1U) ^ ((x & 1U) * 0445112474U));
} }
void gps_l2c_m_code(gsl::span<int32_t> _dest, uint32_t _prn) void gps_l2c_m_code(gsl::span<int32_t> _dest, uint32_t _prn)
{ {
int32_t x; uint32_t x;
x = GPS_L2C_M_INIT_REG[_prn - 1]; x = GPS_L2C_M_INIT_REG[_prn - 1];
for (int32_t n = 0; n < GPS_L2_M_CODE_LENGTH_CHIPS; n++) for (int32_t n = 0; n < GPS_L2_M_CODE_LENGTH_CHIPS; n++)
{ {
_dest[n] = static_cast<int8_t>(x & 1); _dest[n] = static_cast<int8_t>(x & 1U);
x = gps_l2c_m_shift(x); x = gps_l2c_m_shift(x);
} }
} }

View File

@ -31,23 +31,26 @@
*/ */
#include "gps_sdr_signal_processing.h" #include "gps_sdr_signal_processing.h"
#include <array>
#include <bitset>
auto auxCeil = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); }; auto auxCeil = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); };
void gps_l1_ca_code_gen_int(gsl::span<int32_t> _dest, int32_t _prn, uint32_t _chip_shift) void gps_l1_ca_code_gen_int(gsl::span<int32_t> _dest, int32_t _prn, uint32_t _chip_shift)
{ {
const uint32_t _code_length = 1023; const uint32_t _code_length = 1023;
bool G1[_code_length]; std::bitset<_code_length> G1{};
bool G2[_code_length]; std::bitset<_code_length> G2{};
bool G1_register[10], G2_register[10]; std::bitset<10> G1_register{};
std::bitset<10> G2_register{};
bool feedback1, feedback2; bool feedback1, feedback2;
bool aux; bool aux;
uint32_t lcv, lcv2; uint32_t lcv, lcv2;
uint32_t delay; uint32_t delay;
int32_t prn_idx; int32_t prn_idx;
/* G2 Delays as defined in GPS-ISD-200D */ // G2 Delays as defined in GPS-ISD-200D
const int32_t delays[51] = {5 /*PRN1*/, 6, 7, 8, 17, 18, 139, 140, 141, 251, 252, 254, 255, 256, 257, 258, 469, 470, 471, 472, const std::array<int32_t, 51> delays = {5 /*PRN1*/, 6, 7, 8, 17, 18, 139, 140, 141, 251, 252, 254, 255, 256, 257, 258, 469, 470, 471, 472,
473, 474, 509, 512, 513, 514, 515, 516, 859, 860, 861, 862 /*PRN32*/, 473, 474, 509, 512, 513, 514, 515, 516, 859, 860, 861, 862 /*PRN32*/,
145 /*PRN120*/, 175, 52, 21, 237, 235, 886, 657, 634, 762, 145 /*PRN120*/, 175, 52, 21, 237, 235, 886, 657, 634, 762,
355, 1012, 176, 603, 130, 359, 595, 68, 386 /*PRN138*/}; 355, 1012, 176, 603, 130, 359, 595, 68, 386 /*PRN138*/};
@ -62,7 +65,7 @@ void gps_l1_ca_code_gen_int(gsl::span<int32_t> _dest, int32_t _prn, uint32_t _ch
prn_idx = _prn - 1; prn_idx = _prn - 1;
} }
/* A simple error check */ // A simple error check
if ((prn_idx < 0) || (prn_idx > 51)) if ((prn_idx < 0) || (prn_idx > 51))
{ {
return; return;
@ -74,14 +77,14 @@ void gps_l1_ca_code_gen_int(gsl::span<int32_t> _dest, int32_t _prn, uint32_t _ch
G2_register[lcv] = true; G2_register[lcv] = true;
} }
/* Generate G1 & G2 Register */ // Generate G1 & G2 Register
for (lcv = 0; lcv < _code_length; lcv++) for (lcv = 0; lcv < _code_length; lcv++)
{ {
G1[lcv] = G1_register[0]; G1[lcv] = G1_register[0];
G2[lcv] = G2_register[0]; G2[lcv] = G2_register[0];
feedback1 = G1_register[7] ^ G1_register[0]; feedback1 = G1_register[7] ^ G1_register[0];
feedback2 = (G2_register[8] + G2_register[7] + G2_register[4] + G2_register[2] + G2_register[1] + G2_register[0]) & 0x1; feedback2 = G2_register[8] xor G2_register[7] xor G2_register[4] xor G2_register[2] xor G2_register[1] xor G2_register[0];
for (lcv2 = 0; lcv2 < 9; lcv2++) for (lcv2 = 0; lcv2 < 9; lcv2++)
{ {
@ -93,12 +96,12 @@ void gps_l1_ca_code_gen_int(gsl::span<int32_t> _dest, int32_t _prn, uint32_t _ch
G2_register[9] = feedback2; G2_register[9] = feedback2;
} }
/* Set the delay */ // Set the delay
delay = _code_length - delays[prn_idx]; delay = _code_length - delays[prn_idx];
delay += _chip_shift; delay += _chip_shift;
delay %= _code_length; delay %= _code_length;
/* Generate PRN from G1 and G2 Registers */ // Generate PRN from G1 and G2 Registers
for (lcv = 0; lcv < _code_length; lcv++) for (lcv = 0; lcv < _code_length; lcv++)
{ {
aux = G1[(lcv + _chip_shift) % _code_length] ^ G2[delay]; aux = G1[(lcv + _chip_shift) % _code_length] ^ G2[delay];
@ -119,7 +122,7 @@ void gps_l1_ca_code_gen_int(gsl::span<int32_t> _dest, int32_t _prn, uint32_t _ch
void gps_l1_ca_code_gen_float(gsl::span<float> _dest, int32_t _prn, uint32_t _chip_shift) void gps_l1_ca_code_gen_float(gsl::span<float> _dest, int32_t _prn, uint32_t _chip_shift)
{ {
const uint32_t _code_length = 1023; const uint32_t _code_length = 1023;
int32_t ca_code_int[_code_length]; std::array<int32_t, _code_length> ca_code_int{};
gps_l1_ca_code_gen_int(ca_code_int, _prn, _chip_shift); gps_l1_ca_code_gen_int(ca_code_int, _prn, _chip_shift);
@ -133,7 +136,7 @@ void gps_l1_ca_code_gen_float(gsl::span<float> _dest, int32_t _prn, uint32_t _ch
void gps_l1_ca_code_gen_complex(gsl::span<std::complex<float>> _dest, int32_t _prn, uint32_t _chip_shift) void gps_l1_ca_code_gen_complex(gsl::span<std::complex<float>> _dest, int32_t _prn, uint32_t _chip_shift)
{ {
const uint32_t _code_length = 1023; const uint32_t _code_length = 1023;
int32_t ca_code_int[_code_length] = {0}; std::array<int32_t, _code_length> ca_code_int{};
gps_l1_ca_code_gen_int(ca_code_int, _prn, _chip_shift); gps_l1_ca_code_gen_int(ca_code_int, _prn, _chip_shift);
@ -151,12 +154,12 @@ void gps_l1_ca_code_gen_complex(gsl::span<std::complex<float>> _dest, int32_t _p
void gps_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift) void gps_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift)
{ {
// This function is based on the GNU software GPS for MATLAB in the Kay Borre book // This function is based on the GNU software GPS for MATLAB in the Kay Borre book
std::complex<float> _code[1023]; std::array<std::complex<float>, 1023> _code{};
int32_t _samplesPerCode, _codeValueIndex; int32_t _samplesPerCode, _codeValueIndex;
float _ts; float _ts;
float _tc; float _tc;
float aux; float aux;
const int32_t _codeFreqBasis = 1023000; //Hz const int32_t _codeFreqBasis = 1023000; // Hz
const int32_t _codeLength = 1023; const int32_t _codeLength = 1023;
//--- Find number of samples per spreading code ---------------------------- //--- Find number of samples per spreading code ----------------------------
@ -165,7 +168,7 @@ void gps_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, ui
//--- Find time constants -------------------------------------------------- //--- Find time constants --------------------------------------------------
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec _ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
_tc = 1.0 / static_cast<float>(_codeFreqBasis); // C/A chip period in sec _tc = 1.0 / static_cast<float>(_codeFreqBasis); // C/A chip period in sec
gps_l1_ca_code_gen_complex(_code, _prn, _chip_shift); //generate C/A code 1 sample per chip gps_l1_ca_code_gen_complex(_code, _prn, _chip_shift); // generate C/A code 1 sample per chip
for (int32_t i = 0; i < _samplesPerCode; i++) for (int32_t i = 0; i < _samplesPerCode; i++)
{ {

View File

@ -301,6 +301,9 @@ eph_t eph_to_rtklib(const Beidou_Dnav_Ephemeris& bei_eph)
rtklib_sat.Adot = 0; //only in CNAV; rtklib_sat.Adot = 0; //only in CNAV;
rtklib_sat.ndot = 0; //only in CNAV; rtklib_sat.ndot = 0; //only in CNAV;
rtklib_sat.svh = bei_eph.i_SV_health;
rtklib_sat.sva = bei_eph.i_SV_accuracy;
rtklib_sat.code = bei_eph.i_sig_type; /*B1I data*/ rtklib_sat.code = bei_eph.i_sig_type; /*B1I data*/
rtklib_sat.flag = bei_eph.i_nav_type; /*MEO/IGSO satellite*/ rtklib_sat.flag = bei_eph.i_nav_type; /*MEO/IGSO satellite*/
rtklib_sat.iode = static_cast<int32_t>(bei_eph.d_AODE); /* AODE */ rtklib_sat.iode = static_cast<int32_t>(bei_eph.d_AODE); /* AODE */

View File

@ -166,9 +166,8 @@ double prange(const obsd_t *obs, const nav_t *nav, const double *azel,
return 0.0; return 0.0;
} }
/* L1-L2 for GPS/GLO/QZS, L1-L5 for GAL/SBS/BDS */
/* L1-L2 for GPS/GLO/QZS, L1-L5 for GAL/SBS */ if (sys == SYS_GAL or sys == SYS_SBS or sys == SYS_BDS)
if (sys == SYS_GAL or sys == SYS_SBS)
{ {
j = 2; j = 2;
} }
@ -282,6 +281,11 @@ double prange(const obsd_t *obs, const nav_t *nav, const double *azel,
PC = P2 + P1_P2 - ISCl5i; PC = P2 + P1_P2 - ISCl5i;
} }
} }
if (sys == SYS_BDS)
{
P2 += P2_C2; /* C2->P2 */
PC = P2; // no tgd corrections for B3I
}
else if (sys == SYS_GAL or sys == SYS_GLO or sys == SYS_BDS) // Gal. E5a single freq. else if (sys == SYS_GAL or sys == SYS_GLO or sys == SYS_BDS) // Gal. E5a single freq.
{ {
P2 += P2_C2; /* C2->P2 */ P2 += P2_C2; /* C2->P2 */

View File

@ -221,7 +221,7 @@ int decode_sbstype6(const sbsmsg_t *msg, sbssat_t *sbssat)
} }
for (i = 0; i < sbssat->nsat && i < MAXSAT; i++) for (i = 0; i < sbssat->nsat && i < MAXSAT; i++)
{ {
if (sbssat->sat[i].fcorr.iodf != iodf[i / 28]) if (sbssat->sat[i].fcorr.iodf != iodf[i / 39])
{ {
continue; continue;
} }

View File

@ -267,15 +267,24 @@ void write_results(const std::vector<volk_gnsssdr_test_results_t> *results, bool
// do not overwrite volk_gnsssdr_config when using a regex. // do not overwrite volk_gnsssdr_config when using a regex.
if (!fs::exists(config_path.parent_path())) if (!fs::exists(config_path.parent_path()))
{ {
std::cout << "Creating " << config_path.parent_path() << " ..." << std::endl;
try try
{ {
fs::create_directories(config_path.parent_path()); std::cout << "Creating " << config_path.parent_path() << " ..." << std::endl;
try
{
fs::create_directories(config_path.parent_path());
}
catch (const fs::filesystem_error &e)
{
std::cerr << "ERROR: Could not create folder " << config_path.parent_path() << std::endl;
std::cerr << "Reason: " << e.what() << std::endl;
return;
}
} }
catch (const fs::filesystem_error &e) catch (...)
{ {
std::cerr << "ERROR: Could not create folder " << config_path.parent_path() << std::endl; // Catch exception when using std::experimental
std::cerr << "Reason: " << e.what() << std::endl; std::cerr << "ERROR: Could not create folder" << std::endl;
return; return;
} }
} }

View File

@ -50,7 +50,7 @@ list(APPEND AVAIL_BUILDTYPES
# known build types in AVAIL_BUILDTYPES. If the build type is found, # known build types in AVAIL_BUILDTYPES. If the build type is found,
# the function exits immediately. If nothing is found by the end of # the function exits immediately. If nothing is found by the end of
# checking all available build types, we exit with an error and list # checking all available build types, we exit with an error and list
# the avialable build types. # the available build types.
######################################################################## ########################################################################
function(VOLK_CHECK_BUILD_TYPE settype) function(VOLK_CHECK_BUILD_TYPE settype)
string(TOUPPER ${settype} _settype) string(TOUPPER ${settype} _settype)

View File

@ -183,7 +183,7 @@ if(CPU_IS_x86)
# eliminate AVX if cvtpi32_ps intrinsic fails like some versions of clang # eliminate AVX if cvtpi32_ps intrinsic fails like some versions of clang
######################################################################### #########################################################################
# check to see if the compiler/linker works with cvtpi32_ps instrinsic when using AVX # check to see if the compiler/linker works with cvtpi32_ps intrinsic when using AVX
if(CMAKE_SIZEOF_VOID_P EQUAL 4) if(CMAKE_SIZEOF_VOID_P EQUAL 4)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps.c "#include <immintrin.h>\nint main (void) {__m128 __a; __m64 __b; __m128 foo = _mm_cvtpi32_ps(__a, __b); return (0); }") file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps.c "#include <immintrin.h>\nint main (void) {__m128 __a; __m64 __b; __m128 foo = _mm_cvtpi32_ps(__a, __b); return (0); }")
execute_process(COMMAND ${CMAKE_C_COMPILER} -mavx -o execute_process(COMMAND ${CMAKE_C_COMPILER} -mavx -o
@ -192,7 +192,7 @@ if(CPU_IS_x86)
OUTPUT_QUIET ERROR_QUIET OUTPUT_QUIET ERROR_QUIET
RESULT_VARIABLE avx_compile_result) RESULT_VARIABLE avx_compile_result)
if(NOT ${avx_compile_result} EQUAL 0) if(NOT ${avx_compile_result} EQUAL 0)
overrule_arch(avx "Compiler missing cvtpi32_ps instrinsic") overrule_arch(avx "Compiler missing cvtpi32_ps intrinsic")
elseif(NOT CROSSCOMPILE_MULTILIB) elseif(NOT CROSSCOMPILE_MULTILIB)
execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test_cvtpi32_ps
OUTPUT_QUIET ERROR_QUIET OUTPUT_QUIET ERROR_QUIET
@ -216,7 +216,7 @@ if(CPU_IS_x86)
if("${CMAKE_C_COMPILER_ID}" MATCHES "Clang") if("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
# Figure out the version of Clang # Figure out the version of Clang
if(CMAKE_VERSION VERSION_LESS "2.8.10") if(CMAKE_VERSION VERSION_LESS "2.8.10")
# Exctract the Clang version from the --version string. # Extract the Clang version from the --version string.
# In cmake 2.8.10, we can just use CMAKE_C_COMPILER_VERSION # In cmake 2.8.10, we can just use CMAKE_C_COMPILER_VERSION
# without having to go through these string manipulations # without having to go through these string manipulations
execute_process(COMMAND ${CMAKE_C_COMPILER} --version execute_process(COMMAND ${CMAKE_C_COMPILER} --version

View File

@ -38,6 +38,7 @@
#include <glog/logging.h> #include <glog/logging.h>
#include <gnuradio/io_signature.h> #include <gnuradio/io_signature.h>
#include <matio.h> #include <matio.h>
#include <array>
#include <cmath> // for round #include <cmath> // for round
#include <cstdlib> // for size_t, llabs #include <cstdlib> // for size_t, llabs
#include <exception> // for exception #include <exception> // for exception
@ -46,6 +47,8 @@
#include <utility> // for move #include <utility> // for move
#if HAS_STD_FILESYSTEM #if HAS_STD_FILESYSTEM
#include <system_error>
namespace errorlib = std;
#if HAS_STD_FILESYSTEM_EXPERIMENTAL #if HAS_STD_FILESYSTEM_EXPERIMENTAL
#include <experimental/filesystem> #include <experimental/filesystem>
namespace fs = std::experimental::filesystem; namespace fs = std::experimental::filesystem;
@ -54,8 +57,12 @@ namespace fs = std::experimental::filesystem;
namespace fs = std::filesystem; namespace fs = std::filesystem;
#endif #endif
#else #else
#include <boost/filesystem/path.hpp> #include <boost/filesystem/operations.hpp> // for create_directories, exists
#include <boost/filesystem/path.hpp> // for path, operator<<
#include <boost/filesystem/path_traits.hpp> // for filesystem
#include <boost/system/error_code.hpp> // for error_code
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
namespace errorlib = boost::system;
#endif #endif
@ -64,33 +71,6 @@ hybrid_observables_gs_sptr hybrid_observables_gs_make(unsigned int nchannels_in,
return hybrid_observables_gs_sptr(new hybrid_observables_gs(nchannels_in, nchannels_out, dump, dump_mat, std::move(dump_filename))); return hybrid_observables_gs_sptr(new hybrid_observables_gs(nchannels_in, nchannels_out, dump, dump_mat, std::move(dump_filename)));
} }
void hybrid_observables_gs::msg_handler_pvt_to_observables(const pmt::pmt_t &msg)
{
gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler
try
{
if (pmt::any_ref(msg).type() == typeid(double))
{
double new_rx_clock_offset_s;
new_rx_clock_offset_s = boost::any_cast<double>(pmt::any_ref(msg));
T_rx_offset_ms = new_rx_clock_offset_s * 1000.0;
T_rx_TOW_ms = T_rx_TOW_ms - static_cast<int>(round(T_rx_offset_ms));
T_rx_remnant_to_20ms = (T_rx_TOW_ms % 20);
//d_Rx_clock_buffer.clear(); // Clear all the elements in the buffer
for (uint32_t n = 0; n < d_nchannels_out; n++)
{
d_gnss_synchro_history->clear(n);
}
LOG(INFO) << "Corrected new RX Time offset: " << T_rx_offset_ms << "[ms]";
}
}
catch (boost::bad_any_cast &e)
{
LOG(WARNING) << "msg_handler_pvt_to_observables Bad any cast!";
}
}
hybrid_observables_gs::hybrid_observables_gs(uint32_t nchannels_in, hybrid_observables_gs::hybrid_observables_gs(uint32_t nchannels_in,
uint32_t nchannels_out, uint32_t nchannels_out,
@ -110,7 +90,7 @@ hybrid_observables_gs::hybrid_observables_gs(uint32_t nchannels_in,
d_nchannels_out = nchannels_out; d_nchannels_out = nchannels_out;
d_nchannels_in = nchannels_in; d_nchannels_in = nchannels_in;
T_rx_offset_ms = 0; T_rx_offset_ms = 0;
d_gnss_synchro_history = new Gnss_circular_deque<Gnss_Synchro>(500, d_nchannels_out); d_gnss_synchro_history = std::make_shared<Gnss_circular_deque<Gnss_Synchro>>(500, d_nchannels_out);
// ############# ENABLE DATA FILE LOG ################# // ############# ENABLE DATA FILE LOG #################
if (d_dump) if (d_dump)
@ -169,9 +149,9 @@ hybrid_observables_gs::hybrid_observables_gs(uint32_t nchannels_in,
hybrid_observables_gs::~hybrid_observables_gs() hybrid_observables_gs::~hybrid_observables_gs()
{ {
delete d_gnss_synchro_history;
if (d_dump_file.is_open()) if (d_dump_file.is_open())
{ {
auto pos = d_dump_file.tellp();
try try
{ {
d_dump_file.close(); d_dump_file.close();
@ -180,6 +160,15 @@ hybrid_observables_gs::~hybrid_observables_gs()
{ {
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what(); LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
} }
if (pos == 0)
{
errorlib::error_code ec;
if (!fs::remove(fs::path(d_dump_filename), ec))
{
std::cerr << "Problem removing temporary file " << d_dump_filename << '\n';
}
d_dump_mat = false;
}
} }
if (d_dump_mat) if (d_dump_mat)
{ {
@ -195,6 +184,34 @@ hybrid_observables_gs::~hybrid_observables_gs()
} }
void hybrid_observables_gs::msg_handler_pvt_to_observables(const pmt::pmt_t &msg)
{
gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler
try
{
if (pmt::any_ref(msg).type() == typeid(double))
{
double new_rx_clock_offset_s;
new_rx_clock_offset_s = boost::any_cast<double>(pmt::any_ref(msg));
T_rx_offset_ms = new_rx_clock_offset_s * 1000.0;
T_rx_TOW_ms = T_rx_TOW_ms - static_cast<int>(round(T_rx_offset_ms));
T_rx_remnant_to_20ms = (T_rx_TOW_ms % 20);
//d_Rx_clock_buffer.clear(); // Clear all the elements in the buffer
for (uint32_t n = 0; n < d_nchannels_out; n++)
{
d_gnss_synchro_history->clear(n);
}
LOG(INFO) << "Corrected new RX Time offset: " << T_rx_offset_ms << "[ms]";
}
}
catch (boost::bad_any_cast &e)
{
LOG(WARNING) << "msg_handler_pvt_to_observables Bad any cast!";
}
}
int32_t hybrid_observables_gs::save_matfile() int32_t hybrid_observables_gs::save_matfile()
{ {
// READ DUMP FILE // READ DUMP FILE
@ -297,32 +314,32 @@ int32_t hybrid_observables_gs::save_matfile()
matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
if (reinterpret_cast<int64_t *>(matfp) != nullptr) if (reinterpret_cast<int64_t *>(matfp) != nullptr)
{ {
size_t dims[2] = {static_cast<size_t>(d_nchannels_out), static_cast<size_t>(num_epoch)}; std::array<size_t, 2> dims{static_cast<size_t>(d_nchannels_out), static_cast<size_t>(num_epoch)};
matvar = Mat_VarCreate("RX_time", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, RX_time_aux.data(), MAT_F_DONT_COPY_DATA); matvar = Mat_VarCreate("RX_time", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), RX_time_aux.data(), MAT_F_DONT_COPY_DATA);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("TOW_at_current_symbol_s", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, TOW_at_current_symbol_s_aux.data(), MAT_F_DONT_COPY_DATA); matvar = Mat_VarCreate("TOW_at_current_symbol_s", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), TOW_at_current_symbol_s_aux.data(), MAT_F_DONT_COPY_DATA);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("Carrier_Doppler_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, Carrier_Doppler_hz_aux.data(), MAT_F_DONT_COPY_DATA); matvar = Mat_VarCreate("Carrier_Doppler_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), Carrier_Doppler_hz_aux.data(), MAT_F_DONT_COPY_DATA);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("Carrier_phase_cycles", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, Carrier_phase_cycles_aux.data(), MAT_F_DONT_COPY_DATA); matvar = Mat_VarCreate("Carrier_phase_cycles", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), Carrier_phase_cycles_aux.data(), MAT_F_DONT_COPY_DATA);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("Pseudorange_m", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, Pseudorange_m_aux.data(), MAT_F_DONT_COPY_DATA); matvar = Mat_VarCreate("Pseudorange_m", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), Pseudorange_m_aux.data(), MAT_F_DONT_COPY_DATA);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("PRN", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, PRN_aux.data(), MAT_F_DONT_COPY_DATA); matvar = Mat_VarCreate("PRN", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), PRN_aux.data(), MAT_F_DONT_COPY_DATA);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("Flag_valid_pseudorange", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, Flag_valid_pseudorange_aux.data(), MAT_F_DONT_COPY_DATA); matvar = Mat_VarCreate("Flag_valid_pseudorange", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), Flag_valid_pseudorange_aux.data(), MAT_F_DONT_COPY_DATA);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
} }

View File

@ -40,6 +40,7 @@
#include <gnuradio/types.h> // for gr_vector_int #include <gnuradio/types.h> // for gr_vector_int
#include <cstdint> // for int32_t #include <cstdint> // for int32_t
#include <fstream> // for string, ofstream #include <fstream> // for string, ofstream
#include <memory> // for shared_ptr
#include <vector> // for vector #include <vector> // for vector
class Gnss_Synchro; class Gnss_Synchro;
@ -94,8 +95,8 @@ private:
double T_rx_offset_ms; double T_rx_offset_ms;
std::string d_dump_filename; std::string d_dump_filename;
std::ofstream d_dump_file; std::ofstream d_dump_file;
boost::circular_buffer<uint64_t> d_Rx_clock_buffer; // time history boost::circular_buffer<uint64_t> d_Rx_clock_buffer; // time history
Gnss_circular_deque<Gnss_Synchro>* d_gnss_synchro_history; // Tracking observable history std::shared_ptr<Gnss_circular_deque<Gnss_Synchro>> d_gnss_synchro_history; // Tracking observable history
void msg_handler_pvt_to_observables(const pmt::pmt_t& msg); void msg_handler_pvt_to_observables(const pmt::pmt_t& msg);
double compute_T_rx_s(const Gnss_Synchro& a); double compute_T_rx_s(const Gnss_Synchro& a);
bool interp_trk_obs(Gnss_Synchro& interpolated_obs, const uint32_t& ch, const uint64_t& rx_clock); bool interp_trk_obs(Gnss_Synchro& interpolated_obs, const uint32_t& ch, const uint64_t& rx_clock);

View File

@ -39,6 +39,7 @@
#include "gps_sdr_signal_processing.h" #include "gps_sdr_signal_processing.h"
#include <gnuradio/io_signature.h> #include <gnuradio/io_signature.h>
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <array>
#include <fstream> #include <fstream>
#include <utility> #include <utility>
@ -158,7 +159,7 @@ void signal_generator_c::generate_codes()
{ {
sampled_code_data_[sat] = static_cast<gr_complex *>(std::malloc(vector_length_ * sizeof(gr_complex))); sampled_code_data_[sat] = static_cast<gr_complex *>(std::malloc(vector_length_ * sizeof(gr_complex)));
gr_complex code[64000]; //[samples_per_code_[sat]]; std::array<gr_complex, 64000> code{}; //[samples_per_code_[sat]];
if (system_[sat] == "G") if (system_[sat] == "G")
{ {
@ -179,7 +180,7 @@ void signal_generator_c::generate_codes()
for (unsigned int i = 0; i < num_of_codes_per_vector_[sat]; i++) for (unsigned int i = 0; i < num_of_codes_per_vector_[sat]; i++)
{ {
memcpy(&(sampled_code_data_[sat][i * samples_per_code_[sat]]), memcpy(&(sampled_code_data_[sat][i * samples_per_code_[sat]]),
code, sizeof(gr_complex) * samples_per_code_[sat]); code.data(), sizeof(gr_complex) * samples_per_code_[sat]);
} }
} }
else if (system_[sat] == "R") else if (system_[sat] == "R")
@ -201,7 +202,7 @@ void signal_generator_c::generate_codes()
for (unsigned int i = 0; i < num_of_codes_per_vector_[sat]; i++) for (unsigned int i = 0; i < num_of_codes_per_vector_[sat]; i++)
{ {
memcpy(&(sampled_code_data_[sat][i * samples_per_code_[sat]]), memcpy(&(sampled_code_data_[sat][i * samples_per_code_[sat]]),
code, sizeof(gr_complex) * samples_per_code_[sat]); code.data(), sizeof(gr_complex) * samples_per_code_[sat]);
} }
} }
else if (system_[sat] == "E") else if (system_[sat] == "E")
@ -227,7 +228,7 @@ void signal_generator_c::generate_codes()
bool cboc = true; bool cboc = true;
std::array<char, 3> signal = {{'1', 'B', '\0'}}; std::array<char, 3> signal = {{'1', 'B', '\0'}};
galileo_e1_code_gen_complex_sampled(gsl::span<gr_complex>(code, 64000), signal, cboc, PRN_[sat], fs_in_, galileo_e1_code_gen_complex_sampled(code, signal, cboc, PRN_[sat], fs_in_,
static_cast<int>(GALILEO_E1_B_CODE_LENGTH_CHIPS) - delay_chips_[sat]); static_cast<int>(GALILEO_E1_B_CODE_LENGTH_CHIPS) - delay_chips_[sat]);
// Obtain the desired CN0 assuming that Pn = 1. // Obtain the desired CN0 assuming that Pn = 1.
@ -243,7 +244,7 @@ void signal_generator_c::generate_codes()
for (unsigned int i = 0; i < num_of_codes_per_vector_[sat]; i++) for (unsigned int i = 0; i < num_of_codes_per_vector_[sat]; i++)
{ {
memcpy(&(sampled_code_data_[sat][i * samples_per_code_[sat]]), memcpy(&(sampled_code_data_[sat][i * samples_per_code_[sat]]),
code, sizeof(gr_complex) * samples_per_code_[sat]); code.data(), sizeof(gr_complex) * samples_per_code_[sat]);
} }
// Generate E1C signal (25 code-periods, with secondary code) // Generate E1C signal (25 code-periods, with secondary code)

View File

@ -32,6 +32,7 @@
#include "gr_complex_ip_packet_source.h" #include "gr_complex_ip_packet_source.h"
#include <gnuradio/io_signature.h> #include <gnuradio/io_signature.h>
#include <array>
#include <cstdint> #include <cstdint>
#include <utility> #include <utility>
@ -184,14 +185,14 @@ bool Gr_Complex_Ip_Packet_Source::stop()
bool Gr_Complex_Ip_Packet_Source::open() bool Gr_Complex_Ip_Packet_Source::open()
{ {
char errbuf[PCAP_ERRBUF_SIZE]; std::array<char, PCAP_ERRBUF_SIZE> errbuf{};
boost::mutex::scoped_lock lock(d_mutex); // hold mutex for duration of this function boost::mutex::scoped_lock lock(d_mutex); // hold mutex for duration of this function
// open device for reading // open device for reading
descr = pcap_open_live(d_src_device.c_str(), 1500, 1, 1000, errbuf); descr = pcap_open_live(d_src_device.c_str(), 1500, 1, 1000, errbuf.data());
if (descr == nullptr) if (descr == nullptr)
{ {
std::cout << "Error opening Ethernet device " << d_src_device << std::endl; std::cout << "Error opening Ethernet device " << d_src_device << std::endl;
std::cout << "Fatal Error in pcap_open_live(): " << std::string(errbuf) << std::endl; std::cout << "Fatal Error in pcap_open_live(): " << std::string(errbuf.data()) << std::endl;
return false; return false;
} }
// bind UDP port to avoid automatic reply with ICMP port unreachable packets from kernel // bind UDP port to avoid automatic reply with ICMP port unreachable packets from kernel

View File

@ -102,7 +102,7 @@ private:
static void static_pcap_callback(u_char *args, const struct pcap_pkthdr *pkthdr, const u_char *packet); static void static_pcap_callback(u_char *args, const struct pcap_pkthdr *pkthdr, const u_char *packet);
/* /*
* Opens the ethernet device using libpcap raw capture mode * Opens the ethernet device using libpcap raw capture mode
* If any of these fail, the fuction retuns the error and exits. * If any of these fail, the function returns the error and exits.
*/ */
bool open(); bool open();
}; };

View File

@ -32,6 +32,7 @@
#include "labsat23_source.h" #include "labsat23_source.h"
#include "control_message_factory.h" #include "control_message_factory.h"
#include <gnuradio/io_signature.h> #include <gnuradio/io_signature.h>
#include <array>
#include <exception> #include <exception>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
@ -215,8 +216,8 @@ int labsat23_source::general_work(int noutput_items,
{ {
if (binary_input_file->eof() == false) if (binary_input_file->eof() == false)
{ {
char memblock[1024]; std::array<char, 1024> memblock{};
binary_input_file->read(memblock, 1024); binary_input_file->read(memblock.data(), 1024);
// parse Labsat header // parse Labsat header
// check preamble // check preamble
int byte_counter = 0; int byte_counter = 0;

View File

@ -29,10 +29,10 @@
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*/ */
#include "beidou_b1i_telemetry_decoder_gs.h" #include "beidou_b1i_telemetry_decoder_gs.h"
#include "Beidou_B1I.h" #include "Beidou_B1I.h"
#include "Beidou_DNAV.h"
#include "beidou_dnav_almanac.h"
#include "beidou_dnav_ephemeris.h" #include "beidou_dnav_ephemeris.h"
#include "beidou_dnav_iono.h" #include "beidou_dnav_iono.h"
#include "beidou_dnav_utc_model.h" #include "beidou_dnav_utc_model.h"
@ -43,6 +43,7 @@
#include <pmt/pmt.h> // for make_any #include <pmt/pmt.h> // for make_any
#include <pmt/pmt_sugar.h> // for mp #include <pmt/pmt_sugar.h> // for mp
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <array>
#include <cstdlib> // for abs #include <cstdlib> // for abs
#include <exception> // for exception #include <exception> // for exception
#include <iostream> // for cout #include <iostream> // for cout
@ -57,7 +58,6 @@ beidou_b1i_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump)
return beidou_b1i_telemetry_decoder_gs_sptr(new beidou_b1i_telemetry_decoder_gs(satellite, dump)); return beidou_b1i_telemetry_decoder_gs_sptr(new beidou_b1i_telemetry_decoder_gs(satellite, dump));
} }
beidou_b1i_telemetry_decoder_gs::beidou_b1i_telemetry_decoder_gs( beidou_b1i_telemetry_decoder_gs::beidou_b1i_telemetry_decoder_gs(
const Gnss_Satellite &satellite, const Gnss_Satellite &satellite,
bool dump) : gr::block("beidou_b1i_telemetry_decoder_gs", bool dump) : gr::block("beidou_b1i_telemetry_decoder_gs",
@ -75,63 +75,38 @@ beidou_b1i_telemetry_decoder_gs::beidou_b1i_telemetry_decoder_gs(
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
LOG(INFO) << "Initializing BeiDou B1I Telemetry Decoding for satellite " << this->d_satellite; LOG(INFO) << "Initializing BeiDou B1I Telemetry Decoding for satellite " << this->d_satellite;
d_samples_per_symbol = (BEIDOU_B1I_CODE_RATE_HZ / BEIDOU_B1I_CODE_LENGTH_CHIPS) / BEIDOU_D1NAV_SYMBOL_RATE_SPS; d_symbol_duration_ms = BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B1I_CODE_PERIOD_MS;
d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS; d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS * d_samples_per_symbol; d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
d_secondary_code_symbols = static_cast<int32_t *>(volk_gnsssdr_malloc(BEIDOU_B1I_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_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_preamble_period_samples = BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS;
// Setting samples of secondary code
for (int32_t i = 0; i < BEIDOU_B1I_SECONDARY_CODE_LENGTH; i++)
{
if (BEIDOU_B1I_SECONDARY_CODE.at(i) == '1')
{
d_secondary_code_symbols[i] = 1;
}
else
{
d_secondary_code_symbols[i] = -1;
}
}
// Setting samples of preamble code // Setting samples of preamble code
int32_t n = 0;
for (int32_t i = 0; i < d_symbols_per_preamble; i++) for (int32_t i = 0; i < d_symbols_per_preamble; i++)
{ {
int32_t m = 0;
if (BEIDOU_DNAV_PREAMBLE.at(i) == '1') if (BEIDOU_DNAV_PREAMBLE.at(i) == '1')
{ {
for (uint32_t j = 0; j < d_samples_per_symbol; j++) d_preamble_samples[i] = 1;
{
d_preamble_samples[n] = d_secondary_code_symbols[m];
n++;
m++;
m = m % BEIDOU_B1I_SECONDARY_CODE_LENGTH;
}
} }
else else
{ {
for (uint32_t j = 0; j < d_samples_per_symbol; j++) d_preamble_samples[i] = -1;
{
d_preamble_samples[n] = -d_secondary_code_symbols[m];
n++;
m++;
m = m % BEIDOU_B1I_SECONDARY_CODE_LENGTH;
}
} }
} }
d_subframe_symbols = static_cast<double *>(volk_gnsssdr_malloc(BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(double), volk_gnsssdr_get_alignment())); d_subframe_symbols = static_cast<float *>(volk_gnsssdr_malloc(BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(float), volk_gnsssdr_get_alignment()));
d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS * d_samples_per_symbol + d_samples_per_preamble; d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS + d_samples_per_preamble;
d_symbol_history.set_capacity(d_required_symbols + 1); d_symbol_history.set_capacity(d_required_symbols);
d_last_valid_preamble = 0;
d_sent_tlm_failed_msg = false;
d_flag_valid_word = false;
// Generic settings // Generic settings
d_sample_counter = 0; d_sample_counter = 0;
d_stat = 0; d_stat = 0;
d_preamble_index = 0; d_preamble_index = 0;
d_flag_frame_sync = false; d_flag_frame_sync = false;
d_TOW_at_current_symbol_ms = 0; d_TOW_at_current_symbol_ms = 0U;
d_TOW_at_Preamble_ms = 0U; d_TOW_at_Preamble_ms = 0U;
Flag_valid_word = false; Flag_valid_word = false;
d_CRC_error_counter = 0; d_CRC_error_counter = 0;
@ -144,7 +119,6 @@ beidou_b1i_telemetry_decoder_gs::beidou_b1i_telemetry_decoder_gs(
beidou_b1i_telemetry_decoder_gs::~beidou_b1i_telemetry_decoder_gs() beidou_b1i_telemetry_decoder_gs::~beidou_b1i_telemetry_decoder_gs()
{ {
volk_gnsssdr_free(d_preamble_samples); volk_gnsssdr_free(d_preamble_samples);
volk_gnsssdr_free(d_secondary_code_symbols);
volk_gnsssdr_free(d_subframe_symbols); volk_gnsssdr_free(d_subframe_symbols);
if (d_dump_file.is_open() == true) if (d_dump_file.is_open() == true)
@ -163,8 +137,9 @@ beidou_b1i_telemetry_decoder_gs::~beidou_b1i_telemetry_decoder_gs()
void beidou_b1i_telemetry_decoder_gs::decode_bch15_11_01(const int32_t *bits, int32_t *decbits) void beidou_b1i_telemetry_decoder_gs::decode_bch15_11_01(const int32_t *bits, int32_t *decbits)
{ {
int32_t bit, err, reg[4] = {1, 1, 1, 1}; int32_t bit, err;
int32_t errind[15] = {14, 13, 10, 12, 6, 9, 4, 11, 0, 5, 7, 8, 1, 3, 2}; std::array<int32_t, 4> reg{1, 1, 1, 1};
const std::array<int32_t, 15> errind{14, 13, 10, 12, 6, 9, 4, 11, 0, 5, 7, 8, 1, 3, 2};
for (uint32_t i = 0; i < 15; i++) for (uint32_t i = 0; i < 15; i++)
{ {
@ -192,10 +167,12 @@ void beidou_b1i_telemetry_decoder_gs::decode_bch15_11_01(const int32_t *bits, in
void beidou_b1i_telemetry_decoder_gs::decode_word( void beidou_b1i_telemetry_decoder_gs::decode_word(
int32_t word_counter, int32_t word_counter,
const double *enc_word_symbols, const float *enc_word_symbols,
int32_t *dec_word_symbols) int32_t *dec_word_symbols)
{ {
int32_t bitsbch[30], first_branch[15], second_branch[15]; std::array<int32_t, 30> bitsbch{};
std::array<int32_t, 15> first_branch{};
std::array<int32_t, 15> second_branch{};
if (word_counter == 1) if (word_counter == 1)
{ {
@ -214,8 +191,8 @@ void beidou_b1i_telemetry_decoder_gs::decode_word(
} }
} }
decode_bch15_11_01(&bitsbch[0], first_branch); decode_bch15_11_01(&bitsbch[0], first_branch.data());
decode_bch15_11_01(&bitsbch[15], second_branch); decode_bch15_11_01(&bitsbch[15], second_branch.data());
for (uint32_t j = 0; j < 11; j++) for (uint32_t j = 0; j < 11; j++)
{ {
@ -232,17 +209,17 @@ void beidou_b1i_telemetry_decoder_gs::decode_word(
} }
void beidou_b1i_telemetry_decoder_gs::decode_subframe(double *frame_symbols) void beidou_b1i_telemetry_decoder_gs::decode_subframe(float *frame_symbols)
{ {
// 1. Transform from symbols to bits // 1. Transform from symbols to bits
std::string data_bits; std::string data_bits;
int32_t dec_word_bits[30]; std::array<int32_t, 30> dec_word_bits{};
// Decode each word in subframe // Decode each word in subframe
for (uint32_t ii = 0; ii < BEIDOU_DNAV_WORDS_SUBFRAME; ii++) for (uint32_t ii = 0; ii < BEIDOU_DNAV_WORDS_SUBFRAME; ii++)
{ {
// decode the word // decode the word
decode_word((ii + 1), &frame_symbols[ii * 30], dec_word_bits); decode_word((ii + 1), &frame_symbols[ii * 30], dec_word_bits.data());
// Save word to string format // Save word to string format
for (uint32_t jj = 0; jj < (BEIDOU_DNAV_WORD_LENGTH_BITS); jj++) for (uint32_t jj = 0; jj < (BEIDOU_DNAV_WORD_LENGTH_BITS); jj++)
@ -263,11 +240,13 @@ void beidou_b1i_telemetry_decoder_gs::decode_subframe(double *frame_symbols)
// 3. Check operation executed correctly // 3. Check operation executed correctly
if (d_nav.flag_crc_test == true) if (d_nav.flag_crc_test == true)
{ {
DLOG(INFO) << "BeiDou DNAV CRC correct in channel " << d_channel << " from satellite " << d_satellite; DLOG(INFO) << "BeiDou DNAV CRC correct in channel " << d_channel
<< " from satellite " << d_satellite;
} }
else else
{ {
DLOG(INFO) << "BeiDou DNAV CRC error in channel " << d_channel << " from satellite " << d_satellite; DLOG(INFO) << "BeiDou DNAV CRC error in channel " << d_channel
<< " from satellite " << d_satellite;
} }
// 4. Push the new navigation data to the queues // 4. Push the new navigation data to the queues
if (d_nav.have_new_ephemeris() == true) if (d_nav.have_new_ephemeris() == true)
@ -292,7 +271,7 @@ void beidou_b1i_telemetry_decoder_gs::decode_subframe(double *frame_symbols)
std::shared_ptr<Beidou_Dnav_Iono> tmp_obj = std::make_shared<Beidou_Dnav_Iono>(d_nav.get_iono()); 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)); 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; LOG(INFO) << "BEIDOU DNAV Iono have been received in channel" << d_channel << " from satellite " << d_satellite;
std::cout << "New BEIDOU B1I DNAV Iono message received in channel " << d_channel << ": Iono model parameters from satellite " << d_satellite << TEXT_RESET << std::endl; std::cout << TEXT_YELLOW << "New BEIDOU B1I DNAV Iono message received in channel " << d_channel << ": Iono model parameters from satellite " << d_satellite << TEXT_RESET << std::endl;
} }
if (d_nav.have_new_almanac() == true) if (d_nav.have_new_almanac() == true)
{ {
@ -322,41 +301,59 @@ void beidou_b1i_telemetry_decoder_gs::set_satellite(const Gnss_Satellite &satell
{ {
// Clear values from previous declaration // Clear values from previous declaration
volk_gnsssdr_free(d_preamble_samples); volk_gnsssdr_free(d_preamble_samples);
volk_gnsssdr_free(d_secondary_code_symbols);
volk_gnsssdr_free(d_subframe_symbols); volk_gnsssdr_free(d_subframe_symbols);
d_samples_per_symbol = (BEIDOU_B1I_CODE_RATE_HZ / BEIDOU_B1I_CODE_LENGTH_CHIPS) / BEIDOU_D2NAV_SYMBOL_RATE_SPS;
d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS; d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS * d_samples_per_symbol; d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
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_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_preamble_period_samples = BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS;
// Setting samples of preamble code // Setting samples of preamble code
int32_t n = 0;
for (int32_t i = 0; i < d_symbols_per_preamble; i++) for (int32_t i = 0; i < d_symbols_per_preamble; i++)
{ {
if (BEIDOU_DNAV_PREAMBLE.at(i) == '1') if (BEIDOU_DNAV_PREAMBLE.at(i) == '1')
{ {
for (uint32_t j = 0; j < d_samples_per_symbol; j++) d_preamble_samples[i] = 1;
{
d_preamble_samples[n] = 1;
n++;
}
} }
else else
{ {
for (uint32_t j = 0; j < d_samples_per_symbol; j++) d_preamble_samples[i] = -1;
{
d_preamble_samples[n] = -1;
n++;
}
} }
} }
d_subframe_symbols = static_cast<double *>(volk_gnsssdr_malloc(BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(double), volk_gnsssdr_get_alignment())); d_symbol_duration_ms = BEIDOU_B1I_GEO_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B1I_CODE_PERIOD_MS;
d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS * d_samples_per_symbol + d_samples_per_preamble; d_subframe_symbols = static_cast<float *>(volk_gnsssdr_malloc(BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(float), volk_gnsssdr_get_alignment()));
d_symbol_history.set_capacity(d_required_symbols + 1); d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS + d_samples_per_preamble;
d_symbol_history.set_capacity(d_required_symbols);
}
else
{
// Clear values from previous declaration
volk_gnsssdr_free(d_preamble_samples);
volk_gnsssdr_free(d_subframe_symbols);
//back to normal satellites
d_symbol_duration_ms = BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B1I_CODE_PERIOD_MS;
d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
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;
// Setting samples of preamble code
for (int32_t i = 0; i < d_symbols_per_preamble; i++)
{
if (BEIDOU_DNAV_PREAMBLE.at(i) == '1')
{
d_preamble_samples[i] = 1;
}
else
{
d_preamble_samples[i] = -1;
}
}
d_subframe_symbols = static_cast<float *>(volk_gnsssdr_malloc(BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(float), volk_gnsssdr_get_alignment()));
d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS + d_samples_per_preamble;
d_symbol_history.set_capacity(d_required_symbols);
} }
} }
@ -387,6 +384,15 @@ void beidou_b1i_telemetry_decoder_gs::set_channel(int32_t channel)
} }
} }
void beidou_b1i_telemetry_decoder_gs::reset()
{
d_last_valid_preamble = d_sample_counter;
d_TOW_at_current_symbol_ms = 0;
d_sent_tlm_failed_msg = false;
d_flag_valid_word = false;
DLOG(INFO) << "Beidou B1I Telemetry decoder reset for satellite " << d_satellite;
return;
}
int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
@ -403,10 +409,9 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_
d_symbol_history.push_back(current_symbol.Prompt_I); // add new symbol to the symbol queue d_symbol_history.push_back(current_symbol.Prompt_I); // add new symbol to the symbol queue
d_sample_counter++; // count for the processed samples d_sample_counter++; // count for the processed samples
consume_each(1); consume_each(1);
d_flag_preamble = false; d_flag_preamble = false;
if (d_symbol_history.size() > d_required_symbols) if (d_symbol_history.size() >= d_required_symbols)
{ {
//******* preamble correlation ******** //******* preamble correlation ********
for (int32_t i = 0; i < d_samples_per_preamble; i++) for (int32_t i = 0; i < d_samples_per_preamble; i++)
@ -421,7 +426,6 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_
} }
} }
} }
//******* frame sync ****************** //******* frame sync ******************
if (d_stat == 0) // no preamble information if (d_stat == 0) // no preamble information
{ {
@ -429,7 +433,7 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_
{ {
// Record the preamble sample stamp // Record the preamble sample stamp
d_preamble_index = d_sample_counter; d_preamble_index = d_sample_counter;
LOG(INFO) << "Preamble detection for BEIDOU B1I SAT " << this->d_satellite; DLOG(INFO) << "Preamble detection for BEIDOU B1I SAT " << this->d_satellite;
// Enter into frame pre-detection status // Enter into frame pre-detection status
d_stat = 1; d_stat = 1;
} }
@ -443,9 +447,54 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_
if (abs(preamble_diff - d_preamble_period_samples) == 0) if (abs(preamble_diff - d_preamble_period_samples) == 0)
{ {
// try to decode frame // try to decode frame
LOG(INFO) << "Starting BeiDou DNAV frame decoding for BeiDou B1I SAT " << this->d_satellite; DLOG(INFO) << "Starting BeiDou DNAV frame decoding for BeiDou B1I SAT " << this->d_satellite;
d_preamble_index = d_sample_counter; //record the preamble sample stamp d_preamble_index = d_sample_counter; //record the preamble sample stamp
d_stat = 2; d_stat = 2;
// ******* SAMPLES TO SYMBOLS *******
if (corr_value > 0) //normal PLL lock
{
for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++)
{
d_subframe_symbols[i] = d_symbol_history.at(i);
}
}
else // 180 deg. inverted carrier phase PLL lock
{
for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++)
{
d_subframe_symbols[i] = -d_symbol_history.at(i);
}
}
// call the decoder
decode_subframe(d_subframe_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)
{
DLOG(INFO) << "BeiDou DNAV frame sync lost for SAT " << this->d_satellite;
d_flag_frame_sync = false;
d_stat = 0;
flag_SOW_set = false;
}
}
} }
else else
{ {
@ -464,50 +513,16 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_
// ******* SAMPLES TO SYMBOLS ******* // ******* SAMPLES TO SYMBOLS *******
if (corr_value > 0) //normal PLL lock if (corr_value > 0) //normal PLL lock
{ {
int32_t k = 0;
for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++) for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++)
{ {
d_subframe_symbols[i] = 0; d_subframe_symbols[i] = d_symbol_history.at(i);
// 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_B1I_SECONDARY_CODE_LENGTH;
}
}
} }
} }
else // 180 deg. inverted carrier phase PLL lock else // 180 deg. inverted carrier phase PLL lock
{ {
int32_t k = 0;
for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++) for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++)
{ {
d_subframe_symbols[i] = 0; d_subframe_symbols[i] = -d_symbol_history.at(i);
// 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_B1I_SECONDARY_CODE_LENGTH;
}
}
} }
} }
@ -531,7 +546,7 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_
d_preamble_index = d_sample_counter; // record the preamble sample stamp d_preamble_index = d_sample_counter; // record the preamble sample stamp
if (d_CRC_error_counter > CRC_ERROR_LIMIT) if (d_CRC_error_counter > CRC_ERROR_LIMIT)
{ {
LOG(INFO) << "BeiDou DNAV frame sync lost for SAT " << this->d_satellite; DLOG(INFO) << "BeiDou DNAV frame sync lost for SAT " << this->d_satellite;
d_flag_frame_sync = false; d_flag_frame_sync = false;
d_stat = 0; d_stat = 0;
flag_SOW_set = false; flag_SOW_set = false;
@ -539,60 +554,74 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_
} }
} }
} }
// UPDATE GNSS SYNCHRO DATA // UPDATE GNSS SYNCHRO DATA
// 2. Add the telemetry decoder information // 2. Add the telemetry decoder information
if (this->d_flag_preamble == true and d_nav.flag_new_SOW_available == true) if (this->d_flag_preamble == true and d_nav.flag_new_SOW_available == true)
// update TOW at the preamble instant // update TOW at the preamble instant
{ {
// Reporting sow as gps time of week // 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_Preamble_ms = static_cast<uint32_t>((d_nav.d_SOW + BEIDOU_DNAV_BDT2GPST_LEAP_SEC_OFFSET) * 1000.0);
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>((d_required_symbols + 1) * BEIDOU_B1I_CODE_PERIOD_MS); //check TOW update consistency
uint32_t last_d_TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms;
//compute new TOW
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + d_required_symbols * d_symbol_duration_ms;
flag_SOW_set = true; flag_SOW_set = true;
d_nav.flag_new_SOW_available = false; 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_B1I_CODE_PERIOD_MS);
}
if (last_d_TOW_at_current_symbol_ms != 0 and abs(static_cast<int64_t>(d_TOW_at_current_symbol_ms) - int64_t(last_d_TOW_at_current_symbol_ms)) > d_symbol_duration_ms)
{
LOG(INFO) << "Warning: BEIDOU B1I TOW update in ch " << d_channel
<< " does not match the TLM TOW counter " << static_cast<int64_t>(d_TOW_at_current_symbol_ms) - int64_t(last_d_TOW_at_current_symbol_ms) << " ms \n";
if (d_flag_frame_sync == true and flag_SOW_set == true) d_TOW_at_current_symbol_ms = 0;
{ d_flag_valid_word = false;
current_symbol.Flag_valid_word = true; }
else
{
d_last_valid_preamble = d_sample_counter;
d_flag_valid_word = true;
}
} }
else else
{ {
current_symbol.Flag_valid_word = false; if (d_flag_valid_word)
{
d_TOW_at_current_symbol_ms += d_symbol_duration_ms;
if (current_symbol.Flag_valid_symbol_output == false)
{
d_flag_valid_word = false;
}
}
} }
current_symbol.PRN = this->d_satellite.get_PRN(); if (d_flag_valid_word == true)
current_symbol.TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms;
if (d_dump == true)
{ {
// MULTIPLEXED FILE RECORDING - Record results to file current_symbol.TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms;
try current_symbol.Flag_valid_word = d_flag_valid_word;
if (d_dump == true)
{ {
double tmp_double; // MULTIPLEXED FILE RECORDING - Record results to file
uint64_t tmp_ulong_int; try
tmp_double = static_cast<double>(d_TOW_at_current_symbol_ms); {
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double)); double tmp_double;
tmp_ulong_int = current_symbol.Tracking_sample_counter; uint64_t tmp_ulong_int;
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t)); tmp_double = static_cast<double>(d_TOW_at_current_symbol_ms) / 1000.0;
tmp_double = d_nav.d_SOW; d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double)); tmp_ulong_int = current_symbol.Tracking_sample_counter;
tmp_ulong_int = static_cast<uint64_t>(d_required_symbols); d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t));
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t)); tmp_double = static_cast<double>(d_TOW_at_Preamble_ms) / 1000.0;
} d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
catch (const std::ifstream::failure &e) }
{ catch (const std::ifstream::failure &e)
LOG(WARNING) << "Exception writing observables dump file " << e.what(); {
LOG(WARNING) << "Exception writing Telemetry GPS L5 dump file " << e.what();
}
} }
// 3. Make the output (copy the object contents to the GNURadio reserved memory)
*out[0] = current_symbol;
return 1;
} }
return 0;
// 3. Make the output (copy the object contents to the GNURadio reserved memory)
*out[0] = current_symbol;
return 1;
} }

View File

@ -39,7 +39,7 @@
#include <boost/circular_buffer.hpp> #include <boost/circular_buffer.hpp>
#include <boost/shared_ptr.hpp> // for boost::shared_ptr #include <boost/shared_ptr.hpp> // for boost::shared_ptr
#include <gnuradio/block.h> // for block #include <gnuradio/block.h> // for block
#include <gnuradio/types.h> // for gr_vector_const_void_star #include <gnuradio/types.h> // for gr_vector_const_void_star
#include <cstdint> #include <cstdint>
#include <fstream> #include <fstream>
#include <string> #include <string>
@ -62,10 +62,8 @@ public:
~beidou_b1i_telemetry_decoder_gs(); //!< Class destructor ~beidou_b1i_telemetry_decoder_gs(); //!< Class destructor
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
void set_channel(int channel); //!< Set receiver's channel void set_channel(int channel); //!< Set receiver's channel
inline void reset() void reset();
{
return;
}
/*! /*!
* \brief This is where all signal processing takes place * \brief This is where all signal processing takes place
*/ */
@ -77,19 +75,17 @@ private:
beidou_b1i_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump); beidou_b1i_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
beidou_b1i_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump); beidou_b1i_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
void decode_subframe(double *symbols); void decode_subframe(float *symbols);
void decode_word(int32_t word_counter, const double *enc_word_symbols, int32_t *dec_word_symbols); void decode_word(int32_t word_counter, const float *enc_word_symbols, int32_t *dec_word_symbols);
void decode_bch15_11_01(const int32_t *bits, int32_t *decbits); void decode_bch15_11_01(const int32_t *bits, int32_t *decbits);
// Preamble decoding // Preamble decoding
int32_t *d_preamble_samples; 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_symbols_per_preamble;
int32_t d_samples_per_preamble; int32_t d_samples_per_preamble;
int32_t d_preamble_period_samples; int32_t d_preamble_period_samples;
double *d_subframe_symbols; float *d_subframe_symbols;
uint32_t d_required_symbols; uint32_t d_required_symbols;
// Storage for incoming data // Storage for incoming data
@ -107,12 +103,16 @@ private:
//!< Navigation Message variable //!< Navigation Message variable
Beidou_Dnav_Navigation_Message d_nav; Beidou_Dnav_Navigation_Message d_nav;
//!< Values to populate gnss synchronization structure // Values to populate gnss synchronization structure
uint32_t d_symbol_duration_ms;
uint32_t d_TOW_at_Preamble_ms; uint32_t d_TOW_at_Preamble_ms;
uint32_t d_TOW_at_current_symbol_ms; uint32_t d_TOW_at_current_symbol_ms;
uint64_t d_last_valid_preamble;
bool d_flag_valid_word;
bool d_sent_tlm_failed_msg;
bool Flag_valid_word; bool Flag_valid_word;
//!< Satellite Information and logging capacity // Satellite Information and logging capacity
Gnss_Satellite d_satellite; Gnss_Satellite d_satellite;
int32_t d_channel; int32_t d_channel;
bool d_dump; bool d_dump;

View File

@ -42,6 +42,7 @@
#include <pmt/pmt.h> // for make_any #include <pmt/pmt.h> // for make_any
#include <pmt/pmt_sugar.h> // for mp #include <pmt/pmt_sugar.h> // for mp
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <array>
#include <cstdlib> // for abs #include <cstdlib> // for abs
#include <exception> // for exception #include <exception> // for exception
#include <iostream> // for cout #include <iostream> // for cout
@ -53,8 +54,7 @@ beidou_b3i_telemetry_decoder_gs_sptr
beidou_b3i_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, beidou_b3i_make_telemetry_decoder_gs(const Gnss_Satellite &satellite,
bool dump) bool dump)
{ {
return beidou_b3i_telemetry_decoder_gs_sptr( return beidou_b3i_telemetry_decoder_gs_sptr(new beidou_b3i_telemetry_decoder_gs(satellite, dump));
new beidou_b3i_telemetry_decoder_gs(satellite, dump));
} }
@ -70,74 +70,37 @@ beidou_b3i_telemetry_decoder_gs::beidou_b3i_telemetry_decoder_gs(
this->message_port_register_out(pmt::mp("telemetry")); this->message_port_register_out(pmt::mp("telemetry"));
// Control messages to tracking block // Control messages to tracking block
this->message_port_register_out(pmt::mp("telemetry_to_trk")); this->message_port_register_out(pmt::mp("telemetry_to_trk"));
// initialize internal vars // initialize internal vars
d_dump = dump; d_dump = dump;
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
LOG(INFO) << "Initializing BeiDou B3I Telemetry Decoding for satellite " LOG(INFO) << "Initializing BeiDou B3I Telemetry Decoding for satellite " << this->d_satellite;
<< this->d_satellite;
d_samples_per_symbol = d_symbol_duration_ms = BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B3I_CODE_PERIOD_MS;
(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_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
d_samples_per_preamble = d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS * d_samples_per_symbol; d_preamble_samples = static_cast<int32_t *>(volk_gnsssdr_malloc(d_samples_per_preamble * sizeof(int32_t), volk_gnsssdr_get_alignment()));
d_secondary_code_symbols = static_cast<int32_t *>( d_preamble_period_samples = BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS;
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;
// 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 // Setting samples of preamble code
int32_t n = 0;
for (int32_t i = 0; i < d_symbols_per_preamble; i++) for (int32_t i = 0; i < d_symbols_per_preamble; i++)
{ {
int32_t m = 0;
if (BEIDOU_DNAV_PREAMBLE.at(i) == '1') if (BEIDOU_DNAV_PREAMBLE.at(i) == '1')
{ {
for (uint32_t j = 0; j < d_samples_per_symbol; j++) d_preamble_samples[i] = 1;
{
d_preamble_samples[n] = d_secondary_code_symbols[m];
n++;
m++;
m = m % BEIDOU_B3I_SECONDARY_CODE_LENGTH;
}
} }
else else
{ {
for (uint32_t j = 0; j < d_samples_per_symbol; j++) d_preamble_samples[i] = -1;
{
d_preamble_samples[n] = -d_secondary_code_symbols[m];
n++;
m++;
m = m % BEIDOU_B3I_SECONDARY_CODE_LENGTH;
}
} }
} }
d_subframe_symbols = static_cast<double *>( d_subframe_symbols = static_cast<float *>(volk_gnsssdr_malloc(BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(float), volk_gnsssdr_get_alignment()));
volk_gnsssdr_malloc(BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(double), d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS + d_samples_per_preamble;
volk_gnsssdr_get_alignment())); d_symbol_history.set_capacity(d_required_symbols);
d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS * d_samples_per_symbol +
d_samples_per_preamble;
d_symbol_history.set_capacity(d_required_symbols + 1);
d_last_valid_preamble = 0;
d_sent_tlm_failed_msg = false;
d_flag_valid_word = false;
// Generic settings // Generic settings
d_sample_counter = 0; d_sample_counter = 0;
d_stat = 0; d_stat = 0;
@ -156,7 +119,6 @@ beidou_b3i_telemetry_decoder_gs::beidou_b3i_telemetry_decoder_gs(
beidou_b3i_telemetry_decoder_gs::~beidou_b3i_telemetry_decoder_gs() beidou_b3i_telemetry_decoder_gs::~beidou_b3i_telemetry_decoder_gs()
{ {
volk_gnsssdr_free(d_preamble_samples); volk_gnsssdr_free(d_preamble_samples);
volk_gnsssdr_free(d_secondary_code_symbols);
volk_gnsssdr_free(d_subframe_symbols); volk_gnsssdr_free(d_subframe_symbols);
if (d_dump_file.is_open() == true) if (d_dump_file.is_open() == true)
@ -167,8 +129,7 @@ beidou_b3i_telemetry_decoder_gs::~beidou_b3i_telemetry_decoder_gs()
} }
catch (const std::exception &ex) catch (const std::exception &ex)
{ {
LOG(WARNING) << "Exception in destructor closing the dump file " LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
<< ex.what();
} }
} }
} }
@ -177,8 +138,9 @@ beidou_b3i_telemetry_decoder_gs::~beidou_b3i_telemetry_decoder_gs()
void beidou_b3i_telemetry_decoder_gs::decode_bch15_11_01(const int32_t *bits, void beidou_b3i_telemetry_decoder_gs::decode_bch15_11_01(const int32_t *bits,
int32_t *decbits) int32_t *decbits)
{ {
int32_t bit, err, reg[4] = {1, 1, 1, 1}; int32_t bit, err;
int32_t errind[15] = {14, 13, 10, 12, 6, 9, 4, 11, 0, 5, 7, 8, 1, 3, 2}; std::array<int32_t, 4> reg{1, 1, 1, 1};
const std::array<int32_t, 15> errind{14, 13, 10, 12, 6, 9, 4, 11, 0, 5, 7, 8, 1, 3, 2};
for (uint32_t i = 0; i < 15; i++) for (uint32_t i = 0; i < 15; i++)
{ {
@ -205,17 +167,19 @@ void beidou_b3i_telemetry_decoder_gs::decode_bch15_11_01(const int32_t *bits,
void beidou_b3i_telemetry_decoder_gs::decode_word( void beidou_b3i_telemetry_decoder_gs::decode_word(
int32_t word_counter, const double *enc_word_symbols, int32_t word_counter,
const float *enc_word_symbols,
int32_t *dec_word_symbols) int32_t *dec_word_symbols)
{ {
int32_t bitsbch[30], first_branch[15], second_branch[15]; std::array<int32_t, 30> bitsbch{};
std::array<int32_t, 15> first_branch{};
std::array<int32_t, 15> second_branch{};
if (word_counter == 1) if (word_counter == 1)
{ {
for (uint32_t j = 0; j < 30; j++) for (uint32_t j = 0; j < 30; j++)
{ {
dec_word_symbols[j] = dec_word_symbols[j] = static_cast<int32_t>(enc_word_symbols[j] > 0) ? (1) : (-1);
static_cast<int32_t>(enc_word_symbols[j] > 0) ? (1) : (-1);
} }
} }
else else
@ -224,13 +188,12 @@ void beidou_b3i_telemetry_decoder_gs::decode_word(
{ {
for (uint32_t c = 0; c < 15; c++) for (uint32_t c = 0; c < 15; c++)
{ {
bitsbch[r * 15 + c] = bitsbch[r * 15 + c] = static_cast<int32_t>(enc_word_symbols[c * 2 + r] > 0) ? (1) : (-1);
static_cast<int32_t>(enc_word_symbols[c * 2 + r] > 0) ? (1) : (-1);
} }
} }
decode_bch15_11_01(&bitsbch[0], first_branch); decode_bch15_11_01(&bitsbch[0], first_branch.data());
decode_bch15_11_01(&bitsbch[15], second_branch); decode_bch15_11_01(&bitsbch[15], second_branch.data());
for (uint32_t j = 0; j < 11; j++) for (uint32_t j = 0; j < 11; j++)
{ {
@ -247,17 +210,17 @@ void beidou_b3i_telemetry_decoder_gs::decode_word(
} }
void beidou_b3i_telemetry_decoder_gs::decode_subframe(double *frame_symbols) void beidou_b3i_telemetry_decoder_gs::decode_subframe(float *frame_symbols)
{ {
// 1. Transform from symbols to bits // 1. Transform from symbols to bits
std::string data_bits; std::string data_bits;
int32_t dec_word_bits[30]; std::array<int32_t, 30> dec_word_bits{};
// Decode each word in subframe // Decode each word in subframe
for (uint32_t ii = 0; ii < BEIDOU_DNAV_WORDS_SUBFRAME; ii++) for (uint32_t ii = 0; ii < BEIDOU_DNAV_WORDS_SUBFRAME; ii++)
{ {
// decode the word // decode the word
decode_word((ii + 1), &frame_symbols[ii * 30], dec_word_bits); decode_word((ii + 1), &frame_symbols[ii * 30], dec_word_bits.data());
// Save word to string format // Save word to string format
for (uint32_t jj = 0; jj < (BEIDOU_DNAV_WORD_LENGTH_BITS); jj++) for (uint32_t jj = 0; jj < (BEIDOU_DNAV_WORD_LENGTH_BITS); jj++)
@ -356,50 +319,62 @@ void beidou_b3i_telemetry_decoder_gs::set_satellite(
{ {
// Clear values from previous declaration // Clear values from previous declaration
volk_gnsssdr_free(d_preamble_samples); volk_gnsssdr_free(d_preamble_samples);
volk_gnsssdr_free(d_secondary_code_symbols);
volk_gnsssdr_free(d_subframe_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_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
d_samples_per_preamble = d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS * d_samples_per_symbol; d_preamble_samples = static_cast<int32_t *>(volk_gnsssdr_malloc(d_samples_per_preamble * sizeof(int32_t),
d_secondary_code_symbols = nullptr; volk_gnsssdr_get_alignment()));
d_preamble_samples = static_cast<int32_t *>( d_preamble_period_samples = BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS;
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;
// Setting samples of preamble code // Setting samples of preamble code
int32_t n = 0;
for (int32_t i = 0; i < d_symbols_per_preamble; i++) for (int32_t i = 0; i < d_symbols_per_preamble; i++)
{ {
if (BEIDOU_DNAV_PREAMBLE.at(i) == '1') if (BEIDOU_DNAV_PREAMBLE.at(i) == '1')
{ {
for (uint32_t j = 0; j < d_samples_per_symbol; j++) d_preamble_samples[i] = 1;
{
d_preamble_samples[n] = 1;
n++;
}
} }
else else
{ {
for (uint32_t j = 0; j < d_samples_per_symbol; j++) d_preamble_samples[i] = -1;
{ }
d_preamble_samples[n] = -1; }
n++; d_symbol_duration_ms = BEIDOU_B3I_GEO_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B3I_CODE_PERIOD_MS;
} d_subframe_symbols = static_cast<float *>(volk_gnsssdr_malloc(
BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(float),
volk_gnsssdr_get_alignment()));
d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS + d_samples_per_preamble;
d_symbol_history.set_capacity(d_required_symbols);
}
else
{
// Clear values from previous declaration
volk_gnsssdr_free(d_preamble_samples);
volk_gnsssdr_free(d_subframe_symbols);
//back to normal satellites
d_symbol_duration_ms = BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B3I_CODE_PERIOD_MS;
d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
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;
// Setting samples of preamble code
for (int32_t i = 0; i < d_symbols_per_preamble; i++)
{
if (BEIDOU_DNAV_PREAMBLE.at(i) == '1')
{
d_preamble_samples[i] = 1;
}
else
{
d_preamble_samples[i] = -1;
} }
} }
d_subframe_symbols = static_cast<double *>(volk_gnsssdr_malloc( d_subframe_symbols = static_cast<float *>(volk_gnsssdr_malloc(BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(float), volk_gnsssdr_get_alignment()));
BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(double), d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS + d_samples_per_preamble;
volk_gnsssdr_get_alignment())); d_symbol_history.set_capacity(d_required_symbols);
d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS * d_samples_per_symbol +
d_samples_per_preamble;
d_symbol_history.set_capacity(d_required_symbols + 1);
} }
} }
@ -434,6 +409,15 @@ void beidou_b3i_telemetry_decoder_gs::set_channel(int32_t channel)
} }
} }
void beidou_b3i_telemetry_decoder_gs::reset()
{
d_last_valid_preamble = d_sample_counter;
d_TOW_at_current_symbol_ms = 0;
d_sent_tlm_failed_msg = false;
d_flag_valid_word = false;
DLOG(INFO) << "Beidou B3I Telemetry decoder reset for satellite " << d_satellite;
return;
}
int beidou_b3i_telemetry_decoder_gs::general_work( int beidou_b3i_telemetry_decoder_gs::general_work(
int noutput_items __attribute__((unused)), int noutput_items __attribute__((unused)),
@ -454,10 +438,9 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
d_symbol_history.push_back(current_symbol.Prompt_I); // add new symbol to the symbol queue d_symbol_history.push_back(current_symbol.Prompt_I); // add new symbol to the symbol queue
d_sample_counter++; // count for the processed samples d_sample_counter++; // count for the processed samples
consume_each(1); consume_each(1);
d_flag_preamble = false; d_flag_preamble = false;
if (d_symbol_history.size() > d_required_symbols) if (d_symbol_history.size() >= d_required_symbols)
{ {
//******* preamble correlation ******** //******* preamble correlation ********
for (int32_t i = 0; i < d_samples_per_preamble; i++) for (int32_t i = 0; i < d_samples_per_preamble; i++)
@ -472,7 +455,6 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
} }
} }
} }
//******* frame sync ****************** //******* frame sync ******************
if (d_stat == 0) // no preamble information if (d_stat == 0) // no preamble information
{ {
@ -480,8 +462,7 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
{ {
// Record the preamble sample stamp // Record the preamble sample stamp
d_preamble_index = d_sample_counter; d_preamble_index = d_sample_counter;
LOG(INFO) << "Preamble detection for BEIDOU B3I SAT " DLOG(INFO) << "Preamble detection for BEIDOU B3I SAT " << this->d_satellite;
<< this->d_satellite;
// Enter into frame pre-detection status // Enter into frame pre-detection status
d_stat = 1; d_stat = 1;
} }
@ -495,10 +476,55 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
if (abs(preamble_diff - d_preamble_period_samples) == 0) if (abs(preamble_diff - d_preamble_period_samples) == 0)
{ {
// try to decode frame // try to decode frame
LOG(INFO) << "Starting BeiDou DNAV frame decoding for BeiDou B3I SAT " DLOG(INFO) << "Starting BeiDou DNAV frame decoding for BeiDou B3I SAT "
<< this->d_satellite; << this->d_satellite;
d_preamble_index = d_sample_counter; // record the preamble sample stamp d_preamble_index = d_sample_counter; // record the preamble sample stamp
d_stat = 2; d_stat = 2;
// ******* SAMPLES TO SYMBOLS *******
if (corr_value > 0) //normal PLL lock
{
for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++)
{
d_subframe_symbols[i] = d_symbol_history.at(i);
}
}
else // 180 deg. inverted carrier phase PLL lock
{
for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++)
{
d_subframe_symbols[i] = -d_symbol_history.at(i);
}
}
// call the decoder
decode_subframe(d_subframe_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)
{
DLOG(INFO) << "BeiDou DNAV frame sync lost for SAT "
<< this->d_satellite;
d_flag_frame_sync = false;
d_stat = 0;
flag_SOW_set = false;
}
}
} }
else else
{ {
@ -513,62 +539,21 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
} }
else if (d_stat == 2) // preamble acquired else if (d_stat == 2) // preamble acquired
{ {
if (d_sample_counter == if (d_sample_counter == d_preamble_index + static_cast<uint64_t>(d_preamble_period_samples))
d_preamble_index + static_cast<uint64_t>(d_preamble_period_samples))
{ {
//******* SAMPLES TO SYMBOLS ******* // ******* SAMPLES TO SYMBOLS *******
if (corr_value > 0) // normal PLL lock if (corr_value > 0) //normal PLL lock
{ {
int32_t k = 0;
for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++) for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++)
{ {
d_subframe_symbols[i] = 0; d_subframe_symbols[i] = d_symbol_history.at(i);
// 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 else // 180 deg. inverted carrier phase PLL lock
{ {
int32_t k = 0;
for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++) for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++)
{ {
d_subframe_symbols[i] = 0; d_subframe_symbols[i] = -d_symbol_history.at(i);
// 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;
}
}
} }
} }
@ -578,10 +563,8 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
if (d_nav.flag_crc_test == true) if (d_nav.flag_crc_test == true)
{ {
d_CRC_error_counter = 0; d_CRC_error_counter = 0;
d_flag_preamble = true; // valid preamble indicator (initialized to d_flag_preamble = true; // valid preamble indicator (initialized to false every work())
// false every work()) d_preamble_index = d_sample_counter; // record the preamble sample stamp (t_P)
d_preamble_index =
d_sample_counter; // record the preamble sample stamp (t_P)
if (!d_flag_frame_sync) if (!d_flag_frame_sync)
{ {
d_flag_frame_sync = true; d_flag_frame_sync = true;
@ -595,8 +578,8 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
d_preamble_index = d_sample_counter; // record the preamble sample stamp d_preamble_index = d_sample_counter; // record the preamble sample stamp
if (d_CRC_error_counter > CRC_ERROR_LIMIT) if (d_CRC_error_counter > CRC_ERROR_LIMIT)
{ {
LOG(INFO) << "BeiDou DNAV frame sync lost for SAT " DLOG(INFO) << "BeiDou DNAV frame sync lost for SAT "
<< this->d_satellite; << this->d_satellite;
d_flag_frame_sync = false; d_flag_frame_sync = false;
d_stat = 0; d_stat = 0;
flag_SOW_set = false; flag_SOW_set = false;
@ -604,63 +587,74 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
} }
} }
} }
// UPDATE GNSS SYNCHRO DATA // UPDATE GNSS SYNCHRO DATA
// 2. Add the telemetry decoder information // 2. Add the telemetry decoder information
if (this->d_flag_preamble == true and d_nav.flag_new_SOW_available == true) if (this->d_flag_preamble == true and d_nav.flag_new_SOW_available == true)
// update TOW at the preamble instant // update TOW at the preamble instant
{ {
// Reporting sow as gps time of week // 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_Preamble_ms = static_cast<uint32_t>((d_nav.d_SOW + BEIDOU_DNAV_BDT2GPST_LEAP_SEC_OFFSET) * 1000.0);
d_TOW_at_current_symbol_ms = //check TOW update consistency
d_TOW_at_Preamble_ms + static_cast<uint32_t>((d_required_symbols + 1) * uint32_t last_d_TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms;
BEIDOU_B3I_CODE_PERIOD_MS); //compute new TOW
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + d_required_symbols * d_symbol_duration_ms;
flag_SOW_set = true; flag_SOW_set = true;
d_nav.flag_new_SOW_available = false; 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) if (last_d_TOW_at_current_symbol_ms != 0 and abs(static_cast<int64_t>(d_TOW_at_current_symbol_ms) - int64_t(last_d_TOW_at_current_symbol_ms)) > d_symbol_duration_ms)
{ {
current_symbol.Flag_valid_word = true; LOG(INFO) << "Warning: BEIDOU B3I TOW update in ch " << d_channel
<< " does not match the TLM TOW counter " << static_cast<int64_t>(d_TOW_at_current_symbol_ms) - int64_t(last_d_TOW_at_current_symbol_ms) << " ms \n";
d_TOW_at_current_symbol_ms = 0;
d_flag_valid_word = false;
}
else
{
d_last_valid_preamble = d_sample_counter;
d_flag_valid_word = true;
}
} }
else else
{ {
current_symbol.Flag_valid_word = false; if (d_flag_valid_word)
{
d_TOW_at_current_symbol_ms += d_symbol_duration_ms;
if (current_symbol.Flag_valid_symbol_output == false)
{
d_flag_valid_word = false;
}
}
} }
current_symbol.PRN = this->d_satellite.get_PRN(); if (d_flag_valid_word == true)
current_symbol.TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms;
if (d_dump == true)
{ {
// MULTIPLEXED FILE RECORDING - Record results to file current_symbol.TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms;
try current_symbol.Flag_valid_word = d_flag_valid_word;
if (d_dump == true)
{ {
double tmp_double; // MULTIPLEXED FILE RECORDING - Record results to file
uint64_t tmp_ulong_int; try
tmp_double = static_cast<double>(d_TOW_at_current_symbol_ms); {
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double)); double tmp_double;
tmp_ulong_int = current_symbol.Tracking_sample_counter; uint64_t tmp_ulong_int;
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t)); tmp_double = static_cast<double>(d_TOW_at_current_symbol_ms) / 1000.0;
tmp_double = d_nav.d_SOW; d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double)); tmp_ulong_int = current_symbol.Tracking_sample_counter;
tmp_ulong_int = static_cast<uint64_t>(d_required_symbols); d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t));
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t)); tmp_double = static_cast<double>(d_TOW_at_Preamble_ms) / 1000.0;
} d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
catch (const std::ifstream::failure &e) }
{ catch (const std::ifstream::failure &e)
LOG(WARNING) << "Exception writing observables dump file " << e.what(); {
LOG(WARNING) << "Exception writing Telemetry GPS L5 dump file " << e.what();
}
} }
// 3. Make the output (copy the object contents to the GNURadio reserved memory)
*out[0] = current_symbol;
return 1;
} }
return 0;
// 3. Make the output (copy the object contents to the GNURadio reserved memory)
*out[0] = current_symbol;
return 1;
} }

View File

@ -60,10 +60,8 @@ public:
~beidou_b3i_telemetry_decoder_gs(); //!< Class destructor ~beidou_b3i_telemetry_decoder_gs(); //!< Class destructor
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
void set_channel(int channel); //!< Set receiver's channel void set_channel(int channel); //!< Set receiver's channel
inline void reset() void reset();
{
return;
}
/*! /*!
* \brief This is where all signal processing takes place * \brief This is where all signal processing takes place
*/ */
@ -77,27 +75,24 @@ private:
bool dump); bool dump);
beidou_b3i_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump); beidou_b3i_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
void decode_subframe(double *symbols); void decode_subframe(float *symbols);
void decode_word(int32_t word_counter, const double *enc_word_symbols, void decode_word(int32_t word_counter, const float *enc_word_symbols,
int32_t *dec_word_symbols); int32_t *dec_word_symbols);
void decode_bch15_11_01(const int32_t *bits, int32_t *decbits); void decode_bch15_11_01(const int32_t *bits, int32_t *decbits);
// Preamble decoding // Preamble decoding
int32_t *d_preamble_samples; 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_symbols_per_preamble;
int32_t d_samples_per_preamble; int32_t d_samples_per_preamble;
int32_t d_preamble_period_samples; int32_t d_preamble_period_samples;
double *d_subframe_symbols; float *d_subframe_symbols;
uint32_t d_required_symbols; uint32_t d_required_symbols;
// Storage for incoming data // Storage for incoming data
boost::circular_buffer<float> d_symbol_history; boost::circular_buffer<float> d_symbol_history;
// Variables for internal functionality // Variables for internal functionality
uint64_t d_sample_counter; // Sample counter as an index (1,2,3,..etc) uint64_t d_sample_counter; // Sample counter as an index (1,2,3,..etc) indicating number of samples processed
// indicating number of samples processed
uint64_t d_preamble_index; // Index of sample number where preamble was found uint64_t d_preamble_index; // Index of sample number where preamble was found
uint32_t d_stat; // Status of decoder uint32_t d_stat; // Status of decoder
bool d_flag_frame_sync; // Indicate when a frame sync is achieved bool d_flag_frame_sync; // Indicate when a frame sync is achieved
@ -109,8 +104,12 @@ private:
Beidou_Dnav_Navigation_Message d_nav; Beidou_Dnav_Navigation_Message d_nav;
// Values to populate gnss synchronization structure // Values to populate gnss synchronization structure
uint32_t d_symbol_duration_ms;
uint32_t d_TOW_at_Preamble_ms; uint32_t d_TOW_at_Preamble_ms;
uint32_t d_TOW_at_current_symbol_ms; uint32_t d_TOW_at_current_symbol_ms;
uint64_t d_last_valid_preamble;
bool d_flag_valid_word;
bool d_sent_tlm_failed_msg;
bool Flag_valid_word; bool Flag_valid_word;
// Satellite Information and logging capacity // Satellite Information and logging capacity

View File

@ -181,9 +181,9 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs(
d_symbol_history.set_capacity(d_required_symbols + 1); d_symbol_history.set_capacity(d_required_symbols + 1);
// vars for Viterbi decoder // vars for Viterbi decoder
int32_t max_states = 1 << mm; // 2^mm int32_t max_states = 1U << static_cast<uint32_t>(mm); // 2^mm
g_encoder[0] = 121; // Polynomial G1 g_encoder[0] = 121; // Polynomial G1
g_encoder[1] = 91; // Polynomial G2 g_encoder[1] = 91; // Polynomial G2
out0 = static_cast<int32_t *>(volk_gnsssdr_malloc(max_states * sizeof(int32_t), volk_gnsssdr_get_alignment())); out0 = static_cast<int32_t *>(volk_gnsssdr_malloc(max_states * sizeof(int32_t), volk_gnsssdr_get_alignment()));
out1 = static_cast<int32_t *>(volk_gnsssdr_malloc(max_states * sizeof(int32_t), volk_gnsssdr_get_alignment())); out1 = static_cast<int32_t *>(volk_gnsssdr_malloc(max_states * sizeof(int32_t), volk_gnsssdr_get_alignment()));
state0 = static_cast<int32_t *>(volk_gnsssdr_malloc(max_states * sizeof(int32_t), volk_gnsssdr_get_alignment())); state0 = static_cast<int32_t *>(volk_gnsssdr_malloc(max_states * sizeof(int32_t), volk_gnsssdr_get_alignment()));

View File

@ -38,12 +38,13 @@
#include <gnuradio/io_signature.h> #include <gnuradio/io_signature.h>
#include <pmt/pmt.h> // for make_any #include <pmt/pmt.h> // for make_any
#include <pmt/pmt_sugar.h> // for mp #include <pmt/pmt_sugar.h> // for mp
#include <cmath> // for floor, round #include <array>
#include <cstdlib> // for abs, malloc #include <cmath> // for floor, round
#include <cstring> // for memcpy #include <cstdlib> // for abs, malloc
#include <exception> // for exception #include <cstring> // for memcpy
#include <iostream> // for cout #include <exception> // for exception
#include <memory> // for shared_ptr, make_shared #include <iostream> // for cout
#include <memory> // for shared_ptr, make_shared
#define CRC_ERROR_LIMIT 6 #define CRC_ERROR_LIMIT 6
@ -75,11 +76,11 @@ glonass_l1_ca_telemetry_decoder_gs::glonass_l1_ca_telemetry_decoder_gs(
d_samples_per_symbol = (GLONASS_L1_CA_CODE_RATE_HZ / GLONASS_L1_CA_CODE_LENGTH_CHIPS) / GLONASS_L1_CA_SYMBOL_RATE_BPS; d_samples_per_symbol = (GLONASS_L1_CA_CODE_RATE_HZ / GLONASS_L1_CA_CODE_LENGTH_CHIPS) / GLONASS_L1_CA_SYMBOL_RATE_BPS;
// Set the preamble information // Set the preamble information
uint16_t preambles_bits[GLONASS_GNAV_PREAMBLE_LENGTH_BITS] = GLONASS_GNAV_PREAMBLE; std::array<uint16_t, GLONASS_GNAV_PREAMBLE_LENGTH_BITS> preambles_bits{GLONASS_GNAV_PREAMBLE};
// Since preamble rate is different than navigation data rate we use a constant // Since preamble rate is different than navigation data rate we use a constant
d_symbols_per_preamble = GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS; d_symbols_per_preamble = GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS;
memcpy(static_cast<uint16_t *>(this->d_preambles_bits), static_cast<uint16_t *>(preambles_bits), GLONASS_GNAV_PREAMBLE_LENGTH_BITS * sizeof(uint16_t)); memcpy(static_cast<uint16_t *>(this->d_preambles_bits), preambles_bits.data(), GLONASS_GNAV_PREAMBLE_LENGTH_BITS * sizeof(uint16_t));
// preamble bits to sampled symbols // preamble bits to sampled symbols
d_preambles_symbols = static_cast<int32_t *>(malloc(sizeof(int32_t) * d_symbols_per_preamble)); d_preambles_symbols = static_cast<int32_t *>(malloc(sizeof(int32_t) * d_symbols_per_preamble));
@ -349,7 +350,7 @@ int glonass_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribu
// NEW GLONASS string received // NEW GLONASS string received
// 0. fetch the symbols into an array // 0. fetch the symbols into an array
int32_t string_length = GLONASS_GNAV_STRING_SYMBOLS - d_symbols_per_preamble; int32_t string_length = GLONASS_GNAV_STRING_SYMBOLS - d_symbols_per_preamble;
double string_symbols[GLONASS_GNAV_DATA_SYMBOLS] = {0}; std::array<double, GLONASS_GNAV_DATA_SYMBOLS> string_symbols{};
// ******* SYMBOL TO BIT ******* // ******* SYMBOL TO BIT *******
for (int32_t i = 0; i < string_length; i++) for (int32_t i = 0; i < string_length; i++)
@ -365,7 +366,7 @@ int glonass_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribu
} }
// call the decoder // call the decoder
decode_string(string_symbols, string_length); decode_string(string_symbols.data(), string_length);
if (d_nav.flag_CRC_test == true) if (d_nav.flag_CRC_test == true)
{ {
d_CRC_error_counter = 0; d_CRC_error_counter = 0;

View File

@ -38,12 +38,13 @@
#include <gnuradio/io_signature.h> #include <gnuradio/io_signature.h>
#include <pmt/pmt.h> // for make_any #include <pmt/pmt.h> // for make_any
#include <pmt/pmt_sugar.h> // for mp #include <pmt/pmt_sugar.h> // for mp
#include <cmath> // for floor, round #include <array>
#include <cstdlib> // for abs, malloc #include <cmath> // for floor, round
#include <cstring> // for memcpy #include <cstdlib> // for abs, malloc
#include <exception> // for exception #include <cstring> // for memcpy
#include <iostream> // for cout #include <exception> // for exception
#include <memory> // for shared_ptr, make_shared #include <iostream> // for cout
#include <memory> // for shared_ptr, make_shared
#define CRC_ERROR_LIMIT 6 #define CRC_ERROR_LIMIT 6
@ -75,11 +76,11 @@ glonass_l2_ca_telemetry_decoder_gs::glonass_l2_ca_telemetry_decoder_gs(
d_samples_per_symbol = (GLONASS_L2_CA_CODE_RATE_HZ / GLONASS_L2_CA_CODE_LENGTH_CHIPS) / GLONASS_L2_CA_SYMBOL_RATE_BPS; d_samples_per_symbol = (GLONASS_L2_CA_CODE_RATE_HZ / GLONASS_L2_CA_CODE_LENGTH_CHIPS) / GLONASS_L2_CA_SYMBOL_RATE_BPS;
// Set the preamble information // Set the preamble information
uint16_t preambles_bits[GLONASS_GNAV_PREAMBLE_LENGTH_BITS] = GLONASS_GNAV_PREAMBLE; std::array<uint16_t, GLONASS_GNAV_PREAMBLE_LENGTH_BITS> preambles_bits{GLONASS_GNAV_PREAMBLE};
// Since preamble rate is different than navigation data rate we use a constant // Since preamble rate is different than navigation data rate we use a constant
d_symbols_per_preamble = GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS; d_symbols_per_preamble = GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS;
memcpy(static_cast<uint16_t *>(this->d_preambles_bits), static_cast<uint16_t *>(preambles_bits), GLONASS_GNAV_PREAMBLE_LENGTH_BITS * sizeof(uint16_t)); memcpy(static_cast<uint16_t *>(this->d_preambles_bits), preambles_bits.data(), GLONASS_GNAV_PREAMBLE_LENGTH_BITS * sizeof(uint16_t));
// preamble bits to sampled symbols // preamble bits to sampled symbols
d_preambles_symbols = static_cast<int32_t *>(malloc(sizeof(int32_t) * d_symbols_per_preamble)); d_preambles_symbols = static_cast<int32_t *>(malloc(sizeof(int32_t) * d_symbols_per_preamble));
@ -351,7 +352,7 @@ int glonass_l2_ca_telemetry_decoder_gs::general_work(int noutput_items __attribu
// NEW GLONASS string received // NEW GLONASS string received
// 0. fetch the symbols into an array // 0. fetch the symbols into an array
int32_t string_length = GLONASS_GNAV_STRING_SYMBOLS - d_symbols_per_preamble; int32_t string_length = GLONASS_GNAV_STRING_SYMBOLS - d_symbols_per_preamble;
double string_symbols[GLONASS_GNAV_DATA_SYMBOLS] = {0}; std::array<double, GLONASS_GNAV_DATA_SYMBOLS> string_symbols{};
// ******* SYMBOL TO BIT ******* // ******* SYMBOL TO BIT *******
for (int32_t i = 0; i < string_length; i++) for (int32_t i = 0; i < string_length; i++)
@ -367,7 +368,7 @@ int glonass_l2_ca_telemetry_decoder_gs::general_work(int noutput_items __attribu
} }
// call the decoder // call the decoder
decode_string(string_symbols, string_length); decode_string(string_symbols.data(), string_length);
if (d_nav.flag_CRC_test == true) if (d_nav.flag_CRC_test == true)
{ {
d_CRC_error_counter = 0; d_CRC_error_counter = 0;

View File

@ -38,6 +38,7 @@
#include <pmt/pmt.h> // for make_any #include <pmt/pmt.h> // for make_any
#include <pmt/pmt_sugar.h> // for mp #include <pmt/pmt_sugar.h> // for mp
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <array>
#include <cmath> // for round #include <cmath> // for round
#include <cstring> // for memcpy #include <cstring> // for memcpy
#include <exception> // for exception #include <exception> // for exception
@ -144,18 +145,18 @@ bool gps_l1_ca_telemetry_decoder_gs::gps_word_parityCheck(uint32_t gpsword)
// up bits which are to be XOR'ed together to implement the GPS parity // up bits which are to be XOR'ed together to implement the GPS parity
// check algorithm described in IS-GPS-200E. This avoids lengthy shift- // check algorithm described in IS-GPS-200E. This avoids lengthy shift-
// and-xor loops. // and-xor loops.
d1 = gpsword & 0xFBFFBF00; d1 = gpsword & 0xFBFFBF00U;
d2 = _rotl(gpsword, 1) & 0x07FFBF01; d2 = _rotl(gpsword, 1U) & 0x07FFBF01U;
d3 = _rotl(gpsword, 2) & 0xFC0F8100; d3 = _rotl(gpsword, 2U) & 0xFC0F8100U;
d4 = _rotl(gpsword, 3) & 0xF81FFE02; d4 = _rotl(gpsword, 3U) & 0xF81FFE02U;
d5 = _rotl(gpsword, 4) & 0xFC00000E; d5 = _rotl(gpsword, 4U) & 0xFC00000EU;
d6 = _rotl(gpsword, 5) & 0x07F00001; d6 = _rotl(gpsword, 5U) & 0x07F00001U;
d7 = _rotl(gpsword, 6) & 0x00003000; d7 = _rotl(gpsword, 6U) & 0x00003000U;
t = d1 ^ d2 ^ d3 ^ d4 ^ d5 ^ d6 ^ d7; t = d1 ^ d2 ^ d3 ^ d4 ^ d5 ^ d6 ^ d7;
// Now XOR the 5 6-bit fields together to produce the 6-bit final result. // Now XOR the 5 6-bit fields together to produce the 6-bit final result.
parity = t ^ _rotl(t, 6) ^ _rotl(t, 12) ^ _rotl(t, 18) ^ _rotl(t, 24); parity = t ^ _rotl(t, 6U) ^ _rotl(t, 12U) ^ _rotl(t, 18U) ^ _rotl(t, 24U);
parity = parity & 0x3F; parity = parity & 0x3FU;
if (parity == (gpsword & 0x3F)) if (parity == (gpsword & 0x3FU))
{ {
return true; return true;
} }
@ -205,7 +206,7 @@ void gps_l1_ca_telemetry_decoder_gs::set_channel(int32_t channel)
bool gps_l1_ca_telemetry_decoder_gs::decode_subframe() bool gps_l1_ca_telemetry_decoder_gs::decode_subframe()
{ {
char subframe[GPS_SUBFRAME_LENGTH]; std::array<char, GPS_SUBFRAME_LENGTH> subframe{};
int32_t frame_bit_index = 0; int32_t frame_bit_index = 0;
int32_t word_index = 0; int32_t word_index = 0;
uint32_t GPS_frame_4bytes = 0; uint32_t GPS_frame_4bytes = 0;
@ -229,19 +230,19 @@ bool gps_l1_ca_telemetry_decoder_gs::decode_subframe()
// Bits 0 to 29 = the GPS data word // Bits 0 to 29 = the GPS data word
// Bits 30 to 31 = 2 LSBs of the GPS word ahead. // Bits 30 to 31 = 2 LSBs of the GPS word ahead.
// prepare the extended frame [-2 -1 0 ... 30] // prepare the extended frame [-2 -1 0 ... 30]
if (d_prev_GPS_frame_4bytes & 0x00000001) if (d_prev_GPS_frame_4bytes & 0x00000001U)
{ {
GPS_frame_4bytes = GPS_frame_4bytes | 0x40000000; GPS_frame_4bytes = GPS_frame_4bytes | 0x40000000U;
} }
if (d_prev_GPS_frame_4bytes & 0x00000002) if (d_prev_GPS_frame_4bytes & 0x00000002U)
{ {
GPS_frame_4bytes = GPS_frame_4bytes | 0x80000000; GPS_frame_4bytes = GPS_frame_4bytes | 0x80000000U;
} }
// Check that the 2 most recently logged words pass parity. Have to first // Check that the 2 most recently logged words pass parity. Have to first
// invert the data bits according to bit 30 of the previous word. // invert the data bits according to bit 30 of the previous word.
if (GPS_frame_4bytes & 0x40000000) if (GPS_frame_4bytes & 0x40000000U)
{ {
GPS_frame_4bytes ^= 0x3FFFFFC0; // invert the data bits (using XOR) GPS_frame_4bytes ^= 0x3FFFFFC0U; // invert the data bits (using XOR)
} }
// check parity. If ANY word inside the subframe fails the parity, set subframe_synchro_confirmation = false // check parity. If ANY word inside the subframe fails the parity, set subframe_synchro_confirmation = false
if (not gps_l1_ca_telemetry_decoder_gs::gps_word_parityCheck(GPS_frame_4bytes)) if (not gps_l1_ca_telemetry_decoder_gs::gps_word_parityCheck(GPS_frame_4bytes))
@ -257,7 +258,7 @@ bool gps_l1_ca_telemetry_decoder_gs::decode_subframe()
} }
else else
{ {
GPS_frame_4bytes <<= 1; // shift 1 bit left the telemetry word GPS_frame_4bytes <<= 1U; // shift 1 bit left the telemetry word
} }
} }
@ -265,7 +266,7 @@ bool gps_l1_ca_telemetry_decoder_gs::decode_subframe()
// NEW GPS SUBFRAME HAS ARRIVED! // NEW GPS SUBFRAME HAS ARRIVED!
if (subframe_synchro_confirmation) if (subframe_synchro_confirmation)
{ {
int32_t subframe_ID = d_nav.subframe_decoder(subframe); // decode the subframe int32_t subframe_ID = d_nav.subframe_decoder(subframe.data()); // decode the subframe
if (subframe_ID > 0 and subframe_ID < 6) if (subframe_ID > 0 and subframe_ID < 6)
{ {
std::cout << "New GPS NAV message received in channel " << this->d_channel << ": " std::cout << "New GPS NAV message received in channel " << this->d_channel << ": "

View File

@ -182,7 +182,7 @@ int gps_l5_telemetry_decoder_gs::general_work(int noutput_items __attribute__((u
// Expand packet bits to bitsets. Notice the reverse order of the bits sequence, required by the CNAV message decoder // Expand packet bits to bitsets. Notice the reverse order of the bits sequence, required by the CNAV message decoder
for (uint32_t i = 0; i < GPS_L5_CNAV_DATA_PAGE_BITS; i++) for (uint32_t i = 0; i < GPS_L5_CNAV_DATA_PAGE_BITS; i++)
{ {
raw_bits[GPS_L5_CNAV_DATA_PAGE_BITS - 1 - i] = ((msg.raw_msg[i / 8] >> (7 - i % 8)) & 1u); raw_bits[GPS_L5_CNAV_DATA_PAGE_BITS - 1 - i] = ((msg.raw_msg[i / 8] >> (7 - i % 8)) & 1U);
} }
d_CNAV_Message.decode_page(raw_bits); d_CNAV_Message.decode_page(raw_bits);

View File

@ -34,9 +34,10 @@
#include <glog/logging.h> #include <glog/logging.h>
#include <gnuradio/io_signature.h> #include <gnuradio/io_signature.h>
#include <pmt/pmt_sugar.h> // for mp #include <pmt/pmt_sugar.h> // for mp
#include <cmath> // for abs #include <array>
#include <exception> // for exception #include <cmath> // for abs
#include <iomanip> // for operator<<, setw #include <exception> // for exception
#include <iomanip> // for operator<<, setw
// logging levels // logging levels
#define EVENT 2 // logs important events which don't occur every block #define EVENT 2 // logs important events which don't occur every block
@ -130,7 +131,7 @@ void sbas_l1_telemetry_decoder_gs::Sample_Aligner::reset()
*/ */
bool sbas_l1_telemetry_decoder_gs::Sample_Aligner::get_symbols(const std::vector<double> &samples, std::vector<double> &symbols) bool sbas_l1_telemetry_decoder_gs::Sample_Aligner::get_symbols(const std::vector<double> &samples, std::vector<double> &symbols)
{ {
double smpls[3] = {}; std::array<double, 3> smpls{};
double corr_diff; double corr_diff;
bool stand_by = true; bool stand_by = true;
double sym; double sym;
@ -191,12 +192,10 @@ sbas_l1_telemetry_decoder_gs::Symbol_Aligner_And_Decoder::Symbol_Aligner_And_Dec
// convolutional code properties // convolutional code properties
d_KK = 7; d_KK = 7;
const int32_t nn = 2; const int32_t nn = 2;
int32_t g_encoder[nn]; std::array<int32_t, nn> g_encoder{121, 91};
g_encoder[0] = 121;
g_encoder[1] = 91;
d_vd1 = new Viterbi_Decoder(g_encoder, d_KK, nn); d_vd1 = new Viterbi_Decoder(g_encoder.data(), d_KK, nn);
d_vd2 = new Viterbi_Decoder(g_encoder, d_KK, nn); d_vd2 = new Viterbi_Decoder(g_encoder.data(), d_KK, nn);
d_past_symbol = 0; d_past_symbol = 0;
} }

View File

@ -41,6 +41,7 @@
#include "dll_pll_conf.h" #include "dll_pll_conf.h"
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include <glog/logging.h> #include <glog/logging.h>
#include <array>
BeidouB1iDllPllTracking::BeidouB1iDllPllTracking( BeidouB1iDllPllTracking::BeidouB1iDllPllTracking(
@ -149,8 +150,8 @@ BeidouB1iDllPllTracking::BeidouB1iDllPllTracking(
trk_param.very_early_late_space_narrow_chips = 0.0; trk_param.very_early_late_space_narrow_chips = 0.0;
trk_param.track_pilot = false; trk_param.track_pilot = false;
trk_param.system = 'C'; trk_param.system = 'C';
char sig_[3] = "B1"; std::array<char, 3> sig_{'B', '1', '\0'};
std::memcpy(trk_param.signal, sig_, 3); std::memcpy(trk_param.signal, sig_.data(), 3);
trk_param.cn0_samples = configuration->property(role + ".cn0_samples", trk_param.cn0_samples); trk_param.cn0_samples = configuration->property(role + ".cn0_samples", trk_param.cn0_samples);
trk_param.cn0_min = configuration->property(role + ".cn0_min", trk_param.cn0_min); trk_param.cn0_min = configuration->property(role + ".cn0_min", trk_param.cn0_min);

View File

@ -41,6 +41,7 @@
#include "dll_pll_conf.h" #include "dll_pll_conf.h"
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include <glog/logging.h> #include <glog/logging.h>
#include <array>
using google::LogMessage; using google::LogMessage;
@ -154,8 +155,8 @@ BeidouB3iDllPllTracking::BeidouB3iDllPllTracking(
trk_param.very_early_late_space_chips = 0.0; trk_param.very_early_late_space_chips = 0.0;
trk_param.very_early_late_space_narrow_chips = 0.0; trk_param.very_early_late_space_narrow_chips = 0.0;
trk_param.system = 'C'; trk_param.system = 'C';
char sig_[3] = "B3"; std::array<char, 3> sig_{'B', '3', '\0'};
std::memcpy(trk_param.signal, sig_, 3); std::memcpy(trk_param.signal, sig_.data(), 3);
trk_param.cn0_samples = configuration->property(role + ".cn0_samples", trk_param.cn0_samples); trk_param.cn0_samples = configuration->property(role + ".cn0_samples", trk_param.cn0_samples);
trk_param.cn0_min = configuration->property(role + ".cn0_min", trk_param.cn0_min); trk_param.cn0_min = configuration->property(role + ".cn0_min", trk_param.cn0_min);
trk_param.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param.max_code_lock_fail); trk_param.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param.max_code_lock_fail);

View File

@ -41,7 +41,7 @@
#include "dll_pll_conf.h" #include "dll_pll_conf.h"
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include <glog/logging.h> #include <glog/logging.h>
#include <array>
GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking( GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking(
ConfigurationInterface* configuration, const std::string& role, ConfigurationInterface* configuration, const std::string& role,
@ -159,8 +159,8 @@ GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking(
int vector_length = std::round(fs_in / (GALILEO_E1_CODE_CHIP_RATE_HZ / GALILEO_E1_B_CODE_LENGTH_CHIPS)); int vector_length = std::round(fs_in / (GALILEO_E1_CODE_CHIP_RATE_HZ / GALILEO_E1_B_CODE_LENGTH_CHIPS));
trk_param.vector_length = vector_length; trk_param.vector_length = vector_length;
trk_param.system = 'E'; trk_param.system = 'E';
char sig_[3] = "1B"; std::array<char, 3> sig_{'1', 'B', '\0'};
std::memcpy(trk_param.signal, sig_, 3); std::memcpy(trk_param.signal, sig_.data(), 3);
trk_param.cn0_samples = configuration->property(role + ".cn0_samples", trk_param.cn0_samples); trk_param.cn0_samples = configuration->property(role + ".cn0_samples", trk_param.cn0_samples);
trk_param.cn0_min = configuration->property(role + ".cn0_min", trk_param.cn0_min); trk_param.cn0_min = configuration->property(role + ".cn0_min", trk_param.cn0_min);
trk_param.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param.max_code_lock_fail); trk_param.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param.max_code_lock_fail);

View File

@ -43,6 +43,7 @@
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include <glog/logging.h> #include <glog/logging.h>
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <array>
// the following flags are FPGA-specific and they are using arrange the values of the local code in the way the FPGA // the following flags are FPGA-specific and they are using arrange the values of the local code in the way the FPGA
// expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking. // expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking.
@ -166,8 +167,8 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga(
int32_t vector_length = std::round(fs_in / (GALILEO_E1_CODE_CHIP_RATE_HZ / GALILEO_E1_B_CODE_LENGTH_CHIPS)); int32_t vector_length = std::round(fs_in / (GALILEO_E1_CODE_CHIP_RATE_HZ / GALILEO_E1_B_CODE_LENGTH_CHIPS));
trk_param_fpga.vector_length = vector_length; trk_param_fpga.vector_length = vector_length;
trk_param_fpga.system = 'E'; trk_param_fpga.system = 'E';
char sig_[3] = "1B"; std::array<char, 3> sig_{'1', 'B', '\0'};
std::memcpy(trk_param_fpga.signal, sig_, 3); std::memcpy(trk_param_fpga.signal, sig_.data(), 3);
trk_param_fpga.cn0_samples = configuration->property(role + ".cn0_samples", trk_param_fpga.cn0_samples); trk_param_fpga.cn0_samples = configuration->property(role + ".cn0_samples", trk_param_fpga.cn0_samples);
trk_param_fpga.cn0_min = configuration->property(role + ".cn0_min", trk_param_fpga.cn0_min); trk_param_fpga.cn0_min = configuration->property(role + ".cn0_min", trk_param_fpga.cn0_min);
trk_param_fpga.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param_fpga.max_code_lock_fail); trk_param_fpga.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param_fpga.max_code_lock_fail);

View File

@ -40,7 +40,7 @@
#include "dll_pll_conf.h" #include "dll_pll_conf.h"
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include <glog/logging.h> #include <glog/logging.h>
#include <array>
GalileoE5aDllPllTracking::GalileoE5aDllPllTracking( GalileoE5aDllPllTracking::GalileoE5aDllPllTracking(
ConfigurationInterface* configuration, const std::string& role, ConfigurationInterface* configuration, const std::string& role,
@ -156,8 +156,8 @@ GalileoE5aDllPllTracking::GalileoE5aDllPllTracking(
trk_param.very_early_late_space_chips = 0.0; trk_param.very_early_late_space_chips = 0.0;
trk_param.very_early_late_space_narrow_chips = 0.0; trk_param.very_early_late_space_narrow_chips = 0.0;
trk_param.system = 'E'; trk_param.system = 'E';
char sig_[3] = "5X"; std::array<char, 3> sig_{'5', 'X', '\0'};
std::memcpy(trk_param.signal, sig_, 3); std::memcpy(trk_param.signal, sig_.data(), 3);
trk_param.cn0_samples = configuration->property(role + ".cn0_samples", trk_param.cn0_samples); trk_param.cn0_samples = configuration->property(role + ".cn0_samples", trk_param.cn0_samples);
trk_param.cn0_min = configuration->property(role + ".cn0_min", trk_param.cn0_min); trk_param.cn0_min = configuration->property(role + ".cn0_min", trk_param.cn0_min);
trk_param.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param.max_code_lock_fail); trk_param.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param.max_code_lock_fail);

View File

@ -38,6 +38,7 @@
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include <glog/logging.h> #include <glog/logging.h>
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <array>
// the following flags are FPGA-specific and they are using arrange the values of the local code in the way the FPGA // the following flags are FPGA-specific and they are using arrange the values of the local code in the way the FPGA
// expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking. // expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking.
@ -159,8 +160,8 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga(
trk_param_fpga.very_early_late_space_chips = 0.0; trk_param_fpga.very_early_late_space_chips = 0.0;
trk_param_fpga.very_early_late_space_narrow_chips = 0.0; trk_param_fpga.very_early_late_space_narrow_chips = 0.0;
trk_param_fpga.system = 'E'; trk_param_fpga.system = 'E';
char sig_[3] = "5X"; std::array<char, 3> sig_{'5', 'X', '\0'};
std::memcpy(trk_param_fpga.signal, sig_, 3); std::memcpy(trk_param_fpga.signal, sig_.data(), 3);
trk_param_fpga.cn0_samples = configuration->property(role + ".cn0_samples", trk_param_fpga.cn0_samples); trk_param_fpga.cn0_samples = configuration->property(role + ".cn0_samples", trk_param_fpga.cn0_samples);
trk_param_fpga.cn0_min = configuration->property(role + ".cn0_min", trk_param_fpga.cn0_min); trk_param_fpga.cn0_min = configuration->property(role + ".cn0_min", trk_param_fpga.cn0_min);
trk_param_fpga.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param_fpga.max_code_lock_fail); trk_param_fpga.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param_fpga.max_code_lock_fail);

View File

@ -42,7 +42,7 @@
#include "dll_pll_conf.h" #include "dll_pll_conf.h"
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include <glog/logging.h> #include <glog/logging.h>
#include <array>
GpsL1CaDllPllTracking::GpsL1CaDllPllTracking( GpsL1CaDllPllTracking::GpsL1CaDllPllTracking(
ConfigurationInterface* configuration, const std::string& role, ConfigurationInterface* configuration, const std::string& role,
@ -162,8 +162,8 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking(
trk_param.very_early_late_space_narrow_chips = 0.0; trk_param.very_early_late_space_narrow_chips = 0.0;
trk_param.track_pilot = false; trk_param.track_pilot = false;
trk_param.system = 'G'; trk_param.system = 'G';
char sig_[3] = "1C"; std::array<char, 3> sig_{'1', 'C', '\0'};
std::memcpy(trk_param.signal, sig_, 3); std::memcpy(trk_param.signal, sig_.data(), 3);
trk_param.cn0_samples = configuration->property(role + ".cn0_samples", trk_param.cn0_samples); trk_param.cn0_samples = configuration->property(role + ".cn0_samples", trk_param.cn0_samples);
trk_param.cn0_min = configuration->property(role + ".cn0_min", trk_param.cn0_min); trk_param.cn0_min = configuration->property(role + ".cn0_min", trk_param.cn0_min);
trk_param.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param.max_code_lock_fail); trk_param.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param.max_code_lock_fail);

View File

@ -43,6 +43,7 @@
#include "gps_sdr_signal_processing.h" #include "gps_sdr_signal_processing.h"
#include <glog/logging.h> #include <glog/logging.h>
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <array>
#define NUM_PRNs 32 // total number of PRNs #define NUM_PRNs 32 // total number of PRNs
#define GPS_CA_BIT_DURATION_MS 20 #define GPS_CA_BIT_DURATION_MS 20
@ -168,8 +169,8 @@ GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga(
trk_param_fpga.very_early_late_space_narrow_chips = 0.0; trk_param_fpga.very_early_late_space_narrow_chips = 0.0;
trk_param_fpga.track_pilot = false; trk_param_fpga.track_pilot = false;
trk_param_fpga.system = 'G'; trk_param_fpga.system = 'G';
char sig_[3] = "1C"; std::array<char, 3> sig_{'1', 'C', '\0'};
std::memcpy(trk_param_fpga.signal, sig_, 3); std::memcpy(trk_param_fpga.signal, sig_.data(), 3);
trk_param_fpga.cn0_samples = configuration->property(role + ".cn0_samples", trk_param_fpga.cn0_samples); trk_param_fpga.cn0_samples = configuration->property(role + ".cn0_samples", trk_param_fpga.cn0_samples);
trk_param_fpga.cn0_min = configuration->property(role + ".cn0_min", trk_param_fpga.cn0_min); trk_param_fpga.cn0_min = configuration->property(role + ".cn0_min", trk_param_fpga.cn0_min);
trk_param_fpga.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param_fpga.max_code_lock_fail); trk_param_fpga.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param_fpga.max_code_lock_fail);
@ -183,7 +184,6 @@ GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga(
// } // }
//trk_param_fpga.max_lock_fail = max_lock_fail; //trk_param_fpga.max_lock_fail = max_lock_fail;
// FPGA configuration parameters // FPGA configuration parameters
std::string default_device_name = "/dev/uio"; std::string default_device_name = "/dev/uio";
std::string device_name = configuration->property(role + ".devicename", default_device_name); std::string device_name = configuration->property(role + ".devicename", default_device_name);

View File

@ -41,7 +41,7 @@
#include "dll_pll_conf.h" #include "dll_pll_conf.h"
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include <glog/logging.h> #include <glog/logging.h>
#include <array>
GpsL2MDllPllTracking::GpsL2MDllPllTracking( GpsL2MDllPllTracking::GpsL2MDllPllTracking(
ConfigurationInterface* configuration, const std::string& role, ConfigurationInterface* configuration, const std::string& role,
@ -138,8 +138,8 @@ GpsL2MDllPllTracking::GpsL2MDllPllTracking(
trk_param.pll_bw_narrow_hz = 0.0; trk_param.pll_bw_narrow_hz = 0.0;
trk_param.dll_bw_narrow_hz = 0.0; trk_param.dll_bw_narrow_hz = 0.0;
trk_param.system = 'G'; trk_param.system = 'G';
char sig_[3] = "2S"; std::array<char, 3> sig_{'2', 'S', '\0'};
std::memcpy(trk_param.signal, sig_, 3); std::memcpy(trk_param.signal, sig_.data(), 3);
trk_param.cn0_samples = configuration->property(role + ".cn0_samples", trk_param.cn0_samples); trk_param.cn0_samples = configuration->property(role + ".cn0_samples", trk_param.cn0_samples);
trk_param.cn0_min = configuration->property(role + ".cn0_min", trk_param.cn0_min); trk_param.cn0_min = configuration->property(role + ".cn0_min", trk_param.cn0_min);
trk_param.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param.max_code_lock_fail); trk_param.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param.max_code_lock_fail);

View File

@ -45,11 +45,11 @@
#include "gps_l2c_signal.h" #include "gps_l2c_signal.h"
#include <glog/logging.h> #include <glog/logging.h>
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <array>
#include <cmath> // for round #include <cmath> // for round
#include <cstring> // for memcpy #include <cstring> // for memcpy
#include <iostream> #include <iostream>
#define NUM_PRNs 32 #define NUM_PRNs 32
@ -98,8 +98,8 @@ GpsL2MDllPllTrackingFpga::GpsL2MDllPllTrackingFpga(
trk_param_fpga.pll_bw_narrow_hz = 0.0; trk_param_fpga.pll_bw_narrow_hz = 0.0;
trk_param_fpga.dll_bw_narrow_hz = 0.0; trk_param_fpga.dll_bw_narrow_hz = 0.0;
trk_param_fpga.system = 'G'; trk_param_fpga.system = 'G';
char sig_[3] = "2S"; std::array<char, 3> sig_{'2', 'S', '\0'};
std::memcpy(trk_param_fpga.signal, sig_, 3); std::memcpy(trk_param_fpga.signal, sig_.data(), 3);
trk_param_fpga.cn0_samples = configuration->property(role + ".cn0_samples", trk_param_fpga.cn0_samples); trk_param_fpga.cn0_samples = configuration->property(role + ".cn0_samples", trk_param_fpga.cn0_samples);
trk_param_fpga.cn0_min = configuration->property(role + ".cn0_min", trk_param_fpga.cn0_min); trk_param_fpga.cn0_min = configuration->property(role + ".cn0_min", trk_param_fpga.cn0_min);
trk_param_fpga.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param_fpga.max_code_lock_fail); trk_param_fpga.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param_fpga.max_code_lock_fail);
@ -113,7 +113,6 @@ GpsL2MDllPllTrackingFpga::GpsL2MDllPllTrackingFpga(
// } // }
// trk_param_fpga.max_lock_fail = max_lock_fail; // trk_param_fpga.max_lock_fail = max_lock_fail;
// FPGA configuration parameters // FPGA configuration parameters
std::string default_device_name = "/dev/uio"; std::string default_device_name = "/dev/uio";
std::string device_name = configuration->property(role + ".devicename", default_device_name); std::string device_name = configuration->property(role + ".devicename", default_device_name);

View File

@ -41,7 +41,7 @@
#include "dll_pll_conf.h" #include "dll_pll_conf.h"
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include <glog/logging.h> #include <glog/logging.h>
#include <array>
GpsL5DllPllTracking::GpsL5DllPllTracking( GpsL5DllPllTracking::GpsL5DllPllTracking(
ConfigurationInterface* configuration, const std::string& role, ConfigurationInterface* configuration, const std::string& role,
@ -157,8 +157,8 @@ GpsL5DllPllTracking::GpsL5DllPllTracking(
trk_param.very_early_late_space_chips = 0.0; trk_param.very_early_late_space_chips = 0.0;
trk_param.very_early_late_space_narrow_chips = 0.0; trk_param.very_early_late_space_narrow_chips = 0.0;
trk_param.system = 'G'; trk_param.system = 'G';
char sig_[3] = "L5"; std::array<char, 3> sig_{'L', '5', '\0'};
std::memcpy(trk_param.signal, sig_, 3); std::memcpy(trk_param.signal, sig_.data(), 3);
trk_param.cn0_samples = configuration->property(role + ".cn0_samples", trk_param.cn0_samples); trk_param.cn0_samples = configuration->property(role + ".cn0_samples", trk_param.cn0_samples);
trk_param.cn0_min = configuration->property(role + ".cn0_min", trk_param.cn0_min); trk_param.cn0_min = configuration->property(role + ".cn0_min", trk_param.cn0_min);

View File

@ -42,13 +42,10 @@
#include "display.h" #include "display.h"
#include "dll_pll_conf_fpga.h" #include "dll_pll_conf_fpga.h"
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
//#include "gnss_synchro.h"
#include "gps_l5_signal.h" #include "gps_l5_signal.h"
#include <glog/logging.h> #include <glog/logging.h>
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
//#include <cmath> // for round #include <array>
//#include <cstring> // for memcpy
//#include <iostream>
#define NUM_PRNs 32 // number of PRNS #define NUM_PRNs 32 // number of PRNS
@ -172,8 +169,8 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga(
trk_param_fpga.very_early_late_space_chips = 0.0; trk_param_fpga.very_early_late_space_chips = 0.0;
trk_param_fpga.very_early_late_space_narrow_chips = 0.0; trk_param_fpga.very_early_late_space_narrow_chips = 0.0;
trk_param_fpga.system = 'G'; trk_param_fpga.system = 'G';
char sig_[3] = "L5"; std::array<char, 3> sig_{'L', '5', '\0'};
std::memcpy(trk_param_fpga.signal, sig_, 3); std::memcpy(trk_param_fpga.signal, sig_.data(), 3);
trk_param_fpga.cn0_samples = configuration->property(role + ".cn0_samples", trk_param_fpga.cn0_samples); trk_param_fpga.cn0_samples = configuration->property(role + ".cn0_samples", trk_param_fpga.cn0_samples);
trk_param_fpga.cn0_min = configuration->property(role + ".cn0_min", trk_param_fpga.cn0_min); trk_param_fpga.cn0_min = configuration->property(role + ".cn0_min", trk_param_fpga.cn0_min);
trk_param_fpga.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param_fpga.max_code_lock_fail); trk_param_fpga.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param_fpga.max_code_lock_fail);

View File

@ -61,13 +61,13 @@
#include <pmt/pmt_sugar.h> // for mp #include <pmt/pmt_sugar.h> // for mp
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <algorithm> // for fill_n #include <algorithm> // for fill_n
#include <array>
#include <cmath> // for fmod, round, floor #include <cmath> // for fmod, round, floor
#include <exception> // for exception #include <exception> // for exception
#include <gsl/gsl> #include <gsl/gsl>
#include <iostream> // for cout, cerr #include <iostream> // for cout, cerr
#include <map> #include <map>
#include <numeric> #include <numeric>
#include <vector>
#if HAS_STD_FILESYSTEM #if HAS_STD_FILESYSTEM
#if HAS_STD_FILESYSTEM_EXPERIMENTAL #if HAS_STD_FILESYSTEM_EXPERIMENTAL
@ -286,17 +286,16 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl
d_code_period = BEIDOU_B1I_CODE_PERIOD; d_code_period = BEIDOU_B1I_CODE_PERIOD;
d_code_chip_rate = BEIDOU_B1I_CODE_RATE_HZ; d_code_chip_rate = BEIDOU_B1I_CODE_RATE_HZ;
d_code_length_chips = static_cast<uint32_t>(BEIDOU_B1I_CODE_LENGTH_CHIPS); d_code_length_chips = static_cast<uint32_t>(BEIDOU_B1I_CODE_LENGTH_CHIPS);
//d_symbols_per_bit = BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT; //todo: enable after fixing beidou symbol synchronization d_symbols_per_bit = BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT; //todo: enable after fixing beidou symbol synchronization
d_symbols_per_bit = 1;
d_correlation_length_ms = 1; d_correlation_length_ms = 1;
d_code_samples_per_chip = 1; d_code_samples_per_chip = 1;
d_secondary = false; d_secondary = true;
trk_parameters.track_pilot = false; trk_parameters.track_pilot = false;
// synchronize and remove data secondary code // synchronize and remove data secondary code
d_secondary_code_length = static_cast<uint32_t>(BEIDOU_B1I_SECONDARY_CODE_LENGTH); d_secondary_code_length = static_cast<uint32_t>(BEIDOU_B1I_SECONDARY_CODE_LENGTH);
d_secondary_code_string = const_cast<std::string *>(&BEIDOU_B1I_SECONDARY_CODE_STR); d_secondary_code_string = const_cast<std::string *>(&BEIDOU_B1I_SECONDARY_CODE_STR);
//d_data_secondary_code_length = static_cast<uint32_t>(BEIDOU_B1I_SECONDARY_CODE_LENGTH); d_data_secondary_code_length = static_cast<uint32_t>(BEIDOU_B1I_SECONDARY_CODE_LENGTH);
//d_data_secondary_code_string = const_cast<std::string *>(&BEIDOU_B1I_SECONDARY_CODE_STR); d_data_secondary_code_string = const_cast<std::string *>(&BEIDOU_B1I_SECONDARY_CODE_STR);
} }
else if (signal_type == "B3") else if (signal_type == "B3")
{ {
@ -305,16 +304,15 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl
d_code_period = BEIDOU_B3I_CODE_PERIOD; d_code_period = BEIDOU_B3I_CODE_PERIOD;
d_code_chip_rate = BEIDOU_B3I_CODE_RATE_HZ; d_code_chip_rate = BEIDOU_B3I_CODE_RATE_HZ;
d_code_length_chips = static_cast<uint32_t>(BEIDOU_B3I_CODE_LENGTH_CHIPS); d_code_length_chips = static_cast<uint32_t>(BEIDOU_B3I_CODE_LENGTH_CHIPS);
//d_symbols_per_bit = BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT; //todo: enable after fixing beidou symbol synchronization d_symbols_per_bit = BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT; //todo: enable after fixing beidou symbol synchronization
d_symbols_per_bit = 1;
d_correlation_length_ms = 1; d_correlation_length_ms = 1;
d_code_samples_per_chip = 1; d_code_samples_per_chip = 1;
d_secondary = false; d_secondary = false;
trk_parameters.track_pilot = false; trk_parameters.track_pilot = false;
d_secondary_code_length = static_cast<uint32_t>(BEIDOU_B3I_SECONDARY_CODE_LENGTH); d_secondary_code_length = static_cast<uint32_t>(BEIDOU_B3I_SECONDARY_CODE_LENGTH);
d_secondary_code_string = const_cast<std::string *>(&BEIDOU_B3I_SECONDARY_CODE_STR); d_secondary_code_string = const_cast<std::string *>(&BEIDOU_B3I_SECONDARY_CODE_STR);
//d_data_secondary_code_length = static_cast<uint32_t>(BEIDOU_B3I_SECONDARY_CODE_LENGTH); d_data_secondary_code_length = static_cast<uint32_t>(BEIDOU_B3I_SECONDARY_CODE_LENGTH);
//d_data_secondary_code_string = const_cast<std::string *>(&BEIDOU_B3I_SECONDARY_CODE_STR); d_data_secondary_code_string = const_cast<std::string *>(&BEIDOU_B3I_SECONDARY_CODE_STR);
} }
else else
{ {
@ -580,8 +578,10 @@ void dll_pll_veml_tracking::start_tracking()
d_carrier_phase_rate_step_rad = 0.0; d_carrier_phase_rate_step_rad = 0.0;
d_carr_ph_history.clear(); d_carr_ph_history.clear();
d_code_ph_history.clear(); d_code_ph_history.clear();
std::array<char, 3> Signal_; std::array<char, 3> Signal_{};
std::memcpy(Signal_.data(), d_acquisition_gnss_synchro->Signal, 3); Signal_[0] = d_acquisition_gnss_synchro->Signal[0];
Signal_[1] = d_acquisition_gnss_synchro->Signal[1];
Signal_[2] = d_acquisition_gnss_synchro->Signal[2];
if (systemName == "GPS" and signal_type == "1C") if (systemName == "GPS" and signal_type == "1C")
{ {
@ -651,8 +651,7 @@ void dll_pll_veml_tracking::start_tracking()
// GEO Satellites use different secondary code // GEO Satellites use different secondary code
if (d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6) if (d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6)
{ {
//d_symbols_per_bit = BEIDOU_B1I_GEO_TELEMETRY_SYMBOLS_PER_BIT;//todo: enable after fixing beidou symbol synchronization d_symbols_per_bit = BEIDOU_B1I_GEO_TELEMETRY_SYMBOLS_PER_BIT; //todo: enable after fixing beidou symbol synchronization
d_symbols_per_bit = 1;
d_correlation_length_ms = 1; d_correlation_length_ms = 1;
d_code_samples_per_chip = 1; d_code_samples_per_chip = 1;
d_secondary = false; d_secondary = false;
@ -665,17 +664,16 @@ void dll_pll_veml_tracking::start_tracking()
} }
else else
{ {
//d_symbols_per_bit = BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT;//todo: enable after fixing beidou symbol synchronization d_symbols_per_bit = BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT; //todo: enable after fixing beidou symbol synchronization
d_symbols_per_bit = 1;
d_correlation_length_ms = 1; d_correlation_length_ms = 1;
d_code_samples_per_chip = 1; d_code_samples_per_chip = 1;
d_secondary = false; d_secondary = true;
trk_parameters.track_pilot = false; trk_parameters.track_pilot = false;
// synchronize and remove data secondary code // synchronize and remove data secondary code
d_secondary_code_length = static_cast<uint32_t>(BEIDOU_B1I_SECONDARY_CODE_LENGTH); d_secondary_code_length = static_cast<uint32_t>(BEIDOU_B1I_SECONDARY_CODE_LENGTH);
d_secondary_code_string = const_cast<std::string *>(&BEIDOU_B1I_SECONDARY_CODE_STR); d_secondary_code_string = const_cast<std::string *>(&BEIDOU_B1I_SECONDARY_CODE_STR);
//d_data_secondary_code_length = static_cast<uint32_t>(BEIDOU_B1I_SECONDARY_CODE_LENGTH); d_data_secondary_code_length = static_cast<uint32_t>(BEIDOU_B1I_SECONDARY_CODE_LENGTH);
//d_data_secondary_code_string = const_cast<std::string *>(&BEIDOU_B1I_SECONDARY_CODE_STR); d_data_secondary_code_string = const_cast<std::string *>(&BEIDOU_B1I_SECONDARY_CODE_STR);
d_Prompt_circular_buffer.set_capacity(d_secondary_code_length); d_Prompt_circular_buffer.set_capacity(d_secondary_code_length);
} }
} }
@ -686,8 +684,7 @@ void dll_pll_veml_tracking::start_tracking()
// Update secondary code settings for geo satellites // Update secondary code settings for geo satellites
if (d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6) if (d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6)
{ {
//d_symbols_per_bit = BEIDOU_B3I_GEO_TELEMETRY_SYMBOLS_PER_BIT;//todo: enable after fixing beidou symbol synchronization d_symbols_per_bit = BEIDOU_B3I_GEO_TELEMETRY_SYMBOLS_PER_BIT; //todo: enable after fixing beidou symbol synchronization
d_symbols_per_bit = 1;
d_correlation_length_ms = 1; d_correlation_length_ms = 1;
d_code_samples_per_chip = 1; d_code_samples_per_chip = 1;
d_secondary = false; d_secondary = false;
@ -700,17 +697,16 @@ void dll_pll_veml_tracking::start_tracking()
} }
else else
{ {
//d_symbols_per_bit = BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT; //todo: enable after fixing beidou symbol synchronization d_symbols_per_bit = BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT; //todo: enable after fixing beidou symbol synchronization
d_symbols_per_bit = 1;
d_correlation_length_ms = 1; d_correlation_length_ms = 1;
d_code_samples_per_chip = 1; d_code_samples_per_chip = 1;
d_secondary = false; d_secondary = true;
trk_parameters.track_pilot = false; trk_parameters.track_pilot = false;
// synchronize and remove data secondary code // synchronize and remove data secondary code
d_secondary_code_length = static_cast<uint32_t>(BEIDOU_B3I_SECONDARY_CODE_LENGTH); d_secondary_code_length = static_cast<uint32_t>(BEIDOU_B3I_SECONDARY_CODE_LENGTH);
d_secondary_code_string = const_cast<std::string *>(&BEIDOU_B3I_SECONDARY_CODE_STR); d_secondary_code_string = const_cast<std::string *>(&BEIDOU_B3I_SECONDARY_CODE_STR);
//d_data_secondary_code_length = static_cast<uint32_t>(BEIDOU_B3I_SECONDARY_CODE_LENGTH); d_data_secondary_code_length = static_cast<uint32_t>(BEIDOU_B3I_SECONDARY_CODE_LENGTH);
//d_data_secondary_code_string = const_cast<std::string *>(&BEIDOU_B3I_SECONDARY_CODE_STR); d_data_secondary_code_string = const_cast<std::string *>(&BEIDOU_B3I_SECONDARY_CODE_STR);
d_Prompt_circular_buffer.set_capacity(d_secondary_code_length); d_Prompt_circular_buffer.set_capacity(d_secondary_code_length);
} }
} }
@ -1443,92 +1439,92 @@ int32_t dll_pll_veml_tracking::save_matfile()
matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
if (reinterpret_cast<int64_t *>(matfp) != nullptr) if (reinterpret_cast<int64_t *>(matfp) != nullptr)
{ {
size_t dims[2] = {1, static_cast<size_t>(num_epoch)}; std::array<size_t, 2> dims{1, static_cast<size_t>(num_epoch)};
matvar = Mat_VarCreate("abs_VE", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_VE.data(), 0); matvar = Mat_VarCreate("abs_VE", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_VE.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E.data(), 0); matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_E.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("abs_P", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_P.data(), 0); matvar = Mat_VarCreate("abs_P", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_P.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("abs_L", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_L.data(), 0); matvar = Mat_VarCreate("abs_L", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_L.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("abs_VL", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_VL.data(), 0); matvar = Mat_VarCreate("abs_VL", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_VL.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("Prompt_I", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_I.data(), 0); matvar = Mat_VarCreate("Prompt_I", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), Prompt_I.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("Prompt_Q", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_Q.data(), 0); matvar = Mat_VarCreate("Prompt_Q", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), Prompt_Q.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("PRN_start_sample_count", MAT_C_UINT64, MAT_T_UINT64, 2, dims, PRN_start_sample_count.data(), 0); matvar = Mat_VarCreate("PRN_start_sample_count", MAT_C_UINT64, MAT_T_UINT64, 2, dims.data(), PRN_start_sample_count.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("acc_carrier_phase_rad", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, acc_carrier_phase_rad.data(), 0); matvar = Mat_VarCreate("acc_carrier_phase_rad", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), acc_carrier_phase_rad.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carrier_doppler_hz", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, carrier_doppler_hz.data(), 0); matvar = Mat_VarCreate("carrier_doppler_hz", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), carrier_doppler_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carrier_doppler_rate_hz", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, carrier_doppler_rate_hz.data(), 0); matvar = Mat_VarCreate("carrier_doppler_rate_hz", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), carrier_doppler_rate_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_freq_chips", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, code_freq_chips.data(), 0); matvar = Mat_VarCreate("code_freq_chips", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), code_freq_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_freq_rate_chips", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, code_freq_rate_chips.data(), 0); matvar = Mat_VarCreate("code_freq_rate_chips", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), code_freq_rate_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carr_error_hz", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, carr_error_hz.data(), 0); matvar = Mat_VarCreate("carr_error_hz", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), carr_error_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carr_error_filt_hz", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, carr_error_filt_hz.data(), 0); matvar = Mat_VarCreate("carr_error_filt_hz", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), carr_error_filt_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_error_chips", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, code_error_chips.data(), 0); matvar = Mat_VarCreate("code_error_chips", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), code_error_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, code_error_filt_chips.data(), 0); matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), code_error_filt_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("CN0_SNV_dB_Hz", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, CN0_SNV_dB_Hz.data(), 0); matvar = Mat_VarCreate("CN0_SNV_dB_Hz", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), CN0_SNV_dB_Hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carrier_lock_test", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, carrier_lock_test.data(), 0); matvar = Mat_VarCreate("carrier_lock_test", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), carrier_lock_test.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("aux1", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, aux1.data(), 0); matvar = Mat_VarCreate("aux1", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), aux1.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("aux2", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux2.data(), 0); matvar = Mat_VarCreate("aux2", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), aux2.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 2, dims, PRN.data(), 0); matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 2, dims.data(), PRN.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
} }
@ -1655,7 +1651,7 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused)
d_P_accu = *d_Prompt; d_P_accu = *d_Prompt;
d_L_accu = *d_Late; d_L_accu = *d_Late;
//fail-safe: check if the secondary code or bit synchronization has not succedded in a limited time period //fail-safe: check if the secondary code or bit synchronization has not succeeded in a limited time period
if (trk_parameters.bit_synchronization_time_limit_s < (d_sample_counter - d_acq_sample_stamp) / static_cast<int>(trk_parameters.fs_in)) if (trk_parameters.bit_synchronization_time_limit_s < (d_sample_counter - d_acq_sample_stamp) / static_cast<int>(trk_parameters.fs_in))
{ {
d_carrier_lock_fail_counter = 300000; //force loss-of-lock condition d_carrier_lock_fail_counter = 300000; //force loss-of-lock condition

View File

@ -1211,92 +1211,92 @@ int32_t dll_pll_veml_tracking_fpga::save_matfile()
matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
if (reinterpret_cast<int64_t *>(matfp) != nullptr) if (reinterpret_cast<int64_t *>(matfp) != nullptr)
{ {
size_t dims[2] = {1, static_cast<size_t>(num_epoch)}; std::array<size_t, 2> dims{1, static_cast<size_t>(num_epoch)};
matvar = Mat_VarCreate("abs_VE", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_VE.data(), 0); matvar = Mat_VarCreate("abs_VE", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_VE.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E.data(), 0); matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_E.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("abs_P", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_P.data(), 0); matvar = Mat_VarCreate("abs_P", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_P.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("abs_L", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_L.data(), 0); matvar = Mat_VarCreate("abs_L", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_L.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("abs_VL", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_VL.data(), 0); matvar = Mat_VarCreate("abs_VL", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_VL.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("Prompt_I", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_I.data(), 0); matvar = Mat_VarCreate("Prompt_I", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), Prompt_I.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("Prompt_Q", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_Q.data(), 0); matvar = Mat_VarCreate("Prompt_Q", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), Prompt_Q.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("PRN_start_sample_count", MAT_C_UINT64, MAT_T_UINT64, 2, dims, PRN_start_sample_count.data(), 0); matvar = Mat_VarCreate("PRN_start_sample_count", MAT_C_UINT64, MAT_T_UINT64, 2, dims.data(), PRN_start_sample_count.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("acc_carrier_phase_rad", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, acc_carrier_phase_rad.data(), 0); matvar = Mat_VarCreate("acc_carrier_phase_rad", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), acc_carrier_phase_rad.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carrier_doppler_hz", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, carrier_doppler_hz.data(), 0); matvar = Mat_VarCreate("carrier_doppler_hz", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), carrier_doppler_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carrier_doppler_rate_hz", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, carrier_doppler_rate_hz.data(), 0); matvar = Mat_VarCreate("carrier_doppler_rate_hz", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), carrier_doppler_rate_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_freq_chips", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, code_freq_chips.data(), 0); matvar = Mat_VarCreate("code_freq_chips", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), code_freq_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_freq_rate_chips", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, code_freq_rate_chips.data(), 0); matvar = Mat_VarCreate("code_freq_rate_chips", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), code_freq_rate_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carr_error_hz", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, carr_error_hz.data(), 0); matvar = Mat_VarCreate("carr_error_hz", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), carr_error_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carr_error_filt_hz", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, carr_error_filt_hz.data(), 0); matvar = Mat_VarCreate("carr_error_filt_hz", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), carr_error_filt_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_error_chips", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, code_error_chips.data(), 0); matvar = Mat_VarCreate("code_error_chips", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), code_error_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, code_error_filt_chips.data(), 0); matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), code_error_filt_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("CN0_SNV_dB_Hz", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, CN0_SNV_dB_Hz.data(), 0); matvar = Mat_VarCreate("CN0_SNV_dB_Hz", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), CN0_SNV_dB_Hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carrier_lock_test", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, carrier_lock_test.data(), 0); matvar = Mat_VarCreate("carrier_lock_test", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), carrier_lock_test.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("aux1", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, aux1.data(), 0); matvar = Mat_VarCreate("aux1", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), aux1.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("aux2", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux2.data(), 0); matvar = Mat_VarCreate("aux2", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), aux2.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 2, dims, PRN.data(), 0); matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 2, dims.data(), PRN.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
} }

View File

@ -467,9 +467,9 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attri
} }
//assign the GNURadio block output data //assign the GNURadio block output data
current_synchro_data.System = {'E'}; current_synchro_data.System = {'E'};
std::string str_aux = "1B"; current_synchro_data.Signal[0] = '1';
const char *str = str_aux.c_str(); // get a C style null terminated string current_synchro_data.Signal[1] = 'B';
std::memcpy(static_cast<void *>(current_synchro_data.Signal), str, 3); current_synchro_data.Signal[2] = '\0';
current_synchro_data.fs = d_fs_in; current_synchro_data.fs = d_fs_in;
*out[0] = current_synchro_data; *out[0] = current_synchro_data;

View File

@ -48,6 +48,7 @@
#include <matio.h> #include <matio.h>
#include <pmt/pmt.h> #include <pmt/pmt.h>
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <array>
#include <cmath> #include <cmath>
#include <exception> #include <exception>
#include <iostream> #include <iostream>
@ -447,76 +448,76 @@ int32_t glonass_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile()
matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
if (reinterpret_cast<int64_t *>(matfp) != nullptr) if (reinterpret_cast<int64_t *>(matfp) != nullptr)
{ {
size_t dims[2] = {1, static_cast<size_t>(num_epoch)}; std::array<size_t, 2> dims{1, static_cast<size_t>(num_epoch)};
matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E.data(), 0); matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_E.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("abs_P", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_P.data(), 0); matvar = Mat_VarCreate("abs_P", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_P.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("abs_L", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_L.data(), 0); matvar = Mat_VarCreate("abs_L", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_L.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("Prompt_I", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_I.data(), 0); matvar = Mat_VarCreate("Prompt_I", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), Prompt_I.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("Prompt_Q", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_Q.data(), 0); matvar = Mat_VarCreate("Prompt_Q", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), Prompt_Q.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("PRN_start_sample_count", MAT_C_UINT64, MAT_T_UINT64, 2, dims, PRN_start_sample_count.data(), 0); matvar = Mat_VarCreate("PRN_start_sample_count", MAT_C_UINT64, MAT_T_UINT64, 2, dims.data(), PRN_start_sample_count.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("acc_carrier_phase_rad", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, acc_carrier_phase_rad.data(), 0); matvar = Mat_VarCreate("acc_carrier_phase_rad", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), acc_carrier_phase_rad.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carrier_doppler_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_doppler_hz.data(), 0); matvar = Mat_VarCreate("carrier_doppler_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), carrier_doppler_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_freq_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_freq_chips.data(), 0); matvar = Mat_VarCreate("code_freq_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), code_freq_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carr_error_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_hz.data(), 0); matvar = Mat_VarCreate("carr_error_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), carr_error_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carr_error_filt_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_filt_hz.data(), 0); matvar = Mat_VarCreate("carr_error_filt_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), carr_error_filt_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_error_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_chips.data(), 0); matvar = Mat_VarCreate("code_error_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), code_error_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_filt_chips.data(), 0); matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), code_error_filt_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("CN0_SNV_dB_Hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, CN0_SNV_dB_Hz.data(), 0); matvar = Mat_VarCreate("CN0_SNV_dB_Hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), CN0_SNV_dB_Hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carrier_lock_test", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_lock_test.data(), 0); matvar = Mat_VarCreate("carrier_lock_test", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), carrier_lock_test.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("aux1", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux1.data(), 0); matvar = Mat_VarCreate("aux1", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), aux1.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("aux2", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux2.data(), 0); matvar = Mat_VarCreate("aux2", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), aux2.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 2, dims, PRN.data(), 0); matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 2, dims.data(), PRN.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
} }

View File

@ -47,6 +47,7 @@
#include <gnuradio/io_signature.h> #include <gnuradio/io_signature.h>
#include <matio.h> #include <matio.h>
#include <pmt/pmt.h> #include <pmt/pmt.h>
#include <array>
#include <cmath> #include <cmath>
#include <exception> #include <exception>
#include <iostream> #include <iostream>
@ -395,76 +396,76 @@ int32_t glonass_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile()
matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
if (reinterpret_cast<int64_t *>(matfp) != nullptr) if (reinterpret_cast<int64_t *>(matfp) != nullptr)
{ {
size_t dims[2] = {1, static_cast<size_t>(num_epoch)}; std::array<size_t, 2> dims{1, static_cast<size_t>(num_epoch)};
matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E.data(), 0); matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_E.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("abs_P", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_P.data(), 0); matvar = Mat_VarCreate("abs_P", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_P.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("abs_L", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_L.data(), 0); matvar = Mat_VarCreate("abs_L", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_L.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("Prompt_I", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_I.data(), 0); matvar = Mat_VarCreate("Prompt_I", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), Prompt_I.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("Prompt_Q", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_Q.data(), 0); matvar = Mat_VarCreate("Prompt_Q", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), Prompt_Q.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("PRN_start_sample_count", MAT_C_UINT64, MAT_T_UINT64, 2, dims, PRN_start_sample_count.data(), 0); matvar = Mat_VarCreate("PRN_start_sample_count", MAT_C_UINT64, MAT_T_UINT64, 2, dims.data(), PRN_start_sample_count.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("acc_carrier_phase_rad", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, acc_carrier_phase_rad.data(), 0); matvar = Mat_VarCreate("acc_carrier_phase_rad", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), acc_carrier_phase_rad.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carrier_doppler_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_doppler_hz.data(), 0); matvar = Mat_VarCreate("carrier_doppler_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), carrier_doppler_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_freq_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_freq_chips.data(), 0); matvar = Mat_VarCreate("code_freq_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), code_freq_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carr_error_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_hz.data(), 0); matvar = Mat_VarCreate("carr_error_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), carr_error_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carr_error_filt_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_filt_hz.data(), 0); matvar = Mat_VarCreate("carr_error_filt_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), carr_error_filt_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_error_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_chips.data(), 0); matvar = Mat_VarCreate("code_error_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), code_error_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_filt_chips.data(), 0); matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), code_error_filt_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("CN0_SNV_dB_Hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, CN0_SNV_dB_Hz.data(), 0); matvar = Mat_VarCreate("CN0_SNV_dB_Hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), CN0_SNV_dB_Hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carrier_lock_test", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_lock_test.data(), 0); matvar = Mat_VarCreate("carrier_lock_test", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), carrier_lock_test.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("aux1", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux1.data(), 0); matvar = Mat_VarCreate("aux1", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), aux1.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("aux2", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux2.data(), 0); matvar = Mat_VarCreate("aux2", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), aux2.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 2, dims, PRN.data(), 0); matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 2, dims.data(), PRN.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
} }

View File

@ -46,13 +46,13 @@
#include <gnuradio/io_signature.h> #include <gnuradio/io_signature.h>
#include <matio.h> #include <matio.h>
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <array>
#include <cmath> #include <cmath>
#include <exception> #include <exception>
#include <iostream> #include <iostream>
#include <memory> #include <memory>
#include <sstream> #include <sstream>
#include <utility> #include <utility>
#include <vector>
#define CN0_ESTIMATION_SAMPLES 10 #define CN0_ESTIMATION_SAMPLES 10
@ -400,76 +400,76 @@ int32_t Glonass_L1_Ca_Dll_Pll_Tracking_cc::save_matfile()
matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
if (reinterpret_cast<int64_t *>(matfp) != nullptr) if (reinterpret_cast<int64_t *>(matfp) != nullptr)
{ {
size_t dims[2] = {1, static_cast<size_t>(num_epoch)}; std::array<size_t, 2> dims{1, static_cast<size_t>(num_epoch)};
matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E.data(), 0); matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_E.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("abs_P", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_P.data(), 0); matvar = Mat_VarCreate("abs_P", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_P.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("abs_L", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_L.data(), 0); matvar = Mat_VarCreate("abs_L", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_L.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("Prompt_I", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_I.data(), 0); matvar = Mat_VarCreate("Prompt_I", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), Prompt_I.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("Prompt_Q", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_Q.data(), 0); matvar = Mat_VarCreate("Prompt_Q", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), Prompt_Q.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("PRN_start_sample_count", MAT_C_UINT64, MAT_T_UINT64, 2, dims, PRN_start_sample_count.data(), 0); matvar = Mat_VarCreate("PRN_start_sample_count", MAT_C_UINT64, MAT_T_UINT64, 2, dims.data(), PRN_start_sample_count.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("acc_carrier_phase_rad", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, acc_carrier_phase_rad.data(), 0); matvar = Mat_VarCreate("acc_carrier_phase_rad", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), acc_carrier_phase_rad.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carrier_doppler_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_doppler_hz.data(), 0); matvar = Mat_VarCreate("carrier_doppler_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), carrier_doppler_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_freq_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_freq_chips.data(), 0); matvar = Mat_VarCreate("code_freq_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), code_freq_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carr_error_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_hz.data(), 0); matvar = Mat_VarCreate("carr_error_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), carr_error_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carr_error_filt_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_filt_hz.data(), 0); matvar = Mat_VarCreate("carr_error_filt_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), carr_error_filt_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_error_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_chips.data(), 0); matvar = Mat_VarCreate("code_error_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), code_error_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_filt_chips.data(), 0); matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), code_error_filt_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("CN0_SNV_dB_Hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, CN0_SNV_dB_Hz.data(), 0); matvar = Mat_VarCreate("CN0_SNV_dB_Hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), CN0_SNV_dB_Hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carrier_lock_test", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_lock_test.data(), 0); matvar = Mat_VarCreate("carrier_lock_test", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), carrier_lock_test.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("aux1", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux1.data(), 0); matvar = Mat_VarCreate("aux1", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), aux1.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("aux2", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux2.data(), 0); matvar = Mat_VarCreate("aux2", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), aux2.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 2, dims, PRN.data(), 0); matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 2, dims.data(), PRN.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
} }

View File

@ -46,13 +46,13 @@
#include <matio.h> #include <matio.h>
#include <pmt/pmt.h> #include <pmt/pmt.h>
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <array>
#include <cmath> #include <cmath>
#include <exception> #include <exception>
#include <iostream> #include <iostream>
#include <memory> #include <memory>
#include <sstream> #include <sstream>
#include <utility> #include <utility>
#include <vector>
#define CN0_ESTIMATION_SAMPLES 10 #define CN0_ESTIMATION_SAMPLES 10
@ -446,76 +446,76 @@ int32_t glonass_l2_ca_dll_pll_c_aid_tracking_cc::save_matfile()
matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
if (reinterpret_cast<int64_t *>(matfp) != nullptr) if (reinterpret_cast<int64_t *>(matfp) != nullptr)
{ {
size_t dims[2] = {1, static_cast<size_t>(num_epoch)}; std::array<size_t, 2> dims{1, static_cast<size_t>(num_epoch)};
matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E.data(), 0); matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_E.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("abs_P", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_P.data(), 0); matvar = Mat_VarCreate("abs_P", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_P.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("abs_L", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_L.data(), 0); matvar = Mat_VarCreate("abs_L", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_L.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("Prompt_I", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_I.data(), 0); matvar = Mat_VarCreate("Prompt_I", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), Prompt_I.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("Prompt_Q", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_Q.data(), 0); matvar = Mat_VarCreate("Prompt_Q", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), Prompt_Q.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("PRN_start_sample_count", MAT_C_UINT64, MAT_T_UINT64, 2, dims, PRN_start_sample_count.data(), 0); matvar = Mat_VarCreate("PRN_start_sample_count", MAT_C_UINT64, MAT_T_UINT64, 2, dims.data(), PRN_start_sample_count.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("acc_carrier_phase_rad", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, acc_carrier_phase_rad.data(), 0); matvar = Mat_VarCreate("acc_carrier_phase_rad", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), acc_carrier_phase_rad.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carrier_doppler_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_doppler_hz.data(), 0); matvar = Mat_VarCreate("carrier_doppler_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), carrier_doppler_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_freq_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_freq_chips.data(), 0); matvar = Mat_VarCreate("code_freq_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), code_freq_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carr_error_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_hz.data(), 0); matvar = Mat_VarCreate("carr_error_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), carr_error_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carr_error_filt_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_filt_hz.data(), 0); matvar = Mat_VarCreate("carr_error_filt_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), carr_error_filt_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_error_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_chips.data(), 0); matvar = Mat_VarCreate("code_error_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), code_error_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_filt_chips.data(), 0); matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), code_error_filt_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("CN0_SNV_dB_Hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, CN0_SNV_dB_Hz.data(), 0); matvar = Mat_VarCreate("CN0_SNV_dB_Hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), CN0_SNV_dB_Hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carrier_lock_test", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_lock_test.data(), 0); matvar = Mat_VarCreate("carrier_lock_test", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), carrier_lock_test.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("aux1", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux1.data(), 0); matvar = Mat_VarCreate("aux1", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), aux1.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("aux2", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux2.data(), 0); matvar = Mat_VarCreate("aux2", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), aux2.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 2, dims, PRN.data(), 0); matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 2, dims.data(), PRN.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
} }

View File

@ -45,6 +45,7 @@
#include <gnuradio/io_signature.h> #include <gnuradio/io_signature.h>
#include <matio.h> #include <matio.h>
#include <pmt/pmt.h> #include <pmt/pmt.h>
#include <array>
#include <cmath> #include <cmath>
#include <exception> #include <exception>
#include <iostream> #include <iostream>
@ -394,76 +395,76 @@ int32_t glonass_l2_ca_dll_pll_c_aid_tracking_sc::save_matfile()
matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
if (reinterpret_cast<int64_t *>(matfp) != nullptr) if (reinterpret_cast<int64_t *>(matfp) != nullptr)
{ {
size_t dims[2] = {1, static_cast<size_t>(num_epoch)}; std::array<size_t, 2> dims{1, static_cast<size_t>(num_epoch)};
matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E.data(), 0); matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_E.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("abs_P", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_P.data(), 0); matvar = Mat_VarCreate("abs_P", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_P.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("abs_L", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_L.data(), 0); matvar = Mat_VarCreate("abs_L", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_L.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("Prompt_I", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_I.data(), 0); matvar = Mat_VarCreate("Prompt_I", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), Prompt_I.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("Prompt_Q", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_Q.data(), 0); matvar = Mat_VarCreate("Prompt_Q", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), Prompt_Q.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("PRN_start_sample_count", MAT_C_UINT64, MAT_T_UINT64, 2, dims, PRN_start_sample_count.data(), 0); matvar = Mat_VarCreate("PRN_start_sample_count", MAT_C_UINT64, MAT_T_UINT64, 2, dims.data(), PRN_start_sample_count.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("acc_carrier_phase_rad", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, acc_carrier_phase_rad.data(), 0); matvar = Mat_VarCreate("acc_carrier_phase_rad", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), acc_carrier_phase_rad.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carrier_doppler_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_doppler_hz.data(), 0); matvar = Mat_VarCreate("carrier_doppler_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), carrier_doppler_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_freq_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_freq_chips.data(), 0); matvar = Mat_VarCreate("code_freq_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), code_freq_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carr_error_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_hz.data(), 0); matvar = Mat_VarCreate("carr_error_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), carr_error_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carr_error_filt_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_filt_hz.data(), 0); matvar = Mat_VarCreate("carr_error_filt_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), carr_error_filt_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_error_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_chips.data(), 0); matvar = Mat_VarCreate("code_error_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), code_error_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_filt_chips.data(), 0); matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), code_error_filt_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("CN0_SNV_dB_Hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, CN0_SNV_dB_Hz.data(), 0); matvar = Mat_VarCreate("CN0_SNV_dB_Hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), CN0_SNV_dB_Hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carrier_lock_test", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_lock_test.data(), 0); matvar = Mat_VarCreate("carrier_lock_test", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), carrier_lock_test.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("aux1", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux1.data(), 0); matvar = Mat_VarCreate("aux1", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), aux1.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("aux2", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux2.data(), 0); matvar = Mat_VarCreate("aux2", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), aux2.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 2, dims, PRN.data(), 0); matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 2, dims.data(), PRN.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
} }

View File

@ -46,6 +46,7 @@
#include <gnuradio/io_signature.h> #include <gnuradio/io_signature.h>
#include <matio.h> #include <matio.h>
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <array>
#include <cmath> #include <cmath>
#include <exception> #include <exception>
#include <iostream> #include <iostream>
@ -399,76 +400,76 @@ int32_t Glonass_L2_Ca_Dll_Pll_Tracking_cc::save_matfile()
matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
if (reinterpret_cast<int64_t *>(matfp) != nullptr) if (reinterpret_cast<int64_t *>(matfp) != nullptr)
{ {
size_t dims[2] = {1, static_cast<size_t>(num_epoch)}; std::array<size_t, 2> dims{1, static_cast<size_t>(num_epoch)};
matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E.data(), 0); matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_E.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("abs_P", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_P.data(), 0); matvar = Mat_VarCreate("abs_P", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_P.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("abs_L", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_L.data(), 0); matvar = Mat_VarCreate("abs_L", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_L.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("Prompt_I", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_I.data(), 0); matvar = Mat_VarCreate("Prompt_I", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), Prompt_I.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("Prompt_Q", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_Q.data(), 0); matvar = Mat_VarCreate("Prompt_Q", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), Prompt_Q.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("PRN_start_sample_count", MAT_C_UINT64, MAT_T_UINT64, 2, dims, PRN_start_sample_count.data(), 0); matvar = Mat_VarCreate("PRN_start_sample_count", MAT_C_UINT64, MAT_T_UINT64, 2, dims.data(), PRN_start_sample_count.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("acc_carrier_phase_rad", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, acc_carrier_phase_rad.data(), 0); matvar = Mat_VarCreate("acc_carrier_phase_rad", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), acc_carrier_phase_rad.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carrier_doppler_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_doppler_hz.data(), 0); matvar = Mat_VarCreate("carrier_doppler_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), carrier_doppler_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_freq_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_freq_chips.data(), 0); matvar = Mat_VarCreate("code_freq_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), code_freq_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carr_error_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_hz.data(), 0); matvar = Mat_VarCreate("carr_error_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), carr_error_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carr_error_filt_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carr_error_filt_hz.data(), 0); matvar = Mat_VarCreate("carr_error_filt_hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), carr_error_filt_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_error_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_chips.data(), 0); matvar = Mat_VarCreate("code_error_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), code_error_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, code_error_filt_chips.data(), 0); matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), code_error_filt_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("CN0_SNV_dB_Hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, CN0_SNV_dB_Hz.data(), 0); matvar = Mat_VarCreate("CN0_SNV_dB_Hz", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), CN0_SNV_dB_Hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carrier_lock_test", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, carrier_lock_test.data(), 0); matvar = Mat_VarCreate("carrier_lock_test", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), carrier_lock_test.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("aux1", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux1.data(), 0); matvar = Mat_VarCreate("aux1", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), aux1.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("aux2", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux2.data(), 0); matvar = Mat_VarCreate("aux2", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), aux2.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 2, dims, PRN.data(), 0); matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 2, dims.data(), PRN.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
} }

View File

@ -47,6 +47,7 @@
#include <gnuradio/io_signature.h> #include <gnuradio/io_signature.h>
#include <matio.h> #include <matio.h>
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <array>
#include <cmath> #include <cmath>
#include <exception> #include <exception>
#include <gsl/gsl> #include <gsl/gsl>
@ -54,7 +55,6 @@
#include <memory> #include <memory>
#include <sstream> #include <sstream>
#include <utility> #include <utility>
#include <vector>
gps_l1_ca_kf_tracking_cc_sptr gps_l1_ca_kf_tracking_cc_sptr
@ -504,92 +504,92 @@ int32_t Gps_L1_Ca_Kf_Tracking_cc::save_matfile()
matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
if (reinterpret_cast<int64_t *>(matfp) != nullptr) if (reinterpret_cast<int64_t *>(matfp) != nullptr)
{ {
size_t dims[2] = {1, static_cast<size_t>(num_epoch)}; std::array<size_t, 2> dims{1, static_cast<size_t>(num_epoch)};
matvar = Mat_VarCreate("abs_VE", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_VE.data(), 0); matvar = Mat_VarCreate("abs_VE", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_VE.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_E.data(), 0); matvar = Mat_VarCreate("abs_E", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_E.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("abs_P", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_P.data(), 0); matvar = Mat_VarCreate("abs_P", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_P.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("abs_L", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_L.data(), 0); matvar = Mat_VarCreate("abs_L", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_L.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("abs_VL", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_VL.data(), 0); matvar = Mat_VarCreate("abs_VL", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), abs_VL.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("Prompt_I", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_I.data(), 0); matvar = Mat_VarCreate("Prompt_I", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), Prompt_I.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("Prompt_Q", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, Prompt_Q.data(), 0); matvar = Mat_VarCreate("Prompt_Q", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), Prompt_Q.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("PRN_start_sample_count", MAT_C_UINT64, MAT_T_UINT64, 2, dims, PRN_start_sample_count.data(), 0); matvar = Mat_VarCreate("PRN_start_sample_count", MAT_C_UINT64, MAT_T_UINT64, 2, dims.data(), PRN_start_sample_count.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("acc_carrier_phase_rad", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, acc_carrier_phase_rad.data(), 0); matvar = Mat_VarCreate("acc_carrier_phase_rad", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), acc_carrier_phase_rad.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carrier_doppler_hz", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, carrier_doppler_hz.data(), 0); matvar = Mat_VarCreate("carrier_doppler_hz", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), carrier_doppler_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carrier_dopplerrate_hz2", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, carrier_dopplerrate_hz2.data(), 0); matvar = Mat_VarCreate("carrier_dopplerrate_hz2", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), carrier_dopplerrate_hz2.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_freq_chips", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, code_freq_chips.data(), 0); matvar = Mat_VarCreate("code_freq_chips", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), code_freq_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carr_error_hz", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, carr_error_hz.data(), 0); matvar = Mat_VarCreate("carr_error_hz", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), carr_error_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carr_noise_sigma2", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, carr_noise_sigma2.data(), 0); matvar = Mat_VarCreate("carr_noise_sigma2", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), carr_noise_sigma2.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carr_error_filt_hz", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, carr_error_filt_hz.data(), 0); matvar = Mat_VarCreate("carr_error_filt_hz", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), carr_error_filt_hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_error_chips", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, code_error_chips.data(), 0); matvar = Mat_VarCreate("code_error_chips", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), code_error_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, code_error_filt_chips.data(), 0); matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), code_error_filt_chips.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("CN0_SNV_dB_Hz", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, CN0_SNV_dB_Hz.data(), 0); matvar = Mat_VarCreate("CN0_SNV_dB_Hz", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), CN0_SNV_dB_Hz.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("carrier_lock_test", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, carrier_lock_test.data(), 0); matvar = Mat_VarCreate("carrier_lock_test", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), carrier_lock_test.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("aux1", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, aux1.data(), 0); matvar = Mat_VarCreate("aux1", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), aux1.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("aux2", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, aux2.data(), 0); matvar = Mat_VarCreate("aux2", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims.data(), aux2.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 2, dims, PRN.data(), 0); matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 2, dims.data(), PRN.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
} }

View File

@ -500,11 +500,11 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attrib
d_tcp_com.send_receive_tcp_packet_gps_l1_ca(tx_variables_array, &tcp_data); d_tcp_com.send_receive_tcp_packet_gps_l1_ca(tx_variables_array, &tcp_data);
} }
//assign the GNURadio block output data // assign the GNU Radio block output data
current_synchro_data.System = {'G'}; current_synchro_data.System = {'G'};
std::string str_aux = "1C"; current_synchro_data.Signal[0] = '1';
const char *str = str_aux.c_str(); // get a C style null terminated string current_synchro_data.Signal[1] = 'C';
std::memcpy(static_cast<void *>(current_synchro_data.Signal), str, 3); current_synchro_data.Signal[2] = '\0';
current_synchro_data.fs = d_fs_in; current_synchro_data.fs = d_fs_in;
*out[0] = current_synchro_data; *out[0] = current_synchro_data;

View File

@ -32,7 +32,6 @@
#include "dll_pll_conf.h" #include "dll_pll_conf.h"
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include <cstring>
Dll_Pll_Conf::Dll_Pll_Conf() Dll_Pll_Conf::Dll_Pll_Conf()
{ {
@ -72,6 +71,7 @@ Dll_Pll_Conf::Dll_Pll_Conf()
enable_doppler_correction = false; enable_doppler_correction = false;
track_pilot = false; track_pilot = false;
system = 'G'; system = 'G';
char sig_[3] = "1C"; signal[0] = '1';
std::memcpy(signal, sig_, 3); signal[1] = 'C';
signal[2] = '\0';
} }

View File

@ -73,8 +73,9 @@ Dll_Pll_Conf_Fpga::Dll_Pll_Conf_Fpga()
enable_doppler_correction = false; enable_doppler_correction = false;
track_pilot = false; track_pilot = false;
system = 'G'; system = 'G';
char sig_[3] = "1C"; signal[0] = '1';
std::memcpy(signal, sig_, 3); signal[1] = 'C';
signal[2] = '\0';
device_name = "/dev/uio"; device_name = "/dev/uio";
device_base = 1U; device_base = 1U;
multicorr_type = 0U; multicorr_type = 0U;

View File

@ -38,7 +38,6 @@
#include <glog/logging.h> #include <glog/logging.h>
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <cmath> #include <cmath>
#include <cstdio>
#include <fcntl.h> // for O_RDWR, O_RSYNC #include <fcntl.h> // for O_RDWR, O_RSYNC
#include <string> #include <string>
#include <sys/mman.h> // for PROT_READ, PROT_WRITE, MAP_SHARED #include <sys/mman.h> // for PROT_READ, PROT_WRITE, MAP_SHARED

View File

@ -54,6 +54,7 @@
*/ */
#include "ini.h" #include "ini.h"
#include <array>
#include <cctype> #include <cctype>
#include <fstream> #include <fstream>
#include <string> #include <string>
@ -112,9 +113,9 @@ int ini_parse(const char* filename,
void* user) void* user)
{ {
/* Uses a fair bit of stack (use heap instead if you need to) */ /* Uses a fair bit of stack (use heap instead if you need to) */
char line[MAX_LINE]; std::array<char, MAX_LINE> line{};
char section[MAX_SECTION] = ""; std::array<char, MAX_SECTION> section{};
char prev_name[MAX_NAME] = ""; std::array<char, MAX_NAME> prev_name{};
std::ifstream file; std::ifstream file;
char* start; char* start;
@ -147,14 +148,14 @@ int ini_parse(const char* filename,
line[i] = read_line[i]; line[i] = read_line[i];
} }
line[len_str] = '\0'; line[len_str] = '\0';
start = lskip(rstrip(line)); start = lskip(rstrip(line.data()));
#if INI_ALLOW_MULTILINE #if INI_ALLOW_MULTILINE
if (*prev_name && *start && start > line) if (prev_name.data() && *start && start > line.data())
{ {
/* Non-black line with leading whitespace, treat as continuation /* Non-black line with leading whitespace, treat as continuation
of previous name's value (as per Python ConfigParser). */ of previous name's value (as per Python ConfigParser). */
if (!handler(user, section, prev_name, start) && !error) if (!handler(user, section.data(), prev_name.data(), start) && !error)
{ {
error = lineno; error = lineno;
} }
@ -168,8 +169,8 @@ int ini_parse(const char* filename,
if (*end == ']') if (*end == ']')
{ {
*end = '\0'; *end = '\0';
strncpy0(section, start + 1, sizeof(section)); strncpy0(section.data(), start + 1, sizeof(section));
*prev_name = '\0'; prev_name[MAX_NAME - 1] = '\0';
} }
else if (!error) else if (!error)
{ {
@ -194,8 +195,8 @@ int ini_parse(const char* filename,
rstrip(value); rstrip(value);
/* Valid name=value pair found, call handler */ /* Valid name=value pair found, call handler */
strncpy0(prev_name, name, sizeof(prev_name)); strncpy0(prev_name.data(), name, sizeof(prev_name));
if (!handler(user, section, name, value) && !error) if (!handler(user, section.data(), name, value) && !error)
{ {
error = lineno; error = lineno;
} }

View File

@ -326,11 +326,19 @@ static int server_connect(char *server)
} }
if (connect(fd, aip->ai_addr, aip->ai_addrlen) != 0) if (connect(fd, aip->ai_addr, aip->ai_addrlen) != 0)
{ {
freeaddrinfo(aip);
if (close(fd) != 0)
{
// avoid warning
}
return -1; return -1;
} }
break; else
{
break;
}
} }
freeaddrinfo(aip);
return fd; return fd;
} }

View File

@ -31,8 +31,11 @@
#ifndef GNSS_SDR_CONCURRENT_QUEUE_H #ifndef GNSS_SDR_CONCURRENT_QUEUE_H
#define GNSS_SDR_CONCURRENT_QUEUE_H #define GNSS_SDR_CONCURRENT_QUEUE_H
#include <boost/thread.hpp> #include <chrono>
#include <condition_variable>
#include <mutex>
#include <queue> #include <queue>
#include <thread>
template <typename Data> template <typename Data>
@ -48,7 +51,7 @@ class Concurrent_Queue
public: public:
void push(Data const& data) void push(Data const& data)
{ {
boost::mutex::scoped_lock lock(the_mutex); std::unique_lock<std::mutex> lock(the_mutex);
the_queue.push(data); the_queue.push(data);
lock.unlock(); lock.unlock();
the_condition_variable.notify_one(); the_condition_variable.notify_one();
@ -56,13 +59,13 @@ public:
bool empty() const bool empty() const
{ {
boost::mutex::scoped_lock lock(the_mutex); std::unique_lock<std::mutex> lock(the_mutex);
return the_queue.empty(); return the_queue.empty();
} }
bool try_pop(Data& popped_value) bool try_pop(Data& popped_value)
{ {
boost::mutex::scoped_lock lock(the_mutex); std::unique_lock<std::mutex> lock(the_mutex);
if (the_queue.empty()) if (the_queue.empty())
{ {
return false; return false;
@ -74,7 +77,7 @@ public:
void wait_and_pop(Data& popped_value) void wait_and_pop(Data& popped_value)
{ {
boost::mutex::scoped_lock lock(the_mutex); std::unique_lock<std::mutex> lock(the_mutex);
while (the_queue.empty()) while (the_queue.empty())
{ {
the_condition_variable.wait(lock); the_condition_variable.wait(lock);
@ -82,10 +85,26 @@ public:
popped_value = the_queue.front(); popped_value = the_queue.front();
the_queue.pop(); the_queue.pop();
} }
bool timed_wait_and_pop(Data& popped_value, int wait_ms)
{
std::unique_lock<std::mutex> lock(the_mutex);
if (the_queue.empty())
{
the_condition_variable.wait_for(lock, std::chrono::milliseconds(wait_ms));
if (the_queue.empty())
{
return false;
}
}
popped_value = the_queue.front();
the_queue.pop();
return true;
}
private: private:
std::queue<Data> the_queue; std::queue<Data> the_queue;
mutable boost::mutex the_mutex; mutable std::mutex the_mutex;
boost::condition_variable the_condition_variable; std::condition_variable the_condition_variable;
}; };
#endif #endif

View File

@ -1065,7 +1065,7 @@ bool GNSSFlowgraph::send_telemetry_msg(const pmt::pmt_t& msg)
* \param[in] what What is the action: * \param[in] what What is the action:
* --- actions from channels --- * --- actions from channels ---
* -> 0 acquisition failed * -> 0 acquisition failed
* -> 1 acquisition succesfull * -> 1 acquisition successful
* -> 2 tracking lost * -> 2 tracking lost
* --- actions from TC receiver control --- * --- actions from TC receiver control ---
* -> 10 TC request standby mode * -> 10 TC request standby mode

View File

@ -33,6 +33,7 @@
#include "control_message_factory.h" #include "control_message_factory.h"
#include "pvt_interface.h" #include "pvt_interface.h"
#include <boost/asio.hpp> #include <boost/asio.hpp>
#include <array>
#include <cmath> // for isnan #include <cmath> // for isnan
#include <exception> // for exception #include <exception> // for exception
#include <iomanip> // for setprecision #include <iomanip> // for setprecision
@ -151,10 +152,10 @@ std::string TcpCmdInterface::status(const std::vector<std::string> &commandLine
&UTC_time) == true) &UTC_time) == true)
{ {
struct tm tstruct = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr}; struct tm tstruct = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr};
char buf1[80]; std::array<char, 80> buf1{};
tstruct = *gmtime(&UTC_time); tstruct = *gmtime(&UTC_time);
strftime(buf1, sizeof(buf1), "%d/%m/%Y %H:%M:%S", &tstruct); strftime(buf1.data(), sizeof(buf1), "%d/%m/%Y %H:%M:%S", &tstruct);
std::string str_time = std::string(buf1); std::string str_time = std::string(buf1.data());
str_stream << "- Receiver UTC Time: " << str_time << std::endl; str_stream << "- Receiver UTC Time: " << str_time << std::endl;
str_stream << std::setprecision(9); str_stream << std::setprecision(9);
str_stream << "- Receiver Position WGS84 [Lat, Long, H]: " str_stream << "- Receiver Position WGS84 [Lat, Long, H]: "

View File

@ -36,45 +36,26 @@
#include <cstdint> #include <cstdint>
#include <string> #include <string>
// Physical constants
const double BEIDOU_C_M_S = 299792458.0; //!< The speed of light, [m/s]
const double BEIDOU_C_M_MS = 299792.4580; //!< The speed of light, [m/ms]
const double BEIDOU_PI = 3.1415926535898; //!< Pi
const double BEIDOU_TWO_PI = 6.283185307179586; //!< 2Pi
const double BEIDOU_OMEGA_EARTH_DOT = 7.2921150e-5; //!< Earth rotation rate, [rad/s] as defined in CGCS2000
const double BEIDOU_GM = 3.986004418e14; //!< Universal gravitational constant times the mass of the Earth, [m^3/s^2] as defined in CGCS2000
const double BEIDOU_F = -4.442807309e-10; //!< Constant, [s/(m)^(1/2)] F=-2(GM)^.5/C^2
// carrier and code frequencies // carrier and code frequencies
const double BEIDOU_B1I_FREQ_HZ = 1.561098e9; //!< B1I [Hz] const double BEIDOU_B1I_FREQ_HZ = 1.561098e9; //!< B1I [Hz]
const double BEIDOU_B1I_CODE_RATE_HZ = 2.046e6; //!< Beidou B1I code rate [chips/s] const double BEIDOU_B1I_CODE_RATE_HZ = 2.046e6; //!< Beidou B1I code rate [chips/s]
const double BEIDOU_B1I_CODE_LENGTH_CHIPS = 2046.0; //!< Beidou B1I code length [chips] const double BEIDOU_B1I_CODE_LENGTH_CHIPS = 2046.0; //!< Beidou B1I code length [chips]
const double BEIDOU_B1I_CODE_PERIOD = 0.001; //!< Beidou B1I code period [seconds] const double BEIDOU_B1I_CODE_PERIOD = 0.001; //!< Beidou B1I code period [seconds]
const uint32_t BEIDOU_B1I_CODE_PERIOD_MS = 1; //!< Beidou B1I code period [ms] const uint32_t BEIDOU_B1I_CODE_PERIOD_MS = 1; //!< Beidou B1I code period [ms]
const double BEIDOU_B1I_CHIP_PERIOD = 4.8875e-07; //!< Beidou B1I chip period [seconds]
const int32_t BEIDOU_B1I_SECONDARY_CODE_LENGTH = 20; const int32_t 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_SECONDARY_CODE_STR = "00000100110101001110";
const std::string BEIDOU_B1I_GEO_PREAMBLE_SYMBOLS_STR = {"1111110000001100001100"}; const std::string BEIDOU_B1I_GEO_PREAMBLE_SYMBOLS_STR = {"1111110000001100001100"};
const int32_t BEIDOU_B1I_GEO_PREAMBLE_LENGTH_SYMBOLS = 22; const int32_t BEIDOU_B1I_GEO_PREAMBLE_LENGTH_SYMBOLS = 22;
const std::string BEIDOU_B1I_D2_SECONDARY_CODE_STR = "00"; const std::string BEIDOU_B1I_D2_SECONDARY_CODE_STR = "00";
const int BEIDOU_B1I_PREAMBLE_LENGTH_BITS = 11; const uint32_t BEIDOU_B1I_PREAMBLE_LENGTH_BITS = 11;
const int BEIDOU_B1I_PREAMBLE_LENGTH_SYMBOLS = 220; // ************** const uint32_t BEIDOU_B1I_PREAMBLE_LENGTH_SYMBOLS = 220;
const double BEIDOU_B1I_PREAMBLE_DURATION_S = 0.220; const double BEIDOU_B1I_PREAMBLE_DURATION_S = 0.220;
const int BEIDOU_B1I_PREAMBLE_DURATION_MS = 220; const int32_t BEIDOU_B1I_PREAMBLE_DURATION_MS = 220;
const int BEIDOU_B1I_TELEMETRY_RATE_BITS_SECOND = 50; //!< D1 NAV message bit rate [bits/s] const int32_t BEIDOU_B1I_TELEMETRY_RATE_BITS_SECOND = 50;
const int BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT = 20; const int32_t BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT = 20;
const int BEIDOU_B1I_GEO_TELEMETRY_SYMBOLS_PER_BIT = 2; const int32_t BEIDOU_B1I_GEO_TELEMETRY_SYMBOLS_PER_BIT = 2;
const int BEIDOU_B1I_TELEMETRY_SYMBOL_PERIOD_MS = BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B1I_CODE_PERIOD_MS; const int32_t BEIDOU_B1I_TELEMETRY_SYMBOL_PERIOD_MS = BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B1I_CODE_PERIOD_MS;
const int BEIDOU_B1I_TELEMETRY_RATE_SYMBOLS_SECOND = BEIDOU_B1I_TELEMETRY_RATE_BITS_SECOND * BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT; //************!< NAV message bit rate [symbols/s] const int32_t BEIDOU_B1I_TELEMETRY_RATE_SYMBOLS_SECOND = BEIDOU_B1I_TELEMETRY_RATE_BITS_SECOND * BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT;
const int BEIDOU_WORD_LENGTH = 4; //**************!< CRC + BEIDOU WORD (-2 -1 0 ... 29) Bits = 4 bytes
const int BEIDOU_SUBFRAME_LENGTH = 40; //**************!< BEIDOU_WORD_LENGTH x 10 = 40 bytes
const int BEIDOU_DNAV_SUBFRAME_DATA_BITS = 300; //!< Number of bits per subframe in the NAV message [bits]
const int BEIDOU_SUBFRAME_SECONDS = 6; //!< Subframe duration [seconds]
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]
#endif /* GNSS_SDR_BEIDOU_B1I_H_ */ #endif /* GNSS_SDR_BEIDOU_B1I_H_ */

View File

@ -42,7 +42,6 @@ const double BEIDOU_B3I_CODE_LENGTH_CHIPS = 10230.0; //!< BeiDou B3I code lengt
const double BEIDOU_B3I_CODE_PERIOD = 0.001; //!< BeiDou B3I code period [seconds] const double BEIDOU_B3I_CODE_PERIOD = 0.001; //!< BeiDou B3I code period [seconds]
const uint32_t BEIDOU_B3I_CODE_PERIOD_MS = 1; //!< BeiDou B3I code period [ms] const uint32_t BEIDOU_B3I_CODE_PERIOD_MS = 1; //!< BeiDou B3I code period [ms]
const int32_t BEIDOU_B3I_SECONDARY_CODE_LENGTH = 20; const int32_t 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_SECONDARY_CODE_STR = "00000100110101001110";
const std::string BEIDOU_B3I_GEO_PREAMBLE_SYMBOLS_STR = {"1111110000001100001100"}; const std::string BEIDOU_B3I_GEO_PREAMBLE_SYMBOLS_STR = {"1111110000001100001100"};
const int32_t BEIDOU_B3I_GEO_PREAMBLE_LENGTH_SYMBOLS = 22; const int32_t BEIDOU_B3I_GEO_PREAMBLE_LENGTH_SYMBOLS = 22;
@ -53,7 +52,9 @@ const double BEIDOU_B3I_PREAMBLE_DURATION_S = 0.220;
const int32_t BEIDOU_B3I_PREAMBLE_DURATION_MS = 220; const int32_t BEIDOU_B3I_PREAMBLE_DURATION_MS = 220;
const int32_t BEIDOU_B3I_TELEMETRY_RATE_BITS_SECOND = 50; //!< D1 NAV message bit rate [bits/s] const int32_t BEIDOU_B3I_TELEMETRY_RATE_BITS_SECOND = 50; //!< D1 NAV message bit rate [bits/s]
const int32_t BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT = 20; const int32_t BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT = 20;
const int32_t BEIDOU_B3I_GEO_TELEMETRY_SYMBOLS_PER_BIT = 2; // ************* const int32_t BEIDOU_B3I_GEO_TELEMETRY_SYMBOLS_PER_BIT = 2; // *************
const int32_t BEIDOU_B3I_TELEMETRY_RATE_SYMBOLS_SECOND = BEIDOU_B3I_TELEMETRY_RATE_BITS_SECOND * BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT; //************!< NAV message bit rate [symbols/s] const int32_t BEIDOU_B3I_TELEMETRY_SYMBOL_PERIOD_MS = BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B3I_CODE_PERIOD_MS;
const int32_t BEIDOU_B3I_TELEMETRY_RATE_SYMBOLS_SECOND = BEIDOU_B3I_TELEMETRY_RATE_BITS_SECOND * BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT;
#endif /* GNSS_SDR_BEIDOU_B3I_H_ */ #endif /* GNSS_SDR_BEIDOU_B3I_H_ */

View File

@ -36,21 +36,30 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
const double BEIDOU_DNAV_C_M_S = 299792458.0; //!< The speed of light, [m/s] 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_C_M_MS = 299792.4580; //!< The speed of light, [m/ms]
const double BEIDOU_DNAV_PI = 3.1415926535898; //!< Pi const double BEIDOU_DNAV_PI = 3.1415926535898; //!< BeiDou DNAV Pi
const double BEIDOU_DNAV_TWO_PI = 6.283185307179586; //!< 2Pi const double BEIDOU_DNAV_TWO_PI = 6.2831853071796; //!< BeiDou DNAV 2Pi
const double BEIDOU_DNAV_OMEGA_EARTH_DOT = 7.2921150e-5; //!< Earth rotation rate, [rad/s] as defined in CGCS2000
const double BEIDOU_DNAV_GM = 3.986004418e14; //!< Universal gravitational constant times the mass of the Earth, [m^3/s^2] as defined in CGCS2000
const double BEIDOU_DNAV_F = -4.442807309e-10; //!< Constant, [s/(m)^(1/2)] F=-2(GM)^.5/C^2
const int32_t BEIDOU_DNAV_PREAMBLE_LENGTH_BITS = 11; const int32_t BEIDOU_DNAV_PREAMBLE_LENGTH_BITS = 11;
const int32_t BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS = 11; // ************** const int32_t BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS = 11; // **************
const double BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS = 300; const double BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS = 300;
const double BEIDOU_DNAV_SUBFRAME_SYMBOLS = 300; const double BEIDOU_DNAV_SUBFRAME_SYMBOLS = 300;
const double BEIDOU_DNAV_DATA_BITS = 300; const int32_t BEIDOU_DNAV_SUBFRAME_DATA_BITS = 300; //!< Number of bits per subframe in the NAV message [bits]
const double BEIDOU_DNAV_WORDS_SUBFRAME = 10; const double BEIDOU_DNAV_WORDS_SUBFRAME = 10;
const double BEIDOU_DNAV_WORD_LENGTH_BITS = 30; const double BEIDOU_DNAV_WORD_LENGTH_BITS = 30;
const double BEIDOU_D1NAV_SYMBOL_RATE_SPS = 50; const double BEIDOU_D1NAV_SYMBOL_RATE_SPS = 50;
const double BEIDOU_D2NAV_SYMBOL_RATE_SPS = 500; const double BEIDOU_D2NAV_SYMBOL_RATE_SPS = 500;
const std::string BEIDOU_DNAV_PREAMBLE = "11100010010"; const std::string BEIDOU_DNAV_PREAMBLE = "11100010010";
// Number of leap seconds passed from the start of the GPS epoch up to the start of BeiDou epoch
const int32_t BEIDOU_DNAV_BDT2GPST_LEAP_SEC_OFFSET = 14;
// Number of weeks passed from the start of the GPS epoch up to the start of BeiDou epoch
const int32_t BEIDOU_DNAV_BDT2GPST_WEEK_NUM_OFFSET = 1356;
// BEIDOU D1 NAVIGATION MESSAGE STRUCTURE // BEIDOU D1 NAVIGATION MESSAGE STRUCTURE
// GENERAL // GENERAL
const std::vector<std::pair<int32_t, int32_t> > D1_PRE({{1, 11}}); const std::vector<std::pair<int32_t, int32_t> > D1_PRE({{1, 11}});

View File

@ -59,7 +59,7 @@ const uint32_t GPS_L1_CA_BIT_PERIOD_MS = 20U; //!< GPS L1 C/A bit period [
const double GPS_L1_CA_CHIP_PERIOD = 9.7752e-07; //!< GPS L1 C/A chip period [seconds] const double GPS_L1_CA_CHIP_PERIOD = 9.7752e-07; //!< GPS L1 C/A chip period [seconds]
//optimum parameters //optimum parameters
const uint32_t GPS_L1_CA_OPT_ACQ_FS_HZ = 2000000; //!< Sampling frequncy that maximizes the acquisition SNR while using a non-multiple of chip rate const uint32_t GPS_L1_CA_OPT_ACQ_FS_HZ = 2000000; //!< Sampling frequency that maximizes the acquisition SNR while using a non-multiple of chip rate
/*! /*!
* \brief Maximum Time-Of-Arrival (TOA) difference between satellites for a receiver operated on Earth surface is 20 ms * \brief Maximum Time-Of-Arrival (TOA) difference between satellites for a receiver operated on Earth surface is 20 ms

Some files were not shown because too many files have changed in this diff Show More