Go to Post The 48 defensive DNA lies dormant in the drive train. It's impossible to forget. - Koko Ed [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 10-06-2010, 21:49
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Multiple Dequeue Element VIs in loop

Correctly diagnosed.

As originally written, but not what was posted, the code was told to wait for all six queues to have something posted to them before running the next loop iteration and processing the second command in any of the queues. That would in fact be a pretty odd requirement for a state machine, but that was what was written.

Using the timeout to avoid the blocking of the dequeues will allow the original code to work, but it also makes it effectively a polled loop. Technically, the loop will run sooner if all queues have something in them, but if nothing is posted, the loop would run every 1ms. Probably not a big performance issue, but that would depend on what you expect.

Depending on what is being enqueued and how they are processed, there are two pretty common patterns.
1. Go with a loop per queue. Don't be afraid to put the loop into a subVI which may allow you to reuse code depending on the processing, and will make the code much more readable. Because LV execution is not stack based, the engine can efficiently sleep very large numbers of parallel code clumps such as the loops, and they will awaken and be scheduled with very little overhead.
2. If you are wanting to process the results more centrally because of combined effects, consider posting to a single queue, but put an array into the queue data and combine up to your six data items into the array.

Greg McKaskle
Reply With Quote
  #2   Spotlight this post!  
Unread 10-06-2010, 22:05
Lisa Perez's Avatar
Lisa Perez Lisa Perez is offline
Registered User
FRC #0573 (Mech Warriors)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2003
Location: Bloomfield Hills, MI
Posts: 1,291
Lisa Perez has a reputation beyond reputeLisa Perez has a reputation beyond reputeLisa Perez has a reputation beyond reputeLisa Perez has a reputation beyond reputeLisa Perez has a reputation beyond reputeLisa Perez has a reputation beyond reputeLisa Perez has a reputation beyond reputeLisa Perez has a reputation beyond reputeLisa Perez has a reputation beyond reputeLisa Perez has a reputation beyond reputeLisa Perez has a reputation beyond repute
Re: Multiple Dequeue Element VIs in loop

Dave and Greg: Thank you for your suggestions! Looks like I've got the original program up and running now (although I will indeed be keeping the multiple state-machines as set up in my revised program as you both have suggested).
__________________
Event Coordinator - Center Line District Event
Volunteer Coordinator - Michigan State Championship

Lead Mentor - Team 573, Mech Warriors
Former Mentor - Team 830, Rat Pack and Team 3182, Athena's Warriors
Proud Alumna - Team 573, Mech Warriors and Team 1, Juggernauts
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
game element blackiceskier General Forum 11 23-10-2009 13:15
[FTC]: Multiple Programs or One Program with Multiple Auto Modes kevin51292 FIRST Tech Challenge 4 02-01-2009 20:37
07 Game element? bear24rw Rumor Mill 15 05-01-2007 18:38
pic: Division By Chicken Element Tim Delles Robot Showcase 2 12-04-2006 21:26


All times are GMT -5. The time now is 22:01.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi