SofiaShahid Posted April 16, 2013 Report Share Posted April 16, 2013 Hello, For my application I need to perform 25 operations in series that requires opening and closing of switches and checking the system parameters and all should be in sequence. I do not want a sequence stucture for every task. Please recommend a suitable alternative. I am using Labview 2012 on windows 7 Regards, Sofia Quote Link to comment
hooovahh Posted April 16, 2013 Report Share Posted April 16, 2013 The most obvious (and most popular) answer is a state machine. You can queue up your 25 operations and then do them one after another. With a state machine you can have it update data, between states, or go to cleanup if something fails on step 15 or do what ever you want. You aren't limited to performing the 25 states one after another until they are all complete. I recommend a modified type of state machine called a Queued Message Handler (QMH). Go to File >> New... and select the Queued Message Handler under VI >> From Template >> Frameworks >> Design Patterns. This works in a similar way to a normal state machine but uses strings for the state names (not enums) and is more flexible, but also is more error prone (mis-spelled states for example). Quote Link to comment
crossrulz Posted April 16, 2013 Report Share Posted April 16, 2013 I second the recommendation of a state machine. I actually would use a normal state machine for what you quickly described. Quote Link to comment
ShaunR Posted April 16, 2013 Report Share Posted April 16, 2013 Connecting VIs via their error terminals is the preferred method to a sequence structure. 1 Quote Link to comment
Bryan Posted April 17, 2013 Report Share Posted April 17, 2013 With the ambiguity of the question, one could even suggest something as simple as a for loop. Without knowing how similar the 25 operations are (they could be the same operation 25 times with the same data type in/output), I'll "second" ShaunR's post and "third" a state machine. Quote Link to comment
Norm Kirchner Posted April 18, 2013 Report Share Posted April 18, 2013 Based on the limited information associated with the post, I would also recommend using a Queued Driven Message Handler (QDMH)(Template available via the 2012 sample/template projects) I presume you're a relatively new developer and as useful as the QDMH is in making sure your application can do what you want, it has a variety of key flaws for handling flow control, especially if it's event driven from the Front Panel. For simplicity sake, it might be best to defer to a basic state machine and simply index the enumeration +1 for each itteration of the loop. Also, based on experience, Shaun's response is probably not what you'd choose right now because you're likely sharing a variety of pieces of information between each one of the steps and you don't feel comfortable making each of these calls into their own unique SubVI or making a well structured TypeDef cluster to store all this information. However, on the latter point of my previous comment, whether or not you use a QDMH or a basic State Machine, I would HIGHLY recommend that you use a 'Mother Cluster' going through a shift register to share information from step to step of your sequence. The QDMH template project and TLB http://lavag.org/topic/14164-discuss-tlb-top-level-baseline/ are good examples of this practice. Best, Norm ~,~ ps. Good luck and straighten your wires out! They have too many random kinks in them. (people like to help people more who write cleaner code) Quote Link to comment
ohiofudu Posted April 19, 2013 Report Share Posted April 19, 2013 Hi hope this will help you start your sequential task without sequence structure. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.