Hi,
I am currently trying to implement a modulator/demodulator for TETRA using pi/4 DQPSK. I
tried to use cqpsk.py which was provided with this package, but apparently some functions
such as psk.constellation[] are not available in the new version of gnuradio. I created a
list of constellation points to be used by chunks_to_symbols_bc() function, and I think
this has solved this issue. I have another issue: when I modulate a string of bits in a
file, and then demodulate it, the output contains 10 zeros and then a few numbers between
0 to 255 which does not seem to be related to the input bit stream at all. Could anyone
please advise me on the matter? I am using GNURadio3.6.0, and main bits of code are
attached:
Regards,
Vahid
CQPSK.py cqpsk_mod() modification:
...
self.pi4map = [1, 3, 7, 5]
self.constel = [1+0j,0.7+0.7j,0+1j,-0.7+07j,-1+0j,-0.7-0.7j,0-1j,0.7-0.7j]
self.symbol_mapper = gr.map_bb(self.pi4map)
self.diffenc = gr.diff_encoder_bb(arity)
self.chunks2symbols = gr.chunks_to_symbols_bc(self.constel)
...
-------------------------------------------------------------------
Modulator:
sample_rate = options.sample_rate
symbol_rate = 18000
sps = 2
IN = gr.file_source(gr.sizeof_char, options.input_file, repeat = False)
#IN = (1,0,0,0,1,1,0,0)
#src = gr.vector_source_b (IN)
MOD = cqpsk.cqpsk_mod( samples_per_symbol = sps,
excess_bw=0.35,
log=options.log,
verbose=options.verbose)
OUT = gr.file_sink(gr.sizeof_gr_complex, options.output_file)
# r = float(sample_rate) / float(new_sample_rate)
# INTERPOLATOR = gr.fractional_interpolator_cc(0, r)
self.connect(IN, MOD, OUT)
---------------------------------------------------------------
Demodulator:
sample_rate = options.sample_rate
symbol_rate = 18000
sps = 2
# output rate will be 36,000
ntaps = 11 * sps
new_sample_rate = symbol_rate * sps
channel_taps = gr.firdes.low_pass(1.0, sample_rate, options.low_pass,
options.low_pass * 0.1, gr.firdes.WIN_HANN)
FILTER = gr.freq_xlating_fir_filter_ccf(1, channel_taps, options.calibration,
sample_rate)
sys.stderr.write("sample rate: %d\n" %(sample_rate))
IN = gr.file_source(gr.sizeof_gr_complex, options.input_file, repeat = False)
DEMOD = cqpsk.cqpsk_demod( samples_per_symbol = sps,
excess_bw=0.35,
costas_alpha=0.03,
gain_mu=0.05,
mu=0.05,
omega_relative_limit=0.05,
log=options.log,
verbose=options.verbose)
self.convert = gr.float_to_char()
self.convert2 = gr.float_to_char()
OUT = gr.file_sink(gr.sizeof_char, options.output_file)
self.sink1 = gr.vector_sink_b()
r = float(sample_rate) / float(new_sample_rate)
INTERPOLATOR = gr.fractional_interpolator_cc(0, r)
self.connect(IN, FILTER, INTERPOLATOR, DEMOD, self.convert, OUT)
self.connect (DEMOD,self.convert2,self.sink1)
def print_data(self):
print "data in sink1 is: ",self.sink1.data()
---------------