[Discuss-gnuradio] how to test ber in a FH system

2010-02-09 Thread nansai hu
Hi,all

I need to do a ber test and my current system is based on frequence hopping.

I think I should send a random 01 bit sequence at the transmiter side and
then,obsever the received bit sequence.
In next step,when campare the two sequence in order, how decided the
order?or how to do the Sync in two radio?especially in a Fh system.
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] BER plots for various modulation schemes

2010-02-03 Thread nansai hu
Same question.
How build a scenario to measure a ber vs. snr with two radio?

2010/1/6 amarnath alapati 

> hello everybody,
>I wanted to test the USRP performance for various modulation
> schemes by varying the power level of transmitted signal and plotting the
> BER. Can i use one of the existing gnuradio-examples/python/ programs to do
> this? How to check the power level of the transmitted signal?
>
> Cheers,
> AMARNATH.A.
>
> ___
> Discuss-gnuradio mailing list
> Discuss-gnuradio@gnu.org
> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>
>
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


[Discuss-gnuradio] BER test in FH system

2010-02-03 Thread nansai hu
I need to do a ber test and my current system is based on frequence hopping.

I think I should send a random 01 bit sequence at the transmiter side and
then,obsever the received bit sequence.
In next step,when campare the two sequence in order, how decided the
order?or how to do the Sync in two radio?especially in a Fh system.
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] how to use Log Power FFT module in python

2009-12-16 Thread nansai hu
In the binary floating point data,how many bits represent data and how many
bits represnt the right?


2009/12/16 Josh Blum 

>
>
> nansai hu wrote:
>
>> Many Thanks.
>> I use a file sink to received the result of Log Power FFT and it can be
>> excute successfully.
>> But the file which I saved is hard to read and understand.
>>
>
> Its binary floating point data.
>
>
>
>> In my mind, I think a scenario like this:
>> I use a signal generater to transmit a signal, then I use USRP to
>> received.
>> USRP include a USRP source,a Log Power FFT and a File sink.
>> When I transmit a CW signal,I imagine that I could get the file data in
>> 512points(one snapshot) and see a peak value and noise in other 511
>> points.
>>
>>
> Im not sure that the problem is. There is a graphical fft sink in grc, so
> you can look at a live/running fft plot.
>
>
> 2009/12/16 Josh Blum 
>>
>> A few ways I can think of off-hand:
>>>
>>> 1) make a custom gr.hier_block2 in python, it can read from a message
>>> queue
>>>
>>> 2) use a file sink to dump the data from the log power fft to file,
>>> post-process the file
>>>
>>> 3) you could use the variable sink in grc to write the fft vectors to a
>>> variable called fft_vec. Then another variable could be
>>> print(str(fft_vec)).
>>> I think it would actually work, but I have not tried. :-)
>>>
>>> -josh
>>>
>>>
>>> nansai hu wrote:
>>>
>>> Ok. I add a vector sink in GRC and to observe the data in that module.
>>>> But when I run GRC there is no result shown. I need to add some other
>>>> block
>>>> to see or I need write some code like "prinf" in Python?
>>>>
>>>>
>>>>
>>>> 2009/12/16 Josh Blum 
>>>>
>>>> all blocks that have:
>>>>
>>>>> 1) a float input/sink port
>>>>> 2) a vector length set to fft_size
>>>>>
>>>>> -josh
>>>>>
>>>>>
>>>>> nansai hu wrote:
>>>>>
>>>>> My question is I can't find any module in GRC can be conncet to Log
>>>>> Power
>>>>>
>>>>>> FFT module in right format.
>>>>>> Could you tell me which module in GRC can be use to receive Log Power
>>>>>> FFT
>>>>>> module?
>>>>>>
>>>>>> 2009/12/16 Josh Blum 
>>>>>>
>>>>>>
>>>>>> nansai hu wrote:
>>>>>>
>>>>>>> I want to do some function in frequency domain and just writen a C++
>>>>>>>
>>>>>>> block
>>>>>>>> already.
>>>>>>>> Now, I just want to use GRC to constuct a front end and connect to
>>>>>>>> my
>>>>>>>> own
>>>>>>>> block.
>>>>>>>>
>>>>>>>> The interface bewteen these two is a power vector of FFT results and
>>>>>>>>  I
>>>>>>>> use
>>>>>>>> a Log Power FFT module in GRC.
>>>>>>>>
>>>>>>>> My question is Log Power FFT module in GRC seems that have a very
>>>>>>>> strange
>>>>>>>> output format(not stream or vector),
>>>>>>>>
>>>>>>>> It outputs stream, where each element in the stream is a vector of
>>>>>>>>
>>>>>>>> floats
>>>>>>> with length fft_size.
>>>>>>>
>>>>>>> the output signature of the block is fft_size*sizeof(float)
>>>>>>>
>>>>>>> specifically, what problem are you having?
>>>>>>>
>>>>>>> -josh
>>>>>>>
>>>>>>>  So what is the format of that module and How clould I use it if my
>>>>>>> C++
>>>>>>>
>>>>>>> block
>>>>>>>
>>>>>>>> have a float vector input(512 points power result of FFT).
>>>>>>>>
>>>>>>>> Thanks
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> 
>>>>>>>>
>>>>>>>> ___
>>>>>>>> Discuss-gnuradio mailing list
>>>>>>>> Discuss-gnuradio@gnu.org
>>>>>>>> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] how to use Log Power FFT module in python

