discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] Spectrum issues with wavfile_sink


From: Axel Belliard
Subject: [Discuss-gnuradio] Spectrum issues with wavfile_sink
Date: Thu, 29 Apr 2010 11:48:24 +0200 (CEST)
User-agent: SquirrelMail/1.5.1

Hi

I’m working on a stanag 4285 transmitter. To validate my work, I’m trying
to “record” my transmitter output and play it in Sigmira (a SDR that
manage  Stanag 4285).As I didn’t get my USRP yet, I’m using a
wavfile_sink.  See my code bellow.

About my code :
self.tx=Txpath_ss(self.taille,"s",1) is performing framing and channel coding
self.mod=modulateurStanag.stanag_mod(self.interpolation,0.2,False,False,False)
is the modulator. It is very similar to the d8psk modulator that can be
found in gnuradio project. Except there is no differential coding and the
mapping is weird


I’m facing two problems:
If I run several time my code, the fft plot and waterfall will show the
expected spectrum most of the times, but in some case they show only three
frequency lines at 1k,1k8, and 2k6.
If I play my generated wavfile with Sigmira, his spectrum analyse tools
always shows the expected spectrum and the three frequency line.

What is going wrong?

Axel

#!/usr/bin/env python
##################################################
# Gnuradio Python Flow Graph
# Title: Top Block
# Generated: Thu Apr 22 17:05:02 2010
##################################################

from gnuradio import blks2
from gnuradio import gr
from gnuradio.eng_option import eng_option
from gnuradio.wxgui import fftsink2
from gnuradio.wxgui import waterfallsink2
from grc_gnuradio import wxgui as grc_wxgui
from optparse import OptionParser
import numpy
import wx
from rxpath import Rxpath_ss
from txpath import Txpath_ss
from gnuradio import stanag
import modulateurStanag
from gnuradio.gr import firdes

class top_block(grc_wxgui.top_block_gui):

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


                self.src_data = (0,1,1,0.................)
                self.in_data = gr.vector_source_s (self.src_data)
                self.sample_rate=2401
                self.interpolation=8
                self.taille=len(self.src_data)
                ######################


                #####interleaving && Codage ########
                self.tx=Txpath_ss(self.taille,"s",1)##
                
self.mod=modulateurStanag.stanag_mod(self.interpolation,0.2,False,False,False)###
(root raised filter BW= 0.2)
                self.scale = gr.multiply_const_cc (0.5)
                ###frequency mixing#####
                self.convQ=gr.complex_to_real()
                self.loQ=gr.sig_source_f(self.sample_rate*self.interpolation,
gr.GR_COS_WAVE,1800.0,0.5,0)
                self.mixQ=gr.multiply_ff()

                self.convI=gr.complex_to_imag()
                self.loI=gr.sig_source_f(self.sample_rate*self.interpolation,
gr.GR_SIN_WAVE,1800.0,0.5,0)
                self.mixI=gr.multiply_ff()

                self.som=gr.add_ff()

                ####sinks####
                self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
                        self.GetWin(),
                        baseband_freq=0,
                        y_per_div=10,
                        y_divs=10,
                        ref_level=50,
                        sample_rate=19208,
                        fft_size=1024,
                        fft_rate=60,
                        average=False,
                        avg_alpha=None,
                        title="FFT Plot",
                        peak_hold=False,
                )
                self.Add(self.wxgui_fftsink2_0.win)
                self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_f(
                        self.GetWin(),
                        baseband_freq=0,
                        y_per_div=10,
                        ref_level=50,
                        sample_rate=19208,
                        fft_size=1024,
                        fft_rate=60,
                        average=False,
                        avg_alpha=None,
                        title="waterfall",
                )
                self.Add(self.wxgui_waterfallsink2_0.win)
                self.gr_wavfile_sink_0 = gr.wavfile_sink("StanagGnu2.wav", 1, 
19208, 16)
                self.gr_wavfile_sink_1 = gr.wavfile_sink("1k8.wav", 1, 19208, 
16)
                self.sink1= gr.vector_sink_f()
                self.sink2= gr.vector_sink_f()

                #############################

                #######Connections#################
                
self.connect(self.in_data,self.tx,self.mod,self.scale)#,self.demod,self.rx,self.sink3)
                self.connect(self.tx,self.sink1)

                self.connect(self.scale,self.convQ)
                self.connect(self.convQ,(self.mixQ,0))
                self.connect(self.loQ,(self.mixQ,1))

                self.connect(self.scale,self.convI)
                self.connect(self.convI,(self.mixI,0))
                self.connect(self.loI,(self.mixI,1))


                self.connect(self.mixQ,(self.som,0))
                self.connect(self.mixI,(self.som,1))
                self.connect(self.som,self.gr_wavfile_sink_0)

                #fft#


                self.connect(self.convQ,self.sink2)
                self.connect(self.som,self.wxgui_fftsink2_0)
                self.connect(self.som,self.wxgui_waterfallsink2_0)

        def print_out(self):
                print "\n 3 :", len(self.sink2.data()),max(self.sink2.data())




if __name__ == '__main__':
        parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
        (options, args) = parser.parse_args()
        tb = top_block()
        tb.Run(True)
        tb.print_out()






reply via email to

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