discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] Difference between run and start/stop commands


From: mjquinn
Subject: [Discuss-gnuradio] Difference between run and start/stop commands
Date: Fri, 09 Dec 2005 19:25:27 -0500
User-agent: Internet Messaging Program (IMP) H3 (4.0.4)

I know that the best method for correlating a is to use the new GMSK code. However, I am trying to understand the difference between the run and start/stop/wait commands and also gain additional insight into the simple_correlator function. When I try to run the below code using the fg.run command it displays the appropriate sequence numbers. Once it reaches the final packet, the program stops and seems to be waiting for additional input. I suspect that this hang up is caused by the simple_correlator function, but I am not really sure of the details of why. If I replace the fg.run command with the combination of fg.start and fg.stop, the program works fine. However, I would prefer not to have to hit enter once the program finishes executing. Why does fg.start/stop work but fg.run not work? Also, in the check_lfsr function, what is the significance of runlength value?

Thanks,
Mike

#!/usr/bin/env python

from gnuradio import gr
from gnuradio.eng_option import eng_option
from optparse import OptionParser
import math

from gnuradio.wxgui import scopesink
from gnuradio.wxgui import stdgui, fftsink
import wx
from gnuradio import howto
from gnuradio import usrp

def open_pipelines (filename, repeat):

        payload_size = 1024     # in bytes
        data_rate = 100e3
        sw_interp = 8
        fs = sw_interp * data_rate

        fg = gr.flow_graph()
       tx_max_deviation = 50e3  stream_length = 100*512  # in shorts

        # ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
        # Transmitter Pipeline
        # ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

        data_src = gr.lfsr_32k_source_s ()
        src_head = gr.head (gr.sizeof_short, int (stream_length))
        shorts_to_bytes = howto.shorts_to_bytes ()

        framer = gr.simple_framer (payload_size)
       bytes_to_syms = gr.bytes_to_syms ()

        if 1:
           interp_taps =  gr.firdes.low_pass (sw_interp,      # gain
                                              fs,             # sampling rate
                                              data_rate / 2 * 1.2, # cutoff
data_rate/2 * 0.4, # trans width
                                              gr.firdes.WIN_HANN)


        interp = gr.interp_fir_filter_fff (sw_interp, interp_taps)

        k = 2 * math.pi * tx_max_deviation / fs
       fmmod = gr.frequency_modulator_fc (k)
        gain = gr.multiply_const_cc (16000)


fg.connect (data_src, src_head, shorts_to_bytes, framer, bytes_to_syms, interp, fmmod, gain)

        # ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
        # Receiver Pipeline
        # ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

        filter_taps =  gr.firdes.low_pass (1,                   # gain
                                          fs,             # sampling rate
                                          data_rate / 2 * 1.1, # cutoff
                                          data_rate,           # trans width
                                          gr.firdes.WIN_HANN)

       filter = gr.fir_filter_ccf (1, filter_taps)
        k = 1
        fmdemod = gr.quadrature_demod_cf (k)

        corr = gr.simple_correlator (payload_size)

        bytes_to_shorts = howto.bytes_to_shorts ()
        head = gr.head (gr.sizeof_short, stream_length)
        check = gr.check_lfsr_32k_s ()
        fg.connect (gain, filter, fmdemod, corr, bytes_to_shorts, head, check)

        fg.run ()

        ntotal = check.ntotal ()
        nright = check.nright ()
        runlength = check.runlength ()

        print "ntotal    =", ntotal
        print "nright    =", nright
        print "nwrong    =", ntotal-nright
        print "runlength =", runlength
        print "error rate =", (ntotal-nright)/(1.0*ntotal)

# ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Main
# ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

def main():
   parser = OptionParser (option_class=eng_option)
parser.add_option ("-f", "--filename", type="string", default="payload.txt",
                      help="read data from FILENAME")
   parser.add_option ("-R", "--repeat", action="store_true", default=False)
     (options, args) = parser.parse_args ()

   open_pipelines (options.filename, options.repeat)

if __name__ == '__main__':
   try:
       main()
   except KeyboardInterrupt:
       pass




reply via email to

[Prev in Thread] Current Thread [Next in Thread]