2009-12-16 Thread nansai hu
Many Thanks.
I use a file sink to received the result of Log Power FFT and it can be
excute successfully.
But the file which I saved is hard to read and understand.

In my mind, I think a scenario like this:
I use a signal generater to transmit a signal, then I use USRP to received.
USRP include a USRP source,a Log Power FFT and a File sink.
When I transmit a CW signal,I imagine that I could get the file data in
512points(one snapshot) and see a peak value and noise in other 511 points.

2009/12/16 Josh Blum 

> A few ways I can think of off-hand:
>
> 1) make a custom gr.hier_block2 in python, it can read from a message queue
>
> 2) use a file sink to dump the data from the log power fft to file,
> post-process the file
>
> 3) you could use the variable sink in grc to write the fft vectors to a
> variable called fft_vec. Then another variable could be print(str(fft_vec)).
> I think it would actually work, but I have not tried. :-)
>
> -josh
>
>
> nansai hu wrote:
>
>> Ok. I add a vector sink in GRC and to observe the data in that module.
>> But when I run GRC there is no result shown. I need to add some other
>> block
>> to see or I need write some code like "prinf" in Python?
>>
>>
>>
>> 2009/12/16 Josh Blum 
>>
>> all blocks that have:
>>>
>>> 1) a float input/sink port
>>> 2) a vector length set to fft_size
>>>
>>> -josh
>>>
>>>
>>> nansai hu wrote:
>>>
>>> My question is I can't find any module in GRC can be conncet to Log Power
>>>> FFT module in right format.
>>>> Could you tell me which module in GRC can be use to receive Log Power
>>>> FFT
>>>> module?
>>>>
>>>> 2009/12/16 Josh Blum 
>>>>
>>>>
>>>> nansai hu wrote:
>>>>>
>>>>> I want to do some function in frequency domain and just writen a C++
>>>>>
>>>>>> block
>>>>>> already.
>>>>>> Now, I just want to use GRC to constuct a front end and connect to my
>>>>>> own
>>>>>> block.
>>>>>>
>>>>>> The interface bewteen these two is a power vector of FFT results and
>>>>>>  I
>>>>>> use
>>>>>> a Log Power FFT module in GRC.
>>>>>>
>>>>>> My question is Log Power FFT module in GRC seems that have a very
>>>>>> strange
>>>>>> output format(not stream or vector),
>>>>>>
>>>>>> It outputs stream, where each element in the stream is a vector of
>>>>>>
>>>>> floats
>>>>> with length fft_size.
>>>>>
>>>>> the output signature of the block is fft_size*sizeof(float)
>>>>>
>>>>> specifically, what problem are you having?
>>>>>
>>>>> -josh
>>>>>
>>>>>  So what is the format of that module and How clould I use it if my C++
>>>>>
>>>>> block
>>>>>> have a float vector input(512 points power result of FFT).
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> 
>>>>>>
>>>>>> ___
>>>>>> Discuss-gnuradio mailing list
>>>>>> Discuss-gnuradio@gnu.org
>>>>>> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>>>>>
>>>>>>
>>>>>>
>>
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] how to use Log Power FFT module in python

