LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

create static references array

Hello,
i have done a labview program which controls six different test machines.
the different tests are VIs which are kept by the main program in an array of static references. this way i have to write the vi only once. afterwards i create six different references of the same vi, each of them managing one test machine.
 
everything is working fine. the only drawback I have found, is how to create the six references of each VI.
 
the first thing I tried, was to locate the static reference function inside a loop. I enabled indexing, and i expected to obtain an array of six different references of the same vi. unfortunately this is not working: i obtain an array with six times the same reference.
 
to fix this, i located the static reference function inside a switch with six cases. all of this, inside the same loop. i have to use the static reference function six times, one for each test machine. this is working, but is more work. everytime a add a new test vi, I have to add the switch with the six cases. it is a lot of copy & paste work, and errors are likely to be done doing this.
 
I would like to know if there is any other (and simpler) way of obtaining this array.
 
enclosed you find an example showing this: the upper loop creates an array of six references but all of them are the same. the other one, uses a switch-case so that different references are generated.
 
thank you in advance
0 Kudos
Message 1 of 9
(3,946 Views)
Hi Dani.
As you need six instances of the same VI, why not using a setup like demonstrated in the LabVIEW Examples: Search for "DateServerUsingReentrantRun.vi". Having one VI more than once running in memory requires a reentrant VI. This is subject of this example.
Hope you like it and it helps, Guenter
0 Kudos
Message 2 of 9
(3,919 Views)
Actually I believe that the VI has to be saved as a template (*.vit). Then you can launch any number of independent clones into memory. I have built several applications that utilize this feature and it works well...

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 9
(3,906 Views)

Hello Günter and Mike,

Günter: yes, i know the vis have to be reentrant. my software is very similar to the one you send. but i use static references instead of loading dynamiccally the vi into memory. i find static references are better. this way the vi appears on the hierarchy of the project. Mike: I am familiarised too with templates. I am not using them, because if the test pattern has to be changed, then I have modify the template, delete all six copies, and create six new vis based on the modified template. I am somewhat lazy...

my question actually was: what to I have to add/change to the upper loop in my example, so that the array contains six different references, instead of 6 times the same reference.

thanks

Daniel

0 Kudos
Message 4 of 9
(3,893 Views)
I think you missed the point of what I was getting at. If you create a template VI and programmatically open a reference to it 6 times you will get references to 6 independent instances of the template all running in memory. Nothing needs to get saved to disk. If the template changes simply close the 6 old references and open 6 new ones.

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 5 of 9
(3,853 Views)

Hi Mike,

      In my experience, any re-entrant VI can have multiple dynamically-opened copies running in memory - it need not be a VIT for this. Smiley Surprised

Cheers!

Message Edited by tbd on 08-17-2007 07:12 PM

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 6 of 9
(3,838 Views)

Hello Mike,

you are right, i missed the point, sorry.

so your proposal is more or less what i am doing, with two differences:

- I do not have a template, but a reentrant VI. it is not necessary that the file is a template(as tbd confirms)

- I do not open dynamically the references, but create static references.  (in the comments at the bottom of this article can you find the disadvantages of loading vis dynamically. that is why i preferer to create static references: http://zone.ni.com/devzone/cda/tut/p/id/3929)

what i am trying to find out, is, how to create different static references of the same vi in a loop.

Daniel

 

0 Kudos
Message 7 of 9
(3,822 Views)

ok, i think this will do.

one can dynamically load the vi, but using the static reference as type specifier.

thank you everybody for your support. you have helped a lot in solving this.

regards

Daniel

 

Mensaje editado por Dani Pindado

0 Kudos
Message 8 of 9
(3,814 Views)

Oops! - posted a follow-up too slowly!  It's all mute now, sorry for this distraction. Smiley Tongue 

Message Edited by tbd on 08-18-2007 02:10 AM

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 9 of 9
(3,812 Views)