Example #1
0
def TestTx():
    """ Parser Options """
    parser = OptionParser (option_class=eng_option)
    RadioTx.add_parser_options (parser)
    (options, args) = parser.parse_args ()
    if len(args)!=0:
        parser.print_help()
        sys.exit(1)

    print "TestTx\n=========="

    tb = gr.top_block()
    tx = RadioTx(options)
    tb.connect(tx)

    #T, w, C = 10.0, 100.0e3, 100
    T, w, C = 10.0, 40.0e3, 100
    A = 4000
    if SEND_MIMO_TRAINING:
        T = 10.0
        s = "hi"*4
        txvector = mimo.txvector()
        txvector.set_length(len(s) )
        phy = mimo.tx(options.nchannels)
        phy.configure(txvector)
        phy.set_gain(10000)
        phy.set_upsampling_factor(2)
        phy.transmit(s)
        m = phy.outputQ().delete_head()
        print "created message ... %d samples"%(m.length()/gr.sizeof_gr_complex/options.nchannels)
    else:
        P = min(T, C/w)
        k = max(1, int(T/P) )
        s = Signal()
        s.setData(make_exponential(A, P, w, options.sample_rate) )
        m = gr.message_from_string(s.string(k), 0, 1, len(s.vector())*k )
        print "created message ... %d samples"%(int(k*P*options.sample_rate) )

    interval = 0.2
    g = FuncThread(send_msg, "send msg", m, tx.pad.inputQ(), interval)
    g.setDaemon(1)
    g.start()
    
    stoptime = T+5.0
    f = FuncThread(send_stoprf, "stop rf", tx, stoptime)
    f.setDaemon(1)
    f.start()
    
    print "running ..."
    tb.run()
    print "stoppping ..."
Example #2
0
 def make_tx(self, options):
     return mimo.tx()