Sharon_ Posted April 4, 2012 Report Share Posted April 4, 2012 Hi, Is it possible to combine 2 flat sequence into 1? Regards, Sharon Quote Link to comment
BramJ Posted April 4, 2012 Report Share Posted April 4, 2012 right click frame -> add frame after/before ? Quote Link to comment
Sharon_ Posted April 4, 2012 Author Report Share Posted April 4, 2012 No. I have some old VIs where the programmer has used so many flat seq structures with frames. I want to have one flat seq ultimately so I can convert it into stacked seq. Regards, Sharon Quote Link to comment
Phillip Brooks Posted April 4, 2012 Report Share Posted April 4, 2012 (edited) 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 ( ) 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 April 4, 2012 by Phillip Brooks 1 Quote Link to comment
ohiofudu Posted April 4, 2012 Report Share Posted April 4, 2012 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. Quote Link to comment
Jordan Kuehn Posted April 4, 2012 Report Share Posted April 4, 2012 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. Quote Link to comment
Darin Posted April 4, 2012 Report Share Posted April 4, 2012 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. 1 Quote Link to comment
Sharon_ Posted April 5, 2012 Author Report Share Posted April 5, 2012 Just to save some block diagram space. That's all. Quote Link to comment
KWaris Posted April 21, 2012 Report Share Posted April 21, 2012 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 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.