LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically loading VI on RT system (cRIO-9101)

We have a simple program on this cRIO that starts and stops an FGPA program.  When I manually execute this VI, all is well, everything runs correctly.  The RT program doesn't need to run on startup or perpetually (we do other things with the cRIO as well as run this program).  I'd like to be able to dynamically load the VI into memory and run it from other PC's on the network using the VI Server on the cRIO but have been unsuccessful using the "Open App Reference" followed by an "Open VI Reference . . . I get a "file no found" or "program not loaded in memory error" or "VI is not executable" when the simple PC program tries to run the RT VI remotely (it saves data to a file so there's no need to have a front panel open).  I placed the file manually in the c:\ni-rt\system folder on the cRIO thinking that might work, but no luck.  Do I instead need to build an executeable and have it available when the invoke (or call by reference) is used?  I know the VI Server is capable of being told to load VI's into memory, but how do I make this happen.

 

Attached is a simple VI (PC side of things) that does "see" the VI (in this case a simple VI on the RT system that blinks the LED on the chassis), but I get the "VI is not executeable" error.  If the Blink LED.vi is running, the "Execution State" says "Run", but when it's not running that indicator says "Bad".  Of course, the most confusing thing to me is why this program (see screenshot) makes Blink LED run when Blink LED is loaded on the PC!  How can I make it run if it's not loaded in memory on the local PC???

><><><><><><
Tommy R.
><><><><><><
Message 1 of 10
(5,638 Views)

Refer to the LabVIEW example finder and search for VI Server.  The example is called "VI Server.lvproj" and only installs with the LabVIEW Real-Time module; try that and let us know if it works for you.

 

Also, have a look at the following page; having a state machine architecture implement what you are doing would be better:

How Do I Start my Real-Time Application without setting it as a Startup Executable?

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 2 of 10
(5,623 Views)

I've referenced the VI Server example and it works like this . . . The LabVIEW project is open, I right-click on the "VI Server - RT Engine.vi" and choose Deploy.  The VI (and all necessary support files) are deployed.  The front panel of the RT Engine VI opens and like I said before, when the VI I want to run on the RT system is open on the development PC, the host program will cause the RT program to run just fine.  After deploying, if I close the RT Engine VI and run the Host VI, I get the VI is not in memory error.  I have to contrast this behavior with, between two PC's running VI server, if I create a VI and put it in the C:\ folder (for example) and reference that VI from another computer with a Open application/VI Reference, the VI will run just fine, even when it's not loaded in memory.  It must be possible to run a VI on a RT system from outside any project or without the VI being opened first.

><><><><><><
Tommy R.
><><><><><><
Download All
0 Kudos
Message 3 of 10
(5,618 Views)
For that particular example, try replacing the String constant file name in Open VI Reference (VI Server - Host Computer.vi) with a path constant of the whole path name of the VI that you want to call, ie, c:\ni-rt\....\nameofvi.vi. Does that work for you? Sorry don't have a RT controller to test at the moment.
Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 4 of 10
(5,611 Views)
I've uploaded a copy of the VI into the c:\ni-rt\system\ folder and I get the VI is not executable error.  I tried this before with my program and got the same error.  I wonder if because this VI (and most others) require what's in the dependencies folder, that's why the non-executable error trips.
><><><><><><
Tommy R.
><><><><><><
0 Kudos
Message 5 of 10
(5,607 Views)
OK so you did use the full path name right? What I would also have you check is the VI Server properties for the RT target. Make sure all access is set to '*' and you deploy that setting.
Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 6 of 10
(5,602 Views)
The host program sees the VI (otherwise I'd get a file not found error).  If I just use the filename I get this error, but when I use the full path with filename, I get the not executeable error.  The access settings are "*" already as is the exported VI setting.  Do I need to "export" the VI, I've never heard of or seen a place to perform this step.  Still, with this change (use full path), the VI will run if I either right-click, choose deploy (opening the VI on the development PC) or simpy double-click the VI to open it first.
><><><><><><
Tommy R.
><><><><><><
0 Kudos
Message 7 of 10
(5,595 Views)

Hello Thomas,

 

In RT systems, for the vi to be in the memory the vis front panel has to be open. In the example, when the front panel is open, the VI is in the RT system memory and hence you can successfully open its reference. But, once you close the front panel, it ll be removed from the memory hence the error. 

-Mallya

" Appreciate and motivate those who help"
Message 8 of 10
(5,564 Views)

I have the exactly same problem. If I don't open the front panel of the FPGA host program, The Vi server cannot find it. Is there anyway to load the FPGA host vi automaticaly in the memory without mamually open the front panel?

 

Thanks!

0 Kudos
Message 9 of 10
(5,320 Views)

I made a state machine that runs when the cRIO starts (either compiling to run on startup, or configure the .ini file to run a particular VI on startup).  This program does nothing more that sit and wait for instructions on which FPGA or RT VI to run (of course you have to include the particular VI's to run beforehand, i.e. it doesn't dynamically/interactively look for VI's).  Couldn't find any other technique to do what i wanted to do.  It'd be much easier if the functionality of the VI server worked the way it does in on a Windows machine (put the VI's you want to kickstart in a particular folder on the target machine).

><><><><><><
Tommy R.
><><><><><><
0 Kudos
Message 10 of 10
(5,317 Views)