2009-12-16 Thread nansai hu
Ok. I add a vector sink in GRC and to observe the data in that module.
But when I run GRC there is no result shown. I need to add some other block
to see or I need write some code like "prinf" in Python?



2009/12/16 Josh Blum 

> all blocks that have:
>
> 1) a float input/sink port
> 2) a vector length set to fft_size
>
> -josh
>
>
> nansai hu wrote:
>
>> My question is I can't find any module in GRC can be conncet to Log Power
>> FFT module in right format.
>> Could you tell me which module in GRC can be use to receive Log Power FFT
>> module?
>>
>> 2009/12/16 Josh Blum 
>>
>>
>>> nansai hu wrote:
>>>
>>> I want to do some function in frequency domain and just writen a C++
>>>> block
>>>> already.
>>>> Now, I just want to use GRC to constuct a front end and connect to my
>>>> own
>>>> block.
>>>>
>>>> The interface bewteen these two is a power vector of FFT results and  I
>>>> use
>>>> a Log Power FFT module in GRC.
>>>>
>>>> My question is Log Power FFT module in GRC seems that have a very
>>>> strange
>>>> output format(not stream or vector),
>>>>
>>>> It outputs stream, where each element in the stream is a vector of
>>> floats
>>> with length fft_size.
>>>
>>> the output signature of the block is fft_size*sizeof(float)
>>>
>>> specifically, what problem are you having?
>>>
>>> -josh
>>>
>>>  So what is the format of that module and How clould I use it if my C++
>>>
>>>> block
>>>> have a float vector input(512 points power result of FFT).
>>>>
>>>> Thanks
>>>>
>>>>
>>>>
>>>> 
>>>>
>>>> ___
>>>> Discuss-gnuradio mailing list
>>>> Discuss-gnuradio@gnu.org
>>>> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>>>
>>>>
>>
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] how to use Log Power FFT module in python

2009-12-16 Thread nansai hu
My question is I can't find any module in GRC can be conncet to Log Power
FFT module in right format.
Could you tell me which module in GRC can be use to receive Log Power FFT
module?

2009/12/16 Josh Blum 

>
>
> nansai hu wrote:
>
>> I want to do some function in frequency domain and just writen a C++ block
>> already.
>> Now, I just want to use GRC to constuct a front end and connect to my own
>> block.
>>
>> The interface bewteen these two is a power vector of FFT results and  I
>> use
>> a Log Power FFT module in GRC.
>>
>> My question is Log Power FFT module in GRC seems that have a very strange
>> output format(not stream or vector),
>>
>
> It outputs stream, where each element in the stream is a vector of floats
> with length fft_size.
>
> the output signature of the block is fft_size*sizeof(float)
>
> specifically, what problem are you having?
>
> -josh
>
>  So what is the format of that module and How clould I use it if my C++
>> block
>> have a float vector input(512 points power result of FFT).
>>
>> Thanks
>>
>>
>>
>> 
>>
>> ___
>> Discuss-gnuradio mailing list
>> Discuss-gnuradio@gnu.org
>> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>
>
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


[Discuss-gnuradio] how to use Log Power FFT module in python

2009-12-16 Thread nansai hu
I want to do some function in frequency domain and just writen a C++ block
already.
Now, I just want to use GRC to constuct a front end and connect to my own
block.

The interface bewteen these two is a power vector of FFT results and  I use
a Log Power FFT module in GRC.

My question is Log Power FFT module in GRC seems that have a very strange
output format(not stream or vector),
So what is the format of that module and How clould I use it if my C++ block
have a float vector input(512 points power result of FFT).

Thanks
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] How to modify freq deviation in a FM radio?????

2009-10-28 Thread nansai hu
Agilent4440
RBW=3Hz
span=1Mhz
center freq= USRP freq

2009/10/28 Josh Blum 

>
>
> nansai hu wrote:
>
>> Yes,this seems work.but the intention is get a radio.So, I use a USRP
>> source
>> instead FFT sink and observe in Spectrum Analyzer and it still doesn't
>> work.
>>
>> I think the only different is I use a usrp as CF to put baseband FM signal
>> to RF because Spectrum Analyzer quite like FFT sink.
>>
>>
> Whats the resolution bandwidth on your spectrum analyzer set to? Perhaps
> its not set fine/small enough?
>
> -Josh
>
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] How to modify freq deviation in a FM radio?????

