[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r4686 - gnuradio/branches/developers/jcorgan/sounder/g
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r4686 - gnuradio/branches/developers/jcorgan/sounder/gnuradio-examples/python/hier/sounder |
Date: |
Thu, 1 Mar 2007 21:37:06 -0700 (MST) |
Author: jcorgan
Date: 2007-03-01 21:37:06 -0700 (Thu, 01 Mar 2007)
New Revision: 4686
Modified:
gnuradio/branches/developers/jcorgan/sounder/gnuradio-examples/python/hier/sounder/sounder_rx.py
gnuradio/branches/developers/jcorgan/sounder/gnuradio-examples/python/hier/sounder/usrp_sounder_rx.py
gnuradio/branches/developers/jcorgan/sounder/gnuradio-examples/python/hier/sounder/usrp_source.py
Log:
Refactored USRP specific code from sounder_rx
Modified:
gnuradio/branches/developers/jcorgan/sounder/gnuradio-examples/python/hier/sounder/sounder_rx.py
===================================================================
---
gnuradio/branches/developers/jcorgan/sounder/gnuradio-examples/python/hier/sounder/sounder_rx.py
2007-03-02 03:57:30 UTC (rev 4685)
+++
gnuradio/branches/developers/jcorgan/sounder/gnuradio-examples/python/hier/sounder/sounder_rx.py
2007-03-02 04:37:06 UTC (rev 4686)
@@ -28,28 +28,21 @@
class sounder_rx(gr.hier_block2):
"""
- Creates a top-level channel sounder block with the given parameters.
+ Creates a channel sounder receiver block with the given parameters.
"""
- def __init__(self, subdev_spec, freq, cal, verbose, max_delay, chip_rate,
gain):
+ def __init__(self, chip_rate, max_delay, verbose):
# Call hierarchical block constructor
# Top-level blocks have no inputs or outputs
gr.hier_block2.__init__(self,
- "sounder_rx", # Block typename
- gr.io_signature(0,0,0), # Input signature
- gr.io_signature(0,0,0)) # Output signature
- self._freq = freq
- self._cal = cal
- self._verbose = verbose
+ "sounder_rx", #
Block typename
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), #
Input signature
+ gr.io_signature(0,0,0)) #
Output signature
self._max_delay = max_delay
+ self._chip_rate = chip_rate
+ self._verbose = verbose
- self._u = usrp_source_c(0, subdev_spec, gain, chip_rate, self._freq,
self._cal, verbose)
- self.define_component("usrp", self._u)
-
- self._chip_rate = self._u._if_rate
- self._resolution = 1.0/self._chip_rate
-
min_chips = int(math.ceil(2.0*self._max_delay * self._chip_rate))
degree = int(math.ceil(math.log(min_chips)/math.log(2)))
self._length = 2**degree-1
@@ -57,9 +50,6 @@
self._tap = 0.0001
if self._verbose:
- print "Actual chip rate is", n2s(self._chip_rate), "chips/sec"
- print "Resolution is", n2s(self._resolution), "sec"
- print "Using specified maximum delay spread of", self._max_delay,
"sec"
print "Mininum sequence length needed is", n2s(min_chips), "chips"
print "Using PN sequence of degree", degree, "length", self._length
print "Sequences per second is", self._seq_per_sec
@@ -71,7 +61,9 @@
self.define_component("keep",
gr.keep_one_in_n(gr.sizeof_gr_complex*self._length, int(self._seq_per_sec)))
self.define_component("sink",
gr.file_sink(gr.sizeof_gr_complex*self._length, "FFT.dat"))
- self.connect("usrp", 0, "s2v", 0)
+ # Ultimately this will be
+ # self.connect("self s2v fft avg keep sink")
+ self.connect("self", 0, "s2v", 0)
self.connect("s2v", 0, "fft", 0)
self.connect("fft", 0, "avg", 0)
self.connect("avg", 0, "keep", 0)
Modified:
gnuradio/branches/developers/jcorgan/sounder/gnuradio-examples/python/hier/sounder/usrp_sounder_rx.py
===================================================================
---
gnuradio/branches/developers/jcorgan/sounder/gnuradio-examples/python/hier/sounder/usrp_sounder_rx.py
2007-03-02 03:57:30 UTC (rev 4685)
+++
gnuradio/branches/developers/jcorgan/sounder/gnuradio-examples/python/hier/sounder/usrp_sounder_rx.py
2007-03-02 04:37:06 UTC (rev 4686)
@@ -23,8 +23,38 @@
from gnuradio import gr, eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser
+from usrp_source import usrp_source_c
from sounder_rx import sounder_rx
+n2s = eng_notation.num_to_str
+
+class usrp_sounder_rx(gr.hier_block2):
+ def __init__(self, subdev_spec, freq, cal, verbose, max_delay, chip_rate,
gain):
+ # Call hierarchical block constructor
+ # Top-level blocks have no inputs or outputs
+ gr.hier_block2.__init__(self,
+ "sounder_rx", # Block typename
+ gr.io_signature(0,0,0), # Input signature
+ gr.io_signature(0,0,0)) # Output signature
+ self._freq = freq
+ self._cal = cal
+ self._verbose = verbose
+ self._max_delay = max_delay
+ self._gain = gain
+
+ self._u = usrp_source_c(0, subdev_spec, self._gain, chip_rate,
self._freq, self._cal, self._verbose)
+ self.define_component("usrp", self._u)
+ self._chip_rate = self._u._if_rate
+
+ self.define_component("sounder_rx", sounder_rx(self._chip_rate,
self._max_delay, self._verbose))
+
+ if self._verbose:
+ print "Chip rate is", n2s(self._chip_rate), "chips/sec"
+ print "Resolution is", n2s(1.0/self._chip_rate), "sec"
+ print "Using specified maximum delay spread of", self._max_delay,
"sec"
+
+ self.connect("usrp", 0, "sounder_rx", 0)
+
def main():
parser = OptionParser(option_class=eng_option)
@@ -50,9 +80,9 @@
sys.exit(1)
# Create an instance of a hierarchical block
- top_block = sounder_rx(options.rx_subdev_spec, options.freq,
options.cal,
- options.verbose, options.max_delay,
options.chip_rate,
- options.gain)
+ top_block = usrp_sounder_rx(options.rx_subdev_spec, options.freq,
options.cal,
+ options.verbose, options.max_delay,
options.chip_rate,
+ options.gain)
# Create an instance of a runtime, passing it the top block
# to process
Modified:
gnuradio/branches/developers/jcorgan/sounder/gnuradio-examples/python/hier/sounder/usrp_source.py
===================================================================
---
gnuradio/branches/developers/jcorgan/sounder/gnuradio-examples/python/hier/sounder/usrp_source.py
2007-03-02 03:57:30 UTC (rev 4685)
+++
gnuradio/branches/developers/jcorgan/sounder/gnuradio-examples/python/hier/sounder/usrp_source.py
2007-03-02 04:37:06 UTC (rev 4686)
@@ -93,7 +93,9 @@
gain = (g[0]+g[1])/2.0
self._gain = gain
self._subdev.set_gain(self._gain)
-
+ if self._verbose:
+ print "USRP gain set to", self._gain
+
def set_calibration(self, calibration):
self._cal = calibration
if self._verbose:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r4686 - gnuradio/branches/developers/jcorgan/sounder/gnuradio-examples/python/hier/sounder,
jcorgan <=