LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data transfer, synchronization, and stopping multiple loops.

I've recently made a few changes to the main structure of my project and, although it does still seem to work fine, I was wondering if this was actually a robust structure or if I was inadvertently doing something very wrong!  The main changes were to how the main vi shuts down, and to the organisation of the synchronization primitives (queues, rendezvous, occurrences).  I enclose an example vi that I put together to show the systems I'm using.  Also, you might be able to get a good overview from the picture below:

 

Stop Loops.JPG

 

The two 'True' cases in the slave loops merely wire the selector terminal to the boolean output to the conditional terminal of the while loops.

 

I have obviously not included everything and have made some simplifications to the loops, but everything from the synchronization pallet is as it is in my project.  Could I have some feedback on this if possible, please.  I got to where I am now largely through trial and error, exploration, and a few helpful nudges from some people in this community. Smiley Happy

 

- James



Never say "Oops." Always say "Ah, interesting!"

0 Kudos
Message 1 of 15
(3,262 Views)

I am also wondering if there is a way I can initialize the two queues from inside the Master Loop?  In the main project, the main data cluster is actually initialized inside the Master Loop with default/initial values... but I also have this second cluster of 'empty' values/elements outside the loop (containing some of the data from the main data cluster) to initialize the queues.  This seems unnecessary to me, but is there actually a way around it?



Never say "Oops." Always say "Ah, interesting!"

0 Kudos
Message 2 of 15
(3,261 Views)

I prefer to have my consumer loops accept explicit messages and not just a single data element. By using this methood you can define an explicit Stop/Exit message that you post to all of your consumers. Also, it is a good practice to release the queues outside of all the loops after each has processed the stop command. Also, an explicit stop message eliminates the need for your consumer loops to poll the Stop button. They would simply wait on the queue for the next message. I am not a big fan of polling architectures.

 

As for your "initialization" of the queues, you aren't really initializing them but simply creating them. They should be outside of the loops.

 



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 3 of 15
(3,225 Views)
Thank you for clearing up my queue creation query.

@Mark_Yedinak wrote:

I prefer to have my consumer loops accept explicit messages and not just a single data element. By using this methood you can define an explicit Stop/Exit message that you post to all of your consumers. Also, an explicit stop message eliminates the need for your consumer loops to poll the Stop button. They would simply wait on the queue for the next message.


Could you elaborate on what you mean by the explicit Stop/Exit messages, and/or how you would implement them?  I'm not sure I completely understand where you're coming from.  



Never say "Oops." Always say "Ah, interesting!"

0 Kudos
Message 4 of 15
(3,215 Views)

A minor point for clarification:

I understand why not to always use continuous polling architecture (that's why I now use event structures and queues, etc) but I'm just not sure how what you suggested could be implemented at the moment.  However, I'm more than willing to change anything that will be of benefit (to the program itself or just to my LabVIEW skill set / knowledge).  Smiley Happy



Never say "Oops." Always say "Ah, interesting!"

0 Kudos
Message 5 of 15
(3,199 Views)

Here is a basic example of using explicit messages to control things.

 

Simple Application Architecture.png

 

Note: The snippet got a bit messed up. Use th ecode from the zip file.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 6 of 15
(3,189 Views)

Are you able to down-save it for as low as LabVIEW 8.5?



Never say "Oops." Always say "Ah, interesting!"

0 Kudos
Message 7 of 15
(3,185 Views)

Here is an 8.0 version I had. Let me know if this works for you.

 

 



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 8 of 15
(3,180 Views)

@Mark_Yedinak wrote:

Here is an 8.0 10 version I had. Let me know if this works for you.

  


Downwards, I say, downwards!  Not up!  Smiley Tongue



Never say "Oops." Always say "Ah, interesting!"

0 Kudos
Message 9 of 15
(3,176 Views)

Let's try this once more.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 10 of 15
(3,171 Views)