2009-10-28 Thread nansai hu
Yes,this seems work.but the intention is get a radio.So, I use a USRP source
instead FFT sink and observe in Spectrum Analyzer and it still doesn't work.

I think the only different is I use a usrp as CF to put baseband FM signal
to RF because Spectrum Analyzer quite like FFT sink.

2009/10/28 Josh Blum 

> My advice is to get this all figured out in software before using any
> hardware (usrps and spectrum analyzers).
>
> You can simulate the effect of changing the max deviation all in software
> using a noise source, throttle, nbfm tx block, and an fft sink (all in grc).
>
> I guarantee that changing max deviation from 5 to 50k makes a big
> difference.
>
> -Josh
>
> nansai hu wrote:
>
>>  I want to design a FM radio with freq deviation can be change.
>> Then I tried to modified an example in GNUradio example folder which name
>> "fm_tx4.py" in line61,let max_dev=5 to 50K,shown in following yellow
>> label.
>> but there is no change at all in a spectrum analyzer.
>> Help me,thanks
>>
>> class pipeline(gr.hier_block2):
>>def __init__(self, filename, lo_freq, audio_rate, if_rate):
>>
>>gr.hier_block2.__init__(self, "pipeline",
>>gr.io_signature(0, 0, 0),
>> # Input signature
>>gr.io_signature(1, 1,
>> gr.sizeof_gr_complex))
>> # Output signature
>>
>>src = gr.file_source (gr.sizeof_float,'/home/sdr/Desktop/hu/1.wma',
>> True)
>>fmtx = blks2.nbfm_tx (audio_rate, if_rate, max_dev=5, tau=75e-6)
>>
>># Local oscillator
>>lo = gr.sig_source_c (if_rate,# sample rate
>>  gr.GR_SIN_WAVE, # waveform type
>>  lo_freq,#frequency
>>  1.0,# amplitude
>>  0)  # DC Offset
>>mixer = gr.multiply_cc ()
>>
>>self.connect (src, fmtx, (mixer, 0))
>>self.connect (lo, (mixer, 1))
>>self.connect (mixer, self)
>>
>>
>>
>> 
>>
>> ___
>> Discuss-gnuradio mailing list
>> Discuss-gnuradio@gnu.org
>> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>
>
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


[Discuss-gnuradio] How to modify freq deviation in a FM radio?????

2009-10-27 Thread nansai hu
I want to design a FM radio with freq deviation can be change.
Then I tried to modified an example in GNUradio example folder which name
"fm_tx4.py" in line61,let max_dev=5 to 50K,shown in following yellow label.
but there is no change at all in a spectrum analyzer.
Help me,thanks

class pipeline(gr.hier_block2):
def __init__(self, filename, lo_freq, audio_rate, if_rate):

gr.hier_block2.__init__(self, "pipeline",
gr.io_signature(0, 0, 0),
# Input signature
gr.io_signature(1, 1, gr.sizeof_gr_complex))
# Output signature

src = gr.file_source (gr.sizeof_float,'/home/sdr/Desktop/hu/1.wma',
True)
fmtx = blks2.nbfm_tx (audio_rate, if_rate, max_dev=5, tau=75e-6)

# Local oscillator
lo = gr.sig_source_c (if_rate,# sample rate
  gr.GR_SIN_WAVE, # waveform type
  lo_freq,#frequency
  1.0,# amplitude
  0)  # DC Offset
mixer = gr.multiply_cc ()

self.connect (src, fmtx, (mixer, 0))
self.connect (lo, (mixer, 1))
self.connect (mixer, self)
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] How to generate a FM signal?

2009-10-27 Thread nansai hu
I just want to do a demo about two radios in one USRP by time divition, both
are FM&FH, but with the intention to distingrish these radios,the FM
deviation and FH hop step should be different.Now I could control the hop
step,but the FM deviation can't be controled(FM deviation should be12.5K and
25K,which input to  max_dev in WBFM module)

2009/10/26 Josh Blum 

