LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sharing data between concurrent, multi-rate while loops

Solved!
Go to solution

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

 

concurrent image.JPG

 

 

Message 1 of 9
(4,571 Views)

Use an action engine.

 

http://forums.ni.com/ni/board/message?board.id=170&view=by_date_ascending&message.id=240328#M240328

>

"There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
Message 2 of 9
(4,563 Views)

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

0 Kudos
Message 3 of 9
(4,561 Views)

Mike,

 

Is it possible to post your VI viewable for Labview 8.2?  Or post the Block Diagram image in the thread?

 

Thanks,

 

Adam

Message Edited by MREDAY on 07-17-2009 08:05 AM
Message Edited by MREDAY on 07-17-2009 08:14 AM
0 Kudos
Message 4 of 9
(4,553 Views)
Solution
Accepted by topic author MREDAY

Hi Adam,

yes, here we go.

 

Mike

0 Kudos
Message 5 of 9
(4,539 Views)

You can navigate to File -> New.. and look for the Producer/Consumer (Data) template.

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 6 of 9
(4,538 Views)

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?

0 Kudos
Message 7 of 9
(4,531 Views)
Thanks Adnan for the template reference.
0 Kudos
Message 8 of 9
(4,528 Views)

Hi Adam,

you can cluster it. No need to use more than one queue if you only have these two loops.

 

Mike

0 Kudos
Message 9 of 9
(4,527 Views)