LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I programmatically deploy a VI to a target?

I'm building a generic test application for a customer.  We use a configuration (XML) file format that is basically a big cluster of all the things we need, such as an array of channel configuration clusters (name, physical channel, calibration, etc.), an array of filter settings, sample rates, log file names, etc.  The target VI starts and waits for a configuration.  The main VI starts and prompts the user for the test configuration file.  It's loaded in and sent to the target, which initializes all the devices and channels and starts running.  

 

This is all fine a good, but right now the test criteria are hard-coded in the target VI and that ain't good.  The customer wants to be able to specify arbitrary test criteria, which may vary from test to test.  The test criteria could involve averaging, FFT, etc. so I had this crazy idea to use a separate VI to represent the specific test criteria.  The config file would have the file name for the test criteria VI.  The end user would develop the test criteria VI to suit the particular test needs.  Then somehow, the VI would get to the RT PXI target and execute.  I know how to reference the VI on the host and have developed a simple prototype of the concept, but I don't know how to get the VI to the RT target programmatically at run time.

0 Kudos
Message 1 of 12
(4,723 Views)
knicewar,

Here is a KnowledgeBase that explains how to programmatically deploy a VI to a real-time target.  In your application you would probably have to write some data to a file or a shared variable that the user made VI could access.
Regards,

Jon S.
National Instruments
LabVIEW NXG Product Owner
0 Kudos
Message 2 of 12
(4,691 Views)

How will it get all the dependencies?  When I tell it to run, will it fetch the additional VIs it needs?

 

0 Kudos
Message 3 of 12
(4,682 Views)
knicewar,

LabVIEW saves each subVI as a relative path to the main VI. In your application I would save all your subVIs in the same directory and then FTP all the VI's to the same directory.

More information on subVI path information can be found in this KnowledgeBase
Regards,

Jon S.
National Instruments
LabVIEW NXG Product Owner
0 Kudos
Message 4 of 12
(4,662 Views)

knicewar,

 

I wanted to give you a little bit more info about what happens when a program is deployed to a Real-Time Target.  When you deploy a program to an RT target, the program is loaded into memory, not onto the disk of the target.  In your situation you could FTP a VI onto a target in the c:\ni-rt\startup directory.  Then in your main program you can use VI server to launch the VI you FTP'd to the target.

Regards,

Jon S.
National Instruments
LabVIEW NXG Product Owner
0 Kudos
Message 5 of 12
(4,584 Views)

Hmmm....

 

No mention of a configuration file. Did you concider reading the config from a config file? The new config file could be palced where it has to be using FTP when it needs changed.

 

Just trying tohelp,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 6 of 12
(4,580 Views)

Hi Jon,

 

I wasn't aware that deploying a VI doesn't actually send a file.  If that's the case, then I don't care about FTPing the VI over.  All I want to do is deploy a VI (to the RT target) and the VI was specified in a config file that the host VI loaded at run-time.  Am I going about this the wrong way?

 

 

0 Kudos
Message 7 of 12
(4,575 Views)

knicewar,

 

When you deploy a program to an RT target, the currently running program is stopped.  I think in your case your going to want to FTP the user made VI over to the startup folder and use VI Server to call this from the main VI running on the RT target.  

Regards,

Jon S.
National Instruments
LabVIEW NXG Product Owner
0 Kudos
Message 8 of 12
(4,537 Views)

BTW, this seems to work.  I haven't built the full-up app yet but I tried a simple test.  I FTP'd over a VI file then ran a VI on the target that opens this file by reference and calls it.  It works even if the VI calls another VI.  Somehow it figures out the dependencies and does the Right Thing.  I did not have to FTP over the dependencies.  <whew!>

 

0 Kudos
Message 9 of 12
(4,512 Views)

I am trying to view the knowledge base article that you reference as I have the same question.  However, every time I click on the link I get an error message that says you are not authorized to view this article.  I have tried searching the article through MyNI page and though I find a reference to the article in the search I still get the same error.

 

Any idea as to why?

 

Jason

Wire Warrior

Behold the power of LabVIEW as my army of Roomba minions streaks across the floor!
0 Kudos
Message 10 of 12
(4,491 Views)