Attribute/control stream question

Hello,

The processing of pulses into data requires me to keep track of valid
pulses (following samples are above threshold) and leading edges (sample
is 6 dB or more than previous sample and following sample is 6 dB or
less than current sample). I also want to indicate preamble start and
pass timestamps along. I have thought of three methods to do this but
do not know which would be the best one.

The first method is to have two streams through the blocks, one a float
stream containing the sample values and the other a short or int stream
containing the attributes and control. The float data makes it easier
to do processing as some of the blocks use 3 dB multiplication of the
samples (1.414 and 0.707). Being an old programmer I still have the
float equals slow performance mindset.

The second method is to have the two streams as shorts. I have to deal
with an integer multiplication and division (sample * 707 / 1000). I
have no handle if integers would be faster than floats other than
integer division tends to be expensive.

The third method is to use one integer stream and have the upper 16 bits
be the attributes/control and the lower 16 bits be the value. This
method has an additional minor disadvantage over the second method of
needing to mask off the upper 16 bits when using the value but I do not
have to deal with two streams.

73 Eric

Eric A. Cottrell wrote:

Hello,

The processing of pulses into data requires me to keep track of valid
pulses (following samples are above threshold) and leading edges (sample
is 6 dB or more than previous sample and following sample is 6 dB or
less than current sample). I also want to indicate preamble start and
pass timestamps along. I have thought of three methods to do this but
do not know which would be the best one.

You can do this, or you may be able to break things up into chunks of
samples and process them as vectors. See the ofdm_sync code for an
example of how we do that.

integer division tends to be expensive.

Float multiplication is 1 cycle. Integer multiplication can actually be
slower these days.

The third method is to use one integer stream and have the upper 16 bits
be the attributes/control and the lower 16 bits be the value. This
method has an additional minor disadvantage over the second method of
needing to mask off the upper 16 bits when using the value but I do not
have to deal with two streams.

I would use separate streams so you don’t need to play with bit fields.
There are a number of places in the OFDM code where we use chars in
parallel with vectors of floats, and it works well for us.

Matt

Matt E. wrote:

You can do this, or you may be able to break things up into chunks of
samples and process them as vectors. See the ofdm_sync code for an
example of how we do that.

Also, off the top of my head, you might find the peak_detector and
sample_and_hold blocks useful for what you’re doing. If these won’t do
what you need, that at least the S/H block illustrates the use of
different streams where input stream 0 is some data type (float,
gr_complex, bytes, ints) and input stream 1 is a byte stream
(sizeof_char) as the control line.

Tom

Pleasde Help me!!!
grc

(grc:1774): Gtk-WARNING **: Unable to locate theme engine in
module_path: “pixmap”,

(grc:1774): Gtk-WARNING **: Unable to locate theme engine in
module_path: “pixmap”,

(grc:1774): Gtk-WARNING **: Unable to locate theme engine in
module_path: “pixmap”,

(grc:1774): Gtk-WARNING **: Unable to locate theme engine in
module_path: “pixmap”,
<<< Welcome to GNU Radio Companion 3.2.2 >>>
Error: ‘options’

Failue
Traceback (most recent call last):
File
“/usr/lib/python2.7/dist-packages/gnuradio/grc/gui/MainWindow.py”, line
174, in new_page
flow_graph = self._platform.get_new_flow_graph()
File “/usr/lib/python2.7/dist-packages/gnuradio/grc/base/Platform.py”,
line 149, in get_new_flow_graph
def get_new_flow_graph(self): return self.FlowGraph(self)
File “”, line 4, in init
File
“/usr/lib/python2.7/dist-packages/gnuradio/grc/base/FlowGraph.py”, line
37, in init
self.import_data()
File
“/usr/lib/python2.7/dist-packages/gnuradio/grc/base/FlowGraph.py”, line
192, in import_data
self._options_block = self.get_parent().get_new_block(self,
‘options’)
File “/usr/lib/python2.7/dist-packages/gnuradio/grc/base/Platform.py”,
line 159, in get_new_block
def get_new_block(self, flow_graph, key): return
self.Block(flow_graph, n=self._blocks_n[key])
File “/usr/lib/python2.7/dist-packages/gnuradio/grc/base/odict.py”,
line 34, in getitem
return self._data[key]
KeyError: ‘options’
Error: ‘options’

Failue
Traceback (most recent call last):
File
“/usr/lib/python2.7/dist-packages/gnuradio/grc/gui/MainWindow.py”, line
174, in new_page
flow_graph = self._platform.get_new_flow_graph()
File “/usr/lib/python2.7/dist-packages/gnuradio/grc/base/Platform.py”,
line 149, in get_new_flow_graph
def get_new_flow_graph(self): return self.FlowGraph(self)
File “”, line 4, in init
File
“/usr/lib/python2.7/dist-packages/gnuradio/grc/base/FlowGraph.py”, line
37, in init
self.import_data()
File
“/usr/lib/python2.7/dist-packages/gnuradio/grc/base/FlowGraph.py”, line
192, in import_data
self._options_block = self.get_parent().get_new_block(self,
‘options’)
File “/usr/lib/python2.7/dist-packages/gnuradio/grc/base/Platform.py”,
line 159, in get_new_block
def get_new_block(self, flow_graph, key): return
self.Block(flow_graph, n=self._blocks_n[key])
File “/usr/lib/python2.7/dist-packages/gnuradio/grc/base/odict.py”,
line 34, in getitem
return self._data[key]
KeyError: ‘options’
Traceback (most recent call last):
File “/usr/bin/grc”, line 53, in
ActionHandler(args, Platform())
File
“/usr/lib/python2.7/dist-packages/gnuradio/grc/gui/ActionHandler.py”,
line 70, in init
self.handle_states(Actions.APPLICATION_INITIALIZE)
File
“/usr/lib/python2.7/dist-packages/gnuradio/grc/gui/ActionHandler.py”,
line 332, in handle_states
Actions.get_action_from_name(Actions.ELEMENT_DELETE).set_sensitive(bool(self.get_flow_graph().get_selected_elements()))
File
“/usr/lib/python2.7/dist-packages/gnuradio/grc/gui/MainWindow.py”, line
281, in get_flow_graph
return self.get_page().get_flow_graph()
AttributeError: ‘NoneType’ object has no attribute ‘get_flow_graph’

Tom R. wrote:

do not know which would be the best one.
different streams where input stream 0 is some data type (float,
gr_complex, bytes, ints) and input stream 1 is a byte stream
(sizeof_char) as the control line.

Tom
Hello,

Thanks for the suggestions and observations. I will look at the OFDM
code and other blocks.

This is getting to be a big project. PPM is so simple but there are
some interesting enhanced receiving techniques to squeeze the last drop
of performance. I took a text description and turned it into code so no
doubt there are other functions I can use to optimize the current code.
I want to add capability to time stamp the frames and get signal levels
so I am modifying the code again. I also want to comment it so others
can figure out what is going on. Sorry it is taking some time to get
the code ready but I want the code structure to be set before check-in.

I am still figuring out GNURadio and Python so I looked at the cfile
example and used it to improve my log program. I noticed that I may be
able to use a higher sample rate if I go with the 4rx0tx USRP file. A
future enhancement may be to put the AM detector in the USRP and just
send shorts over the USB bus. I want to try 10 or 16 MSPS rate to see
if performance improves.

I want to try the OFDM code anyway and see if I get any data off the
BPSK carriers of IBOC AM stations used for station information.

73 Eric