LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does this loop only execute once?

Solved!
Go to solution

Hi, Please see the attached picture. Could someone please tell me what I have done wrong here, this while loop only executes once, and I can't figure out why. Please help!

Many thanks, Alec 

0 Kudos
Message 1 of 6
(2,251 Views)

WTF = Wait Time Failure

 

You did not wire a timout value to the event structure so it waits forever.

 

Or should that be Wat Till Forever?

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 6
(2,247 Views)

But... when I wire a time out, then nothing inside my event structure seems to execute. I feel like im missing something fundamental here 😕

0 Kudos
Message 3 of 6
(2,244 Views)

Even so, the case structure below should at least execute the "Automate" case. IF the wiring is correct. I think the problem is a "wire that's actually behind the functions" problem. On the left there the queue is being initialized with a datatype of a cluster. But the Enqueue function has a string as its input. This should have been a broken wire IF the queue wire from the Obtain Queue is actually connected to the Enqueue function. I think it's not, and the wire is actually going from the Obtain Queue directly to the while loop border. Hence, nothing is being placed on the queue, and the Preview Queue Elements just sits there waiting forever for something to show up.

 

P.S. It appears that you were trying to make a Producer-Consumer architecture. That uses 2 loops: Application Design Patterns: Producer/Consumer

0 Kudos
Message 4 of 6
(2,241 Views)

ok, well spotted. my bad... thats cause thats not actually what the application does. i put that in so you could try and see my problem.... Pressing an "Automate" Button on the UI, will trigger an Event structure case to place the "Automate" command in the queue...

 

The queue is inisialised and left blank

0 Kudos
Message 5 of 6
(2,237 Views)
Solution
Accepted by topic author alecjcook

last suggestion before getting on the road fo rthe rest of th week.

 

It looks like you are attempting a Producer Consumer architecture that SHOULD be in two loops and not just one. Search for that term to look at some examples.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 6 of 6
(2,231 Views)