Hey Eric, Michael and other friends:
My code is working well now. But I met two new problems, which are not so crucial, but really important to me.
1. When I initilize the Viterbi algorithm, I wish that for the first trunk of data, ninput_items >= Viterbi algorithm's working length, let's say ninput_items > 100 (only for the first trunk of data, doesn't matter for later ones). Now I am using assert(ninput_items > 100), which may not may not let me get through. Is there anyway so that I could control the number of incoming samples?
2. Another problem is more difficult to describe, the following is part of my main code:
class my_graph(gr.flow_graph):
def __init__(self, rx_callbackA, rx_callbackB, spb, bt, SNR, freq_error):
gr.flow_graph.__init__(self)
fg = self
# Tuning Parameters
gain_mu = 0.002*spb
omega = spb*(1+freq_error)
# transmitter
self.packet_transmitterA = gmsk2_mod_pkts(fg, spb=spb, bt=bt)
self.packet_transmitterB = gmsk2_mod_pkts(fg, spb=spb, bt=bt)
adder = gr.add_cc ()
const = gr.multiply_const_cc (0.5)
fg.connect (self.packet_transmitterA , (adder, 0))
fg.connect (self.packet_transmitterB, const, (adder, 1))
self.packet_receiver = Separator_demod_pkts(fg, callbackA=rx_callbackA, callbackB=rx_callbackB,
spb=spb, gain_mu=gain_mu,
freq_error=freq_error, omega=omega)
fg.connect (adder, self.packet_receiver)
Then in the main function, i do
while n < nbytes:
send_pkt_A(struct.pack('!H', pktnoA) + 'A' + (pkt_sizeA - 3) * chr(pktnoA & 0xff))
send_pkt_B(struct.pack('!H', pktnoB) + 'B' + (pkt_sizeB - 3) * chr(pktnoB & 0xff))
n += pkt_size
print "n now is %d" % n
pktnoA += 1
pktnoB += 1
Here pkt_size is 1500, nbytes is 1M as default. I omit other parts of my code because they are not so important here. I print the value of n in the loop because I want to see when it stops. So the output is sth like this:
I am stream A's callback function
ok = True from 'A', pktno = 46 len(payload) = 1500 118/118
n now is 108000
I am stream B's callback function
ok = True from 'B', pktno = 247 len(payload) = 1000 119/119
n now is 109500
I am stream B's callback function
ok = True from 'B', pktno = 248 len(payload) = 1000 120/120
I am stream A's callback function
ok = True from 'A', pktno = 47 len(payload) = 1500 121/121
I am stream B's callback function
ok = True from 'B', pktno = 249 len(payload) = 1000 122/122
I am stream A's callback function
ok = True from 'A', pktno = 48 len(payload) = 1500 123/123
Then it stops!!! Nothing happens after that. It appears to me that the process goes somewhere and never comes back. The current value of n is still far from nbytes, but it just stops there. One possible solution I found out was that I could change the "msgq_limit" parameter of the gr_message_source in gmsk2_pkt. If I increase "msgq_limit", the program could go further and further, with larger n and processed packets, but still stops some timeand never continues.
So could anyone help me address these two things? Thank you very much in advance!
Dawei
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org http://lists.gnu.org/mailman/listinfo/discuss-gnuradio