Hi, I'm also having issues with the use of this block if I try the same concept. I'm not concerned with the noise generation and just want to modulate and then demodulate data. I am using the vector creation and packing as stated above. The results I'm getting are deterministic, just incorrect. Here is what i'm using:
099 self.src_data = 3 * [0x40,0x41,0x42,0x43,] 100 self.src0 = gr.vector_source_b(self.src_data) 101 self.mod = blks2.dbpsk_mod(8,0.35,False,True,False) 102 self.demod = blks2.dbpsk_demod(8,0.35,0.1,None,0.5,0.005,False,True,False) 103 self.pack = gr.unpacked_to_packed_bb(1,gr.GR_MSB_FIRST) 104 self.connect(self.src0,self.mod,self.demod,self.pack) 105 106 self.sink1 = gr.vector_sink_b() 107 self.connect(self.pack,self.sink1) 108 109 self.sink2 = gr.vector_sink_b() 110 self.connect = (self.src0,self.sink2) 111 112 def print_data(self): 113 print "data: ",self.src_data 114 print len(self.src_data) 115 print "demod: ",self.sink1.data() 116 print len(self.sink1.data()) 117 print "check: ",self.sink2.data() 118 print len(self.sink2.data()) Here is the output: >>> gr_fir_ccf: using SSE Modulator: bits per symbol: 1 Gray code: False RRC roll-off factor: 0.35 Demodulator: bits per symbol: 1 Gray code: False RRC roll-off factor: 0.35 Costas Loop alpha: 1.00e-01 Costas Loop beta: 2.50e-03 M&M mu: 0.50 M&M mu gain: 1.00e-01 M&M omega: 8.00 M&M omega gain: 2.50e-03 M&M omega limit: 0.01 data: [64, 65, 66, 67, 64, 65, 66, 67, 64, 65, 66, 67] 12 demod: (1, 239, 1, 5, 9, 13, 1, 5, 9, 13, 1) 11 check: () 0 Thanks in advance for any help On Thu, Mar 11, 2010 at 11:43 AM, Tom Rondeau <trondeau1...@gmail.com> wrote: > On Thu, Mar 11, 2010 at 4:09 AM, Axel Belliard <beill...@esiee.fr> wrote: >> 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 > > This is a bit confusing, but it makes sense in the way we meant for > the digital modulators to work. The problem is that you are trying to > put in "bits" into the modulator, which actually takes a "packet" > stream of bits. In other words, when you think you are putting in the > bits "0 0 1 1," you are actually telling it that you are putting in > the bytes "0 0 1 1" that gets unpacked into the bit stream "0 0 0 0 0 > 0 0 0, 0 0 0 0 0 0 0 0, 0 0 0 0 0 0 0 1, 0 0 0 0 0 0 0 1" or "0x00 > 0x00 0x01 0x01". > > What you want to put in as the source is a vector of "0x33" instead. > You can also use the gr.unpacked_to_packed_bb on the demod side to > repack the bits. I've edited your code below to show how to do this. > Now, when you do this, you're still going to see some random stuff > going on in the output stream for the first few symbols. These garbage > bits are due to the filters' group delays. > > One final thought. You're doing a frequency shift operation on the > complex baseband signal and then almost immediately downconverting it. > This doesn't really do anything of any consequence to your simulation > except require you to use a larger sampling rate than really required. > If you want to test frequency offset errors, you can use the features > in the channel model that we have (blks2.channel_model), which takes > in a noise voltage, frequency offset, timing offset, and a vector of > taps to simulate multipath. > > >> 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 > > N = <something> > self.src_data = N*[0x33, ] # make an N-long vector > with 0x33 in every element > >> 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) > > self.pack = gr.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST) > >> ###################### >> >> ######Connection des blocs##### > > self.connect(self.src0,self.objMod, self.mixer, > self.air_noise, > self.chan_filter, self.objDeMod, self.pack) > >> ##################### >> >> ################# Observation entree/sortie######## >> self.sink1 = gr.vector_sink_b() > > self.connect(self.pack, ,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 >> > > > _______________________________________________ > Discuss-gnuradio mailing list > Discuss-gnuradio@gnu.org > http://lists.gnu.org/mailman/listinfo/discuss-gnuradio > _______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org http://lists.gnu.org/mailman/listinfo/discuss-gnuradio