<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Tips to remember when using Queued State machine in LabVIEW</title>
    <link>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1946433#M647828</link>
    <description>&lt;P&gt;Let's try again.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Right. &amp;nbsp;You probably only need shift registers in one loop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lynn&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://forums.ni.com/t5/image/serverpage/image-id/71749iC1CC9F80545521AA/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="Dequeue time out.png" title="Dequeue time out.png" align="center" /&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Apr 2012 18:32:50 GMT</pubDate>
    <dc:creator>johnsold</dc:creator>
    <dc:date>2012-04-10T18:32:50Z</dc:date>
    <item>
      <title>Tips to remember when using Queued State machine</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1908271#M640563</link>
      <description>&lt;P&gt;I have been able to work through to convert my State Machine architecture to a QSM thereby eliminating using Local variables/property nodes to send values/data to my State machine but instead sending them through queues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like some tips/advice on making use of them perfectly. Especially, "Not to do" stuff with queues and How to efficiently release a queue etc. What is the convention when using queues? Thanks!&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;V&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2012 15:53:39 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1908271#M640563</guid>
      <dc:creator>VeeJay</dc:creator>
      <dc:date>2012-03-09T15:53:39Z</dc:date>
    </item>
    <item>
      <title>Re: Tips to remember when using Queued State machine</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1908303#M640572</link>
      <description>&lt;P&gt;Before I can reply I must ask a califying question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you talking about a QSM Queued State Machine where the states to be executed are stored in a queue and populated by the SM cases themselves...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OR&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;QMH Queued Message handler where a secondary loop executes states based on what is queued up from anther source?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ben&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2012 16:09:58 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1908303#M640572</guid>
      <dc:creator>Ben</dc:creator>
      <dc:date>2012-03-09T16:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: Tips to remember when using Queued State machine</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1908383#M640590</link>
      <description>&lt;P&gt;Hmmm!! I jumped the gun... I would have to say, Neither... I guess it isn't really QSM or Queued message handler. My State machine is the generic one. But, data for the SM is obtained from a queue and feedback is sent back from the State machine through a queue. Does that clarify ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW, good to know more variations.. Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2012 16:47:48 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1908383#M640590</guid>
      <dc:creator>VeeJay</dc:creator>
      <dc:date>2012-03-09T16:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: Tips to remember when using Queued State machine</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1908445#M640604</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://ni.lithium.com/t5/user/viewprofilepage/user-id/139820"&gt;@VeeJay&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hmmm!! I jumped the gun... I would have to say, Neither... I guess it isn't really QSM or Queued message handler. My State machine is the generic one. But, data for the SM is obtained from a queue and feedback is sent back from the State machine through a queue. Does that clarify ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW, good to know more variations.. Thanks!&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That is a QSM.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will defer to those that use them regularly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would only use such a a construct if the queue was limited to a single entry and prevented inserting multiple states at the front or back of the queue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As long as the queue is limited to a single entry then a State Transition Diagram could be used to described all of the states.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The multiple entry version can be thought of as a method to implement a "goto" statement in LV. Very useful for those that come from a background working with stacks and pushing and popping off work and those that use them often love them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But for me&amp;nbsp;let me refer to a letter from&amp;nbsp;Dijkstra&amp;nbsp;&lt;A href="http://books.google.com/books?id=DulqCHiuD4YC&amp;amp;pg=PA59&amp;amp;lpg=PA59&amp;amp;dq=%22goto%22+introduce+chaos&amp;amp;source=bl&amp;amp;ots=_3EzwihipP&amp;amp;sig=YOKXzgqo_0zKiPrhItLs3TQvwb4&amp;amp;hl=en&amp;amp;sa=X&amp;amp;ei=0ThaT8T6AsTi0QGI4YiNBg&amp;amp;sqi=2&amp;amp;ved=0CCAQ6AEwAA#v=onepage&amp;amp;q=%22goto%22%20introduce%20chaos&amp;amp;f=false" target="_self"&gt;quote from here&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"GOTO Staements Concidered Harmful" goto statement introduces chaos&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ben&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2012 17:23:20 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1908445#M640604</guid>
      <dc:creator>Ben</dc:creator>
      <dc:date>2012-03-09T17:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: Tips to remember when using Queued State machine</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1908497#M640616</link>
      <description>&lt;P&gt;Don't enqueue data to yourself. Sometimes it is appropriate but just be careful. This kind of thing can lead to horrible bugs that are difficult to track down.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://forums.ni.com/t5/image/serverpage/image-id/68739i0E3906F0A84A4692/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="Example_VI_BD.png" title="Example_VI_BD.png" align="center" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2012 17:53:51 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1908497#M640616</guid>
      <dc:creator>SteveChandler</dc:creator>
      <dc:date>2012-03-09T17:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: Tips to remember when using Queued State machine</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1908665#M640650</link>
      <description>&lt;P&gt;I guess I'll jump on this thread. &amp;nbsp;I'm having some trouble with basic producer/consumer loops. &amp;nbsp;My goal is to acquire waveforms from a digital oscilloscope and write them to file as quickly as possible. &amp;nbsp;For debugging I'm using write to spreadsheet, but I ultimately plan to write the data in binary format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For some reason, the write loop below continues to write waveforms even after I've stopped sampling. &amp;nbsp;All of the waveforms appear to be identical (first waveform?) as well so I'm clearly not queuing/dequeuing properly. &amp;nbsp;I've changed numerous things, like adding a timeout to the dequeue but it had no effect...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://forums.ni.com/t5/image/serverpage/image-id/68753i765D8F0E469425ED/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="Scope.jpg" title="Scope.jpg" align="center" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any clues? &amp;nbsp;Thanks in advance...&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2012 20:22:51 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1908665#M640650</guid>
      <dc:creator>Chingon</dc:creator>
      <dc:date>2012-03-09T20:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: Tips to remember when using Queued State machine</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1908669#M640651</link>
      <description>&lt;P&gt;Move the dequeue-element VI inside the lower for-loop.&amp;nbsp; Without any data there, that VI will hold until there's data there.&amp;nbsp; When there is data there, that loop is going to execute until there's nothing left in the queue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And dont' forget to close the queue at the outside of the producer loop, next to the z-scope close VI.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2012 20:26:21 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1908669#M640651</guid>
      <dc:creator>SnowMule</dc:creator>
      <dc:date>2012-03-09T20:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: Tips to remember when using Queued State machine</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1908695#M640655</link>
      <description>&lt;P&gt;Also some other clean-up I'd suggest..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Get rid of the case statement in the producer loop.&amp;nbsp; It appears the only purpose of that is to turn on/off the saving-to-file VI.&amp;nbsp; Instead, put that switch in the consumer loop, and put the case structure around the write-to-spreadsheet VIs.&amp;nbsp; The less tunnels you have into and out of a case structure, the less memory/CPU it requires.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you're logging a voltage and a time together, why write to two files instead of two columns in the same file?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dataflow is the reason you see the first element written over and over and over and over.&amp;nbsp; The dequeue-element executes, pops the first element off the queue and stuffs it through the tunnels on the while-loop.&amp;nbsp;&amp;nbsp; That dequeue-element never executes again, since its outside the while-loop, so the values of the first element stay at those tunnels and are brought in every time the loop comes around.&amp;nbsp; Since those values never change, the loop is going to execute infinitely or until the Stop Writing control is true.&amp;nbsp; The "# of elements in queue" updates because the queue wire is a reference to the queue that you're filling up in the producer and you read the reference to elements-in-queue each time the consumer loop spins around.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2012 20:35:21 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1908695#M640655</guid>
      <dc:creator>SnowMule</dc:creator>
      <dc:date>2012-03-09T20:35:21Z</dc:date>
    </item>
    <item>
      <title>Re: Tips to remember when using Queued State machine</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1908711#M640657</link>
      <description>&lt;P&gt;^Thanks for the tips. I did move my dequeue into the while loop and that solved the frozen values.... but only when run in highlight execution mode. &amp;nbsp;When I run at full speed I get a nonsense repeated waveform. &amp;nbsp;Debugging to continue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, when I release the queue after the producer loop I error out because my writing loop is still looking at it. &amp;nbsp;The reason I have a case loop in the producer is because the False state is when I'm graphing the waveforms and not writing them. That part works great.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2012 20:47:52 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1908711#M640657</guid>
      <dc:creator>Chingon</dc:creator>
      <dc:date>2012-03-09T20:47:52Z</dc:date>
    </item>
    <item>
      <title>Re: Tips to remember when using Queued State machine</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1908719#M640661</link>
      <description>&lt;P&gt;@Steve Chandler, would you mind elaborating on your thought? I don't understand enQ when you have shown deQ element funtion. Do you mean do not enQ inside a case structure after deQing? THnaks!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2012 20:51:04 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1908719#M640661</guid>
      <dc:creator>VeeJay</dc:creator>
      <dc:date>2012-03-09T20:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: Tips to remember when using Queued State machine</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1908721#M640662</link>
      <description>&lt;P&gt;@Chingon I thought I could share a document i found on NI community that describes writing Daqmx to a file using PC architecture. Hope this gives a tip on what you are trying to do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://decibel.ni.com/content/docs/DOC-2431" target="_blank"&gt;https://decibel.ni.com/content/docs/DOC-2431&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2012 20:53:03 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1908721#M640662</guid>
      <dc:creator>VeeJay</dc:creator>
      <dc:date>2012-03-09T20:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: Tips to remember when using Queued State machine</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1908723#M640663</link>
      <description>&lt;P&gt;^Yes, I also don't really understand the meaning of enqueuing data to yourself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-sorry for the threadjack, I'll make a new thread regarding my debugging process. &amp;nbsp;Suffice it to say that the enqueuing fix SnowMule provided has worked.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2012 20:54:08 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1908723#M640663</guid>
      <dc:creator>Chingon</dc:creator>
      <dc:date>2012-03-09T20:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: Tips to remember when using Queued State machine</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1908851#M640684</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://ni.lithium.com/t5/user/viewprofilepage/user-id/139820"&gt;@VeeJay&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://ni.lithium.com/t5/user/viewprofilepage/user-id/1994"&gt;@Steve&lt;/a&gt; Chandler, would you mind elaborating on your thought? I don't understand enQ when you have shown deQ element funtion. Do you mean do not enQ inside a case structure after deQing? THnaks!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;This is what I mean. I should have elaborated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://forums.ni.com/t5/image/serverpage/image-id/68769i99ACC42F16F1EEDA/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="Example_VI_BD.png" title="Example_VI_BD.png" align="center" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2012 23:07:41 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1908851#M640684</guid>
      <dc:creator>SteveChandler</dc:creator>
      <dc:date>2012-03-09T23:07:41Z</dc:date>
    </item>
    <item>
      <title>Re: Tips to remember when using Queued State machine</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1909977#M640946</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;Well there wre not a lot of sugestions by users of QSMs so I'll add what I know and have learned from recieiving them as projects started by my customers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) The QSM desgin patern reminds me of "The Worm Orobors" Dragon eating its tail. I mention this bcause like a dragon the QSM can be powerful and at the same time dangerous. If the Dragon eats too much it can slow down further consumption.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is illustrated by Steve's post above where he warned about queueing update state&amp;nbsp;from within states.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;Steve Chandler wrote:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;...&amp;nbsp;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;IMG src="http://forums.ni.com/t5/image/serverpage/image-id/68769i99ACC42F16F1EEDA/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="Example_VI_BD.png" title="Example_VI_BD.png" align="center" /&gt;&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if we takes Steve's suggestion literaly the QSM will simply become a State Machine (with a fancy way of sortin the next case) and defeats the feature of the QSM.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So be very careful in how muh you let the QSM feed itself. If you get to a point wre you want to give it two bytes of the apple, thenk twice (or three times).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On the same token, think about those states that welcome "stacking up the plate" like the sequence of states "Set Path",&amp;nbsp;"Open File",&amp;nbsp;"Write" for example. A QSM can be structured to use those three states in sequence for mot than one file. So instead of pushing three states Set, Open, Write, concider tossing "Set" and "Open" and turn them into sub-VIs that are invoked prior to calling "Write".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So consiering turning states into sub-VI to avoid the defining a bufet for the beast.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2)&amp;nbsp;Analyze your data structures and think about "Who touches what data when?"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;WHat you will often find is there is some data that only gets touched in a couple of situations and there fore the data does not have to be available in every state. Concider pusing that datat down into a AE and remove those explicit functions from the QSM (same thoughs apply to SM&amp;nbsp;BTW). When it time to do something whit tht data, use the AE and not a state in the&amp;nbsp;QSM.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) Document, document document!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;QSM's can develop in beasts if you are not careful. If you limit them to a well defined set of tricks and declaw them regualarly, and keep thm hungry, you and your code should benefit.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Trying to help,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ben&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2012 12:50:05 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1909977#M640946</guid>
      <dc:creator>Ben</dc:creator>
      <dc:date>2012-03-12T12:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: Tips to remember when using Queued State machine</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1910075#M640972</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
