LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Call by reference and VI Server - Performance

Hi,

 

I've made a small VI which is used to dynamically call any VI, pass values to controls, run the VI and get the results back.

 

Parameters are placed in an array with the names of the parameter, the data type and the value.

 

I don't really know if using VI server and property nodes is the optimal solution from a performance point of view ?

 

Do you see a more efficient way to get the same behavior ?

 

The attached VI was built with LV 2012.

 

Thanks,

Alex

0 Kudos
Message 1 of 9
(3,908 Views)

 

Hi,

 


VI Server allow you programmatically access and control VIs , call a VI remotely and load VIs into memory dynamically

why don't you use the invoke node Ctr. Val Set? Ctrl Val. Set.png

 

Weakly typed control refnums are more flexible in the type of data they accept

 

How to Update the Front Panel of the Top Level VI from within a Dynamically-Called SubVI

 

0 Kudos
Message 2 of 9
(3,882 Views)

Hi,

 

Thanks for the invoke node. I will use it instead of accessing values through property nodes.

 

However, I still need to know the data type of each control to avoid entering values with a wrong type. The "Get Type Of Variant" vi which is in vi.lib\Utility\GetType.llb is not listed in the panel. What is the risk of using such functions ? Could it be removed from future LabVIEW releases ?

 

Is there any other way to get the data type of a variant ?

 

Thanks,

Alex

0 Kudos
Message 3 of 9
(3,861 Views)

Hi Alex,

 


if you want to pass values you will actually need to know the names of the controls and their data types, which requires much more programming. The advantage of making this sort of call is that the subVI is in memory only from the open to the close, rather than during the entire execution of the program.

The Get Type of Control VI. It is included in the vi.lib\Utility\GetType.llb library. This should let you programmatically scan any VI for its control references, and the output of the Get Type of Control VI will give the data representation, such as U8 or U16

0 Kudos
Message 4 of 9
(3,851 Views)

Are you using LV 2012 and do they have the same connector panes? The start asynch call is much easier for this kind of thing. But, if you are trying to make this reuse for any VI the VI server is the best way to do it. You can bundle up your control names and their variant values in an array, and use the control val.set method in a for loop.

 

 

0 Kudos
Message 5 of 9
(3,840 Views)

Thanks for your replies.

 

@ for(imstuck) : I'm using LV2012 but the called VIs have different connector panes so I have to use the VI server.

 

I've successfully used the "Control Value Set" method.

 

Now I would like read the values of the indicators. I've used the "Control Value Get All" with Controls set to false, so I only get indicators. I then get a variant and using the "Get Type of Control VI" (vi.lib\Utility\GetType.llb), I can retrieve the correct type of the data. However, if my indicator is an array, the "Get Type of Control VI" will return "Array" as type but does not indicate anything about the array elements type. Is there a way to know that or should I just try to convert the variant to all data types until I find one which does not generate an error ?

 

Is there also a way to use the "Control Value Set" method on controls which are included in the connector pane ?

 

Thanks,

Alex

0 Kudos
Message 6 of 9
(3,788 Views)

Hi,

 

glad to read that you've successfully used the "Control Value Set" method.

could you please post your VI oder Project?

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

Hi,

 

The VI is attached. The goal is to be able to dynamically load a VI, set controls value with the "Parameters" array, run the VI and then retrieve value of the indicators.

 

At the moment it does not support a lot of data types and I would like to support array indicators.

 

Thanks,

Alex

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

I found a "GetArrayInfo.vi" in vi.lib\Utility\VariantDataType which returns exactly the information I need. However, I still don't know if using VIs which are not on the palette is a good thing or not.

0 Kudos
Message 9 of 9
(3,771 Views)