LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

vi vs vit

Hi all,

I have a question regarding the difference between a reentrant VI and a VI Template.  Am I correct in understanding that the only differences between them are:
  1. VITs are never run, but are templates that generates a VI instance on the fly that has all the properties, attributes and limitations of a VI.  A VI on the other hand has only one instance (unless you make it reentrant?)
  2. A VI generated by a VIT is debuggable just like a VI in that you can trace the execution along the wires.
Is there anything that I am saying that is incorrect?

Further, is a VIT the same speed as a reentrant VI when doing stuff recursively?

Is there anything else that I should be aware of when using VITs?

Thanks for all your help.


Adrian
0 Kudos
Message 1 of 11
(9,592 Views)
Your descriptions are correct.
 
A VIT creates a copy of the VI in memory when you open a reference to it. Creating that copy takes time, which affects performance when doing recursion. That copy is then a standard VI in every sense, except it is not a file. Also, if you don't close these references, they will take up space in your RAM.
 
Reentrant VIs can currently only do real recursion in 8.5 and if they are part of a class.

___________________
Try to take over the world!
Message 2 of 11
(9,575 Views)


Reentrant VIs can currently only do real recursion in 8.5 and if they are part of a class.


But, recursion can stil be done in lower versions also, right ?

I ve seen some posts, one for example is of becktho's...

- Partha ( CLD until Oct 2024 🙂 )
0 Kudos
Message 3 of 11
(9,545 Views)
parthabe asked
 


Reentrant VIs can currently only do real recursion in 8.5 and if they are part of a class.


But, recursion can stil be done in lower versions also, right ?


Yes but is more cumbersome. I believe that reference applies to VI's appearing in their own diagram!

Without LVOOP VI server calls must be used. i used recursion in my adaptive save-restore Nugget as shown in figure 18.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 11
(9,539 Views)

Thank you, Ben.

I put up with the example posted by Becktho for the Factorial VI.

All these days, I thought that people would use recursion only for some simple arithmatic calculations like the one stated above; NOT like the stuff you ve posted.

I ve never come across situations like these in my project.

- Partha ( CLD until Oct 2024 🙂 )
0 Kudos
Message 5 of 11
(9,530 Views)
Some more remarks...

> - VITs are never run, but are templates that generates a VI
> instance on the fly that has all the properties, attributes and
> limitations of a VI.  A VI on the other hand has only one instance
> (unless you make it reentrant?)

You can actually run a vit, but when you open one with VI Server, it is
cloned. (If you drop a vit in your diagram, you can edit it, but also run
the vit itself). It seems kinda pointless to make a vit if you are going to
run it like a vi, but you'll do this a lot during development.

> - A VI generated by a VIT is debuggable just like a VI in that you can
trace the execution along the wires.

But in 8.5 (I think from 8.0 on) reentrant vi's can also be debugged. Just
for your information...

>
> Is there anything that I am saying that is incorrect?
>
> Further, is a VIT the same speed as a reentrant VI when doing stuff
recursively?

I'd stick with reentrant VI's if you don't need the UI. My guess is they are
faster, but never did any benchmarking. In 8.5, there are some forms of
reentrancy. One form recycles clones up to a maximum. This way you can avoid
the creating (memory allocation), which could be much faster. Don't know the
exact details, but I do know using it correctly will be much faster then
traditional reentrancy.

If the sole purpuse is to create a reentrant function, you can also fake
reentrancy. Look at the Recursive File List. That will probably be even
faster.

> Is there anything else that I should be aware of when using VITs?

They can be tricky to keep track off. If a vit opens a reference to itself,
it will keep on running even if you close it's panel. The only way to close
it is by using "all vi's in memory", and use VI server to close it. I often
get messages about saving template clones when I quit LabVIEW.

You'll find yourself editting a vit's clone. Then when you press save,
you'll notice you should have been editting the vit!


> Thanks for all your help.
>
>
> Adrian


Message 6 of 11
(9,517 Views)

hi all, i am new to labview programming, some of them were explained about the difference b/w Vi and Vit, still i am not clear. theory about vi and vit is some what ok, need some samples on this.

i have some questions

1.whats the purpose of using Vit instead of Vi ? some of them explained the concept of multiple instances...thats ok.. any thing else ?

2. what clone means ? which is possible in only with Vit ?

hope any of you will help me in understanding the difference between vi and vit.

Thanks for your supports!

Ram

0 Kudos
Message 7 of 11
(9,284 Views)
"ramnathrn" <x@no.email> wrote in message
news:1205241007630-669315@exchange.ni.com...
> 1.whats the purpose of using Vit instead of Vi ? some of them explained
the concept of multiple instances...thats ok.. any thing else ?
There are no other differences between VI and VIT.


> 2. what clone means&nbsp;? which is&nbsp;possible in only with Vit&nbsp;?
If you open VIT, you don't open the actual file, but a clone. This way you
can open it multiple times. Each time you open it, you get a clone. This is
especially usefull when you open the vit with VI Server.

VIT's are usefull to make a interface window once, and use it multiple times
in your program. If the code should run multiple times, but doesn't have a
user interface, use reentrant vi's instead.

Hope it helps,

Wiebe.


0 Kudos
Message 8 of 11
(9,264 Views)
 
Please refer to the below link for more info on reentrant VIs (Preallocate), Reentrant VIs (Share Clones), VI Templates, and Dynamic VIs;
 
Hope this helps!
Aashish M
CEO
TransferFi
www.transferfi.com
0 Kudos
Message 9 of 11
(9,245 Views)

thanks wiebe, now i am very clear.

 

0 Kudos
Message 10 of 11
(9,233 Views)