def test_002(self): vlen = 256 subc = 208 L = 8 cplen = 12 blocklen = vlen + cplen framelength = 11 bits_per_subc = [2] * vlen data_blocks = 10 N = int(1e9) # GI metric pre0, fd = morellimengali_designer.create(subc, vlen, L) ofdm_frames = \ ofdm_frame_src( vlen, data_blocks, pre0, cplen, framelength, bits_per_subc ) #uut = ofdm.autocorrelator0( vlen, cplen ) uut = autocorrelator(vlen, cplen) limit_stream = gr.head(gr.sizeof_float, N) self.tb.connect(ofdm_frames, uut, limit_stream, gr.null_sink(gr.sizeof_float)) # log_to_file( self.tb, limit_stream, "data/cyclicprefix_autocorr.float" ) r = time_it(self.tb) print "Expected throughput: %s Samples/s" % (eng_notation.num_to_str( float(N) / r))
def __init__( self, vlen ): gr.hier_block2.__init__( self, "channel_estimator_001", gr.io_signature( 1, 1, gr.sizeof_gr_complex * vlen ), gr.io_signature( 1, 1, gr.sizeof_float ) ) #nondata_blocks = [1] #pilot_tones = [0] if snr_estimator_001.vlen != vlen or \ snr_estimator_001.td is None or \ snr_estimator_001.fd is None : td,fd = morellimengali_designer.create(vlen, vlen,8) #-> replace the fixed number of periodic parts->8 snr_estimator_001.td, snr_estimator_001.fd = td,fd snr_estimator_001.vlen = vlen else: td,fd = snr_estimator_001.td, snr_estimator_001.fd self.preamble_td = td self.preamble_fd = fd uut = milans_snr_estimator( vlen, vlen, 8 )#-> replace the fixed number of periodic parts->8 #uut.set_known_block( 0, self.preamble_fd, True ) #trigger = gr.vector_source_b( [1], True ) self.connect( self, uut ) #self.connect( trigger, ( uut, 1 ) ) self.connect( ( uut), self )
def test_002(self): vlen = 256 subc = 208 L = 8 cplen = 12 blocklen = vlen + cplen framelength = 11 bits_per_subc = [2]*vlen data_blocks = 10 N = int( 1e9 ) # GI metric pre0,fd = morellimengali_designer.create( subc, vlen, L ) ofdm_frames = \ ofdm_frame_src( vlen, data_blocks, pre0, cplen, framelength, bits_per_subc ) #uut = ofdm.autocorrelator0( vlen, cplen ) uut = autocorrelator( vlen, cplen ) limit_stream = gr.head( gr.sizeof_float, N ) self.tb.connect( ofdm_frames, uut, limit_stream, gr.null_sink( gr.sizeof_float ) ) # log_to_file( self.tb, limit_stream, "data/cyclicprefix_autocorr.float" ) r = time_it( self.tb ) print "Expected throughput: %s Samples/s" % ( eng_notation.num_to_str( float(N) / r ) )
def test_101(self): vlen = 256 subc = 208 L = 8 cplen = 12 blocklen = vlen + cplen framelength = 11 bits_per_subc = [2]*vlen data_blocks = 10 # SC metric, ofdm frames generated statically M = 10 Nsamples_per_frame = framelength * (vlen+cplen) N = int( 1e9 ) pre0,fd = morellimengali_designer.create( subc, vlen, L ) ofdm_frames = \ ofdm_frame_src( vlen, data_blocks, pre0, cplen, framelength, bits_per_subc ) dst = gr.vector_sink_c() #uut = ofdm.autocorrelator( vlen, cplen ) uut = autocorrelator( vlen, cplen ) limit_stream = gr.head( gr.sizeof_gr_complex, Nsamples_per_frame * M ) tb = gr.top_block("s") tb.connect( ofdm_frames, limit_stream, dst ) tb.run() src = gr.vector_source_c( dst.data(), True ) limit = gr.head( gr.sizeof_gr_complex, N ) self.tb.connect( src, limit, uut, gr.null_sink( gr.sizeof_float ) ) r = time_it( self.tb ) print "GI rate: %s Samples/second" \ % ( eng_notation.num_to_str( float(N) / r ) )
def test_101(self): vlen = 256 subc = 208 L = 8 cplen = 12 blocklen = vlen + cplen framelength = 11 bits_per_subc = [2] * vlen data_blocks = 10 # SC metric, ofdm frames generated statically M = 10 Nsamples_per_frame = framelength * (vlen + cplen) N = int(1e9) pre0, fd = morellimengali_designer.create(subc, vlen, L) ofdm_frames = \ ofdm_frame_src( vlen, data_blocks, pre0, cplen, framelength, bits_per_subc ) dst = gr.vector_sink_c() #uut = ofdm.autocorrelator( vlen, cplen ) uut = autocorrelator(vlen, cplen) limit_stream = gr.head(gr.sizeof_gr_complex, Nsamples_per_frame * M) tb = gr.top_block("s") tb.connect(ofdm_frames, limit_stream, dst) tb.run() src = gr.vector_source_c(dst.data(), True) limit = gr.head(gr.sizeof_gr_complex, N) self.tb.connect(src, limit, uut, gr.null_sink(gr.sizeof_float)) r = time_it(self.tb) print "GI rate: %s Samples/second" \ % ( eng_notation.num_to_str( float(N) / r ) )
def test_001(self): vlen = 256 subc = 208 L = 8 cplen = 12 blocklen = vlen + cplen framelength = 11 bits_per_subc = [2] * vlen data_blocks = 10 N = int(1e8) profiling = False pre0, fd = morellimengali_designer.create(subc, vlen, L) ofdm_frames = \ ofdm_frame_src( vlen, data_blocks, pre0, cplen, framelength, bits_per_subc ) uut = autocorrelator(vlen / 2, vlen / 2) ref = recursive_timing_metric(vlen) limit_stream = gr.head(gr.sizeof_float, N) self.tb.connect(ofdm_frames, uut, limit_stream, gr.null_sink(gr.sizeof_float)) # limit_stream.enable_detailed_profiling( profiling ) # uut.s2.enable_detailed_profiling( profiling ) if not profiling: limit_stream2 = gr.head(gr.sizeof_float, N) compare = gr.sub_ff() err_acc = ofdm.accumulator_ff() skip_err = gr.skiphead(gr.sizeof_float, N - 1) last_err_val = gr.head(gr.sizeof_float, 1) err_sink = gr.vector_sink_f() self.tb.connect(ofdm_frames, ref, limit_stream2, gr.null_sink(gr.sizeof_float)) self.tb.connect(uut, (compare, 0)) self.tb.connect(ref, (compare, 1)) self.tb.connect(compare, err_acc) self.tb.connect(err_acc, skip_err) self.tb.connect(skip_err, last_err_val) self.tb.connect(last_err_val, err_sink) # log_to_file( self.tb, limit_stream, "data/autocorr_uut.float" ) # log_to_file( self.tb, limit_stream2, "data/autocorr_ref.float" ) # r = time_it( self.tb ) self.tb.run() # print "Expected throughput: %s Samples/s" % ( eng_notation.num_to_str( float(N) / r ) ) if not profiling: e = numpy.array(err_sink.data())[0] print "Err: %.7f" % (e)
def test_001(self): vlen = 256 subc = 208 L = 8 cplen = 12 blocklen = vlen + cplen framelength = 11 bits_per_subc = [2]*vlen data_blocks = 10 N = int( 1e8 ) profiling = False pre0,fd = morellimengali_designer.create( subc, vlen, L ) ofdm_frames = \ ofdm_frame_src( vlen, data_blocks, pre0, cplen, framelength, bits_per_subc ) uut = autocorrelator( vlen/2, vlen/2 ) ref = recursive_timing_metric( vlen ) limit_stream = gr.head( gr.sizeof_float, N ) self.tb.connect( ofdm_frames, uut, limit_stream, gr.null_sink( gr.sizeof_float ) ) # limit_stream.enable_detailed_profiling( profiling ) # uut.s2.enable_detailed_profiling( profiling ) if not profiling: limit_stream2 = gr.head( gr.sizeof_float, N ) compare = gr.sub_ff() err_acc = ofdm.accumulator_ff() skip_err = gr.skiphead( gr.sizeof_float, N-1 ) last_err_val = gr.head( gr.sizeof_float, 1 ) err_sink = gr.vector_sink_f() self.tb.connect( ofdm_frames, ref, limit_stream2, gr.null_sink( gr.sizeof_float ) ) self.tb.connect( uut, ( compare, 0 ) ) self.tb.connect( ref, ( compare, 1 ) ) self.tb.connect( compare, err_acc ) self.tb.connect( err_acc, skip_err ) self.tb.connect( skip_err, last_err_val ) self.tb.connect( last_err_val, err_sink ) # log_to_file( self.tb, limit_stream, "data/autocorr_uut.float" ) # log_to_file( self.tb, limit_stream2, "data/autocorr_ref.float" ) # r = time_it( self.tb ) self.tb.run() # print "Expected throughput: %s Samples/s" % ( eng_notation.num_to_str( float(N) / r ) ) if not profiling: e = numpy.array( err_sink.data() )[0] print "Err: %.7f" % ( e )