# Reconfiguring Flowgraphs

**URL:** <https://www.ruby-forum.com/t/reconfiguring-flowgraphs/234810>\
**Category:** GNU Radio\
**Created:** [July 21, 2014, 1:07pm UTC](https://www.ruby-forum.com/t/reconfiguring-flowgraphs/234810 "2014-07-21T13:07:08Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![alcina](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a587f6/32.png) [@alcina](https://www.ruby-forum.com/u/alcina)\
**Post date:** [July 21, 2014, 1:07pm UTC](https://www.ruby-forum.com/t/reconfiguring-flowgraphs/234810/1 "2014-07-21T13:07:08Z")

</div>

Hi all:  
Thank you in advance.I want to ask some questions about the  
“Reconfiguring Flowgraphs”.  
My flowgraphs:  
source—\>block A(just one  
block)—\>sink  
And I want to run the flowgraphs for 30 seconds,and then run the other  
flowgraphs:  
source—\>block B(just one  
block)—\>sink  
And I have read the API,and then I write something like this:

def main():  
tb=my\_top\_block()  
tb.start()  
time.sleep(30)

```
#stop flowgraph
tb.lock()
tb.disconnect((tb.uhd_usrp_source_0,0),(tb.rx_0,0))

#start flowgraph
tb.connect((tb.uhd_usrp_source_0,0),(tb.rx_1,0))
tb.connect((tb.rx_1,0),tb.snk)
            # blockA:(tb.rx_0,0) blockB:(tb.rx_1,0)
            tb.unlock()

tb.wait()

```

But it go error: RuntimeError: delay(4): insufficient connected input  
ports (1 needed, 0 connected)  
Can someone help me?Thank you.  
Best regards,  
xd

---

<div class="post-metadata">

**Author:** ![xianda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/b38774/32.png) [@xianda](https://www.ruby-forum.com/u/xianda)\
**Post date:** [July 21, 2014, 1:44pm UTC](https://www.ruby-forum.com/t/reconfiguring-flowgraphs/234810/2 "2014-07-21T13:44:49Z")

</div>

I forget to say:the “sink” also different with each other.Namely:  
source—\>block A(just one block)—\>sink1  
source—\>block B(just one block)—\>sink2  
Can someone help me?Thanks.

At 2014-07-21 06:50:10, “xianda” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

Hi all:  
Thank you in advance.I want to ask some questions about the  
“Reconfiguring Flowgraphs”.  
My flowgraphs:  
source—\>block A(just one  
block)—\>sink  
And I want to run the flowgraphs for 30 seconds,and then run the other  
flowgraphs:  
source—\>block B(just one  
block)—\>sink  
And I have read the API,and then I write something like this:

def main():  
tb=my\_top\_block()  
tb.start()  
time.sleep(30)

```
#stop flowgraph
tb.lock()
tb.disconnect((tb.uhd_usrp_source_0,0),(tb.rx_0,0))

#start flowgraph
tb.connect((tb.uhd_usrp_source_0,0),(tb.rx_1,0))
tb.connect((tb.rx_1,0),tb.snk)
            # blockA:(tb.rx_0,0) blockB:(tb.rx_1,0)
            tb.unlock()

tb.wait()

```

But it go error: RuntimeError: delay(4): insufficient connected input  
ports (1 needed, 0 connected)  
Can someone help me?Thank you.  
Best regards,  
xd

---

<div class="post-metadata">

**Author:** ![xianda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/b38774/32.png) [@xianda](https://www.ruby-forum.com/u/xianda)\
**Post date:** [July 21, 2014, 2:08pm UTC](https://www.ruby-forum.com/t/reconfiguring-flowgraphs/234810/3 "2014-07-21T14:08:47Z")

</div>

unless you also disconnect block A and sink1, GNU Radio will continue to  
assume that block A should produce output for sink1, and it can’t do  
that without input.

Greetings,  
Marcus

---

<div class="post-metadata">

**Author:** ![xianda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/b38774/32.png) [@xianda](https://www.ruby-forum.com/u/xianda)\
**Post date:** [July 26, 2014, 4:05am UTC](https://www.ruby-forum.com/t/reconfiguring-flowgraphs/234810/4 "2014-07-26T04:05:28Z")

</div>

Hi Xianda,

as usual, saying “doesn’t work”, “can’t run”, “behaves wrong” really  
gives no clue what’s wrong.  
Please follow  
[http://gnuradio.org/redmine/projects/gnuradio/wiki/ReportingErrors](http://gnuradio.org/redmine/projects/gnuradio/wiki/ReportingErrors) ,  
especially “How do I ask?”.

Greetings,  
Marcus

---

<div class="post-metadata">

**Author:** ![xianda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/b38774/32.png) [@xianda](https://www.ruby-forum.com/u/xianda)\
**Post date:** [July 26, 2014, 4:33am UTC](https://www.ruby-forum.com/t/reconfiguring-flowgraphs/234810/5 "2014-07-26T04:33:46Z")

</div>

Hi xianda,

tb.wait() does exactly what you said it does: Wait for the flow graph to  
complete.A flowgraph will run until one of the blocks in that flowgraph  
signal that they’re done, or you call tb.stop().  
If you don’t have such a block, your tb will run forever, and wait()  
will never return.

Greetings,  
Marcus

---

<div class="post-metadata">

**Author:** ![xianda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/b38774/32.png) [@xianda](https://www.ruby-forum.com/u/xianda)\
**Post date:** [July 26, 2014, 4:49am UTC](https://www.ruby-forum.com/t/reconfiguring-flowgraphs/234810/6 "2014-07-26T04:49:54Z")

</div>

Hi Marcus:  
Thank you for your reply.Sorry for that if you can’t  
understand.I will try my best to explain my question.

def main():  
tb=my\_top\_block()  
tb.start()  
time.sleep(30)

```
#stop flowgraph
tb.lock()
tb.disconnect((tb.uhd_usrp_source_0,0),(tb.rx_0,0))
            tb.disconnct((tb.rx_0,0),tb.snk1)
             #start flowgraph
 tb.connect((tb.uhd_usrp_source_0,0),(tb.rx_1,0))
 tb.connect((tb.rx_1,0),tb.snk)
             # blockA:(tb.rx_0,0) blockB:(tb.rx_1,0)
             tb.unlock()
  tb.wait()
             print "start"

```

I want to disconnct flow graph, and then to start a new connect.My code  
hang in tb.wait(),it can’t go on.I add print “start” and it can’t  
display “start”.Sorry for my poor english if you can’t understand.  
Thank you so much.  
Best regards,  
xd

---

<div class="post-metadata">

**Author:** ![xianda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/b38774/32.png) [@xianda](https://www.ruby-forum.com/u/xianda)\
**Post date:** [July 26, 2014, 4:46am UTC](https://www.ruby-forum.com/t/reconfiguring-flowgraphs/234810/7 "2014-07-26T04:46:17Z")

</div>

Xianda,  
my advice: Please try to draw a complete picture of what you are doing.  
What are your sources, blocks you interchange, your sinks, what do you  
do to make your flowgraph stop (under which circumstances)? I really  
can’t read your mind; all I know about your flow graph is what you tell  
me, which is that you have 1 source, and two in-and-output blocks and  
two sinks, and that you first connect src - blk1 - sink1 and then src -  
blk2 - sink2.

You omitted that it is a USRP source until you send an excerpt of your  
code, you omit what kind of blocks blk{1,2} and what kind of sinks  
sink{1,2} are. You don’t tell me in what relationship your “new”  
flowgraph stands to your reconfigured one etc.

It’s like you expect me to guess what you are doing in my own time to  
try to help you, just to save you from revealing what you are doing.  
This won’t work.  
Please explain, in whole, what you’re trying to do, what you have tried  
to verify that it goes wrong, which problems you encountered and so on,  
and we, as a list, might be able to figure out what’s going on.

Greetings,  
Marcus

---

<div class="post-metadata">

**Author:** ![xianda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/b38774/32.png) [@xianda](https://www.ruby-forum.com/u/xianda)\
**Post date:** [July 26, 2014, 4:52am UTC](https://www.ruby-forum.com/t/reconfiguring-flowgraphs/234810/8 "2014-07-26T04:52:49Z")

</div>

Hi Marcus:  
Thank you so much.Do you indicate my new flowgraph had  
run?I have add a file sink,but it is null.And I think it don’t run.I  
don’t know why.Can you give me some advices?Thank you so much.  
Best regards,  
xd

---

<div class="post-metadata">

**Author:** ![xianda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/b38774/32.png) [@xianda](https://www.ruby-forum.com/u/xianda)\
**Post date:** [July 26, 2014, 5:37am UTC](https://www.ruby-forum.com/t/reconfiguring-flowgraphs/234810/9 "2014-07-26T05:37:03Z")

</div>

Hi Marcus:  
Thank you so much for your kindly reply.I have  
attached my code.I want to run the flowgraph 1 at first,and then I  
disconnct it.Then I want to run the flowgraph 2.  
Flowgraph 1:  
uhd\_usrp\_source----\>\>\>ofdm\_rx\_0----\>\>\>file sink

```
                Flowgraph 2:
                uhd_usrp_source---->>>ofdm_rx_1---->>>blocks_vector_to_stream---->>>blks2_tcp_sink

```

Note:  
ofdm\_rx is a block in  
gnuradio/gr-digital/python/digital/ofdm\_txrx.py.I make some changes on  
ofdm\_rx.And I get two new block:ofdm\_rx\_0 and ofdm\_rx\_1.I have tested  
flowgraph 1 and flowgraph 2 respectively.And they all run  
successfully.And now I just want to run flowgraph 1 in 30 seconds and  
then disconnct flowgraph 1.Then run flowgraph 2 forever.But now the  
flowgraph 2 don’t receive samples.And in the ofdm\_rx\_1 I add some file  
sink.These file sink display null.When I have tested flowgraph 1 and  
flowgraph 2 respectively,these file sink all have samples.So I think  
maybe encounter some errors when I reconfiguring flowgraphs.Thank you so  
much.So kindly of you.Thanks.  
Best regards,  
xd

---

<div class="post-metadata">

**Author:** ![xianda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/b38774/32.png) [@xianda](https://www.ruby-forum.com/u/xianda)\
**Post date:** [July 26, 2014, 9:04am UTC](https://www.ruby-forum.com/t/reconfiguring-flowgraphs/234810/10 "2014-07-26T09:04:15Z")

</div>

so if you replace lines 70-79 and replace them with tb.stop(), you get  
bytes in your file? How many? Is it much more than 52\*8? Do you actually  
guarantee that there should be output of ofdm\_rx\_0 or does this happen  
coincidentially?

Something as complex as an OFDM receiver really shouldn’t be used as a  
test for stream reconfiguration, because you’re receiving live signals  
and there’s millions of things that might go wrong; have you tried with  
a simpler block, e.g. stream\_to\_vector instead of ofdm\_rx/ofdm\_rx1? Have  
you intentionally used  
“from ofdm\_null\_txrx import ofdm\_rx”? I don’t know ofdm\_null\_txrx, so  
this might be to blame; the name sure suggests that it might not produce  
output, and the parameters suggest you send data somewhere (not to the  
output of that block).

Greetings,  
Marcus
