Example #1
0
    def setup_qpsk0(self):
        self.tb = gr.top_block()

        pts, code = digital.psk_4_0x0_0_1()
        constellation = digital.constellation_psk(pts, code, 4)
        
        self.src = blocks.vector_source_b(self.src_data_qpsk)
        self.p2u = blocks.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST)
        self.mod = digital.generic_mod(constellation, True, self.sps, True, self.eb)
        self.snk = blocks.null_sink(gr.sizeof_gr_complex)

        self.tb.connect(self.src, self.p2u, self.mod, self.snk)
Example #2
0
    def setup_qpsk0(self):
        self.tb = gr.top_block()

        pts, code = digital.psk_4_0x0_0_1()
        constellation = digital.constellation_psk(pts, code, 4)
        
        self.src = blocks.vector_source_b(self.src_data_qpsk)
        self.p2u = blocks.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST)
        self.mod = digital.generic_mod(constellation, True, self.sps, True, self.eb)
        self.snk = blocks.null_sink(gr.sizeof_gr_complex)

        self.tb.connect(self.src, self.p2u, self.mod, self.snk)
Example #3
0
    def setup_qpsk0(self):
        self.tb = gr.top_block()

        # Build the constellation object
        arity = 4
        bps = 2
        pts, code = digital.psk_4_0x0_0_1()
        constellation = digital.constellation_psk(pts, code, 4)

        # Create QPSK data to pass to the demodulator
        src = blocks.vector_source_b(self.src_data_qpsk)
        p2u = blocks.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST)
        mod = digital.generic_mod(constellation, True, self.sps, True, self.eb)
        snk = blocks.vector_sink_c()

        tb = gr.top_block()
        tb.connect(src, p2u, mod, snk)
        tb.run()

        self.src = blocks.vector_source_c(snk.data())
        self.freq_recov = digital.fll_band_edge_cc(self.sps, self.eb,
                                                   self.fll_ntaps,
                                                   self.freq_bw)
        self.time_recov = digital.pfb_clock_sync_ccf(self.sps, self.timing_bw,
                                                     self.taps, self.nfilts,
                                                     self.nfilts // 2,
                                                     self.timing_max_dev)
        self.receiver = digital.constellation_receiver_cb(
            constellation.base(), self.phase_bw, self.fmin, self.fmax)
        self.diffdec = digital.diff_decoder_bb(arity)
        self.symbol_mapper = digital.map_bb(
            mod_codes.invert_code(constellation.pre_diff_code()))
        self.unpack = blocks.unpack_k_bits_bb(bps)
        self.snk = blocks.null_sink(gr.sizeof_char)

        self.tb.connect(self.src, self.freq_recov, self.time_recov,
                        self.receiver)
        self.tb.connect(self.receiver, self.diffdec, self.symbol_mapper,
                        self.unpack)
        self.tb.connect(self.unpack, self.snk)
Example #4
0
    def test_constellation_soft_decoder_cf_qpsk(self):
        prec = 8
  	src_data = (0.5 + 0.5j,  0.1 - 1.2j, -0.8 - 0.1j, -0.45 + 0.8j,
                    0.8 + 1.0j, -0.5 + 0.1j,  0.1 - 1.2j, 1+1j)
        lut = digital.soft_dec_table_generator(digital.sd_psk_4_0x0_0_1, prec)
	expected_result = list()
        for s in src_data:
            expected_result += digital.calc_soft_dec_from_table(s, lut, prec)

        cnst_pts,code = digital.psk_4_0x0_0_1()
        cnst = digital.constellation_calcdist(cnst_pts, code, 2, 1)
        cnst.set_soft_dec_lut(lut, int(prec))
        src = blocks.vector_source_c(src_data)
        op = digital.constellation_soft_decoder_cf(cnst.base())
        dst = blocks.vector_sink_f()

        self.tb.connect(src, op)
        self.tb.connect(op, dst)
        self.tb.run()               # run the graph and wait for it to finish

        actual_result = dst.data()  # fetch the contents of the sink
	#print "actual result", actual_result
	#print "expected result", expected_result
        self.assertFloatTuplesAlmostEqual(expected_result, actual_result, 5)
Example #5
0
    def setup_qpsk0(self):
        self.tb = gr.top_block()

        # Build the constellation object
        arity = 4
        bps = 2
        pts, code = digital.psk_4_0x0_0_1()
        constellation = digital.constellation_psk(pts, code, 4)

        # Create QPSK data to pass to the demodulator
        src = blocks.vector_source_b(self.src_data_qpsk)
        p2u = blocks.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST)
        mod = digital.generic_mod(constellation, True, self.sps, True, self.eb)
        snk = blocks.vector_sink_c()

        tb = gr.top_block()
        tb.connect(src, p2u, mod, snk)
        tb.run()


        self.src = blocks.vector_source_c(snk.data())
        self.freq_recov = digital.fll_band_edge_cc(self.sps, self.eb,
                                                   self.fll_ntaps, self.freq_bw)
        self.time_recov = digital.pfb_clock_sync_ccf(self.sps, self.timing_bw, self.taps,
                                                     self.nfilts, self.nfilts//2, self.timing_max_dev)
        self.receiver = digital.constellation_receiver_cb(
            constellation.base(), self.phase_bw, self.fmin, self.fmax)
        self.diffdec = digital.diff_decoder_bb(arity)
        self.symbol_mapper = digital.map_bb(
            mod_codes.invert_code(constellation.pre_diff_code()))
        self.unpack = blocks.unpack_k_bits_bb(bps)
        self.snk = blocks.null_sink(gr.sizeof_char)

        self.tb.connect(self.src, self.freq_recov, self.time_recov, self.receiver)
        self.tb.connect(self.receiver, self.diffdec, self.symbol_mapper, self.unpack)
        self.tb.connect(self.unpack, self.snk)