discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Seeking a method to expose a floating point value


From: Ed Coleman
Subject: Re: [Discuss-gnuradio] Seeking a method to expose a floating point value
Date: Wed, 20 Jul 2016 10:30:51 -0400

Thanks again for taking the time to answer, Marcus.

My end goal is to interface with external hardware, process the waveforms contained and produce a 'result' - I have created a gnuradio flow graph to perform this task.  The 'result' will be a unique floating point value at the sample rate of the hardware.  I then want to calculate the average and standard deviation of that result over a user selectable time interval ranging from 200msec to 1s.  These two values will be sent over a serial connection, updated at the same user selected time interval.

I was using random number generator flow graph to simplify and focus the question of this thread to pulling discreet samples out of a grc block.  My plan was to do the statistical calculations and serial port management outside of the gnuradio block in python code (with which I'm more comfortable).  

It seems, from your answer, that I'll be much better served to create custom blocks.  Looks like I have some reading to do on that topic!  

On Tue, Jul 19, 2016 at 4:45 PM, Marcus Müller <address@hidden> wrote:

Well, there's multiple things you can do; a very easy thing would be to put your external Python code into a GNU Radio block and let the GNU Radio scheduler call it as soon as there's a "chunk" of fresh samples.

You could also go for message passing, or zmq inter-process messages. Or simply take the data out of a vector sink?

This depends a lot on what you're trying to do, i.e. the bigger picture. What do you need these numbers for?

It's the very nature of general purpose OSes running on general purpose computers that things usually are not "continuous" in time, but happen by means of exchanging buffers with a chunk of workload at once; so possibly this isn't even a problem, because the program you want to use to work on that data might be expecting buffers of samples, too.

Best regards,

Marcus

On 19.07.2016 22:11, Ed Coleman wrote:

Hello Marcus:

Thank you for the quick reply.  My initial thought was that the external code would query the grc block at a rate of 32kHz.  I WAS assuming that there would be a unique value available every 1/32000s.   Since this is not the case, I'm left wondering how best to get all 32000samples per second out of this block and into an array in python so that I can manipulate the data.  It seems as though this may be a more in depth question than I realized.

-Ed


-------------------------

Hi Ed,

to what do you need that number "delivered"? That's the interesting point here; whether your external code "polls" a function, or expects to get a message of some sorts, or listens on a socket, or...

Also note that it's not really like there's a constant "trickle" of random numbers, one every 1s/32000; GNU Radio is buffer-based, meaning that throttle gets a block of e.g. 4096 input items, passes them, and then waits 4096/32000 until it looks for new input. 

Best regards,

Marcus


On 19.07.2016 20:32, Ed Coleman wrote:
Considering the simple flow graph attached, a random number is generated at a sample rate of 32kHz.  I’m seeking a method to ‘expose’ the floating point number to external python code. This code would need to be updated at every 'tic' of the sample rate.  Initially I had considered using the probe function but, from what I have read, it appears that is not appropriate for such a fast update rate.  Any suggestions would be appreciated.

Inline image 1


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


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


_______________________________________________
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]