mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-10-30 23:03:05 +00:00 
			
		
		
		
	New feature: GNSS-SDR now reads the IFEN NSR 2bit sample file format. The GNSS-SDR receiver can now be used with the SX-NSR scientific navigation front-end receiver using its native .stream binary captures.
More information of this high-end front-end can be found here: http://www.ifen.com/products/sx-scientific-gnss-solutions/nsr-software-receiver.html git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@421 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
		
							
								
								
									
										392
									
								
								conf/gnss-sdr_nsr_file.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										392
									
								
								conf/gnss-sdr_nsr_file.conf
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,392 @@ | ||||
| ; Sample configuration file for IFEN SX-NSR software receiver front-end | ||||
| ; http://www.ifen.com/products/sx-scientific-gnss-solutions/nsr-software-receiver.html | ||||
| ; This sample configuration is able to process directly .sream binary files | ||||
| ; 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_hz: Internal signal sampling frequency after the signal conditioning stage [Hz]. | ||||
| GNSS-SDR.internal_fs_hz=2560000 | ||||
|  | ||||
| ;######### CONTROL_THREAD CONFIG ############ | ||||
| ControlThread.wait_for_flowgraph=false | ||||
|  | ||||
| ;######### SUPL RRLP GPS assistance configuration ##### | ||||
| GNSS-SDR.SUPL_gps_enabled=false | ||||
| GNSS-SDR.SUPL_read_gps_assistance_xml=false | ||||
| GNSS-SDR.SUPL_gps_ephemeris_server=supl.nokia.com | ||||
| GNSS-SDR.SUPL_gps_ephemeris_port=7275 | ||||
| GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com | ||||
| GNSS-SDR.SUPL_gps_acquisition_port=7275 | ||||
| GNSS-SDR.SUPL_MCC=244 | ||||
| GNSS-SDR.SUPL_MNS=5 | ||||
| GNSS-SDR.SUPL_LAC=0x59e2 | ||||
| GNSS-SDR.SUPL_CI=0x31b0 | ||||
|  | ||||
| ;######### SIGNAL_SOURCE CONFIG ############ | ||||
| ;#implementation: Use [File_Signal_Source] [Nsr_File_Signal_Source] or [UHD_Signal_Source] or [GN3S_Signal_Source] (experimental) | ||||
| SignalSource.implementation=Nsr_File_Signal_Source | ||||
|  | ||||
| ;#filename: path to file with the captured GNSS signal samples to be processed | ||||
| SignalSource.filename=/media/DATALOGGER_/signals/ION GNSS 2013/E1L1_FE0_Band0.stream | ||||
|  | ||||
| ;#item_type: Type and resolution for each of the signal samples. Use only gr_complex in this version. | ||||
| SignalSource.item_type=byte | ||||
|  | ||||
| ;#sampling_frequency: Original Signal sampling frequency in [Hz]  | ||||
| SignalSource.sampling_frequency=20480000 | ||||
|  | ||||
| ;#freq: RF front-end center frequency in [Hz]  | ||||
| SignalSource.freq=1575420000 | ||||
|  | ||||
| ;#subdevice: UHD subdevice specification (for USRP1 use A:0 or B:0) | ||||
| SignalSource.subdevice=B:0 | ||||
|  | ||||
| ;#samples: Number of samples to be processed. Notice that 0 indicates the entire file. | ||||
| SignalSource.samples=0 | ||||
|  | ||||
| ;#repeat: Repeat the processing file. Disable this option in this version | ||||
| SignalSource.repeat=false | ||||
|  | ||||
| ;#dump: Dump the Signal source data to a file. Disable this option in this version | ||||
| SignalSource.dump=false | ||||
|  | ||||
| SignalSource.dump_filename=../data/signal_source.dat | ||||
|  | ||||
|  | ||||
| ;#enable_throttle_control: Enabling this option tells the signal source to keep the delay between samples in post processing. | ||||
| ; it helps to not overload the CPU, but the processing time will be longer.  | ||||
| SignalSource.enable_throttle_control=false | ||||
|  | ||||
|  | ||||
| ;######### SIGNAL_CONDITIONER CONFIG ############ | ||||
| ;## It holds blocks to change data type, filter and resample input data.  | ||||
|  | ||||
| ;#implementation: Use [Pass_Through] or [Signal_Conditioner] | ||||
| ;#[Pass_Through] disables this block and the [DataTypeAdapter], [InputFilter] and [Resampler] blocks | ||||
| ;#[Signal_Conditioner] enables this block. Then you have to configure [DataTypeAdapter], [InputFilter] and [Resampler] blocks | ||||
| SignalConditioner.implementation=Signal_Conditioner | ||||
|  | ||||
| ;######### DATA_TYPE_ADAPTER CONFIG ############ | ||||
| ;## Changes the type of input data. | ||||
| ;#implementation: [Pass_Through] disables this block | ||||
| DataTypeAdapter.implementation=Pass_Through | ||||
| DataTypeAdapter.item_type=float | ||||
|  | ||||
| ;######### INPUT_FILTER CONFIG ############ | ||||
| ;## Filter the input data. Can be combined with frequency translation for IF signals | ||||
|  | ||||
| ;#implementation: Use [Pass_Through] or [Fir_Filter] or [Freq_Xlating_Fir_Filter] | ||||
| ;#[Freq_Xlating_Fir_Filter] enables FIR filter and a composite frequency translation  | ||||
| ;# that shifts IF down to zero Hz. | ||||
|  | ||||
| InputFilter.implementation=Freq_Xlating_Fir_Filter | ||||
|  | ||||
| ;#dump: Dump the filtered data to a file. | ||||
| InputFilter.dump=false | ||||
|  | ||||
| ;#dump_filename: Log path and filename. | ||||
| InputFilter.dump_filename=../data/input_filter.dat | ||||
|  | ||||
| ;#The following options are used in the filter design of Fir_Filter and Freq_Xlating_Fir_Filter implementation.  | ||||
| ;#These options are based on parameters of gnuradio's function: gr_remez. | ||||
| ;#These function calculates the optimal (in the Chebyshev/minimax sense) FIR filter inpulse  | ||||
| ;#reponse given a set of band edges, the desired reponse on those bands,  | ||||
| ;#and the weight given to the error in those bands. | ||||
|  | ||||
| ;#input_item_type: Type and resolution for input signal samples. Use only gr_complex in this version. | ||||
| InputFilter.input_item_type=float | ||||
|  | ||||
| ;#outut_item_type: Type and resolution for output filtered signal samples. Use only gr_complex in this version. | ||||
| InputFilter.output_item_type=gr_complex | ||||
|  | ||||
| ;#taps_item_type: Type and resolution for the taps of the filter. Use only float in this version. | ||||
| InputFilter.taps_item_type=float | ||||
|  | ||||
| ;#number_of_taps: Number of taps in the filter. Increasing this parameter increases the processing time | ||||
| InputFilter.number_of_taps=5 | ||||
|  | ||||
| ;#number_of _bands: Number of frequency bands in the filter. | ||||
| InputFilter.number_of_bands=2 | ||||
|  | ||||
| ;#bands: frequency at the band edges [ b1 e1 b2 e2 b3 e3 ...]. | ||||
| ;#Frequency is in the range [0, 1], with 1 being the Nyquist frequency (Fs/2) | ||||
| ;#The number of band_begin and band_end elements must match the number of bands | ||||
|  | ||||
| InputFilter.band1_begin=0.0 | ||||
| InputFilter.band1_end=0.45 | ||||
| InputFilter.band2_begin=0.55 | ||||
| InputFilter.band2_end=1.0 | ||||
|  | ||||
| ;#ampl: desired amplitude at the band edges [ a(b1) a(e1) a(b2) a(e2) ...]. | ||||
| ;#The number of ampl_begin and ampl_end elements must match the number of bands | ||||
|  | ||||
| InputFilter.ampl1_begin=1.0 | ||||
| InputFilter.ampl1_end=1.0 | ||||
| InputFilter.ampl2_begin=0.0 | ||||
| InputFilter.ampl2_end=0.0 | ||||
|  | ||||
| ;#band_error: weighting applied to each band (usually 1). | ||||
| ;#The number of band_error elements must match the number of bands | ||||
| InputFilter.band1_error=1.0 | ||||
| InputFilter.band2_error=1.0 | ||||
|  | ||||
| ;#filter_type: one of "bandpass", "hilbert" or "differentiator"  | ||||
| InputFilter.filter_type=bandpass | ||||
|  | ||||
| ;#grid_density: determines how accurately the filter will be constructed. | ||||
| ;The minimum value is 16; higher values are slower to compute the filter. | ||||
| InputFilter.grid_density=16 | ||||
|  | ||||
| ;# Original sampling frequency stored in the signal file | ||||
| InputFilter.sampling_frequency=20480000 | ||||
|  | ||||
| ;#The following options are used only in Freq_Xlating_Fir_Filter implementation. | ||||
| ;#InputFilter.IF is the intermediate frequency (in Hz) shifted down to zero Hz | ||||
|  | ||||
| InputFilter.IF=5499998.47412109 | ||||
|  | ||||
| ;# Decimation factor after the frequency tranaslating block | ||||
| InputFilter.decimation_factor=8 | ||||
|  | ||||
|  | ||||
| ;######### RESAMPLER CONFIG ############ | ||||
| ;## Resamples the input data.  | ||||
|  | ||||
| ;#implementation: Use [Pass_Through] or [Direct_Resampler] | ||||
| ;#[Pass_Through] disables this block | ||||
| ;#[Direct_Resampler] enables a resampler that implements a nearest neigbourhood interpolation | ||||
| ;Resampler.implementation=Direct_Resampler | ||||
| Resampler.implementation=Pass_Through | ||||
|  | ||||
| ;#dump: Dump the resamplered data to a file. | ||||
| Resampler.dump=false | ||||
| ;#dump_filename: Log path and filename. | ||||
| Resampler.dump_filename=../data/resampler.dat | ||||
|  | ||||
| ;#item_type: Type and resolution for each of the signal samples. Use only gr_complex in this version. | ||||
| Resampler.item_type=gr_complex | ||||
|  | ||||
| ;#sample_freq_in: the sample frequency of the input signal | ||||
| Resampler.sample_freq_in=8000000 | ||||
|  | ||||
| ;#sample_freq_out: the desired sample frequency of the output signal | ||||
| Resampler.sample_freq_out=2048000 | ||||
|  | ||||
|  | ||||
| ;######### CHANNELS GLOBAL CONFIG ############ | ||||
| ;#count: Number of available satellite channels. | ||||
| Channels.count=8 | ||||
| ;#in_acquisition: Number of channels simultaneously acquiring | ||||
| Channels.in_acquisition=1 | ||||
| ;#system: GPS, GLONASS, Galileo, SBAS or Compass | ||||
| ;#if the option is disabled by default is assigned GPS | ||||
| Channel.system=GPS | ||||
|  | ||||
| ;#signal:  | ||||
| ;# "1C" GPS L1 C/A | ||||
| ;# "1P" GPS L1 P | ||||
| ;# "1W" GPS L1 Z-tracking and similar (AS on) | ||||
| ;# "1Y" GPS L1 Y | ||||
| ;# "1M" GPS L1 M | ||||
| ;# "1N" GPS L1 codeless | ||||
| ;# "2C" GPS L2 C/A | ||||
| ;# "2D" GPS L2 L1(C/A)+(P2-P1) semi-codeless | ||||
| ;# "2S" GPS L2 L2C (M) | ||||
| ;# "2L" GPS L2 L2C (L) | ||||
| ;# "2X" GPS L2 L2C (M+L) | ||||
| ;# "2P" GPS L2 P | ||||
| ;# "2W" GPS L2 Z-tracking and similar (AS on) | ||||
| ;# "2Y" GPS L2 Y | ||||
| ;# "2M" GPS GPS L2 M | ||||
| ;# "2N" GPS L2 codeless | ||||
| ;# "5I" GPS L5 I | ||||
| ;# "5Q" GPS L5 Q | ||||
| ;# "5X" GPS L5 I+Q | ||||
| ;# "1C" GLONASS G1 C/A | ||||
| ;# "1P" GLONASS G1 P | ||||
| ;# "2C" GLONASS G2 C/A  (Glonass M) | ||||
| ;# "2P" GLONASS G2 P | ||||
| ;# "1A" GALILEO E1 A (PRS) | ||||
| ;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) | ||||
| ;# "1C" GALILEO E1 C (no data) | ||||
| ;# "1X" GALILEO E1 B+C | ||||
| ;# "1Z" GALILEO E1 A+B+C | ||||
| ;# "5I" GALILEO E5a I (F/NAV OS) | ||||
| ;# "5Q" GALILEO E5a Q  (no data) | ||||
| ;# "5X" GALILEO E5a I+Q | ||||
| ;# "7I" GALILEO E5b I | ||||
| ;# "7Q" GALILEO E5b Q | ||||
| ;# "7X" GALILEO E5b I+Q | ||||
| ;# "8I" GALILEO E5 I | ||||
| ;# "8Q" GALILEO E5 Q | ||||
| ;# "8X" GALILEO E5 I+Q | ||||
| ;# "6A" GALILEO E6 A | ||||
| ;# "6B" GALILEO E6 B | ||||
| ;# "6C" GALILEO E6 C | ||||
| ;# "6X" GALILEO E6 B+C | ||||
| ;# "6Z" GALILEO E6 A+B+C | ||||
| ;# "1C" SBAS L1 C/A | ||||
| ;# "5I" SBAS L5 I | ||||
| ;# "5Q" SBAS L5 Q | ||||
| ;# "5X" SBAS L5 I+Q | ||||
| ;# "2I" COMPASS E2 I | ||||
| ;# "2Q" COMPASS E2 Q | ||||
| ;# "2X" COMPASS E2 IQ | ||||
| ;# "7I" COMPASS E5b I | ||||
| ;# "7Q" COMPASS E5b Q | ||||
| ;# "7X" COMPASS E5b IQ | ||||
| ;# "6I" COMPASS E6 I | ||||
| ;# "6Q" COMPASS E6 Q | ||||
| ;# "6X" COMPASS E6 IQ | ||||
| ;#if the option is disabled by default is assigned "1C" GPS L1 C/A | ||||
| Channel.signal=1C | ||||
|  | ||||
| ;######### SPECIFIC CHANNELS CONFIG ###### | ||||
| ;#The following options are specific to each channel and overwrite the generic options  | ||||
|  | ||||
| ;######### CHANNEL 0 CONFIG ############ | ||||
|  | ||||
| Channel0.system=GPS | ||||
| Channel0.signal=1C | ||||
|  | ||||
| ;#satellite: Satellite PRN ID for this channel. Disable this option to random search | ||||
| Channel0.satellite=11 | ||||
|  | ||||
| ;######### CHANNEL 1 CONFIG ############ | ||||
|  | ||||
| Channel1.system=GPS | ||||
| Channel1.signal=1C | ||||
| Channel1.satellite=18 | ||||
|  | ||||
|  | ||||
| ;######### ACQUISITION GLOBAL CONFIG ############ | ||||
|  | ||||
| ;#dump: Enable or disable the acquisition internal data file logging [true] or [false]  | ||||
| Acquisition.dump=false | ||||
| ;#filename: Log path and filename | ||||
| Acquisition.dump_filename=./acq_dump.dat | ||||
| ;#item_type: Type and resolution for each of the signal samples. Use only gr_complex in this version. | ||||
| Acquisition.item_type=gr_complex | ||||
| ;#if: Signal intermediate frequency in [Hz]  | ||||
| Acquisition.if=0 | ||||
| ;#sampled_ms: Signal block duration for the acquisition signal detection [ms] | ||||
| Acquisition.sampled_ms=1 | ||||
| ;#implementation: Acquisition algorithm selection for this channel: [GPS_L1_CA_PCPS_Acquisition] or [Galileo_E1_PCPS_Ambiguous_Acquisition] | ||||
| Acquisition.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler | ||||
| ;#threshold: Acquisition threshold | ||||
| Acquisition.threshold=0.010 | ||||
| ;#pfa: Acquisition false alarm probability. This option overrides the threshold option. Only use with implementations: [GPS_L1_CA_PCPS_Acquisition] or [Galileo_E1_PCPS_Ambiguous_Acquisition]  | ||||
| ;Acquisition.pfa=0.0001 | ||||
| ;#doppler_max: Maximum expected Doppler shift [Hz] | ||||
| Acquisition.doppler_max=10000 | ||||
| Acquisition.doppler_min=-10000 | ||||
| ;#doppler_max: Doppler step in the grid search [Hz] | ||||
| Acquisition.doppler_step=500 | ||||
| ;#maximum dwells | ||||
| Acquisition.max_dwells=15 | ||||
|  | ||||
| ;######### ACQUISITION CHANNELS CONFIG ###### | ||||
| ;#The following options are specific to each channel and overwrite the generic options  | ||||
|  | ||||
|  | ||||
| ;######### ACQUISITION CH 0 CONFIG ############ | ||||
| ;Acquisition0.implementation=GPS_L1_CA_PCPS_Acquisition | ||||
| ;Acquisition0.threshold=0.005 | ||||
| ;Acquisition0.pfa=0.001 | ||||
| ;Acquisition0.doppler_max=10000 | ||||
| ;Acquisition0.doppler_step=250 | ||||
|  | ||||
| ;#repeat_satellite: Use only jointly with the satellite PRN ID option. The default value is false | ||||
| ;Acquisition0.repeat_satellite = false | ||||
|  | ||||
|  | ||||
| ;######### TRACKING GLOBAL CONFIG ############ | ||||
|  | ||||
| ;#implementation: Selected tracking algorithm: [GPS_L1_CA_DLL_PLL_Tracking] or [GPS_L1_CA_DLL_FLL_PLL_Tracking] [GPS_L1_CA_DLL_PLL_Optim_Tracking] | ||||
| Tracking.implementation=GPS_L1_CA_DLL_PLL_Optim_Tracking | ||||
| ;#item_type: Type and resolution for each of the signal samples. Use only [gr_complex] in this version. | ||||
| Tracking.item_type=gr_complex | ||||
|  | ||||
| ;#sampling_frequency: Signal Intermediate Frequency in [Hz]  | ||||
| Tracking.if=0 | ||||
|  | ||||
| ;#dump: Enable or disable the Tracking internal binary data file logging [true] or [false]  | ||||
| Tracking.dump=false | ||||
|  | ||||
| ;#dump_filename: Log path and filename. Notice that the tracking channel will add "x.dat" where x is the channel number. | ||||
| Tracking.dump_filename=./tracking_ch_ | ||||
|  | ||||
| ;#pll_bw_hz: PLL loop filter bandwidth [Hz] | ||||
| Tracking.pll_bw_hz=50.0; | ||||
|  | ||||
| ;#dll_bw_hz: DLL loop filter bandwidth [Hz] | ||||
| Tracking.dll_bw_hz=2.0; | ||||
|  | ||||
| ;#fll_bw_hz: FLL loop filter bandwidth [Hz] | ||||
| Tracking.fll_bw_hz=10.0; | ||||
|  | ||||
| ;#order: PLL/DLL loop filter order [2] or [3] | ||||
| Tracking.order=3; | ||||
|  | ||||
| ;#early_late_space_chips: correlator early-late space [chips]. Use [0.5] | ||||
| Tracking.early_late_space_chips=0.5; | ||||
|  | ||||
| ;######### TELEMETRY DECODER CONFIG ############ | ||||
| ;#implementation: Use [GPS_L1_CA_Telemetry_Decoder] for GPS L1 C/A. | ||||
| TelemetryDecoder.implementation=GPS_L1_CA_Telemetry_Decoder | ||||
| TelemetryDecoder.dump=false | ||||
|  | ||||
| ;######### OBSERVABLES CONFIG ############ | ||||
| ;#implementation: Use [GPS_L1_CA_Observables] for GPS L1 C/A. | ||||
| Observables.implementation=GPS_L1_CA_Observables | ||||
|  | ||||
| ;#dump: Enable or disable the Observables internal binary data file logging [true] or [false]  | ||||
| Observables.dump=false | ||||
|  | ||||
| ;#dump_filename: Log path and filename. | ||||
| Observables.dump_filename=./observables.dat | ||||
|  | ||||
|  | ||||
| ;######### PVT CONFIG ############ | ||||
| ;#implementation: Position Velocity and Time (PVT) implementation algorithm: Use [GPS_L1_CA_PVT] in this version. | ||||
| PVT.implementation=GPS_L1_CA_PVT | ||||
|  | ||||
| ;#averaging_depth: Number of PVT observations in the moving average algorithm | ||||
| PVT.averaging_depth=100 | ||||
|  | ||||
| ;#flag_average: Enables the PVT averaging between output intervals (arithmetic mean) [true] or [false]  | ||||
| PVT.flag_averaging=true | ||||
|  | ||||
| ;#output_rate_ms: Period between two PVT outputs. Notice that the minimum period is equal to the tracking integration time (for GPS CA L1 is 1ms) [ms] | ||||
| PVT.output_rate_ms=100 | ||||
|  | ||||
| ;#display_rate_ms: Position console print (std::out) interval [ms]. Notice that output_rate_ms<=display_rate_ms. | ||||
| PVT.display_rate_ms=500 | ||||
|  | ||||
| ;# RINEX, KML, and NMEA output configuration | ||||
|  | ||||
| ;#dump_filename: Log path and filename without extension. Notice that PVT will add ".dat" to the binary dump and ".kml" to GoogleEarth dump. | ||||
| PVT.dump_filename=./PVT | ||||
|  | ||||
| ;#nmea_dump_filename: NMEA log path and filename | ||||
| PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; | ||||
|  | ||||
| ;#flag_nmea_tty_port: Enable or disable the NMEA log to a serial TTY port (Can be used with real hardware or virtual one) | ||||
| PVT.flag_nmea_tty_port=false; | ||||
|  | ||||
| ;#nmea_dump_devname: serial device descriptor for NMEA logging | ||||
| PVT.nmea_dump_devname=/dev/pts/4 | ||||
|  | ||||
|  | ||||
| ;#dump: Enable or disable the PVT internal binary data file logging [true] or [false]  | ||||
| PVT.dump=false | ||||
|  | ||||
| ;######### OUTPUT_FILTER CONFIG ############ | ||||
| ;# Receiver output filter: Leave this block disabled in this version | ||||
| OutputFilter.implementation=Null_Sink_Output_Filter | ||||
| OutputFilter.filename=data/gnss-sdr.dat | ||||
| OutputFilter.item_type=gr_complex | ||||
| @@ -32,7 +32,6 @@ | ||||
| #include "configuration_interface.h" | ||||
| #include <string> | ||||
| #include <boost/lexical_cast.hpp> | ||||
| //#include <gnuradio/io_signature.h> | ||||
| #include <gnuradio/blocks/file_sink.h> | ||||
| #include <gnuradio/filter/pm_remez.h> | ||||
| #include <glog/log_severity.h> | ||||
| @@ -55,14 +54,24 @@ FreqXlatingFirFilter::FreqXlatingFirFilter(ConfigurationInterface* configuration | ||||
|     if ((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("gr_complex") == 0) | ||||
|             && (output_item_type_.compare("gr_complex") == 0)) | ||||
|         { | ||||
|             item_size = sizeof(gr_complex); | ||||
|             item_size = sizeof(gr_complex); //output | ||||
|             input_size_=sizeof(gr_complex); //input | ||||
|             freq_xlating_fir_filter_ccf_ = gr::filter::freq_xlating_fir_filter_ccf::make(decimation_factor, taps_, intermediate_freq_, sampling_freq_); | ||||
|             DLOG(INFO) << "input_filter(" << freq_xlating_fir_filter_ccf_->unique_id() << ")"; | ||||
|         } | ||||
|     else if((taps_item_type_.compare("float") == 0) && (input_item_type_.compare("float") == 0) | ||||
|             && (output_item_type_.compare("gr_complex") == 0)) | ||||
|         { | ||||
|             item_size = sizeof(gr_complex); | ||||
|             input_size_=sizeof(float); //input | ||||
|             freq_xlating_fir_filter_fcf_ = gr::filter::freq_xlating_fir_filter_fcf::make(decimation_factor, taps_, intermediate_freq_, sampling_freq_); | ||||
|             DLOG(INFO) << "input_filter(" << freq_xlating_fir_filter_fcf_->unique_id() << ")"; | ||||
|         } | ||||
|     else | ||||
|         { | ||||
|             LOG_AT_LEVEL(ERROR) << taps_item_type_ << " unknown input filter item type"; | ||||
|         } | ||||
|  | ||||
|     if (dump_) | ||||
|         { | ||||
|             DLOG(INFO) << "Dumping output into file " << dump_filename_; | ||||
| @@ -82,7 +91,12 @@ void FreqXlatingFirFilter::connect(gr::top_block_sptr top_block) | ||||
| { | ||||
|     if (dump_) | ||||
|         { | ||||
|             top_block->connect(freq_xlating_fir_filter_ccf_, 0, file_sink_, 0); | ||||
|     		if (input_size_==sizeof(float)) | ||||
|     		{ | ||||
|     			top_block->connect(freq_xlating_fir_filter_fcf_, 0, file_sink_, 0); | ||||
|     		}else{ | ||||
|     			top_block->connect(freq_xlating_fir_filter_ccf_, 0, file_sink_, 0); | ||||
|     		} | ||||
|         } | ||||
|     else | ||||
|         { | ||||
| @@ -96,7 +110,12 @@ void FreqXlatingFirFilter::disconnect(gr::top_block_sptr top_block) | ||||
| { | ||||
|     if (dump_) | ||||
|         { | ||||
|             top_block->connect(freq_xlating_fir_filter_ccf_, 0, file_sink_, 0); | ||||
| 		if (input_size_==sizeof(float)) | ||||
| 		{ | ||||
| 			top_block->disconnect(freq_xlating_fir_filter_fcf_, 0, file_sink_, 0); | ||||
| 		}else{ | ||||
| 			top_block->disconnect(freq_xlating_fir_filter_ccf_, 0, file_sink_, 0); | ||||
| 		} | ||||
|         } | ||||
|  | ||||
| } | ||||
| @@ -104,13 +123,24 @@ void FreqXlatingFirFilter::disconnect(gr::top_block_sptr top_block) | ||||
|  | ||||
| gr::basic_block_sptr FreqXlatingFirFilter::get_left_block() | ||||
| { | ||||
|     return freq_xlating_fir_filter_ccf_; | ||||
| 	if (input_size_==sizeof(float)) | ||||
| 	{ | ||||
| 		return freq_xlating_fir_filter_fcf_; | ||||
| 	}else{ | ||||
| 		return freq_xlating_fir_filter_ccf_; | ||||
| 	} | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| gr::basic_block_sptr FreqXlatingFirFilter::get_right_block() | ||||
| { | ||||
|     return freq_xlating_fir_filter_ccf_; | ||||
| 	if (input_size_==sizeof(float)) | ||||
| 	{ | ||||
| 		return freq_xlating_fir_filter_fcf_; | ||||
| 	}else{ | ||||
| 		return freq_xlating_fir_filter_ccf_; | ||||
| 	} | ||||
| } | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -36,6 +36,7 @@ | ||||
| #include "gnss_synchro.h" | ||||
| #include "gnss_block_interface.h" | ||||
| #include <gnuradio/filter/freq_xlating_fir_filter_ccf.h> | ||||
| #include <gnuradio/filter/freq_xlating_fir_filter_fcf.h> | ||||
| #include <gnuradio/blocks/file_sink.h> | ||||
| #include <gnuradio/msg_queue.h> | ||||
|  | ||||
| @@ -82,10 +83,12 @@ public: | ||||
|  | ||||
| private: | ||||
|     gr::filter::freq_xlating_fir_filter_ccf::sptr freq_xlating_fir_filter_ccf_; | ||||
|     gr::filter::freq_xlating_fir_filter_fcf::sptr freq_xlating_fir_filter_fcf_; | ||||
|     ConfigurationInterface* config_; | ||||
|     bool dump_; | ||||
|     std::string dump_filename_; | ||||
|     std::string input_item_type_; | ||||
|     size_t input_size_; | ||||
|     std::string output_item_type_; | ||||
|     std::string taps_item_type_; | ||||
|     std::vector <float> taps_; | ||||
|   | ||||
| @@ -17,4 +17,4 @@ | ||||
| # | ||||
|  | ||||
| add_subdirectory(adapters) | ||||
| #add_subdirectory(gnuradio_blocks) | ||||
| add_subdirectory(gnuradio_blocks) | ||||
|   | ||||
| @@ -74,7 +74,7 @@ if(RTLSDR_DRIVER) | ||||
|     set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${RTL_DRIVER_INCLUDE_DIRS})  | ||||
| endif(RTLSDR_DRIVER) | ||||
|  | ||||
| set(SIGNAL_SOURCE_ADAPTER_SOURCES file_signal_source.cc gen_signal_source.cc uhd_signal_source.cc ${OPT_DRIVER_SOURCES}) | ||||
| set(SIGNAL_SOURCE_ADAPTER_SOURCES file_signal_source.cc gen_signal_source.cc uhd_signal_source.cc nsr_file_signal_source.cc ${OPT_DRIVER_SOURCES}) | ||||
|  | ||||
|  | ||||
| include_directories( | ||||
| @@ -83,6 +83,7 @@ include_directories( | ||||
|      ${CMAKE_SOURCE_DIR}/src/core/system_parameters | ||||
|      ${CMAKE_SOURCE_DIR}/src/core/interfaces | ||||
|      ${CMAKE_SOURCE_DIR}/src/algorithms/libs | ||||
|      ${CMAKE_SOURCE_DIR}/src/algorithms/signal_source/gnuradio_blocks | ||||
|      ${UHD_INCLUDE_DIRS} | ||||
|      ${GLOG_INCLUDE_DIRS} | ||||
|      ${GFlags_INCLUDE_DIRS}      | ||||
| @@ -90,4 +91,4 @@ include_directories( | ||||
| ) | ||||
|  | ||||
| add_library(signal_source_adapters ${SIGNAL_SOURCE_ADAPTER_SOURCES}) | ||||
| target_link_libraries(signal_source_adapters ${Boost_LIBRARIES}  ${GNURADIO_PMT_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES} ${UHD_LIBRARIES}  ${GNURADIO_UHD_LIBRARIES} ${OPT_LIBRARIES}  gnss_sp_libs) | ||||
| target_link_libraries(signal_source_adapters signal_source_gr_blocks ${Boost_LIBRARIES}  ${GNURADIO_PMT_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES} ${UHD_LIBRARIES}  ${GNURADIO_UHD_LIBRARIES} ${OPT_LIBRARIES} gnss_sp_libs) | ||||
|   | ||||
| @@ -36,11 +36,8 @@ | ||||
| #define GNSS_SDR_FILE_SIGNAL_SOURCE_H_ | ||||
|  | ||||
| #include "gnss_block_interface.h" | ||||
| //#include <gnuradio/gr_file_source.h> | ||||
| #include <gnuradio/blocks/file_source.h> | ||||
| //#include <gnuradio/gr_file_sink.h> | ||||
| #include <gnuradio/blocks/file_sink.h> | ||||
| //#include <gnuradio/gr_throttle.h> | ||||
| #include <gnuradio/blocks/throttle.h> | ||||
| #include <gnuradio/hier_block2.h> | ||||
| #include <gnuradio/msg_queue.h> | ||||
| @@ -101,7 +98,7 @@ public: | ||||
|     } | ||||
|  | ||||
| private: | ||||
|     long samples_; | ||||
|     unsigned long long samples_; | ||||
|     long sampling_frequency_; | ||||
|     std::string filename_; | ||||
|     std::string item_type_; | ||||
| @@ -111,12 +108,9 @@ private: | ||||
|     std::string role_; | ||||
|     unsigned int in_streams_; | ||||
|     unsigned int out_streams_; | ||||
| //    gr_file_source_sptr file_source_; | ||||
|     gr::blocks::file_source::sptr file_source_; | ||||
|     //gr_block_sptr valve_; | ||||
|     boost::shared_ptr<gr::block> valve_; | ||||
|     gr::blocks::file_sink::sptr sink_; | ||||
| //    gr_block_sptr throttle_; | ||||
|     gr::blocks::throttle::sptr  throttle_; | ||||
|     boost::shared_ptr<gr::msg_queue> queue_; | ||||
|     size_t item_size_; | ||||
|   | ||||
							
								
								
									
										333
									
								
								src/algorithms/signal_source/adapters/nsr_file_signal_source.cc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										333
									
								
								src/algorithms/signal_source/adapters/nsr_file_signal_source.cc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,333 @@ | ||||
| /*! | ||||
|  * \file nsr_file_signal_source.cc | ||||
|  * \brief Implementation of a class that reads signals samples from a NSR 2 bits sampler front-end file | ||||
|  * and adapts it to a SignalSourceInterface. More information about the front-end here | ||||
|  * http://www.ifen.com/products/sx-scientific-gnss-solutions/nsr-software-receiver.html | ||||
|  * \author Javier Arribas, 2013 jarribas(at)cttc.es | ||||
|  * | ||||
|  * ------------------------------------------------------------------------- | ||||
|  * | ||||
|  * Copyright (C) 2010-2013  (see AUTHORS file for a list of contributors) | ||||
|  * | ||||
|  * GNSS-SDR is a software defined Global Navigation | ||||
|  *          Satellite Systems receiver | ||||
|  * | ||||
|  * This file is part of GNSS-SDR. | ||||
|  * | ||||
|  * GNSS-SDR is free software: you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
|  * the Free Software Foundation, either version 3 of the License, or | ||||
|  * at your option) any later version. | ||||
|  * | ||||
|  * GNSS-SDR is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  * GNU General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * ------------------------------------------------------------------------- | ||||
|  */ | ||||
|  | ||||
| #include "nsr_file_signal_source.h" | ||||
| #include "gnss_sdr_valve.h" | ||||
| #include "configuration_interface.h" | ||||
| #include <string> | ||||
| #include <iostream> | ||||
| #include <fstream> | ||||
| #include <iomanip> | ||||
| #include <exception> | ||||
| #include <gflags/gflags.h> | ||||
| #include <glog/log_severity.h> | ||||
| #include <glog/logging.h> | ||||
|  | ||||
| using google::LogMessage; | ||||
|  | ||||
| DEFINE_string(nsr_signal_source, "-", | ||||
| 		"If defined, path to the file containing the NSR (byte to 2-bit packed) signal samples (overrides the configuration file)"); | ||||
|  | ||||
|  | ||||
| NsrFileSignalSource::NsrFileSignalSource(ConfigurationInterface* configuration, | ||||
|         std::string role, unsigned int in_streams, unsigned int out_streams, | ||||
|         boost::shared_ptr<gr::msg_queue> queue) : | ||||
| 		                role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue) | ||||
| { | ||||
|     std::string default_filename = "../data/my_capture.dat"; | ||||
|     std::string default_item_type = "byte"; | ||||
|     std::string default_dump_filename = "../data/my_capture_dump.dat"; | ||||
|  | ||||
|     samples_ = configuration->property(role + ".samples", 0); | ||||
|     sampling_frequency_ = configuration->property(role + ".sampling_frequency", 0); | ||||
|     filename_ = configuration->property(role + ".filename", default_filename); | ||||
|  | ||||
|     // override value with commandline flag, if present | ||||
|     if (FLAGS_nsr_signal_source.compare("-") != 0) filename_= FLAGS_nsr_signal_source; | ||||
|  | ||||
|     item_type_ = configuration->property(role + ".item_type", default_item_type); | ||||
|     repeat_ = configuration->property(role + ".repeat", false); | ||||
|     dump_ = configuration->property(role + ".dump", false); | ||||
|     dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); | ||||
|     enable_throttle_control_ = configuration->property(role + ".enable_throttle_control", false); | ||||
|  | ||||
|     if (item_type_.compare("byte") == 0) | ||||
|         { | ||||
|             item_size_ = sizeof(char); | ||||
|         } | ||||
|     else | ||||
|         { | ||||
|             LOG_AT_LEVEL(WARNING) << item_type_ | ||||
|                     << " unrecognized item type. Using byte."; | ||||
|             item_size_ = sizeof(char); | ||||
|         } | ||||
|     try | ||||
|     { | ||||
|             file_source_ = gr::blocks::file_source::make(item_size_, filename_.c_str(), repeat_); | ||||
|             unpack_byte_ = make_unpack_byte_2bit_samples(); | ||||
|  | ||||
|     } | ||||
|     catch (const std::exception &e) | ||||
|     { | ||||
|             std::cerr | ||||
|             << "The receiver was configured to work with a file signal source " | ||||
|             << std::endl | ||||
|             << "but the specified file is unreachable by GNSS-SDR." | ||||
|             << std::endl | ||||
|             << "Please modify the configuration at " | ||||
|             << "conf/gnss-sdr.conf (the default configuration file)" | ||||
|             << std::endl | ||||
|             << "and point SignalSource.filename to a valid file," | ||||
|             << std::endl | ||||
|             << "or specify your own receiver and source with the flag" | ||||
|             << std::endl | ||||
|             <<"gnss-sdr --config_file=my_GNSS_SDR_configuration.conf" | ||||
|             << std::endl; | ||||
|             LOG_AT_LEVEL(INFO) << "file_signal_source: Unable to open the samples file " | ||||
|                                << filename_.c_str() << ", exiting the program."; | ||||
|             throw(e); | ||||
|     } | ||||
|  | ||||
|     DLOG(INFO) << "file_source(" << file_source_->unique_id() << ")"; | ||||
|  | ||||
|     if (samples_ == 0) // read all file | ||||
|         { | ||||
|             /*! | ||||
|              * BUG workaround: The GNU Radio file source does not stop the receiver after reaching the End of File. | ||||
|              * A possible solution is to compute the file length in samples using file size, excluding the last 100 milliseconds, and enable always the | ||||
|              * valve block | ||||
|              */ | ||||
|             std::ifstream file (filename_.c_str(), std::ios::in | std::ios::binary | std::ios::ate); | ||||
|             std::ifstream::pos_type size; | ||||
|  | ||||
|             if (file.is_open()) | ||||
|                 { | ||||
|                     size = file.tellg(); | ||||
|                     DLOG(INFO) << "Total samples in the file= " << floor((double)size / (double)item_size()); | ||||
|                 } | ||||
|             else | ||||
|                 { | ||||
|                     std::cout << "file_signal_source: Unable to open the samples file " << filename_.c_str() << std::endl; | ||||
|                     LOG_AT_LEVEL(ERROR) << "file_signal_source: Unable to open the samples file " << filename_.c_str(); | ||||
|                 } | ||||
|             std::cout << std::setprecision(16); | ||||
|             std::cout << "Processing file " << filename_ << ", which contains " << (double)size << " [bytes]" << std::endl; | ||||
|  | ||||
|             if (size > 0) | ||||
|                 { | ||||
|             	int sample_packet_factor=4; // 1 byte -> 4 samples | ||||
|                 samples_ = floor((double)size / (double)item_size())*sample_packet_factor; | ||||
|                 samples_=samples_- ceil(0.002 * (double)sampling_frequency_); //process all the samples available in the file excluding the last 2 ms | ||||
|                 } | ||||
|         } | ||||
|  | ||||
|     CHECK(samples_ > 0) << "File does not contain enough samples to process."; | ||||
|     double signal_duration_s; | ||||
|     signal_duration_s = (double)samples_ * ( 1 /(double)sampling_frequency_); | ||||
|     DLOG(INFO) << "Total number samples to be processed= " << samples_ << " GNSS signal duration= " << signal_duration_s << " [s]"; | ||||
|     std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]" << std::endl; | ||||
|  | ||||
|     valve_ = gnss_sdr_make_valve(sizeof(float), samples_, queue_); | ||||
|     DLOG(INFO) << "valve(" << valve_->unique_id() << ")"; | ||||
|  | ||||
|     if (dump_) | ||||
|         { | ||||
|             //sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str()); | ||||
|             sink_ = gr::blocks::file_sink::make(sizeof(float), dump_filename_.c_str()); | ||||
|             DLOG(INFO) << "file_sink(" << sink_->unique_id() << ")"; | ||||
|         } | ||||
|  | ||||
|     if (enable_throttle_control_) | ||||
|         { | ||||
|             throttle_ = gr::blocks::throttle::make(sizeof(float), sampling_frequency_); | ||||
|  | ||||
|         } | ||||
|     DLOG(INFO) << "File source filename " << filename_; | ||||
|     DLOG(INFO) << "Samples " << samples_; | ||||
|     DLOG(INFO) << "Sampling frequency " << sampling_frequency_; | ||||
|     DLOG(INFO) << "Item type " << item_type_; | ||||
|     DLOG(INFO) << "Item size " << item_size_; | ||||
|     DLOG(INFO) << "Repeat " << repeat_; | ||||
|     DLOG(INFO) << "Dump " << dump_; | ||||
|     DLOG(INFO) << "Dump filename " << dump_filename_; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| NsrFileSignalSource::~NsrFileSignalSource() | ||||
| {} | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| void NsrFileSignalSource::connect(gr::top_block_sptr top_block) | ||||
| { | ||||
|     if (samples_ > 0) | ||||
|         { | ||||
|             if (enable_throttle_control_ == true) | ||||
|                 { | ||||
|                     top_block->connect(file_source_, 0, unpack_byte_, 0); | ||||
|                     top_block->connect(unpack_byte_, 0,throttle_,0); | ||||
|  | ||||
|                     DLOG(INFO) << "connected file source to throttle"; | ||||
|                     top_block->connect(throttle_, 0, valve_, 0); | ||||
|                     DLOG(INFO) << "connected throttle to valve"; | ||||
|                     if (dump_) | ||||
|                         { | ||||
|                             top_block->connect(valve_, 0, sink_, 0); | ||||
|                             DLOG(INFO) << "connected valve to file sink"; | ||||
|                         } | ||||
|                 } | ||||
|             else | ||||
|                 { | ||||
|                     top_block->connect(file_source_, 0, unpack_byte_, 0); | ||||
|                     top_block->connect(unpack_byte_, 0,valve_,0); | ||||
|                     DLOG(INFO) << "connected file source to valve"; | ||||
|                     if (dump_) | ||||
|                         { | ||||
|                             top_block->connect(valve_, 0, sink_, 0); | ||||
|                             DLOG(INFO) << "connected valve to file sink"; | ||||
|                         } | ||||
|                 } | ||||
|         } | ||||
|     else | ||||
|         { | ||||
|             if (enable_throttle_control_ == true) | ||||
|                 { | ||||
|                     top_block->connect(file_source_, 0, unpack_byte_, 0); | ||||
|                     top_block->connect(unpack_byte_, 0,throttle_,0); | ||||
|                     DLOG(INFO) << "connected file source to throttle"; | ||||
|                     if (dump_) | ||||
|                         { | ||||
|                             top_block->connect(throttle_, 0, sink_, 0); | ||||
|                             DLOG(INFO) << "connected file source to sink"; | ||||
|                         } | ||||
|                 } | ||||
|             else | ||||
|                 { | ||||
|                     if (dump_) | ||||
|                         { | ||||
|                             top_block->connect(file_source_, 0, unpack_byte_, 0); | ||||
|                             top_block->connect(unpack_byte_, 0, sink_, 0); | ||||
|                             DLOG(INFO) << "connected file source to sink"; | ||||
|                         } | ||||
|                 } | ||||
|         } | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| void NsrFileSignalSource::disconnect(gr::top_block_sptr top_block) | ||||
| { | ||||
|     if (samples_ > 0) | ||||
|         { | ||||
|             if (enable_throttle_control_ == true) | ||||
|                 { | ||||
|                     top_block->disconnect(file_source_, 0, unpack_byte_, 0); | ||||
|                     DLOG(INFO) << "disconnected file source to unpack_byte_"; | ||||
|                     top_block->connect(unpack_byte_, 0,throttle_,0); | ||||
|                     DLOG(INFO) << "disconnected unpack_byte_ to throttle_"; | ||||
|                     top_block->disconnect(throttle_, 0, valve_, 0); | ||||
|                     DLOG(INFO) << "disconnected throttle to valve"; | ||||
|                     if (dump_) | ||||
|                         { | ||||
|                             top_block->disconnect(valve_, 0, sink_, 0); | ||||
|                             DLOG(INFO) << "disconnected valve to file sink"; | ||||
|                         } | ||||
|                 } | ||||
|             else | ||||
|                 { | ||||
|                     top_block->disconnect(file_source_, 0, unpack_byte_, 0); | ||||
|                     DLOG(INFO) << "disconnected file source to unpack_byte_"; | ||||
|                     top_block->disconnect(unpack_byte_, 0, valve_, 0); | ||||
|                     DLOG(INFO) << "disconnected unpack_byte_ to valve"; | ||||
|                     if (dump_) | ||||
|                         { | ||||
|                             top_block->disconnect(valve_, 0, sink_, 0); | ||||
|                             DLOG(INFO) << "disconnected valve to file sink"; | ||||
|                         } | ||||
|                 } | ||||
|         } | ||||
|     else | ||||
|         { | ||||
|             if (enable_throttle_control_ == true) | ||||
|                 { | ||||
| 					top_block->disconnect(file_source_, 0, unpack_byte_, 0); | ||||
| 					DLOG(INFO) << "disconnected file source to unpack_byte_"; | ||||
|                     top_block->disconnect(unpack_byte_, 0, throttle_, 0); | ||||
|                     DLOG(INFO) << "disconnected unpack_byte_ to throttle"; | ||||
|                     if (dump_) | ||||
|                         { | ||||
|                             top_block->disconnect(unpack_byte_, 0, sink_, 0); | ||||
|                             DLOG(INFO) << "disconnected funpack_byte_ to sink"; | ||||
|                         } | ||||
|                 } | ||||
|             else | ||||
|                 { | ||||
|                     if (dump_) | ||||
|                         { | ||||
| 							top_block->disconnect(file_source_, 0, unpack_byte_, 0); | ||||
| 							DLOG(INFO) << "disconnected file source to unpack_byte_"; | ||||
|                             top_block->disconnect(unpack_byte_, 0, sink_, 0); | ||||
|                             DLOG(INFO) << "disconnected unpack_byte_ to sink"; | ||||
|                         } | ||||
|                 } | ||||
|         } | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| gr::basic_block_sptr NsrFileSignalSource::get_left_block() | ||||
| { | ||||
|     LOG_AT_LEVEL(WARNING) << "Left block of a signal source should not be retrieved"; | ||||
|     //return gr_block_sptr(); | ||||
|     return gr::blocks::file_source::sptr(); | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| gr::basic_block_sptr NsrFileSignalSource::get_right_block() | ||||
| { | ||||
|     if (samples_ > 0) | ||||
|         { | ||||
|             return valve_; | ||||
|         } | ||||
|     else | ||||
|         { | ||||
|             if (enable_throttle_control_ == true) | ||||
|                 { | ||||
|                     return throttle_; | ||||
|                 } | ||||
|             else | ||||
|                 { | ||||
|                     return unpack_byte_; | ||||
|                 } | ||||
|         } | ||||
| } | ||||
							
								
								
									
										123
									
								
								src/algorithms/signal_source/adapters/nsr_file_signal_source.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										123
									
								
								src/algorithms/signal_source/adapters/nsr_file_signal_source.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,123 @@ | ||||
| /*! | ||||
|  * \file nsr_file_signal_source.h | ||||
|  * \brief Implementation of a class that reads signals samples from a NSR 2 bits sampler front-end file | ||||
|  * and adapts it to a SignalSourceInterface. More information about the front-end here | ||||
|  * http://www.ifen.com/products/sx-scientific-gnss-solutions/nsr-software-receiver.html | ||||
|  * \author Javier Arribas, 2013 jarribas(at)cttc.es | ||||
|  * | ||||
|  * This class represents a file signal source. | ||||
|  * | ||||
|  * ------------------------------------------------------------------------- | ||||
|  * | ||||
|  * Copyright (C) 2010-2012  (see AUTHORS file for a list of contributors) | ||||
|  * | ||||
|  * GNSS-SDR is a software defined Global Navigation | ||||
|  *          Satellite Systems receiver | ||||
|  * | ||||
|  * This file is part of GNSS-SDR. | ||||
|  * | ||||
|  * GNSS-SDR is free software: you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
|  * the Free Software Foundation, either version 3 of the License, or | ||||
|  * at your option) any later version. | ||||
|  * | ||||
|  * GNSS-SDR is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  * GNU General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * ------------------------------------------------------------------------- | ||||
|  */ | ||||
|  | ||||
| #ifndef GNSS_SDR_NSR_FILE_SIGNAL_SOURCE_H_ | ||||
| #define GNSS_SDR_NSR_FILE_SIGNAL_SOURCE_H_ | ||||
|  | ||||
| #include "gnss_block_interface.h" | ||||
| #include <gnuradio/blocks/file_source.h> | ||||
| #include "unpack_byte_2bit_samples.h" | ||||
| #include <gnuradio/blocks/file_sink.h> | ||||
| #include <gnuradio/blocks/throttle.h> | ||||
| #include <gnuradio/hier_block2.h> | ||||
| #include <gnuradio/msg_queue.h> | ||||
|  | ||||
| class ConfigurationInterface; | ||||
|  | ||||
| /*! | ||||
|  * \brief Class that reads signals samples from a file | ||||
|  * and adapts it to a SignalSourceInterface | ||||
|  */ | ||||
| class NsrFileSignalSource: public GNSSBlockInterface | ||||
| { | ||||
| public: | ||||
|     NsrFileSignalSource(ConfigurationInterface* configuration, std::string role, | ||||
|             unsigned int in_streams, unsigned int out_streams, | ||||
|             boost::shared_ptr<gr::msg_queue> queue); | ||||
|  | ||||
|     virtual ~NsrFileSignalSource(); | ||||
|     std::string role() | ||||
|     { | ||||
|         return role_; | ||||
|     } | ||||
|  | ||||
|     /*! | ||||
|      * \brief Returns "Nsr_File_Signal_Source". | ||||
|      */ | ||||
|     std::string implementation() | ||||
|     { | ||||
|         return "Nsr_File_Signal_Source"; | ||||
|     } | ||||
|     size_t item_size() | ||||
|     { | ||||
|         return item_size_; | ||||
|     } | ||||
|     void connect(gr::top_block_sptr top_block); | ||||
|     void disconnect(gr::top_block_sptr top_block); | ||||
|     gr::basic_block_sptr get_left_block(); | ||||
|     gr::basic_block_sptr get_right_block(); | ||||
|     std::string filename() | ||||
|     { | ||||
|         return filename_; | ||||
|     } | ||||
|     std::string item_type() | ||||
|     { | ||||
|         return item_type_; | ||||
|     } | ||||
|     bool repeat() | ||||
|     { | ||||
|         return repeat_; | ||||
|     } | ||||
|     long sampling_frequency() | ||||
|     { | ||||
|         return sampling_frequency_; | ||||
|     } | ||||
|     long samples() | ||||
|     { | ||||
|         return samples_; | ||||
|     } | ||||
|  | ||||
| private: | ||||
|     unsigned long long samples_; | ||||
|     long sampling_frequency_; | ||||
|     std::string filename_; | ||||
|     std::string item_type_; | ||||
|     bool repeat_; | ||||
|     bool dump_; | ||||
|     std::string dump_filename_; | ||||
|     std::string role_; | ||||
|     unsigned int in_streams_; | ||||
|     unsigned int out_streams_; | ||||
|     gr::blocks::file_source::sptr file_source_; | ||||
|     unpack_byte_2bit_samples_sptr unpack_byte_; | ||||
|     boost::shared_ptr<gr::block> valve_; | ||||
|     gr::blocks::file_sink::sptr sink_; | ||||
|     gr::blocks::throttle::sptr  throttle_; | ||||
|     boost::shared_ptr<gr::msg_queue> queue_; | ||||
|     size_t item_size_; | ||||
|     // Throttle control | ||||
|     bool enable_throttle_control_; | ||||
| }; | ||||
|  | ||||
| #endif /*GNSS_SDR_NSR_FILE_SIGNAL_SOURCE_H_*/ | ||||
							
								
								
									
										32
									
								
								src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,32 @@ | ||||
| # Copyright (C) 2012-2013  (see AUTHORS file for a list of contributors) | ||||
| # | ||||
| # This file is part of GNSS-SDR. | ||||
| # | ||||
| # GNSS-SDR is free software: you can redistribute it and/or modify | ||||
| # it under the terms of the GNU General Public License as published by | ||||
| # the Free Software Foundation, either version 3 of the License, or | ||||
| # at your option) any later version. | ||||
| # | ||||
| # GNSS-SDR is distributed in the hope that it will be useful, | ||||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
| # GNU General Public License for more details. | ||||
| # | ||||
| # You should have received a copy of the GNU General Public License | ||||
| # along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>. | ||||
| # | ||||
|  | ||||
|  | ||||
| set(SIGNAL_SOURCE_GR_BLOCKS_SOURCES  | ||||
|      unpack_byte_2bit_samples.cc | ||||
| ) | ||||
|  | ||||
| include_directories( | ||||
|      $(CMAKE_CURRENT_SOURCE_DIR) | ||||
|      ${GLOG_INCLUDE_DIRS} | ||||
|      ${GFlags_INCLUDE_DIRS} | ||||
|      ${GNURADIO_RUNTIME_INCLUDE_DIRS} | ||||
| ) | ||||
|  | ||||
| add_library(signal_source_gr_blocks ${SIGNAL_SOURCE_GR_BLOCKS_SOURCES}) | ||||
| target_link_libraries(signal_source_gr_blocks ${GNURADIO_RUNTIME_LIBRARIES}) | ||||
| @@ -0,0 +1,87 @@ | ||||
| /*! | ||||
|  * \file unpack_byte_2bit_samples.cc | ||||
|  * | ||||
|  * \brief Unpacks byte samples to NSR 2 bits samples | ||||
|  * \author Javier Arribas jarribas (at) cttc.es | ||||
|  * ------------------------------------------------------------------------- | ||||
|  * | ||||
|  * Copyright (C) 2010-2012  (see AUTHORS file for a list of contributors) | ||||
|  * | ||||
|  * GNSS-SDR is a software defined Global Navigation | ||||
|  *          Satellite Systems receiver | ||||
|  * | ||||
|  * This file is part of GNSS-SDR. | ||||
|  * | ||||
|  * GNSS-SDR is free software: you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
|  * the Free Software Foundation, either version 3 of the License, or | ||||
|  * at your option) any later version. | ||||
|  * | ||||
|  * GNSS-SDR is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  * GNU General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * ------------------------------------------------------------------------- | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include "unpack_byte_2bit_samples.h" | ||||
| #include <iostream> | ||||
| #include <gnuradio/io_signature.h> | ||||
|  | ||||
| struct byte_2bit_struct | ||||
| { | ||||
|   signed two_bit_sample:2;  // <- 2 bits wide only | ||||
| }; | ||||
|  | ||||
|  | ||||
| unpack_byte_2bit_samples_sptr make_unpack_byte_2bit_samples() | ||||
| { | ||||
|     return unpack_byte_2bit_samples_sptr(new unpack_byte_2bit_samples()); | ||||
| } | ||||
|  | ||||
| unpack_byte_2bit_samples::unpack_byte_2bit_samples() | ||||
| 	: sync_interpolator("unpack_byte_2bit_samples", | ||||
|             		gr::io_signature::make(1, 1,sizeof(signed char)), | ||||
|             		gr::io_signature::make(1, 1,sizeof(float)), | ||||
|             		4) | ||||
| { | ||||
|  | ||||
| } | ||||
|  | ||||
| unpack_byte_2bit_samples::~unpack_byte_2bit_samples() | ||||
| { | ||||
|  | ||||
| } | ||||
|  | ||||
| int unpack_byte_2bit_samples::work(int noutput_items,gr_vector_const_void_star &input_items, | ||||
|         gr_vector_void_star &output_items) | ||||
| { | ||||
|     const signed char *in = (const signed char *)input_items[0]; | ||||
|     float *out = (float*)output_items[0]; | ||||
|  | ||||
|     byte_2bit_struct sample; | ||||
|     int n=0; | ||||
|     for(int i = 0; i < noutput_items/4; i++) { | ||||
|     	// Read packed input sample (1 byte = 4 samples) | ||||
|     	signed char c = in[i]; | ||||
|         sample.two_bit_sample=c & 3; | ||||
|         out[n++]=(float)sample.two_bit_sample; | ||||
|  | ||||
|         sample.two_bit_sample=(c>>2) & 3; | ||||
|         out[n++]=(float)sample.two_bit_sample; | ||||
|  | ||||
|         sample.two_bit_sample=(c>>4) & 3; | ||||
|         out[n++]=(float)sample.two_bit_sample; | ||||
|  | ||||
|         sample.two_bit_sample=(c>>6) & 3; | ||||
|         out[n++]=(float)sample.two_bit_sample; | ||||
|  | ||||
|     } | ||||
|  | ||||
|     return noutput_items; | ||||
| } | ||||
| @@ -0,0 +1,58 @@ | ||||
| /*! | ||||
|  * \file unpack_byte_2bit_samples.h | ||||
|  * | ||||
|  * \brief Unpacks byte samples to NSR 2 bits samples | ||||
|  * \author Javier Arribas jarribas (at) cttc.es | ||||
|  * ------------------------------------------------------------------------- | ||||
|  * | ||||
|  * Copyright (C) 2010-2012  (see AUTHORS file for a list of contributors) | ||||
|  * | ||||
|  * GNSS-SDR is a software defined Global Navigation | ||||
|  *          Satellite Systems receiver | ||||
|  * | ||||
|  * This file is part of GNSS-SDR. | ||||
|  * | ||||
|  * GNSS-SDR is free software: you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
|  * the Free Software Foundation, either version 3 of the License, or | ||||
|  * at your option) any later version. | ||||
|  * | ||||
|  * GNSS-SDR is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  * GNU General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * ------------------------------------------------------------------------- | ||||
|  */ | ||||
|  | ||||
| #ifndef GNSS_SDR_unpack_byte_2bit_samples_H | ||||
| #define 	 GNSS_SDR_unpack_byte_2bit_samples_H | ||||
|  | ||||
| #include <gnuradio/sync_interpolator.h> | ||||
|  | ||||
| class unpack_byte_2bit_samples; | ||||
| typedef boost::shared_ptr<unpack_byte_2bit_samples> unpack_byte_2bit_samples_sptr; | ||||
|  | ||||
| unpack_byte_2bit_samples_sptr make_unpack_byte_2bit_samples(); | ||||
|  | ||||
| /*! | ||||
|  * \brief This class implements conversion between byte packet samples to 2bit samples | ||||
|  *  1 byte = 4 2bit samples | ||||
|  */ | ||||
| class unpack_byte_2bit_samples: public gr::sync_interpolator | ||||
| { | ||||
| private: | ||||
|     friend unpack_byte_2bit_samples_sptr | ||||
|     make_unpack_byte_2bit_samples_sptr(); | ||||
|  | ||||
| public: | ||||
|     unpack_byte_2bit_samples(); | ||||
|     ~unpack_byte_2bit_samples(); | ||||
|     int work (int noutput_items,gr_vector_const_void_star &input_items, | ||||
|     		gr_vector_void_star &output_items); | ||||
| }; | ||||
|  | ||||
| #endif | ||||
| @@ -34,6 +34,7 @@ include_directories( | ||||
| 	 ${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-supl | ||||
|      ${CMAKE_SOURCE_DIR}/src/algorithms/libs | ||||
|      ${CMAKE_SOURCE_DIR}/src/algorithms/signal_source/adapters | ||||
|      ${CMAKE_SOURCE_DIR}/src/algorithms/signal_source/gnuradio_blocks | ||||
|      ${CMAKE_SOURCE_DIR}/src/algorithms/output_filter/adapters | ||||
|      ${CMAKE_SOURCE_DIR}/src/algorithms/channel/adapters | ||||
|      ${CMAKE_SOURCE_DIR}/src/algorithms/channel/libs | ||||
|   | ||||
| @@ -44,6 +44,7 @@ | ||||
| #include "gnss_block_interface.h" | ||||
| #include "pass_through.h" | ||||
| #include "file_signal_source.h" | ||||
| #include "nsr_file_signal_source.h" | ||||
| #include "null_sink_output_filter.h" | ||||
| #include "file_output_filter.h" | ||||
| #include "channel.h" | ||||
| @@ -286,6 +287,21 @@ GNSSBlockInterface* GNSSBlockFactory::GetBlock( | ||||
|                     exit(1); | ||||
|             } | ||||
|         } | ||||
|     else if (implementation.compare("Nsr_File_Signal_Source") == 0) | ||||
|         { | ||||
|             try | ||||
|             { | ||||
|                     block = new NsrFileSignalSource(configuration, role, in_streams, | ||||
|                             out_streams, queue); | ||||
|             } | ||||
|             catch (const std::exception &e) | ||||
|             { | ||||
|                     std::cout << "GNSS-SDR program ended." << std::endl; | ||||
|                     LOG_AT_LEVEL(INFO) << implementation | ||||
|                             << ": Source file not found"; | ||||
|                     exit(1); | ||||
|             } | ||||
|         } | ||||
|     else if (implementation.compare("UHD_Signal_Source") == 0) | ||||
|         { | ||||
|             block = new UhdSignalSource(configuration, role, in_streams, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Javier Arribas
					Javier Arribas