LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to run/test application using network streams

Hello,

 

I'm confused on what steps to follow to test an application using the network streams feature. After reading a lot and going through other discussions I found 2 simple VIs on the last post here http://forums.ni.com/t5/LabVIEW/Network-streams-problem-with-cRIO-9022/td-p/1401576 (I attached the VIs, which I modified just a bit) which I believe have been tested before and work so I was trying to do the same in my desktop and it does not work. I get the same scenario when I was trying to test the code I wrote: no bugs, both VIs run but nothing happens.

 

According to the link above this is what is supposed to happen: "a PC hosts a GUI (see mainGUI.VI) that sends an array of doubles to the cRIO via one stream and reads a double value back via another. The cRIO, via the scan interface, reads the array via the first stream and writes an analog value to the host via the second (see mainRT.VI). "

 

The current set up is: 

1. Add both VIs to the blank project with the target device cRIO (see attached screenshot)

2. Deploy mainRT.vi on the cRIO

3. Run both at the same time

 

Am I missing something?

 

Also, I have been reading that there are two ways of testing this. One running both VIs on the PC and the other actually using the targeted device, in this case cRIO. Is that correct?

 

Please help!

Thank you

Download All
0 Kudos
Message 1 of 4
(3,217 Views)

I noticed two things.  First, Main GuiWriter reaches for on a URL //IP/GuiReader (on the cRIO).  On the RIO, RioWriter reaches for a URL on //IP/rioReader (on the Host).  But that means both Main and Rio are on the URL, and they are "cross-connecting" to each other.  If you try to generalize this to different devices, you would need to know the URL of both.  [When I've done this, the Host used the URL of the Remote for all its connections, while the Remote did not specify a URL].

 

A probably More Serious problem is that /IP/rioReader is missing its first "/".  See if that makes a difference ...

 

Bob Schor

0 Kudos
Message 2 of 4
(3,174 Views)

Hi Bob, 

 

Sorry for the late reply. I thought I needed to use two URLs since I was using two streams, but I changed it leaving only the one on the host and it runs but it does not read or write or show any kind of error, it just stays there. I believe I must be doing something wrong with the steps I mentioned before.

 

When do I need to build and/or deploy each VI? To run the application do I have to click run on both VIs at the same time or open the application I built?

 

Thanks!

0 Kudos
Message 3 of 4
(3,128 Views)

Connections have TimeOuts, so you have a little "wiggle room" in deciding which to load first.

 

In my situation, one side is a Remote Real Time system ("Remote"), which has the behavior that when it starts up, it runs the code that I want, which includes establishing the Remote side of the Network Stream.  I make all (four) streams use the Remote as the site whose URL (or IP) I need to know.  I set them up so that if they time out (I think I may use 15 seconds), they simply close the connections and try again, exiting when all four connections are established, and going on to run the rest of the Remote code.

 

On the Host, the expectation is that the code is already running on the Remote.  Accordingly, on the Host side, the Initialization sequence establishes the four connections, all using the IP (URL) of the Remote.  I also use a 15-second timeout, but run it inside a second loop to allow three tries before I give up (and generate an Error Exit).  Otherwise, if all the connections get made, I've got my Network Streams connected and can continue.

 

In this scheme, both the Host and Remote code are in the same Project.  What I typically do is to Build the Remote code, deploy it, and set it to run as the Startup.  If you are not dealing with a Real Time System, you might not have that option.  But you should deploy your Remote code, and start both programs within each other's respective TimeOut windows.  Since in my scheme the Remote Window is infinite, I (automatically) start it first, then start the Host.  I haven't timed it, but I'd guestimate that the connections are established in at most a few tenths of a second.

 

Bob Schor

0 Kudos
Message 4 of 4
(3,103 Views)