LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Running RT from Host programmatically

Solved!
Go to solution

Good day,

I will briefly explain my situation:

I have a RT VI that communicates with my Host VI via Network Stream to transfer data. To make sure the Network Stream connection is properly established I start the RT (manually) and then the Host. I would like to just work exclusively from the Host Front Panel meaning I need to start the RT VI in the code of the Host VI.

 

The problem now is the Network Stream connection isn't being established, I assume this is beause the Host is starting before the RT. The thing is I have the code setup so that it doesn't try connecting the Network Stream (to the RT VI) untill the RT hast successfully started running.

 

Does anyone know what I am missing? I have attached the two VI's and a screenshot of the code.

 

Any help is greatly appreciated!

 

Kind regars

Phil

Download All
0 Kudos
Message 1 of 6
(2,819 Views)

I have something similar.  For me it was easy enough to compile the RT application into a binary using the application builder, then deploy it, and set it to run on startup.  I also have code for the network streams to try to continually connect from the host to RT.

 

So the RT application runs on startup, and to get it running I send the reboot command to the RT system.  And then I start my Windows application, which is setup to try to connect to the network streams.  It will keep trying until the RT software is up and running, and then the connection is established.

0 Kudos
Message 2 of 6
(2,786 Views)

To get Network Streams established, you must be running the "Connection Code" on both Host and Target simultaneously.  How you get them both running is up to you.

 

I have mine set up similarly to yours -- the Target routine has an endless "Waiting for Host-initiated Connection" loop, and the Host has a "Try three times and then give up" loop.  During Development (which I am working and making changes to both Host and Target), I often start Target first, as I can be "interrupted" before starting the Host and won't "lose the opportunity to connect".  I'm using (of course) LabVIEW Project, so I "Deploy and Run" the Target from Project.

 

As Hooovahh notes, another way is to build an RT-Executable for the Target and Deploy as Startup..  Now you just turn on the Target, it runs (and waits "forever" for the Host), and you can just concentrate on the Host code.  You may want to have the Target reboot itself on exit, or follow Hooovahh's "equivalent suggestion" to have the Host reboot the Target to "force" the Target into its Startup state.

 

Bob Schor

0 Kudos
Message 3 of 6
(2,752 Views)

Hello Bob, thank you for the quick reply and apologies for my late one.

 

I have attached a screenshot of the VI when I run highlighted execution and as you can see the program seems to be stopping before the Invoke Node, even though when I open the RT.vi the Front Panel indicates that it is running. I posed the question with the Network Stream because I had a feeling (nothing more unfortunately) that the code to start the RT.vi wasn't working because of the Network Stream. I am really not sure why that would be the cuase because the RT.vi waits in the while loop until the Network Stream is established.

 

Kind regards 

Phil

0 Kudos
Message 4 of 6
(2,724 Views)
Solution
Accepted by topic author philck

Hi Phil,

 


@philck wrote:

when I run highlighted execution and as you can see the program seems to be stopping before the Invoke Node,


Do you really think you will start the RTMain.vi on your RT target by calling the invoke node with a path to a VI located on your Windows computer harddrive?

How should the invoke node know it has to execute that VI on the (unspecified) RT target???

 

You should build an RTExe from your RT code and deploy that to your RT target. That RTExe should be set to run at startup and it needs to wait for the host to start the communication! (Basically the same what Bob recommended with references to Hooovahh…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 6
(2,720 Views)

Hello Gerdw

 

That is indeed the problem thank you very much for your help!

 

Kind regards,

Phil

0 Kudos
Message 6 of 6
(2,701 Views)