discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Activating/Deactivating Blocks in real time


From: Achilleas Anastasopoulos
Subject: Re: [Discuss-gnuradio] Activating/Deactivating Blocks in real time
Date: Thu, 3 Oct 2013 20:11:00 -0400


Thanks for all the suggestions; they helped a lot.

Here is my progress and the BIG problem that I have not solved...

Recall, my original big block is A (it is a complex hier block with 1:1 input:output rate)
as shown below

in --> [ A ] --> out                  (overall hier "sync" block)

I want to prepend it with a block PRE and append it with a block POST, so that
the overall block behaves as A when a control input s(t)=1 and outputs 0 (while consuming
input) when s(t)=1



in --> [  PRE--> A --> POST   ]  --> out                       (overall "sync" block)
              ^                    ^
              |                     |
       ctr-------------------------

My motivation for all this is that with s(t) I can control when A works because it is
really complex and its output is not needed always, while not disturbing the remaining
graph...


I created one block (call it PRE) that essentially does what the "copy" block does, with the only difference it is controlled by another control input s(t).
When s(t)=1 it copies its input to the output and consumes the input
when s(t)=0 it just consumes the input.

I also created another block (call it POST) which is based on the MUX
idea that was suggested (only simpler) that (is supposed to) behave as follows:
It has two inputs: 0)  the output of A and 1) the SAME control signal s(t).
When s(t)=1 it copies the input to the output.
When s(t)=0 is outputs 0's


The problem is that the POST block (which is a general block) is problematic:
I set the ninput_items_required[1] (the control port) to noutput_items in the forecast method
BUT
I cannot set the ninput_items_required[0] to any meaningful value,
since the number of input items required depends on the control signal s(t).
I cannot just set it to noutput_items, because when s(t)=0 block A is not producing anything
(that's the whole point!!!) and thus the POST block will be just waiting for its input0 queue to fill but
nothing comes to that!!!

Any ideas?

thanks again for all the help,
Achilleas




On Thu, Oct 3, 2013 at 8:03 AM, West, Nathan <address@hidden> wrote:
On Wed, Oct 2, 2013 at 11:06 PM, Achilleas Anastasopoulos <address@hidden> wrote:
I guess I forgot to make this one thing more clear:

I would like the input stream of block A to be consumed even
when s(t)=1.

With Tim's suggestion, when s(t)=1 we will have the right output, but the input will be waiting in block's A queue to be processed the
moment s(t) turns 0.
Is this correct, or am I missing something?

But this gives me the following idea:

I guess what i need in addition to that is a block that based
on s(t) either sends the input to the output when s(t)==0 (which is then connected to A),
or just consumes the input (when s(t)==1).
Is there such a block available? (even if not, this is pretty easy to write!)

Any comments on this?

thanks for the hints and ideas!
Achilleas


Achilleas,

I solved a similar problem by creating a general block that consumes an input stream on some condition, and passes it otherwise. If you pair this with another block that tags a sample where passing or rejecting  should begin (correlate_access_code_tag?) it works quite nicely. With this approach you could use the control pin idea, but I would recommend tags to keep it cleaner.

Looking at this might help you get going a little faster if this sounds like it would work for you: https://github.com/n-west/gr-west_3_6/blob/master/lib/filter_payload_impl.cc  It's a little messy because I was trying (and more or less failied) to make it dynamic and allow multiple streams coming in to be synchronized and let any input stream control output of all streams. It also still uses 3.6 API (I know, the shame!)

-Nathan


On Wed, Oct 2, 2013 at 5:51 PM, Monahan-Mitchell, Tim <address@hidden> wrote:

Can you do this with a 2:1 mux block? Input 2 = constant 0, control input is s(t)?

 

From: discuss-gnuradio-bounces+tmonahan=address@hidden [mailto:discuss-gnuradio-bounces+tmonahan=address@hidden] On Behalf Of Achilleas Anastasopoulos
Sent: Wednesday, October 02, 2013 3:48 PM
To: address@hidden
Subject: [Discuss-gnuradio] Activating/Deactivating Blocks in real time

 

I have the following problem that I would like your opinion on how to solve elegantly:

I have a block A (say a standard sync block with some memory--eg an fir filter) which
has input x(t) and output y(t) and is pretty computationally intensive.

I would like to add the following functionality to it:


Add a new input s(t) to A which can be 0 or 1.

When s(t)=1 the block operates as before ie, it processes x(t) to generate y(t).

If s(t)=0 I would like it to output y(t)=0 and consume the appropriate x(t)'s from the input.

This way when s(t)=0 block A essentially "does not work".

 

This is pretty straightforward to code if I modify the work function of block A.

However, block A for me is a pretty complicated hierarchical block, so I don't have access to its "work" function.

One way to do this is to rewrite the whole hierarchical block A as a flat block and then do as suggested above.

Is there a better way?

 

Thanks
Achilleas

 



_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio




reply via email to

[Prev in Thread] Current Thread [Next in Thread]