def main(): tb = gr.top_block() # noise source n = mlse.randint_b(2) reshape_n = gr.stream_to_vector(1, 58*2) tb.connect(n,reshape_n) # limit experiment length head=gr.head(58*2,1) tb.connect(reshape_n, head) # modulate gsm_burstmod = gsm.gsm_modulate_burst() tb.connect(head, gsm_burstmod) random_tsc_index = mlse.randint_b(8); tb.connect(random_tsc_index, (gsm_burstmod,1)) # apply channel channel = gsm.my_channel(-100,[0.2,1,0.2]) channel_apply = gsm.apply_channel_to_vect(148, channel, 1) tb.connect(gsm_burstmod, channel_apply) # derotate derot = mlse.derotate_cc(148,4,-1) #FIXME: why -1? (not as if it matters) tb.connect(channel_apply, derot) modsink = gr.vector_sink_c(148) datasink = gr.vector_sink_b(58*2) tb.connect(derot, modsink) tb.connect(head, datasink) # mlse-decode decode = mlse.equalizer_midamble_vcb(mlse.make_packet_config_gsm()) tb.connect(derot,decode) tb.connect(random_tsc_index, (decode,1)) # ber ber = mlse.ber_vbi(58*2) tb.connect(decode, ber) tb.connect(head, (ber,1)) result_sink = gr.vector_sink_b(58*2) tb.connect(decode, result_sink) chanest_sink = gr.vector_sink_c(7) tb.connect((decode,1), chanest_sink) tb.run() tb.run() d=modsink.data() # printvect_c(d) print ber.bit_error_rate() print_bitvect( datasink.data()) print_bitvect( result_sink.data()) import operator print_bitvect( map(operator.xor, datasink.data(), result_sink.data())) printvect_c( chanest_sink.data())
def main(): tb = gr.top_block() # noise source n = mlse.randint_b(2) reshape_n = gr.stream_to_vector(1, 58 * 2) tb.connect(n, reshape_n) # limit experiment length head = gr.head(58 * 2, 1) tb.connect(reshape_n, head) # modulate gsm_burstmod = gsm.gsm_modulate_burst() tb.connect(head, gsm_burstmod) random_tsc_index = mlse.randint_b(8) tb.connect(random_tsc_index, (gsm_burstmod, 1)) # apply channel channel = gsm.my_channel(-100, [0.2, 1, 0.2]) channel_apply = gsm.apply_channel_to_vect(148, channel, 1) tb.connect(gsm_burstmod, channel_apply) # derotate derot = mlse.derotate_cc(148, 4, -1) #FIXME: why -1? (not as if it matters) tb.connect(channel_apply, derot) modsink = gr.vector_sink_c(148) datasink = gr.vector_sink_b(58 * 2) tb.connect(derot, modsink) tb.connect(head, datasink) # mlse-decode decode = mlse.equalizer_midamble_vcb(mlse.make_packet_config_gsm()) tb.connect(derot, decode) tb.connect(random_tsc_index, (decode, 1)) # ber ber = mlse.ber_vbi(58 * 2) tb.connect(decode, ber) tb.connect(head, (ber, 1)) result_sink = gr.vector_sink_b(58 * 2) tb.connect(decode, result_sink) chanest_sink = gr.vector_sink_c(7) tb.connect((decode, 1), chanest_sink) tb.run() tb.run() d = modsink.data() # printvect_c(d) print ber.bit_error_rate() print_bitvect(datasink.data()) print_bitvect(result_sink.data()) import operator print_bitvect(map(operator.xor, datasink.data(), result_sink.data())) printvect_c(chanest_sink.data())
def make_flowgraph(self): tb = gr.top_block() # noise source n = mlse.randint_b(2) reshape_n = gr.stream_to_vector(1, 58 * 2) tb.connect(n, reshape_n) # limit experiment length head = gr.head(58 * 2, self.packets) tb.connect(reshape_n, head) # modulate gsm_burstmod = gsm.gsm_modulate_burst() tb.connect(head, gsm_burstmod) random_tsc_index = mlse.randint_b(8) tb.connect(random_tsc_index, (gsm_burstmod, 1)) # apply channel channel = gsm.my_channel(self.snr, self.chan_taps) channel_apply = gsm.apply_channel_to_vect(148, channel, 3) #TODO: don't use to_vector and to_stream for the channel tb.connect(gsm_burstmod, channel_apply) # derotate derot = mlse.derotate_cc(148, 4, -1) #FIXME: why -1? (not as if it matters) tb.connect(channel_apply, derot) # mlse-decode if (self.no_decorr): decode = gsm.gsm_decode_harddecision() else: decode = mlse.equalizer_midamble_vcb(mlse.make_packet_config_gsm()) tb.connect(random_tsc_index, (decode, 1)) tb.connect(derot, decode) # ber ber = mlse.ber_vbi(58 * 2) tb.connect(decode, ber) tb.connect(head, (ber, 1)) if (not self.no_decorr): # throw away channel-estimate data chanest_sink = gr.null_sink(6 * gr.sizeof_gr_complex) tb.connect((decode, 1), chanest_sink) # export members we need self.tb = tb self.ber = ber self.head = head self.channel = channel
def make_flowgraph(self): tb = gr.top_block() # noise source n = mlse.randint_b(2) reshape_n = gr.stream_to_vector(1, 58*2) tb.connect(n,reshape_n) # limit experiment length head=gr.head(58*2,self.packets) tb.connect(reshape_n, head) # modulate gsm_burstmod = gsm.gsm_modulate_burst() tb.connect(head, gsm_burstmod) random_tsc_index = mlse.randint_b(8); tb.connect(random_tsc_index, (gsm_burstmod,1)) # apply channel channel = gsm.my_channel(self.snr, self.chan_taps) channel_apply = gsm.apply_channel_to_vect(148, channel, 3) #TODO: don't use to_vector and to_stream for the channel tb.connect(gsm_burstmod, channel_apply) # derotate derot = mlse.derotate_cc(148,4,-1) #FIXME: why -1? (not as if it matters) tb.connect(channel_apply, derot) # mlse-decode if(self.no_decorr): decode = gsm.gsm_decode_harddecision() else: decode = mlse.equalizer_midamble_vcb(mlse.make_packet_config_gsm()) tb.connect(random_tsc_index, (decode,1)) tb.connect(derot,decode) # ber ber = mlse.ber_vbi(58*2) tb.connect(decode, ber) tb.connect(head, (ber,1)) if(not self.no_decorr): # throw away channel-estimate data chanest_sink = gr.null_sink(6*gr.sizeof_gr_complex) tb.connect((decode,1), chanest_sink) # export members we need self.tb = tb self.ber = ber self.head = head self.channel = channel