Dynamically changing parameters of a block

Suppose I have myblock = gr.multiply_const_ff(var_value) sitting
somewhere in my flowgraph. I want the user to be able to change the
value of var_value by using a slider. I know how to make a slider, but
I am not able to find information on how to dynamically change the
block at runtime. One option that I can think of is to

  1. Stop the flow graph
  2. Disconnect the block in question with any block it may be connected
    to
  3. Redefine the block with new parameters
  4. Reconnect the block
  5. Restart the flow graph

I tried the above method, but I did know how to redefine an existing
block. Do I have to somehow “destroy” or “clear” the existing block
before defining another block with the same name?

Karthik

http://gnuradio.org/doc/doxygen/classgr__multiply__const__ff.html

The block has a method called set_k

just do my_block.set_k(new_constant)

-Josh

Hi Eric and others,

I also have a similar problem, but it is not limited to ‘gain control’,
Actually I want to implement an echo back or ping pong transmission
system.

First I implemented two separate transmitt and receive flow graphs in
two
separate transmit(), and receive() functions as mentioned in the
following:

Master Transceiver:

  Transmit()            Transmitt one data packet
  Receive()             Wait in receive for the echoed back packet 

or
timeout

Slave Transceiver:

  if (Receive()):             Always wait in receive
         Transmit()            Transmitt back the received data 

packet

But in this method I get an error ‘cant open usb device…cant open
USRP
0/1’

Then I found flowgraph.disconnect() method and thought that I should
implement a single flowgraph which can dynamically connect different
blocks
to transmit and then disconnect and connect with receive blocks and so
on…

Is it possible and is there any example code which doing something like
this
or otherwise can you please suggest me some way to do this.

Thanks

Kaleem Ahmad

Eric B. wrote:

  1. Redefine the block with new parameters
    No need for all of that, just call
    [email protected]
    Discuss-gnuradio Info Page


View this message in context:
http://www.nabble.com/Dynamically-changing-parameters-of-a-block-tp19698798p19721002.html
Sent from the GnuRadio mailing list archive at Nabble.com.

Any suggestions!!!

kaleem ahmad wrote:

somewhere in my flowgraph. I want the user to be able to change the


View this message in context:
http://www.nabble.com/Dynamically-changing-parameters-of-a-block-tp19698798p19738563.html
Sent from the GnuRadio mailing list archive at Nabble.com.

On Tue, Sep 30, 2008 at 02:09:47AM -0700, kaleem ahmad wrote:

Any suggestions!!!

How many usrps are involved in this?
How many usrp sinks and sources are you creating?
You should be creating 1 each for each USRP and keep them open the
entire time.

Eric

On Fri, Sep 26, 2008 at 06:40:29PM -0700, Karthik Vijayraghavan wrote:

  1. Restart the flow graph

I tried the above method, but I did know how to redefine an existing
block. Do I have to somehow “destroy” or “clear” the existing block
before defining another block with the same name?

Karthik

No need for all of that, just call

myblock.set_k(new_value)

while it’s running.

Eric

Any suggestions!!!

kaleem ahmad wrote:

them open the
something like following is correct way to handle it:
receive(fg):

How many usrps are involved in this?

Master Transceiver:
packet

[email protected]
Discuss-gnuradio Info Page


View this message in context:
http://www.nabble.com/Dynamically-changing-parameters-of-a-block-tp19698798p19775571.html
Sent from the GnuRadio mailing list archive at Nabble.com.

Hi Eric,

Two nodes, each consists of one USRP and an RFX2400, are involved, one
as a
Master(Transmit … receive echoed version…Transmit new packet and so
on)
and the other USRP is Slave (Receive…echo back the received packet). I
am
creating 1 usrp source (for transmitting) and 1 usrp sink (for
receiving)
for each node.

I dont understand “You should be creating 1 each for each USRP and keep
them
open the
entire time.”

How can I keep both source and sink open all the time without using
disconnect/disconnect_all. Because when I am transmitting my source is a
file and my sink is usrp. At same USRP node when I am receiving my
source is
usrp and my sink is a file. My problem is how can I construct a graph
which
either keep both of these things open at a time or dynamically connect
and
disconnect them.

Can you suggest me an example flow graph, or e.g can you comment that
something like following is correct way to handle it:

+++++++++++++++++++++++++++++
while(1):
send()
receive()
delay(500ms)

send(fg):
fg.connect(file_source, frammer, NRZ, modulation, gain, usrp)

receive(fg):
fg.disconnect_all()
fg.connect(usrp, filter, de_modulation, correlation, file_sink)
wait_for_timeout()
fg.disconnect_all()
++++++++++++++++++++++++++++++++++++++++++

It is just an example flowgraph and soesnt matter if the correct blocks
are
used, but the thing which I want to know is the order of connect() and
disconnect_all(), is it possible to have like this and will it work with
such delays.

Best Regards

Kaleem Ahmad

Eric B. wrote:

Eric

First I implemented two separate transmitt and receive flow graphs in

Then I found flowgraph.disconnect() method and thought that I should


Discuss-gnuradio mailing list
[email protected]
Discuss-gnuradio Info Page


View this message in context:
http://www.nabble.com/Dynamically-changing-parameters-of-a-block-tp19698798p19756768.html
Sent from the GnuRadio mailing list archive at Nabble.com.

I also have been having trouble trying to dynamically change the
parameter of a block.

In this case the amplitude of the sine wave in usrp_siggen.py
(gr.sig_source_f).

I use the set amplitude function of the top_block to change the
amplitude in my main loop. However, observing the spectrum using FFT
when I change the amplitude the signal seems to stop working (big FFT
spike disappears).

Can I not use the set amplitude function in usrp_siggen.py to
dynamically change the signal amplitude in a main loop?

I will try using gr.multiply_const_cc as recommended by Richard J…