def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.freq_xlating_fft_filter_ccc_0.set_taps((firdes.low_pass(1,self.samp_rate,200000,10000))) self.freq_xlating_fft_filter_ccc_0_0.set_taps((firdes.low_pass(1,self.samp_rate,200000,10000))) self.freq_xlating_fft_filter_ccc_0_0_0.set_taps((firdes.low_pass(1,self.samp_rate,200000,10000))) self.qtgui_waterfall_sink_x_0.set_frequency_range(self.freq, self.samp_rate) self.rtlsdr_source_0.set_sample_rate(self.samp_rate)
def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.set_samp_per_sym(int((self.samp_rate/(self.decimation)) / self.symb_rate)) self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate, 600e3, 5e3, firdes.WIN_BLACKMAN, 6.76)) self.blocks_throttle_0.set_sample_rate(self.samp_rate) self.freq_xlating_fir_filter_xxx_0.set_taps((firdes.low_pass(1, self.samp_rate, self.channel_spacing, self.channel_trans, firdes.WIN_BLACKMAN,6.76))) self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate)
def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.set_sps(((float)(self.samp_rate)/(float)(self.baud_rate))) self.uhd_usrp_source_0.set_samp_rate(self.samp_rate) self.uhd_usrp_source_0.set_bandwidth(self.samp_rate, 0) self.low_pass_filter_0_0.set_taps(firdes.low_pass(1, self.samp_rate, 100e3, 100e3, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate, 200e3, 100e3, firdes.WIN_HAMMING, 6.76))
def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.set_samp_per_sym(int(self.samp_rate/self.bit_rate)) self.blocks_throttle_0.set_sample_rate(self.samp_rate/32) self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate/self.fxff_decimation, self.bit_rate*0.8, self.bit_rate*.2, firdes.WIN_BLACKMAN, 6.76)) self.freq_xlating_fir_filter_xxx_0.set_taps((firdes.low_pass(1, self.samp_rate, self.bit_rate*1.1, self.bit_rate*.4, firdes.WIN_BLACKMAN, 6.76))) self.analog_quadrature_demod_cf_0.set_gain(self.samp_rate/(2*math.pi*self.fsk_deviation_hz/8.0)/self.fxff_decimation)
def set_decimation(self, decimation): self.decimation = decimation self.analog_sig_source_x_0_0_0.set_sampling_freq(self.samp_rate/self.decimation) self.high_pass_filter_0.set_taps(firdes.high_pass(1, self.samp_rate/self.decimation, self.bw, 10, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0_0_0.set_taps(firdes.low_pass(1, self.samp_rate/self.decimation, self.bw, 10, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0_0_0_0.set_taps(firdes.low_pass(self.visualsq, self.samp_rate/self.decimation, self.bw, 10, firdes.WIN_HAMMING, 6.76)) self.fractional_resampler_xx_0.set_resamp_ratio((self.samp_rate/self.decimation)/48000.0)
def set_audio_samp_rate(self, audio_samp_rate): self.audio_samp_rate = audio_samp_rate self.low_pass_filter_1.set_taps(firdes.low_pass(10, self.audio_samp_rate, (self.mark_frequency - self.space_frequency)/2.0, 1000, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.audio_samp_rate, self.deviation+self.max_modulation_freq, 3000, firdes.WIN_HAMMING, 6.76)) self.analog_sig_source_x_0.set_sampling_freq(self.audio_samp_rate) self.analog_quadrature_demod_cf_0_0.set_gain((2*math.pi*self.deviation)/self.audio_samp_rate) self.analog_quadrature_demod_cf_0.set_gain(((self.audio_samp_rate/10) / self.baud_rate)/(math.pi*1))
def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate, 75e3, 25e3, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0_0.set_taps(firdes.low_pass(1, self.samp_rate, 75e3, 25e3, firdes.WIN_HAMMING, 6.76)) self.osmosdr_source_0.set_sample_rate(self.samp_rate) self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate) self.analog_sig_source_x_0_0.set_sampling_freq(self.samp_rate)
def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self._samp_rate_text_box.set_value(self.samp_rate) self.iir_filter_xxx_0.set_taps(((1.0/(1+self.tau*2*self.samp_rate), 1.0/(1+self.tau*2*self.samp_rate))), ((1, -(1-self.tau*2*self.samp_rate)/(1+self.tau*2*self.samp_rate)))) self.low_pass_filter_2_1_0_0.set_taps(firdes.low_pass(1, self.samp_rate, 15000, 500, firdes.WIN_HANN, 6.76)) self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate, self.b_signal, 2000, firdes.WIN_HANN, 6.76)) self.osmosdr_source_0.set_sample_rate(self.samp_rate) self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate)
def set_initial_dec(self, initial_dec): self.initial_dec = initial_dec self._initial_dec_text_box.set_value(self.initial_dec) self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate/self.initial_dec, self.bandwidth, 20, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0_0.set_taps(firdes.low_pass(1, (self.samp_rate/self.initial_dec)/self.complex_dec, self.amplitude_filter, 50, firdes.WIN_HAMMING, 6.76)) self.wxgui_scopesink2_0.set_sample_rate(self.samp_rate/self.initial_dec/self.complex_dec/self.amplitude_dec) self.wxgui_scopesink2_1.set_sample_rate(self.samp_rate/self.initial_dec/self.complex_dec/self.amplitude_dec) self.wxgui_waterfallsink2_0_0.set_sample_rate(self.samp_rate/self.initial_dec)
def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.wxgui_waterfallsink2_0_0.set_sample_rate(self.samp_rate) self.freq_xlating_fir_filter_xxx_0.set_taps((firdes.low_pass(1, self.samp_rate, self.xlate_bandwidth/2, 1000))) self.wxgui_waterfallsink2_0.set_sample_rate(self.samp_rate/self.xlate_decim) self.wxgui_waterfallsink2_0_1.set_sample_rate(self.samp_rate/self.xlate_decim) self.rtlsdr_source_0.set_sample_rate(self.samp_rate) self.freq_xlating_fir_filter_xxx_0_0.set_taps((firdes.low_pass(1, self.samp_rate, self.xlate_bandwidth_0/2, 1000)))
def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.blocks_throttle_0.set_sample_rate(self.samp_rate) self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate/self.initial_dec, self.bandwidth, 20, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0_0.set_taps(firdes.low_pass(1, (self.samp_rate/self.initial_dec)/self.complex_dec, self.amplitude_filter, 50, firdes.WIN_HAMMING, 6.76)) self.wxgui_scopesink2_0.set_sample_rate(self.samp_rate/self.initial_dec/self.complex_dec/self.amplitude_dec) self.wxgui_scopesink2_1.set_sample_rate(self.samp_rate/self.initial_dec/self.complex_dec/self.amplitude_dec) self.wxgui_waterfallsink2_0_0.set_sample_rate(self.samp_rate/self.initial_dec)
def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.analog_sig_source_x_1.set_sampling_freq(self.samp_rate) self.analog_sig_source_x_1_0.set_sampling_freq(self.samp_rate) self.analog_sig_source_x_1_1.set_sampling_freq(self.samp_rate) self.analog_sig_source_x_1_2.set_sampling_freq(self.samp_rate) self.low_pass_filter_0_0.set_taps(firdes.low_pass(1, self.samp_rate, 3500, 100, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0_0_0.set_taps(firdes.low_pass(1, self.samp_rate, 3500, 100, firdes.WIN_HAMMING, 6.76))
def set_samp_rate_rx(self, samp_rate_rx): self.samp_rate_rx = samp_rate_rx self.set_xlate_filter_taps(firdes.low_pass(1, self.samp_rate_rx, 125000, 25000, firdes.WIN_HAMMING, 6.76)) self.osmosdr_source_0.set_sample_rate(self.samp_rate_rx) self.osmosdr_source_0.set_bandwidth(self.samp_rate_rx, 0) self.low_pass_filter_0_0.set_taps(firdes.low_pass(4, self.samp_rate_rx/self.xlating_decimation/self.lpf_decimation, 100, 100, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0.set_taps(firdes.low_pass(self.lpf_decimation, self.samp_rate_rx/self.xlating_decimation, 2e3, 1e3, firdes.WIN_HAMMING, 6.76)) self.analog_pll_carriertracking_cc_0.set_max_freq(2*math.pi*2e3/(self.samp_rate_rx/self.xlating_decimation/self.lpf_decimation)) self.analog_pll_carriertracking_cc_0.set_min_freq(-2*math.pi*2e3/(self.samp_rate_rx/self.xlating_decimation/self.lpf_decimation))
def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate) self.osmosdr_source_0_0.set_sample_rate(self.samp_rate) self.osmosdr_source_0_0.set_bandwidth(self.samp_rate, 0) self.low_pass_filter_0_0.set_taps(firdes.low_pass(1, self.samp_rate, self.bitrate, self.bitrate/2, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate, 2000000, 1000000, firdes.WIN_HAMMING, 6.76)) self.set_bw(self.samp_rate) self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate)
def set_usrp_rate(self, usrp_rate): self.usrp_rate = usrp_rate self.gr_frequency_modulator_fc_0.set_sensitivity(2*math.pi*self.fm_max_dev/self.usrp_rate) self.gr_sig_source_x_0.set_sampling_freq(self.usrp_rate) self.gr_sig_source_x_0_0.set_sampling_freq(self.usrp_rate) self.gr_sig_source_x_0_1.set_sampling_freq(self.usrp_rate) self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.usrp_rate, 2.5e3, .5e3, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0_0.set_taps(firdes.low_pass(1, self.usrp_rate, 15e3, 2e3, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0_0_0.set_taps(firdes.low_pass(1, self.usrp_rate, 15e3, 2e3, firdes.WIN_HAMMING, 6.76))
def set_bw(self, bw): self.bw = bw self.set_sb_pos(((self.bw*self.mode==2)-(self.bw*self.mode==3))) self.analog_sig_source_x_0.set_frequency(self.dev+(self.bw*self.mode==2)+(self.bw*self.mode==3)) self.analog_sig_source_x_0_0_0.set_frequency(-self.bw) self.high_pass_filter_0.set_taps(firdes.high_pass(1, self.samp_rate/self.decimation, self.bw, 10, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0_0_0.set_taps(firdes.low_pass(1, self.samp_rate/self.decimation, self.bw, 10, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0_2.set_taps(firdes.low_pass(1, self.samp_rate, self.bw*(2+(self.mode==2)+(self.mode==3)), 500, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0_0_0_0.set_taps(firdes.low_pass(self.visualsq, self.samp_rate/self.decimation, self.bw, 10, firdes.WIN_HAMMING, 6.76))
def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.freq_xlating_fft_filter_ccc_0.set_taps((firdes.low_pass(1,self.samp_rate,200000,10000))) self.freq_xlating_fft_filter_ccc_0_0.set_taps((firdes.low_pass(1,self.samp_rate,200000,10000))) self.freq_xlating_fft_filter_ccc_0_0_0.set_taps((firdes.low_pass(1,self.samp_rate,200000,10000))) self.rtlsdr_source_0.set_sample_rate(self.samp_rate) self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate) self.wxgui_fftsink2_0_0.set_sample_rate(self.samp_rate) self.wxgui_fftsink2_0_0_0.set_sample_rate(self.samp_rate) self.wxgui_waterfallsink2_1.set_sample_rate(self.samp_rate)
def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.set_decimation(self.samp_rate / 48000) self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate) self.wxgui_waterfallsink2_0.set_sample_rate(self.samp_rate / self.decimation) self.band_pass_filter_0.set_taps(firdes.complex_band_pass(1, self.samp_rate / self.decimation, 200, 2800, 200, firdes.WIN_HAMMING, 6.76)) self.analog_sig_source_x_1.set_sampling_freq(self.samp_rate / self.decimation) self.low_pass_filter_1.set_taps(firdes.low_pass(1000, self.samp_rate / 25, 200, 50, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate, 20000, 5000, firdes.WIN_HAMMING, 6.76)) self.osmosdr_source_0.set_sample_rate(self.samp_rate)
def set_variable_sample_rate_0(self, variable_sample_rate_0): self.variable_sample_rate_0 = variable_sample_rate_0 self._variable_sample_rate_0_text_box.set_value(self.variable_sample_rate_0) self.set_xlate_filter(firdes.low_pass(1, self.variable_sample_rate_0, 125000, 25000, firdes.WIN_HAMMING, 6.76)) self.RTL820T.set_sample_rate(self.variable_sample_rate_0) self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.variable_sample_rate_0, 5000, 8000, firdes.WIN_HAMMING, 6.76)) self.wxgui_constellationsink2_0.set_sample_rate(self.variable_sample_rate_0) self.wxgui_fftsink2_0.set_sample_rate(self.variable_sample_rate_0) self.wxgui_scopesink2_0.set_sample_rate(self.variable_sample_rate_0) self.wxgui_waterfallsink2_0.set_sample_rate(self.variable_sample_rate_0)
def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.set_file_name_string(str(int(time.mktime(time.gmtime())))+"UTC_"+'{:.6f}'.format(self.lo_freq)+"Hz"+"_"+str(int(self.samp_rate/100))+"sps"+".raw") self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate/100) self.low_pass_filter_0.set_taps(firdes.low_pass(10**(self.gain_offset_dB/20), self.samp_rate, 100E3, 20E3, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0_0.set_taps(firdes.low_pass(1, self.samp_rate/100, 0.9*self.cw_filter_bw, 0.1*self.cw_filter_bw, firdes.WIN_BLACKMAN, 6.76)) self.qtgui_freq_sink_x_0_0.set_frequency_range(self.lo_freq, self.samp_rate/100) self.qtgui_freq_sink_x_0.set_frequency_range(self.usrp_DDC_freq, self.samp_rate) self.qtgui_waterfall_sink_x_0.set_frequency_range(self.usrp_DDC_freq, self.samp_rate) self.uhd_usrp_source_0.set_samp_rate(self.samp_rate)
def set_channel_rate(self, channel_rate): self.channel_rate = channel_rate self.goertzel_fc_0_0.set_rate(self.channel_rate) self.freq_xlating_fir_filter_xxx_0_0.set_taps((firdes.low_pass(1.0, self.channel_rate, 500, 100, firdes.WIN_HAMMING))) self.blocks_delay_0.set_dly(int(self.channel_rate/30*0.0)) self.set_rf_scale(int(self.rf_rate/self.channel_rate) + self.rf_rate % self.channel_rate) self.set_audio_scale(int(self.channel_rate/self.audio_rate) + self.channel_rate % self.audio_rate) self.wxgui_fftsink2_0.set_sample_rate(self.channel_rate) self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.channel_rate, 10000, 4000, firdes.WIN_HAMMING, 6.76)) self.freq_xlating_fir_filter_xxx_0.set_taps((firdes.low_pass(1.0, self.rf_rate, self.channel_rate, self.channel_rate/2, firdes.WIN_HAMMING)))
def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.blocks_throttle_0_1.set_sample_rate(self.samp_rate) self.low_pass_filter_0_0.set_taps(firdes.low_pass(1, self.samp_rate, 30, 30, firdes.WIN_HAMMING, 6.76)) self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate) self.analog_sig_source_x_1.set_sampling_freq(self.samp_rate) self.low_pass_filter_0_1.set_taps(firdes.low_pass(1, self.samp_rate, 500, 500, firdes.WIN_HAMMING, 6.76)) self.analog_sig_source_x_0_0.set_sampling_freq(self.samp_rate) self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate, self.bandwidth, self.bandwidth, firdes.WIN_HAMMING, 6.76)) self.blocks_throttle_0_0.set_sample_rate(self.samp_rate) self.wxgui_waterfallsink2_0.set_sample_rate(self.samp_rate)
def set_processing_rate(self, processing_rate): with self._lock: self.processing_rate = processing_rate self.analog_quadrature_demod_cf_0.set_gain((self.processing_rate // 2)/(2*math.pi*self.fsk_deviation_hz/8.0)) self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.processing_rate, 60e3, 15e3, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0_0.set_taps(firdes.low_pass(1, self.processing_rate // 2, self.fm_bandwidth + 1e3, 1e3, firdes.WIN_HAMMING, 6.76)) self.qtgui_freq_sink_x_1.set_frequency_range(self.satellite_frequency, self.processing_rate // 2) self.qtgui_time_sink_x_0.set_samp_rate(self.processing_rate // 2) self.qtgui_waterfall_sink_x_0.set_frequency_range(self.satellite_frequency, self.processing_rate // 2) self.apt_am_demod_0.set_parameter_samp_rate(self.processing_rate / 2) self.blocks_throttle_0.set_sample_rate(self.processing_rate)
def set_baseband_rate(self, baseband_rate): self.baseband_rate = baseband_rate self.set_rds_samp_rate(self.baseband_rate / self.rds_dec) self.analog_pll_refout_cc_0.set_max_freq(2 * cmath.pi * (19000+200) / self.baseband_rate) self.analog_pll_refout_cc_0.set_min_freq(2 * cmath.pi * (19000-200) / self.baseband_rate) self.band_pass_filter_0.set_taps(firdes.complex_band_pass(1, self.baseband_rate, self.pilot_tone - 0.5e3, self.pilot_tone+0.5e3, 1e3, firdes.WIN_HAMMING, 6.76)) self.band_pass_filter_0_0.set_taps(firdes.band_pass(1, self.baseband_rate, 23e3, 53e3, 1e3, firdes.WIN_HAMMING, 6.76)) self.band_pass_filter_1.set_taps(firdes.band_pass(1, self.baseband_rate, self.stereo_subcarrier - 0.5e3, self.stereo_subcarrier + 0.5e3, 0.5e3, firdes.WIN_HAMMING, 6.76)) self.freq_xlating_fir_filter_xxx_1.set_taps((firdes.low_pass(2500,self.baseband_rate,self.rds_bandwidth,1e3,firdes.WIN_HAMMING))) self.low_pass_filter_1.set_taps(firdes.low_pass(10, self.baseband_rate, 15e3, 3e3, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_2.set_taps(firdes.low_pass(1, self.baseband_rate, 16e3, 1e3, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_4.set_taps(firdes.low_pass(1, self.baseband_rate, 60e3, 1e3, firdes.WIN_HAMMING, 6.76)) self.qtgui_freq_sink_x_0_0.set_frequency_range(0, self.baseband_rate) self.qtgui_freq_sink_x_0_1_0_0.set_frequency_range(0, self.baseband_rate) self.qtgui_time_sink_x_0.set_samp_rate(self.baseband_rate)
def set_baseband_rate(self, baseband_rate): self.baseband_rate = baseband_rate self.set_audio_decim_rate(self.baseband_rate/self.audio_decim) self.wxgui_fftsink2_0_0_0_1.set_sample_rate(self.baseband_rate) self.wxgui_fftsink2_0_0_0_1_0_0.set_sample_rate(self.baseband_rate) self.wxgui_fftsink2_0_0.set_sample_rate(self.baseband_rate) self.fir_filter_xxx_2.set_taps((firdes.complex_band_pass(1.0,self.baseband_rate,19e3-500,19e3+500,1e3,firdes.WIN_HAMMING))) self.wxgui_scopesink2_0.set_sample_rate(self.baseband_rate) self.analog_pll_refout_cc_0.set_max_freq(2 * math.pi * (19000+200) / self.baseband_rate) self.analog_pll_refout_cc_0.set_min_freq(2 * math.pi * (19000-200) / self.baseband_rate) self.fir_filter_xxx_5.set_taps((firdes.low_pass(1.0,self.baseband_rate,20e3,40e3,firdes.WIN_HAMMING))) self.fir_filter_xxx_3.set_taps((firdes.band_pass(1.0,self.baseband_rate,38e3-13e3,38e3+13e3,3e3,firdes.WIN_HAMMING))) self.fir_filter_xxx_1.set_taps((firdes.low_pass(1.0,self.baseband_rate,13e3,3e3,firdes.WIN_HAMMING))) self.wxgui_waterfallsink2_0.set_sample_rate(self.baseband_rate) self.freq_xlating_fir_filter_xxx_1.set_taps((firdes.low_pass(2500.0,self.baseband_rate,2.4e3,2e3,firdes.WIN_HAMMING)))
def __init__(self): gr.hier_block2.__init__( self, "NBFM Chain", gr.io_signature(1, 1, gr.sizeof_gr_complex*1), gr.io_signature(1, 1, gr.sizeof_float*1), ) ################################################## # Blocks ################################################## self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=192000, decimation=2400000, taps=None, fractional_bw=None, ) self.low_pass_filter_1 = filter.fir_filter_ccf(1, firdes.low_pass( 1, 192000, 5e3, 5e3, firdes.WIN_HAMMING, 6.76)) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((5, )) self.analog_nbfm_rx_0 = analog.nbfm_rx( audio_rate=48000, quad_rate=192000, tau=75e-6, max_dev=2.5e3, ) ################################################## # Connections ################################################## self.connect((self.analog_nbfm_rx_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self, 0)) self.connect((self.low_pass_filter_1, 0), (self.analog_nbfm_rx_0, 0)) self.connect((self, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.low_pass_filter_1, 0))
def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate) self.wxgui_waterfallsink2_0.set_sample_rate(self.samp_rate) self.osmosdr_source_c_0_1.set_sample_rate(self.samp_rate) self.freq_xlating_fir_filter_xxx_0_1.set_taps((firdes.low_pass(1, self.samp_rate,self.cutoff, self.width, firdes.WIN_BLACKMAN, 6.76))) self.wxgui_scopesink2_0_0.set_sample_rate(self.samp_rate)
def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate) self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate) self.blocks_throttle_0.set_sample_rate(self.samp_rate) self.wxgui_fftsink2_0_0.set_sample_rate(self.samp_rate) self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate, self.cutoff, 100, firdes.WIN_HAMMING, 6.76))
def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.set_pre_channel_rate(self.samp_rate/self.decim) self.wxgui_waterfallsink2_0.set_sample_rate(self.samp_rate) self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate) self.osmosdr_source_c_0.set_sample_rate(self.samp_rate) self.freq_xlating_fir_filter_xxx_0.set_taps((firdes.low_pass(1, self.samp_rate, self.xlate_bandwidth/2, 6000)))
def set_channel_trans(self, channel_trans): self.channel_trans = channel_trans self._channel_trans_slider.set_value(self.channel_trans) self._channel_trans_text_box.set_value(self.channel_trans) self.freq_xlating_fir_filter_xxx_0.set_taps( (firdes.low_pass(1, self.samp_rate, self.channel_spacing, self.channel_trans, firdes.WIN_BLACKMAN, 6.76)) )
def __init__(self): gr.top_block.__init__(self, "Top Block") Qt.QWidget.__init__(self) self.setWindowTitle("Top Block") try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "top_block") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 10e3 self.freq = freq = 2e3 ################################################## # Blocks ################################################## self._samp_rate_range = Range(1e3, 40e3, 200, 10e3, 200) self._samp_rate_win = RangeWidget(self._samp_rate_range, self.set_samp_rate, "samp_rate", "counter_slider", float) self.top_layout.addWidget(self._samp_rate_win) self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "" ) self.rtlsdr_source_0.set_sample_rate(samp_rate) self.rtlsdr_source_0.set_center_freq(freq, 0) self.rtlsdr_source_0.set_freq_corr(0, 0) self.rtlsdr_source_0.set_dc_offset_mode(0, 0) self.rtlsdr_source_0.set_iq_balance_mode(0, 0) self.rtlsdr_source_0.set_gain_mode(False, 0) self.rtlsdr_source_0.set_gain(37.2, 0) self.rtlsdr_source_0.set_if_gain(20, 0) self.rtlsdr_source_0.set_bb_gain(20, 0) self.rtlsdr_source_0.set_antenna("", 0) self.rtlsdr_source_0.set_bandwidth(10000, 0) self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=1, decimation=1, taps=None, fractional_bw=0.45, ) self.qtgui_tab_widget_0 = Qt.QTabWidget() self.qtgui_tab_widget_0_widget_0 = Qt.QWidget() self.qtgui_tab_widget_0_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.qtgui_tab_widget_0_widget_0) self.qtgui_tab_widget_0_grid_layout_0 = Qt.QGridLayout() self.qtgui_tab_widget_0_layout_0.addLayout(self.qtgui_tab_widget_0_grid_layout_0) self.qtgui_tab_widget_0.addTab(self.qtgui_tab_widget_0_widget_0, "LPDemodulatedSignal") self.qtgui_tab_widget_0_widget_1 = Qt.QWidget() self.qtgui_tab_widget_0_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.qtgui_tab_widget_0_widget_1) self.qtgui_tab_widget_0_grid_layout_1 = Qt.QGridLayout() self.qtgui_tab_widget_0_layout_1.addLayout(self.qtgui_tab_widget_0_grid_layout_1) self.qtgui_tab_widget_0.addTab(self.qtgui_tab_widget_0_widget_1, "FrequencyDomainOfDemodulatedSignal") self.qtgui_tab_widget_0_widget_2 = Qt.QWidget() self.qtgui_tab_widget_0_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.qtgui_tab_widget_0_widget_2) self.qtgui_tab_widget_0_grid_layout_2 = Qt.QGridLayout() self.qtgui_tab_widget_0_layout_2.addLayout(self.qtgui_tab_widget_0_grid_layout_2) self.qtgui_tab_widget_0.addTab(self.qtgui_tab_widget_0_widget_2, "TimeRepresentationOfCarrier") self.qtgui_tab_widget_0_widget_3 = Qt.QWidget() self.qtgui_tab_widget_0_layout_3 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.qtgui_tab_widget_0_widget_3) self.qtgui_tab_widget_0_grid_layout_3 = Qt.QGridLayout() self.qtgui_tab_widget_0_layout_3.addLayout(self.qtgui_tab_widget_0_grid_layout_3) self.qtgui_tab_widget_0.addTab(self.qtgui_tab_widget_0_widget_3, "TimeDomainForDemodSignal") self.top_layout.addWidget(self.qtgui_tab_widget_0) self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass( 1, samp_rate, 10, 1, firdes.WIN_HAMMING, 6.76)) self.blocks_multiply_xx_0_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((2, )) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self.analog_sig_source_x_0_0 = analog.sig_source_c(samp_rate, analog.GR_SIN_WAVE, 434.015e6, 1, 0) self.TimeRepresentationOfCarrier_0 = qtgui.time_sink_c( 1024, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.TimeRepresentationOfCarrier_0.set_update_time(0.10) self.TimeRepresentationOfCarrier_0.set_y_axis(-1, 1) self.TimeRepresentationOfCarrier_0.set_y_label("Amplitude", "") self.TimeRepresentationOfCarrier_0.enable_tags(-1, True) self.TimeRepresentationOfCarrier_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.TimeRepresentationOfCarrier_0.enable_autoscale(True) self.TimeRepresentationOfCarrier_0.enable_grid(True) self.TimeRepresentationOfCarrier_0.enable_control_panel(True) if not True: self.TimeRepresentationOfCarrier_0.disable_legend() labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2*1): if len(labels[i]) == 0: if(i % 2 == 0): self.TimeRepresentationOfCarrier_0.set_line_label(i, "Re{{Data {0}}}".format(i/2)) else: self.TimeRepresentationOfCarrier_0.set_line_label(i, "Im{{Data {0}}}".format(i/2)) else: self.TimeRepresentationOfCarrier_0.set_line_label(i, labels[i]) self.TimeRepresentationOfCarrier_0.set_line_width(i, widths[i]) self.TimeRepresentationOfCarrier_0.set_line_color(i, colors[i]) self.TimeRepresentationOfCarrier_0.set_line_style(i, styles[i]) self.TimeRepresentationOfCarrier_0.set_line_marker(i, markers[i]) self.TimeRepresentationOfCarrier_0.set_line_alpha(i, alphas[i]) self._TimeRepresentationOfCarrier_0_win = sip.wrapinstance(self.TimeRepresentationOfCarrier_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._TimeRepresentationOfCarrier_0_win) self.TimeRepresentationOfCarrier = qtgui.time_sink_c( 1024, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.TimeRepresentationOfCarrier.set_update_time(0.10) self.TimeRepresentationOfCarrier.set_y_axis(-1, 1) self.TimeRepresentationOfCarrier.set_y_label("Amplitude", "") self.TimeRepresentationOfCarrier.enable_tags(-1, True) self.TimeRepresentationOfCarrier.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.TimeRepresentationOfCarrier.enable_autoscale(True) self.TimeRepresentationOfCarrier.enable_grid(True) self.TimeRepresentationOfCarrier.enable_control_panel(True) if not True: self.TimeRepresentationOfCarrier.disable_legend() labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2*1): if len(labels[i]) == 0: if(i % 2 == 0): self.TimeRepresentationOfCarrier.set_line_label(i, "Re{{Data {0}}}".format(i/2)) else: self.TimeRepresentationOfCarrier.set_line_label(i, "Im{{Data {0}}}".format(i/2)) else: self.TimeRepresentationOfCarrier.set_line_label(i, labels[i]) self.TimeRepresentationOfCarrier.set_line_width(i, widths[i]) self.TimeRepresentationOfCarrier.set_line_color(i, colors[i]) self.TimeRepresentationOfCarrier.set_line_style(i, styles[i]) self.TimeRepresentationOfCarrier.set_line_marker(i, markers[i]) self.TimeRepresentationOfCarrier.set_line_alpha(i, alphas[i]) self._TimeRepresentationOfCarrier_win = sip.wrapinstance(self.TimeRepresentationOfCarrier.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._TimeRepresentationOfCarrier_win) self.TimeDomainForDemodSignal = qtgui.time_sink_f( 1024, #size samp_rate, #samp_rate "", #name 1 #number of inputs ) self.TimeDomainForDemodSignal.set_update_time(0.10) self.TimeDomainForDemodSignal.set_y_axis(-1, 1) self.TimeDomainForDemodSignal.set_y_label("Amplitude", "") self.TimeDomainForDemodSignal.enable_tags(-1, True) self.TimeDomainForDemodSignal.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.TimeDomainForDemodSignal.enable_autoscale(True) self.TimeDomainForDemodSignal.enable_grid(True) self.TimeDomainForDemodSignal.enable_control_panel(True) if not True: self.TimeDomainForDemodSignal.disable_legend() labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.TimeDomainForDemodSignal.set_line_label(i, "Data {0}".format(i)) else: self.TimeDomainForDemodSignal.set_line_label(i, labels[i]) self.TimeDomainForDemodSignal.set_line_width(i, widths[i]) self.TimeDomainForDemodSignal.set_line_color(i, colors[i]) self.TimeDomainForDemodSignal.set_line_style(i, styles[i]) self.TimeDomainForDemodSignal.set_line_marker(i, markers[i]) self.TimeDomainForDemodSignal.set_line_alpha(i, alphas[i]) self._TimeDomainForDemodSignal_win = sip.wrapinstance(self.TimeDomainForDemodSignal.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._TimeDomainForDemodSignal_win) self.LPDemodulatedSignal_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc 1e9, #bw "", #name 1 #number of inputs ) self.LPDemodulatedSignal_0.set_update_time(0.10) self.LPDemodulatedSignal_0.set_y_axis(-140, 10) self.LPDemodulatedSignal_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.LPDemodulatedSignal_0.enable_autoscale(True) self.LPDemodulatedSignal_0.enable_grid(True) self.LPDemodulatedSignal_0.set_fft_average(1.0) self.LPDemodulatedSignal_0.enable_control_panel(True) if not True: self.LPDemodulatedSignal_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.LPDemodulatedSignal_0.set_plot_pos_half(not True) labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.LPDemodulatedSignal_0.set_line_label(i, "Data {0}".format(i)) else: self.LPDemodulatedSignal_0.set_line_label(i, labels[i]) self.LPDemodulatedSignal_0.set_line_width(i, widths[i]) self.LPDemodulatedSignal_0.set_line_color(i, colors[i]) self.LPDemodulatedSignal_0.set_line_alpha(i, alphas[i]) self._LPDemodulatedSignal_0_win = sip.wrapinstance(self.LPDemodulatedSignal_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._LPDemodulatedSignal_0_win) self.LPDemodulatedSignal = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.LPDemodulatedSignal.set_update_time(0.10) self.LPDemodulatedSignal.set_y_axis(-140, 10) self.LPDemodulatedSignal.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.LPDemodulatedSignal.enable_autoscale(True) self.LPDemodulatedSignal.enable_grid(True) self.LPDemodulatedSignal.set_fft_average(1.0) self.LPDemodulatedSignal.enable_control_panel(True) if not True: self.LPDemodulatedSignal.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.LPDemodulatedSignal.set_plot_pos_half(not True) labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.LPDemodulatedSignal.set_line_label(i, "Data {0}".format(i)) else: self.LPDemodulatedSignal.set_line_label(i, labels[i]) self.LPDemodulatedSignal.set_line_width(i, widths[i]) self.LPDemodulatedSignal.set_line_color(i, colors[i]) self.LPDemodulatedSignal.set_line_alpha(i, alphas[i]) self._LPDemodulatedSignal_win = sip.wrapinstance(self.LPDemodulatedSignal.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._LPDemodulatedSignal_win) self.FrequencyDomainOfDemodulatedSignal = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc 1000e6, #bw "", #name 1 #number of inputs ) self.FrequencyDomainOfDemodulatedSignal.set_update_time(0.10) self.FrequencyDomainOfDemodulatedSignal.set_y_axis(-140, 10) self.FrequencyDomainOfDemodulatedSignal.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.FrequencyDomainOfDemodulatedSignal.enable_autoscale(True) self.FrequencyDomainOfDemodulatedSignal.enable_grid(True) self.FrequencyDomainOfDemodulatedSignal.set_fft_average(1.0) self.FrequencyDomainOfDemodulatedSignal.enable_control_panel(True) if not True: self.FrequencyDomainOfDemodulatedSignal.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.FrequencyDomainOfDemodulatedSignal.set_plot_pos_half(not True) labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.FrequencyDomainOfDemodulatedSignal.set_line_label(i, "Data {0}".format(i)) else: self.FrequencyDomainOfDemodulatedSignal.set_line_label(i, labels[i]) self.FrequencyDomainOfDemodulatedSignal.set_line_width(i, widths[i]) self.FrequencyDomainOfDemodulatedSignal.set_line_color(i, colors[i]) self.FrequencyDomainOfDemodulatedSignal.set_line_alpha(i, alphas[i]) self._FrequencyDomainOfDemodulatedSignal_win = sip.wrapinstance(self.FrequencyDomainOfDemodulatedSignal.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._FrequencyDomainOfDemodulatedSignal_win) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0_0, 0), (self.TimeRepresentationOfCarrier, 0)) self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0_0, 1)) self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_multiply_xx_0_0, 0), (self.FrequencyDomainOfDemodulatedSignal, 0)) self.connect((self.blocks_multiply_xx_0_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.LPDemodulatedSignal, 0)) self.connect((self.low_pass_filter_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.TimeDomainForDemodSignal, 0)) self.connect((self.rtlsdr_source_0, 0), (self.LPDemodulatedSignal_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.TimeRepresentationOfCarrier_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.blocks_multiply_xx_0_0, 0))
def set_cutoff(self, cutoff): self.cutoff = cutoff self._cutoff_slider.set_value(self.cutoff) self._cutoff_text_box.set_value(self.cutoff) self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate, self.cutoff, self.transition, firdes.WIN_HAMMING, 6.76))
def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.qtgui_sink_x_0.set_frequency_range(self.center_freq, self.samp_rate) self.osmosdr_source_0.set_sample_rate(self.samp_rate) self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate, 75e3, 25e3, firdes.WIN_HAMMING, 6.76)) self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate)
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Multi Tx") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.audio_rate = audio_rate = 48000 self.wpm = wpm = 15 self.wbfm_on = wbfm_on = True self.usb_on = usb_on = True self.samp_rate = samp_rate = audio_rate * 40 self.q_offset = q_offset = 0 self.psk_on = psk_on = True self.phase = phase = 0 self.nbfm_on = nbfm_on = True self.magnitude = magnitude = 0 self.lsb_on = lsb_on = True self.i_offset = i_offset = 0 self.gain = gain = 25 self.cw_on = cw_on = True self.center_freq = center_freq = 441000000 self.am_on = am_on = True ################################################## # Blocks ################################################## self._wbfm_on_check_box = forms.check_box( parent=self.GetWin(), value=self.wbfm_on, callback=self.set_wbfm_on, label='WBFM', true=True, false=False, ) self.GridAdd(self._wbfm_on_check_box, 4, 1, 1, 1) self._usb_on_check_box = forms.check_box( parent=self.GetWin(), value=self.usb_on, callback=self.set_usb_on, label='USB', true=True, false=False, ) self.GridAdd(self._usb_on_check_box, 4, 4, 1, 1) _q_offset_sizer = wx.BoxSizer(wx.VERTICAL) self._q_offset_text_box = forms.text_box( parent=self.GetWin(), sizer=_q_offset_sizer, value=self.q_offset, callback=self.set_q_offset, label='DC offset Q', converter=forms.float_converter(), proportion=0, ) self._q_offset_slider = forms.slider( parent=self.GetWin(), sizer=_q_offset_sizer, value=self.q_offset, callback=self.set_q_offset, minimum=-0.1, maximum=0.1, num_steps=200, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_q_offset_sizer, 3, 0, 1, 7) self._psk_on_check_box = forms.check_box( parent=self.GetWin(), value=self.psk_on, callback=self.set_psk_on, label='PSK31', true=True, false=False, ) self.GridAdd(self._psk_on_check_box, 4, 6, 1, 1) _phase_sizer = wx.BoxSizer(wx.VERTICAL) self._phase_text_box = forms.text_box( parent=self.GetWin(), sizer=_phase_sizer, value=self.phase, callback=self.set_phase, label='Phase correction', converter=forms.float_converter(), proportion=0, ) self._phase_slider = forms.slider( parent=self.GetWin(), sizer=_phase_sizer, value=self.phase, callback=self.set_phase, minimum=-0.1, maximum=0.1, num_steps=200, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_phase_sizer, 0, 0, 1, 7) self._nbfm_on_check_box = forms.check_box( parent=self.GetWin(), value=self.nbfm_on, callback=self.set_nbfm_on, label='NBFM', true=True, false=False, ) self.GridAdd(self._nbfm_on_check_box, 4, 0, 1, 1) _magnitude_sizer = wx.BoxSizer(wx.VERTICAL) self._magnitude_text_box = forms.text_box( parent=self.GetWin(), sizer=_magnitude_sizer, value=self.magnitude, callback=self.set_magnitude, label='Magnitude correction', converter=forms.float_converter(), proportion=0, ) self._magnitude_slider = forms.slider( parent=self.GetWin(), sizer=_magnitude_sizer, value=self.magnitude, callback=self.set_magnitude, minimum=-0.1, maximum=0.1, num_steps=200, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_magnitude_sizer, 1, 0, 1, 7) self._lsb_on_check_box = forms.check_box( parent=self.GetWin(), value=self.lsb_on, callback=self.set_lsb_on, label='LSB', true=True, false=False, ) self.GridAdd(self._lsb_on_check_box, 4, 3, 1, 1) _i_offset_sizer = wx.BoxSizer(wx.VERTICAL) self._i_offset_text_box = forms.text_box( parent=self.GetWin(), sizer=_i_offset_sizer, value=self.i_offset, callback=self.set_i_offset, label='DC offset I', converter=forms.float_converter(), proportion=0, ) self._i_offset_slider = forms.slider( parent=self.GetWin(), sizer=_i_offset_sizer, value=self.i_offset, callback=self.set_i_offset, minimum=-0.1, maximum=0.1, num_steps=200, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_i_offset_sizer, 2, 0, 1, 7) self._cw_on_check_box = forms.check_box( parent=self.GetWin(), value=self.cw_on, callback=self.set_cw_on, label='CW', true=True, false=False, ) self.GridAdd(self._cw_on_check_box, 4, 5, 1, 1) self._am_on_check_box = forms.check_box( parent=self.GetWin(), value=self.am_on, callback=self.set_am_on, label='AM', true=True, false=False, ) self.GridAdd(self._am_on_check_box, 4, 2, 1, 1) self.root_raised_cosine_filter_1 = filter.fir_filter_ccf( 1, firdes.root_raised_cosine(1, audio_rate, 5, 0.35, 200)) self.root_raised_cosine_filter_0 = filter.fir_filter_ccf( 1, firdes.root_raised_cosine(1, audio_rate, 5, 0.35, 200)) self.rational_resampler_xxx_3 = filter.rational_resampler_ccc( interpolation=192, decimation=1, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_2 = filter.rational_resampler_ccc( interpolation=samp_rate, decimation=audio_rate, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=samp_rate / audio_rate / 2, decimation=1, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=samp_rate / audio_rate / 4, decimation=1, taps=None, fractional_bw=None, ) self.osmosdr_sink_0 = osmosdr.sink(args="numchan=" + str(1) + " " + '') self.osmosdr_sink_0.set_sample_rate(samp_rate) self.osmosdr_sink_0.set_center_freq(center_freq, 0) self.osmosdr_sink_0.set_freq_corr(0, 0) self.osmosdr_sink_0.set_gain(gain, 0) self.osmosdr_sink_0.set_if_gain(20, 0) self.osmosdr_sink_0.set_bb_gain(20, 0) self.osmosdr_sink_0.set_antenna('', 0) self.osmosdr_sink_0.set_bandwidth(0, 0) self.low_pass_filter_1 = filter.interp_fir_filter_ccf( 1, firdes.low_pass(0.5, audio_rate, 5000, 400, firdes.WIN_HAMMING, 6.76)) self.iqbalance_fix_cc_0 = iqbalance.fix_cc(magnitude, phase) self.digital_psk_mod_0 = digital.psk.psk_mod( constellation_points=2, mod_code="none", differential=True, samples_per_symbol=8, excess_bw=0.35, verbose=False, log=False, ) self.digital_map_bb_0 = digital.map_bb(([1, 0])) self.blocks_wavfile_source_0 = blocks.wavfile_source( '/home/nocomp/Musique/wave/maybe-next-time.wav', True) self.blocks_vector_source_x_2 = blocks.vector_source_b( (0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1), True, 1, []) self.blocks_vector_source_x_0 = blocks.vector_source_c( (1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0), True, 1, []) self.blocks_unpacked_to_packed_xx_0 = blocks.unpacked_to_packed_bb( 1, gr.GR_MSB_FIRST) self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex * 1, int(1.2 * audio_rate / wpm)) self.blocks_multiply_xx_6 = blocks.multiply_vcc(1) self.blocks_multiply_xx_5 = blocks.multiply_vcc(1) self.blocks_multiply_xx_4 = blocks.multiply_vcc(1) self.blocks_multiply_xx_3_0 = blocks.multiply_vcc(1) self.blocks_multiply_xx_3 = blocks.multiply_vcc(1) self.blocks_multiply_xx_2 = blocks.multiply_vcc(1) self.blocks_multiply_xx_1 = blocks.multiply_vcc(1) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_float_to_complex_0 = blocks.float_to_complex(1) self.blocks_add_xx_1 = blocks.add_vcc(1) self.blocks_add_xx_0 = blocks.add_vcc(1) self.blocks_add_const_vxx_1 = blocks.add_const_vcc( (i_offset + 1j * q_offset, )) self.blocks_add_const_vxx_0 = blocks.add_const_vcc((0.5, )) self.band_pass_filter_0_0 = filter.interp_fir_filter_ccc( 1, firdes.complex_band_pass(1, audio_rate, -2800, -200, 200, firdes.WIN_HAMMING, 6.76)) self.band_pass_filter_0 = filter.interp_fir_filter_ccc( 1, firdes.complex_band_pass(1, audio_rate, 200, 2800, 200, firdes.WIN_HAMMING, 6.76)) self.analog_wfm_tx_0 = analog.wfm_tx( audio_rate=audio_rate, quad_rate=audio_rate * 4, tau=75e-6, max_dev=75e3, fh=-1.0, ) self.analog_sig_source_x_6 = analog.sig_source_c( audio_rate, analog.GR_COS_WAVE, 22000, 1 if psk_on else 0, 0) self.analog_sig_source_x_5 = analog.sig_source_c( audio_rate, analog.GR_COS_WAVE, 20000, 1 if cw_on else 0, 0) self.analog_sig_source_x_4 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, 120000, 1.0 / 7, 0) self.analog_sig_source_x_3_0 = analog.sig_source_c( audio_rate, analog.GR_COS_WAVE, 11000, 1.8 if lsb_on else 0, 0) self.analog_sig_source_x_3 = analog.sig_source_c( audio_rate, analog.GR_COS_WAVE, 14000, 1.8 if usb_on else 0, 0) self.analog_sig_source_x_2 = analog.sig_source_c( audio_rate, analog.GR_COS_WAVE, 0, 1 if am_on else 0, 0) self.analog_sig_source_x_1 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, 0, 1.0 / 7 if wbfm_on else 0, 0) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, -100000, 1.0 / 7 if nbfm_on else 0, 0) self.analog_nbfm_tx_0 = analog.nbfm_tx( audio_rate=audio_rate, quad_rate=audio_rate * 2, tau=75e-6, max_dev=5e3, fh=-1.0, ) self.analog_const_source_x_0 = analog.sig_source_f( 0, analog.GR_CONST_WAVE, 0, 0, 0) ################################################## # Connections ################################################## self.connect((self.analog_const_source_x_0, 0), (self.blocks_float_to_complex_0, 1)) self.connect((self.analog_nbfm_tx_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_1, 1)) self.connect((self.analog_sig_source_x_2, 0), (self.blocks_multiply_xx_2, 1)) self.connect((self.analog_sig_source_x_3, 0), (self.blocks_multiply_xx_3, 1)) self.connect((self.analog_sig_source_x_3_0, 0), (self.blocks_multiply_xx_3_0, 1)) self.connect((self.analog_sig_source_x_4, 0), (self.blocks_multiply_xx_4, 1)) self.connect((self.analog_sig_source_x_5, 0), (self.blocks_multiply_xx_5, 1)) self.connect((self.analog_sig_source_x_6, 0), (self.blocks_multiply_xx_6, 1)) self.connect((self.analog_wfm_tx_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.band_pass_filter_0, 0), (self.blocks_multiply_xx_3, 0)) self.connect((self.band_pass_filter_0_0, 0), (self.blocks_multiply_xx_3_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_multiply_xx_2, 0)) self.connect((self.blocks_add_const_vxx_1, 0), (self.osmosdr_sink_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.iqbalance_fix_cc_0, 0)) self.connect((self.blocks_add_xx_1, 0), (self.rational_resampler_xxx_2, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.band_pass_filter_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.band_pass_filter_0_0, 0)) self.connect((self.blocks_float_to_complex_0, 0), (self.low_pass_filter_1, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_multiply_xx_2, 0), (self.blocks_add_xx_1, 0)) self.connect((self.blocks_multiply_xx_3, 0), (self.blocks_add_xx_1, 2)) self.connect((self.blocks_multiply_xx_3_0, 0), (self.blocks_add_xx_1, 1)) self.connect((self.blocks_multiply_xx_4, 0), (self.blocks_add_xx_0, 2)) self.connect((self.blocks_multiply_xx_5, 0), (self.blocks_add_xx_1, 3)) self.connect((self.blocks_multiply_xx_6, 0), (self.blocks_add_xx_1, 4)) self.connect((self.blocks_repeat_0, 0), (self.root_raised_cosine_filter_1, 0)) self.connect((self.blocks_unpacked_to_packed_xx_0, 0), (self.digital_psk_mod_0, 0)) self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_repeat_0, 0)) self.connect((self.blocks_vector_source_x_2, 0), (self.digital_map_bb_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.analog_nbfm_tx_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.analog_wfm_tx_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_float_to_complex_0, 0)) self.connect((self.digital_map_bb_0, 0), (self.blocks_unpacked_to_packed_xx_0, 0)) self.connect((self.digital_psk_mod_0, 0), (self.rational_resampler_xxx_3, 0)) self.connect((self.iqbalance_fix_cc_0, 0), (self.blocks_add_const_vxx_1, 0)) self.connect((self.low_pass_filter_1, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_xx_1, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.rational_resampler_xxx_2, 0), (self.blocks_multiply_xx_4, 0)) self.connect((self.rational_resampler_xxx_3, 0), (self.blocks_multiply_xx_6, 0)) self.connect((self.root_raised_cosine_filter_0, 0), (self.blocks_multiply_xx_5, 0)) self.connect((self.root_raised_cosine_filter_1, 0), (self.root_raised_cosine_filter_0, 0))
def __init__(self): gr.top_block.__init__(self, "Top Block") Qt.QWidget.__init__(self) self.setWindowTitle("Top Block") try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "top_block") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.data_rate_V2 = data_rate_V2 = 510 * 2 self.version_chooser = version_chooser = data_rate_V2 self.freq_range = freq_range = 433.995 self.audio_rate = audio_rate = 48000 self.trans = trans = 1.2e3 self.samp_rate = samp_rate = 2400000 self.samp_per_sym = samp_per_sym = audio_rate / version_chooser self.gain = gain = 390 self.freq_offset = freq_offset = 100e3 self.freq = freq = (0 * 433.886e6 + 0 * 433.877e6 + 0 * 433.995e6) + freq_range * 1e6 + 100e3 self.data_rate_V1 = data_rate_V1 = 680 self.data_rate = data_rate = version_chooser self.channel_trans = channel_trans = 2000 self.channel_spacing = channel_spacing = 25e3 ################################################## # Blocks ################################################## self.tab = Qt.QTabWidget() self.tab_widget_0 = Qt.QWidget() self.tab_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_0) self.tab_grid_layout_0 = Qt.QGridLayout() self.tab_layout_0.addLayout(self.tab_grid_layout_0) self.tab.addTab(self.tab_widget_0, "Frequency") self.tab_widget_1 = Qt.QWidget() self.tab_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_1) self.tab_grid_layout_1 = Qt.QGridLayout() self.tab_layout_1.addLayout(self.tab_grid_layout_1) self.tab.addTab(self.tab_widget_1, "Signal") self.tab_widget_2 = Qt.QWidget() self.tab_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_2) self.tab_grid_layout_2 = Qt.QGridLayout() self.tab_layout_2.addLayout(self.tab_grid_layout_2) self.tab.addTab(self.tab_widget_2, "Datarate") self.top_layout.addWidget(self.tab) self._gain_layout = Qt.QVBoxLayout() self._gain_tool_bar = Qt.QToolBar(self) self._gain_layout.addWidget(self._gain_tool_bar) self._gain_tool_bar.addWidget(Qt.QLabel("Decoder_Gain" + ": ")) class qwt_counter_pyslot(Qwt.QwtCounter): def __init__(self, parent=None): Qwt.QwtCounter.__init__(self, parent) @pyqtSlot('double') def setValue(self, value): super(Qwt.QwtCounter, self).setValue(value) self._gain_counter = qwt_counter_pyslot() self._gain_counter.setRange(0, 1000, 1) self._gain_counter.setNumButtons(2) self._gain_counter.setValue(self.gain) self._gain_tool_bar.addWidget(self._gain_counter) self._gain_counter.valueChanged.connect(self.set_gain) self._gain_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot) self._gain_slider.setRange(0, 1000, 1) self._gain_slider.setValue(self.gain) self._gain_slider.setMinimumWidth(1000) self._gain_slider.valueChanged.connect(self.set_gain) self._gain_layout.addWidget(self._gain_slider) self.tab_layout_1.addLayout(self._gain_layout) self._version_chooser_options = [data_rate_V1, data_rate_V2] self._version_chooser_labels = ["V1", "V2"] self._version_chooser_tool_bar = Qt.QToolBar(self) self._version_chooser_tool_bar.addWidget( Qt.QLabel("Oregon Scientific Version" + ": ")) self._version_chooser_combo_box = Qt.QComboBox() self._version_chooser_tool_bar.addWidget( self._version_chooser_combo_box) for label in self._version_chooser_labels: self._version_chooser_combo_box.addItem(label) self._version_chooser_callback = lambda i: Qt.QMetaObject.invokeMethod( self._version_chooser_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._version_chooser_options.index(i))) self._version_chooser_callback(self.version_chooser) self._version_chooser_combo_box.currentIndexChanged.connect( lambda i: self.set_version_chooser(self._version_chooser_options[i] )) self.tab_grid_layout_2.addWidget(self._version_chooser_tool_bar, 0, 0) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype freq, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.10) self.qtgui_waterfall_sink_x_0.enable_grid(False) labels = ["", "", "", "", "", "", "", "", "", ""] colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.tab_grid_layout_0.addWidget(self._qtgui_waterfall_sink_x_0_win, 2, 0) self.qtgui_sink_x_0 = qtgui.sink_c( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype freq - freq_offset, #fc samp_rate / 50, #bw "", #name True, #plotfreq True, #plotwaterfall True, #plottime True, #plotconst ) self.qtgui_sink_x_0.set_update_time(1.0 / 10) self._qtgui_sink_x_0_win = sip.wrapinstance( self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget) self.tab_layout_1.addWidget(self._qtgui_sink_x_0_win) self.qtgui_sink_x_0.enable_rf_freq(True) self.qtgui_number_sink_0 = qtgui.number_sink(gr.sizeof_float, 0, qtgui.NUM_GRAPH_HORIZ, 1) self.qtgui_number_sink_0.set_update_time(0.10) self.qtgui_number_sink_0.set_title("") labels = ["", "", "", "", "", "", "", "", "", ""] units = ["", "", "", "", "", "", "", "", "", ""] colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in xrange(1): self.qtgui_number_sink_0.set_min(i, -1) self.qtgui_number_sink_0.set_max(i, 1) self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_0.set_label(i, labels[i]) self.qtgui_number_sink_0.set_unit(i, units[i]) self.qtgui_number_sink_0.set_factor(i, factor[i]) self.qtgui_number_sink_0.enable_autoscale(False) self._qtgui_number_sink_0_win = sip.wrapinstance( self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget) self.tab_grid_layout_1.addWidget(self._qtgui_number_sink_0_win, 0, 0) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype freq, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(True) self.qtgui_freq_sink_x_0.set_fft_average(1.0) labels = ["", "", "", "", "", "", "", "", "", ""] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue" ] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance( self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.tab_grid_layout_0.addWidget(self._qtgui_freq_sink_x_0_win, 0, 0) self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + "") self.osmosdr_source_0.set_sample_rate(samp_rate) self.osmosdr_source_0.set_center_freq(freq, 0) self.osmosdr_source_0.set_freq_corr(0, 0) self.osmosdr_source_0.set_dc_offset_mode(0, 0) self.osmosdr_source_0.set_iq_balance_mode(0, 0) self.osmosdr_source_0.set_gain_mode(True, 0) self.osmosdr_source_0.set_gain(10, 0) self.osmosdr_source_0.set_if_gain(20, 0) self.osmosdr_source_0.set_bb_gain(20, 0) self.osmosdr_source_0.set_antenna("TX/RX", 0) self.osmosdr_source_0.set_bandwidth(0, 0) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc( 50, (firdes.low_pass(1, samp_rate, channel_spacing, channel_trans, firdes.WIN_BLACKMAN, 6.76)), -freq_offset, samp_rate) self._freq_range_layout = Qt.QVBoxLayout() self._freq_range_tool_bar = Qt.QToolBar(self) self._freq_range_layout.addWidget(self._freq_range_tool_bar) self._freq_range_tool_bar.addWidget(Qt.QLabel("Frequency" + ": ")) class qwt_counter_pyslot(Qwt.QwtCounter): def __init__(self, parent=None): Qwt.QwtCounter.__init__(self, parent) @pyqtSlot('double') def setValue(self, value): super(Qwt.QwtCounter, self).setValue(value) self._freq_range_counter = qwt_counter_pyslot() self._freq_range_counter.setRange(433, 434, 0.005) self._freq_range_counter.setNumButtons(2) self._freq_range_counter.setValue(self.freq_range) self._freq_range_tool_bar.addWidget(self._freq_range_counter) self._freq_range_counter.valueChanged.connect(self.set_freq_range) self._freq_range_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot) self._freq_range_slider.setRange(433, 434, 0.005) self._freq_range_slider.setValue(self.freq_range) self._freq_range_slider.setMinimumWidth(1) self._freq_range_slider.valueChanged.connect(self.set_freq_range) self._freq_range_layout.addWidget(self._freq_range_slider) self.tab_grid_layout_0.addLayout(self._freq_range_layout, 1, 0) self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff( samp_per_sym * (1 + 0.0), 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005) self.digital_binary_slicer_fb_1 = digital.binary_slicer_fb() self._data_rate_tool_bar = Qt.QToolBar(self) self._data_rate_tool_bar.addWidget(Qt.QLabel("Datarate" + ": ")) self._data_rate_line_edit = Qt.QLineEdit(str(self.data_rate)) self._data_rate_tool_bar.addWidget(self._data_rate_line_edit) self._data_rate_line_edit.returnPressed.connect( lambda: self.set_data_rate( int(self._data_rate_line_edit.text().toAscii()))) self.tab_grid_layout_2.addWidget(self._data_rate_tool_bar, 1, 0) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1, "/tmp/fifo", False) self.blocks_file_sink_0.set_unbuffered(False) self.blocks_add_const_vxx_0 = blocks.add_const_vff((gain * 1e-3, )) self.band_pass_filter_0 = filter.fir_filter_ccc( 1, firdes.complex_band_pass(1, samp_rate / 50, -2500, 2500, trans, firdes.WIN_HAMMING, 6.76)) self.analog_am_demod_cf_0 = analog.am_demod_cf( channel_rate=samp_rate / 50, audio_decim=1, audio_pass=0 * 500 + 1 * 2500, audio_stop=5000, ) self.analog_agc2_xx_0 = analog.agc2_cc(1e-1, 1e-2, 1, 0) self.analog_agc2_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.connect((self.digital_binary_slicer_fb_1, 0), (self.blocks_file_sink_0, 0)) self.connect((self.band_pass_filter_0, 0), (self.analog_am_demod_cf_0, 0)) self.connect((self.analog_am_demod_cf_0, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_1, 0)) self.connect((self.osmosdr_source_0, 0), (self.analog_agc2_xx_0, 0)) self.connect((self.analog_agc2_xx_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.band_pass_filter_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.qtgui_number_sink_0, 0)) self.connect((self.band_pass_filter_0, 0), (self.qtgui_sink_x_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.qtgui_waterfall_sink_x_0, 0))
def __init__(self): gr.top_block.__init__(self, "Rtl Airband") Qt.QWidget.__init__(self) self.setWindowTitle("Rtl Airband") try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "rtl_airband") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2.048e6 self.freq_corr = freq_corr = 0 self.freq = freq = 131.55e6 ################################################## # Blocks ################################################## self._freq_corr_range = Range(-10e3, 10e3, 1, 0, 200) self._freq_corr_win = RangeWidget(self._freq_corr_range, self.set_freq_corr, "freq_corr", "counter_slider", float) self.top_layout.addWidget(self._freq_corr_win) self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=24000, decimation=192000, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=192000, decimation=int(samp_rate), taps=None, fractional_bw=None, ) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 8192, #size firdes.WIN_BLACKMAN_hARRIS, #wintype freq+freq_corr, #fc 192e3, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.10) self.qtgui_waterfall_sink_x_0.enable_grid(False) self.qtgui_waterfall_sink_x_0.enable_axis_labels(True) if not False: self.qtgui_waterfall_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [6, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0.set_intensity_range(-100, -40) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_waterfall_sink_x_0_win) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 4096, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc 192e3, #bw "", #name 1 #number of inputs ) self.qtgui_freq_sink_x_0.set_update_time(0.10) self.qtgui_freq_sink_x_0.set_y_axis(-120, -20) self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_0.enable_autoscale(False) self.qtgui_freq_sink_x_0.enable_grid(True) self.qtgui_freq_sink_x_0.set_fft_average(0.2) self.qtgui_freq_sink_x_0.enable_axis_labels(True) self.qtgui_freq_sink_x_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win) self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + '' ) self.osmosdr_source_0.set_sample_rate(samp_rate) self.osmosdr_source_0.set_center_freq(freq+freq_corr, 0) self.osmosdr_source_0.set_freq_corr(70, 0) self.osmosdr_source_0.set_dc_offset_mode(0, 0) self.osmosdr_source_0.set_iq_balance_mode(0, 0) self.osmosdr_source_0.set_gain_mode(False, 0) self.osmosdr_source_0.set_gain(45, 0) self.osmosdr_source_0.set_if_gain(20, 0) self.osmosdr_source_0.set_bb_gain(20, 0) self.osmosdr_source_0.set_antenna('', 0) self.osmosdr_source_0.set_bandwidth(0, 0) self.fft_filter_xxx_0 = filter.fft_filter_fff(1, (firdes.low_pass(7,24e3,3e3,1e2,firdes.WIN_BLACKMAN)), 1) self.fft_filter_xxx_0.declare_sample_delay(0) self.dc_blocker_xx_0 = filter.dc_blocker_ff(32, True) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self.audio_sink_0 = audio.sink(24000, '', True) self.analog_agc_xx_0 = analog.agc_ff(4e-1, 0.01, 1.0) self.analog_agc_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.connect((self.analog_agc_xx_0, 0), (self.fft_filter_xxx_0, 0)) self.connect((self.blocks_complex_to_mag_0, 0), (self.dc_blocker_xx_0, 0)) self.connect((self.dc_blocker_xx_0, 0), (self.analog_agc_xx_0, 0)) self.connect((self.fft_filter_xxx_0, 0), (self.audio_sink_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.blocks_complex_to_mag_0, 0))
def __init__(self, fm_subcarrier=9960, zero_point=-5): grc_wxgui.top_block_gui.__init__(self, title="VOR Receiver") ################################################## # Parameters ################################################## self.fm_subcarrier = fm_subcarrier self.zero_point = zero_point ################################################## # Variables ################################################## self.rf_rate = rf_rate = 1000000 self.dir_rate = dir_rate = 10 self.channel_rate = channel_rate = 40000 self.audio_rate = audio_rate = 10000 self.vor_freq = vor_freq = 113.9e6 self.volume = volume = 0 self.rf_scale = rf_scale = int( rf_rate / channel_rate) + rf_rate % channel_rate self.offset = offset = fm_subcarrier + 4000 self.dir_scale = dir_scale = int( audio_rate / dir_rate) + audio_rate % dir_rate self.channel = channel = 113.9e6 self.audio_scale = audio_scale = int( channel_rate / audio_rate) + channel_rate % audio_rate ################################################## # Blocks ################################################## _volume_sizer = wx.BoxSizer(wx.VERTICAL) self._volume_text_box = forms.text_box( parent=self.GetWin(), sizer=_volume_sizer, value=self.volume, callback=self.set_volume, label='volume', converter=forms.float_converter(), proportion=0, ) self._volume_slider = forms.slider( parent=self.GetWin(), sizer=_volume_sizer, value=self.volume, callback=self.set_volume, minimum=-10, maximum=10, num_steps=1000, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_volume_sizer) self._channel_text_box = forms.text_box( parent=self.GetWin(), value=self.channel, callback=self.set_channel, label="Channel (Hz)", converter=forms.float_converter(), ) self.Add(self._channel_text_box) self.zeroer = blocks.add_const_vff((zero_point * (math.pi / 180), )) self.wxgui_numbersink2_0 = numbersink2.number_sink_f( self.GetWin(), unit="deg", minval=-180, maxval=180, factor=180 / math.acos(-1), decimal_places=2, ref_level=0, sample_rate=dir_rate, number_rate=dir_rate, average=True, avg_alpha=.25, label="Direction", peak_hold=False, show_gauge=True, ) self.Add(self.wxgui_numbersink2_0.win) self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( self.GetWin(), baseband_freq=channel, y_per_div=10, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=channel_rate, fft_size=1024, fft_rate=15, average=True, avg_alpha=0.25, title="Channel", peak_hold=False, ) self.Add(self.wxgui_fftsink2_0.win) self._vor_freq_text_box = forms.text_box( parent=self.GetWin(), value=self.vor_freq, callback=self.set_vor_freq, label='vor_freq', converter=forms.float_converter(), ) self.Add(self._vor_freq_text_box) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=40, decimation=1, taps=None, fractional_bw=None, ) self.low_pass_filter_1 = filter.fir_filter_ccf( 1, firdes.low_pass(1, dir_rate, 1, 2, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0 = filter.fir_filter_ccf( 1, firdes.low_pass(1, channel_rate, 10000, 4000, firdes.WIN_HAMMING, 6.76)) self.goertzel_fc_0_0 = fft.goertzel_fc(channel_rate, dir_scale * audio_scale, 30) self.goertzel_fc_0 = fft.goertzel_fc(audio_rate, dir_scale, 30) self.freq_xlating_fir_filter_xxx_0_0 = filter.freq_xlating_fir_filter_ccc( 1, (firdes.low_pass(1.0, channel_rate, 500, 100, firdes.WIN_HAMMING)), fm_subcarrier, channel_rate) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc( rf_scale, (firdes.low_pass(1.0, rf_rate, channel_rate, channel_rate / 2, firdes.WIN_HAMMING)), 900, rf_rate) self.dc_blocker_xx_0 = filter.dc_blocker_ff(128, True) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, 1e6) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff( (10**(volume / 10), )) self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1) self.blocks_file_source_0 = blocks.file_source( gr.sizeof_gr_complex * 1, "/home/john/apps/aviation_rx/woodside_vor25.dat", True) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1, int(channel_rate / 30 * 0.0)) self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1) self.audio_sink_0 = audio.sink(audio_rate, "", True) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1) self.analog_am_demod_cf_0 = analog.am_demod_cf( channel_rate=40e3, audio_decim=4, audio_pass=5000, audio_stop=5500, ) self.analog_agc2_xx_1 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0) self.analog_agc2_xx_1.set_max_gain(65536) self.analog_agc2_xx_0_1_0 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0) self.analog_agc2_xx_0_1_0.set_max_gain(100) self.analog_agc2_xx_0_1 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0) self.analog_agc2_xx_0_1.set_max_gain(100) ################################################## # Connections ################################################## self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.wxgui_fftsink2_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0_0, 0), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_delay_0, 0)) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.goertzel_fc_0_0, 0)) self.connect((self.goertzel_fc_0, 0), (self.analog_agc2_xx_0_1, 0)) self.connect((self.goertzel_fc_0_0, 0), (self.analog_agc2_xx_0_1_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0)) self.connect((self.dc_blocker_xx_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_delay_0, 0), (self.freq_xlating_fir_filter_xxx_0_0, 0)) self.connect((self.blocks_complex_to_arg_0, 0), (self.zeroer, 0)) self.connect((self.zeroer, 0), (self.wxgui_numbersink2_0, 0)) self.connect((self.low_pass_filter_1, 0), (self.blocks_complex_to_arg_0, 0)) self.connect((self.analog_agc2_xx_0_1, 0), (self.blocks_multiply_conjugate_cc_0, 0)) self.connect((self.analog_agc2_xx_0_1_0, 0), (self.blocks_multiply_conjugate_cc_0, 1)) self.connect((self.blocks_multiply_conjugate_cc_0, 0), (self.low_pass_filter_1, 0)) self.connect((self.low_pass_filter_0, 0), (self.analog_am_demod_cf_0, 0)) self.connect((self.analog_am_demod_cf_0, 0), (self.goertzel_fc_0, 0)) self.connect((self.analog_am_demod_cf_0, 0), (self.dc_blocker_xx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_file_source_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.analog_agc2_xx_1, 0)) self.connect((self.analog_agc2_xx_1, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Zoom Fft") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.ratio_chooser = ratio_chooser = 20 self.zoom_ratio = zoom_ratio = ratio_chooser self.samp_rate = samp_rate = 2500000 self.freq = freq = 94500000 ################################################## # Blocks ################################################## self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( self.GetWin(), baseband_freq=freq, y_per_div=10, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=samp_rate / zoom_ratio, fft_size=1024, fft_rate=15, average=False, avg_alpha=None, title='FFT Plot', peak_hold=False, win=window.blackmanharris, ) self.Add(self.wxgui_fftsink2_0.win) self._ratio_chooser_chooser = forms.drop_down( parent=self.GetWin(), value=self.ratio_chooser, callback=self.set_ratio_chooser, label='ratio_chooser', choices=[ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ], labels=[], ) self.Add(self._ratio_chooser_chooser) self.osmosdr_source_1 = osmosdr.source(args="numchan=" + str(1) + " " + 'airspy') self.osmosdr_source_1.set_sample_rate(samp_rate) self.osmosdr_source_1.set_center_freq(freq, 0) self.osmosdr_source_1.set_freq_corr(0, 0) self.osmosdr_source_1.set_dc_offset_mode(0, 0) self.osmosdr_source_1.set_iq_balance_mode(0, 0) self.osmosdr_source_1.set_gain_mode(False, 0) self.osmosdr_source_1.set_gain(10, 0) self.osmosdr_source_1.set_if_gain(20, 0) self.osmosdr_source_1.set_bb_gain(20, 0) self.osmosdr_source_1.set_antenna('', 0) self.osmosdr_source_1.set_bandwidth(0, 0) self.low_pass_filter_0 = filter.fir_filter_ccf( zoom_ratio, firdes.low_pass(1, samp_rate, samp_rate / zoom_ratio / 2, 100, firdes.WIN_HAMMING, 6.76)) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate / zoom_ratio, True) ################################################## # Connections ################################################## self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.osmosdr_source_1, 0), (self.low_pass_filter_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="VA3RFT") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 1920000 self.offset = offset = 50000 self.gain = gain = 40 self.fsk_deviation_hz = fsk_deviation_hz = 8000 self.freq = freq = 444475000 self.corr = corr = 0 ################################################## # Blocks ################################################## _gain_sizer = wx.BoxSizer(wx.VERTICAL) self._gain_text_box = forms.text_box( parent=self.GetWin(), sizer=_gain_sizer, value=self.gain, callback=self.set_gain, label='RX gain', converter=forms.float_converter(), proportion=0, ) self._gain_slider = forms.slider( parent=self.GetWin(), sizer=_gain_sizer, value=self.gain, callback=self.set_gain, minimum=0, maximum=49.6, num_steps=124, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_gain_sizer) _corr_sizer = wx.BoxSizer(wx.VERTICAL) self._corr_text_box = forms.text_box( parent=self.GetWin(), sizer=_corr_sizer, value=self.corr, callback=self.set_corr, label='Freq. correction', converter=forms.float_converter(), proportion=0, ) self._corr_slider = forms.slider( parent=self.GetWin(), sizer=_corr_sizer, value=self.corr, callback=self.set_corr, minimum=-150, maximum=150, num_steps=300, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_corr_sizer) self.wxgui_waterfallsink2_1 = waterfallsink2.waterfall_sink_c( self.GetWin(), baseband_freq=0, dynamic_range=50, ref_level=-20, ref_scale=2.0, sample_rate=48000, fft_size=512, fft_rate=3, average=False, avg_alpha=None, title='Waterfall Plot', ) self.Add(self.wxgui_waterfallsink2_1.win) self.wxgui_scopesink2_0 = scopesink2.scope_sink_f( self.GetWin(), title='Scope Plot', sample_rate=48000, v_scale=0.25, v_offset=0, t_scale=0.001, ac_couple=False, xy_mode=False, num_inputs=1, trig_mode=wxgui.TRIG_MODE_AUTO, y_axis_label='Counts', ) self.Add(self.wxgui_scopesink2_0.win) self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + '') self.osmosdr_source_0.set_sample_rate(samp_rate) self.osmosdr_source_0.set_center_freq(freq - offset, 0) self.osmosdr_source_0.set_freq_corr(corr, 0) self.osmosdr_source_0.set_dc_offset_mode(0, 0) self.osmosdr_source_0.set_iq_balance_mode(0, 0) self.osmosdr_source_0.set_gain_mode(False, 0) self.osmosdr_source_0.set_gain(gain, 0) self.osmosdr_source_0.set_if_gain(20, 0) self.osmosdr_source_0.set_bb_gain(20, 0) self.osmosdr_source_0.set_antenna('', 0) self.osmosdr_source_0.set_bandwidth(0, 0) self.low_pass_filter_1 = filter.fir_filter_fff( 1, firdes.low_pass(1, 48000, 8000, 2000, firdes.WIN_HAMMING, 6.76)) self.low_pass_filter_0 = filter.fir_filter_ccf( 40, firdes.low_pass(20, samp_rate, 3500, 2000, firdes.WIN_HAMMING, 6.76)) self.dsd_block_ff_0 = dsd.dsd_block_ff(dsd.dsd_FRAME_DMR_MOTOTRBO, dsd.dsd_MOD_AUTO_SELECT, 3, True, 2) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.audio_sink_0 = audio.sink(8000, '', True) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, -offset, 1, 0) self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1) ################################################## # Connections ################################################## self.connect((self.analog_quadrature_demod_cf_0, 0), (self.low_pass_filter_1, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.dsd_block_ff_0, 0), (self.audio_sink_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.analog_quadrature_demod_cf_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.wxgui_waterfallsink2_1, 0)) self.connect((self.low_pass_filter_1, 0), (self.dsd_block_ff_0, 0)) self.connect((self.low_pass_filter_1, 0), (self.wxgui_scopesink2_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.blocks_multiply_xx_0, 0))
def __init__(self): gr.top_block.__init__(self, "Bluetooth LE Receiver") ################################################## # Variables ################################################## self.transition_width = transition_width = 300e3 self.sample_rate = sample_rate = 4e6 self.data_rate = data_rate = 1e6 self.cutoff_freq = cutoff_freq = 850e3 self.ble_channel_spacing = ble_channel_spacing = 2e6 self.ble_channel = ble_channel = 12 self.ble_base_freq = ble_base_freq = 2402e6 self.squelch_threshold = squelch_threshold = -70 self.rf_gain = rf_gain = 10 self.lowpass_filter = lowpass_filter = firdes.low_pass( 1, sample_rate, cutoff_freq, transition_width, firdes.WIN_HAMMING, 6.76) self.gmsk_sps = gmsk_sps = int(sample_rate / data_rate) self.gmsk_omega_limit = gmsk_omega_limit = 0.035 self.gmsk_mu = gmsk_mu = 0.5 self.gmsk_gain_mu = gmsk_gain_mu = 0.7 self.freq_offset = freq_offset = 1e6 self.freq = freq = ble_base_freq + (ble_channel_spacing * ble_channel) ################################################## # Message Queues ################################################## message_sink_msgq_out = virtual_sink_msgq_in = gr.msg_queue(2) ################################################## # Blocks ################################################## self.unpacked_to_packed = blocks.unpacked_to_packed_bb( 1, gr.GR_LSB_FIRST) self.osmosdr_source = osmosdr.source(args="numchan=" + str(1) + " " + '') self.osmosdr_source.set_sample_rate(sample_rate) self.osmosdr_source.set_center_freq(2.402e6, 0) self.osmosdr_source.set_freq_corr(0, 0) self.osmosdr_source.set_dc_offset_mode(0, 0) self.osmosdr_source.set_iq_balance_mode(0, 0) self.osmosdr_source.set_gain_mode(False, 0) self.osmosdr_source.set_gain(rf_gain, 0) self.osmosdr_source.set_if_gain(20, 0) self.osmosdr_source.set_bb_gain(20, 0) self.osmosdr_source.set_antenna('', 0) self.osmosdr_source.set_bandwidth(0, 0) self.message_sink = blocks.message_sink(gr.sizeof_char * 1, message_sink_msgq_out, True) self.freq_xlating_fir_filter_lp = filter.freq_xlating_fir_filter_ccc( 1, (lowpass_filter), -freq_offset, sample_rate) self.digital_gmsk_demod_0 = digital.gmsk_demod( samples_per_symbol=gmsk_sps, gain_mu=gmsk_gain_mu, mu=gmsk_mu, omega_relative_limit=gmsk_omega_limit, freq_error=0.0, verbose=False, log=False, ) self.blocks_file_sink_0 = blocks.file_sink( gr.sizeof_char * 1, '/home/spencer/Documents/BLEtest2.txt', True) self.blocks_file_sink_0.set_unbuffered(False) self.analog_simple_squelch = analog.simple_squelch_cc( squelch_threshold, 0.1) ################################################## # Connections ################################################## self.connect((self.analog_simple_squelch, 0), (self.freq_xlating_fir_filter_lp, 0)) self.connect((self.digital_gmsk_demod_0, 0), (self.unpacked_to_packed, 0)) self.connect((self.freq_xlating_fir_filter_lp, 0), (self.digital_gmsk_demod_0, 0)) self.connect((self.osmosdr_source, 0), (self.analog_simple_squelch, 0)) self.connect((self.unpacked_to_packed, 0), (self.blocks_file_sink_0, 0)) self.connect((self.unpacked_to_packed, 0), (self.message_sink, 0))
def set_cutoff(self, cutoff): self.cutoff = cutoff self.low_pass_filter_0.set_taps( firdes.low_pass(1, self.samp_rate, self.cutoff, self.trans, firdes.WIN_HAMMING, 6.76))
def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.rtlsdr_source_0.set_sample_rate(self.samp_rate) self.low_pass_filter_0.set_taps( firdes.low_pass(1, self.samp_rate, self.cutoff, self.trans, firdes.WIN_HAMMING, 6.76))
def set_trans(self, trans): self.trans = trans self.low_pass_filter_0.set_taps( firdes.low_pass(1, self.samp_rate, self.cutoff, self.trans, firdes.WIN_HAMMING, 6.76))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Top Block") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.symb_rate = symb_rate = 30000 self.samp_rate = samp_rate = 10e6 self.decimation = decimation = 300 self.symb_rate_slider = symb_rate_slider = 4000 self.samp_per_sym = samp_per_sym = int( (samp_rate / (decimation)) / symb_rate) self.freq_offset = freq_offset = 1.8e6 self.freq = freq = 433.92e6 self.channel_trans = channel_trans = 1.2e6 self.channel_spacing = channel_spacing = 3000000 + 2000000 # Added self.addconst = addconst = 0 # Changed # Changed from the original Yale_FileInput_BinaryOutput GNURadio Flowgraph export self.initpathprefix = initpathprefix = "/home/user/alarm-fingerprint/AlarmGnuRadioFiles/" self.pathprefix = pathprefix = "/home/user/alarm-fingerprint/AlarmGnuRadioFiles/Captured/" # Same as external hard drive processing code variables self.finput = finput = initpathprefix + "Capture_init.cap" self.foutput = foutput = pathprefix + finput.rsplit("/", 1)[1] # Added self.recfile4 = recfile4 = initpathprefix + "/init/_AddConst" + str( addconst) + "_Yale.dat" ################################################## # Blocks ################################################## _channel_trans_sizer = wx.BoxSizer(wx.VERTICAL) self._channel_trans_text_box = forms.text_box( parent=self.GetWin(), sizer=_channel_trans_sizer, value=self.channel_trans, callback=self.set_channel_trans, label='channel_trans', converter=forms.float_converter(), proportion=0, ) self._channel_trans_slider = forms.slider( parent=self.GetWin(), sizer=_channel_trans_sizer, value=self.channel_trans, callback=self.set_channel_trans, minimum=0, maximum=1.8e6, num_steps=10, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_channel_trans_sizer) _symb_rate_slider_sizer = wx.BoxSizer(wx.VERTICAL) self._symb_rate_slider_text_box = forms.text_box( parent=self.GetWin(), sizer=_symb_rate_slider_sizer, value=self.symb_rate_slider, callback=self.set_symb_rate_slider, label='symb_rate_slider', converter=forms.float_converter(), proportion=0, ) self._symb_rate_slider_slider = forms.slider( parent=self.GetWin(), sizer=_symb_rate_slider_sizer, value=self.symb_rate_slider, callback=self.set_symb_rate_slider, minimum=0, maximum=10e3, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_symb_rate_slider_sizer) self.low_pass_filter_0 = filter.fir_filter_fff( decimation, firdes.low_pass(1, samp_rate, 600e3, 5e3, firdes.WIN_BLACKMAN, 6.76)) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc( 1, (firdes.low_pass(1, samp_rate, channel_spacing, channel_trans, firdes.WIN_BLACKMAN, 6.76)), -freq_offset, samp_rate) self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff( samp_per_sym * (1 + 0.0), 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005) self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb() self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_file_source_0 = blocks.file_source( gr.sizeof_gr_complex * 1, finput, False) self.blocks_file_sink_0_0 = blocks.file_sink(gr.sizeof_char * 1, recfile4, False) self.blocks_file_sink_0_0.set_unbuffered(False) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_add_const_vxx_0 = blocks.add_const_vff((addconst, )) ################################################## # Connections ################################################## self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.blocks_add_const_vxx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.digital_clock_recovery_mm_xx_0, 0)) self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0)) self.connect((self.digital_binary_slicer_fb_0, 0), (self.blocks_file_sink_0_0, 0))
def __init__(self, antenna=satnogs.not_set_antenna, bb_gain=satnogs.not_set_rx_bb_gain, decoded_data_file_path='/tmp/.satnogs/data/noaa', dev_args=satnogs.not_set_dev_args, doppler_correction_per_sec=20, enable_iq_dump=0, file_path='/tmp/test.ogg', flip_images=0, if_gain=satnogs.not_set_rx_if_gain, iq_file_path='/tmp/iq.dat', lo_offset=100e3, ppm=0, rf_gain=satnogs.not_set_rx_rf_gain, rigctl_port=4532, rx_freq=90.4e6, rx_sdr_device='usrpb200', split_images=0, sync=1, waterfall_file_path='/tmp/waterfall.dat'): gr.top_block.__init__(self, "NOAA APT Decoder") ################################################## # Parameters ################################################## self.antenna = antenna self.bb_gain = bb_gain self.decoded_data_file_path = decoded_data_file_path self.dev_args = dev_args self.doppler_correction_per_sec = doppler_correction_per_sec self.enable_iq_dump = enable_iq_dump self.file_path = file_path self.flip_images = flip_images self.if_gain = if_gain self.iq_file_path = iq_file_path self.lo_offset = lo_offset self.ppm = ppm self.rf_gain = rf_gain self.rigctl_port = rigctl_port self.rx_freq = rx_freq self.rx_sdr_device = rx_sdr_device self.split_images = split_images self.sync = sync self.waterfall_file_path = waterfall_file_path ################################################## # Variables ################################################## self.samp_rate_rx = samp_rate_rx = satnogs.hw_rx_settings[rx_sdr_device]['samp_rate'] self.first_stage_decimation = first_stage_decimation = 4 self.noaa_filter_taps = noaa_filter_taps = firdes.low_pass(1.0, samp_rate_rx /first_stage_decimation, 16.5e3, 4e3, firdes.WIN_HAMMING, 6.76) self.initial_bandwidth = initial_bandwidth = 100e3 self.first_stage_filter_taps = first_stage_filter_taps = firdes.low_pass(1.0, 1.0, 0.2, 0.1, firdes.WIN_HAMMING, 6.76) self.audio_decimation = audio_decimation = 2 ################################################## # Blocks ################################################## self.satnogs_waterfall_sink_0 = satnogs.waterfall_sink(samp_rate_rx/ ( first_stage_decimation * int(samp_rate_rx/ first_stage_decimation / initial_bandwidth)), 0.0, 8, 1024, waterfall_file_path, 0) self.satnogs_tcp_rigctl_msg_source_0 = satnogs.tcp_rigctl_msg_source("127.0.0.1", rigctl_port, False, 1000/doppler_correction_per_sec, 1500) self.satnogs_ogg_encoder_0 = satnogs.ogg_encoder(file_path, 48000, 0.8) self.satnogs_noaa_apt_sink_0 = satnogs.noaa_apt_sink(decoded_data_file_path, 2080, 1500, bool(split_images), bool(sync), bool(flip_images)) self.satnogs_iq_sink_0 = satnogs.iq_sink(32767, iq_file_path, False, enable_iq_dump) self.satnogs_coarse_doppler_correction_cc_0 = satnogs.coarse_doppler_correction_cc(rx_freq, samp_rate_rx /first_stage_decimation) self.rational_resampler_xxx_2 = filter.rational_resampler_ccc( interpolation=48000, decimation=int(samp_rate_rx/ ( first_stage_decimation * int(samp_rate_rx/ first_stage_decimation / initial_bandwidth)) / audio_decimation), taps=None, fractional_bw=None, ) self.rational_resampler_xxx_1 = filter.rational_resampler_fff( interpolation=48000, decimation=int(samp_rate_rx/ ( first_stage_decimation * int(samp_rate_rx/ first_stage_decimation / initial_bandwidth)) / audio_decimation), taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff( interpolation=1, decimation=4, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=4*4160, decimation=int((samp_rate_rx/ ( first_stage_decimation * int(samp_rate_rx/ first_stage_decimation / initial_bandwidth)) / audio_decimation)/2), taps=None, fractional_bw=None, ) self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + satnogs.handle_rx_dev_args(rx_sdr_device, dev_args) ) self.osmosdr_source_0.set_sample_rate(samp_rate_rx) self.osmosdr_source_0.set_center_freq(rx_freq - lo_offset, 0) self.osmosdr_source_0.set_freq_corr(ppm, 0) self.osmosdr_source_0.set_dc_offset_mode(2, 0) self.osmosdr_source_0.set_iq_balance_mode(0, 0) self.osmosdr_source_0.set_gain_mode(False, 0) self.osmosdr_source_0.set_gain(satnogs.handle_rx_rf_gain(rx_sdr_device, rf_gain), 0) self.osmosdr_source_0.set_if_gain(satnogs.handle_rx_if_gain(rx_sdr_device, if_gain), 0) self.osmosdr_source_0.set_bb_gain(satnogs.handle_rx_bb_gain(rx_sdr_device, bb_gain), 0) self.osmosdr_source_0.set_antenna(satnogs.handle_rx_antenna(rx_sdr_device, antenna), 0) self.osmosdr_source_0.set_bandwidth(samp_rate_rx, 0) self.hilbert_fc_0 = filter.hilbert_fc(65, firdes.WIN_HAMMING, 6.76) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(first_stage_decimation, (first_stage_filter_taps), lo_offset, samp_rate_rx) self.fir_filter_xxx_1 = filter.fir_filter_fff(2, ([0.5, 0.5])) self.fir_filter_xxx_1.declare_sample_delay(0) self.fft_filter_xxx_0 = filter.fft_filter_ccc(int(samp_rate_rx/ first_stage_decimation / initial_bandwidth), (noaa_filter_taps), 1) self.fft_filter_xxx_0.declare_sample_delay(0) self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self.band_pass_filter_0 = filter.fir_filter_fff(1, firdes.band_pass( 6, samp_rate_rx/ ( first_stage_decimation * int(samp_rate_rx/ first_stage_decimation / initial_bandwidth)) / audio_decimation, 500, 4.2e3, 200, firdes.WIN_HAMMING, 6.76)) self.analog_wfm_rcv_0 = analog.wfm_rcv( quad_rate=samp_rate_rx/ ( first_stage_decimation * int(samp_rate_rx/ first_stage_decimation / initial_bandwidth)), audio_decimation=audio_decimation, ) ################################################## # Connections ################################################## self.msg_connect((self.satnogs_tcp_rigctl_msg_source_0, 'freq'), (self.satnogs_coarse_doppler_correction_cc_0, 'freq')) self.connect((self.analog_wfm_rcv_0, 0), (self.band_pass_filter_0, 0)) self.connect((self.analog_wfm_rcv_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.band_pass_filter_0, 0), (self.fir_filter_xxx_1, 0)) self.connect((self.blocks_complex_to_mag_0, 0), (self.rational_resampler_xxx_0_0, 0)) self.connect((self.fft_filter_xxx_0, 0), (self.analog_wfm_rcv_0, 0)) self.connect((self.fft_filter_xxx_0, 0), (self.rational_resampler_xxx_2, 0)) self.connect((self.fir_filter_xxx_1, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.satnogs_coarse_doppler_correction_cc_0, 0)) self.connect((self.hilbert_fc_0, 0), (self.blocks_complex_to_mag_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.hilbert_fc_0, 0)) self.connect((self.rational_resampler_xxx_0_0, 0), (self.satnogs_noaa_apt_sink_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.satnogs_ogg_encoder_0, 0)) self.connect((self.rational_resampler_xxx_2, 0), (self.satnogs_iq_sink_0, 0)) self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0), (self.fft_filter_xxx_0, 0)) self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0), (self.satnogs_waterfall_sink_0, 0))
def set_channel_spacing(self, channel_spacing): self.channel_spacing = channel_spacing self.freq_xlating_fir_filter_xxx_0.set_taps( (firdes.low_pass(1, self.samp_rate, self.channel_spacing, self.channel_trans, firdes.WIN_BLACKMAN, 6.76)))
def __init__(self): gr.top_block.__init__(self, "Top Block") Qt.QWidget.__init__(self) self.setWindowTitle("Top Block") try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "top_block") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 10e6 self.channel_width = channel_width = 200e3 self.channel_freq = channel_freq = 99.7e6 self.center_freq = center_freq = 94.9e6 self.audio_gain = audio_gain = 1 ################################################## # Blocks ################################################## self._channel_freq_range = Range(88e6, 107e6, 200e3, 99.7e6, 200) self._channel_freq_win = RangeWidget(self._channel_freq_range, self.set_channel_freq, "channel_freq", "counter_slider", float) self.top_layout.addWidget(self._channel_freq_win) self._audio_gain_range = Range(0, 5, .1, 1, 200) self._audio_gain_win = RangeWidget(self._audio_gain_range, self.set_audio_gain, "audio_gain", "slider", float) self.top_layout.addWidget(self._audio_gain_win) self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( interpolation=12, decimation=5, taps=None, fractional_bw=None, ) self.qtgui_sink_x_0 = qtgui.sink_c( 1024, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype center_freq, #fc samp_rate, #bw "", #name True, #plotfreq True, #plotwaterfall True, #plottime True, #plotconst ) self.qtgui_sink_x_0.set_update_time(1.0/10) self._qtgui_sink_x_0_win = sip.wrapinstance(self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_sink_x_0_win) self.qtgui_sink_x_0.enable_rf_freq(True) self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "" ) self.osmosdr_source_0.set_sample_rate(samp_rate) self.osmosdr_source_0.set_center_freq(center_freq, 0) self.osmosdr_source_0.set_freq_corr(0, 0) self.osmosdr_source_0.set_dc_offset_mode(0, 0) self.osmosdr_source_0.set_iq_balance_mode(0, 0) self.osmosdr_source_0.set_gain_mode(False, 0) self.osmosdr_source_0.set_gain(0, 0) self.osmosdr_source_0.set_if_gain(20, 0) self.osmosdr_source_0.set_bb_gain(20, 0) self.osmosdr_source_0.set_antenna("", 0) self.osmosdr_source_0.set_bandwidth(0, 0) self.low_pass_filter_0 = filter.fir_filter_ccf(int(samp_rate/channel_width), firdes.low_pass( 1, samp_rate, 75e3, 25e3, firdes.WIN_HAMMING, 6.76)) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((audio_gain, )) self.audio_sink_0 = audio.sink(48000, "", True) self.analog_wfm_rcv_0 = analog.wfm_rcv( quad_rate=480e3, audio_decimation=10, ) self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, center_freq - channel_freq, 1, 0) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.analog_wfm_rcv_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.qtgui_sink_x_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.analog_wfm_rcv_0, 0))
def __init__(self): gr.top_block.__init__(self, "VCC Ground Station Simulator") Qt.QWidget.__init__(self) self.setWindowTitle("VCC Ground Station Simulator") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "gs_sim_v1") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 250000 self.tx_tune_sel = tx_tune_sel = 0 self.tx_offset = tx_offset = samp_rate/2 self.tx_gain = tx_gain = 40 self.tx_freq = tx_freq = 401.12e6 self.trigger_thresh = trigger_thresh = -2 self.rx_offset = rx_offset = samp_rate/2.0 self.rx_gain = rx_gain = 40 self.rx_freq = rx_freq = 401.04e6 self.rx_fine_tune = rx_fine_tune = 0 self.man_tune = man_tune = 0.0 self.interp_2 = interp_2 = 1 self.interp = interp = 48 self.fsk_dev = fsk_dev = 10000 self.decim_2 = decim_2 = 2 self.decim = decim = int(samp_rate/2000) self.chan_filt_trans = chan_filt_trans = 1000 self.chan_filt_cutoff = chan_filt_cutoff = 24000 self.bb_gain = bb_gain = .75 self.baud = baud = 9600 ################################################## # Blocks ################################################## self.main_tab = Qt.QTabWidget() self.main_tab_widget_0 = Qt.QWidget() self.main_tab_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.main_tab_widget_0) self.main_tab_grid_layout_0 = Qt.QGridLayout() self.main_tab_layout_0.addLayout(self.main_tab_grid_layout_0) self.main_tab.addTab(self.main_tab_widget_0, 'Full Band') self.main_tab_widget_1 = Qt.QWidget() self.main_tab_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.main_tab_widget_1) self.main_tab_grid_layout_1 = Qt.QGridLayout() self.main_tab_layout_1.addLayout(self.main_tab_grid_layout_1) self.main_tab.addTab(self.main_tab_widget_1, 'RX Channel') self.main_tab_widget_2 = Qt.QWidget() self.main_tab_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.main_tab_widget_2) self.main_tab_grid_layout_2 = Qt.QGridLayout() self.main_tab_layout_2.addLayout(self.main_tab_grid_layout_2) self.main_tab.addTab(self.main_tab_widget_2, 'TX Channel') self.top_grid_layout.addWidget(self.main_tab, 0, 0, 2, 8) for r in range(0, 2): self.top_grid_layout.setRowStretch(r, 1) for c in range(0, 8): self.top_grid_layout.setColumnStretch(c, 1) self._tx_gain_tool_bar = Qt.QToolBar(self) self._tx_gain_tool_bar.addWidget(Qt.QLabel('TX Gain'+": ")) self._tx_gain_line_edit = Qt.QLineEdit(str(self.tx_gain)) self._tx_gain_tool_bar.addWidget(self._tx_gain_line_edit) self._tx_gain_line_edit.returnPressed.connect( lambda: self.set_tx_gain(eng_notation.str_to_num(str(self._tx_gain_line_edit.text().toAscii())))) self.main_tab_grid_layout_2.addWidget(self._tx_gain_tool_bar, 2, 3, 1, 1) for r in range(2, 3): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(3, 4): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self._tx_freq_tool_bar = Qt.QToolBar(self) self._tx_freq_tool_bar.addWidget(Qt.QLabel('TX Freq'+": ")) self._tx_freq_line_edit = Qt.QLineEdit(str(self.tx_freq)) self._tx_freq_tool_bar.addWidget(self._tx_freq_line_edit) self._tx_freq_line_edit.returnPressed.connect( lambda: self.set_tx_freq(eng_notation.str_to_num(str(self._tx_freq_line_edit.text().toAscii())))) self.main_tab_grid_layout_2.addWidget(self._tx_freq_tool_bar, 2, 0, 1, 1) for r in range(2, 3): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 1): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self._trigger_thresh_tool_bar = Qt.QToolBar(self) self._trigger_thresh_tool_bar.addWidget(Qt.QLabel('Trigger Thresh'+": ")) self._trigger_thresh_line_edit = Qt.QLineEdit(str(self.trigger_thresh)) self._trigger_thresh_tool_bar.addWidget(self._trigger_thresh_line_edit) self._trigger_thresh_line_edit.returnPressed.connect( lambda: self.set_trigger_thresh(eng_notation.str_to_num(str(self._trigger_thresh_line_edit.text().toAscii())))) self.main_tab_grid_layout_1.addWidget(self._trigger_thresh_tool_bar, 4, 4, 1, 2) for r in range(4, 5): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(4, 6): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self._rx_gain_tool_bar = Qt.QToolBar(self) self._rx_gain_tool_bar.addWidget(Qt.QLabel('RX Gain'+": ")) self._rx_gain_line_edit = Qt.QLineEdit(str(self.rx_gain)) self._rx_gain_tool_bar.addWidget(self._rx_gain_line_edit) self._rx_gain_line_edit.returnPressed.connect( lambda: self.set_rx_gain(eng_notation.str_to_num(str(self._rx_gain_line_edit.text().toAscii())))) self.main_tab_grid_layout_0.addWidget(self._rx_gain_tool_bar, 4, 2, 1, 2) for r in range(4, 5): self.main_tab_grid_layout_0.setRowStretch(r, 1) for c in range(2, 4): self.main_tab_grid_layout_0.setColumnStretch(c, 1) self._rx_freq_tool_bar = Qt.QToolBar(self) self._rx_freq_tool_bar.addWidget(Qt.QLabel('RX Freq'+": ")) self._rx_freq_line_edit = Qt.QLineEdit(str(self.rx_freq)) self._rx_freq_tool_bar.addWidget(self._rx_freq_line_edit) self._rx_freq_line_edit.returnPressed.connect( lambda: self.set_rx_freq(eng_notation.str_to_num(str(self._rx_freq_line_edit.text().toAscii())))) self.main_tab_grid_layout_0.addWidget(self._rx_freq_tool_bar, 4, 0, 1, 2) for r in range(4, 5): self.main_tab_grid_layout_0.setRowStretch(r, 1) for c in range(0, 2): self.main_tab_grid_layout_0.setColumnStretch(c, 1) self._rx_fine_tune_tool_bar = Qt.QToolBar(self) self._rx_fine_tune_tool_bar.addWidget(Qt.QLabel('RX Fine Tune'+": ")) self._rx_fine_tune_line_edit = Qt.QLineEdit(str(self.rx_fine_tune)) self._rx_fine_tune_tool_bar.addWidget(self._rx_fine_tune_line_edit) self._rx_fine_tune_line_edit.returnPressed.connect( lambda: self.set_rx_fine_tune(eng_notation.str_to_num(str(self._rx_fine_tune_line_edit.text().toAscii())))) self.main_tab_grid_layout_1.addWidget(self._rx_fine_tune_tool_bar, 3, 4, 1, 2) for r in range(3, 4): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(4, 6): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self._man_tune_tool_bar = Qt.QToolBar(self) self._man_tune_tool_bar.addWidget(Qt.QLabel('TX Freq Offset'+": ")) self._man_tune_line_edit = Qt.QLineEdit(str(self.man_tune)) self._man_tune_tool_bar.addWidget(self._man_tune_line_edit) self._man_tune_line_edit.returnPressed.connect( lambda: self.set_man_tune(eng_notation.str_to_num(str(self._man_tune_line_edit.text().toAscii())))) self.main_tab_grid_layout_2.addWidget(self._man_tune_tool_bar, 3, 0, 1, 1) for r in range(3, 4): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 1): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self._bb_gain_tool_bar = Qt.QToolBar(self) self._bb_gain_tool_bar.addWidget(Qt.QLabel('BB Gain'+": ")) self._bb_gain_line_edit = Qt.QLineEdit(str(self.bb_gain)) self._bb_gain_tool_bar.addWidget(self._bb_gain_line_edit) self._bb_gain_line_edit.returnPressed.connect( lambda: self.set_bb_gain(eng_notation.str_to_num(str(self._bb_gain_line_edit.text().toAscii())))) self.main_tab_grid_layout_2.addWidget(self._bb_gain_tool_bar, 2, 2, 1, 1) for r in range(2, 3): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(2, 3): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self.vcc_qt_hex_text_tx_0 = vcc.qt_hex_text() self._vcc_qt_hex_text_tx_0_win = self.vcc_qt_hex_text_tx_0; self.main_tab_grid_layout_1.addWidget(self._vcc_qt_hex_text_tx_0_win, 5, 0, 2, 6) for r in range(5, 7): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(0, 6): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self.vcc_qt_hex_text_tx = vcc.qt_hex_text() self._vcc_qt_hex_text_tx_win = self.vcc_qt_hex_text_tx; self.main_tab_grid_layout_2.addWidget(self._vcc_qt_hex_text_tx_win, 0, 0, 2, 2) for r in range(0, 2): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(0, 2): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self.uhd_usrp_source_1 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_1.set_samp_rate(samp_rate) self.uhd_usrp_source_1.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) self.uhd_usrp_source_1.set_center_freq(uhd.tune_request(rx_freq, rx_offset), 0) self.uhd_usrp_source_1.set_gain(rx_gain, 0) self.uhd_usrp_source_1.set_antenna('TX/RX', 0) self.uhd_usrp_source_1.set_auto_dc_offset(True, 0) self.uhd_usrp_source_1.set_auto_iq_balance(True, 0) self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS) self.uhd_usrp_sink_0.set_center_freq(uhd.tune_request(tx_freq, tx_offset), 0) self.uhd_usrp_sink_0.set_gain(tx_gain, 0) self.uhd_usrp_sink_0.set_antenna('TX/RX', 0) self._tx_tune_sel_options = (0, 1, ) self._tx_tune_sel_labels = ('Auto', 'Manual', ) self._tx_tune_sel_tool_bar = Qt.QToolBar(self) self._tx_tune_sel_tool_bar.addWidget(Qt.QLabel('TX Tune Mode'+": ")) self._tx_tune_sel_combo_box = Qt.QComboBox() self._tx_tune_sel_tool_bar.addWidget(self._tx_tune_sel_combo_box) for label in self._tx_tune_sel_labels: self._tx_tune_sel_combo_box.addItem(label) self._tx_tune_sel_callback = lambda i: Qt.QMetaObject.invokeMethod(self._tx_tune_sel_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._tx_tune_sel_options.index(i))) self._tx_tune_sel_callback(self.tx_tune_sel) self._tx_tune_sel_combo_box.currentIndexChanged.connect( lambda i: self.set_tx_tune_sel(self._tx_tune_sel_options[i])) self.main_tab_grid_layout_2.addWidget(self._tx_tune_sel_tool_bar, 3, 1, 1, 1) for r in range(3, 4): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(1, 2): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self.rational_resampler_xxx_4 = filter.rational_resampler_ccc( interpolation=interp/2, decimation=decim, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_3 = filter.rational_resampler_ccc( interpolation=1, decimation=2, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_2 = filter.rational_resampler_ccc( interpolation=1, decimation=2, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_1_0 = filter.rational_resampler_ccc( interpolation=interp_2, decimation=decim_2, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=interp, decimation=decim, taps=None, fractional_bw=None, ) self.qtgui_waterfall_sink_x_0_0 = qtgui.waterfall_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim*interp / decim_2 * interp_2, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0_0.set_update_time(0.0010) self.qtgui_waterfall_sink_x_0_0.enable_grid(True) self.qtgui_waterfall_sink_x_0_0.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0_0.set_intensity_range(-50, 50) self._qtgui_waterfall_sink_x_0_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0_0.pyqwidget(), Qt.QWidget) self.main_tab_grid_layout_1.addWidget(self._qtgui_waterfall_sink_x_0_0_win, 2, 0, 2, 4) for r in range(2, 4): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(0, 4): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype rx_freq, #fc samp_rate, #bw "", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.010) self.qtgui_waterfall_sink_x_0.enable_grid(True) self.qtgui_waterfall_sink_x_0.enable_axis_labels(True) if not True: self.qtgui_waterfall_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.main_tab_grid_layout_0.addWidget(self._qtgui_waterfall_sink_x_0_win, 1, 0, 1, 8) for r in range(1, 2): self.main_tab_grid_layout_0.setRowStretch(r, 1) for c in range(0, 8): self.main_tab_grid_layout_0.setColumnStretch(c, 1) self.qtgui_freq_sink_x_1_0_1 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype rx_freq, #fc samp_rate, #bw "VCC RX Spectrum", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1_0_1.set_update_time(0.0010) self.qtgui_freq_sink_x_1_0_1.set_y_axis(-150, -40) self.qtgui_freq_sink_x_1_0_1.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1_0_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1_0_1.enable_autoscale(False) self.qtgui_freq_sink_x_1_0_1.enable_grid(True) self.qtgui_freq_sink_x_1_0_1.set_fft_average(0.2) self.qtgui_freq_sink_x_1_0_1.enable_axis_labels(True) self.qtgui_freq_sink_x_1_0_1.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_1_0_1.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1_0_1.set_plot_pos_half(not True) labels = ['pre-d', 'agc_filt', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1_0_1.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1_0_1.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1_0_1.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1_0_1.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1_0_1.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_0_1_win = sip.wrapinstance(self.qtgui_freq_sink_x_1_0_1.pyqwidget(), Qt.QWidget) self.main_tab_grid_layout_0.addWidget(self._qtgui_freq_sink_x_1_0_1_win, 0, 0, 1, 8) for r in range(0, 1): self.main_tab_grid_layout_0.setRowStretch(r, 1) for c in range(0, 8): self.main_tab_grid_layout_0.setColumnStretch(c, 1) self.qtgui_freq_sink_x_1_0_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate/decim*interp/2, #bw "TX Spectrum", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1_0_0.set_update_time(0.010) self.qtgui_freq_sink_x_1_0_0.set_y_axis(-150, 0) self.qtgui_freq_sink_x_1_0_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1_0_0.enable_autoscale(False) self.qtgui_freq_sink_x_1_0_0.enable_grid(True) self.qtgui_freq_sink_x_1_0_0.set_fft_average(1.0) self.qtgui_freq_sink_x_1_0_0.enable_axis_labels(True) self.qtgui_freq_sink_x_1_0_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_1_0_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1_0_0.set_plot_pos_half(not True) labels = ['', '', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1_0_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1_0_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1_0_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1_0_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1_0_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_0_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_1_0_0.pyqwidget(), Qt.QWidget) self.main_tab_grid_layout_2.addWidget(self._qtgui_freq_sink_x_1_0_0_win, 0, 2, 2, 2) for r in range(0, 2): self.main_tab_grid_layout_2.setRowStretch(r, 1) for c in range(2, 4): self.main_tab_grid_layout_2.setColumnStretch(c, 1) self.qtgui_freq_sink_x_1_0 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate / decim*interp / decim_2 * interp_2, #bw "Narrow Spectrum", #name 1 #number of inputs ) self.qtgui_freq_sink_x_1_0.set_update_time(0.0010) self.qtgui_freq_sink_x_1_0.set_y_axis(-50, 50) self.qtgui_freq_sink_x_1_0.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1_0.enable_autoscale(False) self.qtgui_freq_sink_x_1_0.enable_grid(True) self.qtgui_freq_sink_x_1_0.set_fft_average(1.0) self.qtgui_freq_sink_x_1_0.enable_axis_labels(True) self.qtgui_freq_sink_x_1_0.enable_control_panel(False) if not False: self.qtgui_freq_sink_x_1_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1_0.set_plot_pos_half(not True) labels = ['pre-d', 'agc_filt', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1_0.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1_0.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1_0.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1_0.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_1_0.pyqwidget(), Qt.QWidget) self.main_tab_grid_layout_1.addWidget(self._qtgui_freq_sink_x_1_0_win, 0, 0, 2, 4) for r in range(0, 2): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(0, 4): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self.qtgui_freq_sink_x_1 = qtgui.freq_sink_c( 2048, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate*interp/decim*interp_2/decim_2, #bw "Burst RX Spectrum", #name 2 #number of inputs ) self.qtgui_freq_sink_x_1.set_update_time(0.10) self.qtgui_freq_sink_x_1.set_y_axis(-140, 10) self.qtgui_freq_sink_x_1.set_y_label('Relative Gain', 'dB') self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") self.qtgui_freq_sink_x_1.enable_autoscale(True) self.qtgui_freq_sink_x_1.enable_grid(True) self.qtgui_freq_sink_x_1.set_fft_average(1.0) self.qtgui_freq_sink_x_1.enable_axis_labels(True) self.qtgui_freq_sink_x_1.enable_control_panel(False) if not True: self.qtgui_freq_sink_x_1.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_freq_sink_x_1.set_plot_pos_half(not True) labels = ['orig', 'corr', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "dark blue"] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2): if len(labels[i]) == 0: self.qtgui_freq_sink_x_1.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_freq_sink_x_1.set_line_label(i, labels[i]) self.qtgui_freq_sink_x_1.set_line_width(i, widths[i]) self.qtgui_freq_sink_x_1.set_line_color(i, colors[i]) self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i]) self._qtgui_freq_sink_x_1_win = sip.wrapinstance(self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget) self.main_tab_grid_layout_1.addWidget(self._qtgui_freq_sink_x_1_win, 0, 4, 2, 4) for r in range(0, 2): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(4, 8): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self.pyqt_meta_text_output_0 = pyqt.meta_text_output() self._pyqt_meta_text_output_0_win = self.pyqt_meta_text_output_0; self.main_tab_grid_layout_1.addWidget(self._pyqt_meta_text_output_0_win, 3, 6, 4, 2) for r in range(3, 7): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(6, 8): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self.pyqt_ctime_plot_0 = pyqt.ctime_plot('') self._pyqt_ctime_plot_0_win = self.pyqt_ctime_plot_0; self.main_tab_grid_layout_1.addWidget(self._pyqt_ctime_plot_0_win, 2, 4, 1, 4) for r in range(2, 3): self.main_tab_grid_layout_1.setRowStretch(r, 1) for c in range(4, 8): self.main_tab_grid_layout_1.setColumnStretch(c, 1) self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass( 1, samp_rate / decim *interp, chan_filt_cutoff, chan_filt_trans, firdes.WIN_HAMMING, 6.76)) self.gmsk_tx_burst_hier2_0 = gmsk_tx_burst_hier2( bb_gain=bb_gain, bt=.5, delay_enable=1, pad_front=0, pad_tail=0, ptt_delay=.25, samp_rate=samp_rate, ) self.gmsk_ax25_rx_hier_0 = gmsk_ax25_rx_hier( lpf_cutoff=7.2e3, lpf_trans=1e3, quad_demod_gain=(samp_rate/decim*interp/decim_2*interp_2)/(2*math.pi*fsk_dev/8.0), samp_rate=(samp_rate/decim*interp) / decim_2 * interp_2, samps_per_symb=(samp_rate/decim*interp / baud) / decim_2 * interp_2, ) self.fsk_burst_detector_0 = fsk_burst_detector( avg_len=100.0, cons_offset=3, decim=decim, fsk_dev=fsk_dev, interp=interp, samp_rate=samp_rate, ) self.burst_rx_es_hier_0 = burst_rx_es_hier( avg_len=100, baud=9600, samp_rate=samp_rate/decim*interp, samps_per_symb=samp_rate/decim*interp / baud, trigger_thresh=trigger_thresh, ) self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", '0.0.0.0', '8000', 1024, False) self.blocks_multiply_xx_0_0 = blocks.multiply_vcc(1) self.blocks_multiply_xx_0 = blocks.multiply_vcc(1) self.analog_sig_source_x_0_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, -1 * rx_fine_tune, 1, 0) self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, man_tune, 1, 0) self.analog_agc2_xx_0 = analog.agc2_cc(10, 1e-1, 65536, 1) self.analog_agc2_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.msg_connect((self.blocks_socket_pdu_0, 'pdus'), (self.gmsk_tx_burst_hier2_0, 'kiss/ax25')) self.msg_connect((self.burst_rx_es_hier_0, 'brst_corr'), (self.pyqt_ctime_plot_0, 'cpdus')) self.msg_connect((self.burst_rx_es_hier_0, 'meta'), (self.pyqt_meta_text_output_0, 'pdus')) self.msg_connect((self.gmsk_ax25_rx_hier_0, 'kiss'), (self.blocks_socket_pdu_0, 'pdus')) self.msg_connect((self.gmsk_ax25_rx_hier_0, 'kiss'), (self.vcc_qt_hex_text_tx_0, 'pdus')) self.msg_connect((self.gmsk_tx_burst_hier2_0, 'ax25'), (self.vcc_qt_hex_text_tx, 'pdus')) self.connect((self.analog_agc2_xx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0_0, 1)) self.connect((self.blocks_multiply_xx_0, 0), (self.rational_resampler_xxx_4, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.blocks_multiply_xx_0_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.burst_rx_es_hier_0, 0), (self.rational_resampler_xxx_2, 0)) self.connect((self.burst_rx_es_hier_0, 1), (self.rational_resampler_xxx_3, 0)) self.connect((self.fsk_burst_detector_0, 0), (self.burst_rx_es_hier_0, 1)) self.connect((self.gmsk_ax25_rx_hier_0, 0), (self.qtgui_freq_sink_x_1, 1)) self.connect((self.gmsk_tx_burst_hier2_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.burst_rx_es_hier_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.fsk_burst_detector_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.rational_resampler_xxx_1_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.analog_agc2_xx_0, 0)) self.connect((self.rational_resampler_xxx_1_0, 0), (self.qtgui_freq_sink_x_1_0, 0)) self.connect((self.rational_resampler_xxx_1_0, 0), (self.qtgui_waterfall_sink_x_0_0, 0)) self.connect((self.rational_resampler_xxx_2, 0), (self.qtgui_freq_sink_x_1, 0)) self.connect((self.rational_resampler_xxx_3, 0), (self.gmsk_ax25_rx_hier_0, 0)) self.connect((self.rational_resampler_xxx_4, 0), (self.qtgui_freq_sink_x_1_0_0, 0)) self.connect((self.uhd_usrp_source_1, 0), (self.blocks_multiply_xx_0_0, 0)) self.connect((self.uhd_usrp_source_1, 0), (self.qtgui_freq_sink_x_1_0_1, 0)) self.connect((self.uhd_usrp_source_1, 0), (self.qtgui_waterfall_sink_x_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Top Block") _icon_path = "C:\Program Files\GNURadio-3.7\share\icons\hicolor\scalable/apps\gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.volume = volume = 1 self.transition = transition = 1e6 self.samp_rate = samp_rate = 2e6 self.freq = freq = 100.8e6 self.cutoff = cutoff = 100e3 ################################################## # Blocks ################################################## _volume_sizer = wx.BoxSizer(wx.VERTICAL) self._volume_text_box = forms.text_box( parent=self.GetWin(), sizer=_volume_sizer, value=self.volume, callback=self.set_volume, label='volume', converter=forms.float_converter(), proportion=0, ) self._volume_slider = forms.slider( parent=self.GetWin(), sizer=_volume_sizer, value=self.volume, callback=self.set_volume, minimum=0, maximum=100, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_volume_sizer) _transition_sizer = wx.BoxSizer(wx.VERTICAL) self._transition_text_box = forms.text_box( parent=self.GetWin(), sizer=_transition_sizer, value=self.transition, callback=self.set_transition, label='transition', converter=forms.float_converter(), proportion=0, ) self._transition_slider = forms.slider( parent=self.GetWin(), sizer=_transition_sizer, value=self.transition, callback=self.set_transition, minimum=5e5, maximum=2e6, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_transition_sizer) _freq_sizer = wx.BoxSizer(wx.VERTICAL) self._freq_text_box = forms.text_box( parent=self.GetWin(), sizer=_freq_sizer, value=self.freq, callback=self.set_freq, label='freq', converter=forms.float_converter(), proportion=0, ) self._freq_slider = forms.slider( parent=self.GetWin(), sizer=_freq_sizer, value=self.freq, callback=self.set_freq, minimum=87.4e6, maximum=109e6, num_steps=1000, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_freq_sizer) _cutoff_sizer = wx.BoxSizer(wx.VERTICAL) self._cutoff_text_box = forms.text_box( parent=self.GetWin(), sizer=_cutoff_sizer, value=self.cutoff, callback=self.set_cutoff, label='cutoff', converter=forms.float_converter(), proportion=0, ) self._cutoff_slider = forms.slider( parent=self.GetWin(), sizer=_cutoff_sizer, value=self.cutoff, callback=self.set_cutoff, minimum=10e3, maximum=500e3, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_cutoff_sizer) self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c( self.GetWin(), baseband_freq=freq, dynamic_range=100, ref_level=0, ref_scale=2.0, sample_rate=samp_rate, fft_size=512, fft_rate=15, average=False, avg_alpha=None, title='Waterfall Plot', ) self.Add(self.wxgui_waterfallsink2_0.win) self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( self.GetWin(), baseband_freq=freq, y_per_div=10, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=samp_rate, fft_size=1024, fft_rate=15, average=False, avg_alpha=None, title='FFT Plot', peak_hold=False, ) self.Add(self.wxgui_fftsink2_0.win) self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + 'rtl=00000001' ) self.rtlsdr_source_0.set_sample_rate(samp_rate) self.rtlsdr_source_0.set_center_freq(freq, 0) self.rtlsdr_source_0.set_freq_corr(0, 0) self.rtlsdr_source_0.set_dc_offset_mode(0, 0) self.rtlsdr_source_0.set_iq_balance_mode(0, 0) self.rtlsdr_source_0.set_gain_mode(False, 0) self.rtlsdr_source_0.set_gain(10, 0) self.rtlsdr_source_0.set_if_gain(20, 0) self.rtlsdr_source_0.set_bb_gain(20, 0) self.rtlsdr_source_0.set_antenna('', 0) self.rtlsdr_source_0.set_bandwidth(0, 0) self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=48, decimation=500, taps=None, fractional_bw=None, ) self.low_pass_filter_0 = filter.fir_filter_ccf(int(samp_rate/500e3), firdes.low_pass( 1, samp_rate, cutoff, transition, firdes.WIN_HAMMING, 6.76)) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((volume, )) self.audio_sink_0 = audio.sink(48000, '', True) self.analog_wfm_rcv_0 = analog.wfm_rcv( quad_rate=500e3, audio_decimation=1, ) ################################################## # Connections ################################################## self.connect((self.analog_wfm_rcv_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.analog_wfm_rcv_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.wxgui_fftsink2_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.wxgui_waterfallsink2_0, 0))
def set_chan_filt_cutoff(self, chan_filt_cutoff): self.chan_filt_cutoff = chan_filt_cutoff self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate / self.decim *self.interp, self.chan_filt_cutoff, self.chan_filt_trans, firdes.WIN_HAMMING, 6.76))
def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.wxgui_waterfallsink2_0.set_sample_rate(self.samp_rate) self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate) self.rtlsdr_source_0.set_sample_rate(self.samp_rate) self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate, self.cutoff, self.transition, firdes.WIN_HAMMING, 6.76))
def set_cutoff_freq(self, cutoff_freq): self.cutoff_freq = cutoff_freq self.set_lowpass_filter( firdes.low_pass(1, self.sample_rate, self.cutoff_freq, self.transition_width, firdes.WIN_HAMMING, 6.76))
def set_transition(self, transition): self.transition = transition self._transition_slider.set_value(self.transition) self._transition_text_box.set_value(self.transition) self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate, self.cutoff, self.transition, firdes.WIN_HAMMING, 6.76))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Top Block") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.variable_slider_Audio_level_0 = variable_slider_Audio_level_0 = 1 self.variable_slider_Audio_level = variable_slider_Audio_level = 1 self.variable_slider_0 = variable_slider_0 = 2.400140e9 self.samp_rate = samp_rate = 2e6 self.rf_gain = rf_gain = 100 self.modelation_amp = modelation_amp = 1 self.mixer_level = mixer_level = 1 self.if_gain = if_gain = 100 self.bb_gain = bb_gain = 59 self.Audio_freq = Audio_freq = 1000 ################################################## # Blocks ################################################## _variable_slider_Audio_level_0_sizer = wx.BoxSizer(wx.VERTICAL) self._variable_slider_Audio_level_0_text_box = forms.text_box( parent=self.GetWin(), sizer=_variable_slider_Audio_level_0_sizer, value=self.variable_slider_Audio_level_0, callback=self.set_variable_slider_Audio_level_0, label='Modulator amp', converter=forms.float_converter(), proportion=0, ) self._variable_slider_Audio_level_0_slider = forms.slider( parent=self.GetWin(), sizer=_variable_slider_Audio_level_0_sizer, value=self.variable_slider_Audio_level_0, callback=self.set_variable_slider_Audio_level_0, minimum=0, maximum=10, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_variable_slider_Audio_level_0_sizer, 0, 1, 1, 1) _mixer_level_sizer = wx.BoxSizer(wx.VERTICAL) self._mixer_level_text_box = forms.text_box( parent=self.GetWin(), sizer=_mixer_level_sizer, value=self.mixer_level, callback=self.set_mixer_level, label='Mixer Level', converter=forms.float_converter(), proportion=0, ) self._mixer_level_slider = forms.slider( parent=self.GetWin(), sizer=_mixer_level_sizer, value=self.mixer_level, callback=self.set_mixer_level, minimum=0, maximum=5, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_mixer_level_sizer, 1, 1, 1, 1) _variable_slider_Audio_level_sizer = wx.BoxSizer(wx.VERTICAL) self._variable_slider_Audio_level_text_box = forms.text_box( parent=self.GetWin(), sizer=_variable_slider_Audio_level_sizer, value=self.variable_slider_Audio_level, callback=self.set_variable_slider_Audio_level, label='Audio Level', converter=forms.float_converter(), proportion=0, ) self._variable_slider_Audio_level_slider = forms.slider( parent=self.GetWin(), sizer=_variable_slider_Audio_level_sizer, value=self.variable_slider_Audio_level, callback=self.set_variable_slider_Audio_level, minimum=0, maximum=2, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_variable_slider_Audio_level_sizer, 1, 2, 1, 1) _variable_slider_0_sizer = wx.BoxSizer(wx.VERTICAL) self._variable_slider_0_text_box = forms.text_box( parent=self.GetWin(), sizer=_variable_slider_0_sizer, value=self.variable_slider_0, callback=self.set_variable_slider_0, label='TX Frequency', converter=forms.float_converter(), proportion=0, ) self._variable_slider_0_slider = forms.slider( parent=self.GetWin(), sizer=_variable_slider_0_sizer, value=self.variable_slider_0, callback=self.set_variable_slider_0, minimum=2.400e9, maximum=2.40035e9, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_variable_slider_0_sizer, 1, 3, 1, 1) _rf_gain_sizer = wx.BoxSizer(wx.VERTICAL) self._rf_gain_text_box = forms.text_box( parent=self.GetWin(), sizer=_rf_gain_sizer, value=self.rf_gain, callback=self.set_rf_gain, label='RF Gain', converter=forms.float_converter(), proportion=0, ) self._rf_gain_slider = forms.slider( parent=self.GetWin(), sizer=_rf_gain_sizer, value=self.rf_gain, callback=self.set_rf_gain, minimum=1, maximum=100, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_rf_gain_sizer, 0, 3, 1, 1) self.rational_resampler_xxx_1 = filter.rational_resampler_ccc( interpolation=2000000, decimation=192000, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=24, decimation=6, taps=None, fractional_bw=None, ) _modelation_amp_sizer = wx.BoxSizer(wx.VERTICAL) self._modelation_amp_text_box = forms.text_box( parent=self.GetWin(), sizer=_modelation_amp_sizer, value=self.modelation_amp, callback=self.set_modelation_amp, label='modelation Amp', converter=forms.float_converter(), proportion=0, ) self._modelation_amp_slider = forms.slider( parent=self.GetWin(), sizer=_modelation_amp_sizer, value=self.modelation_amp, callback=self.set_modelation_amp, minimum=0.1, maximum=10, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_modelation_amp_sizer, 2, 1, 1, 1) self.low_pass_filter_0 = filter.fir_filter_ccf( 1, firdes.low_pass(1, 192000, 3500, 1000, firdes.WIN_HAMMING, 6.76)) _if_gain_sizer = wx.BoxSizer(wx.VERTICAL) self._if_gain_text_box = forms.text_box( parent=self.GetWin(), sizer=_if_gain_sizer, value=self.if_gain, callback=self.set_if_gain, label='if_gain', converter=forms.float_converter(), proportion=0, ) self._if_gain_slider = forms.slider( parent=self.GetWin(), sizer=_if_gain_sizer, value=self.if_gain, callback=self.set_if_gain, minimum=1, maximum=100, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_if_gain_sizer) self.hilbert_fc_0 = filter.hilbert_fc(256, firdes.WIN_HAMMING, 6.76) (self.hilbert_fc_0).set_min_output_buffer(10) (self.hilbert_fc_0).set_max_output_buffer(10) self.blocks_wavfile_source_0 = blocks.wavfile_source( '/home/anton/gnuradio-grc-examples/test_audio.wav', True) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1, 48e3, True) self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex * 1) self.blocks_multiply_xx_0_0 = blocks.multiply_vcc(1) self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vcc( (variable_slider_Audio_level_0, )) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff( (variable_slider_Audio_level_0, )) _bb_gain_sizer = wx.BoxSizer(wx.VERTICAL) self._bb_gain_text_box = forms.text_box( parent=self.GetWin(), sizer=_bb_gain_sizer, value=self.bb_gain, callback=self.set_bb_gain, label='BB Gain', converter=forms.float_converter(), proportion=0, ) self._bb_gain_slider = forms.slider( parent=self.GetWin(), sizer=_bb_gain_sizer, value=self.bb_gain, callback=self.set_bb_gain, minimum=1, maximum=59, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_bb_gain_sizer, 2, 2, 1, 1) self.analog_sig_source_x_0 = analog.sig_source_c( samp_rate, analog.GR_COS_WAVE, 192e3, mixer_level, 0) _Audio_freq_sizer = wx.BoxSizer(wx.VERTICAL) self._Audio_freq_text_box = forms.text_box( parent=self.GetWin(), sizer=_Audio_freq_sizer, value=self.Audio_freq, callback=self.set_Audio_freq, label='Audio freq', converter=forms.float_converter(), proportion=0, ) self._Audio_freq_slider = forms.slider( parent=self.GetWin(), sizer=_Audio_freq_sizer, value=self.Audio_freq, callback=self.set_Audio_freq, minimum=100, maximum=2000, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_Audio_freq_sizer, 0, 2, 1, 1) ################################################## # Connections ################################################## self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.blocks_null_sink_0, 0)) self.connect((self.blocks_multiply_xx_0_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.blocks_throttle_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.hilbert_fc_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.blocks_multiply_xx_0_0, 1)) self.connect((self.rational_resampler_xxx_0, 0), (self.hilbert_fc_0, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.blocks_multiply_const_vxx_0_0, 0))
def __init__(self, baudrate=1200.0, raw_file='', udp_dest_audio='127.0.0.1', udp_dest_iq='127.0.0.1', udp_port_audio=7355, udp_port_iq=7356): gr.top_block.__init__(self, "satnogs raw to udp") ################################################## # Parameters ################################################## self.baudrate = baudrate self.raw_file = raw_file self.udp_dest_audio = udp_dest_audio self.udp_dest_iq = udp_dest_iq self.udp_port_audio = udp_port_audio self.udp_port_iq = udp_port_iq ################################################## # Variables ################################################## self.sps = sps = 4 self.audio_samp_rate = audio_samp_rate = 48000 self.if_freq = if_freq = 12000 self.decimation = decimation = satnogs.find_decimation( baudrate, 2, audio_samp_rate, sps) ################################################## # Blocks ################################################## self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_ccf( audio_samp_rate / (baudrate * decimation), taps=None, flt_size=32) self.pfb_arb_resampler_xxx_0.declare_sample_delay(0) self.low_pass_filter_0_0 = filter.fir_filter_ccf( 1, firdes.low_pass(1, audio_samp_rate, 0.42 * audio_samp_rate / 2.0, 0.05 * audio_samp_rate, firdes.WIN_HAMMING, 6.76)) self.blocks_udp_sink_0_0 = blocks.udp_sink(gr.sizeof_short * 1, udp_dest_iq, udp_port_iq, 1472, True) self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_short * 1, udp_dest_audio, udp_port_audio, 1472, True) self.blocks_throttle_1 = blocks.throttle(gr.sizeof_gr_complex * 1, baudrate * decimation, True) self.blocks_rotator_cc_0_0 = blocks.rotator_cc( 2.0 * math.pi * (if_freq / audio_samp_rate)) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_cc(16383) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_cc(1 / 16768) self.blocks_interleaved_short_to_complex_0 = blocks.interleaved_short_to_complex( False, False) self.blocks_float_to_short_0 = blocks.float_to_short(1, 16383.0) self.blocks_file_source_0 = blocks.file_source(gr.sizeof_short * 1, raw_file, False, 0, 0) self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL) self.blocks_complex_to_real_0 = blocks.complex_to_real(1) self.blocks_complex_to_interleaved_short_0 = blocks.complex_to_interleaved_short( False) self.analog_agc2_xx_0_1 = analog.agc2_cc(1e-3, 1e-3, 0.5, 1.0) self.analog_agc2_xx_0_1.set_max_gain(65536) self.analog_agc2_xx_0_0 = analog.agc2_cc(0.01, 0.001, 0.015, 1.0) self.analog_agc2_xx_0_0.set_max_gain(65536) self.analog_agc2_xx_0 = analog.agc2_cc(1e-2, 1e-3, 1.5e-2, 1.0) self.analog_agc2_xx_0.set_max_gain(65536) ################################################## # Connections ################################################## self.connect((self.analog_agc2_xx_0, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.analog_agc2_xx_0_0, 0), (self.low_pass_filter_0_0, 0)) self.connect((self.analog_agc2_xx_0_1, 0), (self.pfb_arb_resampler_xxx_0, 0)) self.connect((self.blocks_complex_to_interleaved_short_0, 0), (self.blocks_udp_sink_0_0, 0)) self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_float_to_short_0, 0)) self.connect((self.blocks_file_source_0, 0), (self.blocks_interleaved_short_to_complex_0, 0)) self.connect((self.blocks_float_to_short_0, 0), (self.blocks_udp_sink_0, 0)) self.connect((self.blocks_interleaved_short_to_complex_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_throttle_1, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_complex_to_interleaved_short_0, 0)) self.connect((self.blocks_rotator_cc_0_0, 0), (self.blocks_complex_to_real_0, 0)) self.connect((self.blocks_throttle_1, 0), (self.analog_agc2_xx_0, 0)) self.connect((self.blocks_throttle_1, 0), (self.analog_agc2_xx_0_1, 0)) self.connect((self.low_pass_filter_0_0, 0), (self.blocks_rotator_cc_0_0, 0)) self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.analog_agc2_xx_0_0, 0))
def __init__(self): gr.top_block.__init__(self, "Konzerv Rx Atan") Qt.QWidget.__init__(self) self.setWindowTitle("Konzerv Rx Atan") try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "konzerv_rx_atan") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 1800000 self.center_freq = center_freq = 0 self.audio_rate = audio_rate = 44100 ################################################## # Blocks ################################################## self._center_freq_range = Range(-samp_rate / 2, samp_rate / 2, 1, 0, 200) self._center_freq_win = RangeWidget(self._center_freq_range, self.set_center_freq, "center_freq", "counter_slider", float) self.top_layout.addWidget(self._center_freq_win) self.qtgui_waterfall_sink_x_1 = qtgui.waterfall_sink_f( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "Demod signal", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_1.set_update_time(0.10) self.qtgui_waterfall_sink_x_1.enable_grid(False) if not True: self.qtgui_waterfall_sink_x_1.disable_legend() if "float" == "float" or "float" == "msg_float": self.qtgui_waterfall_sink_x_1.set_plot_pos_half(not True) labels = ["", "", "", "", "", "", "", "", "", ""] colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_1.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_1.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_1.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_1.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_1_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_waterfall_sink_x_1_win) self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype 0, #fc samp_rate, #bw "Rx signal", #name 1 #number of inputs ) self.qtgui_waterfall_sink_x_0.set_update_time(0.10) self.qtgui_waterfall_sink_x_0.enable_grid(False) if not True: self.qtgui_waterfall_sink_x_0.disable_legend() if "complex" == "float" or "complex" == "msg_float": self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True) labels = ["", "", "", "", "", "", "", "", "", ""] colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_waterfall_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i]) self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i]) self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i]) self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10) self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance( self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_waterfall_sink_x_0_win) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc( 1, (firdes.low_pass(1.0, samp_rate, 1.5e5, 1e4)), center_freq, samp_rate) self.fir_filter_xxx_0 = filter.fir_filter_fff( samp_rate / audio_rate, (firdes.low_pass(1.0, samp_rate, audio_rate / 2 - 1000, 1000))) self.fir_filter_xxx_0.declare_sample_delay(0) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate, True) self.blocks_sub_xx_0 = blocks.sub_cc(1) self.blocks_multiply_xx_1 = blocks.multiply_vff(1) self.blocks_multiply_xx_0 = blocks.multiply_vff(1) self.blocks_file_source_0 = blocks.file_source( gr.sizeof_gr_complex * 1, "/home/mero/kafu/grc_demo_2021/konzerv.iq", True) self.blocks_divide_xx_0 = blocks.divide_ff(1) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1, 1) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.blocks_complex_to_float_1 = blocks.complex_to_float(1) self.blocks_complex_to_float_0 = blocks.complex_to_float(1) self.blocks_add_xx_0 = blocks.add_vff(1) self.audio_sink_0 = audio.sink(audio_rate, "", True) ################################################## # Connections ################################################## self.connect((self.blocks_add_xx_0, 0), (self.blocks_divide_xx_0, 0)) self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_multiply_xx_1, 0)) self.connect((self.blocks_complex_to_float_1, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_complex_to_float_1, 1), (self.blocks_multiply_xx_1, 1)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_divide_xx_0, 1)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.qtgui_waterfall_sink_x_1, 0)) self.connect((self.blocks_delay_0, 0), (self.blocks_sub_xx_0, 1)) self.connect((self.blocks_divide_xx_0, 0), (self.fir_filter_xxx_0, 0)) self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_sub_xx_0, 0), (self.blocks_complex_to_float_1, 0)) self.connect((self.blocks_throttle_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.qtgui_waterfall_sink_x_0, 0)) self.connect((self.fir_filter_xxx_0, 0), (self.audio_sink_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_complex_to_float_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_delay_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_sub_xx_0, 0))
def set_audio_rate(self, audio_rate): self.audio_rate = audio_rate self.fir_filter_xxx_0.set_taps( (firdes.low_pass(1.0, self.samp_rate, self.audio_rate / 2 - 1000, 1000)))
def make_audio_filter(): return grfilter.fir_filter_fff( stereo_rate // self.__audio_int_rate, # decimation firdes.low_pass(1.0, stereo_rate, 15000, 5000, firdes.WIN_HAMMING))
def __init__(self): gr.top_block.__init__(self, "RTLSDR NOAA APT Receiver V1.0.0") ############################################################### # Variables - added for Raspberry-Noaa-V2 manually after export ############################################################### # get some variables in place for inputs # # Arguments: # 1. Full path and name of stream file (including file extension) # 2. Gain to be used # 3. Frequency (in Mhz) # 4. Frequency offset (PPM) # 5. SDR Device ID from settings.yml (for RTL-SDR source block) # 6. Bias-T (0/1 for RTL-SDR) stream_name = sys.argv[1] gain = float(sys.argv[2]) import decimal freq = int( decimal.Decimal(sys.argv[3].strip("M")) * decimal.Decimal(1000000)) freq_offset = int(sys.argv[4]) sdr_dev_id = sys.argv[5] bias_t_string = sys.argv[6] bias_t = "1" if not bias_t_string: bias_t = "0" ################################################## # Variables ################################################## self.trans = trans = 25000 self.samp_rate = samp_rate = 1920000 self.recfile = recfile = stream_name self.fcd_freq = fcd_freq = freq self.cutoff = cutoff = 75000 self.centre_freq = centre_freq = 0 ############################################################### # Blocks - note the fcd_freq, freq_offset rtl device, bias-t and gain are carried # in from settings.yml using the 'variables' block above. # NOTE: If you edit and replace this .py in gnucomposer # these will be overwritten with hard-coded values and # need to be manually reintroduced to make the script take # settings from your own settings.yml. ################################################################ self.rtlsdr_source_0 = osmosdr.source(args='numchan=' + str(1) + ' ' + 'rtl=' + str(sdr_dev_id) + ',bias=' + bias_t + '') self.rtlsdr_source_0.set_sample_rate(samp_rate) self.rtlsdr_source_0.set_center_freq(fcd_freq, 0) self.rtlsdr_source_0.set_freq_corr(freq_offset, 0) self.rtlsdr_source_0.set_dc_offset_mode(0, 0) self.rtlsdr_source_0.set_iq_balance_mode(0, 0) self.rtlsdr_source_0.set_gain_mode(False, 0) self.rtlsdr_source_0.set_gain(gain, 0) self.rtlsdr_source_0.set_if_gain(20, 0) self.rtlsdr_source_0.set_bb_gain(20, 0) self.rtlsdr_source_0.set_antenna('', 0) self.rtlsdr_source_0.set_bandwidth(0, 0) self.rational_resampler_xxx_1 = filter.rational_resampler_fff( interpolation=1, decimation=4, taps=None, fractional_bw=None, ) self.rational_resampler_xxx_0 = filter.rational_resampler_fff( interpolation=441, decimation=192, taps=None, fractional_bw=None, ) self.low_pass_filter_0 = filter.fir_filter_ccf( 20, firdes.low_pass(1, samp_rate, cutoff, trans, firdes.WIN_HAMMING, 6.76)) self.gr_wavfile_sink_0_0_0_0 = blocks.wavfile_sink( recfile, 1, 11025, 16) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((0.7, )) self.blks2_wfm_rcv_0 = analog.wfm_rcv( quad_rate=96000, audio_decimation=5, ) ################################################## # Connections ################################################## self.connect((self.blks2_wfm_rcv_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.gr_wavfile_sink_0_0_0_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.blks2_wfm_rcv_0, 0)) self.connect((self.rational_resampler_xxx_0, 0), (self.rational_resampler_xxx_1, 0)) self.connect((self.rational_resampler_xxx_1, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.low_pass_filter_0, 0))
def __init__(self, freq_tx, freq_rx, gain, fname): gr.top_block.__init__(self, "Repeater") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 200000 self.gain_tx = gain_tx = gain self.gain_rx = gain_rx = 15 self.freq_tx = freq_tx self.freq_rx = freq_rx self.fname = fname ################################################## # Message Queues ################################################## blocks_message_sink_0_msgq_out = blocks_message_source_0_msgq_in = gr.msg_queue( 2) ################################################## # Blocks ################################################## self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("addr=192.168.10.2", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(freq_rx, 0) self.uhd_usrp_source_0.set_gain(gain_rx, 0) self.uhd_usrp_source_0.set_antenna('TX/RX', 0) self.uhd_usrp_source_0.set_bandwidth(10e6, 0) self.uhd_usrp_sink_0 = uhd.usrp_sink( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_center_freq(freq_tx, 0) self.uhd_usrp_sink_0.set_gain(gain_tx, 0) self.uhd_usrp_sink_0.set_antenna('TX/RX', 0) self.uhd_usrp_sink_0.set_bandwidth(10e6, 0) self.low_pass_filter_0 = filter.fir_filter_ccf( 1, firdes.low_pass(1, samp_rate, samp_rate / 2 - 2e3, (samp_rate / 2 - 2e3) / 4, firdes.WIN_HAMMING, 6.76)) self.digital_gmsk_mod_0 = digital.gmsk_mod( samples_per_symbol=2, bt=0.35, verbose=False, log=False, ) self.digital_gmsk_demod_0 = digital.gmsk_demod( samples_per_symbol=2, gain_mu=0.175, mu=0.5, omega_relative_limit=0.005, freq_error=0.0, verbose=False, log=False, ) self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc((1, )) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((1, )) self.blocks_message_source_0 = blocks.message_source( gr.sizeof_char * 1, blocks_message_source_0_msgq_in) self.blocks_message_sink_0 = blocks.message_sink( gr.sizeof_char * 1, blocks_message_sink_0_msgq_out, False) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1, fname, True) self.blocks_file_sink_0.set_unbuffered(True) self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b( grc_blks2.packet_encoder( samples_per_symbol=2, bits_per_symbol=1, preamble='', access_code='', pad_for_usrp=True, ), payload_length=0, ) self.blks2_packet_decoder_0 = grc_blks2.packet_demod_b( grc_blks2.packet_decoder( access_code='', threshold=-1, callback=lambda ok, payload: self.blks2_packet_decoder_0. recv_pkt(ok, payload), ), ) ################################################## # Connections ################################################## self.connect((self.blks2_packet_decoder_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.blks2_packet_decoder_0, 0), (self.blocks_message_sink_0, 0)) self.connect((self.blks2_packet_encoder_0, 0), (self.digital_gmsk_mod_0, 0)) self.connect((self.blocks_message_source_0, 0), (self.blks2_packet_encoder_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.blocks_multiply_const_vxx_1, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.digital_gmsk_demod_0, 0), (self.blks2_packet_decoder_0, 0)) self.connect((self.digital_gmsk_mod_0, 0), (self.blocks_multiply_const_vxx_1, 0)) self.connect((self.low_pass_filter_0, 0), (self.digital_gmsk_demod_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_multiply_const_vxx_0, 0))