>
>
> nansai hu wrote:
>
>> I appracite you could tell me what is the meaning of following paramaters:
>>@param audio_rate: sample rate of audio stream, >= 16k
>>@type audio_rate: integer
>>@param quad_rate: sample rate of output stream
>>@type quad_rate: integer
>>
>
> This is the input and output rates of the block.
>
>
>@param tau: preemphasis time constant (default 75e-6)
>>@type tau: float
>>@param max_dev: maximum deviation in Hz (default 75e3)
>>@type max_dev: float
>>
>>
> No idea, check the source, but the default values are good to get a working
> wbfm radio.
>
>
> I try to change the max_dev from 10 to 1000,and give it to a usrp source as
>> baseband signal,
>>
>
> For transmit, the usrp expects numbers between +/- 2**15. Your transmit
> amplitude should be on the order of 10k. What are you sending it?
>
> -Josh
>
>
>
> but, the bandwith on spectrum analyize don not change.How to change
>> deviation of a fm signal?
>>
>> 2009/10/26 nansai hu 
>>
>> I tried to run your code wfm, but there is nothing happened in my spectrum
>>> analyzer.
>>> I am just wondering that your code is in baseband or how to add a carrier
>>> freq by usrp source.
>>>
>>> 2009/10/24 Josh Blum 
>>>
>>>
>>> nansai hu wrote:
>>>>
>>>> Is anybody had a experiment about How to generate a FM signal?
>>>>>
>>>>> Use the wideband and/or narrowband fm blocks; just specify your data
>>>>>
>>>> rates.
>>>>
>>>>
>>>>
>>>> http://gnuradio.org/cgit/gnuradio.git/tree/gnuradio-core/src/python/gnuradio/blks2impl
>>>>
>>>>
>>>> or tell me how to use FM MOD or VCO module in GRC, what is the paramater
>>>>
>>>>> sensitive means?
>>>>>
>>>>> check the source :-)
>>>>
>>>> -Josh
>>>>
>>>>
>>>
>>
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] How to generate a FM signal?

2009-10-26 Thread nansai hu
I appracite you could tell me what is the meaning of following paramaters:
@param audio_rate: sample rate of audio stream, >= 16k
@type audio_rate: integer
@param quad_rate: sample rate of output stream
@type quad_rate: integer
@param tau: preemphasis time constant (default 75e-6)
@type tau: float
@param max_dev: maximum deviation in Hz (default 75e3)
@type max_dev: float

I try to change the max_dev from 10 to 1000,and give it to a usrp source as
baseband signal,
but, the bandwith on spectrum analyize don not change.How to change
deviation of a fm signal?

2009/10/26 nansai hu 

> I tried to run your code wfm, but there is nothing happened in my spectrum
> analyzer.
> I am just wondering that your code is in baseband or how to add a carrier
> freq by usrp source.
>
> 2009/10/24 Josh Blum 
>
>
>>
>> nansai hu wrote:
>>
>>> Is anybody had a experiment about How to generate a FM signal?
>>>
>>> Use the wideband and/or narrowband fm blocks; just specify your data
>> rates.
>>
>>
>> http://gnuradio.org/cgit/gnuradio.git/tree/gnuradio-core/src/python/gnuradio/blks2impl
>>
>>
>> or tell me how to use FM MOD or VCO module in GRC, what is the paramater
>>> sensitive means?
>>>
>>
>> check the source :-)
>>
>> -Josh
>>
>
>
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] How to generate a FM signal?

2009-10-26 Thread nansai hu
I tried to run your code wfm, but there is nothing happened in my spectrum
analyzer.
I am just wondering that your code is in baseband or how to add a carrier
freq by usrp source.

2009/10/24 Josh Blum 

>
>
> nansai hu wrote:
>
>> Is anybody had a experiment about How to generate a FM signal?
>>
>>  Use the wideband and/or narrowband fm blocks; just specify your data
> rates.
>
>
> http://gnuradio.org/cgit/gnuradio.git/tree/gnuradio-core/src/python/gnuradio/blks2impl
>
>
>  or tell me how to use FM MOD or VCO module in GRC, what is the paramater
>> sensitive means?
>>
>
> check the source :-)
>
> -Josh
>
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


[Discuss-gnuradio] How to generate a FM signal?

