LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to maintain the vi refnum ?

Hi all,

 

I am developing an application which will create multiple VI instance from Template VI.

what’s my problem is tracking the instance VI.

 

How to maintain the reference number of the VI?

Upon next iteration, i want to check the VI whether it is running / completed / closed.

Based on that, i will do certain operation.

 

For example :

 

Engine       refnum

 

1               987845

2               457854

3               215645

.

.

.

 

Waiting for yours reply

Thanks

Ram

using Labview 8.5 , GOOP 3.0

0 Kudos
Message 1 of 10
(4,155 Views)
Use an Invoke Node to call the template VI dynamically and you will get the reference of the instance. The code is shown in this document.
0 Kudos
Message 2 of 10
(4,134 Views)


@JB wrote:
Use an Invoke Node to call the template VI dynamically and you will get the reference of the instance. The code is shown in this document.


Actually that is a bit misleading I think. The instantiation of the Template VI happens at the Open VI Reference node when the correct options bits (bit2 is not set) are passed to it. The refnum that is returned from this Open Vi Reference Node is the refnum the OP would like to have. You also need to keep this refnum valid since it is the only thing that would keep the VI instance alive and is also the means to reference that VI instance later on. So storing that refnum in some way (and making sure the VI hierarchy that executed the Open VI Reference stays running for the entire life time of that VI instance) is the way to do what was required. Of course I would use for that stoarge an intelligent LabVIEw 2 style global or as some like to call it an action engine. But a global (autsch I really used that word) array of VI references would work too as poor mans solution.

The VI run method can then be used to "spawn" that VI instance into its own process letting it run as a deamon in your application.

Rolf Kalbermatter


Message Edited by rolfk on 04-16-2008 12:15 PM
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 3 of 10
(4,128 Views)
Hi Rolf,

Yes, I fully agree with your comments. I hesitated to link the example (couldn't find a better one). Although it is not useable as is it, it shows at least the basic concept.

Wish you a nice day
0 Kudos
Message 4 of 10
(4,121 Views)
It is also possible to start the VI dynamically, and make the VI open a
reference to itself. This reference has to be done explicitly, so you need
to use Open VI Reference, and pass the VI's name that you get from a
property node. Don't use the reference that you get from the property node!

Using this method, the template can deside for itself when it's done. When
the VI's state machine is done, the reference can be closed, and the VI will
disapear from memory.

Regards,

Wiebe.


0 Kudos
Message 5 of 10
(4,097 Views)

Hi,

 

Since you are using GOOP3, i.e. object oriented programming, you can simply store the VI refs as data (attribute) in the class. Using a class gives you a natural place for putting the code that launches and manages the VIs, it can be placed in method VIs of the class.

 

Jan Klasson

www.endevo.se

0 Kudos
Message 6 of 10
(4,066 Views)

hi jank,

can you tell me which data type should I use to store the reference number ?

Thanks

Ram

0 Kudos
Message 7 of 10
(4,035 Views)
Use a VI Refnum control.
 
Jan
0 Kudos
Message 8 of 10
(3,978 Views)
thnaks jank.
 
finally i did what i asked you.
0 Kudos
Message 9 of 10
(3,933 Views)
On May 2, 10:40�pm, ramnathrn <x...@no.email> wrote:
> thnaks jank.
> &nbsp;
> finally i did what i asked you.

aa
0 Kudos
Message 10 of 10
(3,924 Views)