discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] bpsk Simulation


From: Axel Belliard
Subject: [Discuss-gnuradio] bpsk Simulation
Date: Thu, 11 Mar 2010 10:09:49 +0100 (CET)
User-agent: SquirrelMail/1.5.1

Hi,

I'm new to gnu radio. To get familiar with this project, I'm trying to
simulate a dbpsk link.

My flow graph look like this :
stream of bits => Modulation => frequency up translation => Noisy channel
=> frequency down translation => Demodulation

But, there is something going wrong!! If the input stream looks like this
: 0 0 1 1 0 0 1 1 0 0 1 1..... the output will be ( after Costa's loop and
MM are stabilized )  : 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1......
 I looked for an undesired decimation, but didn't find any. Do you Have
any idea of what is going wrong?

Axel

My code :
class my_top_block(gr.top_block):
        def __init__(self):
                gr.top_block.__init__(self)
                fg = gr.flow_graph()

                sps = 8
                symbol_rate = 1625000.0 / 6.0
                sample_rate = sps * symbol_rate
                p_size = 1024
                lo_freq = 7.5e5
                lp_cutoff = 2.5e5
                lp_tw = 5e5
                noise_mag = 0.0
                #Source
                self.src_data = (big stream of : 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 
1)
                self.src0 = gr.vector_source_b (self.src_data)
                ######

                ###Modulation####
                self.objMod = dbpsk.dbpsk_mod(sps,0.35,False,False,False)
                #################

                ### Canal########
                # Mix to IF
                self.lo = gr.sig_source_c(sample_rate, gr.GR_SIN_WAVE, 
lo_freq,1.0, 0)
                self.mixer = gr.multiply_cc()
                self.connect(self.lo, (self.mixer, 1))
                # Simulate noise in the channel
                self.noise = gr.noise_source_c(gr.GR_GAUSSIAN, noise_mag)
                self.air_noise = gr.add_cc()
                self.connect(self.noise, (self.air_noise, 1))
                # Mix to baseband
                self.chan_taps = gr.firdes.low_pass(1.0, sample_rate, 
lp_cutoff, lp_tw,
gr.firdes.WIN_HAMMING)
                self.chan_filter = gr.freq_xlating_fir_filter_ccc(1,
self.chan_taps,-lo_freq, sample_rate)
                ###################

                ### Demodulation######
                self.objDeMod=dbpsk.dbpsk_demod(sps,0.35)
                ######################

                ######Connection des blocs#####
                self.connect(self.src0,self.objMod, self.mixer, self.air_noise,
self.chan_filter, self.objDeMod)
                #####################

        ################# Observation entree/sortie########
                self.sink1 = gr.vector_sink_b()
                self.connect(self.objDeMod,self.sink1)
                self.sink2 = gr.vector_sink_b()
                self.connect(self.src0,self.sink2)

        def print_data(self):
                print "demod: ",self.sink1.data()
                print len(self.sink1.data())
                print "check: ",self.sink2.data()
                print len(self.sink2.data())
         ################################################
if __name__ == '__main__':
        try:
                tb=my_top_block()
                tb.run()
                tb.print_data()
        except KeyboardInterrupt:
                pass






reply via email to

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