Stacked sequence dynamically

Hello,
This is what I am trying to do (maybe stacked sequence is not a good option):
1. User enter no of iterations
2. Lets say user enters"2", then i want 2 different plots, 2 different indicators to be displayed
3. If the user enters "3", then i want 3 different plots, 3 different indicators to be displayed
3. Since i want 2 different indicators, I dont wanna use for loop. As for loop will give me an array and I can probably index the array, but then i would have to control the display as well and it is manageable if i have less iterations, however, if i have more iterations then it would be an issue
4. So I was thinking if I can dynamically change the number of sequence in stacked sequence then depending on no of iteration, I would have corresponding sequence with each sequence doing the same thing. The benefit being i dont have to do any post processing
Please let me know if this is the right thought process?
Thanks

Use a FOR loop.  Wire the i straight into the case structure's selector.  Now you basically have your sequence structure, but you can choose how many iterations to have based on N.  The sequence structure must run straight through no matter what.
But a state machine is probably really what you want.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines

Similar Messages

  • Event structure in "for loop" and stacked sequence

    I tried to put an event structure into a for loop sequence, then used a pause button to pause the program (one loop with event structure.vi). The pause button functioned normally since the program could be paused whenever the button was pressed. Then, I put this for loop sequence into a stacked sequence (Problem.vi), which has 2 frames and every frame has the for loop sequence in it. After the pause button was pressed once, the pause button and stop button will no longer effective anymore. Where should I modify so that this program will work properly? Thanks a lot.
    Attachments:
    Problem.vi ‏42 KB
    one_loop_with_event_structure.vi ‏27 KB

    Ah, at last something weird !
    The answer is simple : don't do that !
    You should either avoid having 2 event structures handling the same events, or learn how to process dynamic events.
    Why didn't you read the answers to a question posted a few hours ago (still on the overview page of this forum ?). See here.
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • Advice on breaking up Stacked Sequences in 6.1?

    I've dived right into an old but functional
    test system ~300 VI's. Flow and structure is pretty hard to follow and
    I'm thinking of breaking it up into state machines.
    Any ideas on how to approach a stacked sequence beast in 6.1? Flat sequence seems crucial to the method described here.
    Rough layout of main vi attached:
    Attachments:
    main.PNG ‏46 KB

    Open your VI in LV 8.x and use the method described in your linked thread ;-)
    You can copy the sequence and remove it while displaying frame 0 in the original and frame 1 in the copy. If you have controls/indicators they will be duplicated. Also, wire connections via sequence locals will be lost. So you will have to rewire and clean up your code. But I think there's no straightforward solution because flat sequences didn't exist in 6.1.

  • 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

  • [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

  • Stacked sequence does not trigger

    I am reviewing Pull-down Menu.vi in Labview BasicsII: Development Coarse Manual. When I go through Exercise 2-7, I never get the dialog boxes. I have the Get Menu Selection wired to the stacked sequence where it connects to the box containing the question mark. When I choose "Test 2" or any of the menu choices, it does not trigger the frames.
    I ran the program in solutions on the disk, and this program runs correctly, showing the dialog boxes.
    I have had this problem before. I connect a wire to a stacked sequence where it shows the question mark. But the stacked sequence ignores the information coming to it.

    First, I think you're refering to a case structure and not a sequence structure.
    Second, you are probably not defining your cases properly. You can use probes to examine exactly what data you're sending to the case structure selector terminal (that's the question mark). If you are using strings, the strings have to much exactly to the strings in the case definition. If they don't match, the default case will execute. If, after using a probe to see what data you are sending the case structure, and after making sure you defined the cases correctly, you still don't see what's wrong, you should post your VI.
    I realize saying this is a bit unnecessary, because you already started, but...
    To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
    In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).
    Try to take over the world!

  • 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

  • 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 .

  • Question on stacked sequence

    Hi,
    I have a question regarding stacked sequence.
    I have a stacked sequence with 5 sequences (0,....,4). I would like to execute these in this form
    0, 1, 2, 1, 3, 1, 4, 1  then again 0,..
    I don't want to duplicate the 1 section since it contains many objets, variables,...One possibility would be to move out the objects then duplicate the sequence and use shift registers but I don't want to use this because in 1, I have some real time graphs to plot..
    Is there another (easy) way to do this ?
    Thanks for ideas,
    Regards
    Solved!
    Go to Solution.

    nitad54448 wrote:
    I have a question regarding stacked sequence.
    Sequences MUST execute in order until all frames are complete, and there is no escape. Don't use stacked sequences, they are too limiting.
    nitad54448 wrote:
    I don't want to duplicate the 1 section since it contains many objets, variables,...
    You don't need to duplicate it. Create a simple state machine with cases 0,2,3,4 and add the code of state 1 right after the case, so it executes at each iteration of the loop after any of the states.
    Here's a quick draft (LV 8.0) that would cycle through the states as you specified forever. See if it can give you some ideas.
    Please show us your actual code, maybe we have a few better suggestions.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    RepeatStates.vi ‏14 KB

  • Using same string indicator in different stacked sequences

    Hi guys, I want to use the same string indicator in different stacked sequences. I tried to wire the output of every string constant through the sequence to my string indicator outside the sequence block but then I get an 'Wire connected to an undirected tunnel' error. What is the best way to use the same indicator for all the sequences?
    Solved!
    Go to Solution.

    GerdW wrote:
    GerdW wrote:
    @TiTou:
    Problems with copy&paste?
    not even :-o
    GerdW wrote:
    @TiTou:
    Problems with copy&paste?
    not even :-o
    see : http://forums.ni.com/t5/Feedback-on-NI-Discussion-Forums/Text-lines-and-images-get-duplicated-when-I...
    When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"

  • 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

  • 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

  • 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

  • Flashing stacked sequence auto start and stop

    Seems like this should be so easy but I'm stumped.
     I want to use some flashing leds while some of my data is plotted but can’t figure out a way to programmatically start and stop a simple flashing stacked sequence.
    thanks for any help.
    Attachments:
    flashing LEDs.vi ‏33 KB
    flashing LEDs.png ‏12 KB

    OK. Then put the flashing in the loop with Stuff 2, which I presume is the one for which you want to show activity. I modified your program to do this. I also eliminated the sequence structure by using dataflow. You can probably get down to one loop by changing to a state machine structure.
    If the flashing rate needs to be a different rate than the Stuff 2 logic, put the slower part into a case structure which only executes one time for every n iterations.
    Lynn
    Attachments:
    flashing LEDs.2.vi ‏16 KB

Maybe you are looking for