LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

about sequence structures.

I often see some single_page sequence structures in the diagram. What
are the execution order of them or they are executed radomly? What is
the purpose of it?
0 Kudos
Message 1 of 5
(1,631 Views)
You can use a single-page sequence as a way of munipulating the execution order of code.
If you connect the output of a sub-vi to the outside of the sequence, you can be sure that the vi's inside the sequence will only execute after the sub-vi is finished. That is why I sometimes use the sequence structure.
The order of execution inside the sequence by the way is only known to the LabVIEW developers.

But sometimes the sequence is just used as a cosmetic decoration tool for grouping vi's.
0 Kudos
Message 2 of 5
(1,631 Views)
As the other fellow stated, single-page sequences are good for enforcing data dependencies between operations where there is no natural dependency. Ideally, you should see very few of them in code because there are very few cases in which there are trully no natural data dependencies.

A common mistake is to forget that errors are data too. As a matter of course I put error clusters on subVIs that can either generate errors, or might reasonably want to be able to respond to an error.

For example, take the case of the Wait(ms) function. It can't generate an error, but there are situations where it might need to be able to respond to an error. Say for instance the delay is very long (3-4 secs) if an error occurs in the code do you really want to delay for 3-4
seconds before you find out about it? Probibly not, that's why I rarely use the wait function by itself. Rather, I have created a routine that wraps around the function to give it error clusters and give it the ability to by pass the delay if there's an error input.

These error clusters also provide a natural data dependency reducing the number of artificial structures like one-frame sequences.

In terms of multi-frame sequences, you never really need them...

Mike..

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 5
(1,631 Views)
On 17 Apr 2002 04:37:32 -0700, fiw0000@yeah.net (Rosa) wrote:

>I often see some single_page sequence structures in the diagram. What
>are the execution order of them or they are executed radomly? What is
>the purpose of it?

They just force the dataflow to go through them before some other
action can occur.


Regards,

Steve Drake
0 Kudos
Message 4 of 5
(1,631 Views)
> I often see some single_page sequence structures in the diagram. What
> are the execution order of them or they are executed radomly? What is
> the purpose of it?
>

Just to say the same thing as the others in another way -- The sequence
structure is a node, and one of the most basic rules of LV dataflow is
that a node will not execute until all inputs are available, and it will
produce data on its outputs only when it completes.

This can be used to ensure that the execution of the code inside of the
sequence frame will not begin until all inputs have arrived. It also
ensures that every node within the sequence, even those that do not have
data wired out must complete before any of the outputs of the sequence
are produced.

Note that a while loop or
for loop which executes only one iteration
acts the same, and so does a case structure with a constant wired to the
selector. A subVI isn't usually thought of the same as a structure
node, but a subVI has a diagram with control terminals act as tunnels do
on a structure. So, subVIs take place in another window, but otherwise
semantically do the same thing as a single frame sequence. They are
also reusable and easier to debug.

Greg McKaskle
0 Kudos
Message 5 of 5
(1,631 Views)