2009-10-23 Thread nansai hu
Is anybody had a experiment about How to generate a FM signal?

or tell me how to use FM MOD or VCO module in GRC, what is the paramater
sensitive means?
Thanks
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


[Discuss-gnuradio] how to use value of a variable_sink in program

2009-10-21 Thread nansai hu
how to use value of a variable_sink in program?

I use a variable_sink to receive a value that clac in GRC program
Now I want to use this value in another place in program(name as val_freq),

So how to do that? I announced val_freq in front of whole program and add
two yellow lines in variable_sink,
but it doesn't work.

self.blks2_variable_sink_x_0 = grc_blks2.variable_sink_f(
vlen=1,
decim=1,
callback=self.set_mod_freq_sg,
global val_freq
val_freq=self.set_mod_freq_sg,
)
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


[Discuss-gnuradio] how to use value of a variable_sink in program

2009-10-20 Thread nansai hu
how to use value of a variable_sink in program?

I use a variable_sink to receive a value that clac in GRC program
Now I want to use this value in another place in program(name as val_freq),

So how to do that? I announced val_freq in front of whole program and add
two yellow lines in variable_sink,
but it doesn't work.

self.blks2_variable_sink_x_0 = grc_blks2.variable_sink_f(
vlen=1,
decim=1,
callback=self.set_mod_freq_sg,
global val_freq
val_freq=self.set_mod_freq_sg,
)
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


[Discuss-gnuradio] GR class

2009-09-16 Thread nansai hu
there are lots of pre-definited function in GR class. Mean you  from
gnuradio import gr,
so is there any dictionary or explanation of these function and how to use
them
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] how to define a globe variable in py?

2009-09-11 Thread nansai hu
That means out of any class?
Or could show me a example, thanks

2009/9/11 Fernando Rodrigues 

> you should declare the variable out of the threads and use something
> similar to a lock. because you're using threads, if you don't use locks, a
> operation of read/write could lead to mistaken results.
>
>
> Fernando Rodrigues
>
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


[Discuss-gnuradio] how to define a globe variable in py?

2009-09-11 Thread nansai hu
I add two threading in a py file and the variable in one could be read or
write in the other threading.
So how and where I should add the define of the variable even the also need
be used in py main loop?
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


[Discuss-gnuradio] how to get the value of grc item in py main loop

2009-09-11 Thread nansai hu
I use grc to generate a py file with some grc items,like ratiobuttom in name
of band_chooser.
Now I am modify the py file with my own logic in main loop,so how can I get
the choice value of band_chooser for some advanced judge?
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] how to use grc item's value in py

2009-09-08 Thread nansai hu
Then,how to catch the value of ratiobutton block in other function or
mainloop?

That means if user choose "Yes" then set USRP freq output at
900MHz,otherwise, set USRP at 950 MHz?


2009/9/7 Josh Blum 

> Suppose that there is a radiobutton with ID xyz:
>
> Then, a method named "set_xyz" will be generated in the py file.
> At runtime, set_xyz is called whenever the radiobutton changes.
> You can add a print statement inside this set_xyz method.
>
> _josh
>
> nansai hu wrote:
>
>>  I generated a py file by GRC with a ratiobutton block.(ratiobutton have
>> two
>> button "Yes" & "No")
>> And now  I want to modify the py file to implement a if logic by that
>> ratiobutton:
>> That means if user choose "Yes" then Print "", otherwise, Print
>> "",
>> So how and which value of ratiobutton block I should judge in py file?
>>
>> Is anyone have this kind of experience before? or show me a example,
>> thanks
>>
>>
>>
>> 
>>
>> ___
>> Discuss-gnuradio mailing list
>> Discuss-gnuradio@gnu.org
>> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>
>
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


[Discuss-gnuradio] how to use grc item's value in py

2009-09-07 Thread nansai hu
I generated a py file by GRC with a ratiobutton block.(ratiobutton have two
button "Yes" & "No")
And now  I want to modify the py file to implement a if logic by that
ratiobutton:
That means if user choose "Yes" then Print "", otherwise, Print "",
So how and which value of ratiobutton block I should judge in py file?

Is anyone have this kind of experience before? or show me a example, thanks
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] A basic but critical problem in beginning of python code