2)&amp;nbsp;Analyze your data structures and think about "Who touches what data when?"
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;WHat you will often find is there is some data that only gets touched in a couple of situations and there fore the data does not have to be available in every state. Concider pusing that datat down into a AE and remove those explicit functions from the QSM (same thoughs apply to SM&amp;nbsp;BTW). When it time to do something whit tht data, use the AE and not a state in the&amp;nbsp;QSM.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Thanks Ben! That explains quite a bit. I am a little lost on Point 2. I do have data that is only used in certain states. I just wire it up to the case structure and use it only in the required state. For example, My COM Port sends speed and angle data only when we click on a CONTROL. My state machine sits in a wait state until I get the "START boolean", "Speed" and "Angle" data from the COM port. START=TRUE, I enter into an operational state. Is this a wrong way to go about it? (You said, same thoughts apply to SM ) A little more elaboration would be awesome. Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;V&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;P.S. I think the architecture I am using is pseudo QSM, I will post my vi once I Clean up a little bit.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2012 13:41:38 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1910075#M640972</guid>
      <dc:creator>VeeJay</dc:creator>
      <dc:date>2012-03-12T13:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: Tips to remember when using Queued State machine</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1910141#M640980</link>
      <description>&lt;P&gt;Also, I would like some guidance in using shift registers for queues. Sometimes, I see code where shift registers are used for queue name and error, in the enQ loop and not&amp;nbsp; in the deQ loop. Why is it? Is that the right convention?&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2012 14:16:01 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1910141#M640980</guid>
      <dc:creator>VeeJay</dc:creator>
      <dc:date>2012-03-12T14:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: Tips to remember when using Queued State machine</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1912247#M641373</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://ni.lithium.com/t5/user/viewprofilepage/user-id/139820"&gt;@VeeJay&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Also, I would like some guidance in using shift registers for queues. Sometimes, I see code where shift registers are used for queue name and error, in the enQ loop and not&amp;nbsp; in the deQ loop. Why is it? Is that the right convention?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Whenever using a loop, especially a For Loop, there is a chance that the loop will iterate 0 times.&amp;nbsp; Lets say there is an array going into the loop with indexing enabled.&amp;nbsp; Lets say the array accidentally is empty.&amp;nbsp; The loop will iterate 0 times.&amp;nbsp; Whenever this happens, if you use regular tunnels for the queue name, the queue name goes in, but since the loop did not execute, some default value (probably NULL) comes out.&amp;nbsp; So when you try to close the queue name, you will get an error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you don't use an array to trigger the number of loops, this point is pointless.&amp;nbsp; But it is a good habit to make to always use shift registers for such things as queue names, VISA handles, etc.&amp;nbsp; As for error in and out, if you use shift registers, any errors that occur in one iteration carries over to the next.&amp;nbsp; With tunnels, this won't happen.&amp;nbsp; Whatever comes into the loop will always be used for the next iteration.&amp;nbsp; You will lose any errors that occur inside the loop, except for the last iteration.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this clears up the shift registery mystery.&amp;nbsp; I always use shift registers, even for While Loops, just to form and keep a good habit.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Mar 2012 17:34:29 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1912247#M641373</guid>
      <dc:creator>tbob</dc:creator>
      <dc:date>2012-03-13T17:34:29Z</dc:date>
    </item>
    <item>
      <title>Re: Tips to remember when using Queued State machine</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1913509#M641581</link>
      <description>&lt;P&gt;Thanks tbob! That helps. I always used shift registers for Q's but now am also going to use it for VISA Serial handles and errors. I haven't seen any case in my 2 years where it didnt work without shift registers but it is better to be safe.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One more question. Is it mandatory to run the Q name wire through a case structure or event structure to the other side? I mean, the data that I deQ is used in the case structure/event structure but I do not wire the Q name through. Any repurcussions in not doing this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, highlight execution is so slow that sometimes the I lose track of the logic. And especially with the Software I am using for integration, it pops an error whenever I use highlight execution (perhaps the 3rd party software I am using has a timeout error or something). So, I am unable to step through my code, I am forced to complete the entire code before testing it in which case I am either right or wrong and troubleshooting is getting hard. Is there an alternate to highlight execution?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Mar 2012 15:22:09 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1913509#M641581</guid>
      <dc:creator>VeeJay</dc:creator>
      <dc:date>2012-03-14T15:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: Tips to remember when using Queued State machine</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1913791#M641641</link>
      <description>&lt;P&gt;I have attached my code (simplified version of my humongous application). Main idea is implementation of Qs. &lt;U&gt;&lt;STRONG&gt;Comments on this would help me when I take my CLD next month. &lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;TEAR ME APART! I need to learn. Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please excuse the Block diagram. I put it up in a hurry for comments. Basic thing happening there is Serial Port sends commands and accepts Feedback (top 2 loops).&lt;/P&gt;
&lt;P&gt;Based on commands, instructions are sent and feedback received. (bottom 2 loops) It looks like a 1-stop flight you take. both ways &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Central loop is the layover.&lt;/P&gt;
&lt;P&gt;Any design errors and logic ones? I would really appreciaite it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have posted this in many forms before and I think this would be my last one since I would have used Qs. TDML_split ....vi is the subvi in loop1. Inside that vi there are just conversion vis. I don;t think those need to be posted unless they do. Please let me know. Sorry for multiple edits.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Mar 2012 17:45:25 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1913791#M641641</guid>
      <dc:creator>VeeJay</dc:creator>
      <dc:date>2012-03-14T17:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: Tips to remember when using Queued State machine</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1913851#M641651</link>
      <description>&lt;P&gt;VeeJay,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First, I have not taken the CLD, so consider my comments with regard to that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Documentation is listed as a major component of the scoring. &amp;nbsp;The scorers seem to want VI documentation, tip strips on controls, description on BD of what various parts of the code do, and a non-default icon. &amp;nbsp;You have a few comments on the BD and none of the others. &amp;nbsp;You do nota have anything which actually says what this VI is expected to do.&lt;/P&gt;
&lt;P&gt;2. Make Typedefs of controls and clusters which get reused or which may need to be modified in the future. &amp;nbsp;Your byte count cluster was the one which caught my eye. &amp;nbsp;You have two copies of this outside the the upper loop. &amp;nbsp;One would be enough.&lt;/P&gt;
&lt;P&gt;3. Shift registers. Several of the shift registers carry data which is never changed inside the loops. Do you have a good reason for using shift registers rather than tunnels? &amp;nbsp;If so, it should be documented.&lt;/P&gt;
&lt;P&gt;4. The TDML_split.... VI is missing. It appears that you read on byte from the serial port and then derive three numerical values from it. &amp;nbsp;I would like to know how you do that.&lt;/P&gt;
&lt;P&gt;5. The Queue Status followed by #elements in queue = 0? seems to be redundant with Dequeue with a timeout.&lt;/P&gt;
&lt;P&gt;6. Writing data to the Control code indicator will not trigger the Control code value change event.&lt;/P&gt;
&lt;P&gt;7. The Unbundle and Bundle nodes in the event structure can be simplified and improved. &amp;nbsp;The image below shows your original code in the center. &amp;nbsp;Below I show wiring the cluster wire into the center terminal of Bundle. When it is wired this way, only elements which change need to be wired at the left side. &amp;nbsp;At the top I show the same thing using Bundle by Name. This has the advantage of bein self-documenting.&lt;/P&gt;
&lt;P&gt;Anyone looking at this code knows immediately what is being changed. &amp;nbsp;You code works. &amp;nbsp;The others can save you some time now and in the future.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://forums.ni.com/t5/image/serverpage/image-id/69117i6DBA449C52E97701/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="Cluster Bundle simplified.png" title="Cluster Bundle simplified.png" align="center" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;8. You do not handle or report errors. &amp;nbsp;That is one of the things which I have heard that CLD scorers look for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lynn&lt;/P&gt;</description>
      <pubDate>Wed, 14 Mar 2012 18:17:48 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Tips-to-remember-when-using-Queued-State-machine/m-p/1913851#M641651</guid>
      <dc:creator>johnsold</dc:creator>
      <dc:date>2012-03-14T18:17:48Z</dc:date>
    </item>
  </channel>
</rss>

