Beispiel #1
0
    def __init__(self):
        gr.hier_block2.__init__(self,
                                "proto_transceiver",
                                gr.io_signature(1, 1, gr.sizeof_gr_complex),
                                gr.io_signature(1, 1, gr.sizeof_gr_complex))
#file sinks for debugging
        self.agc_out = gr.file_sink(itemsize = gr.sizeof_gr_complex,
                                    filename = "agc.dat")
#########################
#uplink blocks

        q_encoder = gr.msg_queue(100)
        self.tx_encoder = rfidbts.pie_encoder(samples_per_delimiter = 8, 
                                              samples_per_tari = 16,
                                              samples_per_pw = 8,
                                              samples_per_trcal = 53,
                                              samples_per_data1 = 32)
        self.tx_encoder.set_encoder_queue(q_encoder)
        rfidbts.cvar.rfid_mac.set_encoder_queue(q_encoder)
####################################
#downlink blocks
        q_blocker = gr.msg_queue(100)
        frame_size_rn16 = int((32 + 32 + 12) * 8 + int(75*0.4*1.024))
        self.TX_blocker = rfidbts.receive_gate(threshold = 0.15,     #bit above the noise floor
                                               off_max = 15)         #should not be in the off state for more than 13 us
        self.TX_blocker.set_gate_queue(q_blocker)
        rfidbts.cvar.rfid_mac.set_gate_queue(q_blocker)
        self.blocker = gr.dc_blocker_cc(D = 5, 
                                        long_form = True)
        self.agc = gr.agc_cc(rate = 5e-1, 
                             reference = 0.707, 
                             gain = 100.0,
                             max_gain = 1000.0)
        self.search = preamble_search(frame_size_rn16)
        self.half_symbols = symbol_mapper()
#        self.decoder = binary_diff_decoder()
        self.decoder = rfidbts.orthogonal_decode()
        self.framer = rfidbts.packetizer()
#frame the rn16 and send to message queue
#####################################
#connect uplink
        self.connect(self.tx_encoder, self)
#####################################
#connect downlink
        self.connect(self,
                     self.TX_blocker,
                     self.blocker,
                     self.agc,
                     self.search,
                     self.half_symbols,
                     self.decoder,
                     self.framer)
        self.connect(self.agc, self.agc_out)
    def test_002(self):
        ''' Test impulse response - short form, cc '''
        src_data = [1,] + 100*[0,] 
        expected_result = ((-0.029296875+0j), (-0.0302734375+0j),
                           (0.96875+0j), (-0.0302734375+0j),
                           (-0.029296875+0j))

        src = gr.vector_source_c(src_data)
        op = gr.dc_blocker_cc(32, False)
        dst = gr.vector_sink_c()

        self.tb.connect (src, op, dst)
        self.tb.run()

        # only test samples around D-1
        result_data = dst.data()[29:34]
        self.assertFloatTuplesAlmostEqual (expected_result, result_data)
    def test_001(self):
        ''' Test impulse response - long form, cc '''
        src_data = [1,] + 100*[0,] 
        expected_result = ((-0.02072429656982422+0j), (-0.02081298828125+0j),
                           (0.979156494140625+0j), (-0.02081298828125+0j),
                           (-0.02072429656982422+0j))

        src = gr.vector_source_c(src_data)
        op = gr.dc_blocker_cc(32, True)
        dst = gr.vector_sink_c()

        self.tb.connect (src, op, dst)
        self.tb.run()

        # only test samples around 2D-2
        result_data = dst.data()[60:65]
        self.assertFloatTuplesAlmostEqual (expected_result, result_data)
Beispiel #4
0
    def __init__(self):
        gr.hier_block2.__init__(self, "proto_transceiver",
                                gr.io_signature(1, 1, gr.sizeof_gr_complex),
                                gr.io_signature(1, 1, gr.sizeof_gr_complex))
        #file sinks for debugging
        self.agc_out = gr.file_sink(itemsize=gr.sizeof_gr_complex,
                                    filename="agc.dat")
        #########################
        #uplink blocks

        q_encoder = gr.msg_queue(100)
        self.tx_encoder = rfidbts.pie_encoder(samples_per_delimiter=8,
                                              samples_per_tari=16,
                                              samples_per_pw=8,
                                              samples_per_trcal=53,
                                              samples_per_data1=32)
        self.tx_encoder.set_encoder_queue(q_encoder)
        rfidbts.cvar.rfid_mac.set_encoder_queue(q_encoder)
        ####################################
        #downlink blocks
        q_blocker = gr.msg_queue(100)
        frame_size_rn16 = int((32 + 32 + 12) * 8 + int(75 * 0.4 * 1.024))
        self.TX_blocker = rfidbts.receive_gate(
            threshold=0.15,  #bit above the noise floor
            off_max=15)  #should not be in the off state for more than 13 us
        self.TX_blocker.set_gate_queue(q_blocker)
        rfidbts.cvar.rfid_mac.set_gate_queue(q_blocker)
        self.blocker = gr.dc_blocker_cc(D=5, long_form=True)
        self.agc = gr.agc_cc(rate=5e-1,
                             reference=0.707,
                             gain=100.0,
                             max_gain=1000.0)
        self.search = preamble_search(frame_size_rn16)
        self.half_symbols = symbol_mapper()
        #        self.decoder = binary_diff_decoder()
        self.decoder = rfidbts.orthogonal_decode()
        self.framer = rfidbts.packetizer()
        #frame the rn16 and send to message queue
        #####################################
        #connect uplink
        self.connect(self.tx_encoder, self)
        #####################################
        #connect downlink
        self.connect(self, self.TX_blocker, self.blocker, self.agc,
                     self.search, self.half_symbols, self.decoder, self.framer)
        self.connect(self.agc, self.agc_out)
Beispiel #5
0
    def test_002(self):
        ''' Test impulse response - short form, cc '''
        src_data = [
            1,
        ] + 100 * [
            0,
        ]
        expected_result = ((-0.029296875 + 0j), (-0.0302734375 + 0j),
                           (0.96875 + 0j), (-0.0302734375 + 0j),
                           (-0.029296875 + 0j))

        src = gr.vector_source_c(src_data)
        op = gr.dc_blocker_cc(32, False)
        dst = gr.vector_sink_c()

        self.tb.connect(src, op, dst)
        self.tb.run()

        # only test samples around D-1
        result_data = dst.data()[29:34]
        self.assertComplexTuplesAlmostEqual(expected_result, result_data)
Beispiel #6
0
    def test_001(self):
        ''' Test impulse response - long form, cc '''
        src_data = [
            1,
        ] + 100 * [
            0,
        ]
        expected_result = ((-0.02072429656982422 + 0j),
                           (-0.02081298828125 + 0j), (0.979156494140625 + 0j),
                           (-0.02081298828125 + 0j),
                           (-0.02072429656982422 + 0j))

        src = gr.vector_source_c(src_data)
        op = gr.dc_blocker_cc(32, True)
        dst = gr.vector_sink_c()

        self.tb.connect(src, op, dst)
        self.tb.run()

        # only test samples around 2D-2
        result_data = dst.data()[60:65]
        self.assertComplexTuplesAlmostEqual(expected_result, result_data)