07-17-2009 07:47 AM
Hello,
I am trying to share data between concurrent while loops running at different rates. What is the recommended way to do this? In practice I have 12 indicators and 3 charts I would update (to screen) in the slower loop, while the data is aquired and stored to disk in the faster loop. The image below is a simplified version of what my application is really running.
I currently use shared and local variables to accomplish this. I've been told however that local variables are bad due to their memory usage (data is copied instead of passed by reference).
Thanks for any suggestions,
Adam
Solved! Go to Solution.
07-17-2009 07:56 AM
Use an action engine.
http://forums.ni.com/ni/board/message?board.id=170&view=by_date_ascending&message.id=240328#M240328
07-17-2009 08:01 AM
Hi MREDAY,
you can use queues to accomplish this. Send the value only if you really work with it in the other loop, so that this loop is triggered by the queue.
Your example can then look like the attached example.
Mike
07-17-2009 08:05 AM - edited 07-17-2009 08:14 AM
Mike,
Is it possible to post your VI viewable for Labview 8.2? Or post the Block Diagram image in the thread?
Thanks,
Adam
07-17-2009 08:18 AM
Hi Adam,
yes, here we go.
Mike
07-17-2009 08:19 AM
You can navigate to File -> New.. and look for the Producer/Consumer (Data) template.
07-17-2009 08:27 AM
Thanks a lot Mike. I'm gonna give this a go.
Would it be better to cluster all my data (12 indicators worth) into a single queue or should create a queue for each indicator and the while loop waits to run until all queue data has been recieved?
07-17-2009 08:30 AM
07-17-2009 08:31 AM
Hi Adam,
you can cluster it. No need to use more than one queue if you only have these two loops.
Mike