06-14-2007 03:30 PM
06-14-2007 04:31 PM
A VI Template is just a VI that you can use a starting point to build other VIs in the same way you can have a Word or Excel Template. When you open a VI Template from the 'New... menu selection, LabVIEW gives it a new name so the template does not get overwritten.
A Reentrant VI will force LabVIEW to create a new instance of that particular VI in memory for each place it is used on a block diagram. This really only useful for subVIs. This lets you have a single VI that can be used in several places without them blocking each other or sharing data.
If that doesn't clear it up, let us know and we'll explain a bit more.
Ed
06-14-2007 05:13 PM
06-14-2007 05:34 PM
06-14-2007 08:00 PM
06-15-2007 01:37 AM
06-15-2007 07:55 AM
The answer to the question "what is the difference... really depends on the context and the version of LV being used.
Lets start with pre-LV 8
Ed mentioned how templates operates while editing.
When running they are similar in that each time you open a template, a new VI is cloned from the template. If you whatch the hiearchy screen you will see new instances being created for each open.
Each template has its own diagram and front panel because they are different VI.
VI's that are not re-entrant share the front panel but have unique data and code spaces. Since the FP are shared and each instance of the VI in a diagram is unique, the only way to view the FP of a particular instance, was to find that instance in one of the diagrams and double-clicking it to tell LV which version you are are looking at.
So one big difference is you can use a template to open a dozen idenitcle FP's and have them run at the same time. You can not do this with re-entrant VI's.
OK I am not going to have time to address all of the other things.
RE: the issue you are having with crashing.
Since templates requires crating a clone, make sure the path to the template is correct, and monitor the error cluster coming for the "Open".
Have fun,
Ben
06-15-2007 08:09 AM
@Tarek316 wrote:
I inherited an app that uses .vit for the purpose of having multipe separate instances.
Thanks,
OK, here's what happens when you call a VI Template using Call by Reference or using Invoke and Property Nodes.
Since the VI you are calling is a template, LabVIEW creates a new instance of that VI by creating a copy of it and giving a new name. Notice in the title bar of the instantiated VI the VI name is the same as the template VI plus a number. This is the same thing you see when you open a template from the "New..." menu. So if you call the template VI 3 times, you'd end up with 5 newly instantiated VIs named, "VI Name 1.vi", "VI Name 2.vi" and "VI Name 3.vi". This is how you end up with multiple instances.
Reentrancy only works on subVIs when they are used as a normal subVI in a top level application. Using Call by Reference or Invoke and Property Nodes to open and run a reentrant VI results in the VI only being opened once because LabVIEW will not automatically give it a new name. The new name is only generated when calling templates. Since LabVIEW can only a have a single instance of VI name in memory at a time, you'll not end up with multiple instances.
Not sure if I can help with the know issue on OSX. If it's specific to using the Call by Reference function, you could try calling the templates using Invoke and Property nodes.
Ed
06-18-2007 02:35 PM
06-18-2007 08:57 PM