eaolson Posted July 20, 2007 Report Share Posted July 20, 2007 After posting this question on the OpenG forums, I was doing a little poking around and now seem to be stuck. Is there any way to open a VI programmatically (as with Open VI Reference) in the context of a particular application instance? I don't mean an application reference (from Open Application Reference), because that actually opens a TCP connection to a VI Server instance running on some other machine. When I've got a LabVIEW project with an RT target defined, I can open one of the VIs designated for that target in an RT application instance. It pulls some target-specific subVIs from a different vi.lib than the standard. It doesn't actually form a connection to the target. I can get refnums for the project itself, and the targets, but can't seem to do much with those refnums. Quote Link to comment
Rolf Kalbermatter Posted July 23, 2007 Report Share Posted July 23, 2007 QUOTE(eaolson @ Jul 19 2007, 09:31 AM) After posting http://forums.openg.org/index.php?showtopic=619&hl=' target="_blank">this question on the OpenG forums, I was doing a little poking around and now seem to be stuck. Is there any way to open a VI programmatically (as with Open VI Reference) in the context of a particular application instance? I don't mean an application reference (from Open Application Reference), because that actually opens a TCP connection to a VI Server instance running on some other machine. When I've got a LabVIEW project with an RT target defined, I can open one of the VIs designated for that target in an RT application instance. It pulls some target-specific subVIs from a different vi.lib than the standard. It doesn't actually form a connection to the target. I can get refnums for the project itself, and the targets, but can't seem to do much with those refnums. I haven't thinkered with projects and such in VI server yet but this is just some of the basic understanding I have about LabVIEW VI server. The targets in a project should be more or less just like application references. And the way to open a VI in the context of an application reference is to pass that application reference to the Open VI Reference function. Have you tried to connect one of those target references to the Open VI Reference or maybe search for a property in the target reference that might return a real application reference? Rolf Kalbermatter Quote Link to comment
Aristos Queue Posted July 24, 2007 Report Share Posted July 24, 2007 QUOTE(eaolson @ Jul 19 2007, 09:31 AM) After posting http://forums.openg.org/index.php?showtopic=619&hl=' target="_blank">this question on the OpenG forums, I was doing a little poking around and now seem to be stuck. Is there any way to open a VI programmatically (as with Open VI Reference) in the context of a particular application instance? I don't mean an application reference (from Open Application Reference), because that actually opens a TCP connection to a VI Server instance running on some other machine. When I've got a LabVIEW project with an RT target defined, I can open one of the VIs designated for that target in an RT application instance. It pulls some target-specific subVIs from a different vi.lib than the standard. It doesn't actually form a connection to the target. I can get refnums for the project itself, and the targets, but can't seem to do much with those refnums. Every application instance has its own application refnum. You can have multiple application refnums for the same LabVIEW.exe on the same machine. For example, if you open two LabVIEW projects, each one has its own application instance, and you can get the app refnum for each of those and then open VIs into those app instances. Your comments about these opening TCP/IP connections apply ... LabVIEW treats communication between two app instances as if it were communication between separate machines. This makes it possible to develop multiple apps on the same machine and have those apps work together at runtime whether they're deployed on the same machine or different machines. If the apps are on the same machine, LV does optimize out some of the communication overhead unless you explicitly open the application refnum using a TCP/IP port number (wire to the port input on the Open Application Reference primitive). Any VI that you open in the host computer's targeted application instance will be deployed on the target when you run that VI. The host's targeted app instance is a proxy for what goes on down on the target. Quote Link to comment
eaolson Posted July 24, 2007 Author Report Share Posted July 24, 2007 QUOTE(rolfk @ Jul 22 2007, 03:42 AM) The targets in a project should be more or less just like application references. And the way to open a VI in the context of an application reference is to pass that application reference to the Open VI Reference function. Have you tried to connect one of those target references to the Open VI Reference or maybe search for a property in the target reference that might return a real application reference? Yes, that's exactly what I can not do. The Project property contains Targets[], an array of all the targets in the project. They are of type Target Item Refnum. Open VI Reference wants a "LabVIEW Application Reference". Using the Target refnum in place of the Application Reference doesn't work (broken wire), nor does typecasting it to an Application Reference (error). Application Reference is not even in the LabVIEW object heirarchy, so I can't use To More Specific/To More Generic Class. Attached is what I was trying to do. QUOTE(Aristos Queue @ Jul 22 2007, 11:34 PM) Every application instance has its own application refnum. You can have multiple application refnums for the same LabVIEW.exe on the same machine. For example, if you open two LabVIEW projects, each one has its own application instance, and you can get the app refnum for each of those and then open VIs into those app instances. My situation is slightly different. I have one project that contains a "My Computer" target and a "RT PXI Target". Each of these seems to have its own application instance as well. If I open my real-time VI under the RT PXI Target by double-clicking in the project explorer window, LabVIEW knows to pull some RT-specific subVIs from <labview>/Targets/NI/RT/vi.lib and does so automatically. No TCP connection to the target is made. If I wire the path to the VI to Open VI Reference, LabVIEW looks for these subVIs in <labview>/vi.lib and can't find them. The Project property node has a property that is the application reference for the project. There isn't a corresponding property for Target Item. Quote Link to comment
elyness Posted August 24, 2007 Report Share Posted August 24, 2007 I just ran into the same problem trying to get reference to FPGA vi's. The trick is to use the "Get All Descendents" method of the Target class and specify type as "VI". This returns an array of reference to all of the VI's in the target. Attached is your vi modified to use the Get All Descendents method. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.