LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

what does "skip subroutine call if busy" do???

if i select this, what happens???
0 Kudos
Message 1 of 5
(3,862 Views)
> if i select this, what happens???
>

This is a rather advanced bit of functionality that is useful when
trying to do more deterministic applications where it is OK to sometimes
skip a function.

Lets say that you have a subVI that is called from multiple locations.
If you leave the VI as non-reentrant, the calls will block waiting for
each other to complete. This is fine for most situations, so it is the
default.

Another option is to make the subVI reentrant. This is appropriate when
the subVI either doesn't have any state information/history so that one
call affects another, or where you want the history to be kept separate.
With a reentrant VI, the calls are totally separate and will not wait
on one another -- they will run totally independent even simultaneously.
Keep in mind that most computers only have one CPU, so simultaneous
really means that the CPU takes turns or multitasks back and forth.

Now the choice you asked about. If you set the priority of the subVI to
be a subroutine, then you have a popup item on the node that lets you
skip. This means that on a particular call, one of two things will
happen. If the subVI isn't busy, if no other call is currently running,
then this call will enter the subVI and run till completion. On the
otherhand, if the subVI is already busy, if another call is already in
there, just skip it without running. To tell the difference, make sure
the subVI has an output that defaults to FALSE, but returns TRUE if the
call completes.

When is this option appropriate? If you have multiple calls to
something like a logging VI where you pass in an array of the latest
values, then you can set it to skip. If it logged the values, go
collect some more and call it with just the new values. If it skipped,
you can go collect some more, but append them to the old values before
calling the logger. This allows your VIs to block less and lets them
keep up with computational schedules. It is obviously useful only when
a skipped call is acceptable and can be made up for in some way.

Greg McKaskle
Message 2 of 5
(3,862 Views)
What would happen if i connected the out puts fromn such a vi to another function would it wait until it can call the vi, or would it use the out puts from the last time it was called?
0 Kudos
Message 3 of 5
(3,862 Views)
Hi,

I didn't know about this...

Is this a 'proper' feature of LabVIEW? It's not documented, and the most
simple example I could come up with, crashes (reproducable). LabVIEW
generates a bookkeep.cpp error, line 6??.

Regards,

Wiebe.

"Greg McKaskle" wrote in message
news:3D270594.6030707@austin.rr.com...
> > if i select this, what happens???
> >
>
> This is a rather advanced bit of functionality that is useful when
> trying to do more deterministic applications where it is OK to sometimes
> skip a function.
>
> Lets say that you have a subVI that is called from multiple locations.
> If you leave the VI as non-reentrant, the calls will block waiting for
> each other to complete. This is fine for most situations, so it is the
> default.
>
> Another option is to make the subVI reentrant. This is appropriate when
> the subVI either doesn't have any state information/history so that one
> call affects another, or where you want the history to be kept separate.
> With a reentrant VI, the calls are totally separate and will not wait
> on one another -- they will run totally independent even simultaneously.
> Keep in mind that most computers only have one CPU, so simultaneous
> really means that the CPU takes turns or multitasks back and forth.
>
> Now the choice you asked about. If you set the priority of the subVI to
> be a subroutine, then you have a popup item on the node that lets you
> skip. This means that on a particular call, one of two things will
> happen. If the subVI isn't busy, if no other call is currently running,
> then this call will enter the subVI and run till completion. On the
> otherhand, if the subVI is already busy, if another call is already in
> there, just skip it without running. To tell the difference, make sure
> the subVI has an output that defaults to FALSE, but returns TRUE if the
> call completes.
>
> When is this option appropriate? If you have multiple calls to
> something like a logging VI where you pass in an array of the latest
> values, then you can set it to skip. If it logged the values, go
> collect some more and call it with just the new values. If it skipped,
> you can go collect some more, but append them to the old values before
> calling the logger. This allows your VIs to block less and lets them
> keep up with computational schedules. It is obviously useful only when
> a skipped call is acceptable and can be made up for in some way.
>
> Greg McKaskle
>
0 Kudos
Message 4 of 5
(3,862 Views)
It has been my experience that skipping the execution of a subvi will force all outputs of the subVI to the default value for the indicator on the subVI front panel. Hope this answers your question!

Jim Cahow
Applications Engineer
National Instruments
0 Kudos
Message 5 of 5
(3,862 Views)