Proper use of stacked sequence structure

Hello
I have been reading this forum up and down, trying to figure out what the proper use of a stacked sequence struckture is.
The reason i ask was that almost evryone in this forum thinks it is miss used / and or hides code. And that there is berrer ways of doing it.
I ask this question, wondering what is the PROPER use of SSS?
attached is the code so you can see what i am doing. As you will see, the code in the SSS are all the same for each frame, only channel number and numeric indicator is different, making upscaling more efficiant.
Faster readings is not an issue since i will be slowing it down later on, so we get a visual value evry 5-10 seconds or so.
keep in mind i am a novice at LabView, and all input is much appreciated.
Attachments:
r read 1ch.vi ‏52 KB

TorbH wrote:
I tried using array as you showed, but i fail to get it to work properly, well it works as it should but i want it to be able to stop with a button, when i did that only channels 202 - 206 stopped. 201 kept going.
The reason for me to have this opportunity is that later i will connect channels 207-212. and they also will need to be started/stopped seperatly.
Put the stop button inside of the loop.  The button is read with the terminal.  The terminal is read outside of the loop, so it will have the same value for every iteration of your loop.  By moving the terminal inside of the loop, your terminal will be read every iteration and you can therefore abort the loop.
TorbH wrote:
Also, frome here on out, how would i go ahead and use the data? Can i in a "state machine" use several for loops to perform the same tasks as i had in my previous version?
A state machine is actually just a single loop.  You can use a state macine with other loops, you just need to be careful of how you pass the data around.
State Machine
Producer/Consumer
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines

Similar Messages

  • Question about stacked sequence structure

    Hi,
    I made a numeric control outside a stacked sequence structure, and connect the control both to frame 1 and frame 2. In frame 2 there is a while loop structure. And now I start the labview program with the control A. Then, after frame 1 finished, frame 2 started, now I want to change the control to B and deliver B into frame 2. But the indicator in frame 2 shows that the control is still A. So I wonder how can I change the control and deliver it to the frame after the frame has started? Thank you!
    NI Software :  LabVIEW  version 7.1
    OS :  Windows XP
    Regards,
    jackauden

    Dataflow dictates what you are seeing. The control does not get read once the sequence starts. This is as expected.
    Some possible solutions:
    Just don't use stacked sequence! I don't and never feel limited by this choice.
    Create local variable of the control and read from it inside frame 2.
    Do you REALLY need a stacked sequence? Why???
    LabVIEW Champion . Do more with less code and in less time .

  • Problem using in Stacked sequence.

    I am using sstacked sequence structure, Where in each sequence I am having a sub VI which will pop up the Front Panel during the sequence, but the sub VI present in the next sequence is also poping the Front Panel. How to avoid this . I want the sub VI present in the next sequence to pop up only after I close the Fornt panel of VI present in the First sequence. Iam using this stacked sequence inside a event structure.

    Hi Rajashekar,
    Does the first subvi complete all its execution before the second vi front panel appears. If so then it may be that you just need to tell the first vi to close its front panel after it has finished executing. To do this right click on the sub vi and choose 'Subvi Node setup...' then tick the close afterwards if originally closed option
    Dave
    Message Edited by DavidU on 10-14-2008 09:21 AM
    Message Edited by DavidU on 10-14-2008 09:21 AM
    Attachments:
    SubVI setup.PNG ‏11 KB

  • Retrieve iteration from stacked sequence structure

    I have a stacked sequence structure with 15 iterations. Is there a functional equivalent to the "i" from the For loop or a way to make one?
    I need to trigger some other events based on what iteration of the stacked sequence is running. 

    Let me first reiterate what the others have said. Avoid stacked sequences like the plague!
    I have found that except for very few situations there is always a better way then using a sequence structure.
    That being said you could use a local variable to do this too...
    Attachments:
    it3.jpg ‏43 KB

  • Remove the stacked sequence structure from LabVIEW.

    Remove once and for all the stacked sequence structure from labVIEW
                                           It's an absolute horror.

    > Sequence locals are sometimes (for very few cases) usefull if you know how to use them properly
    What does that even mean????
    (.. and you are repeating basically the same statement about four more times as if  the use of sequences and sequence locals is an advanced skill, only to be used by LabVIEW masters. Your post is so redundant that it could be condensed to 20% of the size without loss of information).
    It is clear that the stacked sequence can never disappear from LabVIEW, because of the need for backward compatibility. (It could be taken out of the palette, but why...).
    LabVIEW Champion . Do more with less code and in less time .

  • [Help]: Exit stacked sequence in advance

    I am using a stacked sequence structure. Within one sequence, if I find a condition is met, I want exit the whole sequence structure without executing following sequences. Is there a simple way to do this?  Thanks a lot.
    Dejun

    Simple is a relative term.  I would highly recommend not using sequence structures as, usually, it can hide code (stacked) and the same can be accomplished using data flow.  If you cant get around using it (or just dont want to) then the below would be one obvious solution...
    Attachments:
    NoSequence.jpg ‏57 KB

  • "Exit" button used in multiple sequence frames

    I am hoping there is a more elegant way to do this...
    See the attached VI for a vastly-simplified program that typifies what I am trying to accomplish.  Basically, I've got one button that I want available in multiple sequence frames.  In this case, I have used an "Exit" button.  When pressed, the program passes through any remaining sequence frames until it ends.  The final frame "unclicks" the "Exit" button.  This final frame is necessary because I had to set the mechanical action of the Exit button to "Switch When Released" because I used local variables in all sequence frames after the first one.
    Is there a way I can accomplish the same functionalities of this program without using local variables and/or while setting the mechanical action of the "Exit" switch to "Latch When Released?"  I am specifically looking for solutions which will work in multiple frames of a stacked sequence structure (I realized there are ways to turn the three lights on without using a stacked sequence structure, but I am not interested in doing so).
    Any help would be greatly appreciated!  Thanks!
    Solved!
    Go to Solution.
    Attachments:
    Stop Button Demo.vi ‏14 KB

    hi dia,
    So many discussion was finished regarding this multiple Event structure. In your code totally 3 event structures you are using. But in a program only one Event structure is enough to operate properly. Because in LabVIEW only one event queue is there in built. So if you use more than one event structure LabVIEW will got confused and it will get queued up, even though there is no state and it will be masked some time. That's why your code taking so much of time to exit. Some times it seems like hang...
    Try this VI...
    <<Kudos are welcome>>
    ELECTRO SAM
    For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life.
    - John 3:16
    Attachments:
    Event Handle.vi ‏11 KB

  • Question about the sequence structure

    Hi,
    If we want to get best performance when programming a sequence of functions or calculations, we should choose 'Stacked sequence structure' or 'Flat sequence structure'? or they have the same performance?
    Thanks.

    To the best of my knowlege there is no performance hit, the "Flat sequence structure" was a fairly recent addition to try and overcome one (of many) complaints about sequence structures in general, that stacked sequences obscure what is happening in the code. If the various sections of your calculation or functions have data dependency, i.e. the output of a calculation is fed into the subsequent calculation or function, then a sequence structure is probably not needed as, with data flow, the calculation that is "dependent" won't executed until all its inputs requirements are satified. If the "functions" are in the form of sub-vi's the method that is more "proper" is to inforce a dependency between subsequent vi's. This can be as simple as adding error in and out controls to the sub-vi's, even if they are only passed through the vi without actually performing an error function. This allows you to wire them together in the execution order that is required. Doing this on some of the early "built-in" functions that have remained in LabVIEW (the original timer functions) sometime requires putting a wrapper around them to make them sub-vi's with error passing, but in the latest versions of LabVIEW the compiler seems to do a good job of minimizing any performance hits this might appear to cause.
    Putnam Monroe
    LabVIEW Evangelist since 1992
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

  • How to get current sequence in a stacked sequence

    Hello,
    I am trying to implement a progress bar for a stacked sequence; as the sequence increases, the bar increases etc... This may be trivial but I cant figureout how to determine the current sequence number.  There is no property node for a stacked sequence structure...
    I am using labview 8.5 
    Regards
    hvo

    First, what proces are you doing using teh sequence structure? In general, you should avoid using sequence structures, esspecially stacked sequence structures. I assume you are new to LabVIEW and data flow programming. Take some time to learn how to use data flow programming and you will find you rarely ever need to use sequence structures. There are lots of discussions which cover the negatives about sequence structures.
    Now, given that you will need to develop your own variable which is used to update the progress bar throughout the sequence. The brute force method would be to wire a value through and use sequence locals. However if you went down this path you will quickly see why sequence structures are not recommended. A more generic method would be to create an Action Engine (search for action engine for lots of explanations on those) which would control the progress bar data. Each frame would need to call the action engine to update the progress bar.
    Since it sounds like you are writing a fairly complex sequence I would recommend you do one of two things. First and probably the easiest would be to create a subVI for each frame and then simply use dataflow to wire these together in the order you want to execute them. The downside here is that you are creating subVIs which may or may not ever be reused. It is still a valid approach though. The second and more flexible approach would be to use a state machine to control your processing. This is much more flexible and easier to maintain than a stacked sequence.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Is there a way to automatically jump to a certain frame in a stacked sequence?

    I am working with stacked sequence structures.  I would like to have a condition in some of the frames, such that if the condition is false, the sequence proceeds normally, and if the condition is true, the sequence jumps to a certain frame.  Is this possible?

    Hi D. Luprek and drewsky,
    besides "sequence structures are generally frowned upon": JUMPing around in code is generally frowned upon!
    Long long time ago I used BASIC for programming and heard comments like "BASIC is spaghetti code" or "using JUMPs (aka GOTO) isn't programming"
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Data between stacked sequences

    I need to transfer a large array from one sequence to next sequence in stacked sequence structure. I made a property  node in next sequence, it works. But I did not feel it is the best way to do it. Please advice if any better way to do this job. Thanks

    You already received the correct answers above...
    Still, your question is not clear at all. Please try to describe the problem in more detail, maybe attach a simple VI that shows the main points.
    detech wrote:
    I need to transfer a large array from one sequence to next sequence in stacked sequence structure. I made a property  node in next sequence, it works.
    Are you trying to transfer data between "frames" of the same sequence structure or between two different sequence structures that are data dependent?
    As has been mentioned, to retain data between frames of the same sequence, use sequence locals.
    Anyway, I am absolutely sure there is a better way to do all this. If you show us your code, we can point you in the right direction.
    LabVIEW Champion . Do more with less code and in less time .

  • Stacked sequence inside for loop question

    Hi everyone,
    I am new to LabVIEW and I just want to make a for loop with a stack sequence inside. I want it so that when the for loop executes for the n-th time, the stacked sequence is at the n-th frame (because each frame contains different tasks to be carried out). Is this possible? or is there an alternative equivalent method? Please help me out! Thanks!!

    Thank you Norbert for the words of advice.
    Try to avoid Stacked Sequence Structures at all cost.  They are a nightmare to deal with when maintaining the code and they do not offer simple scalability, especially if you need to deal with parallelism.
    As Norbert suggested, State Machines is the way to go.  Try to avoid naming covention such as 1...2...3...4...5.......9999.  Give the name of each case based on what that case does.  Create a TypeDef Control for the state selector (you'll thank me after having changed it for the 5th time   ).
    There are probably 100's of examples in this forum.
    RayR

  • Why does a sequence structure execute if a while loop is to the left of it?

      I have a while loop in a case structure whose boolean is wired to a sub vi.  To the right of this structure I have a sequence that executes regardless of the while loops condition.  I assumed that the program would not continue to the case structure until the while loop stopped.  Then it would proceed to the case structure.
    Thank You

    jemengineering wrote:
      I have a while loop in a case structure whose boolean is wired to a sub vi.  To the right of this structure I have a sequence that executes regardless of the while loops condition.  I assumed that the program would not continue to the case structure until the while loop stopped.  Then it would proceed to the case structure.
    As others have mentioned, you have to familiarize yourself with the core idea of dataflow programming. One of the great powers of LabVIEW is the fact that things can occur in paralell unless there is data dependency.
    A good start would be the LabVIEW beginners online tutorial:
    http://www.ni.com/swf/presentation/us/labview/aap/default.htm
    The quiz #1 on slide 11 deals with the above issues. Try to answer it. 
    In your particular case, you need to force execution order. This can be done by creating a data dependency (preferred) or by the use of a sequence structure. You could e.g. create a 2-frame flat sequence and place the loop in the first frame and the case structure in the second frame.
    The picture shows a few scenarios for comparison. Can you spot the differences?  Understanding dataflow is crucial for writing any LabVIEW program.
    Message Edited by altenbach on 07-31-2006 06:49 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    ExecutionOrder.png ‏19 KB

  • Go out from stack sequence when there is an error

    Hi All,
    I have a small code that used to do the simple testing. I used all stack sequence to control the equipment sequencely. What I want to do is if there is an error (either failed to control equipment or any error that can occur) in any sequence, the code will make it go out rather than loop thru all the sequence then go out, is it possible to do this kind of feature ? I do try to using the event to raise the error but it failed cos I have no idea how to do it.Anybody please help.
    Thanks 

    But the problem is there are too many VI (about 20++
    Are you running 20 different test sequences ?  Or 20 instances of the same test?
    If it's the same test, or even a similar test, then make it a subVI, feed it parameters to customize it, and be done.
    If they're really that different, then the mistake was to write 20 different test sequences without handling errors.
    If that's the case, I know of no way to automatically replace the things. 
    Message Edited by CoastalMaineBird on 07-16-2009 05:14 PM
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • How to break a flat sequence structure ...??

    How to break a flat sequence structure into two flat sequences structures......i am a student learning labview....help me..

    To accomplish what you want you need to basically write some really ugly code. This is a side effect of using the flat sequence structure in the first place. This is exactly why they are not recommended.
    First and foremost you will need to place your frame structure inside a loop. This will control how many times you execute the code.
    Now you have a few alternatives to skip the first three steps which are kludging but time is of the essence.
    1. Place a case structure around the code within the first three frames. Each frame will have a case structure. You can use the loop count to control only executing the code the first time through the loop.
    2. You could combone the code of the first three frames into a single subVI and then use the same approach described above to skip executing that subVI.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

Maybe you are looking for