LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Replace Flat Sequence Structure?

I have made a program that uses a flat sequence to complete 20 steps 10 output and 10 input, now the program is just a monitoring build which has an array for each o/p so I am able to select what I measure for each point. I was after some advice on the best way to build a multiplexer or something along that line to replace the flat sequence. 

Any advice is appreciated 

0 Kudos
Message 1 of 11
(3,740 Views)

Search the forums for "state machine".

0 Kudos
Message 2 of 11
(3,736 Views)

Share the piece of code you tried so that you can get the better solution

As suggested pls practice design patterns (State Machine preferably)

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 3 of 11
(3,729 Views)

If you are doing "multiple steps", a State Machine (which uses a loop structure, with common values placed in Shift Registers and a Case Statement selecting which step you are doing, with one of the Shift Registers usually serving as "Which Step is Next?" decision) makes sense, and also has the side benefit of taking a long strung-out Block Diagram and "stacking" it in a "natural" structure.

 

On the other hand, some use the Sequence structure to (... pause ...) control the sequence of the VIs/functions involved.  In many cases, a better way to sequence things is to use the Principle of Data Flow, which often means The Error Line Is There for a Reason -- Use It.  Note that most NI functions have Error In and Error Out terminals, and NI Best Practices recommends that you use a 4-2-2-4 Connnector Pattern for your sub-VIs, with Error In and Error Out in the lower corners.  Functions place on the Error Line with (by the Principle of Data Flow) execute in the order they appear on the Error Line.

 

One of the few times that a Frame Sequence is required is if you need a 100-msec delay between one function finishing and the next one starting:  the Wait function doesn't have an Error Line, so when I need this, I either use a sub-VI I write that includes the Error Lines and a Wait inside, or use a Frame Sequence to surround the Wait and make sure "An Error Line Runs Through It".  [My apologies to those who may not catch the bad pun there ...].

 

Bob Schor

0 Kudos
Message 4 of 11
(3,685 Views)

@Bob_Schor wrote:
<snip>

One of the few times that a Frame Sequence is required is if you need a 100-msec delay between one function finishing and the next one starting:  the Wait function doesn't have an Error Line, so when I need this, I either use a sub-VI I write that includes the Error Lines and a Wait inside, or use a Frame Sequence to surround the Wait and make sure "An Error Line Runs Through It".  [My apologies to those who may not catch the bad pun there ...].

 

Bob Schor


I was concentrating more on the fact that you contradicted yourself from one sentence to the next.  Apparently it isn't required, Error Line Phoenix.  😉  (And my return pun is even more obscure.)

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 11
(3,675 Views)

LabVIEW provides this really useful tool called a stacked sequence.  It's great! just take each from from your flat sequence and copy it into the stacked sequence structure.... much better than those Queued Message Handlers and State Machines.  More sustainable too!

0 Kudos
Message 6 of 11
(3,663 Views)

@Tim_McClung wrote:

LabVIEW provides this really useful tool called a stacked sequence.  It's great! just take each from from your flat sequence and copy it into the stacked sequence structure.... much better than those Queued Message Handlers and State Machines.  More sustainable too!


I hope this message was one that is intended to be a joke.

Message 7 of 11
(3,659 Views)

Bob, Bill.  2017 has this really nifty vim. Called delay dataflow


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 11
(3,654 Views)

@RavensFan wrote:

@Tim_McClung wrote:

LabVIEW provides this really useful tool called a stacked sequence.  It's great! just take each from from your flat sequence and copy it into the stacked sequence structure.... much better than those Queued Message Handlers and State Machines.  More sustainable too!


I hope this message was one that is intended to be a joke.


Humor often resides in ambiguity. 😉

0 Kudos
Message 9 of 11
(3,644 Views)

@Tim_McClung wrote:

@RavensFan wrote:

@Tim_McClung wrote:

LabVIEW provides this really useful tool called a stacked sequence.  It's great! just take each from from your flat sequence and copy it into the stacked sequence structure.... much better than those Queued Message Handlers and State Machines.  More sustainable too!


I hope this message was one that is intended to be a joke.


Humor often resides in ambiguity. 😉


It scared me that a new user might not have recognized the humor and would be come someone who believes a stacked sequence is a good thing.

0 Kudos
Message 10 of 11
(3,637 Views)

Valid point.  Thanks for holding the straight line and helping people learn good coding practices. 

 

Cheers,

 

Tim

Message 11 of 11
(253 Views)