Jump to content

Flat Sequence


Recommended Posts

Why do you want to use a stacked sequence structure?

I suspect that the majority suggestion on LAVA would be to convert the flat seqs to sub-vis. If they are old and work, don't mess with them; especially if you aren't touching the code inside them. People usually use flat seq structures to enforce order of operation and a seemingly simple change can break things badly. They did this because they don't understand dataflow which means they don't know LabVIEW and that means there may be other monsters waiting to bite you.

If the flat seqs are large (complex) and need to be modified, it might be better to create a sub-vi. Within the sub-vi, they can be converted from a flat to a stacked seq structure and then finally to a case structure that can be wrapped with a while loop and some shift registers to be turned into state machine. You can even use a diagram disable structure to leave a copy of the flat seq in place as you refactor. If something doesn't work, you can just use the old code until you have time to 'do it right'.

If the flat seqs contain locals or property nodes that modify data not related to the code within the structures, you've got a whole big, ugly, nasty bag of butt hurt that can't be fixed with sub-vis or get better by adding a stacked sequence structure. The block diagram of your top level VI may look nice, but the next person looking at the code won't be any happier than you.

When I open a piece of code that contains nested sequence structures, I become instantly upset to my stomach.

My choices in order of preference:

1. State Machine

2. Flat seq structure

3. Anything else ( :P)

4. stacked sequence structure

P.S.

Remembered this from the NI Idea Exchange:

http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Splitting-and-exiting-flat-sequences/idi-p/1535798

I'm going to throw my R&D two cents in here in support of "what Lynn said". You've built a flat sequence structure when what you need is a case structure inside a while loop. You can popup on the flat sequence and choose "Replace with Stacked Sequence" and then you can pop up on the stacked sequence and choose "Replace >> Replace Case Structure". Having done that, put a while loop around it and wire the terminal to the ? terminal.

Edited by Phillip Brooks
  • Like 1
Link to comment

I will say convert codes in each sequence to a vi and use Error cluster to enforce sequence if it is only 3 sequence.For more than 3 sequence use State Machine.

I agree with the first part, but I do not necessarily agree on arbitrarily converting a series of subvi's into a state machine if there is never any need to programatically change the order of execution. In fact, for a series of subvi's that are always called in sequence (very likely in this case, since I doubt the frames have been coded with any idea of replication elsewhere) I'd find that keeping them laid out in a row would be more readable, especially with some informative icons.

Link to comment

To get the effect you show in the picture, simply remove both FSS and replace with one big one. I doubt you want that, you probably want to merge the two. In this case I would simply align the two individual structures side-by-side, functionally the same with a lot less pain. Stacked sequences would be a bad idea.

If it ain't broke, don't fix it. If it is broke, start over. You seem to be headed down the path of most work for least return.

  • Like 1
Link to comment
  • 3 weeks later...

why not just drop the stacked sequence structure on the block diagram. Drop one of the flat sequence structure inside stacked sequence. Right click the frame of the stacked sequence and add the frame. Inside the new frame, add the second flat sequence. And keep doing it until all flat sequence frames are placed.

This is just to do what you want to do. I would perhaps take the advices above, convert the code into vis and the state machine. Using proper labview architecture, the application could be extended and scaled in future

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.