Beispiel #1
0
    def test_002_t(self):
        # set up fg
        analog_random_source = blocks.vector_source_b(
            map(int, numpy.random.randint(0, 2, 1000)), True)

        digital_ofdm = grc_blks2.packet_mod_b(
            digital.ofdm_mod(options=grc_blks2.options(
                modulation="bpsk",
                fft_length=256,
                occupied_tones=200,
                cp_length=128,
                pad_for_usrp=True,
                log=None,
                verbose=None,
            ), ),
            payload_length=0,
        )

        head = blocks.head(gr.sizeof_gr_complex, 256)
        DUT = hydra.hydra_sink(1, 256, 100e3, 200e3, ((100e3, 200e3), ))
        sink = blocks.vector_sink_c(1)
        sink = blocks.vector_sink_c(1)

        self.tb.connect(analog_random_source, digital_ofdm, head, sink)
        self.tb.start()
        import time
        time.sleep(1)
        self.tb.stop()
        print sink.data()[0:255]
Beispiel #2
0
    def device_definition(options):
        """
        Definition of the devices used in the program.
        @param options
        """

        tb = OpERAFlow(name="US")

        bits_per_symbol = 2
        modulator = grc_blks2.packet_mod_b(
            digital.ofdm_mod(
                options=grc_blks2.options(
                    modulation="bpsk",
                    fft_length=512,
                    occupied_tones=200,
                    cp_length=128,
                    pad_for_usrp=True,
                    log=None,
                    verbose=None,
                )
            ),
            payload_length=0,
        )

        uhd_source = UHDSourceDummy(modulator=modulator, f=change_status_fun)
        uhd_source.pre_connect(tb)  # Gambi
        the_source = AWGNChannel(bits_per_symbol=bits_per_symbol, component=uhd_source)

        algorithm = None
        if options.sensing == "ed":
            sensing = EnergySSArch(fft_size=1024, mavg_size=1)

            algorithm = EnergyDecision(options.th)
            sink = EnergyDetector(1024, algorithm)
        elif options.sensing == "wfd":
            sensing = WaveformSSArch(fft_size=1024)

            algorithm = WaveformDecision(options.th)
            sink = WaveformDetector(1024, algorithm)
        elif options.sensing == "cfd":
            sensing = CycloSSArch(64, 16, 4)

            from sensing import CycloDecision

            algorithm = CycloDecision(64, 16, 4, options.th)
            sink = CycloDetector(64, 16, 4, algorithm)
        else:
            raise AttributeError

        radio = RadioDevice(name="radio")
        radio.add_arch(source=the_source, arch=sensing, sink=sink, uhd_device=uhd_source, name="sensing")

        tb.add_radio(radio, "radio")

        return tb, radio, algorithm
Beispiel #3
0
	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.samp_rate = samp_rate = 1000

		##################################################
		# Blocks
		##################################################
		self.blks2_ofdm_mod_0 = grc_blks2.packet_mod_b(blks2.ofdm_mod(
				options=grc_blks2.options(
					modulation="bpsk",
					fft_length=1024,
					occupied_tones=256,
					cp_length=512,
					pad_for_usrp=True,
					log=None,
					verbose=None,
				),
			),
			payload_length=0,
		)
		self.gr_float_to_char_0 = gr.float_to_char()
		self.gr_sig_source_x_0 = gr.sig_source_f(samp_rate, gr.GR_SIN_WAVE, 100, 127, 0)
		self.gr_throttle_0 = gr.throttle(gr.sizeof_char*1, samp_rate)
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
			self.GetWin(),
			baseband_freq=0,
			y_per_div=10,
			y_divs=10,
			ref_level=50,
			ref_scale=2.0,
			sample_rate=samp_rate*1000,
			fft_size=1024,
			fft_rate=30,
			average=False,
			avg_alpha=None,
			title="FFT Plot",
			peak_hold=False,
		)
		self.Add(self.wxgui_fftsink2_0.win)

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_throttle_0, 0), (self.blks2_ofdm_mod_0, 0))
		self.connect((self.gr_sig_source_x_0, 0), (self.gr_float_to_char_0, 0))
		self.connect((self.gr_float_to_char_0, 0), (self.gr_throttle_0, 0))
		self.connect((self.blks2_ofdm_mod_0, 0), (self.wxgui_fftsink2_0, 0))
 def _build(self, input_signature, output_signature):
     """
     @param input_signature The input signature.
     @param output_signature The output signature.
     """
     return grc_blks2.packet_mod_f(digital.ofdm_mod(options=grc_blks2.options(modulation="bpsk",
                                                                              fft_length=512,
                                                                              occupied_tones=200,
                                                                              cp_length=128,
                                                                              pad_for_usrp=True,
                                                                              log=None,
                                                                              verbose=None)),
                                   payload_length=0,
                                   )
    def __init__(self, options):
        gr.top_block.__init__(self, name = "top_block")


        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1e6
        self.fft_len = fft_len = options.fft_length
        self.ebn0 = ebn0 = options.ebn0
        self.cp_len = cp_len = options.cp_length
        self.bits_per_symbol = bits_per_symbol = 8

        ##################################################
        # Blocks
        ##################################################
        self.digital_ofdm_mod_0 = grc_blks2.packet_mod_i(digital.ofdm_mod(
        		options=grc_blks2.options(
        			modulation="qam256",
        			fft_length=fft_len,
        			occupied_tones=40,
        			cp_length=cp_len,
        			pad_for_usrp=True,
        			log=None,
        			verbose=None,
        		),
        	),
        	payload_length=0,
        )
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate)
        self.blocks_skiphead_0 = blocks.skiphead(gr.sizeof_gr_complex*1, (fft_len+cp_len)*1)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex*1, "./%d_%d_%d_%d_%s.bin" % (fft_len, cp_len, options.ebn0, options.it, options.type), False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.analog_random_source_x_0 = blocks.vector_source_i(map(int, numpy.random.randint(0, 2, 1000)), True)
        self.analog_noise_source_x_0 = analog.noise_source_c(analog.GR_GAUSSIAN, 1.0 / math.sqrt(2.0 * bits_per_symbol * 10**(ebn0/10.0)), 0)

        self.channels_selective_fading_model_0 = channels.selective_fading_model( 8, 10.0/samp_rate, False, 4.0, 0, options.delay, options.mag, 128 )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_throttle_0, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.analog_random_source_x_0, 0), (self.digital_ofdm_mod_0, 0))
        self.connect((self.digital_ofdm_mod_0, 0), (self.channels_selective_fading_model_0, 0))
        self.connect((self.blocks_skiphead_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_skiphead_0, 0))
        self.connect((self.channels_selective_fading_model_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.analog_noise_source_x_0, 0), (self.blocks_add_xx_0, 1))
Beispiel #6
0
    def device_definition(options):
        """
        Definition of the devices used in the program.
        @param options
        """

        tb = OpERAFlow(name='US')
	bits_per_symbol = 2

        modulator = grc_blks2.packet_mod_b(digital.ofdm_mod(
        		options=grc_blks2.options(
        			modulation="bpsk",
        			fft_length=512,
        			occupied_tones=200,
        			cp_length=128,
        			pad_for_usrp=True,
        			log=None,
        			verbose=None,
        		),
        	),
        	payload_length=0,
        )

        uhd_source = UHDSourceDummy(modulator=modulator)
        uhd_source.pre_connect(tb)  # Gambi
        the_source = AWGNChannel(component=uhd_source, bits_per_symbol = bits_per_symbol)

        arch1 = EnergySSArch(fft_size=1024, mavg_size=1)
        algo1 = EnergyDecision(options.th['ed'])

        if options.sensing == "wfd":
            arch2 = WaveformSSArch(fft_size=1024)
            algo2 = WaveformDecision(options.th['wfd'])
        elif options.sensing == 'cfd':
            arch2 = CycloSSArch(64, 16, 4)
	    from sensing import CycloDecision
            algo2 = CycloDecision(64, 16, 4, options.th['cfd'])
	else:
		raise AttributeError

        hier = HierarchicalSSArch(1024, algo1=algo1, algo2=algo2)

        radio = RadioDevice(name="radio")
        radio.add_arch(source=the_source, arch=arch1,   sink=(hier, 0), uhd_device=uhd_source, name='ed')
        radio.add_arch(source=the_source, arch=arch2,   sink=(hier, 1), uhd_device=uhd_source, name='sensing')
        tb.add_radio(radio, "radio")

        return tb, radio, algo1, algo1
 def _build(self, callback, input_signature, output_signature):
     """
     Implementation of UHDRxPktArch abstract method.
     @param callback Function called when a packet is received.
     @param input_signature A gr.io_signature instance.
     @param output_signature A gr.io_signature instance.
     """
     return digital.ofdm_demod(options=grc_blks2.options(modulation="qam64",
                                                         fft_length=512,
                                                         occupied_tones=200,
                                                         cp_length=128,
                                                         snr=30,
                                                         log=None,
                                                         verbose=None,
                                                         ),
                               callback=callback)
Beispiel #8
0
	def __init__(self):
		gr.top_block.__init__(self, "Top Block")

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 150000

		##################################################
		# Blocks
		##################################################
		self.uhd_usrp_sink_0 = uhd.usrp_sink(
			device_addr="serial=4a54d7c8",
			stream_args=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(60000, 0)
		self.uhd_usrp_sink_0.set_gain(0, 0)
		self.uhd_usrp_sink_0.set_bandwidth(10000, 0)
		self.digital_ofdm_mod_0 = grc_blks2.packet_mod_f(digital.ofdm_mod(
				options=grc_blks2.options(
					modulation="qpsk",
					fft_length=1024,
					occupied_tones=200,
					cp_length=128,
					pad_for_usrp=True,
					log=None,
					verbose=None,
				),
			),
			payload_length=0,
		)
		self.blocks_file_source_0 = blocks.file_source(gr.sizeof_float*1, "/home/ubuntu/input", False)

		##################################################
		# Connections
		##################################################
		self.connect((self.digital_ofdm_mod_0, 0), (self.uhd_usrp_sink_0, 0))
		self.connect((self.blocks_file_source_0, 0), (self.digital_ofdm_mod_0, 0))
Beispiel #9
0
    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.samp_rate = samp_rate = 10e6

        ##################################################
        # Blocks
        ##################################################
        self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex * 1, samp_rate)
        self.gr_file_source_0 = gr.file_source(
            gr.sizeof_gr_complex * 1,
            "/home/traviscollins/git/BLISS/GNURadio/OFDM/received_p.txt", True)
        self.gr_file_sink_0 = gr.file_sink(
            gr.sizeof_char * 1,
            "/home/traviscollins/git/BLISS/GNURadio/OFDM/output.txt")
        self.gr_file_sink_0.set_unbuffered(False)
        self.digital_ofdm_demod_0 = grc_blks2.packet_demod_b(
            digital.ofdm_demod(
                options=grc_blks2.options(
                    modulation="bpsk",
                    fft_length=512,
                    occupied_tones=200,
                    cp_length=128,
                    snr=10,
                    log=None,
                    verbose=None,
                ),
                callback=lambda ok, payload: self.digital_ofdm_demod_0.
                recv_pkt(ok, payload),
            ), )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.digital_ofdm_demod_0, 0), (self.gr_file_sink_0, 0))
        self.connect((self.gr_file_source_0, 0), (self.gr_throttle_0, 0))
        self.connect((self.gr_throttle_0, 0), (self.digital_ofdm_demod_0, 0))
Beispiel #10
0
	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.samp_rate = samp_rate = 10e6

		##################################################
		# Blocks
		##################################################
		self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*1, samp_rate)
		self.gr_file_source_0 = gr.file_source(gr.sizeof_gr_complex*1, "/home/traviscollins/git/BLISS/GNURadio/OFDM/received_p.txt", True)
		self.gr_file_sink_0 = gr.file_sink(gr.sizeof_char*1, "/home/traviscollins/git/BLISS/GNURadio/OFDM/output.txt")
		self.gr_file_sink_0.set_unbuffered(False)
		self.digital_ofdm_demod_0 = grc_blks2.packet_demod_b(digital.ofdm_demod(
				options=grc_blks2.options(
					modulation="bpsk",
					fft_length=512,
					occupied_tones=200,
					cp_length=128,
					snr=10,
					log=None,
					verbose=None,
				),
				callback=lambda ok, payload: self.digital_ofdm_demod_0.recv_pkt(ok, payload),
			),
		)

		##################################################
		# Connections
		##################################################
		self.connect((self.digital_ofdm_demod_0, 0), (self.gr_file_sink_0, 0))
		self.connect((self.gr_file_source_0, 0), (self.gr_throttle_0, 0))
		self.connect((self.gr_throttle_0, 0), (self.digital_ofdm_demod_0, 0))
Beispiel #11
0
    def _build(self, input_signature, output_signature):
        """
        Implemention of base class abstract method.
        @param input_signature The input signature.
        @param output_signature The output signature.
        """

        # Old values:
        # modulation = "qam64"
        # fft_length = 512
        # cp_length = 128

        return digital.ofdm_mod(
            options=grc_blks2.options(
                modulation=self.modulation,
                fft_length=self.fft_length,
                occupied_tones=self.occupied_tones,
                cp_length=self.cp_length,
                log=None,
                verbose=None,
            ),
            msgq_limit=4,
            pad_for_usrp=False,
        )
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Video Transmitter")
        _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_0 = variable_slider_0 = 4900e6
        self.signal = signal = 5000
        self.samp_rate = samp_rate = 90000
        self.rfgain = rfgain = 0
        self.freq = freq = 12e6

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=90e6,
            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)
        _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="freq_slider",
            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=2450e6,
            maximum=5000e6,
            num_steps=10,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_variable_slider_0_sizer)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
            device_addr="",
            stream_args=uhd.stream_args(
                cpu_format="fc32",
                otw_format="sc16",
                channels=range(1),
            ),
        )
        self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_0.set_center_freq(90e6, 0)
        self.uhd_usrp_sink_0.set_gain(15, 0)
        self.uhd_usrp_sink_0.set_antenna("J2", 0)
        _signal_sizer = wx.BoxSizer(wx.VERTICAL)
        self._signal_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_signal_sizer,
            value=self.signal,
            callback=self.set_signal,
            label='signal',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._signal_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_signal_sizer,
            value=self.signal,
            callback=self.set_signal,
            minimum=0,
            maximum=32e6,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_signal_sizer)
        _rfgain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._rfgain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_rfgain_sizer,
            value=self.rfgain,
            callback=self.set_rfgain,
            label='rfgain',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._rfgain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_rfgain_sizer,
            value=self.rfgain,
            callback=self.set_rfgain,
            minimum=0,
            maximum=50,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_rfgain_sizer)
        self.digital_ofdm_mod_0 = grc_blks2.packet_mod_b(
            digital.ofdm_mod(options=grc_blks2.options(
                modulation="qpsk",
                fft_length=512,
                occupied_tones=200,
                cp_length=128,
                pad_for_usrp=True,
                log=None,
                verbose=None,
            ), ),
            payload_length=0,
        )
        self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_char * 1, 512e3,
                                                   True)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((500, ))
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_char * 1, "/home/ece775/video1.ts", True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.uhd_usrp_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_throttle_0_0, 0),
                     (self.digital_ofdm_mod_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_throttle_0_0, 0))
        self.connect((self.digital_ofdm_mod_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
Beispiel #13
0
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        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)

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        self.random_source_x_0 = gr.vector_source_s(
            map(int, numpy.random.randint(0, 2, 1000)), True)
        self.qtgui_sink_x_0 = qtgui.sink_c(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "QT GUI Plot",  #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.digital_ofdm_mod_0 = grc_blks2.packet_mod_f(
            digital.ofdm_mod(options=grc_blks2.options(
                modulation="qpsk",
                fft_length=512,
                occupied_tones=300,
                cp_length=128,
                pad_for_usrp=True,
                log=None,
                verbose=None,
            ), ),
            payload_length=0,
        )
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate)
        self.blocks_short_to_float_0 = blocks.short_to_float(1, 1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.random_source_x_0, 0),
                     (self.blocks_short_to_float_0, 0))
        self.connect((self.blocks_short_to_float_0, 0),
                     (self.digital_ofdm_mod_0, 0))
        self.connect((self.digital_ofdm_mod_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.qtgui_sink_x_0, 0))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Video Receiver")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1000000
        self.variable_slider_0 = variable_slider_0 = 50
        self.freq_slider = freq_slider = 4900e6
        self.freq = freq = 2450e6
        self.FILT_0 = FILT_0 = firdes.low_pass(1, samp_rate, 10000, 1000, firdes.WIN_HAMMING, 6.76)
        self.FILT = FILT = firdes.low_pass(1, samp_rate, 10000, 1000, firdes.WIN_HAMMING, 6.76)

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.GetWin(),
        	baseband_freq=90e6,
        	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)
        _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='variable_slider_0',
        	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=0,
        	maximum=100,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_variable_slider_0_sizer)
        self.uhd_usrp_source_0 = uhd.usrp_source(
        	device_addr="",
        	stream_args=uhd.stream_args(
        		cpu_format="fc32",
        		otw_format="sc16",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_center_freq(90e6, 0)
        self.uhd_usrp_source_0.set_gain(15, 0)
        self.uhd_usrp_source_0.set_antenna("J2", 0)
        _freq_slider_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freq_slider_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_freq_slider_sizer,
        	value=self.freq_slider,
        	callback=self.set_freq_slider,
        	label='freq_slider',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._freq_slider_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_freq_slider_sizer,
        	value=self.freq_slider,
        	callback=self.set_freq_slider,
        	minimum=2450e6,
        	maximum=5000e6,
        	num_steps=10,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_freq_slider_sizer)
        self.digital_ofdm_demod_0 = grc_blks2.packet_demod_b(digital.ofdm_demod(
        		options=grc_blks2.options(
        			modulation="qpsk",
        			fft_length=512,
        			occupied_tones=200,
        			cp_length=128,
        			snr=10,
        			log=None,
        			verbose=None,
        		),
        		callback=lambda ok, payload: self.digital_ofdm_demod_0.recv_pkt(ok, payload),
        	),
        )
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, "/home/csc773/vid1.ts", False)
        self.blocks_file_sink_0.set_unbuffered(False)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.digital_ofdm_demod_0, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.digital_ofdm_demod_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_fftsink2_0, 0))
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Simulated Sender GUI")

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 32000
		self.noise_voltage = noise_voltage = 0.01
		self.mult_const = mult_const = 1

		##################################################
		# Controls
		##################################################
		_noise_voltage_sizer = wx.BoxSizer(wx.VERTICAL)
		self._noise_voltage_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_noise_voltage_sizer,
			value=self.noise_voltage,
			callback=self.set_noise_voltage,
			label="Noise Voltage",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._noise_voltage_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_noise_voltage_sizer,
			value=self.noise_voltage,
			callback=self.set_noise_voltage,
			minimum=0,
			maximum=1,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_noise_voltage_sizer)
		self._mult_const_text_box = forms.text_box(
			parent=self.GetWin(),
			value=self.mult_const,
			callback=self.set_mult_const,
			label="Multiplication Const",
			converter=forms.float_converter(),
		)
		self.Add(self._mult_const_text_box)

		##################################################
		# Blocks
		##################################################
		self.blks2_ofdm_mod_0 = grc_blks2.packet_mod_b(blks2.ofdm_mod(
				options=grc_blks2.options(
					modulation="bpsk",
					fft_length=512,
					occupied_tones=200,
					cp_length=128,
					pad_for_usrp=True,
					log=None,
					verbose=None,
				),
			),
			payload_length=512,
		)
		self.gr_channel_model_0 = gr.channel_model(
			noise_voltage=noise_voltage,
			frequency_offset=0.0,
			epsilon=1.0,
			taps=(1.0 + 1.0j, ),
			noise_seed=42,
		)
		self.gr_multiply_const_vxx_0 = gr.multiply_const_vcc((mult_const, ))
		self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*1, samp_rate)
		self.random_source_x_0 = gr.vector_source_b(map(int, numpy.random.randint(0, 256, 512)), True)
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
			self.GetWin(),
			baseband_freq=0,
			y_per_div=10,
			y_divs=10,
			ref_level=50,
			sample_rate=samp_rate,
			fft_size=256,
			fft_rate=30,
			average=True,
			avg_alpha=0.1,
			title="FFT Plot",
			peak_hold=False,
		)
		self.Add(self.wxgui_fftsink2_0.win)

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_throttle_0, 0), (self.wxgui_fftsink2_0, 0))
		self.connect((self.gr_channel_model_0, 0), (self.gr_throttle_0, 0))
		self.connect((self.gr_multiply_const_vxx_0, 0), (self.gr_channel_model_0, 0))
		self.connect((self.random_source_x_0, 0), (self.blks2_ofdm_mod_0, 0))
		self.connect((self.blks2_ofdm_mod_0, 0), (self.gr_multiply_const_vxx_0, 0))
Beispiel #16
0
    def __init__(self, address="addr=192.168.10.2"):
        gr.top_block.__init__(self, "OFDM 256QAM")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("OFDM 256QAM")
        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", "GSM_OFDM_LTE_E300")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Parameters
        ##################################################
        self.address = address

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1e6
        self.samp_0 = samp_0 = 6.5e6
        self.CENTRAL_FREQEUNCY_USRP_Ch1 = CENTRAL_FREQEUNCY_USRP_Ch1 = 2145e6
        self.BW_USRP = BW_USRP = 50e6

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
            ",".join(("", "")),
            uhd.stream_args(
                cpu_format="fc32",
                args="scalar=1024",
                channels=range(1),
            ),
        )
        self.uhd_usrp_sink_0.set_subdev_spec("B:0", 0)
        self.uhd_usrp_sink_0.set_samp_rate(5e6)
        self.uhd_usrp_sink_0.set_center_freq(CENTRAL_FREQEUNCY_USRP_Ch1, 0)
        self.uhd_usrp_sink_0.set_gain(27, 0)
        self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
        self.uhd_usrp_sink_0.set_bandwidth(BW_USRP, 0)
        self.digital_ofdm_mod_1 = grc_blks2.packet_mod_f(
            digital.ofdm_mod(options=grc_blks2.options(
                modulation="bpsk",
                fft_length=1024,
                occupied_tones=1000,
                cp_length=0,
                pad_for_usrp=True,
                log=None,
                verbose=None,
            ), ),
            payload_length=0,
        )
        self.digital_cpmmod_bc_1 = digital.cpmmod_bc(analog.cpm.LREC, 2, 2, 2,
                                                     2)
        self.blocks_vector_source_x_1 = blocks.vector_source_f(
            (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
             1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
             1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1), True, 1, [])
        self.blocks_vector_source_x_0_0_0 = blocks.vector_source_f(
            (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
             1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
             1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1), True, 1, [])
        self.blocks_vector_source_x_0_0 = blocks.vector_source_f(
            (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
             1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
             1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1), True, 1, [])
        self.blocks_vector_source_x_0 = blocks.vector_source_f(
            (1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1,
             1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
             1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1), True, 1, [])
        self.blocks_float_to_char_0 = blocks.float_to_char(1, 1)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_float_to_char_0, 0))
        self.connect((self.blocks_complex_to_real_0, 0),
                     (self.digital_ofdm_mod_1, 0))
        self.connect((self.blocks_float_to_char_0, 0),
                     (self.digital_cpmmod_bc_1, 0))
        self.connect((self.blocks_vector_source_x_0, 0),
                     (self.blocks_add_xx_0, 2))
        self.connect((self.blocks_vector_source_x_0_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_vector_source_x_0_0_0, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_vector_source_x_1, 0),
                     (self.blocks_add_xx_0, 3))
        self.connect((self.digital_cpmmod_bc_1, 0),
                     (self.blocks_complex_to_real_0, 0))
        self.connect((self.digital_ofdm_mod_1, 0), (self.uhd_usrp_sink_0, 0))
Beispiel #17
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Ofdmqam")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000
        self.ampNoise = ampNoise = 0

        ##################################################
        # Blocks
        ##################################################
        _ampNoise_sizer = wx.BoxSizer(wx.VERTICAL)
        self._ampNoise_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_ampNoise_sizer,
            value=self.ampNoise,
            callback=self.set_ampNoise,
            label='ampNoise',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._ampNoise_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_ampNoise_sizer,
            value=self.ampNoise,
            callback=self.set_ampNoise,
            minimum=0,
            maximum=100,
            num_steps=1,
            style=wx.SL_VERTICAL,
            cast=float,
            proportion=1,
        )
        self.Add(_ampNoise_sizer)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=0,
            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 Transmissao",
            peak_hold=False,
        )
        self.GridAdd(self.wxgui_fftsink2_0.win, 1, 1, 1, 1)
        self.digital_ofdm_mod_0 = grc_blks2.packet_mod_f(
            digital.ofdm_mod(options=grc_blks2.options(
                modulation="bpsk",
                fft_length=64,
                occupied_tones=52,
                cp_length=16,
                pad_for_usrp=True,
                log=None,
                verbose=None,
            ), ),
            payload_length=0,
        )
        self.digital_ofdm_demod_0 = grc_blks2.packet_demod_f(
            digital.ofdm_demod(
                options=grc_blks2.options(
                    modulation="bpsk",
                    fft_length=64,
                    occupied_tones=52,
                    cp_length=16,
                    snr=10,
                    log=None,
                    verbose=None,
                ),
                callback=lambda ok, payload: self.digital_ofdm_demod_0.
                recv_pkt(ok, payload),
            ), )
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_float * 1,
            "/home/luan/Documentos/GNU/ofdmQamLuan_TxRx_File/lena_Tx.jpeg",
            True)
        self.blocks_file_sink_0 = blocks.file_sink(
            gr.sizeof_float * 1,
            "/home/luan/Documentos/GNU/ofdmQamLuan_TxRx_File/lena_Rx.jpeg",
            False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.analog_noise_source_x_0 = analog.noise_source_c(
            analog.GR_GAUSSIAN, ampNoise, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.digital_ofdm_mod_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.analog_noise_source_x_0, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_file_source_0, 0),
                     (self.digital_ofdm_mod_0, 0))
        self.connect((self.digital_ofdm_demod_0, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.digital_ofdm_demod_0, 0))
Beispiel #18
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Simulated Sender GUI")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000
        self.noise_voltage = noise_voltage = 0.01
        self.mult_const = mult_const = 1

        ##################################################
        # Controls
        ##################################################
        _noise_voltage_sizer = wx.BoxSizer(wx.VERTICAL)
        self._noise_voltage_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_noise_voltage_sizer,
            value=self.noise_voltage,
            callback=self.set_noise_voltage,
            label="Noise Voltage",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._noise_voltage_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_noise_voltage_sizer,
            value=self.noise_voltage,
            callback=self.set_noise_voltage,
            minimum=0,
            maximum=1,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_noise_voltage_sizer)
        self._mult_const_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.mult_const,
            callback=self.set_mult_const,
            label="Multiplication Const",
            converter=forms.float_converter(),
        )
        self.Add(self._mult_const_text_box)

        ##################################################
        # Blocks
        ##################################################
        self.blks2_ofdm_mod_0 = grc_blks2.packet_mod_b(
            blks2.ofdm_mod(options=grc_blks2.options(
                modulation="bpsk",
                fft_length=512,
                occupied_tones=200,
                cp_length=128,
                pad_for_usrp=True,
                log=None,
                verbose=None,
            ), ),
            payload_length=512,
        )
        self.gr_channel_model_0 = gr.channel_model(
            noise_voltage=noise_voltage,
            frequency_offset=0.0,
            epsilon=1.0,
            taps=(1.0 + 1.0j, ),
            noise_seed=42,
        )
        self.gr_multiply_const_vxx_0 = gr.multiply_const_vcc((mult_const, ))
        self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex * 1, samp_rate)
        self.random_source_x_0 = gr.vector_source_b(
            map(int, numpy.random.randint(0, 256, 512)), True)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=50,
            sample_rate=samp_rate,
            fft_size=256,
            fft_rate=30,
            average=True,
            avg_alpha=0.1,
            title="FFT Plot",
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.gr_throttle_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.gr_channel_model_0, 0), (self.gr_throttle_0, 0))
        self.connect((self.gr_multiply_const_vxx_0, 0),
                     (self.gr_channel_model_0, 0))
        self.connect((self.random_source_x_0, 0), (self.blks2_ofdm_mod_0, 0))
        self.connect((self.blks2_ofdm_mod_0, 0),
                     (self.gr_multiply_const_vxx_0, 0))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self,
                                         title="Video Transmitter Loopback")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.signal = signal = 5000
        self.samp_rate = samp_rate = 384000
        self.rfgain = rfgain = 0
        self.freq = freq = 12e6

        ##################################################
        # Blocks
        ##################################################
        _signal_sizer = wx.BoxSizer(wx.VERTICAL)
        self._signal_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_signal_sizer,
            value=self.signal,
            callback=self.set_signal,
            label='signal',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._signal_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_signal_sizer,
            value=self.signal,
            callback=self.set_signal,
            minimum=0,
            maximum=32e6,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_signal_sizer)
        _rfgain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._rfgain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_rfgain_sizer,
            value=self.rfgain,
            callback=self.set_rfgain,
            label='rfgain',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._rfgain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_rfgain_sizer,
            value=self.rfgain,
            callback=self.set_rfgain,
            minimum=0,
            maximum=50,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_rfgain_sizer)
        self.digital_ofdm_mod_0 = grc_blks2.packet_mod_b(
            digital.ofdm_mod(options=grc_blks2.options(
                modulation="qpsk",
                fft_length=512,
                occupied_tones=200,
                cp_length=128,
                pad_for_usrp=True,
                log=None,
                verbose=None,
            ), ),
            payload_length=0,
        )
        self.digital_ofdm_demod_0 = grc_blks2.packet_demod_b(
            digital.ofdm_demod(
                options=grc_blks2.options(
                    modulation="qpsk",
                    fft_length=512,
                    occupied_tones=200,
                    cp_length=128,
                    snr=10,
                    log=None,
                    verbose=None,
                ),
                callback=lambda ok, payload: self.digital_ofdm_demod_0.
                recv_pkt(ok, payload),
            ), )
        self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_char * 1,
                                                   samp_rate, True)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_char * 1, "/home/ece775/video1.ts", True)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1,
                                                   "/home/ece775/sink.ts",
                                                   False)
        self.blocks_file_sink_0.set_unbuffered(False)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.digital_ofdm_demod_0, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_throttle_0_0, 0))
        self.connect((self.digital_ofdm_mod_0, 0),
                     (self.digital_ofdm_demod_0, 0))
        self.connect((self.blocks_throttle_0_0, 0),
                     (self.digital_ofdm_mod_0, 0))
Beispiel #20
0
    def __init__(self):
        gr.top_block.__init__(self, "Ofdm_Usrp_Rx")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Ofdm_Usrp_Rx")
        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", "ofdmUsrpRx")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.usrp_freq = usrp_freq = 474e6
        self.samp_rate = samp_rate = 1000000

        ##################################################
        # Blocks
        ##################################################
        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(usrp_freq, 0)
        self.uhd_usrp_source_0.set_gain(10, 0)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #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.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(False)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)

        if not True:
            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.digital_ofdm_demod_0 = grc_blks2.packet_demod_f(
            digital.ofdm_demod(
                options=grc_blks2.options(
                    modulation="bpsk",
                    fft_length=512,
                    occupied_tones=200,
                    cp_length=128,
                    snr=10,
                    log=None,
                    verbose=None,
                ),
                callback=lambda ok, payload: self.digital_ofdm_demod_0.
                recv_pkt(ok, payload),
            ), )
        self.blocks_file_sink_0 = blocks.file_sink(
            gr.sizeof_float * 1,
            "/home/alunos/Documentos/ofdm_Usrp_Luan/file_Rx.txt", False)
        self.blocks_file_sink_0.set_unbuffered(False)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.digital_ofdm_demod_0, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.digital_ofdm_demod_0, 0))
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
Beispiel #21
0
    def __init__(self, address="addr=192.168.10.2"):
        gr.top_block.__init__(self, "OFDM 256QAM")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("OFDM 256QAM")
        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", "GSM_OFDM_LTE_E300")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())


        ##################################################
        # Parameters
        ##################################################
        self.address = address

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1e6
        self.samp_0 = samp_0 = 6.5e6
        self.CENTRAL_FREQEUNCY_USRP_Ch1 = CENTRAL_FREQEUNCY_USRP_Ch1 = 2145e6
        self.BW_USRP = BW_USRP = 50e6

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
        	",".join(("", "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		args="scalar=1024",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_sink_0.set_subdev_spec("B:0", 0)
        self.uhd_usrp_sink_0.set_samp_rate(5e6)
        self.uhd_usrp_sink_0.set_center_freq(CENTRAL_FREQEUNCY_USRP_Ch1, 0)
        self.uhd_usrp_sink_0.set_gain(27, 0)
        self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
        self.uhd_usrp_sink_0.set_bandwidth(BW_USRP, 0)
        self.digital_ofdm_mod_1 = grc_blks2.packet_mod_f(digital.ofdm_mod(
        		options=grc_blks2.options(
        			modulation="bpsk",
        			fft_length=1024,
        			occupied_tones=1000,
        			cp_length=0,
        			pad_for_usrp=True,
        			log=None,
        			verbose=None,
        		),
        	),
        	payload_length=0,
        )
        self.digital_cpmmod_bc_1 = digital.cpmmod_bc(analog.cpm.LREC, 2, 2, 2, 2)
        self.blocks_vector_source_x_1 = blocks.vector_source_f((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,0,1, 1,0, 0, 1,0,1, 1, 1,0, 0, 1,0,1), True, 1, [])
        self.blocks_vector_source_x_0_0_0 = blocks.vector_source_f((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,0,1, 1,0, 0, 1,0,1, 1, 1,0, 0, 1,0,1), True, 1, [])
        self.blocks_vector_source_x_0_0 = blocks.vector_source_f((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,0,1, 1,0, 0, 1,0,1, 1, 1,0, 0, 1,0,1), True, 1, [])
        self.blocks_vector_source_x_0 = blocks.vector_source_f((1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,0,1, 1,0, 0, 1,0,1, 0, 1,0, 0, 1,0,1), True, 1, [])
        self.blocks_float_to_char_0 = blocks.float_to_char(1, 1)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_float_to_char_0, 0))    
        self.connect((self.blocks_complex_to_real_0, 0), (self.digital_ofdm_mod_1, 0))    
        self.connect((self.blocks_float_to_char_0, 0), (self.digital_cpmmod_bc_1, 0))    
        self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_add_xx_0, 2))    
        self.connect((self.blocks_vector_source_x_0_0, 0), (self.blocks_add_xx_0, 1))    
        self.connect((self.blocks_vector_source_x_0_0_0, 0), (self.blocks_add_xx_0, 0))    
        self.connect((self.blocks_vector_source_x_1, 0), (self.blocks_add_xx_0, 3))    
        self.connect((self.digital_cpmmod_bc_1, 0), (self.blocks_complex_to_real_0, 0))    
        self.connect((self.digital_ofdm_mod_1, 0), (self.uhd_usrp_sink_0, 0))    
Beispiel #22
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Video Receiver")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1000000
        self.variable_slider_0 = variable_slider_0 = 50
        self.freq_slider = freq_slider = 4900e6
        self.freq = freq = 2450e6
        self.FILT_0 = FILT_0 = firdes.low_pass(1, samp_rate, 10000, 1000,
                                               firdes.WIN_HAMMING, 6.76)
        self.FILT = FILT = firdes.low_pass(1, samp_rate, 10000, 1000,
                                           firdes.WIN_HAMMING, 6.76)

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=90e6,
            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)
        _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='variable_slider_0',
            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=0,
            maximum=100,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_variable_slider_0_sizer)
        self.uhd_usrp_source_0 = uhd.usrp_source(
            device_addr="",
            stream_args=uhd.stream_args(
                cpu_format="fc32",
                otw_format="sc16",
                channels=range(1),
            ),
        )
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_center_freq(90e6, 0)
        self.uhd_usrp_source_0.set_gain(15, 0)
        self.uhd_usrp_source_0.set_antenna("J2", 0)
        _freq_slider_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freq_slider_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_freq_slider_sizer,
            value=self.freq_slider,
            callback=self.set_freq_slider,
            label='freq_slider',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._freq_slider_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_freq_slider_sizer,
            value=self.freq_slider,
            callback=self.set_freq_slider,
            minimum=2450e6,
            maximum=5000e6,
            num_steps=10,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_freq_slider_sizer)
        self.digital_ofdm_demod_0 = grc_blks2.packet_demod_b(
            digital.ofdm_demod(
                options=grc_blks2.options(
                    modulation="qpsk",
                    fft_length=512,
                    occupied_tones=200,
                    cp_length=128,
                    snr=10,
                    log=None,
                    verbose=None,
                ),
                callback=lambda ok, payload: self.digital_ofdm_demod_0.
                recv_pkt(ok, payload),
            ), )
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1,
                                                   "/home/csc773/vid1.ts",
                                                   False)
        self.blocks_file_sink_0.set_unbuffered(False)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.digital_ofdm_demod_0, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.digital_ofdm_demod_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_fftsink2_0, 0))
Beispiel #23
0
    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.samp_rate = samp_rate = 10000000

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=0,
            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_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=0,
            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.random_source_x_0 = gr.vector_source_b(map(int, numpy.random.randint(0, 2, 1000)), True)
        self.gr_vector_to_stream_0 = gr.vector_to_stream(gr.sizeof_gr_complex * 1, 512)
        self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex * 1, samp_rate)
        self.gr_sub_xx_0 = gr.sub_cc(512)
        self.gr_stream_to_vector_0 = gr.stream_to_vector(gr.sizeof_gr_complex * 1, 512)
        self.gr_file_source_1 = gr.file_source(
            gr.sizeof_gr_complex * 512, "/home/traviscollins/git/BLISS/Matlab/Spectral_Subtraction/hilbert.txt", True
        )
        self.gr_file_source_0 = gr.file_source(
            gr.sizeof_float * 1, "/home/traviscollins/git/BLISS/Matlab/Spectral_Subtraction/INPUT.txt", True
        )
        self.gr_file_sink_0 = gr.file_sink(
            gr.sizeof_float * 1, "/home/traviscollins/git/BLISS/Matlab/Spectral_Subtraction/OUTPUT.txt"
        )
        self.gr_file_sink_0.set_unbuffered(False)
        self.gr_add_xx_0 = gr.add_vcc(1)
        self.fft_vxx_1 = fft.fft_vcc(512, False, (window.blackmanharris(1024)), True, 1)
        self.fft_vxx_0 = fft.fft_vcc(512, True, (window.blackmanharris(1024)), True, 1)
        self.digital_ofdm_mod_0 = grc_blks2.packet_mod_f(
            digital.ofdm_mod(
                options=grc_blks2.options(
                    modulation="bpsk",
                    fft_length=512,
                    occupied_tones=200,
                    cp_length=128,
                    pad_for_usrp=True,
                    log=None,
                    verbose=None,
                )
            ),
            payload_length=0,
        )
        self.digital_ofdm_demod_0 = grc_blks2.packet_demod_f(
            digital.ofdm_demod(
                options=grc_blks2.options(
                    modulation="bpsk", fft_length=512, occupied_tones=200, cp_length=128, snr=10, log=None, verbose=None
                ),
                callback=lambda ok, payload: self.digital_ofdm_demod_0.recv_pkt(ok, payload),
            )
        )
        self.digital_dxpsk_mod_0 = digital.dbpsk_mod(
            samples_per_symbol=2, excess_bw=0.35, gray_coded=True, verbose=False, log=False
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.gr_file_source_0, 0), (self.digital_ofdm_mod_0, 0))
        self.connect((self.digital_ofdm_demod_0, 0), (self.gr_file_sink_0, 0))
        self.connect((self.gr_stream_to_vector_0, 0), (self.fft_vxx_0, 0))
        self.connect((self.random_source_x_0, 0), (self.digital_dxpsk_mod_0, 0))
        self.connect((self.digital_ofdm_mod_0, 0), (self.gr_add_xx_0, 0))
        self.connect((self.digital_dxpsk_mod_0, 0), (self.gr_add_xx_0, 1))
        self.connect((self.gr_add_xx_0, 0), (self.gr_throttle_0, 0))
        self.connect((self.gr_throttle_0, 0), (self.gr_stream_to_vector_0, 0))
        self.connect((self.fft_vxx_0, 0), (self.gr_sub_xx_0, 0))
        self.connect((self.gr_file_source_1, 0), (self.gr_sub_xx_0, 1))
        self.connect((self.gr_vector_to_stream_0, 0), (self.digital_ofdm_demod_0, 0))
        self.connect((self.gr_vector_to_stream_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.gr_add_xx_0, 0), (self.wxgui_fftsink2_0_0, 0))
        self.connect((self.gr_sub_xx_0, 0), (self.fft_vxx_1, 0))
        self.connect((self.fft_vxx_1, 0), (self.gr_vector_to_stream_0, 0))
Beispiel #24
0
	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.samp_rate = samp_rate = 150000

		##################################################
		# Blocks
		##################################################
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
			self.GetWin(),
			baseband_freq=60000,
			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.uhd_usrp_source_0 = uhd.usrp_source(
			device_addr="serial=4925e275",
			stream_args=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(60000, 0)
		self.uhd_usrp_source_0.set_gain(0, 0)
		self.uhd_usrp_source_0.set_bandwidth(10000, 0)
		self.digital_ofdm_demod_0 = grc_blks2.packet_demod_c(digital.ofdm_demod(
				options=grc_blks2.options(
					modulation="qpsk",
					fft_length=1024,
					occupied_tones=200,
					cp_length=128,
					snr=10,
					log=None,
					verbose=None,
				),
				callback=lambda ok, payload: self.digital_ofdm_demod_0.recv_pkt(ok, payload),
			),
		)
		self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex*1, "/home/capstone/output")
		self.blocks_file_sink_0.set_unbuffered(True)

		##################################################
		# Connections
		##################################################
		self.connect((self.uhd_usrp_source_0, 0), (self.digital_ofdm_demod_0, 0))
		self.connect((self.digital_ofdm_demod_0, 0), (self.blocks_file_sink_0, 0))
		self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_fftsink2_0, 0))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Video Transmitter")
        _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_0 = variable_slider_0 = 4900e6
        self.signal = signal = 5000
        self.samp_rate = samp_rate = 90000
        self.rfgain = rfgain = 0
        self.freq = freq = 12e6

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=90e6,
            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)
        _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="freq_slider",
            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=2450e6,
            maximum=5000e6,
            num_steps=10,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_variable_slider_0_sizer)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
            device_addr="", stream_args=uhd.stream_args(cpu_format="fc32", otw_format="sc16", channels=range(1))
        )
        self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_0.set_center_freq(90e6, 0)
        self.uhd_usrp_sink_0.set_gain(15, 0)
        self.uhd_usrp_sink_0.set_antenna("J2", 0)
        _signal_sizer = wx.BoxSizer(wx.VERTICAL)
        self._signal_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_signal_sizer,
            value=self.signal,
            callback=self.set_signal,
            label="signal",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._signal_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_signal_sizer,
            value=self.signal,
            callback=self.set_signal,
            minimum=0,
            maximum=32e6,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_signal_sizer)
        _rfgain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._rfgain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_rfgain_sizer,
            value=self.rfgain,
            callback=self.set_rfgain,
            label="rfgain",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._rfgain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_rfgain_sizer,
            value=self.rfgain,
            callback=self.set_rfgain,
            minimum=0,
            maximum=50,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_rfgain_sizer)
        self.digital_ofdm_mod_0 = grc_blks2.packet_mod_b(
            digital.ofdm_mod(
                options=grc_blks2.options(
                    modulation="qpsk",
                    fft_length=512,
                    occupied_tones=200,
                    cp_length=128,
                    pad_for_usrp=True,
                    log=None,
                    verbose=None,
                )
            ),
            payload_length=0,
        )
        self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_char * 1, 512e3, True)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((500,))
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char * 1, "/home/ece775/video1.ts", True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.uhd_usrp_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_throttle_0_0, 0), (self.digital_ofdm_mod_0, 0))
        self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0_0, 0))
        self.connect((self.digital_ofdm_mod_0, 0), (self.blocks_multiply_const_vxx_0, 0))
    from grc_gnuradio import blks2 as grc_blks2
    from gr_blocks.utils import UHDSourceDummy
    from gnuradio import digital
    from channels import AWGNChannel
    from opera import cyclo_detector
    from utils import Logger

    Logger._ch_status = 1

    modulator = grc_blks2.packet_mod_b(digital.ofdm_mod(
			    options=grc_blks2.options(
				    modulation="bpsk",
				    fft_length=512,
				    occupied_tones=200,
				    cp_length=128,
				    pad_for_usrp=True,
				    log=None,
				    verbose=None,
				    ),
			    ),
        	payload_length=0,
        )

    src = UHDSourceDummy(modulator=modulator)

    the_source = AWGNChannel(component=src)

    from sensing import CycloSSArch
    from sensing import CycloDecision
Beispiel #27
0
	def __init__(self):
		gr.top_block.__init__(self, "QAM16")
		Qt.QWidget.__init__(self)
		self.setWindowTitle("QAM16")
		self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
		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)


		##################################################
		# Variables
		##################################################
		self.variable_qtgui_range_0 = variable_qtgui_range_0 = 474e6
		self.samp_rate = samp_rate = 44100
		self.Useful_Carriers = Useful_Carriers = 1024
		self.Transmission_Frequency = Transmission_Frequency = 474e6
		self.OFDM_Symbols = OFDM_Symbols = 2048
		self.Guard_Interval = Guard_Interval = 4
		self.Gain = Gain = 20
		self.Packets_Number = 2048

		

		
		##################################################
		# My code...
		print(atsc.ATSC_MPEG_PKT_LENGTH);
		print(atsc.MPEG_SYNC_BYTE);
		self.ts = self.make_fake_transport_stream_packet(self.Packets_Number) # make 2048 packets of 188 each one.
		print(len(self.ts))
		##################################################		
	
	

		##################################################
		# Blocks
		##################################################
		self._variable_qtgui_range_0_layout = Qt.QVBoxLayout()
		self._variable_qtgui_range_0_tool_bar = Qt.QToolBar(self)
		self._variable_qtgui_range_0_layout.addWidget(self._variable_qtgui_range_0_tool_bar)
		self._variable_qtgui_range_0_tool_bar.addWidget(Qt.QLabel("Transmission_Frequency"+": "))
		self._variable_qtgui_range_0_counter = Qwt.QwtCounter()
		self._variable_qtgui_range_0_counter.setRange(470e6, 478e6, 1e3)
		self._variable_qtgui_range_0_counter.setNumButtons(2)
		self._variable_qtgui_range_0_counter.setValue(self.variable_qtgui_range_0)
		self._variable_qtgui_range_0_tool_bar.addWidget(self._variable_qtgui_range_0_counter)
		self._variable_qtgui_range_0_counter.valueChanged.connect(self.set_variable_qtgui_range_0)
		self._variable_qtgui_range_0_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
		self._variable_qtgui_range_0_slider.setRange(470e6, 478e6, 1e3)
		self._variable_qtgui_range_0_slider.setValue(self.variable_qtgui_range_0)
		self._variable_qtgui_range_0_slider.setMinimumWidth(200)
		self._variable_qtgui_range_0_slider.valueChanged.connect(self.set_variable_qtgui_range_0)
		self._variable_qtgui_range_0_layout.addWidget(self._variable_qtgui_range_0_slider)
		self.top_layout.addLayout(self._variable_qtgui_range_0_layout)
		self.qtgui_sink_x_0 = qtgui.sink_c(
			OFDM_Symbols, #fftsize
			firdes.WIN_BLACKMAN_hARRIS, #wintype
			Transmission_Frequency, #fc
			8e6, #bw
			"QT GUI Plot", #name
			True, #plotfreq
			False, #plotwaterfall
			True, #plottime
			False, #plotconst
		)
		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.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*1, samp_rate)
		#self.gr_file_source_0 = gr.file_source(gr.sizeof_float*1, "/home/katsikas/katsikas-repo/Gnuradio/Common/Text.txt", True)
		self.gr_vector_source_0 = gr.vector_source_f(self.ts, True, 1)
		self.gr_file_sink_0 = gr.file_sink(gr.sizeof_float*1, "/home/katsikas/katsikas-repo/Gnuradio/Common/Results.txt")
		self.gr_file_sink_0.set_unbuffered(False)
		self.digital_ofdm_mod_0 = grc_blks2.packet_mod_f(digital.ofdm_mod(
				options=grc_blks2.options(
					modulation="qam64",
					fft_length=OFDM_Symbols,
					occupied_tones=Useful_Carriers,
					cp_length=OFDM_Symbols/Guard_Interval,
					pad_for_usrp=True,
					log=None,
					verbose=None,
				),
			),
			payload_length=0,
		)
		self.digital_ofdm_demod_0 = grc_blks2.packet_demod_f(digital.ofdm_demod(
				options=grc_blks2.options(
					modulation="qam64",
					fft_length=OFDM_Symbols,
					occupied_tones=Useful_Carriers,
					cp_length=OFDM_Symbols/Guard_Interval,
					snr=20,
					log=None,
					verbose=None,
				),
				callback=lambda ok, payload: self.digital_ofdm_demod_0.recv_pkt(ok, payload),
			),
		)

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_throttle_0, 0), (self.qtgui_sink_x_0, 0))
		self.connect((self.digital_ofdm_mod_0, 0), (self.gr_throttle_0, 0))
		self.connect((self.digital_ofdm_mod_0, 0), (self.digital_ofdm_demod_0, 0))
		#self.connect((self.gr_file_source_0, 0), (self.digital_ofdm_mod_0, 0))
		self.connect((self.gr_vector_source_0, 0), (self.digital_ofdm_mod_0, 0))
		self.connect((self.digital_ofdm_demod_0, 0), (self.gr_file_sink_0, 0))
