LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programatically deploy and call a Real Time Application from Host

Hello,

          Im trying to create an application of my real time project, but there are many dependencies, so even when i create a source distribution or a real time application, the application doesnt execute as intended. 

First of all here is what my entire project scenario is: 

1. I have a project with 3 parts

  1.1 A Host application, A module which is the starting point of my application, where the user enters some info and starts executing. This app is internally intended to call the real time application. The real time target is basically a pxi chassis with CAN cards, FPGA I/O's to control power to various ECU's connected.

1.2 Target Application - This is the real time project whch has the behavior of the functions to be executed on the target

1.3 FPGA Application - This is also part of the project, which is compiled for the target. The FPGA application is called by the Target application to control the power to the various ECU's.

 

Requirement/Expectation:

                                         I'm trying to distribute by project to users hence im looking to create an application or an installer (anything works). The intention/expectation is to Launch one Application called HOST.exe from the Host computer. On launching the Host exe, when the user is done with initial configuration, the user would decide to execute the sequence. At this point user clicks on a button in the Host to start executing. Now, i want the target application to be called internally from the Host application (note that the Target application should be deployed and the Target application's GUI/Front panel needs to be visible to the user on the Host computer). The target application should internally call the FPGA executable when required and control the I/O's.

I have attached a screenshot of the project structure. Any help/direction would be greatly appreciated. Pls note that i'm trying to create exe/installer from Labview project explorer using the application builder. I dont have experience/knowledge on Labview RT/FPGA hence please explain be step by step. Thank you!!

 

Regards

Jay 

0 Kudos
Message 1 of 13
(6,349 Views)

I already have a working code in Labview development environment, so inserting the functionality of target main and FPGA is all done. I only need to achieve the same in executable. 

0 Kudos
Message 2 of 13
(6,345 Views)

Hi Ramjay, 

 

I use the exact same method in my projects. Generally I work with cRIOs but it doesn't matter.

 

Deploying VIs to RT controllers programmatically can be easily done by using WebDAV. You can start by looking help menu of "Simple Put", it is very easy to use. If you need help after that, I can prepare an example for you.

 

WebDAV.PNG

 

You can find the part I generally use in my projects below. VI path notation differs in OSs. For example, I used cRIO-9030 in this project and the OS is NI Linux RT. You can find the notations in here. It seem that PXI-8115 uses Phar Lap ETS so you can look notations for Phar Lap in that tutorial. Phar Lap notation is different than NI Linux RT notation. I think you can use C:\ni-rt\startup folder to put your RT Host VI. 

 

After that, you need to use VI server to make the deployed RT host VI run. When you look at the snippet,  you can find the part that you need. Target IP Address key is read from config file. The reason is that the user can change IP address of cRIO in the future.

 

CallRTHostVI.png

 

If you have any further questions, I'm glad to help. 

 

Emre

 

Actor Framework rocks!
Emre TUZUNER
0 Kudos
Message 3 of 13
(6,276 Views)

Ramjay wrote:

Now, i want the target application to be called internally from the Host application (note that the Target application should be deployed and the Target application's GUI/Front panel needs to be visible to the user on the Host computer).


I think you have a misunderstanding of how systems involving RT targets work. When you build/deploy an RT Executable (rtexe), the code will run on the target and will not have a user interface. Your Host VI running on windows will need to communicate between the PC and the RT executable to transfer data / control the target. The fact that you can 'run' a VI on an RT target in the development environment is just for debugging - unless you have an RT target with an embedded UI (or use remote front panels, ugh), the target's front panel will not be visible and will be removed when the rtexe is built.

 

Typically, you would deploy this code once or when an update is needed.

 

If you want to deploy the code to the RT target programmatically, using the RAD tool (replication and deployment), you can create an image of an RT target and deploy that to other targets with the same configuration. The tool is based on the System Configuration API - which is a LabVIEW API that you can use to do the same thing (and the tool is open source so you can pick/choose the bits you want in your application).

 

The other method of manually transferring the RT executable (or a VI) to the target also works - but it will require all of the other dependencies (e.g. shared libraries, software modules) to already be installed/configured on the target.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 4 of 13
(6,264 Views)

Hi Emre,

               Thanks for the information. I have a doubt. As explained by SAM_Sharp, is it possible or is there a way to be able to interact with the target main vi's front panel from the host computer? I've attached a screenshot of the target. What i need is to be able to click those RUN,Stop buttons and be able to see the progress information as well, all from Host computer. I'm able to do all this right now from the development environment. The one that Sam_Sharp mentioned makes sense, but that situation works when an application doesnt need any user interaction. But in my case i need to be able to let the user interact with the target's front panel and the functionalities given there.

 

Regards

Jay

0 Kudos
Message 5 of 13
(6,234 Views)
The way you interact with the targets front panel is through the host VI. You must implement some sort of communications method (e.g. network streams, TCP/IP, network shared variables) to send your 'commands' from the host VI to the target VI.

As I mentioned before, once you 'deploy' the code as an RT executable, it won't have a front panel that you can open.

You should take a look at the CompactRIO Developers Guide - it gives a great overview of how a CompactRIO system operates and also how to implement the communications between the two.

LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 6 of 13
(6,228 Views)

Hi Ramjay, 

 

Of course you can interact with RT target and PC. You can use VI Server to Run or Stop a VI in the RT target.  As I said above, you can use WebDAV VIs to put a file to RT target. Using WebDAV VIs is a piece of cake. You can take a look to WebDAV info.

 

1. Deploy the RT Target VI to controller by using WebDAV VIs. 

2. Run VI server (As I've shown above).

 

If you need to communicate with the target from Windows host, using Network Streams is a good choice as Sam told. I can also help you with that too. 

 

Emre

Actor Framework rocks!
Emre TUZUNER
0 Kudos
Message 7 of 13
(6,217 Views)

Hi,

    I tried creating an RT application and set it up as startup application. Same way i created a host application as well. When i execute the same code from the development environment everything works, whereas when i launch the application, the network stream seems like it doesnt work. Not sure if im doing it right. I've added a snapshot of the host writing and target reading vi's. Also, i want to know how to debug on the target cos i dont know whats going on in the target when i execute the application.

 

RegardsNetwork Stream.png

Jay 

0 Kudos
Message 8 of 13
(6,163 Views)

Ramjay, 

 

Everything seems fine except the data type. There may be a problem with the assigned data type. I don't see well enough from this picture if reader and writer types match with each other. So can you just send a numeric rather than a cluster and set the buffer size to 1? You can change them later. I just wonder the results. 

 

Emre 

Actor Framework rocks!
Emre TUZUNER
0 Kudos
Message 9 of 13
(6,160 Views)

As I mentioned the exact same code works fine when I run both the Vi's from LabVIEW environment, problem is only when I create the application.  The types match for sure so no problem with that.

0 Kudos
Message 10 of 13
(6,151 Views)