01-04-2012 10:27 AM
Hey all,
I have data coming in via shared memory. This is "live" data, that so far I can plot on a chart, view, etc. But I also need to buffer a chunk of this data so I can process it further (avg, etc) What I want is to have a buffer fill up with say the latest 1000 values, and have those 1000 values available to manipulate just like I read them in from a text or other file. I would also like to be able to adjust the buffer size on the fly. This sounds straightforward enough that I thought there would be a single subVI available to do this, but no luck, and I can't seem to figure out *which* of the buffer-related vi's would work best.
Does anyone have a simple, straightforward solution? Seems kind of silly to reinvent the wheel if I don't need to.
Also, I saw some sub-vi's referencing "queues." As I understand them, this builds a buffer that you can thena access one element at a time. Is that correct?
Many thanks!
01-05-2012 02:26 PM
It sounds like a very interesting project. Have you tried looking into the templates for Producer/Consumer Design Patterns? File » New... » VI » Frameworks » Design Patterns. Try fooling around with some of the example code and see if you have any specific questions. Yes, your understanding of the queue is correct.
01-05-2012 02:44 PM
...and if you don't like suggestion by Ben D AE you could go with
Ben plugs an AE (Action Engine see this Nugget).*
Ben
*again
** In one of my big SCRAMNet apps I use queues to move the data to the proper consumer and an AE to maintain the current state for display.
04-17-2012 12:44 PM
Hello,
I am trying to do the nearly same thing: storing 1000 data points from a while loop in a "buffer" of sorts. I then want to use this buffer as an array feed into a parallel while loop. Did you have any luck and create a VI that does this? Would you be willing to post your solution?
Thanks,
04-19-2012 09:05 AM
Hello mkw21,
I've located a couple examples that use buffering and array operations. Though neither of the examples perform the exact operation you describe, they should give you some ideas on how to set up and design some of the pieces of your program.
https://decibel.ni.com/content/docs/DOC-10781
https://decibel.ni.com/content/docs/DOC-3414
04-19-2012 09:13 AM
Before you spend time trying to code up a buffer, first investigate Queues.
They are fast!
Ben
04-19-2012 09:34 AM
Sygnal processing -> Point by point functions might help you.