Comparator block?

Hi,

I would like to have a comparator in my GRC block design to compair
something like SNR or RMS or both on RX channels in my design.

Logic would be something like…

if channel A>B then switch to channel B else use channel A.

I have found the ‘slector’ block which looks useful in switching the
channel sources based on routing value…

I found threshold block which includes a comparator? but no comparator
block.

Is there a reason there is no comparator block? I read the IF statement
should be avoided in FPGA design although a comparator is quite standard
in electronic design ?

Maybe there is a better way to achieve deversity and i’m missing
something obvious? I want to have diversity switching in each differnt
channel frequency / bandwidth and not just at the IQ source…

any ideas much welcome… or even a pointer to a comparator block !

I’m new at GNUradio and have’nt made a custom block yet… but maybe its
time to try !!! ??

Looking into this more it seams I will just have to add ‘IF else
statement’ to generated python code… It would be nice if GNUradio had
this built in so I could experiment without hacking code!!

Ah well, anyone know any reason why a comparator or an IF block was
never included?

Ben B. wrote in post #1160904:

Hi,

I would like to have a comparator in my GRC block design to compair
something like SNR or RMS or both on RX channels in my design.

Logic would be something like…

if channel A>B then switch to channel B else use channel A.

I have found the ‘slector’ block which looks useful in switching the
channel sources based on routing value…

I found threshold block which includes a comparator? but no comparator
block.

Is there a reason there is no comparator block? I read the IF statement
should be avoided in FPGA design although a comparator is quite standard
in electronic design ?

Maybe there is a better way to achieve deversity and i’m missing
something obvious? I want to have diversity switching in each differnt
channel frequency / bandwidth and not just at the IQ source…

any ideas much welcome… or even a pointer to a comparator block !

I’m new at GNUradio and have’nt made a custom block yet… but maybe its
time to try !!! ??

Just in case anyone is interested !

I managed to get diversity switching between 2 channels with 2 RMS
blocks with Probe of ‘VALUE’ in the RMS blocks. then used 2 Threshold
blocks. Threshold block 1 with RMS_Value2>RMS_Value1 as the the low and
high threshold value. this passes a 0 or 1 to a variable that is used in
the SELECTOR block to route the 2 SOURCE SINC BLOCKS on to demod etc…

Anyway, Its a very long way around just using a comparator ( if
RMS1>RMS2 router= XXX !!! )

well, maybe that will make sense to somebody one day !

So far I have’nt managed to add the line directly into .PY code to make
this work. I’ll post it here if I get it to work in a more graceful way.
Or if I eventually get around to making a comparator block.

Sidenote: the strem switches but theres an audiable crunch on the
channel change after a few ms delay… tried switching audio and
complex source ( same crunch noise ! ) Maybe I need a fast auto - pan on
the audio channels to make a smoother switch!!

Tried same SDR source block as input in case they were running out of
phase / sync… same crunch noise… Perhaps the selector block is a bit
clunky ! ??

will look into other ways of dynamic stream routing… perhaps I can
code this in python in the stream routing section.

will update here if I get anywhere with that