2009-09-07 Thread nansai hu
Thanks for your help, I am just use the first way under your mentioned,
means I modified a generated py file, and I use start function instead
run(ture) function in the last line.
But, after this job,the items added in GRC before is not displayed
anymore.(I used a slider item to control the freq, after change run() to
start() in the last line, the slider is missing while executing)

2009/9/5 nansai hu 

> Josh & others:
>
> Thanks for your help, I am just use the first way under your mentioned,
> means I modified a generated py file, and I use start function instead
> run(ture) function in the last line.
> But, after this job,the items added in GRC before is not displayed
> anymore.(I used a slider item to control the freq, after change run() to
> start() in the last line, the slider is missing while executing)
>
>   2009/9/5 Josh Blum 
>
>> In the wx gui code (generated by grc), the last line in the py file is
>> tb.Run(True). This effectively calls start() on the flow graph and blocks in
>> the wx main loop:
>>
>> ---from top_block_gui.py---
>> #start flow graph
>> if start: self.start()
>> #blocking main loop
>> self._app.MainLoop()
>>
>> For a wxgui app, you have to block in MainLoop(). However
>>
>> A) One option is to make your own threading.Thread class and pass it an
>> instance of your top block. Your thread will run in the background while the
>> main thread blocks at MainLoop().
>>
>> B) An even better idea would be to make your own grc block wrapper that
>> will invoke this thread. You dont need to have an actual gnuradio block in
>> this xml wrapper, any python code is possible. A great example is the xmlrpc
>> server block:
>> http://gnuradio.org/trac/browser/gnuradio/trunk/grc/blocks/xmlrpc_server.xml
>>
>> With option *A*: this would require modifications to a generated py file.
>> If you generate the file again, you have to re-do the modifications.
>>
>> However, with option *B*: grc can generate the py file with your thread +
>> custom logic. All the information is captured in the saved grc file, so you
>> do not need to modify the "output py file".
>>
>> -Josh
>>
>>
>> nansai hu wrote:
>>
>>> So that is the reason for use .run() the gui will display if you py file
>>> is
>>> modified by a grc file, but if use the .start() function, no gui display
>>> even in same program?
>>>
>>> if it is ture,how can I add some logic after the program started?
>>> I mean if I use start() function ,the code after start() could be
>>> executed
>>> (use run function these code could not be executed),but the GUI silde or
>>> ratiobottom item which add to file by GRC previously could not be
>>> displayed?
>>>
>>> Is there anyway to have both GUI item and some logic after program could
>>> be
>>> available in same time?
>>>
>>> 2009/9/5 Josh Blum 
>>>
>>> run() is a blocking call.
>>>> start() is a non-blocking call.
>>>>
>>>> Also, I believe run() will exit when a block returns -1 in its work
>>>> method.
>>>> FYI
>>>>
>>>> -Josh
>>>>
>>>> nansai hu wrote:
>>>>
>>>>  When run a python script file, as we know main function will be run
>>>>> first.
>>>>> We send the class to a object "tb",for instance. Then we have two ways
>>>>> to
>>>>> let the program run.
>>>>> One is call tb.run() function,and other is call tb.start()
>>>>> function.Could
>>>>> somebody told me the difference bewteen these?
>>>>>
>>>>> In my coding experience, use .run() the gui will display if you py file
>>>>> is
>>>>> modified by a grc file, but if use the .start() function, no gui
>>>>> display
>>>>> even in same program.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> 
>>>>>
>>>>> ___
>>>>> Discuss-gnuradio mailing list
>>>>> Discuss-gnuradio@gnu.org
>>>>> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>>>>
>>>>>
>>>
>
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] A basic but critical problem in beginning of python code

2009-09-05 Thread nansai hu
Josh & others:

Thanks for your help, I am just use the first way under your mentioned,
means I modified a generated py file, and I use start function instead
run(ture) function in the last line.
But, after this job,the items added in GRC before is not displayed
anymore.(I used a slider item to control the freq, after change run() to
start() in the last line, the slider is missing while executing)

2009/9/5 Josh Blum 

