Example #1
0
    def __init__(self,
                 ch_port=1,
                 tx_ip='192.168.5.100',
                 samp_rate=250000,
                 sig_in='./in.dat'):
        gr.top_block.__init__(self, "Gr Baseband Async O")

        ##################################################
        # Parameters
        ##################################################
        self.ch_port = ch_port
        self.tx_ip = tx_ip
        self.samp_rate = samp_rate
        self.sig_in = sig_in

        ##################################################
        # Blocks
        ##################################################
        self.red_pitaya_sink_0 = red_pitaya.sink(addr=tx_ip,
                                                 port=1000 + ch_port,
                                                 freq=0,
                                                 rate=samp_rate,
                                                 corr=0,
                                                 ptt=True)

        self.blocks_head_0 = blocks.head(gr.sizeof_gr_complex * 1, 50000000)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_float * 1,
                                                       sig_in, False)
        self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL)
        self.analog_const_source_x_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_head_0, 0))
        self.connect((self.blocks_head_0, 0), (self.red_pitaya_sink_0, 0))
Example #2
0
    def __init__(self,
                 amplitude_calibration1=1,
                 amplitude_calibration2=1,
                 ch_rx1=1,
                 ch_rx2=2,
                 ch_tx=1,
                 duration=250000,
                 rx_ip1='192.168.5.100',
                 rx_ip2='192.168.5.100',
                 samp_rate=250000,
                 sig_in='./in.dat',
                 sig_out1='./out1.dat',
                 sig_out2='./out2.dat',
                 tx_ip='192.168.5.100'):
        gr.top_block.__init__(self, "Gr Baseband Async Oii")

        ##################################################
        # Parameters
        ##################################################
        self.amplitude_calibration1 = amplitude_calibration1
        self.amplitude_calibration2 = amplitude_calibration2
        self.ch_rx1 = ch_rx1
        self.ch_rx2 = ch_rx2
        self.ch_tx = ch_tx
        self.duration = duration
        self.rx_ip1 = rx_ip1
        self.rx_ip2 = rx_ip2
        self.samp_rate = samp_rate
        self.sig_in = sig_in
        self.sig_out1 = sig_out1
        self.sig_out2 = sig_out2
        self.tx_ip = tx_ip

        ##################################################
        # Blocks
        ##################################################
        self.red_pitaya_source_0_0 = red_pitaya.source(addr=rx_ip2,
                                                       port=1000 + ch_rx2,
                                                       freq=0,
                                                       rate=samp_rate,
                                                       corr=0)

        self.red_pitaya_source_0 = red_pitaya.source(addr=rx_ip1,
                                                     port=1000 + ch_rx1,
                                                     freq=0,
                                                     rate=samp_rate,
                                                     corr=0)

        self.red_pitaya_sink = red_pitaya.sink(addr=tx_ip,
                                               port=1000 + ch_tx,
                                               freq=0,
                                               rate=samp_rate,
                                               corr=0,
                                               ptt=True)

        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vcc(
            (amplitude_calibration2, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc(
            (amplitude_calibration1, ))
        self.blocks_head_0_1 = blocks.head(gr.sizeof_gr_complex * 1, duration)
        self.blocks_head_0_0 = blocks.head(gr.sizeof_float * 1, duration)
        self.blocks_head_0 = blocks.head(gr.sizeof_float * 1, duration)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_float * 1,
                                                       sig_in, False)
        self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL)
        self.blocks_file_sink_0_0 = blocks.file_sink(gr.sizeof_float * 1,
                                                     sig_out2, False)
        self.blocks_file_sink_0_0.set_unbuffered(False)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_float * 1,
                                                   sig_out1, False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_complex_to_real_0_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.analog_const_source_x_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_complex_to_real_0, 0),
                     (self.blocks_head_0, 0))
        self.connect((self.blocks_complex_to_real_0_0, 0),
                     (self.blocks_head_0_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_head_0_1, 0))
        self.connect((self.blocks_head_0, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.blocks_head_0_0, 0), (self.blocks_file_sink_0_0, 0))
        self.connect((self.blocks_head_0_1, 0), (self.red_pitaya_sink, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_complex_to_real_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.blocks_complex_to_real_0_0, 0))
        self.connect((self.red_pitaya_source_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.red_pitaya_source_0_0, 0),
                     (self.blocks_multiply_const_vxx_0_0, 0))
Example #3
0
    def __init__(self,
                 ch_port=1,
                 duration=250000,
                 rx_ip='192.168.5.101',
                 samp_rate=250000,
                 sig_in='./in.dat',
                 sig_out='./out.dat',
                 tx_ip='192.168.5.101'):
        gr.top_block.__init__(self, "gr_sandbox")

        ##################################################
        # Parameters
        ##################################################
        self.ch_port = ch_port
        self.duration = duration
        self.rx_ip = rx_ip
        self.samp_rate = samp_rate
        self.sig_in = sig_in
        self.sig_out = sig_out
        self.tx_ip = tx_ip

        ##################################################
        # Blocks
        ##################################################
        self.red_pitaya_source_0 = red_pitaya.source(addr=rx_ip,
                                                     port=1000 + ch_port,
                                                     freq=0,
                                                     rate=samp_rate,
                                                     corr=0)

        self.red_pitaya_sink_0 = red_pitaya.sink(addr=tx_ip,
                                                 port=1000 + ch_port,
                                                 freq=0,
                                                 rate=samp_rate,
                                                 corr=0,
                                                 ptt=True)

        self.blocks_head_0 = blocks.head(gr.sizeof_float * 1, duration)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_float * 1,
                                                       sig_in, False)
        self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_float * 1,
                                                   sig_out, False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.analog_const_source_x_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_complex_to_real_0, 0),
                     (self.blocks_head_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.red_pitaya_sink_0, 0))
        self.connect((self.blocks_head_0, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.red_pitaya_source_0, 0),
                     (self.blocks_complex_to_real_0, 0))