discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Testing


From: Activecat
Subject: Re: [Discuss-gnuradio] Testing
Date: Wed, 30 Apr 2014 16:37:33 +0800

You should attached the files where you put the std::cout.
The std::cout should be in the work() function.


On Wed, Apr 30, 2014 at 11:07 AM, Sara Chérif <address@hidden> wrote:
I am testing some blocks to understand the synchronization in ofdm . I edited c++ files & put std::cout for all variables in  frequency_modulator_fc_impl.cc and multiply_cc_impl.cc and then I rebuilt using cmake../  then make then sudo make install . But when I run the python file "./top_block.py"  I got an empty output from vector sinks also I got only the values of variables in multiply_cc_impl.cc on terminal . so why the values of variables of frequency_modulator_fc_impl.cc aren't shown on terminal ?!!!!!!!

Thanks.

Here is the python file


#!/usr/bin/env python
##################################################
# Gnuradio Python Flow Graph
# Title: Top Block
# Generated: Wed Apr 23 05:43:13 2014
##################################################

from gnuradio import blocks
from gnuradio import eng_notation
from gnuradio import gr
from gnuradio.eng_option import eng_option
from gnuradio.filter import firdes
from grc_gnuradio import wxgui as grc_wxgui
from optparse import OptionParser
import wx
from gnuradio import digital
from gnuradio import analog

class top_block(grc_wxgui.top_block_gui):

    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000
        fft_len=512
        cp_len=128
        n_sync_words=1
        frame_length_tag_key = "frame_length"

        ##################################################
        # Blocks
        ##################################################
        self.blocks_vector_source_x_0 = blocks.vector_source_c((1, 1, 1,0,0,0,1,0,1), False, 1, [])
       
        self.sync_detect = digital.ofdm_sync_sc_cfb(fft_len, cp_len)
        self.delay = blocks.delay(gr.sizeof_gr_complex, fft_len+cp_len)
        self.oscillator = analog.frequency_modulator_fc(-2.0 / fft_len)
        self.mixer = blocks.multiply_cc()
        self.hpd = digital.header_payload_demux(
            n_sync_words+1,       # Number of OFDM symbols before payload (sync + 1 sym header)
            fft_len, cp_len,      # FFT length, guard interval
            frame_length_tag_key, # Frame length tag key
            "",                   # We're not using trigger tags
            True                  # One output item is one OFDM symbol (False would output complex scalars)
        )

        self.blocks_vector_sink_x_0 = blocks.vector_sink_b(4096)
        self.blocks_vector_sink_x_1 = blocks.vector_sink_b(4096)

        ##################################################
        # Connections
        ##################################################
       
        self.connect((self.blocks_vector_source_x_0, 0), (self.sync_detect))
        self.connect((self.blocks_vector_source_x_0, 0), self.delay, (self.mixer, 0), (self.hpd, 0), (self.blocks_vector_sink_x_0, 0))
        self.connect((self.sync_detect, 0), self.oscillator, (self.mixer, 1))
        self.connect((self.sync_detect, 1), (self.hpd, 1),(self.blocks_vector_sink_x_1, 0))
       
        #if debug_log:
         #   self.connect((sync_detect, 0), blocks.file_sink(gr.sizeof_float, 'freq-offset.dat'))
          #  self.connect((sync_detect, 1), blocks.file_sink(gr.sizeof_char, 'sync-detect.dat'))


# QT sink close method reimplementation

    def get_samp_rate(self):
        return self.samp_rate

    def set_samp_rate(self, samp_rate):
        self.samp_rate = samp_rate

if __name__ == '__main__':
    import ctypes
    import sys
    if sys.platform.startswith('linux'):
        try:
            x11 = ctypes.cdll.LoadLibrary('libX11.so')
            x11.XInitThreads()
        except:
            print "Warning: failed to XInitThreads()"
    parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
    (options, args) = parser.parse_args()
    tb = top_block()
    tb.Start(True)
    tb.Wait()
    print tb.blocks_vector_sink_x_0.data()
    print tb.blocks_vector_sink_x_1.data()

_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio



reply via email to

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