def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Dvbs Tx") ################################################## # Variables ################################################## self.symbol_rate = symbol_rate = 4500000 self.samp_rate = samp_rate = symbol_rate * 2 self.rrc_taps = rrc_taps = 20 ################################################## # Blocks ################################################## self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( self.GetWin(), baseband_freq=435000000, 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=True, avg_alpha=None, title="FFT Plot", peak_hold=False, ) self.Add(self.wxgui_fftsink2_0.win) self.trellis_encoder_xx_0 = trellis.encoder_bb(trellis.fsm(1, 2, (0171, 0133)), 0) self.osmosdr_sink_0 = osmosdr.sink( args="numchan=" + str(1) + " " + "" ) self.osmosdr_sink_0.set_sample_rate(samp_rate) self.osmosdr_sink_0.set_center_freq(435e6, 0) self.osmosdr_sink_0.set_freq_corr(0, 0) self.osmosdr_sink_0.set_gain(2, 0) self.osmosdr_sink_0.set_if_gain(0, 0) self.osmosdr_sink_0.set_bb_gain(-4, 0) self.osmosdr_sink_0.set_antenna("", 0) self.osmosdr_sink_0.set_bandwidth(6000000, 0) self.fft_filter_xxx_0 = filter.fft_filter_ccc(1, (firdes.root_raised_cosine(1.79, samp_rate, samp_rate/2, 0.35, rrc_taps)), 1) self.fft_filter_xxx_0.declare_sample_delay(0) self.dvbs_reed_solomon_enc_bb_0 = dvbs.reed_solomon_enc_bb() self.dvbs_randomizer_bb_0 = dvbs.randomizer_bb() self.dvbs_puncture_bb_0 = dvbs.puncture_bb(dvbs.C1_2) self.dvbs_modulator_bc_0 = dvbs.modulator_bc() self.dvbs_interleaver_bb_0 = dvbs.interleaver_bb() self.blocks_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(2) self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST) self.blocks_pack_k_bits_bb_0 = blocks.pack_k_bits_bb(2) self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, "/home/re/xfer/adv.ts", False) ################################################## # Connections ################################################## self.connect((self.blocks_file_source_0, 0), (self.dvbs_randomizer_bb_0, 0)) self.connect((self.dvbs_randomizer_bb_0, 0), (self.dvbs_reed_solomon_enc_bb_0, 0)) self.connect((self.dvbs_reed_solomon_enc_bb_0, 0), (self.dvbs_interleaver_bb_0, 0)) self.connect((self.dvbs_interleaver_bb_0, 0), (self.blocks_packed_to_unpacked_xx_0, 0)) self.connect((self.blocks_packed_to_unpacked_xx_0, 0), (self.trellis_encoder_xx_0, 0)) self.connect((self.trellis_encoder_xx_0, 0), (self.blocks_unpack_k_bits_bb_0, 0)) self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.dvbs_puncture_bb_0, 0)) self.connect((self.dvbs_puncture_bb_0, 0), (self.blocks_pack_k_bits_bb_0, 0)) self.connect((self.dvbs_modulator_bc_0, 0), (self.fft_filter_xxx_0, 0)) self.connect((self.blocks_pack_k_bits_bb_0, 0), (self.dvbs_modulator_bc_0, 0)) self.connect((self.fft_filter_xxx_0, 0), (self.osmosdr_sink_0, 0)) self.connect((self.fft_filter_xxx_0, 0), (self.wxgui_fftsink2_0, 0))
def main(args): nargs = len(args) if nargs == 1: infile = args[0] outfile = None elif nargs == 2: infile = args[0] outfile = args[1] else: sys.stderr.write("Usage: dvbs-blade.py input_file [output_file]\n") sys.exit(1) symbol_rate = 4500000 samp_rate = symbol_rate * 2 code_rate = dvbs.C1_2 rrc_taps = 20 center_freq = 435000000 txvga1_gain = -4 txvga2_gain = 1 bandwidth = 6000000 tb = gr.top_block() src = blocks.file_source(gr.sizeof_char, infile, True) dvbs_randomizer = dvbs.randomizer_bb() dvbs_reed_solomon_enc = dvbs.reed_solomon_enc_bb() dvbs_interleaver = dvbs.interleaver_bb() blocks_packed_to_unpacked = blocks.packed_to_unpacked_bb( 1, gr.GR_MSB_FIRST) trellis_encoder = trellis.encoder_bb(trellis.fsm(1, 2, (0171, 0133)), 0) blocks_unpack_k_bits = blocks.unpack_k_bits_bb(2) dvbs_puncture = dvbs.puncture_bb(code_rate) blocks_pack_k_bits = blocks.pack_k_bits_bb(2) digital_chunks_to_symbols = digital.chunks_to_symbols_bc(([ complex(0.70710678, 0.70710678), complex(0.70710678, -0.70710678), complex(-0.70710678, 0.70710678), complex(-0.70710678, -0.70710678) ]), 1) interp_fir_filter = filter.interp_fir_filter_ccc( 2, (firdes.root_raised_cosine(1.79, samp_rate, samp_rate / 2, 0.35, rrc_taps))) interp_fir_filter.declare_sample_delay(0) out = osmosdr.sink(args="bladerf=0,buffers=128,buflen=32768") out.set_sample_rate(samp_rate) out.set_center_freq(center_freq, 0) out.set_freq_corr(0, 0) out.set_gain(txvga2_gain, 0) out.set_bb_gain(txvga1_gain, 0) out.set_bandwidth(bandwidth, 0) tb.connect(src, dvbs_randomizer) tb.connect(dvbs_randomizer, dvbs_reed_solomon_enc) tb.connect(dvbs_reed_solomon_enc, dvbs_interleaver) tb.connect(dvbs_interleaver, blocks_packed_to_unpacked) tb.connect(blocks_packed_to_unpacked, trellis_encoder) tb.connect(trellis_encoder, blocks_unpack_k_bits) tb.connect(blocks_unpack_k_bits, dvbs_puncture) tb.connect(dvbs_puncture, blocks_pack_k_bits) tb.connect(blocks_pack_k_bits, digital_chunks_to_symbols) tb.connect(digital_chunks_to_symbols, interp_fir_filter) tb.connect(interp_fir_filter, out) if outfile: dst = blocks.file_sink(gr.sizeof_gr_complex, outfile) tb.connect(interp_fir_filter, dst) tb.run()
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Dvbs Tx") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.symbol_rate = symbol_rate = 1000000 self.username = username = os.environ.get('USER') self.samp_rate = samp_rate = symbol_rate * 2 self.rrc_taps = rrc_taps = 20 self.frequency = frequency = 970e6 ################################################## # Blocks ################################################## self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( self.GetWin(), baseband_freq=frequency, 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=True, avg_alpha=None, title='FFT Plot', peak_hold=False, ) self.Add(self.wxgui_fftsink2_0.win) self.trellis_encoder_xx_0 = trellis.encoder_bb( trellis.fsm(1, 2, (0171, 0133)), 0, 0) if False else trellis.encoder_bb( trellis.fsm(1, 2, (0171, 0133)), 0) self._symbol_rate_chooser = forms.radio_buttons( parent=self.GetWin(), value=self.symbol_rate, callback=self.set_symbol_rate, label='symbol_rate', choices=[333000, 500000, 1000000, 1200000, 1500000], labels=["333kS/s", "500 kS/s", "1000kS/s", "1200kS/s", "1500kS/s"], style=wx.RA_HORIZONTAL, ) self.Add(self._symbol_rate_chooser) self.pluto_sink_0 = iio.pluto_sink('', int(frequency), int(samp_rate), int(9000000), 0x8000, False, 0.0, '', True) self.fft_filter_xxx_0 = filter.fft_filter_ccc( 1, (firdes.root_raised_cosine(1.79, samp_rate, samp_rate / 2, 0.35, rrc_taps)), 1) self.fft_filter_xxx_0.declare_sample_delay(0) self.dvbs_reed_solomon_enc_bb_0 = dvbs.reed_solomon_enc_bb() self.dvbs_randomizer_bb_0 = dvbs.randomizer_bb() self.dvbs_puncture_bb_0 = dvbs.puncture_bb(dvbs.C1_2) self.dvbs_modulator_bc_0 = dvbs.modulator_bc() self.dvbs_interleaver_bb_0 = dvbs.interleaver_bb() self.blocks_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(2) self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb( 1, gr.GR_MSB_FIRST) self.blocks_pack_k_bits_bb_0 = blocks.pack_k_bits_bb(2) self.blocks_file_source_1 = blocks.file_source( gr.sizeof_char * 1, "/media/" + username + "/PlutoSDR/MPEG2-lalinea.ts", True) ################################################## # Connections ################################################## self.connect((self.blocks_file_source_1, 0), (self.dvbs_randomizer_bb_0, 0)) self.connect((self.blocks_pack_k_bits_bb_0, 0), (self.dvbs_modulator_bc_0, 0)) self.connect((self.blocks_packed_to_unpacked_xx_0, 0), (self.trellis_encoder_xx_0, 0)) self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.dvbs_puncture_bb_0, 0)) self.connect((self.dvbs_interleaver_bb_0, 0), (self.blocks_packed_to_unpacked_xx_0, 0)) self.connect((self.dvbs_modulator_bc_0, 0), (self.fft_filter_xxx_0, 0)) self.connect((self.dvbs_puncture_bb_0, 0), (self.blocks_pack_k_bits_bb_0, 0)) self.connect((self.dvbs_randomizer_bb_0, 0), (self.dvbs_reed_solomon_enc_bb_0, 0)) self.connect((self.dvbs_reed_solomon_enc_bb_0, 0), (self.dvbs_interleaver_bb_0, 0)) self.connect((self.fft_filter_xxx_0, 0), (self.pluto_sink_0, 0)) self.connect((self.fft_filter_xxx_0, 0), (self.wxgui_fftsink2_0, 0)) self.connect((self.trellis_encoder_xx_0, 0), (self.blocks_unpack_k_bits_bb_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Dvbs Tx") ################################################## # Variables ################################################## self.symbol_rate = symbol_rate = 4500000 self.samp_rate = samp_rate = symbol_rate * 2 self.rrc_taps = rrc_taps = 20 ################################################## # Blocks ################################################## self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( self.GetWin(), baseband_freq=435000000, 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=True, avg_alpha=None, title="FFT Plot", peak_hold=False, ) self.Add(self.wxgui_fftsink2_0.win) self.trellis_encoder_xx_0 = trellis.encoder_bb(trellis.fsm(1, 2, (0171, 0133)), 0) self.osmosdr_sink_0 = osmosdr.sink( args="numchan=" + str(1) + " " + "" ) self.osmosdr_sink_0.set_sample_rate(samp_rate) self.osmosdr_sink_0.set_center_freq(435e6, 0) self.osmosdr_sink_0.set_freq_corr(0, 0) self.osmosdr_sink_0.set_gain(2, 0) self.osmosdr_sink_0.set_if_gain(0, 0) self.osmosdr_sink_0.set_bb_gain(-4, 0) self.osmosdr_sink_0.set_antenna("", 0) self.osmosdr_sink_0.set_bandwidth(6000000, 0) self.interp_fir_filter_xxx_0 = filter.interp_fir_filter_ccc(2, (firdes.root_raised_cosine(1.79, samp_rate, samp_rate/2, 0.35, rrc_taps))) self.interp_fir_filter_xxx_0.declare_sample_delay(0) self.dvbs_reed_solomon_enc_bb_0 = dvbs.reed_solomon_enc_bb() self.dvbs_randomizer_bb_0 = dvbs.randomizer_bb() self.dvbs_puncture_bb_0 = dvbs.puncture_bb(dvbs.C1_2) self.dvbs_interleaver_bb_0 = dvbs.interleaver_bb() self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc(([complex(0.70710678,0.70710678), complex(0.70710678,-0.70710678), complex(-0.70710678,0.70710678), complex(-0.70710678,-0.70710678)]), 1) self.blocks_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(2) self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST) self.blocks_pack_k_bits_bb_0 = blocks.pack_k_bits_bb(2) self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, "/home/re/xfer/adv.ts", False) ################################################## # Connections ################################################## self.connect((self.blocks_file_source_0, 0), (self.dvbs_randomizer_bb_0, 0)) self.connect((self.dvbs_randomizer_bb_0, 0), (self.dvbs_reed_solomon_enc_bb_0, 0)) self.connect((self.dvbs_reed_solomon_enc_bb_0, 0), (self.dvbs_interleaver_bb_0, 0)) self.connect((self.dvbs_interleaver_bb_0, 0), (self.blocks_packed_to_unpacked_xx_0, 0)) self.connect((self.blocks_packed_to_unpacked_xx_0, 0), (self.trellis_encoder_xx_0, 0)) self.connect((self.interp_fir_filter_xxx_0, 0), (self.wxgui_fftsink2_0, 0)) self.connect((self.interp_fir_filter_xxx_0, 0), (self.osmosdr_sink_0, 0)) self.connect((self.trellis_encoder_xx_0, 0), (self.blocks_unpack_k_bits_bb_0, 0)) self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.dvbs_puncture_bb_0, 0)) self.connect((self.dvbs_puncture_bb_0, 0), (self.blocks_pack_k_bits_bb_0, 0)) self.connect((self.blocks_pack_k_bits_bb_0, 0), (self.digital_chunks_to_symbols_xx_0, 0)) self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.interp_fir_filter_xxx_0, 0))
def main(args): nargs = len(args) if nargs == 1: infile = args[0] outfile = None elif nargs == 2: infile = args[0] outfile = args[1] else: sys.stderr.write("Usage: dvbs-blade.py input_file [output_file]\n") sys.exit(1) symbol_rate = 4500000 samp_rate = symbol_rate * 2 code_rate = dvbs.C1_2 rrc_taps = 20 center_freq = 435000000 txvga1_gain = -4 txvga2_gain = 1 bandwidth = 6000000 tb = gr.top_block() src = blocks.file_source(gr.sizeof_char, infile, True) dvbs_randomizer = dvbs.randomizer_bb() dvbs_reed_solomon_enc = dvbs.reed_solomon_enc_bb() dvbs_interleaver = dvbs.interleaver_bb() blocks_packed_to_unpacked = blocks.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST) trellis_encoder = trellis.encoder_bb(trellis.fsm(1, 2, (0171, 0133)), 0) blocks_unpack_k_bits = blocks.unpack_k_bits_bb(2) dvbs_puncture = dvbs.puncture_bb(code_rate) blocks_pack_k_bits = blocks.pack_k_bits_bb(2) dvbs_modulator = dvbs.modulator_bc() fft_filter = filter.fft_filter_ccc( 1, (firdes.root_raised_cosine(1.79, samp_rate, samp_rate / 2, 0.35, rrc_taps)), 1 ) fft_filter.declare_sample_delay(0) out = osmosdr.sink(args="bladerf=0,buffers=128,buflen=32768") out.set_sample_rate(samp_rate) out.set_center_freq(center_freq, 0) out.set_freq_corr(0, 0) out.set_gain(txvga2_gain, 0) out.set_bb_gain(txvga1_gain, 0) out.set_bandwidth(bandwidth, 0) tb.connect(src, dvbs_randomizer) tb.connect(dvbs_randomizer, dvbs_reed_solomon_enc) tb.connect(dvbs_reed_solomon_enc, dvbs_interleaver) tb.connect(dvbs_interleaver, blocks_packed_to_unpacked) tb.connect(blocks_packed_to_unpacked, trellis_encoder) tb.connect(trellis_encoder, blocks_unpack_k_bits) tb.connect(blocks_unpack_k_bits, dvbs_puncture) tb.connect(dvbs_puncture, blocks_pack_k_bits) tb.connect(blocks_pack_k_bits, dvbs_modulator) tb.connect(dvbs_modulator, fft_filter) tb.connect(fft_filter, out) if outfile: dst = blocks.file_sink(gr.sizeof_gr_complex, outfile) tb.connect(fft_filter, dst) tb.run()