04-24-2013 03:56 AM
Hello, all,
I want to use functions from another VI in my VI. I would like to know how many possibilties I can have to reach this purpose in LabVIEW. Could you please let me know also the disadvantage and advatage of the solutions from you?
Thanks for all the contribution in advance.
Regards,
qf2599
04-25-2013 06:30 AM
Hi,
you can use functions of a VI in another VI by integrating the VI in another VI. So you have a VI (main) which has included another VI (named SubVI).
What you need to make the connections to the SubVI on the MainVI-block diagram is to connect the inputs and outputs to the SubVI connector pane. See the following link how it works:
Hope this helps.
Best regards
Suse
04-25-2013 06:57 AM
Hello, Suse,
Thank you very much for your reply.
This is one of sulotions.
Do you know any other posibilities?
Regards,
qf2599
04-25-2013 07:19 AM
Hi,
you can use variables if you use both VIs in your project and if you only want to get the result of a function.
But be carefull. Variables can also cause race conditions. Functional Global Variables (FGV) prevent race conditions.
You can also use Queues to transmit data to other VIs or loops as well as notifier.
Have a look at this link: Webcast-Serie: Erfolgreich durchstarten mit NI LabVIEW!: http://www.ni.com/white-paper/14178/de
And watch the including Webcast named "Fortgeschrittene Entwurfsmuster – das Erzeuger-Verbraucher-Prinzip in LabVIEW"
LabVIEW Core 1 and 2 training courses also give information to SubVIs, variables, queues and notifier:
Best regards
Suse
04-25-2013 07:58 AM
Hi,Suse,
Thanks again for your reply.
I have tried FGV, Queue and DVR. In my case, these don't help so much. I have no idea about this called VI so far. But I need to call the functions from this VI.
There're 2 sulotions so far for me. Call VI by reference and Call DLL.
Do you know what's the disadvantages and advantages of these two ways? Do you have any other solutions?
BR
qf2599
04-25-2013 08:02 AM
Hi,
you can post your code so I can say what's better.
Best
Suse
04-25-2013 08:17 AM
Hi, Suse,
My code is very simple. A simple subVI is created, whose exact functions included is unimportant and careless.
In my main VI,
1st solution: Call this subVI by reference and use invoke nodes to run VI and use get Ctrl value and set Ctrl value to pass data with main VI.
2nd solution: Build DLL from subVI. In main VI , use call library node to call this DLL and select the function to get output results.
3rd solution: Directly leave the subVI in main VI, wire the respective terminators. Danymically call subVI or stastically call subVI can be considered.I have made a test. It seems that stastically call subVI is faster than Danymically call subVI when exectue the subVI the same times.
Any other solutions? why? Advantages and disadvantages?
04-25-2013 08:32 AM
What is the point of this exercise? Just use the subVI in your main VI. That is by far the simplest and most efficient.
04-25-2013 08:39 AM
Thanks for your reply.
The point is to find out how many possibilities in LabVIEW to use the functions from another VI.
BR
qf2599
04-25-2013 09:02 AM
Hi,
there is no need to make a dynamic call of the VI or create a DLL.
I would recommend to use the SubVI statically in the mainVI. This is the easiest way.
Best regards
Suse