[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss-gnuradio] About receiver physical layer of Benchmark
From: |
Hassaan Ajaz |
Subject: |
[Discuss-gnuradio] About receiver physical layer of Benchmark |
Date: |
Mon, 26 Apr 2010 22:59:38 +0500 |
Hi
I am basically trying to
develop a Cooperative MIMO test-bed.
So my problem is regarding the physical layer of benchmark
for gmsk
The basic flow graph of benchmark for receiver is
USRP--->Channel
Filter--->Quadrature Demod--->Clock recovery--->Slicer--->Correlator--->Framer
sink
Now what I am trying to do is to put a msg sink after the
clock recovery block in the file pkt.py by first removing slicer from gmsk.py
and then adding the following code in pkt.py
PROBLEM WITH CODE:The code does not show any syntax errors but it
does not receive anything at all. Kindly help.
class demod_pkts(gr.hier_block2):
"""
Wrap an
arbitrary digital demodulator in our packet handling framework.
The input is complex baseband. When packets are demodulated, they are
passed to the
app via the callback.
"""
def __init__(self,
demodulator, access_code=None, callback=None, threshold=-1):
"""
Hierarchical block for demodulating and deframing packets.
The input is the complex modulated signal at baseband.
Demodulated packets are sent to the handler.
@param
demodulator: instance of demodulator class (gr_block or hier_block2)
@type demodulator: complex baseband in
@param access_code: AKA sync vector
@type
access_code: string of 1's and 0's
@param callback: function
of two args: ok, payload
@type callback: ok: bool; payload:
string
@param threshold: detect access_code with up to threshold bits
wrong (-1 -> use default)
@type threshold: int
"""
gr.hier_block2.__init__(self, "demod_pkts",
gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input
signature
gr.io_signature(0, 0,
0)) # Output signature
self._demodulator = demodulator
if access_code is None:
access_code = packet_utils.default_access_code
if not packet_utils.is_1_0_string(access_code):
raise ValueError, "Invalid access_code %r. Must be string of 1's and
0's" % (access_code,)
self._access_code = access_code
if threshold ==
-1:
threshold = 12 # FIXME raise exception
self._rcvd_pktq = gr.msg_queue() # holds packets from the PHY
self._msg_sink=gr.message_sink(gr.sizeof_float,self._rcvd_pktq,True) #have tried with both Dont_block true and false. No effect
#self.framer_sink = gr.framer_sink_1(self._rcvd_pktq)
self.connect(self, self._demodulator, self._msg_sink) #HERE I
have removed the access correlator onwards connection
self._watcher = _queue_watcher_thread(self._rcvd_pktq,
callback) #the received queue is then sent to the class queue
watcher
class _queue_watcher_thread(_threading.Thread):
def __init__(self, rcvd_pktq, callback):
_threading.Thread.__init__(self)
self.setDaemon(1)
self.rcvd_pktq = rcvd_pktq
self.callback = callback
self.keep_running = True
self._combine=combiner(self.callback) #class defined after next few lines
self.start()
def run(self):
while
self.keep_running:
msg = self.rcvd_pktq.delete_head()
#ok, payload = packet_utils.unmake_packet(msg.to_string(),
int(msg.arg1()))
self._combine.proc_pkt(msg) #here i have
called the function that inserts the FLOAT msg into the msg source queue
in the class combiner
class combiner(gr.hier_block2):
def __init__(self,callback):
gr.hier_block2.__init__(self, "combiner",
gr.io_signature(0, 0, 0), # Input signature
gr.io_signature(0, 0, 0)) # Output signature
self.call = callback
self.msgsrc=gr.message_source(gr.sizeof_float,4)
self.msgqq=gr.msg_queue()
self.slicer =
gr.binary_slicer_fb()
self.framer_sink =
gr.framer_sink_1(self.msgqq)
self.correlator =
gr.correlate_access_code_bb(packet_utils.default_access_code,
12)
self.connect(self.msgsrc, self.slicer,
self.correlator,self.framer_sink) #this is the source where i
inserted the msg and the connection with remaining modules
self._watcher=_que_watcher_thread(self.msgqq,self.call)
def proc_pkt(self, msge):
self.msgsrc.msgq().insert_tail(msge)
class _que_watcher_thread(_threading.Thread):
def
__init__(self, rcvd_pktq, callback):
_threading.Thread.__init__(self)
self.setDaemon(1)
self.rcvd_pktq = rcvd_pktq
self.callback = callback
self.keep_running = True
self.start()
def run(self):
while self.keep_running:
msg =
self.rcvd_pktq.delete_head()
ok, payload =
packet_utils.unmake_packet(msg.to_string(), int(msg.arg1()))
if self.callback:
self.callback(ok,
payload)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Discuss-gnuradio] About receiver physical layer of Benchmark,
Hassaan Ajaz <=