> In the wx gui code (generated by grc), the last line in the py file is
> tb.Run(True). This effectively calls start() on the flow graph and blocks in
> the wx main loop:
>
> ---from top_block_gui.py---
> #start flow graph
> if start: self.start()
> #blocking main loop
> self._app.MainLoop()
>
> For a wxgui app, you have to block in MainLoop(). However
>
> A) One option is to make your own threading.Thread class and pass it an
> instance of your top block. Your thread will run in the background while the
> main thread blocks at MainLoop().
>
> B) An even better idea would be to make your own grc block wrapper that
> will invoke this thread. You dont need to have an actual gnuradio block in
> this xml wrapper, any python code is possible. A great example is the xmlrpc
> server block:
> http://gnuradio.org/trac/browser/gnuradio/trunk/grc/blocks/xmlrpc_server.xml
>
> With option *A*: this would require modifications to a generated py file.
> If you generate the file again, you have to re-do the modifications.
>
> However, with option *B*: grc can generate the py file with your thread +
> custom logic. All the information is captured in the saved grc file, so you
> do not need to modify the "output py file".
>
> -Josh
>
>
> nansai hu wrote:
>
>> So that is the reason for use .run() the gui will display if you py file
>> is
>> modified by a grc file, but if use the .start() function, no gui display
>> even in same program?
>>
>> if it is ture,how can I add some logic after the program started?
>> I mean if I use start() function ,the code after start() could be executed
>> (use run function these code could not be executed),but the GUI silde or
>> ratiobottom item which add to file by GRC previously could not be
>> displayed?
>>
>> Is there anyway to have both GUI item and some logic after program could
>> be
>> available in same time?
>>
>> 2009/9/5 Josh Blum 
>>
>> run() is a blocking call.
>>> start() is a non-blocking call.
>>>
>>> Also, I believe run() will exit when a block returns -1 in its work
>>> method.
>>> FYI
>>>
>>> -Josh
>>>
>>> nansai hu wrote:
>>>
>>>  When run a python script file, as we know main function will be run
>>>> first.
>>>> We send the class to a object "tb",for instance. Then we have two ways
>>>> to
>>>> let the program run.
>>>> One is call tb.run() function,and other is call tb.start()
>>>> function.Could
>>>> somebody told me the difference bewteen these?
>>>>
>>>> In my coding experience, use .run() the gui will display if you py file
>>>> is
>>>> modified by a grc file, but if use the .start() function, no gui display
>>>> even in same program.
>>>>
>>>>
>>>>
>>>> 
>>>>
>>>> ___
>>>> Discuss-gnuradio mailing list
>>>> Discuss-gnuradio@gnu.org
>>>> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>>>
>>>>
>>
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] A basic but critical problem in beginning of python code

2009-09-05 Thread nansai hu
So that is the reason for use .run() the gui will display if you py file is
modified by a grc file, but if use the .start() function, no gui display
even in same program?

if it is ture,how can I add some logic after the program started?
I mean if I use start() function ,the code after start() could be executed
(use run function these code could not be executed),but the GUI silde or
ratiobottom item which add to file by GRC previously could not be displayed?

Is there anyway to have both GUI item and some logic after program could be
available in same time?

2009/9/5 Josh Blum 

> run() is a blocking call.
> start() is a non-blocking call.
>
> Also, I believe run() will exit when a block returns -1 in its work method.
> FYI
>
> -Josh
>
> nansai hu wrote:
>
>>  When run a python script file, as we know main function will be run
>> first.
>> We send the class to a object "tb",for instance. Then we have two ways to
>> let the program run.
>> One is call tb.run() function,and other is call tb.start() function.Could
>> somebody told me the difference bewteen these?
>>
>> In my coding experience, use .run() the gui will display if you py file is
>> modified by a grc file, but if use the .start() function, no gui display
>> even in same program.
>>
>>
>>
>> 
>>
>> ___
>> Discuss-gnuradio mailing list
>> Discuss-gnuradio@gnu.org
>> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>
>
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


[Discuss-gnuradio] A basic but critical problem in beginning of python code

2009-09-04 Thread nansai hu
When run a python script file, as we know main function will be run first.
We send the class to a object "tb",for instance. Then we have two ways to
let the program run.
One is call tb.run() function,and other is call tb.start() function.Could
somebody told me the difference bewteen these?

In my coding experience, use .run() the gui will display if you py file is
modified by a grc file, but if use the .start() function, no gui display
even in same program.
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio