LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Sequence Struture

Hello All,
 
I am Developing a code in LabVIEW.
Basically the program flow is sequential and the process is Automatic.
 
Since it is Automatic and The flow is sequential, I am Using many Structured Sequences in my Logic.
But I have READ that we should not use many sequences in the logic cos it Hinders the normal Data Flow in Labview
 
If any one has any Template or an Architeture for such type of logic please let me know.
Or which type Template or Architeture I should use
 
Please Guide me
 
Thanks in Advance
 
Avni Vyas
0 Kudos
Message 1 of 7
(3,627 Views)

Hi Avni,

I would recommend using the "Error Cluster" input/output controls in all your VIs - this way all your VIs can be chained together in sequential order, whilst still having the option to execute "parallel" functions by splitting the Error Cluster wire into two paths and recombining with the "Merge Errors" VI.

I frequently build all my VIs starting from the attached template (see attached VI).

The other advantage of this method is that execution of the VI sequence can be effectively cut short when an error occurs because the remaining VIs in such a sequence will execute the "Error True" case rather than the main code which you would write into the "No Error" case.

Mark.

0 Kudos
Message 2 of 7
(3,621 Views)
Hello,

I assume you read this thread (if not, I recomand you do).
Sequence are not evil, but it is not really hard to use a state machine instead and it is a lot easier to maintain. If someday you want to modify your soft and, you want more flexibilty SM is he right architecture.

Also, want you might concider instead of a stacked sequence is just putting each case in a subVI and put then in a line linking the error, I think this is more readable than a stacked sequence, but it's a matter of "tastes"...

There are good patterns in LabVIEW, what version do your have ?
;
)


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

Message 3 of 7
(3,618 Views)
Using the Error In > Error Out style, programs/diagrams (and subs) can often look as tidy and ordered as this (see attached image)...
0 Kudos
Message 4 of 7
(3,617 Views)
Hello Mark,

I am not sure I get your point... do you mean the code on your image is good or bad Smiley Surprised ?

I do think this is good and nuch more readable than a sequence.



We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 5 of 7
(3,605 Views)
Hi TiTou,
 
Definitely good [I meant].
 
State machines are certainly usefull, although I wouldn't use them purely to acheive a preset/predefined sequence - SMs are most usefull when the order/sequencing is conditionaly executed. A downside of SMs is that the case structure is visually "stacked", much like a stacked sequence structure, so the code is less visible on the diagram.
 
Message 6 of 7
(3,595 Views)
Mark,

I totally agree with you 😉

just to add that, why using a stacked sequence more than a SM ?
It hide the code exactly the same, but if you want to modifiy you code and make it conditionnaly executed, a SM will be a lot easier to adapt.


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 7 of 7
(3,591 Views)