LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you execute a VI in sequence. In labwindows that is not a problem becasue it goes step by step. BUt in Labview do you do a step by step execution of test?

How do you execute a VI in sequence. In labwindows that is not a problem becasue it goes step by step. BUt in Labview do you do a step by step execution of test?
0 Kudos
Message 1 of 4
(2,837 Views)
LabVIEW is a dataflow language. A VI or function will not execute until all of its data inputs are available. A lot of the built-in functions have error in/out connections. Wiring these from function to function enforces dataflow and is good error handling. Every VI or subVI that you create should have the same connections. They are on the Array & Cluster palette and just need to wired to the connector pane.

The sequence structure can also be used to enforce execution order but (imho) should be used sparingly. They have certain problems such as the inability to exit early. Correct dataflow and certain programming architectures such as a state machine, make them unneccessary in most cases.
0 Kudos
Message 2 of 4
(2,837 Views)
Dennis, I have seen this response (use sequence sparingly) on numerous occassions and would just like to point out that there are times when the sequence structure just makes more sense to me and other times when it is neccessary hence the reason it exists. Forgive my ingnorance and ask this question, I cannot say I fully understand why the use of the sequence structure is not encouraged when a state machine is (logically, to me) just another method of expressing what needs to be done and often times just as if not more complicated. Why one over the other besides the usual answers like IDS (it's dataflow, stupid) or sequence structures make the flow difficult to read (why would that be the case if a flat sequence structure executing from left to right
chronologically makes more sense?), etc. Once upon a time in a version of LabVIEW long long a go, I believe it was not possible to print out all frames of a sequence structure and made sequence and its content difficult to present. I pray it not to be the real reason for discouraging its use since it is no longer an issue with ease of presentation with modern versions of LabVIEW (flat sequences) as well as the ability of printing each frame in a stacked sequence structure.
0 Kudos
Message 3 of 4
(2,837 Views)
You are correct that the flat sequence structure corrects the issue with visibility and connecting error in/error out clusters. It also changes the way in which data exits frame (in a stacked sequence, data exits when all frames are complete). What it does not do is offer any flexibility in execution. A sequence will always execute every frame in one specific order. I prefer to use something that's easier to modify and change execution order. Imagine how ugly a program will get if you need to skip from frame 2 to 5 because of an error condition and then return to a different frame to reinitialize something. It's my personal preference but also experience that makes me spend a little more time up front doing something like a state machine o
r making subVIs.
0 Kudos
Message 4 of 4
(2,837 Views)