Beispiel #28
0
	def __init__(self):
		gr.top_block.__init__(self, "Top Block")
		Qt.QWidget.__init__(self)
		self.setWindowTitle("Top Block")
		self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
		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)


		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 32000

		##################################################
		# Blocks
		##################################################
		self.random_source_x_0 = gr.vector_source_s(map(int, numpy.random.randint(0, 2, 1000)), True)
		self.qtgui_sink_x_0 = qtgui.sink_c(
			1024, #fftsize
			firdes.WIN_BLACKMAN_hARRIS, #wintype
			0, #fc
			samp_rate, #bw
			"QT GUI Plot", #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.digital_ofdm_mod_0 = grc_blks2.packet_mod_f(digital.ofdm_mod(
				options=grc_blks2.options(
					modulation="qpsk",
					fft_length=512,
					occupied_tones=300,
					cp_length=128,
					pad_for_usrp=True,
					log=None,
					verbose=None,
				),
			),
			payload_length=0,
		)
		self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate)
		self.blocks_short_to_float_0 = blocks.short_to_float(1, 1)

		##################################################
		# Connections
		##################################################
		self.connect((self.random_source_x_0, 0), (self.blocks_short_to_float_0, 0))
		self.connect((self.blocks_short_to_float_0, 0), (self.digital_ofdm_mod_0, 0))
		self.connect((self.digital_ofdm_mod_0, 0), (self.blocks_throttle_0, 0))
		self.connect((self.blocks_throttle_0, 0), (self.qtgui_sink_x_0, 0))
Beispiel #29
0
    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.samp_rate = samp_rate = 10000000

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=0,
            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_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=0,
            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.random_source_x_0 = gr.vector_source_b(
            map(int, numpy.random.randint(0, 2, 1000)), True)
        self.gr_vector_to_stream_0 = gr.vector_to_stream(
            gr.sizeof_gr_complex * 1, 512)
        self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex * 1, samp_rate)
        self.gr_sub_xx_0 = gr.sub_cc(512)
        self.gr_stream_to_vector_0 = gr.stream_to_vector(
            gr.sizeof_gr_complex * 1, 512)
        self.gr_file_source_1 = gr.file_source(
            gr.sizeof_gr_complex * 512,
            "/home/traviscollins/git/BLISS/Matlab/Spectral_Subtraction/hilbert.txt",
            True)
        self.gr_file_source_0 = gr.file_source(
            gr.sizeof_float * 1,
            "/home/traviscollins/git/BLISS/Matlab/Spectral_Subtraction/INPUT.txt",
            True)
        self.gr_file_sink_0 = gr.file_sink(
            gr.sizeof_float * 1,
            "/home/traviscollins/git/BLISS/Matlab/Spectral_Subtraction/OUTPUT.txt"
        )
        self.gr_file_sink_0.set_unbuffered(False)
        self.gr_add_xx_0 = gr.add_vcc(1)
        self.fft_vxx_1 = fft.fft_vcc(512, False, (window.blackmanharris(1024)),
                                     True, 1)
        self.fft_vxx_0 = fft.fft_vcc(512, True, (window.blackmanharris(1024)),
                                     True, 1)
        self.digital_ofdm_mod_0 = grc_blks2.packet_mod_f(
            digital.ofdm_mod(options=grc_blks2.options(
                modulation="bpsk",
                fft_length=512,
                occupied_tones=200,
                cp_length=128,
                pad_for_usrp=True,
                log=None,
                verbose=None,
            ), ),
            payload_length=0,
        )
        self.digital_ofdm_demod_0 = grc_blks2.packet_demod_f(
            digital.ofdm_demod(
                options=grc_blks2.options(
                    modulation="bpsk",
                    fft_length=512,
                    occupied_tones=200,
                    cp_length=128,
                    snr=10,
                    log=None,
                    verbose=None,
                ),
                callback=lambda ok, payload: self.digital_ofdm_demod_0.
                recv_pkt(ok, payload),
            ), )
        self.digital_dxpsk_mod_0 = digital.dbpsk_mod(samples_per_symbol=2,
                                                     excess_bw=0.35,
                                                     gray_coded=True,
                                                     verbose=False,
                                                     log=False)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.gr_file_source_0, 0), (self.digital_ofdm_mod_0, 0))
        self.connect((self.digital_ofdm_demod_0, 0), (self.gr_file_sink_0, 0))
        self.connect((self.gr_stream_to_vector_0, 0), (self.fft_vxx_0, 0))
        self.connect((self.random_source_x_0, 0),
                     (self.digital_dxpsk_mod_0, 0))
        self.connect((self.digital_ofdm_mod_0, 0), (self.gr_add_xx_0, 0))
        self.connect((self.digital_dxpsk_mod_0, 0), (self.gr_add_xx_0, 1))
        self.connect((self.gr_add_xx_0, 0), (self.gr_throttle_0, 0))
        self.connect((self.gr_throttle_0, 0), (self.gr_stream_to_vector_0, 0))
        self.connect((self.fft_vxx_0, 0), (self.gr_sub_xx_0, 0))
        self.connect((self.gr_file_source_1, 0), (self.gr_sub_xx_0, 1))
        self.connect((self.gr_vector_to_stream_0, 0),
                     (self.digital_ofdm_demod_0, 0))
        self.connect((self.gr_vector_to_stream_0, 0),
                     (self.wxgui_fftsink2_0, 0))
        self.connect((self.gr_add_xx_0, 0), (self.wxgui_fftsink2_0_0, 0))
        self.connect((self.gr_sub_xx_0, 0), (self.fft_vxx_1, 0))
        self.connect((self.fft_vxx_1, 0), (self.gr_vector_to_stream_0, 0))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Video Transmitter Loopback")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.signal = signal = 5000
        self.samp_rate = samp_rate = 384000
        self.rfgain = rfgain = 0
        self.freq = freq = 12e6

        ##################################################
        # Blocks
        ##################################################
        _signal_sizer = wx.BoxSizer(wx.VERTICAL)
        self._signal_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_signal_sizer,
        	value=self.signal,
        	callback=self.set_signal,
        	label='signal',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._signal_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_signal_sizer,
        	value=self.signal,
        	callback=self.set_signal,
        	minimum=0,
        	maximum=32e6,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_signal_sizer)
        _rfgain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._rfgain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_rfgain_sizer,
        	value=self.rfgain,
        	callback=self.set_rfgain,
        	label='rfgain',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._rfgain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_rfgain_sizer,
        	value=self.rfgain,
        	callback=self.set_rfgain,
        	minimum=0,
        	maximum=50,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_rfgain_sizer)
        self.digital_ofdm_mod_0 = grc_blks2.packet_mod_b(digital.ofdm_mod(
        		options=grc_blks2.options(
        			modulation="qpsk",
        			fft_length=512,
        			occupied_tones=200,
        			cp_length=128,
        			pad_for_usrp=True,
        			log=None,
        			verbose=None,
        		),
        	),
        	payload_length=0,
        )
        self.digital_ofdm_demod_0 = grc_blks2.packet_demod_b(digital.ofdm_demod(
        		options=grc_blks2.options(
        			modulation="qpsk",
        			fft_length=512,
        			occupied_tones=200,
        			cp_length=128,
        			snr=10,
        			log=None,
        			verbose=None,
        		),
        		callback=lambda ok, payload: self.digital_ofdm_demod_0.recv_pkt(ok, payload),
        	),
        )
        self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_char*1, samp_rate,True)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, "/home/ece775/video1.ts", True)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, "/home/ece775/sink.ts", False)
        self.blocks_file_sink_0.set_unbuffered(False)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.digital_ofdm_demod_0, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0_0, 0))
        self.connect((self.digital_ofdm_mod_0, 0), (self.digital_ofdm_demod_0, 0))
        self.connect((self.blocks_throttle_0_0, 0), (self.digital_ofdm_mod_0, 0))