Esempio n. 1
0
    def __init__(self):
        gr.top_block.__init__(self, "Elster Rx Nogui")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 2400000
        self.rx_gain = rx_gain = 45
        self.corr = corr = 0
        self.channel_rate = channel_rate = 400000
        self.channel_decimation = channel_decimation = 4
        self.center_freq = center_freq = 904600000

        ##################################################
        # Blocks
        ##################################################
        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(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(0, 0)
        self.osmosdr_source_0.set_gain(rx_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(channel_decimation, firdes.low_pass(
        	1, channel_rate, 20000, 5000, firdes.WIN_HAMMING, 6.76))
        self.elster_packetize_0 = elster.packetize(1)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(channel_rate * 56.48E-6 / 2 / channel_decimation, 0.25*(0.05*0.05), 0.5, 0.05, 0.005)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(gr.sizeof_gr_complex*1, samp_rate/channel_rate)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(-channel_rate/(115000*2*3.1416))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.osmosdr_source_0, 0), (self.blocks_keep_one_in_n_0, 0))
        self.connect((self.blocks_keep_one_in_n_0, 0), (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0, 0), (self.low_pass_filter_1, 0))
        self.connect((self.low_pass_filter_1, 0), (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0), (self.elster_packetize_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Elster Rx Multi")

        ##################################################
        # Variables
        ##################################################
        self.window_size = window_size = (800, 600)
        self.samp_rate = samp_rate = 2400000
        self.rx_gain = rx_gain = 45
        self.corr = corr = 0
        self.channel_rate = channel_rate = 400000
        self.channel_decimation = channel_decimation = 4
        self.ch_filt_trans = ch_filt_trans = 10000
        self.ch_filt_cut = ch_filt_cut = 35000
        self.center_freq = center_freq = 904600000

        ##################################################
        # Blocks
        ##################################################
        self.nb = self.nb = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Band spectrum")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Band waterfall")
        self.Add(self.nb)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
            self.nb.GetPage(1).GetWin(),
            baseband_freq=center_freq,
            dynamic_range=50,
            ref_level=-30,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='Waterfall Plot',
            size=(window_size),
        )
        self.nb.GetPage(1).Add(self.wxgui_waterfallsink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.nb.GetPage(0).GetWin(),
            baseband_freq=center_freq,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=512,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='FFT Plot',
            peak_hold=True,
            size=(window_size),
        )
        self.nb.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.uhd_usrp_source_0 = uhd.usrp_source(
            ",".join(("", "")),
            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(uhd.tune_request(center_freq),
                                               0)
        self.uhd_usrp_source_0.set_gain(rx_gain, 0)
        self.uhd_usrp_source_0.set_antenna('RX2', 0)
        self.pfb_channelizer_ccf_0 = pfb.channelizer_ccf(
            samp_rate / channel_rate, (firdes.low_pass(
                1, samp_rate, 175000, 50000, firdes.WIN_HAMMING, 6.76)), 1.0,
            100)
        self.pfb_channelizer_ccf_0.set_channel_map(([]))
        self.pfb_channelizer_ccf_0.declare_sample_delay(0)

        self.elster_packetize_0 = elster.packetize(6)
        self.digital_pfb_clock_sync_xxx_0_0_2 = digital.pfb_clock_sync_fff(
            channel_rate * 56.48E-6 / 2, 2 * 3.1416 / 100,
            (firdes.root_raised_cosine(32, 32 * (channel_rate * 56.48E-6 / 2),
                                       1.0, 0.35, 11 * 32 * 6)), 32, 16, 1.5,
            1)
        self.digital_pfb_clock_sync_xxx_0_0_1 = digital.pfb_clock_sync_fff(
            channel_rate * 56.48E-6 / 2, 2 * 3.1416 / 100,
            (firdes.root_raised_cosine(32, 32 * (channel_rate * 56.48E-6 / 2),
                                       1.0, 0.35, 11 * 32 * 6)), 32, 16, 1.5,
            1)
        self.digital_pfb_clock_sync_xxx_0_0_0_1 = digital.pfb_clock_sync_fff(
            channel_rate * 56.48E-6 / 2, 2 * 3.1416 / 100,
            (firdes.root_raised_cosine(32, 32 * (channel_rate * 56.48E-6 / 2),
                                       1.0, 0.35, 11 * 32 * 6)), 32, 16, 1.5,
            1)
        self.digital_pfb_clock_sync_xxx_0_0_0_0 = digital.pfb_clock_sync_fff(
            channel_rate * 56.48E-6 / 2, 2 * 3.1416 / 100,
            (firdes.root_raised_cosine(32, 32 * (channel_rate * 56.48E-6 / 2),
                                       1.0, 0.35, 11 * 32 * 6)), 32, 16, 1.5,
            1)
        self.digital_pfb_clock_sync_xxx_0_0_0 = digital.pfb_clock_sync_fff(
            channel_rate * 56.48E-6 / 2, 2 * 3.1416 / 100,
            (firdes.root_raised_cosine(32, 32 * (channel_rate * 56.48E-6 / 2),
                                       1.0, 0.35, 11 * 32 * 6)), 32, 16, 1.5,
            1)
        self.digital_pfb_clock_sync_xxx_0_0 = digital.pfb_clock_sync_fff(
            channel_rate * 56.48E-6 / 2, 2 * 3.1416 / 100,
            (firdes.root_raised_cosine(32, 32 * (channel_rate * 56.48E-6 / 2),
                                       1.0, 0.35, 11 * 32 * 6)), 32, 16, 1.5,
            1)
        self.digital_binary_slicer_fb_0_4 = digital.binary_slicer_fb()
        self.digital_binary_slicer_fb_0_3 = digital.binary_slicer_fb()
        self.digital_binary_slicer_fb_0_2 = digital.binary_slicer_fb()
        self.digital_binary_slicer_fb_0_1 = digital.binary_slicer_fb()
        self.digital_binary_slicer_fb_0_0 = digital.binary_slicer_fb()
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        _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=-100,
            maximum=100,
            num_steps=200,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_corr_sizer)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, -200000, 1, 0)
        self.analog_quadrature_demod_cf_0_4 = analog.quadrature_demod_cf(
            channel_rate / (115000 * 2 * 3.1416))
        self.analog_quadrature_demod_cf_0_3 = analog.quadrature_demod_cf(
            channel_rate / (115000 * 2 * 3.1416))
        self.analog_quadrature_demod_cf_0_2 = analog.quadrature_demod_cf(
            channel_rate / (115000 * 2 * 3.1416))
        self.analog_quadrature_demod_cf_0_1 = analog.quadrature_demod_cf(
            channel_rate / (115000 * 2 * 3.1416))
        self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf(
            channel_rate / (115000 * 2 * 3.1416))
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(
            channel_rate / (115000 * 2 * 3.1416))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_quadrature_demod_cf_0, 0),
                     (self.digital_pfb_clock_sync_xxx_0_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0_0, 0),
                     (self.digital_pfb_clock_sync_xxx_0_0_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0_1, 0),
                     (self.digital_pfb_clock_sync_xxx_0_0_1, 0))
        self.connect((self.analog_quadrature_demod_cf_0_2, 0),
                     (self.digital_pfb_clock_sync_xxx_0_0_0_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0_3, 0),
                     (self.digital_pfb_clock_sync_xxx_0_0_2, 0))
        self.connect((self.analog_quadrature_demod_cf_0_4, 0),
                     (self.digital_pfb_clock_sync_xxx_0_0_0_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.pfb_channelizer_ccf_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.elster_packetize_0, 0))
        self.connect((self.digital_binary_slicer_fb_0_0, 0),
                     (self.elster_packetize_0, 1))
        self.connect((self.digital_binary_slicer_fb_0_1, 0),
                     (self.elster_packetize_0, 2))
        self.connect((self.digital_binary_slicer_fb_0_2, 0),
                     (self.elster_packetize_0, 3))
        self.connect((self.digital_binary_slicer_fb_0_3, 0),
                     (self.elster_packetize_0, 4))
        self.connect((self.digital_binary_slicer_fb_0_4, 0),
                     (self.elster_packetize_0, 5))
        self.connect((self.digital_pfb_clock_sync_xxx_0_0, 0),
                     (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0_0_0, 0),
                     (self.digital_binary_slicer_fb_0_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0_0_0_0, 0),
                     (self.digital_binary_slicer_fb_0_2, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0_0_0_1, 0),
                     (self.digital_binary_slicer_fb_0_4, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0_0_1, 0),
                     (self.digital_binary_slicer_fb_0_1, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0_0_2, 0),
                     (self.digital_binary_slicer_fb_0_3, 0))
        self.connect((self.pfb_channelizer_ccf_0, 0),
                     (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.pfb_channelizer_ccf_0, 1),
                     (self.analog_quadrature_demod_cf_0_0, 0))
        self.connect((self.pfb_channelizer_ccf_0, 2),
                     (self.analog_quadrature_demod_cf_0_1, 0))
        self.connect((self.pfb_channelizer_ccf_0, 3),
                     (self.analog_quadrature_demod_cf_0_2, 0))
        self.connect((self.pfb_channelizer_ccf_0, 4),
                     (self.analog_quadrature_demod_cf_0_3, 0))
        self.connect((self.pfb_channelizer_ccf_0, 5),
                     (self.analog_quadrature_demod_cf_0_4, 0))
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.wxgui_waterfallsink2_0, 0))
Esempio n. 3
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Elster Rx")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.window_size = window_size = (800,600)
        self.samp_rate = samp_rate = 2400000
        self.rx_gain = rx_gain = 45
        self.corr = corr = 0
        self.channel_rate = channel_rate = 400000
        self.channel_decimation = channel_decimation = 4
        self.center_freq = center_freq = 904600000

        ##################################################
        # Blocks
        ##################################################
        self.nb = self.nb = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Band spectrum")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Band waterfall")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "1-channel waterfall")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Scope")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Bit stream")
        self.Add(self.nb)
        _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=-100,
        	maximum=100,
        	num_steps=200,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_corr_sizer)
        self.wxgui_waterfallsink2_1 = waterfallsink2.waterfall_sink_c(
        	self.nb.GetPage(2).GetWin(),
        	baseband_freq=0,
        	dynamic_range=50,
        	ref_level=-30,
        	ref_scale=2.0,
        	sample_rate=channel_rate,
        	fft_size=512,
        	fft_rate=30,
        	average=False,
        	avg_alpha=None,
        	title="Waterfall Plot",
        	size=(window_size),
        )
        self.nb.GetPage(2).Add(self.wxgui_waterfallsink2_1.win)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
        	self.nb.GetPage(1).GetWin(),
        	baseband_freq=center_freq,
        	dynamic_range=50,
        	ref_level=-30,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Waterfall Plot",
        	size=(window_size),
        )
        self.nb.GetPage(1).Add(self.wxgui_waterfallsink2_0.win)
        self.wxgui_scopesink2_1 = scopesink2.scope_sink_f(
        	self.nb.GetPage(4).GetWin(),
        	title="Scope Plot",
        	sample_rate=2/56.48E-6,
        	v_scale=0.5,
        	v_offset=1,
        	t_scale=8*56.48E-6,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        	size=(window_size),
        )
        self.nb.GetPage(4).Add(self.wxgui_scopesink2_1.win)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.nb.GetPage(3).GetWin(),
        	title="Scope Plot",
        	sample_rate=channel_rate/4,
        	v_scale=0.4,
        	v_offset=0,
        	t_scale=56.48E-6 *8,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        	size=(window_size),
        )
        self.nb.GetPage(3).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.nb.GetPage(0).GetWin(),
        	baseband_freq=center_freq,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=512,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=True,
        	size=(window_size),
        )
        self.nb.GetPage(0).Add(self.wxgui_fftsink2_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(center_freq, 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(0, 0)
        self.osmosdr_source_0.set_gain(rx_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(channel_decimation, firdes.low_pass(
        	1, channel_rate, 20000, 5000, firdes.WIN_HAMMING, 6.76))
        self.elster_packetize_0 = elster.packetize(1)
        self.digital_correlate_access_code_bb_0 = digital.correlate_access_code_bb("1010101010101010101010101010101001010101101001011001101010100110", 0)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(channel_rate * 56.48E-6 / 2 / channel_decimation, 0.25*(0.05*0.05), 0.5, 0.05, 0.005)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.blocks_uchar_to_float_0 = blocks.uchar_to_float()
        self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(gr.sizeof_gr_complex*1, samp_rate/channel_rate)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(-channel_rate/(115000*2*3.1416))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_uchar_to_float_0, 0), (self.wxgui_scopesink2_1, 0))
        self.connect((self.digital_correlate_access_code_bb_0, 0), (self.blocks_uchar_to_float_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_correlate_access_code_bb_0, 0))
        self.connect((self.low_pass_filter_1, 0), (self.wxgui_scopesink2_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0, 0), (self.low_pass_filter_1, 0))
        self.connect((self.low_pass_filter_1, 0), (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.blocks_keep_one_in_n_0, 0), (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.blocks_keep_one_in_n_0, 0), (self.wxgui_waterfallsink2_1, 0))
        self.connect((self.osmosdr_source_0, 0), (self.wxgui_waterfallsink2_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.blocks_keep_one_in_n_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0), (self.elster_packetize_0, 0))