LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Selecting the right Sub VI Execution Mode

Solved!
Go to solution

Often times there is a requirement to either increase or decrease a command voltage to some device between two set points.

 

So i created a Sub VI which does the following - VoltIncDec.vi

- Based on the Start Volt and End Volt decides either to Inc or Dec 

- Till the actual value reaches 90% of the end value,  it ramps up fast and thereafter slowly. ( to avoid overshoot ) 

- Once it reaches end value it outputs a Boolean which the caller VI can use to branch off. 

 

Now in the actual logic this SubVI will be called in many places asynchronously. So what execution should it be allotted with regard to re-entrancy. ( Tried reading the Help on this but must admit it wasn't quite clear ) 

 

The attached ParamIncDec.vi uses this subVI - VoltIncDec.vi

 

Thanks 

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
Download All
0 Kudos
Message 1 of 8
(742 Views)
Solution
Accepted by MogaRaghu

This is the option which you're looking for, I guess:

Screenshot 2024-03-12 17.19.03.png

Message 2 of 8
(728 Views)

When you say you looked at the help, did you look at this page or was it one of the others:

 

https://www.ni.com/docs/en-US/bundle/labview/page/reentrancy-allowing-simultaneous-calls-to-the-same...

 

If you didn't see that one, that has a handy chart listing the two types of reentrancy compared to non-reentrant VIs.

 

If I had to summarize it would be that the "Preallocated" option is better for any VI needing simultaneous calls except when it comes to memory usage.  If there's a chance your VI could have high memory use (either because you call it in dozens or hundreds of places, or because each instance of it is large either due to VI size or the VI holds large arrays of data) then consider "Shared" instead..

Message 3 of 8
(709 Views)

@MogaRaghu wrote:

Often times there is a requirement to either increase or decrease a command voltage to some device between two set points.

 

So i created a Sub VI which does the following - VoltIncDec.vi

- Based on the Start Volt and End Volt decides either to Inc or Dec 

- Till the actual value reaches 90% of the end value,  it ramps up fast and thereafter slowly. ( to avoid overshoot ) 

- Once it reaches end value it outputs a Boolean which the caller VI can use to branch off. 


Did you even test your subVI? Since by default it goes from 5V to 2V and 0.9x2V is less than 2V, it will undershoot (or overshoot the target).

It seems exceedingly complicated. Here's a simple replacement that will slow down if it is within 0.5V of the end, no matter the direction.

 

All you probably need is the following. And yes, set it to reentrant (not done yet):

(Yes, this is just a quick draft. It can probably be simplified)

 

 

altenbach_1-1710272442497.png

 

 

 

.

Message 4 of 8
(666 Views)

@altenbach

 

Maybe its not as simple as you suggested but it does it job OK. In the case no 2 , it finally handles the marginal overshoot or undershoot by feeding in the required end point. 

 

Will check out yours. 

 

Thanks for the time to put together the snippet.

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 5 of 8
(630 Views)

Thanks to all those who responded. 

 

And also pointing to the correct help document to refer to !!

 

 

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 6 of 8
(628 Views)

@MogaRaghu wrote:

In the case no 2 , it finally handles the marginal overshoot or undershoot by feeding in the required end point


Mine ends exactly at the endpoint and avoids any over- or under-shoot. Nothing marginal ever.. 🙂

0 Kudos
Message 7 of 8
(601 Views)

Here's a quick test bench. It always helps to see the result graphically:

 

altenbach_0-1710345233714.png

 

Of course there are other ways to do that, for example a (slightly modified)  exponential filter would gradually approach the endpoint.

0 Kudos
Message 8 of 8
(566 Views)